1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | 'use strict';
|
8 |
|
9 | Object.defineProperty(exports, '__esModule', { value: true });
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | function makeNull(value) {
|
23 | if (value == null || value === '') {
|
24 | return null;
|
25 | }
|
26 | return value;
|
27 | }
|
28 | function exists(value, allowEmptyString) {
|
29 | if (allowEmptyString === void 0) { allowEmptyString = false; }
|
30 | return value != null && (value !== '' || allowEmptyString);
|
31 | }
|
32 | function missing(value) {
|
33 | return !exists(value);
|
34 | }
|
35 | function missingOrEmpty(value) {
|
36 | return value == null || value.length === 0;
|
37 | }
|
38 | function toStringOrNull(value) {
|
39 | return value != null && typeof value.toString === 'function' ? value.toString() : null;
|
40 | }
|
41 |
|
42 | function attrToNumber(value) {
|
43 | if (value === undefined) {
|
44 |
|
45 | return;
|
46 | }
|
47 | if (value === null || value === '') {
|
48 |
|
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 |
|
58 | function attrToBoolean(value) {
|
59 | if (value === undefined) {
|
60 |
|
61 | return;
|
62 | }
|
63 | if (value === null || value === '') {
|
64 |
|
65 | return false;
|
66 | }
|
67 | if (typeof value === 'boolean') {
|
68 |
|
69 | return value;
|
70 | }
|
71 |
|
72 | return (/true/i).test(value);
|
73 | }
|
74 |
|
75 | function attrToString(value) {
|
76 | if (value == null || value === '') {
|
77 | return;
|
78 | }
|
79 | return value;
|
80 | }
|
81 |
|
82 | function 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 | }
|
94 | function jsonEquals(val1, val2) {
|
95 | var val1Json = val1 ? JSON.stringify(val1) : null;
|
96 | var val2Json = val2 ? JSON.stringify(val2) : null;
|
97 | return val1Json === val2Json;
|
98 | }
|
99 | function defaultComparator(valueA, valueB, accentedCompare) {
|
100 | if (accentedCompare === void 0) { accentedCompare = false; }
|
101 | var valueAMissing = valueA == null;
|
102 | var valueBMissing = valueB == null;
|
103 |
|
104 |
|
105 |
|
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 |
|
132 | return valueA.localeCompare(valueB);
|
133 | }
|
134 | catch (e) {
|
135 |
|
136 |
|
137 | return doQuickCompare(valueA, valueB);
|
138 | }
|
139 | }
|
140 | function 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 |
|
149 | var GenericUtils = 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 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 | var ColumnKeyCreator = (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 |
|
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 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 | function 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 | }
|
227 | function 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 | }
|
237 | function deepCloneObject(object) {
|
238 | return JSON.parse(JSON.stringify(object));
|
239 | }
|
240 |
|
241 |
|
242 |
|
243 |
|
244 | function 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 |
|
256 |
|
257 |
|
258 |
|
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 | }
|
269 | function getProperty(object, key) {
|
270 | return object[key];
|
271 | }
|
272 | function setProperty(object, key, value) {
|
273 | object[key] = value;
|
274 | }
|
275 |
|
276 |
|
277 |
|
278 |
|
279 | function 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 |
|
288 |
|
289 |
|
290 | function 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 | }
|
296 | function 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 | }
|
303 | function 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 | }
|
319 | function 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 |
|
331 |
|
332 |
|
333 |
|
334 | if (makeCopyOfSimpleObjects) {
|
335 | var objectIsDueToBeCopied = destValue == null && sourceValue != null;
|
336 | if (objectIsDueToBeCopied) {
|
337 |
|
338 |
|
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 | }
|
355 | function missingOrEmptyObject(value) {
|
356 | return missing(value) || Object.keys(value).length === 0;
|
357 | }
|
358 | function 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 | }
|
373 | function 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 | }
|
387 | function 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 | }
|
396 | function getValueUsingField(data, field, fieldContainsDots) {
|
397 | if (!field || !data) {
|
398 | return;
|
399 | }
|
400 |
|
401 | if (!fieldContainsDots) {
|
402 | return data[field];
|
403 | }
|
404 |
|
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 |
|
416 |
|
417 | function removeAllReferences(obj, objectName) {
|
418 | Object.keys(obj).forEach(function (key) {
|
419 | var value = obj[key];
|
420 |
|
421 |
|
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 |
|
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 | }
|
440 | function isNonNullObject(value) {
|
441 | return typeof value === 'object' && value !== null;
|
442 | }
|
443 |
|
444 | var ObjectUtils = 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 | */
|
471 | var FUNCTION_STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
|
472 | var FUNCTION_ARGUMENT_NAMES = /([^\s,]+)/g;
|
473 | var doOnceFlags = {};
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 | function doOnce(func, key) {
|
480 | if (doOnceFlags[key]) {
|
481 | return;
|
482 | }
|
483 | func();
|
484 | doOnceFlags[key] = true;
|
485 | }
|
486 | function getFunctionName(funcConstructor) {
|
487 |
|
488 | if (funcConstructor.name) {
|
489 | return funcConstructor.name;
|
490 | }
|
491 |
|
492 | var matches = /function\s+([^\(]+)/.exec(funcConstructor.toString());
|
493 | return matches && matches.length === 2 ? matches[1].trim() : null;
|
494 | }
|
495 |
|
496 | function 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 | }
|
500 | function isFunction(val) {
|
501 | return !!(val && val.constructor && val.call && val.apply);
|
502 | }
|
503 | function executeInAWhile(funcs) {
|
504 | executeAfter(funcs, 400);
|
505 | }
|
506 | var executeNextVMTurnFuncs = [];
|
507 | var executeNextVMTurnPending = false;
|
508 | function 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 | }
|
521 | function 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 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 | function debounce(func, wait, immediate) {
|
535 | if (immediate === void 0) { immediate = false; }
|
536 |
|
537 |
|
538 |
|
539 | var timeout;
|
540 |
|
541 | return function () {
|
542 | var args = [];
|
543 | for (var _i = 0; _i < arguments.length; _i++) {
|
544 | args[_i] = arguments[_i];
|
545 | }
|
546 |
|
547 | var context = this;
|
548 |
|
549 |
|
550 | var callNow = immediate && !timeout;
|
551 |
|
552 |
|
553 |
|
554 |
|
555 | window.clearTimeout(timeout);
|
556 |
|
557 | timeout = window.setTimeout(function () {
|
558 |
|
559 |
|
560 | timeout = null;
|
561 |
|
562 | if (!immediate) {
|
563 |
|
564 |
|
565 |
|
566 | func.apply(context, args);
|
567 | }
|
568 | }, wait);
|
569 |
|
570 | if (callNow) {
|
571 | func.apply(context, args);
|
572 | }
|
573 | };
|
574 | }
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 | function 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 | }
|
596 | function 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 | }
|
620 | function 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 | }
|
627 | function callIfPresent(func) {
|
628 | if (func) {
|
629 | func();
|
630 | }
|
631 | }
|
632 |
|
633 | var FunctionUtils = 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 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 | var Context = (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 |
|
684 |
|
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 |
|
693 | this.contextParams.beanClasses.forEach(this.createBeanWrapper.bind(this));
|
694 |
|
695 |
|
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 |
|
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 |
|
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 |
|
813 | var allMethods = {};
|
814 |
|
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 |
|
856 | var beanAny = bean;
|
857 | if (typeof beanAny.destroy === 'function') {
|
858 | beanAny.destroy();
|
859 | }
|
860 | });
|
861 | return [];
|
862 | };
|
863 | return Context;
|
864 | }());
|
865 |
|
866 |
|
867 | function applyToConstructor(constructor, argArray) {
|
868 | var args = [null].concat(argArray);
|
869 | var factoryFunction = constructor.bind.apply(constructor, args);
|
870 | return new factoryFunction();
|
871 | }
|
872 | function PreConstruct(target, methodName, descriptor) {
|
873 | var props = getOrCreateProps(target.constructor);
|
874 | if (!props.preConstructMethods) {
|
875 | props.preConstructMethods = [];
|
876 | }
|
877 | props.preConstructMethods.push(methodName);
|
878 | }
|
879 | function PostConstruct(target, methodName, descriptor) {
|
880 | var props = getOrCreateProps(target.constructor);
|
881 | if (!props.postConstructMethods) {
|
882 | props.postConstructMethods = [];
|
883 | }
|
884 | props.postConstructMethods.push(methodName);
|
885 | }
|
886 | function PreDestroy(target, methodName, descriptor) {
|
887 | var props = getOrCreateProps(target.constructor);
|
888 | if (!props.preDestroyMethods) {
|
889 | props.preDestroyMethods = [];
|
890 | }
|
891 | props.preDestroyMethods.push(methodName);
|
892 | }
|
893 | function Bean(beanName) {
|
894 | return function (classConstructor) {
|
895 | var props = getOrCreateProps(classConstructor);
|
896 | props.beanName = beanName;
|
897 | };
|
898 | }
|
899 | function Autowired(name) {
|
900 | return function (target, propertyKey, descriptor) {
|
901 | autowiredFunc(target, name, false, target, propertyKey, null);
|
902 | };
|
903 | }
|
904 | function Optional(name) {
|
905 | return function (target, propertyKey, descriptor) {
|
906 | autowiredFunc(target, name, true, target, propertyKey, null);
|
907 | };
|
908 | }
|
909 | function 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 |
|
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 | }
|
929 | function 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 |
|
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 | }
|
954 | function getOrCreateProps(target) {
|
955 | if (!target.hasOwnProperty("__agBeanMetaData")) {
|
956 | target.__agBeanMetaData = {};
|
957 | }
|
958 | return target.__agBeanMetaData;
|
959 | }
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 | var __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 | };
|
973 | var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
974 | return function (target, key) { decorator(target, key, paramIndex); }
|
975 | };
|
976 | var EventService = (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 |
|
985 | this.firedEvents = {};
|
986 | }
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
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 |
|
1008 |
|
1009 |
|
1010 |
|
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 |
|
1081 |
|
1082 |
|
1083 |
|
1084 | EventService.prototype.dispatchAsync = function (func) {
|
1085 |
|
1086 | this.asyncFunctionsQueue.push(func);
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 | if (!this.scheduled) {
|
1092 |
|
1093 | window.setTimeout(this.flushAsyncQueue.bind(this), 0);
|
1094 |
|
1095 | this.scheduled = true;
|
1096 | }
|
1097 | };
|
1098 |
|
1099 | EventService.prototype.flushAsyncQueue = function () {
|
1100 | this.scheduled = false;
|
1101 |
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 | var queueCopy = this.asyncFunctionsQueue.slice();
|
1107 | this.asyncFunctionsQueue = [];
|
1108 |
|
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 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 | var Constants = (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 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 | (function (ModuleNames) {
|
1169 |
|
1170 | ModuleNames["CommunityCoreModule"] = "@ag-grid-community/core";
|
1171 |
|
1172 | ModuleNames["CommunityAllModules"] = "@ag-grid-community/all";
|
1173 |
|
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 |
|
1178 | ModuleNames["EnterpriseCoreModule"] = "@ag-grid-enterprise/core";
|
1179 |
|
1180 | ModuleNames["EnterpriseAllModules"] = "@ag-grid-enterprise/all";
|
1181 |
|
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 |
|
1200 |
|
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 |
|
1206 |
|
1207 |
|
1208 | })(exports.ModuleNames || (exports.ModuleNames = {}));
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 | var ModuleRegistry = (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 |
|
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 |
|
1269 | ModuleRegistry.modulesMap = {};
|
1270 | return ModuleRegistry;
|
1271 | }());
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 | var __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 | };
|
1285 | var instanceIdSequence = 0;
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 | var Column = (function () {
|
1293 | function Column(colDef, userProvidedColDef, colId, primary) {
|
1294 |
|
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 |
|
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 |
|
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 |
|
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 |
|
1347 | if (colDef.pinned !== undefined) {
|
1348 | this.setPinned(colDef.pinned);
|
1349 | }
|
1350 | else {
|
1351 | this.setPinned(colDef.initialPinned);
|
1352 | }
|
1353 |
|
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 |
|
1364 | Column.prototype.setColDef = function (colDef, userProvidedColDef) {
|
1365 | this.colDef = colDef;
|
1366 | this.userProvidedColDef = userProvidedColDef;
|
1367 | this.initMinAndMaxWidths();
|
1368 | this.initDotNotation();
|
1369 | };
|
1370 | |
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 | Column.prototype.getUserProvidedColDef = function () {
|
1376 | return this.userProvidedColDef;
|
1377 | };
|
1378 | Column.prototype.setParent = function (parent) {
|
1379 | this.parent = parent;
|
1380 | };
|
1381 |
|
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 |
|
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 |
|
1425 | Column.prototype.isPrimary = function () {
|
1426 | return this.primary;
|
1427 | };
|
1428 |
|
1429 | Column.prototype.isFilterAllowed = function () {
|
1430 |
|
1431 |
|
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 |
|
1502 | Column.prototype.addEventListener = function (eventType, listener) {
|
1503 | this.eventService.addEventListener(eventType, listener);
|
1504 | };
|
1505 |
|
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 |
|
1522 | if (typeof this.colDef.suppressNavigable === 'boolean') {
|
1523 | return this.colDef.suppressNavigable;
|
1524 | }
|
1525 |
|
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 |
|
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 |
|
1563 | if (typeof value === 'boolean') {
|
1564 | return value;
|
1565 | }
|
1566 |
|
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 |
|
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 |
|
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 |
|
1656 | Column.prototype.isFilterActive = function () {
|
1657 | return this.filterActive;
|
1658 | };
|
1659 |
|
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 | |
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 | Column.prototype.getColDef = function () {
|
1732 | return this.colDef;
|
1733 | };
|
1734 | Column.prototype.getColumnGroupShow = function () {
|
1735 | return this.colDef.columnGroupShow;
|
1736 | };
|
1737 | |
1738 |
|
1739 |
|
1740 |
|
1741 | Column.prototype.getColId = function () {
|
1742 | return this.colId;
|
1743 | };
|
1744 | |
1745 |
|
1746 |
|
1747 |
|
1748 | Column.prototype.getId = function () {
|
1749 | return this.getColId();
|
1750 | };
|
1751 | |
1752 |
|
1753 |
|
1754 |
|
1755 | Column.prototype.getUniqueId = function () {
|
1756 | return this.getId();
|
1757 | };
|
1758 | Column.prototype.getDefinition = function () {
|
1759 | return this.colDef;
|
1760 | };
|
1761 |
|
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 |
|
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 |
|
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 |
|
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 |
|
1834 |
|
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 |
|
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 |
|
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 |
|
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 |
|
1902 |
|
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 |
|
1908 |
|
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 |
|
1914 |
|
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 |
|
1920 | Column.EVENT_MOVING_CHANGED = 'movingChanged';
|
1921 |
|
1922 | Column.EVENT_LEFT_CHANGED = 'leftChanged';
|
1923 |
|
1924 | Column.EVENT_WIDTH_CHANGED = 'widthChanged';
|
1925 |
|
1926 | Column.EVENT_LAST_LEFT_PINNED_CHANGED = 'lastLeftPinnedChanged';
|
1927 | Column.EVENT_FIRST_RIGHT_PINNED_CHANGED = 'firstRightPinnedChanged';
|
1928 |
|
1929 | Column.EVENT_VISIBLE_CHANGED = 'visibleChanged';
|
1930 |
|
1931 | Column.EVENT_FILTER_CHANGED = 'filterChanged';
|
1932 |
|
1933 | Column.EVENT_FILTER_ACTIVE_CHANGED = 'filterActiveChanged';
|
1934 |
|
1935 | Column.EVENT_SORT_CHANGED = 'sortChanged';
|
1936 | Column.EVENT_MENU_VISIBLE_CHANGED = 'menuVisibleChanged';
|
1937 |
|
1938 | Column.EVENT_ROW_GROUP_CHANGED = 'columnRowGroupChanged';
|
1939 |
|
1940 | Column.EVENT_PIVOT_CHANGED = 'columnPivotChanged';
|
1941 |
|
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 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 | function 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 | }
|
1983 | function existsAndNotEmpty(value) {
|
1984 | return value != null && value.length > 0;
|
1985 | }
|
1986 | function last(arr) {
|
1987 | if (!arr || !arr.length) {
|
1988 | return;
|
1989 | }
|
1990 | return arr[arr.length - 1];
|
1991 | }
|
1992 | function 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 |
|
2002 | function compareArrays(array1, array2) {
|
2003 | return areEqual(array1, array2);
|
2004 | }
|
2005 |
|
2006 | function shallowCompare(arr1, arr2) {
|
2007 | return areEqual(arr1, arr2);
|
2008 | }
|
2009 | function sortNumerically(array) {
|
2010 | return array.sort(function (a, b) { return a - b; });
|
2011 | }
|
2012 | function 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 | }
|
2024 | function removeFromArray(array, object) {
|
2025 | var index = array.indexOf(object);
|
2026 | if (index >= 0) {
|
2027 | array.splice(index, 1);
|
2028 | }
|
2029 | }
|
2030 | function removeAllFromArray(array, toRemove) {
|
2031 | toRemove.forEach(function (item) { return removeFromArray(array, item); });
|
2032 | }
|
2033 | function insertIntoArray(array, object, toIndex) {
|
2034 | array.splice(toIndex, 0, object);
|
2035 | }
|
2036 | function insertArrayIntoArray(dest, src, toIndex) {
|
2037 | if (dest == null || src == null) {
|
2038 | return;
|
2039 | }
|
2040 |
|
2041 | for (var i = src.length - 1; i >= 0; i--) {
|
2042 | var item = src[i];
|
2043 | insertIntoArray(dest, item, toIndex);
|
2044 | }
|
2045 | }
|
2046 | function moveInArray(array, objectsToMove, toIndex) {
|
2047 |
|
2048 | removeAllFromArray(array, objectsToMove);
|
2049 |
|
2050 |
|
2051 | objectsToMove.slice().reverse().forEach(function (obj) { return insertIntoArray(array, obj, toIndex); });
|
2052 | }
|
2053 | function includes(array, value) {
|
2054 | return array.indexOf(value) > -1;
|
2055 | }
|
2056 | function flatten(arrayOfArrays) {
|
2057 | return [].concat.apply([], arrayOfArrays);
|
2058 | }
|
2059 | function pushAll(target, source) {
|
2060 | if (source == null || target == null) {
|
2061 | return;
|
2062 | }
|
2063 | source.forEach(function (value) { return target.push(value); });
|
2064 | }
|
2065 | function toStrings(array) {
|
2066 | return array.map(toStringOrNull);
|
2067 | }
|
2068 | function 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 |
|
2077 | var ArrayUtils = 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 |
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 | var __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 | };
|
2110 | var ColumnGroup = (function () {
|
2111 | function ColumnGroup(providedColumnGroup, groupId, instanceId, pinned) {
|
2112 |
|
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 |
|
2121 | ColumnGroup.createUniqueId = function (groupId, instanceId) {
|
2122 | return groupId + '_' + instanceId;
|
2123 | };
|
2124 |
|
2125 |
|
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 |
|
2152 | this.displayedChildren.forEach(function (child) {
|
2153 | if (child instanceof ColumnGroup) {
|
2154 | child.checkLeft();
|
2155 | }
|
2156 | });
|
2157 |
|
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 |
|
2171 |
|
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 |
|
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 |
|
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 |
|
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 |
|
2331 | this.displayedChildren = [];
|
2332 |
|
2333 |
|
2334 | var parentWithExpansion = this;
|
2335 | while (parentWithExpansion != null && parentWithExpansion.isPadding()) {
|
2336 | parentWithExpansion = parentWithExpansion.getParent();
|
2337 | }
|
2338 | var isExpandable = parentWithExpansion ? parentWithExpansion.providedColumnGroup.isExpandable() : false;
|
2339 |
|
2340 | if (!isExpandable) {
|
2341 | this.displayedChildren = this.children;
|
2342 | this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED));
|
2343 | return;
|
2344 | }
|
2345 |
|
2346 |
|
2347 |
|
2348 | this.children.forEach(function (child) {
|
2349 |
|
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 |
|
2358 | if (parentWithExpansion.providedColumnGroup.isExpanded()) {
|
2359 | _this.displayedChildren.push(child);
|
2360 | }
|
2361 | break;
|
2362 | case ColumnGroup.HEADER_GROUP_SHOW_CLOSED:
|
2363 |
|
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 |
|
2387 |
|
2388 |
|
2389 |
|
2390 |
|
2391 | var ProvidedColumnGroup = (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 |
|
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 |
|
2474 |
|
2475 | ProvidedColumnGroup.prototype.setupExpandable = function () {
|
2476 | var _this = this;
|
2477 | this.setExpandable();
|
2478 |
|
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 |
|
2486 | var atLeastOneShowingWhenOpen = false;
|
2487 |
|
2488 | var atLeastOneShowingWhenClosed = false;
|
2489 |
|
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 |
|
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 |
|
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 |
|
2554 |
|
2555 |
|
2556 |
|
2557 |
|
2558 | var 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 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 | var AG_GRID_STOP_PROPAGATION = '__ag_Grid_Stop_Propagation';
|
2576 | var PASSIVE_EVENTS = ['touchstart', 'touchend', 'touchmove', 'touchcancel'];
|
2577 | var supports = {};
|
2578 |
|
2579 |
|
2580 |
|
2581 |
|
2582 |
|
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 | function stopPropagationForAgGrid(event) {
|
2588 | event[AG_GRID_STOP_PROPAGATION] = true;
|
2589 | }
|
2590 | function isStopPropagationForAgGrid(event) {
|
2591 | return event[AG_GRID_STOP_PROPAGATION] === true;
|
2592 | }
|
2593 | var 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 | })();
|
2613 | function 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 |
|
2626 |
|
2627 |
|
2628 |
|
2629 |
|
2630 | function addChangeListener(element, listener) {
|
2631 | element.addEventListener('changed', listener);
|
2632 | element.addEventListener('paste', listener);
|
2633 | element.addEventListener('input', listener);
|
2634 | }
|
2635 | function isElementInEventPath(element, event) {
|
2636 | if (!event || !element) {
|
2637 | return false;
|
2638 | }
|
2639 | return getEventPath(event).indexOf(element) >= 0;
|
2640 | }
|
2641 | function 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 |
|
2652 |
|
2653 |
|
2654 |
|
2655 |
|
2656 |
|
2657 | function addAgGridEventPath(event) {
|
2658 | event.__agGridEventPath = getEventPath(event);
|
2659 | }
|
2660 |
|
2661 |
|
2662 |
|
2663 |
|
2664 |
|
2665 |
|
2666 |
|
2667 | function getEventPath(event) {
|
2668 | var eventNoType = event;
|
2669 | if (eventNoType.path) {
|
2670 |
|
2671 | return eventNoType.path;
|
2672 | }
|
2673 | if (eventNoType.composedPath) {
|
2674 |
|
2675 | return eventNoType.composedPath();
|
2676 | }
|
2677 | if (eventNoType.__agGridEventPath) {
|
2678 |
|
2679 | return eventNoType.__agGridEventPath;
|
2680 | }
|
2681 |
|
2682 |
|
2683 | return createEventPath(event);
|
2684 | }
|
2685 | function addSafePassiveEventListener(frameworkOverrides, eElement, event, listener) {
|
2686 | var isPassive = includes(PASSIVE_EVENTS, event);
|
2687 | var options = isPassive ? { passive: true } : undefined;
|
2688 |
|
2689 |
|
2690 | if (frameworkOverrides && frameworkOverrides.addEventListener) {
|
2691 | frameworkOverrides.addEventListener(eElement, event, listener, options);
|
2692 | }
|
2693 | }
|
2694 |
|
2695 | var EventUtils = 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 |
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 | var __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 | };
|
2720 | var BeanStub = (function () {
|
2721 | function BeanStub() {
|
2722 | var _this = this;
|
2723 | this.destroyFunctions = [];
|
2724 | this.destroyed = false;
|
2725 |
|
2726 |
|
2727 | this.__v_skip = true;
|
2728 | this.isAlive = function () { return !_this.destroyed; };
|
2729 | }
|
2730 |
|
2731 |
|
2732 |
|
2733 |
|
2734 |
|
2735 |
|
2736 |
|
2737 |
|
2738 |
|
2739 |
|
2740 |
|
2741 |
|
2742 |
|
2743 |
|
2744 |
|
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 |
|
2753 |
|
2754 |
|
2755 |
|
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 |
|
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 |
|
2848 |
|
2849 |
|
2850 |
|
2851 |
|
2852 | var __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 | })();
|
2865 | var __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 | };
|
2871 | var __param$1 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
2872 | return function (target, key) { decorator(target, key, paramIndex); }
|
2873 | };
|
2874 |
|
2875 | var ColumnFactory = (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 |
|
2885 |
|
2886 |
|
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 |
|
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 |
|
2900 |
|
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 |
|
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 |
|
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 |
|
2958 |
|
2959 | for (var i = 0; i < unbalancedTree.length; i++) {
|
2960 | var child = unbalancedTree[i];
|
2961 | if (child instanceof ProvidedColumnGroup) {
|
2962 |
|
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 |
|
2970 | var firstPaddedGroup = void 0;
|
2971 | var currentPaddedGroup = void 0;
|
2972 |
|
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 |
|
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 |
|
3036 |
|
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 |
|
3058 | var column = this.findExistingColumn(colDef, existingColsCopy);
|
3059 |
|
3060 |
|
3061 | if (existingColsCopy && column) {
|
3062 | removeFromArray(existingColsCopy, column);
|
3063 | }
|
3064 | if (!column) {
|
3065 |
|
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 |
|
3078 | var flex = attrToNumber(colDef.flex);
|
3079 | if (flex !== undefined) {
|
3080 | column.setFlex(flex);
|
3081 | }
|
3082 |
|
3083 | var noFlexThisCol = column.getFlex() <= 0;
|
3084 | if (noFlexThisCol) {
|
3085 |
|
3086 | var width = attrToNumber(colDef.width);
|
3087 | if (width != null) {
|
3088 | column.setActualWidth(width);
|
3089 | }
|
3090 | else {
|
3091 |
|
3092 |
|
3093 | var widthBeforeUpdate = column.getActualWidth();
|
3094 | column.setActualWidth(widthBeforeUpdate);
|
3095 | }
|
3096 | }
|
3097 |
|
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 |
|
3107 | var sortIndex = attrToNumber(colDef.sortIndex);
|
3108 | if (sortIndex !== undefined) {
|
3109 | column.setSortIndex(sortIndex);
|
3110 | }
|
3111 |
|
3112 | var hide = attrToBoolean(colDef.hide);
|
3113 | if (hide !== undefined) {
|
3114 | column.setVisible(!hide);
|
3115 | }
|
3116 |
|
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 |
|
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 |
|
3157 | var colDefMerged = {};
|
3158 |
|
3159 | var defaultColDef = this.gridOptionsWrapper.getDefaultColDef();
|
3160 | mergeDeep(colDefMerged, defaultColDef, false, true);
|
3161 |
|
3162 | var columnType = colDef.type;
|
3163 | if (!columnType) {
|
3164 | columnType = defaultColDef && defaultColDef.type;
|
3165 | }
|
3166 |
|
3167 | if (columnType) {
|
3168 | this.assignColumnTypes(columnType, colDefMerged);
|
3169 | }
|
3170 |
|
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 |
|
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;
|
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 |
|
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 |
|
3258 |
|
3259 |
|
3260 |
|
3261 |
|
3262 | var Events = (function () {
|
3263 | function Events() {
|
3264 | }
|
3265 |
|
3266 |
|
3267 | Events.EVENT_COLUMN_EVERYTHING_CHANGED = 'columnEverythingChanged';
|
3268 |
|
3269 | Events.EVENT_NEW_COLUMNS_LOADED = 'newColumnsLoaded';
|
3270 |
|
3271 | Events.EVENT_COLUMN_PIVOT_MODE_CHANGED = 'columnPivotModeChanged';
|
3272 |
|
3273 | Events.EVENT_COLUMN_ROW_GROUP_CHANGED = 'columnRowGroupChanged';
|
3274 |
|
3275 | Events.EVENT_EXPAND_COLLAPSE_ALL = 'expandOrCollapseAll';
|
3276 |
|
3277 | Events.EVENT_COLUMN_PIVOT_CHANGED = 'columnPivotChanged';
|
3278 |
|
3279 | Events.EVENT_GRID_COLUMNS_CHANGED = 'gridColumnsChanged';
|
3280 |
|
3281 | Events.EVENT_COLUMN_VALUE_CHANGED = 'columnValueChanged';
|
3282 |
|
3283 | Events.EVENT_COLUMN_MOVED = 'columnMoved';
|
3284 |
|
3285 | Events.EVENT_COLUMN_VISIBLE = 'columnVisible';
|
3286 |
|
3287 | Events.EVENT_COLUMN_PINNED = 'columnPinned';
|
3288 |
|
3289 | Events.EVENT_COLUMN_GROUP_OPENED = 'columnGroupOpened';
|
3290 |
|
3291 | Events.EVENT_COLUMN_RESIZED = 'columnResized';
|
3292 |
|
3293 | Events.EVENT_DISPLAYED_COLUMNS_CHANGED = 'displayedColumnsChanged';
|
3294 |
|
3295 | Events.EVENT_VIRTUAL_COLUMNS_CHANGED = 'virtualColumnsChanged';
|
3296 |
|
3297 | Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED = 'asyncTransactionsFlushed';
|
3298 |
|
3299 | Events.EVENT_ROW_GROUP_OPENED = 'rowGroupOpened';
|
3300 |
|
3301 | Events.EVENT_ROW_DATA_CHANGED = 'rowDataChanged';
|
3302 |
|
3303 | Events.EVENT_ROW_DATA_UPDATED = 'rowDataUpdated';
|
3304 |
|
3305 | Events.EVENT_PINNED_ROW_DATA_CHANGED = 'pinnedRowDataChanged';
|
3306 |
|
3307 | Events.EVENT_RANGE_SELECTION_CHANGED = 'rangeSelectionChanged';
|
3308 |
|
3309 | Events.EVENT_CHART_CREATED = 'chartCreated';
|
3310 |
|
3311 | Events.EVENT_CHART_RANGE_SELECTION_CHANGED = 'chartRangeSelectionChanged';
|
3312 |
|
3313 | Events.EVENT_CHART_OPTIONS_CHANGED = 'chartOptionsChanged';
|
3314 |
|
3315 | Events.EVENT_CHART_DESTROYED = 'chartDestroyed';
|
3316 |
|
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 |
|
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 |
|
3342 | Events.EVENT_FILTER_CHANGED = 'filterChanged';
|
3343 |
|
3344 | Events.EVENT_FILTER_MODIFIED = 'filterModified';
|
3345 | Events.EVENT_FILTER_OPENED = 'filterOpened';
|
3346 | Events.EVENT_SORT_CHANGED = 'sortChanged';
|
3347 |
|
3348 | Events.EVENT_VIRTUAL_ROW_REMOVED = 'virtualRowRemoved';
|
3349 | Events.EVENT_ROW_CLICKED = 'rowClicked';
|
3350 | Events.EVENT_ROW_DOUBLE_CLICKED = 'rowDoubleClicked';
|
3351 |
|
3352 | Events.EVENT_GRID_READY = 'gridReady';
|
3353 | |
3354 |
|
3355 | Events.EVENT_GRID_SIZE_CHANGED = 'gridSizeChanged';
|
3356 |
|
3357 | Events.EVENT_VIEWPORT_CHANGED = 'viewportChanged';
|
3358 |
|
3359 | Events.EVENT_SCROLLBAR_WIDTH_CHANGED = 'scrollbarWidthChanged';
|
3360 |
|
3361 | Events.EVENT_FIRST_DATA_RENDERED = 'firstDataRendered';
|
3362 |
|
3363 | Events.EVENT_DRAG_STARTED = 'dragStarted';
|
3364 |
|
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 |
|
3372 | Events.EVENT_BODY_SCROLL = 'bodyScroll';
|
3373 |
|
3374 | Events.EVENT_BODY_SCROLL_END = 'bodyScrollEnd';
|
3375 | Events.EVENT_HEIGHT_SCALE_CHANGED = 'heightScaleChanged';
|
3376 | |
3377 |
|
3378 | Events.EVENT_PAGINATION_CHANGED = 'paginationChanged';
|
3379 | |
3380 |
|
3381 |
|
3382 | Events.EVENT_COMPONENT_STATE_CHANGED = 'componentStateChanged';
|
3383 |
|
3384 |
|
3385 |
|
3386 |
|
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 |
|
3402 | Events.EVENT_POPUP_TO_FRONT = 'popupToFront';
|
3403 |
|
3404 |
|
3405 |
|
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 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 |
|
3429 |
|
3430 |
|
3431 |
|
3432 | var GroupInstanceIdCreator = (function () {
|
3433 | function GroupInstanceIdCreator() {
|
3434 |
|
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 |
|
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 |
|
3455 |
|
3456 |
|
3457 |
|
3458 |
|
3459 | var reUnescapedHtml = /[&<>"']/g;
|
3460 |
|
3461 |
|
3462 |
|
3463 | var HTML_ESCAPES = {
|
3464 | '&': '&',
|
3465 | '<': '<',
|
3466 | '>': '>',
|
3467 | '"': '"',
|
3468 | "'": '''
|
3469 | };
|
3470 |
|
3471 |
|
3472 |
|
3473 |
|
3474 |
|
3475 |
|
3476 | function 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 |
|
3491 | extra = string.charCodeAt(counter++);
|
3492 | if ((extra & 0xFC00) == 0xDC00) {
|
3493 | output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
3494 | }
|
3495 | else {
|
3496 |
|
3497 |
|
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) {
|
3524 | return stringFromCharCode(point);
|
3525 | }
|
3526 | var symbol = '';
|
3527 | if ((point & 0xFFFFF800) == 0) {
|
3528 | symbol = stringFromCharCode(((point >> 6) & 0x1F) | 0xC0);
|
3529 | }
|
3530 | else if ((point & 0xFFFF0000) == 0) {
|
3531 | checkScalarValue(point);
|
3532 | symbol = stringFromCharCode(((point >> 12) & 0x0F) | 0xE0);
|
3533 | symbol += createByte(point, 6);
|
3534 | }
|
3535 | else if ((point & 0xFFE00000) == 0) {
|
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 |
|
3556 |
|
3557 |
|
3558 |
|
3559 |
|
3560 | function 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 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 | function 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 | }
|
3578 | function capitalise(str) {
|
3579 | return str[0].toUpperCase() + str.substr(1).toLowerCase();
|
3580 | }
|
3581 | function escapeString(toEscape) {
|
3582 |
|
3583 |
|
3584 |
|
3585 | return toEscape == null ? null : toEscape.toString().toString().replace(reUnescapedHtml, function (chr) { return HTML_ESCAPES[chr]; });
|
3586 | }
|
3587 |
|
3588 |
|
3589 |
|
3590 |
|
3591 |
|
3592 |
|
3593 | function 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 |
|
3602 | var StringUtils = 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 |
|
3613 |
|
3614 |
|
3615 |
|
3616 |
|
3617 | function convertToMap(arr) {
|
3618 | var map = new Map();
|
3619 | arr.forEach(function (pair) { return map.set(pair[0], pair[1]); });
|
3620 | return map;
|
3621 | }
|
3622 |
|
3623 | function mapById(arr, callback) {
|
3624 | var map = new Map();
|
3625 | arr.forEach(function (item) { return map.set(callback(item), item); });
|
3626 | return map;
|
3627 | }
|
3628 | function keys(map) {
|
3629 | var arr = [];
|
3630 | map.forEach(function (_, key) { return arr.push(key); });
|
3631 | return arr;
|
3632 | }
|
3633 |
|
3634 | var MapUtils = Object.freeze({
|
3635 | convertToMap: convertToMap,
|
3636 | mapById: mapById,
|
3637 | keys: keys
|
3638 | });
|
3639 |
|
3640 |
|
3641 |
|
3642 |
|
3643 |
|
3644 |
|
3645 |
|
3646 | var __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 | })();
|
3659 | var __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 | };
|
3665 | var __param$2 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
3666 | return function (target, key) { decorator(target, key, paramIndex); }
|
3667 | };
|
3668 | var __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 | };
|
3679 | var __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 | };
|
3695 | var __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 | };
|
3699 | var ColumnModel = (function (_super) {
|
3700 | __extends$1(ColumnModel, _super);
|
3701 | function ColumnModel() {
|
3702 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
3703 |
|
3704 | _this.primaryHeaderRowCount = 0;
|
3705 | _this.secondaryHeaderRowCount = 0;
|
3706 |
|
3707 | _this.gridHeaderRowCount = 0;
|
3708 |
|
3709 | _this.displayedColumnsLeft = [];
|
3710 | _this.displayedColumnsRight = [];
|
3711 | _this.displayedColumnsCenter = [];
|
3712 |
|
3713 | _this.displayedColumns = [];
|
3714 |
|
3715 | _this.displayedColumnsAndGroupsMap = {};
|
3716 |
|
3717 | _this.viewportColumns = [];
|
3718 |
|
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 |
|
3755 |
|
3756 | this.colDefVersion++;
|
3757 |
|
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 |
|
3775 | var raiseEventsFunc = colsPreviouslyExisted ? this.compareColumnStatesAndRaiseEvents(source) : undefined;
|
3776 |
|
3777 |
|
3778 | this.valueCache.expire();
|
3779 |
|
3780 |
|
3781 |
|
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 |
|
3796 |
|
3797 |
|
3798 |
|
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 |
|
3810 |
|
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 |
|
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 |
|
3844 |
|
3845 | var indexAPresent = primaryIndexA >= 0;
|
3846 | var indexBPresent = primaryIndexB >= 0;
|
3847 | if (indexAPresent && indexBPresent) {
|
3848 | return primaryIndexA - primaryIndexB;
|
3849 | }
|
3850 | if (indexAPresent) {
|
3851 |
|
3852 | return 1;
|
3853 | }
|
3854 | if (indexBPresent) {
|
3855 |
|
3856 | return -1;
|
3857 | }
|
3858 |
|
3859 |
|
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 |
|
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 |
|
3889 |
|
3890 |
|
3891 | ColumnModel.prototype.checkViewportColumns = function () {
|
3892 |
|
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 |
|
3913 |
|
3914 |
|
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 |
|
3939 |
|
3940 |
|
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 |
|
3991 |
|
3992 |
|
3993 |
|
3994 |
|
3995 |
|
3996 |
|
3997 |
|
3998 |
|
3999 |
|
4000 | this.animationFrameService.flushAllFrames();
|
4001 |
|
4002 | var columnsAutosized = [];
|
4003 |
|
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 |
|
4011 | if (columnsAutosized.indexOf(column) >= 0) {
|
4012 | return false;
|
4013 | }
|
4014 |
|
4015 | var preferredWidth = _this.autoWidthCalculator.getPreferredWidthForColumn(column, shouldSkipHeader);
|
4016 |
|
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 |
|
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 |
|
4132 | ColumnModel.prototype.getPrimaryColumnTree = function () {
|
4133 | return this.primaryColumnTree;
|
4134 | };
|
4135 |
|
4136 | ColumnModel.prototype.getHeaderRowCount = function () {
|
4137 | return this.gridHeaderRowCount;
|
4138 | };
|
4139 |
|
4140 | ColumnModel.prototype.getDisplayedTreeLeft = function () {
|
4141 | return this.displayedTreeLeft;
|
4142 | };
|
4143 |
|
4144 | ColumnModel.prototype.getDisplayedTreeRight = function () {
|
4145 | return this.displayedTreeRight;
|
4146 | };
|
4147 |
|
4148 | ColumnModel.prototype.getDisplayedTreeCentre = function () {
|
4149 | return this.displayedTreeCentre;
|
4150 | };
|
4151 |
|
4152 | ColumnModel.prototype.isColumnDisplayed = function (column) {
|
4153 | return this.getAllDisplayedColumns().indexOf(column) >= 0;
|
4154 | };
|
4155 |
|
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 |
|
4190 | var filterPasses;
|
4191 | if (filterCallback) {
|
4192 |
|
4193 |
|
4194 |
|
4195 |
|
4196 |
|
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 |
|
4227 |
|
4228 |
|
4229 |
|
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 |
|
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 |
|
4248 | if (col.isAutoHeight()) {
|
4249 | return true;
|
4250 | }
|
4251 | var columnLeft = col.getLeft() || 0;
|
4252 | var columnRight = columnLeft + col.getActualWidth();
|
4253 |
|
4254 |
|
4255 |
|
4256 |
|
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 |
|
4264 |
|
4265 |
|
4266 | ColumnModel.prototype.getDisplayedColumnsLeftWidth = function () {
|
4267 | return this.getWidthOfColsInList(this.displayedColumnsLeft);
|
4268 | };
|
4269 |
|
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 |
|
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 |
|
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 |
|
4491 |
|
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 |
|
4504 |
|
4505 | maxWidthActive = false;
|
4506 | }
|
4507 | });
|
4508 | var minWidthPasses = width >= minWidthAccumulated;
|
4509 | var maxWidthPasses = !maxWidthActive || (width <= maxWidthAccumulated);
|
4510 | return minWidthPasses && maxWidthPasses;
|
4511 | };
|
4512 |
|
4513 |
|
4514 |
|
4515 |
|
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 |
|
4522 | if (finished) {
|
4523 | var columns = resizeSets && resizeSets.length > 0 ? resizeSets[0].columns : null;
|
4524 | this.fireColumnResizedEvent(columns, finished, source);
|
4525 | }
|
4526 | return;
|
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 |
|
4538 |
|
4539 |
|
4540 |
|
4541 |
|
4542 |
|
4543 |
|
4544 |
|
4545 |
|
4546 |
|
4547 | var finishedColsGrew = true;
|
4548 | var loopCount = 0;
|
4549 | var _loop_2 = function () {
|
4550 | loopCount++;
|
4551 | if (loopCount > 1000) {
|
4552 |
|
4553 |
|
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 |
|
4573 |
|
4574 |
|
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 |
|
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 |
|
4625 |
|
4626 |
|
4627 |
|
4628 |
|
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 |
|
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 |
|
4702 | var proposedColumnOrder = this.gridColumns.slice();
|
4703 | moveInArray(proposedColumnOrder, columnsToMove, toIndex);
|
4704 |
|
4705 | if (!this.doesMovePassMarryChildren(proposedColumnOrder)) {
|
4706 | return false;
|
4707 | }
|
4708 | if (!this.doesMovePassLockedPositions(proposedColumnOrder)) {
|
4709 | return false;
|
4710 | }
|
4711 | return true;
|
4712 | };
|
4713 |
|
4714 |
|
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 |
|
4732 | var lastPlacement = 0;
|
4733 | var rulePassed = true;
|
4734 | var lockPositionToPlacement = function (position) {
|
4735 | if (!position) {
|
4736 | return 1;
|
4737 | }
|
4738 | if (position === true) {
|
4739 | return 0;
|
4740 | }
|
4741 | return position === 'left' ? 0 : 2;
|
4742 | };
|
4743 | proposedColumnOrder.forEach(function (col) {
|
4744 | var placement = lockPositionToPlacement(col.getColDef().lockPosition);
|
4745 | if (placement < lastPlacement) {
|
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 |
|
4772 | var spread = maxIndex - minIndex;
|
4773 | var maxSpread = columnGroup.getLeafColumns().length - 1;
|
4774 |
|
4775 | if (spread > maxSpread) {
|
4776 | rulePassed = false;
|
4777 | }
|
4778 |
|
4779 |
|
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 |
|
4807 |
|
4808 |
|
4809 |
|
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 |
|
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 |
|
4829 |
|
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 |
|
4837 |
|
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 |
|
4847 | ColumnModel.prototype.getValueColumns = function () {
|
4848 | return this.valueColumns ? this.valueColumns : [];
|
4849 | };
|
4850 |
|
4851 | ColumnModel.prototype.getPivotColumns = function () {
|
4852 | return this.pivotColumns ? this.pivotColumns : [];
|
4853 | };
|
4854 |
|
4855 | ColumnModel.prototype.isPivotActive = function () {
|
4856 | return this.pivotColumns && this.pivotColumns.length > 0 && this.pivotMode;
|
4857 | };
|
4858 |
|
4859 | ColumnModel.prototype.getRowGroupColumns = function () {
|
4860 | return this.rowGroupColumns ? this.rowGroupColumns : [];
|
4861 | };
|
4862 |
|
4863 | ColumnModel.prototype.getDisplayedCenterColumns = function () {
|
4864 | return this.displayedColumnsCenter;
|
4865 | };
|
4866 |
|
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 |
|
4884 |
|
4885 |
|
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 |
|
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 |
|
4979 |
|
4980 |
|
4981 |
|
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 |
|
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 |
|
5000 |
|
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 |
|
5026 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
5146 |
|
5147 |
|
5148 | if (source === void 0) { source = "api"; }
|
5149 |
|
5150 | var primaryColumns = this.getColumnsFromTree(this.primaryColumnTree);
|
5151 | var columnStates = [];
|
5152 |
|
5153 |
|
5154 |
|
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 |
|
5224 | var columnsWithNoState = existingColumns.slice();
|
5225 | var rowGroupIndexes = {};
|
5226 | var pivotIndexes = {};
|
5227 | var autoGroupColumnStates = [];
|
5228 |
|
5229 |
|
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 |
|
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 |
|
5254 | var applyDefaultsFunc = function (col) {
|
5255 | return _this.syncColumnWithStateItem(col, null, params.defaultState, rowGroupIndexes, pivotIndexes, false, source);
|
5256 | };
|
5257 | columnsWithNoState.forEach(applyDefaultsFunc);
|
5258 |
|
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 |
|
5266 | return indexA - indexB;
|
5267 | }
|
5268 | if (aHasIndex) {
|
5269 |
|
5270 | return -1;
|
5271 | }
|
5272 | if (bHasIndex) {
|
5273 |
|
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 |
|
5282 | return oldIndexA - oldIndexB;
|
5283 | }
|
5284 | if (aHasOldIndex) {
|
5285 |
|
5286 | return -1;
|
5287 | }
|
5288 |
|
5289 |
|
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 |
|
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 |
|
5303 | autoGroupColsCopy.forEach(applyDefaultsFunc);
|
5304 | _this.applyOrderAfterApplyState(params);
|
5305 | _this.updateDisplayedColumns(source);
|
5306 | _this.dispatchEverythingChanged(source);
|
5307 | raiseEventsFunc();
|
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 |
|
5313 |
|
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;
|
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 |
|
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 |
|
5348 |
|
5349 |
|
5350 |
|
5351 | insertIntoArray(newOrder, col, autoGroupInsertIndex++);
|
5352 | }
|
5353 | else {
|
5354 |
|
5355 | newOrder.push(col);
|
5356 | }
|
5357 | });
|
5358 |
|
5359 |
|
5360 |
|
5361 |
|
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 |
|
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 |
|
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 |
|
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 |
|
5423 | var aggFuncChanged = oldActive && cs.aggFunc != c.getAggFunc();
|
5424 | return activeChanged || aggFuncChanged;
|
5425 | };
|
5426 | var changedValues = getChangedColumns(valueChangePredicate);
|
5427 | if (changedValues.length > 0) {
|
5428 |
|
5429 |
|
5430 |
|
5431 |
|
5432 |
|
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 |
|
5446 | _this.raiseColumnMovedEvent(columnStateBefore, source);
|
5447 | };
|
5448 | };
|
5449 | ColumnModel.prototype.raiseColumnPinnedEvent = function (changedColumns, source) {
|
5450 | if (!changedColumns.length) {
|
5451 | return;
|
5452 | }
|
5453 |
|
5454 | var column = changedColumns.length === 1 ? changedColumns[0] : null;
|
5455 |
|
5456 | var pinned = this.getCommonValue(changedColumns, function (col) { return col.getPinned(); });
|
5457 | var event = {
|
5458 | type: Events.EVENT_COLUMN_PINNED,
|
5459 |
|
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 |
|
5474 | var firstValue = valueGetter(cols[0]);
|
5475 | for (var i = 1; i < cols.length; i++) {
|
5476 | if (firstValue !== valueGetter(cols[i])) {
|
5477 |
|
5478 | return undefined;
|
5479 | }
|
5480 | }
|
5481 | return firstValue;
|
5482 | };
|
5483 | ColumnModel.prototype.raiseColumnVisibleEvent = function (changedColumns, source) {
|
5484 | if (!changedColumns.length) {
|
5485 | return;
|
5486 | }
|
5487 |
|
5488 | var column = changedColumns.length === 1 ? changedColumns[0] : null;
|
5489 |
|
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 |
|
5504 | var _this = this;
|
5505 | var colStateAfter = this.getColumnState();
|
5506 | var colStateAfterMapped = {};
|
5507 | colStateAfter.forEach(function (s) { return colStateAfterMapped[s.colId] = s; });
|
5508 |
|
5509 | var colsIntersectIds = {};
|
5510 | colStateBefore.forEach(function (s) {
|
5511 | if (colStateAfterMapped[s.colId]) {
|
5512 | colsIntersectIds[s.colId] = true;
|
5513 | }
|
5514 | });
|
5515 |
|
5516 | var beforeFiltered = colStateBefore.filter(function (c) { return colsIntersectIds[c.colId]; });
|
5517 | var afterFiltered = colStateAfter.filter(function (c) { return colsIntersectIds[c.colId]; });
|
5518 |
|
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 |
|
5570 | var hide = getValue('hide').value1;
|
5571 | if (hide !== undefined) {
|
5572 | column.setVisible(!hide, source);
|
5573 | }
|
5574 |
|
5575 | var pinned = getValue('pinned').value1;
|
5576 | if (pinned !== undefined) {
|
5577 | column.setPinned(pinned);
|
5578 | }
|
5579 |
|
5580 | var minColWidth = this.columnUtils.calculateColMinWidth(column.getColDef());
|
5581 |
|
5582 | var flex = getValue('flex').value1;
|
5583 | if (flex !== undefined) {
|
5584 | column.setFlex(flex);
|
5585 | }
|
5586 |
|
5587 | var noFlexThisCol = column.getFlex() <= 0;
|
5588 | if (noFlexThisCol) {
|
5589 |
|
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 |
|
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 |
|
5630 |
|
5631 |
|
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 |
|
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 |
|
5721 |
|
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 |
|
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 |
|
5784 | return headerValueGetter(params);
|
5785 | }
|
5786 | else if (typeof headerValueGetter === 'string') {
|
5787 |
|
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 |
|
5806 | var pivotValueColumn = column.getColDef().pivotValueColumn;
|
5807 | var pivotActiveOnThisColumn = exists(pivotValueColumn);
|
5808 | var aggFunc = null;
|
5809 | var aggFuncFound;
|
5810 |
|
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;
|
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 |
|
5840 |
|
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 |
|
5874 | function () { return undefined; }, function () { return undefined; },
|
5875 |
|
5876 | function (colDef) {
|
5877 | var aggFunc = colDef.aggFunc;
|
5878 |
|
5879 | if (aggFunc === null || aggFunc === '') {
|
5880 | return null;
|
5881 | }
|
5882 | if (aggFunc === undefined) {
|
5883 | return;
|
5884 | }
|
5885 | return !!aggFunc;
|
5886 | }, function (colDef) {
|
5887 |
|
5888 | return colDef.initialAggFunc != null && colDef.initialAggFunc != '';
|
5889 | });
|
5890 |
|
5891 | this.valueColumns.forEach(function (col) {
|
5892 | var colDef = col.getColDef();
|
5893 |
|
5894 | if (colDef.aggFunc != null && colDef.aggFunc != '') {
|
5895 | col.setAggFunc(colDef.aggFunc);
|
5896 | }
|
5897 | else {
|
5898 |
|
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 |
|
5914 |
|
5915 |
|
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;
|
5930 | }
|
5931 | else if (indexPresent) {
|
5932 | if (index === null) {
|
5933 |
|
5934 |
|
5935 | include = false;
|
5936 | }
|
5937 | else {
|
5938 |
|
5939 |
|
5940 | include = index >= 0;
|
5941 | }
|
5942 | }
|
5943 | else {
|
5944 | if (colIsNew) {
|
5945 |
|
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 |
|
5958 |
|
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 |
|
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 |
|
5986 |
|
5987 | previousCols.forEach(function (col) {
|
5988 | if (colsWithValue.indexOf(col) >= 0) {
|
5989 | res.push(col);
|
5990 | }
|
5991 | });
|
5992 |
|
5993 | colsWithValue.forEach(function (col) {
|
5994 | if (res.indexOf(col) < 0) {
|
5995 | res.push(col);
|
5996 | }
|
5997 | });
|
5998 |
|
5999 | previousCols.forEach(function (col) {
|
6000 | if (res.indexOf(col) < 0) {
|
6001 | setFlagFunc(col, false);
|
6002 | }
|
6003 | });
|
6004 |
|
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 |
|
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 |
|
6088 | if (typeof key !== 'string') {
|
6089 | console.error('AG Grid: group key must be a string');
|
6090 | }
|
6091 |
|
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 |
|
6107 |
|
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 |
|
6116 |
|
6117 | columnsForDisplay = this.gridColumns.filter(function (column) {
|
6118 |
|
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 |
|
6156 | this.updateGroupsAndDisplayedColumns(source);
|
6157 |
|
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 |
|
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 |
|
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 |
|
6237 |
|
6238 |
|
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 |
|
6249 |
|
6250 |
|
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 |
|
6286 |
|
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 |
|
6297 |
|
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 |
|
6303 | var newGridColumns = oldColsOrdered.slice();
|
6304 | newColsOrdered.forEach(function (newCol) {
|
6305 | var parent = newCol.getOriginalParent();
|
6306 |
|
6307 | if (!parent) {
|
6308 | newGridColumns.push(newCol);
|
6309 | return;
|
6310 | }
|
6311 |
|
6312 |
|
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 |
|
6326 | if (!siblings.length) {
|
6327 | newGridColumns.push(newCol);
|
6328 | return;
|
6329 | }
|
6330 |
|
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 |
|
6341 |
|
6342 |
|
6343 |
|
6344 |
|
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 |
|
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 |
|
6382 |
|
6383 |
|
6384 |
|
6385 |
|
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 |
|
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 |
|
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 |
|
6450 | var allColumns = this.primaryColumns.slice(0);
|
6451 |
|
6452 | var doingRtl = this.gridOptionsWrapper.isEnableRtl();
|
6453 | [
|
6454 | this.displayedColumnsLeft,
|
6455 | this.displayedColumnsRight,
|
6456 | this.displayedColumnsCenter
|
6457 | ].forEach(function (columns) {
|
6458 | if (doingRtl) {
|
6459 |
|
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 |
|
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 |
|
6477 |
|
6478 |
|
6479 | allColumns.forEach(function (column) {
|
6480 | column.setLeft(null, source);
|
6481 | });
|
6482 | };
|
6483 | ColumnModel.prototype.setLeftValuesOfGroups = function () {
|
6484 |
|
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 |
|
6509 | this.viewportColumnsCenter = this.displayedColumnsCenter;
|
6510 | }
|
6511 | else {
|
6512 |
|
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 |
|
6539 |
|
6540 | this.viewportRowLeft = {};
|
6541 | this.viewportRowRight = {};
|
6542 | this.viewportRowCenter = {};
|
6543 |
|
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 |
|
6550 | var child = children[i];
|
6551 | var addThisItem = false;
|
6552 | if (child instanceof Column) {
|
6553 |
|
6554 | addThisItem = virtualColIds[child.getId()] === true;
|
6555 | }
|
6556 | else {
|
6557 |
|
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 |
|
6596 |
|
6597 |
|
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 |
|
6636 |
|
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 |
|
6663 |
|
6664 |
|
6665 |
|
6666 |
|
6667 |
|
6668 | if (!this.flexColsCalculatedAtLestOnce) {
|
6669 | if (this.gridOptionsWrapper.isRowModelDefault()) {
|
6670 | this.rowModel.resetRowHeights();
|
6671 | }
|
6672 | this.flexColsCalculatedAtLestOnce = true;
|
6673 | }
|
6674 | return flexingColumns;
|
6675 | };
|
6676 |
|
6677 | ColumnModel.prototype.sizeColumnsToFit = function (gridWidth, source, silent) {
|
6678 | if (source === void 0) { source = "sizeColumnsToFit"; }
|
6679 |
|
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 |
|
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 |
|
6702 |
|
6703 |
|
6704 |
|
6705 |
|
6706 |
|
6707 |
|
6708 |
|
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 |
|
6715 | colsToSpread.forEach(function (column) {
|
6716 | column.setMinimum(source);
|
6717 | });
|
6718 | }
|
6719 | else {
|
6720 | var scale = availablePixels / this.getWidthOfColsInList(colsToSpread);
|
6721 |
|
6722 |
|
6723 | var pixelsForLastCol = availablePixels;
|
6724 |
|
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) {
|
6741 | newWidth = pixelsForLastCol;
|
6742 | }
|
6743 | column.setActualWidth(newWidth, source, true);
|
6744 | pixelsForLastCol -= newWidth;
|
6745 | }
|
6746 | }
|
6747 | }
|
6748 |
|
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 |
|
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 |
|
6816 |
|
6817 |
|
6818 |
|
6819 |
|
6820 |
|
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 |
|
6830 |
|
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 |
|
6935 |
|
6936 |
|
6937 |
|
6938 |
|
6939 | var __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 | })();
|
6952 | var __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 |
|
6959 | var ColumnUtils = (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 |
|
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 |
|
7009 |
|
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 |
|
7056 |
|
7057 |
|
7058 |
|
7059 |
|
7060 | var __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 | })();
|
7073 | var __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 |
|
7080 | var DisplayedGroupCreator = (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 |
|
7093 | pinned,
|
7094 |
|
7095 | oldDisplayedGroups) {
|
7096 | var _this = this;
|
7097 | var result = [];
|
7098 | var previousRealPath;
|
7099 | var previousOriginalPath;
|
7100 | var oldColumnsMapped = this.mapOldGroupsById(oldDisplayedGroups);
|
7101 |
|
7102 |
|
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 |
|
7110 | var newGroup = _this.createColumnGroup(currentOriginalPath[i], groupInstanceIdCreator, oldColumnsMapped, pinned);
|
7111 | currentRealPath[i] = newGroup;
|
7112 |
|
7113 | if (i == 0) {
|
7114 | result.push(newGroup);
|
7115 | }
|
7116 | else {
|
7117 | currentRealPath[i - 1].addChild(newGroup);
|
7118 | }
|
7119 | }
|
7120 | else {
|
7121 |
|
7122 | currentRealPath[i] = previousRealPath[i];
|
7123 | }
|
7124 | }
|
7125 | var noColumnGroups = currentRealPath.length === 0;
|
7126 | if (noColumnGroups) {
|
7127 |
|
7128 |
|
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 |
|
7147 |
|
7148 |
|
7149 | if (columnGroup && columnGroup.getProvidedColumnGroup() !== providedGroup) {
|
7150 | columnGroup = null;
|
7151 | }
|
7152 | if (exists(columnGroup)) {
|
7153 |
|
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 |
|
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 |
|
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 |
|
7210 |
|
7211 |
|
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 |
|
7226 |
|
7227 |
|
7228 |
|
7229 |
|
7230 | var __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 | };
|
7246 | var __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 |
|
7252 |
|
7253 |
|
7254 | var PropertyKeys = (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 |
|
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 |
|
7334 |
|
7335 |
|
7336 | PropertyKeys.FRAMEWORK_PROPERTIES = [
|
7337 | '__ob__', '__v_skip', '__metadata__', 'mappedColumnProperties', 'hasChildColumns', 'toColDef', 'createColDefFromGridColumn'
|
7338 | ];
|
7339 | return PropertyKeys;
|
7340 | }());
|
7341 |
|
7342 |
|
7343 |
|
7344 |
|
7345 |
|
7346 |
|
7347 |
|
7348 | var __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 | };
|
7359 | var __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 | };
|
7375 | var __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 | };
|
7379 | var ComponentUtil = (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 |
|
7390 | if (typeof gridOptions !== 'object') {
|
7391 | gridOptions = {};
|
7392 | }
|
7393 |
|
7394 | var pGridOptions = gridOptions;
|
7395 | var keyExists = function (key) { return typeof component[key] !== 'undefined'; };
|
7396 |
|
7397 | if (keyExists('groupAggFiltering') && typeof component.groupAggFiltering !== 'function') {
|
7398 | pGridOptions.groupAggFiltering = ComponentUtil.toBoolean(component.groupAggFiltering);
|
7399 | delete component.groupAggFiltering;
|
7400 | }
|
7401 |
|
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 |
|
7424 | var pGridOptions = gridOptions;
|
7425 | var keyExists = function (key) { return changesToApply[key]; };
|
7426 |
|
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 |
|
7437 |
|
7438 |
|
7439 |
|
7440 | if (changesToApply.rowClass) {
|
7441 | api.setRowClass(changesToApply.rowClass.currentValue);
|
7442 | delete changesToApply.rowClass;
|
7443 | }
|
7444 |
|
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 |
|
7506 |
|
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 |
|
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 |
|
7532 |
|
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 |
|
7546 | ComponentUtil.EVENTS = [];
|
7547 |
|
7548 | ComponentUtil.PUBLIC_EVENTS = [];
|
7549 |
|
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 | }());
|
7560 | ComponentUtil.EVENTS = values(Events);
|
7561 |
|
7562 | ComponentUtil.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 |
|
7587 | ComponentUtil.PUBLIC_EVENTS = ComponentUtil.EVENTS.filter(function (e) { return !includes(ComponentUtil.EXCLUDED_INTERNAL_EVENTS, e); });
|
7588 |
|
7589 |
|
7590 |
|
7591 |
|
7592 |
|
7593 |
|
7594 |
|
7595 | var __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 | })();
|
7608 | var __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 | };
|
7614 | var AgStackComponentsRegistry = (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 |
|
7629 |
|
7630 |
|
7631 |
|
7632 | var classEscaped = componentMeta.componentName.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
7633 |
|
7634 | var classUpperCase = classEscaped.toUpperCase();
|
7635 |
|
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 |
|
7649 |
|
7650 |
|
7651 |
|
7652 |
|
7653 | var __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 | };
|
7669 | var __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 | };
|
7673 | var ColDefUtil = (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 |
|
7829 |
|
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 |
|
7844 |
|
7845 |
|
7846 |
|
7847 |
|
7848 | var __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 | };
|
7864 | var Color = (function () {
|
7865 | |
7866 |
|
7867 |
|
7868 |
|
7869 |
|
7870 |
|
7871 |
|
7872 |
|
7873 |
|
7874 |
|
7875 |
|
7876 |
|
7877 | function Color(r, g, b, a) {
|
7878 | if (a === void 0) { a = 1; }
|
7879 |
|
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 |
|
7887 |
|
7888 |
|
7889 |
|
7890 |
|
7891 |
|
7892 |
|
7893 |
|
7894 | Color.fromString = function (str) {
|
7895 |
|
7896 | if (str.indexOf('#') >= 0) {
|
7897 | return Color.fromHexString(str);
|
7898 | }
|
7899 |
|
7900 | var hex = Color.nameToHex[str];
|
7901 | if (hex) {
|
7902 | return Color.fromHexString(hex);
|
7903 | }
|
7904 |
|
7905 | if (str.indexOf('rgb') >= 0) {
|
7906 | return Color.fromRgbaString(str);
|
7907 | }
|
7908 | throw new Error("Invalid color string: '" + str + "'");
|
7909 | };
|
7910 |
|
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 |
|
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) {
|
7970 | value = Math.max(0, Math.min(100, value));
|
7971 | value /= 100;
|
7972 | }
|
7973 | else {
|
7974 | if (i === 3) {
|
7975 | value = Math.max(0, Math.min(1, value));
|
7976 | }
|
7977 | else {
|
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 |
|
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 |
|
8051 |
|
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 |
|
8059 |
|
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 |
|
8083 |
|
8084 | Color.HSBtoRGB = function (H, S, B) {
|
8085 | if (isNaN(H)) {
|
8086 | H = 0;
|
8087 | }
|
8088 | H = (((H % 360) + 360) % 360) / 360;
|
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) {
|
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 |
|
8158 |
|
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 |
|
8315 |
|
8316 |
|
8317 |
|
8318 |
|
8319 |
|
8320 |
|
8321 | function 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 |
|
8336 | data[row] = [];
|
8337 | }
|
8338 | if (!data[row][column]) {
|
8339 |
|
8340 | data[row][column] = '';
|
8341 | }
|
8342 | };
|
8343 | ensureDataExists();
|
8344 | if (currentChar === '"') {
|
8345 | if (insideQuotedField) {
|
8346 | if (nextChar === '"') {
|
8347 |
|
8348 | data[row][column] += '"';
|
8349 | position++;
|
8350 | }
|
8351 | else {
|
8352 |
|
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 |
|
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 |
|
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 |
|
8372 | column = 0;
|
8373 | row++;
|
8374 | ensureDataExists();
|
8375 | if (currentChar === '\r' && nextChar === '\n') {
|
8376 |
|
8377 | position++;
|
8378 | }
|
8379 | return out_row_1 = row, out_column_1 = column, out_position_1 = position, "continue";
|
8380 | }
|
8381 | }
|
8382 |
|
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 |
|
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 |
|
8399 | var CsvUtils = Object.freeze({
|
8400 | stringToArray: stringToArray
|
8401 | });
|
8402 |
|
8403 |
|
8404 |
|
8405 |
|
8406 |
|
8407 |
|
8408 |
|
8409 | var __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 |
|
8422 |
|
8423 |
|
8424 |
|
8425 | var isSafari;
|
8426 | var isIE;
|
8427 | var isEdge;
|
8428 | var isChrome;
|
8429 | var isFirefox;
|
8430 | var isIOS;
|
8431 | var invisibleScrollbar;
|
8432 | var browserScrollbarWidth;
|
8433 | function isBrowserIE() {
|
8434 | if (isIE === undefined) {
|
8435 | isIE = !!document.documentMode;
|
8436 | }
|
8437 | return isIE;
|
8438 | }
|
8439 | function isBrowserEdge() {
|
8440 | if (isEdge === undefined) {
|
8441 | isEdge = !isBrowserIE() && !!window.StyleMedia;
|
8442 | }
|
8443 | return isEdge;
|
8444 | }
|
8445 | function isBrowserSafari() {
|
8446 | if (isSafari === undefined) {
|
8447 |
|
8448 | isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
8449 | }
|
8450 | return isSafari;
|
8451 | }
|
8452 | function 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 | }
|
8460 | function isBrowserFirefox() {
|
8461 | if (isFirefox === undefined) {
|
8462 | var win = window;
|
8463 | isFirefox = typeof win.InstallTrigger !== 'undefined';
|
8464 | }
|
8465 | return isFirefox;
|
8466 | }
|
8467 | function isIOSUserAgent() {
|
8468 | if (isIOS === undefined) {
|
8469 |
|
8470 | isIOS = (/iPad|iPhone|iPod/.test(navigator.platform) ||
|
8471 |
|
8472 | (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) &&
|
8473 |
|
8474 | !window.MSStream;
|
8475 | }
|
8476 | return isIOS;
|
8477 | }
|
8478 | function 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 | }
|
8489 | function getMaxDivHeight() {
|
8490 | if (!document.body) {
|
8491 | return -1;
|
8492 | }
|
8493 | var res = 1000000;
|
8494 |
|
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 | }
|
8511 | function getScrollbarWidth() {
|
8512 | if (browserScrollbarWidth == null) {
|
8513 | initScrollbarWidthAndVisibility();
|
8514 | }
|
8515 | return browserScrollbarWidth;
|
8516 | }
|
8517 | function 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';
|
8524 | div.style.position = 'absolute';
|
8525 | body.appendChild(div);
|
8526 | var width = div.offsetWidth - div.clientWidth;
|
8527 |
|
8528 | if (width === 0 && div.clientWidth === 0) {
|
8529 | width = null;
|
8530 | }
|
8531 |
|
8532 | if (div.parentNode) {
|
8533 | div.parentNode.removeChild(div);
|
8534 | }
|
8535 | if (width != null) {
|
8536 | browserScrollbarWidth = width;
|
8537 | invisibleScrollbar = width === 0;
|
8538 | }
|
8539 | }
|
8540 | function isInvisibleScrollbar() {
|
8541 | if (invisibleScrollbar == null) {
|
8542 | initScrollbarWidthAndVisibility();
|
8543 | }
|
8544 | return invisibleScrollbar;
|
8545 | }
|
8546 |
|
8547 | function 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 |
|
8585 |
|
8586 |
|
8587 |
|
8588 | function 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 |
|
8602 |
|
8603 |
|
8604 |
|
8605 | function 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 |
|
8618 | var BrowserUtils = 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 |
|
8635 |
|
8636 |
|
8637 |
|
8638 |
|
8639 | var rtlNegativeScroll;
|
8640 |
|
8641 |
|
8642 |
|
8643 |
|
8644 |
|
8645 |
|
8646 |
|
8647 | function 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 | }
|
8660 | function 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 | }
|
8668 | function setDisplayed(element, displayed) {
|
8669 | element.classList.toggle('ag-hidden', !displayed);
|
8670 | }
|
8671 | function setVisible(element, visible) {
|
8672 | element.classList.toggle('ag-invisible', !visible);
|
8673 | }
|
8674 | function 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 | }
|
8682 | function 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 |
|
8696 |
|
8697 |
|
8698 |
|
8699 | function 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 | }
|
8715 | function 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 | }
|
8722 | function 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 | }
|
8729 | function getAbsoluteHeight(el) {
|
8730 | var size = getElementSize(el);
|
8731 | var marginRight = size.marginBottom + size.marginTop;
|
8732 | return Math.ceil(el.offsetHeight + marginRight);
|
8733 | }
|
8734 | function getAbsoluteWidth(el) {
|
8735 | var size = getElementSize(el);
|
8736 | var marginWidth = size.marginLeft + size.marginRight;
|
8737 | return Math.ceil(el.offsetWidth + marginWidth);
|
8738 | }
|
8739 | function 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 =
|
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 | }
|
8759 | function getScrollLeft(element, rtl) {
|
8760 | var scrollLeft = element.scrollLeft;
|
8761 | if (rtl) {
|
8762 |
|
8763 | scrollLeft = Math.abs(scrollLeft);
|
8764 | if (isBrowserChrome() && !isRtlNegativeScroll()) {
|
8765 | scrollLeft = element.scrollWidth - element.clientWidth - scrollLeft;
|
8766 | }
|
8767 | }
|
8768 | return scrollLeft;
|
8769 | }
|
8770 | function setScrollLeft(element, value, rtl) {
|
8771 | if (rtl) {
|
8772 |
|
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 | }
|
8782 | function clearElement(el) {
|
8783 | while (el && el.firstChild) {
|
8784 | el.removeChild(el.firstChild);
|
8785 | }
|
8786 | }
|
8787 |
|
8788 | function removeElement(parent, cssSelector) {
|
8789 | removeFromParent(parent.querySelector(cssSelector));
|
8790 | }
|
8791 | function removeFromParent(node) {
|
8792 | if (node && node.parentNode) {
|
8793 | node.parentNode.removeChild(node);
|
8794 | }
|
8795 | }
|
8796 | function isVisible(element) {
|
8797 | return element.offsetParent !== null;
|
8798 | }
|
8799 |
|
8800 |
|
8801 |
|
8802 |
|
8803 |
|
8804 |
|
8805 | function loadTemplate(template) {
|
8806 |
|
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 | }
|
8816 | function appendHtml(eContainer, htmlTemplate) {
|
8817 | if (eContainer.lastChild) {
|
8818 |
|
8819 |
|
8820 |
|
8821 |
|
8822 | eContainer.insertAdjacentHTML('afterbegin', htmlTemplate);
|
8823 | }
|
8824 | else {
|
8825 | eContainer.innerHTML = htmlTemplate;
|
8826 | }
|
8827 | }
|
8828 |
|
8829 | function 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 | }
|
8836 | function offsetHeight(element) {
|
8837 | return element && element.clientHeight ? element.clientHeight : 0;
|
8838 | }
|
8839 | function offsetWidth(element) {
|
8840 | return element && element.clientWidth ? element.clientWidth : 0;
|
8841 | }
|
8842 | function ensureDomOrder(eContainer, eChild, eChildBefore) {
|
8843 |
|
8844 | if (eChildBefore && eChildBefore.nextSibling === eChild) {
|
8845 | return;
|
8846 | }
|
8847 | if (eChildBefore) {
|
8848 | if (eChildBefore.nextSibling) {
|
8849 |
|
8850 | eContainer.insertBefore(eChild, eChildBefore.nextSibling);
|
8851 | }
|
8852 | else {
|
8853 |
|
8854 | eContainer.appendChild(eChild);
|
8855 | }
|
8856 | }
|
8857 | else {
|
8858 |
|
8859 | if (eContainer.firstChild && eContainer.firstChild !== eChild) {
|
8860 |
|
8861 | eContainer.insertAdjacentElement('afterbegin', eChild);
|
8862 | }
|
8863 | }
|
8864 | }
|
8865 | function 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 | }
|
8874 | function insertWithDomOrder(eContainer, eToInsert, eChildBefore) {
|
8875 | if (eChildBefore) {
|
8876 |
|
8877 | eChildBefore.insertAdjacentElement('afterend', eToInsert);
|
8878 | }
|
8879 | else {
|
8880 | if (eContainer.firstChild) {
|
8881 |
|
8882 | eContainer.insertAdjacentElement('afterbegin', eToInsert);
|
8883 | }
|
8884 | else {
|
8885 |
|
8886 | eContainer.appendChild(eToInsert);
|
8887 | }
|
8888 | }
|
8889 | }
|
8890 |
|
8891 | function prependDC(parent, documentFragment) {
|
8892 | if (exists(parent.firstChild)) {
|
8893 | parent.insertBefore(documentFragment, parent.firstChild);
|
8894 | }
|
8895 | else {
|
8896 | parent.appendChild(documentFragment);
|
8897 | }
|
8898 | }
|
8899 | function 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 | }
|
8910 | function isHorizontalScrollShowing(element) {
|
8911 | return element.clientWidth < element.scrollWidth;
|
8912 | }
|
8913 | function isVerticalScrollShowing(element) {
|
8914 | return element.clientHeight < element.scrollHeight;
|
8915 | }
|
8916 | function 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 | }
|
8927 | function 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 | }
|
8933 | function 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 | }
|
8944 | function 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 | }
|
8950 | function formatSize(size) {
|
8951 | if (typeof size === 'number') {
|
8952 | return size + "px";
|
8953 | }
|
8954 | return size;
|
8955 | }
|
8956 |
|
8957 |
|
8958 |
|
8959 |
|
8960 |
|
8961 |
|
8962 | function 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 |
|
8970 |
|
8971 |
|
8972 |
|
8973 |
|
8974 | function isElement(o) {
|
8975 | return (typeof HTMLElement === 'function'
|
8976 | ? o instanceof HTMLElement
|
8977 | : o && isNonNullObject(o) && o.nodeType === 1 && typeof o.nodeName === 'string');
|
8978 | }
|
8979 | function isNodeOrElement(o) {
|
8980 | return isNode(o) || isElement(o);
|
8981 | }
|
8982 |
|
8983 |
|
8984 |
|
8985 |
|
8986 |
|
8987 | function 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 | }
|
8995 | function 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 |
|
9005 | function setCheckboxState(eCheckbox, state) {
|
9006 | if (typeof state === 'boolean') {
|
9007 | eCheckbox.checked = state;
|
9008 | eCheckbox.indeterminate = false;
|
9009 | }
|
9010 | else {
|
9011 |
|
9012 |
|
9013 | eCheckbox.indeterminate = true;
|
9014 | }
|
9015 | }
|
9016 | function addOrRemoveAttribute(element, name, value) {
|
9017 | if (value == null) {
|
9018 | element.removeAttribute(name);
|
9019 | }
|
9020 | else {
|
9021 | element.setAttribute(name, value.toString());
|
9022 | }
|
9023 | }
|
9024 | function 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 |
|
9033 | var DomUtils = 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 |
|
9081 |
|
9082 |
|
9083 |
|
9084 |
|
9085 |
|
9086 | function 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 | }
|
9092 | function 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 |
|
9132 |
|
9133 |
|
9134 |
|
9135 | function 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 |
|
9148 |
|
9149 |
|
9150 |
|
9151 |
|
9152 |
|
9153 | function 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 |
|
9168 |
|
9169 |
|
9170 |
|
9171 |
|
9172 | function 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 |
|
9186 | var GeneralUtils = Object.freeze({
|
9187 | getNameOfClass: getNameOfClass,
|
9188 | findLineByLeastSquares: findLineByLeastSquares,
|
9189 | cssStyleObjectToMarkup: cssStyleObjectToMarkup,
|
9190 | message: message,
|
9191 | bindCellRendererToHtmlElement: bindCellRendererToHtmlElement
|
9192 | });
|
9193 |
|
9194 |
|
9195 |
|
9196 |
|
9197 |
|
9198 |
|
9199 |
|
9200 |
|
9201 | function setAriaAttribute(element, attribute, value) {
|
9202 | element.setAttribute(ariaAttributeName(attribute), value.toString());
|
9203 | }
|
9204 | function removeAriaAttribute(element, attribute) {
|
9205 | element.removeAttribute(ariaAttributeName(attribute));
|
9206 | }
|
9207 | function ariaAttributeName(attribute) {
|
9208 | return "aria-" + attribute;
|
9209 | }
|
9210 | function setAriaRole(element, role) {
|
9211 | if (role) {
|
9212 | element.setAttribute('role', role);
|
9213 | }
|
9214 | else {
|
9215 | element.removeAttribute('role');
|
9216 | }
|
9217 | }
|
9218 | function 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 |
|
9232 | function getAriaLevel(element) {
|
9233 | return parseInt(element.getAttribute('aria-level'), 10);
|
9234 | }
|
9235 | function getAriaPosInSet(element) {
|
9236 | return parseInt(element.getAttribute('aria-posinset'), 10);
|
9237 | }
|
9238 | function getAriaDescribedBy(element) {
|
9239 | return element.getAttribute('aria-describedby') || '';
|
9240 | }
|
9241 |
|
9242 | function setAriaLabel(element, label) {
|
9243 | var key = 'label';
|
9244 | if (label) {
|
9245 | setAriaAttribute(element, key, label);
|
9246 | }
|
9247 | else {
|
9248 | removeAriaAttribute(element, key);
|
9249 | }
|
9250 | }
|
9251 | function setAriaLabelledBy(element, labelledBy) {
|
9252 | var key = 'labelledby';
|
9253 | if (labelledBy) {
|
9254 | setAriaAttribute(element, key, labelledBy);
|
9255 | }
|
9256 | else {
|
9257 | removeAriaAttribute(element, key);
|
9258 | }
|
9259 | }
|
9260 | function setAriaDescription(element, description) {
|
9261 | var key = 'description';
|
9262 | if (description) {
|
9263 | setAriaAttribute(element, key, description);
|
9264 | }
|
9265 | else {
|
9266 | removeAriaAttribute(element, key);
|
9267 | }
|
9268 | }
|
9269 | function setAriaDescribedBy(element, describedby) {
|
9270 | var key = 'describedby';
|
9271 | if (describedby) {
|
9272 | setAriaAttribute(element, key, describedby);
|
9273 | }
|
9274 | else {
|
9275 | removeAriaAttribute(element, key);
|
9276 | }
|
9277 | }
|
9278 | function setAriaLevel(element, level) {
|
9279 | setAriaAttribute(element, 'level', level);
|
9280 | }
|
9281 | function setAriaDisabled(element, disabled) {
|
9282 | setAriaAttribute(element, 'disabled', disabled);
|
9283 | }
|
9284 | function setAriaExpanded(element, expanded) {
|
9285 | setAriaAttribute(element, 'expanded', expanded);
|
9286 | }
|
9287 | function removeAriaExpanded(element) {
|
9288 | removeAriaAttribute(element, 'expanded');
|
9289 | }
|
9290 | function setAriaSetSize(element, setsize) {
|
9291 | setAriaAttribute(element, 'setsize', setsize);
|
9292 | }
|
9293 | function setAriaPosInSet(element, position) {
|
9294 | setAriaAttribute(element, 'posinset', position);
|
9295 | }
|
9296 | function setAriaMultiSelectable(element, multiSelectable) {
|
9297 | setAriaAttribute(element, 'multiselectable', multiSelectable);
|
9298 | }
|
9299 | function setAriaRowCount(element, rowCount) {
|
9300 | setAriaAttribute(element, 'rowcount', rowCount);
|
9301 | }
|
9302 | function setAriaRowIndex(element, rowIndex) {
|
9303 | setAriaAttribute(element, 'rowindex', rowIndex);
|
9304 | }
|
9305 | function setAriaColCount(element, colCount) {
|
9306 | setAriaAttribute(element, 'colcount', colCount);
|
9307 | }
|
9308 | function setAriaColIndex(element, colIndex) {
|
9309 | setAriaAttribute(element, 'colindex', colIndex);
|
9310 | }
|
9311 | function setAriaColSpan(element, colSpan) {
|
9312 | setAriaAttribute(element, 'colspan', colSpan);
|
9313 | }
|
9314 | function setAriaSort(element, sort) {
|
9315 | setAriaAttribute(element, 'sort', sort);
|
9316 | }
|
9317 | function removeAriaSort(element) {
|
9318 | removeAriaAttribute(element, 'sort');
|
9319 | }
|
9320 | function setAriaSelected(element, selected) {
|
9321 | var attributeName = 'selected';
|
9322 | if (selected) {
|
9323 | setAriaAttribute(element, attributeName, selected);
|
9324 | }
|
9325 | else {
|
9326 | removeAriaAttribute(element, attributeName);
|
9327 | }
|
9328 | }
|
9329 | function setAriaChecked(element, checked) {
|
9330 | setAriaAttribute(element, 'checked', checked === undefined ? 'mixed' : checked);
|
9331 | }
|
9332 |
|
9333 | var AriaUtils = 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 |
|
9363 |
|
9364 |
|
9365 |
|
9366 |
|
9367 | function padStartWidthZeros(value, totalStringSize) {
|
9368 | return value.toString().padStart(totalStringSize, '0');
|
9369 | }
|
9370 | function 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 |
|
9379 |
|
9380 |
|
9381 |
|
9382 |
|
9383 | function isNumeric(value) {
|
9384 | return value !== '' && !isNaN(parseFloat(value)) && isFinite(value);
|
9385 | }
|
9386 | function 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 | }
|
9395 | function 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 | }
|
9403 | function 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 |
|
9411 |
|
9412 |
|
9413 |
|
9414 |
|
9415 |
|
9416 | function 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 | }
|
9422 | function sum(values) {
|
9423 | return values == null ? null : values.reduce(function (total, value) { return total + value; }, 0);
|
9424 | }
|
9425 |
|
9426 | var NumberUtils = 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 |
|
9439 |
|
9440 |
|
9441 |
|
9442 |
|
9443 | var __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 |
|
9461 |
|
9462 |
|
9463 |
|
9464 |
|
9465 |
|
9466 | function 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 |
|
9480 |
|
9481 | function 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 |
|
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 |
|
9517 | var DateUtils = Object.freeze({
|
9518 | serialiseDate: serialiseDate,
|
9519 | parseDateTimeFromString: parseDateTimeFromString
|
9520 | });
|
9521 |
|
9522 |
|
9523 |
|
9524 |
|
9525 |
|
9526 |
|
9527 |
|
9528 | function 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 |
|
9543 |
|
9544 |
|
9545 |
|
9546 |
|
9547 |
|
9548 | function 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 |
|
9562 |
|
9563 |
|
9564 |
|
9565 |
|
9566 | function 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 | }
|
9577 | function 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 | }
|
9600 | function 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 |
|
9616 | var FuzzyMatchUtils = 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 |
|
9626 |
|
9627 |
|
9628 |
|
9629 |
|
9630 |
|
9631 |
|
9632 |
|
9633 |
|
9634 |
|
9635 | var iconNameClassMap = {
|
9636 |
|
9637 | columnGroupOpened: 'expanded',
|
9638 |
|
9639 | columnGroupClosed: 'contracted',
|
9640 |
|
9641 | columnSelectClosed: 'tree-closed',
|
9642 |
|
9643 | columnSelectOpen: 'tree-open',
|
9644 |
|
9645 |
|
9646 | columnSelectIndeterminate: 'tree-indeterminate',
|
9647 |
|
9648 | columnMovePin: 'pin',
|
9649 |
|
9650 | columnMoveHide: 'eye-slash',
|
9651 |
|
9652 | columnMoveMove: 'arrows',
|
9653 |
|
9654 | columnMoveLeft: 'left',
|
9655 |
|
9656 | columnMoveRight: 'right',
|
9657 |
|
9658 | columnMoveGroup: 'group',
|
9659 |
|
9660 | columnMoveValue: 'aggregation',
|
9661 |
|
9662 | columnMovePivot: 'pivot',
|
9663 |
|
9664 |
|
9665 | dropNotAllowed: 'not-allowed',
|
9666 |
|
9667 | groupContracted: 'tree-closed',
|
9668 |
|
9669 | groupExpanded: 'tree-open',
|
9670 |
|
9671 | chart: 'chart',
|
9672 |
|
9673 | close: 'cross',
|
9674 |
|
9675 | cancel: 'cancel',
|
9676 |
|
9677 | check: 'tick',
|
9678 |
|
9679 | first: 'first',
|
9680 |
|
9681 | previous: 'previous',
|
9682 |
|
9683 | next: 'next',
|
9684 |
|
9685 | last: 'last',
|
9686 |
|
9687 | linked: 'linked',
|
9688 |
|
9689 | unlinked: 'unlinked',
|
9690 |
|
9691 | colorPicker: 'color-picker',
|
9692 |
|
9693 | groupLoading: 'loading',
|
9694 |
|
9695 | menu: 'menu',
|
9696 |
|
9697 | filter: 'filter',
|
9698 |
|
9699 | columns: 'columns',
|
9700 |
|
9701 | maximize: 'maximize',
|
9702 |
|
9703 | minimize: 'minimize',
|
9704 |
|
9705 | menuPin: 'pin',
|
9706 |
|
9707 | menuValue: 'aggregation',
|
9708 |
|
9709 | menuAddRowGroup: 'group',
|
9710 |
|
9711 | menuRemoveRowGroup: 'group',
|
9712 |
|
9713 | clipboardCopy: 'copy',
|
9714 |
|
9715 | clipboardPaste: 'paste',
|
9716 |
|
9717 | pivotPanel: 'pivot',
|
9718 |
|
9719 | rowGroupPanel: 'group',
|
9720 |
|
9721 | valuePanel: 'aggregation',
|
9722 |
|
9723 | columnDrag: 'grip',
|
9724 |
|
9725 | rowDrag: 'grip',
|
9726 |
|
9727 | save: 'save',
|
9728 |
|
9729 | csvExport: 'csv',
|
9730 |
|
9731 | excelExport: 'excel',
|
9732 |
|
9733 | smallDown: 'small-down',
|
9734 |
|
9735 | smallLeft: 'small-left',
|
9736 |
|
9737 | smallRight: 'small-right',
|
9738 | smallUp: 'small-up',
|
9739 |
|
9740 | sortAscending: 'asc',
|
9741 |
|
9742 | sortDescending: 'desc',
|
9743 |
|
9744 | sortUnSort: 'none'
|
9745 | };
|
9746 |
|
9747 |
|
9748 |
|
9749 |
|
9750 |
|
9751 |
|
9752 |
|
9753 |
|
9754 | function 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 | }
|
9763 | function createIconNoSpan(iconName, gridOptionsWrapper, column, forceCreate) {
|
9764 | var userProvidedIcon = null;
|
9765 |
|
9766 | var icons = column && column.getColDef().icons;
|
9767 | if (icons) {
|
9768 | userProvidedIcon = icons[iconName];
|
9769 | }
|
9770 |
|
9771 | if (gridOptionsWrapper && !userProvidedIcon) {
|
9772 | var optionsIcons = gridOptionsWrapper.getIcons();
|
9773 | if (optionsIcons) {
|
9774 | userProvidedIcon = optionsIcons[iconName];
|
9775 | }
|
9776 | }
|
9777 |
|
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 |
|
9816 | var IconUtils = Object.freeze({
|
9817 | iconNameClassMap: iconNameClassMap,
|
9818 | createIcon: createIcon,
|
9819 | createIconNoSpan: createIconNoSpan
|
9820 | });
|
9821 |
|
9822 |
|
9823 |
|
9824 |
|
9825 |
|
9826 |
|
9827 |
|
9828 | var NUMPAD_DEL_NUMLOCK_ON_KEY = 'Del';
|
9829 | var NUMPAD_DEL_NUMLOCK_ON_CHARCODE = 46;
|
9830 | function isEventFromPrintableCharacter(event) {
|
9831 |
|
9832 | if (event.altKey || event.ctrlKey || event.metaKey) {
|
9833 | return false;
|
9834 | }
|
9835 |
|
9836 |
|
9837 | var printableCharacter = event.key.length === 1;
|
9838 |
|
9839 |
|
9840 | var numpadDelWithNumlockOnForEdgeOrIe = isNumpadDelWithNumLockOnForEdge(event);
|
9841 | return printableCharacter || numpadDelWithNumlockOnForEdgeOrIe;
|
9842 | }
|
9843 |
|
9844 |
|
9845 |
|
9846 |
|
9847 |
|
9848 |
|
9849 |
|
9850 |
|
9851 |
|
9852 | function isUserSuppressingKeyboardEvent(gridOptionsWrapper, keyboardEvent, rowNode, column, editing) {
|
9853 | var gridOptionsFunc = gridOptionsWrapper.getSuppressKeyboardEventFunc();
|
9854 | var colDefFunc = column ? column.getColDef().suppressKeyboardEvent : undefined;
|
9855 |
|
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 |
|
9871 | if (colDefFunc) {
|
9872 | var colDefFuncResult = colDefFunc(params);
|
9873 |
|
9874 | if (colDefFuncResult) {
|
9875 | return true;
|
9876 | }
|
9877 | }
|
9878 | if (gridOptionsFunc) {
|
9879 |
|
9880 | return gridOptionsFunc(params);
|
9881 | }
|
9882 |
|
9883 | return false;
|
9884 | }
|
9885 | function 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 | }
|
9902 | function isNumpadDelWithNumLockOnForEdge(event) {
|
9903 | return (isBrowserEdge()) &&
|
9904 | event.key === NUMPAD_DEL_NUMLOCK_ON_KEY &&
|
9905 | event.charCode === NUMPAD_DEL_NUMLOCK_ON_CHARCODE;
|
9906 | }
|
9907 |
|
9908 | var KeyboardUtils = Object.freeze({
|
9909 | isEventFromPrintableCharacter: isEventFromPrintableCharacter,
|
9910 | isUserSuppressingKeyboardEvent: isUserSuppressingKeyboardEvent,
|
9911 | isUserSuppressingHeaderKeyboardEvent: isUserSuppressingHeaderKeyboardEvent
|
9912 | });
|
9913 |
|
9914 |
|
9915 |
|
9916 |
|
9917 |
|
9918 |
|
9919 |
|
9920 |
|
9921 |
|
9922 |
|
9923 |
|
9924 |
|
9925 |
|
9926 |
|
9927 |
|
9928 | function areEventsNear(e1, e2, pixelCount) {
|
9929 |
|
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 |
|
9938 | var MouseUtils = Object.freeze({
|
9939 | areEventsNear: areEventsNear
|
9940 | });
|
9941 |
|
9942 |
|
9943 |
|
9944 |
|
9945 |
|
9946 |
|
9947 |
|
9948 |
|
9949 |
|
9950 |
|
9951 |
|
9952 |
|
9953 |
|
9954 |
|
9955 |
|
9956 | function 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 |
|
9969 |
|
9970 | return positionA - positionB;
|
9971 | }
|
9972 | if (bothNodesAreFillerNodes) {
|
9973 |
|
9974 |
|
9975 |
|
9976 |
|
9977 |
|
9978 |
|
9979 |
|
9980 |
|
9981 |
|
9982 | return nodeA.__objectId - nodeB.__objectId;
|
9983 | }
|
9984 | if (aHasIndex) {
|
9985 | return 1;
|
9986 | }
|
9987 | return -1;
|
9988 | };
|
9989 |
|
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 | }
|
10005 | function 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 |
|
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 |
|
10025 | var RowNodeUtils = Object.freeze({
|
10026 | sortRowNodesByOrder: sortRowNodesByOrder,
|
10027 | traverseNodesWithKey: traverseNodesWithKey
|
10028 | });
|
10029 |
|
10030 |
|
10031 |
|
10032 |
|
10033 |
|
10034 |
|
10035 |
|
10036 | function convertToSet(list) {
|
10037 | var set = new Set();
|
10038 | list.forEach(function (x) { return set.add(x); });
|
10039 | return set;
|
10040 | }
|
10041 |
|
10042 | var SetUtils = /*#__PURE__*/Object.freeze({
|
10043 | convertToSet: convertToSet
|
10044 | });
|
10045 |
|
10046 |
|
10047 |
|
10048 |
|
10049 |
|
10050 |
|
10051 |
|
10052 | var __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 | };
|
10063 | var 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);
|
10064 | var _ = utils;
|
10065 |
|
10066 |
|
10067 |
|
10068 |
|
10069 |
|
10070 |
|
10071 |
|
10072 | var NumberSequence = (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 |
|
10095 |
|
10096 |
|
10097 |
|
10098 |
|
10099 | (function (AgPromiseStatus) {
|
10100 | AgPromiseStatus[AgPromiseStatus["IN_PROGRESS"] = 0] = "IN_PROGRESS";
|
10101 | AgPromiseStatus[AgPromiseStatus["RESOLVED"] = 1] = "RESOLVED";
|
10102 | })(exports.AgPromiseStatus || (exports.AgPromiseStatus = {}));
|
10103 | var AgPromise = (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 |
|
10157 |
|
10158 |
|
10159 |
|
10160 |
|
10161 |
|
10162 |
|
10163 |
|
10164 | var Timer = (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 |
|
10178 |
|
10179 |
|
10180 |
|
10181 |
|
10182 | var __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 | })();
|
10195 | var __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 | };
|
10206 | var __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 | };
|
10212 | var 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 = {}));
|
10218 | var CustomTooltipFeature = (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 |
|
10228 |
|
10229 |
|
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 |
|
10248 |
|
10249 | this.setToDoNothing();
|
10250 | _super.prototype.destroy.call(this);
|
10251 | };
|
10252 | CustomTooltipFeature.prototype.onMouseEnter = function (e) {
|
10253 | if (isIOSUserAgent()) {
|
10254 | return;
|
10255 | }
|
10256 |
|
10257 |
|
10258 |
|
10259 |
|
10260 | if (this.state != TooltipStates.NOTHING) {
|
10261 | return;
|
10262 | }
|
10263 |
|
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 |
|
10284 |
|
10285 |
|
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 |
|
10298 |
|
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 |
|
10308 | this.tooltipComp.getGui().classList.add('ag-tooltip-hiding');
|
10309 |
|
10310 |
|
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 |
|
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 |
|
10335 |
|
10336 |
|
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 |
|
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 |
|
10402 |
|
10403 |
|
10404 |
|
10405 |
|
10406 | var __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 | })();
|
10419 | var __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 | };
|
10425 | var compIdSequence = new NumberSequence();
|
10426 | var CssClassManager = (function () {
|
10427 | function CssClassManager(getGui) {
|
10428 |
|
10429 |
|
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 | }());
|
10477 | var Component = (function (_super) {
|
10478 | __extends$6(Component, _super);
|
10479 | function Component(template) {
|
10480 | var _this = _super.call(this) || this;
|
10481 |
|
10482 | _this.displayed = true;
|
10483 |
|
10484 | _this.visible = true;
|
10485 |
|
10486 |
|
10487 |
|
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 |
|
10538 | Component.prototype.createChildComponentsFromTags = function (parentNode, paramsMap) {
|
10539 | var _this = this;
|
10540 |
|
10541 |
|
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 |
|
10549 |
|
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 |
|
10559 | var items = Array.prototype.slice.call(childNode.children);
|
10560 | childComp.addItems(items);
|
10561 | }
|
10562 |
|
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 |
|
10621 | if (!!this.getContext()) {
|
10622 | this.createChildComponentsFromTags(this.getGui(), paramsMap);
|
10623 | }
|
10624 | };
|
10625 | Component.prototype.createChildComponentsPreConstruct = function () {
|
10626 |
|
10627 |
|
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 |
|
10641 |
|
10642 |
|
10643 | var topLevelRefMatch = querySelector.refSelector
|
10644 | && _this.eGui.getAttribute('ref') === querySelector.refSelector;
|
10645 | if (topLevelRefMatch) {
|
10646 | setResult(_this.eGui);
|
10647 | }
|
10648 | else {
|
10649 |
|
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 |
|
10670 |
|
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 |
|
10761 |
|
10762 |
|
10763 |
|
10764 |
|
10765 | function QuerySelector(selector) {
|
10766 | return querySelectorFunc.bind(this, selector, undefined);
|
10767 | }
|
10768 | function RefSelector(ref) {
|
10769 | return querySelectorFunc.bind(this, "[ref=" + ref + "]", ref);
|
10770 | }
|
10771 | function 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 |
|
10787 |
|
10788 |
|
10789 |
|
10790 |
|
10791 |
|
10792 |
|
10793 |
|
10794 |
|
10795 |
|
10796 |
|
10797 |
|
10798 |
|
10799 |
|
10800 |
|
10801 |
|
10802 | function addToObjectProps(target, key, value) {
|
10803 |
|
10804 | var props = getOrCreateProps$1(target, getFunctionName(target.constructor));
|
10805 | if (!props[key]) {
|
10806 | props[key] = [];
|
10807 | }
|
10808 | props[key].push(value);
|
10809 | }
|
10810 | function 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 |
|
10822 |
|
10823 |
|
10824 |
|
10825 |
|
10826 | var __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 | })();
|
10839 | var __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 |
|
10846 |
|
10847 |
|
10848 | var ReadOnlyFloatingFilter = (function (_super) {
|
10849 | __extends$7(ReadOnlyFloatingFilter, _super);
|
10850 | function ReadOnlyFloatingFilter() {
|
10851 | return _super.call(this, "\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 |
|
10854 |
|
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 |
|
10874 |
|
10875 |
|
10876 |
|
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 |
|
10894 |
|
10895 |
|
10896 |
|
10897 |
|
10898 |
|
10899 |
|
10900 | var DateCompWrapper = (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 |
|
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 |
|
10985 |
|
10986 |
|
10987 |
|
10988 |
|
10989 | var __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 |
|
11001 | var OptionsFactory = (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 |
|
11087 |
|
11088 |
|
11089 |
|
11090 |
|
11091 | var 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 |
|
11124 |
|
11125 |
|
11126 |
|
11127 |
|
11128 | var KeyCode = (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 |
|
11147 |
|
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 |
|
11159 |
|
11160 |
|
11161 |
|
11162 |
|
11163 | var __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 | })();
|
11176 | var __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 | };
|
11187 | var __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 | };
|
11193 | var ManagedFocusFeature = (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 |
|
11253 |
|
11254 |
|
11255 |
|
11256 |
|
11257 | var __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 | })();
|
11270 | var __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 |
|
11278 |
|
11279 |
|
11280 |
|
11281 |
|
11282 |
|
11283 |
|
11284 | var ProvidedFilter = (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 |
|
11292 |
|
11293 |
|
11294 |
|
11295 |
|
11296 |
|
11297 | _this.appliedModel = null;
|
11298 | return _this;
|
11299 | }
|
11300 | ProvidedFilter.prototype.postConstruct = function () {
|
11301 | this.resetTemplate();
|
11302 | this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), {
|
11303 | handleKeyDown: this.handleKeyDown.bind(this)
|
11304 | }));
|
11305 | };
|
11306 |
|
11307 | ProvidedFilter.prototype.handleKeyDown = function (e) { };
|
11308 | ProvidedFilter.prototype.getFilterTitle = function () {
|
11309 | return this.translate(this.filterNameKey);
|
11310 | };
|
11311 | ProvidedFilter.prototype.isFilterActive = function () {
|
11312 |
|
11313 | return !!this.appliedModel;
|
11314 | };
|
11315 | ProvidedFilter.prototype.resetTemplate = function (paramsMap) {
|
11316 | var templateString = "\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 |
|
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 |
|
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 |
|
11393 |
|
11394 |
|
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 |
|
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 |
|
11433 |
|
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 |
|
11444 |
|
11445 | this.providedFilterParams.filterChangedCallback({ afterFloatingFilter: afterFloatingFilter, afterDataChange: afterDataChange });
|
11446 | }
|
11447 | var closeOnApply = this.providedFilterParams.closeOnApply;
|
11448 |
|
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 |
|
11470 |
|
11471 |
|
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 |
|
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 |
|
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 |
|
11543 |
|
11544 |
|
11545 |
|
11546 |
|
11547 | var __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 | })();
|
11560 | var __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 | };
|
11566 | var AgAbstractLabel = (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 |
|
11657 |
|
11658 |
|
11659 |
|
11660 |
|
11661 | var __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 | })();
|
11674 | var AgAbstractField = (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 |
|
11734 |
|
11735 |
|
11736 |
|
11737 |
|
11738 | var __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 | })();
|
11751 | var __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 | };
|
11757 | var AgPickerField = (function (_super) {
|
11758 | __extends$c(AgPickerField, _super);
|
11759 | function AgPickerField(config, className, pickerIcon, ariaRole) {
|
11760 | var _this = _super.call(this, config,
|
11761 | "<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 |
|
11854 |
|
11855 |
|
11856 |
|
11857 |
|
11858 | var __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 | })();
|
11871 | var __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 | };
|
11877 | var AgList = (function (_super) {
|
11878 | __extends$d(AgList, _super);
|
11879 | function AgList(cssIdentifier) {
|
11880 | if (cssIdentifier === void 0) { cssIdentifier = 'default'; }
|
11881 | var _this = _super.call(this, "<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 |
|
12032 |
|
12033 |
|
12034 |
|
12035 |
|
12036 | var __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 | })();
|
12049 | var __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 | };
|
12055 | var AgSelect = (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 |
|
12164 |
|
12165 |
|
12166 |
|
12167 |
|
12168 | var __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 | })();
|
12181 | var __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 | };
|
12187 | var AgAbstractInputField = (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, "\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 |
|
12277 |
|
12278 |
|
12279 |
|
12280 |
|
12281 | var __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 | })();
|
12294 | var __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 | };
|
12300 | var ConditionPosition;
|
12301 | (function (ConditionPosition) {
|
12302 | ConditionPosition[ConditionPosition["One"] = 0] = "One";
|
12303 | ConditionPosition[ConditionPosition["Two"] = 1] = "Two";
|
12304 | })(ConditionPosition || (ConditionPosition = {}));
|
12305 |
|
12306 |
|
12307 |
|
12308 |
|
12309 |
|
12310 |
|
12311 |
|
12312 | var SimpleFilter = (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 |
|
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 |
|
12370 | if (!a && !b) {
|
12371 | return true;
|
12372 | }
|
12373 |
|
12374 | if ((!a && b) || (a && !b)) {
|
12375 | return false;
|
12376 | }
|
12377 |
|
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 |
|
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 |
|
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 |
|
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 "\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 |
|
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 | }
|
12588 | if (!this.allowTwoConditions) {
|
12589 | return false;
|
12590 | }
|
12591 | if (this.isReadOnly()) {
|
12592 |
|
12593 | return this.isConditionUiComplete(position);
|
12594 | }
|
12595 | if (this.alwaysShowBothConditions) {
|
12596 | return true;
|
12597 | }
|
12598 |
|
12599 | return this.isConditionUiComplete(position - 1);
|
12600 | };
|
12601 | SimpleFilter.prototype.isConditionDisabled = function (position) {
|
12602 | if (this.isReadOnly()) {
|
12603 | return true;
|
12604 | }
|
12605 | if (!this.isConditionVisible(position)) {
|
12606 | return true;
|
12607 | }
|
12608 | if (position === 0) {
|
12609 | return false;
|
12610 | }
|
12611 |
|
12612 | return !this.isConditionUiComplete(position - 1);
|
12613 | };
|
12614 | SimpleFilter.prototype.isConditionBodyVisible = function (position) {
|
12615 | if (!this.isConditionVisible(position)) {
|
12616 | return false;
|
12617 | }
|
12618 |
|
12619 | var type = this.getConditionTypes()[position];
|
12620 | var numberOfInputs = this.getNumberOfInputs(type);
|
12621 | return numberOfInputs > 0;
|
12622 | };
|
12623 |
|
12624 |
|
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 |
|
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 |
|
12678 |
|
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 |
|
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 |
|
12722 | if (predicate != null && !values.some(function (v) { return v == null; })) {
|
12723 | return predicate(values, cellValue);
|
12724 | }
|
12725 |
|
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 |
|
12772 |
|
12773 |
|
12774 |
|
12775 |
|
12776 | var __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 | })();
|
12789 | var ScalarFilter = (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 |
|
12866 |
|
12867 |
|
12868 |
|
12869 |
|
12870 | var __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 | })();
|
12883 | var __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 | };
|
12894 | var __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 | };
|
12900 | var DEFAULT_MIN_YEAR = 1000;
|
12901 | var DEFAULT_MAX_YEAR = Infinity;
|
12902 | var DateFilter = (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 |
|
12916 |
|
12917 |
|
12918 |
|
12919 |
|
12920 |
|
12921 |
|
12922 |
|
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 |
|
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 "\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 |
|
13086 |
|
13087 |
|
13088 |
|
13089 |
|
13090 | var __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 | })();
|
13103 | var SimpleFloatingFilter = (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 |
|
13112 |
|
13113 | SimpleFloatingFilter.prototype.destroy = function () {
|
13114 | _super.prototype.destroy.call(this);
|
13115 | };
|
13116 |
|
13117 |
|
13118 |
|
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 |
|
13139 |
|
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 |
|
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 |
|
13177 |
|
13178 | return this.isTypeEditable(this.lastType);
|
13179 | }
|
13180 |
|
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 |
|
13193 |
|
13194 | this.readOnly = !!params.filterParams.readOnly;
|
13195 |
|
13196 |
|
13197 |
|
13198 |
|
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 |
|
13221 |
|
13222 |
|
13223 |
|
13224 |
|
13225 | var __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 | })();
|
13238 | var __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 | };
|
13244 | var DateFloatingFilter = (function (_super) {
|
13245 | __extends$k(DateFloatingFilter, _super);
|
13246 | function DateFloatingFilter() {
|
13247 | return _super.call(this, "\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 |
|
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 |
|
13282 |
|
13283 |
|
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 |
|
13341 |
|
13342 |
|
13343 |
|
13344 |
|
13345 | var __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 | })();
|
13358 | var __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 | };
|
13364 | var DefaultDateComponent = (function (_super) {
|
13365 | __extends$l(DefaultDateComponent, _super);
|
13366 | function DefaultDateComponent() {
|
13367 | return _super.call(this, "\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 |
|
13370 |
|
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 |
|
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 |
|
13436 |
|
13437 |
|
13438 |
|
13439 |
|
13440 | var __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 | })();
|
13453 | var __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 | };
|
13459 | var NumberFilter = (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 "\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 |
|
13564 |
|
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 |
|
13597 |
|
13598 |
|
13599 |
|
13600 |
|
13601 | var __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 | })();
|
13614 | var __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 | };
|
13625 | var __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 | };
|
13631 | var TextFilter = (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 |
|
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);
|
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 "\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 |
|
13801 |
|
13802 |
|
13803 |
|
13804 |
|
13805 | var __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 | })();
|
13818 | var __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 | };
|
13824 | var TextInputFloatingFilter = (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( "\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 |
|
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);
|
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 |
|
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 |
|
13920 |
|
13921 |
|
13922 |
|
13923 |
|
13924 | var __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 | })();
|
13937 | var NumberFloatingFilter = (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 |
|
13950 |
|
13951 |
|
13952 |
|
13953 |
|
13954 | var __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 | })();
|
13967 | var TextFloatingFilter = (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 |
|
13980 |
|
13981 |
|
13982 |
|
13983 |
|
13984 | var TouchListener = (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 |
|
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 |
|
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 |
|
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 |
|
14079 | var interval = now - this.lastTapTime;
|
14080 | if (interval > TouchListener.DOUBLE_TAP_MILLIS) {
|
14081 |
|
14082 | var event_3 = {
|
14083 | type: TouchListener.EVENT_DOUBLE_TAP,
|
14084 | touchStart: this.touchStart
|
14085 | };
|
14086 | this.eventService.dispatchEvent(event_3);
|
14087 |
|
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 |
|
14110 |
|
14111 |
|
14112 |
|
14113 |
|
14114 | var __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 | })();
|
14127 | var __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 | };
|
14133 | var HeaderComp = (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 |
|
14141 |
|
14142 | HeaderComp.prototype.destroy = function () {
|
14143 | _super.prototype.destroy.call(this);
|
14144 | };
|
14145 | HeaderComp.prototype.refresh = function (params) {
|
14146 | this.params = params;
|
14147 |
|
14148 |
|
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 |
|
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 |
|
14224 |
|
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 |
|
14233 |
|
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 |
|
14241 |
|
14242 |
|
14243 |
|
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 |
|
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 |
|
14288 | this.addManagedListener(this.params.column, Column.EVENT_MOVING_CHANGED, function () {
|
14289 | _this.lastMovingChanged = new Date().getTime();
|
14290 | });
|
14291 |
|
14292 | if (this.eLabel) {
|
14293 | this.addManagedListener(this.eLabel, 'click', function (event) {
|
14294 |
|
14295 |
|
14296 |
|
14297 | var moving = _this.params.column.isMoving();
|
14298 | var nowTime = new Date().getTime();
|
14299 |
|
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 |
|
14329 |
|
14330 |
|
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 |
|
14395 |
|
14396 |
|
14397 |
|
14398 |
|
14399 | var __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 | })();
|
14412 | var __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 | };
|
14418 | var HeaderGroupComp = (function (_super) {
|
14419 | __extends$s(HeaderGroupComp, _super);
|
14420 | function HeaderGroupComp() {
|
14421 | return _super.call(this, HeaderGroupComp.TEMPLATE) || this;
|
14422 | }
|
14423 |
|
14424 |
|
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 |
|
14459 |
|
14460 |
|
14461 |
|
14462 |
|
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 |
|
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 |
|
14525 |
|
14526 |
|
14527 |
|
14528 |
|
14529 | var __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 | })();
|
14542 | var PopupComponent = (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 |
|
14567 |
|
14568 |
|
14569 |
|
14570 |
|
14571 | var __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 | })();
|
14584 | var __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 | };
|
14590 | var LargeTextCellEditor = (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)) {
|
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 |
|
14636 |
|
14637 |
|
14638 |
|
14639 |
|
14640 | var __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 | })();
|
14653 | var __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 | };
|
14659 | var SelectCellEditor = (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 |
|
14690 |
|
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 |
|
14723 |
|
14724 |
|
14725 |
|
14726 |
|
14727 | var __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 | })();
|
14740 | var PopupSelectCellEditor = (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 |
|
14755 |
|
14756 |
|
14757 |
|
14758 |
|
14759 | var __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 | })();
|
14772 | var __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 | };
|
14778 | var TextCellEditor = (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 |
|
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 |
|
14825 |
|
14826 |
|
14827 | if (!isBrowserSafari()) {
|
14828 | eInput.getFocusableElement().focus();
|
14829 | }
|
14830 | var inputEl = eInput.getInputElement();
|
14831 | if (this.highlightAllOnFocus) {
|
14832 | inputEl.select();
|
14833 | }
|
14834 | else {
|
14835 |
|
14836 |
|
14837 |
|
14838 |
|
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 |
|
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 |
|
14874 |
|
14875 |
|
14876 |
|
14877 |
|
14878 | var __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 | })();
|
14891 | var PopupTextCellEditor = (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 |
|
14906 |
|
14907 |
|
14908 |
|
14909 |
|
14910 | var __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 | })();
|
14923 | var __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 | };
|
14929 | var ARROW_UP = '\u2191';
|
14930 | var ARROW_DOWN = '\u2193';
|
14931 | var AnimateShowChangeCellRenderer = (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 |
|
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 |
|
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 |
|
14962 |
|
14963 |
|
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 |
|
14991 |
|
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 |
|
15000 |
|
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 |
|
15020 |
|
15021 |
|
15022 |
|
15023 |
|
15024 | var __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 | })();
|
15037 | var __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 | };
|
15043 | var AnimateSlideCellRenderer = (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 |
|
15058 |
|
15059 |
|
15060 | var refreshCountCopy = this.refreshCount;
|
15061 |
|
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 |
|
15069 |
|
15070 |
|
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 |
|
15094 |
|
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 |
|
15120 |
|
15121 |
|
15122 |
|
15123 |
|
15124 | (function (RowHighlightPosition) {
|
15125 | RowHighlightPosition[RowHighlightPosition["Above"] = 0] = "Above";
|
15126 | RowHighlightPosition[RowHighlightPosition["Below"] = 1] = "Below";
|
15127 | })(exports.RowHighlightPosition || (exports.RowHighlightPosition = {}));
|
15128 | var RowNode = (function () {
|
15129 | function RowNode(beans) {
|
15130 |
|
15131 | this.rowIndex = null;
|
15132 |
|
15133 | this.key = null;
|
15134 |
|
15135 | this.childrenMapped = {};
|
15136 | |
15137 |
|
15138 |
|
15139 | this.displayed = false;
|
15140 |
|
15141 | this.rowTop = null;
|
15142 | |
15143 |
|
15144 | this.oldRowTop = null;
|
15145 |
|
15146 | this.selectable = true;
|
15147 | |
15148 |
|
15149 | this.__objectId = RowNode.OBJECT_ID_SEQUENCE++;
|
15150 | |
15151 |
|
15152 | this.__autoHeights = {};
|
15153 |
|
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 |
|
15161 | RowNode.prototype.setData = function (data) {
|
15162 | this.setDataCommon(data, false);
|
15163 | };
|
15164 |
|
15165 |
|
15166 |
|
15167 |
|
15168 |
|
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 |
|
15182 |
|
15183 |
|
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 |
|
15216 |
|
15217 |
|
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 |
|
15250 | var getRowIdFunc = this.beans.gridOptionsWrapper.getRowIdFunc();
|
15251 | if (getRowIdFunc) {
|
15252 |
|
15253 |
|
15254 | if (this.data) {
|
15255 |
|
15256 |
|
15257 |
|
15258 |
|
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 |
|
15266 |
|
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 |
|
15271 | if (this.id !== null && typeof this.id !== 'string') {
|
15272 | this.id = '' + this.id;
|
15273 | }
|
15274 | }
|
15275 | else {
|
15276 |
|
15277 |
|
15278 |
|
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 |
|
15390 |
|
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 |
|
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 |
|
15415 |
|
15416 |
|
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 |
|
15462 |
|
15463 |
|
15464 |
|
15465 |
|
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 | |
15476 |
|
15477 |
|
15478 |
|
15479 |
|
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 |
|
15519 |
|
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 |
|
15543 |
|
15544 |
|
15545 |
|
15546 |
|
15547 |
|
15548 |
|
15549 |
|
15550 | RowNode.prototype.setDataValue = function (colKey, newValue, eventSource) {
|
15551 |
|
15552 |
|
15553 |
|
15554 |
|
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 |
|
15575 | RowNode.prototype.setAggData = function (newAggData) {
|
15576 | var _this = this;
|
15577 |
|
15578 | var colIds = getAllKeysInObjects([this.aggData, newAggData]);
|
15579 | var oldAggData = this.aggData;
|
15580 | this.aggData = newAggData;
|
15581 |
|
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 |
|
15593 |
|
15594 |
|
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 |
|
15624 |
|
15625 |
|
15626 |
|
15627 |
|
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 | |
15635 |
|
15636 |
|
15637 |
|
15638 | RowNode.prototype.isSelected = function () {
|
15639 |
|
15640 | if (this.footer) {
|
15641 | return this.sibling.isSelected();
|
15642 | }
|
15643 | return this.selected;
|
15644 | };
|
15645 |
|
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 |
|
15653 |
|
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 |
|
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 |
|
15701 |
|
15702 |
|
15703 |
|
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 |
|
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 |
|
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 |
|
15737 |
|
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 |
|
15752 |
|
15753 |
|
15754 |
|
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 |
|
15766 | if (!suppressFinishActions) {
|
15767 | var clearOtherNodes = newValue && (clearSelection || !this.beans.gridOptionsWrapper.isRowSelectionMulti());
|
15768 | if (clearOtherNodes) {
|
15769 | updatedCount += this.beans.selectionService.clearOtherNodes(this);
|
15770 | }
|
15771 |
|
15772 | if (updatedCount > 0) {
|
15773 | this.beans.selectionService.updateGroupsFromChildrenSelections();
|
15774 |
|
15775 |
|
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 |
|
15784 | if (newValue) {
|
15785 | this.beans.selectionService.setLastSelectedNode(this);
|
15786 | }
|
15787 | }
|
15788 | return updatedCount;
|
15789 | };
|
15790 |
|
15791 |
|
15792 |
|
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 |
|
15830 |
|
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 |
|
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 |
|
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 |
|
15889 |
|
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 |
|
15912 |
|
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 |
|
15956 |
|
15957 |
|
15958 |
|
15959 |
|
15960 | var __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 | })();
|
15973 | var __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 | };
|
15979 | var CheckboxSelectionComponent = (function (_super) {
|
15980 | __extends$B(CheckboxSelectionComponent, _super);
|
15981 | function CheckboxSelectionComponent() {
|
15982 | return _super.call(this, "\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 |
|
15992 |
|
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 |
|
16026 |
|
16027 | this.addGuiEventListener('click', function (event) { return stopPropagationForAgGrid(event); });
|
16028 |
|
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 |
|
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 |
|
16063 | var selectable = this.rowNode.selectable;
|
16064 |
|
16065 |
|
16066 |
|
16067 | if (selectable && this.checkboxCallbackExists()) {
|
16068 | selectable = this.column.isCellCheckboxSelection(this.rowNode);
|
16069 | }
|
16070 |
|
16071 | this.setVisible(selectable);
|
16072 | };
|
16073 | CheckboxSelectionComponent.prototype.checkboxCallbackExists = function () {
|
16074 |
|
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 |
|
16089 |
|
16090 |
|
16091 |
|
16092 |
|
16093 | var __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 | })();
|
16106 | var __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 | };
|
16112 | var __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 = {}));
|
16137 | var DragAndDropService = (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 |
|
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 |
|
16225 |
|
16226 |
|
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 |
|
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 |
|
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 |
|
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 |
|
16372 |
|
16373 |
|
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 |
|
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 |
|
16428 |
|
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 |
|
16524 |
|
16525 |
|
16526 |
|
16527 |
|
16528 | var __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 | })();
|
16541 | var __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 | };
|
16547 | var RowDragComp = (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( "<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 |
|
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 |
|
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));
|
16649 | var VisibilityStrategy = (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 |
|
16670 |
|
16671 |
|
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 |
|
16685 | var NonManagedVisibilityStrategy = (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 |
|
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 |
|
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 |
|
16715 | var ManagedVisibilityStrategy = (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 |
|
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 |
|
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 |
|
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 |
|
16755 |
|
16756 |
|
16757 |
|
16758 |
|
16759 | var __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 | })();
|
16772 | var __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 | };
|
16783 | var __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 | };
|
16789 | var GroupCellRendererCtrl = (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 |
|
16805 |
|
16806 | var nullValue = params.value == null;
|
16807 | var skipCell = false;
|
16808 |
|
16809 |
|
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 |
|
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 |
|
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 |
|
16860 |
|
16861 |
|
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 |
|
16872 | if (!rowGroupCols || rowGroupCols.length === 0) {
|
16873 | return true;
|
16874 | }
|
16875 | var firstRowGroupCol = rowGroupCols[0];
|
16876 | return firstRowGroupCol.getId() === colDef.showRowGroup;
|
16877 | };
|
16878 |
|
16879 |
|
16880 |
|
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 |
|
16913 | if (missing(this.displayedGroupNode)) {
|
16914 | this.displayedGroupNode = rowNode;
|
16915 | }
|
16916 | };
|
16917 | GroupCellRendererCtrl.prototype.setupShowingValueForOpenedParent = function () {
|
16918 |
|
16919 |
|
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 |
|
16927 |
|
16928 |
|
16929 | if (!rowNode.groupData) {
|
16930 | this.showingValueForOpenedParent = false;
|
16931 | return;
|
16932 | }
|
16933 |
|
16934 |
|
16935 | var showingGroupNode = rowNode.rowGroupColumn != null;
|
16936 | if (showingGroupNode) {
|
16937 | var keyOfGroupingColumn = rowNode.rowGroupColumn.getId();
|
16938 | var configuredToShowThisGroupLevel = column.isRowGroupDisplayed(keyOfGroupingColumn);
|
16939 |
|
16940 | if (configuredToShowThisGroupLevel) {
|
16941 | this.showingValueForOpenedParent = false;
|
16942 | return;
|
16943 | }
|
16944 | }
|
16945 |
|
16946 |
|
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 |
|
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 |
|
16984 |
|
16985 |
|
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 |
|
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 |
|
17015 | if (params.fullWidth) {
|
17016 | return this.userComponentFactory.getFullWidthGroupRowInnerCellRenderer(this.gridOptions.groupRowRendererParams, params);
|
17017 | }
|
17018 |
|
17019 |
|
17020 |
|
17021 |
|
17022 |
|
17023 |
|
17024 |
|
17025 |
|
17026 |
|
17027 |
|
17028 |
|
17029 |
|
17030 |
|
17031 | var innerCompDetails = this.userComponentFactory
|
17032 | .getInnerRendererDetails(params, params);
|
17033 |
|
17034 |
|
17035 | var isGroupRowRenderer = function (details) { return details && details.componentClass == _this.compClass; };
|
17036 | if (innerCompDetails && !isGroupRowRenderer(innerCompDetails)) {
|
17037 |
|
17038 | return innerCompDetails;
|
17039 | }
|
17040 | var relatedColumn = this.displayedGroupNode.rowGroupColumn;
|
17041 | var relatedColDef = relatedColumn ? relatedColumn.getColDef() : undefined;
|
17042 | if (!relatedColDef) {
|
17043 | return;
|
17044 | }
|
17045 |
|
17046 | var relatedCompDetails = this.userComponentFactory
|
17047 | .getCellRendererDetails(relatedColDef, params);
|
17048 | if (relatedCompDetails && !isGroupRowRenderer(relatedCompDetails)) {
|
17049 |
|
17050 | return relatedCompDetails;
|
17051 | }
|
17052 | if (isGroupRowRenderer(relatedCompDetails) &&
|
17053 | relatedColDef.cellRendererParams &&
|
17054 | relatedColDef.cellRendererParams.innerRenderer) {
|
17055 |
|
17056 |
|
17057 | var res = this.userComponentFactory.getInnerRendererDetails(relatedColDef.cellRendererParams, params);
|
17058 | return res;
|
17059 | }
|
17060 | };
|
17061 | GroupCellRendererCtrl.prototype.addChildCount = function () {
|
17062 |
|
17063 |
|
17064 | if (this.params.suppressCount) {
|
17065 | return;
|
17066 | }
|
17067 | this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED, this.updateChildCount.bind(this));
|
17068 |
|
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 |
|
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 |
|
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 |
|
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 |
|
17113 |
|
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 |
|
17125 | stopPropagationForAgGrid(mouseEvent);
|
17126 | this.onExpandOrContract(mouseEvent);
|
17127 | };
|
17128 | GroupCellRendererCtrl.prototype.onExpandOrContract = function (e) {
|
17129 |
|
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 |
|
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 |
|
17159 |
|
17160 | var expanded = this.showingValueForOpenedParent ? true : node.expanded;
|
17161 | this.comp.setExpandedDisplayed(expanded);
|
17162 | this.comp.setContractedDisplayed(!expanded);
|
17163 | }
|
17164 | else {
|
17165 |
|
17166 | this.comp.setExpandedDisplayed(false);
|
17167 | this.comp.setContractedDisplayed(false);
|
17168 | }
|
17169 |
|
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 |
|
17185 | this.showExpandAndContractIcons();
|
17186 |
|
17187 | this.setIndent();
|
17188 | this.refreshAriaExpanded();
|
17189 | };
|
17190 | GroupCellRendererCtrl.prototype.setupIndent = function () {
|
17191 |
|
17192 |
|
17193 |
|
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 |
|
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 |
|
17243 | !rowNode.footer &&
|
17244 |
|
17245 | !rowNode.rowPinned &&
|
17246 |
|
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 |
|
17273 |
|
17274 |
|
17275 |
|
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 |
|
17302 |
|
17303 |
|
17304 |
|
17305 |
|
17306 | var __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 | })();
|
17319 | var __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 | };
|
17325 | var GroupCellRenderer = (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 |
|
17374 |
|
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 |
|
17403 |
|
17404 |
|
17405 |
|
17406 |
|
17407 | var __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 | })();
|
17420 | var __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 | };
|
17426 | var LoadingCellRenderer = (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 |
|
17449 |
|
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 |
|
17465 |
|
17466 |
|
17467 |
|
17468 |
|
17469 | var __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 | })();
|
17482 | var LoadingOverlayComponent = (function (_super) {
|
17483 | __extends$H(LoadingOverlayComponent, _super);
|
17484 | function LoadingOverlayComponent() {
|
17485 | return _super.call(this) || this;
|
17486 | }
|
17487 |
|
17488 |
|
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 |
|
17505 |
|
17506 |
|
17507 |
|
17508 |
|
17509 | var __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 | })();
|
17522 | var NoRowsOverlayComponent = (function (_super) {
|
17523 | __extends$I(NoRowsOverlayComponent, _super);
|
17524 | function NoRowsOverlayComponent() {
|
17525 | return _super.call(this) || this;
|
17526 | }
|
17527 |
|
17528 |
|
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 |
|
17545 |
|
17546 |
|
17547 |
|
17548 |
|
17549 | var __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 | })();
|
17562 | var TooltipComponent = (function (_super) {
|
17563 | __extends$J(TooltipComponent, _super);
|
17564 | function TooltipComponent() {
|
17565 | return _super.call(this, "<div class=\"ag-tooltip\"></div>") || this;
|
17566 | }
|
17567 |
|
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 |
|
17577 |
|
17578 |
|
17579 |
|
17580 |
|
17581 | var __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 | })();
|
17594 | var __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 | };
|
17600 | var UserComponentRegistry = (function (_super) {
|
17601 | __extends$K(UserComponentRegistry, _super);
|
17602 | function UserComponentRegistry() {
|
17603 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
17604 | _this.agGridDefaults = {
|
17605 |
|
17606 | agDateInput: DefaultDateComponent,
|
17607 |
|
17608 | agColumnHeader: HeaderComp,
|
17609 | agColumnGroupHeader: HeaderGroupComp,
|
17610 |
|
17611 | agTextColumnFloatingFilter: TextFloatingFilter,
|
17612 | agNumberColumnFloatingFilter: NumberFloatingFilter,
|
17613 | agDateColumnFloatingFilter: DateFloatingFilter,
|
17614 | agReadOnlyFloatingFilter: ReadOnlyFloatingFilter,
|
17615 |
|
17616 | agAnimateShowChangeCellRenderer: AnimateShowChangeCellRenderer,
|
17617 | agAnimateSlideCellRenderer: AnimateSlideCellRenderer,
|
17618 | agGroupCellRenderer: GroupCellRenderer,
|
17619 | agGroupRowRenderer: GroupCellRenderer,
|
17620 | agLoadingCellRenderer: LoadingCellRenderer,
|
17621 |
|
17622 | agCellEditor: TextCellEditor,
|
17623 | agTextCellEditor: TextCellEditor,
|
17624 | agSelectCellEditor: SelectCellEditor,
|
17625 | agPopupTextCellEditor: PopupTextCellEditor,
|
17626 | agPopupSelectCellEditor: PopupSelectCellEditor,
|
17627 | agLargeTextCellEditor: LargeTextCellEditor,
|
17628 |
|
17629 | agTextColumnFilter: TextFilter,
|
17630 | agNumberColumnFilter: NumberFilter,
|
17631 | agDateColumnFilter: DateFilter,
|
17632 |
|
17633 | agLoadingOverlay: LoadingOverlayComponent,
|
17634 | agNoRowsOverlay: NoRowsOverlayComponent,
|
17635 |
|
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 |
|
17723 |
|
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 |
|
17735 |
|
17736 |
|
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 |
|
17786 |
|
17787 |
|
17788 |
|
17789 |
|
17790 | var DateComponent = {
|
17791 | propertyName: 'dateComponent',
|
17792 | cellRenderer: false
|
17793 | };
|
17794 | var HeaderComponent = {
|
17795 | propertyName: 'headerComponent',
|
17796 | cellRenderer: false
|
17797 | };
|
17798 | var HeaderGroupComponent = {
|
17799 | propertyName: 'headerGroupComponent',
|
17800 | cellRenderer: false
|
17801 | };
|
17802 | var CellRendererComponent = {
|
17803 | propertyName: 'cellRenderer',
|
17804 | cellRenderer: true
|
17805 | };
|
17806 | var CellEditorComponent = {
|
17807 | propertyName: 'cellEditor',
|
17808 | cellRenderer: false
|
17809 | };
|
17810 | var InnerRendererComponent = {
|
17811 | propertyName: 'innerRenderer',
|
17812 | cellRenderer: true
|
17813 | };
|
17814 | var LoadingOverlayComponent$1 = {
|
17815 | propertyName: 'loadingOverlayComponent',
|
17816 | cellRenderer: false
|
17817 | };
|
17818 | var NoRowsOverlayComponent$1 = {
|
17819 | propertyName: 'noRowsOverlayComponent',
|
17820 | cellRenderer: false
|
17821 | };
|
17822 | var TooltipComponent$1 = {
|
17823 | propertyName: 'tooltipComponent',
|
17824 | cellRenderer: false
|
17825 | };
|
17826 | var FilterComponent = {
|
17827 | propertyName: 'filter',
|
17828 | cellRenderer: false
|
17829 | };
|
17830 | var FloatingFilterComponent = {
|
17831 | propertyName: 'floatingFilterComponent',
|
17832 | cellRenderer: false
|
17833 | };
|
17834 | var ToolPanelComponent = {
|
17835 | propertyName: 'toolPanel',
|
17836 | cellRenderer: false
|
17837 | };
|
17838 | var StatusPanelComponent = {
|
17839 | propertyName: 'statusPanel',
|
17840 | cellRenderer: false
|
17841 | };
|
17842 | var FullWidth = {
|
17843 | propertyName: 'fullWidthCellRenderer',
|
17844 | cellRenderer: true
|
17845 | };
|
17846 | var FullWidthLoading = {
|
17847 | propertyName: 'loadingCellRenderer',
|
17848 | cellRenderer: true
|
17849 | };
|
17850 | var FullWidthGroup = {
|
17851 | propertyName: 'groupRowRenderer',
|
17852 | cellRenderer: true
|
17853 | };
|
17854 | var FullWidthDetail = {
|
17855 | propertyName: 'detailCellRenderer',
|
17856 | cellRenderer: true
|
17857 | };
|
17858 |
|
17859 |
|
17860 |
|
17861 |
|
17862 |
|
17863 |
|
17864 |
|
17865 | var FloatingFilterMapper = (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 | */
|
17892 | var __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 | })();
|
17905 | var __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 | };
|
17911 | var UserComponentFactory = (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 |
|
17924 |
|
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 |
|
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 |
|
17948 | UserComponentFactory.prototype.getCellEditorDetails = function (def, params) {
|
17949 | return this.getCompDetails(def, CellEditorComponent, 'agCellEditor', params, true);
|
17950 | };
|
17951 |
|
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 |
|
17992 | if (compName != null) {
|
17993 | lookupFromRegistry(compName);
|
17994 | }
|
17995 |
|
17996 | if (jsComp == null && fwComp == null && defaultName != null) {
|
17997 | lookupFromRegistry(defaultName);
|
17998 | }
|
17999 |
|
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 |
|
18032 |
|
18033 |
|
18034 |
|
18035 |
|
18036 | if (defObject) {
|
18037 | var defObjectAny = defObject;
|
18038 |
|
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 |
|
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 |
|
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 |
|
18092 | var instance;
|
18093 | if (jsComponent) {
|
18094 | instance = new ComponentClass();
|
18095 | }
|
18096 | else {
|
18097 |
|
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 |
|
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 |
|
18117 |
|
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 |
|
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 |
|
18179 |
|
18180 |
|
18181 |
|
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 |
|
18190 |
|
18191 |
|
18192 |
|
18193 |
|
18194 | var __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 | })();
|
18207 | var __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 |
|
18214 |
|
18215 | var DragService = (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 |
|
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 |
|
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 |
|
18290 |
|
18291 |
|
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 |
|
18298 | this.addTemporaryEvents(events);
|
18299 |
|
18300 | if (params.dragStartPixels === 0) {
|
18301 | this.onCommonMove(touch, this.touchStart, params.eElement);
|
18302 | }
|
18303 | };
|
18304 |
|
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 |
|
18312 |
|
18313 |
|
18314 | if (e._alreadyProcessedByDragService) {
|
18315 | return;
|
18316 | }
|
18317 | e._alreadyProcessedByDragService = true;
|
18318 |
|
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 |
|
18336 | this.addTemporaryEvents(events);
|
18337 |
|
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 |
|
18355 |
|
18356 | DragService.prototype.isEventNearStartEvent = function (currentEvent, startEvent) {
|
18357 |
|
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 |
|
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 |
|
18386 |
|
18387 |
|
18388 |
|
18389 |
|
18390 |
|
18391 |
|
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 |
|
18402 | this.onCommonMove(touch, this.touchStart, el);
|
18403 | };
|
18404 |
|
18405 |
|
18406 | DragService.prototype.onMouseMove = function (mouseEvent, el) {
|
18407 |
|
18408 |
|
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 |
|
18427 |
|
18428 |
|
18429 |
|
18430 |
|
18431 | if (!touch) {
|
18432 | touch = this.touchLastTime;
|
18433 | }
|
18434 |
|
18435 |
|
18436 |
|
18437 |
|
18438 | this.onUpCommon(touch, el);
|
18439 |
|
18440 |
|
18441 |
|
18442 |
|
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 |
|
18493 |
|
18494 |
|
18495 |
|
18496 |
|
18497 | var __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 | })();
|
18510 | var __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 | };
|
18521 | var __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 | };
|
18527 | var FilterManager = (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 |
|
18537 |
|
18538 |
|
18539 |
|
18540 |
|
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 |
|
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 |
|
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 |
|
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 |
|
18650 |
|
18651 |
|
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 | }
|
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 |
|
18670 | if (isSecondary) {
|
18671 | return true;
|
18672 | }
|
18673 | var isShowingPrimaryColumns = !_this.columnModel.isPivotActive();
|
18674 | var isValueActive = column.isValueActive();
|
18675 |
|
18676 | if (!isValueActive || !isShowingPrimaryColumns) {
|
18677 | return false;
|
18678 | }
|
18679 |
|
18680 | if (_this.columnModel.isPivotMode()) {
|
18681 |
|
18682 |
|
18683 | return true;
|
18684 | }
|
18685 | else {
|
18686 |
|
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 |
|
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 |
|
18759 |
|
18760 |
|
18761 |
|
18762 |
|
18763 |
|
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 |
|
18800 |
|
18801 | this.processingFilterChange = true;
|
18802 | this.eventService.dispatchEvent(filterChangedEvent);
|
18803 | this.processingFilterChange = false;
|
18804 | };
|
18805 | FilterManager.prototype.isSuppressFlashingCellsBecauseFiltering = function () {
|
18806 |
|
18807 |
|
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 |
|
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 |
|
18843 | return true;
|
18844 | };
|
18845 | FilterManager.prototype.doesRowPassFilter = function (params) {
|
18846 |
|
18847 |
|
18848 |
|
18849 |
|
18850 | if (this.isQuickFilterPresent() && !this.doesRowPassQuickFilter(params.rowNode)) {
|
18851 | return false;
|
18852 | }
|
18853 |
|
18854 | if (this.gridOptionsWrapper.isExternalFilterPresent() && !this.gridOptionsWrapper.doesExternalFilterPass(params.rowNode)) {
|
18855 | return false;
|
18856 | }
|
18857 |
|
18858 | if (this.isColumnFilterPresent() && !this.doColumnFiltersPass(params.rowNode, params.filterInstanceToSkip)) {
|
18859 | return false;
|
18860 | }
|
18861 |
|
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 |
|
19009 |
|
19010 |
|
19011 |
|
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 |
|
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 |
|
19110 |
|
19111 |
|
19112 |
|
19113 |
|
19114 | var __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 | })();
|
19127 | var AbstractHeaderCellComp = (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 |
|
19142 |
|
19143 |
|
19144 |
|
19145 |
|
19146 | var __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 | })();
|
19159 | var __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 | };
|
19165 | var HeaderFilterCellComp = (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 |
|
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 |
|
19222 |
|
19223 |
|
19224 |
|
19225 |
|
19226 | var SideBarDefParser = (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 |
|
19316 |
|
19317 |
|
19318 |
|
19319 |
|
19320 | var __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 | };
|
19331 | var __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 | };
|
19337 | var __param$3 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
19338 | return function (target, key) { decorator(target, key, paramIndex); }
|
19339 | };
|
19340 | var __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 | };
|
19356 | var __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 | };
|
19360 | var DEFAULT_ROW_HEIGHT = 25;
|
19361 | var DEFAULT_DETAIL_ROW_HEIGHT = 300;
|
19362 | var DEFAULT_VIEWPORT_ROW_MODEL_PAGE_SIZE = 5;
|
19363 | var DEFAULT_VIEWPORT_ROW_MODEL_BUFFER_SIZE = 5;
|
19364 | var DEFAULT_KEEP_DETAIL_ROW_COUNT = 10;
|
19365 | function isTrue(value) {
|
19366 | return value === true || value === 'true';
|
19367 | }
|
19368 | function toNumber(value) {
|
19369 | if (typeof value == 'number') {
|
19370 | return value;
|
19371 | }
|
19372 | if (typeof value == 'string') {
|
19373 | return parseInt(value, 10);
|
19374 | }
|
19375 | }
|
19376 | function zeroOrGreater(value, defaultValue) {
|
19377 | if (value >= 0) {
|
19378 | return value;
|
19379 | }
|
19380 |
|
19381 | return defaultValue;
|
19382 | }
|
19383 | function oneOrGreater(value, defaultValue) {
|
19384 | var valueNumber = parseInt(value, 10);
|
19385 | if (isNumeric(valueNumber) && valueNumber > 0) {
|
19386 | return valueNumber;
|
19387 | }
|
19388 | return defaultValue;
|
19389 | }
|
19390 | var GridOptionsWrapper = (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 |
|
19405 |
|
19406 |
|
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 |
|
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 |
|
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 |
|
19498 |
|
19499 |
|
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 |
|
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 |
|
19643 | return isTrue(this.gridOptions.groupHideOpenParents);
|
19644 | };
|
19645 | GridOptionsWrapper.prototype.isGroupUseEntireRow = function (pivotMode) {
|
19646 |
|
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 |
|
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 |
|
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 |
|
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 |
|
19889 |
|
19890 | var getRowIdProvided = this.gridOptions.getRowId != null;
|
19891 | var immutableData = isTrue(this.gridOptions.immutableData);
|
19892 |
|
19893 |
|
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 | }
|
19929 | if (res <= 0) {
|
19930 | return;
|
19931 | }
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
20462 |
|
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 |
|
20514 |
|
20515 |
|
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 |
|
20531 |
|
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 |
|
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 |
|
20739 | GridOptionsWrapper.prototype.globalEventHandler = function (eventName, event) {
|
20740 |
|
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 |
|
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 |
|
20778 |
|
20779 |
|
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 |
|
20798 |
|
20799 |
|
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 |
|
20935 |
|
20936 |
|
20937 |
|
20938 |
|
20939 | var __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 | })();
|
20952 | var __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 = {}));
|
20963 | var LayoutFeature = (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 |
|
20996 |
|
20997 |
|
20998 |
|
20999 |
|
21000 | var __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 | })();
|
21013 | var __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 | };
|
21019 | var GridBodyScrollFeature = (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 |
|
21052 |
|
21053 |
|
21054 |
|
21055 |
|
21056 | this.horizontallyScrollHeaderCenterAndFloatingCenter();
|
21057 | }
|
21058 | };
|
21059 | GridBodyScrollFeature.prototype.horizontallyScrollHeaderCenterAndFloatingCenter = function (scrollLeft) {
|
21060 |
|
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 |
|
21108 |
|
21109 |
|
21110 |
|
21111 |
|
21112 |
|
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 |
|
21167 |
|
21168 |
|
21169 |
|
21170 | if (touchOnly === void 0) { touchOnly = false; }
|
21171 |
|
21172 |
|
21173 |
|
21174 |
|
21175 |
|
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 |
|
21210 |
|
21211 |
|
21212 |
|
21213 |
|
21214 |
|
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 |
|
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 |
|
21242 |
|
21243 |
|
21244 |
|
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 |
|
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 |
|
21270 | GridBodyScrollFeature.prototype.scrollToTop = function () {
|
21271 | this.eBodyViewport.scrollTop = 0;
|
21272 | };
|
21273 |
|
21274 | GridBodyScrollFeature.prototype.ensureNodeVisible = function (comparator, position) {
|
21275 | if (position === void 0) { position = null; }
|
21276 |
|
21277 | var rowCount = this.rowModel.getRowCount();
|
21278 | var comparatorIsAFunction = typeof comparator === 'function';
|
21279 | var indexToSelect = -1;
|
21280 |
|
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 |
|
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 |
|
21302 |
|
21303 |
|
21304 |
|
21305 |
|
21306 |
|
21307 | GridBodyScrollFeature.prototype.ensureIndexVisible = function (index, position) {
|
21308 |
|
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 |
|
21336 |
|
21337 | var pxTop = this.heightScaler.getScrollPositionForPixel(rowTopPixel);
|
21338 | var pxBottom = this.heightScaler.getScrollPositionForPixel(rowBottomPixel - viewportHeight);
|
21339 |
|
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 |
|
21355 | newScrollPosition = pxTop;
|
21356 | }
|
21357 | else if (rowAboveViewport) {
|
21358 |
|
21359 | newScrollPosition = pxBottom;
|
21360 | }
|
21361 | if (newScrollPosition !== null) {
|
21362 | this.eBodyViewport.scrollTop = newScrollPosition;
|
21363 | this.rowRenderer.redrawAfterScroll();
|
21364 | }
|
21365 |
|
21366 |
|
21367 |
|
21368 |
|
21369 | rowGotShiftedDuringOperation = (startingRowTop !== rowNode.rowTop)
|
21370 | || (startingRowHeight !== rowNode.rowHeight);
|
21371 | } while (rowGotShiftedDuringOperation);
|
21372 |
|
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 |
|
21382 | if (column.isPinned()) {
|
21383 | return;
|
21384 | }
|
21385 |
|
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 |
|
21394 |
|
21395 |
|
21396 |
|
21397 | this.centerRowContainerCtrl.onHorizontalViewportChanged();
|
21398 |
|
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 |
|
21486 |
|
21487 |
|
21488 |
|
21489 |
|
21490 | var AutoScrollService = (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 |
|
21574 |
|
21575 |
|
21576 |
|
21577 |
|
21578 | var __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 | })();
|
21591 | var __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 | };
|
21602 | var __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 | };
|
21608 | var __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 | };
|
21624 | var __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 | };
|
21628 | var RowDragFeature = (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 |
|
21710 | draggingEvent.dragItem.rowNodes = this.getRowNodes(draggingEvent);
|
21711 |
|
21712 |
|
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 |
|
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, 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
|
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 |
|
21996 |
|
21997 |
|
21998 |
|
21999 |
|
22000 | var __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 | })();
|
22013 | var __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 = {}));
|
22023 | var CSS_CLASS_CELL_SELECTABLE = 'ag-selectable';
|
22024 | var CSS_CLASS_FORCE_VERTICAL_SCROLL = 'ag-force-vertical-scroll';
|
22025 | var CSS_CLASS_COLUMN_MOVING = 'ag-column-moving';
|
22026 | var GridBodyCtrl = (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 |
|
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 |
|
22096 |
|
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 |
|
22112 | var elementWithFocus = event.relatedTarget;
|
22113 | if (getTabIndex(elementWithFocus) === null) {
|
22114 | _this.rowRenderer.stopEditing();
|
22115 | return;
|
22116 | }
|
22117 | var clickInsideGrid =
|
22118 |
|
22119 | viewports.some(function (viewport) { return viewport.contains(elementWithFocus); })
|
22120 |
|
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 |
|
22167 |
|
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 |
|
22181 |
|
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 |
|
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 |
|
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 |
|
22226 | floatingTopHeight += 1;
|
22227 | }
|
22228 | var floatingBottomHeight = pinnedRowModel.getPinnedBottomTotalHeight();
|
22229 | if (floatingBottomHeight) {
|
22230 |
|
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 |
|
22239 |
|
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 |
|
22271 | GridBodyCtrl.prototype.addScrollEventListener = function (listener) {
|
22272 | this.eBodyViewport.addEventListener('scroll', listener);
|
22273 | };
|
22274 |
|
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 |
|
22319 |
|
22320 |
|
22321 |
|
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 |
|
22334 |
|
22335 |
|
22336 |
|
22337 |
|
22338 | var CSS_CELL_RANGE_SELECTED = 'ag-cell-range-selected';
|
22339 | var CSS_CELL_RANGE_CHART = 'ag-cell-range-chart';
|
22340 | var CSS_CELL_RANGE_SINGLE_CELL = 'ag-cell-range-single-cell';
|
22341 | var CSS_CELL_RANGE_CHART_CATEGORY = 'ag-cell-range-chart-category';
|
22342 | var CSS_CELL_RANGE_HANDLE = 'ag-cell-range-handle';
|
22343 | var CSS_CELL_RANGE_TOP = 'ag-cell-range-top';
|
22344 | var CSS_CELL_RANGE_RIGHT = 'ag-cell-range-right';
|
22345 | var CSS_CELL_RANGE_BOTTOM = 'ag-cell-range-bottom';
|
22346 | var CSS_CELL_RANGE_LEFT = 'ag-cell-range-left';
|
22347 | var CellRangeFeature = (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 |
|
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 |
|
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 |
|
22427 | if (!leftCol) {
|
22428 | left = true;
|
22429 | }
|
22430 |
|
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 |
|
22513 |
|
22514 |
|
22515 |
|
22516 |
|
22517 | var __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 |
|
22532 |
|
22533 |
|
22534 |
|
22535 |
|
22536 | var CellPositionFeature = (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();
|
22563 | }
|
22564 | };
|
22565 | CellPositionFeature.prototype.setupColSpan = function () {
|
22566 |
|
22567 | if (this.column.getColDef().colSpan == null) {
|
22568 | return;
|
22569 | }
|
22570 | this.colsSpanning = this.getColSpanningList();
|
22571 |
|
22572 | this.addManagedListener(this.beans.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayColumnsChanged.bind(this));
|
22573 |
|
22574 |
|
22575 |
|
22576 |
|
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 |
|
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 |
|
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 |
|
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 |
|
22655 | CellPositionFeature.prototype.destroy = function () {
|
22656 | _super.prototype.destroy.call(this);
|
22657 | };
|
22658 | return CellPositionFeature;
|
22659 | }(BeanStub));
|
22660 |
|
22661 |
|
22662 |
|
22663 |
|
22664 |
|
22665 |
|
22666 |
|
22667 | var __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 | })();
|
22680 | var CellCustomStyleFeature = (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 |
|
22760 | CellCustomStyleFeature.prototype.destroy = function () {
|
22761 | _super.prototype.destroy.call(this);
|
22762 | };
|
22763 | return CellCustomStyleFeature;
|
22764 | }(BeanStub));
|
22765 |
|
22766 |
|
22767 |
|
22768 |
|
22769 |
|
22770 |
|
22771 |
|
22772 | var __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 | })();
|
22785 | var TooltipFeature = (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 |
|
22847 | TooltipFeature.prototype.destroy = function () {
|
22848 | _super.prototype.destroy.call(this);
|
22849 | };
|
22850 | return TooltipFeature;
|
22851 | }(BeanStub));
|
22852 |
|
22853 |
|
22854 |
|
22855 |
|
22856 |
|
22857 |
|
22858 |
|
22859 | var __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 |
|
22866 |
|
22867 |
|
22868 |
|
22869 |
|
22870 | var Beans = (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 |
|
23016 |
|
23017 |
|
23018 |
|
23019 |
|
23020 | var __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 | })();
|
23033 | var CellMouseListenerFeature = (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 |
|
23067 | if (this.isDoubleClickOnIPad()) {
|
23068 | this.onCellDoubleClicked(mouseEvent);
|
23069 | mouseEvent.preventDefault();
|
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 |
|
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 |
|
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 |
|
23099 | var cellDoubleClickedEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_DOUBLE_CLICKED);
|
23100 | this.beans.eventService.dispatchEvent(cellDoubleClickedEvent);
|
23101 |
|
23102 | if (typeof colDef.onCellDoubleClicked === 'function') {
|
23103 |
|
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 |
|
23117 | if (this.isRightClickInExistingRange(mouseEvent)) {
|
23118 | return;
|
23119 | }
|
23120 | var ranges = rangeService && rangeService.getCellRanges().length != 0;
|
23121 | if (!shiftKey || !ranges) {
|
23122 |
|
23123 |
|
23124 |
|
23125 | var forceBrowserFocus = (isBrowserEdge()) && !this.cellCtrl.isEditing() && !isFocusableFormField(target);
|
23126 | this.cellCtrl.focusCell(forceBrowserFocus);
|
23127 | }
|
23128 |
|
23129 |
|
23130 | if (shiftKey && ranges) {
|
23131 |
|
23132 | mouseEvent.preventDefault();
|
23133 | }
|
23134 |
|
23135 |
|
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 |
|
23196 |
|
23197 |
|
23198 |
|
23199 |
|
23200 | var __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 | })();
|
23213 | var CellKeyboardListenerFeature = (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 |
|
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 |
|
23295 |
|
23296 |
|
23297 |
|
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 |
|
23316 |
|
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 |
|
23329 |
|
23330 |
|
23331 |
|
23332 |
|
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 |
|
23358 | event.preventDefault();
|
23359 | };
|
23360 | CellKeyboardListenerFeature.prototype.destroy = function () {
|
23361 | };
|
23362 | return CellKeyboardListenerFeature;
|
23363 | }(BeanStub));
|
23364 |
|
23365 |
|
23366 |
|
23367 |
|
23368 |
|
23369 |
|
23370 |
|
23371 | var __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 | })();
|
23384 | var __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 | };
|
23390 | var DndSourceComp = (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 |
|
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 |
|
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 |
|
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 |
|
23453 |
|
23454 |
|
23455 |
|
23456 |
|
23457 | var __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 | })();
|
23470 | var __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 | };
|
23481 | var CSS_CELL = 'ag-cell';
|
23482 | var CSS_AUTO_HEIGHT = 'ag-cell-auto-height';
|
23483 | var CSS_NORMAL_HEIGHT = 'ag-cell-normal-height';
|
23484 | var CSS_CELL_FOCUS = 'ag-cell-focus';
|
23485 | var CSS_CELL_FIRST_RIGHT_PINNED = 'ag-cell-first-right-pinned';
|
23486 | var CSS_CELL_LAST_LEFT_PINNED = 'ag-cell-last-left-pinned';
|
23487 | var CSS_CELL_NOT_INLINE_EDITING = 'ag-cell-not-inline-editing';
|
23488 | var CSS_CELL_INLINE_EDITING = 'ag-cell-inline-editing';
|
23489 | var CSS_CELL_POPUP_EDITING = 'ag-cell-popup-editing';
|
23490 | var CSS_COLUMN_HOVER = 'ag-column-hover';
|
23491 | var CSS_CELL_WRAP_TEXT = 'ag-cell-wrap-text';
|
23492 | var instanceIdSequence$1 = 0;
|
23493 | var CellCtrl = (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 |
|
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 |
|
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 |
|
23572 |
|
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 |
|
23612 |
|
23613 | var minRowHeight = this.beans.gridOptionsWrapper.getRowHeightForNode(this.rowNode).height;
|
23614 | var measureHeight = function (timesCalled) {
|
23615 | if (_this.editing) {
|
23616 | return;
|
23617 | }
|
23618 |
|
23619 |
|
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 |
|
23628 |
|
23629 | var doc = _this.beans.gridOptionsWrapper.getDocument();
|
23630 | var notYetInDom = !doc || !doc.contains(eAutoHeightContainer);
|
23631 |
|
23632 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
23734 |
|
23735 |
|
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 |
|
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 |
|
23769 |
|
23770 |
|
23771 |
|
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 |
|
23800 |
|
23801 |
|
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();
|
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 |
|
23827 |
|
23828 | CellCtrl.prototype.setInlineEditingClass = function () {
|
23829 | if (!this.isAlive()) {
|
23830 | return;
|
23831 | }
|
23832 |
|
23833 |
|
23834 |
|
23835 |
|
23836 |
|
23837 |
|
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 |
|
23846 |
|
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 |
|
23902 |
|
23903 |
|
23904 |
|
23905 |
|
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 |
|
23942 | cellEditor.focusIn();
|
23943 | }
|
23944 | else {
|
23945 |
|
23946 |
|
23947 |
|
23948 | this.focusCell(true);
|
23949 | }
|
23950 | };
|
23951 | CellCtrl.prototype.onCellChanged = function (event) {
|
23952 |
|
23953 |
|
23954 | if (!this.cellComp) {
|
23955 | return;
|
23956 | }
|
23957 | var eventImpactsThisCell = event.column === this.column;
|
23958 | if (eventImpactsThisCell) {
|
23959 | this.refreshCell({});
|
23960 | }
|
23961 | };
|
23962 |
|
23963 |
|
23964 |
|
23965 |
|
23966 |
|
23967 |
|
23968 | CellCtrl.prototype.refreshCell = function (params) {
|
23969 |
|
23970 | if (this.suppressRefreshCell || this.editing) {
|
23971 | return;
|
23972 | }
|
23973 |
|
23974 |
|
23975 |
|
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 |
|
23983 |
|
23984 |
|
23985 |
|
23986 |
|
23987 |
|
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 |
|
23994 |
|
23995 |
|
23996 | this.showValue(newData);
|
23997 |
|
23998 |
|
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 |
|
24010 |
|
24011 | this.cellCustomStyleFeature.applyCellClassRules();
|
24012 | };
|
24013 |
|
24014 |
|
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 |
|
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 |
|
24051 | this.cellComp.addOrRemoveCssClass(fullName, true);
|
24052 | this.cellComp.addOrRemoveCssClass(animationFullName, false);
|
24053 |
|
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 |
|
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 |
|
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 |
|
24108 |
|
24109 |
|
24110 |
|
24111 | var lockedClosedGroup = this.rowNode.leafGroup && this.beans.columnModel.isPivotMode();
|
24112 | var isOpenGroup = this.rowNode.group && this.rowNode.expanded && !this.rowNode.footer && !lockedClosedGroup;
|
24113 |
|
24114 | var groupFootersEnabled = this.beans.gridOptionsWrapper.isGroupIncludeFooter();
|
24115 |
|
24116 | var groupAlwaysShowAggData = this.beans.gridOptionsWrapper.isGroupSuppressBlankHeader();
|
24117 |
|
24118 |
|
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);
|
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 |
|
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 |
|
24265 |
|
24266 | this.createCellPosition();
|
24267 |
|
24268 | this.onCellFocused();
|
24269 |
|
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 |
|
24295 | if (cellFocused && event && event.forceBrowserFocus) {
|
24296 | var focusEl = this.cellComp.getFocusableElement();
|
24297 | focusEl.focus();
|
24298 | }
|
24299 |
|
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 |
|
24313 | CellCtrl.prototype.applyStaticCssClasses = function () {
|
24314 | this.cellComp.addOrRemoveCssClass(CSS_CELL, true);
|
24315 | this.cellComp.addOrRemoveCssClass(CSS_CELL_NOT_INLINE_EDITING, true);
|
24316 |
|
24317 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
24415 |
|
24416 |
|
24417 |
|
24418 |
|
24419 | var __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 | })();
|
24432 | var __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 | };
|
24448 | var __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 | };
|
24452 | var 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 = {}));
|
24460 | var instanceIdSequence$2 = 0;
|
24461 | var RowCtrl = (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 |
|
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 |
|
24564 |
|
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 |
|
24579 |
|
24580 |
|
24581 |
|
24582 |
|
24583 |
|
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 |
|
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 |
|
24664 |
|
24665 |
|
24666 |
|
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 |
|
24722 |
|
24723 |
|
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 |
|
24772 | var column = cellCtrl.getColumn();
|
24773 | if (column.getPinned() != nextContainerPinned) {
|
24774 | return REMOVE_CELL;
|
24775 | }
|
24776 |
|
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 |
|
24792 | this.slideRowIn = oldRowTopExists;
|
24793 |
|
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 |
|
24816 | var tryRefresh = function (gui, pinned) {
|
24817 | if (!gui) {
|
24818 | return true;
|
24819 | }
|
24820 | var cellRenderer = gui.rowComp.getFullWidthCellRenderer();
|
24821 |
|
24822 |
|
24823 |
|
24824 |
|
24825 | if (!cellRenderer) {
|
24826 | return false;
|
24827 | }
|
24828 |
|
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 |
|
24880 |
|
24881 |
|
24882 | this.getAllCellCtrls().forEach(function (cellCtrl) {
|
24883 | return cellCtrl.refreshCell({
|
24884 | suppressFlash: !event.update,
|
24885 | newData: !event.update
|
24886 | });
|
24887 | });
|
24888 |
|
24889 |
|
24890 |
|
24891 |
|
24892 |
|
24893 | this.onRowSelected();
|
24894 |
|
24895 | this.postProcessCss();
|
24896 | };
|
24897 | RowCtrl.prototype.onRowNodeCellChanged = function () {
|
24898 |
|
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 |
|
24935 |
|
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 | }
|
24990 | element.classList.toggle('ag-full-width-focus', isFocused);
|
24991 | if (isFocused) {
|
24992 |
|
24993 |
|
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 |
|
25047 |
|
25048 |
|
25049 |
|
25050 |
|
25051 |
|
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 |
|
25079 | var multiSelectKeyPressed = mouseEvent.ctrlKey || mouseEvent.metaKey;
|
25080 | var shiftKeyPressed = mouseEvent.shiftKey;
|
25081 |
|
25082 |
|
25083 |
|
25084 |
|
25085 |
|
25086 |
|
25087 | var groupSelectsChildren = this.beans.gridOptionsWrapper.isGroupSelectsChildren();
|
25088 | if (
|
25089 |
|
25090 |
|
25091 | (groupSelectsChildren && this.rowNode.group) ||
|
25092 |
|
25093 |
|
25094 | !this.rowNode.selectable ||
|
25095 |
|
25096 | this.rowNode.rowPinned ||
|
25097 |
|
25098 | !this.beans.gridOptionsWrapper.isRowSelection() ||
|
25099 |
|
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 |
|
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 |
|
25135 |
|
25136 |
|
25137 |
|
25138 | if (clientHeight != null && clientHeight > 0) {
|
25139 |
|
25140 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
25343 |
|
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 |
|
25367 |
|
25368 | if (!this.active) {
|
25369 | return;
|
25370 | }
|
25371 |
|
25372 |
|
25373 |
|
25374 |
|
25375 |
|
25376 |
|
25377 |
|
25378 | this.addManagedListener(eRow, 'mouseenter', function () { return _this.rowNode.onMouseEnter(); });
|
25379 | this.addManagedListener(eRow, 'mouseleave', function () { return _this.rowNode.onMouseLeave(); });
|
25380 |
|
25381 | this.addManagedListener(this.rowNode, RowNode.EVENT_MOUSE_ENTER, function () {
|
25382 |
|
25383 |
|
25384 |
|
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 |
|
25394 |
|
25395 |
|
25396 |
|
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 |
|
25409 |
|
25410 |
|
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 |
|
25422 |
|
25423 |
|
25424 |
|
25425 |
|
25426 |
|
25427 |
|
25428 |
|
25429 |
|
25430 |
|
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 |
|
25451 | RowCtrl.prototype.destroyFirstPass = function () {
|
25452 | this.active = false;
|
25453 |
|
25454 |
|
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 |
|
25465 |
|
25466 |
|
25467 |
|
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 |
|
25499 | if (!rowFocused && this.editingRow) {
|
25500 | this.stopEditing(false);
|
25501 | }
|
25502 | };
|
25503 | RowCtrl.prototype.onPaginationChanged = function () {
|
25504 | var currentPage = this.beans.paginationProxy.getCurrentPage();
|
25505 |
|
25506 |
|
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 |
|
25518 | this.onTopChanged();
|
25519 | };
|
25520 |
|
25521 |
|
25522 |
|
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 |
|
25534 | if (this.printLayout) {
|
25535 | return;
|
25536 | }
|
25537 |
|
25538 |
|
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 |
|
25554 | if (this.printLayout) {
|
25555 | return '';
|
25556 | }
|
25557 |
|
25558 | var pixels = this.slideRowIn ? this.roundRowTopToBounds(this.rowNode.oldRowTop) : this.rowNode.rowTop;
|
25559 | var afterPaginationPixels = this.applyPaginationOffset(pixels);
|
25560 |
|
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 |
|
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 |
|
25592 |
|
25593 |
|
25594 |
|
25595 |
|
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 |
|
25605 |
|
25606 |
|
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 |
|
25626 | RowCtrl.prototype.getPinnedLeftRowElement = function () {
|
25627 | return this.leftGui ? this.leftGui.element : undefined;
|
25628 | };
|
25629 |
|
25630 | RowCtrl.prototype.getPinnedRightRowElement = function () {
|
25631 | return this.rightGui ? this.rightGui.element : undefined;
|
25632 | };
|
25633 |
|
25634 | RowCtrl.prototype.getBodyRowElement = function () {
|
25635 | return this.centerGui ? this.centerGui.element : undefined;
|
25636 | };
|
25637 |
|
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 |
|
25647 |
|
25648 |
|
25649 |
|
25650 |
|
25651 | var __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 | })();
|
25664 | var __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 | };
|
25670 | var __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 | };
|
25686 | var RowContainerEventsFeature = (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 |
|
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 |
|
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 |
|
25798 | var wasScrollKey = !editing && this.navigationService.handlePageScrollingKey(keyboardEvent);
|
25799 |
|
25800 | if (!wasScrollKey) {
|
25801 | cellCtrl.onKeyDown(keyboardEvent);
|
25802 | }
|
25803 |
|
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 |
|
25850 | if (!keyboardEvent.ctrlKey && !keyboardEvent.metaKey) {
|
25851 | return;
|
25852 | }
|
25853 |
|
25854 |
|
25855 |
|
25856 | if (editing) {
|
25857 | return;
|
25858 | }
|
25859 |
|
25860 |
|
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 |
|
25975 |
|
25976 |
|
25977 |
|
25978 |
|
25979 | var __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 | })();
|
25992 | var __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 |
|
25999 |
|
26000 |
|
26001 | var ViewportSizeFeature = (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 |
|
26020 | this.centerContainerCtrl.registerViewportResizeListener(listener);
|
26021 |
|
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 |
|
26041 |
|
26042 | ViewportSizeFeature.prototype.checkViewportAndScrolls = function () {
|
26043 |
|
26044 | this.updateScrollVisibleService();
|
26045 |
|
26046 | this.checkBodyHeight();
|
26047 |
|
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 |
|
26069 |
|
26070 |
|
26071 |
|
26072 |
|
26073 |
|
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 |
|
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 |
|
26091 |
|
26092 |
|
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 |
|
26121 |
|
26122 |
|
26123 |
|
26124 |
|
26125 | var __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 | })();
|
26138 | var __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 | };
|
26144 | var SetPinnedLeftWidthFeature = (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 |
|
26173 |
|
26174 |
|
26175 |
|
26176 |
|
26177 | var __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 | })();
|
26190 | var __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 | };
|
26196 | var SetPinnedRightWidthFeature = (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 |
|
26225 |
|
26226 |
|
26227 |
|
26228 |
|
26229 | var __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 | })();
|
26242 | var __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 | };
|
26248 | var SetHeightFeature = (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 |
|
26278 |
|
26279 |
|
26280 |
|
26281 |
|
26282 | var __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 | })();
|
26295 | var __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 | };
|
26301 | var DragListenerFeature = (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() ||
|
26311 | missing(this.rangeService)
|
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 |
|
26339 |
|
26340 |
|
26341 |
|
26342 |
|
26343 | var __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 | })();
|
26356 | var __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 | };
|
26362 | var CenterWidthFeature = (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 |
|
26396 |
|
26397 |
|
26398 |
|
26399 |
|
26400 | var __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 | })();
|
26413 | var __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 | };
|
26419 | var __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 | };
|
26435 | var __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 = {}));
|
26459 | function 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 | }
|
26481 | var 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 | ]);
|
26495 | var 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 | ]);
|
26500 | var WrapperCssClasses = convertToMap([
|
26501 | [exports.RowContainerName.CENTER, 'ag-center-cols-clipper'],
|
26502 | ]);
|
26503 | var RowContainerCtrl = (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 |
|
26622 |
|
26623 |
|
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 |
|
26649 |
|
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 |
|
26663 |
|
26664 |
|
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 |
|
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 |
|
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 |
|
26726 | var allRowsRegardlessOfFullWidth = this.getRowCtrls();
|
26727 |
|
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 |
|
26773 |
|
26774 |
|
26775 |
|
26776 |
|
26777 | var __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 | })();
|
26790 | var __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 | };
|
26796 | var GRID_BODY_TEMPLATE = "<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>";
|
26797 | var GridBodyComp = (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 |
|
26880 |
|
26881 |
|
26882 |
|
26883 |
|
26884 | var __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 | })();
|
26897 | var __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 | };
|
26903 | var ScrollVisibleService = (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 |
|
26920 |
|
26921 |
|
26922 |
|
26923 |
|
26924 |
|
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 |
|
26954 | ScrollVisibleService.prototype.isHorizontalScrollShowing = function () {
|
26955 | return this.horizontalScrollShowing;
|
26956 | };
|
26957 |
|
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 |
|
26981 |
|
26982 |
|
26983 |
|
26984 |
|
26985 | var __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 | })();
|
26998 | var __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 | };
|
27004 | var MouseEventService = (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 |
|
27013 |
|
27014 |
|
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 |
|
27022 |
|
27023 |
|
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 |
|
27080 |
|
27081 |
|
27082 |
|
27083 |
|
27084 | var __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 | })();
|
27097 | var __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 | };
|
27108 | var __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 | };
|
27114 | var NavigationService = (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 |
|
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 |
|
27152 |
|
27153 | if (ctrl && !alt && !rangeServiceShouldHandleShift) {
|
27154 | this.onCtrlUpDownLeftRight(key, currentCell);
|
27155 | processed = true;
|
27156 | }
|
27157 | break;
|
27158 | case KeyCode.PAGE_DOWN:
|
27159 |
|
27160 | if (!ctrl && !alt) {
|
27161 | this.onPageDown(currentCell);
|
27162 | processed = true;
|
27163 | }
|
27164 | break;
|
27165 | case KeyCode.PAGE_UP:
|
27166 |
|
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 |
|
27187 | this.animationFrameService.flushAllFrames();
|
27188 |
|
27189 |
|
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 |
|
27275 |
|
27276 |
|
27277 |
|
27278 |
|
27279 |
|
27280 |
|
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 |
|
27353 |
|
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 |
|
27368 | NavigationService.prototype.onTabKeyDown = function (previous, keyboardEvent) {
|
27369 | var backwards = keyboardEvent.shiftKey;
|
27370 | var movedToNextCell = this.tabToNextCellCommon(previous, backwards, keyboardEvent);
|
27371 | if (movedToNextCell) {
|
27372 |
|
27373 |
|
27374 | keyboardEvent.preventDefault();
|
27375 | return;
|
27376 | }
|
27377 |
|
27378 |
|
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 |
|
27389 |
|
27390 |
|
27391 | if (previous instanceof CellCtrl) {
|
27392 | previous.focusCell(true);
|
27393 | }
|
27394 | if (this.focusService.focusNextGridCoreContainer(backwards)) {
|
27395 | keyboardEvent.preventDefault();
|
27396 | }
|
27397 | }
|
27398 | };
|
27399 |
|
27400 | NavigationService.prototype.tabToNextCell = function (backwards, event) {
|
27401 | var focusedCell = this.focusService.getFocusedCell();
|
27402 |
|
27403 | if (!focusedCell) {
|
27404 | return false;
|
27405 | }
|
27406 | var cellOrRow = this.getCellByPosition(focusedCell);
|
27407 |
|
27408 |
|
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 |
|
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 |
|
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 |
|
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 |
|
27447 |
|
27448 |
|
27449 |
|
27450 | previousCell.stopEditing();
|
27451 |
|
27452 | var nextCell = this.findNextCellToFocusOn(previousPos, backwards, true);
|
27453 | if (nextCell == null) {
|
27454 | return false;
|
27455 | }
|
27456 |
|
27457 |
|
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 |
|
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 |
|
27502 | var nextCell = this.findNextCellToFocusOn(cellPos, backwards, false);
|
27503 |
|
27504 |
|
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 |
|
27514 |
|
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 |
|
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 |
|
27551 |
|
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 |
|
27566 |
|
27567 |
|
27568 |
|
27569 |
|
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 |
|
27579 |
|
27580 | var nextCell = this.getCellByPosition(nextPosition);
|
27581 |
|
27582 |
|
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 |
|
27596 |
|
27597 | if (this.rangeService) {
|
27598 | this.rangeService.setRangeToCell(nextPosition);
|
27599 | }
|
27600 |
|
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 |
|
27628 |
|
27629 | NavigationService.prototype.navigateToNextCell = function (event, key, currentCell, allowUserOverride) {
|
27630 |
|
27631 | var nextCell = currentCell;
|
27632 | var hitEdgeOfGrid = false;
|
27633 | while (nextCell && (nextCell === currentCell || !this.isValidNavigateCell(nextCell))) {
|
27634 |
|
27635 |
|
27636 |
|
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 |
|
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 |
|
27657 |
|
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 |
|
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 |
|
27697 |
|
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 |
|
27708 | this.ensureCellVisible(cellPosition);
|
27709 | var cellComp = this.getCellByPosition(cellPosition);
|
27710 |
|
27711 | if (!cellComp) {
|
27712 | return null;
|
27713 | }
|
27714 | cellPosition = cellComp.getCellPosition();
|
27715 |
|
27716 |
|
27717 |
|
27718 |
|
27719 |
|
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 |
|
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 |
|
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 |
|
27787 |
|
27788 | this.gridBodyCon.getScrollFeature().horizontallyScrollHeaderCenterAndFloatingCenter();
|
27789 |
|
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 |
|
27845 |
|
27846 |
|
27847 |
|
27848 |
|
27849 | var __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 | })();
|
27862 | var __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 | };
|
27868 | var PopupEditorWrapper = (function (_super) {
|
27869 | __extends$1c(PopupEditorWrapper, _super);
|
27870 | function PopupEditorWrapper(params) {
|
27871 | var _this = _super.call(this, "<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 |
|
27899 |
|
27900 |
|
27901 |
|
27902 |
|
27903 | var __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 | })();
|
27916 | var CellComp = (function (_super) {
|
27917 | __extends$1d(CellComp, _super);
|
27918 | function CellComp(beans, cellCtrl, printLayout, eRow, editingRow) {
|
27919 | var _this = _super.call(this) || this;
|
27920 |
|
27921 |
|
27922 |
|
27923 |
|
27924 |
|
27925 |
|
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( "<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 |
|
27974 | return this.eCellValue;
|
27975 | }
|
27976 | if (this.eCellWrapper) {
|
27977 |
|
27978 | return this.eCellWrapper;
|
27979 | }
|
27980 |
|
27981 | return this.getGui();
|
27982 | };
|
27983 | CellComp.prototype.setRenderDetails = function (compDetails, valueToDisplay, forceNewCellRendererInstance) {
|
27984 |
|
27985 | var isInlineEditing = this.cellEditor && !this.cellEditorPopupWrapper;
|
27986 | if (isInlineEditing) {
|
27987 | return;
|
27988 | }
|
27989 |
|
27990 | this.firstRender = this.firstRender == null;
|
27991 |
|
27992 | var controlWrapperChanged = this.refreshWrapper(false);
|
27993 |
|
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 |
|
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 |
|
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 |
|
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 | }
|
28091 | var params = compDetails.params;
|
28092 | cellEditorPromise.then(function (c) { return _this.afterCellEditorCreated(versionCopy, c, params, popup, position); });
|
28093 |
|
28094 |
|
28095 |
|
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 |
|
28137 |
|
28138 | if (this.cellRendererClass !== compClassAndParams.componentClass) {
|
28139 | return false;
|
28140 | }
|
28141 |
|
28142 | var result = this.cellRenderer.refresh(compClassAndParams.params);
|
28143 |
|
28144 |
|
28145 |
|
28146 |
|
28147 | return result === true || result === undefined;
|
28148 | };
|
28149 | CellComp.prototype.createCellRendererInstance = function (compDetails) {
|
28150 | var _this = this;
|
28151 |
|
28152 |
|
28153 |
|
28154 |
|
28155 |
|
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 |
|
28167 |
|
28168 | var componentPromise = compDetails.newAgStackInstance();
|
28169 | var callback = _this.afterCellRendererCreated.bind(_this, displayComponentVersionCopy, componentClass);
|
28170 | if (componentPromise) {
|
28171 | componentPromise.then(callback);
|
28172 | }
|
28173 | };
|
28174 |
|
28175 |
|
28176 |
|
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 |
|
28213 |
|
28214 |
|
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 |
|
28250 |
|
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 |
|
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 |
|
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 |
|
28309 |
|
28310 |
|
28311 |
|
28312 |
|
28313 |
|
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 |
|
28323 |
|
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 |
|
28337 |
|
28338 |
|
28339 |
|
28340 |
|
28341 | var __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 | })();
|
28354 | var RowComp = (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( "<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 |
|
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 |
|
28469 | if (!cellComp) {
|
28470 | return;
|
28471 | }
|
28472 |
|
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 |
|
28487 |
|
28488 |
|
28489 |
|
28490 |
|
28491 | var __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 | })();
|
28504 | var __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 | };
|
28515 | var __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 | };
|
28521 | function 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 =
|
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 =
|
28533 | "<div class=\"" + cssClasses.viewport + "\" ref=\"eViewport\" role=\"presentation\">\n <div class=\"" + cssClasses.container + "\" ref=\"eContainer\"></div>\n </div>";
|
28534 | }
|
28535 | else {
|
28536 | res =
|
28537 | "<div class=\"" + cssClasses.container + "\" ref=\"eContainer\"></div>";
|
28538 | }
|
28539 | return res;
|
28540 | }
|
28541 | var RowContainerComp = (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 |
|
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 |
|
28636 |
|
28637 |
|
28638 |
|
28639 |
|
28640 | var __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 | };
|
28646 | var BodyDropPivotTarget = (function () {
|
28647 | function BodyDropPivotTarget(pinned) {
|
28648 | this.columnsToAggregate = [];
|
28649 | this.columnsToGroup = [];
|
28650 | this.columnsToPivot = [];
|
28651 | this.pinned = pinned;
|
28652 | }
|
28653 |
|
28654 | BodyDropPivotTarget.prototype.onDragEnter = function (draggingEvent) {
|
28655 | var _this = this;
|
28656 | this.clearColumnsList();
|
28657 |
|
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 |
|
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 |
|
28692 | BodyDropPivotTarget.prototype.onDragLeave = function (draggingEvent) {
|
28693 |
|
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 |
|
28702 | BodyDropPivotTarget.prototype.onDragging = function (draggingEvent) {
|
28703 | };
|
28704 |
|
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 |
|
28727 |
|
28728 |
|
28729 |
|
28730 |
|
28731 | var __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 | };
|
28737 | var MoveColumnFeature = (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 |
|
28756 | var columns = draggingEvent.dragItem.columns;
|
28757 | var dragCameFromToolPanel = draggingEvent.dragSource.type === exports.DragSourceType.ToolPanel;
|
28758 | if (dragCameFromToolPanel) {
|
28759 |
|
28760 | this.setColumnsVisible(columns, true, "uiColumnDragged");
|
28761 | }
|
28762 | else {
|
28763 |
|
28764 |
|
28765 |
|
28766 |
|
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 |
|
28802 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
28803 | var clientWidth = this.eContainer.clientWidth;
|
28804 | x = clientWidth - x;
|
28805 | }
|
28806 |
|
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 |
|
28815 |
|
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 |
|
28839 | if (missing(draggingEvent.hDirection)) {
|
28840 | return;
|
28841 | }
|
28842 | var mouseXNormalised = this.normaliseX(draggingEvent.x);
|
28843 |
|
28844 |
|
28845 |
|
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 |
|
28855 |
|
28856 | return col.getPinned() == _this.pinned;
|
28857 | }
|
28858 |
|
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 |
|
28876 |
|
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 |
|
28890 |
|
28891 |
|
28892 | var allMovingColumnsOrdered = allMovingColumns.slice();
|
28893 | this.columnModel.sortColumnsLikeGridColumns(allMovingColumnsOrdered);
|
28894 | var validMoves = this.calculateValidMoves(allMovingColumnsOrdered, draggingRight, mouseX);
|
28895 |
|
28896 |
|
28897 | var oldIndex = this.calculateOldIndex(allMovingColumnsOrdered);
|
28898 | if (validMoves.length === 0) {
|
28899 | return;
|
28900 | }
|
28901 | var firstValidMove = validMoves[0];
|
28902 |
|
28903 |
|
28904 |
|
28905 |
|
28906 |
|
28907 |
|
28908 |
|
28909 |
|
28910 | var constrainDirection = oldIndex !== null && !fromEnter;
|
28911 |
|
28912 | if (dragSourceType == exports.DragSourceType.HeaderCell) {
|
28913 | constrainDirection = oldIndex !== null;
|
28914 | }
|
28915 | if (constrainDirection) {
|
28916 |
|
28917 | if (draggingLeft && firstValidMove >= oldIndex) {
|
28918 | return;
|
28919 | }
|
28920 |
|
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 |
|
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 |
|
28941 | var allDisplayedCols = this.columnModel.getDisplayedColumns(this.pinned);
|
28942 |
|
28943 |
|
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 |
|
28949 |
|
28950 |
|
28951 | var displayIndex = 0;
|
28952 | var availableWidth = mouseX;
|
28953 |
|
28954 |
|
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 |
|
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 |
|
28971 | if (draggingRight) {
|
28972 | displayIndex++;
|
28973 | }
|
28974 | }
|
28975 |
|
28976 |
|
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 |
|
28991 |
|
28992 |
|
28993 |
|
28994 |
|
28995 |
|
28996 |
|
28997 |
|
28998 |
|
28999 |
|
29000 | if (draggingRight) {
|
29001 |
|
29002 |
|
29003 | var pointer = firstValidMove + 1;
|
29004 | var lastIndex = allGridCols.length - 1;
|
29005 | while (pointer <= lastIndex) {
|
29006 | validMoves.push(pointer);
|
29007 | pointer++;
|
29008 | }
|
29009 |
|
29010 | validMoves.sort(numberComparator);
|
29011 | }
|
29012 | else {
|
29013 |
|
29014 |
|
29015 |
|
29016 |
|
29017 |
|
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 |
|
29027 | pointer = firstValidMove - 1;
|
29028 | var firstDisplayIndex = 0;
|
29029 | while (pointer >= firstDisplayIndex) {
|
29030 | validMoves.push(pointer);
|
29031 | pointer--;
|
29032 | }
|
29033 |
|
29034 | validMoves.sort(numberComparator).reverse();
|
29035 | }
|
29036 | return validMoves;
|
29037 | };
|
29038 |
|
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 |
|
29064 |
|
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 |
|
29085 |
|
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 |
|
29119 |
|
29120 |
|
29121 |
|
29122 |
|
29123 | var __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 | })();
|
29136 | var __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 | };
|
29142 | var BodyDropTarget = (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 |
|
29197 |
|
29198 |
|
29199 | BodyDropTarget.prototype.isDropColumnInPivotMode = function (draggingEvent) {
|
29200 |
|
29201 |
|
29202 |
|
29203 | return this.columnModel.isPivotMode() && draggingEvent.dragSource.type === exports.DragSourceType.ToolPanel;
|
29204 | };
|
29205 | BodyDropTarget.prototype.onDragEnter = function (draggingEvent) {
|
29206 |
|
29207 |
|
29208 |
|
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 |
|
29241 |
|
29242 |
|
29243 |
|
29244 |
|
29245 | var __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 | };
|
29261 | var __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 | };
|
29265 | var CssClassApplier = (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 |
|
29283 |
|
29284 |
|
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 |
|
29318 |
|
29319 |
|
29320 |
|
29321 |
|
29322 | var __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 | })();
|
29335 | var __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 | };
|
29341 | var HeaderCellComp = (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 |
|
29415 |
|
29416 |
|
29417 |
|
29418 |
|
29419 | var __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 | })();
|
29432 | var __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 | };
|
29438 | var HeaderGroupCellComp = (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 |
|
29490 |
|
29491 |
|
29492 |
|
29493 |
|
29494 | var __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 | })();
|
29507 | var __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 = {}));
|
29518 | var HeaderRowComp = (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( "<div class=\"ag-header-row " + extraClass + "\" role=\"row\"></div>");
|
29526 | _this.ctrl = ctrl;
|
29527 | return _this;
|
29528 | }
|
29529 |
|
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 |
|
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 |
|
29607 |
|
29608 |
|
29609 |
|
29610 |
|
29611 | var __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 | })();
|
29624 | var __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 | };
|
29630 | var instanceIdSequence$3 = 0;
|
29631 | var AbstractHeaderCellCtrl = (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 |
|
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 |
|
29691 |
|
29692 |
|
29693 |
|
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 |
|
29708 |
|
29709 |
|
29710 |
|
29711 |
|
29712 | var __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 | };
|
29718 | function unwrapUserComp(comp) {
|
29719 | var compAsAny = comp;
|
29720 | var isProxy = compAsAny != null && compAsAny.getFrameworkComponentInstance != null;
|
29721 | return isProxy ? compAsAny.getFrameworkComponentInstance() : comp;
|
29722 | }
|
29723 | var GridApi = (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 |
|
29752 | GridApi.prototype.__getAlignedGridService = function () {
|
29753 | return this.alignedGridsService;
|
29754 | };
|
29755 |
|
29756 | GridApi.prototype.__getContext = function () {
|
29757 | return this.context;
|
29758 | };
|
29759 |
|
29760 | GridApi.prototype.addDetailGridInfo = function (id, gridInfo) {
|
29761 | this.detailGridInfoMap[id] = gridInfo;
|
29762 | };
|
29763 |
|
29764 | GridApi.prototype.removeDetailGridInfo = function (id) {
|
29765 | this.detailGridInfoMap[id] = undefined;
|
29766 | };
|
29767 |
|
29768 | GridApi.prototype.getDetailGridInfo = function (id) {
|
29769 | return this.detailGridInfoMap[id];
|
29770 | };
|
29771 |
|
29772 | GridApi.prototype.forEachDetailGridInfo = function (callback) {
|
29773 | var index = 0;
|
29774 | iterateObject(this.detailGridInfoMap, function (id, gridInfo) {
|
29775 |
|
29776 | if (exists(gridInfo)) {
|
29777 | callback(gridInfo, index);
|
29778 | index++;
|
29779 | }
|
29780 | });
|
29781 | };
|
29782 |
|
29783 | GridApi.prototype.getDataAsCsv = function (params) {
|
29784 | if (ModuleRegistry.assertRegistered(exports.ModuleNames.CsvExportModule, 'api.getDataAsCsv')) {
|
29785 | return this.csvCreator.getDataAsCsv(params);
|
29786 | }
|
29787 | };
|
29788 |
|
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 |
|
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 |
|
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 |
|
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 |
|
29833 | GridApi.prototype.getMultipleSheetsAsExcel = function (params) {
|
29834 | if (ModuleRegistry.assertRegistered(exports.ModuleNames.ExcelExportModule, 'api.getMultipleSheetsAsExcel')) {
|
29835 | return this.excelCreator.getMultipleSheetsAsExcel(params);
|
29836 | }
|
29837 | };
|
29838 |
|
29839 | GridApi.prototype.exportMultipleSheetsAsExcel = function (params) {
|
29840 | if (ModuleRegistry.assertRegistered(exports.ModuleNames.ExcelExportModule, 'api.exportMultipleSheetsAsExcel')) {
|
29841 | return this.excelCreator.exportMultipleSheetsAsExcel(params);
|
29842 | }
|
29843 | };
|
29844 |
|
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 |
|
29851 |
|
29852 |
|
29853 |
|
29854 |
|
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 |
|
29870 | GridApi.prototype.setServerSideDatasource = function (datasource) {
|
29871 | if (this.serverSideRowModel) {
|
29872 |
|
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 |
|
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 |
|
29889 | GridApi.prototype.setViewportDatasource = function (viewportDatasource) {
|
29890 | if (this.gridOptionsWrapper.isRowModelViewport()) {
|
29891 |
|
29892 |
|
29893 |
|
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 |
|
29901 | GridApi.prototype.setRowData = function (rowData) {
|
29902 |
|
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 |
|
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 |
|
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 |
|
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 |
|
29928 | GridApi.prototype.getFloatingTopRowCount = function () {
|
29929 | console.warn('AG Grid: since v12, api.getFloatingTopRowCount() is now api.getPinnedTopRowCount()');
|
29930 | return this.getPinnedTopRowCount();
|
29931 | };
|
29932 |
|
29933 | GridApi.prototype.getFloatingBottomRowCount = function () {
|
29934 | console.warn('AG Grid: since v12, api.getFloatingBottomRowCount() is now api.getPinnedBottomRowCount()');
|
29935 | return this.getPinnedBottomRowCount();
|
29936 | };
|
29937 |
|
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 |
|
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 |
|
29948 | GridApi.prototype.setPinnedTopRowData = function (rows) {
|
29949 | this.pinnedRowModel.setPinnedTopRowData(rows);
|
29950 | };
|
29951 |
|
29952 | GridApi.prototype.setPinnedBottomRowData = function (rows) {
|
29953 | this.pinnedRowModel.setPinnedBottomRowData(rows);
|
29954 | };
|
29955 |
|
29956 | GridApi.prototype.getPinnedTopRowCount = function () {
|
29957 | return this.pinnedRowModel.getPinnedTopRowCount();
|
29958 | };
|
29959 |
|
29960 | GridApi.prototype.getPinnedBottomRowCount = function () {
|
29961 | return this.pinnedRowModel.getPinnedBottomRowCount();
|
29962 | };
|
29963 |
|
29964 | GridApi.prototype.getPinnedTopRow = function (index) {
|
29965 | return this.pinnedRowModel.getPinnedTopRow(index);
|
29966 | };
|
29967 |
|
29968 | GridApi.prototype.getPinnedBottomRow = function (index) {
|
29969 | return this.pinnedRowModel.getPinnedBottomRow(index);
|
29970 | };
|
29971 | |
29972 |
|
29973 |
|
29974 | GridApi.prototype.setColumnDefs = function (colDefs, source) {
|
29975 | if (source === void 0) { source = "api"; }
|
29976 | this.columnModel.setColumnDefs(colDefs, source);
|
29977 | };
|
29978 |
|
29979 | GridApi.prototype.setAutoGroupColumnDef = function (colDef, source) {
|
29980 | this.gridOptionsWrapper.setProperty('autoGroupColumnDef', colDef, true);
|
29981 | };
|
29982 |
|
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 |
|
29991 |
|
29992 |
|
29993 |
|
29994 | GridApi.prototype.getVerticalPixelRange = function () {
|
29995 | return this.gridBodyCtrl.getScrollFeature().getVScrollPosition();
|
29996 | };
|
29997 | |
29998 |
|
29999 |
|
30000 |
|
30001 |
|
30002 | GridApi.prototype.getHorizontalPixelRange = function () {
|
30003 | return this.gridBodyCtrl.getScrollFeature().getHScrollPosition();
|
30004 | };
|
30005 |
|
30006 | GridApi.prototype.setAlwaysShowHorizontalScroll = function (show) {
|
30007 | this.gridOptionsWrapper.setProperty('alwaysShowHorizontalScroll', show);
|
30008 | };
|
30009 |
|
30010 | GridApi.prototype.setAlwaysShowVerticalScroll = function (show) {
|
30011 | this.gridOptionsWrapper.setProperty('alwaysShowVerticalScroll', show);
|
30012 | };
|
30013 |
|
30014 | GridApi.prototype.refreshToolPanel = function () {
|
30015 | if (!this.sideBarComp) {
|
30016 | return;
|
30017 | }
|
30018 | this.sideBarComp.refresh();
|
30019 | };
|
30020 |
|
30021 | GridApi.prototype.refreshCells = function (params) {
|
30022 | if (params === void 0) { params = {}; }
|
30023 | if (Array.isArray(params)) {
|
30024 |
|
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 |
|
30031 | GridApi.prototype.flashCells = function (params) {
|
30032 | if (params === void 0) { params = {}; }
|
30033 | this.rowRenderer.flashCells(params);
|
30034 | };
|
30035 |
|
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 |
|
30045 | GridApi.prototype.refreshHeader = function () {
|
30046 | this.ctrlsService.getHeaderRowContainerCtrls().forEach(function (c) { return c.refresh(); });
|
30047 | };
|
30048 |
|
30049 | GridApi.prototype.isAnyFilterPresent = function () {
|
30050 | return this.filterManager.isAnyFilterPresent();
|
30051 | };
|
30052 |
|
30053 | GridApi.prototype.isColumnFilterPresent = function () {
|
30054 | return this.filterManager.isColumnFilterPresent() || this.filterManager.isAggregateFilterPresent();
|
30055 | };
|
30056 |
|
30057 | GridApi.prototype.isQuickFilterPresent = function () {
|
30058 | return this.filterManager.isQuickFilterPresent();
|
30059 | };
|
30060 | |
30061 |
|
30062 |
|
30063 |
|
30064 |
|
30065 | GridApi.prototype.getModel = function () {
|
30066 | return this.rowModel;
|
30067 | };
|
30068 |
|
30069 | GridApi.prototype.setRowNodeExpanded = function (rowNode, expanded) {
|
30070 | if (rowNode) {
|
30071 | rowNode.setExpanded(expanded);
|
30072 | }
|
30073 | };
|
30074 | |
30075 |
|
30076 |
|
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 |
|
30086 |
|
30087 |
|
30088 |
|
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 |
|
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 |
|
30126 | GridApi.prototype.isAnimationFrameQueueEmpty = function () {
|
30127 | return this.animationFrameService.isQueueEmpty();
|
30128 | };
|
30129 | GridApi.prototype.flushAllAnimationFrames = function () {
|
30130 | this.animationFrameService.flushAllFrames();
|
30131 | };
|
30132 | |
30133 |
|
30134 |
|
30135 |
|
30136 |
|
30137 |
|
30138 | GridApi.prototype.getRowNode = function (id) {
|
30139 | return this.rowModel.getRowNode(id);
|
30140 | };
|
30141 | |
30142 |
|
30143 |
|
30144 |
|
30145 | GridApi.prototype.getSizesForCurrentTheme = function () {
|
30146 | return {
|
30147 | rowHeight: this.gridOptionsWrapper.getRowHeightAsNumber(),
|
30148 | headerHeight: this.gridOptionsWrapper.getHeaderHeight()
|
30149 | };
|
30150 | };
|
30151 |
|
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 |
|
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 |
|
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 |
|
30192 |
|
30193 |
|
30194 |
|
30195 |
|
30196 |
|
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 |
|
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 |
|
30241 | GridApi.prototype.selectAll = function () {
|
30242 | this.selectionService.selectAllRowNodes();
|
30243 | };
|
30244 |
|
30245 | GridApi.prototype.deselectAll = function () {
|
30246 | this.selectionService.deselectAllRowNodes();
|
30247 | };
|
30248 |
|
30249 | GridApi.prototype.selectAllFiltered = function () {
|
30250 | this.selectionService.selectAllRowNodes(true);
|
30251 | };
|
30252 |
|
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 |
|
30264 | GridApi.prototype.sizeColumnsToFit = function () {
|
30265 | this.gridBodyCtrl.sizeColumnsToFit();
|
30266 | };
|
30267 |
|
30268 | GridApi.prototype.showLoadingOverlay = function () {
|
30269 | this.overlayWrapperComp.showLoadingOverlay();
|
30270 | };
|
30271 |
|
30272 | GridApi.prototype.showNoRowsOverlay = function () {
|
30273 | this.overlayWrapperComp.showNoRowsOverlay();
|
30274 | };
|
30275 |
|
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 |
|
30289 |
|
30290 |
|
30291 |
|
30292 | GridApi.prototype.getSelectedNodes = function () {
|
30293 | return this.selectionService.getSelectedNodes();
|
30294 | };
|
30295 |
|
30296 | GridApi.prototype.getSelectedRows = function () {
|
30297 | return this.selectionService.getSelectedRows();
|
30298 | };
|
30299 | |
30300 |
|
30301 |
|
30302 |
|
30303 |
|
30304 | GridApi.prototype.getBestCostNodeSelection = function () {
|
30305 | return this.selectionService.getBestCostNodeSelection();
|
30306 | };
|
30307 |
|
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 |
|
30316 |
|
30317 |
|
30318 |
|
30319 |
|
30320 |
|
30321 |
|
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 |
|
30329 |
|
30330 |
|
30331 |
|
30332 |
|
30333 |
|
30334 |
|
30335 |
|
30336 | GridApi.prototype.ensureIndexVisible = function (index, position) {
|
30337 | this.gridBodyCtrl.getScrollFeature().ensureIndexVisible(index, position);
|
30338 | };
|
30339 | |
30340 |
|
30341 |
|
30342 |
|
30343 |
|
30344 |
|
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 |
|
30352 |
|
30353 |
|
30354 |
|
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 |
|
30364 |
|
30365 |
|
30366 |
|
30367 |
|
30368 | GridApi.prototype.forEachNode = function (callback) {
|
30369 | this.rowModel.forEachNode(callback);
|
30370 | };
|
30371 |
|
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 |
|
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 |
|
30387 |
|
30388 |
|
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 |
|
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 |
|
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 |
|
30442 |
|
30443 | GridApi.prototype.getColumnDefs = function () { return this.columnModel.getColumnDefs(); };
|
30444 |
|
30445 | GridApi.prototype.onFilterChanged = function () {
|
30446 | this.filterManager.onFilterChanged();
|
30447 | };
|
30448 | |
30449 |
|
30450 |
|
30451 |
|
30452 | GridApi.prototype.onSortChanged = function () {
|
30453 | this.sortController.onSortChanged('api');
|
30454 | };
|
30455 |
|
30456 | GridApi.prototype.setFilterModel = function (model) {
|
30457 | this.filterManager.setFilterModel(model);
|
30458 | };
|
30459 |
|
30460 | GridApi.prototype.getFilterModel = function () {
|
30461 | return this.filterManager.getFilterModel();
|
30462 | };
|
30463 |
|
30464 | GridApi.prototype.getFocusedCell = function () {
|
30465 | return this.focusService.getFocusedCell();
|
30466 | };
|
30467 |
|
30468 | GridApi.prototype.clearFocusedCell = function () {
|
30469 | return this.focusService.clearFocusedCell();
|
30470 | };
|
30471 |
|
30472 | GridApi.prototype.setFocusedCell = function (rowIndex, colKey, rowPinned) {
|
30473 | this.focusService.setFocusedCell(rowIndex, colKey, rowPinned, true);
|
30474 | };
|
30475 |
|
30476 | GridApi.prototype.setSuppressRowDrag = function (value) {
|
30477 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SUPPRESS_ROW_DRAG, value);
|
30478 | };
|
30479 |
|
30480 | GridApi.prototype.setSuppressMoveWhenRowDragging = function (value) {
|
30481 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SUPPRESS_MOVE_WHEN_ROW_DRAG, value);
|
30482 | };
|
30483 |
|
30484 | GridApi.prototype.setSuppressRowClickSelection = function (value) {
|
30485 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SUPPRESS_ROW_CLICK_SELECTION, value);
|
30486 | };
|
30487 |
|
30488 | GridApi.prototype.addRowDropZone = function (params) {
|
30489 | this.gridBodyCtrl.getRowDragFeature().addRowDropZone(params);
|
30490 | };
|
30491 |
|
30492 | GridApi.prototype.removeRowDropZone = function (params) {
|
30493 | var activeDropTarget = this.dragAndDropService.findExternalZone(params);
|
30494 | if (activeDropTarget) {
|
30495 | this.dragAndDropService.removeDropTarget(activeDropTarget);
|
30496 | }
|
30497 | };
|
30498 |
|
30499 | GridApi.prototype.getRowDropZoneParams = function (events) {
|
30500 | return this.gridBodyCtrl.getRowDragFeature().getRowDropZone(events);
|
30501 | };
|
30502 |
|
30503 | GridApi.prototype.setHeaderHeight = function (headerHeight) {
|
30504 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_HEADER_HEIGHT, headerHeight);
|
30505 | };
|
30506 | |
30507 |
|
30508 |
|
30509 |
|
30510 | GridApi.prototype.setDomLayout = function (domLayout) {
|
30511 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_DOM_LAYOUT, domLayout);
|
30512 | };
|
30513 |
|
30514 | GridApi.prototype.setEnableCellTextSelection = function (selectable) {
|
30515 | this.gridBodyCtrl.setCellTextSelection(selectable);
|
30516 | };
|
30517 |
|
30518 | GridApi.prototype.setFillHandleDirection = function (direction) {
|
30519 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_FILL_HANDLE_DIRECTION, direction);
|
30520 | };
|
30521 |
|
30522 | GridApi.prototype.setGroupHeaderHeight = function (headerHeight) {
|
30523 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GROUP_HEADER_HEIGHT, headerHeight);
|
30524 | };
|
30525 |
|
30526 | GridApi.prototype.setFloatingFiltersHeight = function (headerHeight) {
|
30527 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_FLOATING_FILTERS_HEIGHT, headerHeight);
|
30528 | };
|
30529 |
|
30530 | GridApi.prototype.setPivotHeaderHeight = function (headerHeight) {
|
30531 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PIVOT_HEADER_HEIGHT, headerHeight);
|
30532 | };
|
30533 |
|
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 |
|
30658 | GridApi.prototype.isSideBarVisible = function () {
|
30659 | return this.sideBarComp ? this.sideBarComp.isDisplayed() : false;
|
30660 | };
|
30661 |
|
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 |
|
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 |
|
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 |
|
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 |
|
30696 | GridApi.prototype.getOpenedToolPanel = function () {
|
30697 | return this.sideBarComp ? this.sideBarComp.openedItem() : null;
|
30698 | };
|
30699 |
|
30700 | GridApi.prototype.getSideBar = function () {
|
30701 | return this.gridOptionsWrapper.getSideBar();
|
30702 | };
|
30703 |
|
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 |
|
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 |
|
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 |
|
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 |
|
30745 |
|
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 |
|
30758 | GridApi.prototype.addEventListener = function (eventType, listener) {
|
30759 | var async = this.gridOptionsWrapper.useAsyncEvents();
|
30760 | this.eventService.addEventListener(eventType, listener, async);
|
30761 | };
|
30762 |
|
30763 | GridApi.prototype.addGlobalListener = function (listener) {
|
30764 | var async = this.gridOptionsWrapper.useAsyncEvents();
|
30765 | this.eventService.addGlobalListener(listener, async);
|
30766 | };
|
30767 |
|
30768 | GridApi.prototype.removeEventListener = function (eventType, listener) {
|
30769 | var async = this.gridOptionsWrapper.useAsyncEvents();
|
30770 | this.eventService.removeEventListener(eventType, listener, async);
|
30771 | };
|
30772 |
|
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 |
|
30781 | GridApi.prototype.destroy = function () {
|
30782 |
|
30783 |
|
30784 | if (this.destroyCalled) {
|
30785 | return;
|
30786 | }
|
30787 | this.destroyCalled = true;
|
30788 |
|
30789 | var gridCtrl = this.ctrlsService.getGridCtrl();
|
30790 | if (gridCtrl) {
|
30791 | gridCtrl.destroyGridUi();
|
30792 | }
|
30793 |
|
30794 | this.context.destroy();
|
30795 | };
|
30796 | GridApi.prototype.cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid = function () {
|
30797 |
|
30798 |
|
30799 |
|
30800 |
|
30801 |
|
30802 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
30851 | GridApi.prototype.undoCellEditing = function () {
|
30852 | this.undoRedoService.undo();
|
30853 | };
|
30854 |
|
30855 | GridApi.prototype.redoCellEditing = function () {
|
30856 | this.undoRedoService.redo();
|
30857 | };
|
30858 |
|
30859 | GridApi.prototype.getCurrentUndoSize = function () {
|
30860 | return this.undoRedoService.getCurrentUndoStackSize();
|
30861 | };
|
30862 |
|
30863 | GridApi.prototype.getCurrentRedoSize = function () {
|
30864 | return this.undoRedoService.getCurrentRedoStackSize();
|
30865 | };
|
30866 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
30937 | GridApi.prototype.showColumnMenuAfterButtonClick = function (colKey, buttonElement) {
|
30938 |
|
30939 | var column = this.columnModel.getGridColumn(colKey);
|
30940 | this.menuFactory.showMenuAfterButtonClick(column, buttonElement, 'columnMenu');
|
30941 | };
|
30942 |
|
30943 | GridApi.prototype.showColumnMenuAfterMouseClick = function (colKey, mouseEvent) {
|
30944 |
|
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 |
|
30956 | GridApi.prototype.hidePopupMenu = function () {
|
30957 |
|
30958 | if (this.contextMenuFactory) {
|
30959 | this.contextMenuFactory.hideActiveMenu();
|
30960 | }
|
30961 |
|
30962 | this.menuFactory.hideActiveMenu();
|
30963 | };
|
30964 |
|
30965 | GridApi.prototype.setPopupParent = function (ePopupParent) {
|
30966 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_POPUP_PARENT, ePopupParent);
|
30967 | };
|
30968 |
|
30969 | GridApi.prototype.tabToNextCell = function (event) {
|
30970 | return this.navigationService.tabToNextCell(false, event);
|
30971 | };
|
30972 |
|
30973 | GridApi.prototype.tabToPreviousCell = function (event) {
|
30974 | return this.navigationService.tabToNextCell(true, event);
|
30975 | };
|
30976 |
|
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 |
|
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 |
|
30991 | GridApi.prototype.getEditingCells = function () {
|
30992 | return this.rowRenderer.getEditingCells();
|
30993 | };
|
30994 |
|
30995 | GridApi.prototype.stopEditing = function (cancel) {
|
30996 | if (cancel === void 0) { cancel = false; }
|
30997 | this.rowRenderer.stopEditing(cancel);
|
30998 | };
|
30999 |
|
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 |
|
31022 | GridApi.prototype.addAggFunc = function (key, aggFunc) {
|
31023 | if (this.aggFuncService) {
|
31024 | this.aggFuncService.addAggFunc(key, aggFunc);
|
31025 | }
|
31026 | };
|
31027 |
|
31028 | GridApi.prototype.addAggFuncs = function (aggFuncs) {
|
31029 | if (this.aggFuncService) {
|
31030 | this.aggFuncService.addAggFuncs(aggFuncs);
|
31031 | }
|
31032 | };
|
31033 |
|
31034 | GridApi.prototype.clearAggFuncs = function () {
|
31035 | if (this.aggFuncService) {
|
31036 | this.aggFuncService.clear();
|
31037 | }
|
31038 | };
|
31039 |
|
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 |
|
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 |
|
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 |
|
31077 | this.rowRenderer.refreshFullWidthRows(res.update);
|
31078 |
|
31079 | if (!this.gridOptionsWrapper.isSuppressChangeDetection()) {
|
31080 | this.rowRenderer.refreshCells();
|
31081 | }
|
31082 | return res;
|
31083 | };
|
31084 |
|
31085 | GridApi.prototype.setDeltaSort = function (enable) {
|
31086 | this.gridOptionsWrapper.setProperty('deltaSort', enable);
|
31087 | };
|
31088 |
|
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 |
|
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 |
|
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 |
|
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 |
|
31139 |
|
31140 |
|
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 |
|
31160 |
|
31161 |
|
31162 |
|
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 |
|
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 |
|
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 |
|
31193 |
|
31194 |
|
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 |
|
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 |
|
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 |
|
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 |
|
31250 |
|
31251 |
|
31252 |
|
31253 |
|
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 |
|
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 |
|
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 |
|
31293 | GridApi.prototype.getLastDisplayedRow = function () {
|
31294 | return this.rowRenderer.getLastVirtualRenderedRow();
|
31295 | };
|
31296 |
|
31297 | GridApi.prototype.getDisplayedRowAtIndex = function (index) {
|
31298 | return this.rowModel.getRow(index);
|
31299 | };
|
31300 |
|
31301 | GridApi.prototype.getDisplayedRowCount = function () {
|
31302 | return this.rowModel.getRowCount();
|
31303 | };
|
31304 | |
31305 |
|
31306 |
|
31307 |
|
31308 |
|
31309 | GridApi.prototype.paginationIsLastPageFound = function () {
|
31310 | return this.paginationProxy.isLastPageFound();
|
31311 | };
|
31312 |
|
31313 | GridApi.prototype.paginationGetPageSize = function () {
|
31314 | return this.paginationProxy.getPageSize();
|
31315 | };
|
31316 |
|
31317 | GridApi.prototype.paginationSetPageSize = function (size) {
|
31318 | this.gridOptionsWrapper.setProperty('paginationPageSize', size);
|
31319 | };
|
31320 |
|
31321 | GridApi.prototype.paginationGetCurrentPage = function () {
|
31322 | return this.paginationProxy.getCurrentPage();
|
31323 | };
|
31324 |
|
31325 | GridApi.prototype.paginationGetTotalPages = function () {
|
31326 | return this.paginationProxy.getTotalPages();
|
31327 | };
|
31328 |
|
31329 | GridApi.prototype.paginationGetRowCount = function () {
|
31330 | return this.paginationProxy.getMasterRowCount();
|
31331 | };
|
31332 |
|
31333 | GridApi.prototype.paginationGoToNextPage = function () {
|
31334 | this.paginationProxy.goToNextPage();
|
31335 | };
|
31336 |
|
31337 | GridApi.prototype.paginationGoToPreviousPage = function () {
|
31338 | this.paginationProxy.goToPreviousPage();
|
31339 | };
|
31340 |
|
31341 | GridApi.prototype.paginationGoToFirstPage = function () {
|
31342 | this.paginationProxy.goToFirstPage();
|
31343 | };
|
31344 |
|
31345 | GridApi.prototype.paginationGoToLastPage = function () {
|
31346 | this.paginationProxy.goToLastPage();
|
31347 | };
|
31348 |
|
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 |
|
31468 |
|
31469 |
|
31470 |
|
31471 |
|
31472 | var __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 | })();
|
31485 | var __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 | };
|
31491 | var SetLeftFeature = (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 |
|
31516 |
|
31517 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onLeftChanged.bind(this));
|
31518 |
|
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 |
|
31541 |
|
31542 |
|
31543 |
|
31544 |
|
31545 | this.actualLeft = actualLeft;
|
31546 | this.beans.columnAnimationService.executeNextVMTurn(function () {
|
31547 |
|
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 |
|
31573 | return leftWidth + leftPosition;
|
31574 | };
|
31575 | SetLeftFeature.prototype.setLeft = function (value) {
|
31576 |
|
31577 |
|
31578 |
|
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 |
|
31608 |
|
31609 |
|
31610 |
|
31611 |
|
31612 | var __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 | })();
|
31625 | var __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 | };
|
31631 | var HoverFeature = (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 |
|
31665 |
|
31666 |
|
31667 |
|
31668 |
|
31669 | var __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 | })();
|
31682 | var __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 | };
|
31688 | var HeaderFilterCellCtrl = (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 |
|
31806 |
|
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
|
31859 | };
|
31860 |
|
31861 |
|
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 |
|
31943 |
|
31944 |
|
31945 |
|
31946 |
|
31947 | var __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 | })();
|
31960 | var __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 | };
|
31966 | var ResizeFeature = (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 |
|
32043 |
|
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 |
|
32050 | if (notPinningLeft) {
|
32051 | result *= -1;
|
32052 | }
|
32053 | }
|
32054 | else {
|
32055 |
|
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 |
|
32076 |
|
32077 |
|
32078 |
|
32079 |
|
32080 | var __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 | })();
|
32093 | var AgCheckbox = (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 |
|
32198 |
|
32199 |
|
32200 |
|
32201 |
|
32202 | var __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 | })();
|
32215 | var __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 | };
|
32221 | var SelectAllFeature = (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 |
|
32262 | this.checkRightRowModelType();
|
32263 |
|
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 |
|
32282 | if (selectionCount.selected === 0 && selectionCount.notSelected === 0) {
|
32283 | return false;
|
32284 | }
|
32285 |
|
32286 | if (selectionCount.selected > 0 && selectionCount.notSelected > 0) {
|
32287 | return null;
|
32288 | }
|
32289 |
|
32290 | if (selectionCount.selected > 0) {
|
32291 | return true;
|
32292 | }
|
32293 |
|
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 |
|
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 |
|
32417 |
|
32418 |
|
32419 |
|
32420 |
|
32421 | var __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 | })();
|
32434 | var __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 | };
|
32440 | var HeaderCellCtrl = (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 |
|
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 |
|
32596 | oldClasses.delete(c);
|
32597 | }
|
32598 | else {
|
32599 |
|
32600 | _this.comp.addOrRemoveCssClass(c, true);
|
32601 | }
|
32602 | });
|
32603 |
|
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 |
|
32671 | var attemptRefresh = compInstance != null && this.userCompDetails.componentClass == newCompDetails.componentClass;
|
32672 | var headerCompRefreshed = attemptRefresh ? this.attemptHeaderCompRefresh(newCompDetails.params) : false;
|
32673 | if (headerCompRefreshed) {
|
32674 |
|
32675 |
|
32676 |
|
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 |
|
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 |
|
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 |
|
32709 |
|
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 |
|
32733 |
|
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 |
|
32860 |
|
32861 |
|
32862 |
|
32863 |
|
32864 | var __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 | })();
|
32877 | var __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 | };
|
32883 | var GroupResizeFeature = (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 |
|
32910 | var keys = [];
|
32911 | var leafCols = _this.columnGroup.getDisplayedLeafColumns();
|
32912 | leafCols.forEach(function (column) {
|
32913 |
|
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 |
|
32999 |
|
33000 | GroupResizeFeature.prototype.normaliseDragChange = function (dragChange) {
|
33001 | var result = dragChange;
|
33002 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
33003 |
|
33004 | if (this.pinned !== Constants.PINNED_LEFT) {
|
33005 | result *= -1;
|
33006 | }
|
33007 | }
|
33008 | else if (this.pinned === Constants.PINNED_RIGHT) {
|
33009 |
|
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 |
|
33031 |
|
33032 |
|
33033 |
|
33034 |
|
33035 | var __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 | })();
|
33048 | var __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 | };
|
33054 | var GroupWidthFeature = (function (_super) {
|
33055 | __extends$1t(GroupWidthFeature, _super);
|
33056 | function GroupWidthFeature(comp, columnGroup) {
|
33057 | var _this = _super.call(this) || this;
|
33058 |
|
33059 | _this.removeChildListenersFuncs = [];
|
33060 | _this.columnGroup = columnGroup;
|
33061 | _this.comp = comp;
|
33062 | return _this;
|
33063 | }
|
33064 | GroupWidthFeature.prototype.postConstruct = function () {
|
33065 |
|
33066 | this.addListenersToChildrenColumns();
|
33067 |
|
33068 | this.addManagedListener(this.columnGroup, ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED, this.onDisplayedChildrenChanged.bind(this));
|
33069 | this.onWidthChanged();
|
33070 |
|
33071 |
|
33072 |
|
33073 | this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this));
|
33074 | };
|
33075 | GroupWidthFeature.prototype.addListenersToChildrenColumns = function () {
|
33076 | var _this = this;
|
33077 |
|
33078 | this.removeListenersOnChildrenColumns();
|
33079 |
|
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 |
|
33109 |
|
33110 |
|
33111 |
|
33112 |
|
33113 | var __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 | })();
|
33126 | var __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 | };
|
33132 | var HeaderGroupCellCtrl = (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 |
|
33183 |
|
33184 |
|
33185 |
|
33186 |
|
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 |
|
33241 |
|
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 |
|
33250 |
|
33251 |
|
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 |
|
33278 |
|
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 |
|
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 |
|
33299 |
|
33300 | HeaderGroupCellCtrl.prototype.getDragItemForGroup = function () {
|
33301 | var allColumnsOriginalOrder = this.columnGroup.getProvidedColumnGroup().getLeafColumns();
|
33302 |
|
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 |
|
33313 | allColumnsOriginalOrder.forEach(function (column) { return allColumnsCurrentOrder.push(column); });
|
33314 |
|
33315 | return {
|
33316 | columns: allColumnsCurrentOrder,
|
33317 | visibleState: visibleState
|
33318 | };
|
33319 | };
|
33320 | HeaderGroupCellCtrl.prototype.isSuppressMoving = function () {
|
33321 |
|
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 |
|
33354 |
|
33355 |
|
33356 |
|
33357 |
|
33358 | var __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 | })();
|
33371 | var __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 | };
|
33377 | var instanceIdSequence$4 = 0;
|
33378 | var HeaderRowCtrl = (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 |
|
33400 |
|
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 |
|
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 |
|
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 |
|
33495 |
|
33496 |
|
33497 |
|
33498 | if (child.isEmptyGroup()) {
|
33499 | return;
|
33500 | }
|
33501 | var idOfChild = child.getUniqueId();
|
33502 |
|
33503 | var headerCtrl = oldCtrls[idOfChild];
|
33504 | delete oldCtrls[idOfChild];
|
33505 |
|
33506 |
|
33507 |
|
33508 |
|
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 |
|
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 |
|
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 |
|
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 |
|
33605 |
|
33606 |
|
33607 |
|
33608 |
|
33609 | var __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 | })();
|
33622 | var __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 | };
|
33628 | var __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 | };
|
33644 | var __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 | };
|
33648 | var HeaderRowContainerCtrl = (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 |
|
33733 |
|
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 | }
|
33759 | var hidden = width == 0;
|
33760 | var isRtl = _this.gridOptionsWrapper.isEnableRtl();
|
33761 | var scrollbarWidth = _this.gridOptionsWrapper.getScrollbarWidth();
|
33762 |
|
33763 |
|
33764 |
|
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 |
|
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 |
|
33836 |
|
33837 |
|
33838 |
|
33839 |
|
33840 | var __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 | })();
|
33853 | var __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 | };
|
33859 | var HeaderRowContainerComp = (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 |
|
33875 | setCenterWidth: function (width) { return _this.eCenterContainer.style.width = width; },
|
33876 | setContainerTransform: function (transform) { return _this.eCenterContainer.style.transform = transform; },
|
33877 |
|
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 |
|
33895 |
|
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 |
|
33950 |
|
33951 |
|
33952 |
|
33953 |
|
33954 | var __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 | })();
|
33967 | var __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 = {}));
|
33979 | var HeaderNavigationService = (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 |
|
34002 |
|
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;
|
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 |
|
34050 |
|
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 |
|
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 |
|
34119 |
|
34120 | this.gridBodyCon.getScrollFeature().horizontallyScrollHeaderCenterAndFloatingCenter();
|
34121 |
|
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 |
|
34147 |
|
34148 |
|
34149 |
|
34150 |
|
34151 | var __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 | })();
|
34164 | var __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 | };
|
34170 | var GridHeaderCtrl = (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 |
|
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 |
|
34225 |
|
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 |
|
34296 |
|
34297 |
|
34298 |
|
34299 |
|
34300 | var __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 | })();
|
34313 | var __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 | };
|
34319 | var GridHeaderComp = (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 |
|
34352 |
|
34353 |
|
34354 |
|
34355 |
|
34356 | var __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 | })();
|
34369 | var __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 | };
|
34375 | var HorizontalResizeService = (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 |
|
34391 |
|
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 |
|
34404 | ctrl.setResizeCursor(true);
|
34405 |
|
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 |
|
34435 |
|
34436 |
|
34437 |
|
34438 |
|
34439 | var __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 | })();
|
34452 | var __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 | };
|
34458 | var StandardMenuFactory = (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 |
|
34532 |
|
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 |
|
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 |
|
34573 |
|
34574 |
|
34575 |
|
34576 |
|
34577 | var __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 | })();
|
34590 | var __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 | };
|
34596 | var TabbedLayout = (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 "<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 |
|
34651 | focusService.focusInto(eBody, e.shiftKey);
|
34652 | }
|
34653 | else {
|
34654 |
|
34655 | if (focusService.isFocusUnderManagedComponent(eBody)) {
|
34656 |
|
34657 | activeItem.eHeaderButton.focus();
|
34658 | }
|
34659 | else {
|
34660 | var nextEl = focusService.findNextFocusableElement(eBody, false, e.shiftKey);
|
34661 | if (nextEl) {
|
34662 |
|
34663 | nextEl.focus();
|
34664 | }
|
34665 | else {
|
34666 |
|
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 |
|
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 |
|
34759 |
|
34760 |
|
34761 |
|
34762 |
|
34763 |
|
34764 |
|
34765 |
|
34766 | function 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 |
|
34781 |
|
34782 |
|
34783 |
|
34784 |
|
34785 | var __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 | })();
|
34798 | var __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 | };
|
34804 | var DEBOUNCE_DELAY = 50;
|
34805 | var ResizeObserverService = (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 |
|
34817 |
|
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 |
|
34826 | var widthLastTime = offsetWidth(element);
|
34827 | var heightLastTime = offsetHeight(element);
|
34828 |
|
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 |
|
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 |
|
34866 |
|
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 |
|
34882 |
|
34883 |
|
34884 |
|
34885 |
|
34886 | var __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 | })();
|
34899 | var __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 | };
|
34905 | var AnimationFrameService = (function (_super) {
|
34906 | __extends$1F(AnimationFrameService, _super);
|
34907 | function AnimationFrameService() {
|
34908 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
34909 |
|
34910 |
|
34911 |
|
34912 | _this.createTasksP1 = { list: [], sorted: false };
|
34913 | _this.createTasksP2 = { list: [], sorted: false };
|
34914 |
|
34915 |
|
34916 |
|
34917 | _this.destroyTasks = [];
|
34918 | _this.ticking = false;
|
34919 |
|
34920 |
|
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 |
|
34938 |
|
34939 |
|
34940 |
|
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 |
|
34965 |
|
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 |
|
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 |
|
35038 |
|
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 |
|
35056 |
|
35057 |
|
35058 |
|
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 |
|
35091 |
|
35092 |
|
35093 |
|
35094 |
|
35095 | var __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 | })();
|
35108 | var __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 | };
|
35114 | var RESIZE_CONTAINER_STYLE = 'ag-resizer-wrapper';
|
35115 | var RESIZE_TEMPLATE = "<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>";
|
35116 | var PositionableFeature = (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 |
|
35159 |
|
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 |
|
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 |
|
35405 |
|
35406 | (diff < 0 && e.clientX > xPosition + parentRect.left) ||
|
35407 |
|
35408 |
|
35409 | (diff > 0 && e.clientX < xPosition + parentRect.left));
|
35410 | }
|
35411 | else {
|
35412 | if (anywhereWithin) {
|
35413 |
|
35414 |
|
35415 | skipX = ((diff < 0 && e.clientX > boundaryElRect.right) ||
|
35416 | (diff > 0 && e.clientX < xPosition + parentRect.left));
|
35417 | }
|
35418 | else {
|
35419 | skipX = (
|
35420 |
|
35421 |
|
35422 |
|
35423 | (diff < 0 && e.clientX > boundaryElRect.right) ||
|
35424 |
|
35425 |
|
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 |
|
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 |
|
35446 |
|
35447 |
|
35448 | (diff < 0 && e.clientY > yPosition + parentRect.top + topBuffer) ||
|
35449 |
|
35450 |
|
35451 | (diff > 0 && e.clientY < yPosition + parentRect.top));
|
35452 | }
|
35453 | else {
|
35454 | skipY = (
|
35455 |
|
35456 |
|
35457 | (diff < 0 && e.clientY > boundaryElRect.bottom) ||
|
35458 |
|
35459 |
|
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 |
|
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 |
|
35747 |
|
35748 |
|
35749 |
|
35750 |
|
35751 | var __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 | })();
|
35764 | var __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 | };
|
35770 | var AutoWidthCalculator = (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 |
|
35782 |
|
35783 |
|
35784 |
|
35785 | AutoWidthCalculator.prototype.getPreferredWidthForColumn = function (column, skipHeader) {
|
35786 | var eHeaderCell = this.getHeaderCellForColumn(column);
|
35787 |
|
35788 | if (!eHeaderCell) {
|
35789 | return -1;
|
35790 | }
|
35791 | var elements = this.rowRenderer.getAllCellsForColumn(column);
|
35792 | if (!skipHeader) {
|
35793 |
|
35794 |
|
35795 |
|
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 |
|
35811 | eDummyContainer.style.position = 'fixed';
|
35812 |
|
35813 |
|
35814 | var eBodyContainer = this.centerRowContainerCtrl.getContainerElement();
|
35815 | eBodyContainer.appendChild(eDummyContainer);
|
35816 | elements.forEach(function (el) { return _this.cloneItemIntoDummy(el, eDummyContainer); });
|
35817 |
|
35818 |
|
35819 | var dummyContainerWidth = eDummyContainer.offsetWidth;
|
35820 |
|
35821 | eBodyContainer.removeChild(eDummyContainer);
|
35822 |
|
35823 |
|
35824 | var autoSizePadding = this.gridOptionsWrapper.getAutoSizePadding();
|
35825 | return dummyContainerWidth + autoSizePadding;
|
35826 | };
|
35827 | AutoWidthCalculator.prototype.getHeaderCellForColumn = function (column) {
|
35828 |
|
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 |
|
35840 | var eCellClone = eCell.cloneNode(true);
|
35841 |
|
35842 | eCellClone.style.width = '';
|
35843 |
|
35844 | eCellClone.style.position = 'static';
|
35845 | eCellClone.style.left = '';
|
35846 |
|
35847 |
|
35848 |
|
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 |
|
35860 |
|
35861 |
|
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 |
|
35869 |
|
35870 |
|
35871 | if (item != 'ag-row-position-absolute') {
|
35872 | eCloneParentClassList.add(item);
|
35873 | }
|
35874 | }
|
35875 | break;
|
35876 | }
|
35877 | pointer = pointer.parentElement;
|
35878 | }
|
35879 |
|
35880 |
|
35881 |
|
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 |
|
35905 |
|
35906 |
|
35907 |
|
35908 |
|
35909 | var __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 | })();
|
35922 | var __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 | };
|
35928 | var __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 | };
|
35944 | var __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 | };
|
35948 | var RowRenderer = (function (_super) {
|
35949 | __extends$1I(RowRenderer, _super);
|
35950 | function RowRenderer() {
|
35951 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
35952 | _this.destroyFuncsForColumnListeners = [];
|
35953 |
|
35954 |
|
35955 | _this.rowCtrlsByRowIndex = {};
|
35956 | _this.zombieRowCtrls = {};
|
35957 | _this.allRowCtrls = [];
|
35958 | _this.topRowCtrls = [];
|
35959 | _this.bottomRowCtrls = [];
|
35960 |
|
35961 |
|
35962 |
|
35963 |
|
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 |
|
36009 |
|
36010 |
|
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 |
|
36029 |
|
36030 |
|
36031 |
|
36032 |
|
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 |
|
36054 | this.refreshListenersToColumnsForCellComps();
|
36055 |
|
36056 | this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.refreshListenersToColumnsForCellComps.bind(this));
|
36057 | this.addDestroyFunc(this.removeGridColumnListeners.bind(this));
|
36058 | };
|
36059 |
|
36060 | RowRenderer.prototype.removeGridColumnListeners = function () {
|
36061 | this.destroyFuncsForColumnListeners.forEach(function (func) { return func(); });
|
36062 | this.destroyFuncsForColumnListeners.length = 0;
|
36063 | };
|
36064 |
|
36065 |
|
36066 |
|
36067 |
|
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 |
|
36111 |
|
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 |
|
36120 |
|
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 |
|
36134 |
|
36135 |
|
36136 |
|
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 |
|
36178 | var params = {
|
36179 | recycleRows: true
|
36180 | };
|
36181 | this.redrawAfterModelUpdate(params);
|
36182 | };
|
36183 |
|
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 |
|
36199 | var partialRefresh = rowNodes != null && rowNodes.length > 0;
|
36200 | if (partialRefresh) {
|
36201 | var indexesToRemove = this.getRenderedIndexesForRowNodes(rowNodes);
|
36202 |
|
36203 | this.removeRowCtrls(indexesToRemove);
|
36204 | }
|
36205 |
|
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 |
|
36216 |
|
36217 |
|
36218 |
|
36219 |
|
36220 |
|
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 |
|
36229 |
|
36230 |
|
36231 |
|
36232 |
|
36233 |
|
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 |
|
36241 |
|
36242 | var recycleRows = !this.printLayout && !!params.recycleRows;
|
36243 | var animate = params.animate && this.gridOptionsWrapper.isAnimateRows();
|
36244 |
|
36245 |
|
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 |
|
36272 |
|
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 |
|
36287 | if (this.printLayout) {
|
36288 | this.rowContainerHeightService.setModelHeight(null);
|
36289 | return;
|
36290 | }
|
36291 | var containerHeight = this.paginationProxy.getCurrentPageHeight();
|
36292 |
|
36293 |
|
36294 |
|
36295 |
|
36296 |
|
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 |
|
36319 |
|
36320 |
|
36321 |
|
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 |
|
36335 |
|
36336 |
|
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 |
|
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 |
|
36449 |
|
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 |
|
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 |
|
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 |
|
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 |
|
36518 | RowRenderer.prototype.removeRowCtrls = function (rowsToRemove) {
|
36519 | var _this = this;
|
36520 |
|
36521 |
|
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 |
|
36532 |
|
36533 |
|
36534 |
|
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 |
|
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 |
|
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 |
|
36565 | iterateObject(this.rowCtrlsByRowIndex, checkRowToDraw);
|
36566 |
|
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 |
|
36578 |
|
36579 |
|
36580 |
|
36581 |
|
36582 |
|
36583 | var indexesToDraw = this.calculateIndexesToDraw(rowsToRecycle);
|
36584 | this.removeRowCompsNotToDraw(indexesToDraw);
|
36585 |
|
36586 |
|
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 |
|
36627 |
|
36628 | RowRenderer.prototype.redrawFullWidthEmbeddedRows = function () {
|
36629 |
|
36630 |
|
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 |
|
36645 | if (!rowCtrl.isFullWidth()) {
|
36646 | return false;
|
36647 | }
|
36648 |
|
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 |
|
36667 |
|
36668 |
|
36669 |
|
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 |
|
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 |
|
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 |
|
36707 |
|
36708 | return;
|
36709 | }
|
36710 | }
|
36711 | if (rowNode) {
|
36712 |
|
36713 |
|
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 |
|
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 |
|
36745 |
|
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;
|
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 |
|
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 |
|
36795 | if (firstRowIndex < pageFirstRow) {
|
36796 | firstRowIndex = pageFirstRow;
|
36797 | }
|
36798 | if (lastRowIndex > pageLastRow) {
|
36799 | lastRowIndex = pageLastRow;
|
36800 | }
|
36801 | newFirst = firstRowIndex;
|
36802 | newLast = lastRowIndex;
|
36803 | }
|
36804 |
|
36805 |
|
36806 |
|
36807 |
|
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 |
|
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 |
|
36840 |
|
36841 |
|
36842 | window.setTimeout(function () { return _this.eventService.dispatchEventOnce(event_2); }, 50);
|
36843 | }
|
36844 | };
|
36845 | RowRenderer.prototype.ensureAllRowsInRangeHaveHeightsCalculated = function (topPixel, bottomPixel) {
|
36846 |
|
36847 |
|
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 |
|
36861 |
|
36862 |
|
36863 |
|
36864 |
|
36865 |
|
36866 |
|
36867 |
|
36868 |
|
36869 |
|
36870 |
|
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 |
|
36880 | if (!mightWantToKeepRow) {
|
36881 | return REMOVE_ROW;
|
36882 | }
|
36883 |
|
36884 |
|
36885 |
|
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 |
|
36895 |
|
36896 |
|
36897 |
|
36898 |
|
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 |
|
36934 |
|
36935 | RowRenderer.prototype.isRangeInRenderedViewport = function (startIndex, endIndex) {
|
36936 |
|
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));
|
36984 | var RowCtrlCache = (function () {
|
36985 | function RowCtrlCache(maxCount) {
|
36986 |
|
36987 | this.entriesMap = {};
|
36988 |
|
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 |
|
37014 |
|
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 |
|
37031 |
|
37032 |
|
37033 |
|
37034 |
|
37035 | var __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 | })();
|
37048 | var __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 | };
|
37054 | var ValueFormatterService = (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 |
|
37066 | formatter = suppliedFormatter;
|
37067 | }
|
37068 | else if (useFormatterFromColumn) {
|
37069 |
|
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 |
|
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 |
|
37106 |
|
37107 |
|
37108 |
|
37109 |
|
37110 | var __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 | })();
|
37123 | var __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 | };
|
37129 | var PinnedRowModel = (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;
|
37149 | }
|
37150 | for (var i = 0; i < rows.length; i++) {
|
37151 | var rowNode = rows[i];
|
37152 | var rowTopPixel = rowNode.rowTop + rowNode.rowHeight - 1;
|
37153 |
|
37154 |
|
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 |
|
37262 |
|
37263 |
|
37264 |
|
37265 |
|
37266 | (function (ServerSideTransactionResultStatus) {
|
37267 |
|
37268 | ServerSideTransactionResultStatus["Applied"] = "Applied";
|
37269 | |
37270 |
|
37271 |
|
37272 |
|
37273 | ServerSideTransactionResultStatus["StoreNotFound"] = "StoreNotFound";
|
37274 | |
37275 |
|
37276 |
|
37277 | ServerSideTransactionResultStatus["StoreLoading"] = "StoreLoading";
|
37278 | |
37279 |
|
37280 |
|
37281 | ServerSideTransactionResultStatus["StoreWaitingToLoad"] = "StoreWaitingToLoad";
|
37282 | |
37283 |
|
37284 |
|
37285 | ServerSideTransactionResultStatus["StoreLoadingFailed"] = "StoreLoadingFailed";
|
37286 | |
37287 |
|
37288 |
|
37289 | ServerSideTransactionResultStatus["StoreWrongType"] = "StoreWrongType";
|
37290 | |
37291 |
|
37292 |
|
37293 |
|
37294 | ServerSideTransactionResultStatus["Cancelled"] = "Cancelled";
|
37295 | })(exports.ServerSideTransactionResultStatus || (exports.ServerSideTransactionResultStatus = {}));
|
37296 |
|
37297 |
|
37298 |
|
37299 |
|
37300 |
|
37301 |
|
37302 |
|
37303 |
|
37304 |
|
37305 |
|
37306 |
|
37307 |
|
37308 |
|
37309 | var ChangedPath = (function () {
|
37310 | function ChangedPath(keepingColumns, rootNode) {
|
37311 |
|
37312 |
|
37313 |
|
37314 |
|
37315 |
|
37316 |
|
37317 | this.active = true;
|
37318 |
|
37319 |
|
37320 | this.nodeIdsToColumns = {};
|
37321 |
|
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 |
|
37331 |
|
37332 |
|
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 |
|
37362 |
|
37363 | ChangedPath.prototype.forEachChangedNodeDepthFirst = function (callback, traverseLeafNodes) {
|
37364 | if (traverseLeafNodes === void 0) { traverseLeafNodes = false; }
|
37365 | if (this.active) {
|
37366 |
|
37367 |
|
37368 | this.depthFirstSearchChangedPath(this.pathRoot, callback);
|
37369 | }
|
37370 | else {
|
37371 |
|
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 |
|
37400 |
|
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 |
|
37421 |
|
37422 |
|
37423 | ChangedPath.prototype.addParentNode = function (rowNode, columns) {
|
37424 | if (!rowNode || rowNode.isRowPinned()) {
|
37425 | return;
|
37426 | }
|
37427 |
|
37428 |
|
37429 |
|
37430 |
|
37431 |
|
37432 | var newEntryCount = this.createPathItems(rowNode);
|
37433 |
|
37434 | this.linkPathItems(rowNode, newEntryCount);
|
37435 |
|
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 |
|
37462 |
|
37463 |
|
37464 |
|
37465 |
|
37466 | var __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 | })();
|
37479 | var RowNodeBlock = (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 |
|
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 |
|
37522 |
|
37523 | var thisIsMostRecentRequest = version === this.version;
|
37524 |
|
37525 |
|
37526 | var weAreNotDestroyed = this.isAlive();
|
37527 | return thisIsMostRecentRequest && weAreNotDestroyed;
|
37528 | };
|
37529 | RowNodeBlock.prototype.successCommon = function (version, params) {
|
37530 |
|
37531 |
|
37532 |
|
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 |
|
37543 |
|
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 |
|
37561 |
|
37562 |
|
37563 |
|
37564 |
|
37565 | var __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 | })();
|
37578 | var __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 | };
|
37584 | var __param$4 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
37585 | return function (target, key) { decorator(target, key, paramIndex); }
|
37586 | };
|
37587 | var RowNodeBlockLoader = (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 |
|
37610 |
|
37611 |
|
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 |
|
37691 |
|
37692 |
|
37693 |
|
37694 |
|
37695 | var __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 | })();
|
37708 | var __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 | };
|
37714 | var PaginationProxy = (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 |
|
37760 |
|
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 |
|
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 |
|
37931 |
|
37932 |
|
37933 | this.masterRowCount = this.rowModel.getTopLevelRowCount();
|
37934 |
|
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 |
|
37954 | if (masterPageEndIndex === masterLastRowIndex) {
|
37955 |
|
37956 | this.bottomDisplayedRowIndex = this.rowModel.getRowCount() - 1;
|
37957 | }
|
37958 | else {
|
37959 | var firstIndexNotToShow = this.rowModel.getTopLevelRowDisplayedIndex(masterPageEndIndex + 1);
|
37960 |
|
37961 |
|
37962 |
|
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 |
|
38016 |
|
38017 |
|
38018 |
|
38019 |
|
38020 | var __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 | })();
|
38033 | var __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 | };
|
38039 | var StylingService = (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 |
|
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 |
|
38078 |
|
38079 |
|
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 |
|
38120 |
|
38121 |
|
38122 |
|
38123 |
|
38124 | var __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 | })();
|
38137 | var AgRadioButton = (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 |
|
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 |
|
38160 |
|
38161 |
|
38162 |
|
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 |
|
38179 |
|
38180 |
|
38181 |
|
38182 |
|
38183 | var __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 | })();
|
38196 | var AgToggleButton = (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 |
|
38211 |
|
38212 |
|
38213 |
|
38214 |
|
38215 | var __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 | })();
|
38228 | var AgInputTextField = (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 |
|
38269 |
|
38270 |
|
38271 |
|
38272 |
|
38273 | var __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 | })();
|
38286 | var AgInputTextArea = (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 |
|
38309 |
|
38310 |
|
38311 |
|
38312 |
|
38313 | var __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 | })();
|
38326 | var AgInputNumberField = (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 |
|
38407 |
|
38408 |
|
38409 |
|
38410 |
|
38411 | var __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 | })();
|
38424 | var AgInputRange = (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 |
|
38477 |
|
38478 |
|
38479 |
|
38480 |
|
38481 | var __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 | })();
|
38494 | var __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 | };
|
38500 | var AgSlider = (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 |
|
38578 |
|
38579 |
|
38580 |
|
38581 |
|
38582 | var __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 | })();
|
38595 | var __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 | };
|
38601 | var AgAngleSelect = (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 |
|
38791 |
|
38792 |
|
38793 |
|
38794 |
|
38795 | var __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 | })();
|
38808 | var __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 | };
|
38814 | var __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 | };
|
38830 | var AgColorPanel = (function (_super) {
|
38831 | __extends$1X(AgColorPanel, _super);
|
38832 | function AgColorPanel(config) {
|
38833 | var _this = _super.call(this, AgColorPanel.TEMPLATE) || this;
|
38834 | _this.H = 1;
|
38835 | _this.S = 1;
|
38836 | _this.B = 1;
|
38837 | _this.A = 1;
|
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 |
|
38855 |
|
38856 |
|
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 |
|
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 |
|
38958 |
|
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 |
|
39011 | recentColors = recentColors.filter(function (currentColor) { return currentColor != rgbaColor; });
|
39012 |
|
39013 | recentColors = [rgbaColor].concat(recentColors);
|
39014 |
|
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 |
|
39059 |
|
39060 |
|
39061 |
|
39062 |
|
39063 | var __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 | })();
|
39076 | var __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 | };
|
39082 | var AgPanel = (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 "<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 |
|
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 |
|
39247 |
|
39248 |
|
39249 |
|
39250 |
|
39251 | var __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 | })();
|
39264 | var __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 | };
|
39275 | var __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 | };
|
39281 | var AgDialog = (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( "<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 |
|
39417 |
|
39418 |
|
39419 |
|
39420 |
|
39421 | var __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 | })();
|
39434 | var AgColorPicker = (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 |
|
39476 |
|
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 |
|
39509 |
|
39510 |
|
39511 |
|
39512 |
|
39513 | var __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 | })();
|
39526 | var __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 | };
|
39532 | var AgGroupComponent = (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 "<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 |
|
39738 |
|
39739 |
|
39740 |
|
39741 |
|
39742 | var __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 | })();
|
39755 | var __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 | };
|
39761 | var TabGuardCtrl = (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 |
|
39854 |
|
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 |
|
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 |
|
39900 |
|
39901 |
|
39902 |
|
39903 |
|
39904 | var __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 | })();
|
39917 | var __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 | };
|
39933 | var __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 | };
|
39937 | var TabGuardComp = (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 |
|
40002 |
|
40003 |
|
40004 |
|
40005 |
|
40006 | var __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 | })();
|
40019 | var __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 | };
|
40030 | var __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 | };
|
40036 | var AgMenuList = (function (_super) {
|
40037 | __extends$22(AgMenuList, _super);
|
40038 | function AgMenuList(level) {
|
40039 | if (level === void 0) { level = 1; }
|
40040 | var _this = _super.call(this, "<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 = "\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 |
|
40219 |
|
40220 |
|
40221 |
|
40222 |
|
40223 | var __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 | })();
|
40236 | var __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 | };
|
40242 | var AgMenuPanel = (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 |
|
40282 |
|
40283 |
|
40284 |
|
40285 |
|
40286 | var __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 | })();
|
40299 | var __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 | };
|
40305 | var AgMenuItemComponent = (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( "<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 |
|
40337 |
|
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( "<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 |
|
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( "<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( "<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( "<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( "<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 |
|
40562 | this.activateTimeoutId = window.setTimeout(function () { return _this.activate(true); }, AgMenuItemComponent.ACTIVATION_DELAY);
|
40563 | }
|
40564 | else {
|
40565 |
|
40566 | this.activate(true);
|
40567 | }
|
40568 | };
|
40569 | AgMenuItemComponent.prototype.onMouseLeave = function () {
|
40570 | var _this = this;
|
40571 | this.cancelActivate();
|
40572 | if (this.isSubMenuOpen()) {
|
40573 |
|
40574 | this.deactivateTimeoutId = window.setTimeout(function () { return _this.deactivate(); }, AgMenuItemComponent.ACTIVATION_DELAY);
|
40575 | }
|
40576 | else {
|
40577 |
|
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 |
|
40599 |
|
40600 |
|
40601 |
|
40602 |
|
40603 | var __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 | })();
|
40616 | var __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 | };
|
40622 | var __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 | };
|
40638 | var __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 | };
|
40642 | var FocusService = (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 |
|
40650 |
|
40651 |
|
40652 |
|
40653 |
|
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 |
|
40670 |
|
40671 |
|
40672 |
|
40673 |
|
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 |
|
40689 |
|
40690 |
|
40691 |
|
40692 |
|
40693 |
|
40694 | FocusService.toggleKeyboardMode = function (event) {
|
40695 | var isKeyboardActive = FocusService_1.keyboardModeActive;
|
40696 | var isKeyboardEvent = event.type === 'keydown';
|
40697 | if (isKeyboardEvent) {
|
40698 |
|
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 |
|
40738 |
|
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 |
|
40752 |
|
40753 |
|
40754 |
|
40755 |
|
40756 |
|
40757 |
|
40758 | FocusService.prototype.getFocusCellToUseAfterRefresh = function () {
|
40759 | var eDocument = this.gridOptionsWrapper.getDocument();
|
40760 | if (this.gridOptionsWrapper.isSuppressFocusAfterRefresh() || !this.focusedCellPosition) {
|
40761 | return null;
|
40762 | }
|
40763 |
|
40764 |
|
40765 |
|
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 |
|
40777 |
|
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 |
|
40805 |
|
40806 |
|
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 |
|
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 |
|
41015 |
|
41016 |
|
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 |
|
41099 |
|
41100 |
|
41101 |
|
41102 |
|
41103 | var __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 | })();
|
41116 | var __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 | };
|
41122 | var DIRECTION;
|
41123 | (function (DIRECTION) {
|
41124 | DIRECTION[DIRECTION["vertical"] = 0] = "vertical";
|
41125 | DIRECTION[DIRECTION["horizontal"] = 1] = "horizontal";
|
41126 | })(DIRECTION || (DIRECTION = {}));
|
41127 | var instanceIdSeq = 0;
|
41128 | var PopupService = (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 |
|
41163 |
|
41164 |
|
41165 | var x;
|
41166 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
41167 |
|
41168 | x = xLeftPosition();
|
41169 | if (x < 0) {
|
41170 | x = xRightPosition();
|
41171 | }
|
41172 | if (x > maxX) {
|
41173 | x = 0;
|
41174 | }
|
41175 | }
|
41176 | else {
|
41177 |
|
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 |
|
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 |
|
41285 |
|
41286 |
|
41287 |
|
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 |
|
41389 |
|
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 |
|
41429 |
|
41430 | _this.isEventFromCurrentPopup({ mouseEvent: mouseEvent, touchEvent: touchEvent }, eChild) ||
|
41431 |
|
41432 | _this.isEventSameChainAsOriginalEvent({ originalMouseEvent: click, mouseEvent: mouseEvent, touchEvent: touchEvent }) ||
|
41433 |
|
41434 |
|
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 |
|
41457 |
|
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 |
|
41474 |
|
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 |
|
41514 |
|
41515 |
|
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 |
|
41529 |
|
41530 | PopupService.prototype.isEventSameChainAsOriginalEvent = function (params) {
|
41531 | var originalMouseEvent = params.originalMouseEvent, mouseEvent = params.mouseEvent, touchEvent = params.touchEvent;
|
41532 |
|
41533 |
|
41534 |
|
41535 |
|
41536 | var mouseEventOrTouch = null;
|
41537 | if (mouseEvent) {
|
41538 |
|
41539 | mouseEventOrTouch = mouseEvent;
|
41540 | }
|
41541 | else if (touchEvent) {
|
41542 |
|
41543 | mouseEventOrTouch = touchEvent.touches[0];
|
41544 | }
|
41545 | if (mouseEventOrTouch && originalMouseEvent) {
|
41546 |
|
41547 |
|
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 |
|
41638 |
|
41639 |
|
41640 |
|
41641 |
|
41642 | var __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 | })();
|
41655 | var __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 | };
|
41661 | var VirtualList = (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 |
|
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 "\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 |
|
41786 | eGui.scrollTop = rowTopPixel;
|
41787 | }
|
41788 | else if (viewportScrolledBeforeRow) {
|
41789 |
|
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 |
|
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 |
|
41838 | this.renderedRows.forEach(function (_, rowIndex) {
|
41839 | if ((rowIndex < start || rowIndex > finish) && rowIndex !== _this.lastFocusedRowIndex) {
|
41840 | _this.removeRow(rowIndex);
|
41841 | }
|
41842 | });
|
41843 |
|
41844 | for (var rowIndex = start; rowIndex <= finish; rowIndex++) {
|
41845 | if (this.renderedRows.has(rowIndex)) {
|
41846 | continue;
|
41847 | }
|
41848 |
|
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 |
|
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 |
|
41923 |
|
41924 |
|
41925 |
|
41926 |
|
41927 | var OUTSIDE_ANGULAR_EVENTS = ['mouseover', 'mouseout', 'mouseenter', 'mouseleave'];
|
41928 | var PASSIVE_EVENTS$1 = ['touchstart', 'touchend', 'touchmove', 'touchcancel'];
|
41929 |
|
41930 | var VanillaFrameworkOverrides = (function () {
|
41931 | function VanillaFrameworkOverrides() {
|
41932 | this.isOutsideAngular = function (eventType) { return includes(OUTSIDE_ANGULAR_EVENTS, eventType); };
|
41933 | }
|
41934 |
|
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 |
|
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 |
|
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 |
|
41963 |
|
41964 |
|
41965 |
|
41966 |
|
41967 | var __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 | })();
|
41980 | var __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 | };
|
41986 | var CellNavigationService = (function (_super) {
|
41987 | __extends$28(CellNavigationService, _super);
|
41988 | function CellNavigationService() {
|
41989 | return _super !== null && _super.apply(this, arguments) || this;
|
41990 | }
|
41991 |
|
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 |
|
42023 |
|
42024 | var pointer = focusedCell;
|
42025 | var finished = false;
|
42026 |
|
42027 |
|
42028 |
|
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 |
|
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 |
|
42118 | var index = rowPosition.rowIndex;
|
42119 | var pinned = rowPosition.rowPinned;
|
42120 | if (this.isLastRowInContainer(rowPosition)) {
|
42121 | switch (pinned) {
|
42122 | case Constants.PINNED_BOTTOM:
|
42123 |
|
42124 | return null;
|
42125 | case Constants.PINNED_TOP:
|
42126 |
|
42127 |
|
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 |
|
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 |
|
42175 | var index = rowPosition.rowIndex;
|
42176 | var pinned = rowPosition.rowPinned;
|
42177 | var isFirstRow = pinned ? index === 0 : index === this.paginationProxy.getPageFirstRow();
|
42178 |
|
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 |
|
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 |
|
42233 | var newColumn = this.columnModel.getDisplayedColAfter(gridCell.column);
|
42234 |
|
42235 | if (!newColumn) {
|
42236 | newColumn = displayedColumns[0];
|
42237 | var rowBelow = this.getRowBelow(gridCell);
|
42238 | if (missing(rowBelow)) {
|
42239 | return null;
|
42240 | }
|
42241 |
|
42242 |
|
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 |
|
42256 | var newColumn = this.columnModel.getDisplayedColBefore(gridCell.column);
|
42257 |
|
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 |
|
42265 |
|
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 |
|
42294 |
|
42295 |
|
42296 |
|
42297 |
|
42298 | var __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 | })();
|
42311 | var __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 | };
|
42317 | var __param$5 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
42318 | return function (target, key) { decorator(target, key, paramIndex); }
|
42319 | };
|
42320 | var AlignedGridsService = (function (_super) {
|
42321 | __extends$29(AlignedGridsService, _super);
|
42322 | function AlignedGridsService() {
|
42323 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
42324 |
|
42325 |
|
42326 |
|
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 |
|
42342 | AlignedGridsService.prototype.fireEvent = function (callback) {
|
42343 |
|
42344 |
|
42345 | if (this.consuming) {
|
42346 | return;
|
42347 | }
|
42348 |
|
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 |
|
42360 |
|
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 |
|
42427 |
|
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 |
|
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 |
|
42451 |
|
42452 | var masterColumn = colEvent.column;
|
42453 | var otherColumn = null;
|
42454 | if (masterColumn) {
|
42455 | otherColumn = this.columnModel.getPrimaryColumn(masterColumn.getColId());
|
42456 | }
|
42457 |
|
42458 |
|
42459 | if (masterColumn && !otherColumn) {
|
42460 | return;
|
42461 | }
|
42462 |
|
42463 |
|
42464 | var masterColumns = this.getMasterColumns(colEvent);
|
42465 | switch (colEvent.type) {
|
42466 | case Events.EVENT_COLUMN_MOVED:
|
42467 |
|
42468 |
|
42469 |
|
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 |
|
42480 |
|
42481 |
|
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 |
|
42539 |
|
42540 |
|
42541 |
|
42542 |
|
42543 | var __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 | })();
|
42556 | var __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 | };
|
42562 | var __param$6 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
42563 | return function (target, key) { decorator(target, key, paramIndex); }
|
42564 | };
|
42565 | var SelectionService = (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 |
|
42611 | SelectionService.prototype.updateGroupsFromChildrenSelections = function (changedPath) {
|
42612 |
|
42613 | if (!this.gridOptionsWrapper.isGroupSelectsChildren()) {
|
42614 | return;
|
42615 | }
|
42616 |
|
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 |
|
42632 |
|
42633 |
|
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 |
|
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 |
|
42681 |
|
42682 |
|
42683 |
|
42684 |
|
42685 |
|
42686 |
|
42687 |
|
42688 |
|
42689 |
|
42690 |
|
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 |
|
42716 |
|
42717 |
|
42718 |
|
42719 |
|
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 |
|
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 |
|
42741 |
|
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 |
|
42779 | if (rowNode) {
|
42780 | callback(rowNode);
|
42781 | }
|
42782 | });
|
42783 |
|
42784 | this.reset();
|
42785 | }
|
42786 |
|
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 |
|
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 |
|
42823 |
|
42824 |
|
42825 | SelectionService.prototype.selectNode = function (rowNode, tryMulti) {
|
42826 | if (rowNode) {
|
42827 | rowNode.setSelectedParams({ newValue: true, clearSelection: !tryMulti });
|
42828 | }
|
42829 | };
|
42830 | |
42831 |
|
42832 |
|
42833 |
|
42834 | SelectionService.prototype.deselectIndex = function (rowIndex) {
|
42835 | var node = this.rowModel.getRow(rowIndex);
|
42836 | this.deselectNode(node);
|
42837 | };
|
42838 | |
42839 |
|
42840 |
|
42841 |
|
42842 | SelectionService.prototype.deselectNode = function (rowNode) {
|
42843 | if (rowNode) {
|
42844 | rowNode.setSelectedParams({ newValue: false, clearSelection: false });
|
42845 | }
|
42846 | };
|
42847 | |
42848 |
|
42849 |
|
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 |
|
42878 |
|
42879 |
|
42880 |
|
42881 |
|
42882 | var __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 | };
|
42888 | var ColumnApi = (function () {
|
42889 | function ColumnApi() {
|
42890 | }
|
42891 |
|
42892 | ColumnApi.prototype.sizeColumnsToFit = function (gridWidth) {
|
42893 |
|
42894 |
|
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 |
|
42901 | ColumnApi.prototype.setColumnGroupOpened = function (group, newValue) { this.columnModel.setColumnGroupOpened(group, newValue, 'api'); };
|
42902 |
|
42903 | ColumnApi.prototype.getColumnGroup = function (name, instanceId) { return this.columnModel.getColumnGroup(name, instanceId); };
|
42904 |
|
42905 | ColumnApi.prototype.getProvidedColumnGroup = function (name) { return this.columnModel.getProvidedColumnGroup(name); };
|
42906 |
|
42907 | ColumnApi.prototype.getDisplayNameForColumn = function (column, location) { return this.columnModel.getDisplayNameForColumn(column, location) || ''; };
|
42908 |
|
42909 | ColumnApi.prototype.getDisplayNameForColumnGroup = function (columnGroup, location) { return this.columnModel.getDisplayNameForColumnGroup(columnGroup, location) || ''; };
|
42910 |
|
42911 | ColumnApi.prototype.getColumn = function (key) { return this.columnModel.getPrimaryColumn(key); };
|
42912 |
|
42913 | ColumnApi.prototype.applyColumnState = function (params) { return this.columnModel.applyColumnState(params, 'api'); };
|
42914 |
|
42915 | ColumnApi.prototype.getColumnState = function () { return this.columnModel.getColumnState(); };
|
42916 |
|
42917 | ColumnApi.prototype.resetColumnState = function () { this.columnModel.resetColumnState('api'); };
|
42918 |
|
42919 | ColumnApi.prototype.getColumnGroupState = function () { return this.columnModel.getColumnGroupState(); };
|
42920 |
|
42921 | ColumnApi.prototype.setColumnGroupState = function (stateItems) { this.columnModel.setColumnGroupState(stateItems, 'api'); };
|
42922 |
|
42923 | ColumnApi.prototype.resetColumnGroupState = function () { this.columnModel.resetColumnGroupState('api'); };
|
42924 |
|
42925 | ColumnApi.prototype.isPinning = function () { return this.columnModel.isPinningLeft() || this.columnModel.isPinningRight(); };
|
42926 |
|
42927 | ColumnApi.prototype.isPinningLeft = function () { return this.columnModel.isPinningLeft(); };
|
42928 |
|
42929 | ColumnApi.prototype.isPinningRight = function () { return this.columnModel.isPinningRight(); };
|
42930 |
|
42931 | ColumnApi.prototype.getDisplayedColAfter = function (col) { return this.columnModel.getDisplayedColAfter(col); };
|
42932 |
|
42933 | ColumnApi.prototype.getDisplayedColBefore = function (col) { return this.columnModel.getDisplayedColBefore(col); };
|
42934 |
|
42935 | ColumnApi.prototype.setColumnVisible = function (key, visible) { this.columnModel.setColumnVisible(key, visible, 'api'); };
|
42936 |
|
42937 | ColumnApi.prototype.setColumnsVisible = function (keys, visible) { this.columnModel.setColumnsVisible(keys, visible, 'api'); };
|
42938 |
|
42939 | ColumnApi.prototype.setColumnPinned = function (key, pinned) { this.columnModel.setColumnPinned(key, pinned, 'api'); };
|
42940 |
|
42941 | ColumnApi.prototype.setColumnsPinned = function (keys, pinned) { this.columnModel.setColumnsPinned(keys, pinned, 'api'); };
|
42942 |
|
42943 | ColumnApi.prototype.getAllColumns = function () { return this.columnModel.getAllPrimaryColumns(); };
|
42944 | |
42945 |
|
42946 |
|
42947 |
|
42948 |
|
42949 |
|
42950 |
|
42951 | ColumnApi.prototype.getAllGridColumns = function () { return this.columnModel.getAllGridColumns(); };
|
42952 |
|
42953 | ColumnApi.prototype.getDisplayedLeftColumns = function () { return this.columnModel.getDisplayedLeftColumns(); };
|
42954 |
|
42955 | ColumnApi.prototype.getDisplayedCenterColumns = function () { return this.columnModel.getDisplayedCenterColumns(); };
|
42956 |
|
42957 | ColumnApi.prototype.getDisplayedRightColumns = function () { return this.columnModel.getDisplayedRightColumns(); };
|
42958 |
|
42959 | ColumnApi.prototype.getAllDisplayedColumns = function () { return this.columnModel.getAllDisplayedColumns(); };
|
42960 |
|
42961 | ColumnApi.prototype.getAllDisplayedVirtualColumns = function () { return this.columnModel.getViewportColumns(); };
|
42962 |
|
42963 | ColumnApi.prototype.moveColumn = function (key, toIndex) {
|
42964 | if (typeof key === 'number') {
|
42965 |
|
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 |
|
42974 | ColumnApi.prototype.moveColumnByIndex = function (fromIndex, toIndex) { this.columnModel.moveColumnByIndex(fromIndex, toIndex, 'api'); };
|
42975 |
|
42976 | ColumnApi.prototype.moveColumns = function (columnsToMoveKeys, toIndex) { this.columnModel.moveColumns(columnsToMoveKeys, toIndex, 'api'); };
|
42977 |
|
42978 | ColumnApi.prototype.moveRowGroupColumn = function (fromIndex, toIndex) { this.columnModel.moveRowGroupColumn(fromIndex, toIndex); };
|
42979 |
|
42980 | ColumnApi.prototype.setColumnAggFunc = function (key, aggFunc) { this.columnModel.setColumnAggFunc(key, aggFunc); };
|
42981 |
|
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 |
|
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 |
|
42992 | ColumnApi.prototype.setPivotMode = function (pivotMode) { this.columnModel.setPivotMode(pivotMode); };
|
42993 |
|
42994 | ColumnApi.prototype.isPivotMode = function () { return this.columnModel.isPivotMode(); };
|
42995 |
|
42996 | ColumnApi.prototype.getSecondaryPivotColumn = function (pivotKeys, valueColKey) { return this.columnModel.getSecondaryPivotColumn(pivotKeys, valueColKey); };
|
42997 |
|
42998 | ColumnApi.prototype.setValueColumns = function (colKeys) { this.columnModel.setValueColumns(colKeys, 'api'); };
|
42999 |
|
43000 | ColumnApi.prototype.getValueColumns = function () { return this.columnModel.getValueColumns(); };
|
43001 |
|
43002 | ColumnApi.prototype.removeValueColumn = function (colKey) { this.columnModel.removeValueColumn(colKey, 'api'); };
|
43003 |
|
43004 | ColumnApi.prototype.removeValueColumns = function (colKeys) { this.columnModel.removeValueColumns(colKeys, 'api'); };
|
43005 |
|
43006 | ColumnApi.prototype.addValueColumn = function (colKey) { this.columnModel.addValueColumn(colKey, 'api'); };
|
43007 |
|
43008 | ColumnApi.prototype.addValueColumns = function (colKeys) { this.columnModel.addValueColumns(colKeys, 'api'); };
|
43009 |
|
43010 | ColumnApi.prototype.setRowGroupColumns = function (colKeys) { this.columnModel.setRowGroupColumns(colKeys, 'api'); };
|
43011 |
|
43012 | ColumnApi.prototype.removeRowGroupColumn = function (colKey) { this.columnModel.removeRowGroupColumn(colKey, 'api'); };
|
43013 |
|
43014 | ColumnApi.prototype.removeRowGroupColumns = function (colKeys) { this.columnModel.removeRowGroupColumns(colKeys, 'api'); };
|
43015 |
|
43016 | ColumnApi.prototype.addRowGroupColumn = function (colKey) { this.columnModel.addRowGroupColumn(colKey, 'api'); };
|
43017 |
|
43018 | ColumnApi.prototype.addRowGroupColumns = function (colKeys) { this.columnModel.addRowGroupColumns(colKeys, 'api'); };
|
43019 |
|
43020 | ColumnApi.prototype.getRowGroupColumns = function () { return this.columnModel.getRowGroupColumns(); };
|
43021 |
|
43022 | ColumnApi.prototype.setPivotColumns = function (colKeys) { this.columnModel.setPivotColumns(colKeys, 'api'); };
|
43023 |
|
43024 | ColumnApi.prototype.removePivotColumn = function (colKey) { this.columnModel.removePivotColumn(colKey, 'api'); };
|
43025 |
|
43026 | ColumnApi.prototype.removePivotColumns = function (colKeys) { this.columnModel.removePivotColumns(colKeys, 'api'); };
|
43027 |
|
43028 | ColumnApi.prototype.addPivotColumn = function (colKey) { this.columnModel.addPivotColumn(colKey, 'api'); };
|
43029 |
|
43030 | ColumnApi.prototype.addPivotColumns = function (colKeys) { this.columnModel.addPivotColumns(colKeys, 'api'); };
|
43031 |
|
43032 | ColumnApi.prototype.getPivotColumns = function () { return this.columnModel.getPivotColumns(); };
|
43033 |
|
43034 | ColumnApi.prototype.getLeftDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeLeft(); };
|
43035 |
|
43036 | ColumnApi.prototype.getCenterDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeCentre(); };
|
43037 |
|
43038 | ColumnApi.prototype.getRightDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeRight(); };
|
43039 |
|
43040 | ColumnApi.prototype.getAllDisplayedColumnGroups = function () { return this.columnModel.getAllDisplayedTrees(); };
|
43041 |
|
43042 | ColumnApi.prototype.autoSizeColumn = function (key, skipHeader) { return this.columnModel.autoSizeColumn(key, skipHeader, 'api'); };
|
43043 |
|
43044 | ColumnApi.prototype.autoSizeColumns = function (keys, skipHeader) {
|
43045 | this.columnModel.autoSizeColumns({ columns: keys, skipHeader: skipHeader });
|
43046 | };
|
43047 |
|
43048 | ColumnApi.prototype.autoSizeAllColumns = function (skipHeader) { this.columnModel.autoSizeAllColumns(skipHeader, 'api'); };
|
43049 |
|
43050 | ColumnApi.prototype.setSecondaryColumns = function (colDefs) { this.columnModel.setSecondaryColumns(colDefs, 'api'); };
|
43051 |
|
43052 | ColumnApi.prototype.getSecondaryColumns = function () { return this.columnModel.getSecondaryColumns(); };
|
43053 |
|
43054 | ColumnApi.prototype.getPrimaryColumns = function () { return this.columnModel.getAllPrimaryColumns(); };
|
43055 | ColumnApi.prototype.cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid = function () {
|
43056 |
|
43057 |
|
43058 |
|
43059 |
|
43060 |
|
43061 |
|
43062 | setTimeout(_.removeAllReferences.bind(window, this, 'Column API'), 100);
|
43063 | };
|
43064 |
|
43065 |
|
43066 |
|
43067 |
|
43068 |
|
43069 |
|
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 |
|
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 |
|
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 |
|
43085 | ColumnApi.prototype.setState = function (columnState) {
|
43086 | console.error('AG Grid: setState is deprecated, use setColumnState');
|
43087 | return this.setColumnState(columnState);
|
43088 | };
|
43089 |
|
43090 | ColumnApi.prototype.getState = function () {
|
43091 | console.error('AG Grid: getState is deprecated, use getColumnState');
|
43092 | return this.getColumnState();
|
43093 | };
|
43094 |
|
43095 | ColumnApi.prototype.resetState = function () {
|
43096 | console.error('AG Grid: resetState is deprecated, use resetColumnState');
|
43097 | this.resetColumnState();
|
43098 | };
|
43099 |
|
43100 | ColumnApi.prototype.getAggregationColumns = function () {
|
43101 | console.error('AG Grid: getAggregationColumns is deprecated, use getValueColumns');
|
43102 | return this.columnModel.getValueColumns();
|
43103 | };
|
43104 |
|
43105 | ColumnApi.prototype.removeAggregationColumn = function (colKey) {
|
43106 | console.error('AG Grid: removeAggregationColumn is deprecated, use removeValueColumn');
|
43107 | this.columnModel.removeValueColumn(colKey, 'api');
|
43108 | };
|
43109 |
|
43110 | ColumnApi.prototype.removeAggregationColumns = function (colKeys) {
|
43111 | console.error('AG Grid: removeAggregationColumns is deprecated, use removeValueColumns');
|
43112 | this.columnModel.removeValueColumns(colKeys, 'api');
|
43113 | };
|
43114 |
|
43115 | ColumnApi.prototype.addAggregationColumn = function (colKey) {
|
43116 | console.error('AG Grid: addAggregationColumn is deprecated, use addValueColumn');
|
43117 | this.columnModel.addValueColumn(colKey, 'api');
|
43118 | };
|
43119 |
|
43120 | ColumnApi.prototype.addAggregationColumns = function (colKeys) {
|
43121 | console.error('AG Grid: addAggregationColumns is deprecated, use addValueColumns');
|
43122 | this.columnModel.addValueColumns(colKeys, 'api');
|
43123 | };
|
43124 |
|
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 |
|
43130 | ColumnApi.prototype.getDisplayNameForCol = function (column) {
|
43131 | console.error('AG Grid: getDisplayNameForCol is deprecated, use getDisplayNameForColumn');
|
43132 | return this.getDisplayNameForColumn(column, null);
|
43133 | };
|
43134 |
|
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 |
|
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 |
|
43158 |
|
43159 |
|
43160 |
|
43161 |
|
43162 | var __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 | })();
|
43175 | var __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 | };
|
43181 | var ValueService = (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 |
|
43193 |
|
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 |
|
43200 |
|
43201 | if (!this.initialised) {
|
43202 | this.init();
|
43203 | }
|
43204 | if (!rowNode) {
|
43205 | return;
|
43206 | }
|
43207 |
|
43208 | var colDef = column.getColDef();
|
43209 | var field = colDef.field;
|
43210 | var colId = column.getId();
|
43211 | var data = rowNode.data;
|
43212 | var result;
|
43213 |
|
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 |
|
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 |
|
43273 |
|
43274 |
|
43275 |
|
43276 |
|
43277 |
|
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 |
|
43285 |
|
43286 | if (missing(rowNode.data)) {
|
43287 | rowNode.data = {};
|
43288 | }
|
43289 |
|
43290 | var _a = column.getColDef(), field = _a.field, newValueHandler = _a.newValueHandler, valueSetter = _a.valueSetter;
|
43291 |
|
43292 | if (missing(field) && missing(newValueHandler) && missing(valueSetter)) {
|
43293 |
|
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 |
|
43320 |
|
43321 |
|
43322 | if (valueWasDifferent === undefined) {
|
43323 | valueWasDifferent = true;
|
43324 | }
|
43325 |
|
43326 |
|
43327 |
|
43328 | if (!valueWasDifferent) {
|
43329 | return false;
|
43330 | }
|
43331 |
|
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 |
|
43376 | var valuesAreSame = false;
|
43377 | if (!isFieldContainsDots) {
|
43378 | data[field] = newValue;
|
43379 | }
|
43380 | else {
|
43381 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
43488 |
|
43489 |
|
43490 |
|
43491 |
|
43492 | var __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 | })();
|
43505 | var __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 | };
|
43511 | var __param$7 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
43512 | return function (target, key) { decorator(target, key, paramIndex); }
|
43513 | };
|
43514 | var ExpressionService = (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 |
|
43527 | var func = expressionOrFunc;
|
43528 | return func(params);
|
43529 | }
|
43530 | else if (typeof expressionOrFunc === 'string') {
|
43531 |
|
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 |
|
43543 |
|
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 |
|
43549 |
|
43550 |
|
43551 | console.log('Processing of the expression failed');
|
43552 |
|
43553 | console.log('Expression = ' + expression);
|
43554 |
|
43555 | console.log('Params =', params);
|
43556 |
|
43557 | console.log('Exception = ' + e);
|
43558 | return null;
|
43559 | }
|
43560 | };
|
43561 | ExpressionService.prototype.createExpressionFunction = function (expression) {
|
43562 |
|
43563 | if (this.expressionToFunctionCache[expression]) {
|
43564 | return this.expressionToFunctionCache[expression];
|
43565 | }
|
43566 |
|
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 |
|
43570 | this.expressionToFunctionCache[expression] = theFunction;
|
43571 | return theFunction;
|
43572 | };
|
43573 | ExpressionService.prototype.createFunctionBody = function (expression) {
|
43574 |
|
43575 |
|
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 |
|
43594 |
|
43595 |
|
43596 |
|
43597 |
|
43598 | var __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 | })();
|
43611 | var __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 | };
|
43617 | var TemplateService = (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 |
|
43626 |
|
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 |
|
43636 | callbackList = [];
|
43637 | this.waitingCallbacks[url] = callbackList;
|
43638 |
|
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 |
|
43647 | if (callback) {
|
43648 | callbackList.push(callback);
|
43649 | }
|
43650 |
|
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 |
|
43659 |
|
43660 | this.templateCache[url] = httpResult.response || httpResult.responseText;
|
43661 |
|
43662 | var callbacks = this.waitingCallbacks[url];
|
43663 | for (var i = 0; i < callbacks.length; i++) {
|
43664 | var callback = callbacks[i];
|
43665 |
|
43666 |
|
43667 |
|
43668 | callback();
|
43669 | }
|
43670 | };
|
43671 | TemplateService = __decorate$1U([
|
43672 | Bean('templateService')
|
43673 | ], TemplateService);
|
43674 | return TemplateService;
|
43675 | }(BeanStub));
|
43676 |
|
43677 |
|
43678 |
|
43679 |
|
43680 |
|
43681 |
|
43682 |
|
43683 | var __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 | })();
|
43696 | var __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 | };
|
43702 | var __param$8 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
43703 | return function (target, key) { decorator(target, key, paramIndex); }
|
43704 | };
|
43705 | var LoggerFactory = (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));
|
43727 | var Logger = (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 |
|
43738 | console.log('AG Grid.' + this.name + ': ' + message);
|
43739 | }
|
43740 | };
|
43741 | return Logger;
|
43742 | }());
|
43743 |
|
43744 |
|
43745 |
|
43746 |
|
43747 |
|
43748 |
|
43749 |
|
43750 | var __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 | })();
|
43763 | var __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 | };
|
43769 | var GridCtrl = (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 |
|
43782 |
|
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 |
|
43890 |
|
43891 |
|
43892 |
|
43893 |
|
43894 | var __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 | })();
|
43907 | var __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 | };
|
43913 | var GridComp = (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 |
|
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 = "<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 |
|
44007 |
|
44008 |
|
44009 |
|
44010 |
|
44011 | var __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 | })();
|
44024 | var __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 | };
|
44030 | var SortController = (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 |
|
44042 | if (sort !== Constants.SORT_ASC && sort !== Constants.SORT_DESC) {
|
44043 | sort = null;
|
44044 | }
|
44045 |
|
44046 | column.setSort(sort, source);
|
44047 | var doingMultiSort = (multiSort || this.gridOptionsWrapper.isAlwaysMultiSort()) && !this.gridOptionsWrapper.isSuppressMultiSort();
|
44048 |
|
44049 | if (!doingMultiSort) {
|
44050 | this.clearSortBarThisColumn(column, source);
|
44051 | }
|
44052 |
|
44053 | this.updateSortIndex(column);
|
44054 | this.dispatchSortChangedEvents(source);
|
44055 | };
|
44056 | SortController.prototype.updateSortIndex = function (lastColToChange) {
|
44057 |
|
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 |
|
44067 | if (lastColToChange.getSort()) {
|
44068 | lastColToChange.setSortIndex(sortIndex);
|
44069 | }
|
44070 |
|
44071 | var allCols = this.columnModel.getPrimaryAndSecondaryAndAutoColumns();
|
44072 | allCols.filter(function (col) { return col.getSort() == null; }).forEach(function (col) { return col.setSortIndex(); });
|
44073 | };
|
44074 |
|
44075 |
|
44076 | SortController.prototype.onSortChanged = function (source) {
|
44077 | this.dispatchSortChangedEvents(source);
|
44078 | };
|
44079 | SortController.prototype.isSortActive = function () {
|
44080 |
|
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 |
|
44097 | if (columnToClear !== columnToSkip) {
|
44098 |
|
44099 |
|
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 |
|
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 |
|
44138 | var allColumnsIncludingAuto = this.columnModel.getPrimaryAndSecondaryAndAutoColumns();
|
44139 | var columnsWithSorting = allColumnsIncludingAuto.filter(function (column) { return !!column.getSort(); });
|
44140 |
|
44141 |
|
44142 |
|
44143 | var allColsIndexes = {};
|
44144 | allColumnsIncludingAuto.forEach(function (col, index) { return allColsIndexes[col.getId()] = index; });
|
44145 |
|
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;
|
44151 | }
|
44152 | else if (iA == null && iB == null) {
|
44153 |
|
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;
|
44160 | }
|
44161 | else {
|
44162 | return 1;
|
44163 | }
|
44164 | });
|
44165 | return columnsWithSorting;
|
44166 | };
|
44167 |
|
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 |
|
44199 |
|
44200 |
|
44201 |
|
44202 |
|
44203 | var __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 | })();
|
44216 | var __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 | };
|
44222 | var ColumnHoverService = (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 |
|
44262 |
|
44263 |
|
44264 |
|
44265 |
|
44266 | var __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 | })();
|
44279 | var __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 | };
|
44285 | var ColumnAnimationService = (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 |
|
44310 |
|
44311 |
|
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 |
|
44344 |
|
44345 | this.animationThreadCount++;
|
44346 | var animationThreadCountCopy = this.animationThreadCount;
|
44347 | this.gridBodyCtrl.setColumnMovingCss(true);
|
44348 | this.executeLaterFuncs.push(function () {
|
44349 |
|
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 |
|
44380 |
|
44381 |
|
44382 |
|
44383 |
|
44384 | var __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 | })();
|
44397 | var __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 | };
|
44403 | var AutoGroupColService = (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 |
|
44419 |
|
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 |
|
44431 | AutoGroupColService.prototype.createOneAutoGroupColumn = function (existingCols, rowGroupCol, index) {
|
44432 |
|
44433 | var defaultAutoColDef = this.generateDefaultColDef(rowGroupCol);
|
44434 |
|
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 |
|
44447 | if (!this.gridOptionsWrapper.isTreeData()) {
|
44448 |
|
44449 |
|
44450 | var noFieldOrValueGetter = missing(defaultAutoColDef.field) && missing(defaultAutoColDef.valueGetter) && missing(defaultAutoColDef.filterValueGetter);
|
44451 | if (noFieldOrValueGetter) {
|
44452 | defaultAutoColDef.filter = false;
|
44453 | }
|
44454 | }
|
44455 |
|
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 |
|
44478 | if (!userHasProvidedGroupCellRenderer) {
|
44479 | res.cellRenderer = 'agGroupCellRenderer';
|
44480 | }
|
44481 |
|
44482 |
|
44483 | if (rowGroupCol) {
|
44484 | var colDef = rowGroupCol.getColDef();
|
44485 | Object.assign(res, {
|
44486 |
|
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 |
|
44522 |
|
44523 |
|
44524 |
|
44525 |
|
44526 | var __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 | })();
|
44539 | var __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 | };
|
44545 | var PaginationAutoPageSizeService = (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 |
|
44593 |
|
44594 |
|
44595 |
|
44596 |
|
44597 | var __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 | })();
|
44610 | var __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 | };
|
44616 | var ValueCache = (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 |
|
44662 |
|
44663 |
|
44664 |
|
44665 |
|
44666 | var __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 | })();
|
44679 | var __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 | };
|
44685 | var ChangeDetectionService = (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 |
|
44698 |
|
44699 |
|
44700 |
|
44701 |
|
44702 |
|
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 |
|
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 |
|
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 |
|
44739 |
|
44740 |
|
44741 |
|
44742 |
|
44743 | var __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 | })();
|
44756 | var __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 | };
|
44762 | var AgComponentUtils = (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 = (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 |
|
44818 |
|
44819 |
|
44820 |
|
44821 |
|
44822 | var __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 | })();
|
44835 | var __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 | };
|
44841 | var ComponentMetadataProvider = (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 |
|
44953 |
|
44954 |
|
44955 |
|
44956 |
|
44957 | var __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 | })();
|
44970 | var __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 | };
|
44976 | var MAT_GRID_SIZE = 8;
|
44977 | var BASE_GRID_SIZE = 4;
|
44978 | var BALHAM_GRID_SIZE = 4;
|
44979 | var ALPINE_GRID_SIZE = 6;
|
44980 | var HARD_CODED_SIZES = {
|
44981 |
|
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 |
|
45013 |
|
45014 |
|
45015 |
|
45016 |
|
45017 |
|
45018 |
|
45019 |
|
45020 |
|
45021 | var 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 | };
|
45028 | var CALCULATED_SIZES = {};
|
45029 | var Environment = (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 |
|
45110 |
|
45111 |
|
45112 |
|
45113 |
|
45114 | var __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 | })();
|
45127 | var __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 | };
|
45133 | var __param$9 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
45134 | return function (target, key) { decorator(target, key, paramIndex); }
|
45135 | };
|
45136 |
|
45137 |
|
45138 |
|
45139 |
|
45140 | var RowContainerHeightService = (function (_super) {
|
45141 | __extends$2r(RowContainerHeightService, _super);
|
45142 | function RowContainerHeightService() {
|
45143 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
45144 |
|
45145 | _this.scrollY = 0;
|
45146 |
|
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 |
|
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
|
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 |
|
45256 |
|
45257 |
|
45258 |
|
45259 |
|
45260 | var __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 | })();
|
45273 | var __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 | };
|
45279 | var SelectableService = (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 | }
|
45303 | if (child.hasChildren()) {
|
45304 | _this.recurseDown(nextChildrenFunc(child), nextChildrenFunc);
|
45305 | }
|
45306 | var rowSelectable;
|
45307 | if (_this.groupSelectsChildren) {
|
45308 |
|
45309 | var firstSelectable = (nextChildrenFunc(child) || []).find(function (rowNode) { return rowNode.selectable === true; });
|
45310 | rowSelectable = exists(firstSelectable);
|
45311 | }
|
45312 | else {
|
45313 |
|
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 |
|
45330 |
|
45331 |
|
45332 |
|
45333 |
|
45334 | var __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 | })();
|
45347 | var __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 | };
|
45353 | var PaginationComp = (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 "<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 |
|
45509 |
|
45510 |
|
45511 | if (rowCount === 1) {
|
45512 | var firstRow = this.paginationProxy.getRow(0);
|
45513 |
|
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 |
|
45578 |
|
45579 |
|
45580 |
|
45581 |
|
45582 | var __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 | })();
|
45595 | var __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 | };
|
45601 | var LoadingType;
|
45602 | (function (LoadingType) {
|
45603 | LoadingType[LoadingType["Loading"] = 0] = "Loading";
|
45604 | LoadingType[LoadingType["NoRows"] = 1] = "NoRows";
|
45605 | })(LoadingType || (LoadingType = {}));
|
45606 | var OverlayWrapperComponent = (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 |
|
45712 |
|
45713 |
|
45714 |
|
45715 | if (this.columnModel.isReady() && !this.paginationProxy.isEmpty() && !this.manuallyDisplayed) {
|
45716 | this.hideOverlay();
|
45717 | }
|
45718 | };
|
45719 |
|
45720 |
|
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 |
|
45745 |
|
45746 |
|
45747 |
|
45748 |
|
45749 | var __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 | })();
|
45762 | var __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 | };
|
45768 | var RowPositionUtils = (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 |
|
45819 | if (!rowA && !rowB) {
|
45820 | return true;
|
45821 | }
|
45822 |
|
45823 | if ((rowA && !rowB) || (!rowA && rowB)) {
|
45824 | return false;
|
45825 | }
|
45826 |
|
45827 | return rowA.rowIndex === rowB.rowIndex && rowA.rowPinned == rowB.rowPinned;
|
45828 | };
|
45829 |
|
45830 | RowPositionUtils.prototype.before = function (rowA, rowB) {
|
45831 | switch (rowA.rowPinned) {
|
45832 | case Constants.PINNED_TOP:
|
45833 |
|
45834 | if (rowB.rowPinned !== Constants.PINNED_TOP) {
|
45835 | return true;
|
45836 | }
|
45837 | break;
|
45838 | case Constants.PINNED_BOTTOM:
|
45839 |
|
45840 | if (rowB.rowPinned !== Constants.PINNED_BOTTOM) {
|
45841 | return false;
|
45842 | }
|
45843 | break;
|
45844 | default:
|
45845 |
|
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 |
|
45870 |
|
45871 |
|
45872 |
|
45873 |
|
45874 | var __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 | })();
|
45887 | var __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 | };
|
45893 | var CellPositionUtils = (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 |
|
45919 |
|
45920 |
|
45921 |
|
45922 |
|
45923 | var __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 | })();
|
45936 | var UndoRedoAction = (function () {
|
45937 | function UndoRedoAction(cellValueChanges) {
|
45938 | this.cellValueChanges = cellValueChanges;
|
45939 | }
|
45940 | return UndoRedoAction;
|
45941 | }());
|
45942 | var FillUndoRedoAction = (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));
|
45952 | var UndoRedoStack = (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 |
|
45983 |
|
45984 |
|
45985 |
|
45986 |
|
45987 | var __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 | })();
|
46000 | var __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 | };
|
46006 | var UndoRedoService = (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 |
|
46055 |
|
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 |
|
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 |
|
46252 |
|
46253 |
|
46254 |
|
46255 |
|
46256 | var __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 | })();
|
46269 | var __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 | };
|
46275 | var HeaderPositionUtils = (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 |
|
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 |
|
46334 |
|
46335 |
|
46336 |
|
46337 |
|
46338 | var __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 | };
|
46344 | var ColumnDefFactory = (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 |
|
46359 |
|
46360 |
|
46361 | if (pointer.isPadding()) {
|
46362 | pointer = pointer.getOriginalParent();
|
46363 | continue;
|
46364 | }
|
46365 |
|
46366 | var existingParentDef = colGroupDefs[pointer.getGroupId()];
|
46367 | if (existingParentDef) {
|
46368 | existingParentDef.children.push(childDef);
|
46369 |
|
46370 | addToResult = false;
|
46371 |
|
46372 |
|
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 |
|
46419 |
|
46420 |
|
46421 |
|
46422 |
|
46423 | var __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 | };
|
46429 | var RowCssClassCalculator = (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 |
|
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 |
|
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 |
|
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 |
|
46524 |
|
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 |
|
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 |
|
46560 |
|
46561 |
|
46562 |
|
46563 |
|
46564 | var __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 |
|
46571 | var RowNodeSorter = (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 |
|
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 |
|
46593 | comparatorResult = providedComparator(valueA, valueB, nodeA, nodeB, isInverted);
|
46594 | }
|
46595 | else {
|
46596 |
|
46597 | comparatorResult = _.defaultComparator(valueA, valueB, this.gridOptionsWrapper.isAccentedSort());
|
46598 | }
|
46599 |
|
46600 |
|
46601 | var validResult = !isNaN(comparatorResult);
|
46602 | if (validResult && comparatorResult !== 0) {
|
46603 | return sortOption.sort === Constants.SORT_ASC ? comparatorResult : comparatorResult * -1;
|
46604 | }
|
46605 | }
|
46606 |
|
46607 | return sortedNodeA.currentPos - sortedNodeB.currentPos;
|
46608 | };
|
46609 | RowNodeSorter.prototype.getComparator = function (sortOption, rowNode) {
|
46610 | var column = sortOption.column;
|
46611 |
|
46612 | var comparatorOnCol = column.getColDef().comparator;
|
46613 | if (comparatorOnCol != null) {
|
46614 | return comparatorOnCol;
|
46615 | }
|
46616 |
|
46617 | if (rowNode.rowGroupColumn) {
|
46618 | return rowNode.rowGroupColumn.getColDef().comparator;
|
46619 | }
|
46620 | if (!column.getColDef().showRowGroup) {
|
46621 | return;
|
46622 | }
|
46623 |
|
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 |
|
46654 |
|
46655 |
|
46656 |
|
46657 |
|
46658 | var __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 | })();
|
46671 | var __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 | };
|
46677 | var CtrlsService = (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 |
|
46845 |
|
46846 |
|
46847 |
|
46848 |
|
46849 | var __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 | })();
|
46862 | var __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 | };
|
46868 | var CtrlsFactory = (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 |
|
46893 |
|
46894 |
|
46895 |
|
46896 |
|
46897 | var __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 | })();
|
46910 | var __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 | };
|
46916 | var FakeHScrollCtrl = (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 |
|
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 |
|
46967 |
|
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 |
|
46977 |
|
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 |
|
47021 |
|
47022 |
|
47023 |
|
47024 |
|
47025 | var __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 | })();
|
47038 | var __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 | };
|
47044 | var FakeHScrollComp = (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 |
|
47090 |
|
47091 |
|
47092 |
|
47093 |
|
47094 | var __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 | })();
|
47107 | var __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 | };
|
47113 | var PinnedWidthService = (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 |
|
47157 |
|
47158 |
|
47159 |
|
47160 |
|
47161 | var __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 | })();
|
47174 | var __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 | };
|
47180 | var RowNodeEventThrottle = (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 |
|
47193 |
|
47194 |
|
47195 |
|
47196 |
|
47197 |
|
47198 |
|
47199 |
|
47200 |
|
47201 |
|
47202 |
|
47203 | RowNodeEventThrottle.prototype.dispatchExpanded = function (event) {
|
47204 | var _this = this;
|
47205 |
|
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 |
|
47240 |
|
47241 |
|
47242 |
|
47243 |
|
47244 | var __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 | };
|
47260 | var __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 |
|
47265 |
|
47266 | var Grid = (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 |
|
47286 |
|
47287 | var GridCoreCreator = (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 | }
|
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 |
|
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 |
|
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 |
|
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 |
|
47436 |
|
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 |
|
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 |
|
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 |
|
47507 |
|
47508 |
|
47509 |
|
47510 |
|
47511 | function 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 |
|
47532 |
|
47533 |
|
47534 |
|
47535 |
|
47536 | var BaseComponentWrapper = (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 |
|
47573 |
|
47574 |
|
47575 |
|
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 |
|
47586 |
|
47587 |
|
47588 |
|
47589 |
|
47590 | var globalObj = typeof global === 'undefined' ? {} : global;
|
47591 | globalObj.HTMLElement = typeof HTMLElement === 'undefined' ? {} : HTMLElement;
|
47592 | globalObj.HTMLButtonElement = typeof HTMLButtonElement === 'undefined' ? {} : HTMLButtonElement;
|
47593 | globalObj.HTMLSelectElement = typeof HTMLSelectElement === 'undefined' ? {} : HTMLSelectElement;
|
47594 | globalObj.HTMLInputElement = typeof HTMLInputElement === 'undefined' ? {} : HTMLInputElement;
|
47595 | globalObj.Node = typeof Node === 'undefined' ? {} : Node;
|
47596 | globalObj.MouseEvent = typeof MouseEvent === 'undefined' ? {} : MouseEvent;
|
47597 |
|
47598 | var __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 | };
|
47614 | var __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 | };
|
47618 | var ClientSideNodeManager = (function () {
|
47619 | function ClientSideNodeManager(rootNode, gridOptionsWrapper, eventService, columnModel, gridApi, columnApi, selectionService, beans) {
|
47620 | this.nextId = 0;
|
47621 |
|
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 |
|
47640 | this.postConstruct();
|
47641 | }
|
47642 |
|
47643 | ClientSideNodeManager.prototype.postConstruct = function () {
|
47644 |
|
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 |
|
47674 |
|
47675 |
|
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 |
|
47715 |
|
47716 |
|
47717 |
|
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 |
|
47735 | var newNodes = add.map(function (item) { return _this.createNode(item, _this.rootNode, ClientSideNodeManager.TOP_LEVEL); });
|
47736 |
|
47737 | var useIndex = typeof addIndex === 'number' && addIndex >= 0;
|
47738 | var nodesBeforeIndex;
|
47739 | var nodesAfterIndex;
|
47740 | if (useIndex) {
|
47741 |
|
47742 |
|
47743 |
|
47744 |
|
47745 | var allLeafChildren_1 = this.rootNode.allLeafChildren;
|
47746 |
|
47747 |
|
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 |
|
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 |
|
47782 |
|
47783 | if (rowNode.isSelected()) {
|
47784 | nodesToUnselect.push(rowNode);
|
47785 | }
|
47786 |
|
47787 | rowNode.clearRowTopAndRowIndex();
|
47788 |
|
47789 |
|
47790 | rowIdsRemoved[rowNode.id] = true;
|
47791 |
|
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 |
|
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 |
|
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 |
|
47867 | if (this.doingMasterDetail) {
|
47868 |
|
47869 |
|
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 |
|
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 |
|
47901 | var __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 | })();
|
47914 | var __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 | };
|
47920 | var 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 = {}));
|
47927 | var ClientSideRowModel = (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 |
|
47968 |
|
47969 |
|
47970 | do {
|
47971 | atLeastOneChange = false;
|
47972 | var rowAtStartPixel = this.getRowIndexAtPixel(startPixel);
|
47973 | var rowAtEndPixel = this.getRowIndexAtPixel(endPixel);
|
47974 |
|
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 |
|
47996 |
|
47997 |
|
47998 |
|
47999 | var displayedRowsMapped = new Set();
|
48000 |
|
48001 |
|
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 |
|
48032 |
|
48033 |
|
48034 |
|
48035 |
|
48036 | var isRootNode = rowNode.level == -1;
|
48037 |
|
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 |
|
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 |
|
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 |
|
48177 |
|
48178 |
|
48179 |
|
48180 |
|
48181 |
|
48182 |
|
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 |
|
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 |
|
48209 |
|
48210 |
|
48211 |
|
48212 |
|
48213 |
|
48214 |
|
48215 |
|
48216 |
|
48217 |
|
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:
|
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 |
|
48236 |
|
48237 |
|
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 |
|
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 |
|
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 |
|
48315 |
|
48316 | var bottomPointer = 0;
|
48317 | var topPointer = this.rowsToDisplay.length - 1;
|
48318 |
|
48319 | if (pixelToMatch <= 0) {
|
48320 |
|
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 |
|
48365 |
|
48366 |
|
48367 |
|
48368 |
|
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 |
|
48377 | if (node.hasChildren()) {
|
48378 |
|
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 |
|
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 |
|
48403 |
|
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 |
|
48415 | this.rootNode.childrenAfterAggFilter = this.rootNode.childrenAfterFilter;
|
48416 | }
|
48417 | };
|
48418 |
|
48419 |
|
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 |
|
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 |
|
48509 |
|
48510 |
|
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 |
|
48537 | var idIsGroup = typeof id == 'string' && id.indexOf(RowNode.ID_PREFIX_ROW_GROUP) == 0;
|
48538 | if (idIsGroup) {
|
48539 |
|
48540 |
|
48541 |
|
48542 |
|
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 |
|
48554 | ClientSideRowModel.prototype.setRowData = function (rowData) {
|
48555 |
|
48556 |
|
48557 |
|
48558 | var groupState = this.getGroupState();
|
48559 | this.nodeManager.setRowData(rowData);
|
48560 |
|
48561 | this.selectionService.reset();
|
48562 |
|
48563 | this.filterManager.onNewRowsLoaded('rowDataUpdated');
|
48564 |
|
48565 |
|
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 |
|
48601 |
|
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 |
|
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 |
|
48638 |
|
48639 |
|
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 |
|
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 |
|
48690 |
|
48691 |
|
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 |
|
48756 | var __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 | })();
|
48769 | var __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 | };
|
48775 | var FilterStage = (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 |
|
48793 | var __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 | })();
|
48806 | var __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 | };
|
48812 | var SortStage = (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 |
|
48823 |
|
48824 |
|
48825 |
|
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 |
|
48845 | var __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 | })();
|
48858 | var __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 | };
|
48864 | var FlattenStage = (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 |
|
48872 |
|
48873 | var result = [];
|
48874 |
|
48875 | var nextRowTop = { value: 0 };
|
48876 | var skipLeafNodes = this.columnModel.isPivotMode();
|
48877 |
|
48878 |
|
48879 | var showRootNode = skipLeafNodes && rootNode.leafGroup;
|
48880 | var topList = showRootNode ? [rootNode] : rootNode.childrenAfterSort;
|
48881 | this.recursivelyAddToRowsToDisplay(topList, result, nextRowTop, skipLeafNodes, 0);
|
48882 |
|
48883 | var atLeastOneRowPresent = result.length > 0;
|
48884 | var includeGroupTotalFooter = !showRootNode
|
48885 |
|
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 |
|
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 |
|
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 |
|
48915 |
|
48916 |
|
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 |
|
48925 | if (skipLeafNodes && rowNode.leafGroup) {
|
48926 | continue;
|
48927 | }
|
48928 | if (isParent) {
|
48929 | var excludedParent = isRemovedSingleChildrenGroup || isRemovedLowestSingleChildrenGroup;
|
48930 |
|
48931 |
|
48932 | if (rowNode.expanded || excludedParent) {
|
48933 |
|
48934 | var uiLevelForChildren = excludedParent ? uiLevel : uiLevel + 1;
|
48935 | this.recursivelyAddToRowsToDisplay(rowNode.childrenAfterSort, result, nextRowTop, skipLeafNodes, uiLevelForChildren);
|
48936 |
|
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 |
|
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 |
|
48957 |
|
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 |
|
48969 |
|
48970 | footerNode.oldRowTop = null;
|
48971 | if (_.exists(footerNode.id)) {
|
48972 | footerNode.id = 'rowGroupFooter_' + footerNode.id;
|
48973 | }
|
48974 |
|
48975 |
|
48976 |
|
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 |
|
49008 | var __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 | })();
|
49021 | var __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 | };
|
49027 | var SortService = (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 |
|
49046 | _this.pullDownGroupDataForHideOpenParents(rowNode.childrenAfterAggFilter, true);
|
49047 |
|
49048 | var skipSortingPivotLeafs = isPivotMode && rowNode.leafGroup;
|
49049 |
|
49050 |
|
49051 |
|
49052 | var skipSortingGroups = groupMaintainOrder && groupColumnsPresent && !rowNode.leafGroup && !sortContainsGroupColumns;
|
49053 | if (!sortActive || skipSortingGroups || skipSortingPivotLeafs) {
|
49054 |
|
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 |
|
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 |
|
49130 | SortService.prototype.mergeSortedArrays = function (sortOptions, arr1, arr2) {
|
49131 | var res = [];
|
49132 | var i = 0;
|
49133 | var j = 0;
|
49134 |
|
49135 | while (i < arr1.length && j < arr2.length) {
|
49136 |
|
49137 |
|
49138 |
|
49139 |
|
49140 |
|
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 |
|
49150 | while (i < arr1.length) {
|
49151 | res.push(arr1[i++]);
|
49152 | }
|
49153 |
|
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 |
|
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 |
|
49217 | childRowNode.setGroupValue(groupDisplayCol.getId(), undefined);
|
49218 | }
|
49219 | else {
|
49220 |
|
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 |
|
49244 | var __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 | })();
|
49257 | var __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 | };
|
49263 | var FilterService = (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 |
|
49278 | if (rowNode.hasChildren()) {
|
49279 |
|
49280 | if (filterActive && !includeChildNodes) {
|
49281 | rowNode.childrenAfterFilter = rowNode.childrenAfterGroup.filter(function (childNode) {
|
49282 |
|
49283 |
|
49284 | var passBecauseChildren = childNode.childrenAfterFilter && childNode.childrenAfterFilter.length > 0;
|
49285 |
|
49286 |
|
49287 | var passBecauseDataPasses = childNode.data
|
49288 | && _this.filterManager.doesRowPassFilter({ rowNode: childNode });
|
49289 |
|
49290 | return passBecauseChildren || passBecauseDataPasses;
|
49291 | });
|
49292 | }
|
49293 | else {
|
49294 |
|
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 |
|
49308 |
|
49309 | if (rowNode.childrenAfterGroup) {
|
49310 | for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) {
|
49311 | var childNode = rowNode.childrenAfterGroup[i];
|
49312 |
|
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 |
|
49345 | var __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 | })();
|
49358 | var __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 | };
|
49364 | var __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 | };
|
49380 | var ImmutableService = (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 |
|
49401 |
|
49402 | if (nodeTransaction) {
|
49403 | this.rowRenderer.refreshFullWidthRows(nodeTransaction.update);
|
49404 | }
|
49405 |
|
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 |
|
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 |
|
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 |
|
49435 |
|
49436 |
|
49437 |
|
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 |
|
49450 |
|
49451 | existingNodesMap[id] = undefined;
|
49452 | }
|
49453 | else {
|
49454 | transaction.add.push(data);
|
49455 | }
|
49456 | });
|
49457 | }
|
49458 |
|
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 |
|
49487 | var ClientSideRowModelModule = {
|
49488 | moduleName: exports.ModuleNames.ClientSideRowModelModule,
|
49489 | beans: [FilterStage, SortStage, FlattenStage, SortService, FilterService, ImmutableService],
|
49490 | rowModels: { clientSide: ClientSideRowModel }
|
49491 | };
|
49492 |
|
49493 | var __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 | })();
|
49506 | var __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 | };
|
49512 | var InfiniteBlock = (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 |
|
49519 |
|
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 |
|
49540 |
|
49541 |
|
49542 | if (!rowNode.id && rowNode.alreadyRendered) {
|
49543 | rowNode.alreadyRendered = false;
|
49544 | }
|
49545 | if (_.exists(data)) {
|
49546 |
|
49547 |
|
49548 |
|
49549 |
|
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 |
|
49564 | window.setTimeout(function () {
|
49565 | _this.params.datasource.getRows(params);
|
49566 | }, 0);
|
49567 | };
|
49568 | InfiniteBlock.prototype.processServerFail = function () {
|
49569 |
|
49570 | };
|
49571 | InfiniteBlock.prototype.createLoadParams = function () {
|
49572 |
|
49573 |
|
49574 |
|
49575 |
|
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 |
|
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 |
|
49638 |
|
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 |
|
49654 | var __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 | })();
|
49667 | var __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 | };
|
49673 | var __param$a = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
49674 | return function (target, key) { decorator(target, key, paramIndex); }
|
49675 | };
|
49676 | var InfiniteCache = (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 |
|
49691 |
|
49692 |
|
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 |
|
49714 |
|
49715 |
|
49716 |
|
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 |
|
49737 | InfiniteCache.prototype.pageLoaded = function (block, lastRow) {
|
49738 |
|
49739 |
|
49740 | if (!this.isAlive()) {
|
49741 | return;
|
49742 | }
|
49743 | this.logger.log("onPageLoaded: page = " + block.getId() + ", lastRow = " + lastRow);
|
49744 | this.checkRowCount(block, lastRow);
|
49745 |
|
49746 |
|
49747 |
|
49748 | this.onCacheUpdated();
|
49749 | };
|
49750 | InfiniteCache.prototype.purgeBlocksIfNeeded = function (blockToExclude) {
|
49751 | var _this = this;
|
49752 |
|
49753 |
|
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 |
|
49758 |
|
49759 |
|
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 |
|
49768 |
|
49769 |
|
49770 | if (_this.isBlockCurrentlyDisplayed(block)) {
|
49771 | return;
|
49772 | }
|
49773 |
|
49774 | if (_this.isBlockFocused(block)) {
|
49775 | return;
|
49776 | }
|
49777 |
|
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 |
|
49806 |
|
49807 |
|
49808 | };
|
49809 | InfiniteCache.prototype.checkRowCount = function (block, lastRow) {
|
49810 |
|
49811 |
|
49812 | if (typeof lastRow === 'number' && lastRow >= 0) {
|
49813 | this.rowCount = lastRow;
|
49814 | this.lastRowIndexKnown = true;
|
49815 | }
|
49816 | else if (!this.lastRowIndexKnown) {
|
49817 |
|
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 |
|
49828 |
|
49829 | if (_.exists(lastRowIndexKnown)) {
|
49830 | this.lastRowIndexKnown = lastRowIndexKnown;
|
49831 | }
|
49832 |
|
49833 |
|
49834 |
|
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 |
|
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 |
|
49860 | InfiniteCache.prototype.onCacheUpdated = function () {
|
49861 | if (this.isAlive()) {
|
49862 |
|
49863 |
|
49864 |
|
49865 |
|
49866 | this.destroyAllBlocksPastVirtualRowCount();
|
49867 |
|
49868 |
|
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 |
|
49893 |
|
49894 |
|
49895 |
|
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 |
|
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 |
|
49932 | var invalidRange = foundGapInSelection || inActiveRange;
|
49933 | return invalidRange ? [] : result;
|
49934 | };
|
49935 |
|
49936 |
|
49937 |
|
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 |
|
49954 | var __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 | })();
|
49967 | var __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 | };
|
49973 | var InfiniteRowModel = (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 |
|
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 |
|
50029 |
|
50030 |
|
50031 | if (this.cacheParams) {
|
50032 | resetRequired = this.isSortModelDifferent();
|
50033 | }
|
50034 | else {
|
50035 |
|
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 |
|
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 |
|
50067 |
|
50068 | if (!this.datasource) {
|
50069 | return;
|
50070 | }
|
50071 |
|
50072 |
|
50073 |
|
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 |
|
50089 |
|
50090 | newPage: false,
|
50091 | newData: false,
|
50092 | keepRenderedRows: true,
|
50093 | animate: false
|
50094 | };
|
50095 | };
|
50096 | InfiniteRowModel.prototype.resetCache = function () {
|
50097 |
|
50098 | this.destroyCache();
|
50099 | this.cacheParams = {
|
50100 |
|
50101 | datasource: this.datasource,
|
50102 |
|
50103 | filterModel: this.filterManager.getFilterModel(),
|
50104 | sortModel: this.sortController.getSortModel(),
|
50105 | rowNodeBlockLoader: this.rowNodeBlockLoader,
|
50106 |
|
50107 |
|
50108 |
|
50109 | initialRowCount: this.defaultIfInvalid(this.gridOptionsWrapper.getInfiniteInitialRowCount(), 1),
|
50110 | maxBlocksInCache: this.gridOptionsWrapper.getMaxBlocksInCache(),
|
50111 | rowHeight: this.gridOptionsWrapper.getRowHeightAsNumber(),
|
50112 |
|
50113 |
|
50114 | overflowSize: this.defaultIfInvalid(this.gridOptionsWrapper.getCacheOverflowSize(), 1),
|
50115 |
|
50116 |
|
50117 | blockSize: this.defaultIfInvalid(this.gridOptionsWrapper.getCacheBlockSize(), 100),
|
50118 |
|
50119 |
|
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) {
|
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 |
|
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 |
|
50238 | var InfiniteRowModelModule = {
|
50239 | moduleName: exports.ModuleNames.InfiniteRowModelModule,
|
50240 | rowModels: { infinite: InfiniteRowModel }
|
50241 | };
|
50242 |
|
50243 | var BaseCreator = (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 |
|
50264 | var BaseGridSerializingSession = (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 |
|
50285 | var groupIndex = this.gridOptionsWrapper.isGroupMultiAutoColumn() ? node.rowGroupIndex : 0;
|
50286 | var renderGroupSummaryCell =
|
50287 |
|
50288 | node && node.group
|
50289 | && (
|
50290 |
|
50291 | index === groupIndex && this.groupColumns.indexOf(column) !== -1
|
50292 |
|
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 |
|
50351 | var Downloader = (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 |
|
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 |
|
50375 | win.URL.revokeObjectURL(url);
|
50376 | }, 0);
|
50377 | };
|
50378 | return Downloader;
|
50379 | }());
|
50380 |
|
50381 | var __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 | })();
|
50394 | var LINE_SEPARATOR = '\r\n';
|
50395 | var CsvSerializingSession = (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 |
|
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 |
|
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 |
|
50510 | var __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 | })();
|
50523 | var __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 | };
|
50529 | var CsvCreator = (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 |
|
50607 | var __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 | })();
|
50620 | var __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 = {}));
|
50631 | var GridSerializer = (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 |
|
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 |
|
50670 |
|
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 |
|
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 |
|
50772 | rowModel.forEachNode(processRow);
|
50773 | }
|
50774 | }
|
50775 | else {
|
50776 |
|
50777 |
|
50778 |
|
50779 |
|
50780 |
|
50781 | if (params.onlySelectedAllPages || onlySelectedNonStandardModel) {
|
50782 | var selectedNodes = _this.selectionService.getSelectedNodes();
|
50783 | selectedNodes.forEach(processRow);
|
50784 | }
|
50785 | else {
|
50786 |
|
50787 |
|
50788 |
|
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 |
|
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 |
|
50904 | var CsvExportModule = {
|
50905 | moduleName: exports.ModuleNames.CsvExportModule,
|
50906 | beans: [CsvCreator, GridSerializer]
|
50907 | };
|
50908 |
|
50909 | var LINE_SEPARATOR$1 = '\r\n';
|
50910 | var XmlFactory = (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 |
|
50977 | var __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 |
|
50989 |
|
50990 | var 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 | ]);
|
51035 | var ZipContainer = (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) +
|
51113 | decToHex(dt, 2) +
|
51114 | decToHex(size ? this.getFromCrc32Table(convertedContent) : 0, 4) +
|
51115 | decToHex(size, 4) +
|
51116 | decToHex(size, 4) +
|
51117 | decToHex(utfPath.length, 2) +
|
51118 | decToHex(extraFields.length, 2);
|
51119 | var fileHeader = 'PK\x03\x04' + header + utfPath + extraFields;
|
51120 | var folderHeader = 'PK\x01\x02' +
|
51121 | '\x14\x00' +
|
51122 | header +
|
51123 | '\x00\x00' +
|
51124 | '\x00\x00' +
|
51125 | '\x00\x00' +
|
51126 | (content ? '\x00\x00\x00\x00' : '\x10\x00\x00\x00') +
|
51127 | decToHex(offset, 4) +
|
51128 | utfPath +
|
51129 | extraFields;
|
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' +
|
51146 | '\x00\x00' +
|
51147 | '\x00\x00' +
|
51148 | decToHex(tLen, 2) +
|
51149 | decToHex(tLen, 2) +
|
51150 | decToHex(cLen, 4) +
|
51151 | decToHex(lLen, 4) +
|
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 |
|
51203 | ModuleRegistry.register(ClientSideRowModelModule, false);
|
51204 | ModuleRegistry.register(InfiniteRowModelModule, false);
|
51205 | ModuleRegistry.register(CsvExportModule, false);
|
51206 |
|
51207 | exports.AbstractHeaderCellCtrl = AbstractHeaderCellCtrl;
|
51208 | exports.AgAbstractField = AgAbstractField;
|
51209 | exports.AgAngleSelect = AgAngleSelect;
|
51210 | exports.AgCheckbox = AgCheckbox;
|
51211 | exports.AgColorPicker = AgColorPicker;
|
51212 | exports.AgDialog = AgDialog;
|
51213 | exports.AgGroupComponent = AgGroupComponent;
|
51214 | exports.AgInputNumberField = AgInputNumberField;
|
51215 | exports.AgInputRange = AgInputRange;
|
51216 | exports.AgInputTextArea = AgInputTextArea;
|
51217 | exports.AgInputTextField = AgInputTextField;
|
51218 | exports.AgMenuItemComponent = AgMenuItemComponent;
|
51219 | exports.AgMenuList = AgMenuList;
|
51220 | exports.AgMenuPanel = AgMenuPanel;
|
51221 | exports.AgPanel = AgPanel;
|
51222 | exports.AgPromise = AgPromise;
|
51223 | exports.AgRadioButton = AgRadioButton;
|
51224 | exports.AgSelect = AgSelect;
|
51225 | exports.AgSlider = AgSlider;
|
51226 | exports.AgStackComponentsRegistry = AgStackComponentsRegistry;
|
51227 | exports.AgToggleButton = AgToggleButton;
|
51228 | exports.AlignedGridsService = AlignedGridsService;
|
51229 | exports.AnimateShowChangeCellRenderer = AnimateShowChangeCellRenderer;
|
51230 | exports.AnimateSlideCellRenderer = AnimateSlideCellRenderer;
|
51231 | exports.AnimationFrameService = AnimationFrameService;
|
51232 | exports.AutoScrollService = AutoScrollService;
|
51233 | exports.AutoWidthCalculator = AutoWidthCalculator;
|
51234 | exports.Autowired = Autowired;
|
51235 | exports.BaseComponentWrapper = BaseComponentWrapper;
|
51236 | exports.BaseCreator = BaseCreator;
|
51237 | exports.BaseGridSerializingSession = BaseGridSerializingSession;
|
51238 | exports.Bean = Bean;
|
51239 | exports.BeanStub = BeanStub;
|
51240 | exports.Beans = Beans;
|
51241 | exports.BodyDropPivotTarget = BodyDropPivotTarget;
|
51242 | exports.BodyDropTarget = BodyDropTarget;
|
51243 | exports.CellComp = CellComp;
|
51244 | exports.CellCtrl = CellCtrl;
|
51245 | exports.CellNavigationService = CellNavigationService;
|
51246 | exports.CellPositionUtils = CellPositionUtils;
|
51247 | exports.ChangedPath = ChangedPath;
|
51248 | exports.CheckboxSelectionComponent = CheckboxSelectionComponent;
|
51249 | exports.ColDefUtil = ColDefUtil;
|
51250 | exports.Color = Color;
|
51251 | exports.Column = Column;
|
51252 | exports.ColumnApi = ColumnApi;
|
51253 | exports.ColumnFactory = ColumnFactory;
|
51254 | exports.ColumnGroup = ColumnGroup;
|
51255 | exports.ColumnKeyCreator = ColumnKeyCreator;
|
51256 | exports.ColumnModel = ColumnModel;
|
51257 | exports.ColumnUtils = ColumnUtils;
|
51258 | exports.Component = Component;
|
51259 | exports.ComponentUtil = ComponentUtil;
|
51260 | exports.Constants = Constants;
|
51261 | exports.Context = Context;
|
51262 | exports.CssClassApplier = CssClassApplier;
|
51263 | exports.CssClassManager = CssClassManager;
|
51264 | exports.CsvCreator = CsvCreator;
|
51265 | exports.CsvExportModule = CsvExportModule;
|
51266 | exports.CtrlsService = CtrlsService;
|
51267 | exports.CustomTooltipFeature = CustomTooltipFeature;
|
51268 | exports.DateFilter = DateFilter;
|
51269 | exports.DisplayedGroupCreator = DisplayedGroupCreator;
|
51270 | exports.Downloader = Downloader;
|
51271 | exports.DragAndDropService = DragAndDropService;
|
51272 | exports.DragService = DragService;
|
51273 | exports.Environment = Environment;
|
51274 | exports.EventService = EventService;
|
51275 | exports.Events = Events;
|
51276 | exports.ExpressionService = ExpressionService;
|
51277 | exports.FilterManager = FilterManager;
|
51278 | exports.FloatingFilterMapper = FloatingFilterMapper;
|
51279 | exports.FocusService = FocusService;
|
51280 | exports.Grid = Grid;
|
51281 | exports.GridApi = GridApi;
|
51282 | exports.GridBodyComp = GridBodyComp;
|
51283 | exports.GridBodyCtrl = GridBodyCtrl;
|
51284 | exports.GridComp = GridComp;
|
51285 | exports.GridCoreCreator = GridCoreCreator;
|
51286 | exports.GridCtrl = GridCtrl;
|
51287 | exports.GridHeaderComp = GridHeaderComp;
|
51288 | exports.GridHeaderCtrl = GridHeaderCtrl;
|
51289 | exports.GridOptionsWrapper = GridOptionsWrapper;
|
51290 | exports.GridSerializer = GridSerializer;
|
51291 | exports.GroupCellRenderer = GroupCellRenderer;
|
51292 | exports.GroupCellRendererCtrl = GroupCellRendererCtrl;
|
51293 | exports.GroupInstanceIdCreator = GroupInstanceIdCreator;
|
51294 | exports.HeaderCellCtrl = HeaderCellCtrl;
|
51295 | exports.HeaderFilterCellComp = HeaderFilterCellComp;
|
51296 | exports.HeaderFilterCellCtrl = HeaderFilterCellCtrl;
|
51297 | exports.HeaderGroupCellCtrl = HeaderGroupCellCtrl;
|
51298 | exports.HeaderNavigationService = HeaderNavigationService;
|
51299 | exports.HeaderPositionUtils = HeaderPositionUtils;
|
51300 | exports.HeaderRowComp = HeaderRowComp;
|
51301 | exports.HeaderRowContainerComp = HeaderRowContainerComp;
|
51302 | exports.HeaderRowContainerCtrl = HeaderRowContainerCtrl;
|
51303 | exports.HeaderRowCtrl = HeaderRowCtrl;
|
51304 | exports.HorizontalResizeService = HorizontalResizeService;
|
51305 | exports.KeyCode = KeyCode;
|
51306 | exports.LargeTextCellEditor = LargeTextCellEditor;
|
51307 | exports.Logger = Logger;
|
51308 | exports.LoggerFactory = LoggerFactory;
|
51309 | exports.ManagedFocusFeature = ManagedFocusFeature;
|
51310 | exports.ModuleRegistry = ModuleRegistry;
|
51311 | exports.MouseEventService = MouseEventService;
|
51312 | exports.MoveColumnFeature = MoveColumnFeature;
|
51313 | exports.NavigationService = NavigationService;
|
51314 | exports.NumberFilter = NumberFilter;
|
51315 | exports.NumberSequence = NumberSequence;
|
51316 | exports.Optional = Optional;
|
51317 | exports.PaginationProxy = PaginationProxy;
|
51318 | exports.PinnedRowModel = PinnedRowModel;
|
51319 | exports.PopupComponent = PopupComponent;
|
51320 | exports.PopupEditorWrapper = PopupEditorWrapper;
|
51321 | exports.PopupSelectCellEditor = PopupSelectCellEditor;
|
51322 | exports.PopupService = PopupService;
|
51323 | exports.PopupTextCellEditor = PopupTextCellEditor;
|
51324 | exports.PositionableFeature = PositionableFeature;
|
51325 | exports.PostConstruct = PostConstruct;
|
51326 | exports.PreConstruct = PreConstruct;
|
51327 | exports.PreDestroy = PreDestroy;
|
51328 | exports.PropertyKeys = PropertyKeys;
|
51329 | exports.ProvidedColumnGroup = ProvidedColumnGroup;
|
51330 | exports.ProvidedFilter = ProvidedFilter;
|
51331 | exports.Qualifier = Qualifier;
|
51332 | exports.QuerySelector = QuerySelector;
|
51333 | exports.RefSelector = RefSelector;
|
51334 | exports.ResizeObserverService = ResizeObserverService;
|
51335 | exports.RowContainerComp = RowContainerComp;
|
51336 | exports.RowContainerCtrl = RowContainerCtrl;
|
51337 | exports.RowCtrl = RowCtrl;
|
51338 | exports.RowNode = RowNode;
|
51339 | exports.RowNodeBlock = RowNodeBlock;
|
51340 | exports.RowNodeBlockLoader = RowNodeBlockLoader;
|
51341 | exports.RowNodeSorter = RowNodeSorter;
|
51342 | exports.RowPositionUtils = RowPositionUtils;
|
51343 | exports.RowRenderer = RowRenderer;
|
51344 | exports.ScalarFilter = ScalarFilter;
|
51345 | exports.ScrollVisibleService = ScrollVisibleService;
|
51346 | exports.SelectCellEditor = SelectCellEditor;
|
51347 | exports.SelectableService = SelectableService;
|
51348 | exports.SelectionService = SelectionService;
|
51349 | exports.SetLeftFeature = SetLeftFeature;
|
51350 | exports.SimpleFilter = SimpleFilter;
|
51351 | exports.SortController = SortController;
|
51352 | exports.StandardMenuFactory = StandardMenuFactory;
|
51353 | exports.StylingService = StylingService;
|
51354 | exports.TabGuardComp = TabGuardComp;
|
51355 | exports.TabGuardCtrl = TabGuardCtrl;
|
51356 | exports.TabbedLayout = TabbedLayout;
|
51357 | exports.TemplateService = TemplateService;
|
51358 | exports.TextCellEditor = TextCellEditor;
|
51359 | exports.TextFilter = TextFilter;
|
51360 | exports.TextFloatingFilter = TextFloatingFilter;
|
51361 | exports.Timer = Timer;
|
51362 | exports.TouchListener = TouchListener;
|
51363 | exports.UserComponentFactory = UserComponentFactory;
|
51364 | exports.UserComponentRegistry = UserComponentRegistry;
|
51365 | exports.ValueCache = ValueCache;
|
51366 | exports.ValueFormatterService = ValueFormatterService;
|
51367 | exports.ValueService = ValueService;
|
51368 | exports.VanillaFrameworkOverrides = VanillaFrameworkOverrides;
|
51369 | exports.VirtualList = VirtualList;
|
51370 | exports.XmlFactory = XmlFactory;
|
51371 | exports.ZipContainer = ZipContainer;
|
51372 | exports._ = _;
|
51373 | exports.defaultGroupComparator = defaultGroupComparator;
|
51374 | exports.getRowContainerTypeForName = getRowContainerTypeForName;
|
51375 | exports.simpleHttpRequest = simpleHttpRequest;
|
51376 | exports.stringToArray = stringToArray;
|