1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function makeNull(value) {
|
18 | if (value == null || value === '') {
|
19 | return null;
|
20 | }
|
21 | return value;
|
22 | }
|
23 | function exists(value, allowEmptyString) {
|
24 | if (allowEmptyString === void 0) { allowEmptyString = false; }
|
25 | return value != null && (value !== '' || allowEmptyString);
|
26 | }
|
27 | function missing(value) {
|
28 | return !exists(value);
|
29 | }
|
30 | function missingOrEmpty(value) {
|
31 | return value == null || value.length === 0;
|
32 | }
|
33 | function toStringOrNull(value) {
|
34 | return value != null && typeof value.toString === 'function' ? value.toString() : null;
|
35 | }
|
36 |
|
37 | function attrToNumber(value) {
|
38 | if (value === undefined) {
|
39 |
|
40 | return;
|
41 | }
|
42 | if (value === null || value === '') {
|
43 |
|
44 | return null;
|
45 | }
|
46 | if (typeof value === 'number') {
|
47 | return isNaN(value) ? undefined : value;
|
48 | }
|
49 | var valueParsed = parseInt(value, 10);
|
50 | return isNaN(valueParsed) ? undefined : valueParsed;
|
51 | }
|
52 |
|
53 | function attrToBoolean(value) {
|
54 | if (value === undefined) {
|
55 |
|
56 | return;
|
57 | }
|
58 | if (value === null || value === '') {
|
59 |
|
60 | return false;
|
61 | }
|
62 | if (typeof value === 'boolean') {
|
63 |
|
64 | return value;
|
65 | }
|
66 |
|
67 | return (/true/i).test(value);
|
68 | }
|
69 |
|
70 | function attrToString(value) {
|
71 | if (value == null || value === '') {
|
72 | return;
|
73 | }
|
74 | return value;
|
75 | }
|
76 |
|
77 | function referenceCompare(left, right) {
|
78 | if (left == null && right == null) {
|
79 | return true;
|
80 | }
|
81 | if (left == null && right != null) {
|
82 | return false;
|
83 | }
|
84 | if (left != null && right == null) {
|
85 | return false;
|
86 | }
|
87 | return left === right;
|
88 | }
|
89 | function jsonEquals(val1, val2) {
|
90 | var val1Json = val1 ? JSON.stringify(val1) : null;
|
91 | var val2Json = val2 ? JSON.stringify(val2) : null;
|
92 | return val1Json === val2Json;
|
93 | }
|
94 | function defaultComparator(valueA, valueB, accentedCompare) {
|
95 | if (accentedCompare === void 0) { accentedCompare = false; }
|
96 | var valueAMissing = valueA == null;
|
97 | var valueBMissing = valueB == null;
|
98 |
|
99 |
|
100 |
|
101 | if (valueA && valueA.toNumber) {
|
102 | valueA = valueA.toNumber();
|
103 | }
|
104 | if (valueB && valueB.toNumber) {
|
105 | valueB = valueB.toNumber();
|
106 | }
|
107 | if (valueAMissing && valueBMissing) {
|
108 | return 0;
|
109 | }
|
110 | if (valueAMissing) {
|
111 | return -1;
|
112 | }
|
113 | if (valueBMissing) {
|
114 | return 1;
|
115 | }
|
116 | function doQuickCompare(a, b) {
|
117 | return (a > b ? 1 : (a < b ? -1 : 0));
|
118 | }
|
119 | if (typeof valueA !== 'string') {
|
120 | return doQuickCompare(valueA, valueB);
|
121 | }
|
122 | if (!accentedCompare) {
|
123 | return doQuickCompare(valueA, valueB);
|
124 | }
|
125 | try {
|
126 |
|
127 | return valueA.localeCompare(valueB);
|
128 | }
|
129 | catch (e) {
|
130 |
|
131 |
|
132 | return doQuickCompare(valueA, valueB);
|
133 | }
|
134 | }
|
135 | function values(object) {
|
136 | if (object instanceof Set || object instanceof Map) {
|
137 | var arr_1 = [];
|
138 | object.forEach(function (value) { return arr_1.push(value); });
|
139 | return arr_1;
|
140 | }
|
141 | return Object.values(object);
|
142 | }
|
143 |
|
144 | var GenericUtils = Object.freeze({
|
145 | __proto__: null,
|
146 | makeNull: makeNull,
|
147 | exists: exists,
|
148 | missing: missing,
|
149 | missingOrEmpty: missingOrEmpty,
|
150 | toStringOrNull: toStringOrNull,
|
151 | attrToNumber: attrToNumber,
|
152 | attrToBoolean: attrToBoolean,
|
153 | attrToString: attrToString,
|
154 | referenceCompare: referenceCompare,
|
155 | jsonEquals: jsonEquals,
|
156 | defaultComparator: defaultComparator,
|
157 | values: values
|
158 | });
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 | var ColumnKeyCreator = (function () {
|
167 | function ColumnKeyCreator() {
|
168 | this.existingKeys = {};
|
169 | }
|
170 | ColumnKeyCreator.prototype.addExistingKeys = function (keys) {
|
171 | for (var i = 0; i < keys.length; i++) {
|
172 | this.existingKeys[keys[i]] = true;
|
173 | }
|
174 | };
|
175 | ColumnKeyCreator.prototype.getUniqueKey = function (colId, colField) {
|
176 |
|
177 | colId = toStringOrNull(colId);
|
178 | var count = 0;
|
179 | while (true) {
|
180 | var idToTry = void 0;
|
181 | if (colId) {
|
182 | idToTry = colId;
|
183 | if (count !== 0) {
|
184 | idToTry += '_' + count;
|
185 | }
|
186 | }
|
187 | else if (colField) {
|
188 | idToTry = colField;
|
189 | if (count !== 0) {
|
190 | idToTry += '_' + count;
|
191 | }
|
192 | }
|
193 | else {
|
194 | idToTry = '' + count;
|
195 | }
|
196 | if (!this.existingKeys[idToTry]) {
|
197 | this.existingKeys[idToTry] = true;
|
198 | return idToTry;
|
199 | }
|
200 | count++;
|
201 | }
|
202 | };
|
203 | return ColumnKeyCreator;
|
204 | }());
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 | function iterateObject(object, callback) {
|
213 | if (object == null) {
|
214 | return;
|
215 | }
|
216 | if (Array.isArray(object)) {
|
217 | object.forEach(function (value, index) { return callback("" + index, value); });
|
218 | }
|
219 | else {
|
220 | Object.keys(object).forEach(function (key) { return callback(key, object[key]); });
|
221 | }
|
222 | }
|
223 | function cloneObject(object) {
|
224 | var copy = {};
|
225 | var keys = Object.keys(object);
|
226 | for (var i = 0; i < keys.length; i++) {
|
227 | var key = keys[i];
|
228 | var value = object[key];
|
229 | copy[key] = value;
|
230 | }
|
231 | return copy;
|
232 | }
|
233 | function deepCloneObject(object) {
|
234 | return JSON.parse(JSON.stringify(object));
|
235 | }
|
236 |
|
237 |
|
238 |
|
239 |
|
240 | function deepCloneDefinition(object, keysToSkip) {
|
241 | if (!object) {
|
242 | return;
|
243 | }
|
244 | var obj = object;
|
245 | var res = {};
|
246 | Object.keys(obj).forEach(function (key) {
|
247 | if (keysToSkip && keysToSkip.indexOf(key) >= 0) {
|
248 | return;
|
249 | }
|
250 | var value = obj[key];
|
251 |
|
252 |
|
253 |
|
254 |
|
255 | var sourceIsSimpleObject = isNonNullObject(value) && value.constructor === Object;
|
256 | if (sourceIsSimpleObject) {
|
257 | res[key] = deepCloneDefinition(value);
|
258 | }
|
259 | else {
|
260 | res[key] = value;
|
261 | }
|
262 | });
|
263 | return res;
|
264 | }
|
265 | function getProperty(object, key) {
|
266 | return object[key];
|
267 | }
|
268 | function setProperty(object, key, value) {
|
269 | object[key] = value;
|
270 | }
|
271 |
|
272 |
|
273 |
|
274 |
|
275 | function copyPropertiesIfPresent(source, target) {
|
276 | var properties = [];
|
277 | for (var _i = 2; _i < arguments.length; _i++) {
|
278 | properties[_i - 2] = arguments[_i];
|
279 | }
|
280 | properties.forEach(function (p) { return copyPropertyIfPresent(source, target, p); });
|
281 | }
|
282 |
|
283 |
|
284 |
|
285 |
|
286 | function copyPropertyIfPresent(source, target, property, transform) {
|
287 | var value = getProperty(source, property);
|
288 | if (value !== undefined) {
|
289 | setProperty(target, property, transform ? transform(value) : value);
|
290 | }
|
291 | }
|
292 | function getAllKeysInObjects(objects) {
|
293 | var allValues = {};
|
294 | objects.filter(function (obj) { return obj != null; }).forEach(function (obj) {
|
295 | Object.keys(obj).forEach(function (key) { return allValues[key] = null; });
|
296 | });
|
297 | return Object.keys(allValues);
|
298 | }
|
299 | function getAllValuesInObject(obj) {
|
300 | if (!obj) {
|
301 | return [];
|
302 | }
|
303 | var anyObject = Object;
|
304 | if (typeof anyObject.values === 'function') {
|
305 | return anyObject.values(obj);
|
306 | }
|
307 | var ret = [];
|
308 | for (var key in obj) {
|
309 | if (obj.hasOwnProperty(key) && obj.propertyIsEnumerable(key)) {
|
310 | ret.push(obj[key]);
|
311 | }
|
312 | }
|
313 | return ret;
|
314 | }
|
315 | function mergeDeep(dest, source, copyUndefined, makeCopyOfSimpleObjects) {
|
316 | if (copyUndefined === void 0) { copyUndefined = true; }
|
317 | if (makeCopyOfSimpleObjects === void 0) { makeCopyOfSimpleObjects = false; }
|
318 | if (!exists(source)) {
|
319 | return;
|
320 | }
|
321 | iterateObject(source, function (key, sourceValue) {
|
322 | var destValue = dest[key];
|
323 | if (destValue === sourceValue) {
|
324 | return;
|
325 | }
|
326 |
|
327 |
|
328 |
|
329 |
|
330 | if (makeCopyOfSimpleObjects) {
|
331 | var objectIsDueToBeCopied = destValue == null && sourceValue != null;
|
332 | if (objectIsDueToBeCopied) {
|
333 |
|
334 |
|
335 | var sourceIsSimpleObject = typeof sourceValue === 'object' && sourceValue.constructor === Object;
|
336 | var dontCopy = sourceIsSimpleObject;
|
337 | if (dontCopy) {
|
338 | destValue = {};
|
339 | dest[key] = destValue;
|
340 | }
|
341 | }
|
342 | }
|
343 | if (isNonNullObject(sourceValue) && isNonNullObject(destValue) && !Array.isArray(destValue)) {
|
344 | mergeDeep(destValue, sourceValue, copyUndefined, makeCopyOfSimpleObjects);
|
345 | }
|
346 | else if (copyUndefined || sourceValue !== undefined) {
|
347 | dest[key] = sourceValue;
|
348 | }
|
349 | });
|
350 | }
|
351 | function missingOrEmptyObject(value) {
|
352 | return missing(value) || Object.keys(value).length === 0;
|
353 | }
|
354 | function get(source, expression, defaultValue) {
|
355 | if (source == null) {
|
356 | return defaultValue;
|
357 | }
|
358 | var keys = expression.split('.');
|
359 | var objectToRead = source;
|
360 | while (keys.length > 1) {
|
361 | objectToRead = objectToRead[keys.shift()];
|
362 | if (objectToRead == null) {
|
363 | return defaultValue;
|
364 | }
|
365 | }
|
366 | var value = objectToRead[keys[0]];
|
367 | return value != null ? value : defaultValue;
|
368 | }
|
369 | function set(target, expression, value) {
|
370 | if (target == null) {
|
371 | return;
|
372 | }
|
373 | var keys = expression.split('.');
|
374 | var objectToUpdate = target;
|
375 | while (keys.length > 1) {
|
376 | objectToUpdate = objectToUpdate[keys.shift()];
|
377 | if (objectToUpdate == null) {
|
378 | return;
|
379 | }
|
380 | }
|
381 | objectToUpdate[keys[0]] = value;
|
382 | }
|
383 | function deepFreeze(object) {
|
384 | Object.freeze(object);
|
385 | values(object).forEach(function (v) {
|
386 | if (isNonNullObject(v) || typeof v === 'function') {
|
387 | deepFreeze(v);
|
388 | }
|
389 | });
|
390 | return object;
|
391 | }
|
392 | function getValueUsingField(data, field, fieldContainsDots) {
|
393 | if (!field || !data) {
|
394 | return;
|
395 | }
|
396 |
|
397 | if (!fieldContainsDots) {
|
398 | return data[field];
|
399 | }
|
400 |
|
401 | var fields = field.split('.');
|
402 | var currentObject = data;
|
403 | for (var i = 0; i < fields.length; i++) {
|
404 | if (currentObject == null) {
|
405 | return undefined;
|
406 | }
|
407 | currentObject = currentObject[fields[i]];
|
408 | }
|
409 | return currentObject;
|
410 | }
|
411 |
|
412 |
|
413 | function removeAllReferences(obj, objectName) {
|
414 | Object.keys(obj).forEach(function (key) {
|
415 | var value = obj[key];
|
416 |
|
417 |
|
418 | if (typeof value === 'object') {
|
419 | obj[key] = undefined;
|
420 | }
|
421 | });
|
422 | var proto = Object.getPrototypeOf(obj);
|
423 | var properties = {};
|
424 | Object.keys(proto).forEach(function (key) {
|
425 | var value = proto[key];
|
426 |
|
427 | if (typeof value === 'function') {
|
428 | var func = function () {
|
429 | 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.");
|
430 | };
|
431 | properties[key] = { value: func, writable: true };
|
432 | }
|
433 | });
|
434 | Object.defineProperties(obj, properties);
|
435 | }
|
436 | function isNonNullObject(value) {
|
437 | return typeof value === 'object' && value !== null;
|
438 | }
|
439 |
|
440 | var ObjectUtils = Object.freeze({
|
441 | __proto__: null,
|
442 | iterateObject: iterateObject,
|
443 | cloneObject: cloneObject,
|
444 | deepCloneObject: deepCloneObject,
|
445 | deepCloneDefinition: deepCloneDefinition,
|
446 | getProperty: getProperty,
|
447 | setProperty: setProperty,
|
448 | copyPropertiesIfPresent: copyPropertiesIfPresent,
|
449 | copyPropertyIfPresent: copyPropertyIfPresent,
|
450 | getAllKeysInObjects: getAllKeysInObjects,
|
451 | getAllValuesInObject: getAllValuesInObject,
|
452 | mergeDeep: mergeDeep,
|
453 | missingOrEmptyObject: missingOrEmptyObject,
|
454 | get: get,
|
455 | set: set,
|
456 | deepFreeze: deepFreeze,
|
457 | getValueUsingField: getValueUsingField,
|
458 | removeAllReferences: removeAllReferences,
|
459 | isNonNullObject: isNonNullObject
|
460 | });
|
461 |
|
462 | /**
|
463 | * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
|
464 | * @version v27.3.0
|
465 | * @link https://www.ag-grid.com/
|
466 | * @license MIT
|
467 | */
|
468 | var FUNCTION_STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
|
469 | var FUNCTION_ARGUMENT_NAMES = /([^\s,]+)/g;
|
470 | var doOnceFlags = {};
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 | function doOnce(func, key) {
|
477 | if (doOnceFlags[key]) {
|
478 | return;
|
479 | }
|
480 | func();
|
481 | doOnceFlags[key] = true;
|
482 | }
|
483 | function getFunctionName(funcConstructor) {
|
484 |
|
485 | if (funcConstructor.name) {
|
486 | return funcConstructor.name;
|
487 | }
|
488 |
|
489 | var matches = /function\s+([^\(]+)/.exec(funcConstructor.toString());
|
490 | return matches && matches.length === 2 ? matches[1].trim() : null;
|
491 | }
|
492 |
|
493 | function getFunctionParameters(func) {
|
494 | var fnStr = func.toString().replace(FUNCTION_STRIP_COMMENTS, '');
|
495 | return fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(FUNCTION_ARGUMENT_NAMES) || [];
|
496 | }
|
497 | function isFunction(val) {
|
498 | return !!(val && val.constructor && val.call && val.apply);
|
499 | }
|
500 | function executeInAWhile(funcs) {
|
501 | executeAfter(funcs, 400);
|
502 | }
|
503 | var executeNextVMTurnFuncs = [];
|
504 | var executeNextVMTurnPending = false;
|
505 | function executeNextVMTurn(func) {
|
506 | executeNextVMTurnFuncs.push(func);
|
507 | if (executeNextVMTurnPending) {
|
508 | return;
|
509 | }
|
510 | executeNextVMTurnPending = true;
|
511 | window.setTimeout(function () {
|
512 | var funcsCopy = executeNextVMTurnFuncs.slice();
|
513 | executeNextVMTurnFuncs.length = 0;
|
514 | executeNextVMTurnPending = false;
|
515 | funcsCopy.forEach(function (func) { return func(); });
|
516 | }, 0);
|
517 | }
|
518 | function executeAfter(funcs, milliseconds) {
|
519 | if (milliseconds === void 0) { milliseconds = 0; }
|
520 | if (funcs.length > 0) {
|
521 | window.setTimeout(function () { return funcs.forEach(function (func) { return func(); }); }, milliseconds);
|
522 | }
|
523 | }
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 | function debounce(func, wait, immediate) {
|
532 | if (immediate === void 0) { immediate = false; }
|
533 |
|
534 |
|
535 |
|
536 | var timeout;
|
537 |
|
538 | return function () {
|
539 | var args = [];
|
540 | for (var _i = 0; _i < arguments.length; _i++) {
|
541 | args[_i] = arguments[_i];
|
542 | }
|
543 |
|
544 | var context = this;
|
545 |
|
546 |
|
547 | var callNow = immediate && !timeout;
|
548 |
|
549 |
|
550 |
|
551 |
|
552 | window.clearTimeout(timeout);
|
553 |
|
554 | timeout = window.setTimeout(function () {
|
555 |
|
556 |
|
557 | timeout = null;
|
558 |
|
559 | if (!immediate) {
|
560 |
|
561 |
|
562 |
|
563 | func.apply(context, args);
|
564 | }
|
565 | }, wait);
|
566 |
|
567 | if (callNow) {
|
568 | func.apply(context, args);
|
569 | }
|
570 | };
|
571 | }
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 | function throttle(func, wait) {
|
578 | var previousCall = 0;
|
579 | return function () {
|
580 | var args = [];
|
581 | for (var _i = 0; _i < arguments.length; _i++) {
|
582 | args[_i] = arguments[_i];
|
583 | }
|
584 | var context = this;
|
585 | var currentCall = new Date().getTime();
|
586 | if (currentCall - previousCall < wait) {
|
587 | return;
|
588 | }
|
589 | previousCall = currentCall;
|
590 | func.apply(context, args);
|
591 | };
|
592 | }
|
593 | function waitUntil(condition, callback, timeout, timeoutMessage) {
|
594 | if (timeout === void 0) { timeout = 100; }
|
595 | var timeStamp = new Date().getTime();
|
596 | var interval = null;
|
597 | var executed = false;
|
598 | var internalCallback = function () {
|
599 | var reachedTimeout = ((new Date().getTime()) - timeStamp) > timeout;
|
600 | if (condition() || reachedTimeout) {
|
601 | callback();
|
602 | executed = true;
|
603 | if (interval != null) {
|
604 | window.clearInterval(interval);
|
605 | interval = null;
|
606 | }
|
607 | if (reachedTimeout && timeoutMessage) {
|
608 | console.warn(timeoutMessage);
|
609 | }
|
610 | }
|
611 | };
|
612 | internalCallback();
|
613 | if (!executed) {
|
614 | interval = window.setInterval(internalCallback, 10);
|
615 | }
|
616 | }
|
617 | function compose() {
|
618 | var fns = [];
|
619 | for (var _i = 0; _i < arguments.length; _i++) {
|
620 | fns[_i] = arguments[_i];
|
621 | }
|
622 | return function (arg) { return fns.reduce(function (composed, f) { return f(composed); }, arg); };
|
623 | }
|
624 | function callIfPresent(func) {
|
625 | if (func) {
|
626 | func();
|
627 | }
|
628 | }
|
629 |
|
630 | var FunctionUtils = Object.freeze({
|
631 | __proto__: null,
|
632 | doOnce: doOnce,
|
633 | getFunctionName: getFunctionName,
|
634 | getFunctionParameters: getFunctionParameters,
|
635 | isFunction: isFunction,
|
636 | executeInAWhile: executeInAWhile,
|
637 | executeNextVMTurn: executeNextVMTurn,
|
638 | executeAfter: executeAfter,
|
639 | debounce: debounce,
|
640 | throttle: throttle,
|
641 | waitUntil: waitUntil,
|
642 | compose: compose,
|
643 | callIfPresent: callIfPresent
|
644 | });
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 | var Context = (function () {
|
653 | function Context(params, logger) {
|
654 | this.beanWrappers = {};
|
655 | this.destroyed = false;
|
656 | if (!params || !params.beanClasses) {
|
657 | return;
|
658 | }
|
659 | this.contextParams = params;
|
660 | this.logger = logger;
|
661 | this.logger.log(">> creating ag-Application Context");
|
662 | this.createBeans();
|
663 | var beanInstances = this.getBeanInstances();
|
664 | this.wireBeans(beanInstances);
|
665 | this.logger.log(">> ag-Application Context ready - component is alive");
|
666 | }
|
667 | Context.prototype.getBeanInstances = function () {
|
668 | return values(this.beanWrappers).map(function (beanEntry) { return beanEntry.beanInstance; });
|
669 | };
|
670 | Context.prototype.createBean = function (bean, afterPreCreateCallback) {
|
671 | if (!bean) {
|
672 | throw Error("Can't wire to bean since it is null");
|
673 | }
|
674 | this.wireBeans([bean], afterPreCreateCallback);
|
675 | return bean;
|
676 | };
|
677 | Context.prototype.wireBeans = function (beanInstances, afterPreCreateCallback) {
|
678 | this.autoWireBeans(beanInstances);
|
679 | this.methodWireBeans(beanInstances);
|
680 | this.callLifeCycleMethods(beanInstances, 'preConstructMethods');
|
681 |
|
682 |
|
683 | if (exists(afterPreCreateCallback)) {
|
684 | beanInstances.forEach(afterPreCreateCallback);
|
685 | }
|
686 | this.callLifeCycleMethods(beanInstances, 'postConstructMethods');
|
687 | };
|
688 | Context.prototype.createBeans = function () {
|
689 | var _this = this;
|
690 |
|
691 | this.contextParams.beanClasses.forEach(this.createBeanWrapper.bind(this));
|
692 |
|
693 |
|
694 | iterateObject(this.beanWrappers, function (key, beanEntry) {
|
695 | var constructorParamsMeta;
|
696 | if (beanEntry.bean.__agBeanMetaData && beanEntry.bean.__agBeanMetaData.autowireMethods && beanEntry.bean.__agBeanMetaData.autowireMethods.agConstructor) {
|
697 | constructorParamsMeta = beanEntry.bean.__agBeanMetaData.autowireMethods.agConstructor;
|
698 | }
|
699 | var constructorParams = _this.getBeansForParameters(constructorParamsMeta, beanEntry.bean.name);
|
700 | var newInstance = applyToConstructor(beanEntry.bean, constructorParams);
|
701 | beanEntry.beanInstance = newInstance;
|
702 | });
|
703 | var createdBeanNames = Object.keys(this.beanWrappers).join(', ');
|
704 | this.logger.log("created beans: " + createdBeanNames);
|
705 | };
|
706 |
|
707 | Context.prototype.createBeanWrapper = function (BeanClass) {
|
708 | var metaData = BeanClass.__agBeanMetaData;
|
709 | if (!metaData) {
|
710 | var beanName = void 0;
|
711 | if (BeanClass.prototype.constructor) {
|
712 | beanName = getFunctionName(BeanClass.prototype.constructor);
|
713 | }
|
714 | else {
|
715 | beanName = "" + BeanClass;
|
716 | }
|
717 | console.error("Context item " + beanName + " is not a bean");
|
718 | return;
|
719 | }
|
720 | var beanEntry = {
|
721 | bean: BeanClass,
|
722 | beanInstance: null,
|
723 | beanName: metaData.beanName
|
724 | };
|
725 | this.beanWrappers[metaData.beanName] = beanEntry;
|
726 | };
|
727 | Context.prototype.autoWireBeans = function (beanInstances) {
|
728 | var _this = this;
|
729 | beanInstances.forEach(function (beanInstance) {
|
730 | _this.forEachMetaDataInHierarchy(beanInstance, function (metaData, beanName) {
|
731 | var attributes = metaData.agClassAttributes;
|
732 | if (!attributes) {
|
733 | return;
|
734 | }
|
735 | attributes.forEach(function (attribute) {
|
736 | var otherBean = _this.lookupBeanInstance(beanName, attribute.beanName, attribute.optional);
|
737 | beanInstance[attribute.attributeName] = otherBean;
|
738 | });
|
739 | });
|
740 | });
|
741 | };
|
742 | Context.prototype.methodWireBeans = function (beanInstances) {
|
743 | var _this = this;
|
744 | beanInstances.forEach(function (beanInstance) {
|
745 | _this.forEachMetaDataInHierarchy(beanInstance, function (metaData, beanName) {
|
746 | iterateObject(metaData.autowireMethods, function (methodName, wireParams) {
|
747 |
|
748 | if (methodName === "agConstructor") {
|
749 | return;
|
750 | }
|
751 | var initParams = _this.getBeansForParameters(wireParams, beanName);
|
752 | beanInstance[methodName].apply(beanInstance, initParams);
|
753 | });
|
754 | });
|
755 | });
|
756 | };
|
757 | Context.prototype.forEachMetaDataInHierarchy = function (beanInstance, callback) {
|
758 | var prototype = Object.getPrototypeOf(beanInstance);
|
759 | while (prototype != null) {
|
760 | var constructor = prototype.constructor;
|
761 | if (constructor.hasOwnProperty('__agBeanMetaData')) {
|
762 | var metaData = constructor.__agBeanMetaData;
|
763 | var beanName = this.getBeanName(constructor);
|
764 | callback(metaData, beanName);
|
765 | }
|
766 | prototype = Object.getPrototypeOf(prototype);
|
767 | }
|
768 | };
|
769 | Context.prototype.getBeanName = function (constructor) {
|
770 | if (constructor.__agBeanMetaData && constructor.__agBeanMetaData.beanName) {
|
771 | return constructor.__agBeanMetaData.beanName;
|
772 | }
|
773 | var constructorString = constructor.toString();
|
774 | var beanName = constructorString.substring(9, constructorString.indexOf("("));
|
775 | return beanName;
|
776 | };
|
777 | Context.prototype.getBeansForParameters = function (parameters, beanName) {
|
778 | var _this = this;
|
779 | var beansList = [];
|
780 | if (parameters) {
|
781 | iterateObject(parameters, function (paramIndex, otherBeanName) {
|
782 | var otherBean = _this.lookupBeanInstance(beanName, otherBeanName);
|
783 | beansList[Number(paramIndex)] = otherBean;
|
784 | });
|
785 | }
|
786 | return beansList;
|
787 | };
|
788 | Context.prototype.lookupBeanInstance = function (wiringBean, beanName, optional) {
|
789 | if (optional === void 0) { optional = false; }
|
790 | if (beanName === "context") {
|
791 | return this;
|
792 | }
|
793 | if (this.contextParams.providedBeanInstances && this.contextParams.providedBeanInstances.hasOwnProperty(beanName)) {
|
794 | return this.contextParams.providedBeanInstances[beanName];
|
795 | }
|
796 | var beanEntry = this.beanWrappers[beanName];
|
797 | if (beanEntry) {
|
798 | return beanEntry.beanInstance;
|
799 | }
|
800 | if (!optional) {
|
801 | console.error("AG Grid: unable to find bean reference " + beanName + " while initialising " + wiringBean);
|
802 | }
|
803 | return null;
|
804 | };
|
805 | Context.prototype.callLifeCycleMethods = function (beanInstances, lifeCycleMethod) {
|
806 | var _this = this;
|
807 | beanInstances.forEach(function (beanInstance) { return _this.callLifeCycleMethodsOnBean(beanInstance, lifeCycleMethod); });
|
808 | };
|
809 | Context.prototype.callLifeCycleMethodsOnBean = function (beanInstance, lifeCycleMethod, methodToIgnore) {
|
810 |
|
811 | var allMethods = {};
|
812 |
|
813 | this.forEachMetaDataInHierarchy(beanInstance, function (metaData) {
|
814 | var methods = metaData[lifeCycleMethod];
|
815 | if (methods) {
|
816 | methods.forEach(function (methodName) {
|
817 | if (methodName != methodToIgnore) {
|
818 | allMethods[methodName] = true;
|
819 | }
|
820 | });
|
821 | }
|
822 | });
|
823 | var allMethodsList = Object.keys(allMethods);
|
824 | allMethodsList.forEach(function (methodName) { return beanInstance[methodName](); });
|
825 | };
|
826 | Context.prototype.getBean = function (name) {
|
827 | return this.lookupBeanInstance("getBean", name, true);
|
828 | };
|
829 | Context.prototype.destroy = function () {
|
830 | if (this.destroyed) {
|
831 | return;
|
832 | }
|
833 | this.logger.log(">> Shutting down ag-Application Context");
|
834 | var beanInstances = this.getBeanInstances();
|
835 | this.destroyBeans(beanInstances);
|
836 | this.contextParams.providedBeanInstances = null;
|
837 | this.destroyed = true;
|
838 | this.logger.log(">> ag-Application Context shut down - component is dead");
|
839 | };
|
840 | Context.prototype.destroyBean = function (bean) {
|
841 | if (!bean) {
|
842 | return;
|
843 | }
|
844 | this.destroyBeans([bean]);
|
845 | };
|
846 | Context.prototype.destroyBeans = function (beans) {
|
847 | var _this = this;
|
848 | if (!beans) {
|
849 | return [];
|
850 | }
|
851 | beans.forEach(function (bean) {
|
852 | _this.callLifeCycleMethodsOnBean(bean, 'preDestroyMethods', 'destroy');
|
853 |
|
854 | var beanAny = bean;
|
855 | if (typeof beanAny.destroy === 'function') {
|
856 | beanAny.destroy();
|
857 | }
|
858 | });
|
859 | return [];
|
860 | };
|
861 | return Context;
|
862 | }());
|
863 |
|
864 |
|
865 | function applyToConstructor(constructor, argArray) {
|
866 | var args = [null].concat(argArray);
|
867 | var factoryFunction = constructor.bind.apply(constructor, args);
|
868 | return new factoryFunction();
|
869 | }
|
870 | function PreConstruct(target, methodName, descriptor) {
|
871 | var props = getOrCreateProps(target.constructor);
|
872 | if (!props.preConstructMethods) {
|
873 | props.preConstructMethods = [];
|
874 | }
|
875 | props.preConstructMethods.push(methodName);
|
876 | }
|
877 | function PostConstruct(target, methodName, descriptor) {
|
878 | var props = getOrCreateProps(target.constructor);
|
879 | if (!props.postConstructMethods) {
|
880 | props.postConstructMethods = [];
|
881 | }
|
882 | props.postConstructMethods.push(methodName);
|
883 | }
|
884 | function PreDestroy(target, methodName, descriptor) {
|
885 | var props = getOrCreateProps(target.constructor);
|
886 | if (!props.preDestroyMethods) {
|
887 | props.preDestroyMethods = [];
|
888 | }
|
889 | props.preDestroyMethods.push(methodName);
|
890 | }
|
891 | function Bean(beanName) {
|
892 | return function (classConstructor) {
|
893 | var props = getOrCreateProps(classConstructor);
|
894 | props.beanName = beanName;
|
895 | };
|
896 | }
|
897 | function Autowired(name) {
|
898 | return function (target, propertyKey, descriptor) {
|
899 | autowiredFunc(target, name, false, target, propertyKey, null);
|
900 | };
|
901 | }
|
902 | function Optional(name) {
|
903 | return function (target, propertyKey, descriptor) {
|
904 | autowiredFunc(target, name, true, target, propertyKey, null);
|
905 | };
|
906 | }
|
907 | function autowiredFunc(target, name, optional, classPrototype, methodOrAttributeName, index) {
|
908 | if (name === null) {
|
909 | console.error("AG Grid: Autowired name should not be null");
|
910 | return;
|
911 | }
|
912 | if (typeof index === "number") {
|
913 | console.error("AG Grid: Autowired should be on an attribute");
|
914 | return;
|
915 | }
|
916 |
|
917 | var props = getOrCreateProps(target.constructor);
|
918 | if (!props.agClassAttributes) {
|
919 | props.agClassAttributes = [];
|
920 | }
|
921 | props.agClassAttributes.push({
|
922 | attributeName: methodOrAttributeName,
|
923 | beanName: name,
|
924 | optional: optional
|
925 | });
|
926 | }
|
927 | function Qualifier(name) {
|
928 | return function (classPrototype, methodOrAttributeName, index) {
|
929 | var constructor = typeof classPrototype == "function" ? classPrototype : classPrototype.constructor;
|
930 | var props;
|
931 | if (typeof index === "number") {
|
932 |
|
933 | var methodName = void 0;
|
934 | if (methodOrAttributeName) {
|
935 | props = getOrCreateProps(constructor);
|
936 | methodName = methodOrAttributeName;
|
937 | }
|
938 | else {
|
939 | props = getOrCreateProps(constructor);
|
940 | methodName = "agConstructor";
|
941 | }
|
942 | if (!props.autowireMethods) {
|
943 | props.autowireMethods = {};
|
944 | }
|
945 | if (!props.autowireMethods[methodName]) {
|
946 | props.autowireMethods[methodName] = {};
|
947 | }
|
948 | props.autowireMethods[methodName][index] = name;
|
949 | }
|
950 | };
|
951 | }
|
952 | function getOrCreateProps(target) {
|
953 | if (!target.hasOwnProperty("__agBeanMetaData")) {
|
954 | target.__agBeanMetaData = {};
|
955 | }
|
956 | return target.__agBeanMetaData;
|
957 | }
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 | var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
966 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
967 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
968 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
969 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
970 | };
|
971 | var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
972 | return function (target, key) { decorator(target, key, paramIndex); }
|
973 | };
|
974 | var EventService = (function () {
|
975 | function EventService() {
|
976 | this.allSyncListeners = new Map();
|
977 | this.allAsyncListeners = new Map();
|
978 | this.globalSyncListeners = new Set();
|
979 | this.globalAsyncListeners = new Set();
|
980 | this.asyncFunctionsQueue = [];
|
981 | this.scheduled = false;
|
982 |
|
983 | this.firedEvents = {};
|
984 | }
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 | EventService.prototype.setBeans = function (loggerFactory, gridOptionsWrapper, frameworkOverrides, globalEventListener) {
|
995 | if (globalEventListener === void 0) { globalEventListener = null; }
|
996 | this.frameworkOverrides = frameworkOverrides;
|
997 | if (globalEventListener) {
|
998 | var async = gridOptionsWrapper.useAsyncEvents();
|
999 | this.addGlobalListener(globalEventListener, async);
|
1000 | }
|
1001 | };
|
1002 | EventService.prototype.getListeners = function (eventType, async, autoCreateListenerCollection) {
|
1003 | var listenerMap = async ? this.allAsyncListeners : this.allSyncListeners;
|
1004 | var listeners = listenerMap.get(eventType);
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 | if (!listeners && autoCreateListenerCollection) {
|
1010 | listeners = new Set();
|
1011 | listenerMap.set(eventType, listeners);
|
1012 | }
|
1013 | return listeners;
|
1014 | };
|
1015 | EventService.prototype.noRegisteredListenersExist = function () {
|
1016 | return this.allSyncListeners.size === 0 && this.allAsyncListeners.size === 0 &&
|
1017 | this.globalSyncListeners.size === 0 && this.globalAsyncListeners.size === 0;
|
1018 | };
|
1019 | EventService.prototype.addEventListener = function (eventType, listener, async) {
|
1020 | if (async === void 0) { async = false; }
|
1021 | this.getListeners(eventType, async, true).add(listener);
|
1022 | };
|
1023 | EventService.prototype.removeEventListener = function (eventType, listener, async) {
|
1024 | if (async === void 0) { async = false; }
|
1025 | var listeners = this.getListeners(eventType, async, false);
|
1026 | if (!listeners) {
|
1027 | return;
|
1028 | }
|
1029 | listeners.delete(listener);
|
1030 | if (listeners.size === 0) {
|
1031 | var listenerMap = async ? this.allAsyncListeners : this.allSyncListeners;
|
1032 | listenerMap.delete(eventType);
|
1033 | }
|
1034 | };
|
1035 | EventService.prototype.addGlobalListener = function (listener, async) {
|
1036 | if (async === void 0) { async = false; }
|
1037 | (async ? this.globalAsyncListeners : this.globalSyncListeners).add(listener);
|
1038 | };
|
1039 | EventService.prototype.removeGlobalListener = function (listener, async) {
|
1040 | if (async === void 0) { async = false; }
|
1041 | (async ? this.globalAsyncListeners : this.globalSyncListeners).delete(listener);
|
1042 | };
|
1043 | EventService.prototype.dispatchEvent = function (event) {
|
1044 | this.dispatchToListeners(event, true);
|
1045 | this.dispatchToListeners(event, false);
|
1046 | this.firedEvents[event.type] = true;
|
1047 | };
|
1048 | EventService.prototype.dispatchEventOnce = function (event) {
|
1049 | if (!this.firedEvents[event.type]) {
|
1050 | this.dispatchEvent(event);
|
1051 | }
|
1052 | };
|
1053 | EventService.prototype.dispatchToListeners = function (event, async) {
|
1054 | var _this = this;
|
1055 | var eventType = event.type;
|
1056 | var processEventListeners = function (listeners) { return listeners.forEach(function (listener) {
|
1057 | if (async) {
|
1058 | _this.dispatchAsync(function () { return listener(event); });
|
1059 | }
|
1060 | else {
|
1061 | listener(event);
|
1062 | }
|
1063 | }); };
|
1064 | var listeners = this.getListeners(eventType, async, false);
|
1065 | if (listeners) {
|
1066 | processEventListeners(listeners);
|
1067 | }
|
1068 | var globalListeners = async ? this.globalAsyncListeners : this.globalSyncListeners;
|
1069 | globalListeners.forEach(function (listener) {
|
1070 | if (async) {
|
1071 | _this.dispatchAsync(function () { return _this.frameworkOverrides.dispatchEvent(eventType, function () { return listener(eventType, event); }, true); });
|
1072 | }
|
1073 | else {
|
1074 | _this.frameworkOverrides.dispatchEvent(eventType, function () { return listener(eventType, event); }, true);
|
1075 | }
|
1076 | });
|
1077 | };
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 | EventService.prototype.dispatchAsync = function (func) {
|
1083 |
|
1084 | this.asyncFunctionsQueue.push(func);
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 | if (!this.scheduled) {
|
1090 |
|
1091 | window.setTimeout(this.flushAsyncQueue.bind(this), 0);
|
1092 |
|
1093 | this.scheduled = true;
|
1094 | }
|
1095 | };
|
1096 |
|
1097 | EventService.prototype.flushAsyncQueue = function () {
|
1098 | this.scheduled = false;
|
1099 |
|
1100 |
|
1101 |
|
1102 |
|
1103 |
|
1104 | var queueCopy = this.asyncFunctionsQueue.slice();
|
1105 | this.asyncFunctionsQueue = [];
|
1106 |
|
1107 | queueCopy.forEach(function (func) { return func(); });
|
1108 | };
|
1109 | __decorate([
|
1110 | __param(0, Qualifier('loggerFactory')),
|
1111 | __param(1, Qualifier('gridOptionsWrapper')),
|
1112 | __param(2, Qualifier('frameworkOverrides')),
|
1113 | __param(3, Qualifier('globalEventListener'))
|
1114 | ], EventService.prototype, "setBeans", null);
|
1115 | EventService = __decorate([
|
1116 | Bean('eventService')
|
1117 | ], EventService);
|
1118 | return EventService;
|
1119 | }());
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 | var Constants = (function () {
|
1128 | function Constants() {
|
1129 | }
|
1130 | Constants.ROW_BUFFER_SIZE = 10;
|
1131 | Constants.LAYOUT_INTERVAL = 500;
|
1132 | Constants.BATCH_WAIT_MILLIS = 50;
|
1133 | Constants.EXPORT_TYPE_DRAG_COPY = 'dragCopy';
|
1134 | Constants.EXPORT_TYPE_CLIPBOARD = 'clipboard';
|
1135 | Constants.EXPORT_TYPE_EXCEL = 'excel';
|
1136 | Constants.EXPORT_TYPE_CSV = 'csv';
|
1137 | Constants.ROW_MODEL_TYPE_INFINITE = 'infinite';
|
1138 | Constants.ROW_MODEL_TYPE_VIEWPORT = 'viewport';
|
1139 | Constants.ROW_MODEL_TYPE_CLIENT_SIDE = 'clientSide';
|
1140 | Constants.ROW_MODEL_TYPE_SERVER_SIDE = 'serverSide';
|
1141 | Constants.ALWAYS = 'always';
|
1142 | Constants.ONLY_WHEN_GROUPING = 'onlyWhenGrouping';
|
1143 | Constants.PINNED_TOP = 'top';
|
1144 | Constants.PINNED_BOTTOM = 'bottom';
|
1145 | Constants.DOM_LAYOUT_NORMAL = 'normal';
|
1146 | Constants.DOM_LAYOUT_PRINT = 'print';
|
1147 | Constants.DOM_LAYOUT_AUTO_HEIGHT = 'autoHeight';
|
1148 | Constants.GROUP_AUTO_COLUMN_ID = 'ag-Grid-AutoColumn';
|
1149 | Constants.SOURCE_PASTE = 'paste';
|
1150 | Constants.PINNED_RIGHT = 'right';
|
1151 | Constants.PINNED_LEFT = 'left';
|
1152 | Constants.SORT_ASC = 'asc';
|
1153 | Constants.SORT_DESC = 'desc';
|
1154 | Constants.INPUT_SELECTOR = 'input, select, button, textarea';
|
1155 | Constants.FOCUSABLE_SELECTOR = '[tabindex], input, select, button, textarea';
|
1156 | Constants.FOCUSABLE_EXCLUDE = '.ag-hidden, .ag-hidden *, [disabled], .ag-disabled, .ag-disabled *';
|
1157 | return Constants;
|
1158 | }());
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 | var ModuleNames;
|
1167 | (function (ModuleNames) {
|
1168 |
|
1169 | ModuleNames["CommunityCoreModule"] = "@ag-grid-community/core";
|
1170 |
|
1171 | ModuleNames["CommunityAllModules"] = "@ag-grid-community/all";
|
1172 |
|
1173 | ModuleNames["InfiniteRowModelModule"] = "@ag-grid-community/infinite-row-model";
|
1174 | ModuleNames["ClientSideRowModelModule"] = "@ag-grid-community/client-side-row-model";
|
1175 | ModuleNames["CsvExportModule"] = "@ag-grid-community/csv-export";
|
1176 |
|
1177 | ModuleNames["EnterpriseCoreModule"] = "@ag-grid-enterprise/core";
|
1178 |
|
1179 | ModuleNames["EnterpriseAllModules"] = "@ag-grid-enterprise/all";
|
1180 |
|
1181 | ModuleNames["RowGroupingModule"] = "@ag-grid-enterprise/row-grouping";
|
1182 | ModuleNames["ColumnToolPanelModule"] = "@ag-grid-enterprise/column-tool-panel";
|
1183 | ModuleNames["FiltersToolPanelModule"] = "@ag-grid-enterprise/filter-tool-panel";
|
1184 | ModuleNames["MenuModule"] = "@ag-grid-enterprise/menu";
|
1185 | ModuleNames["SetFilterModule"] = "@ag-grid-enterprise/set-filter";
|
1186 | ModuleNames["MultiFilterModule"] = "@ag-grid-enterprise/multi-filter";
|
1187 | ModuleNames["StatusBarModule"] = "@ag-grid-enterprise/status-bar";
|
1188 | ModuleNames["SideBarModule"] = "@ag-grid-enterprise/side-bar";
|
1189 | ModuleNames["RangeSelectionModule"] = "@ag-grid-enterprise/range-selection";
|
1190 | ModuleNames["MasterDetailModule"] = "@ag-grid-enterprise/master-detail";
|
1191 | ModuleNames["RichSelectModule"] = "@ag-grid-enterprise/rich-select";
|
1192 | ModuleNames["GridChartsModule"] = "@ag-grid-enterprise/charts";
|
1193 | ModuleNames["ViewportRowModelModule"] = "@ag-grid-enterprise/viewport-row-model";
|
1194 | ModuleNames["ServerSideRowModelModule"] = "@ag-grid-enterprise/server-side-row-model";
|
1195 | ModuleNames["ExcelExportModule"] = "@ag-grid-enterprise/excel-export";
|
1196 | ModuleNames["ClipboardModule"] = "@ag-grid-enterprise/clipboard";
|
1197 | ModuleNames["SparklinesModule"] = "@ag-grid-enterprise/sparklines";
|
1198 |
|
1199 |
|
1200 | ModuleNames["AngularModule"] = "@ag-grid-community/angular";
|
1201 | ModuleNames["ReactModule"] = "@ag-grid-community/react";
|
1202 | ModuleNames["VueModule"] = "@ag-grid-community/vue";
|
1203 | ModuleNames["PolymerModule"] = "@ag-grid-community/polymer";
|
1204 |
|
1205 |
|
1206 |
|
1207 | })(ModuleNames || (ModuleNames = {}));
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 | var ModuleRegistry = (function () {
|
1216 | function ModuleRegistry() {
|
1217 | }
|
1218 | ModuleRegistry.register = function (module, moduleBased) {
|
1219 | if (moduleBased === void 0) { moduleBased = true; }
|
1220 | ModuleRegistry.modulesMap[module.moduleName] = module;
|
1221 | if (ModuleRegistry.moduleBased === undefined) {
|
1222 | ModuleRegistry.moduleBased = moduleBased;
|
1223 | }
|
1224 | else {
|
1225 | if (ModuleRegistry.moduleBased !== moduleBased) {
|
1226 | doOnce(function () {
|
1227 | 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.");
|
1228 | console.warn('Please see https://www.ag-grid.com/javascript-grid/packages-modules/ for more information.');
|
1229 | }, 'ModulePackageCheck');
|
1230 | }
|
1231 | }
|
1232 | };
|
1233 |
|
1234 | ModuleRegistry.registerModules = function (modules, moduleBased) {
|
1235 | if (moduleBased === void 0) { moduleBased = true; }
|
1236 | if (!modules) {
|
1237 | return;
|
1238 | }
|
1239 | modules.forEach(function (module) { return ModuleRegistry.register(module, moduleBased); });
|
1240 | };
|
1241 | ModuleRegistry.assertRegistered = function (moduleName, reason) {
|
1242 | if (this.isRegistered(moduleName)) {
|
1243 | return true;
|
1244 | }
|
1245 | var warningKey = reason + moduleName;
|
1246 | var warningMessage;
|
1247 | if (ModuleRegistry.moduleBased) {
|
1248 | warningMessage = "AG Grid: unable to use " + reason + " as module " + moduleName + " is not present. Please see: https://www.ag-grid.com/javascript-grid/modules/";
|
1249 | }
|
1250 | else {
|
1251 | 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/";
|
1252 | }
|
1253 | doOnce(function () {
|
1254 | console.warn(warningMessage);
|
1255 | }, warningKey);
|
1256 | return false;
|
1257 | };
|
1258 | ModuleRegistry.isRegistered = function (moduleName) {
|
1259 | return !!ModuleRegistry.modulesMap[moduleName];
|
1260 | };
|
1261 | ModuleRegistry.getRegisteredModules = function () {
|
1262 | return values(ModuleRegistry.modulesMap);
|
1263 | };
|
1264 | ModuleRegistry.isPackageBased = function () {
|
1265 | return !ModuleRegistry.moduleBased;
|
1266 | };
|
1267 |
|
1268 | ModuleRegistry.modulesMap = {};
|
1269 | return ModuleRegistry;
|
1270 | }());
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 | var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
1279 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
1280 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
1281 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
1282 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
1283 | };
|
1284 | var instanceIdSequence = 0;
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 | var Column = (function () {
|
1292 | function Column(colDef, userProvidedColDef, colId, primary) {
|
1293 |
|
1294 | this.instanceId = instanceIdSequence++;
|
1295 | this.moving = false;
|
1296 | this.menuVisible = false;
|
1297 | this.filterActive = false;
|
1298 | this.eventService = new EventService();
|
1299 | this.rowGroupActive = false;
|
1300 | this.pivotActive = false;
|
1301 | this.aggregationActive = false;
|
1302 | this.colDef = colDef;
|
1303 | this.userProvidedColDef = userProvidedColDef;
|
1304 | this.colId = colId;
|
1305 | this.primary = primary;
|
1306 | this.setState(colDef);
|
1307 | }
|
1308 | Column.prototype.getInstanceId = function () {
|
1309 | return this.instanceId;
|
1310 | };
|
1311 | Column.prototype.setState = function (colDef) {
|
1312 |
|
1313 | if (colDef.sort !== undefined) {
|
1314 | if (colDef.sort === Constants.SORT_ASC || colDef.sort === Constants.SORT_DESC) {
|
1315 | this.sort = colDef.sort;
|
1316 | }
|
1317 | }
|
1318 | else {
|
1319 | if (colDef.initialSort === Constants.SORT_ASC || colDef.initialSort === Constants.SORT_DESC) {
|
1320 | this.sort = colDef.initialSort;
|
1321 | }
|
1322 | }
|
1323 |
|
1324 | var sortIndex = attrToNumber(colDef.sortIndex);
|
1325 | var initialSortIndex = attrToNumber(colDef.initialSortIndex);
|
1326 | if (sortIndex !== undefined) {
|
1327 | if (sortIndex !== null) {
|
1328 | this.sortIndex = sortIndex;
|
1329 | }
|
1330 | }
|
1331 | else {
|
1332 | if (initialSortIndex !== null) {
|
1333 | this.sortIndex = initialSortIndex;
|
1334 | }
|
1335 | }
|
1336 |
|
1337 | var hide = attrToBoolean(colDef.hide);
|
1338 | var initialHide = attrToBoolean(colDef.initialHide);
|
1339 | if (hide !== undefined) {
|
1340 | this.visible = !hide;
|
1341 | }
|
1342 | else {
|
1343 | this.visible = !initialHide;
|
1344 | }
|
1345 |
|
1346 | if (colDef.pinned !== undefined) {
|
1347 | this.setPinned(colDef.pinned);
|
1348 | }
|
1349 | else {
|
1350 | this.setPinned(colDef.initialPinned);
|
1351 | }
|
1352 |
|
1353 | var flex = attrToNumber(colDef.flex);
|
1354 | var initialFlex = attrToNumber(colDef.initialFlex);
|
1355 | if (flex !== undefined) {
|
1356 | this.flex = flex;
|
1357 | }
|
1358 | else if (initialFlex !== undefined) {
|
1359 | this.flex = initialFlex;
|
1360 | }
|
1361 | };
|
1362 |
|
1363 | Column.prototype.setColDef = function (colDef, userProvidedColDef) {
|
1364 | this.colDef = colDef;
|
1365 | this.userProvidedColDef = userProvidedColDef;
|
1366 | this.initMinAndMaxWidths();
|
1367 | this.initDotNotation();
|
1368 | };
|
1369 | |
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 | Column.prototype.getUserProvidedColDef = function () {
|
1375 | return this.userProvidedColDef;
|
1376 | };
|
1377 | Column.prototype.setParent = function (parent) {
|
1378 | this.parent = parent;
|
1379 | };
|
1380 |
|
1381 | Column.prototype.getParent = function () {
|
1382 | return this.parent;
|
1383 | };
|
1384 | Column.prototype.setOriginalParent = function (originalParent) {
|
1385 | this.originalParent = originalParent;
|
1386 | };
|
1387 | Column.prototype.getOriginalParent = function () {
|
1388 | return this.originalParent;
|
1389 | };
|
1390 |
|
1391 | Column.prototype.initialise = function () {
|
1392 | this.initMinAndMaxWidths();
|
1393 | this.resetActualWidth('gridInitializing');
|
1394 | this.initDotNotation();
|
1395 | this.validate();
|
1396 | };
|
1397 | Column.prototype.initDotNotation = function () {
|
1398 | var suppressDotNotation = this.gridOptionsWrapper.isSuppressFieldDotNotation();
|
1399 | this.fieldContainsDots = exists(this.colDef.field) && this.colDef.field.indexOf('.') >= 0 && !suppressDotNotation;
|
1400 | this.tooltipFieldContainsDots = exists(this.colDef.tooltipField) && this.colDef.tooltipField.indexOf('.') >= 0 && !suppressDotNotation;
|
1401 | };
|
1402 | Column.prototype.initMinAndMaxWidths = function () {
|
1403 | var colDef = this.colDef;
|
1404 | this.minWidth = this.columnUtils.calculateColMinWidth(colDef);
|
1405 | this.maxWidth = this.columnUtils.calculateColMaxWidth(colDef);
|
1406 | };
|
1407 | Column.prototype.resetActualWidth = function (source) {
|
1408 | if (source === void 0) { source = 'api'; }
|
1409 | var initialWidth = this.columnUtils.calculateColInitialWidth(this.colDef);
|
1410 | this.setActualWidth(initialWidth, source, true);
|
1411 | };
|
1412 | Column.prototype.isEmptyGroup = function () {
|
1413 | return false;
|
1414 | };
|
1415 | Column.prototype.isRowGroupDisplayed = function (colId) {
|
1416 | if (missing(this.colDef) || missing(this.colDef.showRowGroup)) {
|
1417 | return false;
|
1418 | }
|
1419 | var showingAllGroups = this.colDef.showRowGroup === true;
|
1420 | var showingThisGroup = this.colDef.showRowGroup === colId;
|
1421 | return showingAllGroups || showingThisGroup;
|
1422 | };
|
1423 |
|
1424 | Column.prototype.isPrimary = function () {
|
1425 | return this.primary;
|
1426 | };
|
1427 |
|
1428 | Column.prototype.isFilterAllowed = function () {
|
1429 |
|
1430 |
|
1431 | var filterDefined = !!this.colDef.filter || !!this.colDef.filterFramework;
|
1432 | return filterDefined;
|
1433 | };
|
1434 | Column.prototype.isFieldContainsDots = function () {
|
1435 | return this.fieldContainsDots;
|
1436 | };
|
1437 | Column.prototype.isTooltipFieldContainsDots = function () {
|
1438 | return this.tooltipFieldContainsDots;
|
1439 | };
|
1440 | Column.prototype.validate = function () {
|
1441 | var colDefAny = this.colDef;
|
1442 | function warnOnce(msg, key, obj) {
|
1443 | doOnce(function () {
|
1444 | if (obj) {
|
1445 | console.warn(msg, obj);
|
1446 | }
|
1447 | else {
|
1448 | doOnce(function () { return console.warn(msg); }, key);
|
1449 | }
|
1450 | }, key);
|
1451 | }
|
1452 | var usingCSRM = this.gridOptionsWrapper.isRowModelDefault();
|
1453 | if (usingCSRM && !ModuleRegistry.isRegistered(ModuleNames.RowGroupingModule)) {
|
1454 | var rowGroupingItems = ['enableRowGroup', 'rowGroup', 'rowGroupIndex', 'enablePivot', 'enableValue', 'pivot', 'pivotIndex', 'aggFunc'];
|
1455 | rowGroupingItems.forEach(function (item) {
|
1456 | if (exists(colDefAny[item])) {
|
1457 | if (ModuleRegistry.isPackageBased()) {
|
1458 | warnOnce("AG Grid: " + item + " is only valid in ag-grid-enterprise, your column definition should not have " + item, 'ColumnRowGroupingMissing' + item);
|
1459 | }
|
1460 | else {
|
1461 | warnOnce("AG Grid: " + item + " is only valid with AG Grid Enterprise Module " + ModuleNames.RowGroupingModule + " - your column definition should not have " + item, 'ColumnRowGroupingMissing' + item);
|
1462 | }
|
1463 | }
|
1464 | });
|
1465 | }
|
1466 | if (!ModuleRegistry.isRegistered(ModuleNames.RichSelectModule)) {
|
1467 | if (this.colDef.cellEditor === 'agRichSelect') {
|
1468 | if (ModuleRegistry.isPackageBased()) {
|
1469 | warnOnce("AG Grid: " + this.colDef.cellEditor + " can only be used with ag-grid-enterprise", 'ColumnRichSelectMissing');
|
1470 | }
|
1471 | else {
|
1472 | warnOnce("AG Grid: " + this.colDef.cellEditor + " can only be used with AG Grid Enterprise Module " + ModuleNames.RichSelectModule, 'ColumnRichSelectMissing');
|
1473 | }
|
1474 | }
|
1475 | }
|
1476 | if (this.gridOptionsWrapper.isTreeData()) {
|
1477 | var itemsNotAllowedWithTreeData = ['rowGroup', 'rowGroupIndex', 'pivot', 'pivotIndex'];
|
1478 | itemsNotAllowedWithTreeData.forEach(function (item) {
|
1479 | if (exists(colDefAny[item])) {
|
1480 | warnOnce("AG Grid: " + item + " is not possible when doing tree data, your column definition should not have " + item, 'TreeDataCannotRowGroup');
|
1481 | }
|
1482 | });
|
1483 | }
|
1484 | if (exists(this.colDef.width) && typeof this.colDef.width !== 'number') {
|
1485 | warnOnce('AG Grid: colDef.width should be a number, not ' + typeof this.colDef.width, 'ColumnCheck_asdfawef');
|
1486 | }
|
1487 | if (colDefAny.pinnedRowCellRenderer) {
|
1488 | 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');
|
1489 | }
|
1490 | if (colDefAny.pinnedRowCellRendererParams) {
|
1491 | 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');
|
1492 | }
|
1493 | if (colDefAny.pinnedRowCellRendererFramework) {
|
1494 | 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');
|
1495 | }
|
1496 | if (colDefAny.pinnedRowValueGetter) {
|
1497 | 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');
|
1498 | }
|
1499 | };
|
1500 |
|
1501 | Column.prototype.addEventListener = function (eventType, listener) {
|
1502 | this.eventService.addEventListener(eventType, listener);
|
1503 | };
|
1504 |
|
1505 | Column.prototype.removeEventListener = function (eventType, listener) {
|
1506 | this.eventService.removeEventListener(eventType, listener);
|
1507 | };
|
1508 | Column.prototype.createColumnFunctionCallbackParams = function (rowNode) {
|
1509 | return {
|
1510 | node: rowNode,
|
1511 | data: rowNode.data,
|
1512 | column: this,
|
1513 | colDef: this.colDef,
|
1514 | context: this.gridOptionsWrapper.getContext(),
|
1515 | api: this.gridOptionsWrapper.getApi(),
|
1516 | columnApi: this.gridOptionsWrapper.getColumnApi()
|
1517 | };
|
1518 | };
|
1519 | Column.prototype.isSuppressNavigable = function (rowNode) {
|
1520 |
|
1521 | if (typeof this.colDef.suppressNavigable === 'boolean') {
|
1522 | return this.colDef.suppressNavigable;
|
1523 | }
|
1524 |
|
1525 | if (typeof this.colDef.suppressNavigable === 'function') {
|
1526 | var params = this.createColumnFunctionCallbackParams(rowNode);
|
1527 | var userFunc = this.colDef.suppressNavigable;
|
1528 | return userFunc(params);
|
1529 | }
|
1530 | return false;
|
1531 | };
|
1532 | Column.prototype.isCellEditable = function (rowNode) {
|
1533 |
|
1534 | if (rowNode.group && !this.gridOptionsWrapper.isEnableGroupEdit()) {
|
1535 | return false;
|
1536 | }
|
1537 | return this.isColumnFunc(rowNode, this.colDef.editable);
|
1538 | };
|
1539 | Column.prototype.isSuppressFillHandle = function () {
|
1540 | return !!attrToBoolean(this.colDef.suppressFillHandle);
|
1541 | };
|
1542 | Column.prototype.isAutoHeight = function () {
|
1543 | return !!attrToBoolean(this.colDef.autoHeight);
|
1544 | };
|
1545 | Column.prototype.isRowDrag = function (rowNode) {
|
1546 | return this.isColumnFunc(rowNode, this.colDef.rowDrag);
|
1547 | };
|
1548 | Column.prototype.isDndSource = function (rowNode) {
|
1549 | return this.isColumnFunc(rowNode, this.colDef.dndSource);
|
1550 | };
|
1551 | Column.prototype.isCellCheckboxSelection = function (rowNode) {
|
1552 | return this.isColumnFunc(rowNode, this.colDef.checkboxSelection);
|
1553 | };
|
1554 | Column.prototype.isSuppressPaste = function (rowNode) {
|
1555 | return this.isColumnFunc(rowNode, this.colDef ? this.colDef.suppressPaste : null);
|
1556 | };
|
1557 | Column.prototype.isResizable = function () {
|
1558 | return !!attrToBoolean(this.colDef.resizable);
|
1559 | };
|
1560 | Column.prototype.isColumnFunc = function (rowNode, value) {
|
1561 |
|
1562 | if (typeof value === 'boolean') {
|
1563 | return value;
|
1564 | }
|
1565 |
|
1566 | if (typeof value === 'function') {
|
1567 | var params = this.createColumnFunctionCallbackParams(rowNode);
|
1568 | var editableFunc = value;
|
1569 | return editableFunc(params);
|
1570 | }
|
1571 | return false;
|
1572 | };
|
1573 | Column.prototype.setMoving = function (moving, source) {
|
1574 | if (source === void 0) { source = "api"; }
|
1575 | this.moving = moving;
|
1576 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_MOVING_CHANGED, source));
|
1577 | };
|
1578 | Column.prototype.createColumnEvent = function (type, source) {
|
1579 | return {
|
1580 | api: this.gridApi,
|
1581 | columnApi: this.columnApi,
|
1582 | type: type,
|
1583 | column: this,
|
1584 | columns: [this],
|
1585 | source: source
|
1586 | };
|
1587 | };
|
1588 | Column.prototype.isMoving = function () {
|
1589 | return this.moving;
|
1590 | };
|
1591 |
|
1592 | Column.prototype.getSort = function () {
|
1593 | return this.sort;
|
1594 | };
|
1595 | Column.prototype.setSort = function (sort, source) {
|
1596 | if (source === void 0) { source = "api"; }
|
1597 | if (this.sort !== sort) {
|
1598 | this.sort = sort;
|
1599 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_SORT_CHANGED, source));
|
1600 | }
|
1601 | };
|
1602 | Column.prototype.setMenuVisible = function (visible, source) {
|
1603 | if (source === void 0) { source = "api"; }
|
1604 | if (this.menuVisible !== visible) {
|
1605 | this.menuVisible = visible;
|
1606 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_MENU_VISIBLE_CHANGED, source));
|
1607 | }
|
1608 | };
|
1609 | Column.prototype.isMenuVisible = function () {
|
1610 | return this.menuVisible;
|
1611 | };
|
1612 | Column.prototype.isSortAscending = function () {
|
1613 | return this.sort === Constants.SORT_ASC;
|
1614 | };
|
1615 | Column.prototype.isSortDescending = function () {
|
1616 | return this.sort === Constants.SORT_DESC;
|
1617 | };
|
1618 | Column.prototype.isSortNone = function () {
|
1619 | return missing(this.sort);
|
1620 | };
|
1621 | Column.prototype.isSorting = function () {
|
1622 | return exists(this.sort);
|
1623 | };
|
1624 | Column.prototype.getSortIndex = function () {
|
1625 | return this.sortIndex;
|
1626 | };
|
1627 | Column.prototype.setSortIndex = function (sortOrder) {
|
1628 | this.sortIndex = sortOrder;
|
1629 | };
|
1630 | Column.prototype.setAggFunc = function (aggFunc) {
|
1631 | this.aggFunc = aggFunc;
|
1632 | };
|
1633 |
|
1634 | Column.prototype.getAggFunc = function () {
|
1635 | return this.aggFunc;
|
1636 | };
|
1637 | Column.prototype.getLeft = function () {
|
1638 | return this.left;
|
1639 | };
|
1640 | Column.prototype.getOldLeft = function () {
|
1641 | return this.oldLeft;
|
1642 | };
|
1643 | Column.prototype.getRight = function () {
|
1644 | return this.left + this.actualWidth;
|
1645 | };
|
1646 | Column.prototype.setLeft = function (left, source) {
|
1647 | if (source === void 0) { source = "api"; }
|
1648 | this.oldLeft = this.left;
|
1649 | if (this.left !== left) {
|
1650 | this.left = left;
|
1651 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_LEFT_CHANGED, source));
|
1652 | }
|
1653 | };
|
1654 |
|
1655 | Column.prototype.isFilterActive = function () {
|
1656 | return this.filterActive;
|
1657 | };
|
1658 |
|
1659 | Column.prototype.setFilterActive = function (active, source, additionalEventAttributes) {
|
1660 | if (source === void 0) { source = "api"; }
|
1661 | if (this.filterActive !== active) {
|
1662 | this.filterActive = active;
|
1663 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_FILTER_ACTIVE_CHANGED, source));
|
1664 | }
|
1665 | var filterChangedEvent = this.createColumnEvent(Column.EVENT_FILTER_CHANGED, source);
|
1666 | if (additionalEventAttributes) {
|
1667 | mergeDeep(filterChangedEvent, additionalEventAttributes);
|
1668 | }
|
1669 | this.eventService.dispatchEvent(filterChangedEvent);
|
1670 | };
|
1671 | Column.prototype.setPinned = function (pinned) {
|
1672 | if (pinned === true || pinned === Constants.PINNED_LEFT) {
|
1673 | this.pinned = Constants.PINNED_LEFT;
|
1674 | }
|
1675 | else if (pinned === Constants.PINNED_RIGHT) {
|
1676 | this.pinned = Constants.PINNED_RIGHT;
|
1677 | }
|
1678 | else {
|
1679 | this.pinned = null;
|
1680 | }
|
1681 | };
|
1682 | Column.prototype.setFirstRightPinned = function (firstRightPinned, source) {
|
1683 | if (source === void 0) { source = "api"; }
|
1684 | if (this.firstRightPinned !== firstRightPinned) {
|
1685 | this.firstRightPinned = firstRightPinned;
|
1686 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_FIRST_RIGHT_PINNED_CHANGED, source));
|
1687 | }
|
1688 | };
|
1689 | Column.prototype.setLastLeftPinned = function (lastLeftPinned, source) {
|
1690 | if (source === void 0) { source = "api"; }
|
1691 | if (this.lastLeftPinned !== lastLeftPinned) {
|
1692 | this.lastLeftPinned = lastLeftPinned;
|
1693 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_LAST_LEFT_PINNED_CHANGED, source));
|
1694 | }
|
1695 | };
|
1696 | Column.prototype.isFirstRightPinned = function () {
|
1697 | return this.firstRightPinned;
|
1698 | };
|
1699 | Column.prototype.isLastLeftPinned = function () {
|
1700 | return this.lastLeftPinned;
|
1701 | };
|
1702 | Column.prototype.isPinned = function () {
|
1703 | return this.pinned === Constants.PINNED_LEFT || this.pinned === Constants.PINNED_RIGHT;
|
1704 | };
|
1705 | Column.prototype.isPinnedLeft = function () {
|
1706 | return this.pinned === Constants.PINNED_LEFT;
|
1707 | };
|
1708 | Column.prototype.isPinnedRight = function () {
|
1709 | return this.pinned === Constants.PINNED_RIGHT;
|
1710 | };
|
1711 | Column.prototype.getPinned = function () {
|
1712 | return this.pinned;
|
1713 | };
|
1714 | Column.prototype.setVisible = function (visible, source) {
|
1715 | if (source === void 0) { source = "api"; }
|
1716 | var newValue = visible === true;
|
1717 | if (this.visible !== newValue) {
|
1718 | this.visible = newValue;
|
1719 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_VISIBLE_CHANGED, source));
|
1720 | }
|
1721 | };
|
1722 | Column.prototype.isVisible = function () {
|
1723 | return this.visible;
|
1724 | };
|
1725 | |
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 | Column.prototype.getColDef = function () {
|
1731 | return this.colDef;
|
1732 | };
|
1733 | Column.prototype.getColumnGroupShow = function () {
|
1734 | return this.colDef.columnGroupShow;
|
1735 | };
|
1736 | |
1737 |
|
1738 |
|
1739 |
|
1740 | Column.prototype.getColId = function () {
|
1741 | return this.colId;
|
1742 | };
|
1743 | |
1744 |
|
1745 |
|
1746 |
|
1747 | Column.prototype.getId = function () {
|
1748 | return this.getColId();
|
1749 | };
|
1750 | |
1751 |
|
1752 |
|
1753 |
|
1754 | Column.prototype.getUniqueId = function () {
|
1755 | return this.getId();
|
1756 | };
|
1757 | Column.prototype.getDefinition = function () {
|
1758 | return this.colDef;
|
1759 | };
|
1760 |
|
1761 | Column.prototype.getActualWidth = function () {
|
1762 | return this.actualWidth;
|
1763 | };
|
1764 | Column.prototype.createBaseColDefParams = function (rowNode) {
|
1765 | var params = {
|
1766 | node: rowNode,
|
1767 | data: rowNode.data,
|
1768 | colDef: this.colDef,
|
1769 | column: this,
|
1770 | api: this.gridOptionsWrapper.getApi(),
|
1771 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
1772 | context: this.gridOptionsWrapper.getContext()
|
1773 | };
|
1774 | return params;
|
1775 | };
|
1776 | Column.prototype.getColSpan = function (rowNode) {
|
1777 | if (missing(this.colDef.colSpan)) {
|
1778 | return 1;
|
1779 | }
|
1780 | var params = this.createBaseColDefParams(rowNode);
|
1781 | var colSpan = this.colDef.colSpan(params);
|
1782 |
|
1783 | return Math.max(colSpan, 1);
|
1784 | };
|
1785 | Column.prototype.getRowSpan = function (rowNode) {
|
1786 | if (missing(this.colDef.rowSpan)) {
|
1787 | return 1;
|
1788 | }
|
1789 | var params = this.createBaseColDefParams(rowNode);
|
1790 | var rowSpan = this.colDef.rowSpan(params);
|
1791 |
|
1792 | return Math.max(rowSpan, 1);
|
1793 | };
|
1794 | Column.prototype.setActualWidth = function (actualWidth, source, silent) {
|
1795 | if (source === void 0) { source = "api"; }
|
1796 | if (silent === void 0) { silent = false; }
|
1797 | if (this.minWidth != null) {
|
1798 | actualWidth = Math.max(actualWidth, this.minWidth);
|
1799 | }
|
1800 | if (this.maxWidth != null) {
|
1801 | actualWidth = Math.min(actualWidth, this.maxWidth);
|
1802 | }
|
1803 | if (this.actualWidth !== actualWidth) {
|
1804 |
|
1805 | this.actualWidth = actualWidth;
|
1806 | if (this.flex && source !== 'flex' && source !== 'gridInitializing') {
|
1807 | this.flex = null;
|
1808 | }
|
1809 | if (!silent) {
|
1810 | this.fireColumnWidthChangedEvent(source);
|
1811 | }
|
1812 | }
|
1813 | };
|
1814 | Column.prototype.fireColumnWidthChangedEvent = function (source) {
|
1815 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_WIDTH_CHANGED, source));
|
1816 | };
|
1817 | Column.prototype.isGreaterThanMax = function (width) {
|
1818 | if (this.maxWidth != null) {
|
1819 | return width > this.maxWidth;
|
1820 | }
|
1821 | return false;
|
1822 | };
|
1823 | Column.prototype.getMinWidth = function () {
|
1824 | return this.minWidth;
|
1825 | };
|
1826 | Column.prototype.getMaxWidth = function () {
|
1827 | return this.maxWidth;
|
1828 | };
|
1829 | Column.prototype.getFlex = function () {
|
1830 | return this.flex || 0;
|
1831 | };
|
1832 |
|
1833 |
|
1834 | Column.prototype.setFlex = function (flex) {
|
1835 | if (this.flex !== flex) {
|
1836 | this.flex = flex;
|
1837 | }
|
1838 | };
|
1839 | Column.prototype.setMinimum = function (source) {
|
1840 | if (source === void 0) { source = "api"; }
|
1841 | if (exists(this.minWidth)) {
|
1842 | this.setActualWidth(this.minWidth, source);
|
1843 | }
|
1844 | };
|
1845 | Column.prototype.setRowGroupActive = function (rowGroup, source) {
|
1846 | if (source === void 0) { source = "api"; }
|
1847 | if (this.rowGroupActive !== rowGroup) {
|
1848 | this.rowGroupActive = rowGroup;
|
1849 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_ROW_GROUP_CHANGED, source));
|
1850 | }
|
1851 | };
|
1852 |
|
1853 | Column.prototype.isRowGroupActive = function () {
|
1854 | return this.rowGroupActive;
|
1855 | };
|
1856 | Column.prototype.setPivotActive = function (pivot, source) {
|
1857 | if (source === void 0) { source = "api"; }
|
1858 | if (this.pivotActive !== pivot) {
|
1859 | this.pivotActive = pivot;
|
1860 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_PIVOT_CHANGED, source));
|
1861 | }
|
1862 | };
|
1863 |
|
1864 | Column.prototype.isPivotActive = function () {
|
1865 | return this.pivotActive;
|
1866 | };
|
1867 | Column.prototype.isAnyFunctionActive = function () {
|
1868 | return this.isPivotActive() || this.isRowGroupActive() || this.isValueActive();
|
1869 | };
|
1870 | Column.prototype.isAnyFunctionAllowed = function () {
|
1871 | return this.isAllowPivot() || this.isAllowRowGroup() || this.isAllowValue();
|
1872 | };
|
1873 | Column.prototype.setValueActive = function (value, source) {
|
1874 | if (source === void 0) { source = "api"; }
|
1875 | if (this.aggregationActive !== value) {
|
1876 | this.aggregationActive = value;
|
1877 | this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_VALUE_CHANGED, source));
|
1878 | }
|
1879 | };
|
1880 |
|
1881 | Column.prototype.isValueActive = function () {
|
1882 | return this.aggregationActive;
|
1883 | };
|
1884 | Column.prototype.isAllowPivot = function () {
|
1885 | return this.colDef.enablePivot === true;
|
1886 | };
|
1887 | Column.prototype.isAllowValue = function () {
|
1888 | return this.colDef.enableValue === true;
|
1889 | };
|
1890 | Column.prototype.isAllowRowGroup = function () {
|
1891 | return this.colDef.enableRowGroup === true;
|
1892 | };
|
1893 | Column.prototype.getMenuTabs = function (defaultValues) {
|
1894 | var menuTabs = this.getColDef().menuTabs;
|
1895 | if (menuTabs == null) {
|
1896 | menuTabs = defaultValues;
|
1897 | }
|
1898 | return menuTabs;
|
1899 | };
|
1900 |
|
1901 |
|
1902 | Column.prototype.isLockPosition = function () {
|
1903 | console.warn('AG Grid: since v21, col.isLockPosition() should not be used, please use col.getColDef().lockPosition instead.');
|
1904 | return this.colDef ? !!this.colDef.lockPosition : false;
|
1905 | };
|
1906 |
|
1907 |
|
1908 | Column.prototype.isLockVisible = function () {
|
1909 | console.warn('AG Grid: since v21, col.isLockVisible() should not be used, please use col.getColDef().lockVisible instead.');
|
1910 | return this.colDef ? !!this.colDef.lockVisible : false;
|
1911 | };
|
1912 |
|
1913 |
|
1914 | Column.prototype.isLockPinned = function () {
|
1915 | console.warn('AG Grid: since v21, col.isLockPinned() should not be used, please use col.getColDef().lockPinned instead.');
|
1916 | return this.colDef ? !!this.colDef.lockPinned : false;
|
1917 | };
|
1918 |
|
1919 | Column.EVENT_MOVING_CHANGED = 'movingChanged';
|
1920 |
|
1921 | Column.EVENT_LEFT_CHANGED = 'leftChanged';
|
1922 |
|
1923 | Column.EVENT_WIDTH_CHANGED = 'widthChanged';
|
1924 |
|
1925 | Column.EVENT_LAST_LEFT_PINNED_CHANGED = 'lastLeftPinnedChanged';
|
1926 | Column.EVENT_FIRST_RIGHT_PINNED_CHANGED = 'firstRightPinnedChanged';
|
1927 |
|
1928 | Column.EVENT_VISIBLE_CHANGED = 'visibleChanged';
|
1929 |
|
1930 | Column.EVENT_FILTER_CHANGED = 'filterChanged';
|
1931 |
|
1932 | Column.EVENT_FILTER_ACTIVE_CHANGED = 'filterActiveChanged';
|
1933 |
|
1934 | Column.EVENT_SORT_CHANGED = 'sortChanged';
|
1935 | Column.EVENT_MENU_VISIBLE_CHANGED = 'menuVisibleChanged';
|
1936 |
|
1937 | Column.EVENT_ROW_GROUP_CHANGED = 'columnRowGroupChanged';
|
1938 |
|
1939 | Column.EVENT_PIVOT_CHANGED = 'columnPivotChanged';
|
1940 |
|
1941 | Column.EVENT_VALUE_CHANGED = 'columnValueChanged';
|
1942 | __decorate$1([
|
1943 | Autowired('gridOptionsWrapper')
|
1944 | ], Column.prototype, "gridOptionsWrapper", void 0);
|
1945 | __decorate$1([
|
1946 | Autowired('columnUtils')
|
1947 | ], Column.prototype, "columnUtils", void 0);
|
1948 | __decorate$1([
|
1949 | Autowired('columnApi')
|
1950 | ], Column.prototype, "columnApi", void 0);
|
1951 | __decorate$1([
|
1952 | Autowired('gridApi')
|
1953 | ], Column.prototype, "gridApi", void 0);
|
1954 | __decorate$1([
|
1955 | Autowired('context')
|
1956 | ], Column.prototype, "context", void 0);
|
1957 | __decorate$1([
|
1958 | PostConstruct
|
1959 | ], Column.prototype, "initialise", null);
|
1960 | return Column;
|
1961 | }());
|
1962 |
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 | function firstExistingValue() {
|
1970 | var values = [];
|
1971 | for (var _i = 0; _i < arguments.length; _i++) {
|
1972 | values[_i] = arguments[_i];
|
1973 | }
|
1974 | for (var i = 0; i < values.length; i++) {
|
1975 | var value = values[i];
|
1976 | if (exists(value)) {
|
1977 | return value;
|
1978 | }
|
1979 | }
|
1980 | return null;
|
1981 | }
|
1982 | function existsAndNotEmpty(value) {
|
1983 | return value != null && value.length > 0;
|
1984 | }
|
1985 | function last(arr) {
|
1986 | if (!arr || !arr.length) {
|
1987 | return;
|
1988 | }
|
1989 | return arr[arr.length - 1];
|
1990 | }
|
1991 | function areEqual(a, b, comparator) {
|
1992 | if (a == null && b == null) {
|
1993 | return true;
|
1994 | }
|
1995 | return a != null &&
|
1996 | b != null &&
|
1997 | a.length === b.length &&
|
1998 | a.every(function (value, index) { return comparator ? comparator(value, b[index]) : b[index] === value; });
|
1999 | }
|
2000 |
|
2001 | function compareArrays(array1, array2) {
|
2002 | return areEqual(array1, array2);
|
2003 | }
|
2004 |
|
2005 | function shallowCompare(arr1, arr2) {
|
2006 | return areEqual(arr1, arr2);
|
2007 | }
|
2008 | function sortNumerically(array) {
|
2009 | return array.sort(function (a, b) { return a - b; });
|
2010 | }
|
2011 | function removeRepeatsFromArray(array, object) {
|
2012 | if (!array) {
|
2013 | return;
|
2014 | }
|
2015 | for (var index = array.length - 2; index >= 0; index--) {
|
2016 | var thisOneMatches = array[index] === object;
|
2017 | var nextOneMatches = array[index + 1] === object;
|
2018 | if (thisOneMatches && nextOneMatches) {
|
2019 | array.splice(index + 1, 1);
|
2020 | }
|
2021 | }
|
2022 | }
|
2023 | function removeFromArray(array, object) {
|
2024 | var index = array.indexOf(object);
|
2025 | if (index >= 0) {
|
2026 | array.splice(index, 1);
|
2027 | }
|
2028 | }
|
2029 | function removeAllFromArray(array, toRemove) {
|
2030 | toRemove.forEach(function (item) { return removeFromArray(array, item); });
|
2031 | }
|
2032 | function insertIntoArray(array, object, toIndex) {
|
2033 | array.splice(toIndex, 0, object);
|
2034 | }
|
2035 | function insertArrayIntoArray(dest, src, toIndex) {
|
2036 | if (dest == null || src == null) {
|
2037 | return;
|
2038 | }
|
2039 |
|
2040 | for (var i = src.length - 1; i >= 0; i--) {
|
2041 | var item = src[i];
|
2042 | insertIntoArray(dest, item, toIndex);
|
2043 | }
|
2044 | }
|
2045 | function moveInArray(array, objectsToMove, toIndex) {
|
2046 |
|
2047 | removeAllFromArray(array, objectsToMove);
|
2048 |
|
2049 |
|
2050 | objectsToMove.slice().reverse().forEach(function (obj) { return insertIntoArray(array, obj, toIndex); });
|
2051 | }
|
2052 | function includes(array, value) {
|
2053 | return array.indexOf(value) > -1;
|
2054 | }
|
2055 | function flatten(arrayOfArrays) {
|
2056 | return [].concat.apply([], arrayOfArrays);
|
2057 | }
|
2058 | function pushAll(target, source) {
|
2059 | if (source == null || target == null) {
|
2060 | return;
|
2061 | }
|
2062 | source.forEach(function (value) { return target.push(value); });
|
2063 | }
|
2064 | function toStrings(array) {
|
2065 | return array.map(toStringOrNull);
|
2066 | }
|
2067 | function forEachReverse(list, action) {
|
2068 | if (list == null) {
|
2069 | return;
|
2070 | }
|
2071 | for (var i = list.length - 1; i >= 0; i--) {
|
2072 | action(list[i], i);
|
2073 | }
|
2074 | }
|
2075 |
|
2076 | var ArrayUtils = Object.freeze({
|
2077 | __proto__: null,
|
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 | __proto__: null,
|
2697 | stopPropagationForAgGrid: stopPropagationForAgGrid,
|
2698 | isStopPropagationForAgGrid: isStopPropagationForAgGrid,
|
2699 | isEventSupported: isEventSupported,
|
2700 | getCtrlForEvent: getCtrlForEvent,
|
2701 | addChangeListener: addChangeListener,
|
2702 | isElementInEventPath: isElementInEventPath,
|
2703 | createEventPath: createEventPath,
|
2704 | addAgGridEventPath: addAgGridEventPath,
|
2705 | getEventPath: getEventPath,
|
2706 | addSafePassiveEventListener: addSafePassiveEventListener
|
2707 | });
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 | var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2716 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
2717 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
2718 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
2719 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
2720 | };
|
2721 | var BeanStub = (function () {
|
2722 | function BeanStub() {
|
2723 | var _this = this;
|
2724 | this.destroyFunctions = [];
|
2725 | this.destroyed = false;
|
2726 |
|
2727 |
|
2728 | this.__v_skip = true;
|
2729 | this.isAlive = function () { return !_this.destroyed; };
|
2730 | }
|
2731 |
|
2732 |
|
2733 |
|
2734 |
|
2735 |
|
2736 |
|
2737 |
|
2738 |
|
2739 |
|
2740 |
|
2741 |
|
2742 |
|
2743 |
|
2744 |
|
2745 |
|
2746 | BeanStub.prototype.getFrameworkOverrides = function () {
|
2747 | return this.frameworkOverrides;
|
2748 | };
|
2749 | BeanStub.prototype.getContext = function () {
|
2750 | return this.context;
|
2751 | };
|
2752 | BeanStub.prototype.destroy = function () {
|
2753 |
|
2754 |
|
2755 |
|
2756 |
|
2757 | this.destroyFunctions.forEach(function (func) { return func(); });
|
2758 | this.destroyFunctions.length = 0;
|
2759 | this.destroyed = true;
|
2760 | this.dispatchEvent({ type: BeanStub.EVENT_DESTROYED });
|
2761 | };
|
2762 | BeanStub.prototype.addEventListener = function (eventType, listener) {
|
2763 | if (!this.localEventService) {
|
2764 | this.localEventService = new EventService();
|
2765 | }
|
2766 | this.localEventService.addEventListener(eventType, listener);
|
2767 | };
|
2768 | BeanStub.prototype.removeEventListener = function (eventType, listener) {
|
2769 | if (this.localEventService) {
|
2770 | this.localEventService.removeEventListener(eventType, listener);
|
2771 | }
|
2772 | };
|
2773 | BeanStub.prototype.dispatchEventAsync = function (event) {
|
2774 | var _this = this;
|
2775 | window.setTimeout(function () { return _this.dispatchEvent(event); }, 0);
|
2776 | };
|
2777 | BeanStub.prototype.dispatchEvent = function (event) {
|
2778 | if (this.localEventService) {
|
2779 | this.localEventService.dispatchEvent(event);
|
2780 | }
|
2781 | };
|
2782 | BeanStub.prototype.addManagedListener = function (object, event, listener) {
|
2783 | var _this = this;
|
2784 | if (this.destroyed) {
|
2785 | return;
|
2786 | }
|
2787 | if (object instanceof HTMLElement) {
|
2788 | addSafePassiveEventListener(this.getFrameworkOverrides(), object, event, listener);
|
2789 | }
|
2790 | else {
|
2791 | object.addEventListener(event, listener);
|
2792 | }
|
2793 | var destroyFunc = function () {
|
2794 | object.removeEventListener(event, listener);
|
2795 | _this.destroyFunctions = _this.destroyFunctions.filter(function (fn) { return fn !== destroyFunc; });
|
2796 | return null;
|
2797 | };
|
2798 | this.destroyFunctions.push(destroyFunc);
|
2799 | return destroyFunc;
|
2800 | };
|
2801 | BeanStub.prototype.addDestroyFunc = function (func) {
|
2802 |
|
2803 | if (this.isAlive()) {
|
2804 | this.destroyFunctions.push(func);
|
2805 | }
|
2806 | else {
|
2807 | func();
|
2808 | }
|
2809 | };
|
2810 | BeanStub.prototype.createManagedBean = function (bean, context) {
|
2811 | var res = this.createBean(bean, context);
|
2812 | this.addDestroyFunc(this.destroyBean.bind(this, bean, context));
|
2813 | return res;
|
2814 | };
|
2815 | BeanStub.prototype.createBean = function (bean, context, afterPreCreateCallback) {
|
2816 | return (context || this.getContext()).createBean(bean, afterPreCreateCallback);
|
2817 | };
|
2818 | BeanStub.prototype.destroyBean = function (bean, context) {
|
2819 | return (context || this.getContext()).destroyBean(bean);
|
2820 | };
|
2821 | BeanStub.prototype.destroyBeans = function (beans, context) {
|
2822 | var _this = this;
|
2823 | if (beans) {
|
2824 | beans.forEach(function (bean) { return _this.destroyBean(bean, context); });
|
2825 | }
|
2826 | return [];
|
2827 | };
|
2828 | BeanStub.EVENT_DESTROYED = 'destroyed';
|
2829 | __decorate$3([
|
2830 | Autowired('frameworkOverrides')
|
2831 | ], BeanStub.prototype, "frameworkOverrides", void 0);
|
2832 | __decorate$3([
|
2833 | Autowired('context')
|
2834 | ], BeanStub.prototype, "context", void 0);
|
2835 | __decorate$3([
|
2836 | Autowired('eventService')
|
2837 | ], BeanStub.prototype, "eventService", void 0);
|
2838 | __decorate$3([
|
2839 | Autowired('gridOptionsWrapper')
|
2840 | ], BeanStub.prototype, "gridOptionsWrapper", void 0);
|
2841 | __decorate$3([
|
2842 | PreDestroy
|
2843 | ], BeanStub.prototype, "destroy", null);
|
2844 | return BeanStub;
|
2845 | }());
|
2846 |
|
2847 |
|
2848 |
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 | var __extends = (undefined && undefined.__extends) || (function () {
|
2854 | var extendStatics = function (d, b) {
|
2855 | extendStatics = Object.setPrototypeOf ||
|
2856 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
2857 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
2858 | return extendStatics(d, b);
|
2859 | };
|
2860 | return function (d, b) {
|
2861 | extendStatics(d, b);
|
2862 | function __() { this.constructor = d; }
|
2863 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2864 | };
|
2865 | })();
|
2866 | var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2867 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
2868 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
2869 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
2870 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
2871 | };
|
2872 | var __param$1 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
2873 | return function (target, key) { decorator(target, key, paramIndex); }
|
2874 | };
|
2875 |
|
2876 | var ColumnFactory = (function (_super) {
|
2877 | __extends(ColumnFactory, _super);
|
2878 | function ColumnFactory() {
|
2879 | return _super !== null && _super.apply(this, arguments) || this;
|
2880 | }
|
2881 | ColumnFactory.prototype.setBeans = function (loggerFactory) {
|
2882 | this.logger = loggerFactory.create('ColumnFactory');
|
2883 | };
|
2884 | ColumnFactory.prototype.createColumnTree = function (defs, primaryColumns, existingTree) {
|
2885 |
|
2886 |
|
2887 |
|
2888 | var columnKeyCreator = new ColumnKeyCreator();
|
2889 | var _a = this.extractExistingTreeData(existingTree), existingCols = _a.existingCols, existingGroups = _a.existingGroups, existingColKeys = _a.existingColKeys;
|
2890 | columnKeyCreator.addExistingKeys(existingColKeys);
|
2891 |
|
2892 | var unbalancedTree = this.recursivelyCreateColumns(defs, 0, primaryColumns, existingCols, columnKeyCreator, existingGroups);
|
2893 | var treeDept = this.findMaxDept(unbalancedTree, 0);
|
2894 | this.logger.log('Number of levels for grouped columns is ' + treeDept);
|
2895 | var columnTree = this.balanceColumnTree(unbalancedTree, 0, treeDept, columnKeyCreator);
|
2896 | var deptFirstCallback = function (child, parent) {
|
2897 | if (child instanceof ProvidedColumnGroup) {
|
2898 | child.setupExpandable();
|
2899 | }
|
2900 |
|
2901 |
|
2902 | child.setOriginalParent(parent);
|
2903 | };
|
2904 | this.columnUtils.depthFirstOriginalTreeSearch(null, columnTree, deptFirstCallback);
|
2905 | return {
|
2906 | columnTree: columnTree,
|
2907 | treeDept: treeDept
|
2908 | };
|
2909 | };
|
2910 | ColumnFactory.prototype.extractExistingTreeData = function (existingTree) {
|
2911 | var existingCols = [];
|
2912 | var existingGroups = [];
|
2913 | var existingColKeys = [];
|
2914 | if (existingTree) {
|
2915 | this.columnUtils.depthFirstOriginalTreeSearch(null, existingTree, function (item) {
|
2916 | if (item instanceof ProvidedColumnGroup) {
|
2917 | var group = item;
|
2918 | existingGroups.push(group);
|
2919 | }
|
2920 | else {
|
2921 | var col = item;
|
2922 | existingColKeys.push(col.getId());
|
2923 | existingCols.push(col);
|
2924 | }
|
2925 | });
|
2926 | }
|
2927 | return { existingCols: existingCols, existingGroups: existingGroups, existingColKeys: existingColKeys };
|
2928 | };
|
2929 | ColumnFactory.prototype.createForAutoGroups = function (autoGroupCols, gridBalancedTree) {
|
2930 | var _this = this;
|
2931 | return autoGroupCols.map(function (col) { return _this.createAutoGroupTreeItem(gridBalancedTree, col); });
|
2932 | };
|
2933 | ColumnFactory.prototype.createAutoGroupTreeItem = function (balancedColumnTree, column) {
|
2934 | var dept = this.findDepth(balancedColumnTree);
|
2935 |
|
2936 | var nextChild = column;
|
2937 | for (var i = dept - 1; i >= 0; i--) {
|
2938 | var autoGroup = new ProvidedColumnGroup(null, "FAKE_PATH_" + column.getId() + "}_" + i, true, i);
|
2939 | this.context.createBean(autoGroup);
|
2940 | autoGroup.setChildren([nextChild]);
|
2941 | nextChild.setOriginalParent(autoGroup);
|
2942 | nextChild = autoGroup;
|
2943 | }
|
2944 |
|
2945 | return nextChild;
|
2946 | };
|
2947 | ColumnFactory.prototype.findDepth = function (balancedColumnTree) {
|
2948 | var dept = 0;
|
2949 | var pointer = balancedColumnTree;
|
2950 | while (pointer && pointer[0] && pointer[0] instanceof ProvidedColumnGroup) {
|
2951 | dept++;
|
2952 | pointer = pointer[0].getChildren();
|
2953 | }
|
2954 | return dept;
|
2955 | };
|
2956 | ColumnFactory.prototype.balanceColumnTree = function (unbalancedTree, currentDept, columnDept, columnKeyCreator) {
|
2957 | var result = [];
|
2958 |
|
2959 |
|
2960 | for (var i = 0; i < unbalancedTree.length; i++) {
|
2961 | var child = unbalancedTree[i];
|
2962 | if (child instanceof ProvidedColumnGroup) {
|
2963 |
|
2964 | var originalGroup = child;
|
2965 | var newChildren = this.balanceColumnTree(originalGroup.getChildren(), currentDept + 1, columnDept, columnKeyCreator);
|
2966 | originalGroup.setChildren(newChildren);
|
2967 | result.push(originalGroup);
|
2968 | }
|
2969 | else {
|
2970 |
|
2971 | var firstPaddedGroup = void 0;
|
2972 | var currentPaddedGroup = void 0;
|
2973 |
|
2974 | for (var j = columnDept - 1; j >= currentDept; j--) {
|
2975 | var newColId = columnKeyCreator.getUniqueKey(null, null);
|
2976 | var colGroupDefMerged = this.createMergedColGroupDef(null);
|
2977 | var paddedGroup = new ProvidedColumnGroup(colGroupDefMerged, newColId, true, currentDept);
|
2978 | this.context.createBean(paddedGroup);
|
2979 | if (currentPaddedGroup) {
|
2980 | currentPaddedGroup.setChildren([paddedGroup]);
|
2981 | }
|
2982 | currentPaddedGroup = paddedGroup;
|
2983 | if (!firstPaddedGroup) {
|
2984 | firstPaddedGroup = currentPaddedGroup;
|
2985 | }
|
2986 | }
|
2987 |
|
2988 | if (firstPaddedGroup && currentPaddedGroup) {
|
2989 | result.push(firstPaddedGroup);
|
2990 | var hasGroups = unbalancedTree.some(function (leaf) { return leaf instanceof ProvidedColumnGroup; });
|
2991 | if (hasGroups) {
|
2992 | currentPaddedGroup.setChildren([child]);
|
2993 | continue;
|
2994 | }
|
2995 | else {
|
2996 | currentPaddedGroup.setChildren(unbalancedTree);
|
2997 | break;
|
2998 | }
|
2999 | }
|
3000 | result.push(child);
|
3001 | }
|
3002 | }
|
3003 | return result;
|
3004 | };
|
3005 | ColumnFactory.prototype.findMaxDept = function (treeChildren, dept) {
|
3006 | var maxDeptThisLevel = dept;
|
3007 | for (var i = 0; i < treeChildren.length; i++) {
|
3008 | var abstractColumn = treeChildren[i];
|
3009 | if (abstractColumn instanceof ProvidedColumnGroup) {
|
3010 | var originalGroup = abstractColumn;
|
3011 | var newDept = this.findMaxDept(originalGroup.getChildren(), dept + 1);
|
3012 | if (maxDeptThisLevel < newDept) {
|
3013 | maxDeptThisLevel = newDept;
|
3014 | }
|
3015 | }
|
3016 | }
|
3017 | return maxDeptThisLevel;
|
3018 | };
|
3019 | ColumnFactory.prototype.recursivelyCreateColumns = function (defs, level, primaryColumns, existingColsCopy, columnKeyCreator, existingGroups) {
|
3020 | var _this = this;
|
3021 | return (defs || []).map(function (def) {
|
3022 | if (_this.isColumnGroup(def)) {
|
3023 | return _this.createColumnGroup(primaryColumns, def, level, existingColsCopy, columnKeyCreator, existingGroups);
|
3024 | }
|
3025 | else {
|
3026 | return _this.createColumn(primaryColumns, def, existingColsCopy, columnKeyCreator);
|
3027 | }
|
3028 | });
|
3029 | };
|
3030 | ColumnFactory.prototype.createColumnGroup = function (primaryColumns, colGroupDef, level, existingColumns, columnKeyCreator, existingGroups) {
|
3031 | var colGroupDefMerged = this.createMergedColGroupDef(colGroupDef);
|
3032 | var groupId = columnKeyCreator.getUniqueKey(colGroupDefMerged.groupId || null, null);
|
3033 | var providedGroup = new ProvidedColumnGroup(colGroupDefMerged, groupId, false, level);
|
3034 | this.context.createBean(providedGroup);
|
3035 | var existingGroup = this.findExistingGroup(colGroupDef, existingGroups);
|
3036 |
|
3037 |
|
3038 | if (existingGroup) {
|
3039 | removeFromArray(existingGroups, existingGroup);
|
3040 | }
|
3041 | if (existingGroup && existingGroup.isExpanded()) {
|
3042 | providedGroup.setExpanded(true);
|
3043 | }
|
3044 | var children = this.recursivelyCreateColumns(colGroupDefMerged.children, level + 1, primaryColumns, existingColumns, columnKeyCreator, existingGroups);
|
3045 | providedGroup.setChildren(children);
|
3046 | return providedGroup;
|
3047 | };
|
3048 | ColumnFactory.prototype.createMergedColGroupDef = function (colGroupDef) {
|
3049 | var colGroupDefMerged = {};
|
3050 | Object.assign(colGroupDefMerged, this.gridOptionsWrapper.getDefaultColGroupDef());
|
3051 | Object.assign(colGroupDefMerged, colGroupDef);
|
3052 | this.checkForDeprecatedItems(colGroupDefMerged);
|
3053 | return colGroupDefMerged;
|
3054 | };
|
3055 | ColumnFactory.prototype.createColumn = function (primaryColumns, colDef, existingColsCopy, columnKeyCreator) {
|
3056 | var colDefMerged = this.mergeColDefs(colDef);
|
3057 | this.checkForDeprecatedItems(colDefMerged);
|
3058 |
|
3059 | var column = this.findExistingColumn(colDef, existingColsCopy);
|
3060 |
|
3061 |
|
3062 | if (existingColsCopy && column) {
|
3063 | removeFromArray(existingColsCopy, column);
|
3064 | }
|
3065 | if (!column) {
|
3066 |
|
3067 | var colId = columnKeyCreator.getUniqueKey(colDefMerged.colId, colDefMerged.field);
|
3068 | column = new Column(colDefMerged, colDef, colId, primaryColumns);
|
3069 | this.context.createBean(column);
|
3070 | }
|
3071 | else {
|
3072 | column.setColDef(colDefMerged, colDef);
|
3073 | this.applyColumnState(column, colDefMerged);
|
3074 | }
|
3075 | return column;
|
3076 | };
|
3077 | ColumnFactory.prototype.applyColumnState = function (column, colDef) {
|
3078 |
|
3079 | var flex = attrToNumber(colDef.flex);
|
3080 | if (flex !== undefined) {
|
3081 | column.setFlex(flex);
|
3082 | }
|
3083 |
|
3084 | var noFlexThisCol = column.getFlex() <= 0;
|
3085 | if (noFlexThisCol) {
|
3086 |
|
3087 | var width = attrToNumber(colDef.width);
|
3088 | if (width != null) {
|
3089 | column.setActualWidth(width);
|
3090 | }
|
3091 | else {
|
3092 |
|
3093 |
|
3094 | var widthBeforeUpdate = column.getActualWidth();
|
3095 | column.setActualWidth(widthBeforeUpdate);
|
3096 | }
|
3097 | }
|
3098 |
|
3099 | if (colDef.sort !== undefined) {
|
3100 | if (colDef.sort == Constants.SORT_ASC || colDef.sort == Constants.SORT_DESC) {
|
3101 | column.setSort(colDef.sort);
|
3102 | }
|
3103 | else {
|
3104 | column.setSort(undefined);
|
3105 | }
|
3106 | }
|
3107 |
|
3108 | var sortIndex = attrToNumber(colDef.sortIndex);
|
3109 | if (sortIndex !== undefined) {
|
3110 | column.setSortIndex(sortIndex);
|
3111 | }
|
3112 |
|
3113 | var hide = attrToBoolean(colDef.hide);
|
3114 | if (hide !== undefined) {
|
3115 | column.setVisible(!hide);
|
3116 | }
|
3117 |
|
3118 | if (colDef.pinned !== undefined) {
|
3119 | column.setPinned(colDef.pinned);
|
3120 | }
|
3121 | };
|
3122 | ColumnFactory.prototype.findExistingColumn = function (newColDef, existingColsCopy) {
|
3123 | return (existingColsCopy || []).find(function (existingCol) {
|
3124 | var existingColDef = existingCol.getUserProvidedColDef();
|
3125 | if (!existingColDef) {
|
3126 | return false;
|
3127 | }
|
3128 | var newHasId = newColDef.colId != null;
|
3129 | var newHasField = newColDef.field != null;
|
3130 | if (newHasId) {
|
3131 | return existingCol.getId() === newColDef.colId;
|
3132 | }
|
3133 | if (newHasField) {
|
3134 | return existingColDef.field === newColDef.field;
|
3135 | }
|
3136 |
|
3137 | if (existingColDef === newColDef) {
|
3138 | return true;
|
3139 | }
|
3140 | return false;
|
3141 | });
|
3142 | };
|
3143 | ColumnFactory.prototype.findExistingGroup = function (newGroupDef, existingGroups) {
|
3144 | return existingGroups.find(function (existingGroup) {
|
3145 | var existingDef = existingGroup.getColGroupDef();
|
3146 | if (!existingDef) {
|
3147 | return false;
|
3148 | }
|
3149 | var newHasId = newGroupDef.groupId != null;
|
3150 | if (newHasId) {
|
3151 | return existingGroup.getId() === newGroupDef.groupId;
|
3152 | }
|
3153 | return false;
|
3154 | });
|
3155 | };
|
3156 | ColumnFactory.prototype.mergeColDefs = function (colDef) {
|
3157 |
|
3158 | var colDefMerged = {};
|
3159 |
|
3160 | var defaultColDef = this.gridOptionsWrapper.getDefaultColDef();
|
3161 | mergeDeep(colDefMerged, defaultColDef, false, true);
|
3162 |
|
3163 | var columnType = colDef.type;
|
3164 | if (!columnType) {
|
3165 | columnType = defaultColDef && defaultColDef.type;
|
3166 | }
|
3167 |
|
3168 | if (columnType) {
|
3169 | this.assignColumnTypes(columnType, colDefMerged);
|
3170 | }
|
3171 |
|
3172 | mergeDeep(colDefMerged, colDef, false, true);
|
3173 | return colDefMerged;
|
3174 | };
|
3175 | ColumnFactory.prototype.assignColumnTypes = function (type, colDefMerged) {
|
3176 | var typeKeys = [];
|
3177 | if (type instanceof Array) {
|
3178 | var invalidArray = type.some(function (a) { return typeof a !== 'string'; });
|
3179 | if (invalidArray) {
|
3180 | console.warn("AG Grid: if colDef.type is supplied an array it should be of type 'string[]'");
|
3181 | }
|
3182 | else {
|
3183 | typeKeys = type;
|
3184 | }
|
3185 | }
|
3186 | else if (typeof type === 'string') {
|
3187 | typeKeys = type.split(',');
|
3188 | }
|
3189 | else {
|
3190 | console.warn("AG Grid: colDef.type should be of type 'string' | 'string[]'");
|
3191 | return;
|
3192 | }
|
3193 |
|
3194 | var allColumnTypes = Object.assign({}, DefaultColumnTypes);
|
3195 | var userTypes = this.gridOptionsWrapper.getColumnTypes() || {};
|
3196 | iterateObject(userTypes, function (key, value) {
|
3197 | if (key in allColumnTypes) {
|
3198 | console.warn("AG Grid: the column type '" + key + "' is a default column type and cannot be overridden.");
|
3199 | }
|
3200 | else {
|
3201 | allColumnTypes[key] = value;
|
3202 | }
|
3203 | });
|
3204 | typeKeys.forEach(function (t) {
|
3205 | var typeColDef = allColumnTypes[t.trim()];
|
3206 | if (typeColDef) {
|
3207 | mergeDeep(colDefMerged, typeColDef, false, true);
|
3208 | }
|
3209 | else {
|
3210 | console.warn("AG Grid: colDef.type '" + t + "' does not correspond to defined gridOptions.columnTypes");
|
3211 | }
|
3212 | });
|
3213 | };
|
3214 | ColumnFactory.prototype.checkForDeprecatedItems = function (colDef) {
|
3215 | if (colDef) {
|
3216 | var colDefNoType = colDef;
|
3217 | if (colDefNoType.group !== undefined) {
|
3218 | console.warn('AG Grid: colDef.group is invalid, please check documentation on how to do grouping as it changed in version 3');
|
3219 | }
|
3220 | if (colDefNoType.headerGroup !== undefined) {
|
3221 | console.warn('AG Grid: colDef.headerGroup is invalid, please check documentation on how to do grouping as it changed in version 3');
|
3222 | }
|
3223 | if (colDefNoType.headerGroupShow !== undefined) {
|
3224 | 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');
|
3225 | }
|
3226 | if (colDefNoType.suppressRowGroup !== undefined) {
|
3227 | console.warn('AG Grid: colDef.suppressRowGroup is deprecated, please use colDef.type instead');
|
3228 | }
|
3229 | if (colDefNoType.suppressAggregation !== undefined) {
|
3230 | console.warn('AG Grid: colDef.suppressAggregation is deprecated, please use colDef.type instead');
|
3231 | }
|
3232 | if (colDefNoType.suppressRowGroup || colDefNoType.suppressAggregation) {
|
3233 | console.warn('AG Grid: colDef.suppressAggregation and colDef.suppressRowGroup are deprecated, use allowRowGroup, allowPivot and allowValue instead');
|
3234 | }
|
3235 | if (colDefNoType.displayName) {
|
3236 | console.warn("AG Grid: Found displayName " + colDefNoType.displayName + ", please use headerName instead, displayName is deprecated.");
|
3237 | colDefNoType.headerName = colDefNoType.displayName;
|
3238 | }
|
3239 | }
|
3240 | };
|
3241 |
|
3242 | ColumnFactory.prototype.isColumnGroup = function (abstractColDef) {
|
3243 | return abstractColDef.children !== undefined;
|
3244 | };
|
3245 | __decorate$4([
|
3246 | Autowired('columnUtils')
|
3247 | ], ColumnFactory.prototype, "columnUtils", void 0);
|
3248 | __decorate$4([
|
3249 | __param$1(0, Qualifier('loggerFactory'))
|
3250 | ], ColumnFactory.prototype, "setBeans", null);
|
3251 | ColumnFactory = __decorate$4([
|
3252 | Bean('columnFactory')
|
3253 | ], ColumnFactory);
|
3254 | return ColumnFactory;
|
3255 | }(BeanStub));
|
3256 |
|
3257 |
|
3258 |
|
3259 |
|
3260 |
|
3261 |
|
3262 |
|
3263 | var Events = (function () {
|
3264 | function Events() {
|
3265 | }
|
3266 |
|
3267 |
|
3268 | Events.EVENT_COLUMN_EVERYTHING_CHANGED = 'columnEverythingChanged';
|
3269 |
|
3270 | Events.EVENT_NEW_COLUMNS_LOADED = 'newColumnsLoaded';
|
3271 |
|
3272 | Events.EVENT_COLUMN_PIVOT_MODE_CHANGED = 'columnPivotModeChanged';
|
3273 |
|
3274 | Events.EVENT_COLUMN_ROW_GROUP_CHANGED = 'columnRowGroupChanged';
|
3275 |
|
3276 | Events.EVENT_EXPAND_COLLAPSE_ALL = 'expandOrCollapseAll';
|
3277 |
|
3278 | Events.EVENT_COLUMN_PIVOT_CHANGED = 'columnPivotChanged';
|
3279 |
|
3280 | Events.EVENT_GRID_COLUMNS_CHANGED = 'gridColumnsChanged';
|
3281 |
|
3282 | Events.EVENT_COLUMN_VALUE_CHANGED = 'columnValueChanged';
|
3283 |
|
3284 | Events.EVENT_COLUMN_MOVED = 'columnMoved';
|
3285 |
|
3286 | Events.EVENT_COLUMN_VISIBLE = 'columnVisible';
|
3287 |
|
3288 | Events.EVENT_COLUMN_PINNED = 'columnPinned';
|
3289 |
|
3290 | Events.EVENT_COLUMN_GROUP_OPENED = 'columnGroupOpened';
|
3291 |
|
3292 | Events.EVENT_COLUMN_RESIZED = 'columnResized';
|
3293 |
|
3294 | Events.EVENT_DISPLAYED_COLUMNS_CHANGED = 'displayedColumnsChanged';
|
3295 |
|
3296 | Events.EVENT_VIRTUAL_COLUMNS_CHANGED = 'virtualColumnsChanged';
|
3297 |
|
3298 | Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED = 'asyncTransactionsFlushed';
|
3299 |
|
3300 | Events.EVENT_ROW_GROUP_OPENED = 'rowGroupOpened';
|
3301 |
|
3302 | Events.EVENT_ROW_DATA_CHANGED = 'rowDataChanged';
|
3303 |
|
3304 | Events.EVENT_ROW_DATA_UPDATED = 'rowDataUpdated';
|
3305 |
|
3306 | Events.EVENT_PINNED_ROW_DATA_CHANGED = 'pinnedRowDataChanged';
|
3307 |
|
3308 | Events.EVENT_RANGE_SELECTION_CHANGED = 'rangeSelectionChanged';
|
3309 |
|
3310 | Events.EVENT_CHART_CREATED = 'chartCreated';
|
3311 |
|
3312 | Events.EVENT_CHART_RANGE_SELECTION_CHANGED = 'chartRangeSelectionChanged';
|
3313 |
|
3314 | Events.EVENT_CHART_OPTIONS_CHANGED = 'chartOptionsChanged';
|
3315 |
|
3316 | Events.EVENT_CHART_DESTROYED = 'chartDestroyed';
|
3317 |
|
3318 | Events.EVENT_TOOL_PANEL_VISIBLE_CHANGED = 'toolPanelVisibleChanged';
|
3319 | Events.EVENT_COLUMN_PANEL_ITEM_DRAG_START = 'columnPanelItemDragStart';
|
3320 | Events.EVENT_COLUMN_PANEL_ITEM_DRAG_END = 'columnPanelItemDragEnd';
|
3321 |
|
3322 | Events.EVENT_MODEL_UPDATED = 'modelUpdated';
|
3323 | Events.EVENT_PASTE_START = 'pasteStart';
|
3324 | Events.EVENT_PASTE_END = 'pasteEnd';
|
3325 | Events.EVENT_FILL_START = 'fillStart';
|
3326 | Events.EVENT_FILL_END = 'fillEnd';
|
3327 | Events.EVENT_CELL_CLICKED = 'cellClicked';
|
3328 | Events.EVENT_CELL_DOUBLE_CLICKED = 'cellDoubleClicked';
|
3329 | Events.EVENT_CELL_MOUSE_DOWN = 'cellMouseDown';
|
3330 | Events.EVENT_CELL_CONTEXT_MENU = 'cellContextMenu';
|
3331 | Events.EVENT_CELL_VALUE_CHANGED = 'cellValueChanged';
|
3332 | Events.EVENT_CELL_EDIT_REQUEST = 'cellEditRequest';
|
3333 | Events.EVENT_ROW_VALUE_CHANGED = 'rowValueChanged';
|
3334 | Events.EVENT_CELL_FOCUSED = 'cellFocused';
|
3335 | Events.EVENT_FULL_WIDTH_ROW_FOCUSED = 'fullWidthRowFocused';
|
3336 | Events.EVENT_ROW_SELECTED = 'rowSelected';
|
3337 | Events.EVENT_SELECTION_CHANGED = 'selectionChanged';
|
3338 | Events.EVENT_CELL_KEY_DOWN = 'cellKeyDown';
|
3339 | Events.EVENT_CELL_KEY_PRESS = 'cellKeyPress';
|
3340 | Events.EVENT_CELL_MOUSE_OVER = 'cellMouseOver';
|
3341 | Events.EVENT_CELL_MOUSE_OUT = 'cellMouseOut';
|
3342 |
|
3343 | Events.EVENT_FILTER_CHANGED = 'filterChanged';
|
3344 |
|
3345 | Events.EVENT_FILTER_MODIFIED = 'filterModified';
|
3346 | Events.EVENT_FILTER_OPENED = 'filterOpened';
|
3347 | Events.EVENT_SORT_CHANGED = 'sortChanged';
|
3348 |
|
3349 | Events.EVENT_VIRTUAL_ROW_REMOVED = 'virtualRowRemoved';
|
3350 | Events.EVENT_ROW_CLICKED = 'rowClicked';
|
3351 | Events.EVENT_ROW_DOUBLE_CLICKED = 'rowDoubleClicked';
|
3352 |
|
3353 | Events.EVENT_GRID_READY = 'gridReady';
|
3354 | |
3355 |
|
3356 | Events.EVENT_GRID_SIZE_CHANGED = 'gridSizeChanged';
|
3357 |
|
3358 | Events.EVENT_VIEWPORT_CHANGED = 'viewportChanged';
|
3359 |
|
3360 | Events.EVENT_SCROLLBAR_WIDTH_CHANGED = 'scrollbarWidthChanged';
|
3361 |
|
3362 | Events.EVENT_FIRST_DATA_RENDERED = 'firstDataRendered';
|
3363 |
|
3364 | Events.EVENT_DRAG_STARTED = 'dragStarted';
|
3365 |
|
3366 | Events.EVENT_DRAG_STOPPED = 'dragStopped';
|
3367 | Events.EVENT_CHECKBOX_CHANGED = 'checkboxChanged';
|
3368 | Events.EVENT_ROW_EDITING_STARTED = 'rowEditingStarted';
|
3369 | Events.EVENT_ROW_EDITING_STOPPED = 'rowEditingStopped';
|
3370 | Events.EVENT_CELL_EDITING_STARTED = 'cellEditingStarted';
|
3371 | Events.EVENT_CELL_EDITING_STOPPED = 'cellEditingStopped';
|
3372 |
|
3373 | Events.EVENT_BODY_SCROLL = 'bodyScroll';
|
3374 |
|
3375 | Events.EVENT_BODY_SCROLL_END = 'bodyScrollEnd';
|
3376 | Events.EVENT_HEIGHT_SCALE_CHANGED = 'heightScaleChanged';
|
3377 | |
3378 |
|
3379 | Events.EVENT_PAGINATION_CHANGED = 'paginationChanged';
|
3380 | |
3381 |
|
3382 |
|
3383 | Events.EVENT_COMPONENT_STATE_CHANGED = 'componentStateChanged';
|
3384 |
|
3385 |
|
3386 |
|
3387 |
|
3388 | Events.EVENT_BODY_HEIGHT_CHANGED = 'bodyHeightChanged';
|
3389 | Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED = 'displayedColumnsWidthChanged';
|
3390 | Events.EVENT_SCROLL_VISIBILITY_CHANGED = 'scrollVisibilityChanged';
|
3391 | Events.EVENT_COLUMN_HOVER_CHANGED = 'columnHoverChanged';
|
3392 | Events.EVENT_FLASH_CELLS = 'flashCells';
|
3393 | Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED = 'paginationPixelOffsetChanged';
|
3394 | Events.EVENT_DISPLAYED_ROWS_CHANGED = 'displayedRowsChanged';
|
3395 | Events.EVENT_LEFT_PINNED_WIDTH_CHANGED = 'leftPinnedWidthChanged';
|
3396 | Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED = 'rightPinnedWidthChanged';
|
3397 | Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED = 'rowContainerHeightChanged';
|
3398 | Events.EVENT_ROW_DRAG_ENTER = 'rowDragEnter';
|
3399 | Events.EVENT_ROW_DRAG_MOVE = 'rowDragMove';
|
3400 | Events.EVENT_ROW_DRAG_LEAVE = 'rowDragLeave';
|
3401 | Events.EVENT_ROW_DRAG_END = 'rowDragEnd';
|
3402 |
|
3403 | Events.EVENT_POPUP_TO_FRONT = 'popupToFront';
|
3404 |
|
3405 |
|
3406 |
|
3407 | Events.EVENT_COLUMN_ROW_GROUP_CHANGE_REQUEST = 'columnRowGroupChangeRequest';
|
3408 | Events.EVENT_COLUMN_PIVOT_CHANGE_REQUEST = 'columnPivotChangeRequest';
|
3409 | Events.EVENT_COLUMN_VALUE_CHANGE_REQUEST = 'columnValueChangeRequest';
|
3410 | Events.EVENT_COLUMN_AGG_FUNC_CHANGE_REQUEST = 'columnAggFuncChangeRequest';
|
3411 | Events.EVENT_KEYBOARD_FOCUS = 'keyboardFocus';
|
3412 | Events.EVENT_MOUSE_FOCUS = 'mouseFocus';
|
3413 | Events.EVENT_STORE_UPDATED = 'storeUpdated';
|
3414 | return Events;
|
3415 | }());
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 |
|
3429 |
|
3430 |
|
3431 |
|
3432 |
|
3433 | var GroupInstanceIdCreator = (function () {
|
3434 | function GroupInstanceIdCreator() {
|
3435 |
|
3436 | this.existingIds = {};
|
3437 | }
|
3438 | GroupInstanceIdCreator.prototype.getInstanceIdForKey = function (key) {
|
3439 | var lastResult = this.existingIds[key];
|
3440 | var result;
|
3441 | if (typeof lastResult !== 'number') {
|
3442 |
|
3443 | result = 0;
|
3444 | }
|
3445 | else {
|
3446 | result = lastResult + 1;
|
3447 | }
|
3448 | this.existingIds[key] = result;
|
3449 | return result;
|
3450 | };
|
3451 | return GroupInstanceIdCreator;
|
3452 | }());
|
3453 |
|
3454 |
|
3455 |
|
3456 |
|
3457 |
|
3458 |
|
3459 |
|
3460 | var reUnescapedHtml = /[&<>"']/g;
|
3461 |
|
3462 |
|
3463 |
|
3464 | var HTML_ESCAPES = {
|
3465 | '&': '&',
|
3466 | '<': '<',
|
3467 | '>': '>',
|
3468 | '"': '"',
|
3469 | "'": '''
|
3470 | };
|
3471 |
|
3472 |
|
3473 |
|
3474 |
|
3475 |
|
3476 |
|
3477 | function utf8_encode(s) {
|
3478 | var stringFromCharCode = String.fromCharCode;
|
3479 | function ucs2decode(string) {
|
3480 | var output = [];
|
3481 | if (!string) {
|
3482 | return [];
|
3483 | }
|
3484 | var len = string.length;
|
3485 | var counter = 0;
|
3486 | var value;
|
3487 | var extra;
|
3488 | while (counter < len) {
|
3489 | value = string.charCodeAt(counter++);
|
3490 | if (value >= 0xD800 && value <= 0xDBFF && counter < len) {
|
3491 |
|
3492 | extra = string.charCodeAt(counter++);
|
3493 | if ((extra & 0xFC00) == 0xDC00) {
|
3494 | output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
3495 | }
|
3496 | else {
|
3497 |
|
3498 |
|
3499 | output.push(value);
|
3500 | counter--;
|
3501 | }
|
3502 | }
|
3503 | else {
|
3504 | output.push(value);
|
3505 | }
|
3506 | }
|
3507 | return output;
|
3508 | }
|
3509 | function checkScalarValue(point) {
|
3510 | if (point >= 0xD800 && point <= 0xDFFF) {
|
3511 | throw Error('Lone surrogate U+' + point.toString(16).toUpperCase() +
|
3512 | ' is not a scalar value');
|
3513 | }
|
3514 | }
|
3515 | function createByte(point, shift) {
|
3516 | return stringFromCharCode(((point >> shift) & 0x3F) | 0x80);
|
3517 | }
|
3518 | function encodeCodePoint(point) {
|
3519 | if ((point >= 0 && point <= 31 && point !== 10)) {
|
3520 | var convertedCode = point.toString(16).toUpperCase();
|
3521 | var paddedCode = convertedCode.padStart(4, '0');
|
3522 | return "_x" + paddedCode + "_";
|
3523 | }
|
3524 | if ((point & 0xFFFFFF80) == 0) {
|
3525 | return stringFromCharCode(point);
|
3526 | }
|
3527 | var symbol = '';
|
3528 | if ((point & 0xFFFFF800) == 0) {
|
3529 | symbol = stringFromCharCode(((point >> 6) & 0x1F) | 0xC0);
|
3530 | }
|
3531 | else if ((point & 0xFFFF0000) == 0) {
|
3532 | checkScalarValue(point);
|
3533 | symbol = stringFromCharCode(((point >> 12) & 0x0F) | 0xE0);
|
3534 | symbol += createByte(point, 6);
|
3535 | }
|
3536 | else if ((point & 0xFFE00000) == 0) {
|
3537 | symbol = stringFromCharCode(((point >> 18) & 0x07) | 0xF0);
|
3538 | symbol += createByte(point, 12);
|
3539 | symbol += createByte(point, 6);
|
3540 | }
|
3541 | symbol += stringFromCharCode((point & 0x3F) | 0x80);
|
3542 | return symbol;
|
3543 | }
|
3544 | var codePoints = ucs2decode(s);
|
3545 | var length = codePoints.length;
|
3546 | var index = -1;
|
3547 | var codePoint;
|
3548 | var byteString = '';
|
3549 | while (++index < length) {
|
3550 | codePoint = codePoints[index];
|
3551 | byteString += encodeCodePoint(codePoint);
|
3552 | }
|
3553 | return byteString;
|
3554 | }
|
3555 |
|
3556 |
|
3557 |
|
3558 |
|
3559 |
|
3560 |
|
3561 | function camelCaseToHyphen(str) {
|
3562 | if (str === null || str === undefined) {
|
3563 | return null;
|
3564 | }
|
3565 | return str.replace(/([A-Z])/g, function (g) { return '-' + g[0].toLowerCase(); });
|
3566 | }
|
3567 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 |
|
3573 | function hyphenToCamelCase(str) {
|
3574 | if (str === null || str === undefined) {
|
3575 | return null;
|
3576 | }
|
3577 | return str.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
|
3578 | }
|
3579 | function capitalise(str) {
|
3580 | return str[0].toUpperCase() + str.substr(1).toLowerCase();
|
3581 | }
|
3582 | function escapeString(toEscape) {
|
3583 |
|
3584 |
|
3585 |
|
3586 | return toEscape == null ? null : toEscape.toString().toString().replace(reUnescapedHtml, function (chr) { return HTML_ESCAPES[chr]; });
|
3587 | }
|
3588 |
|
3589 |
|
3590 |
|
3591 |
|
3592 |
|
3593 |
|
3594 | function camelCaseToHumanText(camelCase) {
|
3595 | if (!camelCase || camelCase == null) {
|
3596 | return null;
|
3597 | }
|
3598 | var rex = /([A-Z])([A-Z])([a-z])|([a-z])([A-Z])/g;
|
3599 | var words = camelCase.replace(rex, '$1$4 $2$3$5').replace('.', ' ').split(' ');
|
3600 | return words.map(function (word) { return word.substring(0, 1).toUpperCase() + ((word.length > 1) ? word.substring(1, word.length) : ''); }).join(' ');
|
3601 | }
|
3602 |
|
3603 | var StringUtils = Object.freeze({
|
3604 | __proto__: null,
|
3605 | utf8_encode: utf8_encode,
|
3606 | camelCaseToHyphen: camelCaseToHyphen,
|
3607 | hyphenToCamelCase: hyphenToCamelCase,
|
3608 | capitalise: capitalise,
|
3609 | escapeString: escapeString,
|
3610 | camelCaseToHumanText: camelCaseToHumanText
|
3611 | });
|
3612 |
|
3613 |
|
3614 |
|
3615 |
|
3616 |
|
3617 |
|
3618 |
|
3619 | function convertToMap(arr) {
|
3620 | var map = new Map();
|
3621 | arr.forEach(function (pair) { return map.set(pair[0], pair[1]); });
|
3622 | return map;
|
3623 | }
|
3624 |
|
3625 | function mapById(arr, callback) {
|
3626 | var map = new Map();
|
3627 | arr.forEach(function (item) { return map.set(callback(item), item); });
|
3628 | return map;
|
3629 | }
|
3630 | function keys(map) {
|
3631 | var arr = [];
|
3632 | map.forEach(function (_, key) { return arr.push(key); });
|
3633 | return arr;
|
3634 | }
|
3635 |
|
3636 | var MapUtils = Object.freeze({
|
3637 | __proto__: null,
|
3638 | convertToMap: convertToMap,
|
3639 | mapById: mapById,
|
3640 | keys: keys
|
3641 | });
|
3642 |
|
3643 |
|
3644 |
|
3645 |
|
3646 |
|
3647 |
|
3648 |
|
3649 | var __extends$1 = (undefined && undefined.__extends) || (function () {
|
3650 | var extendStatics = function (d, b) {
|
3651 | extendStatics = Object.setPrototypeOf ||
|
3652 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
3653 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
3654 | return extendStatics(d, b);
|
3655 | };
|
3656 | return function (d, b) {
|
3657 | extendStatics(d, b);
|
3658 | function __() { this.constructor = d; }
|
3659 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
3660 | };
|
3661 | })();
|
3662 | var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
3663 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3664 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
3665 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
3666 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
3667 | };
|
3668 | var __param$2 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
3669 | return function (target, key) { decorator(target, key, paramIndex); }
|
3670 | };
|
3671 | var __values = (undefined && undefined.__values) || function(o) {
|
3672 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
3673 | if (m) return m.call(o);
|
3674 | if (o && typeof o.length === "number") return {
|
3675 | next: function () {
|
3676 | if (o && i >= o.length) o = void 0;
|
3677 | return { value: o && o[i++], done: !o };
|
3678 | }
|
3679 | };
|
3680 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
3681 | };
|
3682 | var __read = (undefined && undefined.__read) || function (o, n) {
|
3683 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
3684 | if (!m) return o;
|
3685 | var i = m.call(o), r, ar = [], e;
|
3686 | try {
|
3687 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
3688 | }
|
3689 | catch (error) { e = { error: error }; }
|
3690 | finally {
|
3691 | try {
|
3692 | if (r && !r.done && (m = i["return"])) m.call(i);
|
3693 | }
|
3694 | finally { if (e) throw e.error; }
|
3695 | }
|
3696 | return ar;
|
3697 | };
|
3698 | var __spread = (undefined && undefined.__spread) || function () {
|
3699 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
3700 | return ar;
|
3701 | };
|
3702 | var ColumnModel = (function (_super) {
|
3703 | __extends$1(ColumnModel, _super);
|
3704 | function ColumnModel() {
|
3705 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
3706 |
|
3707 | _this.primaryHeaderRowCount = 0;
|
3708 | _this.secondaryHeaderRowCount = 0;
|
3709 |
|
3710 | _this.gridHeaderRowCount = 0;
|
3711 |
|
3712 | _this.displayedColumnsLeft = [];
|
3713 | _this.displayedColumnsRight = [];
|
3714 | _this.displayedColumnsCenter = [];
|
3715 |
|
3716 | _this.displayedColumns = [];
|
3717 |
|
3718 | _this.displayedColumnsAndGroupsMap = {};
|
3719 |
|
3720 | _this.viewportColumns = [];
|
3721 |
|
3722 | _this.viewportColumnsCenter = [];
|
3723 | _this.autoHeightActiveAtLeastOnce = false;
|
3724 | _this.rowGroupColumns = [];
|
3725 | _this.valueColumns = [];
|
3726 | _this.pivotColumns = [];
|
3727 | _this.ready = false;
|
3728 | _this.autoGroupsNeedBuilding = false;
|
3729 | _this.forceRecreateAutoGroups = false;
|
3730 | _this.pivotMode = false;
|
3731 | _this.bodyWidth = 0;
|
3732 | _this.leftWidth = 0;
|
3733 | _this.rightWidth = 0;
|
3734 | _this.bodyWidthDirty = true;
|
3735 | _this.colDefVersion = 0;
|
3736 | _this.flexColsCalculatedAtLestOnce = false;
|
3737 | return _this;
|
3738 | }
|
3739 | ColumnModel.prototype.init = function () {
|
3740 | var _this = this;
|
3741 | this.suppressColumnVirtualisation = this.gridOptionsWrapper.isSuppressColumnVirtualisation();
|
3742 | var pivotMode = this.gridOptionsWrapper.isPivotMode();
|
3743 | if (this.isPivotSettingAllowed(pivotMode)) {
|
3744 | this.pivotMode = pivotMode;
|
3745 | }
|
3746 | this.usingTreeData = this.gridOptionsWrapper.isTreeData();
|
3747 | this.addManagedListener(this.gridOptionsWrapper, 'autoGroupColumnDef', function () { return _this.onAutoGroupColumnDefChanged(); });
|
3748 | this.addManagedListener(this.gridOptionsWrapper, 'defaultColDef', function () { return _this.onDefaultColDefChanged(); });
|
3749 | };
|
3750 | ColumnModel.prototype.onAutoGroupColumnDefChanged = function () {
|
3751 | this.autoGroupsNeedBuilding = true;
|
3752 | this.forceRecreateAutoGroups = true;
|
3753 | this.updateGridColumns();
|
3754 | this.updateDisplayedColumns('gridOptionsChanged');
|
3755 | };
|
3756 | ColumnModel.prototype.onDefaultColDefChanged = function () {
|
3757 |
|
3758 |
|
3759 | this.colDefVersion++;
|
3760 |
|
3761 | this.forceRecreateAutoGroups = true;
|
3762 | this.createColumnsFromColumnDefs(true);
|
3763 | };
|
3764 | ColumnModel.prototype.getColDefVersion = function () {
|
3765 | return this.colDefVersion;
|
3766 | };
|
3767 | ColumnModel.prototype.setColumnDefs = function (columnDefs, source) {
|
3768 | if (source === void 0) { source = 'api'; }
|
3769 | var colsPreviouslyExisted = !!this.columnDefs;
|
3770 | this.colDefVersion++;
|
3771 | this.columnDefs = columnDefs;
|
3772 | this.createColumnsFromColumnDefs(colsPreviouslyExisted, source);
|
3773 | };
|
3774 | ColumnModel.prototype.createColumnsFromColumnDefs = function (colsPreviouslyExisted, source) {
|
3775 | var _this = this;
|
3776 | if (source === void 0) { source = 'api'; }
|
3777 |
|
3778 | var raiseEventsFunc = colsPreviouslyExisted ? this.compareColumnStatesAndRaiseEvents(source) : undefined;
|
3779 |
|
3780 |
|
3781 | this.valueCache.expire();
|
3782 |
|
3783 |
|
3784 |
|
3785 | this.autoGroupsNeedBuilding = true;
|
3786 | var oldPrimaryColumns = this.primaryColumns;
|
3787 | var oldPrimaryTree = this.primaryColumnTree;
|
3788 | var balancedTreeResult = this.columnFactory.createColumnTree(this.columnDefs, true, oldPrimaryTree);
|
3789 | this.primaryColumnTree = balancedTreeResult.columnTree;
|
3790 | this.primaryHeaderRowCount = balancedTreeResult.treeDept + 1;
|
3791 | this.primaryColumns = this.getColumnsFromTree(this.primaryColumnTree);
|
3792 | this.primaryColumnsMap = {};
|
3793 | this.primaryColumns.forEach(function (col) { return _this.primaryColumnsMap[col.getId()] = col; });
|
3794 | this.extractRowGroupColumns(source, oldPrimaryColumns);
|
3795 | this.extractPivotColumns(source, oldPrimaryColumns);
|
3796 | this.extractValueColumns(source, oldPrimaryColumns);
|
3797 | this.ready = true;
|
3798 |
|
3799 |
|
3800 |
|
3801 |
|
3802 | var gridColsNotProcessed = this.gridColsArePrimary === undefined;
|
3803 | var processGridCols = this.gridColsArePrimary || gridColsNotProcessed;
|
3804 | if (processGridCols) {
|
3805 | this.updateGridColumns();
|
3806 | if (colsPreviouslyExisted && !this.gridOptionsWrapper.isMaintainColumnOrder()) {
|
3807 | this.orderGridColumnsLikePrimary();
|
3808 | }
|
3809 | this.updateDisplayedColumns(source);
|
3810 | this.checkViewportColumns();
|
3811 | }
|
3812 |
|
3813 |
|
3814 | this.dispatchEverythingChanged(source);
|
3815 | raiseEventsFunc && raiseEventsFunc();
|
3816 | this.dispatchNewColumnsLoaded();
|
3817 | };
|
3818 | ColumnModel.prototype.dispatchNewColumnsLoaded = function () {
|
3819 | var newColumnsLoadedEvent = {
|
3820 | type: Events.EVENT_NEW_COLUMNS_LOADED,
|
3821 | api: this.gridApi,
|
3822 | columnApi: this.columnApi
|
3823 | };
|
3824 | this.eventService.dispatchEvent(newColumnsLoadedEvent);
|
3825 | };
|
3826 |
|
3827 | ColumnModel.prototype.dispatchEverythingChanged = function (source) {
|
3828 | if (source === void 0) { source = 'api'; }
|
3829 | var eventEverythingChanged = {
|
3830 | type: Events.EVENT_COLUMN_EVERYTHING_CHANGED,
|
3831 | api: this.gridApi,
|
3832 | columnApi: this.columnApi,
|
3833 | source: source
|
3834 | };
|
3835 | this.eventService.dispatchEvent(eventEverythingChanged);
|
3836 | };
|
3837 | ColumnModel.prototype.orderGridColumnsLikePrimary = function () {
|
3838 | var _this = this;
|
3839 | var primaryColumns = this.primaryColumns;
|
3840 | if (!primaryColumns) {
|
3841 | return;
|
3842 | }
|
3843 | this.gridColumns.sort(function (colA, colB) {
|
3844 | var primaryIndexA = primaryColumns.indexOf(colA);
|
3845 | var primaryIndexB = primaryColumns.indexOf(colB);
|
3846 |
|
3847 |
|
3848 | var indexAPresent = primaryIndexA >= 0;
|
3849 | var indexBPresent = primaryIndexB >= 0;
|
3850 | if (indexAPresent && indexBPresent) {
|
3851 | return primaryIndexA - primaryIndexB;
|
3852 | }
|
3853 | if (indexAPresent) {
|
3854 |
|
3855 | return 1;
|
3856 | }
|
3857 | if (indexBPresent) {
|
3858 |
|
3859 | return -1;
|
3860 | }
|
3861 |
|
3862 |
|
3863 | var gridIndexA = _this.gridColumns.indexOf(colA);
|
3864 | var gridIndexB = _this.gridColumns.indexOf(colB);
|
3865 | return gridIndexA - gridIndexB;
|
3866 | });
|
3867 | };
|
3868 | ColumnModel.prototype.getAllDisplayedAutoHeightCols = function () {
|
3869 | return this.displayedAutoHeightCols;
|
3870 | };
|
3871 | ColumnModel.prototype.setViewport = function () {
|
3872 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
3873 | this.viewportLeft = this.bodyWidth - this.scrollPosition - this.scrollWidth;
|
3874 | this.viewportRight = this.bodyWidth - this.scrollPosition;
|
3875 | }
|
3876 | else {
|
3877 | this.viewportLeft = this.scrollPosition;
|
3878 | this.viewportRight = this.scrollWidth + this.scrollPosition;
|
3879 | }
|
3880 | };
|
3881 |
|
3882 | ColumnModel.prototype.getDisplayedColumnsStartingAt = function (column) {
|
3883 | var currentColumn = column;
|
3884 | var columns = [];
|
3885 | while (currentColumn != null) {
|
3886 | columns.push(currentColumn);
|
3887 | currentColumn = this.getDisplayedColAfter(currentColumn);
|
3888 | }
|
3889 | return columns;
|
3890 | };
|
3891 |
|
3892 |
|
3893 |
|
3894 | ColumnModel.prototype.checkViewportColumns = function () {
|
3895 |
|
3896 | if (this.displayedColumnsCenter == null) {
|
3897 | return;
|
3898 | }
|
3899 | var hashBefore = this.viewportColumns.map(function (column) { return column.getId(); }).join('#');
|
3900 | this.extractViewport();
|
3901 | var hashAfter = this.viewportColumns.map(function (column) { return column.getId(); }).join('#');
|
3902 | if (hashBefore !== hashAfter) {
|
3903 | var event_1 = {
|
3904 | type: Events.EVENT_VIRTUAL_COLUMNS_CHANGED,
|
3905 | api: this.gridApi,
|
3906 | columnApi: this.columnApi
|
3907 | };
|
3908 | this.eventService.dispatchEvent(event_1);
|
3909 | }
|
3910 | };
|
3911 | ColumnModel.prototype.setViewportPosition = function (scrollWidth, scrollPosition) {
|
3912 | if (scrollWidth !== this.scrollWidth || scrollPosition !== this.scrollPosition || this.bodyWidthDirty) {
|
3913 | this.scrollWidth = scrollWidth;
|
3914 | this.scrollPosition = scrollPosition;
|
3915 |
|
3916 |
|
3917 |
|
3918 | this.bodyWidthDirty = true;
|
3919 | this.setViewport();
|
3920 | if (this.ready) {
|
3921 | this.checkViewportColumns();
|
3922 | }
|
3923 | }
|
3924 | };
|
3925 | ColumnModel.prototype.isPivotMode = function () {
|
3926 | return this.pivotMode;
|
3927 | };
|
3928 | ColumnModel.prototype.isPivotSettingAllowed = function (pivot) {
|
3929 | if (pivot && this.gridOptionsWrapper.isTreeData()) {
|
3930 | console.warn("AG Grid: Pivot mode not available in conjunction Tree Data i.e. 'gridOptions.treeData: true'");
|
3931 | return false;
|
3932 | }
|
3933 | return true;
|
3934 | };
|
3935 | ColumnModel.prototype.setPivotMode = function (pivotMode, source) {
|
3936 | if (source === void 0) { source = 'api'; }
|
3937 | if (pivotMode === this.pivotMode || !this.isPivotSettingAllowed(this.pivotMode)) {
|
3938 | return;
|
3939 | }
|
3940 | this.pivotMode = pivotMode;
|
3941 |
|
3942 |
|
3943 |
|
3944 | this.autoGroupsNeedBuilding = true;
|
3945 | this.updateGridColumns();
|
3946 | this.updateDisplayedColumns(source);
|
3947 | var event = {
|
3948 | type: Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,
|
3949 | api: this.gridApi,
|
3950 | columnApi: this.columnApi
|
3951 | };
|
3952 | this.eventService.dispatchEvent(event);
|
3953 | };
|
3954 | ColumnModel.prototype.getSecondaryPivotColumn = function (pivotKeys, valueColKey) {
|
3955 | if (missing(this.secondaryColumns)) {
|
3956 | return null;
|
3957 | }
|
3958 | var valueColumnToFind = this.getPrimaryColumn(valueColKey);
|
3959 | var foundColumn = null;
|
3960 | this.secondaryColumns.forEach(function (column) {
|
3961 | var thisPivotKeys = column.getColDef().pivotKeys;
|
3962 | var pivotValueColumn = column.getColDef().pivotValueColumn;
|
3963 | var pivotKeyMatches = areEqual(thisPivotKeys, pivotKeys);
|
3964 | var pivotValueMatches = pivotValueColumn === valueColumnToFind;
|
3965 | if (pivotKeyMatches && pivotValueMatches) {
|
3966 | foundColumn = column;
|
3967 | }
|
3968 | });
|
3969 | return foundColumn;
|
3970 | };
|
3971 | ColumnModel.prototype.setBeans = function (loggerFactory) {
|
3972 | this.logger = loggerFactory.create('columnModel');
|
3973 | };
|
3974 | ColumnModel.prototype.setFirstRightAndLastLeftPinned = function (source) {
|
3975 | var lastLeft;
|
3976 | var firstRight;
|
3977 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
3978 | lastLeft = this.displayedColumnsLeft ? this.displayedColumnsLeft[0] : null;
|
3979 | firstRight = this.displayedColumnsRight ? last(this.displayedColumnsRight) : null;
|
3980 | }
|
3981 | else {
|
3982 | lastLeft = this.displayedColumnsLeft ? last(this.displayedColumnsLeft) : null;
|
3983 | firstRight = this.displayedColumnsRight ? this.displayedColumnsRight[0] : null;
|
3984 | }
|
3985 | this.gridColumns.forEach(function (column) {
|
3986 | column.setLastLeftPinned(column === lastLeft, source);
|
3987 | column.setFirstRightPinned(column === firstRight, source);
|
3988 | });
|
3989 | };
|
3990 | ColumnModel.prototype.autoSizeColumns = function (params) {
|
3991 | var _this = this;
|
3992 | var columns = params.columns, skipHeader = params.skipHeader, skipHeaderGroups = params.skipHeaderGroups, stopAtGroup = params.stopAtGroup, _a = params.source, source = _a === void 0 ? 'api' : _a;
|
3993 |
|
3994 |
|
3995 |
|
3996 |
|
3997 |
|
3998 |
|
3999 |
|
4000 |
|
4001 |
|
4002 |
|
4003 | this.animationFrameService.flushAllFrames();
|
4004 |
|
4005 | var columnsAutosized = [];
|
4006 |
|
4007 | var changesThisTimeAround = -1;
|
4008 | var shouldSkipHeader = skipHeader != null ? skipHeader : this.gridOptionsWrapper.isSkipHeaderOnAutoSize();
|
4009 | var shouldSkipHeaderGroups = skipHeaderGroups != null ? skipHeaderGroups : shouldSkipHeader;
|
4010 | while (changesThisTimeAround !== 0) {
|
4011 | changesThisTimeAround = 0;
|
4012 | this.actionOnGridColumns(columns, function (column) {
|
4013 |
|
4014 | if (columnsAutosized.indexOf(column) >= 0) {
|
4015 | return false;
|
4016 | }
|
4017 |
|
4018 | var preferredWidth = _this.autoWidthCalculator.getPreferredWidthForColumn(column, shouldSkipHeader);
|
4019 |
|
4020 | if (preferredWidth > 0) {
|
4021 | var newWidth = _this.normaliseColumnWidth(column, preferredWidth);
|
4022 | column.setActualWidth(newWidth, source);
|
4023 | columnsAutosized.push(column);
|
4024 | changesThisTimeAround++;
|
4025 | }
|
4026 | return true;
|
4027 | }, source);
|
4028 | }
|
4029 | if (!shouldSkipHeaderGroups) {
|
4030 | this.autoSizeColumnGroupsByColumns(columns, stopAtGroup);
|
4031 | }
|
4032 | this.fireColumnResizedEvent(columnsAutosized, true, 'autosizeColumns');
|
4033 | };
|
4034 | ColumnModel.prototype.fireColumnResizedEvent = function (columns, finished, source, flexColumns) {
|
4035 | if (flexColumns === void 0) { flexColumns = null; }
|
4036 | if (columns && columns.length) {
|
4037 | var event_2 = {
|
4038 | type: Events.EVENT_COLUMN_RESIZED,
|
4039 | columns: columns,
|
4040 | column: columns.length === 1 ? columns[0] : null,
|
4041 | flexColumns: flexColumns,
|
4042 | finished: finished,
|
4043 | api: this.gridApi,
|
4044 | columnApi: this.columnApi,
|
4045 | source: source
|
4046 | };
|
4047 | this.eventService.dispatchEvent(event_2);
|
4048 | }
|
4049 | };
|
4050 | ColumnModel.prototype.autoSizeColumn = function (key, skipHeader, source) {
|
4051 | if (source === void 0) { source = "api"; }
|
4052 | if (key) {
|
4053 | this.autoSizeColumns({ columns: [key], skipHeader: skipHeader, skipHeaderGroups: true, source: source });
|
4054 | }
|
4055 | };
|
4056 | ColumnModel.prototype.autoSizeColumnGroupsByColumns = function (keys, stopAtGroup) {
|
4057 | var e_1, _a, e_2, _b;
|
4058 | var columnGroups = new Set();
|
4059 | var columns = this.getGridColumns(keys);
|
4060 | columns.forEach(function (col) {
|
4061 | var parent = col.getParent();
|
4062 | while (parent && parent != stopAtGroup) {
|
4063 | if (!parent.isPadding()) {
|
4064 | columnGroups.add(parent);
|
4065 | }
|
4066 | parent = parent.getParent();
|
4067 | }
|
4068 | });
|
4069 | var headerGroupCtrl;
|
4070 | var resizedColumns = [];
|
4071 | try {
|
4072 | for (var columnGroups_1 = __values(columnGroups), columnGroups_1_1 = columnGroups_1.next(); !columnGroups_1_1.done; columnGroups_1_1 = columnGroups_1.next()) {
|
4073 | var columnGroup = columnGroups_1_1.value;
|
4074 | try {
|
4075 | for (var _c = (e_2 = void 0, __values(this.ctrlsService.getHeaderRowContainerCtrls())), _d = _c.next(); !_d.done; _d = _c.next()) {
|
4076 | var headerContainerCtrl = _d.value;
|
4077 | headerGroupCtrl = headerContainerCtrl.getHeaderCtrlForColumn(columnGroup);
|
4078 | if (headerGroupCtrl) {
|
4079 | break;
|
4080 | }
|
4081 | }
|
4082 | }
|
4083 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
4084 | finally {
|
4085 | try {
|
4086 | if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
4087 | }
|
4088 | finally { if (e_2) throw e_2.error; }
|
4089 | }
|
4090 | if (headerGroupCtrl) {
|
4091 | headerGroupCtrl.resizeLeafColumnsToFit();
|
4092 | }
|
4093 | }
|
4094 | }
|
4095 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
4096 | finally {
|
4097 | try {
|
4098 | if (columnGroups_1_1 && !columnGroups_1_1.done && (_a = columnGroups_1.return)) _a.call(columnGroups_1);
|
4099 | }
|
4100 | finally { if (e_1) throw e_1.error; }
|
4101 | }
|
4102 | return resizedColumns;
|
4103 | };
|
4104 | ColumnModel.prototype.autoSizeAllColumns = function (skipHeader, source) {
|
4105 | if (source === void 0) { source = "api"; }
|
4106 | var allDisplayedColumns = this.getAllDisplayedColumns();
|
4107 | this.autoSizeColumns({ columns: allDisplayedColumns, skipHeader: skipHeader, source: source });
|
4108 | };
|
4109 |
|
4110 | ColumnModel.prototype.getColumnsFromTree = function (rootColumns) {
|
4111 | var result = [];
|
4112 | var recursiveFindColumns = function (childColumns) {
|
4113 | for (var i = 0; i < childColumns.length; i++) {
|
4114 | var child = childColumns[i];
|
4115 | if (child instanceof Column) {
|
4116 | result.push(child);
|
4117 | }
|
4118 | else if (child instanceof ProvidedColumnGroup) {
|
4119 | recursiveFindColumns(child.getChildren());
|
4120 | }
|
4121 | }
|
4122 | };
|
4123 | recursiveFindColumns(rootColumns);
|
4124 | return result;
|
4125 | };
|
4126 | ColumnModel.prototype.getAllDisplayedTrees = function () {
|
4127 | if (this.displayedTreeLeft && this.displayedTreeRight && this.displayedTreeCentre) {
|
4128 | return this.displayedTreeLeft
|
4129 | .concat(this.displayedTreeCentre)
|
4130 | .concat(this.displayedTreeRight);
|
4131 | }
|
4132 | return null;
|
4133 | };
|
4134 |
|
4135 | ColumnModel.prototype.getPrimaryColumnTree = function () {
|
4136 | return this.primaryColumnTree;
|
4137 | };
|
4138 |
|
4139 | ColumnModel.prototype.getHeaderRowCount = function () {
|
4140 | return this.gridHeaderRowCount;
|
4141 | };
|
4142 |
|
4143 | ColumnModel.prototype.getDisplayedTreeLeft = function () {
|
4144 | return this.displayedTreeLeft;
|
4145 | };
|
4146 |
|
4147 | ColumnModel.prototype.getDisplayedTreeRight = function () {
|
4148 | return this.displayedTreeRight;
|
4149 | };
|
4150 |
|
4151 | ColumnModel.prototype.getDisplayedTreeCentre = function () {
|
4152 | return this.displayedTreeCentre;
|
4153 | };
|
4154 |
|
4155 | ColumnModel.prototype.isColumnDisplayed = function (column) {
|
4156 | return this.getAllDisplayedColumns().indexOf(column) >= 0;
|
4157 | };
|
4158 |
|
4159 | ColumnModel.prototype.getAllDisplayedColumns = function () {
|
4160 | return this.displayedColumns;
|
4161 | };
|
4162 | ColumnModel.prototype.getViewportColumns = function () {
|
4163 | return this.viewportColumns;
|
4164 | };
|
4165 | ColumnModel.prototype.getDisplayedLeftColumnsForRow = function (rowNode) {
|
4166 | if (!this.colSpanActive) {
|
4167 | return this.displayedColumnsLeft;
|
4168 | }
|
4169 | return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsLeft);
|
4170 | };
|
4171 | ColumnModel.prototype.getDisplayedRightColumnsForRow = function (rowNode) {
|
4172 | if (!this.colSpanActive) {
|
4173 | return this.displayedColumnsRight;
|
4174 | }
|
4175 | return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsRight);
|
4176 | };
|
4177 | ColumnModel.prototype.getDisplayedColumnsForRow = function (rowNode, displayedColumns, filterCallback, emptySpaceBeforeColumn) {
|
4178 | var result = [];
|
4179 | var lastConsideredCol = null;
|
4180 | var _loop_1 = function (i) {
|
4181 | var col = displayedColumns[i];
|
4182 | var maxAllowedColSpan = displayedColumns.length - i;
|
4183 | var colSpan = Math.min(col.getColSpan(rowNode), maxAllowedColSpan);
|
4184 | var columnsToCheckFilter = [col];
|
4185 | if (colSpan > 1) {
|
4186 | var colsToRemove = colSpan - 1;
|
4187 | for (var j = 1; j <= colsToRemove; j++) {
|
4188 | columnsToCheckFilter.push(displayedColumns[i + j]);
|
4189 | }
|
4190 | i += colsToRemove;
|
4191 | }
|
4192 |
|
4193 | var filterPasses;
|
4194 | if (filterCallback) {
|
4195 |
|
4196 |
|
4197 |
|
4198 |
|
4199 |
|
4200 | filterPasses = false;
|
4201 | columnsToCheckFilter.forEach(function (colForFilter) {
|
4202 | if (filterCallback(colForFilter)) {
|
4203 | filterPasses = true;
|
4204 | }
|
4205 | });
|
4206 | }
|
4207 | else {
|
4208 | filterPasses = true;
|
4209 | }
|
4210 | if (filterPasses) {
|
4211 | if (result.length === 0 && lastConsideredCol) {
|
4212 | var gapBeforeColumn = emptySpaceBeforeColumn ? emptySpaceBeforeColumn(col) : false;
|
4213 | if (gapBeforeColumn) {
|
4214 | result.push(lastConsideredCol);
|
4215 | }
|
4216 | }
|
4217 | result.push(col);
|
4218 | }
|
4219 | lastConsideredCol = col;
|
4220 | out_i_1 = i;
|
4221 | };
|
4222 | var out_i_1;
|
4223 | for (var i = 0; i < displayedColumns.length; i++) {
|
4224 | _loop_1(i);
|
4225 | i = out_i_1;
|
4226 | }
|
4227 | return result;
|
4228 | };
|
4229 |
|
4230 |
|
4231 |
|
4232 |
|
4233 | ColumnModel.prototype.getViewportCenterColumnsForRow = function (rowNode) {
|
4234 | var _this = this;
|
4235 | if (!this.colSpanActive) {
|
4236 | return this.viewportColumnsCenter;
|
4237 | }
|
4238 | var emptySpaceBeforeColumn = function (col) {
|
4239 | var left = col.getLeft();
|
4240 | return exists(left) && left > _this.viewportLeft;
|
4241 | };
|
4242 |
|
4243 | var filterCallback = this.suppressColumnVirtualisation ? null : this.isColumnInViewport.bind(this);
|
4244 | return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsCenter, filterCallback, emptySpaceBeforeColumn);
|
4245 | };
|
4246 | ColumnModel.prototype.getAriaColumnIndex = function (col) {
|
4247 | return this.getAllGridColumns().indexOf(col) + 1;
|
4248 | };
|
4249 | ColumnModel.prototype.isColumnInViewport = function (col) {
|
4250 |
|
4251 | if (col.isAutoHeight()) {
|
4252 | return true;
|
4253 | }
|
4254 | var columnLeft = col.getLeft() || 0;
|
4255 | var columnRight = columnLeft + col.getActualWidth();
|
4256 |
|
4257 |
|
4258 |
|
4259 |
|
4260 | var leftBounds = this.viewportLeft - 200;
|
4261 | var rightBounds = this.viewportRight + 200;
|
4262 | var columnToMuchLeft = columnLeft < leftBounds && columnRight < leftBounds;
|
4263 | var columnToMuchRight = columnLeft > rightBounds && columnRight > rightBounds;
|
4264 | return !columnToMuchLeft && !columnToMuchRight;
|
4265 | };
|
4266 |
|
4267 |
|
4268 |
|
4269 | ColumnModel.prototype.getDisplayedColumnsLeftWidth = function () {
|
4270 | return this.getWidthOfColsInList(this.displayedColumnsLeft);
|
4271 | };
|
4272 |
|
4273 | ColumnModel.prototype.getDisplayedColumnsRightWidth = function () {
|
4274 | return this.getWidthOfColsInList(this.displayedColumnsRight);
|
4275 | };
|
4276 | ColumnModel.prototype.updatePrimaryColumnList = function (keys, masterList, actionIsAdd, columnCallback, eventType, source) {
|
4277 | var _this = this;
|
4278 | if (source === void 0) { source = "api"; }
|
4279 | if (!keys || missingOrEmpty(keys)) {
|
4280 | return;
|
4281 | }
|
4282 | var atLeastOne = false;
|
4283 | keys.forEach(function (key) {
|
4284 | var columnToAdd = _this.getPrimaryColumn(key);
|
4285 | if (!columnToAdd) {
|
4286 | return;
|
4287 | }
|
4288 | if (actionIsAdd) {
|
4289 | if (masterList.indexOf(columnToAdd) >= 0) {
|
4290 | return;
|
4291 | }
|
4292 | masterList.push(columnToAdd);
|
4293 | }
|
4294 | else {
|
4295 | if (masterList.indexOf(columnToAdd) < 0) {
|
4296 | return;
|
4297 | }
|
4298 | removeFromArray(masterList, columnToAdd);
|
4299 | }
|
4300 | columnCallback(columnToAdd);
|
4301 | atLeastOne = true;
|
4302 | });
|
4303 | if (!atLeastOne) {
|
4304 | return;
|
4305 | }
|
4306 | if (this.autoGroupsNeedBuilding) {
|
4307 | this.updateGridColumns();
|
4308 | }
|
4309 | this.updateDisplayedColumns(source);
|
4310 | var event = {
|
4311 | type: eventType,
|
4312 | columns: masterList,
|
4313 | column: masterList.length === 1 ? masterList[0] : null,
|
4314 | api: this.gridApi,
|
4315 | columnApi: this.columnApi,
|
4316 | source: source
|
4317 | };
|
4318 | this.eventService.dispatchEvent(event);
|
4319 | };
|
4320 | ColumnModel.prototype.setRowGroupColumns = function (colKeys, source) {
|
4321 | if (source === void 0) { source = "api"; }
|
4322 | this.autoGroupsNeedBuilding = true;
|
4323 | this.setPrimaryColumnList(colKeys, this.rowGroupColumns, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.setRowGroupActive.bind(this), source);
|
4324 | };
|
4325 | ColumnModel.prototype.setRowGroupActive = function (active, column, source) {
|
4326 | if (active === column.isRowGroupActive()) {
|
4327 | return;
|
4328 | }
|
4329 | column.setRowGroupActive(active, source);
|
4330 | if (!active && !this.gridOptionsWrapper.isSuppressMakeColumnVisibleAfterUnGroup()) {
|
4331 | column.setVisible(true, source);
|
4332 | }
|
4333 | };
|
4334 | ColumnModel.prototype.addRowGroupColumn = function (key, source) {
|
4335 | if (source === void 0) { source = "api"; }
|
4336 | if (key) {
|
4337 | this.addRowGroupColumns([key], source);
|
4338 | }
|
4339 | };
|
4340 | ColumnModel.prototype.addRowGroupColumns = function (keys, source) {
|
4341 | if (source === void 0) { source = "api"; }
|
4342 | this.autoGroupsNeedBuilding = true;
|
4343 | this.updatePrimaryColumnList(keys, this.rowGroupColumns, true, this.setRowGroupActive.bind(this, true), Events.EVENT_COLUMN_ROW_GROUP_CHANGED, source);
|
4344 | };
|
4345 | ColumnModel.prototype.removeRowGroupColumns = function (keys, source) {
|
4346 | if (source === void 0) { source = "api"; }
|
4347 | this.autoGroupsNeedBuilding = true;
|
4348 | this.updatePrimaryColumnList(keys, this.rowGroupColumns, false, this.setRowGroupActive.bind(this, false), Events.EVENT_COLUMN_ROW_GROUP_CHANGED, source);
|
4349 | };
|
4350 | ColumnModel.prototype.removeRowGroupColumn = function (key, source) {
|
4351 | if (source === void 0) { source = "api"; }
|
4352 | if (key) {
|
4353 | this.removeRowGroupColumns([key], source);
|
4354 | }
|
4355 | };
|
4356 | ColumnModel.prototype.addPivotColumns = function (keys, source) {
|
4357 | if (source === void 0) { source = "api"; }
|
4358 | this.updatePrimaryColumnList(keys, this.pivotColumns, true, function (column) { return column.setPivotActive(true, source); }, Events.EVENT_COLUMN_PIVOT_CHANGED, source);
|
4359 | };
|
4360 | ColumnModel.prototype.setPivotColumns = function (colKeys, source) {
|
4361 | if (source === void 0) { source = "api"; }
|
4362 | this.setPrimaryColumnList(colKeys, this.pivotColumns, Events.EVENT_COLUMN_PIVOT_CHANGED, function (added, column) {
|
4363 | column.setPivotActive(added, source);
|
4364 | }, source);
|
4365 | };
|
4366 | ColumnModel.prototype.addPivotColumn = function (key, source) {
|
4367 | if (source === void 0) { source = "api"; }
|
4368 | this.addPivotColumns([key], source);
|
4369 | };
|
4370 | ColumnModel.prototype.removePivotColumns = function (keys, source) {
|
4371 | if (source === void 0) { source = "api"; }
|
4372 | this.updatePrimaryColumnList(keys, this.pivotColumns, false, function (column) { return column.setPivotActive(false, source); }, Events.EVENT_COLUMN_PIVOT_CHANGED, source);
|
4373 | };
|
4374 | ColumnModel.prototype.removePivotColumn = function (key, source) {
|
4375 | if (source === void 0) { source = "api"; }
|
4376 | this.removePivotColumns([key], source);
|
4377 | };
|
4378 | ColumnModel.prototype.setPrimaryColumnList = function (colKeys, masterList, eventName, columnCallback, source) {
|
4379 | var _this = this;
|
4380 | masterList.length = 0;
|
4381 | if (exists(colKeys)) {
|
4382 | colKeys.forEach(function (key) {
|
4383 | var column = _this.getPrimaryColumn(key);
|
4384 | if (column) {
|
4385 | masterList.push(column);
|
4386 | }
|
4387 | });
|
4388 | }
|
4389 | (this.primaryColumns || []).forEach(function (column) {
|
4390 | var added = masterList.indexOf(column) >= 0;
|
4391 | columnCallback(added, column);
|
4392 | });
|
4393 | if (this.autoGroupsNeedBuilding) {
|
4394 | this.updateGridColumns();
|
4395 | }
|
4396 | this.updateDisplayedColumns(source);
|
4397 | this.fireColumnEvent(eventName, masterList, source);
|
4398 | };
|
4399 | ColumnModel.prototype.setValueColumns = function (colKeys, source) {
|
4400 | if (source === void 0) { source = "api"; }
|
4401 | this.setPrimaryColumnList(colKeys, this.valueColumns, Events.EVENT_COLUMN_VALUE_CHANGED, this.setValueActive.bind(this), source);
|
4402 | };
|
4403 | ColumnModel.prototype.setValueActive = function (active, column, source) {
|
4404 | if (active === column.isValueActive()) {
|
4405 | return;
|
4406 | }
|
4407 | column.setValueActive(active, source);
|
4408 | if (active && !column.getAggFunc()) {
|
4409 | var initialAggFunc = this.aggFuncService.getDefaultAggFunc(column);
|
4410 | column.setAggFunc(initialAggFunc);
|
4411 | }
|
4412 | };
|
4413 | ColumnModel.prototype.addValueColumns = function (keys, source) {
|
4414 | if (source === void 0) { source = "api"; }
|
4415 | this.updatePrimaryColumnList(keys, this.valueColumns, true, this.setValueActive.bind(this, true), Events.EVENT_COLUMN_VALUE_CHANGED, source);
|
4416 | };
|
4417 | ColumnModel.prototype.addValueColumn = function (colKey, source) {
|
4418 | if (source === void 0) { source = "api"; }
|
4419 | if (colKey) {
|
4420 | this.addValueColumns([colKey], source);
|
4421 | }
|
4422 | };
|
4423 | ColumnModel.prototype.removeValueColumn = function (colKey, source) {
|
4424 | if (source === void 0) { source = "api"; }
|
4425 | this.removeValueColumns([colKey], source);
|
4426 | };
|
4427 | ColumnModel.prototype.removeValueColumns = function (keys, source) {
|
4428 | if (source === void 0) { source = "api"; }
|
4429 | this.updatePrimaryColumnList(keys, this.valueColumns, false, this.setValueActive.bind(this, false), Events.EVENT_COLUMN_VALUE_CHANGED, source);
|
4430 | };
|
4431 |
|
4432 | ColumnModel.prototype.normaliseColumnWidth = function (column, newWidth) {
|
4433 | var minWidth = column.getMinWidth();
|
4434 | if (exists(minWidth) && newWidth < minWidth) {
|
4435 | newWidth = minWidth;
|
4436 | }
|
4437 | var maxWidth = column.getMaxWidth();
|
4438 | if (exists(maxWidth) && column.isGreaterThanMax(newWidth)) {
|
4439 | newWidth = maxWidth;
|
4440 | }
|
4441 | return newWidth;
|
4442 | };
|
4443 | ColumnModel.prototype.getPrimaryOrGridColumn = function (key) {
|
4444 | var column = this.getPrimaryColumn(key);
|
4445 | return column || this.getGridColumn(key);
|
4446 | };
|
4447 | ColumnModel.prototype.setColumnWidths = function (columnWidths, shiftKey, // @takeFromAdjacent - if user has 'shift' pressed, then pixels are taken from adjacent column
|
4448 | finished, // @finished - ends up in the event, tells the user if more events are to come
|
4449 | source) {
|
4450 | var _this = this;
|
4451 | if (source === void 0) { source = "api"; }
|
4452 | var sets = [];
|
4453 | columnWidths.forEach(function (columnWidth) {
|
4454 | var col = _this.getPrimaryOrGridColumn(columnWidth.key);
|
4455 | if (!col) {
|
4456 | return;
|
4457 | }
|
4458 | sets.push({
|
4459 | width: columnWidth.newWidth,
|
4460 | ratios: [1],
|
4461 | columns: [col]
|
4462 | });
|
4463 |
|
4464 | var defaultIsShift = _this.gridOptionsWrapper.getColResizeDefault() === 'shift';
|
4465 | if (defaultIsShift) {
|
4466 | shiftKey = !shiftKey;
|
4467 | }
|
4468 | if (shiftKey) {
|
4469 | var otherCol = _this.getDisplayedColAfter(col);
|
4470 | if (!otherCol) {
|
4471 | return;
|
4472 | }
|
4473 | var widthDiff = col.getActualWidth() - columnWidth.newWidth;
|
4474 | var otherColWidth = otherCol.getActualWidth() + widthDiff;
|
4475 | sets.push({
|
4476 | width: otherColWidth,
|
4477 | ratios: [1],
|
4478 | columns: [otherCol]
|
4479 | });
|
4480 | }
|
4481 | });
|
4482 | if (sets.length === 0) {
|
4483 | return;
|
4484 | }
|
4485 | this.resizeColumnSets({
|
4486 | resizeSets: sets,
|
4487 | finished: finished,
|
4488 | source: source
|
4489 | });
|
4490 | };
|
4491 | ColumnModel.prototype.checkMinAndMaxWidthsForSet = function (columnResizeSet) {
|
4492 | var columns = columnResizeSet.columns, width = columnResizeSet.width;
|
4493 |
|
4494 |
|
4495 | var minWidthAccumulated = 0;
|
4496 | var maxWidthAccumulated = 0;
|
4497 | var maxWidthActive = true;
|
4498 | columns.forEach(function (col) {
|
4499 | var minWidth = col.getMinWidth();
|
4500 | minWidthAccumulated += minWidth || 0;
|
4501 | var maxWidth = col.getMaxWidth();
|
4502 | if (exists(maxWidth) && maxWidth > 0) {
|
4503 | maxWidthAccumulated += maxWidth;
|
4504 | }
|
4505 | else {
|
4506 |
|
4507 |
|
4508 | maxWidthActive = false;
|
4509 | }
|
4510 | });
|
4511 | var minWidthPasses = width >= minWidthAccumulated;
|
4512 | var maxWidthPasses = !maxWidthActive || (width <= maxWidthAccumulated);
|
4513 | return minWidthPasses && maxWidthPasses;
|
4514 | };
|
4515 |
|
4516 |
|
4517 |
|
4518 |
|
4519 | ColumnModel.prototype.resizeColumnSets = function (params) {
|
4520 | var _this = this;
|
4521 | var resizeSets = params.resizeSets, finished = params.finished, source = params.source;
|
4522 | var passMinMaxCheck = !resizeSets || resizeSets.every(function (columnResizeSet) { return _this.checkMinAndMaxWidthsForSet(columnResizeSet); });
|
4523 | if (!passMinMaxCheck) {
|
4524 |
|
4525 | if (finished) {
|
4526 | var columns = resizeSets && resizeSets.length > 0 ? resizeSets[0].columns : null;
|
4527 | this.fireColumnResizedEvent(columns, finished, source);
|
4528 | }
|
4529 | return;
|
4530 | }
|
4531 | var changedCols = [];
|
4532 | var allResizedCols = [];
|
4533 | resizeSets.forEach(function (set) {
|
4534 | var width = set.width, columns = set.columns, ratios = set.ratios;
|
4535 | // keep track of pixels used, and last column gets the remaining,
|
4536 | // to cater for rounding errors, and min width adjustments
|
4537 | var newWidths = {};
|
4538 | var finishedCols = {};
|
4539 | columns.forEach(function (col) { return allResizedCols.push(col); });
|
4540 |
|
4541 |
|
4542 |
|
4543 |
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 |
|
4550 | var finishedColsGrew = true;
|
4551 | var loopCount = 0;
|
4552 | var _loop_2 = function () {
|
4553 | loopCount++;
|
4554 | if (loopCount > 1000) {
|
4555 |
|
4556 |
|
4557 | console.error('AG Grid: infinite loop in resizeColumnSets');
|
4558 | return "break";
|
4559 | }
|
4560 | finishedColsGrew = false;
|
4561 | var subsetCols = [];
|
4562 | var subsetRatioTotal = 0;
|
4563 | var pixelsToDistribute = width;
|
4564 | columns.forEach(function (col, index) {
|
4565 | var thisColFinished = finishedCols[col.getId()];
|
4566 | if (thisColFinished) {
|
4567 | pixelsToDistribute -= newWidths[col.getId()];
|
4568 | }
|
4569 | else {
|
4570 | subsetCols.push(col);
|
4571 | var ratioThisCol = ratios[index];
|
4572 | subsetRatioTotal += ratioThisCol;
|
4573 | }
|
4574 | });
|
4575 |
|
4576 |
|
4577 |
|
4578 | var ratioScale = 1 / subsetRatioTotal;
|
4579 | subsetCols.forEach(function (col, index) {
|
4580 | var lastCol = index === (subsetCols.length - 1);
|
4581 | var colNewWidth;
|
4582 | if (lastCol) {
|
4583 | colNewWidth = pixelsToDistribute;
|
4584 | }
|
4585 | else {
|
4586 | colNewWidth = Math.round(ratios[index] * width * ratioScale);
|
4587 | pixelsToDistribute -= colNewWidth;
|
4588 | }
|
4589 | var minWidth = col.getMinWidth();
|
4590 | var maxWidth = col.getMaxWidth();
|
4591 | if (exists(minWidth) && colNewWidth < minWidth) {
|
4592 | colNewWidth = minWidth;
|
4593 | finishedCols[col.getId()] = true;
|
4594 | finishedColsGrew = true;
|
4595 | }
|
4596 | else if (exists(maxWidth) && maxWidth > 0 && colNewWidth > maxWidth) {
|
4597 | colNewWidth = maxWidth;
|
4598 | finishedCols[col.getId()] = true;
|
4599 | finishedColsGrew = true;
|
4600 | }
|
4601 | newWidths[col.getId()] = colNewWidth;
|
4602 | });
|
4603 | };
|
4604 | while (finishedColsGrew) {
|
4605 | var state_1 = _loop_2();
|
4606 | if (state_1 === "break")
|
4607 | break;
|
4608 | }
|
4609 | columns.forEach(function (col) {
|
4610 | var newWidth = newWidths[col.getId()];
|
4611 | var actualWidth = col.getActualWidth();
|
4612 | if (actualWidth !== newWidth) {
|
4613 | col.setActualWidth(newWidth, source);
|
4614 | changedCols.push(col);
|
4615 | }
|
4616 | });
|
4617 | });
|
4618 |
|
4619 | var atLeastOneColChanged = changedCols.length > 0;
|
4620 | var flexedCols = [];
|
4621 | if (atLeastOneColChanged) {
|
4622 | flexedCols = this.refreshFlexedColumns({ resizingCols: allResizedCols, skipSetLeft: true });
|
4623 | this.setLeftValues(source);
|
4624 | this.updateBodyWidths();
|
4625 | this.checkViewportColumns();
|
4626 | }
|
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 |
|
4632 | var colsForEvent = allResizedCols.concat(flexedCols);
|
4633 | if (atLeastOneColChanged || finished) {
|
4634 | this.fireColumnResizedEvent(colsForEvent, finished, source, flexedCols);
|
4635 | }
|
4636 | };
|
4637 | ColumnModel.prototype.setColumnAggFunc = function (key, aggFunc, source) {
|
4638 | if (source === void 0) { source = "api"; }
|
4639 | if (!key) {
|
4640 | return;
|
4641 | }
|
4642 | var column = this.getPrimaryColumn(key);
|
4643 | if (!column) {
|
4644 | return;
|
4645 | }
|
4646 | column.setAggFunc(aggFunc);
|
4647 | this.fireColumnEvent(Events.EVENT_COLUMN_VALUE_CHANGED, [column], source);
|
4648 | };
|
4649 | ColumnModel.prototype.fireColumnEvent = function (type, columns, source) {
|
4650 | var event = {
|
4651 | type: type,
|
4652 | columns: columns,
|
4653 | column: (columns && columns.length == 1) ? columns[0] : null,
|
4654 | api: this.gridApi,
|
4655 | columnApi: this.columnApi,
|
4656 | source: source
|
4657 | };
|
4658 | this.eventService.dispatchEvent(event);
|
4659 | };
|
4660 | ColumnModel.prototype.moveRowGroupColumn = function (fromIndex, toIndex, source) {
|
4661 | if (source === void 0) { source = "api"; }
|
4662 | var column = this.rowGroupColumns[fromIndex];
|
4663 | this.rowGroupColumns.splice(fromIndex, 1);
|
4664 | this.rowGroupColumns.splice(toIndex, 0, column);
|
4665 | var event = {
|
4666 | type: Events.EVENT_COLUMN_ROW_GROUP_CHANGED,
|
4667 | columns: this.rowGroupColumns,
|
4668 | column: this.rowGroupColumns.length === 1 ? this.rowGroupColumns[0] : null,
|
4669 | api: this.gridApi,
|
4670 | columnApi: this.columnApi,
|
4671 | source: source
|
4672 | };
|
4673 | this.eventService.dispatchEvent(event);
|
4674 | };
|
4675 | ColumnModel.prototype.moveColumns = function (columnsToMoveKeys, toIndex, source) {
|
4676 | if (source === void 0) { source = "api"; }
|
4677 | this.columnAnimationService.start();
|
4678 | if (toIndex > this.gridColumns.length - columnsToMoveKeys.length) {
|
4679 | console.warn('AG Grid: tried to insert columns in invalid location, toIndex = ' + toIndex);
|
4680 | console.warn('AG Grid: remember that you should not count the moving columns when calculating the new index');
|
4681 | return;
|
4682 | }
|
4683 |
|
4684 | var columnsToMove = this.getGridColumns(columnsToMoveKeys);
|
4685 | var failedRules = !this.doesMovePassRules(columnsToMove, toIndex);
|
4686 | if (failedRules) {
|
4687 | return;
|
4688 | }
|
4689 | moveInArray(this.gridColumns, columnsToMove, toIndex);
|
4690 | this.updateDisplayedColumns(source);
|
4691 | var event = {
|
4692 | type: Events.EVENT_COLUMN_MOVED,
|
4693 | columns: columnsToMove,
|
4694 | column: columnsToMove.length === 1 ? columnsToMove[0] : null,
|
4695 | toIndex: toIndex,
|
4696 | api: this.gridApi,
|
4697 | columnApi: this.columnApi,
|
4698 | source: source
|
4699 | };
|
4700 | this.eventService.dispatchEvent(event);
|
4701 | this.columnAnimationService.finish();
|
4702 | };
|
4703 | ColumnModel.prototype.doesMovePassRules = function (columnsToMove, toIndex) {
|
4704 |
|
4705 | var proposedColumnOrder = this.gridColumns.slice();
|
4706 | moveInArray(proposedColumnOrder, columnsToMove, toIndex);
|
4707 |
|
4708 | if (!this.doesMovePassMarryChildren(proposedColumnOrder)) {
|
4709 | return false;
|
4710 | }
|
4711 | if (!this.doesMovePassLockedPositions(proposedColumnOrder)) {
|
4712 | return false;
|
4713 | }
|
4714 | return true;
|
4715 | };
|
4716 |
|
4717 |
|
4718 | ColumnModel.prototype.sortColumnsLikeGridColumns = function (cols) {
|
4719 | var _this = this;
|
4720 | if (!cols || cols.length <= 1) {
|
4721 | return;
|
4722 | }
|
4723 | var notAllColsInGridColumns = cols.filter(function (c) { return _this.gridColumns.indexOf(c) < 0; }).length > 0;
|
4724 | if (notAllColsInGridColumns) {
|
4725 | return;
|
4726 | }
|
4727 | cols.sort(function (a, b) {
|
4728 | var indexA = _this.gridColumns.indexOf(a);
|
4729 | var indexB = _this.gridColumns.indexOf(b);
|
4730 | return indexA - indexB;
|
4731 | });
|
4732 | };
|
4733 | ColumnModel.prototype.doesMovePassLockedPositions = function (proposedColumnOrder) {
|
4734 |
|
4735 | var lastPlacement = 0;
|
4736 | var rulePassed = true;
|
4737 | var lockPositionToPlacement = function (position) {
|
4738 | if (!position) {
|
4739 | return 1;
|
4740 | }
|
4741 | if (position === true) {
|
4742 | return 0;
|
4743 | }
|
4744 | return position === 'left' ? 0 : 2;
|
4745 | };
|
4746 | proposedColumnOrder.forEach(function (col) {
|
4747 | var placement = lockPositionToPlacement(col.getColDef().lockPosition);
|
4748 | if (placement < lastPlacement) {
|
4749 | rulePassed = false;
|
4750 | }
|
4751 | lastPlacement = placement;
|
4752 | });
|
4753 | return rulePassed;
|
4754 | };
|
4755 | ColumnModel.prototype.doesMovePassMarryChildren = function (allColumnsCopy) {
|
4756 | var rulePassed = true;
|
4757 | this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (child) {
|
4758 | if (!(child instanceof ProvidedColumnGroup)) {
|
4759 | return;
|
4760 | }
|
4761 | var columnGroup = child;
|
4762 | var colGroupDef = columnGroup.getColGroupDef();
|
4763 | var marryChildren = colGroupDef && colGroupDef.marryChildren;
|
4764 | if (!marryChildren) {
|
4765 | return;
|
4766 | }
|
4767 | var newIndexes = [];
|
4768 | columnGroup.getLeafColumns().forEach(function (col) {
|
4769 | var newColIndex = allColumnsCopy.indexOf(col);
|
4770 | newIndexes.push(newColIndex);
|
4771 | });
|
4772 | var maxIndex = Math.max.apply(Math, newIndexes);
|
4773 | var minIndex = Math.min.apply(Math, newIndexes);
|
4774 |
|
4775 | var spread = maxIndex - minIndex;
|
4776 | var maxSpread = columnGroup.getLeafColumns().length - 1;
|
4777 |
|
4778 | if (spread > maxSpread) {
|
4779 | rulePassed = false;
|
4780 | }
|
4781 |
|
4782 |
|
4783 | });
|
4784 | return rulePassed;
|
4785 | };
|
4786 | ColumnModel.prototype.moveColumn = function (key, toIndex, source) {
|
4787 | if (source === void 0) { source = "api"; }
|
4788 | this.moveColumns([key], toIndex, source);
|
4789 | };
|
4790 | ColumnModel.prototype.moveColumnByIndex = function (fromIndex, toIndex, source) {
|
4791 | if (source === void 0) { source = "api"; }
|
4792 | var column = this.gridColumns[fromIndex];
|
4793 | this.moveColumn(column, toIndex, source);
|
4794 | };
|
4795 | ColumnModel.prototype.getColumnDefs = function () {
|
4796 | var _this = this;
|
4797 | if (!this.primaryColumns) {
|
4798 | return;
|
4799 | }
|
4800 | var cols = this.primaryColumns.slice();
|
4801 | if (this.gridColsArePrimary) {
|
4802 | cols.sort(function (a, b) { return _this.gridColumns.indexOf(a) - _this.gridColumns.indexOf(b); });
|
4803 | }
|
4804 | else if (this.lastPrimaryOrder) {
|
4805 | cols.sort(function (a, b) { return _this.lastPrimaryOrder.indexOf(a) - _this.lastPrimaryOrder.indexOf(b); });
|
4806 | }
|
4807 | return this.columnDefFactory.buildColumnDefs(cols, this.rowGroupColumns, this.pivotColumns);
|
4808 | };
|
4809 |
|
4810 |
|
4811 |
|
4812 |
|
4813 | ColumnModel.prototype.getBodyContainerWidth = function () {
|
4814 | return this.bodyWidth;
|
4815 | };
|
4816 | ColumnModel.prototype.getContainerWidth = function (pinned) {
|
4817 | switch (pinned) {
|
4818 | case Constants.PINNED_LEFT:
|
4819 | return this.leftWidth;
|
4820 | case Constants.PINNED_RIGHT:
|
4821 | return this.rightWidth;
|
4822 | default:
|
4823 | return this.bodyWidth;
|
4824 | }
|
4825 | };
|
4826 |
|
4827 | ColumnModel.prototype.updateBodyWidths = function () {
|
4828 | var newBodyWidth = this.getWidthOfColsInList(this.displayedColumnsCenter);
|
4829 | var newLeftWidth = this.getWidthOfColsInList(this.displayedColumnsLeft);
|
4830 | var newRightWidth = this.getWidthOfColsInList(this.displayedColumnsRight);
|
4831 |
|
4832 |
|
4833 | this.bodyWidthDirty = this.bodyWidth !== newBodyWidth;
|
4834 | var atLeastOneChanged = this.bodyWidth !== newBodyWidth || this.leftWidth !== newLeftWidth || this.rightWidth !== newRightWidth;
|
4835 | if (atLeastOneChanged) {
|
4836 | this.bodyWidth = newBodyWidth;
|
4837 | this.leftWidth = newLeftWidth;
|
4838 | this.rightWidth = newRightWidth;
|
4839 |
|
4840 |
|
4841 | var event_3 = {
|
4842 | type: Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED,
|
4843 | api: this.gridApi,
|
4844 | columnApi: this.columnApi
|
4845 | };
|
4846 | this.eventService.dispatchEvent(event_3);
|
4847 | }
|
4848 | };
|
4849 |
|
4850 | ColumnModel.prototype.getValueColumns = function () {
|
4851 | return this.valueColumns ? this.valueColumns : [];
|
4852 | };
|
4853 |
|
4854 | ColumnModel.prototype.getPivotColumns = function () {
|
4855 | return this.pivotColumns ? this.pivotColumns : [];
|
4856 | };
|
4857 |
|
4858 | ColumnModel.prototype.isPivotActive = function () {
|
4859 | return this.pivotColumns && this.pivotColumns.length > 0 && this.pivotMode;
|
4860 | };
|
4861 |
|
4862 | ColumnModel.prototype.getRowGroupColumns = function () {
|
4863 | return this.rowGroupColumns ? this.rowGroupColumns : [];
|
4864 | };
|
4865 |
|
4866 | ColumnModel.prototype.getDisplayedCenterColumns = function () {
|
4867 | return this.displayedColumnsCenter;
|
4868 | };
|
4869 |
|
4870 | ColumnModel.prototype.getDisplayedLeftColumns = function () {
|
4871 | return this.displayedColumnsLeft;
|
4872 | };
|
4873 | ColumnModel.prototype.getDisplayedRightColumns = function () {
|
4874 | return this.displayedColumnsRight;
|
4875 | };
|
4876 | ColumnModel.prototype.getDisplayedColumns = function (type) {
|
4877 | switch (type) {
|
4878 | case Constants.PINNED_LEFT:
|
4879 | return this.getDisplayedLeftColumns();
|
4880 | case Constants.PINNED_RIGHT:
|
4881 | return this.getDisplayedRightColumns();
|
4882 | default:
|
4883 | return this.getDisplayedCenterColumns();
|
4884 | }
|
4885 | };
|
4886 |
|
4887 |
|
4888 |
|
4889 | ColumnModel.prototype.getAllPrimaryColumns = function () {
|
4890 | return this.primaryColumns ? this.primaryColumns.slice() : null;
|
4891 | };
|
4892 | ColumnModel.prototype.getSecondaryColumns = function () {
|
4893 | return this.secondaryColumns ? this.secondaryColumns.slice() : null;
|
4894 | };
|
4895 | ColumnModel.prototype.getAllColumnsForQuickFilter = function () {
|
4896 | return this.columnsForQuickFilter;
|
4897 | };
|
4898 |
|
4899 | ColumnModel.prototype.getAllGridColumns = function () {
|
4900 | return this.gridColumns;
|
4901 | };
|
4902 | ColumnModel.prototype.isEmpty = function () {
|
4903 | return missingOrEmpty(this.gridColumns);
|
4904 | };
|
4905 | ColumnModel.prototype.isRowGroupEmpty = function () {
|
4906 | return missingOrEmpty(this.rowGroupColumns);
|
4907 | };
|
4908 | ColumnModel.prototype.setColumnVisible = function (key, visible, source) {
|
4909 | if (source === void 0) { source = "api"; }
|
4910 | this.setColumnsVisible([key], visible, source);
|
4911 | };
|
4912 | ColumnModel.prototype.setColumnsVisible = function (keys, visible, source) {
|
4913 | var _this = this;
|
4914 | if (visible === void 0) { visible = false; }
|
4915 | if (source === void 0) { source = "api"; }
|
4916 | this.columnAnimationService.start();
|
4917 | this.actionOnGridColumns(keys, function (column) {
|
4918 | if (column.isVisible() !== visible) {
|
4919 | column.setVisible(visible, source);
|
4920 | return true;
|
4921 | }
|
4922 | return false;
|
4923 | }, source, function () {
|
4924 | var event = {
|
4925 | type: Events.EVENT_COLUMN_VISIBLE,
|
4926 | visible: visible,
|
4927 | column: null,
|
4928 | columns: null,
|
4929 | api: _this.gridApi,
|
4930 | columnApi: _this.columnApi,
|
4931 | source: source
|
4932 | };
|
4933 | return event;
|
4934 | });
|
4935 | this.columnAnimationService.finish();
|
4936 | };
|
4937 | ColumnModel.prototype.setColumnPinned = function (key, pinned, source) {
|
4938 | if (source === void 0) { source = "api"; }
|
4939 | if (key) {
|
4940 | this.setColumnsPinned([key], pinned, source);
|
4941 | }
|
4942 | };
|
4943 | ColumnModel.prototype.setColumnsPinned = function (keys, pinned, source) {
|
4944 | var _this = this;
|
4945 | if (source === void 0) { source = "api"; }
|
4946 | if (this.gridOptionsWrapper.getDomLayout() === 'print') {
|
4947 | console.warn("Changing the column pinning status is not allowed with domLayout='print'");
|
4948 | return;
|
4949 | }
|
4950 | this.columnAnimationService.start();
|
4951 | var actualPinned;
|
4952 | if (pinned === true || pinned === Constants.PINNED_LEFT) {
|
4953 | actualPinned = Constants.PINNED_LEFT;
|
4954 | }
|
4955 | else if (pinned === Constants.PINNED_RIGHT) {
|
4956 | actualPinned = Constants.PINNED_RIGHT;
|
4957 | }
|
4958 | else {
|
4959 | actualPinned = null;
|
4960 | }
|
4961 | this.actionOnGridColumns(keys, function (col) {
|
4962 | if (col.getPinned() !== actualPinned) {
|
4963 | col.setPinned(actualPinned);
|
4964 | return true;
|
4965 | }
|
4966 | return false;
|
4967 | }, source, function () {
|
4968 | var event = {
|
4969 | type: Events.EVENT_COLUMN_PINNED,
|
4970 | pinned: actualPinned,
|
4971 | column: null,
|
4972 | columns: null,
|
4973 | api: _this.gridApi,
|
4974 | columnApi: _this.columnApi,
|
4975 | source: source
|
4976 | };
|
4977 | return event;
|
4978 | });
|
4979 | this.columnAnimationService.finish();
|
4980 | };
|
4981 |
|
4982 |
|
4983 |
|
4984 |
|
4985 | ColumnModel.prototype.actionOnGridColumns = function (// the column keys this action will be on
|
4986 | keys,
|
4987 | // the action to do - if this returns false, the column was skipped
|
4988 | // and won't be included in the event
|
4989 | action,
|
4990 |
|
4991 | source, createEvent) {
|
4992 | var _this = this;
|
4993 | if (missingOrEmpty(keys)) {
|
4994 | return;
|
4995 | }
|
4996 | var updatedColumns = [];
|
4997 | keys.forEach(function (key) {
|
4998 | var column = _this.getGridColumn(key);
|
4999 | if (!column) {
|
5000 | return;
|
5001 | }
|
5002 |
|
5003 |
|
5004 | var resultOfAction = action(column);
|
5005 | if (resultOfAction !== false) {
|
5006 | updatedColumns.push(column);
|
5007 | }
|
5008 | });
|
5009 | if (!updatedColumns.length) {
|
5010 | return;
|
5011 | }
|
5012 | this.updateDisplayedColumns(source);
|
5013 | if (exists(createEvent) && createEvent) {
|
5014 | var event_4 = createEvent();
|
5015 | event_4.columns = updatedColumns;
|
5016 | event_4.column = updatedColumns.length === 1 ? updatedColumns[0] : null;
|
5017 | this.eventService.dispatchEvent(event_4);
|
5018 | }
|
5019 | };
|
5020 | ColumnModel.prototype.getDisplayedColBefore = function (col) {
|
5021 | var allDisplayedColumns = this.getAllDisplayedColumns();
|
5022 | var oldIndex = allDisplayedColumns.indexOf(col);
|
5023 | if (oldIndex > 0) {
|
5024 | return allDisplayedColumns[oldIndex - 1];
|
5025 | }
|
5026 | return null;
|
5027 | };
|
5028 |
|
5029 |
|
5030 | ColumnModel.prototype.getDisplayedColAfter = function (col) {
|
5031 | var allDisplayedColumns = this.getAllDisplayedColumns();
|
5032 | var oldIndex = allDisplayedColumns.indexOf(col);
|
5033 | if (oldIndex < (allDisplayedColumns.length - 1)) {
|
5034 | return allDisplayedColumns[oldIndex + 1];
|
5035 | }
|
5036 | return null;
|
5037 | };
|
5038 | ColumnModel.prototype.getDisplayedGroupAfter = function (columnGroup) {
|
5039 | return this.getDisplayedGroupAtDirection(columnGroup, 'After');
|
5040 | };
|
5041 | ColumnModel.prototype.getDisplayedGroupBefore = function (columnGroup) {
|
5042 | return this.getDisplayedGroupAtDirection(columnGroup, 'Before');
|
5043 | };
|
5044 | ColumnModel.prototype.getDisplayedGroupAtDirection = function (columnGroup, direction) {
|
5045 |
|
5046 | var requiredLevel = columnGroup.getProvidedColumnGroup().getLevel() + columnGroup.getPaddingLevel();
|
5047 | var colGroupLeafColumns = columnGroup.getDisplayedLeafColumns();
|
5048 | var col = direction === 'After' ? last(colGroupLeafColumns) : colGroupLeafColumns[0];
|
5049 | var getDisplayColMethod = "getDisplayedCol" + direction;
|
5050 | while (true) {
|
5051 |
|
5052 | var column = this[getDisplayColMethod](col);
|
5053 | if (!column) {
|
5054 | return null;
|
5055 | }
|
5056 | var groupPointer = this.getColumnGroupAtLevel(column, requiredLevel);
|
5057 | if (groupPointer !== columnGroup) {
|
5058 | return groupPointer;
|
5059 | }
|
5060 | }
|
5061 | };
|
5062 | ColumnModel.prototype.getColumnGroupAtLevel = function (column, level) {
|
5063 |
|
5064 | var groupPointer = column.getParent();
|
5065 | var originalGroupLevel;
|
5066 | var groupPointerLevel;
|
5067 | while (true) {
|
5068 | var groupPointerProvidedColumnGroup = groupPointer.getProvidedColumnGroup();
|
5069 | originalGroupLevel = groupPointerProvidedColumnGroup.getLevel();
|
5070 | groupPointerLevel = groupPointer.getPaddingLevel();
|
5071 | if (originalGroupLevel + groupPointerLevel <= level) {
|
5072 | break;
|
5073 | }
|
5074 | groupPointer = groupPointer.getParent();
|
5075 | }
|
5076 | return groupPointer;
|
5077 | };
|
5078 | ColumnModel.prototype.isPinningLeft = function () {
|
5079 | return this.displayedColumnsLeft.length > 0;
|
5080 | };
|
5081 | ColumnModel.prototype.isPinningRight = function () {
|
5082 | return this.displayedColumnsRight.length > 0;
|
5083 | };
|
5084 | ColumnModel.prototype.getPrimaryAndSecondaryAndAutoColumns = function () {
|
5085 | var _a;
|
5086 | return (_a = []).concat.apply(_a, __spread([
|
5087 | this.primaryColumns || [],
|
5088 | this.groupAutoColumns || [],
|
5089 | this.secondaryColumns || [],
|
5090 | ]));
|
5091 | };
|
5092 | ColumnModel.prototype.getPrimaryAndAutoGroupCols = function () {
|
5093 | var _a;
|
5094 | return (_a = []).concat.apply(_a, __spread([
|
5095 | this.primaryColumns || [],
|
5096 | this.groupAutoColumns || [],
|
5097 | ]));
|
5098 | };
|
5099 | ColumnModel.prototype.getPrimaryAndSecondaryColumns = function () {
|
5100 | var _a;
|
5101 | return (_a = []).concat.apply(_a, __spread([
|
5102 | this.primaryColumns || [],
|
5103 | this.secondaryColumns || [],
|
5104 | ]));
|
5105 | };
|
5106 | ColumnModel.prototype.createStateItemFromColumn = function (column) {
|
5107 | var rowGroupIndex = column.isRowGroupActive() ? this.rowGroupColumns.indexOf(column) : null;
|
5108 | var pivotIndex = column.isPivotActive() ? this.pivotColumns.indexOf(column) : null;
|
5109 | var aggFunc = column.isValueActive() ? column.getAggFunc() : null;
|
5110 | var sort = column.getSort() != null ? column.getSort() : null;
|
5111 | var sortIndex = column.getSortIndex() != null ? column.getSortIndex() : null;
|
5112 | var flex = column.getFlex() != null && column.getFlex() > 0 ? column.getFlex() : null;
|
5113 | var res = {
|
5114 | colId: column.getColId(),
|
5115 | width: column.getActualWidth(),
|
5116 | hide: !column.isVisible(),
|
5117 | pinned: column.getPinned(),
|
5118 | sort: sort,
|
5119 | sortIndex: sortIndex,
|
5120 | aggFunc: aggFunc,
|
5121 | rowGroup: column.isRowGroupActive(),
|
5122 | rowGroupIndex: rowGroupIndex,
|
5123 | pivot: column.isPivotActive(),
|
5124 | pivotIndex: pivotIndex,
|
5125 | flex: flex
|
5126 | };
|
5127 | return res;
|
5128 | };
|
5129 | ColumnModel.prototype.getColumnState = function () {
|
5130 | if (missing(this.primaryColumns) || !this.isAlive()) {
|
5131 | return [];
|
5132 | }
|
5133 | var colsForState = this.getPrimaryAndSecondaryAndAutoColumns();
|
5134 | var res = colsForState.map(this.createStateItemFromColumn.bind(this));
|
5135 | this.orderColumnStateList(res);
|
5136 | return res;
|
5137 | };
|
5138 | ColumnModel.prototype.orderColumnStateList = function (columnStateList) {
|
5139 |
|
5140 | var colIdToGridIndexMap = convertToMap(this.gridColumns.map(function (col, index) { return [col.getColId(), index]; }));
|
5141 | columnStateList.sort(function (itemA, itemB) {
|
5142 | var posA = colIdToGridIndexMap.has(itemA.colId) ? colIdToGridIndexMap.get(itemA.colId) : -1;
|
5143 | var posB = colIdToGridIndexMap.has(itemB.colId) ? colIdToGridIndexMap.get(itemB.colId) : -1;
|
5144 | return posA - posB;
|
5145 | });
|
5146 | };
|
5147 | ColumnModel.prototype.resetColumnState = function (source) {
|
5148 |
|
5149 |
|
5150 |
|
5151 | if (source === void 0) { source = "api"; }
|
5152 |
|
5153 | var primaryColumns = this.getColumnsFromTree(this.primaryColumnTree);
|
5154 | var columnStates = [];
|
5155 |
|
5156 |
|
5157 |
|
5158 | var letRowGroupIndex = 1000;
|
5159 | var letPivotIndex = 1000;
|
5160 | var colsToProcess = [];
|
5161 | if (this.groupAutoColumns) {
|
5162 | colsToProcess = colsToProcess.concat(this.groupAutoColumns);
|
5163 | }
|
5164 | if (primaryColumns) {
|
5165 | colsToProcess = colsToProcess.concat(primaryColumns);
|
5166 | }
|
5167 | colsToProcess.forEach(function (column) {
|
5168 | var getValueOrNull = function (a, b) { return a != null ? a : b != null ? b : null; };
|
5169 | var colDef = column.getColDef();
|
5170 | var sort = getValueOrNull(colDef.sort, colDef.initialSort);
|
5171 | var sortIndex = getValueOrNull(colDef.sortIndex, colDef.initialSortIndex);
|
5172 | var hide = getValueOrNull(colDef.hide, colDef.initialHide);
|
5173 | var pinned = getValueOrNull(colDef.pinned, colDef.initialPinned);
|
5174 | var width = getValueOrNull(colDef.width, colDef.initialWidth);
|
5175 | var flex = getValueOrNull(colDef.flex, colDef.initialFlex);
|
5176 | var rowGroupIndex = getValueOrNull(colDef.rowGroupIndex, colDef.initialRowGroupIndex);
|
5177 | var rowGroup = getValueOrNull(colDef.rowGroup, colDef.initialRowGroup);
|
5178 | if (rowGroupIndex == null && (rowGroup == null || rowGroup == false)) {
|
5179 | rowGroupIndex = null;
|
5180 | rowGroup = null;
|
5181 | }
|
5182 | var pivotIndex = getValueOrNull(colDef.pivotIndex, colDef.initialPivotIndex);
|
5183 | var pivot = getValueOrNull(colDef.pivot, colDef.initialPivot);
|
5184 | if (pivotIndex == null && (pivot == null || pivot == false)) {
|
5185 | pivotIndex = null;
|
5186 | pivot = null;
|
5187 | }
|
5188 | var aggFunc = getValueOrNull(colDef.aggFunc, colDef.initialAggFunc);
|
5189 | var stateItem = {
|
5190 | colId: column.getColId(),
|
5191 | sort: sort,
|
5192 | sortIndex: sortIndex,
|
5193 | hide: hide,
|
5194 | pinned: pinned,
|
5195 | width: width,
|
5196 | flex: flex,
|
5197 | rowGroup: rowGroup,
|
5198 | rowGroupIndex: rowGroupIndex,
|
5199 | pivot: pivot,
|
5200 | pivotIndex: pivotIndex,
|
5201 | aggFunc: aggFunc,
|
5202 | };
|
5203 | if (missing(rowGroupIndex) && rowGroup) {
|
5204 | stateItem.rowGroupIndex = letRowGroupIndex++;
|
5205 | }
|
5206 | if (missing(pivotIndex) && pivot) {
|
5207 | stateItem.pivotIndex = letPivotIndex++;
|
5208 | }
|
5209 | columnStates.push(stateItem);
|
5210 | });
|
5211 | this.applyColumnState({ state: columnStates, applyOrder: true }, source);
|
5212 | };
|
5213 | ColumnModel.prototype.applyColumnState = function (params, source) {
|
5214 | var _this = this;
|
5215 | if (source === void 0) { source = "api"; }
|
5216 | if (missingOrEmpty(this.primaryColumns)) {
|
5217 | return false;
|
5218 | }
|
5219 | if (params && params.state && !params.state.forEach) {
|
5220 | 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.');
|
5221 | return false;
|
5222 | }
|
5223 | var applyStates = function (states, existingColumns, getById) {
|
5224 | var raiseEventsFunc = _this.compareColumnStatesAndRaiseEvents(source);
|
5225 | _this.autoGroupsNeedBuilding = true;
|
5226 |
|
5227 | var columnsWithNoState = existingColumns.slice();
|
5228 | var rowGroupIndexes = {};
|
5229 | var pivotIndexes = {};
|
5230 | var autoGroupColumnStates = [];
|
5231 |
|
5232 |
|
5233 | var unmatchedAndAutoStates = [];
|
5234 | var unmatchedCount = 0;
|
5235 | var previousRowGroupCols = _this.rowGroupColumns.slice();
|
5236 | var previousPivotCols = _this.pivotColumns.slice();
|
5237 | states.forEach(function (state) {
|
5238 | var colId = state.colId || '';
|
5239 |
|
5240 | var isAutoGroupColumn = colId.startsWith(Constants.GROUP_AUTO_COLUMN_ID);
|
5241 | if (isAutoGroupColumn) {
|
5242 | autoGroupColumnStates.push(state);
|
5243 | unmatchedAndAutoStates.push(state);
|
5244 | return;
|
5245 | }
|
5246 | var column = getById(colId);
|
5247 | if (!column) {
|
5248 | unmatchedAndAutoStates.push(state);
|
5249 | unmatchedCount += 1;
|
5250 | }
|
5251 | else {
|
5252 | _this.syncColumnWithStateItem(column, state, params.defaultState, rowGroupIndexes, pivotIndexes, false, source);
|
5253 | removeFromArray(columnsWithNoState, column);
|
5254 | }
|
5255 | });
|
5256 |
|
5257 | var applyDefaultsFunc = function (col) {
|
5258 | return _this.syncColumnWithStateItem(col, null, params.defaultState, rowGroupIndexes, pivotIndexes, false, source);
|
5259 | };
|
5260 | columnsWithNoState.forEach(applyDefaultsFunc);
|
5261 |
|
5262 | var comparator = function (indexes, oldList, colA, colB) {
|
5263 | var indexA = indexes[colA.getId()];
|
5264 | var indexB = indexes[colB.getId()];
|
5265 | var aHasIndex = indexA != null;
|
5266 | var bHasIndex = indexB != null;
|
5267 | if (aHasIndex && bHasIndex) {
|
5268 |
|
5269 | return indexA - indexB;
|
5270 | }
|
5271 | if (aHasIndex) {
|
5272 |
|
5273 | return -1;
|
5274 | }
|
5275 | if (bHasIndex) {
|
5276 |
|
5277 | return 1;
|
5278 | }
|
5279 | var oldIndexA = oldList.indexOf(colA);
|
5280 | var oldIndexB = oldList.indexOf(colB);
|
5281 | var aHasOldIndex = oldIndexA >= 0;
|
5282 | var bHasOldIndex = oldIndexB >= 0;
|
5283 | if (aHasOldIndex && bHasOldIndex) {
|
5284 |
|
5285 | return oldIndexA - oldIndexB;
|
5286 | }
|
5287 | if (aHasOldIndex) {
|
5288 |
|
5289 | return -1;
|
5290 | }
|
5291 |
|
5292 |
|
5293 | return 1;
|
5294 | };
|
5295 | _this.rowGroupColumns.sort(comparator.bind(_this, rowGroupIndexes, previousRowGroupCols));
|
5296 | _this.pivotColumns.sort(comparator.bind(_this, pivotIndexes, previousPivotCols));
|
5297 | _this.updateGridColumns();
|
5298 |
|
5299 | var autoGroupColsCopy = _this.groupAutoColumns ? _this.groupAutoColumns.slice() : [];
|
5300 | autoGroupColumnStates.forEach(function (stateItem) {
|
5301 | var autoCol = _this.getAutoColumn(stateItem.colId);
|
5302 | removeFromArray(autoGroupColsCopy, autoCol);
|
5303 | _this.syncColumnWithStateItem(autoCol, stateItem, params.defaultState, null, null, true, source);
|
5304 | });
|
5305 |
|
5306 | autoGroupColsCopy.forEach(applyDefaultsFunc);
|
5307 | _this.applyOrderAfterApplyState(params);
|
5308 | _this.updateDisplayedColumns(source);
|
5309 | _this.dispatchEverythingChanged(source);
|
5310 | raiseEventsFunc();
|
5311 | return { unmatchedAndAutoStates: unmatchedAndAutoStates, unmatchedCount: unmatchedCount };
|
5312 | };
|
5313 | this.columnAnimationService.start();
|
5314 | var _a = applyStates(params.state || [], this.primaryColumns || [], function (id) { return _this.getPrimaryColumn(id); }), unmatchedAndAutoStates = _a.unmatchedAndAutoStates, unmatchedCount = _a.unmatchedCount;
|
5315 |
|
5316 |
|
5317 | if (unmatchedAndAutoStates.length > 0 || exists(params.defaultState)) {
|
5318 | unmatchedCount = applyStates(unmatchedAndAutoStates, this.secondaryColumns || [], function (id) { return _this.getSecondaryColumn(id); }).unmatchedCount;
|
5319 | }
|
5320 | this.columnAnimationService.finish();
|
5321 | return unmatchedCount === 0;
|
5322 | };
|
5323 | ColumnModel.prototype.applyOrderAfterApplyState = function (params) {
|
5324 | var _this = this;
|
5325 | if (!params.applyOrder || !params.state) {
|
5326 | return;
|
5327 | }
|
5328 | var newOrder = [];
|
5329 | var processedColIds = {};
|
5330 | params.state.forEach(function (item) {
|
5331 | if (!item.colId || processedColIds[item.colId]) {
|
5332 | return;
|
5333 | }
|
5334 | var col = _this.gridColumnsMap[item.colId];
|
5335 | if (col) {
|
5336 | newOrder.push(col);
|
5337 | processedColIds[item.colId] = true;
|
5338 | }
|
5339 | });
|
5340 |
|
5341 | var autoGroupInsertIndex = 0;
|
5342 | this.gridColumns.forEach(function (col) {
|
5343 | var colId = col.getColId();
|
5344 | var alreadyProcessed = processedColIds[colId] != null;
|
5345 | if (alreadyProcessed) {
|
5346 | return;
|
5347 | }
|
5348 | var isAutoGroupCol = colId.startsWith(Constants.GROUP_AUTO_COLUMN_ID);
|
5349 | if (isAutoGroupCol) {
|
5350 |
|
5351 |
|
5352 |
|
5353 |
|
5354 | insertIntoArray(newOrder, col, autoGroupInsertIndex++);
|
5355 | }
|
5356 | else {
|
5357 |
|
5358 | newOrder.push(col);
|
5359 | }
|
5360 | });
|
5361 |
|
5362 |
|
5363 |
|
5364 |
|
5365 | newOrder = this.placeLockedColumns(newOrder);
|
5366 | if (!this.doesMovePassMarryChildren(newOrder)) {
|
5367 | console.warn('AG Grid: Applying column order broke a group where columns should be married together. Applying new order has been discarded.');
|
5368 | return;
|
5369 | }
|
5370 | this.gridColumns = newOrder;
|
5371 | };
|
5372 | ColumnModel.prototype.compareColumnStatesAndRaiseEvents = function (source) {
|
5373 | var _this = this;
|
5374 | var startState = {
|
5375 | rowGroupColumns: this.rowGroupColumns.slice(),
|
5376 | pivotColumns: this.pivotColumns.slice(),
|
5377 | valueColumns: this.valueColumns.slice()
|
5378 | };
|
5379 | var columnStateBefore = this.getColumnState();
|
5380 | var columnStateBeforeMap = {};
|
5381 | columnStateBefore.forEach(function (col) {
|
5382 | columnStateBeforeMap[col.colId] = col;
|
5383 | });
|
5384 | return function () {
|
5385 | if (_this.gridOptionsWrapper.isSuppressColumnStateEvents()) {
|
5386 | return;
|
5387 | }
|
5388 | var colsForState = _this.getPrimaryAndSecondaryAndAutoColumns();
|
5389 |
|
5390 | var raiseWhenListsDifferent = function (eventType, colsBefore, colsAfter, idMapper) {
|
5391 | var beforeList = colsBefore.map(idMapper);
|
5392 | var afterList = colsAfter.map(idMapper);
|
5393 | var unchanged = areEqual(beforeList, afterList);
|
5394 | if (unchanged) {
|
5395 | return;
|
5396 | }
|
5397 |
|
5398 | var event = {
|
5399 | type: eventType,
|
5400 | columns: colsAfter,
|
5401 | column: colsAfter.length === 1 ? colsAfter[0] : null,
|
5402 | api: _this.gridApi,
|
5403 | columnApi: _this.columnApi,
|
5404 | source: source
|
5405 | };
|
5406 | _this.eventService.dispatchEvent(event);
|
5407 | };
|
5408 |
|
5409 | var getChangedColumns = function (changedPredicate) {
|
5410 | var changedColumns = [];
|
5411 | colsForState.forEach(function (column) {
|
5412 | var colStateBefore = columnStateBeforeMap[column.getColId()];
|
5413 | if (colStateBefore && changedPredicate(colStateBefore, column)) {
|
5414 | changedColumns.push(column);
|
5415 | }
|
5416 | });
|
5417 | return changedColumns;
|
5418 | };
|
5419 | var columnIdMapper = function (c) { return c.getColId(); };
|
5420 | raiseWhenListsDifferent(Events.EVENT_COLUMN_ROW_GROUP_CHANGED, startState.rowGroupColumns, _this.rowGroupColumns, columnIdMapper);
|
5421 | raiseWhenListsDifferent(Events.EVENT_COLUMN_PIVOT_CHANGED, startState.pivotColumns, _this.pivotColumns, columnIdMapper);
|
5422 | var valueChangePredicate = function (cs, c) {
|
5423 | var oldActive = cs.aggFunc != null;
|
5424 | var activeChanged = oldActive != c.isValueActive();
|
5425 |
|
5426 | var aggFuncChanged = oldActive && cs.aggFunc != c.getAggFunc();
|
5427 | return activeChanged || aggFuncChanged;
|
5428 | };
|
5429 | var changedValues = getChangedColumns(valueChangePredicate);
|
5430 | if (changedValues.length > 0) {
|
5431 |
|
5432 |
|
5433 |
|
5434 |
|
5435 |
|
5436 | _this.fireColumnEvent(Events.EVENT_COLUMN_VALUE_CHANGED, _this.valueColumns, source);
|
5437 | }
|
5438 | var resizeChangePredicate = function (cs, c) { return cs.width != c.getActualWidth(); };
|
5439 | _this.fireColumnResizedEvent(getChangedColumns(resizeChangePredicate), true, source);
|
5440 | var pinnedChangePredicate = function (cs, c) { return cs.pinned != c.getPinned(); };
|
5441 | _this.raiseColumnPinnedEvent(getChangedColumns(pinnedChangePredicate), source);
|
5442 | var visibilityChangePredicate = function (cs, c) { return cs.hide == c.isVisible(); };
|
5443 | _this.raiseColumnVisibleEvent(getChangedColumns(visibilityChangePredicate), source);
|
5444 | var sortChangePredicate = function (cs, c) { return cs.sort != c.getSort() || cs.sortIndex != c.getSortIndex(); };
|
5445 | if (getChangedColumns(sortChangePredicate).length > 0) {
|
5446 | _this.sortController.dispatchSortChangedEvents(source);
|
5447 | }
|
5448 |
|
5449 | _this.raiseColumnMovedEvent(columnStateBefore, source);
|
5450 | };
|
5451 | };
|
5452 | ColumnModel.prototype.raiseColumnPinnedEvent = function (changedColumns, source) {
|
5453 | if (!changedColumns.length) {
|
5454 | return;
|
5455 | }
|
5456 |
|
5457 | var column = changedColumns.length === 1 ? changedColumns[0] : null;
|
5458 |
|
5459 | var pinned = this.getCommonValue(changedColumns, function (col) { return col.getPinned(); });
|
5460 | var event = {
|
5461 | type: Events.EVENT_COLUMN_PINNED,
|
5462 |
|
5463 | pinned: pinned != null ? pinned : null,
|
5464 | columns: changedColumns,
|
5465 | column: column,
|
5466 | api: this.gridApi,
|
5467 | columnApi: this.columnApi,
|
5468 | source: source
|
5469 | };
|
5470 | this.eventService.dispatchEvent(event);
|
5471 | };
|
5472 | ColumnModel.prototype.getCommonValue = function (cols, valueGetter) {
|
5473 | if (!cols || cols.length == 0) {
|
5474 | return undefined;
|
5475 | }
|
5476 |
|
5477 | var firstValue = valueGetter(cols[0]);
|
5478 | for (var i = 1; i < cols.length; i++) {
|
5479 | if (firstValue !== valueGetter(cols[i])) {
|
5480 |
|
5481 | return undefined;
|
5482 | }
|
5483 | }
|
5484 | return firstValue;
|
5485 | };
|
5486 | ColumnModel.prototype.raiseColumnVisibleEvent = function (changedColumns, source) {
|
5487 | if (!changedColumns.length) {
|
5488 | return;
|
5489 | }
|
5490 |
|
5491 | var column = changedColumns.length === 1 ? changedColumns[0] : null;
|
5492 |
|
5493 | var visible = this.getCommonValue(changedColumns, function (col) { return col.isVisible(); });
|
5494 | var event = {
|
5495 | type: Events.EVENT_COLUMN_VISIBLE,
|
5496 | visible: visible,
|
5497 | columns: changedColumns,
|
5498 | column: column,
|
5499 | api: this.gridApi,
|
5500 | columnApi: this.columnApi,
|
5501 | source: source
|
5502 | };
|
5503 | this.eventService.dispatchEvent(event);
|
5504 | };
|
5505 | ColumnModel.prototype.raiseColumnMovedEvent = function (colStateBefore, source) {
|
5506 |
|
5507 | var _this = this;
|
5508 | var colStateAfter = this.getColumnState();
|
5509 | var colStateAfterMapped = {};
|
5510 | colStateAfter.forEach(function (s) { return colStateAfterMapped[s.colId] = s; });
|
5511 |
|
5512 | var colsIntersectIds = {};
|
5513 | colStateBefore.forEach(function (s) {
|
5514 | if (colStateAfterMapped[s.colId]) {
|
5515 | colsIntersectIds[s.colId] = true;
|
5516 | }
|
5517 | });
|
5518 |
|
5519 | var beforeFiltered = colStateBefore.filter(function (c) { return colsIntersectIds[c.colId]; });
|
5520 | var afterFiltered = colStateAfter.filter(function (c) { return colsIntersectIds[c.colId]; });
|
5521 |
|
5522 | var movedColumns = [];
|
5523 | afterFiltered.forEach(function (csAfter, index) {
|
5524 | var csBefore = beforeFiltered && beforeFiltered[index];
|
5525 | if (csBefore && csBefore.colId !== csAfter.colId) {
|
5526 | var gridCol = _this.getGridColumn(csBefore.colId);
|
5527 | if (gridCol) {
|
5528 | movedColumns.push(gridCol);
|
5529 | }
|
5530 | }
|
5531 | });
|
5532 | if (!movedColumns.length) {
|
5533 | return;
|
5534 | }
|
5535 | var event = {
|
5536 | type: Events.EVENT_COLUMN_MOVED,
|
5537 | columns: movedColumns,
|
5538 | column: null,
|
5539 | api: this.gridApi,
|
5540 | columnApi: this.columnApi,
|
5541 | source: source
|
5542 | };
|
5543 | this.eventService.dispatchEvent(event);
|
5544 | };
|
5545 | ColumnModel.prototype.syncColumnWithStateItem = function (column, stateItem, defaultState, rowGroupIndexes, pivotIndexes, autoCol, source) {
|
5546 | if (!column) {
|
5547 | return;
|
5548 | }
|
5549 | var getValue = function (key1, key2) {
|
5550 | var obj = { value1: undefined, value2: undefined };
|
5551 | var calculated = false;
|
5552 | if (stateItem) {
|
5553 | if (stateItem[key1] !== undefined) {
|
5554 | obj.value1 = stateItem[key1];
|
5555 | calculated = true;
|
5556 | }
|
5557 | if (exists(key2) && stateItem[key2] !== undefined) {
|
5558 | obj.value2 = stateItem[key2];
|
5559 | calculated = true;
|
5560 | }
|
5561 | }
|
5562 | if (!calculated && defaultState) {
|
5563 | if (defaultState[key1] !== undefined) {
|
5564 | obj.value1 = defaultState[key1];
|
5565 | }
|
5566 | if (exists(key2) && defaultState[key2] !== undefined) {
|
5567 | obj.value2 = defaultState[key2];
|
5568 | }
|
5569 | }
|
5570 | return obj;
|
5571 | };
|
5572 |
|
5573 | var hide = getValue('hide').value1;
|
5574 | if (hide !== undefined) {
|
5575 | column.setVisible(!hide, source);
|
5576 | }
|
5577 |
|
5578 | var pinned = getValue('pinned').value1;
|
5579 | if (pinned !== undefined) {
|
5580 | column.setPinned(pinned);
|
5581 | }
|
5582 |
|
5583 | var minColWidth = this.columnUtils.calculateColMinWidth(column.getColDef());
|
5584 |
|
5585 | var flex = getValue('flex').value1;
|
5586 | if (flex !== undefined) {
|
5587 | column.setFlex(flex);
|
5588 | }
|
5589 |
|
5590 | var noFlexThisCol = column.getFlex() <= 0;
|
5591 | if (noFlexThisCol) {
|
5592 |
|
5593 | var width = getValue('width').value1;
|
5594 | if (width != null) {
|
5595 | if (minColWidth != null && width >= minColWidth) {
|
5596 | column.setActualWidth(width, source);
|
5597 | }
|
5598 | }
|
5599 | }
|
5600 | var sort = getValue('sort').value1;
|
5601 | if (sort !== undefined) {
|
5602 | if (sort === Constants.SORT_DESC || sort === Constants.SORT_ASC) {
|
5603 | column.setSort(sort, source);
|
5604 | }
|
5605 | else {
|
5606 | column.setSort(undefined, source);
|
5607 | }
|
5608 | }
|
5609 | var sortIndex = getValue('sortIndex').value1;
|
5610 | if (sortIndex !== undefined) {
|
5611 | column.setSortIndex(sortIndex);
|
5612 | }
|
5613 |
|
5614 | if (autoCol || !column.isPrimary()) {
|
5615 | return;
|
5616 | }
|
5617 | var aggFunc = getValue('aggFunc').value1;
|
5618 | if (aggFunc !== undefined) {
|
5619 | if (typeof aggFunc === 'string') {
|
5620 | column.setAggFunc(aggFunc);
|
5621 | if (!column.isValueActive()) {
|
5622 | column.setValueActive(true, source);
|
5623 | this.valueColumns.push(column);
|
5624 | }
|
5625 | }
|
5626 | else {
|
5627 | if (exists(aggFunc)) {
|
5628 | console.warn('AG Grid: stateItem.aggFunc must be a string. if using your own aggregation ' +
|
5629 | 'functions, register the functions first before using them in get/set state. This is because it is ' +
|
5630 | 'intended for the column state to be stored and retrieved as simple JSON.');
|
5631 | }
|
5632 |
|
5633 |
|
5634 |
|
5635 | if (column.isValueActive()) {
|
5636 | column.setValueActive(false, source);
|
5637 | removeFromArray(this.valueColumns, column);
|
5638 | }
|
5639 | }
|
5640 | }
|
5641 | var _a = getValue('rowGroup', 'rowGroupIndex'), rowGroup = _a.value1, rowGroupIndex = _a.value2;
|
5642 | if (rowGroup !== undefined || rowGroupIndex !== undefined) {
|
5643 | if (typeof rowGroupIndex === 'number' || rowGroup) {
|
5644 | if (!column.isRowGroupActive()) {
|
5645 | column.setRowGroupActive(true, source);
|
5646 | this.rowGroupColumns.push(column);
|
5647 | }
|
5648 | if (rowGroupIndexes && typeof rowGroupIndex === 'number') {
|
5649 | rowGroupIndexes[column.getId()] = rowGroupIndex;
|
5650 | }
|
5651 | }
|
5652 | else {
|
5653 | if (column.isRowGroupActive()) {
|
5654 | column.setRowGroupActive(false, source);
|
5655 | removeFromArray(this.rowGroupColumns, column);
|
5656 | }
|
5657 | }
|
5658 | }
|
5659 | var _b = getValue('pivot', 'pivotIndex'), pivot = _b.value1, pivotIndex = _b.value2;
|
5660 | if (pivot !== undefined || pivotIndex !== undefined) {
|
5661 | if (typeof pivotIndex === 'number' || pivot) {
|
5662 | if (!column.isPivotActive()) {
|
5663 | column.setPivotActive(true, source);
|
5664 | this.pivotColumns.push(column);
|
5665 | }
|
5666 | if (pivotIndexes && typeof pivotIndex === 'number') {
|
5667 | pivotIndexes[column.getId()] = pivotIndex;
|
5668 | }
|
5669 | }
|
5670 | else {
|
5671 | if (column.isPivotActive()) {
|
5672 | column.setPivotActive(false, source);
|
5673 | removeFromArray(this.pivotColumns, column);
|
5674 | }
|
5675 | }
|
5676 | }
|
5677 | };
|
5678 | ColumnModel.prototype.getGridColumns = function (keys) {
|
5679 | return this.getColumns(keys, this.getGridColumn.bind(this));
|
5680 | };
|
5681 | ColumnModel.prototype.getColumns = function (keys, columnLookupCallback) {
|
5682 | var foundColumns = [];
|
5683 | if (keys) {
|
5684 | keys.forEach(function (key) {
|
5685 | var column = columnLookupCallback(key);
|
5686 | if (column) {
|
5687 | foundColumns.push(column);
|
5688 | }
|
5689 | });
|
5690 | }
|
5691 | return foundColumns;
|
5692 | };
|
5693 |
|
5694 | ColumnModel.prototype.getColumnWithValidation = function (key) {
|
5695 | if (key == null) {
|
5696 | return null;
|
5697 | }
|
5698 | var column = this.getGridColumn(key);
|
5699 | if (!column) {
|
5700 | console.warn('AG Grid: could not find column ' + key);
|
5701 | }
|
5702 | return column;
|
5703 | };
|
5704 | ColumnModel.prototype.getPrimaryColumn = function (key) {
|
5705 | if (!this.primaryColumns) {
|
5706 | return null;
|
5707 | }
|
5708 | return this.getColumn(key, this.primaryColumns, this.primaryColumnsMap);
|
5709 | };
|
5710 | ColumnModel.prototype.getGridColumn = function (key) {
|
5711 | return this.getColumn(key, this.gridColumns, this.gridColumnsMap);
|
5712 | };
|
5713 | ColumnModel.prototype.getSecondaryColumn = function (key) {
|
5714 | if (!this.secondaryColumns) {
|
5715 | return null;
|
5716 | }
|
5717 | return this.getColumn(key, this.secondaryColumns, this.secondaryColumnsMap);
|
5718 | };
|
5719 | ColumnModel.prototype.getColumn = function (key, columnList, columnMap) {
|
5720 | if (!key) {
|
5721 | return null;
|
5722 | }
|
5723 |
|
5724 |
|
5725 | if (typeof key == 'string' && columnMap[key]) {
|
5726 | return columnMap[key];
|
5727 | }
|
5728 | for (var i = 0; i < columnList.length; i++) {
|
5729 | if (this.columnsMatch(columnList[i], key)) {
|
5730 | return columnList[i];
|
5731 | }
|
5732 | }
|
5733 | return this.getAutoColumn(key);
|
5734 | };
|
5735 | ColumnModel.prototype.getAutoColumn = function (key) {
|
5736 | var _this = this;
|
5737 | if (!this.groupAutoColumns ||
|
5738 | !exists(this.groupAutoColumns) ||
|
5739 | missing(this.groupAutoColumns)) {
|
5740 | return null;
|
5741 | }
|
5742 | return this.groupAutoColumns.find(function (groupCol) { return _this.columnsMatch(groupCol, key); }) || null;
|
5743 | };
|
5744 | ColumnModel.prototype.columnsMatch = function (column, key) {
|
5745 | var columnMatches = column === key;
|
5746 | var colDefMatches = column.getColDef() === key;
|
5747 | var idMatches = column.getColId() == key;
|
5748 | return columnMatches || colDefMatches || idMatches;
|
5749 | };
|
5750 | ColumnModel.prototype.getDisplayNameForColumn = function (column, location, includeAggFunc) {
|
5751 | if (includeAggFunc === void 0) { includeAggFunc = false; }
|
5752 | if (!column) {
|
5753 | return null;
|
5754 | }
|
5755 | var headerName = this.getHeaderName(column.getColDef(), column, null, null, location);
|
5756 | if (includeAggFunc) {
|
5757 | return this.wrapHeaderNameWithAggFunc(column, headerName);
|
5758 | }
|
5759 | return headerName;
|
5760 | };
|
5761 | ColumnModel.prototype.getDisplayNameForProvidedColumnGroup = function (columnGroup, providedColumnGroup, location) {
|
5762 | var colGroupDef = providedColumnGroup ? providedColumnGroup.getColGroupDef() : null;
|
5763 | if (colGroupDef) {
|
5764 | return this.getHeaderName(colGroupDef, null, columnGroup, providedColumnGroup, location);
|
5765 | }
|
5766 | return null;
|
5767 | };
|
5768 | ColumnModel.prototype.getDisplayNameForColumnGroup = function (columnGroup, location) {
|
5769 | return this.getDisplayNameForProvidedColumnGroup(columnGroup, columnGroup.getProvidedColumnGroup(), location);
|
5770 | };
|
5771 |
|
5772 | ColumnModel.prototype.getHeaderName = function (colDef, column, columnGroup, providedColumnGroup, location) {
|
5773 | var headerValueGetter = colDef.headerValueGetter;
|
5774 | if (headerValueGetter) {
|
5775 | var params = {
|
5776 | colDef: colDef,
|
5777 | column: column,
|
5778 | columnGroup: columnGroup,
|
5779 | providedColumnGroup: providedColumnGroup,
|
5780 | location: location,
|
5781 | api: this.gridOptionsWrapper.getApi(),
|
5782 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
5783 | context: this.gridOptionsWrapper.getContext()
|
5784 | };
|
5785 | if (typeof headerValueGetter === 'function') {
|
5786 |
|
5787 | return headerValueGetter(params);
|
5788 | }
|
5789 | else if (typeof headerValueGetter === 'string') {
|
5790 |
|
5791 | return this.expressionService.evaluate(headerValueGetter, params);
|
5792 | }
|
5793 | console.warn('ag-grid: headerValueGetter must be a function or a string');
|
5794 | return '';
|
5795 | }
|
5796 | else if (colDef.headerName != null) {
|
5797 | return colDef.headerName;
|
5798 | }
|
5799 | else if (colDef.field) {
|
5800 | return camelCaseToHumanText(colDef.field);
|
5801 | }
|
5802 | return '';
|
5803 | };
|
5804 | ColumnModel.prototype.wrapHeaderNameWithAggFunc = function (column, headerName) {
|
5805 | if (this.gridOptionsWrapper.isSuppressAggFuncInHeader()) {
|
5806 | return headerName;
|
5807 | }
|
5808 |
|
5809 | var pivotValueColumn = column.getColDef().pivotValueColumn;
|
5810 | var pivotActiveOnThisColumn = exists(pivotValueColumn);
|
5811 | var aggFunc = null;
|
5812 | var aggFuncFound;
|
5813 |
|
5814 | if (pivotActiveOnThisColumn) {
|
5815 | var isCollapsedHeaderEnabled = this.gridOptionsWrapper.isRemovePivotHeaderRowWhenSingleValueColumn() && this.valueColumns.length === 1;
|
5816 | var isTotalColumn = column.getColDef().pivotTotalColumnIds !== undefined;
|
5817 | if (isCollapsedHeaderEnabled && !isTotalColumn) {
|
5818 | return headerName;
|
5819 | }
|
5820 | aggFunc = pivotValueColumn ? pivotValueColumn.getAggFunc() : null;
|
5821 | aggFuncFound = true;
|
5822 | }
|
5823 | else {
|
5824 | var measureActive = column.isValueActive();
|
5825 | var aggregationPresent = this.pivotMode || !this.isRowGroupEmpty();
|
5826 | if (measureActive && aggregationPresent) {
|
5827 | aggFunc = column.getAggFunc();
|
5828 | aggFuncFound = true;
|
5829 | }
|
5830 | else {
|
5831 | aggFuncFound = false;
|
5832 | }
|
5833 | }
|
5834 | if (aggFuncFound) {
|
5835 | var aggFuncString = (typeof aggFunc === 'string') ? aggFunc : 'func';
|
5836 | var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
|
5837 | var aggFuncStringTranslated = localeTextFunc(aggFuncString, aggFuncString);
|
5838 | return aggFuncStringTranslated + "(" + headerName + ")";
|
5839 | }
|
5840 | return headerName;
|
5841 | };
|
5842 |
|
5843 |
|
5844 | ColumnModel.prototype.getColumnGroup = function (colId, instanceId) {
|
5845 | if (!colId) {
|
5846 | return null;
|
5847 | }
|
5848 | if (colId instanceof ColumnGroup) {
|
5849 | return colId;
|
5850 | }
|
5851 | var allColumnGroups = this.getAllDisplayedTrees();
|
5852 | var checkInstanceId = typeof instanceId === 'number';
|
5853 | var result = null;
|
5854 | this.columnUtils.depthFirstAllColumnTreeSearch(allColumnGroups, function (child) {
|
5855 | if (child instanceof ColumnGroup) {
|
5856 | var columnGroup = child;
|
5857 | var matched = void 0;
|
5858 | if (checkInstanceId) {
|
5859 | matched = colId === columnGroup.getGroupId() && instanceId === columnGroup.getInstanceId();
|
5860 | }
|
5861 | else {
|
5862 | matched = colId === columnGroup.getGroupId();
|
5863 | }
|
5864 | if (matched) {
|
5865 | result = columnGroup;
|
5866 | }
|
5867 | }
|
5868 | });
|
5869 | return result;
|
5870 | };
|
5871 | ColumnModel.prototype.isReady = function () {
|
5872 | return this.ready;
|
5873 | };
|
5874 | ColumnModel.prototype.extractValueColumns = function (source, oldPrimaryColumns) {
|
5875 | this.valueColumns = this.extractColumns(oldPrimaryColumns, this.valueColumns, function (col, flag) { return col.setValueActive(flag, source); },
|
5876 |
|
5877 | function () { return undefined; }, function () { return undefined; },
|
5878 |
|
5879 | function (colDef) {
|
5880 | var aggFunc = colDef.aggFunc;
|
5881 |
|
5882 | if (aggFunc === null || aggFunc === '') {
|
5883 | return null;
|
5884 | }
|
5885 | if (aggFunc === undefined) {
|
5886 | return;
|
5887 | }
|
5888 | return !!aggFunc;
|
5889 | }, function (colDef) {
|
5890 |
|
5891 | return colDef.initialAggFunc != null && colDef.initialAggFunc != '';
|
5892 | });
|
5893 |
|
5894 | this.valueColumns.forEach(function (col) {
|
5895 | var colDef = col.getColDef();
|
5896 |
|
5897 | if (colDef.aggFunc != null && colDef.aggFunc != '') {
|
5898 | col.setAggFunc(colDef.aggFunc);
|
5899 | }
|
5900 | else {
|
5901 |
|
5902 | if (!col.getAggFunc()) {
|
5903 | col.setAggFunc(colDef.initialAggFunc);
|
5904 | }
|
5905 | }
|
5906 | });
|
5907 | };
|
5908 | ColumnModel.prototype.extractRowGroupColumns = function (source, oldPrimaryColumns) {
|
5909 | 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; });
|
5910 | };
|
5911 | ColumnModel.prototype.extractColumns = function (oldPrimaryColumns, previousCols, setFlagFunc, getIndexFunc, getInitialIndexFunc, getValueFunc, getInitialValueFunc) {
|
5912 | if (oldPrimaryColumns === void 0) { oldPrimaryColumns = []; }
|
5913 | if (previousCols === void 0) { previousCols = []; }
|
5914 | var colsWithIndex = [];
|
5915 | var colsWithValue = [];
|
5916 |
|
5917 |
|
5918 |
|
5919 | (this.primaryColumns || []).forEach(function (col) {
|
5920 | var colIsNew = oldPrimaryColumns.indexOf(col) < 0;
|
5921 | var colDef = col.getColDef();
|
5922 | var value = attrToBoolean(getValueFunc(colDef));
|
5923 | var initialValue = attrToBoolean(getInitialValueFunc(colDef));
|
5924 | var index = attrToNumber(getIndexFunc(colDef));
|
5925 | var initialIndex = attrToNumber(getInitialIndexFunc(colDef));
|
5926 | var include;
|
5927 | var valuePresent = value !== undefined;
|
5928 | var indexPresent = index !== undefined;
|
5929 | var initialValuePresent = initialValue !== undefined;
|
5930 | var initialIndexPresent = initialIndex !== undefined;
|
5931 | if (valuePresent) {
|
5932 | include = value;
|
5933 | }
|
5934 | else if (indexPresent) {
|
5935 | if (index === null) {
|
5936 |
|
5937 |
|
5938 | include = false;
|
5939 | }
|
5940 | else {
|
5941 |
|
5942 |
|
5943 | include = index >= 0;
|
5944 | }
|
5945 | }
|
5946 | else {
|
5947 | if (colIsNew) {
|
5948 |
|
5949 | if (initialValuePresent) {
|
5950 | include = initialValue;
|
5951 | }
|
5952 | else if (initialIndexPresent) {
|
5953 | include = initialIndex != null && initialIndex >= 0;
|
5954 | }
|
5955 | else {
|
5956 | include = false;
|
5957 | }
|
5958 | }
|
5959 | else {
|
5960 |
|
5961 |
|
5962 | include = previousCols.indexOf(col) >= 0;
|
5963 | }
|
5964 | }
|
5965 | if (include) {
|
5966 | var useIndex = colIsNew ? (index != null || initialIndex != null) : index != null;
|
5967 | useIndex ? colsWithIndex.push(col) : colsWithValue.push(col);
|
5968 | }
|
5969 | });
|
5970 | var getIndexForCol = function (col) {
|
5971 | var index = getIndexFunc(col.getColDef());
|
5972 | var defaultIndex = getInitialIndexFunc(col.getColDef());
|
5973 | return index != null ? index : defaultIndex;
|
5974 | };
|
5975 |
|
5976 | colsWithIndex.sort(function (colA, colB) {
|
5977 | var indexA = getIndexForCol(colA);
|
5978 | var indexB = getIndexForCol(colB);
|
5979 | if (indexA === indexB) {
|
5980 | return 0;
|
5981 | }
|
5982 | if (indexA < indexB) {
|
5983 | return -1;
|
5984 | }
|
5985 | return 1;
|
5986 | });
|
5987 | var res = [].concat(colsWithIndex);
|
5988 |
|
5989 |
|
5990 | previousCols.forEach(function (col) {
|
5991 | if (colsWithValue.indexOf(col) >= 0) {
|
5992 | res.push(col);
|
5993 | }
|
5994 | });
|
5995 |
|
5996 | colsWithValue.forEach(function (col) {
|
5997 | if (res.indexOf(col) < 0) {
|
5998 | res.push(col);
|
5999 | }
|
6000 | });
|
6001 |
|
6002 | previousCols.forEach(function (col) {
|
6003 | if (res.indexOf(col) < 0) {
|
6004 | setFlagFunc(col, false);
|
6005 | }
|
6006 | });
|
6007 |
|
6008 | res.forEach(function (col) {
|
6009 | if (previousCols.indexOf(col) < 0) {
|
6010 | setFlagFunc(col, true);
|
6011 | }
|
6012 | });
|
6013 | return res;
|
6014 | };
|
6015 | ColumnModel.prototype.extractPivotColumns = function (source, oldPrimaryColumns) {
|
6016 | 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; });
|
6017 | };
|
6018 | ColumnModel.prototype.resetColumnGroupState = function (source) {
|
6019 | if (source === void 0) { source = "api"; }
|
6020 | var stateItems = [];
|
6021 | this.columnUtils.depthFirstOriginalTreeSearch(null, this.primaryColumnTree, function (child) {
|
6022 | if (child instanceof ProvidedColumnGroup) {
|
6023 | var colGroupDef = child.getColGroupDef();
|
6024 | var groupState = {
|
6025 | groupId: child.getGroupId(),
|
6026 | open: !colGroupDef ? undefined : colGroupDef.openByDefault
|
6027 | };
|
6028 | stateItems.push(groupState);
|
6029 | }
|
6030 | });
|
6031 | this.setColumnGroupState(stateItems, source);
|
6032 | };
|
6033 | ColumnModel.prototype.getColumnGroupState = function () {
|
6034 | var columnGroupState = [];
|
6035 | this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (node) {
|
6036 | if (node instanceof ProvidedColumnGroup) {
|
6037 | columnGroupState.push({
|
6038 | groupId: node.getGroupId(),
|
6039 | open: node.isExpanded()
|
6040 | });
|
6041 | }
|
6042 | });
|
6043 | return columnGroupState;
|
6044 | };
|
6045 | ColumnModel.prototype.setColumnGroupState = function (stateItems, source) {
|
6046 | var _this = this;
|
6047 | if (source === void 0) { source = "api"; }
|
6048 | this.columnAnimationService.start();
|
6049 | var impactedGroups = [];
|
6050 | stateItems.forEach(function (stateItem) {
|
6051 | var groupKey = stateItem.groupId;
|
6052 | var newValue = stateItem.open;
|
6053 | var providedColumnGroup = _this.getProvidedColumnGroup(groupKey);
|
6054 | if (!providedColumnGroup) {
|
6055 | return;
|
6056 | }
|
6057 | if (providedColumnGroup.isExpanded() === newValue) {
|
6058 | return;
|
6059 | }
|
6060 | _this.logger.log('columnGroupOpened(' + providedColumnGroup.getGroupId() + ',' + newValue + ')');
|
6061 | providedColumnGroup.setExpanded(newValue);
|
6062 | impactedGroups.push(providedColumnGroup);
|
6063 | });
|
6064 | this.updateGroupsAndDisplayedColumns(source);
|
6065 | this.setFirstRightAndLastLeftPinned(source);
|
6066 | impactedGroups.forEach(function (providedColumnGroup) {
|
6067 | var event = {
|
6068 | type: Events.EVENT_COLUMN_GROUP_OPENED,
|
6069 | columnGroup: providedColumnGroup,
|
6070 | api: _this.gridApi,
|
6071 | columnApi: _this.columnApi
|
6072 | };
|
6073 | _this.eventService.dispatchEvent(event);
|
6074 | });
|
6075 | this.columnAnimationService.finish();
|
6076 | };
|
6077 |
|
6078 | ColumnModel.prototype.setColumnGroupOpened = function (key, newValue, source) {
|
6079 | if (source === void 0) { source = "api"; }
|
6080 | var keyAsString;
|
6081 | if (key instanceof ProvidedColumnGroup) {
|
6082 | keyAsString = key.getId();
|
6083 | }
|
6084 | else {
|
6085 | keyAsString = key || '';
|
6086 | }
|
6087 | this.setColumnGroupState([{ groupId: keyAsString, open: newValue }], source);
|
6088 | };
|
6089 | ColumnModel.prototype.getProvidedColumnGroup = function (key) {
|
6090 |
|
6091 | if (typeof key !== 'string') {
|
6092 | console.error('AG Grid: group key must be a string');
|
6093 | }
|
6094 |
|
6095 | var res = null;
|
6096 | this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (node) {
|
6097 | if (node instanceof ProvidedColumnGroup) {
|
6098 | if (node.getId() === key) {
|
6099 | res = node;
|
6100 | }
|
6101 | }
|
6102 | });
|
6103 | return res;
|
6104 | };
|
6105 | ColumnModel.prototype.calculateColumnsForDisplay = function () {
|
6106 | var _this = this;
|
6107 | var columnsForDisplay;
|
6108 | if (this.pivotMode && missing(this.secondaryColumns)) {
|
6109 |
|
6110 |
|
6111 | columnsForDisplay = this.gridColumns.filter(function (column) {
|
6112 | var isAutoGroupCol = _this.groupAutoColumns && includes(_this.groupAutoColumns, column);
|
6113 | var isValueCol = _this.valueColumns && includes(_this.valueColumns, column);
|
6114 | return isAutoGroupCol || isValueCol;
|
6115 | });
|
6116 | }
|
6117 | else {
|
6118 |
|
6119 |
|
6120 | columnsForDisplay = this.gridColumns.filter(function (column) {
|
6121 |
|
6122 | var isAutoGroupCol = _this.groupAutoColumns && includes(_this.groupAutoColumns, column);
|
6123 | return isAutoGroupCol || column.isVisible();
|
6124 | });
|
6125 | }
|
6126 | return columnsForDisplay;
|
6127 | };
|
6128 | ColumnModel.prototype.checkColSpanActiveInCols = function (columns) {
|
6129 | var result = false;
|
6130 | columns.forEach(function (col) {
|
6131 | if (exists(col.getColDef().colSpan)) {
|
6132 | result = true;
|
6133 | }
|
6134 | });
|
6135 | return result;
|
6136 | };
|
6137 | ColumnModel.prototype.calculateColumnsForGroupDisplay = function () {
|
6138 | var _this = this;
|
6139 | this.groupDisplayColumns = [];
|
6140 | var checkFunc = function (col) {
|
6141 | var colDef = col.getColDef();
|
6142 | if (colDef && exists(colDef.showRowGroup)) {
|
6143 | _this.groupDisplayColumns.push(col);
|
6144 | }
|
6145 | };
|
6146 | this.gridColumns.forEach(checkFunc);
|
6147 | if (this.groupAutoColumns) {
|
6148 | this.groupAutoColumns.forEach(checkFunc);
|
6149 | }
|
6150 | };
|
6151 | ColumnModel.prototype.getGroupDisplayColumns = function () {
|
6152 | return this.groupDisplayColumns;
|
6153 | };
|
6154 | ColumnModel.prototype.updateDisplayedColumns = function (source) {
|
6155 | var columnsForDisplay = this.calculateColumnsForDisplay();
|
6156 | this.buildDisplayedTrees(columnsForDisplay);
|
6157 | this.calculateColumnsForGroupDisplay();
|
6158 |
|
6159 | this.updateGroupsAndDisplayedColumns(source);
|
6160 |
|
6161 | this.setFirstRightAndLastLeftPinned(source);
|
6162 | };
|
6163 | ColumnModel.prototype.isSecondaryColumnsPresent = function () {
|
6164 | return exists(this.secondaryColumns);
|
6165 | };
|
6166 | ColumnModel.prototype.setSecondaryColumns = function (colDefs, source) {
|
6167 | var _this = this;
|
6168 | if (source === void 0) { source = "api"; }
|
6169 | var newColsPresent = colDefs && colDefs.length > 0;
|
6170 |
|
6171 | if (!newColsPresent && missing(this.secondaryColumns)) {
|
6172 | return;
|
6173 | }
|
6174 | if (newColsPresent) {
|
6175 | this.processSecondaryColumnDefinitions(colDefs);
|
6176 | var balancedTreeResult = this.columnFactory.createColumnTree(colDefs, false, this.secondaryBalancedTree || this.previousSecondaryColumns || undefined);
|
6177 | this.secondaryBalancedTree = balancedTreeResult.columnTree;
|
6178 | this.secondaryHeaderRowCount = balancedTreeResult.treeDept + 1;
|
6179 | this.secondaryColumns = this.getColumnsFromTree(this.secondaryBalancedTree);
|
6180 | this.secondaryColumnsMap = {};
|
6181 | this.secondaryColumns.forEach(function (col) { return _this.secondaryColumnsMap[col.getId()] = col; });
|
6182 | this.previousSecondaryColumns = null;
|
6183 | }
|
6184 | else {
|
6185 | this.previousSecondaryColumns = this.secondaryBalancedTree;
|
6186 | this.secondaryBalancedTree = null;
|
6187 | this.secondaryHeaderRowCount = -1;
|
6188 | this.secondaryColumns = null;
|
6189 | this.secondaryColumnsMap = {};
|
6190 | }
|
6191 | this.updateGridColumns();
|
6192 | this.updateDisplayedColumns(source);
|
6193 | };
|
6194 | ColumnModel.prototype.processSecondaryColumnDefinitions = function (colDefs) {
|
6195 | var columnCallback = this.gridOptionsWrapper.getProcessSecondaryColDefFunc();
|
6196 | var groupCallback = this.gridOptionsWrapper.getProcessSecondaryColGroupDefFunc();
|
6197 | if (!columnCallback && !groupCallback) {
|
6198 | return undefined;
|
6199 | }
|
6200 | var searchForColDefs = function (colDefs2) {
|
6201 | colDefs2.forEach(function (abstractColDef) {
|
6202 | var isGroup = exists(abstractColDef.children);
|
6203 | if (isGroup) {
|
6204 | var colGroupDef = abstractColDef;
|
6205 | if (groupCallback) {
|
6206 | groupCallback(colGroupDef);
|
6207 | }
|
6208 | searchForColDefs(colGroupDef.children);
|
6209 | }
|
6210 | else {
|
6211 | var colDef = abstractColDef;
|
6212 | if (columnCallback) {
|
6213 | columnCallback(colDef);
|
6214 | }
|
6215 | }
|
6216 | });
|
6217 | };
|
6218 | if (colDefs) {
|
6219 | searchForColDefs(colDefs);
|
6220 | }
|
6221 | };
|
6222 |
|
6223 | ColumnModel.prototype.updateGridColumns = function () {
|
6224 | var _this = this;
|
6225 | if (this.gridColsArePrimary) {
|
6226 | this.lastPrimaryOrder = this.gridColumns;
|
6227 | }
|
6228 | else {
|
6229 | this.lastSecondaryOrder = this.gridColumns;
|
6230 | }
|
6231 | if (this.secondaryColumns && this.secondaryBalancedTree) {
|
6232 | var hasSameColumns = this.secondaryColumns.every(function (col) {
|
6233 | return _this.gridColumnsMap[col.getColId()] !== undefined;
|
6234 | });
|
6235 | this.gridBalancedTree = this.secondaryBalancedTree.slice();
|
6236 | this.gridHeaderRowCount = this.secondaryHeaderRowCount;
|
6237 | this.gridColumns = this.secondaryColumns.slice();
|
6238 | this.gridColsArePrimary = false;
|
6239 |
|
6240 |
|
6241 |
|
6242 | if (hasSameColumns) {
|
6243 | this.orderGridColsLike(this.lastSecondaryOrder);
|
6244 | }
|
6245 | }
|
6246 | else if (this.primaryColumns) {
|
6247 | this.gridBalancedTree = this.primaryColumnTree.slice();
|
6248 | this.gridHeaderRowCount = this.primaryHeaderRowCount;
|
6249 | this.gridColumns = this.primaryColumns.slice();
|
6250 | this.gridColsArePrimary = true;
|
6251 |
|
6252 |
|
6253 |
|
6254 | this.orderGridColsLike(this.lastPrimaryOrder);
|
6255 | }
|
6256 | this.addAutoGroupToGridColumns();
|
6257 | this.gridColumns = this.placeLockedColumns(this.gridColumns);
|
6258 | this.setupQuickFilterColumns();
|
6259 | this.clearDisplayedAndViewportColumns();
|
6260 | this.colSpanActive = this.checkColSpanActiveInCols(this.gridColumns);
|
6261 | this.gridColumnsMap = {};
|
6262 | this.gridColumns.forEach(function (col) { return _this.gridColumnsMap[col.getId()] = col; });
|
6263 | this.setAutoHeightActive();
|
6264 | var event = {
|
6265 | type: Events.EVENT_GRID_COLUMNS_CHANGED,
|
6266 | api: this.gridApi,
|
6267 | columnApi: this.columnApi
|
6268 | };
|
6269 | this.eventService.dispatchEvent(event);
|
6270 | };
|
6271 | ColumnModel.prototype.setAutoHeightActive = function () {
|
6272 | this.autoHeightActive = this.gridColumns.filter(function (col) { return col.isAutoHeight(); }).length > 0;
|
6273 | if (this.autoHeightActive) {
|
6274 | this.autoHeightActiveAtLeastOnce = true;
|
6275 | var rowModelType = this.rowModel.getType();
|
6276 | var supportedRowModel = rowModelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE || rowModelType === Constants.ROW_MODEL_TYPE_SERVER_SIDE;
|
6277 | if (!supportedRowModel) {
|
6278 | var message_1 = 'AG Grid - autoHeight columns only work with Client Side Row Model and Server Side Row Model.';
|
6279 | doOnce(function () { return console.warn(message_1); }, 'autoHeightActive.wrongRowModel');
|
6280 | }
|
6281 | }
|
6282 | };
|
6283 | ColumnModel.prototype.orderGridColsLike = function (colsOrder) {
|
6284 | if (missing(colsOrder)) {
|
6285 | return;
|
6286 | }
|
6287 | var lastOrderMapped = convertToMap(colsOrder.map(function (col, index) { return [col, index]; }));
|
6288 |
|
6289 |
|
6290 | var noColsFound = true;
|
6291 | this.gridColumns.forEach(function (col) {
|
6292 | if (lastOrderMapped.has(col)) {
|
6293 | noColsFound = false;
|
6294 | }
|
6295 | });
|
6296 | if (noColsFound) {
|
6297 | return;
|
6298 | }
|
6299 |
|
6300 |
|
6301 | var gridColsMap = convertToMap(this.gridColumns.map(function (col) { return [col, true]; }));
|
6302 | var oldColsOrdered = colsOrder.filter(function (col) { return gridColsMap.has(col); });
|
6303 | var oldColsMap = convertToMap(oldColsOrdered.map(function (col) { return [col, true]; }));
|
6304 | var newColsOrdered = this.gridColumns.filter(function (col) { return !oldColsMap.has(col); });
|
6305 |
|
6306 | var newGridColumns = oldColsOrdered.slice();
|
6307 | newColsOrdered.forEach(function (newCol) {
|
6308 | var parent = newCol.getOriginalParent();
|
6309 |
|
6310 | if (!parent) {
|
6311 | newGridColumns.push(newCol);
|
6312 | return;
|
6313 | }
|
6314 |
|
6315 |
|
6316 | var siblings = [];
|
6317 | while (!siblings.length && parent) {
|
6318 | var leafCols = parent.getLeafColumns();
|
6319 | leafCols.forEach(function (leafCol) {
|
6320 | var presentInNewGriColumns = newGridColumns.indexOf(leafCol) >= 0;
|
6321 | var noYetInSiblings = siblings.indexOf(leafCol) < 0;
|
6322 | if (presentInNewGriColumns && noYetInSiblings) {
|
6323 | siblings.push(leafCol);
|
6324 | }
|
6325 | });
|
6326 | parent = parent.getOriginalParent();
|
6327 | }
|
6328 |
|
6329 | if (!siblings.length) {
|
6330 | newGridColumns.push(newCol);
|
6331 | return;
|
6332 | }
|
6333 |
|
6334 | var indexes = siblings.map(function (col) { return newGridColumns.indexOf(col); });
|
6335 | var lastIndex = Math.max.apply(Math, __spread(indexes));
|
6336 | insertIntoArray(newGridColumns, newCol, lastIndex + 1);
|
6337 | });
|
6338 | this.gridColumns = newGridColumns;
|
6339 | };
|
6340 | ColumnModel.prototype.isPrimaryColumnGroupsPresent = function () {
|
6341 | return this.primaryHeaderRowCount > 1;
|
6342 | };
|
6343 |
|
6344 |
|
6345 |
|
6346 |
|
6347 |
|
6348 | ColumnModel.prototype.setupQuickFilterColumns = function () {
|
6349 | if (this.groupAutoColumns) {
|
6350 | this.columnsForQuickFilter = (this.primaryColumns || []).concat(this.groupAutoColumns);
|
6351 | }
|
6352 | else if (this.primaryColumns) {
|
6353 | this.columnsForQuickFilter = this.primaryColumns;
|
6354 | }
|
6355 | };
|
6356 | ColumnModel.prototype.placeLockedColumns = function (cols) {
|
6357 | var left = [];
|
6358 | var normal = [];
|
6359 | var right = [];
|
6360 | cols.forEach(function (col) {
|
6361 | var position = col.getColDef().lockPosition;
|
6362 | if (position === 'right') {
|
6363 | right.push(col);
|
6364 | }
|
6365 | else if (position === 'left' || position === true) {
|
6366 | left.push(col);
|
6367 | }
|
6368 | else {
|
6369 | normal.push(col);
|
6370 | }
|
6371 | });
|
6372 | return __spread(left, normal, right);
|
6373 | };
|
6374 | ColumnModel.prototype.addAutoGroupToGridColumns = function () {
|
6375 |
|
6376 | this.createGroupAutoColumnsIfNeeded();
|
6377 | if (missing(this.groupAutoColumns)) {
|
6378 | return;
|
6379 | }
|
6380 | this.gridColumns = this.groupAutoColumns ? this.groupAutoColumns.concat(this.gridColumns) : this.gridColumns;
|
6381 | var autoColBalancedTree = this.columnFactory.createForAutoGroups(this.groupAutoColumns, this.gridBalancedTree);
|
6382 | this.gridBalancedTree = autoColBalancedTree.concat(this.gridBalancedTree);
|
6383 | };
|
6384 |
|
6385 |
|
6386 |
|
6387 |
|
6388 |
|
6389 | ColumnModel.prototype.clearDisplayedAndViewportColumns = function () {
|
6390 | this.displayedTreeLeft = [];
|
6391 | this.displayedTreeRight = [];
|
6392 | this.displayedTreeCentre = [];
|
6393 | this.viewportRowLeft = {};
|
6394 | this.viewportRowRight = {};
|
6395 | this.viewportRowCenter = {};
|
6396 | this.displayedColumnsLeft = [];
|
6397 | this.displayedColumnsRight = [];
|
6398 | this.displayedColumnsCenter = [];
|
6399 | this.displayedColumns = [];
|
6400 | this.viewportColumns = [];
|
6401 | };
|
6402 | ColumnModel.prototype.updateGroupsAndDisplayedColumns = function (source) {
|
6403 | this.updateOpenClosedVisibilityInColumnGroups();
|
6404 | this.deriveDisplayedColumns(source);
|
6405 | this.refreshFlexedColumns();
|
6406 | this.extractViewport();
|
6407 | this.updateBodyWidths();
|
6408 |
|
6409 | var event = {
|
6410 | type: Events.EVENT_DISPLAYED_COLUMNS_CHANGED,
|
6411 | api: this.gridApi,
|
6412 | columnApi: this.columnApi
|
6413 | };
|
6414 | this.eventService.dispatchEvent(event);
|
6415 | };
|
6416 | ColumnModel.prototype.deriveDisplayedColumns = function (source) {
|
6417 | this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeLeft, this.displayedColumnsLeft);
|
6418 | this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeCentre, this.displayedColumnsCenter);
|
6419 | this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeRight, this.displayedColumnsRight);
|
6420 | this.joinDisplayedColumns();
|
6421 | this.setLeftValues(source);
|
6422 | this.displayedAutoHeightCols = this.displayedColumns.filter(function (col) { return col.isAutoHeight(); });
|
6423 | };
|
6424 | ColumnModel.prototype.isAutoRowHeightActive = function () {
|
6425 | return this.autoHeightActive;
|
6426 | };
|
6427 | ColumnModel.prototype.wasAutoRowHeightEverActive = function () {
|
6428 | return this.autoHeightActiveAtLeastOnce;
|
6429 | };
|
6430 | ColumnModel.prototype.joinDisplayedColumns = function () {
|
6431 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
6432 | this.displayedColumns = this.displayedColumnsRight
|
6433 | .concat(this.displayedColumnsCenter)
|
6434 | .concat(this.displayedColumnsLeft);
|
6435 | }
|
6436 | else {
|
6437 | this.displayedColumns = this.displayedColumnsLeft
|
6438 | .concat(this.displayedColumnsCenter)
|
6439 | .concat(this.displayedColumnsRight);
|
6440 | }
|
6441 | };
|
6442 |
|
6443 | ColumnModel.prototype.setLeftValues = function (source) {
|
6444 | this.setLeftValuesOfColumns(source);
|
6445 | this.setLeftValuesOfGroups();
|
6446 | };
|
6447 | ColumnModel.prototype.setLeftValuesOfColumns = function (source) {
|
6448 | var _this = this;
|
6449 | if (!this.primaryColumns) {
|
6450 | return;
|
6451 | }
|
6452 |
|
6453 | var allColumns = this.primaryColumns.slice(0);
|
6454 |
|
6455 | var doingRtl = this.gridOptionsWrapper.isEnableRtl();
|
6456 | [
|
6457 | this.displayedColumnsLeft,
|
6458 | this.displayedColumnsRight,
|
6459 | this.displayedColumnsCenter
|
6460 | ].forEach(function (columns) {
|
6461 | if (doingRtl) {
|
6462 |
|
6463 | var left_1 = _this.getWidthOfColsInList(columns);
|
6464 | columns.forEach(function (column) {
|
6465 | left_1 -= column.getActualWidth();
|
6466 | column.setLeft(left_1, source);
|
6467 | });
|
6468 | }
|
6469 | else {
|
6470 |
|
6471 | var left_2 = 0;
|
6472 | columns.forEach(function (column) {
|
6473 | column.setLeft(left_2, source);
|
6474 | left_2 += column.getActualWidth();
|
6475 | });
|
6476 | }
|
6477 | removeAllFromArray(allColumns, columns);
|
6478 | });
|
6479 |
|
6480 |
|
6481 |
|
6482 | allColumns.forEach(function (column) {
|
6483 | column.setLeft(null, source);
|
6484 | });
|
6485 | };
|
6486 | ColumnModel.prototype.setLeftValuesOfGroups = function () {
|
6487 |
|
6488 | [
|
6489 | this.displayedTreeLeft,
|
6490 | this.displayedTreeRight,
|
6491 | this.displayedTreeCentre
|
6492 | ].forEach(function (columns) {
|
6493 | columns.forEach(function (column) {
|
6494 | if (column instanceof ColumnGroup) {
|
6495 | var columnGroup = column;
|
6496 | columnGroup.checkLeft();
|
6497 | }
|
6498 | });
|
6499 | });
|
6500 | };
|
6501 | ColumnModel.prototype.derivedDisplayedColumnsFromDisplayedTree = function (tree, columns) {
|
6502 | columns.length = 0;
|
6503 | this.columnUtils.depthFirstDisplayedColumnTreeSearch(tree, function (child) {
|
6504 | if (child instanceof Column) {
|
6505 | columns.push(child);
|
6506 | }
|
6507 | });
|
6508 | };
|
6509 | ColumnModel.prototype.extractViewportColumns = function () {
|
6510 | if (this.suppressColumnVirtualisation) {
|
6511 |
|
6512 | this.viewportColumnsCenter = this.displayedColumnsCenter;
|
6513 | }
|
6514 | else {
|
6515 |
|
6516 | this.viewportColumnsCenter = this.filterOutColumnsWithinViewport();
|
6517 | }
|
6518 | this.viewportColumns = this.viewportColumnsCenter
|
6519 | .concat(this.displayedColumnsLeft)
|
6520 | .concat(this.displayedColumnsRight);
|
6521 | };
|
6522 | ColumnModel.prototype.getVirtualHeaderGroupRow = function (type, dept) {
|
6523 | var result;
|
6524 | switch (type) {
|
6525 | case Constants.PINNED_LEFT:
|
6526 | result = this.viewportRowLeft[dept];
|
6527 | break;
|
6528 | case Constants.PINNED_RIGHT:
|
6529 | result = this.viewportRowRight[dept];
|
6530 | break;
|
6531 | default:
|
6532 | result = this.viewportRowCenter[dept];
|
6533 | break;
|
6534 | }
|
6535 | if (missing(result)) {
|
6536 | result = [];
|
6537 | }
|
6538 | return result;
|
6539 | };
|
6540 | ColumnModel.prototype.extractViewportRows = function () {
|
6541 |
|
6542 |
|
6543 | this.viewportRowLeft = {};
|
6544 | this.viewportRowRight = {};
|
6545 | this.viewportRowCenter = {};
|
6546 |
|
6547 | var virtualColIds = {};
|
6548 | this.viewportColumns.forEach(function (col) { return virtualColIds[col.getId()] = true; });
|
6549 | var testGroup = function (children, result, dept) {
|
6550 | var returnValue = false;
|
6551 | for (var i = 0; i < children.length; i++) {
|
6552 |
|
6553 | var child = children[i];
|
6554 | var addThisItem = false;
|
6555 | if (child instanceof Column) {
|
6556 |
|
6557 | addThisItem = virtualColIds[child.getId()] === true;
|
6558 | }
|
6559 | else {
|
6560 |
|
6561 | var columnGroup = child;
|
6562 | var displayedChildren = columnGroup.getDisplayedChildren();
|
6563 | if (displayedChildren) {
|
6564 | addThisItem = testGroup(displayedChildren, result, dept + 1);
|
6565 | }
|
6566 | }
|
6567 | if (addThisItem) {
|
6568 | returnValue = true;
|
6569 | if (!result[dept]) {
|
6570 | result[dept] = [];
|
6571 | }
|
6572 | result[dept].push(child);
|
6573 | }
|
6574 | }
|
6575 | return returnValue;
|
6576 | };
|
6577 | testGroup(this.displayedTreeLeft, this.viewportRowLeft, 0);
|
6578 | testGroup(this.displayedTreeRight, this.viewportRowRight, 0);
|
6579 | testGroup(this.displayedTreeCentre, this.viewportRowCenter, 0);
|
6580 | };
|
6581 | ColumnModel.prototype.extractViewport = function () {
|
6582 | this.extractViewportColumns();
|
6583 | this.extractViewportRows();
|
6584 | };
|
6585 | ColumnModel.prototype.filterOutColumnsWithinViewport = function () {
|
6586 | return this.displayedColumnsCenter.filter(this.isColumnInViewport.bind(this));
|
6587 | };
|
6588 | ColumnModel.prototype.refreshFlexedColumns = function (params) {
|
6589 | var _this = this;
|
6590 | if (params === void 0) { params = {}; }
|
6591 | var source = params.source ? params.source : 'flex';
|
6592 | if (params.viewportWidth != null) {
|
6593 | this.flexViewportWidth = params.viewportWidth;
|
6594 | }
|
6595 | if (!this.flexViewportWidth) {
|
6596 | return [];
|
6597 | }
|
6598 |
|
6599 |
|
6600 |
|
6601 | var flexAfterDisplayIndex = -1;
|
6602 | if (params.resizingCols) {
|
6603 | params.resizingCols.forEach(function (col) {
|
6604 | var indexOfCol = _this.displayedColumnsCenter.indexOf(col);
|
6605 | if (flexAfterDisplayIndex < indexOfCol) {
|
6606 | flexAfterDisplayIndex = indexOfCol;
|
6607 | }
|
6608 | });
|
6609 | }
|
6610 | var isColFlex = function (col) {
|
6611 | var afterResizingCols = _this.displayedColumnsCenter.indexOf(col) > flexAfterDisplayIndex;
|
6612 | return col.getFlex() && afterResizingCols;
|
6613 | };
|
6614 | var knownWidthColumns = this.displayedColumnsCenter.filter(function (col) { return !isColFlex(col); });
|
6615 | var flexingColumns = this.displayedColumnsCenter.filter(function (col) { return isColFlex(col); });
|
6616 | var changedColumns = [];
|
6617 | if (!flexingColumns.length) {
|
6618 | return [];
|
6619 | }
|
6620 | var flexingColumnSizes = [];
|
6621 | var spaceForFlexingColumns;
|
6622 | outer: while (true) {
|
6623 | var totalFlex = flexingColumns.reduce(function (count, col) { return count + col.getFlex(); }, 0);
|
6624 | spaceForFlexingColumns = this.flexViewportWidth - this.getWidthOfColsInList(knownWidthColumns);
|
6625 | for (var i = 0; i < flexingColumns.length; i++) {
|
6626 | var col = flexingColumns[i];
|
6627 | var widthByFlexRule = spaceForFlexingColumns * col.getFlex() / totalFlex;
|
6628 | var constrainedWidth = 0;
|
6629 | var minWidth = col.getMinWidth();
|
6630 | var maxWidth = col.getMaxWidth();
|
6631 | if (exists(minWidth) && widthByFlexRule < minWidth) {
|
6632 | constrainedWidth = minWidth;
|
6633 | }
|
6634 | else if (exists(maxWidth) && widthByFlexRule > maxWidth) {
|
6635 | constrainedWidth = maxWidth;
|
6636 | }
|
6637 | if (constrainedWidth) {
|
6638 |
|
6639 |
|
6640 | col.setActualWidth(constrainedWidth, source);
|
6641 | removeFromArray(flexingColumns, col);
|
6642 | changedColumns.push(col);
|
6643 | knownWidthColumns.push(col);
|
6644 | continue outer;
|
6645 | }
|
6646 | flexingColumnSizes[i] = Math.round(widthByFlexRule);
|
6647 | }
|
6648 | break;
|
6649 | }
|
6650 | var remainingSpace = spaceForFlexingColumns;
|
6651 | flexingColumns.forEach(function (col, i) {
|
6652 | col.setActualWidth(Math.min(flexingColumnSizes[i], remainingSpace), source);
|
6653 | changedColumns.push(col);
|
6654 | remainingSpace -= flexingColumnSizes[i];
|
6655 | });
|
6656 | if (!params.skipSetLeft) {
|
6657 | this.setLeftValues(source);
|
6658 | }
|
6659 | if (params.updateBodyWidths) {
|
6660 | this.updateBodyWidths();
|
6661 | }
|
6662 | if (params.fireResizedEvent) {
|
6663 | this.fireColumnResizedEvent(changedColumns, true, source, flexingColumns);
|
6664 | }
|
6665 |
|
6666 |
|
6667 |
|
6668 |
|
6669 |
|
6670 |
|
6671 | if (!this.flexColsCalculatedAtLestOnce) {
|
6672 | if (this.gridOptionsWrapper.isRowModelDefault()) {
|
6673 | this.rowModel.resetRowHeights();
|
6674 | }
|
6675 | this.flexColsCalculatedAtLestOnce = true;
|
6676 | }
|
6677 | return flexingColumns;
|
6678 | };
|
6679 |
|
6680 | ColumnModel.prototype.sizeColumnsToFit = function (gridWidth, source, silent) {
|
6681 | if (source === void 0) { source = "sizeColumnsToFit"; }
|
6682 |
|
6683 | var allDisplayedColumns = this.getAllDisplayedColumns();
|
6684 | if (gridWidth <= 0 || !allDisplayedColumns.length) {
|
6685 | return;
|
6686 | }
|
6687 | var colsToSpread = [];
|
6688 | var colsToNotSpread = [];
|
6689 | allDisplayedColumns.forEach(function (column) {
|
6690 | if (column.getColDef().suppressSizeToFit === true) {
|
6691 | colsToNotSpread.push(column);
|
6692 | }
|
6693 | else {
|
6694 | colsToSpread.push(column);
|
6695 | }
|
6696 | });
|
6697 |
|
6698 | var colsToFireEventFor = colsToSpread.slice(0);
|
6699 | var finishedResizing = false;
|
6700 | var moveToNotSpread = function (column) {
|
6701 | removeFromArray(colsToSpread, column);
|
6702 | colsToNotSpread.push(column);
|
6703 | };
|
6704 |
|
6705 |
|
6706 |
|
6707 |
|
6708 |
|
6709 |
|
6710 |
|
6711 |
|
6712 | colsToSpread.forEach(function (column) { return column.resetActualWidth(source); });
|
6713 | while (!finishedResizing) {
|
6714 | finishedResizing = true;
|
6715 | var availablePixels = gridWidth - this.getWidthOfColsInList(colsToNotSpread);
|
6716 | if (availablePixels <= 0) {
|
6717 |
|
6718 | colsToSpread.forEach(function (column) {
|
6719 | column.setMinimum(source);
|
6720 | });
|
6721 | }
|
6722 | else {
|
6723 | var scale = availablePixels / this.getWidthOfColsInList(colsToSpread);
|
6724 |
|
6725 |
|
6726 | var pixelsForLastCol = availablePixels;
|
6727 |
|
6728 | for (var i = colsToSpread.length - 1; i >= 0; i--) {
|
6729 | var column = colsToSpread[i];
|
6730 | var minWidth = column.getMinWidth();
|
6731 | var maxWidth = column.getMaxWidth();
|
6732 | var newWidth = Math.round(column.getActualWidth() * scale);
|
6733 | if (exists(minWidth) && newWidth < minWidth) {
|
6734 | newWidth = minWidth;
|
6735 | moveToNotSpread(column);
|
6736 | finishedResizing = false;
|
6737 | }
|
6738 | else if (exists(maxWidth) && column.isGreaterThanMax(newWidth)) {
|
6739 | newWidth = maxWidth;
|
6740 | moveToNotSpread(column);
|
6741 | finishedResizing = false;
|
6742 | }
|
6743 | else if (i === 0) {
|
6744 | newWidth = pixelsForLastCol;
|
6745 | }
|
6746 | column.setActualWidth(newWidth, source, true);
|
6747 | pixelsForLastCol -= newWidth;
|
6748 | }
|
6749 | }
|
6750 | }
|
6751 |
|
6752 | colsToFireEventFor.forEach(function (col) {
|
6753 | col.fireColumnWidthChangedEvent(source);
|
6754 | });
|
6755 | this.setLeftValues(source);
|
6756 | this.updateBodyWidths();
|
6757 | if (silent) {
|
6758 | return;
|
6759 | }
|
6760 | this.fireColumnResizedEvent(colsToFireEventFor, true, source);
|
6761 | };
|
6762 | ColumnModel.prototype.buildDisplayedTrees = function (visibleColumns) {
|
6763 | var leftVisibleColumns = [];
|
6764 | var rightVisibleColumns = [];
|
6765 | var centerVisibleColumns = [];
|
6766 | visibleColumns.forEach(function (column) {
|
6767 | switch (column.getPinned()) {
|
6768 | case "left":
|
6769 | leftVisibleColumns.push(column);
|
6770 | break;
|
6771 | case "right":
|
6772 | rightVisibleColumns.push(column);
|
6773 | break;
|
6774 | default:
|
6775 | centerVisibleColumns.push(column);
|
6776 | break;
|
6777 | }
|
6778 | });
|
6779 | var groupInstanceIdCreator = new GroupInstanceIdCreator();
|
6780 | this.displayedTreeLeft = this.displayedGroupCreator.createDisplayedGroups(leftVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, Constants.PINNED_LEFT, this.displayedTreeLeft);
|
6781 | this.displayedTreeRight = this.displayedGroupCreator.createDisplayedGroups(rightVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, Constants.PINNED_RIGHT, this.displayedTreeRight);
|
6782 | this.displayedTreeCentre = this.displayedGroupCreator.createDisplayedGroups(centerVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, null, this.displayedTreeCentre);
|
6783 | this.updateDisplayedMap();
|
6784 | };
|
6785 | ColumnModel.prototype.updateDisplayedMap = function () {
|
6786 | var _this = this;
|
6787 | this.displayedColumnsAndGroupsMap = {};
|
6788 | var func = function (child) {
|
6789 | _this.displayedColumnsAndGroupsMap[child.getUniqueId()] = child;
|
6790 | };
|
6791 | this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeCentre, func);
|
6792 | this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeLeft, func);
|
6793 | this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeRight, func);
|
6794 | };
|
6795 | ColumnModel.prototype.isDisplayed = function (item) {
|
6796 | var fromMap = this.displayedColumnsAndGroupsMap[item.getUniqueId()];
|
6797 |
|
6798 | return fromMap === item;
|
6799 | };
|
6800 | ColumnModel.prototype.updateOpenClosedVisibilityInColumnGroups = function () {
|
6801 | var allColumnGroups = this.getAllDisplayedTrees();
|
6802 | this.columnUtils.depthFirstAllColumnTreeSearch(allColumnGroups, function (child) {
|
6803 | if (child instanceof ColumnGroup) {
|
6804 | var columnGroup = child;
|
6805 | columnGroup.calculateDisplayedColumns();
|
6806 | }
|
6807 | });
|
6808 | };
|
6809 | ColumnModel.prototype.getGroupAutoColumns = function () {
|
6810 | return this.groupAutoColumns;
|
6811 | };
|
6812 | ColumnModel.prototype.createGroupAutoColumnsIfNeeded = function () {
|
6813 | if (!this.autoGroupsNeedBuilding) {
|
6814 | return;
|
6815 | }
|
6816 | this.autoGroupsNeedBuilding = false;
|
6817 | var groupFullWidthRow = this.gridOptionsWrapper.isGroupUseEntireRow(this.pivotMode);
|
6818 |
|
6819 |
|
6820 |
|
6821 |
|
6822 |
|
6823 |
|
6824 | var suppressAutoColumn = this.pivotMode ?
|
6825 | this.gridOptionsWrapper.isPivotSuppressAutoColumn() : this.gridOptionsWrapper.isGroupSuppressAutoColumn();
|
6826 | var groupingActive = this.rowGroupColumns.length > 0 || this.usingTreeData;
|
6827 | var needAutoColumns = groupingActive && !suppressAutoColumn && !groupFullWidthRow;
|
6828 | if (needAutoColumns) {
|
6829 | var existingCols = this.groupAutoColumns || [];
|
6830 | var newAutoGroupCols = this.autoGroupColService.createAutoGroupColumns(existingCols, this.rowGroupColumns);
|
6831 | var autoColsDifferent = !this.autoColsEqual(newAutoGroupCols, this.groupAutoColumns);
|
6832 |
|
6833 |
|
6834 | if (autoColsDifferent || this.forceRecreateAutoGroups) {
|
6835 | this.groupAutoColumns = newAutoGroupCols;
|
6836 | }
|
6837 | }
|
6838 | else {
|
6839 | this.groupAutoColumns = null;
|
6840 | }
|
6841 | };
|
6842 | ColumnModel.prototype.autoColsEqual = function (colsA, colsB) {
|
6843 | return areEqual(colsA, colsB, function (a, b) { return a.getColId() === b.getColId(); });
|
6844 | };
|
6845 | ColumnModel.prototype.getWidthOfColsInList = function (columnList) {
|
6846 | return columnList.reduce(function (width, col) { return width + col.getActualWidth(); }, 0);
|
6847 | };
|
6848 | ColumnModel.prototype.getGridBalancedTree = function () {
|
6849 | return this.gridBalancedTree;
|
6850 | };
|
6851 | ColumnModel.prototype.hasFloatingFilters = function () {
|
6852 | if (!this.gridColumns) {
|
6853 | return false;
|
6854 | }
|
6855 | var res = this.gridColumns.some(function (col) { return col.getColDef().floatingFilter; });
|
6856 | return res;
|
6857 | };
|
6858 | ColumnModel.prototype.getFirstDisplayedColumn = function () {
|
6859 | var isRtl = this.gridOptionsWrapper.isEnableRtl();
|
6860 | var queryOrder = [
|
6861 | 'getDisplayedLeftColumns',
|
6862 | 'getDisplayedCenterColumns',
|
6863 | 'getDisplayedRightColumns'
|
6864 | ];
|
6865 | if (isRtl) {
|
6866 | queryOrder.reverse();
|
6867 | }
|
6868 | for (var i = 0; i < queryOrder.length; i++) {
|
6869 | var container = this[queryOrder[i]]();
|
6870 | if (container.length) {
|
6871 | return isRtl ? last(container) : container[0];
|
6872 | }
|
6873 | }
|
6874 | return null;
|
6875 | };
|
6876 | __decorate$5([
|
6877 | Autowired('expressionService')
|
6878 | ], ColumnModel.prototype, "expressionService", void 0);
|
6879 | __decorate$5([
|
6880 | Autowired('columnFactory')
|
6881 | ], ColumnModel.prototype, "columnFactory", void 0);
|
6882 | __decorate$5([
|
6883 | Autowired('displayedGroupCreator')
|
6884 | ], ColumnModel.prototype, "displayedGroupCreator", void 0);
|
6885 | __decorate$5([
|
6886 | Autowired('ctrlsService')
|
6887 | ], ColumnModel.prototype, "ctrlsService", void 0);
|
6888 | __decorate$5([
|
6889 | Autowired('autoWidthCalculator')
|
6890 | ], ColumnModel.prototype, "autoWidthCalculator", void 0);
|
6891 | __decorate$5([
|
6892 | Autowired('columnUtils')
|
6893 | ], ColumnModel.prototype, "columnUtils", void 0);
|
6894 | __decorate$5([
|
6895 | Autowired('columnAnimationService')
|
6896 | ], ColumnModel.prototype, "columnAnimationService", void 0);
|
6897 | __decorate$5([
|
6898 | Autowired('autoGroupColService')
|
6899 | ], ColumnModel.prototype, "autoGroupColService", void 0);
|
6900 | __decorate$5([
|
6901 | Optional('aggFuncService')
|
6902 | ], ColumnModel.prototype, "aggFuncService", void 0);
|
6903 | __decorate$5([
|
6904 | Optional('valueCache')
|
6905 | ], ColumnModel.prototype, "valueCache", void 0);
|
6906 | __decorate$5([
|
6907 | Optional('animationFrameService')
|
6908 | ], ColumnModel.prototype, "animationFrameService", void 0);
|
6909 | __decorate$5([
|
6910 | Autowired('rowModel')
|
6911 | ], ColumnModel.prototype, "rowModel", void 0);
|
6912 | __decorate$5([
|
6913 | Autowired('columnApi')
|
6914 | ], ColumnModel.prototype, "columnApi", void 0);
|
6915 | __decorate$5([
|
6916 | Autowired('gridApi')
|
6917 | ], ColumnModel.prototype, "gridApi", void 0);
|
6918 | __decorate$5([
|
6919 | Autowired('sortController')
|
6920 | ], ColumnModel.prototype, "sortController", void 0);
|
6921 | __decorate$5([
|
6922 | Autowired('columnDefFactory')
|
6923 | ], ColumnModel.prototype, "columnDefFactory", void 0);
|
6924 | __decorate$5([
|
6925 | PostConstruct
|
6926 | ], ColumnModel.prototype, "init", null);
|
6927 | __decorate$5([
|
6928 | __param$2(0, Qualifier('loggerFactory'))
|
6929 | ], ColumnModel.prototype, "setBeans", null);
|
6930 | ColumnModel = __decorate$5([
|
6931 | Bean('columnModel')
|
6932 | ], ColumnModel);
|
6933 | return ColumnModel;
|
6934 | }(BeanStub));
|
6935 |
|
6936 |
|
6937 |
|
6938 |
|
6939 |
|
6940 |
|
6941 |
|
6942 | var __extends$2 = (undefined && undefined.__extends) || (function () {
|
6943 | var extendStatics = function (d, b) {
|
6944 | extendStatics = Object.setPrototypeOf ||
|
6945 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6946 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
6947 | return extendStatics(d, b);
|
6948 | };
|
6949 | return function (d, b) {
|
6950 | extendStatics(d, b);
|
6951 | function __() { this.constructor = d; }
|
6952 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
6953 | };
|
6954 | })();
|
6955 | var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
6956 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
6957 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
6958 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6959 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6960 | };
|
6961 |
|
6962 | var ColumnUtils = (function (_super) {
|
6963 | __extends$2(ColumnUtils, _super);
|
6964 | function ColumnUtils() {
|
6965 | return _super !== null && _super.apply(this, arguments) || this;
|
6966 | }
|
6967 | ColumnUtils.prototype.calculateColMinWidth = function (colDef) {
|
6968 | return colDef.minWidth != null ? colDef.minWidth : this.gridOptionsWrapper.getMinColWidth();
|
6969 | };
|
6970 | ColumnUtils.prototype.calculateColMaxWidth = function (colDef) {
|
6971 | return colDef.maxWidth != null ? colDef.maxWidth : (this.gridOptionsWrapper.getMaxColWidth() || Number.MAX_SAFE_INTEGER);
|
6972 | };
|
6973 | ColumnUtils.prototype.calculateColInitialWidth = function (colDef) {
|
6974 | var minColWidth = this.calculateColMinWidth(colDef);
|
6975 | var maxColWidth = this.calculateColMaxWidth(colDef);
|
6976 | var width;
|
6977 | var colDefWidth = attrToNumber(colDef.width);
|
6978 | var colDefInitialWidth = attrToNumber(colDef.initialWidth);
|
6979 | if (colDefWidth != null) {
|
6980 | width = colDefWidth;
|
6981 | }
|
6982 | else if (colDefInitialWidth != null) {
|
6983 | width = colDefInitialWidth;
|
6984 | }
|
6985 | else {
|
6986 | width = this.gridOptionsWrapper.getColWidth();
|
6987 | }
|
6988 | return Math.max(Math.min(width, maxColWidth), minColWidth);
|
6989 | };
|
6990 | ColumnUtils.prototype.getOriginalPathForColumn = function (column, originalBalancedTree) {
|
6991 | var result = [];
|
6992 | var found = false;
|
6993 | var recursePath = function (balancedColumnTree, dept) {
|
6994 | for (var i = 0; i < balancedColumnTree.length; i++) {
|
6995 | if (found) {
|
6996 | return;
|
6997 | }
|
6998 |
|
6999 | var node = balancedColumnTree[i];
|
7000 | if (node instanceof ProvidedColumnGroup) {
|
7001 | var nextNode = node;
|
7002 | recursePath(nextNode.getChildren(), dept + 1);
|
7003 | result[dept] = node;
|
7004 | }
|
7005 | else if (node === column) {
|
7006 | found = true;
|
7007 | }
|
7008 | }
|
7009 | };
|
7010 | recursePath(originalBalancedTree, 0);
|
7011 |
|
7012 |
|
7013 | return found ? result : null;
|
7014 | };
|
7015 | ColumnUtils.prototype.depthFirstOriginalTreeSearch = function (parent, tree, callback) {
|
7016 | var _this = this;
|
7017 | if (!tree) {
|
7018 | return;
|
7019 | }
|
7020 | tree.forEach(function (child) {
|
7021 | if (child instanceof ProvidedColumnGroup) {
|
7022 | _this.depthFirstOriginalTreeSearch(child, child.getChildren(), callback);
|
7023 | }
|
7024 | callback(child, parent);
|
7025 | });
|
7026 | };
|
7027 | ColumnUtils.prototype.depthFirstAllColumnTreeSearch = function (tree, callback) {
|
7028 | var _this = this;
|
7029 | if (!tree) {
|
7030 | return;
|
7031 | }
|
7032 | tree.forEach(function (child) {
|
7033 | if (child instanceof ColumnGroup) {
|
7034 | _this.depthFirstAllColumnTreeSearch(child.getChildren(), callback);
|
7035 | }
|
7036 | callback(child);
|
7037 | });
|
7038 | };
|
7039 | ColumnUtils.prototype.depthFirstDisplayedColumnTreeSearch = function (tree, callback) {
|
7040 | var _this = this;
|
7041 | if (!tree) {
|
7042 | return;
|
7043 | }
|
7044 | tree.forEach(function (child) {
|
7045 | if (child instanceof ColumnGroup) {
|
7046 | _this.depthFirstDisplayedColumnTreeSearch(child.getDisplayedChildren(), callback);
|
7047 | }
|
7048 | callback(child);
|
7049 | });
|
7050 | };
|
7051 | ColumnUtils = __decorate$6([
|
7052 | Bean('columnUtils')
|
7053 | ], ColumnUtils);
|
7054 | return ColumnUtils;
|
7055 | }(BeanStub));
|
7056 |
|
7057 |
|
7058 |
|
7059 |
|
7060 |
|
7061 |
|
7062 |
|
7063 | var __extends$3 = (undefined && undefined.__extends) || (function () {
|
7064 | var extendStatics = function (d, b) {
|
7065 | extendStatics = Object.setPrototypeOf ||
|
7066 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
7067 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
7068 | return extendStatics(d, b);
|
7069 | };
|
7070 | return function (d, b) {
|
7071 | extendStatics(d, b);
|
7072 | function __() { this.constructor = d; }
|
7073 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
7074 | };
|
7075 | })();
|
7076 | var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
7077 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
7078 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
7079 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
7080 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7081 | };
|
7082 |
|
7083 | var DisplayedGroupCreator = (function (_super) {
|
7084 | __extends$3(DisplayedGroupCreator, _super);
|
7085 | function DisplayedGroupCreator() {
|
7086 | return _super !== null && _super.apply(this, arguments) || this;
|
7087 | }
|
7088 | DisplayedGroupCreator.prototype.createDisplayedGroups = function (
|
7089 | // all displayed columns sorted - this is the columns the grid should show
|
7090 | sortedVisibleColumns,
|
7091 | // the tree of columns, as provided by the users, used to know what groups columns roll up into
|
7092 | balancedColumnTree,
|
7093 | // creates unique id's for the group
|
7094 | groupInstanceIdCreator,
|
7095 |
|
7096 | pinned,
|
7097 |
|
7098 | oldDisplayedGroups) {
|
7099 | var _this = this;
|
7100 | var result = [];
|
7101 | var previousRealPath;
|
7102 | var previousOriginalPath;
|
7103 | var oldColumnsMapped = this.mapOldGroupsById(oldDisplayedGroups);
|
7104 |
|
7105 |
|
7106 | sortedVisibleColumns.forEach(function (currentColumn) {
|
7107 | var currentOriginalPath = _this.getOriginalPathForColumn(balancedColumnTree, currentColumn);
|
7108 | var currentRealPath = [];
|
7109 | var firstColumn = !previousOriginalPath;
|
7110 | for (var i = 0; i < currentOriginalPath.length; i++) {
|
7111 | if (firstColumn || currentOriginalPath[i] !== previousOriginalPath[i]) {
|
7112 |
|
7113 | var newGroup = _this.createColumnGroup(currentOriginalPath[i], groupInstanceIdCreator, oldColumnsMapped, pinned);
|
7114 | currentRealPath[i] = newGroup;
|
7115 |
|
7116 | if (i == 0) {
|
7117 | result.push(newGroup);
|
7118 | }
|
7119 | else {
|
7120 | currentRealPath[i - 1].addChild(newGroup);
|
7121 | }
|
7122 | }
|
7123 | else {
|
7124 |
|
7125 | currentRealPath[i] = previousRealPath[i];
|
7126 | }
|
7127 | }
|
7128 | var noColumnGroups = currentRealPath.length === 0;
|
7129 | if (noColumnGroups) {
|
7130 |
|
7131 |
|
7132 | result.push(currentColumn);
|
7133 | }
|
7134 | else {
|
7135 | var leafGroup = last(currentRealPath);
|
7136 | leafGroup.addChild(currentColumn);
|
7137 | }
|
7138 | previousRealPath = currentRealPath;
|
7139 | previousOriginalPath = currentOriginalPath;
|
7140 | });
|
7141 | this.setupParentsIntoColumns(result, null);
|
7142 | return result;
|
7143 | };
|
7144 | DisplayedGroupCreator.prototype.createColumnGroup = function (providedGroup, groupInstanceIdCreator, oldColumnsMapped, pinned) {
|
7145 | var groupId = providedGroup.getGroupId();
|
7146 | var instanceId = groupInstanceIdCreator.getInstanceIdForKey(groupId);
|
7147 | var uniqueId = ColumnGroup.createUniqueId(groupId, instanceId);
|
7148 | var columnGroup = oldColumnsMapped[uniqueId];
|
7149 |
|
7150 |
|
7151 |
|
7152 | if (columnGroup && columnGroup.getProvidedColumnGroup() !== providedGroup) {
|
7153 | columnGroup = null;
|
7154 | }
|
7155 | if (exists(columnGroup)) {
|
7156 |
|
7157 | columnGroup.reset();
|
7158 | }
|
7159 | else {
|
7160 | columnGroup = new ColumnGroup(providedGroup, groupId, instanceId, pinned);
|
7161 | this.context.createBean(columnGroup);
|
7162 | }
|
7163 | return columnGroup;
|
7164 | };
|
7165 |
|
7166 | DisplayedGroupCreator.prototype.mapOldGroupsById = function (displayedGroups) {
|
7167 | var result = {};
|
7168 | var recursive = function (columnsOrGroups) {
|
7169 | columnsOrGroups.forEach(function (columnOrGroup) {
|
7170 | if (columnOrGroup instanceof ColumnGroup) {
|
7171 | var columnGroup = columnOrGroup;
|
7172 | result[columnOrGroup.getUniqueId()] = columnGroup;
|
7173 | recursive(columnGroup.getChildren());
|
7174 | }
|
7175 | });
|
7176 | };
|
7177 | if (displayedGroups) {
|
7178 | recursive(displayedGroups);
|
7179 | }
|
7180 | return result;
|
7181 | };
|
7182 | DisplayedGroupCreator.prototype.setupParentsIntoColumns = function (columnsOrGroups, parent) {
|
7183 | var _this = this;
|
7184 | columnsOrGroups.forEach(function (columnsOrGroup) {
|
7185 | columnsOrGroup.setParent(parent);
|
7186 | if (columnsOrGroup instanceof ColumnGroup) {
|
7187 | var columnGroup = columnsOrGroup;
|
7188 | _this.setupParentsIntoColumns(columnGroup.getChildren(), columnGroup);
|
7189 | }
|
7190 | });
|
7191 | };
|
7192 | DisplayedGroupCreator.prototype.getOriginalPathForColumn = function (balancedColumnTree, column) {
|
7193 | var result = [];
|
7194 | var found = false;
|
7195 | var recursePath = function (columnTree, dept) {
|
7196 | for (var i = 0; i < columnTree.length; i++) {
|
7197 |
|
7198 | if (found) {
|
7199 | return;
|
7200 | }
|
7201 | var node = columnTree[i];
|
7202 | if (node instanceof ProvidedColumnGroup) {
|
7203 | recursePath(node.getChildren(), dept + 1);
|
7204 | result[dept] = node;
|
7205 | }
|
7206 | else if (node === column) {
|
7207 | found = true;
|
7208 | }
|
7209 | }
|
7210 | };
|
7211 | recursePath(balancedColumnTree, 0);
|
7212 |
|
7213 |
|
7214 |
|
7215 | if (found) {
|
7216 | return result;
|
7217 | }
|
7218 | console.warn('AG Grid: could not get path');
|
7219 | return null;
|
7220 | };
|
7221 | DisplayedGroupCreator = __decorate$7([
|
7222 | Bean('displayedGroupCreator')
|
7223 | ], DisplayedGroupCreator);
|
7224 | return DisplayedGroupCreator;
|
7225 | }(BeanStub));
|
7226 |
|
7227 |
|
7228 |
|
7229 |
|
7230 |
|
7231 |
|
7232 |
|
7233 | var __read$1 = (undefined && undefined.__read) || function (o, n) {
|
7234 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
7235 | if (!m) return o;
|
7236 | var i = m.call(o), r, ar = [], e;
|
7237 | try {
|
7238 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
7239 | }
|
7240 | catch (error) { e = { error: error }; }
|
7241 | finally {
|
7242 | try {
|
7243 | if (r && !r.done && (m = i["return"])) m.call(i);
|
7244 | }
|
7245 | finally { if (e) throw e.error; }
|
7246 | }
|
7247 | return ar;
|
7248 | };
|
7249 | var __spread$1 = (undefined && undefined.__spread) || function () {
|
7250 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i]));
|
7251 | return ar;
|
7252 | };
|
7253 |
|
7254 |
|
7255 |
|
7256 |
|
7257 | var PropertyKeys = (function () {
|
7258 | function PropertyKeys() {
|
7259 | }
|
7260 | PropertyKeys.STRING_PROPERTIES = [
|
7261 | 'sortingOrder', 'rowClass', 'rowSelection', 'overlayLoadingTemplate', 'overlayNoRowsTemplate',
|
7262 | 'quickFilterText', 'rowModelType', 'editType', 'domLayout', 'clipboardDelimiter', 'rowGroupPanelShow',
|
7263 | 'multiSortKey', 'pivotColumnGroupTotals', 'pivotRowTotals', 'pivotPanelShow', 'fillHandleDirection',
|
7264 | 'serverSideStoreType', 'groupDisplayType', 'treeDataDisplayType'
|
7265 | ];
|
7266 | PropertyKeys.OBJECT_PROPERTIES = [
|
7267 | 'components', 'frameworkComponents', 'rowStyle', 'context', 'autoGroupColumnDef', 'localeText', 'icons',
|
7268 | 'datasource', 'serverSideDatasource', 'viewportDatasource', 'groupRowRendererParams', 'aggFuncs', 'fullWidthCellRendererParams',
|
7269 | 'defaultColGroupDef', 'defaultColDef', 'defaultExportParams', 'defaultCsvExportParams', 'defaultExcelExportParams', 'columnTypes',
|
7270 | 'rowClassRules', 'detailCellRendererParams', 'loadingCellRendererParams', 'loadingOverlayComponentParams',
|
7271 | 'noRowsOverlayComponentParams', 'popupParent', 'colResizeDefault', 'statusBar', 'sideBar', 'chartThemeOverrides',
|
7272 | 'customChartThemes'
|
7273 | ];
|
7274 | PropertyKeys.ARRAY_PROPERTIES = [
|
7275 | 'alignedGrids', 'rowData', 'columnDefs', 'excelStyles', 'pinnedTopRowData', 'pinnedBottomRowData', 'chartThemes'
|
7276 | ];
|
7277 | PropertyKeys.NUMBER_PROPERTIES = [
|
7278 | 'rowHeight', 'detailRowHeight', 'rowBuffer', 'colWidth', 'headerHeight', 'groupHeaderHeight', 'floatingFiltersHeight',
|
7279 | 'pivotHeaderHeight', 'pivotGroupHeaderHeight', 'groupDefaultExpanded', 'minColWidth', 'maxColWidth', 'viewportRowModelPageSize',
|
7280 | 'viewportRowModelBufferSize', 'autoSizePadding', 'maxBlocksInCache', 'maxConcurrentDatasourceRequests', 'tooltipShowDelay',
|
7281 | 'tooltipHideDelay', 'cacheOverflowSize', 'paginationPageSize', 'cacheBlockSize', 'infiniteInitialRowCount', 'scrollbarWidth',
|
7282 | 'batchUpdateWaitMillis', 'asyncTransactionWaitMillis', 'blockLoadDebounceMillis', 'keepDetailRowsCount',
|
7283 | 'undoRedoCellEditingLimit', 'cellFlashDelay', 'cellFadeDelay', 'tabIndex'
|
7284 | ];
|
7285 | PropertyKeys.BOOLEAN_PROPERTIES = [
|
7286 | 'suppressMakeColumnVisibleAfterUnGroup', 'suppressRowClickSelection', 'suppressCellSelection', 'suppressCellFocus', 'suppressHorizontalScroll',
|
7287 | 'alwaysShowHorizontalScroll', 'alwaysShowVerticalScroll', 'debug', 'enableBrowserTooltips', 'enableCellExpressions',
|
7288 | 'angularCompileRows', 'angularCompileFilters', 'groupSuppressAutoColumn', 'groupSelectsChildren', 'groupIncludeFooter',
|
7289 | 'groupIncludeTotalFooter', 'groupUseEntireRow', 'groupSuppressBlankHeader', 'suppressMenuHide', 'suppressRowDeselection',
|
7290 | 'unSortIcon', 'suppressMultiSort', 'alwaysMultiSort', 'singleClickEdit', 'suppressLoadingOverlay', 'suppressNoRowsOverlay', 'suppressAutoSize',
|
7291 | 'skipHeaderOnAutoSize', 'suppressParentsInRowNodes', 'suppressColumnMoveAnimation', 'suppressMovableColumns',
|
7292 | 'suppressFieldDotNotation', 'enableRangeSelection', 'enableRangeHandle', 'enableFillHandle', 'suppressClearOnFillReduction',
|
7293 | 'deltaSort', 'suppressTouch', 'suppressAsyncEvents', 'allowContextMenuWithControlKey', 'suppressContextMenu',
|
7294 | 'rememberGroupStateWhenNewData', 'enableCellChangeFlash', 'suppressDragLeaveHidesColumns', 'suppressMiddleClickScrolls',
|
7295 | 'suppressPreventDefaultOnMouseWheel', 'suppressCopyRowsToClipboard', 'copyHeadersToClipboard', 'copyGroupHeadersToClipboard',
|
7296 | 'pivotMode', 'suppressAggFuncInHeader', 'suppressColumnVirtualisation', 'suppressAggAtRootLevel', 'suppressFocusAfterRefresh',
|
7297 | 'functionsPassive', 'functionsReadOnly', 'animateRows', 'groupSelectsFiltered', 'groupRemoveSingleChildren',
|
7298 | 'groupRemoveLowestSingleChildren', 'enableRtl', 'suppressClickEdit', 'rowDragEntireRow', 'rowDragManaged', 'suppressRowDrag',
|
7299 | 'suppressMoveWhenRowDragging', 'rowDragMultiRow', 'enableGroupEdit', 'embedFullWidthRows', 'deprecatedEmbedFullWidthRows',
|
7300 | 'suppressPaginationPanel', 'groupHideOpenParents', 'groupMultiAutoColumn', 'pagination',
|
7301 | 'stopEditingWhenGridLosesFocus', 'paginationAutoPageSize', 'suppressScrollOnNewData', 'suppressScrollWhenPopupsAreOpen',
|
7302 | 'purgeClosedRowNodes', 'cacheQuickFilter', 'deltaRowDataMode', 'ensureDomOrder', 'accentedSort', 'suppressChangeDetection',
|
7303 | 'valueCache', 'valueCacheNeverExpires', 'aggregateOnlyChangedColumns', 'suppressAnimationFrame', 'suppressExcelExport',
|
7304 | 'suppressCsvExport', 'treeData', 'masterDetail', 'suppressMultiRangeSelection', 'enterMovesDownAfterEdit', 'enterMovesDown',
|
7305 | 'suppressPropertyNamesCheck', 'rowMultiSelectWithClick', 'suppressEnterpriseResetOnNewColumns',
|
7306 | 'suppressRowHoverHighlight', 'suppressRowTransform', 'suppressClipboardPaste', 'suppressLastEmptyLineOnPaste',
|
7307 | 'serverSideSortingAlwaysResets', 'suppressSetColumnStateEvents', 'suppressColumnStateEvents', 'enableCharts', 'deltaColumnMode',
|
7308 | 'suppressMaintainUnsortedOrder', 'enableCellTextSelection', 'suppressBrowserResizeObserver', 'suppressMaxRenderedRowRestriction',
|
7309 | 'excludeChildrenWhenTreeDataFiltering', 'tooltipMouseTrack', 'keepDetailRows', 'paginateChildRows', 'preventDefaultOnContextMenu',
|
7310 | 'undoRedoCellEditing', 'allowDragFromColumnsToolPanel', 'immutableData', 'immutableColumns', 'pivotSuppressAutoColumn',
|
7311 | 'suppressExpandablePivotGroups', 'applyColumnDefOrder', 'debounceVerticalScrollbar', 'detailRowAutoHeight',
|
7312 | 'serverSideFilteringAlwaysResets', 'suppressAggFilteredOnly', 'showOpenedGroup', 'suppressClipboardApi',
|
7313 | 'suppressModelUpdateAfterUpdateTransaction', 'stopEditingWhenCellsLoseFocus', 'maintainColumnOrder', 'groupMaintainOrder',
|
7314 | 'columnHoverHighlight', 'reactUi', 'suppressReactUi', 'readOnlyEdit', 'suppressRowVirtualisation',
|
7315 | 'resetRowDataOnUpdate', 'removePivotHeaderRowWhenSingleValueColumn', 'suppressCopySingleCellRanges'
|
7316 | ];
|
7317 |
|
7318 | PropertyKeys.FUNCTION_PROPERTIES = [
|
7319 | 'localeTextFunc', 'getLocaleText', 'groupRowInnerRenderer', 'groupRowInnerRendererFramework',
|
7320 | 'groupRowRenderer', 'groupRowRendererFramework', 'isExternalFilterPresent', 'getRowHeight', 'doesExternalFilterPass',
|
7321 | 'getRowClass', 'getRowStyle', 'getContextMenuItems', 'getMainMenuItems', 'processRowPostCreate', 'processCellForClipboard',
|
7322 | 'groupRowAggNodes', 'getGroupRowAgg', 'getRowNodeId', 'isFullWidthCell', 'isFullWidthRow', 'fullWidthCellRenderer', 'fullWidthCellRendererFramework',
|
7323 | 'processSecondaryColDef', 'processSecondaryColGroupDef',
|
7324 | 'getBusinessKeyForNode', 'sendToClipboard', 'navigateToNextHeader',
|
7325 | 'tabToNextHeader', 'navigateToNextCell', 'tabToNextCell', 'processCellFromClipboard', 'getDocument', 'postProcessPopup',
|
7326 | 'getChildCount', 'getDataPath', 'loadingCellRenderer', 'loadingCellRendererFramework', 'loadingOverlayComponent',
|
7327 | 'loadingOverlayComponentFramework', 'noRowsOverlayComponent', 'noRowsOverlayComponentFramework', 'detailCellRenderer',
|
7328 | 'detailCellRendererFramework', 'isRowMaster', 'isRowSelectable', 'postSort', 'postSortRows', 'processHeaderForClipboard', 'processGroupHeaderForClipboard',
|
7329 | 'paginationNumberFormatter', 'processDataFromClipboard', 'getServerSideGroupKey', 'isServerSideGroup', 'suppressKeyboardEvent',
|
7330 | 'createChartContainer', 'getChartToolbarItems', 'fillOperation', 'isApplyServerSideTransaction', 'getServerSideStoreParams',
|
7331 | 'isServerSideGroupOpenByDefault', 'isGroupOpenByDefault', 'defaultGroupSortComparator', 'defaultGroupOrderComparator', 'initialGroupOrderComparator',
|
7332 | 'loadingCellRendererSelector', 'getRowId', 'groupAggFiltering'
|
7333 | ];
|
7334 | PropertyKeys.ALL_PROPERTIES = __spread$1(PropertyKeys.ARRAY_PROPERTIES, PropertyKeys.OBJECT_PROPERTIES, PropertyKeys.STRING_PROPERTIES, PropertyKeys.NUMBER_PROPERTIES, PropertyKeys.FUNCTION_PROPERTIES, PropertyKeys.BOOLEAN_PROPERTIES);
|
7335 | |
7336 |
|
7337 |
|
7338 |
|
7339 | PropertyKeys.FRAMEWORK_PROPERTIES = [
|
7340 | '__ob__', '__v_skip', '__metadata__', 'mappedColumnProperties', 'hasChildColumns', 'toColDef', 'createColDefFromGridColumn'
|
7341 | ];
|
7342 | return PropertyKeys;
|
7343 | }());
|
7344 |
|
7345 |
|
7346 |
|
7347 |
|
7348 |
|
7349 |
|
7350 |
|
7351 | var __assign = (undefined && undefined.__assign) || function () {
|
7352 | __assign = Object.assign || function(t) {
|
7353 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
7354 | s = arguments[i];
|
7355 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7356 | t[p] = s[p];
|
7357 | }
|
7358 | return t;
|
7359 | };
|
7360 | return __assign.apply(this, arguments);
|
7361 | };
|
7362 | var __read$2 = (undefined && undefined.__read) || function (o, n) {
|
7363 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
7364 | if (!m) return o;
|
7365 | var i = m.call(o), r, ar = [], e;
|
7366 | try {
|
7367 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
7368 | }
|
7369 | catch (error) { e = { error: error }; }
|
7370 | finally {
|
7371 | try {
|
7372 | if (r && !r.done && (m = i["return"])) m.call(i);
|
7373 | }
|
7374 | finally { if (e) throw e.error; }
|
7375 | }
|
7376 | return ar;
|
7377 | };
|
7378 | var __spread$2 = (undefined && undefined.__spread) || function () {
|
7379 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$2(arguments[i]));
|
7380 | return ar;
|
7381 | };
|
7382 | var ComponentUtil = (function () {
|
7383 | function ComponentUtil() {
|
7384 | }
|
7385 | ComponentUtil.getEventCallbacks = function () {
|
7386 | if (!ComponentUtil.EVENT_CALLBACKS) {
|
7387 | ComponentUtil.EVENT_CALLBACKS = ComponentUtil.EVENTS.map(function (event) { return ComponentUtil.getCallbackForEvent(event); });
|
7388 | }
|
7389 | return ComponentUtil.EVENT_CALLBACKS;
|
7390 | };
|
7391 | ComponentUtil.copyAttributesToGridOptions = function (gridOptions, component, skipEventDeprecationCheck) {
|
7392 |
|
7393 | if (typeof gridOptions !== 'object') {
|
7394 | gridOptions = {};
|
7395 | }
|
7396 |
|
7397 | var pGridOptions = gridOptions;
|
7398 | var keyExists = function (key) { return typeof component[key] !== 'undefined'; };
|
7399 |
|
7400 | if (keyExists('groupAggFiltering') && typeof component.groupAggFiltering !== 'function') {
|
7401 | pGridOptions.groupAggFiltering = ComponentUtil.toBoolean(component.groupAggFiltering);
|
7402 | delete component.groupAggFiltering;
|
7403 | }
|
7404 |
|
7405 | __spread$2(ComponentUtil.ARRAY_PROPERTIES, ComponentUtil.STRING_PROPERTIES, ComponentUtil.OBJECT_PROPERTIES, ComponentUtil.FUNCTION_PROPERTIES, ComponentUtil.getEventCallbacks()).filter(keyExists)
|
7406 | .forEach(function (key) { return pGridOptions[key] = component[key]; });
|
7407 | ComponentUtil.BOOLEAN_PROPERTIES
|
7408 | .filter(keyExists)
|
7409 | .forEach(function (key) { return pGridOptions[key] = ComponentUtil.toBoolean(component[key]); });
|
7410 | ComponentUtil.NUMBER_PROPERTIES
|
7411 | .filter(keyExists)
|
7412 | .forEach(function (key) { return pGridOptions[key] = ComponentUtil.toNumber(component[key]); });
|
7413 | return gridOptions;
|
7414 | };
|
7415 | ComponentUtil.getCallbackForEvent = function (eventName) {
|
7416 | if (!eventName || eventName.length < 2) {
|
7417 | return eventName;
|
7418 | }
|
7419 | return 'on' + eventName[0].toUpperCase() + eventName.substr(1);
|
7420 | };
|
7421 | ComponentUtil.processOnChange = function (changes, gridOptions, api, columnApi) {
|
7422 | if (!changes) {
|
7423 | return;
|
7424 | }
|
7425 | var changesToApply = __assign({}, changes);
|
7426 |
|
7427 | var pGridOptions = gridOptions;
|
7428 | var keyExists = function (key) { return changesToApply[key]; };
|
7429 |
|
7430 | if (keyExists('groupAggFiltering')) {
|
7431 | if (typeof changesToApply.groupAggFiltering === 'function') {
|
7432 | pGridOptions.groupAggFiltering = changesToApply.groupAggFiltering;
|
7433 | }
|
7434 | else {
|
7435 | pGridOptions.groupAggFiltering = ComponentUtil.toBoolean(changesToApply.groupAggFiltering);
|
7436 | }
|
7437 | delete changesToApply.groupAggFiltering;
|
7438 | }
|
7439 |
|
7440 |
|
7441 |
|
7442 |
|
7443 | if (changesToApply.rowClass) {
|
7444 | api.setRowClass(changesToApply.rowClass.currentValue);
|
7445 | delete changesToApply.rowClass;
|
7446 | }
|
7447 |
|
7448 | __spread$2(ComponentUtil.ARRAY_PROPERTIES, ComponentUtil.OBJECT_PROPERTIES, ComponentUtil.STRING_PROPERTIES, ComponentUtil.getEventCallbacks()).filter(keyExists)
|
7449 | .forEach(function (key) { return pGridOptions[key] = changesToApply[key].currentValue; });
|
7450 | ComponentUtil.BOOLEAN_PROPERTIES
|
7451 | .filter(keyExists)
|
7452 | .forEach(function (key) { return pGridOptions[key] = ComponentUtil.toBoolean(changesToApply[key].currentValue); });
|
7453 | ComponentUtil.NUMBER_PROPERTIES
|
7454 | .filter(keyExists)
|
7455 | .forEach(function (key) { return pGridOptions[key] = ComponentUtil.toNumber(changesToApply[key].currentValue); });
|
7456 | if (changesToApply.enableCellTextSelection) {
|
7457 | api.setEnableCellTextSelection(ComponentUtil.toBoolean(changesToApply.enableCellTextSelection.currentValue));
|
7458 | delete changesToApply.enableCellTextSelection;
|
7459 | }
|
7460 | if (changesToApply.quickFilterText) {
|
7461 | api.setQuickFilter(changesToApply.quickFilterText.currentValue);
|
7462 | delete changesToApply.quickFilterText;
|
7463 | }
|
7464 | if (changesToApply.autoGroupColumnDef) {
|
7465 | api.setAutoGroupColumnDef(changesToApply.autoGroupColumnDef.currentValue, "gridOptionsChanged");
|
7466 | delete changesToApply.autoGroupColumnDef;
|
7467 | }
|
7468 | if (changesToApply.columnDefs) {
|
7469 | api.setColumnDefs(changesToApply.columnDefs.currentValue, "gridOptionsChanged");
|
7470 | delete changesToApply.columnDefs;
|
7471 | }
|
7472 | if (changesToApply.defaultColDef) {
|
7473 | api.setDefaultColDef(changesToApply.defaultColDef.currentValue, "gridOptionsChanged");
|
7474 | delete changesToApply.defaultColDef;
|
7475 | }
|
7476 | if (changesToApply.paginationPageSize) {
|
7477 | api.paginationSetPageSize(ComponentUtil.toNumber(changesToApply.paginationPageSize.currentValue));
|
7478 | delete changesToApply.paginationPageSize;
|
7479 | }
|
7480 | if (changesToApply.pivotMode) {
|
7481 | columnApi.setPivotMode(ComponentUtil.toBoolean(changesToApply.pivotMode.currentValue));
|
7482 | delete changesToApply.pivotMode;
|
7483 | }
|
7484 | if (changesToApply.groupRemoveSingleChildren) {
|
7485 | api.setGroupRemoveSingleChildren(ComponentUtil.toBoolean(changesToApply.groupRemoveSingleChildren.currentValue));
|
7486 | delete changesToApply.groupRemoveSingleChildren;
|
7487 | }
|
7488 | if (changesToApply.suppressRowDrag) {
|
7489 | api.setSuppressRowDrag(ComponentUtil.toBoolean(changesToApply.suppressRowDrag.currentValue));
|
7490 | delete changesToApply.suppressRowDrag;
|
7491 | }
|
7492 | if (changesToApply.suppressMoveWhenRowDragging) {
|
7493 | api.setSuppressMoveWhenRowDragging(ComponentUtil.toBoolean(changesToApply.suppressMoveWhenRowDragging.currentValue));
|
7494 | delete changesToApply.suppressMoveWhenRowDragging;
|
7495 | }
|
7496 | if (changesToApply.suppressRowClickSelection) {
|
7497 | api.setSuppressRowClickSelection(ComponentUtil.toBoolean(changesToApply.suppressRowClickSelection.currentValue));
|
7498 | delete changesToApply.suppressRowClickSelection;
|
7499 | }
|
7500 | if (changesToApply.suppressClipboardPaste) {
|
7501 | api.setSuppressClipboardPaste(ComponentUtil.toBoolean(changesToApply.suppressClipboardPaste.currentValue));
|
7502 | delete changesToApply.suppressClipboardPaste;
|
7503 | }
|
7504 | if (changesToApply.headerHeight) {
|
7505 | api.setHeaderHeight(ComponentUtil.toNumber(changesToApply.headerHeight.currentValue));
|
7506 | delete changesToApply.headerHeight;
|
7507 | }
|
7508 |
|
7509 |
|
7510 | var dynamicApi = api;
|
7511 | Object.keys(changesToApply)
|
7512 | .forEach(function (property) {
|
7513 | var setterName = "set" + property.charAt(0).toUpperCase() + property.substring(1);
|
7514 | if (dynamicApi[setterName]) {
|
7515 | dynamicApi[setterName](changes[property].currentValue);
|
7516 | }
|
7517 | });
|
7518 |
|
7519 | var event = {
|
7520 | type: Events.EVENT_COMPONENT_STATE_CHANGED,
|
7521 | api: gridOptions.api,
|
7522 | columnApi: gridOptions.columnApi
|
7523 | };
|
7524 | iterateObject(changes, function (key, value) {
|
7525 | event[key] = value;
|
7526 | });
|
7527 | api.dispatchEvent(event);
|
7528 | };
|
7529 | ComponentUtil.toBoolean = function (value) {
|
7530 | if (typeof value === 'boolean') {
|
7531 | return value;
|
7532 | }
|
7533 | if (typeof value === 'string') {
|
7534 |
|
7535 |
|
7536 | return value.toUpperCase() === 'TRUE' || value == '';
|
7537 | }
|
7538 | return false;
|
7539 | };
|
7540 | ComponentUtil.toNumber = function (value) {
|
7541 | if (typeof value === 'number') {
|
7542 | return value;
|
7543 | }
|
7544 | if (typeof value === 'string') {
|
7545 | return Number(value);
|
7546 | }
|
7547 | };
|
7548 |
|
7549 | ComponentUtil.EVENTS = [];
|
7550 |
|
7551 | ComponentUtil.PUBLIC_EVENTS = [];
|
7552 |
|
7553 | ComponentUtil.EXCLUDED_INTERNAL_EVENTS = [];
|
7554 | ComponentUtil.STRING_PROPERTIES = PropertyKeys.STRING_PROPERTIES;
|
7555 | ComponentUtil.OBJECT_PROPERTIES = PropertyKeys.OBJECT_PROPERTIES;
|
7556 | ComponentUtil.ARRAY_PROPERTIES = PropertyKeys.ARRAY_PROPERTIES;
|
7557 | ComponentUtil.NUMBER_PROPERTIES = PropertyKeys.NUMBER_PROPERTIES;
|
7558 | ComponentUtil.BOOLEAN_PROPERTIES = PropertyKeys.BOOLEAN_PROPERTIES;
|
7559 | ComponentUtil.FUNCTION_PROPERTIES = PropertyKeys.FUNCTION_PROPERTIES;
|
7560 | ComponentUtil.ALL_PROPERTIES = PropertyKeys.ALL_PROPERTIES;
|
7561 | return ComponentUtil;
|
7562 | }());
|
7563 | ComponentUtil.EVENTS = values(Events);
|
7564 |
|
7565 | ComponentUtil.EXCLUDED_INTERNAL_EVENTS = [
|
7566 | Events.EVENT_SCROLLBAR_WIDTH_CHANGED,
|
7567 | Events.EVENT_CHECKBOX_CHANGED,
|
7568 | Events.EVENT_HEIGHT_SCALE_CHANGED,
|
7569 | Events.EVENT_BODY_HEIGHT_CHANGED,
|
7570 | Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED,
|
7571 | Events.EVENT_SCROLL_VISIBILITY_CHANGED,
|
7572 | Events.EVENT_COLUMN_HOVER_CHANGED,
|
7573 | Events.EVENT_FLASH_CELLS,
|
7574 | Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED,
|
7575 | Events.EVENT_DISPLAYED_ROWS_CHANGED,
|
7576 | Events.EVENT_LEFT_PINNED_WIDTH_CHANGED,
|
7577 | Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED,
|
7578 | Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED,
|
7579 | Events.EVENT_POPUP_TO_FRONT,
|
7580 | Events.EVENT_KEYBOARD_FOCUS,
|
7581 | Events.EVENT_MOUSE_FOCUS,
|
7582 | Events.EVENT_STORE_UPDATED,
|
7583 | Events.EVENT_COLUMN_PANEL_ITEM_DRAG_START,
|
7584 | Events.EVENT_COLUMN_PANEL_ITEM_DRAG_END,
|
7585 | Events.EVENT_FILL_START,
|
7586 | Events.EVENT_FILL_END,
|
7587 | Events.EVENT_FULL_WIDTH_ROW_FOCUSED
|
7588 | ];
|
7589 |
|
7590 | ComponentUtil.PUBLIC_EVENTS = ComponentUtil.EVENTS.filter(function (e) { return !includes(ComponentUtil.EXCLUDED_INTERNAL_EVENTS, e); });
|
7591 |
|
7592 |
|
7593 |
|
7594 |
|
7595 |
|
7596 |
|
7597 |
|
7598 | var __extends$4 = (undefined && undefined.__extends) || (function () {
|
7599 | var extendStatics = function (d, b) {
|
7600 | extendStatics = Object.setPrototypeOf ||
|
7601 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
7602 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
7603 | return extendStatics(d, b);
|
7604 | };
|
7605 | return function (d, b) {
|
7606 | extendStatics(d, b);
|
7607 | function __() { this.constructor = d; }
|
7608 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
7609 | };
|
7610 | })();
|
7611 | var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
7612 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
7613 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
7614 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
7615 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7616 | };
|
7617 | var AgStackComponentsRegistry = (function (_super) {
|
7618 | __extends$4(AgStackComponentsRegistry, _super);
|
7619 | function AgStackComponentsRegistry() {
|
7620 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
7621 | _this.componentsMappedByName = {};
|
7622 | return _this;
|
7623 | }
|
7624 | AgStackComponentsRegistry.prototype.setupComponents = function (components) {
|
7625 | var _this = this;
|
7626 | if (components) {
|
7627 | components.forEach(function (componentMeta) { return _this.addComponent(componentMeta); });
|
7628 | }
|
7629 | };
|
7630 | AgStackComponentsRegistry.prototype.addComponent = function (componentMeta) {
|
7631 |
|
7632 |
|
7633 |
|
7634 |
|
7635 | var classEscaped = componentMeta.componentName.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
7636 |
|
7637 | var classUpperCase = classEscaped.toUpperCase();
|
7638 |
|
7639 | this.componentsMappedByName[classUpperCase] = componentMeta.componentClass;
|
7640 | };
|
7641 | AgStackComponentsRegistry.prototype.getComponentClass = function (htmlTag) {
|
7642 | return this.componentsMappedByName[htmlTag];
|
7643 | };
|
7644 | AgStackComponentsRegistry = __decorate$8([
|
7645 | Bean('agStackComponentsRegistry')
|
7646 | ], AgStackComponentsRegistry);
|
7647 | return AgStackComponentsRegistry;
|
7648 | }(BeanStub));
|
7649 |
|
7650 |
|
7651 |
|
7652 |
|
7653 |
|
7654 |
|
7655 |
|
7656 | var __read$3 = (undefined && undefined.__read) || function (o, n) {
|
7657 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
7658 | if (!m) return o;
|
7659 | var i = m.call(o), r, ar = [], e;
|
7660 | try {
|
7661 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
7662 | }
|
7663 | catch (error) { e = { error: error }; }
|
7664 | finally {
|
7665 | try {
|
7666 | if (r && !r.done && (m = i["return"])) m.call(i);
|
7667 | }
|
7668 | finally { if (e) throw e.error; }
|
7669 | }
|
7670 | return ar;
|
7671 | };
|
7672 | var __spread$3 = (undefined && undefined.__spread) || function () {
|
7673 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$3(arguments[i]));
|
7674 | return ar;
|
7675 | };
|
7676 | var ColDefUtil = (function () {
|
7677 | function ColDefUtil() {
|
7678 | }
|
7679 | ColDefUtil.STRING_PROPERTIES = [
|
7680 | 'headerName',
|
7681 | 'columnGroupShow',
|
7682 | 'headerClass',
|
7683 | 'toolPanelClass',
|
7684 | 'headerValueGetter',
|
7685 | 'pivotKeys',
|
7686 | 'groupId',
|
7687 | 'colId',
|
7688 | 'sort',
|
7689 | 'initialSort',
|
7690 | 'field',
|
7691 | 'type',
|
7692 | 'tooltipComponent',
|
7693 | 'tooltipField',
|
7694 | 'headerTooltip',
|
7695 | 'cellClass',
|
7696 | 'showRowGroup',
|
7697 | 'filter',
|
7698 | 'initialAggFunc',
|
7699 | 'defaultAggFunc',
|
7700 | 'aggFunc',
|
7701 | 'pinned',
|
7702 | 'initialPinned',
|
7703 | 'chartDataType',
|
7704 | 'cellEditorPopupPosition'
|
7705 | ];
|
7706 | ColDefUtil.OBJECT_PROPERTIES = [
|
7707 | 'headerGroupComponent',
|
7708 | 'headerGroupComponentFramework',
|
7709 | 'headerGroupComponentParams',
|
7710 | 'cellStyle',
|
7711 | 'cellRenderer',
|
7712 | 'cellRendererParams',
|
7713 | 'cellRendererFramework',
|
7714 | 'cellEditor',
|
7715 | 'cellEditorFramework',
|
7716 | 'cellEditorParams',
|
7717 | 'pinnedRowCellRendererFramework',
|
7718 | 'pinnedRowCellRendererParams',
|
7719 | 'filterFramework',
|
7720 | 'filterParams',
|
7721 | 'pivotValueColumn',
|
7722 | 'headerComponent',
|
7723 | 'headerComponentFramework',
|
7724 | 'headerComponentParams',
|
7725 | 'floatingFilterComponent',
|
7726 | 'floatingFilterComponentParams',
|
7727 | 'floatingFilterComponentFramework',
|
7728 | 'floatingFilterFramework',
|
7729 | 'tooltipComponent',
|
7730 | 'tooltipComponentParams',
|
7731 | 'tooltipComponentFramework',
|
7732 | 'refData',
|
7733 | 'columnsMenuParams'
|
7734 | ];
|
7735 | ColDefUtil.ARRAY_PROPERTIES = [
|
7736 | 'children',
|
7737 | 'sortingOrder',
|
7738 | 'allowedAggFuncs',
|
7739 | 'menuTabs',
|
7740 | 'pivotTotalColumnIds',
|
7741 | 'cellClassRules',
|
7742 | 'icons'
|
7743 | ];
|
7744 | ColDefUtil.NUMBER_PROPERTIES = [
|
7745 | 'sortedAt',
|
7746 | 'sortIndex',
|
7747 | 'initialSortIndex',
|
7748 | 'flex',
|
7749 | 'initialFlex',
|
7750 | 'width',
|
7751 | 'initialWidth',
|
7752 | 'minWidth',
|
7753 | 'maxWidth',
|
7754 | 'rowGroupIndex',
|
7755 | 'initialRowGroupIndex',
|
7756 | 'pivotIndex',
|
7757 | 'initialPivotIndex'
|
7758 | ];
|
7759 | ColDefUtil.BOOLEAN_PROPERTIES = [
|
7760 | 'suppressCellFlash',
|
7761 | 'suppressColumnsToolPanel',
|
7762 | 'suppressFiltersToolPanel',
|
7763 | 'openByDefault',
|
7764 | 'marryChildren',
|
7765 | 'hide',
|
7766 | 'initialHide',
|
7767 | 'rowGroup',
|
7768 | 'initialRowGroup',
|
7769 | 'pivot',
|
7770 | 'initialPivot',
|
7771 | 'checkboxSelection',
|
7772 | 'headerCheckboxSelection',
|
7773 | 'headerCheckboxSelectionFilteredOnly',
|
7774 | 'suppressMenu',
|
7775 | 'suppressMovable',
|
7776 | 'lockPosition',
|
7777 | 'lockVisible',
|
7778 | 'lockPinned',
|
7779 | 'unSortIcon',
|
7780 | 'suppressSizeToFit',
|
7781 | 'suppressAutoSize',
|
7782 | 'enableRowGroup',
|
7783 | 'enablePivot',
|
7784 | 'enableValue',
|
7785 | 'editable',
|
7786 | 'suppressPaste',
|
7787 | 'suppressNavigable',
|
7788 | 'enableCellChangeFlash',
|
7789 | 'rowDrag',
|
7790 | 'dndSource',
|
7791 | 'autoHeight',
|
7792 | 'wrapText',
|
7793 | 'sortable',
|
7794 | 'resizable',
|
7795 | 'singleClickEdit',
|
7796 | 'floatingFilter',
|
7797 | 'cellEditorPopup',
|
7798 | 'suppressFillHandle'
|
7799 | ];
|
7800 | ColDefUtil.FUNCTION_PROPERTIES = [
|
7801 | 'dndSourceOnRowDrag',
|
7802 | 'valueGetter',
|
7803 | 'valueSetter',
|
7804 | 'filterValueGetter',
|
7805 | 'keyCreator',
|
7806 | 'pinnedRowCellRenderer',
|
7807 | 'valueFormatter',
|
7808 | 'pinnedRowValueFormatter',
|
7809 | 'valueParser',
|
7810 | 'comparator',
|
7811 | 'equals',
|
7812 | 'pivotComparator',
|
7813 | 'suppressKeyboardEvent',
|
7814 | 'suppressHeaderKeyboardEvent',
|
7815 | 'colSpan',
|
7816 | 'rowSpan',
|
7817 | 'getQuickFilterText',
|
7818 | 'newValueHandler',
|
7819 | 'onCellValueChanged',
|
7820 | 'onCellClicked',
|
7821 | 'onCellDoubleClicked',
|
7822 | 'onCellContextMenu',
|
7823 | 'rowDragText',
|
7824 | 'tooltipValueGetter',
|
7825 | 'tooltipComponent',
|
7826 | 'tooltipComponentFramework',
|
7827 | 'cellRendererSelector',
|
7828 | 'cellEditorSelector'
|
7829 | ];
|
7830 | ColDefUtil.ALL_PROPERTIES = __spread$3(ColDefUtil.ARRAY_PROPERTIES, ColDefUtil.OBJECT_PROPERTIES, ColDefUtil.STRING_PROPERTIES, ColDefUtil.NUMBER_PROPERTIES, ColDefUtil.FUNCTION_PROPERTIES, ColDefUtil.BOOLEAN_PROPERTIES);
|
7831 |
|
7832 |
|
7833 | ColDefUtil.FRAMEWORK_PROPERTIES = [
|
7834 | '__ob__',
|
7835 | '__v_skip',
|
7836 | '__metadata__',
|
7837 | 'mappedColumnProperties',
|
7838 | 'hasChildColumns',
|
7839 | 'toColDef',
|
7840 | 'createColDefFromGridColumn'
|
7841 | ];
|
7842 | return ColDefUtil;
|
7843 | }());
|
7844 |
|
7845 |
|
7846 |
|
7847 |
|
7848 |
|
7849 |
|
7850 |
|
7851 | var __read$4 = (undefined && undefined.__read) || function (o, n) {
|
7852 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
7853 | if (!m) return o;
|
7854 | var i = m.call(o), r, ar = [], e;
|
7855 | try {
|
7856 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
7857 | }
|
7858 | catch (error) { e = { error: error }; }
|
7859 | finally {
|
7860 | try {
|
7861 | if (r && !r.done && (m = i["return"])) m.call(i);
|
7862 | }
|
7863 | finally { if (e) throw e.error; }
|
7864 | }
|
7865 | return ar;
|
7866 | };
|
7867 | var Color = (function () {
|
7868 | |
7869 |
|
7870 |
|
7871 |
|
7872 |
|
7873 |
|
7874 |
|
7875 |
|
7876 |
|
7877 |
|
7878 |
|
7879 |
|
7880 | function Color(r, g, b, a) {
|
7881 | if (a === void 0) { a = 1; }
|
7882 |
|
7883 | this.r = Math.min(1, Math.max(0, r || 0));
|
7884 | this.g = Math.min(1, Math.max(0, g || 0));
|
7885 | this.b = Math.min(1, Math.max(0, b || 0));
|
7886 | this.a = Math.min(1, Math.max(0, a || 0));
|
7887 | }
|
7888 | |
7889 |
|
7890 |
|
7891 |
|
7892 |
|
7893 |
|
7894 |
|
7895 |
|
7896 |
|
7897 | Color.fromString = function (str) {
|
7898 |
|
7899 | if (str.indexOf('#') >= 0) {
|
7900 | return Color.fromHexString(str);
|
7901 | }
|
7902 |
|
7903 | var hex = Color.nameToHex[str];
|
7904 | if (hex) {
|
7905 | return Color.fromHexString(hex);
|
7906 | }
|
7907 |
|
7908 | if (str.indexOf('rgb') >= 0) {
|
7909 | return Color.fromRgbaString(str);
|
7910 | }
|
7911 | throw new Error("Invalid color string: '" + str + "'");
|
7912 | };
|
7913 |
|
7914 | Color.parseHex = function (input) {
|
7915 | input = input.replace(/ /g, '').slice(1);
|
7916 | var parts;
|
7917 | switch (input.length) {
|
7918 | case 6:
|
7919 | case 8:
|
7920 | parts = [];
|
7921 | for (var i = 0; i < input.length; i += 2) {
|
7922 | parts.push(parseInt("" + input[i] + input[i + 1], 16));
|
7923 | }
|
7924 | break;
|
7925 | case 3:
|
7926 | case 4:
|
7927 | parts = input.split('').map(function (p) { return parseInt(p, 16); }).map(function (p) { return p + p * 16; });
|
7928 | break;
|
7929 | }
|
7930 | if (parts.length >= 3) {
|
7931 | if (parts.every(function (p) { return p >= 0; })) {
|
7932 | if (parts.length === 3) {
|
7933 | parts.push(255);
|
7934 | }
|
7935 | return parts;
|
7936 | }
|
7937 | }
|
7938 | };
|
7939 | Color.fromHexString = function (str) {
|
7940 | var values = Color.parseHex(str);
|
7941 | if (values) {
|
7942 | var _a = __read$4(values, 4), r = _a[0], g = _a[1], b = _a[2], a = _a[3];
|
7943 | return new Color(r / 255, g / 255, b / 255, a / 255);
|
7944 | }
|
7945 | throw new Error("Malformed hexadecimal color string: '" + str + "'");
|
7946 | };
|
7947 | Color.stringToRgba = function (str) {
|
7948 |
|
7949 | var _a = __read$4([NaN, NaN], 2), po = _a[0], pc = _a[1];
|
7950 | for (var i = 0; i < str.length; i++) {
|
7951 | var c = str[i];
|
7952 | if (!po && c === '(') {
|
7953 | po = i;
|
7954 | }
|
7955 | else if (c === ')') {
|
7956 | pc = i;
|
7957 | break;
|
7958 | }
|
7959 | }
|
7960 | var contents = po && pc && str.substring(po + 1, pc);
|
7961 | if (!contents) {
|
7962 | return;
|
7963 | }
|
7964 | var parts = contents.split(',');
|
7965 | var rgba = [];
|
7966 | for (var i = 0; i < parts.length; i++) {
|
7967 | var part = parts[i];
|
7968 | var value = parseFloat(part);
|
7969 | if (isNaN(value)) {
|
7970 | return;
|
7971 | }
|
7972 | if (part.indexOf('%') >= 0) {
|
7973 | value = Math.max(0, Math.min(100, value));
|
7974 | value /= 100;
|
7975 | }
|
7976 | else {
|
7977 | if (i === 3) {
|
7978 | value = Math.max(0, Math.min(1, value));
|
7979 | }
|
7980 | else {
|
7981 | value = Math.max(0, Math.min(255, value));
|
7982 | value /= 255;
|
7983 | }
|
7984 | }
|
7985 | rgba.push(value);
|
7986 | }
|
7987 | return rgba;
|
7988 | };
|
7989 | Color.fromRgbaString = function (str) {
|
7990 | var rgba = Color.stringToRgba(str);
|
7991 | if (rgba) {
|
7992 | if (rgba.length === 3) {
|
7993 | return new Color(rgba[0], rgba[1], rgba[2]);
|
7994 | }
|
7995 | else if (rgba.length === 4) {
|
7996 | return new Color(rgba[0], rgba[1], rgba[2], rgba[3]);
|
7997 | }
|
7998 | }
|
7999 | throw new Error("Malformed rgb/rgba color string: '" + str + "'");
|
8000 | };
|
8001 | Color.fromArray = function (arr) {
|
8002 | if (arr.length === 4) {
|
8003 | return new Color(arr[0], arr[1], arr[2], arr[3]);
|
8004 | }
|
8005 | if (arr.length === 3) {
|
8006 | return new Color(arr[0], arr[1], arr[2]);
|
8007 | }
|
8008 | throw new Error('The given array should contain 3 or 4 color components (numbers).');
|
8009 | };
|
8010 | Color.fromHSB = function (h, s, b, alpha) {
|
8011 | if (alpha === void 0) { alpha = 1; }
|
8012 | var rgb = Color.HSBtoRGB(h, s, b);
|
8013 | return new Color(rgb[0], rgb[1], rgb[2], alpha);
|
8014 | };
|
8015 | Color.padHex = function (str) {
|
8016 |
|
8017 | return str.length === 1 ? '0' + str : str;
|
8018 | };
|
8019 | Color.prototype.toHexString = function () {
|
8020 | var hex = '#'
|
8021 | + Color.padHex(Math.round(this.r * 255).toString(16))
|
8022 | + Color.padHex(Math.round(this.g * 255).toString(16))
|
8023 | + Color.padHex(Math.round(this.b * 255).toString(16));
|
8024 | if (this.a < 1) {
|
8025 | hex += Color.padHex(Math.round(this.a * 255).toString(16));
|
8026 | }
|
8027 | return hex;
|
8028 | };
|
8029 | Color.prototype.toRgbaString = function (fractionDigits) {
|
8030 | if (fractionDigits === void 0) { fractionDigits = 3; }
|
8031 | var components = [
|
8032 | Math.round(this.r * 255),
|
8033 | Math.round(this.g * 255),
|
8034 | Math.round(this.b * 255)
|
8035 | ];
|
8036 | var k = Math.pow(10, fractionDigits);
|
8037 | if (this.a !== 1) {
|
8038 | components.push(Math.round(this.a * k) / k);
|
8039 | return "rgba(" + components.join(', ') + ")";
|
8040 | }
|
8041 | return "rgb(" + components.join(', ') + ")";
|
8042 | };
|
8043 | Color.prototype.toString = function () {
|
8044 | if (this.a === 1) {
|
8045 | return this.toHexString();
|
8046 | }
|
8047 | return this.toRgbaString();
|
8048 | };
|
8049 | Color.prototype.toHSB = function () {
|
8050 | return Color.RGBtoHSB(this.r, this.g, this.b);
|
8051 | };
|
8052 | |
8053 |
|
8054 |
|
8055 |
|
8056 | Color.RGBtoHSB = function (r, g, b) {
|
8057 | var min = Math.min(r, g, b);
|
8058 | var max = Math.max(r, g, b);
|
8059 | var S = max !== 0 ? (max - min) / max : 0;
|
8060 | var H = NaN;
|
8061 |
|
8062 |
|
8063 | if (min !== max) {
|
8064 | var delta = max - min;
|
8065 | var rc = (max - r) / delta;
|
8066 | var gc = (max - g) / delta;
|
8067 | var bc = (max - b) / delta;
|
8068 | if (r === max) {
|
8069 | H = bc - gc;
|
8070 | }
|
8071 | else if (g === max) {
|
8072 | H = 2.0 + rc - bc;
|
8073 | }
|
8074 | else {
|
8075 | H = 4.0 + gc - rc;
|
8076 | }
|
8077 | H /= 6.0;
|
8078 | if (H < 0) {
|
8079 | H = H + 1.0;
|
8080 | }
|
8081 | }
|
8082 | return [H * 360, S, max];
|
8083 | };
|
8084 | |
8085 |
|
8086 |
|
8087 | Color.HSBtoRGB = function (H, S, B) {
|
8088 | if (isNaN(H)) {
|
8089 | H = 0;
|
8090 | }
|
8091 | H = (((H % 360) + 360) % 360) / 360;
|
8092 | var r = 0;
|
8093 | var g = 0;
|
8094 | var b = 0;
|
8095 | if (S === 0) {
|
8096 | r = g = b = B;
|
8097 | }
|
8098 | else {
|
8099 | var h = (H - Math.floor(H)) * 6;
|
8100 | var f = h - Math.floor(h);
|
8101 | var p = B * (1 - S);
|
8102 | var q = B * (1 - S * f);
|
8103 | var t = B * (1 - (S * (1 - f)));
|
8104 | switch (h >> 0) {
|
8105 | case 0:
|
8106 | r = B;
|
8107 | g = t;
|
8108 | b = p;
|
8109 | break;
|
8110 | case 1:
|
8111 | r = q;
|
8112 | g = B;
|
8113 | b = p;
|
8114 | break;
|
8115 | case 2:
|
8116 | r = p;
|
8117 | g = B;
|
8118 | b = t;
|
8119 | break;
|
8120 | case 3:
|
8121 | r = p;
|
8122 | g = q;
|
8123 | b = B;
|
8124 | break;
|
8125 | case 4:
|
8126 | r = t;
|
8127 | g = p;
|
8128 | b = B;
|
8129 | break;
|
8130 | case 5:
|
8131 | r = B;
|
8132 | g = p;
|
8133 | b = q;
|
8134 | break;
|
8135 | }
|
8136 | }
|
8137 | return [r, g, b];
|
8138 | };
|
8139 | Color.prototype.derive = function (hueShift, saturationFactor, brightnessFactor, opacityFactor) {
|
8140 | var hsb = Color.RGBtoHSB(this.r, this.g, this.b);
|
8141 | var b = hsb[2];
|
8142 | if (b == 0 && brightnessFactor > 1.0) {
|
8143 | b = 0.05;
|
8144 | }
|
8145 | var h = (((hsb[0] + hueShift) % 360) + 360) % 360;
|
8146 | var s = Math.max(Math.min(hsb[1] * saturationFactor, 1.0), 0.0);
|
8147 | b = Math.max(Math.min(b * brightnessFactor, 1.0), 0.0);
|
8148 | var a = Math.max(Math.min(this.a * opacityFactor, 1.0), 0.0);
|
8149 | var rgba = Color.HSBtoRGB(h, s, b);
|
8150 | rgba.push(a);
|
8151 | return Color.fromArray(rgba);
|
8152 | };
|
8153 | Color.prototype.brighter = function () {
|
8154 | return this.derive(0, 1.0, 1.0 / 0.7, 1.0);
|
8155 | };
|
8156 | Color.prototype.darker = function () {
|
8157 | return this.derive(0, 1.0, 0.7, 1.0);
|
8158 | };
|
8159 | |
8160 |
|
8161 |
|
8162 |
|
8163 | Color.nameToHex = Object.freeze({
|
8164 | aliceblue: '#F0F8FF',
|
8165 | antiquewhite: '#FAEBD7',
|
8166 | aqua: '#00FFFF',
|
8167 | aquamarine: '#7FFFD4',
|
8168 | azure: '#F0FFFF',
|
8169 | beige: '#F5F5DC',
|
8170 | bisque: '#FFE4C4',
|
8171 | black: '#000000',
|
8172 | blanchedalmond: '#FFEBCD',
|
8173 | blue: '#0000FF',
|
8174 | blueviolet: '#8A2BE2',
|
8175 | brown: '#A52A2A',
|
8176 | burlywood: '#DEB887',
|
8177 | cadetblue: '#5F9EA0',
|
8178 | chartreuse: '#7FFF00',
|
8179 | chocolate: '#D2691E',
|
8180 | coral: '#FF7F50',
|
8181 | cornflowerblue: '#6495ED',
|
8182 | cornsilk: '#FFF8DC',
|
8183 | crimson: '#DC143C',
|
8184 | cyan: '#00FFFF',
|
8185 | darkblue: '#00008B',
|
8186 | darkcyan: '#008B8B',
|
8187 | darkgoldenrod: '#B8860B',
|
8188 | darkgray: '#A9A9A9',
|
8189 | darkgreen: '#006400',
|
8190 | darkgrey: '#A9A9A9',
|
8191 | darkkhaki: '#BDB76B',
|
8192 | darkmagenta: '#8B008B',
|
8193 | darkolivegreen: '#556B2F',
|
8194 | darkorange: '#FF8C00',
|
8195 | darkorchid: '#9932CC',
|
8196 | darkred: '#8B0000',
|
8197 | darksalmon: '#E9967A',
|
8198 | darkseagreen: '#8FBC8F',
|
8199 | darkslateblue: '#483D8B',
|
8200 | darkslategray: '#2F4F4F',
|
8201 | darkslategrey: '#2F4F4F',
|
8202 | darkturquoise: '#00CED1',
|
8203 | darkviolet: '#9400D3',
|
8204 | deeppink: '#FF1493',
|
8205 | deepskyblue: '#00BFFF',
|
8206 | dimgray: '#696969',
|
8207 | dimgrey: '#696969',
|
8208 | dodgerblue: '#1E90FF',
|
8209 | firebrick: '#B22222',
|
8210 | floralwhite: '#FFFAF0',
|
8211 | forestgreen: '#228B22',
|
8212 | fuchsia: '#FF00FF',
|
8213 | gainsboro: '#DCDCDC',
|
8214 | ghostwhite: '#F8F8FF',
|
8215 | gold: '#FFD700',
|
8216 | goldenrod: '#DAA520',
|
8217 | gray: '#808080',
|
8218 | green: '#008000',
|
8219 | greenyellow: '#ADFF2F',
|
8220 | grey: '#808080',
|
8221 | honeydew: '#F0FFF0',
|
8222 | hotpink: '#FF69B4',
|
8223 | indianred: '#CD5C5C',
|
8224 | indigo: '#4B0082',
|
8225 | ivory: '#FFFFF0',
|
8226 | khaki: '#F0E68C',
|
8227 | lavender: '#E6E6FA',
|
8228 | lavenderblush: '#FFF0F5',
|
8229 | lawngreen: '#7CFC00',
|
8230 | lemonchiffon: '#FFFACD',
|
8231 | lightblue: '#ADD8E6',
|
8232 | lightcoral: '#F08080',
|
8233 | lightcyan: '#E0FFFF',
|
8234 | lightgoldenrodyellow: '#FAFAD2',
|
8235 | lightgray: '#D3D3D3',
|
8236 | lightgreen: '#90EE90',
|
8237 | lightgrey: '#D3D3D3',
|
8238 | lightpink: '#FFB6C1',
|
8239 | lightsalmon: '#FFA07A',
|
8240 | lightseagreen: '#20B2AA',
|
8241 | lightskyblue: '#87CEFA',
|
8242 | lightslategray: '#778899',
|
8243 | lightslategrey: '#778899',
|
8244 | lightsteelblue: '#B0C4DE',
|
8245 | lightyellow: '#FFFFE0',
|
8246 | lime: '#00FF00',
|
8247 | limegreen: '#32CD32',
|
8248 | linen: '#FAF0E6',
|
8249 | magenta: '#FF00FF',
|
8250 | maroon: '#800000',
|
8251 | mediumaquamarine: '#66CDAA',
|
8252 | mediumblue: '#0000CD',
|
8253 | mediumorchid: '#BA55D3',
|
8254 | mediumpurple: '#9370DB',
|
8255 | mediumseagreen: '#3CB371',
|
8256 | mediumslateblue: '#7B68EE',
|
8257 | mediumspringgreen: '#00FA9A',
|
8258 | mediumturquoise: '#48D1CC',
|
8259 | mediumvioletred: '#C71585',
|
8260 | midnightblue: '#191970',
|
8261 | mintcream: '#F5FFFA',
|
8262 | mistyrose: '#FFE4E1',
|
8263 | moccasin: '#FFE4B5',
|
8264 | navajowhite: '#FFDEAD',
|
8265 | navy: '#000080',
|
8266 | oldlace: '#FDF5E6',
|
8267 | olive: '#808000',
|
8268 | olivedrab: '#6B8E23',
|
8269 | orange: '#FFA500',
|
8270 | orangered: '#FF4500',
|
8271 | orchid: '#DA70D6',
|
8272 | palegoldenrod: '#EEE8AA',
|
8273 | palegreen: '#98FB98',
|
8274 | paleturquoise: '#AFEEEE',
|
8275 | palevioletred: '#DB7093',
|
8276 | papayawhip: '#FFEFD5',
|
8277 | peachpuff: '#FFDAB9',
|
8278 | peru: '#CD853F',
|
8279 | pink: '#FFC0CB',
|
8280 | plum: '#DDA0DD',
|
8281 | powderblue: '#B0E0E6',
|
8282 | purple: '#800080',
|
8283 | rebeccapurple: '#663399',
|
8284 | red: '#FF0000',
|
8285 | rosybrown: '#BC8F8F',
|
8286 | royalblue: '#4169E1',
|
8287 | saddlebrown: '#8B4513',
|
8288 | salmon: '#FA8072',
|
8289 | sandybrown: '#F4A460',
|
8290 | seagreen: '#2E8B57',
|
8291 | seashell: '#FFF5EE',
|
8292 | sienna: '#A0522D',
|
8293 | silver: '#C0C0C0',
|
8294 | skyblue: '#87CEEB',
|
8295 | slateblue: '#6A5ACD',
|
8296 | slategray: '#708090',
|
8297 | slategrey: '#708090',
|
8298 | snow: '#FFFAFA',
|
8299 | springgreen: '#00FF7F',
|
8300 | steelblue: '#4682B4',
|
8301 | tan: '#D2B48C',
|
8302 | teal: '#008080',
|
8303 | thistle: '#D8BFD8',
|
8304 | tomato: '#FF6347',
|
8305 | turquoise: '#40E0D0',
|
8306 | violet: '#EE82EE',
|
8307 | wheat: '#F5DEB3',
|
8308 | white: '#FFFFFF',
|
8309 | whitesmoke: '#F5F5F5',
|
8310 | yellow: '#FFFF00',
|
8311 | yellowgreen: '#9ACD32'
|
8312 | });
|
8313 | return Color;
|
8314 | }());
|
8315 |
|
8316 |
|
8317 |
|
8318 |
|
8319 |
|
8320 |
|
8321 |
|
8322 |
|
8323 |
|
8324 | function stringToArray(strData, delimiter) {
|
8325 | if (delimiter === void 0) { delimiter = ','; }
|
8326 | var data = [];
|
8327 | var isNewline = function (char) { return char === '\r' || char === '\n'; };
|
8328 | var insideQuotedField = false;
|
8329 | if (strData === '') {
|
8330 | return [['']];
|
8331 | }
|
8332 | var _loop_1 = function (row, column, position) {
|
8333 | var previousChar = strData[position - 1];
|
8334 | var currentChar = strData[position];
|
8335 | var nextChar = strData[position + 1];
|
8336 | var ensureDataExists = function () {
|
8337 | if (!data[row]) {
|
8338 |
|
8339 | data[row] = [];
|
8340 | }
|
8341 | if (!data[row][column]) {
|
8342 |
|
8343 | data[row][column] = '';
|
8344 | }
|
8345 | };
|
8346 | ensureDataExists();
|
8347 | if (currentChar === '"') {
|
8348 | if (insideQuotedField) {
|
8349 | if (nextChar === '"') {
|
8350 |
|
8351 | data[row][column] += '"';
|
8352 | position++;
|
8353 | }
|
8354 | else {
|
8355 |
|
8356 | insideQuotedField = false;
|
8357 | }
|
8358 | return out_row_1 = row, out_column_1 = column, out_position_1 = position, "continue";
|
8359 | }
|
8360 | else if (previousChar === undefined || previousChar === delimiter || isNewline(previousChar)) {
|
8361 |
|
8362 | insideQuotedField = true;
|
8363 | return out_row_1 = row, out_column_1 = column, out_position_1 = position, "continue";
|
8364 | }
|
8365 | }
|
8366 | if (!insideQuotedField) {
|
8367 | if (currentChar === delimiter) {
|
8368 |
|
8369 | column++;
|
8370 | ensureDataExists();
|
8371 | return out_row_1 = row, out_column_1 = column, out_position_1 = position, "continue";
|
8372 | }
|
8373 | else if (isNewline(currentChar)) {
|
8374 |
|
8375 | column = 0;
|
8376 | row++;
|
8377 | ensureDataExists();
|
8378 | if (currentChar === '\r' && nextChar === '\n') {
|
8379 |
|
8380 | position++;
|
8381 | }
|
8382 | return out_row_1 = row, out_column_1 = column, out_position_1 = position, "continue";
|
8383 | }
|
8384 | }
|
8385 |
|
8386 | data[row][column] += currentChar;
|
8387 | out_row_1 = row;
|
8388 | out_column_1 = column;
|
8389 | out_position_1 = position;
|
8390 | };
|
8391 | var out_row_1, out_column_1, out_position_1;
|
8392 |
|
8393 | for (var row = 0, column = 0, position = 0; position < strData.length; position++) {
|
8394 | _loop_1(row, column, position);
|
8395 | row = out_row_1;
|
8396 | column = out_column_1;
|
8397 | position = out_position_1;
|
8398 | }
|
8399 | return data;
|
8400 | }
|
8401 |
|
8402 | var CsvUtils = Object.freeze({
|
8403 | __proto__: null,
|
8404 | stringToArray: stringToArray
|
8405 | });
|
8406 |
|
8407 |
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 |
|
8413 | var __values$1 = (undefined && undefined.__values) || function(o) {
|
8414 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
8415 | if (m) return m.call(o);
|
8416 | if (o && typeof o.length === "number") return {
|
8417 | next: function () {
|
8418 | if (o && i >= o.length) o = void 0;
|
8419 | return { value: o && o[i++], done: !o };
|
8420 | }
|
8421 | };
|
8422 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
8423 | };
|
8424 |
|
8425 |
|
8426 |
|
8427 |
|
8428 |
|
8429 | var isSafari;
|
8430 | var isIE;
|
8431 | var isEdge;
|
8432 | var isChrome;
|
8433 | var isFirefox;
|
8434 | var isIOS;
|
8435 | var invisibleScrollbar;
|
8436 | var browserScrollbarWidth;
|
8437 | function isBrowserIE() {
|
8438 | if (isIE === undefined) {
|
8439 | isIE = !!document.documentMode;
|
8440 | }
|
8441 | return isIE;
|
8442 | }
|
8443 | function isBrowserEdge() {
|
8444 | if (isEdge === undefined) {
|
8445 | isEdge = !isBrowserIE() && !!window.StyleMedia;
|
8446 | }
|
8447 | return isEdge;
|
8448 | }
|
8449 | function isBrowserSafari() {
|
8450 | if (isSafari === undefined) {
|
8451 |
|
8452 | isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
8453 | }
|
8454 | return isSafari;
|
8455 | }
|
8456 | function isBrowserChrome() {
|
8457 | if (isChrome === undefined) {
|
8458 | var win = window;
|
8459 | isChrome = (!!win.chrome && (!!win.chrome.webstore || !!win.chrome.runtime)) ||
|
8460 | (/Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor));
|
8461 | }
|
8462 | return isChrome;
|
8463 | }
|
8464 | function isBrowserFirefox() {
|
8465 | if (isFirefox === undefined) {
|
8466 | var win = window;
|
8467 | isFirefox = typeof win.InstallTrigger !== 'undefined';
|
8468 | }
|
8469 | return isFirefox;
|
8470 | }
|
8471 | function isIOSUserAgent() {
|
8472 | if (isIOS === undefined) {
|
8473 |
|
8474 | isIOS = (/iPad|iPhone|iPod/.test(navigator.platform) ||
|
8475 |
|
8476 | (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) &&
|
8477 |
|
8478 | !window.MSStream;
|
8479 | }
|
8480 | return isIOS;
|
8481 | }
|
8482 | function getTabIndex(el) {
|
8483 | if (!el) {
|
8484 | return null;
|
8485 | }
|
8486 | var numberTabIndex = el.tabIndex;
|
8487 | var tabIndex = el.getAttribute('tabIndex');
|
8488 | if (numberTabIndex === -1 && (tabIndex === null || (tabIndex === '' && !isBrowserFirefox()))) {
|
8489 | return null;
|
8490 | }
|
8491 | return numberTabIndex.toString();
|
8492 | }
|
8493 | function getMaxDivHeight() {
|
8494 | if (!document.body) {
|
8495 | return -1;
|
8496 | }
|
8497 | var res = 1000000;
|
8498 |
|
8499 | var testUpTo = navigator.userAgent.toLowerCase().match(/firefox/) ? 6000000 : 1000000000;
|
8500 | var div = document.createElement('div');
|
8501 | document.body.appendChild(div);
|
8502 | while (true) {
|
8503 | var test = res * 2;
|
8504 | div.style.height = test + 'px';
|
8505 | if (test > testUpTo || div.clientHeight !== test) {
|
8506 | break;
|
8507 | }
|
8508 | else {
|
8509 | res = test;
|
8510 | }
|
8511 | }
|
8512 | document.body.removeChild(div);
|
8513 | return res;
|
8514 | }
|
8515 | function getScrollbarWidth() {
|
8516 | if (browserScrollbarWidth == null) {
|
8517 | initScrollbarWidthAndVisibility();
|
8518 | }
|
8519 | return browserScrollbarWidth;
|
8520 | }
|
8521 | function initScrollbarWidthAndVisibility() {
|
8522 | var body = document.body;
|
8523 | var div = document.createElement('div');
|
8524 | div.style.width = div.style.height = '100px';
|
8525 | div.style.opacity = '0';
|
8526 | div.style.overflow = 'scroll';
|
8527 | div.style.msOverflowStyle = 'scrollbar';
|
8528 | div.style.position = 'absolute';
|
8529 | body.appendChild(div);
|
8530 | var width = div.offsetWidth - div.clientWidth;
|
8531 |
|
8532 | if (width === 0 && div.clientWidth === 0) {
|
8533 | width = null;
|
8534 | }
|
8535 |
|
8536 | if (div.parentNode) {
|
8537 | div.parentNode.removeChild(div);
|
8538 | }
|
8539 | if (width != null) {
|
8540 | browserScrollbarWidth = width;
|
8541 | invisibleScrollbar = width === 0;
|
8542 | }
|
8543 | }
|
8544 | function isInvisibleScrollbar() {
|
8545 | if (invisibleScrollbar == null) {
|
8546 | initScrollbarWidthAndVisibility();
|
8547 | }
|
8548 | return invisibleScrollbar;
|
8549 | }
|
8550 |
|
8551 | function hasOverflowScrolling() {
|
8552 | var e_1, _a;
|
8553 | var prefixes = ['webkit', 'moz', 'o', 'ms'];
|
8554 | var div = document.createElement('div');
|
8555 | var body = document.getElementsByTagName('body')[0];
|
8556 | var found = false;
|
8557 | var p;
|
8558 | body.appendChild(div);
|
8559 | div.setAttribute('style', prefixes.map(function (prefix) { return "-" + prefix + "-overflow-scrolling: touch"; }).concat('overflow-scrolling: touch').join(';'));
|
8560 | var computedStyle = window.getComputedStyle(div);
|
8561 | if (computedStyle.overflowScrolling === 'touch') {
|
8562 | found = true;
|
8563 | }
|
8564 | if (!found) {
|
8565 | try {
|
8566 | for (var prefixes_1 = __values$1(prefixes), prefixes_1_1 = prefixes_1.next(); !prefixes_1_1.done; prefixes_1_1 = prefixes_1.next()) {
|
8567 | p = prefixes_1_1.value;
|
8568 | if (computedStyle[p + "OverflowScrolling"] === 'touch') {
|
8569 | found = true;
|
8570 | break;
|
8571 | }
|
8572 | }
|
8573 | }
|
8574 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
8575 | finally {
|
8576 | try {
|
8577 | if (prefixes_1_1 && !prefixes_1_1.done && (_a = prefixes_1.return)) _a.call(prefixes_1);
|
8578 | }
|
8579 | finally { if (e_1) throw e_1.error; }
|
8580 | }
|
8581 | }
|
8582 | if (div.parentNode) {
|
8583 | div.parentNode.removeChild(div);
|
8584 | }
|
8585 | return found;
|
8586 | }
|
8587 |
|
8588 |
|
8589 |
|
8590 |
|
8591 |
|
8592 | function getBodyWidth() {
|
8593 | if (document.body) {
|
8594 | return document.body.clientWidth;
|
8595 | }
|
8596 | if (window.innerHeight) {
|
8597 | return window.innerWidth;
|
8598 | }
|
8599 | if (document.documentElement && document.documentElement.clientWidth) {
|
8600 | return document.documentElement.clientWidth;
|
8601 | }
|
8602 | return -1;
|
8603 | }
|
8604 |
|
8605 |
|
8606 |
|
8607 |
|
8608 |
|
8609 | function getBodyHeight() {
|
8610 | if (document.body) {
|
8611 | return document.body.clientHeight;
|
8612 | }
|
8613 | if (window.innerHeight) {
|
8614 | return window.innerHeight;
|
8615 | }
|
8616 | if (document.documentElement && document.documentElement.clientHeight) {
|
8617 | return document.documentElement.clientHeight;
|
8618 | }
|
8619 | return -1;
|
8620 | }
|
8621 |
|
8622 | var BrowserUtils = Object.freeze({
|
8623 | __proto__: null,
|
8624 | isBrowserEdge: isBrowserEdge,
|
8625 | isBrowserSafari: isBrowserSafari,
|
8626 | isBrowserChrome: isBrowserChrome,
|
8627 | isBrowserFirefox: isBrowserFirefox,
|
8628 | isIOSUserAgent: isIOSUserAgent,
|
8629 | getTabIndex: getTabIndex,
|
8630 | getMaxDivHeight: getMaxDivHeight,
|
8631 | getScrollbarWidth: getScrollbarWidth,
|
8632 | isInvisibleScrollbar: isInvisibleScrollbar,
|
8633 | hasOverflowScrolling: hasOverflowScrolling,
|
8634 | getBodyWidth: getBodyWidth,
|
8635 | getBodyHeight: getBodyHeight
|
8636 | });
|
8637 |
|
8638 |
|
8639 |
|
8640 |
|
8641 |
|
8642 |
|
8643 |
|
8644 | var rtlNegativeScroll;
|
8645 |
|
8646 |
|
8647 |
|
8648 |
|
8649 |
|
8650 |
|
8651 |
|
8652 | function radioCssClass(element, elementClass, otherElementClass) {
|
8653 | var parent = element.parentElement;
|
8654 | var sibling = parent && parent.firstChild;
|
8655 | while (sibling) {
|
8656 | if (elementClass) {
|
8657 | sibling.classList.toggle(elementClass, sibling === element);
|
8658 | }
|
8659 | if (otherElementClass) {
|
8660 | sibling.classList.toggle(otherElementClass, sibling !== element);
|
8661 | }
|
8662 | sibling = sibling.nextSibling;
|
8663 | }
|
8664 | }
|
8665 | function isFocusableFormField(element) {
|
8666 | var matches = Element.prototype.matches || Element.prototype.msMatchesSelector;
|
8667 | var isFocusable = matches.call(element, Constants.INPUT_SELECTOR);
|
8668 | var isNotFocusable = matches.call(element, Constants.FOCUSABLE_EXCLUDE);
|
8669 | var isElementVisible = isVisible(element);
|
8670 | var focusable = isFocusable && !isNotFocusable && isElementVisible;
|
8671 | return focusable;
|
8672 | }
|
8673 | function setDisplayed(element, displayed) {
|
8674 | element.classList.toggle('ag-hidden', !displayed);
|
8675 | }
|
8676 | function setVisible(element, visible) {
|
8677 | element.classList.toggle('ag-invisible', !visible);
|
8678 | }
|
8679 | function setDisabled(element, disabled) {
|
8680 | var attributeName = 'disabled';
|
8681 | var addOrRemoveDisabledAttribute = disabled ?
|
8682 | function (e) { return e.setAttribute(attributeName, ''); } :
|
8683 | function (e) { return e.removeAttribute(attributeName); };
|
8684 | addOrRemoveDisabledAttribute(element);
|
8685 | nodeListForEach(element.querySelectorAll('input'), function (input) { return addOrRemoveDisabledAttribute(input); });
|
8686 | }
|
8687 | function isElementChildOfClass(element, cls, maxNest) {
|
8688 | var counter = 0;
|
8689 | while (element) {
|
8690 | if (element.classList.contains(cls)) {
|
8691 | return true;
|
8692 | }
|
8693 | element = element.parentElement;
|
8694 | if (maxNest && ++counter > maxNest) {
|
8695 | break;
|
8696 | }
|
8697 | }
|
8698 | return false;
|
8699 | }
|
8700 |
|
8701 |
|
8702 |
|
8703 |
|
8704 | function getElementSize(el) {
|
8705 | 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;
|
8706 | return {
|
8707 | height: parseFloat(height),
|
8708 | width: parseFloat(width),
|
8709 | paddingTop: parseFloat(paddingTop),
|
8710 | paddingRight: parseFloat(paddingRight),
|
8711 | paddingBottom: parseFloat(paddingBottom),
|
8712 | paddingLeft: parseFloat(paddingLeft),
|
8713 | marginTop: parseFloat(marginTop),
|
8714 | marginRight: parseFloat(marginRight),
|
8715 | marginBottom: parseFloat(marginBottom),
|
8716 | marginLeft: parseFloat(marginLeft),
|
8717 | boxSizing: boxSizing
|
8718 | };
|
8719 | }
|
8720 | function getInnerHeight(el) {
|
8721 | var size = getElementSize(el);
|
8722 | if (size.boxSizing === 'border-box') {
|
8723 | return size.height - size.paddingTop - size.paddingBottom;
|
8724 | }
|
8725 | return size.height;
|
8726 | }
|
8727 | function getInnerWidth(el) {
|
8728 | var size = getElementSize(el);
|
8729 | if (size.boxSizing === 'border-box') {
|
8730 | return size.width - size.paddingLeft - size.paddingRight;
|
8731 | }
|
8732 | return size.width;
|
8733 | }
|
8734 | function getAbsoluteHeight(el) {
|
8735 | var size = getElementSize(el);
|
8736 | var marginRight = size.marginBottom + size.marginTop;
|
8737 | return Math.ceil(el.offsetHeight + marginRight);
|
8738 | }
|
8739 | function getAbsoluteWidth(el) {
|
8740 | var size = getElementSize(el);
|
8741 | var marginWidth = size.marginLeft + size.marginRight;
|
8742 | return Math.ceil(el.offsetWidth + marginWidth);
|
8743 | }
|
8744 | function isRtlNegativeScroll() {
|
8745 | if (typeof rtlNegativeScroll === "boolean") {
|
8746 | return rtlNegativeScroll;
|
8747 | }
|
8748 | var template = document.createElement('div');
|
8749 | template.style.direction = 'rtl';
|
8750 | template.style.width = '1px';
|
8751 | template.style.height = '1px';
|
8752 | template.style.position = 'fixed';
|
8753 | template.style.top = '0px';
|
8754 | template.style.overflow = 'hidden';
|
8755 | template.dir = 'rtl';
|
8756 | template.innerHTML =
|
8757 | "<div style=\"width: 2px\">\n <span style=\"display: inline-block; width: 1px\"></span>\n <span style=\"display: inline-block; width: 1px\"></span>\n </div>";
|
8758 | document.body.appendChild(template);
|
8759 | template.scrollLeft = 1;
|
8760 | rtlNegativeScroll = Math.floor(template.scrollLeft) === 0;
|
8761 | document.body.removeChild(template);
|
8762 | return rtlNegativeScroll;
|
8763 | }
|
8764 | function getScrollLeft(element, rtl) {
|
8765 | var scrollLeft = element.scrollLeft;
|
8766 | if (rtl) {
|
8767 |
|
8768 | scrollLeft = Math.abs(scrollLeft);
|
8769 | if (isBrowserChrome() && !isRtlNegativeScroll()) {
|
8770 | scrollLeft = element.scrollWidth - element.clientWidth - scrollLeft;
|
8771 | }
|
8772 | }
|
8773 | return scrollLeft;
|
8774 | }
|
8775 | function setScrollLeft(element, value, rtl) {
|
8776 | if (rtl) {
|
8777 |
|
8778 | if (isRtlNegativeScroll()) {
|
8779 | value *= -1;
|
8780 | }
|
8781 | else if (isBrowserSafari() || isBrowserChrome()) {
|
8782 | value = element.scrollWidth - element.clientWidth - value;
|
8783 | }
|
8784 | }
|
8785 | element.scrollLeft = value;
|
8786 | }
|
8787 | function clearElement(el) {
|
8788 | while (el && el.firstChild) {
|
8789 | el.removeChild(el.firstChild);
|
8790 | }
|
8791 | }
|
8792 |
|
8793 | function removeElement(parent, cssSelector) {
|
8794 | removeFromParent(parent.querySelector(cssSelector));
|
8795 | }
|
8796 | function removeFromParent(node) {
|
8797 | if (node && node.parentNode) {
|
8798 | node.parentNode.removeChild(node);
|
8799 | }
|
8800 | }
|
8801 | function isVisible(element) {
|
8802 | return element.offsetParent !== null;
|
8803 | }
|
8804 |
|
8805 |
|
8806 |
|
8807 |
|
8808 |
|
8809 |
|
8810 | function loadTemplate(template) {
|
8811 |
|
8812 | if (DOMParser !== null) {
|
8813 | var parser = new DOMParser();
|
8814 | var doc = parser.parseFromString(template, "text/html");
|
8815 | return doc.body.firstChild;
|
8816 | }
|
8817 | var tempDiv = document.createElement('div');
|
8818 | tempDiv.innerHTML = (template || '').trim();
|
8819 | return tempDiv.firstChild;
|
8820 | }
|
8821 | function appendHtml(eContainer, htmlTemplate) {
|
8822 | if (eContainer.lastChild) {
|
8823 |
|
8824 |
|
8825 |
|
8826 |
|
8827 | eContainer.insertAdjacentHTML('afterbegin', htmlTemplate);
|
8828 | }
|
8829 | else {
|
8830 | eContainer.innerHTML = htmlTemplate;
|
8831 | }
|
8832 | }
|
8833 |
|
8834 | function getElementAttribute(element, attributeName) {
|
8835 | if (element.attributes && element.attributes[attributeName]) {
|
8836 | var attribute = element.attributes[attributeName];
|
8837 | return attribute.value;
|
8838 | }
|
8839 | return null;
|
8840 | }
|
8841 | function offsetHeight(element) {
|
8842 | return element && element.clientHeight ? element.clientHeight : 0;
|
8843 | }
|
8844 | function offsetWidth(element) {
|
8845 | return element && element.clientWidth ? element.clientWidth : 0;
|
8846 | }
|
8847 | function ensureDomOrder(eContainer, eChild, eChildBefore) {
|
8848 |
|
8849 | if (eChildBefore && eChildBefore.nextSibling === eChild) {
|
8850 | return;
|
8851 | }
|
8852 | if (eChildBefore) {
|
8853 | if (eChildBefore.nextSibling) {
|
8854 |
|
8855 | eContainer.insertBefore(eChild, eChildBefore.nextSibling);
|
8856 | }
|
8857 | else {
|
8858 |
|
8859 | eContainer.appendChild(eChild);
|
8860 | }
|
8861 | }
|
8862 | else {
|
8863 |
|
8864 | if (eContainer.firstChild && eContainer.firstChild !== eChild) {
|
8865 |
|
8866 | eContainer.insertAdjacentElement('afterbegin', eChild);
|
8867 | }
|
8868 | }
|
8869 | }
|
8870 | function setDomChildOrder(eContainer, orderedChildren) {
|
8871 | for (var i = 0; i < orderedChildren.length; i++) {
|
8872 | var correctCellAtIndex = orderedChildren[i];
|
8873 | var actualCellAtIndex = eContainer.children[i];
|
8874 | if (actualCellAtIndex !== correctCellAtIndex) {
|
8875 | eContainer.insertBefore(correctCellAtIndex, actualCellAtIndex);
|
8876 | }
|
8877 | }
|
8878 | }
|
8879 | function insertWithDomOrder(eContainer, eToInsert, eChildBefore) {
|
8880 | if (eChildBefore) {
|
8881 |
|
8882 | eChildBefore.insertAdjacentElement('afterend', eToInsert);
|
8883 | }
|
8884 | else {
|
8885 | if (eContainer.firstChild) {
|
8886 |
|
8887 | eContainer.insertAdjacentElement('afterbegin', eToInsert);
|
8888 | }
|
8889 | else {
|
8890 |
|
8891 | eContainer.appendChild(eToInsert);
|
8892 | }
|
8893 | }
|
8894 | }
|
8895 |
|
8896 | function prependDC(parent, documentFragment) {
|
8897 | if (exists(parent.firstChild)) {
|
8898 | parent.insertBefore(documentFragment, parent.firstChild);
|
8899 | }
|
8900 | else {
|
8901 | parent.appendChild(documentFragment);
|
8902 | }
|
8903 | }
|
8904 | function addStylesToElement(eElement, styles) {
|
8905 | if (!styles) {
|
8906 | return;
|
8907 | }
|
8908 | Object.keys(styles).forEach(function (key) {
|
8909 | var keyCamelCase = hyphenToCamelCase(key);
|
8910 | if (keyCamelCase) {
|
8911 | eElement.style[keyCamelCase] = styles[key];
|
8912 | }
|
8913 | });
|
8914 | }
|
8915 | function isHorizontalScrollShowing(element) {
|
8916 | return element.clientWidth < element.scrollWidth;
|
8917 | }
|
8918 | function isVerticalScrollShowing(element) {
|
8919 | return element.clientHeight < element.scrollHeight;
|
8920 | }
|
8921 | function setElementWidth(element, width) {
|
8922 | if (width === 'flex') {
|
8923 | element.style.removeProperty('width');
|
8924 | element.style.removeProperty('minWidth');
|
8925 | element.style.removeProperty('maxWidth');
|
8926 | element.style.flex = '1 1 auto';
|
8927 | }
|
8928 | else {
|
8929 | setFixedWidth(element, width);
|
8930 | }
|
8931 | }
|
8932 | function setFixedWidth(element, width) {
|
8933 | width = formatSize(width);
|
8934 | element.style.width = width.toString();
|
8935 | element.style.maxWidth = width.toString();
|
8936 | element.style.minWidth = width.toString();
|
8937 | }
|
8938 | function setElementHeight(element, height) {
|
8939 | if (height === 'flex') {
|
8940 | element.style.removeProperty('height');
|
8941 | element.style.removeProperty('minHeight');
|
8942 | element.style.removeProperty('maxHeight');
|
8943 | element.style.flex = '1 1 auto';
|
8944 | }
|
8945 | else {
|
8946 | setFixedHeight(element, height);
|
8947 | }
|
8948 | }
|
8949 | function setFixedHeight(element, height) {
|
8950 | height = formatSize(height);
|
8951 | element.style.height = height.toString();
|
8952 | element.style.maxHeight = height.toString();
|
8953 | element.style.minHeight = height.toString();
|
8954 | }
|
8955 | function formatSize(size) {
|
8956 | if (typeof size === 'number') {
|
8957 | return size + "px";
|
8958 | }
|
8959 | return size;
|
8960 | }
|
8961 |
|
8962 |
|
8963 |
|
8964 |
|
8965 |
|
8966 |
|
8967 | function isNode(o) {
|
8968 | return (typeof Node === 'function'
|
8969 | ? o instanceof Node
|
8970 | : o && typeof o === 'object' && typeof o.nodeType === 'number' && typeof o.nodeName === 'string');
|
8971 | }
|
8972 |
|
8973 |
|
8974 |
|
8975 |
|
8976 |
|
8977 |
|
8978 |
|
8979 | function isElement(o) {
|
8980 | return (typeof HTMLElement === 'function'
|
8981 | ? o instanceof HTMLElement
|
8982 | : o && isNonNullObject(o) && o.nodeType === 1 && typeof o.nodeName === 'string');
|
8983 | }
|
8984 | function isNodeOrElement(o) {
|
8985 | return isNode(o) || isElement(o);
|
8986 | }
|
8987 |
|
8988 |
|
8989 |
|
8990 |
|
8991 |
|
8992 | function copyNodeList(nodeList) {
|
8993 | if (nodeList == null) {
|
8994 | return [];
|
8995 | }
|
8996 | var result = [];
|
8997 | nodeListForEach(nodeList, function (node) { return result.push(node); });
|
8998 | return result;
|
8999 | }
|
9000 | function iterateNamedNodeMap(map, callback) {
|
9001 | if (!map) {
|
9002 | return;
|
9003 | }
|
9004 | for (var i = 0; i < map.length; i++) {
|
9005 | var attr = map[i];
|
9006 | callback(attr.name, attr.value);
|
9007 | }
|
9008 | }
|
9009 |
|
9010 | function setCheckboxState(eCheckbox, state) {
|
9011 | if (typeof state === 'boolean') {
|
9012 | eCheckbox.checked = state;
|
9013 | eCheckbox.indeterminate = false;
|
9014 | }
|
9015 | else {
|
9016 |
|
9017 |
|
9018 | eCheckbox.indeterminate = true;
|
9019 | }
|
9020 | }
|
9021 | function addOrRemoveAttribute(element, name, value) {
|
9022 | if (value == null) {
|
9023 | element.removeAttribute(name);
|
9024 | }
|
9025 | else {
|
9026 | element.setAttribute(name, value.toString());
|
9027 | }
|
9028 | }
|
9029 | function nodeListForEach(nodeList, action) {
|
9030 | if (nodeList == null) {
|
9031 | return;
|
9032 | }
|
9033 | for (var i = 0; i < nodeList.length; i++) {
|
9034 | action(nodeList[i]);
|
9035 | }
|
9036 | }
|
9037 |
|
9038 | var DomUtils = Object.freeze({
|
9039 | __proto__: null,
|
9040 | radioCssClass: radioCssClass,
|
9041 | isFocusableFormField: isFocusableFormField,
|
9042 | setDisplayed: setDisplayed,
|
9043 | setVisible: setVisible,
|
9044 | setDisabled: setDisabled,
|
9045 | isElementChildOfClass: isElementChildOfClass,
|
9046 | getElementSize: getElementSize,
|
9047 | getInnerHeight: getInnerHeight,
|
9048 | getInnerWidth: getInnerWidth,
|
9049 | getAbsoluteHeight: getAbsoluteHeight,
|
9050 | getAbsoluteWidth: getAbsoluteWidth,
|
9051 | isRtlNegativeScroll: isRtlNegativeScroll,
|
9052 | getScrollLeft: getScrollLeft,
|
9053 | setScrollLeft: setScrollLeft,
|
9054 | clearElement: clearElement,
|
9055 | removeElement: removeElement,
|
9056 | removeFromParent: removeFromParent,
|
9057 | isVisible: isVisible,
|
9058 | loadTemplate: loadTemplate,
|
9059 | appendHtml: appendHtml,
|
9060 | getElementAttribute: getElementAttribute,
|
9061 | offsetHeight: offsetHeight,
|
9062 | offsetWidth: offsetWidth,
|
9063 | ensureDomOrder: ensureDomOrder,
|
9064 | setDomChildOrder: setDomChildOrder,
|
9065 | insertWithDomOrder: insertWithDomOrder,
|
9066 | prependDC: prependDC,
|
9067 | addStylesToElement: addStylesToElement,
|
9068 | isHorizontalScrollShowing: isHorizontalScrollShowing,
|
9069 | isVerticalScrollShowing: isVerticalScrollShowing,
|
9070 | setElementWidth: setElementWidth,
|
9071 | setFixedWidth: setFixedWidth,
|
9072 | setElementHeight: setElementHeight,
|
9073 | setFixedHeight: setFixedHeight,
|
9074 | formatSize: formatSize,
|
9075 | isNode: isNode,
|
9076 | isElement: isElement,
|
9077 | isNodeOrElement: isNodeOrElement,
|
9078 | copyNodeList: copyNodeList,
|
9079 | iterateNamedNodeMap: iterateNamedNodeMap,
|
9080 | setCheckboxState: setCheckboxState,
|
9081 | addOrRemoveAttribute: addOrRemoveAttribute,
|
9082 | nodeListForEach: nodeListForEach
|
9083 | });
|
9084 |
|
9085 |
|
9086 |
|
9087 |
|
9088 |
|
9089 |
|
9090 |
|
9091 |
|
9092 | function getNameOfClass(theClass) {
|
9093 | var funcNameRegex = /function (.{1,})\(/;
|
9094 | var funcAsString = theClass.toString();
|
9095 | var results = funcNameRegex.exec(funcAsString);
|
9096 | return results && results.length > 1 ? results[1] : "";
|
9097 | }
|
9098 | function findLineByLeastSquares(values) {
|
9099 | var len = values.length;
|
9100 | var maxDecimals = 0;
|
9101 | if (len <= 1) {
|
9102 | return values;
|
9103 | }
|
9104 | for (var i = 0; i < values.length; i++) {
|
9105 | var value = values[i];
|
9106 | var splitExponent = value.toString().split('e-');
|
9107 | if (splitExponent.length > 1) {
|
9108 | maxDecimals = Math.max(maxDecimals, parseInt(splitExponent[1], 10));
|
9109 | continue;
|
9110 | }
|
9111 | if (Math.floor(value) === value) {
|
9112 | continue;
|
9113 | }
|
9114 | maxDecimals = Math.max(maxDecimals, value.toString().split('.')[1].length);
|
9115 | }
|
9116 | var sum_x = 0;
|
9117 | var sum_y = 0;
|
9118 | var sum_xy = 0;
|
9119 | var sum_xx = 0;
|
9120 | var y = 0;
|
9121 | for (var x = 0; x < len; x++) {
|
9122 | y = values[x];
|
9123 | sum_x += x;
|
9124 | sum_y += y;
|
9125 | sum_xx += x * x;
|
9126 | sum_xy += x * y;
|
9127 | }
|
9128 | var m = (len * sum_xy - sum_x * sum_y) / (len * sum_xx - sum_x * sum_x);
|
9129 | var b = (sum_y / len) - (m * sum_x) / len;
|
9130 | var result = [];
|
9131 | for (var x = 0; x <= len; x++) {
|
9132 | result.push(parseFloat((x * m + b).toFixed(maxDecimals)));
|
9133 | }
|
9134 | return result;
|
9135 | }
|
9136 |
|
9137 |
|
9138 |
|
9139 |
|
9140 |
|
9141 | function cssStyleObjectToMarkup(stylesToUse) {
|
9142 | if (!stylesToUse) {
|
9143 | return '';
|
9144 | }
|
9145 | var resParts = [];
|
9146 | iterateObject(stylesToUse, function (styleKey, styleValue) {
|
9147 | var styleKeyDashed = camelCaseToHyphen(styleKey);
|
9148 | resParts.push(styleKeyDashed + ": " + styleValue + ";");
|
9149 | });
|
9150 | return resParts.join(' ');
|
9151 | }
|
9152 |
|
9153 |
|
9154 |
|
9155 |
|
9156 |
|
9157 |
|
9158 |
|
9159 | function message(msg) {
|
9160 | var eMessage = document.createElement('div');
|
9161 | var eBox = document.querySelector('#__ag__message');
|
9162 | eMessage.innerHTML = msg;
|
9163 | if (!eBox) {
|
9164 | 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>";
|
9165 | eBox = loadTemplate(template);
|
9166 | if (document.body) {
|
9167 | document.body.appendChild(eBox);
|
9168 | }
|
9169 | }
|
9170 | eBox.insertBefore(eMessage, eBox.children[0]);
|
9171 | }
|
9172 |
|
9173 |
|
9174 |
|
9175 |
|
9176 |
|
9177 |
|
9178 | function bindCellRendererToHtmlElement(cellRendererPromise, eTarget) {
|
9179 | cellRendererPromise.then(function (cellRenderer) {
|
9180 | var gui = cellRenderer.getGui();
|
9181 | if (gui != null) {
|
9182 | if (typeof gui === 'object') {
|
9183 | eTarget.appendChild(gui);
|
9184 | }
|
9185 | else {
|
9186 | eTarget.innerHTML = gui;
|
9187 | }
|
9188 | }
|
9189 | });
|
9190 | }
|
9191 |
|
9192 | var GeneralUtils = Object.freeze({
|
9193 | __proto__: null,
|
9194 | getNameOfClass: getNameOfClass,
|
9195 | findLineByLeastSquares: findLineByLeastSquares,
|
9196 | cssStyleObjectToMarkup: cssStyleObjectToMarkup,
|
9197 | message: message,
|
9198 | bindCellRendererToHtmlElement: bindCellRendererToHtmlElement
|
9199 | });
|
9200 |
|
9201 |
|
9202 |
|
9203 |
|
9204 |
|
9205 |
|
9206 |
|
9207 |
|
9208 | function setAriaAttribute(element, attribute, value) {
|
9209 | element.setAttribute(ariaAttributeName(attribute), value.toString());
|
9210 | }
|
9211 | function removeAriaAttribute(element, attribute) {
|
9212 | element.removeAttribute(ariaAttributeName(attribute));
|
9213 | }
|
9214 | function ariaAttributeName(attribute) {
|
9215 | return "aria-" + attribute;
|
9216 | }
|
9217 | function setAriaRole(element, role) {
|
9218 | if (role) {
|
9219 | element.setAttribute('role', role);
|
9220 | }
|
9221 | else {
|
9222 | element.removeAttribute('role');
|
9223 | }
|
9224 | }
|
9225 | function getAriaSortState(column) {
|
9226 | var sort;
|
9227 | if (column.isSortAscending()) {
|
9228 | sort = 'ascending';
|
9229 | }
|
9230 | else if (column.isSortDescending()) {
|
9231 | sort = 'descending';
|
9232 | }
|
9233 | else {
|
9234 | sort = 'none';
|
9235 | }
|
9236 | return sort;
|
9237 | }
|
9238 |
|
9239 | function getAriaLevel(element) {
|
9240 | return parseInt(element.getAttribute('aria-level'), 10);
|
9241 | }
|
9242 | function getAriaPosInSet(element) {
|
9243 | return parseInt(element.getAttribute('aria-posinset'), 10);
|
9244 | }
|
9245 | function getAriaDescribedBy(element) {
|
9246 | return element.getAttribute('aria-describedby') || '';
|
9247 | }
|
9248 |
|
9249 | function setAriaLabel(element, label) {
|
9250 | var key = 'label';
|
9251 | if (label) {
|
9252 | setAriaAttribute(element, key, label);
|
9253 | }
|
9254 | else {
|
9255 | removeAriaAttribute(element, key);
|
9256 | }
|
9257 | }
|
9258 | function setAriaLabelledBy(element, labelledBy) {
|
9259 | var key = 'labelledby';
|
9260 | if (labelledBy) {
|
9261 | setAriaAttribute(element, key, labelledBy);
|
9262 | }
|
9263 | else {
|
9264 | removeAriaAttribute(element, key);
|
9265 | }
|
9266 | }
|
9267 | function setAriaDescription(element, description) {
|
9268 | var key = 'description';
|
9269 | if (description) {
|
9270 | setAriaAttribute(element, key, description);
|
9271 | }
|
9272 | else {
|
9273 | removeAriaAttribute(element, key);
|
9274 | }
|
9275 | }
|
9276 | function setAriaDescribedBy(element, describedby) {
|
9277 | var key = 'describedby';
|
9278 | if (describedby) {
|
9279 | setAriaAttribute(element, key, describedby);
|
9280 | }
|
9281 | else {
|
9282 | removeAriaAttribute(element, key);
|
9283 | }
|
9284 | }
|
9285 | function setAriaLevel(element, level) {
|
9286 | setAriaAttribute(element, 'level', level);
|
9287 | }
|
9288 | function setAriaDisabled(element, disabled) {
|
9289 | setAriaAttribute(element, 'disabled', disabled);
|
9290 | }
|
9291 | function setAriaExpanded(element, expanded) {
|
9292 | setAriaAttribute(element, 'expanded', expanded);
|
9293 | }
|
9294 | function removeAriaExpanded(element) {
|
9295 | removeAriaAttribute(element, 'expanded');
|
9296 | }
|
9297 | function setAriaSetSize(element, setsize) {
|
9298 | setAriaAttribute(element, 'setsize', setsize);
|
9299 | }
|
9300 | function setAriaPosInSet(element, position) {
|
9301 | setAriaAttribute(element, 'posinset', position);
|
9302 | }
|
9303 | function setAriaMultiSelectable(element, multiSelectable) {
|
9304 | setAriaAttribute(element, 'multiselectable', multiSelectable);
|
9305 | }
|
9306 | function setAriaRowCount(element, rowCount) {
|
9307 | setAriaAttribute(element, 'rowcount', rowCount);
|
9308 | }
|
9309 | function setAriaRowIndex(element, rowIndex) {
|
9310 | setAriaAttribute(element, 'rowindex', rowIndex);
|
9311 | }
|
9312 | function setAriaColCount(element, colCount) {
|
9313 | setAriaAttribute(element, 'colcount', colCount);
|
9314 | }
|
9315 | function setAriaColIndex(element, colIndex) {
|
9316 | setAriaAttribute(element, 'colindex', colIndex);
|
9317 | }
|
9318 | function setAriaColSpan(element, colSpan) {
|
9319 | setAriaAttribute(element, 'colspan', colSpan);
|
9320 | }
|
9321 | function setAriaSort(element, sort) {
|
9322 | setAriaAttribute(element, 'sort', sort);
|
9323 | }
|
9324 | function removeAriaSort(element) {
|
9325 | removeAriaAttribute(element, 'sort');
|
9326 | }
|
9327 | function setAriaSelected(element, selected) {
|
9328 | var attributeName = 'selected';
|
9329 | if (selected) {
|
9330 | setAriaAttribute(element, attributeName, selected);
|
9331 | }
|
9332 | else {
|
9333 | removeAriaAttribute(element, attributeName);
|
9334 | }
|
9335 | }
|
9336 | function setAriaChecked(element, checked) {
|
9337 | setAriaAttribute(element, 'checked', checked === undefined ? 'mixed' : checked);
|
9338 | }
|
9339 |
|
9340 | var AriaUtils = Object.freeze({
|
9341 | __proto__: null,
|
9342 | setAriaRole: setAriaRole,
|
9343 | getAriaSortState: getAriaSortState,
|
9344 | getAriaLevel: getAriaLevel,
|
9345 | getAriaPosInSet: getAriaPosInSet,
|
9346 | getAriaDescribedBy: getAriaDescribedBy,
|
9347 | setAriaLabel: setAriaLabel,
|
9348 | setAriaLabelledBy: setAriaLabelledBy,
|
9349 | setAriaDescription: setAriaDescription,
|
9350 | setAriaDescribedBy: setAriaDescribedBy,
|
9351 | setAriaLevel: setAriaLevel,
|
9352 | setAriaDisabled: setAriaDisabled,
|
9353 | setAriaExpanded: setAriaExpanded,
|
9354 | removeAriaExpanded: removeAriaExpanded,
|
9355 | setAriaSetSize: setAriaSetSize,
|
9356 | setAriaPosInSet: setAriaPosInSet,
|
9357 | setAriaMultiSelectable: setAriaMultiSelectable,
|
9358 | setAriaRowCount: setAriaRowCount,
|
9359 | setAriaRowIndex: setAriaRowIndex,
|
9360 | setAriaColCount: setAriaColCount,
|
9361 | setAriaColIndex: setAriaColIndex,
|
9362 | setAriaColSpan: setAriaColSpan,
|
9363 | setAriaSort: setAriaSort,
|
9364 | removeAriaSort: removeAriaSort,
|
9365 | setAriaSelected: setAriaSelected,
|
9366 | setAriaChecked: setAriaChecked
|
9367 | });
|
9368 |
|
9369 |
|
9370 |
|
9371 |
|
9372 |
|
9373 |
|
9374 |
|
9375 | function padStartWidthZeros(value, totalStringSize) {
|
9376 | return value.toString().padStart(totalStringSize, '0');
|
9377 | }
|
9378 | function createArrayOfNumbers(first, last) {
|
9379 | var result = [];
|
9380 | for (var i = first; i <= last; i++) {
|
9381 | result.push(i);
|
9382 | }
|
9383 | return result;
|
9384 | }
|
9385 |
|
9386 |
|
9387 |
|
9388 |
|
9389 |
|
9390 |
|
9391 | function isNumeric(value) {
|
9392 | return value !== '' && !isNaN(parseFloat(value)) && isFinite(value);
|
9393 | }
|
9394 | function cleanNumber(value) {
|
9395 | if (typeof value === 'string') {
|
9396 | value = parseInt(value, 10);
|
9397 | }
|
9398 | if (typeof value === 'number') {
|
9399 | return Math.floor(value);
|
9400 | }
|
9401 | return null;
|
9402 | }
|
9403 | function decToHex(number, bytes) {
|
9404 | var hex = '';
|
9405 | for (var i = 0; i < bytes; i++) {
|
9406 | hex += String.fromCharCode(number & 0xff);
|
9407 | number >>>= 8;
|
9408 | }
|
9409 | return hex;
|
9410 | }
|
9411 | function formatNumberTwoDecimalPlacesAndCommas(value, thousandSeparator, decimalSeparator) {
|
9412 | if (typeof value !== 'number') {
|
9413 | return '';
|
9414 | }
|
9415 | return formatNumberCommas(Math.round(value * 100) / 100, thousandSeparator, decimalSeparator);
|
9416 | }
|
9417 |
|
9418 |
|
9419 |
|
9420 |
|
9421 |
|
9422 |
|
9423 |
|
9424 | function formatNumberCommas(value, thousandSeparator, decimalSeparator) {
|
9425 | if (typeof value !== 'number') {
|
9426 | return '';
|
9427 | }
|
9428 | return value.toString().replace('.', decimalSeparator).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1" + thousandSeparator);
|
9429 | }
|
9430 | function sum(values) {
|
9431 | return values == null ? null : values.reduce(function (total, value) { return total + value; }, 0);
|
9432 | }
|
9433 |
|
9434 | var NumberUtils = Object.freeze({
|
9435 | __proto__: null,
|
9436 | padStartWidthZeros: padStartWidthZeros,
|
9437 | createArrayOfNumbers: createArrayOfNumbers,
|
9438 | isNumeric: isNumeric,
|
9439 | cleanNumber: cleanNumber,
|
9440 | decToHex: decToHex,
|
9441 | formatNumberTwoDecimalPlacesAndCommas: formatNumberTwoDecimalPlacesAndCommas,
|
9442 | formatNumberCommas: formatNumberCommas,
|
9443 | sum: sum
|
9444 | });
|
9445 |
|
9446 |
|
9447 |
|
9448 |
|
9449 |
|
9450 |
|
9451 |
|
9452 | var __read$5 = (undefined && undefined.__read) || function (o, n) {
|
9453 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
9454 | if (!m) return o;
|
9455 | var i = m.call(o), r, ar = [], e;
|
9456 | try {
|
9457 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
9458 | }
|
9459 | catch (error) { e = { error: error }; }
|
9460 | finally {
|
9461 | try {
|
9462 | if (r && !r.done && (m = i["return"])) m.call(i);
|
9463 | }
|
9464 | finally { if (e) throw e.error; }
|
9465 | }
|
9466 | return ar;
|
9467 | };
|
9468 |
|
9469 |
|
9470 |
|
9471 |
|
9472 |
|
9473 |
|
9474 |
|
9475 | function serialiseDate(date, includeTime, separator) {
|
9476 | if (includeTime === void 0) { includeTime = true; }
|
9477 | if (separator === void 0) { separator = '-'; }
|
9478 | if (!date) {
|
9479 | return null;
|
9480 | }
|
9481 | var serialised = [date.getFullYear(), date.getMonth() + 1, date.getDate()].map(function (part) { return padStartWidthZeros(part, 2); }).join(separator);
|
9482 | if (includeTime) {
|
9483 | serialised += ' ' + [date.getHours(), date.getMinutes(), date.getSeconds()].map(function (part) { return padStartWidthZeros(part, 2); }).join(':');
|
9484 | }
|
9485 | return serialised;
|
9486 | }
|
9487 |
|
9488 |
|
9489 |
|
9490 | function parseDateTimeFromString(value) {
|
9491 | if (!value) {
|
9492 | return null;
|
9493 | }
|
9494 | var _a = __read$5(value.split(' '), 2), dateStr = _a[0], timeStr = _a[1];
|
9495 | if (!dateStr) {
|
9496 | return null;
|
9497 | }
|
9498 | var fields = dateStr.split('-').map(function (f) { return parseInt(f, 10); });
|
9499 | if (fields.filter(function (f) { return !isNaN(f); }).length !== 3) {
|
9500 | return null;
|
9501 | }
|
9502 | var _b = __read$5(fields, 3), year = _b[0], month = _b[1], day = _b[2];
|
9503 | var date = new Date(year, month - 1, day);
|
9504 | if (date.getFullYear() !== year ||
|
9505 | date.getMonth() !== month - 1 ||
|
9506 | date.getDate() !== day) {
|
9507 |
|
9508 | return null;
|
9509 | }
|
9510 | if (!timeStr || timeStr === '00:00:00') {
|
9511 | return date;
|
9512 | }
|
9513 | var _c = __read$5(timeStr.split(':').map(function (part) { return parseInt(part, 10); }), 3), hours = _c[0], minutes = _c[1], seconds = _c[2];
|
9514 | if (hours >= 0 && hours < 24) {
|
9515 | date.setHours(hours);
|
9516 | }
|
9517 | if (minutes >= 0 && minutes < 60) {
|
9518 | date.setMinutes(minutes);
|
9519 | }
|
9520 | if (seconds >= 0 && seconds < 60) {
|
9521 | date.setSeconds(seconds);
|
9522 | }
|
9523 | return date;
|
9524 | }
|
9525 |
|
9526 | var DateUtils = Object.freeze({
|
9527 | __proto__: null,
|
9528 | serialiseDate: serialiseDate,
|
9529 | parseDateTimeFromString: parseDateTimeFromString
|
9530 | });
|
9531 |
|
9532 |
|
9533 |
|
9534 |
|
9535 |
|
9536 |
|
9537 |
|
9538 | function fuzzyCheckStrings(inputValues, validValues, allSuggestions) {
|
9539 | var fuzzyMatches = {};
|
9540 | var invalidInputs = inputValues.filter(function (inputValue) {
|
9541 | return !validValues.some(function (validValue) { return validValue === inputValue; });
|
9542 | });
|
9543 | if (invalidInputs.length > 0) {
|
9544 | invalidInputs.forEach(function (invalidInput) {
|
9545 | return fuzzyMatches[invalidInput] = fuzzySuggestions(invalidInput, allSuggestions);
|
9546 | });
|
9547 | }
|
9548 | return fuzzyMatches;
|
9549 | }
|
9550 |
|
9551 |
|
9552 |
|
9553 |
|
9554 |
|
9555 |
|
9556 |
|
9557 |
|
9558 | function fuzzySuggestions(inputValue, allSuggestions, hideIrrelevant, weighted) {
|
9559 | var search = weighted ? string_weighted_distances : string_distances;
|
9560 | var thisSuggestions = allSuggestions.map(function (text) { return ({
|
9561 | value: text,
|
9562 | relevance: search(inputValue.toLowerCase(), text.toLocaleLowerCase())
|
9563 | }); });
|
9564 | thisSuggestions.sort(function (a, b) { return b.relevance - a.relevance; });
|
9565 | if (hideIrrelevant) {
|
9566 | thisSuggestions = thisSuggestions.filter(function (suggestion) { return suggestion.relevance !== 0; });
|
9567 | }
|
9568 | return thisSuggestions.map(function (suggestion) { return suggestion.value; });
|
9569 | }
|
9570 |
|
9571 |
|
9572 |
|
9573 |
|
9574 |
|
9575 |
|
9576 | function get_bigrams(from) {
|
9577 | var s = from.toLowerCase();
|
9578 | var v = new Array(s.length - 1);
|
9579 | var i;
|
9580 | var j;
|
9581 | var ref;
|
9582 | for (i = j = 0, ref = v.length; j <= ref; i = j += 1) {
|
9583 | v[i] = s.slice(i, i + 2);
|
9584 | }
|
9585 | return v;
|
9586 | }
|
9587 | function string_distances(str1, str2) {
|
9588 | if (str1.length === 0 && str2.length === 0) {
|
9589 | return 0;
|
9590 | }
|
9591 | var pairs1 = get_bigrams(str1);
|
9592 | var pairs2 = get_bigrams(str2);
|
9593 | var union = pairs1.length + pairs2.length;
|
9594 | var hit_count = 0;
|
9595 | var j;
|
9596 | var len;
|
9597 | for (j = 0, len = pairs1.length; j < len; j++) {
|
9598 | var x = pairs1[j];
|
9599 | var k = void 0;
|
9600 | var len1 = void 0;
|
9601 | for (k = 0, len1 = pairs2.length; k < len1; k++) {
|
9602 | var y = pairs2[k];
|
9603 | if (x === y) {
|
9604 | hit_count++;
|
9605 | }
|
9606 | }
|
9607 | }
|
9608 | return hit_count > 0 ? (2 * hit_count) / union : 0;
|
9609 | }
|
9610 | function string_weighted_distances(str1, str2) {
|
9611 | var a = str1.replace(/\s/g, '');
|
9612 | var b = str2.replace(/\s/g, '');
|
9613 | var weight = 0;
|
9614 | var lastIndex = 0;
|
9615 | for (var i = 0; i < a.length; i++) {
|
9616 | var idx = b.indexOf(a[i], lastIndex);
|
9617 | if (idx === -1) {
|
9618 | continue;
|
9619 | }
|
9620 | lastIndex = idx;
|
9621 | weight += (100 - (lastIndex * 100 / 10000) * 100);
|
9622 | }
|
9623 | return weight;
|
9624 | }
|
9625 |
|
9626 | var FuzzyMatchUtils = Object.freeze({
|
9627 | __proto__: null,
|
9628 | fuzzyCheckStrings: fuzzyCheckStrings,
|
9629 | fuzzySuggestions: fuzzySuggestions,
|
9630 | get_bigrams: get_bigrams,
|
9631 | string_distances: string_distances,
|
9632 | string_weighted_distances: string_weighted_distances
|
9633 | });
|
9634 |
|
9635 |
|
9636 |
|
9637 |
|
9638 |
|
9639 |
|
9640 |
|
9641 |
|
9642 |
|
9643 |
|
9644 |
|
9645 |
|
9646 | var iconNameClassMap = {
|
9647 |
|
9648 | columnGroupOpened: 'expanded',
|
9649 |
|
9650 | columnGroupClosed: 'contracted',
|
9651 |
|
9652 | columnSelectClosed: 'tree-closed',
|
9653 |
|
9654 | columnSelectOpen: 'tree-open',
|
9655 |
|
9656 |
|
9657 | columnSelectIndeterminate: 'tree-indeterminate',
|
9658 |
|
9659 | columnMovePin: 'pin',
|
9660 |
|
9661 | columnMoveHide: 'eye-slash',
|
9662 |
|
9663 | columnMoveMove: 'arrows',
|
9664 |
|
9665 | columnMoveLeft: 'left',
|
9666 |
|
9667 | columnMoveRight: 'right',
|
9668 |
|
9669 | columnMoveGroup: 'group',
|
9670 |
|
9671 | columnMoveValue: 'aggregation',
|
9672 |
|
9673 | columnMovePivot: 'pivot',
|
9674 |
|
9675 |
|
9676 | dropNotAllowed: 'not-allowed',
|
9677 |
|
9678 | groupContracted: 'tree-closed',
|
9679 |
|
9680 | groupExpanded: 'tree-open',
|
9681 |
|
9682 | chart: 'chart',
|
9683 |
|
9684 | close: 'cross',
|
9685 |
|
9686 | cancel: 'cancel',
|
9687 |
|
9688 | check: 'tick',
|
9689 |
|
9690 | first: 'first',
|
9691 |
|
9692 | previous: 'previous',
|
9693 |
|
9694 | next: 'next',
|
9695 |
|
9696 | last: 'last',
|
9697 |
|
9698 | linked: 'linked',
|
9699 |
|
9700 | unlinked: 'unlinked',
|
9701 |
|
9702 | colorPicker: 'color-picker',
|
9703 |
|
9704 | groupLoading: 'loading',
|
9705 |
|
9706 | menu: 'menu',
|
9707 |
|
9708 | filter: 'filter',
|
9709 |
|
9710 | columns: 'columns',
|
9711 |
|
9712 | maximize: 'maximize',
|
9713 |
|
9714 | minimize: 'minimize',
|
9715 |
|
9716 | menuPin: 'pin',
|
9717 |
|
9718 | menuValue: 'aggregation',
|
9719 |
|
9720 | menuAddRowGroup: 'group',
|
9721 |
|
9722 | menuRemoveRowGroup: 'group',
|
9723 |
|
9724 | clipboardCopy: 'copy',
|
9725 |
|
9726 | clipboardPaste: 'paste',
|
9727 |
|
9728 | pivotPanel: 'pivot',
|
9729 |
|
9730 | rowGroupPanel: 'group',
|
9731 |
|
9732 | valuePanel: 'aggregation',
|
9733 |
|
9734 | columnDrag: 'grip',
|
9735 |
|
9736 | rowDrag: 'grip',
|
9737 |
|
9738 | save: 'save',
|
9739 |
|
9740 | csvExport: 'csv',
|
9741 |
|
9742 | excelExport: 'excel',
|
9743 |
|
9744 | smallDown: 'small-down',
|
9745 |
|
9746 | smallLeft: 'small-left',
|
9747 |
|
9748 | smallRight: 'small-right',
|
9749 | smallUp: 'small-up',
|
9750 |
|
9751 | sortAscending: 'asc',
|
9752 |
|
9753 | sortDescending: 'desc',
|
9754 |
|
9755 | sortUnSort: 'none'
|
9756 | };
|
9757 |
|
9758 |
|
9759 |
|
9760 |
|
9761 |
|
9762 |
|
9763 |
|
9764 |
|
9765 | function createIcon(iconName, gridOptionsWrapper, column) {
|
9766 | var iconContents = createIconNoSpan(iconName, gridOptionsWrapper, column);
|
9767 | if (iconContents && iconContents.className.indexOf('ag-icon') > -1) {
|
9768 | return iconContents;
|
9769 | }
|
9770 | var eResult = document.createElement('span');
|
9771 | eResult.appendChild(iconContents);
|
9772 | return eResult;
|
9773 | }
|
9774 | function createIconNoSpan(iconName, gridOptionsWrapper, column, forceCreate) {
|
9775 | var userProvidedIcon = null;
|
9776 |
|
9777 | var icons = column && column.getColDef().icons;
|
9778 | if (icons) {
|
9779 | userProvidedIcon = icons[iconName];
|
9780 | }
|
9781 |
|
9782 | if (gridOptionsWrapper && !userProvidedIcon) {
|
9783 | var optionsIcons = gridOptionsWrapper.getIcons();
|
9784 | if (optionsIcons) {
|
9785 | userProvidedIcon = optionsIcons[iconName];
|
9786 | }
|
9787 | }
|
9788 |
|
9789 | if (userProvidedIcon) {
|
9790 | var rendererResult = void 0;
|
9791 | if (typeof userProvidedIcon === 'function') {
|
9792 | rendererResult = userProvidedIcon();
|
9793 | }
|
9794 | else if (typeof userProvidedIcon === 'string') {
|
9795 | rendererResult = userProvidedIcon;
|
9796 | }
|
9797 | else {
|
9798 | throw new Error('icon from grid options needs to be a string or a function');
|
9799 | }
|
9800 | if (typeof rendererResult === 'string') {
|
9801 | return loadTemplate(rendererResult);
|
9802 | }
|
9803 | if (isNodeOrElement(rendererResult)) {
|
9804 | return rendererResult;
|
9805 | }
|
9806 | console.warn('AG Grid: iconRenderer should return back a string or a dom object');
|
9807 | }
|
9808 | else {
|
9809 | var span = document.createElement('span');
|
9810 | var cssClass = iconNameClassMap[iconName];
|
9811 | if (!cssClass) {
|
9812 | if (!forceCreate) {
|
9813 | console.warn("AG Grid: Did not find icon " + iconName);
|
9814 | cssClass = '';
|
9815 | }
|
9816 | else {
|
9817 | cssClass = iconName;
|
9818 | }
|
9819 | }
|
9820 | span.setAttribute('class', "ag-icon ag-icon-" + cssClass);
|
9821 | span.setAttribute('unselectable', 'on');
|
9822 | setAriaRole(span, 'presentation');
|
9823 | return span;
|
9824 | }
|
9825 | }
|
9826 |
|
9827 | var IconUtils = Object.freeze({
|
9828 | __proto__: null,
|
9829 | iconNameClassMap: iconNameClassMap,
|
9830 | createIcon: createIcon,
|
9831 | createIconNoSpan: createIconNoSpan
|
9832 | });
|
9833 |
|
9834 |
|
9835 |
|
9836 |
|
9837 |
|
9838 |
|
9839 |
|
9840 | var NUMPAD_DEL_NUMLOCK_ON_KEY = 'Del';
|
9841 | var NUMPAD_DEL_NUMLOCK_ON_CHARCODE = 46;
|
9842 | function isEventFromPrintableCharacter(event) {
|
9843 |
|
9844 | if (event.altKey || event.ctrlKey || event.metaKey) {
|
9845 | return false;
|
9846 | }
|
9847 |
|
9848 |
|
9849 | var printableCharacter = event.key.length === 1;
|
9850 |
|
9851 |
|
9852 | var numpadDelWithNumlockOnForEdgeOrIe = isNumpadDelWithNumLockOnForEdge(event);
|
9853 | return printableCharacter || numpadDelWithNumlockOnForEdgeOrIe;
|
9854 | }
|
9855 |
|
9856 |
|
9857 |
|
9858 |
|
9859 |
|
9860 |
|
9861 |
|
9862 |
|
9863 |
|
9864 | function isUserSuppressingKeyboardEvent(gridOptionsWrapper, keyboardEvent, rowNode, column, editing) {
|
9865 | var gridOptionsFunc = gridOptionsWrapper.getSuppressKeyboardEventFunc();
|
9866 | var colDefFunc = column ? column.getColDef().suppressKeyboardEvent : undefined;
|
9867 |
|
9868 | if (!gridOptionsFunc && !colDefFunc) {
|
9869 | return false;
|
9870 | }
|
9871 | var params = {
|
9872 | event: keyboardEvent,
|
9873 | editing: editing,
|
9874 | column: column,
|
9875 | api: gridOptionsWrapper.getApi(),
|
9876 | node: rowNode,
|
9877 | data: rowNode.data,
|
9878 | colDef: column.getColDef(),
|
9879 | context: gridOptionsWrapper.getContext(),
|
9880 | columnApi: gridOptionsWrapper.getColumnApi()
|
9881 | };
|
9882 |
|
9883 | if (colDefFunc) {
|
9884 | var colDefFuncResult = colDefFunc(params);
|
9885 |
|
9886 | if (colDefFuncResult) {
|
9887 | return true;
|
9888 | }
|
9889 | }
|
9890 | if (gridOptionsFunc) {
|
9891 |
|
9892 | return gridOptionsFunc(params);
|
9893 | }
|
9894 |
|
9895 | return false;
|
9896 | }
|
9897 | function isUserSuppressingHeaderKeyboardEvent(gridOptionsWrapper, keyboardEvent, headerRowIndex, column) {
|
9898 | var colDef = column.getDefinition();
|
9899 | var colDefFunc = colDef && colDef.suppressHeaderKeyboardEvent;
|
9900 | if (!exists(colDefFunc)) {
|
9901 | return false;
|
9902 | }
|
9903 | var params = {
|
9904 | api: gridOptionsWrapper.getApi(),
|
9905 | columnApi: gridOptionsWrapper.getColumnApi(),
|
9906 | context: gridOptionsWrapper.getContext(),
|
9907 | colDef: colDef,
|
9908 | column: column,
|
9909 | headerRowIndex: headerRowIndex,
|
9910 | event: keyboardEvent
|
9911 | };
|
9912 | return !!colDefFunc(params);
|
9913 | }
|
9914 | function isNumpadDelWithNumLockOnForEdge(event) {
|
9915 | return (isBrowserEdge()) &&
|
9916 | event.key === NUMPAD_DEL_NUMLOCK_ON_KEY &&
|
9917 | event.charCode === NUMPAD_DEL_NUMLOCK_ON_CHARCODE;
|
9918 | }
|
9919 |
|
9920 | var KeyboardUtils = Object.freeze({
|
9921 | __proto__: null,
|
9922 | isEventFromPrintableCharacter: isEventFromPrintableCharacter,
|
9923 | isUserSuppressingKeyboardEvent: isUserSuppressingKeyboardEvent,
|
9924 | isUserSuppressingHeaderKeyboardEvent: isUserSuppressingHeaderKeyboardEvent
|
9925 | });
|
9926 |
|
9927 |
|
9928 |
|
9929 |
|
9930 |
|
9931 |
|
9932 |
|
9933 |
|
9934 |
|
9935 |
|
9936 |
|
9937 |
|
9938 |
|
9939 |
|
9940 |
|
9941 | function areEventsNear(e1, e2, pixelCount) {
|
9942 |
|
9943 | if (pixelCount === 0) {
|
9944 | return false;
|
9945 | }
|
9946 | var diffX = Math.abs(e1.clientX - e2.clientX);
|
9947 | var diffY = Math.abs(e1.clientY - e2.clientY);
|
9948 | return Math.max(diffX, diffY) <= pixelCount;
|
9949 | }
|
9950 |
|
9951 | var MouseUtils = Object.freeze({
|
9952 | __proto__: null,
|
9953 | areEventsNear: areEventsNear
|
9954 | });
|
9955 |
|
9956 |
|
9957 |
|
9958 |
|
9959 |
|
9960 |
|
9961 |
|
9962 |
|
9963 |
|
9964 |
|
9965 |
|
9966 |
|
9967 |
|
9968 |
|
9969 |
|
9970 | function sortRowNodesByOrder(rowNodes, rowNodeOrder) {
|
9971 | if (!rowNodes) {
|
9972 | return;
|
9973 | }
|
9974 | var comparator = function (nodeA, nodeB) {
|
9975 | var positionA = rowNodeOrder[nodeA.id];
|
9976 | var positionB = rowNodeOrder[nodeB.id];
|
9977 | var aHasIndex = positionA !== undefined;
|
9978 | var bHasIndex = positionB !== undefined;
|
9979 | var bothNodesAreUserNodes = aHasIndex && bHasIndex;
|
9980 | var bothNodesAreFillerNodes = !aHasIndex && !bHasIndex;
|
9981 | if (bothNodesAreUserNodes) {
|
9982 |
|
9983 |
|
9984 | return positionA - positionB;
|
9985 | }
|
9986 | if (bothNodesAreFillerNodes) {
|
9987 |
|
9988 |
|
9989 |
|
9990 |
|
9991 |
|
9992 |
|
9993 |
|
9994 |
|
9995 |
|
9996 | return nodeA.__objectId - nodeB.__objectId;
|
9997 | }
|
9998 | if (aHasIndex) {
|
9999 | return 1;
|
10000 | }
|
10001 | return -1;
|
10002 | };
|
10003 |
|
10004 | var rowNodeA;
|
10005 | var rowNodeB;
|
10006 | var atLeastOneOutOfOrder = false;
|
10007 | for (var i = 0; i < rowNodes.length - 1; i++) {
|
10008 | rowNodeA = rowNodes[i];
|
10009 | rowNodeB = rowNodes[i + 1];
|
10010 | if (comparator(rowNodeA, rowNodeB) > 0) {
|
10011 | atLeastOneOutOfOrder = true;
|
10012 | break;
|
10013 | }
|
10014 | }
|
10015 | if (atLeastOneOutOfOrder) {
|
10016 | rowNodes.sort(comparator);
|
10017 | }
|
10018 | }
|
10019 | function traverseNodesWithKey(nodes, callback) {
|
10020 | var keyParts = [];
|
10021 | recursiveSearchNodes(nodes);
|
10022 | function recursiveSearchNodes(currentNodes) {
|
10023 | if (!currentNodes) {
|
10024 | return;
|
10025 | }
|
10026 | currentNodes.forEach(function (node) {
|
10027 |
|
10028 | if (node.group || node.hasChildren()) {
|
10029 | keyParts.push(node.key);
|
10030 | var key = keyParts.join('|');
|
10031 | callback(node, key);
|
10032 | recursiveSearchNodes(node.childrenAfterGroup);
|
10033 | keyParts.pop();
|
10034 | }
|
10035 | });
|
10036 | }
|
10037 | }
|
10038 |
|
10039 | var RowNodeUtils = Object.freeze({
|
10040 | __proto__: null,
|
10041 | sortRowNodesByOrder: sortRowNodesByOrder,
|
10042 | traverseNodesWithKey: traverseNodesWithKey
|
10043 | });
|
10044 |
|
10045 |
|
10046 |
|
10047 |
|
10048 |
|
10049 |
|
10050 |
|
10051 | function convertToSet(list) {
|
10052 | var set = new Set();
|
10053 | list.forEach(function (x) { return set.add(x); });
|
10054 | return set;
|
10055 | }
|
10056 |
|
10057 | var SetUtils = /*#__PURE__*/Object.freeze({
|
10058 | __proto__: null,
|
10059 | convertToSet: convertToSet
|
10060 | });
|
10061 |
|
10062 |
|
10063 |
|
10064 |
|
10065 |
|
10066 |
|
10067 |
|
10068 | var __assign$1 = (undefined && undefined.__assign) || function () {
|
10069 | __assign$1 = Object.assign || function(t) {
|
10070 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
10071 | s = arguments[i];
|
10072 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
10073 | t[p] = s[p];
|
10074 | }
|
10075 | return t;
|
10076 | };
|
10077 | return __assign$1.apply(this, arguments);
|
10078 | };
|
10079 | 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);
|
10080 | var _ = utils;
|
10081 |
|
10082 |
|
10083 |
|
10084 |
|
10085 |
|
10086 |
|
10087 |
|
10088 | var NumberSequence = (function () {
|
10089 | function NumberSequence(initValue, step) {
|
10090 | if (initValue === void 0) { initValue = 0; }
|
10091 | if (step === void 0) { step = 1; }
|
10092 | this.nextValue = initValue;
|
10093 | this.step = step;
|
10094 | }
|
10095 | NumberSequence.prototype.next = function () {
|
10096 | var valToReturn = this.nextValue;
|
10097 | this.nextValue += this.step;
|
10098 | return valToReturn;
|
10099 | };
|
10100 | NumberSequence.prototype.peek = function () {
|
10101 | return this.nextValue;
|
10102 | };
|
10103 | NumberSequence.prototype.skip = function (count) {
|
10104 | this.nextValue += count;
|
10105 | };
|
10106 | return NumberSequence;
|
10107 | }());
|
10108 |
|
10109 |
|
10110 |
|
10111 |
|
10112 |
|
10113 |
|
10114 |
|
10115 | var AgPromiseStatus;
|
10116 | (function (AgPromiseStatus) {
|
10117 | AgPromiseStatus[AgPromiseStatus["IN_PROGRESS"] = 0] = "IN_PROGRESS";
|
10118 | AgPromiseStatus[AgPromiseStatus["RESOLVED"] = 1] = "RESOLVED";
|
10119 | })(AgPromiseStatus || (AgPromiseStatus = {}));
|
10120 | var AgPromise = (function () {
|
10121 | function AgPromise(callback) {
|
10122 | var _this = this;
|
10123 | this.status = AgPromiseStatus.IN_PROGRESS;
|
10124 | this.resolution = null;
|
10125 | this.waiters = [];
|
10126 | callback(function (value) { return _this.onDone(value); }, function (params) { return _this.onReject(params); });
|
10127 | }
|
10128 | AgPromise.all = function (promises) {
|
10129 | return new AgPromise(function (resolve) {
|
10130 | var remainingToResolve = promises.length;
|
10131 | var combinedValues = new Array(remainingToResolve);
|
10132 | promises.forEach(function (promise, index) {
|
10133 | promise.then(function (value) {
|
10134 | combinedValues[index] = value;
|
10135 | remainingToResolve--;
|
10136 | if (remainingToResolve === 0) {
|
10137 | resolve(combinedValues);
|
10138 | }
|
10139 | });
|
10140 | });
|
10141 | });
|
10142 | };
|
10143 | AgPromise.resolve = function (value) {
|
10144 | if (value === void 0) { value = null; }
|
10145 | return new AgPromise(function (resolve) { return resolve(value); });
|
10146 | };
|
10147 | AgPromise.prototype.then = function (func) {
|
10148 | var _this = this;
|
10149 | return new AgPromise(function (resolve) {
|
10150 | if (_this.status === AgPromiseStatus.RESOLVED) {
|
10151 | resolve(func(_this.resolution));
|
10152 | }
|
10153 | else {
|
10154 | _this.waiters.push(function (value) { return resolve(func(value)); });
|
10155 | }
|
10156 | });
|
10157 | };
|
10158 | AgPromise.prototype.resolveNow = function (ifNotResolvedValue, ifResolved) {
|
10159 | return this.status === AgPromiseStatus.RESOLVED ? ifResolved(this.resolution) : ifNotResolvedValue;
|
10160 | };
|
10161 | AgPromise.prototype.onDone = function (value) {
|
10162 | this.status = AgPromiseStatus.RESOLVED;
|
10163 | this.resolution = value;
|
10164 | this.waiters.forEach(function (waiter) { return waiter(value); });
|
10165 | };
|
10166 | AgPromise.prototype.onReject = function (params) {
|
10167 | console.warn('TBI');
|
10168 | };
|
10169 | return AgPromise;
|
10170 | }());
|
10171 |
|
10172 |
|
10173 |
|
10174 |
|
10175 |
|
10176 |
|
10177 |
|
10178 |
|
10179 |
|
10180 |
|
10181 | var Timer = (function () {
|
10182 | function Timer() {
|
10183 | this.timestamp = new Date().getTime();
|
10184 | }
|
10185 | Timer.prototype.print = function (msg) {
|
10186 | var duration = (new Date().getTime()) - this.timestamp;
|
10187 | console.info(msg + " = " + duration);
|
10188 | this.timestamp = new Date().getTime();
|
10189 | };
|
10190 | return Timer;
|
10191 | }());
|
10192 |
|
10193 |
|
10194 |
|
10195 |
|
10196 |
|
10197 |
|
10198 |
|
10199 | var __extends$5 = (undefined && undefined.__extends) || (function () {
|
10200 | var extendStatics = function (d, b) {
|
10201 | extendStatics = Object.setPrototypeOf ||
|
10202 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
10203 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
10204 | return extendStatics(d, b);
|
10205 | };
|
10206 | return function (d, b) {
|
10207 | extendStatics(d, b);
|
10208 | function __() { this.constructor = d; }
|
10209 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10210 | };
|
10211 | })();
|
10212 | var __assign$2 = (undefined && undefined.__assign) || function () {
|
10213 | __assign$2 = Object.assign || function(t) {
|
10214 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
10215 | s = arguments[i];
|
10216 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
10217 | t[p] = s[p];
|
10218 | }
|
10219 | return t;
|
10220 | };
|
10221 | return __assign$2.apply(this, arguments);
|
10222 | };
|
10223 | var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
10224 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
10225 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
10226 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
10227 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
10228 | };
|
10229 | var TooltipStates;
|
10230 | (function (TooltipStates) {
|
10231 | TooltipStates[TooltipStates["NOTHING"] = 0] = "NOTHING";
|
10232 | TooltipStates[TooltipStates["WAITING_TO_SHOW"] = 1] = "WAITING_TO_SHOW";
|
10233 | TooltipStates[TooltipStates["SHOWING"] = 2] = "SHOWING";
|
10234 | })(TooltipStates || (TooltipStates = {}));
|
10235 | var CustomTooltipFeature = (function (_super) {
|
10236 | __extends$5(CustomTooltipFeature, _super);
|
10237 | function CustomTooltipFeature(parentComp) {
|
10238 | var _this = _super.call(this) || this;
|
10239 | _this.DEFAULT_SHOW_TOOLTIP_DELAY = 2000;
|
10240 | _this.DEFAULT_HIDE_TOOLTIP_DELAY = 10000;
|
10241 | _this.SHOW_QUICK_TOOLTIP_DIFF = 1000;
|
10242 | _this.FADE_OUT_TOOLTIP_TIMEOUT = 1000;
|
10243 | _this.state = TooltipStates.NOTHING;
|
10244 |
|
10245 |
|
10246 |
|
10247 | _this.tooltipInstanceCount = 0;
|
10248 | _this.tooltipMouseTrack = false;
|
10249 | _this.parentComp = parentComp;
|
10250 | return _this;
|
10251 | }
|
10252 | CustomTooltipFeature.prototype.postConstruct = function () {
|
10253 | this.tooltipShowDelay = this.gridOptionsWrapper.getTooltipDelay('show') || this.DEFAULT_SHOW_TOOLTIP_DELAY;
|
10254 | this.tooltipHideDelay = this.gridOptionsWrapper.getTooltipDelay('hide') || this.DEFAULT_HIDE_TOOLTIP_DELAY;
|
10255 | this.tooltipMouseTrack = this.gridOptionsWrapper.isTooltipMouseTrack();
|
10256 | var el = this.parentComp.getGui();
|
10257 | this.addManagedListener(el, 'mouseenter', this.onMouseEnter.bind(this));
|
10258 | this.addManagedListener(el, 'mouseleave', this.onMouseLeave.bind(this));
|
10259 | this.addManagedListener(el, 'mousemove', this.onMouseMove.bind(this));
|
10260 | this.addManagedListener(el, 'mousedown', this.onMouseDown.bind(this));
|
10261 | this.addManagedListener(el, 'keydown', this.onKeyDown.bind(this));
|
10262 | };
|
10263 | CustomTooltipFeature.prototype.destroy = function () {
|
10264 |
|
10265 |
|
10266 | this.setToDoNothing();
|
10267 | _super.prototype.destroy.call(this);
|
10268 | };
|
10269 | CustomTooltipFeature.prototype.onMouseEnter = function (e) {
|
10270 | if (isIOSUserAgent()) {
|
10271 | return;
|
10272 | }
|
10273 |
|
10274 |
|
10275 |
|
10276 |
|
10277 | if (this.state != TooltipStates.NOTHING) {
|
10278 | return;
|
10279 | }
|
10280 |
|
10281 | var delay = this.isLastTooltipHiddenRecently() ? 200 : this.tooltipShowDelay;
|
10282 | this.showTooltipTimeoutId = window.setTimeout(this.showTooltip.bind(this), delay);
|
10283 | this.lastMouseEvent = e;
|
10284 | this.state = TooltipStates.WAITING_TO_SHOW;
|
10285 | };
|
10286 | CustomTooltipFeature.prototype.onMouseLeave = function () {
|
10287 | this.setToDoNothing();
|
10288 | };
|
10289 | CustomTooltipFeature.prototype.onKeyDown = function () {
|
10290 | this.setToDoNothing();
|
10291 | };
|
10292 | CustomTooltipFeature.prototype.setToDoNothing = function () {
|
10293 | if (this.state === TooltipStates.SHOWING) {
|
10294 | this.hideTooltip();
|
10295 | }
|
10296 | this.clearTimeouts();
|
10297 | this.state = TooltipStates.NOTHING;
|
10298 | };
|
10299 | CustomTooltipFeature.prototype.onMouseMove = function (e) {
|
10300 |
|
10301 |
|
10302 |
|
10303 | this.lastMouseEvent = e;
|
10304 | if (this.tooltipMouseTrack &&
|
10305 | this.state === TooltipStates.SHOWING &&
|
10306 | this.tooltipComp) {
|
10307 | this.positionTooltipUnderLastMouseEvent();
|
10308 | }
|
10309 | };
|
10310 | CustomTooltipFeature.prototype.onMouseDown = function () {
|
10311 | this.setToDoNothing();
|
10312 | };
|
10313 | CustomTooltipFeature.prototype.hideTooltip = function () {
|
10314 |
|
10315 |
|
10316 | if (this.tooltipComp) {
|
10317 | this.destroyTooltipComp();
|
10318 | CustomTooltipFeature.lastTooltipHideTime = new Date().getTime();
|
10319 | }
|
10320 | this.state = TooltipStates.NOTHING;
|
10321 | };
|
10322 | CustomTooltipFeature.prototype.destroyTooltipComp = function () {
|
10323 | var _this = this;
|
10324 |
|
10325 | this.tooltipComp.getGui().classList.add('ag-tooltip-hiding');
|
10326 |
|
10327 |
|
10328 | var tooltipPopupDestroyFunc = this.tooltipPopupDestroyFunc;
|
10329 | var tooltipComp = this.tooltipComp;
|
10330 | window.setTimeout(function () {
|
10331 | tooltipPopupDestroyFunc();
|
10332 | _this.getContext().destroyBean(tooltipComp);
|
10333 | }, this.FADE_OUT_TOOLTIP_TIMEOUT);
|
10334 | this.tooltipPopupDestroyFunc = undefined;
|
10335 | this.tooltipComp = undefined;
|
10336 | };
|
10337 | CustomTooltipFeature.prototype.isLastTooltipHiddenRecently = function () {
|
10338 |
|
10339 | var now = new Date().getTime();
|
10340 | var then = CustomTooltipFeature.lastTooltipHideTime;
|
10341 | return (now - then) < this.SHOW_QUICK_TOOLTIP_DIFF;
|
10342 | };
|
10343 | CustomTooltipFeature.prototype.showTooltip = function () {
|
10344 | var params = __assign$2({}, this.parentComp.getTooltipParams());
|
10345 | if (!exists(params.value)) {
|
10346 | this.setToDoNothing();
|
10347 | return;
|
10348 | }
|
10349 | this.state = TooltipStates.SHOWING;
|
10350 | this.tooltipInstanceCount++;
|
10351 |
|
10352 |
|
10353 |
|
10354 | var callback = this.newTooltipComponentCallback.bind(this, this.tooltipInstanceCount);
|
10355 | var userDetails = this.userComponentFactory.getTooltipCompDetails(params);
|
10356 | userDetails.newAgStackInstance().then(callback);
|
10357 | };
|
10358 | CustomTooltipFeature.prototype.newTooltipComponentCallback = function (tooltipInstanceCopy, tooltipComp) {
|
10359 | var compNoLongerNeeded = this.state !== TooltipStates.SHOWING || this.tooltipInstanceCount !== tooltipInstanceCopy;
|
10360 | if (compNoLongerNeeded) {
|
10361 | this.getContext().destroyBean(tooltipComp);
|
10362 | return;
|
10363 | }
|
10364 | var eGui = tooltipComp.getGui();
|
10365 | this.tooltipComp = tooltipComp;
|
10366 | if (!eGui.classList.contains('ag-tooltip')) {
|
10367 | eGui.classList.add('ag-tooltip-custom');
|
10368 | }
|
10369 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
10370 | var addPopupRes = this.popupService.addPopup({
|
10371 | eChild: eGui,
|
10372 | ariaLabel: translate('ariaLabelTooltip', 'Tooltip')
|
10373 | });
|
10374 | if (addPopupRes) {
|
10375 | this.tooltipPopupDestroyFunc = addPopupRes.hideFunc;
|
10376 | }
|
10377 |
|
10378 | this.positionTooltipUnderLastMouseEvent();
|
10379 | this.hideTooltipTimeoutId = window.setTimeout(this.hideTooltip.bind(this), this.tooltipHideDelay);
|
10380 | };
|
10381 | CustomTooltipFeature.prototype.positionTooltipUnderLastMouseEvent = function () {
|
10382 | this.popupService.positionPopupUnderMouseEvent({
|
10383 | type: 'tooltip',
|
10384 | mouseEvent: this.lastMouseEvent,
|
10385 | ePopup: this.tooltipComp.getGui(),
|
10386 | nudgeY: 18
|
10387 | });
|
10388 | };
|
10389 | CustomTooltipFeature.prototype.clearTimeouts = function () {
|
10390 | if (this.showTooltipTimeoutId) {
|
10391 | window.clearTimeout(this.showTooltipTimeoutId);
|
10392 | this.showTooltipTimeoutId = undefined;
|
10393 | }
|
10394 | if (this.hideTooltipTimeoutId) {
|
10395 | window.clearTimeout(this.hideTooltipTimeoutId);
|
10396 | this.hideTooltipTimeoutId = undefined;
|
10397 | }
|
10398 | };
|
10399 | __decorate$9([
|
10400 | Autowired('popupService')
|
10401 | ], CustomTooltipFeature.prototype, "popupService", void 0);
|
10402 | __decorate$9([
|
10403 | Autowired('userComponentFactory')
|
10404 | ], CustomTooltipFeature.prototype, "userComponentFactory", void 0);
|
10405 | __decorate$9([
|
10406 | Autowired('columnApi')
|
10407 | ], CustomTooltipFeature.prototype, "columnApi", void 0);
|
10408 | __decorate$9([
|
10409 | Autowired('gridApi')
|
10410 | ], CustomTooltipFeature.prototype, "gridApi", void 0);
|
10411 | __decorate$9([
|
10412 | PostConstruct
|
10413 | ], CustomTooltipFeature.prototype, "postConstruct", null);
|
10414 | return CustomTooltipFeature;
|
10415 | }(BeanStub));
|
10416 |
|
10417 |
|
10418 |
|
10419 |
|
10420 |
|
10421 |
|
10422 |
|
10423 | var __extends$6 = (undefined && undefined.__extends) || (function () {
|
10424 | var extendStatics = function (d, b) {
|
10425 | extendStatics = Object.setPrototypeOf ||
|
10426 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
10427 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
10428 | return extendStatics(d, b);
|
10429 | };
|
10430 | return function (d, b) {
|
10431 | extendStatics(d, b);
|
10432 | function __() { this.constructor = d; }
|
10433 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10434 | };
|
10435 | })();
|
10436 | var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
10437 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
10438 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
10439 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
10440 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
10441 | };
|
10442 | var compIdSequence = new NumberSequence();
|
10443 | var CssClassManager = (function () {
|
10444 | function CssClassManager(getGui) {
|
10445 |
|
10446 |
|
10447 | this.cssClassStates = {};
|
10448 | this.getGui = getGui;
|
10449 | }
|
10450 | CssClassManager.prototype.addCssClass = function (className) {
|
10451 | var _this = this;
|
10452 | var list = (className || '').split(' ');
|
10453 | if (list.length > 1) {
|
10454 | list.forEach(function (cls) { return _this.addCssClass(cls); });
|
10455 | return;
|
10456 | }
|
10457 | var updateNeeded = this.cssClassStates[className] !== true;
|
10458 | if (updateNeeded && className.length) {
|
10459 | this.getGui().classList.add(className);
|
10460 | this.cssClassStates[className] = true;
|
10461 | }
|
10462 | };
|
10463 | CssClassManager.prototype.removeCssClass = function (className) {
|
10464 | var _this = this;
|
10465 | var list = (className || '').split(' ');
|
10466 | if (list.length > 1) {
|
10467 | list.forEach(function (cls) { return _this.removeCssClass(cls); });
|
10468 | return;
|
10469 | }
|
10470 | var updateNeeded = this.cssClassStates[className] !== false;
|
10471 | if (updateNeeded && className.length) {
|
10472 | this.getGui().classList.remove(className);
|
10473 | this.cssClassStates[className] = false;
|
10474 | }
|
10475 | };
|
10476 | CssClassManager.prototype.containsCssClass = function (className) {
|
10477 | return this.getGui().classList.contains(className);
|
10478 | };
|
10479 | CssClassManager.prototype.addOrRemoveCssClass = function (className, addOrRemove) {
|
10480 | var _this = this;
|
10481 | var list = (className || '').split(' ');
|
10482 | if (list.length > 1) {
|
10483 | list.forEach(function (cls) { return _this.addOrRemoveCssClass(cls, addOrRemove); });
|
10484 | return;
|
10485 | }
|
10486 | var updateNeeded = this.cssClassStates[className] !== addOrRemove;
|
10487 | if (updateNeeded && className.length) {
|
10488 | this.getGui().classList.toggle(className, addOrRemove);
|
10489 | this.cssClassStates[className] = addOrRemove;
|
10490 | }
|
10491 | };
|
10492 | return CssClassManager;
|
10493 | }());
|
10494 | var Component = (function (_super) {
|
10495 | __extends$6(Component, _super);
|
10496 | function Component(template) {
|
10497 | var _this = _super.call(this) || this;
|
10498 |
|
10499 | _this.displayed = true;
|
10500 |
|
10501 | _this.visible = true;
|
10502 |
|
10503 |
|
10504 |
|
10505 | _this.compId = compIdSequence.next();
|
10506 | _this.cssClassManager = new CssClassManager(function () { return _this.eGui; });
|
10507 | if (template) {
|
10508 | _this.setTemplate(template);
|
10509 | }
|
10510 | return _this;
|
10511 | }
|
10512 | Component.prototype.preConstructOnComponent = function () {
|
10513 | this.usingBrowserTooltips = this.gridOptionsWrapper.isEnableBrowserTooltips();
|
10514 | };
|
10515 | Component.prototype.getCompId = function () {
|
10516 | return this.compId;
|
10517 | };
|
10518 | Component.prototype.getTooltipParams = function () {
|
10519 | return {
|
10520 | value: this.tooltipText,
|
10521 | location: 'UNKNOWN'
|
10522 | };
|
10523 | };
|
10524 | Component.prototype.setTooltip = function (newTooltipText) {
|
10525 | var _this = this;
|
10526 | var removeTooltip = function () {
|
10527 | if (_this.usingBrowserTooltips) {
|
10528 | _this.getGui().removeAttribute('title');
|
10529 | }
|
10530 | else {
|
10531 | _this.tooltipFeature = _this.destroyBean(_this.tooltipFeature);
|
10532 | }
|
10533 | };
|
10534 | var addTooltip = function () {
|
10535 | if (_this.usingBrowserTooltips) {
|
10536 | _this.getGui().setAttribute('title', _this.tooltipText);
|
10537 | }
|
10538 | else {
|
10539 | _this.tooltipFeature = _this.createBean(new CustomTooltipFeature(_this));
|
10540 | }
|
10541 | };
|
10542 | if (this.tooltipText != newTooltipText) {
|
10543 | if (this.tooltipText) {
|
10544 | removeTooltip();
|
10545 | }
|
10546 | if (newTooltipText != null) {
|
10547 | this.tooltipText = newTooltipText;
|
10548 | if (this.tooltipText) {
|
10549 | addTooltip();
|
10550 | }
|
10551 | }
|
10552 | }
|
10553 | };
|
10554 |
|
10555 | Component.prototype.createChildComponentsFromTags = function (parentNode, paramsMap) {
|
10556 | var _this = this;
|
10557 |
|
10558 |
|
10559 | var childNodeList = copyNodeList(parentNode.childNodes);
|
10560 | childNodeList.forEach(function (childNode) {
|
10561 | if (!(childNode instanceof HTMLElement)) {
|
10562 | return;
|
10563 | }
|
10564 | var childComp = _this.createComponentFromElement(childNode, function (childComp) {
|
10565 |
|
10566 |
|
10567 | var childGui = childComp.getGui();
|
10568 | if (childGui) {
|
10569 | _this.copyAttributesFromNode(childNode, childComp.getGui());
|
10570 | }
|
10571 | }, paramsMap);
|
10572 | if (childComp) {
|
10573 | if (childComp.addItems && childNode.children.length) {
|
10574 | _this.createChildComponentsFromTags(childNode, paramsMap);
|
10575 |
|
10576 | var items = Array.prototype.slice.call(childNode.children);
|
10577 | childComp.addItems(items);
|
10578 | }
|
10579 |
|
10580 | _this.swapComponentForNode(childComp, parentNode, childNode);
|
10581 | }
|
10582 | else if (childNode.childNodes) {
|
10583 | _this.createChildComponentsFromTags(childNode, paramsMap);
|
10584 | }
|
10585 | });
|
10586 | };
|
10587 | Component.prototype.createComponentFromElement = function (element, afterPreCreateCallback, paramsMap) {
|
10588 | var key = element.nodeName;
|
10589 | var componentParams = paramsMap ? paramsMap[element.getAttribute('ref')] : undefined;
|
10590 | var ComponentClass = this.agStackComponentsRegistry.getComponentClass(key);
|
10591 | if (ComponentClass) {
|
10592 | Component.elementGettingCreated = element;
|
10593 | var newComponent = new ComponentClass(componentParams);
|
10594 | newComponent.setParentComponent(this);
|
10595 | this.createBean(newComponent, null, afterPreCreateCallback);
|
10596 | return newComponent;
|
10597 | }
|
10598 | return null;
|
10599 | };
|
10600 | Component.prototype.copyAttributesFromNode = function (source, dest) {
|
10601 | iterateNamedNodeMap(source.attributes, function (name, value) { return dest.setAttribute(name, value); });
|
10602 | };
|
10603 | Component.prototype.swapComponentForNode = function (newComponent, parentNode, childNode) {
|
10604 | var eComponent = newComponent.getGui();
|
10605 | parentNode.replaceChild(eComponent, childNode);
|
10606 | parentNode.insertBefore(document.createComment(childNode.nodeName), eComponent);
|
10607 | this.addDestroyFunc(this.destroyBean.bind(this, newComponent));
|
10608 | this.swapInComponentForQuerySelectors(newComponent, childNode);
|
10609 | };
|
10610 | Component.prototype.swapInComponentForQuerySelectors = function (newComponent, childNode) {
|
10611 | var thisNoType = this;
|
10612 | this.iterateOverQuerySelectors(function (querySelector) {
|
10613 | if (thisNoType[querySelector.attributeName] === childNode) {
|
10614 | thisNoType[querySelector.attributeName] = newComponent;
|
10615 | }
|
10616 | });
|
10617 | };
|
10618 | Component.prototype.iterateOverQuerySelectors = function (action) {
|
10619 | var thisPrototype = Object.getPrototypeOf(this);
|
10620 | while (thisPrototype != null) {
|
10621 | var metaData = thisPrototype.__agComponentMetaData;
|
10622 | var currentProtoName = getFunctionName(thisPrototype.constructor);
|
10623 | if (metaData && metaData[currentProtoName] && metaData[currentProtoName].querySelectors) {
|
10624 | metaData[currentProtoName].querySelectors.forEach(function (querySelector) { return action(querySelector); });
|
10625 | }
|
10626 | thisPrototype = Object.getPrototypeOf(thisPrototype);
|
10627 | }
|
10628 | };
|
10629 | Component.prototype.setTemplate = function (template, paramsMap) {
|
10630 | var eGui = loadTemplate(template);
|
10631 | this.setTemplateFromElement(eGui, paramsMap);
|
10632 | };
|
10633 | Component.prototype.setTemplateFromElement = function (element, paramsMap) {
|
10634 | this.eGui = element;
|
10635 | this.eGui.__agComponent = this;
|
10636 | this.wireQuerySelectors();
|
10637 |
|
10638 | if (!!this.getContext()) {
|
10639 | this.createChildComponentsFromTags(this.getGui(), paramsMap);
|
10640 | }
|
10641 | };
|
10642 | Component.prototype.createChildComponentsPreConstruct = function () {
|
10643 |
|
10644 |
|
10645 | if (!!this.getGui()) {
|
10646 | this.createChildComponentsFromTags(this.getGui());
|
10647 | }
|
10648 | };
|
10649 | Component.prototype.wireQuerySelectors = function () {
|
10650 | var _this = this;
|
10651 | if (!this.eGui) {
|
10652 | return;
|
10653 | }
|
10654 | var thisNoType = this;
|
10655 | this.iterateOverQuerySelectors(function (querySelector) {
|
10656 | var setResult = function (result) { return thisNoType[querySelector.attributeName] = result; };
|
10657 |
|
10658 |
|
10659 |
|
10660 | var topLevelRefMatch = querySelector.refSelector
|
10661 | && _this.eGui.getAttribute('ref') === querySelector.refSelector;
|
10662 | if (topLevelRefMatch) {
|
10663 | setResult(_this.eGui);
|
10664 | }
|
10665 | else {
|
10666 |
|
10667 | var resultOfQuery = _this.eGui.querySelector(querySelector.querySelector);
|
10668 | if (resultOfQuery) {
|
10669 | setResult(resultOfQuery.__agComponent || resultOfQuery);
|
10670 | }
|
10671 | }
|
10672 | });
|
10673 | };
|
10674 | Component.prototype.getGui = function () {
|
10675 | return this.eGui;
|
10676 | };
|
10677 | Component.prototype.getFocusableElement = function () {
|
10678 | return this.eGui;
|
10679 | };
|
10680 | Component.prototype.setParentComponent = function (component) {
|
10681 | this.parentComponent = component;
|
10682 | };
|
10683 | Component.prototype.getParentComponent = function () {
|
10684 | return this.parentComponent;
|
10685 | };
|
10686 |
|
10687 |
|
10688 | Component.prototype.setGui = function (eGui) {
|
10689 | this.eGui = eGui;
|
10690 | };
|
10691 | Component.prototype.queryForHtmlElement = function (cssSelector) {
|
10692 | return this.eGui.querySelector(cssSelector);
|
10693 | };
|
10694 | Component.prototype.queryForHtmlInputElement = function (cssSelector) {
|
10695 | return this.eGui.querySelector(cssSelector);
|
10696 | };
|
10697 | Component.prototype.appendChild = function (newChild, container) {
|
10698 | if (!container) {
|
10699 | container = this.eGui;
|
10700 | }
|
10701 | if (newChild == null) {
|
10702 | return;
|
10703 | }
|
10704 | if (isNodeOrElement(newChild)) {
|
10705 | container.appendChild(newChild);
|
10706 | }
|
10707 | else {
|
10708 | var childComponent = newChild;
|
10709 | container.appendChild(childComponent.getGui());
|
10710 | this.addDestroyFunc(this.destroyBean.bind(this, childComponent));
|
10711 | }
|
10712 | };
|
10713 | Component.prototype.isDisplayed = function () {
|
10714 | return this.displayed;
|
10715 | };
|
10716 | Component.prototype.setVisible = function (visible) {
|
10717 | if (visible !== this.visible) {
|
10718 | this.visible = visible;
|
10719 | setVisible(this.eGui, visible);
|
10720 | }
|
10721 | };
|
10722 | Component.prototype.setDisplayed = function (displayed) {
|
10723 | if (displayed !== this.displayed) {
|
10724 | this.displayed = displayed;
|
10725 | setDisplayed(this.eGui, displayed);
|
10726 | var event_1 = {
|
10727 | type: Component.EVENT_DISPLAYED_CHANGED,
|
10728 | visible: this.displayed
|
10729 | };
|
10730 | this.dispatchEvent(event_1);
|
10731 | }
|
10732 | };
|
10733 | Component.prototype.destroy = function () {
|
10734 | if (this.tooltipFeature) {
|
10735 | this.tooltipFeature = this.destroyBean(this.tooltipFeature);
|
10736 | }
|
10737 | _super.prototype.destroy.call(this);
|
10738 | };
|
10739 | Component.prototype.addGuiEventListener = function (event, listener) {
|
10740 | var _this = this;
|
10741 | this.eGui.addEventListener(event, listener);
|
10742 | this.addDestroyFunc(function () { return _this.eGui.removeEventListener(event, listener); });
|
10743 | };
|
10744 | Component.prototype.addCssClass = function (className) {
|
10745 | this.cssClassManager.addCssClass(className);
|
10746 | };
|
10747 | Component.prototype.removeCssClass = function (className) {
|
10748 | this.cssClassManager.removeCssClass(className);
|
10749 | };
|
10750 | Component.prototype.containsCssClass = function (className) {
|
10751 | return this.cssClassManager.containsCssClass(className);
|
10752 | };
|
10753 | Component.prototype.addOrRemoveCssClass = function (className, addOrRemove) {
|
10754 | this.cssClassManager.addOrRemoveCssClass(className, addOrRemove);
|
10755 | };
|
10756 | Component.prototype.getAttribute = function (key) {
|
10757 | var eGui = this.eGui;
|
10758 | return eGui ? eGui.getAttribute(key) : null;
|
10759 | };
|
10760 | Component.prototype.getRefElement = function (refName) {
|
10761 | return this.queryForHtmlElement("[ref=\"" + refName + "\"]");
|
10762 | };
|
10763 | Component.EVENT_DISPLAYED_CHANGED = 'displayedChanged';
|
10764 | __decorate$a([
|
10765 | Autowired('agStackComponentsRegistry')
|
10766 | ], Component.prototype, "agStackComponentsRegistry", void 0);
|
10767 | __decorate$a([
|
10768 | PreConstruct
|
10769 | ], Component.prototype, "preConstructOnComponent", null);
|
10770 | __decorate$a([
|
10771 | PreConstruct
|
10772 | ], Component.prototype, "createChildComponentsPreConstruct", null);
|
10773 | return Component;
|
10774 | }(BeanStub));
|
10775 |
|
10776 |
|
10777 |
|
10778 |
|
10779 |
|
10780 |
|
10781 |
|
10782 | function QuerySelector(selector) {
|
10783 | return querySelectorFunc.bind(this, selector, undefined);
|
10784 | }
|
10785 | function RefSelector(ref) {
|
10786 | return querySelectorFunc.bind(this, "[ref=" + ref + "]", ref);
|
10787 | }
|
10788 | function querySelectorFunc(selector, refSelector, classPrototype, methodOrAttributeName, index) {
|
10789 | if (selector === null) {
|
10790 | console.error('AG Grid: QuerySelector selector should not be null');
|
10791 | return;
|
10792 | }
|
10793 | if (typeof index === 'number') {
|
10794 | console.error('AG Grid: QuerySelector should be on an attribute');
|
10795 | return;
|
10796 | }
|
10797 | addToObjectProps(classPrototype, 'querySelectors', {
|
10798 | attributeName: methodOrAttributeName,
|
10799 | querySelector: selector,
|
10800 | refSelector: refSelector
|
10801 | });
|
10802 | }
|
10803 |
|
10804 |
|
10805 |
|
10806 |
|
10807 |
|
10808 |
|
10809 |
|
10810 |
|
10811 |
|
10812 |
|
10813 |
|
10814 |
|
10815 |
|
10816 |
|
10817 |
|
10818 |
|
10819 | function addToObjectProps(target, key, value) {
|
10820 |
|
10821 | var props = getOrCreateProps$1(target, getFunctionName(target.constructor));
|
10822 | if (!props[key]) {
|
10823 | props[key] = [];
|
10824 | }
|
10825 | props[key].push(value);
|
10826 | }
|
10827 | function getOrCreateProps$1(target, instanceName) {
|
10828 | if (!target.__agComponentMetaData) {
|
10829 | target.__agComponentMetaData = {};
|
10830 | }
|
10831 | if (!target.__agComponentMetaData[instanceName]) {
|
10832 | target.__agComponentMetaData[instanceName] = {};
|
10833 | }
|
10834 | return target.__agComponentMetaData[instanceName];
|
10835 | }
|
10836 |
|
10837 |
|
10838 |
|
10839 |
|
10840 |
|
10841 |
|
10842 |
|
10843 | var __extends$7 = (undefined && undefined.__extends) || (function () {
|
10844 | var extendStatics = function (d, b) {
|
10845 | extendStatics = Object.setPrototypeOf ||
|
10846 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
10847 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
10848 | return extendStatics(d, b);
|
10849 | };
|
10850 | return function (d, b) {
|
10851 | extendStatics(d, b);
|
10852 | function __() { this.constructor = d; }
|
10853 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10854 | };
|
10855 | })();
|
10856 | var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
10857 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
10858 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
10859 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
10860 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
10861 | };
|
10862 |
|
10863 |
|
10864 |
|
10865 | var ReadOnlyFloatingFilter = (function (_super) {
|
10866 | __extends$7(ReadOnlyFloatingFilter, _super);
|
10867 | function ReadOnlyFloatingFilter() {
|
10868 | 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;
|
10869 | }
|
10870 |
|
10871 |
|
10872 | ReadOnlyFloatingFilter.prototype.destroy = function () {
|
10873 | _super.prototype.destroy.call(this);
|
10874 | };
|
10875 | ReadOnlyFloatingFilter.prototype.init = function (params) {
|
10876 | this.params = params;
|
10877 | var displayName = this.columnModel.getDisplayNameForColumn(params.column, 'header', true);
|
10878 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
10879 | this.eFloatingFilterText
|
10880 | .setDisabled(true)
|
10881 | .setInputAriaLabel(displayName + " " + translate('ariaFilterInput', 'Filter Input'));
|
10882 | };
|
10883 | ReadOnlyFloatingFilter.prototype.onParentModelChanged = function (parentModel) {
|
10884 | var _this = this;
|
10885 | if (!parentModel) {
|
10886 | this.eFloatingFilterText.setValue('');
|
10887 | return;
|
10888 | }
|
10889 | this.params.parentFilterInstance(function (filterInstance) {
|
10890 |
|
10891 |
|
10892 |
|
10893 |
|
10894 | if (filterInstance.getModelAsString) {
|
10895 | var modelAsString = filterInstance.getModelAsString(parentModel);
|
10896 | _this.eFloatingFilterText.setValue(modelAsString);
|
10897 | }
|
10898 | });
|
10899 | };
|
10900 | __decorate$b([
|
10901 | RefSelector('eFloatingFilterText')
|
10902 | ], ReadOnlyFloatingFilter.prototype, "eFloatingFilterText", void 0);
|
10903 | __decorate$b([
|
10904 | Autowired('columnModel')
|
10905 | ], ReadOnlyFloatingFilter.prototype, "columnModel", void 0);
|
10906 | return ReadOnlyFloatingFilter;
|
10907 | }(Component));
|
10908 |
|
10909 |
|
10910 |
|
10911 |
|
10912 |
|
10913 |
|
10914 |
|
10915 |
|
10916 |
|
10917 | var DateCompWrapper = (function () {
|
10918 | function DateCompWrapper(context, userComponentFactory, dateComponentParams, eParent) {
|
10919 | var _this = this;
|
10920 | this.alive = true;
|
10921 | this.context = context;
|
10922 | this.eParent = eParent;
|
10923 | var compDetails = userComponentFactory.getDateCompDetails(dateComponentParams);
|
10924 | var promise = compDetails.newAgStackInstance();
|
10925 | promise.then(function (dateComp) {
|
10926 |
|
10927 | if (!_this.alive) {
|
10928 | context.destroyBean(dateComp);
|
10929 | return;
|
10930 | }
|
10931 | _this.dateComp = dateComp;
|
10932 | if (!dateComp) {
|
10933 | return;
|
10934 | }
|
10935 | eParent.appendChild(dateComp.getGui());
|
10936 | if (dateComp.afterGuiAttached) {
|
10937 | dateComp.afterGuiAttached();
|
10938 | }
|
10939 | if (_this.tempValue) {
|
10940 | dateComp.setDate(_this.tempValue);
|
10941 | }
|
10942 | if (_this.disabled != null) {
|
10943 | _this.setDateCompDisabled(_this.disabled);
|
10944 | }
|
10945 | });
|
10946 | }
|
10947 | DateCompWrapper.prototype.destroy = function () {
|
10948 | this.alive = false;
|
10949 | this.dateComp = this.context.destroyBean(this.dateComp);
|
10950 | };
|
10951 | DateCompWrapper.prototype.getDate = function () {
|
10952 | return this.dateComp ? this.dateComp.getDate() : this.tempValue;
|
10953 | };
|
10954 | DateCompWrapper.prototype.setDate = function (value) {
|
10955 | if (this.dateComp) {
|
10956 | this.dateComp.setDate(value);
|
10957 | }
|
10958 | else {
|
10959 | this.tempValue = value;
|
10960 | }
|
10961 | };
|
10962 | DateCompWrapper.prototype.setDisabled = function (disabled) {
|
10963 | if (this.dateComp) {
|
10964 | this.setDateCompDisabled(disabled);
|
10965 | }
|
10966 | else {
|
10967 | this.disabled = disabled;
|
10968 | }
|
10969 | };
|
10970 | DateCompWrapper.prototype.setDisplayed = function (displayed) {
|
10971 | setDisplayed(this.eParent, displayed);
|
10972 | };
|
10973 | DateCompWrapper.prototype.setInputPlaceholder = function (placeholder) {
|
10974 | if (this.dateComp && this.dateComp.setInputPlaceholder) {
|
10975 | this.dateComp.setInputPlaceholder(placeholder);
|
10976 | }
|
10977 | };
|
10978 | DateCompWrapper.prototype.setInputAriaLabel = function (label) {
|
10979 | if (this.dateComp && this.dateComp.setInputAriaLabel) {
|
10980 | this.dateComp.setInputAriaLabel(label);
|
10981 | }
|
10982 | };
|
10983 | DateCompWrapper.prototype.afterGuiAttached = function (params) {
|
10984 | if (this.dateComp && typeof this.dateComp.afterGuiAttached === 'function') {
|
10985 | this.dateComp.afterGuiAttached(params);
|
10986 | }
|
10987 | };
|
10988 | DateCompWrapper.prototype.setDateCompDisabled = function (disabled) {
|
10989 | if (this.dateComp == null) {
|
10990 | return;
|
10991 | }
|
10992 | if (this.dateComp.setDisabled == null) {
|
10993 | return;
|
10994 | }
|
10995 | this.dateComp.setDisabled(disabled);
|
10996 | };
|
10997 | return DateCompWrapper;
|
10998 | }());
|
10999 |
|
11000 |
|
11001 |
|
11002 |
|
11003 |
|
11004 |
|
11005 |
|
11006 | var __assign$3 = (undefined && undefined.__assign) || function () {
|
11007 | __assign$3 = Object.assign || function(t) {
|
11008 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
11009 | s = arguments[i];
|
11010 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
11011 | t[p] = s[p];
|
11012 | }
|
11013 | return t;
|
11014 | };
|
11015 | return __assign$3.apply(this, arguments);
|
11016 | };
|
11017 |
|
11018 | var OptionsFactory = (function () {
|
11019 | function OptionsFactory() {
|
11020 | this.customFilterOptions = {};
|
11021 | }
|
11022 | OptionsFactory.prototype.init = function (params, defaultOptions) {
|
11023 | this.filterOptions = params.filterOptions || defaultOptions;
|
11024 | this.mapCustomOptions();
|
11025 | this.selectDefaultItem(params);
|
11026 | this.checkForDeprecatedParams();
|
11027 | };
|
11028 | OptionsFactory.prototype.checkForDeprecatedParams = function () {
|
11029 | if (this.filterOptions.some(function (opt) { return typeof opt != 'string' && opt.test != null; })) {
|
11030 | console.warn("AG Grid: [IFilterOptionDef] since v26.2.0, test() has been replaced with predicate().");
|
11031 | }
|
11032 | if (this.filterOptions.some(function (opt) { return typeof opt != 'string' && opt.hideFilterInput != null; })) {
|
11033 | console.warn("AG Grid: [IFilterOptionDef] since v26.2.0, useOfHideFilterInput has been replaced with numberOfInputs.");
|
11034 | }
|
11035 | };
|
11036 | OptionsFactory.prototype.getFilterOptions = function () {
|
11037 | return this.filterOptions;
|
11038 | };
|
11039 | OptionsFactory.prototype.mapCustomOptions = function () {
|
11040 | var _this = this;
|
11041 | if (!this.filterOptions) {
|
11042 | return;
|
11043 | }
|
11044 | this.filterOptions.forEach(function (filterOption) {
|
11045 | if (typeof filterOption === 'string') {
|
11046 | return;
|
11047 | }
|
11048 | var requiredProperties = [['displayKey'], ['displayName'], ['predicate', 'test']];
|
11049 | var propertyCheck = function (keys) {
|
11050 | if (!keys.some(function (key) { return filterOption[key] != null; })) {
|
11051 | console.warn("AG Grid: ignoring FilterOptionDef as it doesn't contain one of '" + keys + "'");
|
11052 | return false;
|
11053 | }
|
11054 | return true;
|
11055 | };
|
11056 | if (!requiredProperties.every(propertyCheck)) {
|
11057 | _this.filterOptions = _this.filterOptions.filter(function (v) { return v === filterOption; }) || [];
|
11058 | return;
|
11059 | }
|
11060 | var test = filterOption.test;
|
11061 | var mutatedFilterOptions = __assign$3({}, filterOption);
|
11062 | if (test != null && filterOption.predicate == null) {
|
11063 | mutatedFilterOptions.predicate = function (v, cv) { return test(v[0], cv); };
|
11064 | delete mutatedFilterOptions.test;
|
11065 | }
|
11066 | if (mutatedFilterOptions.hideFilterInput && mutatedFilterOptions.numberOfInputs == null) {
|
11067 | mutatedFilterOptions.numberOfInputs = 0;
|
11068 | delete mutatedFilterOptions.hideFilterInput;
|
11069 | }
|
11070 | _this.customFilterOptions[filterOption.displayKey] = mutatedFilterOptions;
|
11071 | });
|
11072 | };
|
11073 | OptionsFactory.prototype.selectDefaultItem = function (params) {
|
11074 | if (params.defaultOption) {
|
11075 | this.defaultOption = params.defaultOption;
|
11076 | }
|
11077 | else if (this.filterOptions.length >= 1) {
|
11078 | var firstFilterOption = this.filterOptions[0];
|
11079 | if (typeof firstFilterOption === 'string') {
|
11080 | this.defaultOption = firstFilterOption;
|
11081 | }
|
11082 | else if (firstFilterOption.displayKey) {
|
11083 | this.defaultOption = firstFilterOption.displayKey;
|
11084 | }
|
11085 | else {
|
11086 | console.warn("AG Grid: invalid FilterOptionDef supplied as it doesn't contain a 'displayKey'");
|
11087 | }
|
11088 | }
|
11089 | else {
|
11090 | console.warn('AG Grid: no filter options for filter');
|
11091 | }
|
11092 | };
|
11093 | OptionsFactory.prototype.getDefaultOption = function () {
|
11094 | return this.defaultOption;
|
11095 | };
|
11096 | OptionsFactory.prototype.getCustomOption = function (name) {
|
11097 | return this.customFilterOptions[name];
|
11098 | };
|
11099 | return OptionsFactory;
|
11100 | }());
|
11101 |
|
11102 |
|
11103 |
|
11104 |
|
11105 |
|
11106 |
|
11107 |
|
11108 | var DEFAULT_FILTER_LOCALE_TEXT = {
|
11109 | applyFilter: 'Apply',
|
11110 | clearFilter: 'Clear',
|
11111 | resetFilter: 'Reset',
|
11112 | cancelFilter: 'Cancel',
|
11113 | textFilter: 'Text Filter',
|
11114 | numberFilter: 'Number Filter',
|
11115 | dateFilter: 'Date Filter',
|
11116 | setFilter: 'Set Filter',
|
11117 | filterOoo: 'Filter...',
|
11118 | empty: 'Choose One',
|
11119 | equals: 'Equals',
|
11120 | notEqual: 'Not equal',
|
11121 | lessThan: 'Less than',
|
11122 | greaterThan: 'Greater than',
|
11123 | inRange: 'In range',
|
11124 | inRangeStart: 'From',
|
11125 | inRangeEnd: 'To',
|
11126 | lessThanOrEqual: 'Less than or equals',
|
11127 | greaterThanOrEqual: 'Greater than or equals',
|
11128 | contains: 'Contains',
|
11129 | notContains: 'Not contains',
|
11130 | startsWith: 'Starts with',
|
11131 | endsWith: 'Ends with',
|
11132 | blank: 'Blank',
|
11133 | notBlank: 'Not blank',
|
11134 | andCondition: 'AND',
|
11135 | orCondition: 'OR',
|
11136 | dateFormatOoo: 'yyyy-mm-dd',
|
11137 | };
|
11138 |
|
11139 |
|
11140 |
|
11141 |
|
11142 |
|
11143 |
|
11144 |
|
11145 | var KeyCode = (function () {
|
11146 | function KeyCode() {
|
11147 | }
|
11148 | KeyCode.BACKSPACE = 'Backspace';
|
11149 | KeyCode.TAB = 'Tab';
|
11150 | KeyCode.ENTER = 'Enter';
|
11151 | KeyCode.ESCAPE = 'Escape';
|
11152 | KeyCode.SPACE = ' ';
|
11153 | KeyCode.LEFT = 'ArrowLeft';
|
11154 | KeyCode.UP = 'ArrowUp';
|
11155 | KeyCode.RIGHT = 'ArrowRight';
|
11156 | KeyCode.DOWN = 'ArrowDown';
|
11157 | KeyCode.DELETE = 'Delete';
|
11158 | KeyCode.F2 = 'F2';
|
11159 | KeyCode.PAGE_UP = 'PageUp';
|
11160 | KeyCode.PAGE_DOWN = 'PageDown';
|
11161 | KeyCode.PAGE_HOME = 'Home';
|
11162 | KeyCode.PAGE_END = 'End';
|
11163 |
|
11164 |
|
11165 | KeyCode.A = 'KeyA';
|
11166 | KeyCode.C = 'KeyC';
|
11167 | KeyCode.V = 'KeyV';
|
11168 | KeyCode.D = 'KeyD';
|
11169 | KeyCode.Z = 'KeyZ';
|
11170 | KeyCode.Y = 'KeyY';
|
11171 | return KeyCode;
|
11172 | }());
|
11173 |
|
11174 |
|
11175 |
|
11176 |
|
11177 |
|
11178 |
|
11179 |
|
11180 | var __extends$8 = (undefined && undefined.__extends) || (function () {
|
11181 | var extendStatics = function (d, b) {
|
11182 | extendStatics = Object.setPrototypeOf ||
|
11183 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11184 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
11185 | return extendStatics(d, b);
|
11186 | };
|
11187 | return function (d, b) {
|
11188 | extendStatics(d, b);
|
11189 | function __() { this.constructor = d; }
|
11190 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11191 | };
|
11192 | })();
|
11193 | var __assign$4 = (undefined && undefined.__assign) || function () {
|
11194 | __assign$4 = Object.assign || function(t) {
|
11195 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
11196 | s = arguments[i];
|
11197 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
11198 | t[p] = s[p];
|
11199 | }
|
11200 | return t;
|
11201 | };
|
11202 | return __assign$4.apply(this, arguments);
|
11203 | };
|
11204 | var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
11205 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
11206 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
11207 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
11208 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
11209 | };
|
11210 | var ManagedFocusFeature = (function (_super) {
|
11211 | __extends$8(ManagedFocusFeature, _super);
|
11212 | function ManagedFocusFeature(eFocusableElement, callbacks) {
|
11213 | if (callbacks === void 0) { callbacks = {}; }
|
11214 | var _this = _super.call(this) || this;
|
11215 | _this.eFocusableElement = eFocusableElement;
|
11216 | _this.callbacks = callbacks;
|
11217 | _this.callbacks = __assign$4({ shouldStopEventPropagation: function () { return false; }, onTabKeyDown: function (e) {
|
11218 | if (e.defaultPrevented) {
|
11219 | return;
|
11220 | }
|
11221 | var nextRoot = _this.focusService.findNextFocusableElement(_this.eFocusableElement, false, e.shiftKey);
|
11222 | if (!nextRoot) {
|
11223 | return;
|
11224 | }
|
11225 | nextRoot.focus();
|
11226 | e.preventDefault();
|
11227 | } }, callbacks);
|
11228 | return _this;
|
11229 | }
|
11230 | ManagedFocusFeature.prototype.postConstruct = function () {
|
11231 | this.eFocusableElement.classList.add(ManagedFocusFeature.FOCUS_MANAGED_CLASS);
|
11232 | this.addKeyDownListeners(this.eFocusableElement);
|
11233 | if (this.callbacks.onFocusIn) {
|
11234 | this.addManagedListener(this.eFocusableElement, 'focusin', this.callbacks.onFocusIn);
|
11235 | }
|
11236 | if (this.callbacks.onFocusOut) {
|
11237 | this.addManagedListener(this.eFocusableElement, 'focusout', this.callbacks.onFocusOut);
|
11238 | }
|
11239 | };
|
11240 | ManagedFocusFeature.prototype.addKeyDownListeners = function (eGui) {
|
11241 | var _this = this;
|
11242 | this.addManagedListener(eGui, 'keydown', function (e) {
|
11243 | if (e.defaultPrevented || isStopPropagationForAgGrid(e)) {
|
11244 | return;
|
11245 | }
|
11246 | if (_this.callbacks.shouldStopEventPropagation(e)) {
|
11247 | stopPropagationForAgGrid(e);
|
11248 | return;
|
11249 | }
|
11250 | if (e.key === KeyCode.TAB) {
|
11251 | _this.callbacks.onTabKeyDown(e);
|
11252 | }
|
11253 | else if (_this.callbacks.handleKeyDown) {
|
11254 | _this.callbacks.handleKeyDown(e);
|
11255 | }
|
11256 | });
|
11257 | };
|
11258 | ManagedFocusFeature.FOCUS_MANAGED_CLASS = 'ag-focus-managed';
|
11259 | __decorate$c([
|
11260 | Autowired('focusService')
|
11261 | ], ManagedFocusFeature.prototype, "focusService", void 0);
|
11262 | __decorate$c([
|
11263 | PostConstruct
|
11264 | ], ManagedFocusFeature.prototype, "postConstruct", null);
|
11265 | return ManagedFocusFeature;
|
11266 | }(BeanStub));
|
11267 |
|
11268 |
|
11269 |
|
11270 |
|
11271 |
|
11272 |
|
11273 |
|
11274 | var __extends$9 = (undefined && undefined.__extends) || (function () {
|
11275 | var extendStatics = function (d, b) {
|
11276 | extendStatics = Object.setPrototypeOf ||
|
11277 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11278 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
11279 | return extendStatics(d, b);
|
11280 | };
|
11281 | return function (d, b) {
|
11282 | extendStatics(d, b);
|
11283 | function __() { this.constructor = d; }
|
11284 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11285 | };
|
11286 | })();
|
11287 | var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
11288 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
11289 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
11290 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
11291 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
11292 | };
|
11293 |
|
11294 |
|
11295 |
|
11296 |
|
11297 |
|
11298 |
|
11299 |
|
11300 |
|
11301 | var ProvidedFilter = (function (_super) {
|
11302 | __extends$9(ProvidedFilter, _super);
|
11303 | function ProvidedFilter(filterNameKey) {
|
11304 | var _this = _super.call(this) || this;
|
11305 | _this.filterNameKey = filterNameKey;
|
11306 | _this.applyActive = false;
|
11307 | _this.hidePopup = null;
|
11308 |
|
11309 |
|
11310 |
|
11311 |
|
11312 |
|
11313 |
|
11314 | _this.appliedModel = null;
|
11315 | return _this;
|
11316 | }
|
11317 | ProvidedFilter.prototype.postConstruct = function () {
|
11318 | this.resetTemplate();
|
11319 | this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), {
|
11320 | handleKeyDown: this.handleKeyDown.bind(this)
|
11321 | }));
|
11322 | };
|
11323 |
|
11324 | ProvidedFilter.prototype.handleKeyDown = function (e) { };
|
11325 | ProvidedFilter.prototype.getFilterTitle = function () {
|
11326 | return this.translate(this.filterNameKey);
|
11327 | };
|
11328 | ProvidedFilter.prototype.isFilterActive = function () {
|
11329 |
|
11330 | return !!this.appliedModel;
|
11331 | };
|
11332 | ProvidedFilter.prototype.resetTemplate = function (paramsMap) {
|
11333 | 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>";
|
11334 | this.setTemplate(templateString, paramsMap);
|
11335 | };
|
11336 | ProvidedFilter.prototype.isReadOnly = function () {
|
11337 | return !!this.providedFilterParams.readOnly;
|
11338 | };
|
11339 | ProvidedFilter.prototype.init = function (params) {
|
11340 | var _this = this;
|
11341 | this.setParams(params);
|
11342 | this.resetUiToDefaults(true).then(function () {
|
11343 | _this.updateUiVisibility();
|
11344 | _this.setupOnBtApplyDebounce();
|
11345 | });
|
11346 | };
|
11347 | ProvidedFilter.prototype.setParams = function (params) {
|
11348 | this.providedFilterParams = params;
|
11349 | this.applyActive = ProvidedFilter.isUseApplyButton(params);
|
11350 | this.createButtonPanel();
|
11351 | };
|
11352 | ProvidedFilter.prototype.createButtonPanel = function () {
|
11353 | var _this = this;
|
11354 | var buttons = this.providedFilterParams.buttons;
|
11355 | if (!buttons || buttons.length < 1 || this.isReadOnly()) {
|
11356 | return;
|
11357 | }
|
11358 | var eButtonsPanel = document.createElement('div');
|
11359 | eButtonsPanel.classList.add('ag-filter-apply-panel');
|
11360 | var addButton = function (type) {
|
11361 | var text;
|
11362 | var clickListener;
|
11363 | switch (type) {
|
11364 | case 'apply':
|
11365 | text = _this.translate('applyFilter');
|
11366 | clickListener = function (e) { return _this.onBtApply(false, false, e); };
|
11367 | break;
|
11368 | case 'clear':
|
11369 | text = _this.translate('clearFilter');
|
11370 | clickListener = function () { return _this.onBtClear(); };
|
11371 | break;
|
11372 | case 'reset':
|
11373 | text = _this.translate('resetFilter');
|
11374 | clickListener = function () { return _this.onBtReset(); };
|
11375 | break;
|
11376 | case 'cancel':
|
11377 | text = _this.translate('cancelFilter');
|
11378 | clickListener = function (e) { _this.onBtCancel(e); };
|
11379 | break;
|
11380 | default:
|
11381 | console.warn('AG Grid: Unknown button type specified');
|
11382 | return;
|
11383 | }
|
11384 | var button = loadTemplate(
|
11385 |
|
11386 | "<button\n type=\"button\"\n ref=\"" + type + "FilterButton\"\n class=\"ag-standard-button ag-filter-apply-panel-button\"\n >" + text + "\n </button>");
|
11387 | eButtonsPanel.appendChild(button);
|
11388 | _this.addManagedListener(button, 'click', clickListener);
|
11389 | };
|
11390 | convertToSet(buttons).forEach(function (type) { return addButton(type); });
|
11391 | this.getGui().appendChild(eButtonsPanel);
|
11392 | };
|
11393 |
|
11394 | ProvidedFilter.prototype.getDefaultDebounceMs = function () {
|
11395 | return 0;
|
11396 | };
|
11397 | ProvidedFilter.prototype.setupOnBtApplyDebounce = function () {
|
11398 | var debounceMs = ProvidedFilter.getDebounceMs(this.providedFilterParams, this.getDefaultDebounceMs());
|
11399 | this.onBtApplyDebounce = debounce(this.onBtApply.bind(this), debounceMs);
|
11400 | };
|
11401 | ProvidedFilter.prototype.getModel = function () {
|
11402 | return this.appliedModel ? this.appliedModel : null;
|
11403 | };
|
11404 | ProvidedFilter.prototype.setModel = function (model) {
|
11405 | var _this = this;
|
11406 | var promise = model != null ? this.setModelIntoUi(model) : this.resetUiToDefaults();
|
11407 | return promise.then(function () {
|
11408 | _this.updateUiVisibility();
|
11409 |
|
11410 |
|
11411 |
|
11412 | _this.applyModel();
|
11413 | });
|
11414 | };
|
11415 | ProvidedFilter.prototype.onBtCancel = function (e) {
|
11416 | var _this = this;
|
11417 | var currentModel = this.getModel();
|
11418 | var afterAppliedFunc = function () {
|
11419 | _this.onUiChanged(false, 'prevent');
|
11420 | if (_this.providedFilterParams.closeOnApply) {
|
11421 | _this.close(e);
|
11422 | }
|
11423 | };
|
11424 | if (currentModel != null) {
|
11425 | this.setModelIntoUi(currentModel).then(afterAppliedFunc);
|
11426 | }
|
11427 | else {
|
11428 | this.resetUiToDefaults().then(afterAppliedFunc);
|
11429 | }
|
11430 | };
|
11431 | ProvidedFilter.prototype.onBtClear = function () {
|
11432 | var _this = this;
|
11433 | this.resetUiToDefaults().then(function () { return _this.onUiChanged(); });
|
11434 | };
|
11435 | ProvidedFilter.prototype.onBtReset = function () {
|
11436 | this.onBtClear();
|
11437 | this.onBtApply();
|
11438 | };
|
11439 | |
11440 |
|
11441 |
|
11442 | ProvidedFilter.prototype.applyModel = function () {
|
11443 | var newModel = this.getModelFromUi();
|
11444 | if (!this.isModelValid(newModel)) {
|
11445 | return false;
|
11446 | }
|
11447 | var previousModel = this.appliedModel;
|
11448 | this.appliedModel = newModel;
|
11449 |
|
11450 |
|
11451 | return !this.areModelsEqual(previousModel, newModel);
|
11452 | };
|
11453 | ProvidedFilter.prototype.isModelValid = function (model) {
|
11454 | return true;
|
11455 | };
|
11456 | ProvidedFilter.prototype.onBtApply = function (afterFloatingFilter, afterDataChange, e) {
|
11457 | if (afterFloatingFilter === void 0) { afterFloatingFilter = false; }
|
11458 | if (afterDataChange === void 0) { afterDataChange = false; }
|
11459 | if (this.applyModel()) {
|
11460 |
|
11461 |
|
11462 | this.providedFilterParams.filterChangedCallback({ afterFloatingFilter: afterFloatingFilter, afterDataChange: afterDataChange });
|
11463 | }
|
11464 | var closeOnApply = this.providedFilterParams.closeOnApply;
|
11465 |
|
11466 | if (closeOnApply && this.applyActive && !afterFloatingFilter && !afterDataChange) {
|
11467 | this.close(e);
|
11468 | }
|
11469 | };
|
11470 | ProvidedFilter.prototype.onNewRowsLoaded = function () {
|
11471 | };
|
11472 | ProvidedFilter.prototype.close = function (e) {
|
11473 | if (!this.hidePopup) {
|
11474 | return;
|
11475 | }
|
11476 | var keyboardEvent = e;
|
11477 | var key = keyboardEvent && keyboardEvent.key;
|
11478 | var params;
|
11479 | if (key === 'Enter' || key === 'Space') {
|
11480 | params = { keyboardEvent: keyboardEvent };
|
11481 | }
|
11482 | this.hidePopup(params);
|
11483 | this.hidePopup = null;
|
11484 | };
|
11485 | |
11486 |
|
11487 |
|
11488 |
|
11489 |
|
11490 | ProvidedFilter.prototype.onUiChanged = function (fromFloatingFilter, apply) {
|
11491 | if (fromFloatingFilter === void 0) { fromFloatingFilter = false; }
|
11492 | this.updateUiVisibility();
|
11493 | this.providedFilterParams.filterModifiedCallback();
|
11494 | if (this.applyActive && !this.isReadOnly) {
|
11495 | var isValid = this.isModelValid(this.getModelFromUi());
|
11496 | setDisabled(this.getRefElement('applyFilterButton'), !isValid);
|
11497 | }
|
11498 | if ((fromFloatingFilter && !apply) || apply === 'immediately') {
|
11499 | this.onBtApply(fromFloatingFilter);
|
11500 | }
|
11501 | else if ((!this.applyActive && !apply) || apply === 'debounce') {
|
11502 | this.onBtApplyDebounce();
|
11503 | }
|
11504 | };
|
11505 | ProvidedFilter.prototype.afterGuiAttached = function (params) {
|
11506 | if (params == null) {
|
11507 | return;
|
11508 | }
|
11509 | this.hidePopup = params.hidePopup;
|
11510 | };
|
11511 |
|
11512 | ProvidedFilter.getDebounceMs = function (params, debounceDefault) {
|
11513 | if (ProvidedFilter.isUseApplyButton(params)) {
|
11514 | if (params.debounceMs != null) {
|
11515 | console.warn('AG Grid: debounceMs is ignored when apply button is present');
|
11516 | }
|
11517 | return 0;
|
11518 | }
|
11519 | return params.debounceMs != null ? params.debounceMs : debounceDefault;
|
11520 | };
|
11521 |
|
11522 | ProvidedFilter.isUseApplyButton = function (params) {
|
11523 | return !!params.buttons && params.buttons.indexOf('apply') >= 0;
|
11524 | };
|
11525 | ProvidedFilter.prototype.destroy = function () {
|
11526 | this.hidePopup = null;
|
11527 | _super.prototype.destroy.call(this);
|
11528 | };
|
11529 | ProvidedFilter.prototype.translate = function (key) {
|
11530 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
11531 | return translate(key, DEFAULT_FILTER_LOCALE_TEXT[key]);
|
11532 | };
|
11533 | ProvidedFilter.prototype.getCellValue = function (rowNode) {
|
11534 | var _a = this.providedFilterParams, api = _a.api, colDef = _a.colDef, column = _a.column, columnApi = _a.columnApi, context = _a.context;
|
11535 | return this.providedFilterParams.valueGetter({
|
11536 | api: api,
|
11537 | colDef: colDef,
|
11538 | column: column,
|
11539 | columnApi: columnApi,
|
11540 | context: context,
|
11541 | data: rowNode.data,
|
11542 | getValue: function (field) { return rowNode.data[field]; },
|
11543 | node: rowNode,
|
11544 | });
|
11545 | };
|
11546 | __decorate$d([
|
11547 | Autowired('rowModel')
|
11548 | ], ProvidedFilter.prototype, "rowModel", void 0);
|
11549 | __decorate$d([
|
11550 | Autowired('valueService')
|
11551 | ], ProvidedFilter.prototype, "valueService", void 0);
|
11552 | __decorate$d([
|
11553 | PostConstruct
|
11554 | ], ProvidedFilter.prototype, "postConstruct", null);
|
11555 | return ProvidedFilter;
|
11556 | }(Component));
|
11557 |
|
11558 |
|
11559 |
|
11560 |
|
11561 |
|
11562 |
|
11563 |
|
11564 | var __extends$a = (undefined && undefined.__extends) || (function () {
|
11565 | var extendStatics = function (d, b) {
|
11566 | extendStatics = Object.setPrototypeOf ||
|
11567 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11568 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
11569 | return extendStatics(d, b);
|
11570 | };
|
11571 | return function (d, b) {
|
11572 | extendStatics(d, b);
|
11573 | function __() { this.constructor = d; }
|
11574 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11575 | };
|
11576 | })();
|
11577 | var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
11578 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
11579 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
11580 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
11581 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
11582 | };
|
11583 | var AgAbstractLabel = (function (_super) {
|
11584 | __extends$a(AgAbstractLabel, _super);
|
11585 | function AgAbstractLabel(config, template) {
|
11586 | var _this = _super.call(this, template) || this;
|
11587 | _this.labelSeparator = '';
|
11588 | _this.labelAlignment = 'left';
|
11589 | _this.label = '';
|
11590 | _this.config = config || {};
|
11591 | return _this;
|
11592 | }
|
11593 | AgAbstractLabel.prototype.postConstruct = function () {
|
11594 | this.addCssClass('ag-labeled');
|
11595 | this.eLabel.classList.add('ag-label');
|
11596 | var _a = this.config, labelSeparator = _a.labelSeparator, label = _a.label, labelWidth = _a.labelWidth, labelAlignment = _a.labelAlignment;
|
11597 | if (labelSeparator != null) {
|
11598 | this.setLabelSeparator(labelSeparator);
|
11599 | }
|
11600 | if (label != null) {
|
11601 | this.setLabel(label);
|
11602 | }
|
11603 | if (labelWidth != null) {
|
11604 | this.setLabelWidth(labelWidth);
|
11605 | }
|
11606 | this.setLabelAlignment(labelAlignment || this.labelAlignment);
|
11607 | this.refreshLabel();
|
11608 | };
|
11609 | AgAbstractLabel.prototype.refreshLabel = function () {
|
11610 | clearElement(this.eLabel);
|
11611 | if (typeof this.label === 'string') {
|
11612 | this.eLabel.innerText = this.label + this.labelSeparator;
|
11613 | }
|
11614 | else if (this.label) {
|
11615 | this.eLabel.appendChild(this.label);
|
11616 | }
|
11617 | if (this.label === '') {
|
11618 | this.eLabel.classList.add('ag-hidden');
|
11619 | setAriaRole(this.eLabel, 'presentation');
|
11620 | }
|
11621 | else {
|
11622 | this.eLabel.classList.remove('ag-hidden');
|
11623 | setAriaRole(this.eLabel, null);
|
11624 | }
|
11625 | };
|
11626 | AgAbstractLabel.prototype.setLabelSeparator = function (labelSeparator) {
|
11627 | if (this.labelSeparator === labelSeparator) {
|
11628 | return this;
|
11629 | }
|
11630 | this.labelSeparator = labelSeparator;
|
11631 | if (this.label != null) {
|
11632 | this.refreshLabel();
|
11633 | }
|
11634 | return this;
|
11635 | };
|
11636 | AgAbstractLabel.prototype.getLabelId = function () {
|
11637 | this.eLabel.id = this.eLabel.id || "ag-" + this.getCompId() + "-label";
|
11638 | return this.eLabel.id;
|
11639 | };
|
11640 | AgAbstractLabel.prototype.getLabel = function () {
|
11641 | return this.label;
|
11642 | };
|
11643 | AgAbstractLabel.prototype.setLabel = function (label) {
|
11644 | if (this.label === label) {
|
11645 | return this;
|
11646 | }
|
11647 | this.label = label;
|
11648 | this.refreshLabel();
|
11649 | return this;
|
11650 | };
|
11651 | AgAbstractLabel.prototype.setLabelAlignment = function (alignment) {
|
11652 | var eGui = this.getGui();
|
11653 | var eGuiClassList = eGui.classList;
|
11654 | eGuiClassList.toggle('ag-label-align-left', alignment === 'left');
|
11655 | eGuiClassList.toggle('ag-label-align-right', alignment === 'right');
|
11656 | eGuiClassList.toggle('ag-label-align-top', alignment === 'top');
|
11657 | return this;
|
11658 | };
|
11659 | AgAbstractLabel.prototype.setLabelWidth = function (width) {
|
11660 | if (this.label == null) {
|
11661 | return this;
|
11662 | }
|
11663 | setElementWidth(this.eLabel, width);
|
11664 | return this;
|
11665 | };
|
11666 | __decorate$e([
|
11667 | PostConstruct
|
11668 | ], AgAbstractLabel.prototype, "postConstruct", null);
|
11669 | return AgAbstractLabel;
|
11670 | }(Component));
|
11671 |
|
11672 |
|
11673 |
|
11674 |
|
11675 |
|
11676 |
|
11677 |
|
11678 | var __extends$b = (undefined && undefined.__extends) || (function () {
|
11679 | var extendStatics = function (d, b) {
|
11680 | extendStatics = Object.setPrototypeOf ||
|
11681 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11682 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
11683 | return extendStatics(d, b);
|
11684 | };
|
11685 | return function (d, b) {
|
11686 | extendStatics(d, b);
|
11687 | function __() { this.constructor = d; }
|
11688 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11689 | };
|
11690 | })();
|
11691 | var AgAbstractField = (function (_super) {
|
11692 | __extends$b(AgAbstractField, _super);
|
11693 | function AgAbstractField(config, template, className) {
|
11694 | var _this = _super.call(this, config, template) || this;
|
11695 | _this.className = className;
|
11696 | _this.disabled = false;
|
11697 | return _this;
|
11698 | }
|
11699 | AgAbstractField.prototype.postConstruct = function () {
|
11700 | _super.prototype.postConstruct.call(this);
|
11701 | if (this.className) {
|
11702 | this.addCssClass(this.className);
|
11703 | }
|
11704 | };
|
11705 | AgAbstractField.prototype.onValueChange = function (callbackFn) {
|
11706 | var _this = this;
|
11707 | this.addManagedListener(this, AgAbstractField.EVENT_CHANGED, function () { return callbackFn(_this.getValue()); });
|
11708 | return this;
|
11709 | };
|
11710 | AgAbstractField.prototype.getWidth = function () {
|
11711 | return this.getGui().clientWidth;
|
11712 | };
|
11713 | AgAbstractField.prototype.setWidth = function (width) {
|
11714 | setFixedWidth(this.getGui(), width);
|
11715 | return this;
|
11716 | };
|
11717 | AgAbstractField.prototype.getPreviousValue = function () {
|
11718 | return this.previousValue;
|
11719 | };
|
11720 | AgAbstractField.prototype.getValue = function () {
|
11721 | return this.value;
|
11722 | };
|
11723 | AgAbstractField.prototype.setValue = function (value, silent) {
|
11724 | if (this.value === value) {
|
11725 | return this;
|
11726 | }
|
11727 | this.previousValue = this.value;
|
11728 | this.value = value;
|
11729 | if (!silent) {
|
11730 | this.dispatchEvent({ type: AgAbstractField.EVENT_CHANGED });
|
11731 | }
|
11732 | return this;
|
11733 | };
|
11734 | AgAbstractField.prototype.setDisabled = function (disabled) {
|
11735 | disabled = !!disabled;
|
11736 | var element = this.getGui();
|
11737 | setDisabled(element, disabled);
|
11738 | element.classList.toggle('ag-disabled', disabled);
|
11739 | this.disabled = disabled;
|
11740 | return this;
|
11741 | };
|
11742 | AgAbstractField.prototype.isDisabled = function () {
|
11743 | return !!this.disabled;
|
11744 | };
|
11745 | AgAbstractField.EVENT_CHANGED = 'valueChange';
|
11746 | return AgAbstractField;
|
11747 | }(AgAbstractLabel));
|
11748 |
|
11749 |
|
11750 |
|
11751 |
|
11752 |
|
11753 |
|
11754 |
|
11755 | var __extends$c = (undefined && undefined.__extends) || (function () {
|
11756 | var extendStatics = function (d, b) {
|
11757 | extendStatics = Object.setPrototypeOf ||
|
11758 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11759 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
11760 | return extendStatics(d, b);
|
11761 | };
|
11762 | return function (d, b) {
|
11763 | extendStatics(d, b);
|
11764 | function __() { this.constructor = d; }
|
11765 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11766 | };
|
11767 | })();
|
11768 | var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
11769 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
11770 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
11771 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
11772 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
11773 | };
|
11774 | var AgPickerField = (function (_super) {
|
11775 | __extends$c(AgPickerField, _super);
|
11776 | function AgPickerField(config, className, pickerIcon, ariaRole) {
|
11777 | var _this = _super.call(this, config,
|
11778 | "<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;
|
11779 | _this.pickerIcon = pickerIcon;
|
11780 | _this.isPickerDisplayed = false;
|
11781 | _this.isDestroyingPicker = false;
|
11782 | _this.skipClick = false;
|
11783 | return _this;
|
11784 | }
|
11785 | AgPickerField.prototype.postConstruct = function () {
|
11786 | var _this = this;
|
11787 | _super.prototype.postConstruct.call(this);
|
11788 | var displayId = this.getCompId() + "-display";
|
11789 | this.eDisplayField.setAttribute('id', displayId);
|
11790 | setAriaDescribedBy(this.eWrapper, displayId);
|
11791 | var clickHandler = function () {
|
11792 | if (_this.skipClick) {
|
11793 | _this.skipClick = false;
|
11794 | return;
|
11795 | }
|
11796 | if (_this.isDisabled()) {
|
11797 | return;
|
11798 | }
|
11799 | _this.pickerComponent = _this.showPicker();
|
11800 | };
|
11801 | var eGui = this.getGui();
|
11802 | this.addManagedListener(eGui, 'mousedown', function (e) {
|
11803 | if (!_this.skipClick &&
|
11804 | _this.pickerComponent &&
|
11805 | _this.pickerComponent.isAlive() &&
|
11806 | isVisible(_this.pickerComponent.getGui()) &&
|
11807 | eGui.contains(e.target)) {
|
11808 | _this.skipClick = true;
|
11809 | }
|
11810 | });
|
11811 | this.addManagedListener(eGui, 'keydown', function (e) {
|
11812 | switch (e.key) {
|
11813 | case KeyCode.UP:
|
11814 | case KeyCode.DOWN:
|
11815 | case KeyCode.ENTER:
|
11816 | case KeyCode.SPACE:
|
11817 | clickHandler();
|
11818 | case KeyCode.ESCAPE:
|
11819 | if (_this.isPickerDisplayed) {
|
11820 | e.preventDefault();
|
11821 | }
|
11822 | break;
|
11823 | }
|
11824 | });
|
11825 | this.addManagedListener(this.eWrapper, 'click', clickHandler);
|
11826 | this.addManagedListener(this.eLabel, 'click', clickHandler);
|
11827 | if (this.pickerIcon) {
|
11828 | var icon = createIconNoSpan(this.pickerIcon, this.gridOptionsWrapper);
|
11829 | if (icon) {
|
11830 | this.eIcon.appendChild(icon);
|
11831 | }
|
11832 | }
|
11833 | };
|
11834 | AgPickerField.prototype.refreshLabel = function () {
|
11835 | if (exists(this.getLabel())) {
|
11836 | setAriaLabelledBy(this.eWrapper, this.getLabelId());
|
11837 | }
|
11838 | else {
|
11839 | this.eWrapper.removeAttribute('aria-labelledby');
|
11840 | }
|
11841 | _super.prototype.refreshLabel.call(this);
|
11842 | };
|
11843 | AgPickerField.prototype.setAriaLabel = function (label) {
|
11844 | setAriaLabel(this.eWrapper, label);
|
11845 | return this;
|
11846 | };
|
11847 | AgPickerField.prototype.setInputWidth = function (width) {
|
11848 | setElementWidth(this.eWrapper, width);
|
11849 | return this;
|
11850 | };
|
11851 | AgPickerField.prototype.getFocusableElement = function () {
|
11852 | return this.eWrapper;
|
11853 | };
|
11854 | __decorate$f([
|
11855 | RefSelector('eLabel')
|
11856 | ], AgPickerField.prototype, "eLabel", void 0);
|
11857 | __decorate$f([
|
11858 | RefSelector('eWrapper')
|
11859 | ], AgPickerField.prototype, "eWrapper", void 0);
|
11860 | __decorate$f([
|
11861 | RefSelector('eDisplayField')
|
11862 | ], AgPickerField.prototype, "eDisplayField", void 0);
|
11863 | __decorate$f([
|
11864 | RefSelector('eIcon')
|
11865 | ], AgPickerField.prototype, "eIcon", void 0);
|
11866 | return AgPickerField;
|
11867 | }(AgAbstractField));
|
11868 |
|
11869 |
|
11870 |
|
11871 |
|
11872 |
|
11873 |
|
11874 |
|
11875 | var __extends$d = (undefined && undefined.__extends) || (function () {
|
11876 | var extendStatics = function (d, b) {
|
11877 | extendStatics = Object.setPrototypeOf ||
|
11878 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11879 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
11880 | return extendStatics(d, b);
|
11881 | };
|
11882 | return function (d, b) {
|
11883 | extendStatics(d, b);
|
11884 | function __() { this.constructor = d; }
|
11885 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11886 | };
|
11887 | })();
|
11888 | var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
11889 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
11890 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
11891 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
11892 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
11893 | };
|
11894 | var AgList = (function (_super) {
|
11895 | __extends$d(AgList, _super);
|
11896 | function AgList(cssIdentifier) {
|
11897 | if (cssIdentifier === void 0) { cssIdentifier = 'default'; }
|
11898 | var _this = _super.call(this, "<div class=\"ag-list ag-" + cssIdentifier + "-list\" role=\"listbox\"></div>") || this;
|
11899 | _this.cssIdentifier = cssIdentifier;
|
11900 | _this.options = [];
|
11901 | _this.itemEls = [];
|
11902 | return _this;
|
11903 | }
|
11904 | AgList.prototype.init = function () {
|
11905 | this.addManagedListener(this.getGui(), 'keydown', this.handleKeyDown.bind(this));
|
11906 | };
|
11907 | AgList.prototype.handleKeyDown = function (e) {
|
11908 | var key = e.key;
|
11909 | switch (key) {
|
11910 | case KeyCode.ENTER:
|
11911 | if (!this.highlightedEl) {
|
11912 | this.setValue(this.getValue());
|
11913 | }
|
11914 | else {
|
11915 | var pos = this.itemEls.indexOf(this.highlightedEl);
|
11916 | this.setValueByIndex(pos);
|
11917 | }
|
11918 | break;
|
11919 | case KeyCode.DOWN:
|
11920 | case KeyCode.UP:
|
11921 | var isDown = key === KeyCode.DOWN;
|
11922 | var itemToHighlight = void 0;
|
11923 | e.preventDefault();
|
11924 | if (!this.highlightedEl) {
|
11925 | itemToHighlight = this.itemEls[isDown ? 0 : this.itemEls.length - 1];
|
11926 | }
|
11927 | else {
|
11928 | var currentIdx = this.itemEls.indexOf(this.highlightedEl);
|
11929 | var nextPos = currentIdx + (isDown ? 1 : -1);
|
11930 | nextPos = Math.min(Math.max(nextPos, 0), this.itemEls.length - 1);
|
11931 | itemToHighlight = this.itemEls[nextPos];
|
11932 | }
|
11933 | this.highlightItem(itemToHighlight);
|
11934 | break;
|
11935 | }
|
11936 | };
|
11937 | AgList.prototype.addOptions = function (listOptions) {
|
11938 | var _this = this;
|
11939 | listOptions.forEach(function (listOption) { return _this.addOption(listOption); });
|
11940 | return this;
|
11941 | };
|
11942 | AgList.prototype.addOption = function (listOption) {
|
11943 | var value = listOption.value, text = listOption.text;
|
11944 | var sanitisedText = escapeString(text || value);
|
11945 | this.options.push({ value: value, text: sanitisedText });
|
11946 | this.renderOption(value, sanitisedText);
|
11947 | this.updateIndices();
|
11948 | return this;
|
11949 | };
|
11950 | AgList.prototype.updateIndices = function () {
|
11951 | var options = this.getGui().querySelectorAll('.ag-list-item');
|
11952 | options.forEach(function (option, idx) {
|
11953 | setAriaPosInSet(option, idx + 1);
|
11954 | setAriaSetSize(option, options.length);
|
11955 | });
|
11956 | };
|
11957 | AgList.prototype.renderOption = function (value, text) {
|
11958 | var _this = this;
|
11959 | var itemEl = document.createElement('div');
|
11960 | setAriaRole(itemEl, 'option');
|
11961 | itemEl.classList.add('ag-list-item', "ag-" + this.cssIdentifier + "-list-item");
|
11962 | itemEl.innerHTML = "<span>" + text + "</span>";
|
11963 | itemEl.tabIndex = -1;
|
11964 | this.itemEls.push(itemEl);
|
11965 | this.addManagedListener(itemEl, 'mouseover', function () { return _this.highlightItem(itemEl); });
|
11966 | this.addManagedListener(itemEl, 'mouseleave', function () { return _this.clearHighlighted(); });
|
11967 | this.addManagedListener(itemEl, 'click', function () { return _this.setValue(value); });
|
11968 | this.getGui().appendChild(itemEl);
|
11969 | };
|
11970 | AgList.prototype.setValue = function (value, silent) {
|
11971 | if (this.value === value) {
|
11972 | this.fireItemSelected();
|
11973 | return this;
|
11974 | }
|
11975 | if (value == null) {
|
11976 | this.reset();
|
11977 | return this;
|
11978 | }
|
11979 | var idx = this.options.findIndex(function (option) { return option.value === value; });
|
11980 | if (idx !== -1) {
|
11981 | var option = this.options[idx];
|
11982 | this.value = option.value;
|
11983 | this.displayValue = option.text != null ? option.text : option.value;
|
11984 | this.highlightItem(this.itemEls[idx]);
|
11985 | if (!silent) {
|
11986 | this.fireChangeEvent();
|
11987 | }
|
11988 | }
|
11989 | return this;
|
11990 | };
|
11991 | AgList.prototype.setValueByIndex = function (idx) {
|
11992 | return this.setValue(this.options[idx].value);
|
11993 | };
|
11994 | AgList.prototype.getValue = function () {
|
11995 | return this.value;
|
11996 | };
|
11997 | AgList.prototype.getDisplayValue = function () {
|
11998 | return this.displayValue;
|
11999 | };
|
12000 | AgList.prototype.refreshHighlighted = function () {
|
12001 | var _this = this;
|
12002 | this.clearHighlighted();
|
12003 | var idx = this.options.findIndex(function (option) { return option.value === _this.value; });
|
12004 | if (idx !== -1) {
|
12005 | this.highlightItem(this.itemEls[idx]);
|
12006 | }
|
12007 | };
|
12008 | AgList.prototype.reset = function () {
|
12009 | this.value = null;
|
12010 | this.displayValue = null;
|
12011 | this.clearHighlighted();
|
12012 | this.fireChangeEvent();
|
12013 | };
|
12014 | AgList.prototype.highlightItem = function (el) {
|
12015 | if (!el.offsetParent) {
|
12016 | return;
|
12017 | }
|
12018 | this.clearHighlighted();
|
12019 | this.highlightedEl = el;
|
12020 | this.highlightedEl.classList.add(AgList.ACTIVE_CLASS);
|
12021 | setAriaSelected(this.highlightedEl, true);
|
12022 | this.highlightedEl.focus();
|
12023 | };
|
12024 | AgList.prototype.clearHighlighted = function () {
|
12025 | if (!this.highlightedEl || !this.highlightedEl.offsetParent) {
|
12026 | return;
|
12027 | }
|
12028 | this.highlightedEl.classList.remove(AgList.ACTIVE_CLASS);
|
12029 | setAriaSelected(this.highlightedEl, false);
|
12030 | this.highlightedEl = null;
|
12031 | };
|
12032 | AgList.prototype.fireChangeEvent = function () {
|
12033 | this.dispatchEvent({ type: AgAbstractField.EVENT_CHANGED });
|
12034 | this.fireItemSelected();
|
12035 | };
|
12036 | AgList.prototype.fireItemSelected = function () {
|
12037 | this.dispatchEvent({ type: AgList.EVENT_ITEM_SELECTED });
|
12038 | };
|
12039 | AgList.EVENT_ITEM_SELECTED = 'selectedItem';
|
12040 | AgList.ACTIVE_CLASS = 'ag-active-item';
|
12041 | __decorate$g([
|
12042 | PostConstruct
|
12043 | ], AgList.prototype, "init", null);
|
12044 | return AgList;
|
12045 | }(Component));
|
12046 |
|
12047 |
|
12048 |
|
12049 |
|
12050 |
|
12051 |
|
12052 |
|
12053 | var __extends$e = (undefined && undefined.__extends) || (function () {
|
12054 | var extendStatics = function (d, b) {
|
12055 | extendStatics = Object.setPrototypeOf ||
|
12056 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12057 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
12058 | return extendStatics(d, b);
|
12059 | };
|
12060 | return function (d, b) {
|
12061 | extendStatics(d, b);
|
12062 | function __() { this.constructor = d; }
|
12063 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12064 | };
|
12065 | })();
|
12066 | var __decorate$h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
12067 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
12068 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
12069 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12070 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
12071 | };
|
12072 | var AgSelect = (function (_super) {
|
12073 | __extends$e(AgSelect, _super);
|
12074 | function AgSelect(config) {
|
12075 | return _super.call(this, config, 'ag-select', 'smallDown', 'listbox') || this;
|
12076 | }
|
12077 | AgSelect.prototype.init = function () {
|
12078 | var _this = this;
|
12079 | this.listComponent = this.createBean(new AgList('select'));
|
12080 | this.listComponent.setParentComponent(this);
|
12081 | this.eWrapper.tabIndex = 0;
|
12082 | this.listComponent.addManagedListener(this.listComponent, AgList.EVENT_ITEM_SELECTED, function () { if (_this.hideList) {
|
12083 | _this.hideList();
|
12084 | } });
|
12085 | this.listComponent.addManagedListener(this.listComponent, AgAbstractField.EVENT_CHANGED, function () {
|
12086 | _this.setValue(_this.listComponent.getValue(), false, true);
|
12087 | if (_this.hideList) {
|
12088 | _this.hideList();
|
12089 | }
|
12090 | });
|
12091 | };
|
12092 | AgSelect.prototype.showPicker = function () {
|
12093 | var _this = this;
|
12094 | var listGui = this.listComponent.getGui();
|
12095 | var eDocument = this.gridOptionsWrapper.getDocument();
|
12096 | var destroyMouseWheelFunc = this.addManagedListener(eDocument.body, 'wheel', function (e) {
|
12097 | if (!listGui.contains(e.target) && _this.hideList) {
|
12098 | _this.hideList();
|
12099 | }
|
12100 | });
|
12101 | var destroyFocusOutFunc = this.addManagedListener(listGui, 'focusout', function (e) {
|
12102 | if (!listGui.contains(e.relatedTarget) && _this.hideList) {
|
12103 | _this.hideList();
|
12104 | }
|
12105 | });
|
12106 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
12107 | var addPopupRes = this.popupService.addPopup({
|
12108 | modal: true,
|
12109 | eChild: listGui,
|
12110 | closeOnEsc: true,
|
12111 | closedCallback: function () {
|
12112 | _this.hideList = null;
|
12113 | _this.isPickerDisplayed = false;
|
12114 | destroyFocusOutFunc();
|
12115 | destroyMouseWheelFunc();
|
12116 | if (_this.isAlive()) {
|
12117 | setAriaExpanded(_this.eWrapper, false);
|
12118 | _this.getFocusableElement().focus();
|
12119 | }
|
12120 | },
|
12121 | ariaLabel: translate('ariaLabelSelectField', 'Select Field')
|
12122 | });
|
12123 | if (addPopupRes) {
|
12124 | this.hideList = addPopupRes.hideFunc;
|
12125 | }
|
12126 | this.isPickerDisplayed = true;
|
12127 | setElementWidth(listGui, getAbsoluteWidth(this.eWrapper));
|
12128 | setAriaExpanded(this.eWrapper, true);
|
12129 | listGui.style.maxHeight = getInnerHeight(this.popupService.getPopupParent()) + 'px';
|
12130 | listGui.style.position = 'absolute';
|
12131 | this.popupService.positionPopupUnderComponent({
|
12132 | type: 'ag-list',
|
12133 | eventSource: this.eWrapper,
|
12134 | ePopup: listGui,
|
12135 | keepWithinBounds: true
|
12136 | });
|
12137 | this.listComponent.refreshHighlighted();
|
12138 | return this.listComponent;
|
12139 | };
|
12140 | AgSelect.prototype.addOptions = function (options) {
|
12141 | var _this = this;
|
12142 | options.forEach(function (option) { return _this.addOption(option); });
|
12143 | return this;
|
12144 | };
|
12145 | AgSelect.prototype.addOption = function (option) {
|
12146 | this.listComponent.addOption(option);
|
12147 | return this;
|
12148 | };
|
12149 | AgSelect.prototype.setValue = function (value, silent, fromPicker) {
|
12150 | if (this.value === value) {
|
12151 | return this;
|
12152 | }
|
12153 | if (!fromPicker) {
|
12154 | this.listComponent.setValue(value, true);
|
12155 | }
|
12156 | var newValue = this.listComponent.getValue();
|
12157 | if (newValue === this.getValue()) {
|
12158 | return this;
|
12159 | }
|
12160 | this.eDisplayField.innerHTML = this.listComponent.getDisplayValue();
|
12161 | return _super.prototype.setValue.call(this, value, silent);
|
12162 | };
|
12163 | AgSelect.prototype.destroy = function () {
|
12164 | if (this.hideList) {
|
12165 | this.hideList();
|
12166 | }
|
12167 | this.destroyBean(this.listComponent);
|
12168 | _super.prototype.destroy.call(this);
|
12169 | };
|
12170 | __decorate$h([
|
12171 | Autowired('popupService')
|
12172 | ], AgSelect.prototype, "popupService", void 0);
|
12173 | __decorate$h([
|
12174 | PostConstruct
|
12175 | ], AgSelect.prototype, "init", null);
|
12176 | return AgSelect;
|
12177 | }(AgPickerField));
|
12178 |
|
12179 |
|
12180 |
|
12181 |
|
12182 |
|
12183 |
|
12184 |
|
12185 | var __extends$f = (undefined && undefined.__extends) || (function () {
|
12186 | var extendStatics = function (d, b) {
|
12187 | extendStatics = Object.setPrototypeOf ||
|
12188 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12189 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
12190 | return extendStatics(d, b);
|
12191 | };
|
12192 | return function (d, b) {
|
12193 | extendStatics(d, b);
|
12194 | function __() { this.constructor = d; }
|
12195 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12196 | };
|
12197 | })();
|
12198 | var __decorate$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
12199 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
12200 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
12201 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12202 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
12203 | };
|
12204 | var AgAbstractInputField = (function (_super) {
|
12205 | __extends$f(AgAbstractInputField, _super);
|
12206 | function AgAbstractInputField(config, className, inputType, displayFieldTag) {
|
12207 | if (inputType === void 0) { inputType = 'text'; }
|
12208 | if (displayFieldTag === void 0) { displayFieldTag = 'input'; }
|
12209 | 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;
|
12210 | _this.inputType = inputType;
|
12211 | _this.displayFieldTag = displayFieldTag;
|
12212 | return _this;
|
12213 | }
|
12214 | AgAbstractInputField.prototype.postConstruct = function () {
|
12215 | _super.prototype.postConstruct.call(this);
|
12216 | this.setInputType();
|
12217 | this.eLabel.classList.add(this.className + "-label");
|
12218 | this.eWrapper.classList.add(this.className + "-input-wrapper");
|
12219 | this.eInput.classList.add(this.className + "-input");
|
12220 | this.addCssClass('ag-input-field');
|
12221 | this.eInput.id = this.eInput.id || "ag-" + this.getCompId() + "-input";
|
12222 | var _a = this.config, width = _a.width, value = _a.value;
|
12223 | if (width != null) {
|
12224 | this.setWidth(width);
|
12225 | }
|
12226 | if (value != null) {
|
12227 | this.setValue(value);
|
12228 | }
|
12229 | this.addInputListeners();
|
12230 | };
|
12231 | AgAbstractInputField.prototype.refreshLabel = function () {
|
12232 | if (exists(this.getLabel())) {
|
12233 | setAriaLabelledBy(this.eInput, this.getLabelId());
|
12234 | }
|
12235 | else {
|
12236 | this.eInput.removeAttribute('aria-labelledby');
|
12237 | }
|
12238 | _super.prototype.refreshLabel.call(this);
|
12239 | };
|
12240 | AgAbstractInputField.prototype.addInputListeners = function () {
|
12241 | var _this = this;
|
12242 | this.addManagedListener(this.eInput, 'input', function (e) { return _this.setValue(e.target.value); });
|
12243 | };
|
12244 | AgAbstractInputField.prototype.setInputType = function () {
|
12245 | if (this.displayFieldTag === 'input') {
|
12246 | this.eInput.setAttribute('type', this.inputType);
|
12247 | }
|
12248 | };
|
12249 | AgAbstractInputField.prototype.getInputElement = function () {
|
12250 | return this.eInput;
|
12251 | };
|
12252 | AgAbstractInputField.prototype.setInputWidth = function (width) {
|
12253 | setElementWidth(this.eWrapper, width);
|
12254 | return this;
|
12255 | };
|
12256 | AgAbstractInputField.prototype.setInputName = function (name) {
|
12257 | this.getInputElement().setAttribute('name', name);
|
12258 | return this;
|
12259 | };
|
12260 | AgAbstractInputField.prototype.getFocusableElement = function () {
|
12261 | return this.eInput;
|
12262 | };
|
12263 | AgAbstractInputField.prototype.setMaxLength = function (length) {
|
12264 | var eInput = this.eInput;
|
12265 | eInput.maxLength = length;
|
12266 | return this;
|
12267 | };
|
12268 | AgAbstractInputField.prototype.setInputPlaceholder = function (placeholder) {
|
12269 | addOrRemoveAttribute(this.eInput, 'placeholder', placeholder);
|
12270 | return this;
|
12271 | };
|
12272 | AgAbstractInputField.prototype.setInputAriaLabel = function (label) {
|
12273 | setAriaLabel(this.eInput, label);
|
12274 | return this;
|
12275 | };
|
12276 | AgAbstractInputField.prototype.setDisabled = function (disabled) {
|
12277 | setDisabled(this.eInput, disabled);
|
12278 | return _super.prototype.setDisabled.call(this, disabled);
|
12279 | };
|
12280 | __decorate$i([
|
12281 | RefSelector('eLabel')
|
12282 | ], AgAbstractInputField.prototype, "eLabel", void 0);
|
12283 | __decorate$i([
|
12284 | RefSelector('eWrapper')
|
12285 | ], AgAbstractInputField.prototype, "eWrapper", void 0);
|
12286 | __decorate$i([
|
12287 | RefSelector('eInput')
|
12288 | ], AgAbstractInputField.prototype, "eInput", void 0);
|
12289 | return AgAbstractInputField;
|
12290 | }(AgAbstractField));
|
12291 |
|
12292 |
|
12293 |
|
12294 |
|
12295 |
|
12296 |
|
12297 |
|
12298 | var __extends$g = (undefined && undefined.__extends) || (function () {
|
12299 | var extendStatics = function (d, b) {
|
12300 | extendStatics = Object.setPrototypeOf ||
|
12301 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12302 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
12303 | return extendStatics(d, b);
|
12304 | };
|
12305 | return function (d, b) {
|
12306 | extendStatics(d, b);
|
12307 | function __() { this.constructor = d; }
|
12308 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12309 | };
|
12310 | })();
|
12311 | var __decorate$j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
12312 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
12313 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
12314 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12315 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
12316 | };
|
12317 | var ConditionPosition;
|
12318 | (function (ConditionPosition) {
|
12319 | ConditionPosition[ConditionPosition["One"] = 0] = "One";
|
12320 | ConditionPosition[ConditionPosition["Two"] = 1] = "Two";
|
12321 | })(ConditionPosition || (ConditionPosition = {}));
|
12322 |
|
12323 |
|
12324 |
|
12325 |
|
12326 |
|
12327 |
|
12328 |
|
12329 | var SimpleFilter = (function (_super) {
|
12330 | __extends$g(SimpleFilter, _super);
|
12331 | function SimpleFilter() {
|
12332 | return _super !== null && _super.apply(this, arguments) || this;
|
12333 | }
|
12334 | SimpleFilter.prototype.getNumberOfInputs = function (type) {
|
12335 | var customOpts = this.optionsFactory.getCustomOption(type);
|
12336 | if (customOpts) {
|
12337 | var numberOfInputs = customOpts.numberOfInputs;
|
12338 | return numberOfInputs != null ? numberOfInputs : 1;
|
12339 | }
|
12340 | var zeroInputTypes = [
|
12341 | SimpleFilter.EMPTY, SimpleFilter.NOT_BLANK, SimpleFilter.BLANK,
|
12342 | ];
|
12343 | if (type && zeroInputTypes.indexOf(type) >= 0) {
|
12344 | return 0;
|
12345 | }
|
12346 | else if (type === SimpleFilter.IN_RANGE) {
|
12347 | return 2;
|
12348 | }
|
12349 | return 1;
|
12350 | };
|
12351 |
|
12352 | SimpleFilter.prototype.onFloatingFilterChanged = function (type, value) {
|
12353 | this.setTypeFromFloatingFilter(type);
|
12354 | this.setValueFromFloatingFilter(value);
|
12355 | this.onUiChanged(true);
|
12356 | };
|
12357 | SimpleFilter.prototype.setTypeFromFloatingFilter = function (type) {
|
12358 | this.eType1.setValue(type);
|
12359 | this.eType2.setValue(this.optionsFactory.getDefaultOption());
|
12360 | (this.isDefaultOperator('AND') ? this.eJoinOperatorAnd : this.eJoinOperatorOr).setValue(true);
|
12361 | };
|
12362 | SimpleFilter.prototype.getModelFromUi = function () {
|
12363 | if (!this.isConditionUiComplete(ConditionPosition.One)) {
|
12364 | return null;
|
12365 | }
|
12366 | if (this.isAllowTwoConditions() && this.isConditionUiComplete(ConditionPosition.Two)) {
|
12367 | return {
|
12368 | filterType: this.getFilterType(),
|
12369 | operator: this.getJoinOperator(),
|
12370 | condition1: this.createCondition(ConditionPosition.One),
|
12371 | condition2: this.createCondition(ConditionPosition.Two)
|
12372 | };
|
12373 | }
|
12374 | return this.createCondition(ConditionPosition.One);
|
12375 | };
|
12376 | SimpleFilter.prototype.getConditionTypes = function () {
|
12377 | return [
|
12378 | this.eType1.getValue(),
|
12379 | this.eType2.getValue(),
|
12380 | ];
|
12381 | };
|
12382 | SimpleFilter.prototype.getJoinOperator = function () {
|
12383 | return this.eJoinOperatorOr.getValue() === true ? 'OR' : 'AND';
|
12384 | };
|
12385 | SimpleFilter.prototype.areModelsEqual = function (a, b) {
|
12386 |
|
12387 | if (!a && !b) {
|
12388 | return true;
|
12389 | }
|
12390 |
|
12391 | if ((!a && b) || (a && !b)) {
|
12392 | return false;
|
12393 | }
|
12394 |
|
12395 | var aIsSimple = !a.operator;
|
12396 | var bIsSimple = !b.operator;
|
12397 | var oneSimpleOneCombined = (!aIsSimple && bIsSimple) || (aIsSimple && !bIsSimple);
|
12398 | if (oneSimpleOneCombined) {
|
12399 | return false;
|
12400 | }
|
12401 | var res;
|
12402 |
|
12403 | if (aIsSimple) {
|
12404 | var aSimple = a;
|
12405 | var bSimple = b;
|
12406 | res = this.areSimpleModelsEqual(aSimple, bSimple);
|
12407 | }
|
12408 | else {
|
12409 | var aCombined = a;
|
12410 | var bCombined = b;
|
12411 | res = aCombined.operator === bCombined.operator
|
12412 | && this.areSimpleModelsEqual(aCombined.condition1, bCombined.condition1)
|
12413 | && this.areSimpleModelsEqual(aCombined.condition2, bCombined.condition2);
|
12414 | }
|
12415 | return res;
|
12416 | };
|
12417 | SimpleFilter.prototype.setModelIntoUi = function (model) {
|
12418 | var isCombined = model.operator;
|
12419 | if (isCombined) {
|
12420 | var combinedModel = model;
|
12421 | var orChecked = combinedModel.operator === 'OR';
|
12422 | this.eJoinOperatorAnd.setValue(!orChecked);
|
12423 | this.eJoinOperatorOr.setValue(orChecked);
|
12424 | this.eType1.setValue(combinedModel.condition1.type);
|
12425 | this.eType2.setValue(combinedModel.condition2.type);
|
12426 | this.setConditionIntoUi(combinedModel.condition1, ConditionPosition.One);
|
12427 | this.setConditionIntoUi(combinedModel.condition2, ConditionPosition.Two);
|
12428 | }
|
12429 | else {
|
12430 | var simpleModel = model;
|
12431 | this.eJoinOperatorAnd.setValue(this.isDefaultOperator('AND'));
|
12432 | this.eJoinOperatorOr.setValue(this.isDefaultOperator('OR'));
|
12433 | this.eType1.setValue(simpleModel.type);
|
12434 | this.eType2.setValue(this.optionsFactory.getDefaultOption());
|
12435 | this.setConditionIntoUi(simpleModel, ConditionPosition.One);
|
12436 | this.setConditionIntoUi(null, ConditionPosition.Two);
|
12437 | }
|
12438 | return AgPromise.resolve();
|
12439 | };
|
12440 | SimpleFilter.prototype.doesFilterPass = function (params) {
|
12441 | var _this = this;
|
12442 | var model = this.getModel();
|
12443 | if (model == null) {
|
12444 | return true;
|
12445 | }
|
12446 | var operator = model.operator;
|
12447 | var models = [];
|
12448 | if (operator) {
|
12449 | var combinedModel = model;
|
12450 | models.push(combinedModel.condition1, combinedModel.condition2);
|
12451 | }
|
12452 | else {
|
12453 | models.push(model);
|
12454 | }
|
12455 | var combineFunction = operator && operator === 'OR' ? 'some' : 'every';
|
12456 | return models[combineFunction](function (m) { return _this.individualConditionPasses(params, m); });
|
12457 | };
|
12458 | SimpleFilter.prototype.setParams = function (params) {
|
12459 | _super.prototype.setParams.call(this, params);
|
12460 | this.optionsFactory = new OptionsFactory();
|
12461 | this.optionsFactory.init(params, this.getDefaultFilterOptions());
|
12462 | this.allowTwoConditions = !params.suppressAndOrCondition;
|
12463 | this.alwaysShowBothConditions = !!params.alwaysShowBothConditions;
|
12464 | this.defaultJoinOperator = this.getDefaultJoinOperator(params.defaultJoinOperator);
|
12465 | this.putOptionsIntoDropdown();
|
12466 | this.addChangedListeners();
|
12467 | };
|
12468 | SimpleFilter.prototype.getDefaultJoinOperator = function (defaultJoinOperator) {
|
12469 | return includes(['AND', 'OR'], defaultJoinOperator) ? defaultJoinOperator : 'AND';
|
12470 | };
|
12471 | SimpleFilter.prototype.putOptionsIntoDropdown = function () {
|
12472 | var _this = this;
|
12473 | var filterOptions = this.optionsFactory.getFilterOptions();
|
12474 | var eTypes = [this.eType1, this.eType2];
|
12475 |
|
12476 | filterOptions.forEach(function (option) {
|
12477 | var listOption = typeof option === 'string' ?
|
12478 | _this.createBoilerplateListOption(option) :
|
12479 | _this.createCustomListOption(option);
|
12480 | eTypes.forEach(function (eType) { return eType.addOption(listOption); });
|
12481 | });
|
12482 |
|
12483 | eTypes.forEach(function (eType) { return eType.setDisabled(filterOptions.length <= 1); });
|
12484 | };
|
12485 | SimpleFilter.prototype.createBoilerplateListOption = function (option) {
|
12486 | return { value: option, text: this.translate(option) };
|
12487 | };
|
12488 | SimpleFilter.prototype.createCustomListOption = function (option) {
|
12489 | var displayKey = option.displayKey;
|
12490 | var customOption = this.optionsFactory.getCustomOption(option.displayKey);
|
12491 | return {
|
12492 | value: displayKey,
|
12493 | text: customOption ?
|
12494 | this.gridOptionsWrapper.getLocaleTextFunc()(customOption.displayKey, customOption.displayName) :
|
12495 | this.translate(displayKey),
|
12496 | };
|
12497 | };
|
12498 | SimpleFilter.prototype.isAllowTwoConditions = function () {
|
12499 | return this.allowTwoConditions;
|
12500 | };
|
12501 | SimpleFilter.prototype.createBodyTemplate = function () {
|
12502 | 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);
|
12503 | };
|
12504 | SimpleFilter.prototype.getCssIdentifier = function () {
|
12505 | return 'simple-filter';
|
12506 | };
|
12507 | SimpleFilter.prototype.updateUiVisibility = function () {
|
12508 | var _this = this;
|
12509 | var elementConditionGroups = [
|
12510 | [this.eType1],
|
12511 | [this.eType2, this.eJoinOperatorPanel, this.eJoinOperatorAnd, this.eJoinOperatorOr],
|
12512 | ];
|
12513 | var elementBodies = [this.eCondition1Body, this.eCondition2Body];
|
12514 | elementConditionGroups.forEach(function (group, position) {
|
12515 | var visible = _this.isConditionVisible(position);
|
12516 | var disabled = _this.isConditionDisabled(position);
|
12517 | group.forEach(function (element) {
|
12518 | if (element instanceof AgAbstractInputField || element instanceof AgSelect) {
|
12519 | element.setDisabled(disabled);
|
12520 | element.setDisplayed(visible);
|
12521 | }
|
12522 | else {
|
12523 | setDisabled(element, disabled);
|
12524 | setDisplayed(element, visible);
|
12525 | }
|
12526 | });
|
12527 | });
|
12528 | elementBodies.forEach(function (element, index) {
|
12529 | setDisplayed(element, _this.isConditionBodyVisible(index));
|
12530 | });
|
12531 | this.forEachInput(function (element, index, position, numberOfInputs) {
|
12532 | _this.setElementDisplayed(element, index < numberOfInputs);
|
12533 | _this.setElementDisabled(element, _this.isConditionDisabled(position));
|
12534 | });
|
12535 | this.resetPlaceholder();
|
12536 | };
|
12537 | SimpleFilter.prototype.afterGuiAttached = function (params) {
|
12538 | _super.prototype.afterGuiAttached.call(this, params);
|
12539 | this.resetPlaceholder();
|
12540 | if (!params || (!params.suppressFocus && !this.isReadOnly())) {
|
12541 | var firstInput = this.getInputs()[0][0];
|
12542 | if (!firstInput) {
|
12543 | return;
|
12544 | }
|
12545 | if (firstInput instanceof AgAbstractInputField) {
|
12546 | firstInput.getInputElement().focus();
|
12547 | }
|
12548 | }
|
12549 | };
|
12550 |
|
12551 | SimpleFilter.prototype.resetPlaceholder = function () {
|
12552 | var _this = this;
|
12553 | var globalTranslate = this.gridOptionsWrapper.getLocaleTextFunc();
|
12554 | this.forEachInput(function (element, index, _, numberOfInputs) {
|
12555 | if (!(element instanceof AgAbstractInputField)) {
|
12556 | return;
|
12557 | }
|
12558 | var placeholder = index === 0 && numberOfInputs > 1 ? 'inRangeStart' :
|
12559 | index === 0 ? 'filterOoo' :
|
12560 | 'inRangeEnd';
|
12561 | var ariaLabel = index === 0 && numberOfInputs > 1 ? globalTranslate('ariaFilterFromValue', 'Filter from value') :
|
12562 | index === 0 ? globalTranslate('ariaFilterValue', 'Filter Value') :
|
12563 | globalTranslate('ariaFilterToValue', 'Filter to Value');
|
12564 | element.setInputPlaceholder(_this.translate(placeholder));
|
12565 | element.setInputAriaLabel(ariaLabel);
|
12566 | });
|
12567 | };
|
12568 | SimpleFilter.prototype.setElementValue = function (element, value, silent) {
|
12569 | if (element instanceof AgAbstractInputField) {
|
12570 | element.setValue(value != null ? String(value) : null, silent);
|
12571 | }
|
12572 | };
|
12573 | SimpleFilter.prototype.setElementDisplayed = function (element, displayed) {
|
12574 | if (element instanceof Component) {
|
12575 | setDisplayed(element.getGui(), displayed);
|
12576 | }
|
12577 | };
|
12578 | SimpleFilter.prototype.setElementDisabled = function (element, disabled) {
|
12579 | if (element instanceof Component) {
|
12580 | setDisabled(element.getGui(), disabled);
|
12581 | }
|
12582 | };
|
12583 | SimpleFilter.prototype.attachElementOnChange = function (element, listener) {
|
12584 | if (element instanceof AgAbstractInputField) {
|
12585 | element.onValueChange(listener);
|
12586 | }
|
12587 | };
|
12588 | SimpleFilter.prototype.forEachInput = function (cb) {
|
12589 | var _this = this;
|
12590 | var inputs = this.getInputs();
|
12591 | this.getConditionTypes().forEach(function (type, position) {
|
12592 | var numberOfInputs = _this.getNumberOfInputs(type);
|
12593 | for (var index = 0; index < inputs[position].length; index++) {
|
12594 | var input = inputs[position][index];
|
12595 | if (input != null) {
|
12596 | cb(input, index, position, numberOfInputs);
|
12597 | }
|
12598 | }
|
12599 | });
|
12600 | };
|
12601 | SimpleFilter.prototype.isConditionVisible = function (position) {
|
12602 | if (position === 0) {
|
12603 | return true;
|
12604 | }
|
12605 | if (!this.allowTwoConditions) {
|
12606 | return false;
|
12607 | }
|
12608 | if (this.isReadOnly()) {
|
12609 |
|
12610 | return this.isConditionUiComplete(position);
|
12611 | }
|
12612 | if (this.alwaysShowBothConditions) {
|
12613 | return true;
|
12614 | }
|
12615 |
|
12616 | return this.isConditionUiComplete(position - 1);
|
12617 | };
|
12618 | SimpleFilter.prototype.isConditionDisabled = function (position) {
|
12619 | if (this.isReadOnly()) {
|
12620 | return true;
|
12621 | }
|
12622 | if (!this.isConditionVisible(position)) {
|
12623 | return true;
|
12624 | }
|
12625 | if (position === 0) {
|
12626 | return false;
|
12627 | }
|
12628 |
|
12629 | return !this.isConditionUiComplete(position - 1);
|
12630 | };
|
12631 | SimpleFilter.prototype.isConditionBodyVisible = function (position) {
|
12632 | if (!this.isConditionVisible(position)) {
|
12633 | return false;
|
12634 | }
|
12635 |
|
12636 | var type = this.getConditionTypes()[position];
|
12637 | var numberOfInputs = this.getNumberOfInputs(type);
|
12638 | return numberOfInputs > 0;
|
12639 | };
|
12640 |
|
12641 |
|
12642 | SimpleFilter.prototype.isConditionUiComplete = function (position) {
|
12643 | var type = this.getConditionTypes()[position];
|
12644 | if (type === SimpleFilter.EMPTY) {
|
12645 | return false;
|
12646 | }
|
12647 | if (this.getValues(position).some(function (v) { return v == null; })) {
|
12648 | return false;
|
12649 | }
|
12650 | return true;
|
12651 | };
|
12652 | SimpleFilter.prototype.resetUiToDefaults = function (silent) {
|
12653 | var _this = this;
|
12654 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
12655 | var filteringLabel = translate('ariaFilteringOperator', 'Filtering operator');
|
12656 | var uniqueGroupId = 'ag-simple-filter-and-or-' + this.getCompId();
|
12657 | var defaultOption = this.optionsFactory.getDefaultOption();
|
12658 | this.eType1
|
12659 | .setValue(defaultOption, silent)
|
12660 | .setAriaLabel(filteringLabel)
|
12661 | .setDisabled(this.isReadOnly());
|
12662 | this.eType2
|
12663 | .setValue(this.optionsFactory.getDefaultOption(), silent)
|
12664 | .setAriaLabel(filteringLabel)
|
12665 | .setDisabled(this.isReadOnly());
|
12666 | this.eJoinOperatorAnd
|
12667 | .setValue(this.isDefaultOperator('AND'), silent)
|
12668 | .setName(uniqueGroupId)
|
12669 | .setLabel(this.translate('andCondition'))
|
12670 | .setDisabled(this.isReadOnly());
|
12671 | this.eJoinOperatorOr
|
12672 | .setValue(this.isDefaultOperator('OR'), silent)
|
12673 | .setName(uniqueGroupId)
|
12674 | .setLabel(this.translate('orCondition'))
|
12675 | .setDisabled(this.isReadOnly());
|
12676 | this.forEachInput(function (element) {
|
12677 | _this.setElementValue(element, null, silent);
|
12678 | _this.setElementDisabled(element, _this.isReadOnly());
|
12679 | });
|
12680 | this.resetPlaceholder();
|
12681 | return AgPromise.resolve();
|
12682 | };
|
12683 |
|
12684 | SimpleFilter.prototype.setConditionIntoUi = function (model, position) {
|
12685 | var _this = this;
|
12686 | var values = this.mapValuesFromModel(model);
|
12687 | this.forEachInput(function (element, index, elPosition, _) {
|
12688 | if (elPosition !== position) {
|
12689 | return;
|
12690 | }
|
12691 | _this.setElementValue(element, values[index] != null ? values[index] : null);
|
12692 | });
|
12693 | };
|
12694 |
|
12695 |
|
12696 | SimpleFilter.prototype.setValueFromFloatingFilter = function (value) {
|
12697 | var _this = this;
|
12698 | this.forEachInput(function (element, index, position, _) {
|
12699 | _this.setElementValue(element, index === 0 && position === 0 ? value : null);
|
12700 | });
|
12701 | };
|
12702 | SimpleFilter.prototype.isDefaultOperator = function (operator) {
|
12703 | return operator === this.defaultJoinOperator;
|
12704 | };
|
12705 | SimpleFilter.prototype.addChangedListeners = function () {
|
12706 | var _this = this;
|
12707 | if (this.isReadOnly()) {
|
12708 | return;
|
12709 | }
|
12710 | var listener = function () { return _this.onUiChanged(); };
|
12711 | this.eType1.onValueChange(listener);
|
12712 | this.eType2.onValueChange(listener);
|
12713 | this.eJoinOperatorOr.onValueChange(listener);
|
12714 | this.eJoinOperatorAnd.onValueChange(listener);
|
12715 | this.forEachInput(function (element) {
|
12716 | _this.attachElementOnChange(element, listener);
|
12717 | });
|
12718 | };
|
12719 |
|
12720 | SimpleFilter.prototype.individualConditionPasses = function (params, filterModel) {
|
12721 | var cellValue = this.getCellValue(params.node);
|
12722 | var values = this.mapValuesFromModel(filterModel);
|
12723 | var customFilterOption = this.optionsFactory.getCustomOption(filterModel.type);
|
12724 | var customFilterResult = this.evaluateCustomFilter(customFilterOption, values, cellValue);
|
12725 | if (customFilterResult != null) {
|
12726 | return customFilterResult;
|
12727 | }
|
12728 | if (cellValue == null) {
|
12729 | return this.evaluateNullValue(filterModel.type);
|
12730 | }
|
12731 | return this.evaluateNonNullValue(values, cellValue, filterModel, params);
|
12732 | };
|
12733 | SimpleFilter.prototype.evaluateCustomFilter = function (customFilterOption, values, cellValue) {
|
12734 | if (customFilterOption == null) {
|
12735 | return;
|
12736 | }
|
12737 | var predicate = customFilterOption.predicate;
|
12738 |
|
12739 | if (predicate != null && !values.some(function (v) { return v == null; })) {
|
12740 | return predicate(values, cellValue);
|
12741 | }
|
12742 |
|
12743 | return;
|
12744 | };
|
12745 | SimpleFilter.prototype.isBlank = function (cellValue) {
|
12746 | return cellValue == null ||
|
12747 | (typeof cellValue === 'string' && cellValue.trim().length === 0);
|
12748 | };
|
12749 | SimpleFilter.EMPTY = 'empty';
|
12750 | SimpleFilter.BLANK = 'blank';
|
12751 | SimpleFilter.NOT_BLANK = 'notBlank';
|
12752 | SimpleFilter.EQUALS = 'equals';
|
12753 | SimpleFilter.NOT_EQUAL = 'notEqual';
|
12754 | SimpleFilter.LESS_THAN = 'lessThan';
|
12755 | SimpleFilter.LESS_THAN_OR_EQUAL = 'lessThanOrEqual';
|
12756 | SimpleFilter.GREATER_THAN = 'greaterThan';
|
12757 | SimpleFilter.GREATER_THAN_OR_EQUAL = 'greaterThanOrEqual';
|
12758 | SimpleFilter.IN_RANGE = 'inRange';
|
12759 | SimpleFilter.CONTAINS = 'contains';
|
12760 | SimpleFilter.NOT_CONTAINS = 'notContains';
|
12761 | SimpleFilter.STARTS_WITH = 'startsWith';
|
12762 | SimpleFilter.ENDS_WITH = 'endsWith';
|
12763 | __decorate$j([
|
12764 | RefSelector('eOptions1')
|
12765 | ], SimpleFilter.prototype, "eType1", void 0);
|
12766 | __decorate$j([
|
12767 | RefSelector('eOptions2')
|
12768 | ], SimpleFilter.prototype, "eType2", void 0);
|
12769 | __decorate$j([
|
12770 | RefSelector('eJoinOperatorPanel')
|
12771 | ], SimpleFilter.prototype, "eJoinOperatorPanel", void 0);
|
12772 | __decorate$j([
|
12773 | RefSelector('eJoinOperatorAnd')
|
12774 | ], SimpleFilter.prototype, "eJoinOperatorAnd", void 0);
|
12775 | __decorate$j([
|
12776 | RefSelector('eJoinOperatorOr')
|
12777 | ], SimpleFilter.prototype, "eJoinOperatorOr", void 0);
|
12778 | __decorate$j([
|
12779 | RefSelector('eCondition1Body')
|
12780 | ], SimpleFilter.prototype, "eCondition1Body", void 0);
|
12781 | __decorate$j([
|
12782 | RefSelector('eCondition2Body')
|
12783 | ], SimpleFilter.prototype, "eCondition2Body", void 0);
|
12784 | return SimpleFilter;
|
12785 | }(ProvidedFilter));
|
12786 |
|
12787 |
|
12788 |
|
12789 |
|
12790 |
|
12791 |
|
12792 |
|
12793 | var __extends$h = (undefined && undefined.__extends) || (function () {
|
12794 | var extendStatics = function (d, b) {
|
12795 | extendStatics = Object.setPrototypeOf ||
|
12796 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12797 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
12798 | return extendStatics(d, b);
|
12799 | };
|
12800 | return function (d, b) {
|
12801 | extendStatics(d, b);
|
12802 | function __() { this.constructor = d; }
|
12803 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12804 | };
|
12805 | })();
|
12806 | var ScalarFilter = (function (_super) {
|
12807 | __extends$h(ScalarFilter, _super);
|
12808 | function ScalarFilter() {
|
12809 | return _super !== null && _super.apply(this, arguments) || this;
|
12810 | }
|
12811 | ScalarFilter.prototype.setParams = function (params) {
|
12812 | _super.prototype.setParams.call(this, params);
|
12813 | this.scalarFilterParams = params;
|
12814 | };
|
12815 | ScalarFilter.prototype.evaluateNullValue = function (filterType) {
|
12816 | switch (filterType) {
|
12817 | case ScalarFilter.EQUALS:
|
12818 | case ScalarFilter.NOT_EQUAL:
|
12819 | if (this.scalarFilterParams.includeBlanksInEquals) {
|
12820 | return true;
|
12821 | }
|
12822 | break;
|
12823 | case ScalarFilter.GREATER_THAN:
|
12824 | case ScalarFilter.GREATER_THAN_OR_EQUAL:
|
12825 | if (this.scalarFilterParams.includeBlanksInGreaterThan) {
|
12826 | return true;
|
12827 | }
|
12828 | break;
|
12829 | case ScalarFilter.LESS_THAN:
|
12830 | case ScalarFilter.LESS_THAN_OR_EQUAL:
|
12831 | if (this.scalarFilterParams.includeBlanksInLessThan) {
|
12832 | return true;
|
12833 | }
|
12834 | break;
|
12835 | case ScalarFilter.IN_RANGE:
|
12836 | if (this.scalarFilterParams.includeBlanksInRange) {
|
12837 | return true;
|
12838 | }
|
12839 | break;
|
12840 | case ScalarFilter.BLANK:
|
12841 | return true;
|
12842 | case ScalarFilter.NOT_BLANK:
|
12843 | return false;
|
12844 | }
|
12845 | return false;
|
12846 | };
|
12847 | ScalarFilter.prototype.evaluateNonNullValue = function (values, cellValue, filterModel) {
|
12848 | var comparator = this.comparator();
|
12849 | var compareResult = values[0] != null ? comparator(values[0], cellValue) : 0;
|
12850 | switch (filterModel.type) {
|
12851 | case ScalarFilter.EQUALS:
|
12852 | return compareResult === 0;
|
12853 | case ScalarFilter.NOT_EQUAL:
|
12854 | return compareResult !== 0;
|
12855 | case ScalarFilter.GREATER_THAN:
|
12856 | return compareResult > 0;
|
12857 | case ScalarFilter.GREATER_THAN_OR_EQUAL:
|
12858 | return compareResult >= 0;
|
12859 | case ScalarFilter.LESS_THAN:
|
12860 | return compareResult < 0;
|
12861 | case ScalarFilter.LESS_THAN_OR_EQUAL:
|
12862 | return compareResult <= 0;
|
12863 | case ScalarFilter.IN_RANGE: {
|
12864 | var compareToResult = comparator(values[1], cellValue);
|
12865 | return this.scalarFilterParams.inRangeInclusive ?
|
12866 | compareResult >= 0 && compareToResult <= 0 :
|
12867 | compareResult > 0 && compareToResult < 0;
|
12868 | }
|
12869 | case ScalarFilter.BLANK:
|
12870 | return this.isBlank(cellValue);
|
12871 | case ScalarFilter.NOT_BLANK:
|
12872 | return !this.isBlank(cellValue);
|
12873 | default:
|
12874 | console.warn('AG Grid: Unexpected type of filter "' + filterModel.type + '", it looks like the filter was configured with incorrect Filter Options');
|
12875 | return true;
|
12876 | }
|
12877 | };
|
12878 | return ScalarFilter;
|
12879 | }(SimpleFilter));
|
12880 |
|
12881 |
|
12882 |
|
12883 |
|
12884 |
|
12885 |
|
12886 |
|
12887 | var __extends$i = (undefined && undefined.__extends) || (function () {
|
12888 | var extendStatics = function (d, b) {
|
12889 | extendStatics = Object.setPrototypeOf ||
|
12890 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12891 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
12892 | return extendStatics(d, b);
|
12893 | };
|
12894 | return function (d, b) {
|
12895 | extendStatics(d, b);
|
12896 | function __() { this.constructor = d; }
|
12897 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12898 | };
|
12899 | })();
|
12900 | var __assign$5 = (undefined && undefined.__assign) || function () {
|
12901 | __assign$5 = Object.assign || function(t) {
|
12902 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
12903 | s = arguments[i];
|
12904 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
12905 | t[p] = s[p];
|
12906 | }
|
12907 | return t;
|
12908 | };
|
12909 | return __assign$5.apply(this, arguments);
|
12910 | };
|
12911 | var __decorate$k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
12912 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
12913 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
12914 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12915 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
12916 | };
|
12917 | var DEFAULT_MIN_YEAR = 1000;
|
12918 | var DEFAULT_MAX_YEAR = Infinity;
|
12919 | var DateFilter = (function (_super) {
|
12920 | __extends$i(DateFilter, _super);
|
12921 | function DateFilter() {
|
12922 | var _this = _super.call(this, 'dateFilter') || this;
|
12923 | _this.minValidYear = DEFAULT_MIN_YEAR;
|
12924 | _this.maxValidYear = DEFAULT_MAX_YEAR;
|
12925 | return _this;
|
12926 | }
|
12927 | DateFilter.prototype.afterGuiAttached = function (params) {
|
12928 | _super.prototype.afterGuiAttached.call(this, params);
|
12929 | this.dateCondition1FromComp.afterGuiAttached(params);
|
12930 | };
|
12931 | DateFilter.prototype.mapValuesFromModel = function (filterModel) {
|
12932 |
|
12933 |
|
12934 |
|
12935 |
|
12936 |
|
12937 |
|
12938 |
|
12939 |
|
12940 | var _a = filterModel || {}, dateFrom = _a.dateFrom, dateTo = _a.dateTo, type = _a.type;
|
12941 | return [
|
12942 | dateFrom && parseDateTimeFromString(dateFrom) || null,
|
12943 | dateTo && parseDateTimeFromString(dateTo) || null,
|
12944 | ].slice(0, this.getNumberOfInputs(type));
|
12945 | };
|
12946 | DateFilter.prototype.comparator = function () {
|
12947 | return this.dateFilterParams.comparator ? this.dateFilterParams.comparator : this.defaultComparator.bind(this);
|
12948 | };
|
12949 | DateFilter.prototype.defaultComparator = function (filterDate, cellValue) {
|
12950 |
|
12951 | var cellAsDate = cellValue;
|
12952 | if (cellValue == null || cellAsDate < filterDate) {
|
12953 | return -1;
|
12954 | }
|
12955 | if (cellAsDate > filterDate) {
|
12956 | return 1;
|
12957 | }
|
12958 | return 0;
|
12959 | };
|
12960 | DateFilter.prototype.setParams = function (params) {
|
12961 | _super.prototype.setParams.call(this, params);
|
12962 | this.dateFilterParams = params;
|
12963 | var yearParser = function (param, fallback) {
|
12964 | if (params[param] != null) {
|
12965 | if (!isNaN(params[param])) {
|
12966 | return params[param] == null ? fallback : Number(params[param]);
|
12967 | }
|
12968 | else {
|
12969 | console.warn("AG Grid: DateFilter " + param + " is not a number");
|
12970 | }
|
12971 | }
|
12972 | return fallback;
|
12973 | };
|
12974 | this.minValidYear = yearParser('minValidYear', DEFAULT_MIN_YEAR);
|
12975 | this.maxValidYear = yearParser('maxValidYear', DEFAULT_MAX_YEAR);
|
12976 | if (this.minValidYear > this.maxValidYear) {
|
12977 | console.warn("AG Grid: DateFilter minValidYear should be <= maxValidYear");
|
12978 | }
|
12979 | this.createDateComponents();
|
12980 | };
|
12981 | DateFilter.prototype.createDateComponents = function () {
|
12982 | var _this = this;
|
12983 | var createDateCompWrapper = function (element) {
|
12984 | return new DateCompWrapper(_this.getContext(), _this.userComponentFactory, {
|
12985 | onDateChanged: function () { return _this.onUiChanged(); },
|
12986 | filterParams: _this.dateFilterParams
|
12987 | }, element);
|
12988 | };
|
12989 | this.dateCondition1FromComp = createDateCompWrapper(this.eCondition1PanelFrom);
|
12990 | this.dateCondition1ToComp = createDateCompWrapper(this.eCondition1PanelTo);
|
12991 | this.dateCondition2FromComp = createDateCompWrapper(this.eCondition2PanelFrom);
|
12992 | this.dateCondition2ToComp = createDateCompWrapper(this.eCondition2PanelTo);
|
12993 | this.addDestroyFunc(function () {
|
12994 | _this.forEachInput(function (element) { return element.destroy(); });
|
12995 | });
|
12996 | };
|
12997 | DateFilter.prototype.setElementValue = function (element, value, silent) {
|
12998 | element.setDate(value);
|
12999 | };
|
13000 | DateFilter.prototype.setElementDisplayed = function (element, displayed) {
|
13001 | element.setDisplayed(displayed);
|
13002 | };
|
13003 | DateFilter.prototype.setElementDisabled = function (element, disabled) {
|
13004 | element.setDisabled(disabled);
|
13005 | };
|
13006 | DateFilter.prototype.getDefaultFilterOptions = function () {
|
13007 | return DateFilter.DEFAULT_FILTER_OPTIONS;
|
13008 | };
|
13009 | DateFilter.prototype.createValueTemplate = function (position) {
|
13010 | var pos = position === ConditionPosition.One ? '1' : '2';
|
13011 | 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>";
|
13012 | };
|
13013 | DateFilter.prototype.isConditionUiComplete = function (position) {
|
13014 | var _this = this;
|
13015 | if (!_super.prototype.isConditionUiComplete.call(this, position)) {
|
13016 | return false;
|
13017 | }
|
13018 | var isValidDate = function (value) { return value != null
|
13019 | && value.getUTCFullYear() >= _this.minValidYear
|
13020 | && value.getUTCFullYear() <= _this.maxValidYear; };
|
13021 | var valid = true;
|
13022 | this.forEachInput(function (element, index, elPosition, numberOfInputs) {
|
13023 | if (elPosition !== position || !valid || index >= numberOfInputs) {
|
13024 | return;
|
13025 | }
|
13026 | valid = valid && isValidDate(element.getDate());
|
13027 | });
|
13028 | return valid;
|
13029 | };
|
13030 | DateFilter.prototype.areSimpleModelsEqual = function (aSimple, bSimple) {
|
13031 | return aSimple.dateFrom === bSimple.dateFrom
|
13032 | && aSimple.dateTo === bSimple.dateTo
|
13033 | && aSimple.type === bSimple.type;
|
13034 | };
|
13035 | DateFilter.prototype.getFilterType = function () {
|
13036 | return 'date';
|
13037 | };
|
13038 | DateFilter.prototype.createCondition = function (position) {
|
13039 | var type = this.getConditionTypes()[position];
|
13040 | var model = {};
|
13041 | var values = this.getValues(position);
|
13042 | if (values.length > 0) {
|
13043 | model.dateFrom = serialiseDate(values[0]);
|
13044 | }
|
13045 | if (values.length > 1) {
|
13046 | model.dateTo = serialiseDate(values[1]);
|
13047 | }
|
13048 | return __assign$5({ dateFrom: null, dateTo: null, filterType: this.getFilterType(), type: type }, model);
|
13049 | };
|
13050 | DateFilter.prototype.resetPlaceholder = function () {
|
13051 | var globalTranslate = this.gridOptionsWrapper.getLocaleTextFunc();
|
13052 | var placeholder = this.translate('dateFormatOoo');
|
13053 | var ariaLabel = globalTranslate('ariaFilterValue', 'Filter Value');
|
13054 | this.forEachInput(function (element) {
|
13055 | element.setInputPlaceholder(placeholder);
|
13056 | element.setInputAriaLabel(ariaLabel);
|
13057 | });
|
13058 | };
|
13059 | DateFilter.prototype.getInputs = function () {
|
13060 | return [
|
13061 | [this.dateCondition1FromComp, this.dateCondition1ToComp],
|
13062 | [this.dateCondition2FromComp, this.dateCondition2ToComp],
|
13063 | ];
|
13064 | };
|
13065 | DateFilter.prototype.getValues = function (position) {
|
13066 | var result = [];
|
13067 | this.forEachInput(function (element, index, elPosition, numberOfInputs) {
|
13068 | if (position === elPosition && index < numberOfInputs) {
|
13069 | result.push(element.getDate());
|
13070 | }
|
13071 | });
|
13072 | return result;
|
13073 | };
|
13074 | DateFilter.DEFAULT_FILTER_OPTIONS = [
|
13075 | ScalarFilter.EQUALS,
|
13076 | ScalarFilter.GREATER_THAN,
|
13077 | ScalarFilter.LESS_THAN,
|
13078 | ScalarFilter.NOT_EQUAL,
|
13079 | ScalarFilter.IN_RANGE,
|
13080 | ScalarFilter.BLANK,
|
13081 | ScalarFilter.NOT_BLANK,
|
13082 | ];
|
13083 | __decorate$k([
|
13084 | RefSelector('eCondition1PanelFrom')
|
13085 | ], DateFilter.prototype, "eCondition1PanelFrom", void 0);
|
13086 | __decorate$k([
|
13087 | RefSelector('eCondition1PanelTo')
|
13088 | ], DateFilter.prototype, "eCondition1PanelTo", void 0);
|
13089 | __decorate$k([
|
13090 | RefSelector('eCondition2PanelFrom')
|
13091 | ], DateFilter.prototype, "eCondition2PanelFrom", void 0);
|
13092 | __decorate$k([
|
13093 | RefSelector('eCondition2PanelTo')
|
13094 | ], DateFilter.prototype, "eCondition2PanelTo", void 0);
|
13095 | __decorate$k([
|
13096 | Autowired('userComponentFactory')
|
13097 | ], DateFilter.prototype, "userComponentFactory", void 0);
|
13098 | return DateFilter;
|
13099 | }(ScalarFilter));
|
13100 |
|
13101 |
|
13102 |
|
13103 |
|
13104 |
|
13105 |
|
13106 |
|
13107 | var __extends$j = (undefined && undefined.__extends) || (function () {
|
13108 | var extendStatics = function (d, b) {
|
13109 | extendStatics = Object.setPrototypeOf ||
|
13110 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13111 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
13112 | return extendStatics(d, b);
|
13113 | };
|
13114 | return function (d, b) {
|
13115 | extendStatics(d, b);
|
13116 | function __() { this.constructor = d; }
|
13117 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13118 | };
|
13119 | })();
|
13120 | var SimpleFloatingFilter = (function (_super) {
|
13121 | __extends$j(SimpleFloatingFilter, _super);
|
13122 | function SimpleFloatingFilter() {
|
13123 | return _super !== null && _super.apply(this, arguments) || this;
|
13124 | }
|
13125 | SimpleFloatingFilter.prototype.getDefaultDebounceMs = function () {
|
13126 | return 0;
|
13127 | };
|
13128 |
|
13129 |
|
13130 | SimpleFloatingFilter.prototype.destroy = function () {
|
13131 | _super.prototype.destroy.call(this);
|
13132 | };
|
13133 |
|
13134 |
|
13135 |
|
13136 | SimpleFloatingFilter.prototype.getTextFromModel = function (model) {
|
13137 | if (!model) {
|
13138 | return null;
|
13139 | }
|
13140 | var isCombined = model.operator != null;
|
13141 | if (isCombined) {
|
13142 | var combinedModel = model;
|
13143 | var _a = combinedModel || {}, condition1 = _a.condition1, condition2 = _a.condition2;
|
13144 | var customOption1 = this.optionsFactory.getCustomOption(condition1.type);
|
13145 | var customOption2 = this.optionsFactory.getCustomOption(condition2.type);
|
13146 | return [
|
13147 | this.conditionToString(condition1, customOption1),
|
13148 | combinedModel.operator,
|
13149 | this.conditionToString(condition2, customOption2),
|
13150 | ].join(' ');
|
13151 | }
|
13152 | else {
|
13153 | var condition = model;
|
13154 | var customOption = this.optionsFactory.getCustomOption(condition.type);
|
13155 |
|
13156 |
|
13157 | var _b = customOption || {}, displayKey = _b.displayKey, displayName = _b.displayName, numberOfInputs = _b.numberOfInputs;
|
13158 | if (displayKey && displayName && numberOfInputs === 0) {
|
13159 | this.gridOptionsWrapper.getLocaleTextFunc()(displayKey, displayName);
|
13160 | return displayName;
|
13161 | }
|
13162 | return this.conditionToString(condition, customOption);
|
13163 | }
|
13164 | };
|
13165 | SimpleFloatingFilter.prototype.isEventFromFloatingFilter = function (event) {
|
13166 | return event && event.afterFloatingFilter;
|
13167 | };
|
13168 | SimpleFloatingFilter.prototype.getLastType = function () {
|
13169 | return this.lastType;
|
13170 | };
|
13171 | SimpleFloatingFilter.prototype.isReadOnly = function () {
|
13172 | return this.readOnly;
|
13173 | };
|
13174 | SimpleFloatingFilter.prototype.setLastTypeFromModel = function (model) {
|
13175 |
|
13176 | if (!model) {
|
13177 | this.lastType = this.optionsFactory.getDefaultOption();
|
13178 | return;
|
13179 | }
|
13180 | var isCombined = model.operator;
|
13181 | var condition;
|
13182 | if (isCombined) {
|
13183 | var combinedModel = model;
|
13184 | condition = combinedModel.condition1;
|
13185 | }
|
13186 | else {
|
13187 | condition = model;
|
13188 | }
|
13189 | this.lastType = condition.type;
|
13190 | };
|
13191 | SimpleFloatingFilter.prototype.canWeEditAfterModelFromParentFilter = function (model) {
|
13192 | if (!model) {
|
13193 |
|
13194 |
|
13195 | return this.isTypeEditable(this.lastType);
|
13196 | }
|
13197 |
|
13198 | var isCombined = model.operator;
|
13199 | if (isCombined) {
|
13200 | return false;
|
13201 | }
|
13202 | var simpleModel = model;
|
13203 | return this.isTypeEditable(simpleModel.type);
|
13204 | };
|
13205 | SimpleFloatingFilter.prototype.init = function (params) {
|
13206 | this.optionsFactory = new OptionsFactory();
|
13207 | this.optionsFactory.init(params.filterParams, this.getDefaultFilterOptions());
|
13208 | this.lastType = this.optionsFactory.getDefaultOption();
|
13209 |
|
13210 |
|
13211 | this.readOnly = !!params.filterParams.readOnly;
|
13212 |
|
13213 |
|
13214 |
|
13215 |
|
13216 | var editable = this.isTypeEditable(this.lastType);
|
13217 | this.setEditable(editable);
|
13218 | };
|
13219 | SimpleFloatingFilter.prototype.doesFilterHaveSingleInput = function (filterType) {
|
13220 | var customFilterOption = this.optionsFactory.getCustomOption(filterType);
|
13221 | var numberOfInputs = (customFilterOption || {}).numberOfInputs;
|
13222 | return numberOfInputs == null || numberOfInputs == 1;
|
13223 | };
|
13224 | SimpleFloatingFilter.prototype.isTypeEditable = function (type) {
|
13225 | var uneditableTypes = [
|
13226 | SimpleFilter.IN_RANGE, SimpleFilter.EMPTY, SimpleFilter.BLANK, SimpleFilter.NOT_BLANK,
|
13227 | ];
|
13228 | return !!type &&
|
13229 | !this.isReadOnly() &&
|
13230 | this.doesFilterHaveSingleInput(type) &&
|
13231 | uneditableTypes.indexOf(type) < 0;
|
13232 | };
|
13233 | return SimpleFloatingFilter;
|
13234 | }(Component));
|
13235 |
|
13236 |
|
13237 |
|
13238 |
|
13239 |
|
13240 |
|
13241 |
|
13242 | var __extends$k = (undefined && undefined.__extends) || (function () {
|
13243 | var extendStatics = function (d, b) {
|
13244 | extendStatics = Object.setPrototypeOf ||
|
13245 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13246 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
13247 | return extendStatics(d, b);
|
13248 | };
|
13249 | return function (d, b) {
|
13250 | extendStatics(d, b);
|
13251 | function __() { this.constructor = d; }
|
13252 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13253 | };
|
13254 | })();
|
13255 | var __decorate$l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
13256 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
13257 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
13258 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
13259 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
13260 | };
|
13261 | var DateFloatingFilter = (function (_super) {
|
13262 | __extends$k(DateFloatingFilter, _super);
|
13263 | function DateFloatingFilter() {
|
13264 | 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;
|
13265 | }
|
13266 | DateFloatingFilter.prototype.getDefaultFilterOptions = function () {
|
13267 | return DateFilter.DEFAULT_FILTER_OPTIONS;
|
13268 | };
|
13269 | DateFloatingFilter.prototype.conditionToString = function (condition, options) {
|
13270 | var type = condition.type;
|
13271 | var numberOfInputs = (options || {}).numberOfInputs;
|
13272 | var isRange = type == SimpleFilter.IN_RANGE || numberOfInputs === 2;
|
13273 | var dateFrom = parseDateTimeFromString(condition.dateFrom);
|
13274 | var dateTo = parseDateTimeFromString(condition.dateTo);
|
13275 | if (isRange) {
|
13276 | return serialiseDate(dateFrom, false) + "-" + serialiseDate(dateTo, false);
|
13277 | }
|
13278 | if (dateFrom != null) {
|
13279 | return "" + serialiseDate(dateFrom, false);
|
13280 | }
|
13281 |
|
13282 | return "" + type;
|
13283 | };
|
13284 | DateFloatingFilter.prototype.init = function (params) {
|
13285 | _super.prototype.init.call(this, params);
|
13286 | this.params = params;
|
13287 | this.createDateComponent();
|
13288 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
13289 | this.eReadOnlyText
|
13290 | .setDisabled(true)
|
13291 | .setInputAriaLabel(translate('ariaDateFilterInput', 'Date Filter Input'));
|
13292 | };
|
13293 | DateFloatingFilter.prototype.setEditable = function (editable) {
|
13294 | setDisplayed(this.eDateWrapper, editable);
|
13295 | setDisplayed(this.eReadOnlyText.getGui(), !editable);
|
13296 | };
|
13297 | DateFloatingFilter.prototype.onParentModelChanged = function (model, event) {
|
13298 |
|
13299 |
|
13300 |
|
13301 | if (this.isEventFromFloatingFilter(event)) {
|
13302 | return;
|
13303 | }
|
13304 | _super.prototype.setLastTypeFromModel.call(this, model);
|
13305 | var allowEditing = !this.isReadOnly() &&
|
13306 | this.canWeEditAfterModelFromParentFilter(model);
|
13307 | this.setEditable(allowEditing);
|
13308 | if (allowEditing) {
|
13309 | if (model) {
|
13310 | var dateModel = model;
|
13311 | this.dateComp.setDate(parseDateTimeFromString(dateModel.dateFrom));
|
13312 | }
|
13313 | else {
|
13314 | this.dateComp.setDate(null);
|
13315 | }
|
13316 | this.eReadOnlyText.setValue('');
|
13317 | }
|
13318 | else {
|
13319 | this.eReadOnlyText.setValue(this.getTextFromModel(model));
|
13320 | this.dateComp.setDate(null);
|
13321 | }
|
13322 | };
|
13323 | DateFloatingFilter.prototype.onDateChanged = function () {
|
13324 | var _this = this;
|
13325 | var filterValueDate = this.dateComp.getDate();
|
13326 | var filterValueText = serialiseDate(filterValueDate);
|
13327 | this.params.parentFilterInstance(function (filterInstance) {
|
13328 | if (filterInstance) {
|
13329 | var date = parseDateTimeFromString(filterValueText);
|
13330 | filterInstance.onFloatingFilterChanged(_this.getLastType() || null, date);
|
13331 | }
|
13332 | });
|
13333 | };
|
13334 | DateFloatingFilter.prototype.createDateComponent = function () {
|
13335 | var _this = this;
|
13336 | var debounceMs = ProvidedFilter.getDebounceMs(this.params.filterParams, this.getDefaultDebounceMs());
|
13337 | var dateComponentParams = {
|
13338 | onDateChanged: debounce(this.onDateChanged.bind(this), debounceMs),
|
13339 | filterParams: this.params.column.getColDef().filterParams
|
13340 | };
|
13341 | this.dateComp = new DateCompWrapper(this.getContext(), this.userComponentFactory, dateComponentParams, this.eDateWrapper);
|
13342 | this.addDestroyFunc(function () { return _this.dateComp.destroy(); });
|
13343 | };
|
13344 | __decorate$l([
|
13345 | Autowired('userComponentFactory')
|
13346 | ], DateFloatingFilter.prototype, "userComponentFactory", void 0);
|
13347 | __decorate$l([
|
13348 | RefSelector('eReadOnlyText')
|
13349 | ], DateFloatingFilter.prototype, "eReadOnlyText", void 0);
|
13350 | __decorate$l([
|
13351 | RefSelector('eDateWrapper')
|
13352 | ], DateFloatingFilter.prototype, "eDateWrapper", void 0);
|
13353 | return DateFloatingFilter;
|
13354 | }(SimpleFloatingFilter));
|
13355 |
|
13356 |
|
13357 |
|
13358 |
|
13359 |
|
13360 |
|
13361 |
|
13362 | var __extends$l = (undefined && undefined.__extends) || (function () {
|
13363 | var extendStatics = function (d, b) {
|
13364 | extendStatics = Object.setPrototypeOf ||
|
13365 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13366 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
13367 | return extendStatics(d, b);
|
13368 | };
|
13369 | return function (d, b) {
|
13370 | extendStatics(d, b);
|
13371 | function __() { this.constructor = d; }
|
13372 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13373 | };
|
13374 | })();
|
13375 | var __decorate$m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
13376 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
13377 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
13378 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
13379 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
13380 | };
|
13381 | var DefaultDateComponent = (function (_super) {
|
13382 | __extends$l(DefaultDateComponent, _super);
|
13383 | function DefaultDateComponent() {
|
13384 | 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;
|
13385 | }
|
13386 |
|
13387 |
|
13388 | DefaultDateComponent.prototype.destroy = function () {
|
13389 | _super.prototype.destroy.call(this);
|
13390 | };
|
13391 | DefaultDateComponent.prototype.init = function (params) {
|
13392 | var _this = this;
|
13393 | var eDocument = this.gridOptionsWrapper.getDocument();
|
13394 | var inputElement = this.eDateInput.getInputElement();
|
13395 | if (this.shouldUseBrowserDatePicker(params)) {
|
13396 | inputElement.type = 'date';
|
13397 | }
|
13398 |
|
13399 | this.addManagedListener(inputElement, 'mousedown', function () {
|
13400 | if (_this.eDateInput.isDisabled()) {
|
13401 | return;
|
13402 | }
|
13403 | inputElement.focus();
|
13404 | });
|
13405 | this.addManagedListener(inputElement, 'input', function (e) {
|
13406 | if (e.target !== eDocument.activeElement) {
|
13407 | return;
|
13408 | }
|
13409 | if (_this.eDateInput.isDisabled()) {
|
13410 | return;
|
13411 | }
|
13412 | params.onDateChanged();
|
13413 | });
|
13414 | var _a = params.filterParams || {}, minValidYear = _a.minValidYear, maxValidYear = _a.maxValidYear;
|
13415 | if (minValidYear) {
|
13416 | inputElement.min = minValidYear + "-01-01";
|
13417 | }
|
13418 | if (maxValidYear) {
|
13419 | inputElement.max = maxValidYear + "-12-31";
|
13420 | }
|
13421 | };
|
13422 | DefaultDateComponent.prototype.getDate = function () {
|
13423 | return parseDateTimeFromString(this.eDateInput.getValue());
|
13424 | };
|
13425 | DefaultDateComponent.prototype.setDate = function (date) {
|
13426 | this.eDateInput.setValue(serialiseDate(date, false));
|
13427 | };
|
13428 | DefaultDateComponent.prototype.setInputPlaceholder = function (placeholder) {
|
13429 | this.eDateInput.setInputPlaceholder(placeholder);
|
13430 | };
|
13431 | DefaultDateComponent.prototype.setDisabled = function (disabled) {
|
13432 | this.eDateInput.setDisabled(disabled);
|
13433 | };
|
13434 | DefaultDateComponent.prototype.afterGuiAttached = function (params) {
|
13435 | if (!params || !params.suppressFocus) {
|
13436 | this.eDateInput.getInputElement().focus();
|
13437 | }
|
13438 | };
|
13439 | DefaultDateComponent.prototype.shouldUseBrowserDatePicker = function (params) {
|
13440 | if (params.filterParams && params.filterParams.browserDatePicker != null) {
|
13441 | return params.filterParams.browserDatePicker;
|
13442 | }
|
13443 | return isBrowserChrome() || isBrowserFirefox();
|
13444 | };
|
13445 | __decorate$m([
|
13446 | RefSelector('eDateInput')
|
13447 | ], DefaultDateComponent.prototype, "eDateInput", void 0);
|
13448 | return DefaultDateComponent;
|
13449 | }(Component));
|
13450 |
|
13451 |
|
13452 |
|
13453 |
|
13454 |
|
13455 |
|
13456 |
|
13457 | var __extends$m = (undefined && undefined.__extends) || (function () {
|
13458 | var extendStatics = function (d, b) {
|
13459 | extendStatics = Object.setPrototypeOf ||
|
13460 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13461 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
13462 | return extendStatics(d, b);
|
13463 | };
|
13464 | return function (d, b) {
|
13465 | extendStatics(d, b);
|
13466 | function __() { this.constructor = d; }
|
13467 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13468 | };
|
13469 | })();
|
13470 | var __decorate$n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
13471 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
13472 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
13473 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
13474 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
13475 | };
|
13476 | var NumberFilter = (function (_super) {
|
13477 | __extends$m(NumberFilter, _super);
|
13478 | function NumberFilter() {
|
13479 | return _super.call(this, 'numberFilter') || this;
|
13480 | }
|
13481 | NumberFilter.prototype.mapValuesFromModel = function (filterModel) {
|
13482 | var _a = filterModel || {}, filter = _a.filter, filterTo = _a.filterTo, type = _a.type;
|
13483 | return [
|
13484 | filter == null ? null : filter,
|
13485 | filterTo == null ? null : filterTo,
|
13486 | ].slice(0, this.getNumberOfInputs(type));
|
13487 | };
|
13488 | NumberFilter.prototype.getDefaultDebounceMs = function () {
|
13489 | return 500;
|
13490 | };
|
13491 | NumberFilter.prototype.comparator = function () {
|
13492 | return function (left, right) {
|
13493 | if (left === right) {
|
13494 | return 0;
|
13495 | }
|
13496 | return left < right ? 1 : -1;
|
13497 | };
|
13498 | };
|
13499 | NumberFilter.prototype.setParams = function (params) {
|
13500 | this.numberFilterParams = params;
|
13501 | var allowedCharPattern = this.getAllowedCharPattern();
|
13502 | if (allowedCharPattern) {
|
13503 | var config = { allowedCharPattern: allowedCharPattern };
|
13504 | this.resetTemplate({
|
13505 | 'eValue-index0-1': config,
|
13506 | 'eValue-index1-1': config,
|
13507 | 'eValue-index0-2': config,
|
13508 | 'eValue-index1-2': config,
|
13509 | });
|
13510 | }
|
13511 | _super.prototype.setParams.call(this, params);
|
13512 | };
|
13513 | NumberFilter.prototype.getDefaultFilterOptions = function () {
|
13514 | return NumberFilter.DEFAULT_FILTER_OPTIONS;
|
13515 | };
|
13516 | NumberFilter.prototype.createValueTemplate = function (position) {
|
13517 | var pos = position === ConditionPosition.One ? '1' : '2';
|
13518 | var allowedCharPattern = this.getAllowedCharPattern();
|
13519 | var agElementTag = allowedCharPattern ? 'ag-input-text-field' : 'ag-input-number-field';
|
13520 | 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>";
|
13521 | };
|
13522 | NumberFilter.prototype.getValues = function (position) {
|
13523 | var _this = this;
|
13524 | var result = [];
|
13525 | this.forEachInput(function (element, index, elPosition, numberOfInputs) {
|
13526 | if (position === elPosition && index < numberOfInputs) {
|
13527 | result.push(_this.stringToFloat(element.getValue()));
|
13528 | }
|
13529 | });
|
13530 | return result;
|
13531 | };
|
13532 | NumberFilter.prototype.areSimpleModelsEqual = function (aSimple, bSimple) {
|
13533 | return aSimple.filter === bSimple.filter
|
13534 | && aSimple.filterTo === bSimple.filterTo
|
13535 | && aSimple.type === bSimple.type;
|
13536 | };
|
13537 | NumberFilter.prototype.getFilterType = function () {
|
13538 | return 'number';
|
13539 | };
|
13540 | NumberFilter.prototype.stringToFloat = function (value) {
|
13541 | if (typeof value === 'number') {
|
13542 | return value;
|
13543 | }
|
13544 | var filterText = makeNull(value);
|
13545 | if (filterText != null && filterText.trim() === '') {
|
13546 | filterText = null;
|
13547 | }
|
13548 | if (this.numberFilterParams.numberParser) {
|
13549 | return this.numberFilterParams.numberParser(filterText);
|
13550 | }
|
13551 | return filterText == null || filterText.trim() === '-' ? null : parseFloat(filterText);
|
13552 | };
|
13553 | NumberFilter.prototype.createCondition = function (position) {
|
13554 | var type = this.getConditionTypes()[position];
|
13555 | var model = {
|
13556 | filterType: this.getFilterType(),
|
13557 | type: type
|
13558 | };
|
13559 | var values = this.getValues(position);
|
13560 | if (values.length > 0) {
|
13561 | model.filter = values[0];
|
13562 | }
|
13563 | if (values.length > 1) {
|
13564 | model.filterTo = values[1];
|
13565 | }
|
13566 | return model;
|
13567 | };
|
13568 | NumberFilter.prototype.getInputs = function () {
|
13569 | return [
|
13570 | [this.eValueFrom1, this.eValueTo1],
|
13571 | [this.eValueFrom2, this.eValueTo2],
|
13572 | ];
|
13573 | };
|
13574 | NumberFilter.prototype.getAllowedCharPattern = function () {
|
13575 | var allowedCharPattern = (this.numberFilterParams || {}).allowedCharPattern;
|
13576 | if (allowedCharPattern) {
|
13577 | return allowedCharPattern;
|
13578 | }
|
13579 | if (!isBrowserChrome() && !isBrowserEdge()) {
|
13580 |
|
13581 |
|
13582 | return '\\d\\-\\.';
|
13583 | }
|
13584 | return null;
|
13585 | };
|
13586 | NumberFilter.DEFAULT_FILTER_OPTIONS = [
|
13587 | ScalarFilter.EQUALS,
|
13588 | ScalarFilter.NOT_EQUAL,
|
13589 | ScalarFilter.LESS_THAN,
|
13590 | ScalarFilter.LESS_THAN_OR_EQUAL,
|
13591 | ScalarFilter.GREATER_THAN,
|
13592 | ScalarFilter.GREATER_THAN_OR_EQUAL,
|
13593 | ScalarFilter.IN_RANGE,
|
13594 | ScalarFilter.BLANK,
|
13595 | ScalarFilter.NOT_BLANK,
|
13596 | ];
|
13597 | __decorate$n([
|
13598 | RefSelector('eValue-index0-1')
|
13599 | ], NumberFilter.prototype, "eValueFrom1", void 0);
|
13600 | __decorate$n([
|
13601 | RefSelector('eValue-index1-1')
|
13602 | ], NumberFilter.prototype, "eValueTo1", void 0);
|
13603 | __decorate$n([
|
13604 | RefSelector('eValue-index0-2')
|
13605 | ], NumberFilter.prototype, "eValueFrom2", void 0);
|
13606 | __decorate$n([
|
13607 | RefSelector('eValue-index1-2')
|
13608 | ], NumberFilter.prototype, "eValueTo2", void 0);
|
13609 | return NumberFilter;
|
13610 | }(ScalarFilter));
|
13611 |
|
13612 |
|
13613 |
|
13614 |
|
13615 |
|
13616 |
|
13617 |
|
13618 | var __extends$n = (undefined && undefined.__extends) || (function () {
|
13619 | var extendStatics = function (d, b) {
|
13620 | extendStatics = Object.setPrototypeOf ||
|
13621 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13622 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
13623 | return extendStatics(d, b);
|
13624 | };
|
13625 | return function (d, b) {
|
13626 | extendStatics(d, b);
|
13627 | function __() { this.constructor = d; }
|
13628 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13629 | };
|
13630 | })();
|
13631 | var __assign$6 = (undefined && undefined.__assign) || function () {
|
13632 | __assign$6 = Object.assign || function(t) {
|
13633 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
13634 | s = arguments[i];
|
13635 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
13636 | t[p] = s[p];
|
13637 | }
|
13638 | return t;
|
13639 | };
|
13640 | return __assign$6.apply(this, arguments);
|
13641 | };
|
13642 | var __decorate$o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
13643 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
13644 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
13645 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
13646 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
13647 | };
|
13648 | var TextFilter = (function (_super) {
|
13649 | __extends$n(TextFilter, _super);
|
13650 | function TextFilter() {
|
13651 | return _super.call(this, 'textFilter') || this;
|
13652 | }
|
13653 | TextFilter.trimInput = function (value) {
|
13654 | var trimmedInput = value && value.trim();
|
13655 |
|
13656 | return trimmedInput === '' ? value : trimmedInput;
|
13657 | };
|
13658 | TextFilter.prototype.getDefaultDebounceMs = function () {
|
13659 | return 500;
|
13660 | };
|
13661 | TextFilter.prototype.setParams = function (params) {
|
13662 | _super.prototype.setParams.call(this, params);
|
13663 | this.textFilterParams = params;
|
13664 | this.matcher = this.getTextMatcher();
|
13665 | this.formatter = this.textFilterParams.textFormatter ||
|
13666 | (this.textFilterParams.caseSensitive ? TextFilter.DEFAULT_FORMATTER : TextFilter.DEFAULT_LOWERCASE_FORMATTER);
|
13667 | };
|
13668 | TextFilter.prototype.getTextMatcher = function () {
|
13669 | var legacyComparator = this.textFilterParams.textCustomComparator;
|
13670 | if (legacyComparator) {
|
13671 | _.doOnce(function () { return console.warn('AG Grid - textCustomComparator is deprecated, use textMatcher instead.'); }, 'textCustomComparator.deprecated');
|
13672 | return function (_a) {
|
13673 | var filterOption = _a.filterOption, value = _a.value, filterText = _a.filterText;
|
13674 | return legacyComparator(filterOption, value, filterText);
|
13675 | };
|
13676 | }
|
13677 | return this.textFilterParams.textMatcher || TextFilter.DEFAULT_MATCHER;
|
13678 | };
|
13679 | TextFilter.prototype.createCondition = function (position) {
|
13680 | var type = this.getConditionTypes()[position];
|
13681 | var model = {
|
13682 | filterType: this.getFilterType(),
|
13683 | type: type,
|
13684 | };
|
13685 | var values = this.getValues(position);
|
13686 | if (values.length > 0) {
|
13687 | model.filter = values[0];
|
13688 | }
|
13689 | if (values.length > 1) {
|
13690 | model.filterTo = values[1];
|
13691 | }
|
13692 | return model;
|
13693 | };
|
13694 | TextFilter.prototype.getFilterType = function () {
|
13695 | return 'text';
|
13696 | };
|
13697 | TextFilter.prototype.areSimpleModelsEqual = function (aSimple, bSimple) {
|
13698 | return aSimple.filter === bSimple.filter &&
|
13699 | aSimple.filterTo === bSimple.filterTo &&
|
13700 | aSimple.type === bSimple.type;
|
13701 | };
|
13702 | TextFilter.prototype.getInputs = function () {
|
13703 | return [
|
13704 | [this.eValueFrom1, this.eValueTo1],
|
13705 | [this.eValueFrom2, this.eValueTo2],
|
13706 | ];
|
13707 | };
|
13708 | TextFilter.prototype.getValues = function (position) {
|
13709 | var _this = this;
|
13710 | var result = [];
|
13711 | this.forEachInput(function (element, index, elPosition, numberOfInputs) {
|
13712 | if (position === elPosition && index < numberOfInputs) {
|
13713 | var value = makeNull(element.getValue());
|
13714 | var cleanValue = (_this.textFilterParams.trimInput ? TextFilter.trimInput(value) : value) || null;
|
13715 | result.push(cleanValue);
|
13716 | element.setValue(cleanValue, true);
|
13717 | }
|
13718 | });
|
13719 | return result;
|
13720 | };
|
13721 | TextFilter.prototype.getDefaultFilterOptions = function () {
|
13722 | return TextFilter.DEFAULT_FILTER_OPTIONS;
|
13723 | };
|
13724 | TextFilter.prototype.createValueTemplate = function (position) {
|
13725 | var pos = position === ConditionPosition.One ? '1' : '2';
|
13726 | 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>";
|
13727 | };
|
13728 | TextFilter.prototype.mapValuesFromModel = function (filterModel) {
|
13729 | var _a = filterModel || {}, filter = _a.filter, filterTo = _a.filterTo, type = _a.type;
|
13730 | return [
|
13731 | filter || null,
|
13732 | filterTo || null,
|
13733 | ].slice(0, this.getNumberOfInputs(type));
|
13734 | };
|
13735 | TextFilter.prototype.evaluateNullValue = function (filterType) {
|
13736 | var filterTypesAllowNulls = [
|
13737 | SimpleFilter.NOT_EQUAL, SimpleFilter.NOT_CONTAINS, SimpleFilter.BLANK,
|
13738 | ];
|
13739 | return filterType ? filterTypesAllowNulls.indexOf(filterType) >= 0 : false;
|
13740 | };
|
13741 | TextFilter.prototype.evaluateNonNullValue = function (values, cellValue, filterModel, params) {
|
13742 | var _this = this;
|
13743 | var formattedValues = values.map(function (v) { return _this.formatter(v); }) || [];
|
13744 | var cellValueFormatted = this.formatter(cellValue);
|
13745 | var _a = this.textFilterParams, api = _a.api, colDef = _a.colDef, column = _a.column, columnApi = _a.columnApi, context = _a.context, textFormatter = _a.textFormatter;
|
13746 | if (filterModel.type === SimpleFilter.BLANK) {
|
13747 | return this.isBlank(cellValue);
|
13748 | }
|
13749 | else if (filterModel.type === SimpleFilter.NOT_BLANK) {
|
13750 | return !this.isBlank(cellValue);
|
13751 | }
|
13752 | var matcherParams = {
|
13753 | api: api,
|
13754 | colDef: colDef,
|
13755 | column: column,
|
13756 | columnApi: columnApi,
|
13757 | context: context,
|
13758 | node: params.node,
|
13759 | data: params.data,
|
13760 | filterOption: filterModel.type,
|
13761 | value: cellValueFormatted,
|
13762 | textFormatter: textFormatter,
|
13763 | };
|
13764 | return formattedValues.some(function (v) { return _this.matcher(__assign$6(__assign$6({}, matcherParams), { filterText: v })); });
|
13765 | };
|
13766 | TextFilter.DEFAULT_FILTER_OPTIONS = [
|
13767 | SimpleFilter.CONTAINS,
|
13768 | SimpleFilter.NOT_CONTAINS,
|
13769 | SimpleFilter.EQUALS,
|
13770 | SimpleFilter.NOT_EQUAL,
|
13771 | SimpleFilter.STARTS_WITH,
|
13772 | SimpleFilter.ENDS_WITH,
|
13773 | SimpleFilter.BLANK,
|
13774 | SimpleFilter.NOT_BLANK,
|
13775 | ];
|
13776 | TextFilter.DEFAULT_FORMATTER = function (from) { return from; };
|
13777 | TextFilter.DEFAULT_LOWERCASE_FORMATTER = function (from) { return from == null ? null : from.toString().toLowerCase(); };
|
13778 | TextFilter.DEFAULT_MATCHER = function (_a) {
|
13779 | var filterOption = _a.filterOption, value = _a.value, filterText = _a.filterText;
|
13780 | if (filterText == null) {
|
13781 | return false;
|
13782 | }
|
13783 | switch (filterOption) {
|
13784 | case TextFilter.CONTAINS:
|
13785 | return value.indexOf(filterText) >= 0;
|
13786 | case TextFilter.NOT_CONTAINS:
|
13787 | return value.indexOf(filterText) < 0;
|
13788 | case TextFilter.EQUALS:
|
13789 | return value === filterText;
|
13790 | case TextFilter.NOT_EQUAL:
|
13791 | return value != filterText;
|
13792 | case TextFilter.STARTS_WITH:
|
13793 | return value.indexOf(filterText) === 0;
|
13794 | case TextFilter.ENDS_WITH:
|
13795 | var index = value.lastIndexOf(filterText);
|
13796 | return index >= 0 && index === (value.length - filterText.length);
|
13797 | default:
|
13798 | return false;
|
13799 | }
|
13800 | };
|
13801 | __decorate$o([
|
13802 | RefSelector('eValue-index0-1')
|
13803 | ], TextFilter.prototype, "eValueFrom1", void 0);
|
13804 | __decorate$o([
|
13805 | RefSelector('eValue-index1-1')
|
13806 | ], TextFilter.prototype, "eValueTo1", void 0);
|
13807 | __decorate$o([
|
13808 | RefSelector('eValue-index0-2')
|
13809 | ], TextFilter.prototype, "eValueFrom2", void 0);
|
13810 | __decorate$o([
|
13811 | RefSelector('eValue-index1-2')
|
13812 | ], TextFilter.prototype, "eValueTo2", void 0);
|
13813 | return TextFilter;
|
13814 | }(SimpleFilter));
|
13815 |
|
13816 |
|
13817 |
|
13818 |
|
13819 |
|
13820 |
|
13821 |
|
13822 | var __extends$o = (undefined && undefined.__extends) || (function () {
|
13823 | var extendStatics = function (d, b) {
|
13824 | extendStatics = Object.setPrototypeOf ||
|
13825 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13826 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
13827 | return extendStatics(d, b);
|
13828 | };
|
13829 | return function (d, b) {
|
13830 | extendStatics(d, b);
|
13831 | function __() { this.constructor = d; }
|
13832 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13833 | };
|
13834 | })();
|
13835 | var __decorate$p = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
13836 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
13837 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
13838 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
13839 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
13840 | };
|
13841 | var TextInputFloatingFilter = (function (_super) {
|
13842 | __extends$o(TextInputFloatingFilter, _super);
|
13843 | function TextInputFloatingFilter() {
|
13844 | return _super !== null && _super.apply(this, arguments) || this;
|
13845 | }
|
13846 | TextInputFloatingFilter.prototype.postConstruct = function () {
|
13847 | this.resetTemplate();
|
13848 | };
|
13849 | TextInputFloatingFilter.prototype.resetTemplate = function (paramsMap) {
|
13850 | 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);
|
13851 | };
|
13852 | TextInputFloatingFilter.prototype.getDefaultDebounceMs = function () {
|
13853 | return 500;
|
13854 | };
|
13855 | TextInputFloatingFilter.prototype.onParentModelChanged = function (model, event) {
|
13856 | if (this.isEventFromFloatingFilter(event)) {
|
13857 |
|
13858 | return;
|
13859 | }
|
13860 | this.setLastTypeFromModel(model);
|
13861 | this.eFloatingFilterInput.setValue(this.getTextFromModel(model));
|
13862 | this.setEditable(this.canWeEditAfterModelFromParentFilter(model));
|
13863 | };
|
13864 | TextInputFloatingFilter.prototype.init = function (params) {
|
13865 | _super.prototype.init.call(this, params);
|
13866 | this.params = params;
|
13867 | this.applyActive = ProvidedFilter.isUseApplyButton(this.params.filterParams);
|
13868 | var allowedCharPattern = this.params.filterParams.allowedCharPattern;
|
13869 | if (allowedCharPattern != null) {
|
13870 | this.resetTemplate({ eFloatingFilterInput: { allowedCharPattern: allowedCharPattern } });
|
13871 | }
|
13872 | if (!this.isReadOnly()) {
|
13873 | var debounceMs = ProvidedFilter.getDebounceMs(this.params.filterParams, this.getDefaultDebounceMs());
|
13874 | var toDebounce = debounce(this.syncUpWithParentFilter.bind(this), debounceMs);
|
13875 | var filterGui = this.eFloatingFilterInput.getGui();
|
13876 | this.addManagedListener(filterGui, 'input', toDebounce);
|
13877 | this.addManagedListener(filterGui, 'keypress', toDebounce);
|
13878 | this.addManagedListener(filterGui, 'keydown', toDebounce);
|
13879 | }
|
13880 | var columnDef = params.column.getDefinition();
|
13881 | if (this.isReadOnly() || (columnDef.filterParams &&
|
13882 | columnDef.filterParams.filterOptions &&
|
13883 | columnDef.filterParams.filterOptions.length === 1 &&
|
13884 | columnDef.filterParams.filterOptions[0] === 'inRange')) {
|
13885 | this.eFloatingFilterInput.setDisabled(true);
|
13886 | }
|
13887 | var displayName = this.columnModel.getDisplayNameForColumn(params.column, 'header', true);
|
13888 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
13889 | this.eFloatingFilterInput.setInputAriaLabel(displayName + " " + translate('ariaFilterInput', 'Filter Input'));
|
13890 | };
|
13891 | TextInputFloatingFilter.prototype.syncUpWithParentFilter = function (e) {
|
13892 | var _this = this;
|
13893 | var enterKeyPressed = e.key === KeyCode.ENTER;
|
13894 | if (this.applyActive && !enterKeyPressed) {
|
13895 | return;
|
13896 | }
|
13897 | var value = this.eFloatingFilterInput.getValue();
|
13898 | if (this.params.filterParams.trimInput) {
|
13899 | value = TextFilter.trimInput(value);
|
13900 | this.eFloatingFilterInput.setValue(value, true);
|
13901 | }
|
13902 | this.params.parentFilterInstance(function (filterInstance) {
|
13903 | if (filterInstance) {
|
13904 | filterInstance.onFloatingFilterChanged(_this.getLastType() || null, value || null);
|
13905 | }
|
13906 | });
|
13907 | };
|
13908 | TextInputFloatingFilter.prototype.conditionToString = function (condition, options) {
|
13909 | var numberOfInputs = (options || {}).numberOfInputs;
|
13910 | var isRange = condition.type == SimpleFilter.IN_RANGE || numberOfInputs === 2;
|
13911 | if (isRange) {
|
13912 | return condition.filter + "-" + condition.filterTo;
|
13913 | }
|
13914 |
|
13915 | if (condition.filter != null) {
|
13916 | return "" + condition.filter;
|
13917 | }
|
13918 | return "" + condition.type;
|
13919 | };
|
13920 | TextInputFloatingFilter.prototype.setEditable = function (editable) {
|
13921 | this.eFloatingFilterInput.setDisabled(!editable);
|
13922 | };
|
13923 | __decorate$p([
|
13924 | Autowired('columnModel')
|
13925 | ], TextInputFloatingFilter.prototype, "columnModel", void 0);
|
13926 | __decorate$p([
|
13927 | RefSelector('eFloatingFilterInput')
|
13928 | ], TextInputFloatingFilter.prototype, "eFloatingFilterInput", void 0);
|
13929 | __decorate$p([
|
13930 | PostConstruct
|
13931 | ], TextInputFloatingFilter.prototype, "postConstruct", null);
|
13932 | return TextInputFloatingFilter;
|
13933 | }(SimpleFloatingFilter));
|
13934 |
|
13935 |
|
13936 |
|
13937 |
|
13938 |
|
13939 |
|
13940 |
|
13941 | var __extends$p = (undefined && undefined.__extends) || (function () {
|
13942 | var extendStatics = function (d, b) {
|
13943 | extendStatics = Object.setPrototypeOf ||
|
13944 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13945 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
13946 | return extendStatics(d, b);
|
13947 | };
|
13948 | return function (d, b) {
|
13949 | extendStatics(d, b);
|
13950 | function __() { this.constructor = d; }
|
13951 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13952 | };
|
13953 | })();
|
13954 | var NumberFloatingFilter = (function (_super) {
|
13955 | __extends$p(NumberFloatingFilter, _super);
|
13956 | function NumberFloatingFilter() {
|
13957 | return _super !== null && _super.apply(this, arguments) || this;
|
13958 | }
|
13959 | NumberFloatingFilter.prototype.getDefaultFilterOptions = function () {
|
13960 | return NumberFilter.DEFAULT_FILTER_OPTIONS;
|
13961 | };
|
13962 | return NumberFloatingFilter;
|
13963 | }(TextInputFloatingFilter));
|
13964 |
|
13965 |
|
13966 |
|
13967 |
|
13968 |
|
13969 |
|
13970 |
|
13971 | var __extends$q = (undefined && undefined.__extends) || (function () {
|
13972 | var extendStatics = function (d, b) {
|
13973 | extendStatics = Object.setPrototypeOf ||
|
13974 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13975 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
13976 | return extendStatics(d, b);
|
13977 | };
|
13978 | return function (d, b) {
|
13979 | extendStatics(d, b);
|
13980 | function __() { this.constructor = d; }
|
13981 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13982 | };
|
13983 | })();
|
13984 | var TextFloatingFilter = (function (_super) {
|
13985 | __extends$q(TextFloatingFilter, _super);
|
13986 | function TextFloatingFilter() {
|
13987 | return _super !== null && _super.apply(this, arguments) || this;
|
13988 | }
|
13989 | TextFloatingFilter.prototype.getDefaultFilterOptions = function () {
|
13990 | return TextFilter.DEFAULT_FILTER_OPTIONS;
|
13991 | };
|
13992 | return TextFloatingFilter;
|
13993 | }(TextInputFloatingFilter));
|
13994 |
|
13995 |
|
13996 |
|
13997 |
|
13998 |
|
13999 |
|
14000 |
|
14001 | var TouchListener = (function () {
|
14002 | function TouchListener(eElement, preventMouseClick) {
|
14003 | var _this = this;
|
14004 | if (preventMouseClick === void 0) { preventMouseClick = false; }
|
14005 | this.destroyFuncs = [];
|
14006 | this.touching = false;
|
14007 | this.eventService = new EventService();
|
14008 | this.eElement = eElement;
|
14009 | this.preventMouseClick = preventMouseClick;
|
14010 | var startListener = this.onTouchStart.bind(this);
|
14011 | var moveListener = this.onTouchMove.bind(this);
|
14012 | var endListener = this.onTouchEnd.bind(this);
|
14013 | this.eElement.addEventListener("touchstart", startListener, { passive: true });
|
14014 | this.eElement.addEventListener("touchmove", moveListener, { passive: true });
|
14015 |
|
14016 | this.eElement.addEventListener("touchend", endListener, { passive: false });
|
14017 | this.destroyFuncs.push(function () {
|
14018 | _this.eElement.removeEventListener("touchstart", startListener, { passive: true });
|
14019 | _this.eElement.removeEventListener("touchmove", moveListener, { passive: true });
|
14020 | _this.eElement.removeEventListener("touchend", endListener, { passive: false });
|
14021 | });
|
14022 | }
|
14023 | TouchListener.prototype.getActiveTouch = function (touchList) {
|
14024 | for (var i = 0; i < touchList.length; i++) {
|
14025 | var matches = touchList[i].identifier === this.touchStart.identifier;
|
14026 | if (matches) {
|
14027 | return touchList[i];
|
14028 | }
|
14029 | }
|
14030 | return null;
|
14031 | };
|
14032 | TouchListener.prototype.addEventListener = function (eventType, listener) {
|
14033 | this.eventService.addEventListener(eventType, listener);
|
14034 | };
|
14035 | TouchListener.prototype.removeEventListener = function (eventType, listener) {
|
14036 | this.eventService.removeEventListener(eventType, listener);
|
14037 | };
|
14038 | TouchListener.prototype.onTouchStart = function (touchEvent) {
|
14039 | var _this = this;
|
14040 |
|
14041 | if (this.touching) {
|
14042 | return;
|
14043 | }
|
14044 | this.touchStart = touchEvent.touches[0];
|
14045 | this.touching = true;
|
14046 | this.moved = false;
|
14047 | var touchStartCopy = this.touchStart;
|
14048 | window.setTimeout(function () {
|
14049 | var touchesMatch = _this.touchStart === touchStartCopy;
|
14050 | if (_this.touching && touchesMatch && !_this.moved) {
|
14051 | _this.moved = true;
|
14052 | var event_1 = {
|
14053 | type: TouchListener.EVENT_LONG_TAP,
|
14054 | touchStart: _this.touchStart,
|
14055 | touchEvent: touchEvent
|
14056 | };
|
14057 | _this.eventService.dispatchEvent(event_1);
|
14058 | }
|
14059 | }, 500);
|
14060 | };
|
14061 | TouchListener.prototype.onTouchMove = function (touchEvent) {
|
14062 | if (!this.touching) {
|
14063 | return;
|
14064 | }
|
14065 | var touch = this.getActiveTouch(touchEvent.touches);
|
14066 | if (!touch) {
|
14067 | return;
|
14068 | }
|
14069 | var eventIsFarAway = !areEventsNear(touch, this.touchStart, 4);
|
14070 | if (eventIsFarAway) {
|
14071 | this.moved = true;
|
14072 | }
|
14073 | };
|
14074 | TouchListener.prototype.onTouchEnd = function (touchEvent) {
|
14075 | if (!this.touching) {
|
14076 | return;
|
14077 | }
|
14078 | if (!this.moved) {
|
14079 | var event_2 = {
|
14080 | type: TouchListener.EVENT_TAP,
|
14081 | touchStart: this.touchStart
|
14082 | };
|
14083 | this.eventService.dispatchEvent(event_2);
|
14084 | this.checkForDoubleTap();
|
14085 | }
|
14086 |
|
14087 | if (this.preventMouseClick) {
|
14088 | touchEvent.preventDefault();
|
14089 | }
|
14090 | this.touching = false;
|
14091 | };
|
14092 | TouchListener.prototype.checkForDoubleTap = function () {
|
14093 | var now = new Date().getTime();
|
14094 | if (this.lastTapTime && this.lastTapTime > 0) {
|
14095 |
|
14096 | var interval = now - this.lastTapTime;
|
14097 | if (interval > TouchListener.DOUBLE_TAP_MILLIS) {
|
14098 |
|
14099 | var event_3 = {
|
14100 | type: TouchListener.EVENT_DOUBLE_TAP,
|
14101 | touchStart: this.touchStart
|
14102 | };
|
14103 | this.eventService.dispatchEvent(event_3);
|
14104 |
|
14105 | this.lastTapTime = null;
|
14106 | }
|
14107 | else {
|
14108 | this.lastTapTime = now;
|
14109 | }
|
14110 | }
|
14111 | else {
|
14112 | this.lastTapTime = now;
|
14113 | }
|
14114 | };
|
14115 | TouchListener.prototype.destroy = function () {
|
14116 | this.destroyFuncs.forEach(function (func) { return func(); });
|
14117 | };
|
14118 | TouchListener.EVENT_TAP = "tap";
|
14119 | TouchListener.EVENT_DOUBLE_TAP = "doubleTap";
|
14120 | TouchListener.EVENT_LONG_TAP = "longTap";
|
14121 | TouchListener.DOUBLE_TAP_MILLIS = 500;
|
14122 | return TouchListener;
|
14123 | }());
|
14124 |
|
14125 |
|
14126 |
|
14127 |
|
14128 |
|
14129 |
|
14130 |
|
14131 | var __extends$r = (undefined && undefined.__extends) || (function () {
|
14132 | var extendStatics = function (d, b) {
|
14133 | extendStatics = Object.setPrototypeOf ||
|
14134 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14135 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
14136 | return extendStatics(d, b);
|
14137 | };
|
14138 | return function (d, b) {
|
14139 | extendStatics(d, b);
|
14140 | function __() { this.constructor = d; }
|
14141 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14142 | };
|
14143 | })();
|
14144 | var __decorate$q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
14145 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
14146 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
14147 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
14148 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
14149 | };
|
14150 | var HeaderComp = (function (_super) {
|
14151 | __extends$r(HeaderComp, _super);
|
14152 | function HeaderComp() {
|
14153 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
14154 | _this.lastMovingChanged = 0;
|
14155 | return _this;
|
14156 | }
|
14157 |
|
14158 |
|
14159 | HeaderComp.prototype.destroy = function () {
|
14160 | _super.prototype.destroy.call(this);
|
14161 | };
|
14162 | HeaderComp.prototype.refresh = function (params) {
|
14163 | this.params = params;
|
14164 |
|
14165 |
|
14166 | if (this.workOutTemplate() != this.currentTemplate) {
|
14167 | return false;
|
14168 | }
|
14169 | if (this.workOutShowMenu() != this.currentShowMenu) {
|
14170 | return false;
|
14171 | }
|
14172 | if (this.workOutSort() != this.currentSort) {
|
14173 | return false;
|
14174 | }
|
14175 | this.setDisplayName(params);
|
14176 | return true;
|
14177 | };
|
14178 | HeaderComp.prototype.workOutTemplate = function () {
|
14179 | var template = firstExistingValue(this.params.template, HeaderComp.TEMPLATE);
|
14180 |
|
14181 | template = template && template.trim ? template.trim() : template;
|
14182 | return template;
|
14183 | };
|
14184 | HeaderComp.prototype.init = function (params) {
|
14185 | this.params = params;
|
14186 | this.currentTemplate = this.workOutTemplate();
|
14187 | this.setTemplate(this.currentTemplate);
|
14188 | this.setupTap();
|
14189 | this.setupIcons(params.column);
|
14190 | this.setMenu();
|
14191 | this.setupSort();
|
14192 | this.setupFilterIcon();
|
14193 | this.setDisplayName(params);
|
14194 | };
|
14195 | HeaderComp.prototype.setDisplayName = function (params) {
|
14196 | if (this.currentDisplayName != params.displayName) {
|
14197 | this.currentDisplayName = params.displayName;
|
14198 | var displayNameSanitised = escapeString(this.currentDisplayName);
|
14199 | if (this.eText) {
|
14200 | this.eText.innerHTML = displayNameSanitised;
|
14201 | }
|
14202 | }
|
14203 | };
|
14204 | HeaderComp.prototype.setupIcons = function (column) {
|
14205 | this.addInIcon('sortAscending', this.eSortAsc, column);
|
14206 | this.addInIcon('sortDescending', this.eSortDesc, column);
|
14207 | this.addInIcon('sortUnSort', this.eSortNone, column);
|
14208 | this.addInIcon('menu', this.eMenu, column);
|
14209 | this.addInIcon('filter', this.eFilter, column);
|
14210 | };
|
14211 | HeaderComp.prototype.addInIcon = function (iconName, eParent, column) {
|
14212 | if (eParent == null) {
|
14213 | return;
|
14214 | }
|
14215 | var eIcon = createIconNoSpan(iconName, this.gridOptionsWrapper, column);
|
14216 | if (eIcon) {
|
14217 | eParent.appendChild(eIcon);
|
14218 | }
|
14219 | };
|
14220 | HeaderComp.prototype.setupTap = function () {
|
14221 | var _this = this;
|
14222 | var options = this.gridOptionsWrapper;
|
14223 | if (options.isSuppressTouch()) {
|
14224 | return;
|
14225 | }
|
14226 | var touchListener = new TouchListener(this.getGui(), true);
|
14227 | var suppressMenuHide = options.isSuppressMenuHide();
|
14228 | var tapMenuButton = suppressMenuHide && exists(this.eMenu);
|
14229 | var menuTouchListener = tapMenuButton ? new TouchListener(this.eMenu, true) : touchListener;
|
14230 | if (this.params.enableMenu) {
|
14231 | var eventType = tapMenuButton ? 'EVENT_TAP' : 'EVENT_LONG_TAP';
|
14232 | var showMenuFn = function (event) {
|
14233 | options.getApi().showColumnMenuAfterMouseClick(_this.params.column, event.touchStart);
|
14234 | };
|
14235 | this.addManagedListener(menuTouchListener, TouchListener[eventType], showMenuFn);
|
14236 | }
|
14237 | if (this.params.enableSorting) {
|
14238 | var tapListener = function (event) {
|
14239 | var target = event.touchStart.target;
|
14240 |
|
14241 |
|
14242 | if (suppressMenuHide && _this.eMenu.contains(target)) {
|
14243 | return;
|
14244 | }
|
14245 | _this.sortController.progressSort(_this.params.column, false, "uiColumnSorted");
|
14246 | };
|
14247 | this.addManagedListener(touchListener, TouchListener.EVENT_TAP, tapListener);
|
14248 | }
|
14249 |
|
14250 |
|
14251 | this.addDestroyFunc(function () { return touchListener.destroy(); });
|
14252 | if (tapMenuButton) {
|
14253 | this.addDestroyFunc(function () { return menuTouchListener.destroy(); });
|
14254 | }
|
14255 | };
|
14256 | HeaderComp.prototype.workOutShowMenu = function () {
|
14257 |
|
14258 |
|
14259 |
|
14260 |
|
14261 | var menuHides = !this.gridOptionsWrapper.isSuppressMenuHide();
|
14262 | var onIpadAndMenuHides = isIOSUserAgent() && menuHides;
|
14263 | var showMenu = this.params.enableMenu && !onIpadAndMenuHides;
|
14264 | return showMenu;
|
14265 | };
|
14266 | HeaderComp.prototype.setMenu = function () {
|
14267 | var _this = this;
|
14268 |
|
14269 | if (!this.eMenu) {
|
14270 | return;
|
14271 | }
|
14272 | this.currentShowMenu = this.workOutShowMenu();
|
14273 | if (!this.currentShowMenu) {
|
14274 | removeFromParent(this.eMenu);
|
14275 | return;
|
14276 | }
|
14277 | var suppressMenuHide = this.gridOptionsWrapper.isSuppressMenuHide();
|
14278 | this.addManagedListener(this.eMenu, 'click', function () { return _this.showMenu(_this.eMenu); });
|
14279 | this.eMenu.classList.toggle('ag-header-menu-always-show', suppressMenuHide);
|
14280 | };
|
14281 | HeaderComp.prototype.showMenu = function (eventSource) {
|
14282 | if (!eventSource) {
|
14283 | eventSource = this.eMenu;
|
14284 | }
|
14285 | this.menuFactory.showMenuAfterButtonClick(this.params.column, eventSource, 'columnMenu');
|
14286 | };
|
14287 | HeaderComp.prototype.removeSortIcons = function () {
|
14288 | removeFromParent(this.eSortAsc);
|
14289 | removeFromParent(this.eSortDesc);
|
14290 | removeFromParent(this.eSortNone);
|
14291 | removeFromParent(this.eSortOrder);
|
14292 | };
|
14293 | HeaderComp.prototype.workOutSort = function () {
|
14294 | return this.params.enableSorting;
|
14295 | };
|
14296 | HeaderComp.prototype.setupSort = function () {
|
14297 | var _this = this;
|
14298 | this.currentSort = this.params.enableSorting;
|
14299 | if (!this.currentSort) {
|
14300 | this.removeSortIcons();
|
14301 | return;
|
14302 | }
|
14303 | var sortUsingCtrl = this.gridOptionsWrapper.isMultiSortKeyCtrl();
|
14304 |
|
14305 | this.addManagedListener(this.params.column, Column.EVENT_MOVING_CHANGED, function () {
|
14306 | _this.lastMovingChanged = new Date().getTime();
|
14307 | });
|
14308 |
|
14309 | if (this.eLabel) {
|
14310 | this.addManagedListener(this.eLabel, 'click', function (event) {
|
14311 |
|
14312 |
|
14313 |
|
14314 | var moving = _this.params.column.isMoving();
|
14315 | var nowTime = new Date().getTime();
|
14316 |
|
14317 | var movedRecently = (nowTime - _this.lastMovingChanged) < 50;
|
14318 | var columnMoving = moving || movedRecently;
|
14319 | if (!columnMoving) {
|
14320 | var multiSort = sortUsingCtrl ? (event.ctrlKey || event.metaKey) : event.shiftKey;
|
14321 | _this.params.progressSort(multiSort);
|
14322 | }
|
14323 | });
|
14324 | }
|
14325 | this.addManagedListener(this.params.column, Column.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
|
14326 | this.onSortChanged();
|
14327 | this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.setMultiSortOrder.bind(this));
|
14328 | this.setMultiSortOrder();
|
14329 | };
|
14330 | HeaderComp.prototype.onSortChanged = function () {
|
14331 | this.addOrRemoveCssClass('ag-header-cell-sorted-asc', this.params.column.isSortAscending());
|
14332 | this.addOrRemoveCssClass('ag-header-cell-sorted-desc', this.params.column.isSortDescending());
|
14333 | this.addOrRemoveCssClass('ag-header-cell-sorted-none', this.params.column.isSortNone());
|
14334 | if (this.eSortAsc) {
|
14335 | this.eSortAsc.classList.toggle('ag-hidden', !this.params.column.isSortAscending());
|
14336 | }
|
14337 | if (this.eSortDesc) {
|
14338 | this.eSortDesc.classList.toggle('ag-hidden', !this.params.column.isSortDescending());
|
14339 | }
|
14340 | if (this.eSortNone) {
|
14341 | var alwaysHideNoSort = !this.params.column.getColDef().unSortIcon && !this.gridOptionsWrapper.isUnSortIcon();
|
14342 | this.eSortNone.classList.toggle('ag-hidden', alwaysHideNoSort || !this.params.column.isSortNone());
|
14343 | }
|
14344 | };
|
14345 |
|
14346 |
|
14347 |
|
14348 | HeaderComp.prototype.setMultiSortOrder = function () {
|
14349 | if (!this.eSortOrder) {
|
14350 | return;
|
14351 | }
|
14352 | var col = this.params.column;
|
14353 | var allColumnsWithSorting = this.sortController.getColumnsWithSortingOrdered();
|
14354 | var indexThisCol = allColumnsWithSorting.indexOf(col);
|
14355 | var moreThanOneColSorting = allColumnsWithSorting.length > 1;
|
14356 | var showIndex = col.isSorting() && moreThanOneColSorting;
|
14357 | setDisplayed(this.eSortOrder, showIndex);
|
14358 | if (indexThisCol >= 0) {
|
14359 | this.eSortOrder.innerHTML = (indexThisCol + 1).toString();
|
14360 | }
|
14361 | else {
|
14362 | clearElement(this.eSortOrder);
|
14363 | }
|
14364 | };
|
14365 | HeaderComp.prototype.setupFilterIcon = function () {
|
14366 | if (!this.eFilter) {
|
14367 | return;
|
14368 | }
|
14369 | this.addManagedListener(this.params.column, Column.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
|
14370 | this.onFilterChanged();
|
14371 | };
|
14372 | HeaderComp.prototype.onFilterChanged = function () {
|
14373 | var filterPresent = this.params.column.isFilterActive();
|
14374 | this.eFilter.classList.toggle('ag-hidden', !filterPresent);
|
14375 | };
|
14376 | 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>";
|
14377 | __decorate$q([
|
14378 | Autowired('sortController')
|
14379 | ], HeaderComp.prototype, "sortController", void 0);
|
14380 | __decorate$q([
|
14381 | Autowired('menuFactory')
|
14382 | ], HeaderComp.prototype, "menuFactory", void 0);
|
14383 | __decorate$q([
|
14384 | RefSelector('eFilter')
|
14385 | ], HeaderComp.prototype, "eFilter", void 0);
|
14386 | __decorate$q([
|
14387 | RefSelector('eSortAsc')
|
14388 | ], HeaderComp.prototype, "eSortAsc", void 0);
|
14389 | __decorate$q([
|
14390 | RefSelector('eSortDesc')
|
14391 | ], HeaderComp.prototype, "eSortDesc", void 0);
|
14392 | __decorate$q([
|
14393 | RefSelector('eSortNone')
|
14394 | ], HeaderComp.prototype, "eSortNone", void 0);
|
14395 | __decorate$q([
|
14396 | RefSelector('eSortOrder')
|
14397 | ], HeaderComp.prototype, "eSortOrder", void 0);
|
14398 | __decorate$q([
|
14399 | RefSelector('eMenu')
|
14400 | ], HeaderComp.prototype, "eMenu", void 0);
|
14401 | __decorate$q([
|
14402 | RefSelector('eLabel')
|
14403 | ], HeaderComp.prototype, "eLabel", void 0);
|
14404 | __decorate$q([
|
14405 | RefSelector('eText')
|
14406 | ], HeaderComp.prototype, "eText", void 0);
|
14407 | return HeaderComp;
|
14408 | }(Component));
|
14409 |
|
14410 |
|
14411 |
|
14412 |
|
14413 |
|
14414 |
|
14415 |
|
14416 | var __extends$s = (undefined && undefined.__extends) || (function () {
|
14417 | var extendStatics = function (d, b) {
|
14418 | extendStatics = Object.setPrototypeOf ||
|
14419 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14420 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
14421 | return extendStatics(d, b);
|
14422 | };
|
14423 | return function (d, b) {
|
14424 | extendStatics(d, b);
|
14425 | function __() { this.constructor = d; }
|
14426 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14427 | };
|
14428 | })();
|
14429 | var __decorate$r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
14430 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
14431 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
14432 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
14433 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
14434 | };
|
14435 | var HeaderGroupComp = (function (_super) {
|
14436 | __extends$s(HeaderGroupComp, _super);
|
14437 | function HeaderGroupComp() {
|
14438 | return _super.call(this, HeaderGroupComp.TEMPLATE) || this;
|
14439 | }
|
14440 |
|
14441 |
|
14442 | HeaderGroupComp.prototype.destroy = function () {
|
14443 | _super.prototype.destroy.call(this);
|
14444 | };
|
14445 | HeaderGroupComp.prototype.init = function (params) {
|
14446 | this.params = params;
|
14447 | this.checkWarnings();
|
14448 | this.setupLabel();
|
14449 | this.addGroupExpandIcon();
|
14450 | this.setupExpandIcons();
|
14451 | };
|
14452 | HeaderGroupComp.prototype.checkWarnings = function () {
|
14453 | var paramsAny = this.params;
|
14454 | if (paramsAny.template) {
|
14455 | var message_1 = "AG Grid: A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)";
|
14456 | doOnce(function () { return console.warn(message_1); }, 'HeaderGroupComp.templateNotSupported');
|
14457 | }
|
14458 | };
|
14459 | HeaderGroupComp.prototype.setupExpandIcons = function () {
|
14460 | var _this = this;
|
14461 | this.addInIcon("columnGroupOpened", "agOpened");
|
14462 | this.addInIcon("columnGroupClosed", "agClosed");
|
14463 | var expandAction = function (event) {
|
14464 | if (isStopPropagationForAgGrid(event)) {
|
14465 | return;
|
14466 | }
|
14467 | var newExpandedValue = !_this.params.columnGroup.isExpanded();
|
14468 | _this.columnModel.setColumnGroupOpened(_this.params.columnGroup.getProvidedColumnGroup(), newExpandedValue, "uiColumnExpanded");
|
14469 | };
|
14470 | this.addTouchAndClickListeners(this.eCloseIcon, expandAction);
|
14471 | this.addTouchAndClickListeners(this.eOpenIcon, expandAction);
|
14472 | var stopPropagationAction = function (event) {
|
14473 | stopPropagationForAgGrid(event);
|
14474 | };
|
14475 |
|
14476 |
|
14477 |
|
14478 |
|
14479 |
|
14480 | this.addManagedListener(this.eCloseIcon, "dblclick", stopPropagationAction);
|
14481 | this.addManagedListener(this.eOpenIcon, "dblclick", stopPropagationAction);
|
14482 | this.addManagedListener(this.getGui(), "dblclick", expandAction);
|
14483 | this.updateIconVisibility();
|
14484 | var providedColumnGroup = this.params.columnGroup.getProvidedColumnGroup();
|
14485 | this.addManagedListener(providedColumnGroup, ProvidedColumnGroup.EVENT_EXPANDED_CHANGED, this.updateIconVisibility.bind(this));
|
14486 | this.addManagedListener(providedColumnGroup, ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED, this.updateIconVisibility.bind(this));
|
14487 | };
|
14488 | HeaderGroupComp.prototype.addTouchAndClickListeners = function (eElement, action) {
|
14489 | var touchListener = new TouchListener(eElement, true);
|
14490 | this.addManagedListener(touchListener, TouchListener.EVENT_TAP, action);
|
14491 | this.addDestroyFunc(function () { return touchListener.destroy(); });
|
14492 | this.addManagedListener(eElement, "click", action);
|
14493 | };
|
14494 | HeaderGroupComp.prototype.updateIconVisibility = function () {
|
14495 | var columnGroup = this.params.columnGroup;
|
14496 | if (columnGroup.isExpandable()) {
|
14497 | var expanded = this.params.columnGroup.isExpanded();
|
14498 | setDisplayed(this.eOpenIcon, expanded);
|
14499 | setDisplayed(this.eCloseIcon, !expanded);
|
14500 | }
|
14501 | else {
|
14502 | setDisplayed(this.eOpenIcon, false);
|
14503 | setDisplayed(this.eCloseIcon, false);
|
14504 | }
|
14505 | };
|
14506 | HeaderGroupComp.prototype.addInIcon = function (iconName, refName) {
|
14507 | var eIcon = createIconNoSpan(iconName, this.gridOptionsWrapper, null);
|
14508 | if (eIcon) {
|
14509 | this.getRefElement(refName).appendChild(eIcon);
|
14510 | }
|
14511 | };
|
14512 | HeaderGroupComp.prototype.addGroupExpandIcon = function () {
|
14513 | if (!this.params.columnGroup.isExpandable()) {
|
14514 | setDisplayed(this.eOpenIcon, false);
|
14515 | setDisplayed(this.eCloseIcon, false);
|
14516 | return;
|
14517 | }
|
14518 | };
|
14519 | HeaderGroupComp.prototype.setupLabel = function () {
|
14520 |
|
14521 | var displayName = this.params.displayName;
|
14522 | if (exists(displayName)) {
|
14523 | var displayNameSanitised = escapeString(displayName);
|
14524 | this.getRefElement('agLabel').innerHTML = displayNameSanitised;
|
14525 | }
|
14526 | };
|
14527 | 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>";
|
14528 | __decorate$r([
|
14529 | Autowired("columnModel")
|
14530 | ], HeaderGroupComp.prototype, "columnModel", void 0);
|
14531 | __decorate$r([
|
14532 | RefSelector("agOpened")
|
14533 | ], HeaderGroupComp.prototype, "eOpenIcon", void 0);
|
14534 | __decorate$r([
|
14535 | RefSelector("agClosed")
|
14536 | ], HeaderGroupComp.prototype, "eCloseIcon", void 0);
|
14537 | return HeaderGroupComp;
|
14538 | }(Component));
|
14539 |
|
14540 |
|
14541 |
|
14542 |
|
14543 |
|
14544 |
|
14545 |
|
14546 | var __extends$t = (undefined && undefined.__extends) || (function () {
|
14547 | var extendStatics = function (d, b) {
|
14548 | extendStatics = Object.setPrototypeOf ||
|
14549 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14550 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
14551 | return extendStatics(d, b);
|
14552 | };
|
14553 | return function (d, b) {
|
14554 | extendStatics(d, b);
|
14555 | function __() { this.constructor = d; }
|
14556 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14557 | };
|
14558 | })();
|
14559 | var PopupComponent = (function (_super) {
|
14560 | __extends$t(PopupComponent, _super);
|
14561 | function PopupComponent() {
|
14562 | return _super !== null && _super.apply(this, arguments) || this;
|
14563 | }
|
14564 | PopupComponent.prototype.isPopup = function () {
|
14565 | return true;
|
14566 | };
|
14567 | PopupComponent.prototype.setParentComponent = function (container) {
|
14568 | container.addCssClass('ag-has-popup');
|
14569 | _super.prototype.setParentComponent.call(this, container);
|
14570 | };
|
14571 | PopupComponent.prototype.destroy = function () {
|
14572 | var parentComp = this.parentComponent;
|
14573 | var hasParent = parentComp && parentComp.isAlive();
|
14574 | if (hasParent) {
|
14575 | parentComp.getGui().classList.remove('ag-has-popup');
|
14576 | }
|
14577 | _super.prototype.destroy.call(this);
|
14578 | };
|
14579 | return PopupComponent;
|
14580 | }(Component));
|
14581 |
|
14582 |
|
14583 |
|
14584 |
|
14585 |
|
14586 |
|
14587 |
|
14588 | var __extends$u = (undefined && undefined.__extends) || (function () {
|
14589 | var extendStatics = function (d, b) {
|
14590 | extendStatics = Object.setPrototypeOf ||
|
14591 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14592 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
14593 | return extendStatics(d, b);
|
14594 | };
|
14595 | return function (d, b) {
|
14596 | extendStatics(d, b);
|
14597 | function __() { this.constructor = d; }
|
14598 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14599 | };
|
14600 | })();
|
14601 | var __decorate$s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
14602 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
14603 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
14604 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
14605 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
14606 | };
|
14607 | var LargeTextCellEditor = (function (_super) {
|
14608 | __extends$u(LargeTextCellEditor, _super);
|
14609 | function LargeTextCellEditor() {
|
14610 | return _super.call(this, LargeTextCellEditor.TEMPLATE) || this;
|
14611 | }
|
14612 | LargeTextCellEditor.prototype.init = function (params) {
|
14613 | this.params = params;
|
14614 | this.focusAfterAttached = params.cellStartedEdit;
|
14615 | this.eTextArea
|
14616 | .setMaxLength(params.maxLength || 200)
|
14617 | .setCols(params.cols || 60)
|
14618 | .setRows(params.rows || 10);
|
14619 | if (exists(params.value)) {
|
14620 | this.eTextArea.setValue(params.value.toString(), true);
|
14621 | }
|
14622 | this.addGuiEventListener('keydown', this.onKeyDown.bind(this));
|
14623 | };
|
14624 | LargeTextCellEditor.prototype.onKeyDown = function (event) {
|
14625 | var key = event.key;
|
14626 | if (key === KeyCode.LEFT ||
|
14627 | key === KeyCode.UP ||
|
14628 | key === KeyCode.RIGHT ||
|
14629 | key === KeyCode.DOWN ||
|
14630 | (event.shiftKey && key === KeyCode.ENTER)) {
|
14631 | event.stopPropagation();
|
14632 | }
|
14633 | };
|
14634 | LargeTextCellEditor.prototype.afterGuiAttached = function () {
|
14635 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
14636 | this.eTextArea.setInputAriaLabel(translate('ariaInputEditor', 'Input Editor'));
|
14637 | if (this.focusAfterAttached) {
|
14638 | this.eTextArea.getFocusableElement().focus();
|
14639 | }
|
14640 | };
|
14641 | LargeTextCellEditor.prototype.getValue = function () {
|
14642 | return this.params.parseValue(this.eTextArea.getValue());
|
14643 | };
|
14644 | 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>";
|
14645 | __decorate$s([
|
14646 | RefSelector("eTextArea")
|
14647 | ], LargeTextCellEditor.prototype, "eTextArea", void 0);
|
14648 | return LargeTextCellEditor;
|
14649 | }(PopupComponent));
|
14650 |
|
14651 |
|
14652 |
|
14653 |
|
14654 |
|
14655 |
|
14656 |
|
14657 | var __extends$v = (undefined && undefined.__extends) || (function () {
|
14658 | var extendStatics = function (d, b) {
|
14659 | extendStatics = Object.setPrototypeOf ||
|
14660 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14661 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
14662 | return extendStatics(d, b);
|
14663 | };
|
14664 | return function (d, b) {
|
14665 | extendStatics(d, b);
|
14666 | function __() { this.constructor = d; }
|
14667 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14668 | };
|
14669 | })();
|
14670 | var __decorate$t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
14671 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
14672 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
14673 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
14674 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
14675 | };
|
14676 | var SelectCellEditor = (function (_super) {
|
14677 | __extends$v(SelectCellEditor, _super);
|
14678 | function SelectCellEditor() {
|
14679 | var _this = _super.call(this, '<div class="ag-cell-edit-wrapper"><ag-select class="ag-cell-editor" ref="eSelect"></ag-select></div>') || this;
|
14680 | _this.startedByEnter = false;
|
14681 | return _this;
|
14682 | }
|
14683 | SelectCellEditor.prototype.init = function (params) {
|
14684 | var _this = this;
|
14685 | this.focusAfterAttached = params.cellStartedEdit;
|
14686 | if (missing(params.values)) {
|
14687 | console.warn('AG Grid: no values found for select cellEditor');
|
14688 | return;
|
14689 | }
|
14690 | this.startedByEnter = params.eventKey != null ? params.eventKey === KeyCode.ENTER : false;
|
14691 | var hasValue = false;
|
14692 | params.values.forEach(function (value) {
|
14693 | var option = { value: value };
|
14694 | var valueFormatted = _this.valueFormatterService.formatValue(params.column, null, null, value);
|
14695 | var valueFormattedExits = valueFormatted !== null && valueFormatted !== undefined;
|
14696 | option.text = valueFormattedExits ? valueFormatted : value;
|
14697 | _this.eSelect.addOption(option);
|
14698 | hasValue = hasValue || params.value === value;
|
14699 | });
|
14700 | if (hasValue) {
|
14701 | this.eSelect.setValue(params.value, true);
|
14702 | }
|
14703 | else if (params.values.length) {
|
14704 | this.eSelect.setValue(params.values[0], true);
|
14705 | }
|
14706 |
|
14707 |
|
14708 | if (!this.gridOptionsWrapper.isFullRowEdit()) {
|
14709 | this.eSelect.onValueChange(function () { return params.stopEditing(); });
|
14710 | }
|
14711 | };
|
14712 | SelectCellEditor.prototype.afterGuiAttached = function () {
|
14713 | if (this.focusAfterAttached) {
|
14714 | this.eSelect.getFocusableElement().focus();
|
14715 | }
|
14716 | if (this.startedByEnter) {
|
14717 | this.eSelect.showPicker();
|
14718 | }
|
14719 | };
|
14720 | SelectCellEditor.prototype.focusIn = function () {
|
14721 | this.eSelect.getFocusableElement().focus();
|
14722 | };
|
14723 | SelectCellEditor.prototype.getValue = function () {
|
14724 | return this.eSelect.getValue();
|
14725 | };
|
14726 | SelectCellEditor.prototype.isPopup = function () {
|
14727 | return false;
|
14728 | };
|
14729 | __decorate$t([
|
14730 | Autowired('valueFormatterService')
|
14731 | ], SelectCellEditor.prototype, "valueFormatterService", void 0);
|
14732 | __decorate$t([
|
14733 | RefSelector('eSelect')
|
14734 | ], SelectCellEditor.prototype, "eSelect", void 0);
|
14735 | return SelectCellEditor;
|
14736 | }(PopupComponent));
|
14737 |
|
14738 |
|
14739 |
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 | var __extends$w = (undefined && undefined.__extends) || (function () {
|
14745 | var extendStatics = function (d, b) {
|
14746 | extendStatics = Object.setPrototypeOf ||
|
14747 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14748 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
14749 | return extendStatics(d, b);
|
14750 | };
|
14751 | return function (d, b) {
|
14752 | extendStatics(d, b);
|
14753 | function __() { this.constructor = d; }
|
14754 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14755 | };
|
14756 | })();
|
14757 | var PopupSelectCellEditor = (function (_super) {
|
14758 | __extends$w(PopupSelectCellEditor, _super);
|
14759 | function PopupSelectCellEditor() {
|
14760 | var _this = _super.call(this) || this;
|
14761 | doOnce(function () { return console.warn('AG Grid: The PopupSelectCellEditor (agPopupSelectCellEditor) is deprecated. Instead use {cellEditor: "agSelectCellEditor", cellEditorPopup: true} '); }, 'PopupSelectCellEditor.deprecated');
|
14762 | return _this;
|
14763 | }
|
14764 | PopupSelectCellEditor.prototype.isPopup = function () {
|
14765 | return true;
|
14766 | };
|
14767 | return PopupSelectCellEditor;
|
14768 | }(SelectCellEditor));
|
14769 |
|
14770 |
|
14771 |
|
14772 |
|
14773 |
|
14774 |
|
14775 |
|
14776 | var __extends$x = (undefined && undefined.__extends) || (function () {
|
14777 | var extendStatics = function (d, b) {
|
14778 | extendStatics = Object.setPrototypeOf ||
|
14779 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14780 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
14781 | return extendStatics(d, b);
|
14782 | };
|
14783 | return function (d, b) {
|
14784 | extendStatics(d, b);
|
14785 | function __() { this.constructor = d; }
|
14786 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14787 | };
|
14788 | })();
|
14789 | var __decorate$u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
14790 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
14791 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
14792 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
14793 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
14794 | };
|
14795 | var TextCellEditor = (function (_super) {
|
14796 | __extends$x(TextCellEditor, _super);
|
14797 | function TextCellEditor() {
|
14798 | return _super.call(this, TextCellEditor.TEMPLATE) || this;
|
14799 | }
|
14800 | TextCellEditor.prototype.init = function (params) {
|
14801 | this.params = params;
|
14802 | var eInput = this.eInput;
|
14803 | var startValue;
|
14804 |
|
14805 | if (params.cellStartedEdit) {
|
14806 | this.focusAfterAttached = true;
|
14807 | if (params.eventKey === KeyCode.BACKSPACE || params.eventKey === KeyCode.DELETE) {
|
14808 | startValue = '';
|
14809 | }
|
14810 | else if (params.charPress) {
|
14811 | startValue = params.charPress;
|
14812 | }
|
14813 | else {
|
14814 | startValue = this.getStartValue(params);
|
14815 | if (params.eventKey !== KeyCode.F2) {
|
14816 | this.highlightAllOnFocus = true;
|
14817 | }
|
14818 | }
|
14819 | }
|
14820 | else {
|
14821 | this.focusAfterAttached = false;
|
14822 | startValue = this.getStartValue(params);
|
14823 | }
|
14824 | if (startValue != null) {
|
14825 | eInput.setValue(startValue, true);
|
14826 | }
|
14827 | this.addManagedListener(eInput.getGui(), 'keydown', function (event) {
|
14828 | var key = event.key;
|
14829 | if (key === KeyCode.PAGE_UP || key === KeyCode.PAGE_DOWN) {
|
14830 | event.preventDefault();
|
14831 | }
|
14832 | });
|
14833 | };
|
14834 | TextCellEditor.prototype.afterGuiAttached = function () {
|
14835 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
14836 | var eInput = this.eInput;
|
14837 | eInput.setInputAriaLabel(translate('ariaInputEditor', 'Input Editor'));
|
14838 | if (!this.focusAfterAttached) {
|
14839 | return;
|
14840 | }
|
14841 |
|
14842 |
|
14843 |
|
14844 | if (!isBrowserSafari()) {
|
14845 | eInput.getFocusableElement().focus();
|
14846 | }
|
14847 | var inputEl = eInput.getInputElement();
|
14848 | if (this.highlightAllOnFocus) {
|
14849 | inputEl.select();
|
14850 | }
|
14851 | else {
|
14852 |
|
14853 |
|
14854 |
|
14855 |
|
14856 | var value = eInput.getValue();
|
14857 | var len = (exists(value) && value.length) || 0;
|
14858 | if (len) {
|
14859 | inputEl.setSelectionRange(len, len);
|
14860 | }
|
14861 | }
|
14862 | };
|
14863 |
|
14864 | TextCellEditor.prototype.focusIn = function () {
|
14865 | var eInput = this.eInput;
|
14866 | var focusEl = eInput.getFocusableElement();
|
14867 | var inputEl = eInput.getInputElement();
|
14868 | focusEl.focus();
|
14869 | inputEl.select();
|
14870 | };
|
14871 | TextCellEditor.prototype.getValue = function () {
|
14872 | var eInput = this.eInput;
|
14873 | return this.params.parseValue(eInput.getValue());
|
14874 | };
|
14875 | TextCellEditor.prototype.getStartValue = function (params) {
|
14876 | var formatValue = params.useFormatter || params.column.getColDef().refData;
|
14877 | return formatValue ? params.formatValue(params.value) : params.value;
|
14878 | };
|
14879 | TextCellEditor.prototype.isPopup = function () {
|
14880 | return false;
|
14881 | };
|
14882 | TextCellEditor.TEMPLATE = '<div class="ag-cell-edit-wrapper"><ag-input-text-field class="ag-cell-editor" ref="eInput"></ag-input-text-field></div>';
|
14883 | __decorate$u([
|
14884 | RefSelector('eInput')
|
14885 | ], TextCellEditor.prototype, "eInput", void 0);
|
14886 | return TextCellEditor;
|
14887 | }(PopupComponent));
|
14888 |
|
14889 |
|
14890 |
|
14891 |
|
14892 |
|
14893 |
|
14894 |
|
14895 | var __extends$y = (undefined && undefined.__extends) || (function () {
|
14896 | var extendStatics = function (d, b) {
|
14897 | extendStatics = Object.setPrototypeOf ||
|
14898 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14899 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
14900 | return extendStatics(d, b);
|
14901 | };
|
14902 | return function (d, b) {
|
14903 | extendStatics(d, b);
|
14904 | function __() { this.constructor = d; }
|
14905 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14906 | };
|
14907 | })();
|
14908 | var PopupTextCellEditor = (function (_super) {
|
14909 | __extends$y(PopupTextCellEditor, _super);
|
14910 | function PopupTextCellEditor() {
|
14911 | var _this = _super.call(this) || this;
|
14912 | doOnce(function () { return console.warn('AG Grid: The PopupTextCellEditor (agPopupTextCellEditor) is deprecated. Instead use {cellEditor: "agTextCellEditor", cellEditorPopup: true} '); }, 'PopupTextCellEditor.deprecated');
|
14913 | return _this;
|
14914 | }
|
14915 | PopupTextCellEditor.prototype.isPopup = function () {
|
14916 | return true;
|
14917 | };
|
14918 | return PopupTextCellEditor;
|
14919 | }(TextCellEditor));
|
14920 |
|
14921 |
|
14922 |
|
14923 |
|
14924 |
|
14925 |
|
14926 |
|
14927 | var __extends$z = (undefined && undefined.__extends) || (function () {
|
14928 | var extendStatics = function (d, b) {
|
14929 | extendStatics = Object.setPrototypeOf ||
|
14930 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14931 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
14932 | return extendStatics(d, b);
|
14933 | };
|
14934 | return function (d, b) {
|
14935 | extendStatics(d, b);
|
14936 | function __() { this.constructor = d; }
|
14937 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14938 | };
|
14939 | })();
|
14940 | var __decorate$v = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
14941 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
14942 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
14943 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
14944 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
14945 | };
|
14946 | var ARROW_UP = '\u2191';
|
14947 | var ARROW_DOWN = '\u2193';
|
14948 | var AnimateShowChangeCellRenderer = (function (_super) {
|
14949 | __extends$z(AnimateShowChangeCellRenderer, _super);
|
14950 | function AnimateShowChangeCellRenderer() {
|
14951 | var _this = _super.call(this, AnimateShowChangeCellRenderer.TEMPLATE) || this;
|
14952 | _this.refreshCount = 0;
|
14953 | return _this;
|
14954 | }
|
14955 | AnimateShowChangeCellRenderer.prototype.init = function (params) {
|
14956 |
|
14957 | this.eValue = this.queryForHtmlElement('.ag-value-change-value');
|
14958 | this.eDelta = this.queryForHtmlElement('.ag-value-change-delta');
|
14959 | this.refresh(params);
|
14960 | };
|
14961 | AnimateShowChangeCellRenderer.prototype.showDelta = function (params, delta) {
|
14962 | var absDelta = Math.abs(delta);
|
14963 | var valueFormatted = params.formatValue(absDelta);
|
14964 | var valueToUse = exists(valueFormatted) ? valueFormatted : absDelta;
|
14965 | var deltaUp = (delta >= 0);
|
14966 | if (deltaUp) {
|
14967 | this.eDelta.innerHTML = ARROW_UP + valueToUse;
|
14968 | }
|
14969 | else {
|
14970 |
|
14971 | this.eDelta.innerHTML = ARROW_DOWN + valueToUse;
|
14972 | }
|
14973 | this.eDelta.classList.toggle('ag-value-change-delta-up', deltaUp);
|
14974 | this.eDelta.classList.toggle('ag-value-change-delta-down', !deltaUp);
|
14975 | };
|
14976 | AnimateShowChangeCellRenderer.prototype.setTimerToRemoveDelta = function () {
|
14977 | var _this = this;
|
14978 |
|
14979 |
|
14980 |
|
14981 | this.refreshCount++;
|
14982 | var refreshCountCopy = this.refreshCount;
|
14983 | window.setTimeout(function () {
|
14984 | if (refreshCountCopy === _this.refreshCount) {
|
14985 | _this.hideDeltaValue();
|
14986 | }
|
14987 | }, 2000);
|
14988 | };
|
14989 | AnimateShowChangeCellRenderer.prototype.hideDeltaValue = function () {
|
14990 | this.eValue.classList.remove('ag-value-change-value-highlight');
|
14991 | clearElement(this.eDelta);
|
14992 | };
|
14993 | AnimateShowChangeCellRenderer.prototype.refresh = function (params) {
|
14994 | var value = params.value;
|
14995 | if (value === this.lastValue) {
|
14996 | return false;
|
14997 | }
|
14998 | if (exists(params.valueFormatted)) {
|
14999 | this.eValue.innerHTML = params.valueFormatted;
|
15000 | }
|
15001 | else if (exists(params.value)) {
|
15002 | this.eValue.innerHTML = value;
|
15003 | }
|
15004 | else {
|
15005 | clearElement(this.eValue);
|
15006 | }
|
15007 |
|
15008 |
|
15009 | if (this.filterManager.isSuppressFlashingCellsBecauseFiltering()) {
|
15010 | return false;
|
15011 | }
|
15012 | if (typeof value === 'number' && typeof this.lastValue === 'number') {
|
15013 | var delta = value - this.lastValue;
|
15014 | this.showDelta(params, delta);
|
15015 | }
|
15016 |
|
15017 |
|
15018 | if (this.lastValue) {
|
15019 | this.eValue.classList.add('ag-value-change-value-highlight');
|
15020 | }
|
15021 | this.setTimerToRemoveDelta();
|
15022 | this.lastValue = value;
|
15023 | return true;
|
15024 | };
|
15025 | AnimateShowChangeCellRenderer.TEMPLATE = '<span>' +
|
15026 | '<span class="ag-value-change-delta"></span>' +
|
15027 | '<span class="ag-value-change-value"></span>' +
|
15028 | '</span>';
|
15029 | __decorate$v([
|
15030 | Autowired('filterManager')
|
15031 | ], AnimateShowChangeCellRenderer.prototype, "filterManager", void 0);
|
15032 | return AnimateShowChangeCellRenderer;
|
15033 | }(Component));
|
15034 |
|
15035 |
|
15036 |
|
15037 |
|
15038 |
|
15039 |
|
15040 |
|
15041 | var __extends$A = (undefined && undefined.__extends) || (function () {
|
15042 | var extendStatics = function (d, b) {
|
15043 | extendStatics = Object.setPrototypeOf ||
|
15044 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
15045 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
15046 | return extendStatics(d, b);
|
15047 | };
|
15048 | return function (d, b) {
|
15049 | extendStatics(d, b);
|
15050 | function __() { this.constructor = d; }
|
15051 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15052 | };
|
15053 | })();
|
15054 | var __decorate$w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
15055 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
15056 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
15057 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
15058 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
15059 | };
|
15060 | var AnimateSlideCellRenderer = (function (_super) {
|
15061 | __extends$A(AnimateSlideCellRenderer, _super);
|
15062 | function AnimateSlideCellRenderer() {
|
15063 | var _this = _super.call(this, AnimateSlideCellRenderer.TEMPLATE) || this;
|
15064 | _this.refreshCount = 0;
|
15065 | _this.eCurrent = _this.queryForHtmlElement('.ag-value-slide-current');
|
15066 | return _this;
|
15067 | }
|
15068 | AnimateSlideCellRenderer.prototype.init = function (params) {
|
15069 | this.refresh(params);
|
15070 | };
|
15071 | AnimateSlideCellRenderer.prototype.addSlideAnimation = function () {
|
15072 | var _this = this;
|
15073 | this.refreshCount++;
|
15074 |
|
15075 |
|
15076 |
|
15077 | var refreshCountCopy = this.refreshCount;
|
15078 |
|
15079 | if (this.ePrevious) {
|
15080 | this.getGui().removeChild(this.ePrevious);
|
15081 | }
|
15082 | this.ePrevious = loadTemplate('<span class="ag-value-slide-previous ag-value-slide-out"></span>');
|
15083 | this.ePrevious.innerHTML = this.eCurrent.innerHTML;
|
15084 | this.getGui().insertBefore(this.ePrevious, this.eCurrent);
|
15085 |
|
15086 |
|
15087 |
|
15088 | window.setTimeout(function () {
|
15089 | if (refreshCountCopy !== _this.refreshCount) {
|
15090 | return;
|
15091 | }
|
15092 | _this.ePrevious.classList.add('ag-value-slide-out-end');
|
15093 | }, 50);
|
15094 | window.setTimeout(function () {
|
15095 | if (refreshCountCopy !== _this.refreshCount) {
|
15096 | return;
|
15097 | }
|
15098 | _this.getGui().removeChild(_this.ePrevious);
|
15099 | _this.ePrevious = null;
|
15100 | }, 3000);
|
15101 | };
|
15102 | AnimateSlideCellRenderer.prototype.refresh = function (params) {
|
15103 | var value = params.value;
|
15104 | if (missing(value)) {
|
15105 | value = '';
|
15106 | }
|
15107 | if (value === this.lastValue) {
|
15108 | return false;
|
15109 | }
|
15110 |
|
15111 |
|
15112 | if (this.filterManager.isSuppressFlashingCellsBecauseFiltering()) {
|
15113 | return false;
|
15114 | }
|
15115 | this.addSlideAnimation();
|
15116 | this.lastValue = value;
|
15117 | if (exists(params.valueFormatted)) {
|
15118 | this.eCurrent.innerHTML = params.valueFormatted;
|
15119 | }
|
15120 | else if (exists(params.value)) {
|
15121 | this.eCurrent.innerHTML = value;
|
15122 | }
|
15123 | else {
|
15124 | clearElement(this.eCurrent);
|
15125 | }
|
15126 | return true;
|
15127 | };
|
15128 | AnimateSlideCellRenderer.TEMPLATE = "<span>\n <span class=\"ag-value-slide-current\"></span>\n </span>";
|
15129 | __decorate$w([
|
15130 | Autowired('filterManager')
|
15131 | ], AnimateSlideCellRenderer.prototype, "filterManager", void 0);
|
15132 | return AnimateSlideCellRenderer;
|
15133 | }(Component));
|
15134 |
|
15135 |
|
15136 |
|
15137 |
|
15138 |
|
15139 |
|
15140 |
|
15141 | var RowHighlightPosition;
|
15142 | (function (RowHighlightPosition) {
|
15143 | RowHighlightPosition[RowHighlightPosition["Above"] = 0] = "Above";
|
15144 | RowHighlightPosition[RowHighlightPosition["Below"] = 1] = "Below";
|
15145 | })(RowHighlightPosition || (RowHighlightPosition = {}));
|
15146 | var RowNode = (function () {
|
15147 | function RowNode(beans) {
|
15148 |
|
15149 | this.rowIndex = null;
|
15150 |
|
15151 | this.key = null;
|
15152 |
|
15153 | this.childrenMapped = {};
|
15154 | |
15155 |
|
15156 |
|
15157 | this.displayed = false;
|
15158 |
|
15159 | this.rowTop = null;
|
15160 | |
15161 |
|
15162 | this.oldRowTop = null;
|
15163 |
|
15164 | this.selectable = true;
|
15165 | |
15166 |
|
15167 | this.__objectId = RowNode.OBJECT_ID_SEQUENCE++;
|
15168 | |
15169 |
|
15170 | this.__autoHeights = {};
|
15171 |
|
15172 | this.alreadyRendered = false;
|
15173 | this.highlighted = null;
|
15174 | this.selected = false;
|
15175 | this.onRowHeightChangedDebounced = debounce(this.onRowHeightChanged.bind(this), 100);
|
15176 | this.beans = beans;
|
15177 | }
|
15178 |
|
15179 | RowNode.prototype.setData = function (data) {
|
15180 | this.setDataCommon(data, false);
|
15181 | };
|
15182 |
|
15183 |
|
15184 |
|
15185 |
|
15186 |
|
15187 | RowNode.prototype.updateData = function (data) {
|
15188 | this.setDataCommon(data, true);
|
15189 | };
|
15190 | RowNode.prototype.setDataCommon = function (data, update) {
|
15191 | var oldData = this.data;
|
15192 | this.data = data;
|
15193 | this.beans.valueCache.onDataChanged();
|
15194 | this.updateDataOnDetailNode();
|
15195 | this.checkRowSelectable();
|
15196 | var event = this.createDataChangedEvent(data, oldData, update);
|
15197 | this.dispatchLocalEvent(event);
|
15198 | };
|
15199 |
|
15200 |
|
15201 |
|
15202 | RowNode.prototype.updateDataOnDetailNode = function () {
|
15203 | if (this.detailNode) {
|
15204 | this.detailNode.data = this.data;
|
15205 | }
|
15206 | };
|
15207 | RowNode.prototype.createDataChangedEvent = function (newData, oldData, update) {
|
15208 | return {
|
15209 | type: RowNode.EVENT_DATA_CHANGED,
|
15210 | node: this,
|
15211 | oldData: oldData,
|
15212 | newData: newData,
|
15213 | update: update
|
15214 | };
|
15215 | };
|
15216 | RowNode.prototype.createLocalRowEvent = function (type) {
|
15217 | return {
|
15218 | type: type,
|
15219 | node: this
|
15220 | };
|
15221 | };
|
15222 | RowNode.prototype.getRowIndexString = function () {
|
15223 | if (this.rowPinned === Constants.PINNED_TOP) {
|
15224 | return 't-' + this.rowIndex;
|
15225 | }
|
15226 | if (this.rowPinned === Constants.PINNED_BOTTOM) {
|
15227 | return 'b-' + this.rowIndex;
|
15228 | }
|
15229 | return this.rowIndex.toString();
|
15230 | };
|
15231 | RowNode.prototype.createDaemonNode = function () {
|
15232 | var oldNode = new RowNode(this.beans);
|
15233 |
|
15234 |
|
15235 |
|
15236 | oldNode.id = this.id;
|
15237 | oldNode.data = this.data;
|
15238 | oldNode.daemon = true;
|
15239 | oldNode.selected = this.selected;
|
15240 | oldNode.level = this.level;
|
15241 | return oldNode;
|
15242 | };
|
15243 | RowNode.prototype.setDataAndId = function (data, id) {
|
15244 | var oldNode = exists(this.id) ? this.createDaemonNode() : null;
|
15245 | var oldData = this.data;
|
15246 | this.data = data;
|
15247 | this.updateDataOnDetailNode();
|
15248 | this.setId(id);
|
15249 | this.beans.selectionService.syncInRowNode(this, oldNode);
|
15250 | this.checkRowSelectable();
|
15251 | var event = this.createDataChangedEvent(data, oldData, false);
|
15252 | this.dispatchLocalEvent(event);
|
15253 | };
|
15254 | RowNode.prototype.checkRowSelectable = function () {
|
15255 | var isRowSelectableFunc = this.beans.gridOptionsWrapper.getIsRowSelectableFunc();
|
15256 | this.setRowSelectable(isRowSelectableFunc ? isRowSelectableFunc(this) : true);
|
15257 | };
|
15258 | RowNode.prototype.setRowSelectable = function (newVal) {
|
15259 | if (this.selectable !== newVal) {
|
15260 | this.selectable = newVal;
|
15261 | if (this.eventService) {
|
15262 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_SELECTABLE_CHANGED));
|
15263 | }
|
15264 | }
|
15265 | };
|
15266 | RowNode.prototype.setId = function (id) {
|
15267 |
|
15268 | var getRowIdFunc = this.beans.gridOptionsWrapper.getRowIdFunc();
|
15269 | if (getRowIdFunc) {
|
15270 |
|
15271 |
|
15272 | if (this.data) {
|
15273 |
|
15274 |
|
15275 |
|
15276 |
|
15277 | var parentKeys = this.getGroupKeys(true);
|
15278 | this.id = getRowIdFunc({
|
15279 | data: this.data,
|
15280 | parentKeys: parentKeys.length > 0 ? parentKeys : undefined,
|
15281 | level: this.level
|
15282 | });
|
15283 |
|
15284 |
|
15285 | if (this.id !== null && typeof this.id === 'string' && this.id.startsWith(RowNode.ID_PREFIX_ROW_GROUP)) {
|
15286 | 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.");
|
15287 | }
|
15288 |
|
15289 | if (this.id !== null && typeof this.id !== 'string') {
|
15290 | this.id = '' + this.id;
|
15291 | }
|
15292 | }
|
15293 | else {
|
15294 |
|
15295 |
|
15296 |
|
15297 | this.id = undefined;
|
15298 | }
|
15299 | }
|
15300 | else {
|
15301 | this.id = id;
|
15302 | }
|
15303 | };
|
15304 | RowNode.prototype.getGroupKeys = function (excludeSelf) {
|
15305 | if (excludeSelf === void 0) { excludeSelf = false; }
|
15306 | var keys = [];
|
15307 | var pointer = this;
|
15308 | if (excludeSelf) {
|
15309 | pointer = pointer.parent;
|
15310 | }
|
15311 | while (pointer && pointer.level >= 0) {
|
15312 | keys.push(pointer.key);
|
15313 | pointer = pointer.parent;
|
15314 | }
|
15315 | keys.reverse();
|
15316 | return keys;
|
15317 | };
|
15318 | RowNode.prototype.isPixelInRange = function (pixel) {
|
15319 | if (!exists(this.rowTop) || !exists(this.rowHeight)) {
|
15320 | return false;
|
15321 | }
|
15322 | return pixel >= this.rowTop && pixel < (this.rowTop + this.rowHeight);
|
15323 | };
|
15324 | RowNode.prototype.setFirstChild = function (firstChild) {
|
15325 | if (this.firstChild === firstChild) {
|
15326 | return;
|
15327 | }
|
15328 | this.firstChild = firstChild;
|
15329 | if (this.eventService) {
|
15330 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_FIRST_CHILD_CHANGED));
|
15331 | }
|
15332 | };
|
15333 | RowNode.prototype.setLastChild = function (lastChild) {
|
15334 | if (this.lastChild === lastChild) {
|
15335 | return;
|
15336 | }
|
15337 | this.lastChild = lastChild;
|
15338 | if (this.eventService) {
|
15339 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_LAST_CHILD_CHANGED));
|
15340 | }
|
15341 | };
|
15342 | RowNode.prototype.setChildIndex = function (childIndex) {
|
15343 | if (this.childIndex === childIndex) {
|
15344 | return;
|
15345 | }
|
15346 | this.childIndex = childIndex;
|
15347 | if (this.eventService) {
|
15348 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_CHILD_INDEX_CHANGED));
|
15349 | }
|
15350 | };
|
15351 | RowNode.prototype.setRowTop = function (rowTop) {
|
15352 | this.oldRowTop = this.rowTop;
|
15353 | if (this.rowTop === rowTop) {
|
15354 | return;
|
15355 | }
|
15356 | this.rowTop = rowTop;
|
15357 | if (this.eventService) {
|
15358 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_TOP_CHANGED));
|
15359 | }
|
15360 | this.setDisplayed(rowTop !== null);
|
15361 | };
|
15362 | RowNode.prototype.clearRowTopAndRowIndex = function () {
|
15363 | this.oldRowTop = null;
|
15364 | this.setRowTop(null);
|
15365 | this.setRowIndex(null);
|
15366 | };
|
15367 | RowNode.prototype.setDisplayed = function (displayed) {
|
15368 | if (this.displayed === displayed) {
|
15369 | return;
|
15370 | }
|
15371 | this.displayed = displayed;
|
15372 | if (this.eventService) {
|
15373 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_DISPLAYED_CHANGED));
|
15374 | }
|
15375 | };
|
15376 | RowNode.prototype.setDragging = function (dragging) {
|
15377 | if (this.dragging === dragging) {
|
15378 | return;
|
15379 | }
|
15380 | this.dragging = dragging;
|
15381 | if (this.eventService) {
|
15382 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_DRAGGING_CHANGED));
|
15383 | }
|
15384 | };
|
15385 | RowNode.prototype.setHighlighted = function (highlighted) {
|
15386 | if (highlighted === this.highlighted) {
|
15387 | return;
|
15388 | }
|
15389 | this.highlighted = highlighted;
|
15390 | if (this.eventService) {
|
15391 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HIGHLIGHT_CHANGED));
|
15392 | }
|
15393 | };
|
15394 | RowNode.prototype.setAllChildrenCount = function (allChildrenCount) {
|
15395 | if (this.allChildrenCount === allChildrenCount) {
|
15396 | return;
|
15397 | }
|
15398 | this.allChildrenCount = allChildrenCount;
|
15399 | if (this.eventService) {
|
15400 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED));
|
15401 | }
|
15402 | };
|
15403 | RowNode.prototype.setMaster = function (master) {
|
15404 | if (this.master === master) {
|
15405 | return;
|
15406 | }
|
15407 |
|
15408 |
|
15409 | if (this.master && !master) {
|
15410 | this.expanded = false;
|
15411 | }
|
15412 | this.master = master;
|
15413 | if (this.eventService) {
|
15414 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_MASTER_CHANGED));
|
15415 | }
|
15416 | };
|
15417 | RowNode.prototype.setGroup = function (group) {
|
15418 | if (this.group === group) {
|
15419 | return;
|
15420 | }
|
15421 |
|
15422 | if (this.group && !group) {
|
15423 | this.expanded = false;
|
15424 | }
|
15425 | this.group = group;
|
15426 | this.updateHasChildren();
|
15427 | if (this.eventService) {
|
15428 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_GROUP_CHANGED));
|
15429 | }
|
15430 | };
|
15431 | |
15432 |
|
15433 |
|
15434 |
|
15435 | RowNode.prototype.setRowHeight = function (rowHeight, estimated) {
|
15436 | if (estimated === void 0) { estimated = false; }
|
15437 | this.rowHeight = rowHeight;
|
15438 | this.rowHeightEstimated = estimated;
|
15439 | if (this.eventService) {
|
15440 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HEIGHT_CHANGED));
|
15441 | }
|
15442 | };
|
15443 | RowNode.prototype.setRowAutoHeight = function (cellHeight, column) {
|
15444 | if (!this.__autoHeights) {
|
15445 | this.__autoHeights = {};
|
15446 | }
|
15447 | var autoHeights = this.__autoHeights;
|
15448 | autoHeights[column.getId()] = cellHeight;
|
15449 | if (cellHeight != null) {
|
15450 | if (this.checkAutoHeightsDebounced == null) {
|
15451 | this.checkAutoHeightsDebounced = debounce(this.checkAutoHeights.bind(this), 1);
|
15452 | }
|
15453 | this.checkAutoHeightsDebounced();
|
15454 | }
|
15455 | };
|
15456 | RowNode.prototype.checkAutoHeights = function () {
|
15457 | var notAllPresent = false;
|
15458 | var nonePresent = true;
|
15459 | var newRowHeight = 0;
|
15460 | var autoHeights = this.__autoHeights;
|
15461 | if (autoHeights == null) {
|
15462 | return;
|
15463 | }
|
15464 | var displayedAutoHeightCols = this.beans.columnModel.getAllDisplayedAutoHeightCols();
|
15465 | displayedAutoHeightCols.forEach(function (col) {
|
15466 | var cellHeight = autoHeights[col.getId()];
|
15467 | if (cellHeight == null) {
|
15468 | notAllPresent = true;
|
15469 | return;
|
15470 | }
|
15471 | nonePresent = false;
|
15472 | if (cellHeight > newRowHeight) {
|
15473 | newRowHeight = cellHeight;
|
15474 | }
|
15475 | });
|
15476 | if (notAllPresent) {
|
15477 | return;
|
15478 | }
|
15479 |
|
15480 |
|
15481 |
|
15482 |
|
15483 |
|
15484 | if (nonePresent || newRowHeight < 10) {
|
15485 | newRowHeight = this.beans.gridOptionsWrapper.getRowHeightForNode(this).height;
|
15486 | }
|
15487 | if (newRowHeight == this.rowHeight) {
|
15488 | return;
|
15489 | }
|
15490 | this.setRowHeight(newRowHeight);
|
15491 | this.onRowHeightChangedDebounced();
|
15492 | };
|
15493 | |
15494 |
|
15495 |
|
15496 |
|
15497 |
|
15498 |
|
15499 | RowNode.prototype.onRowHeightChanged = function () {
|
15500 | var rowModel = this.beans.rowModel;
|
15501 | if (rowModel.onRowHeightChanged) {
|
15502 | rowModel.onRowHeightChanged();
|
15503 | }
|
15504 | };
|
15505 | RowNode.prototype.setRowIndex = function (rowIndex) {
|
15506 | if (this.rowIndex === rowIndex) {
|
15507 | return;
|
15508 | }
|
15509 | this.rowIndex = rowIndex;
|
15510 | if (this.eventService) {
|
15511 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_ROW_INDEX_CHANGED));
|
15512 | }
|
15513 | };
|
15514 | RowNode.prototype.setUiLevel = function (uiLevel) {
|
15515 | if (this.uiLevel === uiLevel) {
|
15516 | return;
|
15517 | }
|
15518 | this.uiLevel = uiLevel;
|
15519 | if (this.eventService) {
|
15520 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_UI_LEVEL_CHANGED));
|
15521 | }
|
15522 | };
|
15523 | RowNode.prototype.setExpanded = function (expanded, e) {
|
15524 | if (this.expanded === expanded) {
|
15525 | return;
|
15526 | }
|
15527 | this.expanded = expanded;
|
15528 | if (this.eventService) {
|
15529 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_EXPANDED_CHANGED));
|
15530 | }
|
15531 | var event = Object.assign({}, this.createGlobalRowEvent(Events.EVENT_ROW_GROUP_OPENED), {
|
15532 | expanded: expanded,
|
15533 | event: e || null
|
15534 | });
|
15535 | this.beans.rowNodeEventThrottle.dispatchExpanded(event);
|
15536 |
|
15537 |
|
15538 | if (this.beans.gridOptionsWrapper.isGroupIncludeFooter()) {
|
15539 | this.beans.rowRenderer.refreshCells({ rowNodes: [this] });
|
15540 | }
|
15541 | };
|
15542 | RowNode.prototype.createGlobalRowEvent = function (type) {
|
15543 | return {
|
15544 | type: type,
|
15545 | node: this,
|
15546 | data: this.data,
|
15547 | rowIndex: this.rowIndex,
|
15548 | rowPinned: this.rowPinned,
|
15549 | context: this.beans.gridOptionsWrapper.getContext(),
|
15550 | api: this.beans.gridOptionsWrapper.getApi(),
|
15551 | columnApi: this.beans.gridOptionsWrapper.getColumnApi()
|
15552 | };
|
15553 | };
|
15554 | RowNode.prototype.dispatchLocalEvent = function (event) {
|
15555 | if (this.eventService) {
|
15556 | this.eventService.dispatchEvent(event);
|
15557 | }
|
15558 | };
|
15559 | |
15560 |
|
15561 |
|
15562 |
|
15563 |
|
15564 |
|
15565 |
|
15566 |
|
15567 |
|
15568 | RowNode.prototype.setDataValue = function (colKey, newValue, eventSource) {
|
15569 |
|
15570 |
|
15571 |
|
15572 |
|
15573 | var column = this.beans.columnModel.getPrimaryColumn(colKey);
|
15574 | var oldValue = this.beans.valueService.getValue(column, this);
|
15575 | var valueChanged = this.beans.valueService.setValue(this, column, newValue, eventSource);
|
15576 | this.dispatchCellChangedEvent(column, newValue, oldValue);
|
15577 | return valueChanged;
|
15578 | };
|
15579 | RowNode.prototype.setGroupValue = function (colKey, newValue) {
|
15580 | var column = this.beans.columnModel.getGridColumn(colKey);
|
15581 | if (missing(this.groupData)) {
|
15582 | this.groupData = {};
|
15583 | }
|
15584 | var columnId = column.getColId();
|
15585 | var oldValue = this.groupData[columnId];
|
15586 | if (oldValue === newValue) {
|
15587 | return;
|
15588 | }
|
15589 | this.groupData[columnId] = newValue;
|
15590 | this.dispatchCellChangedEvent(column, newValue, oldValue);
|
15591 | };
|
15592 |
|
15593 | RowNode.prototype.setAggData = function (newAggData) {
|
15594 | var _this = this;
|
15595 |
|
15596 | var colIds = getAllKeysInObjects([this.aggData, newAggData]);
|
15597 | var oldAggData = this.aggData;
|
15598 | this.aggData = newAggData;
|
15599 |
|
15600 | if (this.eventService) {
|
15601 | colIds.forEach(function (colId) {
|
15602 | var column = _this.beans.columnModel.getGridColumn(colId);
|
15603 | var value = _this.aggData ? _this.aggData[colId] : undefined;
|
15604 | var oldValue = oldAggData ? oldAggData[colId] : undefined;
|
15605 | _this.dispatchCellChangedEvent(column, value, oldValue);
|
15606 | });
|
15607 | }
|
15608 | };
|
15609 | RowNode.prototype.updateHasChildren = function () {
|
15610 |
|
15611 |
|
15612 |
|
15613 | var newValue = (this.group && !this.footer) || (this.childrenAfterGroup && this.childrenAfterGroup.length > 0);
|
15614 | if (newValue !== this.__hasChildren) {
|
15615 | this.__hasChildren = !!newValue;
|
15616 | if (this.eventService) {
|
15617 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HAS_CHILDREN_CHANGED));
|
15618 | }
|
15619 | }
|
15620 | };
|
15621 | RowNode.prototype.hasChildren = function () {
|
15622 | if (this.__hasChildren == null) {
|
15623 | this.updateHasChildren();
|
15624 | }
|
15625 | return this.__hasChildren;
|
15626 | };
|
15627 | RowNode.prototype.isEmptyRowGroupNode = function () {
|
15628 | return this.group && missingOrEmpty(this.childrenAfterGroup);
|
15629 | };
|
15630 | RowNode.prototype.dispatchCellChangedEvent = function (column, newValue, oldValue) {
|
15631 | var cellChangedEvent = {
|
15632 | type: RowNode.EVENT_CELL_CHANGED,
|
15633 | node: this,
|
15634 | column: column,
|
15635 | newValue: newValue,
|
15636 | oldValue: oldValue
|
15637 | };
|
15638 | this.dispatchLocalEvent(cellChangedEvent);
|
15639 | };
|
15640 | |
15641 |
|
15642 |
|
15643 |
|
15644 |
|
15645 |
|
15646 | RowNode.prototype.resetQuickFilterAggregateText = function () {
|
15647 | this.quickFilterAggregateText = null;
|
15648 | };
|
15649 | RowNode.prototype.isExpandable = function () {
|
15650 | return (this.hasChildren() && !this.footer) || this.master ? true : false;
|
15651 | };
|
15652 | |
15653 |
|
15654 |
|
15655 |
|
15656 | RowNode.prototype.isSelected = function () {
|
15657 |
|
15658 | if (this.footer) {
|
15659 | return this.sibling.isSelected();
|
15660 | }
|
15661 | return this.selected;
|
15662 | };
|
15663 |
|
15664 | RowNode.prototype.depthFirstSearch = function (callback) {
|
15665 | if (this.childrenAfterGroup) {
|
15666 | this.childrenAfterGroup.forEach(function (child) { return child.depthFirstSearch(callback); });
|
15667 | }
|
15668 | callback(this);
|
15669 | };
|
15670 |
|
15671 |
|
15672 | RowNode.prototype.calculateSelectedFromChildren = function () {
|
15673 | var _a;
|
15674 | var atLeastOneSelected = false;
|
15675 | var atLeastOneDeSelected = false;
|
15676 | var atLeastOneMixed = false;
|
15677 | var newSelectedValue;
|
15678 | if (!((_a = this.childrenAfterGroup) === null || _a === void 0 ? void 0 : _a.length)) {
|
15679 | return;
|
15680 | }
|
15681 | for (var i = 0; i < this.childrenAfterGroup.length; i++) {
|
15682 | var child = this.childrenAfterGroup[i];
|
15683 |
|
15684 | if (!child.selectable) {
|
15685 | continue;
|
15686 | }
|
15687 | var childState = child.isSelected();
|
15688 | switch (childState) {
|
15689 | case true:
|
15690 | atLeastOneSelected = true;
|
15691 | break;
|
15692 | case false:
|
15693 | atLeastOneDeSelected = true;
|
15694 | break;
|
15695 | default:
|
15696 | atLeastOneMixed = true;
|
15697 | break;
|
15698 | }
|
15699 | }
|
15700 | if (atLeastOneMixed) {
|
15701 | newSelectedValue = undefined;
|
15702 | }
|
15703 | else if (atLeastOneSelected && !atLeastOneDeSelected) {
|
15704 | newSelectedValue = true;
|
15705 | }
|
15706 | else if (!atLeastOneSelected && atLeastOneDeSelected) {
|
15707 | newSelectedValue = false;
|
15708 | }
|
15709 | else {
|
15710 | newSelectedValue = undefined;
|
15711 | }
|
15712 | this.selectThisNode(newSelectedValue);
|
15713 | };
|
15714 | RowNode.prototype.setSelectedInitialValue = function (selected) {
|
15715 | this.selected = selected;
|
15716 | };
|
15717 | |
15718 |
|
15719 |
|
15720 |
|
15721 |
|
15722 |
|
15723 | RowNode.prototype.setSelected = function (newValue, clearSelection, suppressFinishActions) {
|
15724 | if (clearSelection === void 0) { clearSelection = false; }
|
15725 | if (suppressFinishActions === void 0) { suppressFinishActions = false; }
|
15726 | this.setSelectedParams({
|
15727 | newValue: newValue,
|
15728 | clearSelection: clearSelection,
|
15729 | suppressFinishActions: suppressFinishActions,
|
15730 | rangeSelect: false
|
15731 | });
|
15732 | };
|
15733 | RowNode.prototype.isRowPinned = function () {
|
15734 | return this.rowPinned === Constants.PINNED_TOP || this.rowPinned === Constants.PINNED_BOTTOM;
|
15735 | };
|
15736 |
|
15737 | RowNode.prototype.setSelectedParams = function (params) {
|
15738 | var _a;
|
15739 | var groupSelectsChildren = this.beans.gridOptionsWrapper.isGroupSelectsChildren();
|
15740 | var newValue = params.newValue === true;
|
15741 | var clearSelection = params.clearSelection === true;
|
15742 | var suppressFinishActions = params.suppressFinishActions === true;
|
15743 | var rangeSelect = params.rangeSelect === true;
|
15744 |
|
15745 | var groupSelectsFiltered = groupSelectsChildren && (params.groupSelectsFiltered === true);
|
15746 | if (this.id === undefined) {
|
15747 | console.warn('AG Grid: cannot select node until id for node is known');
|
15748 | return 0;
|
15749 | }
|
15750 | if (this.rowPinned) {
|
15751 | console.warn('AG Grid: cannot select pinned rows');
|
15752 | return 0;
|
15753 | }
|
15754 |
|
15755 |
|
15756 | if (this.footer) {
|
15757 | return this.sibling.setSelectedParams(params);
|
15758 | }
|
15759 | if (rangeSelect && this.beans.selectionService.getLastSelectedNode()) {
|
15760 | var newRowClicked = this.beans.selectionService.getLastSelectedNode() !== this;
|
15761 | var allowMultiSelect = this.beans.gridOptionsWrapper.isRowSelectionMulti();
|
15762 | if (newRowClicked && allowMultiSelect) {
|
15763 | var nodesChanged = this.doRowRangeSelection(params.newValue);
|
15764 | this.beans.selectionService.setLastSelectedNode(this);
|
15765 | return nodesChanged;
|
15766 | }
|
15767 | }
|
15768 | var updatedCount = 0;
|
15769 |
|
15770 |
|
15771 |
|
15772 |
|
15773 | var skipThisNode = groupSelectsFiltered && this.group;
|
15774 | if (!skipThisNode) {
|
15775 | var thisNodeWasSelected = this.selectThisNode(newValue);
|
15776 | if (thisNodeWasSelected) {
|
15777 | updatedCount++;
|
15778 | }
|
15779 | }
|
15780 | if (groupSelectsChildren && ((_a = this.childrenAfterGroup) === null || _a === void 0 ? void 0 : _a.length)) {
|
15781 | updatedCount += this.selectChildNodes(newValue, groupSelectsFiltered);
|
15782 | }
|
15783 |
|
15784 | if (!suppressFinishActions) {
|
15785 | var clearOtherNodes = newValue && (clearSelection || !this.beans.gridOptionsWrapper.isRowSelectionMulti());
|
15786 | if (clearOtherNodes) {
|
15787 | updatedCount += this.beans.selectionService.clearOtherNodes(this);
|
15788 | }
|
15789 |
|
15790 | if (updatedCount > 0) {
|
15791 | this.beans.selectionService.updateGroupsFromChildrenSelections();
|
15792 |
|
15793 |
|
15794 | var event_1 = {
|
15795 | type: Events.EVENT_SELECTION_CHANGED,
|
15796 | api: this.beans.gridApi,
|
15797 | columnApi: this.beans.columnApi
|
15798 | };
|
15799 | this.beans.eventService.dispatchEvent(event_1);
|
15800 | }
|
15801 |
|
15802 | if (newValue) {
|
15803 | this.beans.selectionService.setLastSelectedNode(this);
|
15804 | }
|
15805 | }
|
15806 | return updatedCount;
|
15807 | };
|
15808 |
|
15809 |
|
15810 |
|
15811 | RowNode.prototype.doRowRangeSelection = function (value) {
|
15812 | var _this = this;
|
15813 | if (value === void 0) { value = true; }
|
15814 | var groupsSelectChildren = this.beans.gridOptionsWrapper.isGroupSelectsChildren();
|
15815 | var lastSelectedNode = this.beans.selectionService.getLastSelectedNode();
|
15816 | var nodesToSelect = this.beans.rowModel.getNodesInRangeForSelection(this, lastSelectedNode);
|
15817 | var updatedCount = 0;
|
15818 | nodesToSelect.forEach(function (rowNode) {
|
15819 | if (rowNode.group && groupsSelectChildren || (value === false && _this === rowNode)) {
|
15820 | return;
|
15821 | }
|
15822 | var nodeWasSelected = rowNode.selectThisNode(value);
|
15823 | if (nodeWasSelected) {
|
15824 | updatedCount++;
|
15825 | }
|
15826 | });
|
15827 | this.beans.selectionService.updateGroupsFromChildrenSelections();
|
15828 | var event = {
|
15829 | type: Events.EVENT_SELECTION_CHANGED,
|
15830 | api: this.beans.gridApi,
|
15831 | columnApi: this.beans.columnApi
|
15832 | };
|
15833 | this.beans.eventService.dispatchEvent(event);
|
15834 | return updatedCount;
|
15835 | };
|
15836 | RowNode.prototype.isParentOfNode = function (potentialParent) {
|
15837 | var parentNode = this.parent;
|
15838 | while (parentNode) {
|
15839 | if (parentNode === potentialParent) {
|
15840 | return true;
|
15841 | }
|
15842 | parentNode = parentNode.parent;
|
15843 | }
|
15844 | return false;
|
15845 | };
|
15846 | RowNode.prototype.selectThisNode = function (newValue) {
|
15847 |
|
15848 |
|
15849 | var selectionNotAllowed = !this.selectable && newValue;
|
15850 | var selectionNotChanged = this.selected === newValue;
|
15851 | if (selectionNotAllowed || selectionNotChanged) {
|
15852 | return false;
|
15853 | }
|
15854 | this.selected = newValue;
|
15855 | if (this.eventService) {
|
15856 | this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_ROW_SELECTED));
|
15857 | }
|
15858 | var event = this.createGlobalRowEvent(Events.EVENT_ROW_SELECTED);
|
15859 | this.beans.eventService.dispatchEvent(event);
|
15860 | return true;
|
15861 | };
|
15862 | RowNode.prototype.selectChildNodes = function (newValue, groupSelectsFiltered) {
|
15863 | var children = groupSelectsFiltered ? this.childrenAfterAggFilter : this.childrenAfterGroup;
|
15864 | if (missing(children)) {
|
15865 | return 0;
|
15866 | }
|
15867 | var updatedCount = 0;
|
15868 | for (var i = 0; i < children.length; i++) {
|
15869 | updatedCount += children[i].setSelectedParams({
|
15870 | newValue: newValue,
|
15871 | clearSelection: false,
|
15872 | suppressFinishActions: true,
|
15873 | groupSelectsFiltered: groupSelectsFiltered
|
15874 | });
|
15875 | }
|
15876 | return updatedCount;
|
15877 | };
|
15878 |
|
15879 | RowNode.prototype.addEventListener = function (eventType, listener) {
|
15880 | if (!this.eventService) {
|
15881 | this.eventService = new EventService();
|
15882 | }
|
15883 | this.eventService.addEventListener(eventType, listener);
|
15884 | };
|
15885 |
|
15886 | RowNode.prototype.removeEventListener = function (eventType, listener) {
|
15887 | if (!this.eventService) {
|
15888 | return;
|
15889 | }
|
15890 | this.eventService.removeEventListener(eventType, listener);
|
15891 | if (this.eventService.noRegisteredListenersExist()) {
|
15892 | this.eventService = null;
|
15893 | }
|
15894 | };
|
15895 | RowNode.prototype.onMouseEnter = function () {
|
15896 | this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_MOUSE_ENTER));
|
15897 | };
|
15898 | RowNode.prototype.onMouseLeave = function () {
|
15899 | this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_MOUSE_LEAVE));
|
15900 | };
|
15901 | RowNode.prototype.getFirstChildOfFirstChild = function (rowGroupColumn) {
|
15902 | var currentRowNode = this;
|
15903 | var isCandidate = true;
|
15904 | var foundFirstChildPath = false;
|
15905 | var nodeToSwapIn = null;
|
15906 |
|
15907 |
|
15908 | while (isCandidate && !foundFirstChildPath) {
|
15909 | var parentRowNode = currentRowNode.parent;
|
15910 | var firstChild = exists(parentRowNode) && currentRowNode.firstChild;
|
15911 | if (firstChild) {
|
15912 | if (parentRowNode.rowGroupColumn === rowGroupColumn) {
|
15913 | foundFirstChildPath = true;
|
15914 | nodeToSwapIn = parentRowNode;
|
15915 | }
|
15916 | }
|
15917 | else {
|
15918 | isCandidate = false;
|
15919 | }
|
15920 | currentRowNode = parentRowNode;
|
15921 | }
|
15922 | return foundFirstChildPath ? nodeToSwapIn : null;
|
15923 | };
|
15924 | RowNode.prototype.isFullWidthCell = function () {
|
15925 | var isFullWidthCellFunc = this.beans.gridOptionsWrapper.getIsFullWidthCellFunc();
|
15926 | return isFullWidthCellFunc ? isFullWidthCellFunc({ rowNode: this }) : false;
|
15927 | };
|
15928 | |
15929 |
|
15930 |
|
15931 |
|
15932 | RowNode.prototype.getRoute = function () {
|
15933 | if (this.key == null) {
|
15934 | return;
|
15935 | }
|
15936 | var res = [];
|
15937 | var pointer = this;
|
15938 | while (pointer.key != null) {
|
15939 | res.push(pointer.key);
|
15940 | pointer = pointer.parent;
|
15941 | }
|
15942 | return res.reverse();
|
15943 | };
|
15944 | RowNode.ID_PREFIX_ROW_GROUP = 'row-group-';
|
15945 | RowNode.ID_PREFIX_TOP_PINNED = 't-';
|
15946 | RowNode.ID_PREFIX_BOTTOM_PINNED = 'b-';
|
15947 | RowNode.OBJECT_ID_SEQUENCE = 0;
|
15948 | RowNode.EVENT_ROW_SELECTED = 'rowSelected';
|
15949 | RowNode.EVENT_DATA_CHANGED = 'dataChanged';
|
15950 | RowNode.EVENT_CELL_CHANGED = 'cellChanged';
|
15951 | RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED = 'allChildrenCountChanged';
|
15952 | RowNode.EVENT_MASTER_CHANGED = 'masterChanged';
|
15953 | RowNode.EVENT_GROUP_CHANGED = 'groupChanged';
|
15954 | RowNode.EVENT_MOUSE_ENTER = 'mouseEnter';
|
15955 | RowNode.EVENT_MOUSE_LEAVE = 'mouseLeave';
|
15956 | RowNode.EVENT_HEIGHT_CHANGED = 'heightChanged';
|
15957 | RowNode.EVENT_TOP_CHANGED = 'topChanged';
|
15958 | RowNode.EVENT_DISPLAYED_CHANGED = 'displayedChanged';
|
15959 | RowNode.EVENT_FIRST_CHILD_CHANGED = 'firstChildChanged';
|
15960 | RowNode.EVENT_LAST_CHILD_CHANGED = 'lastChildChanged';
|
15961 | RowNode.EVENT_CHILD_INDEX_CHANGED = 'childIndexChanged';
|
15962 | RowNode.EVENT_ROW_INDEX_CHANGED = 'rowIndexChanged';
|
15963 | RowNode.EVENT_EXPANDED_CHANGED = 'expandedChanged';
|
15964 | RowNode.EVENT_HAS_CHILDREN_CHANGED = 'hasChildrenChanged';
|
15965 | RowNode.EVENT_SELECTABLE_CHANGED = 'selectableChanged';
|
15966 | RowNode.EVENT_UI_LEVEL_CHANGED = 'uiLevelChanged';
|
15967 | RowNode.EVENT_HIGHLIGHT_CHANGED = 'rowHighlightChanged';
|
15968 | RowNode.EVENT_DRAGGING_CHANGED = 'draggingChanged';
|
15969 | return RowNode;
|
15970 | }());
|
15971 |
|
15972 |
|
15973 |
|
15974 |
|
15975 |
|
15976 |
|
15977 |
|
15978 | var __extends$B = (undefined && undefined.__extends) || (function () {
|
15979 | var extendStatics = function (d, b) {
|
15980 | extendStatics = Object.setPrototypeOf ||
|
15981 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
15982 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
15983 | return extendStatics(d, b);
|
15984 | };
|
15985 | return function (d, b) {
|
15986 | extendStatics(d, b);
|
15987 | function __() { this.constructor = d; }
|
15988 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15989 | };
|
15990 | })();
|
15991 | var __decorate$x = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
15992 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
15993 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
15994 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
15995 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
15996 | };
|
15997 | var CheckboxSelectionComponent = (function (_super) {
|
15998 | __extends$B(CheckboxSelectionComponent, _super);
|
15999 | function CheckboxSelectionComponent() {
|
16000 | return _super.call(this, "\n <div class=\"ag-selection-checkbox\" role=\"presentation\">\n <ag-checkbox role=\"presentation\" ref=\"eCheckbox\"></ag-checkbox>\n </div>") || this;
|
16001 | }
|
16002 | CheckboxSelectionComponent.prototype.postConstruct = function () {
|
16003 | this.eCheckbox.setPassive(true);
|
16004 | };
|
16005 | CheckboxSelectionComponent.prototype.getCheckboxId = function () {
|
16006 | return this.eCheckbox.getInputElement().id;
|
16007 | };
|
16008 | CheckboxSelectionComponent.prototype.onDataChanged = function () {
|
16009 |
|
16010 |
|
16011 | this.onSelectionChanged();
|
16012 | };
|
16013 | CheckboxSelectionComponent.prototype.onSelectableChanged = function () {
|
16014 | this.showOrHideSelect();
|
16015 | };
|
16016 | CheckboxSelectionComponent.prototype.onSelectionChanged = function () {
|
16017 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
16018 | var state = this.rowNode.isSelected();
|
16019 | var stateName = state === undefined
|
16020 | ? translate('ariaIndeterminate', 'indeterminate')
|
16021 | : (state === true
|
16022 | ? translate('ariaChecked', 'checked')
|
16023 | : translate('ariaUnchecked', 'unchecked'));
|
16024 | var ariaLabel = translate('ariaRowToggleSelection', 'Press Space to toggle row selection');
|
16025 | this.eCheckbox.setValue(state, true);
|
16026 | this.eCheckbox.setInputAriaLabel(ariaLabel + " (" + stateName + ")");
|
16027 | };
|
16028 | CheckboxSelectionComponent.prototype.onCheckedClicked = function (event) {
|
16029 | var groupSelectsFiltered = this.gridOptionsWrapper.isGroupSelectsFiltered();
|
16030 | var updatedCount = this.rowNode.setSelectedParams({ newValue: false, rangeSelect: event.shiftKey, groupSelectsFiltered: groupSelectsFiltered });
|
16031 | return updatedCount;
|
16032 | };
|
16033 | CheckboxSelectionComponent.prototype.onUncheckedClicked = function (event) {
|
16034 | var groupSelectsFiltered = this.gridOptionsWrapper.isGroupSelectsFiltered();
|
16035 | var updatedCount = this.rowNode.setSelectedParams({ newValue: true, rangeSelect: event.shiftKey, groupSelectsFiltered: groupSelectsFiltered });
|
16036 | return updatedCount;
|
16037 | };
|
16038 | CheckboxSelectionComponent.prototype.init = function (params) {
|
16039 | var _this = this;
|
16040 | this.rowNode = params.rowNode;
|
16041 | this.column = params.column;
|
16042 | this.onSelectionChanged();
|
16043 |
|
16044 |
|
16045 | this.addGuiEventListener('click', function (event) { return stopPropagationForAgGrid(event); });
|
16046 |
|
16047 | this.addGuiEventListener('dblclick', function (event) { return stopPropagationForAgGrid(event); });
|
16048 | this.addManagedListener(this.eCheckbox.getInputElement(), 'click', function (event) {
|
16049 | var isSelected = _this.eCheckbox.getValue();
|
16050 | var previousValue = _this.eCheckbox.getPreviousValue();
|
16051 | if (previousValue === undefined || isSelected === undefined) {
|
16052 |
|
16053 | var result = _this.onUncheckedClicked(event || {});
|
16054 | if (result === 0) {
|
16055 | _this.onCheckedClicked(event);
|
16056 | }
|
16057 | }
|
16058 | else if (isSelected) {
|
16059 | _this.onCheckedClicked(event);
|
16060 | }
|
16061 | else {
|
16062 | _this.onUncheckedClicked(event || {});
|
16063 | }
|
16064 | });
|
16065 | this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_SELECTED, this.onSelectionChanged.bind(this));
|
16066 | this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.onDataChanged.bind(this));
|
16067 | this.addManagedListener(this.rowNode, RowNode.EVENT_SELECTABLE_CHANGED, this.onSelectableChanged.bind(this));
|
16068 | var isRowSelectableFunc = this.gridOptionsWrapper.getIsRowSelectableFunc();
|
16069 | var checkboxVisibleIsDynamic = isRowSelectableFunc || this.checkboxCallbackExists();
|
16070 | if (checkboxVisibleIsDynamic) {
|
16071 | var showOrHideSelectListener = this.showOrHideSelect.bind(this);
|
16072 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, showOrHideSelectListener);
|
16073 | this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, showOrHideSelectListener);
|
16074 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, showOrHideSelectListener);
|
16075 | this.showOrHideSelect();
|
16076 | }
|
16077 | this.eCheckbox.getInputElement().setAttribute('tabindex', '-1');
|
16078 | };
|
16079 | CheckboxSelectionComponent.prototype.showOrHideSelect = function () {
|
16080 |
|
16081 | var selectable = this.rowNode.selectable;
|
16082 |
|
16083 |
|
16084 |
|
16085 | if (selectable && this.checkboxCallbackExists()) {
|
16086 | selectable = this.column.isCellCheckboxSelection(this.rowNode);
|
16087 | }
|
16088 |
|
16089 | this.setVisible(selectable);
|
16090 | };
|
16091 | CheckboxSelectionComponent.prototype.checkboxCallbackExists = function () {
|
16092 |
|
16093 | var colDef = this.column ? this.column.getColDef() : null;
|
16094 | return !!colDef && typeof colDef.checkboxSelection === 'function';
|
16095 | };
|
16096 | __decorate$x([
|
16097 | RefSelector('eCheckbox')
|
16098 | ], CheckboxSelectionComponent.prototype, "eCheckbox", void 0);
|
16099 | __decorate$x([
|
16100 | PostConstruct
|
16101 | ], CheckboxSelectionComponent.prototype, "postConstruct", null);
|
16102 | return CheckboxSelectionComponent;
|
16103 | }(Component));
|
16104 |
|
16105 |
|
16106 |
|
16107 |
|
16108 |
|
16109 |
|
16110 |
|
16111 | var __extends$C = (undefined && undefined.__extends) || (function () {
|
16112 | var extendStatics = function (d, b) {
|
16113 | extendStatics = Object.setPrototypeOf ||
|
16114 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
16115 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
16116 | return extendStatics(d, b);
|
16117 | };
|
16118 | return function (d, b) {
|
16119 | extendStatics(d, b);
|
16120 | function __() { this.constructor = d; }
|
16121 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16122 | };
|
16123 | })();
|
16124 | var __decorate$y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
16125 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
16126 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
16127 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
16128 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
16129 | };
|
16130 | var __values$2 = (undefined && undefined.__values) || function(o) {
|
16131 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
16132 | if (m) return m.call(o);
|
16133 | if (o && typeof o.length === "number") return {
|
16134 | next: function () {
|
16135 | if (o && i >= o.length) o = void 0;
|
16136 | return { value: o && o[i++], done: !o };
|
16137 | }
|
16138 | };
|
16139 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
16140 | };
|
16141 | var DragSourceType;
|
16142 | (function (DragSourceType) {
|
16143 | DragSourceType[DragSourceType["ToolPanel"] = 0] = "ToolPanel";
|
16144 | DragSourceType[DragSourceType["HeaderCell"] = 1] = "HeaderCell";
|
16145 | DragSourceType[DragSourceType["RowDrag"] = 2] = "RowDrag";
|
16146 | DragSourceType[DragSourceType["ChartPanel"] = 3] = "ChartPanel";
|
16147 | })(DragSourceType || (DragSourceType = {}));
|
16148 | var VerticalDirection;
|
16149 | (function (VerticalDirection) {
|
16150 | VerticalDirection[VerticalDirection["Up"] = 0] = "Up";
|
16151 | VerticalDirection[VerticalDirection["Down"] = 1] = "Down";
|
16152 | })(VerticalDirection || (VerticalDirection = {}));
|
16153 | var HorizontalDirection;
|
16154 | (function (HorizontalDirection) {
|
16155 | HorizontalDirection[HorizontalDirection["Left"] = 0] = "Left";
|
16156 | HorizontalDirection[HorizontalDirection["Right"] = 1] = "Right";
|
16157 | })(HorizontalDirection || (HorizontalDirection = {}));
|
16158 | var DragAndDropService = (function (_super) {
|
16159 | __extends$C(DragAndDropService, _super);
|
16160 | function DragAndDropService() {
|
16161 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
16162 | _this.dragSourceAndParamsList = [];
|
16163 | _this.dropTargets = [];
|
16164 | return _this;
|
16165 | }
|
16166 | DragAndDropService_1 = DragAndDropService;
|
16167 | DragAndDropService.prototype.init = function () {
|
16168 | this.ePinnedIcon = createIcon('columnMovePin', this.gridOptionsWrapper, null);
|
16169 | this.eHideIcon = createIcon('columnMoveHide', this.gridOptionsWrapper, null);
|
16170 | this.eMoveIcon = createIcon('columnMoveMove', this.gridOptionsWrapper, null);
|
16171 | this.eLeftIcon = createIcon('columnMoveLeft', this.gridOptionsWrapper, null);
|
16172 | this.eRightIcon = createIcon('columnMoveRight', this.gridOptionsWrapper, null);
|
16173 | this.eGroupIcon = createIcon('columnMoveGroup', this.gridOptionsWrapper, null);
|
16174 | this.eAggregateIcon = createIcon('columnMoveValue', this.gridOptionsWrapper, null);
|
16175 | this.ePivotIcon = createIcon('columnMovePivot', this.gridOptionsWrapper, null);
|
16176 | this.eDropNotAllowedIcon = createIcon('dropNotAllowed', this.gridOptionsWrapper, null);
|
16177 | };
|
16178 | DragAndDropService.prototype.addDragSource = function (dragSource, allowTouch) {
|
16179 | if (allowTouch === void 0) { allowTouch = false; }
|
16180 | var params = {
|
16181 | eElement: dragSource.eElement,
|
16182 | dragStartPixels: dragSource.dragStartPixels,
|
16183 | onDragStart: this.onDragStart.bind(this, dragSource),
|
16184 | onDragStop: this.onDragStop.bind(this),
|
16185 | onDragging: this.onDragging.bind(this)
|
16186 | };
|
16187 | this.dragSourceAndParamsList.push({ params: params, dragSource: dragSource });
|
16188 | this.dragService.addDragSource(params, allowTouch);
|
16189 | };
|
16190 | DragAndDropService.prototype.removeDragSource = function (dragSource) {
|
16191 | var sourceAndParams = this.dragSourceAndParamsList.find(function (item) { return item.dragSource === dragSource; });
|
16192 | if (sourceAndParams) {
|
16193 | this.dragService.removeDragSource(sourceAndParams.params);
|
16194 | removeFromArray(this.dragSourceAndParamsList, sourceAndParams);
|
16195 | }
|
16196 | };
|
16197 | DragAndDropService.prototype.clearDragSourceParamsList = function () {
|
16198 | var _this = this;
|
16199 | this.dragSourceAndParamsList.forEach(function (sourceAndParams) { return _this.dragService.removeDragSource(sourceAndParams.params); });
|
16200 | this.dragSourceAndParamsList.length = 0;
|
16201 | };
|
16202 | DragAndDropService.prototype.nudge = function () {
|
16203 | if (this.dragging) {
|
16204 | this.onDragging(this.eventLastTime, true);
|
16205 | }
|
16206 | };
|
16207 | DragAndDropService.prototype.onDragStart = function (dragSource, mouseEvent) {
|
16208 | this.dragging = true;
|
16209 | this.dragSource = dragSource;
|
16210 | this.eventLastTime = mouseEvent;
|
16211 | this.dragItem = this.dragSource.getDragItem();
|
16212 | this.lastDropTarget = this.dragSource.dragSourceDropTarget;
|
16213 | if (this.dragSource.onDragStarted) {
|
16214 | this.dragSource.onDragStarted();
|
16215 | }
|
16216 | this.createGhost();
|
16217 | };
|
16218 | DragAndDropService.prototype.onDragStop = function (mouseEvent) {
|
16219 | this.eventLastTime = null;
|
16220 | this.dragging = false;
|
16221 | if (this.dragSource.onDragStopped) {
|
16222 | this.dragSource.onDragStopped();
|
16223 | }
|
16224 | if (this.lastDropTarget && this.lastDropTarget.onDragStop) {
|
16225 | var draggingEvent = this.createDropTargetEvent(this.lastDropTarget, mouseEvent, null, null, false);
|
16226 | this.lastDropTarget.onDragStop(draggingEvent);
|
16227 | }
|
16228 | this.lastDropTarget = null;
|
16229 | this.dragItem = null;
|
16230 | this.removeGhost();
|
16231 | };
|
16232 | DragAndDropService.prototype.onDragging = function (mouseEvent, fromNudge) {
|
16233 | var _this = this;
|
16234 | var hDirection = this.getHorizontalDirection(mouseEvent);
|
16235 | var vDirection = this.getVerticalDirection(mouseEvent);
|
16236 | this.eventLastTime = mouseEvent;
|
16237 | this.positionGhost(mouseEvent);
|
16238 |
|
16239 | var validDropTargets = this.dropTargets.filter(function (target) { return _this.isMouseOnDropTarget(mouseEvent, target); });
|
16240 | var len = validDropTargets.length;
|
16241 | var dropTarget = null;
|
16242 | if (len > 0) {
|
16243 | dropTarget = len === 1
|
16244 | ? validDropTargets[0]
|
16245 |
|
16246 |
|
16247 |
|
16248 | : validDropTargets.reduce(function (prevTarget, currTarget) {
|
16249 | if (!prevTarget) {
|
16250 | return currTarget;
|
16251 | }
|
16252 | var prevContainer = prevTarget.getContainer();
|
16253 | var currContainer = currTarget.getContainer();
|
16254 | if (prevContainer.contains(currContainer)) {
|
16255 | return currTarget;
|
16256 | }
|
16257 | return prevTarget;
|
16258 | });
|
16259 | }
|
16260 | if (dropTarget !== this.lastDropTarget) {
|
16261 | this.leaveLastTargetIfExists(mouseEvent, hDirection, vDirection, fromNudge);
|
16262 | this.enterDragTargetIfExists(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
|
16263 | this.lastDropTarget = dropTarget;
|
16264 | }
|
16265 | else if (dropTarget && dropTarget.onDragging) {
|
16266 | var draggingEvent = this.createDropTargetEvent(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
|
16267 | dropTarget.onDragging(draggingEvent);
|
16268 | }
|
16269 | };
|
16270 | DragAndDropService.prototype.enterDragTargetIfExists = function (dropTarget, mouseEvent, hDirection, vDirection, fromNudge) {
|
16271 | if (!dropTarget) {
|
16272 | return;
|
16273 | }
|
16274 | if (dropTarget.onDragEnter) {
|
16275 | var dragEnterEvent = this.createDropTargetEvent(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
|
16276 | dropTarget.onDragEnter(dragEnterEvent);
|
16277 | }
|
16278 | this.setGhostIcon(dropTarget.getIconName ? dropTarget.getIconName() : null);
|
16279 | };
|
16280 | DragAndDropService.prototype.leaveLastTargetIfExists = function (mouseEvent, hDirection, vDirection, fromNudge) {
|
16281 | if (!this.lastDropTarget) {
|
16282 | return;
|
16283 | }
|
16284 | if (this.lastDropTarget.onDragLeave) {
|
16285 | var dragLeaveEvent = this.createDropTargetEvent(this.lastDropTarget, mouseEvent, hDirection, vDirection, fromNudge);
|
16286 | this.lastDropTarget.onDragLeave(dragLeaveEvent);
|
16287 | }
|
16288 | this.setGhostIcon(null);
|
16289 | };
|
16290 | DragAndDropService.prototype.getAllContainersFromDropTarget = function (dropTarget) {
|
16291 | var secondaryContainers = dropTarget.getSecondaryContainers ? dropTarget.getSecondaryContainers() : null;
|
16292 | var containers = [[dropTarget.getContainer()]];
|
16293 | return secondaryContainers ? containers.concat(secondaryContainers) : containers;
|
16294 | };
|
16295 | DragAndDropService.prototype.allContainersIntersect = function (mouseEvent, containers) {
|
16296 | var e_1, _a;
|
16297 | try {
|
16298 | for (var containers_1 = __values$2(containers), containers_1_1 = containers_1.next(); !containers_1_1.done; containers_1_1 = containers_1.next()) {
|
16299 | var container = containers_1_1.value;
|
16300 | var rect = container.getBoundingClientRect();
|
16301 |
|
16302 | if (rect.width === 0 || rect.height === 0) {
|
16303 | return false;
|
16304 | }
|
16305 | var horizontalFit = mouseEvent.clientX >= rect.left && mouseEvent.clientX < rect.right;
|
16306 | var verticalFit = mouseEvent.clientY >= rect.top && mouseEvent.clientY < rect.bottom;
|
16307 | if (!horizontalFit || !verticalFit) {
|
16308 | return false;
|
16309 | }
|
16310 | }
|
16311 | }
|
16312 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
16313 | finally {
|
16314 | try {
|
16315 | if (containers_1_1 && !containers_1_1.done && (_a = containers_1.return)) _a.call(containers_1);
|
16316 | }
|
16317 | finally { if (e_1) throw e_1.error; }
|
16318 | }
|
16319 | return true;
|
16320 | };
|
16321 |
|
16322 | DragAndDropService.prototype.isMouseOnDropTarget = function (mouseEvent, dropTarget) {
|
16323 | var e_2, _a;
|
16324 | var allContainersFromDropTarget = this.getAllContainersFromDropTarget(dropTarget);
|
16325 | var mouseOverTarget = false;
|
16326 | try {
|
16327 | for (var allContainersFromDropTarget_1 = __values$2(allContainersFromDropTarget), allContainersFromDropTarget_1_1 = allContainersFromDropTarget_1.next(); !allContainersFromDropTarget_1_1.done; allContainersFromDropTarget_1_1 = allContainersFromDropTarget_1.next()) {
|
16328 | var currentContainers = allContainersFromDropTarget_1_1.value;
|
16329 | if (this.allContainersIntersect(mouseEvent, currentContainers)) {
|
16330 | mouseOverTarget = true;
|
16331 | break;
|
16332 | }
|
16333 | }
|
16334 | }
|
16335 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
16336 | finally {
|
16337 | try {
|
16338 | if (allContainersFromDropTarget_1_1 && !allContainersFromDropTarget_1_1.done && (_a = allContainersFromDropTarget_1.return)) _a.call(allContainersFromDropTarget_1);
|
16339 | }
|
16340 | finally { if (e_2) throw e_2.error; }
|
16341 | }
|
16342 | if (dropTarget.targetContainsSource && !dropTarget.getContainer().contains(this.dragSource.eElement)) {
|
16343 | return false;
|
16344 | }
|
16345 | return mouseOverTarget && dropTarget.isInterestedIn(this.dragSource.type, this.dragSource.eElement);
|
16346 | };
|
16347 | DragAndDropService.prototype.addDropTarget = function (dropTarget) {
|
16348 | this.dropTargets.push(dropTarget);
|
16349 | };
|
16350 | DragAndDropService.prototype.removeDropTarget = function (dropTarget) {
|
16351 | this.dropTargets = this.dropTargets.filter(function (target) { return target.getContainer() !== dropTarget.getContainer(); });
|
16352 | };
|
16353 | DragAndDropService.prototype.hasExternalDropZones = function () {
|
16354 | return this.dropTargets.some(function (zones) { return zones.external; });
|
16355 | };
|
16356 | DragAndDropService.prototype.findExternalZone = function (params) {
|
16357 | var externalTargets = this.dropTargets.filter(function (target) { return target.external; });
|
16358 | return externalTargets.find(function (zone) { return zone.getContainer() === params.getContainer(); }) || null;
|
16359 | };
|
16360 | DragAndDropService.prototype.getHorizontalDirection = function (event) {
|
16361 | var clientX = this.eventLastTime && this.eventLastTime.clientX;
|
16362 | var eClientX = event.clientX;
|
16363 | if (clientX === eClientX) {
|
16364 | return null;
|
16365 | }
|
16366 | return clientX > eClientX ? HorizontalDirection.Left : HorizontalDirection.Right;
|
16367 | };
|
16368 | DragAndDropService.prototype.getVerticalDirection = function (event) {
|
16369 | var clientY = this.eventLastTime && this.eventLastTime.clientY;
|
16370 | var eClientY = event.clientY;
|
16371 | if (clientY === eClientY) {
|
16372 | return null;
|
16373 | }
|
16374 | return clientY > eClientY ? VerticalDirection.Up : VerticalDirection.Down;
|
16375 | };
|
16376 | DragAndDropService.prototype.createDropTargetEvent = function (dropTarget, event, hDirection, vDirection, fromNudge) {
|
16377 |
|
16378 | var dropZoneTarget = dropTarget.getContainer();
|
16379 | var rect = dropZoneTarget.getBoundingClientRect();
|
16380 | var _a = this, api = _a.gridApi, columnApi = _a.columnApi, dragItem = _a.dragItem, dragSource = _a.dragSource;
|
16381 | var x = event.clientX - rect.left;
|
16382 | var y = event.clientY - rect.top;
|
16383 | return { event: event, x: x, y: y, vDirection: vDirection, hDirection: hDirection, dragSource: dragSource, fromNudge: fromNudge, dragItem: dragItem, api: api, columnApi: columnApi, dropZoneTarget: dropZoneTarget };
|
16384 | };
|
16385 | DragAndDropService.prototype.positionGhost = function (event) {
|
16386 | var ghost = this.eGhost;
|
16387 | if (!ghost) {
|
16388 | return;
|
16389 | }
|
16390 | var ghostRect = ghost.getBoundingClientRect();
|
16391 | var ghostHeight = ghostRect.height;
|
16392 |
|
16393 |
|
16394 |
|
16395 | var browserWidth = getBodyWidth() - 2;
|
16396 | var browserHeight = getBodyHeight() - 2;
|
16397 | var top = event.pageY - (ghostHeight / 2);
|
16398 | var left = event.pageX - 10;
|
16399 | var eDocument = this.gridOptionsWrapper.getDocument();
|
16400 | var win = (eDocument.defaultView || window);
|
16401 | var windowScrollY = win.pageYOffset || eDocument.documentElement.scrollTop;
|
16402 | var windowScrollX = win.pageXOffset || eDocument.documentElement.scrollLeft;
|
16403 |
|
16404 | if (browserWidth > 0 && ((left + ghost.clientWidth) > (browserWidth + windowScrollX))) {
|
16405 | left = browserWidth + windowScrollX - ghost.clientWidth;
|
16406 | }
|
16407 | if (left < 0) {
|
16408 | left = 0;
|
16409 | }
|
16410 | if (browserHeight > 0 && ((top + ghost.clientHeight) > (browserHeight + windowScrollY))) {
|
16411 | top = browserHeight + windowScrollY - ghost.clientHeight;
|
16412 | }
|
16413 | if (top < 0) {
|
16414 | top = 0;
|
16415 | }
|
16416 | ghost.style.left = left + "px";
|
16417 | ghost.style.top = top + "px";
|
16418 | };
|
16419 | DragAndDropService.prototype.removeGhost = function () {
|
16420 | if (this.eGhost && this.eGhostParent) {
|
16421 | this.eGhostParent.removeChild(this.eGhost);
|
16422 | }
|
16423 | this.eGhost = null;
|
16424 | };
|
16425 | DragAndDropService.prototype.createGhost = function () {
|
16426 | this.eGhost = loadTemplate(DragAndDropService_1.GHOST_TEMPLATE);
|
16427 | var theme = this.environment.getTheme().theme;
|
16428 | if (theme) {
|
16429 | this.eGhost.classList.add(theme);
|
16430 | }
|
16431 | this.eGhostIcon = this.eGhost.querySelector('.ag-dnd-ghost-icon');
|
16432 | this.setGhostIcon(null);
|
16433 | var eText = this.eGhost.querySelector('.ag-dnd-ghost-label');
|
16434 | var dragItemName = this.dragSource.dragItemName;
|
16435 | if (isFunction(dragItemName)) {
|
16436 | dragItemName = dragItemName();
|
16437 | }
|
16438 | eText.innerHTML = escapeString(dragItemName) || '';
|
16439 | this.eGhost.style.height = '25px';
|
16440 | this.eGhost.style.top = '20px';
|
16441 | this.eGhost.style.left = '20px';
|
16442 | var eDocument = this.gridOptionsWrapper.getDocument();
|
16443 | var targetEl = null;
|
16444 | try {
|
16445 | targetEl = eDocument.fullscreenElement;
|
16446 | }
|
16447 | catch (e) {
|
16448 |
|
16449 |
|
16450 | }
|
16451 | finally {
|
16452 | if (!targetEl) {
|
16453 | targetEl = eDocument.querySelector('body');
|
16454 | }
|
16455 | }
|
16456 | this.eGhostParent = targetEl;
|
16457 | if (!this.eGhostParent) {
|
16458 | console.warn('AG Grid: could not find document body, it is needed for dragging columns');
|
16459 | }
|
16460 | else {
|
16461 | this.eGhostParent.appendChild(this.eGhost);
|
16462 | }
|
16463 | };
|
16464 | DragAndDropService.prototype.setGhostIcon = function (iconName, shake) {
|
16465 | if (shake === void 0) { shake = false; }
|
16466 | clearElement(this.eGhostIcon);
|
16467 | var eIcon = null;
|
16468 | if (!iconName) {
|
16469 | iconName = this.dragSource.defaultIconName || DragAndDropService_1.ICON_NOT_ALLOWED;
|
16470 | }
|
16471 | switch (iconName) {
|
16472 | case DragAndDropService_1.ICON_PINNED:
|
16473 | eIcon = this.ePinnedIcon;
|
16474 | break;
|
16475 | case DragAndDropService_1.ICON_MOVE:
|
16476 | eIcon = this.eMoveIcon;
|
16477 | break;
|
16478 | case DragAndDropService_1.ICON_LEFT:
|
16479 | eIcon = this.eLeftIcon;
|
16480 | break;
|
16481 | case DragAndDropService_1.ICON_RIGHT:
|
16482 | eIcon = this.eRightIcon;
|
16483 | break;
|
16484 | case DragAndDropService_1.ICON_GROUP:
|
16485 | eIcon = this.eGroupIcon;
|
16486 | break;
|
16487 | case DragAndDropService_1.ICON_AGGREGATE:
|
16488 | eIcon = this.eAggregateIcon;
|
16489 | break;
|
16490 | case DragAndDropService_1.ICON_PIVOT:
|
16491 | eIcon = this.ePivotIcon;
|
16492 | break;
|
16493 | case DragAndDropService_1.ICON_NOT_ALLOWED:
|
16494 | eIcon = this.eDropNotAllowedIcon;
|
16495 | break;
|
16496 | case DragAndDropService_1.ICON_HIDE:
|
16497 | eIcon = this.eHideIcon;
|
16498 | break;
|
16499 | }
|
16500 | this.eGhostIcon.classList.toggle('ag-shake-left-to-right', shake);
|
16501 | if (eIcon === this.eHideIcon && this.gridOptionsWrapper.isSuppressDragLeaveHidesColumns()) {
|
16502 | return;
|
16503 | }
|
16504 | if (eIcon) {
|
16505 | this.eGhostIcon.appendChild(eIcon);
|
16506 | }
|
16507 | };
|
16508 | var DragAndDropService_1;
|
16509 | DragAndDropService.ICON_PINNED = 'pinned';
|
16510 | DragAndDropService.ICON_MOVE = 'move';
|
16511 | DragAndDropService.ICON_LEFT = 'left';
|
16512 | DragAndDropService.ICON_RIGHT = 'right';
|
16513 | DragAndDropService.ICON_GROUP = 'group';
|
16514 | DragAndDropService.ICON_AGGREGATE = 'aggregate';
|
16515 | DragAndDropService.ICON_PIVOT = 'pivot';
|
16516 | DragAndDropService.ICON_NOT_ALLOWED = 'notAllowed';
|
16517 | DragAndDropService.ICON_HIDE = 'hide';
|
16518 | 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>";
|
16519 | __decorate$y([
|
16520 | Autowired('dragService')
|
16521 | ], DragAndDropService.prototype, "dragService", void 0);
|
16522 | __decorate$y([
|
16523 | Autowired('environment')
|
16524 | ], DragAndDropService.prototype, "environment", void 0);
|
16525 | __decorate$y([
|
16526 | Autowired('columnApi')
|
16527 | ], DragAndDropService.prototype, "columnApi", void 0);
|
16528 | __decorate$y([
|
16529 | Autowired('gridApi')
|
16530 | ], DragAndDropService.prototype, "gridApi", void 0);
|
16531 | __decorate$y([
|
16532 | PostConstruct
|
16533 | ], DragAndDropService.prototype, "init", null);
|
16534 | __decorate$y([
|
16535 | PreDestroy
|
16536 | ], DragAndDropService.prototype, "clearDragSourceParamsList", null);
|
16537 | DragAndDropService = DragAndDropService_1 = __decorate$y([
|
16538 | Bean('dragAndDropService')
|
16539 | ], DragAndDropService);
|
16540 | return DragAndDropService;
|
16541 | }(BeanStub));
|
16542 |
|
16543 |
|
16544 |
|
16545 |
|
16546 |
|
16547 |
|
16548 |
|
16549 | var __extends$D = (undefined && undefined.__extends) || (function () {
|
16550 | var extendStatics = function (d, b) {
|
16551 | extendStatics = Object.setPrototypeOf ||
|
16552 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
16553 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
16554 | return extendStatics(d, b);
|
16555 | };
|
16556 | return function (d, b) {
|
16557 | extendStatics(d, b);
|
16558 | function __() { this.constructor = d; }
|
16559 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16560 | };
|
16561 | })();
|
16562 | var __decorate$z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
16563 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
16564 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
16565 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
16566 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
16567 | };
|
16568 | var RowDragComp = (function (_super) {
|
16569 | __extends$D(RowDragComp, _super);
|
16570 | function RowDragComp(cellValueFn, rowNode, column, customGui, dragStartPixels, suppressVisibilityChange) {
|
16571 | var _this = _super.call(this) || this;
|
16572 | _this.cellValueFn = cellValueFn;
|
16573 | _this.rowNode = rowNode;
|
16574 | _this.column = column;
|
16575 | _this.customGui = customGui;
|
16576 | _this.dragStartPixels = dragStartPixels;
|
16577 | _this.suppressVisibilityChange = suppressVisibilityChange;
|
16578 | _this.dragSource = null;
|
16579 | return _this;
|
16580 | }
|
16581 | RowDragComp.prototype.isCustomGui = function () {
|
16582 | return this.customGui != null;
|
16583 | };
|
16584 | RowDragComp.prototype.postConstruct = function () {
|
16585 | if (!this.customGui) {
|
16586 | this.setTemplate( "<div class=\"ag-drag-handle ag-row-drag\" aria-hidden=\"true\"></div>");
|
16587 | this.getGui().appendChild(createIconNoSpan('rowDrag', this.beans.gridOptionsWrapper, null));
|
16588 | this.addDragSource();
|
16589 | }
|
16590 | else {
|
16591 | this.setDragElement(this.customGui, this.dragStartPixels);
|
16592 | }
|
16593 | this.checkCompatibility();
|
16594 | if (!this.suppressVisibilityChange) {
|
16595 | var strategy = this.beans.gridOptionsWrapper.isRowDragManaged() ?
|
16596 | new ManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column) :
|
16597 | new NonManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column);
|
16598 | this.createManagedBean(strategy, this.beans.context);
|
16599 | }
|
16600 | };
|
16601 | RowDragComp.prototype.setDragElement = function (dragElement, dragStartPixels) {
|
16602 | this.setTemplateFromElement(dragElement);
|
16603 | this.addDragSource(dragStartPixels);
|
16604 | };
|
16605 | RowDragComp.prototype.getSelectedCount = function () {
|
16606 | var isRowDragMultiRow = this.beans.gridOptionsWrapper.isRowDragMultiRow();
|
16607 | if (!isRowDragMultiRow) {
|
16608 | return 1;
|
16609 | }
|
16610 | var selection = this.beans.selectionService.getSelectedNodes();
|
16611 | return selection.indexOf(this.rowNode) !== -1 ? selection.length : 1;
|
16612 | };
|
16613 |
|
16614 | RowDragComp.prototype.checkCompatibility = function () {
|
16615 | var managed = this.beans.gridOptionsWrapper.isRowDragManaged();
|
16616 | var treeData = this.beans.gridOptionsWrapper.isTreeData();
|
16617 | if (treeData && managed) {
|
16618 | doOnce(function () {
|
16619 | return console.warn('AG Grid: If using row drag with tree data, you cannot have rowDragManaged=true');
|
16620 | }, 'RowDragComp.managedAndTreeData');
|
16621 | }
|
16622 | };
|
16623 | RowDragComp.prototype.addDragSource = function (dragStartPixels) {
|
16624 | var _this = this;
|
16625 | if (dragStartPixels === void 0) { dragStartPixels = 4; }
|
16626 |
|
16627 | if (this.dragSource) {
|
16628 | this.removeDragSource();
|
16629 | }
|
16630 | var dragItem = {
|
16631 | rowNode: this.rowNode,
|
16632 | columns: this.column ? [this.column] : undefined,
|
16633 | defaultTextValue: this.cellValueFn(),
|
16634 | };
|
16635 | var rowDragText = this.column && this.column.getColDef().rowDragText;
|
16636 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
16637 | this.dragSource = {
|
16638 | type: DragSourceType.RowDrag,
|
16639 | eElement: this.getGui(),
|
16640 | dragItemName: function () {
|
16641 | var dragItemCount = _this.getSelectedCount();
|
16642 | if (rowDragText) {
|
16643 | return rowDragText(dragItem, dragItemCount);
|
16644 | }
|
16645 | return dragItemCount === 1 ? _this.cellValueFn() : dragItemCount + " " + translate('rowDragRows', 'rows');
|
16646 | },
|
16647 | getDragItem: function () { return dragItem; },
|
16648 | dragStartPixels: dragStartPixels,
|
16649 | dragSourceDomDataKey: this.beans.gridOptionsWrapper.getDomDataKey()
|
16650 | };
|
16651 | this.beans.dragAndDropService.addDragSource(this.dragSource, true);
|
16652 | };
|
16653 | RowDragComp.prototype.removeDragSource = function () {
|
16654 | if (this.dragSource) {
|
16655 | this.beans.dragAndDropService.removeDragSource(this.dragSource);
|
16656 | }
|
16657 | this.dragSource = null;
|
16658 | };
|
16659 | __decorate$z([
|
16660 | Autowired('beans')
|
16661 | ], RowDragComp.prototype, "beans", void 0);
|
16662 | __decorate$z([
|
16663 | PostConstruct
|
16664 | ], RowDragComp.prototype, "postConstruct", null);
|
16665 | __decorate$z([
|
16666 | PreDestroy
|
16667 | ], RowDragComp.prototype, "removeDragSource", null);
|
16668 | return RowDragComp;
|
16669 | }(Component));
|
16670 | var VisibilityStrategy = (function (_super) {
|
16671 | __extends$D(VisibilityStrategy, _super);
|
16672 | function VisibilityStrategy(parent, rowNode, column) {
|
16673 | var _this = _super.call(this) || this;
|
16674 | _this.parent = parent;
|
16675 | _this.rowNode = rowNode;
|
16676 | _this.column = column;
|
16677 | return _this;
|
16678 | }
|
16679 | VisibilityStrategy.prototype.setDisplayedOrVisible = function (neverDisplayed) {
|
16680 | if (neverDisplayed) {
|
16681 | this.parent.setDisplayed(false);
|
16682 | }
|
16683 | else {
|
16684 | var shown = true;
|
16685 | var isShownSometimes = false;
|
16686 | if (this.column) {
|
16687 | shown = this.column.isRowDrag(this.rowNode) || this.parent.isCustomGui();
|
16688 | isShownSometimes = isFunction(this.column.getColDef().rowDrag);
|
16689 | }
|
16690 |
|
16691 |
|
16692 |
|
16693 | if (isShownSometimes) {
|
16694 | this.parent.setDisplayed(true);
|
16695 | this.parent.setVisible(shown);
|
16696 | }
|
16697 | else {
|
16698 | this.parent.setDisplayed(shown);
|
16699 | this.parent.setVisible(true);
|
16700 | }
|
16701 | }
|
16702 | };
|
16703 | return VisibilityStrategy;
|
16704 | }(BeanStub));
|
16705 |
|
16706 | var NonManagedVisibilityStrategy = (function (_super) {
|
16707 | __extends$D(NonManagedVisibilityStrategy, _super);
|
16708 | function NonManagedVisibilityStrategy(parent, beans, rowNode, column) {
|
16709 | var _this = _super.call(this, parent, rowNode, column) || this;
|
16710 | _this.beans = beans;
|
16711 | return _this;
|
16712 | }
|
16713 | NonManagedVisibilityStrategy.prototype.postConstruct = function () {
|
16714 | this.addManagedListener(this.beans.gridOptionsWrapper, 'suppressRowDrag', this.onSuppressRowDrag.bind(this));
|
16715 |
|
16716 | this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));
|
16717 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
|
16718 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
|
16719 | this.addManagedListener(this.beans.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.workOutVisibility.bind(this));
|
16720 | this.workOutVisibility();
|
16721 | };
|
16722 | NonManagedVisibilityStrategy.prototype.onSuppressRowDrag = function () {
|
16723 | this.workOutVisibility();
|
16724 | };
|
16725 | NonManagedVisibilityStrategy.prototype.workOutVisibility = function () {
|
16726 |
|
16727 | var neverDisplayed = this.beans.gridOptionsWrapper.isSuppressRowDrag();
|
16728 | this.setDisplayedOrVisible(neverDisplayed);
|
16729 | };
|
16730 | __decorate$z([
|
16731 | PostConstruct
|
16732 | ], NonManagedVisibilityStrategy.prototype, "postConstruct", null);
|
16733 | return NonManagedVisibilityStrategy;
|
16734 | }(VisibilityStrategy));
|
16735 |
|
16736 | var ManagedVisibilityStrategy = (function (_super) {
|
16737 | __extends$D(ManagedVisibilityStrategy, _super);
|
16738 | function ManagedVisibilityStrategy(parent, beans, rowNode, column) {
|
16739 | var _this = _super.call(this, parent, rowNode, column) || this;
|
16740 | _this.beans = beans;
|
16741 | return _this;
|
16742 | }
|
16743 | ManagedVisibilityStrategy.prototype.postConstruct = function () {
|
16744 |
|
16745 | this.addManagedListener(this.beans.eventService, Events.EVENT_SORT_CHANGED, this.workOutVisibility.bind(this));
|
16746 | this.addManagedListener(this.beans.eventService, Events.EVENT_FILTER_CHANGED, this.workOutVisibility.bind(this));
|
16747 | this.addManagedListener(this.beans.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.workOutVisibility.bind(this));
|
16748 | this.addManagedListener(this.beans.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.workOutVisibility.bind(this));
|
16749 |
|
16750 | this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));
|
16751 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
|
16752 | this.addManagedListener(this.beans.gridOptionsWrapper, 'suppressRowDrag', this.onSuppressRowDrag.bind(this));
|
16753 | this.workOutVisibility();
|
16754 | };
|
16755 | ManagedVisibilityStrategy.prototype.onSuppressRowDrag = function () {
|
16756 | this.workOutVisibility();
|
16757 | };
|
16758 | ManagedVisibilityStrategy.prototype.workOutVisibility = function () {
|
16759 |
|
16760 | var gridBodyCon = this.beans.ctrlsService.getGridBodyCtrl();
|
16761 | var rowDragFeature = gridBodyCon.getRowDragFeature();
|
16762 | var shouldPreventRowMove = rowDragFeature && rowDragFeature.shouldPreventRowMove();
|
16763 | var suppressRowDrag = this.beans.gridOptionsWrapper.isSuppressRowDrag();
|
16764 | var hasExternalDropZones = this.beans.dragAndDropService.hasExternalDropZones();
|
16765 | var neverDisplayed = (shouldPreventRowMove && !hasExternalDropZones) || suppressRowDrag;
|
16766 | this.setDisplayedOrVisible(neverDisplayed);
|
16767 | };
|
16768 | __decorate$z([
|
16769 | PostConstruct
|
16770 | ], ManagedVisibilityStrategy.prototype, "postConstruct", null);
|
16771 | return ManagedVisibilityStrategy;
|
16772 | }(VisibilityStrategy));
|
16773 |
|
16774 |
|
16775 |
|
16776 |
|
16777 |
|
16778 |
|
16779 |
|
16780 | var __extends$E = (undefined && undefined.__extends) || (function () {
|
16781 | var extendStatics = function (d, b) {
|
16782 | extendStatics = Object.setPrototypeOf ||
|
16783 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
16784 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
16785 | return extendStatics(d, b);
|
16786 | };
|
16787 | return function (d, b) {
|
16788 | extendStatics(d, b);
|
16789 | function __() { this.constructor = d; }
|
16790 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16791 | };
|
16792 | })();
|
16793 | var __assign$7 = (undefined && undefined.__assign) || function () {
|
16794 | __assign$7 = Object.assign || function(t) {
|
16795 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
16796 | s = arguments[i];
|
16797 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
16798 | t[p] = s[p];
|
16799 | }
|
16800 | return t;
|
16801 | };
|
16802 | return __assign$7.apply(this, arguments);
|
16803 | };
|
16804 | var __decorate$A = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
16805 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
16806 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
16807 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
16808 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
16809 | };
|
16810 | var GroupCellRendererCtrl = (function (_super) {
|
16811 | __extends$E(GroupCellRendererCtrl, _super);
|
16812 | function GroupCellRendererCtrl() {
|
16813 | return _super !== null && _super.apply(this, arguments) || this;
|
16814 | }
|
16815 | GroupCellRendererCtrl.prototype.init = function (comp, eGui, eCheckbox, eExpanded, eContracted, compClass, params) {
|
16816 | this.params = params;
|
16817 | this.eGui = eGui;
|
16818 | this.eCheckbox = eCheckbox;
|
16819 | this.eExpanded = eExpanded;
|
16820 | this.eContracted = eContracted;
|
16821 | this.comp = comp;
|
16822 | this.compClass = compClass;
|
16823 | var topLevelFooter = this.isTopLevelFooter();
|
16824 | var embeddedRowMismatch = this.isEmbeddedRowMismatch();
|
16825 |
|
16826 |
|
16827 | var nullValue = params.value == null;
|
16828 | var skipCell = false;
|
16829 |
|
16830 |
|
16831 | if (this.gridOptionsWrapper.isGroupIncludeFooter() && this.gridOptionsWrapper.isGroupHideOpenParents()) {
|
16832 | var node = params.node;
|
16833 | if (node.footer) {
|
16834 | var showRowGroup = params.colDef && params.colDef.showRowGroup;
|
16835 | var rowGroupColumnId = node.rowGroupColumn && node.rowGroupColumn.getColId();
|
16836 | skipCell = showRowGroup !== rowGroupColumnId;
|
16837 | }
|
16838 | }
|
16839 | this.cellIsBlank = topLevelFooter ? false : (embeddedRowMismatch || nullValue || skipCell);
|
16840 | if (this.cellIsBlank) {
|
16841 | return;
|
16842 | }
|
16843 | this.setupShowingValueForOpenedParent();
|
16844 | this.findDisplayedGroupNode();
|
16845 | this.addFullWidthRowDraggerIfNeeded();
|
16846 | this.addExpandAndContract();
|
16847 | this.addCheckboxIfNeeded();
|
16848 | this.addValueElement();
|
16849 | this.setupIndent();
|
16850 | this.refreshAriaExpanded();
|
16851 | };
|
16852 | GroupCellRendererCtrl.prototype.destroy = function () {
|
16853 | _super.prototype.destroy.call(this);
|
16854 |
|
16855 | this.expandListener = null;
|
16856 | };
|
16857 | GroupCellRendererCtrl.prototype.refreshAriaExpanded = function () {
|
16858 | var _a = this.params, node = _a.node, eParentOfValue = _a.eParentOfValue;
|
16859 | if (this.expandListener) {
|
16860 | this.expandListener = this.expandListener();
|
16861 | }
|
16862 | if (!this.isExpandable()) {
|
16863 | removeAriaExpanded(eParentOfValue);
|
16864 | return;
|
16865 | }
|
16866 | var listener = function () {
|
16867 |
|
16868 | setAriaExpanded(eParentOfValue, !!node.expanded);
|
16869 | };
|
16870 | this.expandListener = this.addManagedListener(node, RowNode.EVENT_EXPANDED_CHANGED, listener) || null;
|
16871 | listener();
|
16872 | };
|
16873 | GroupCellRendererCtrl.prototype.isTopLevelFooter = function () {
|
16874 | if (!this.gridOptionsWrapper.isGroupIncludeTotalFooter()) {
|
16875 | return false;
|
16876 | }
|
16877 | if (this.params.value != null || this.params.node.level != -1) {
|
16878 | return false;
|
16879 | }
|
16880 |
|
16881 |
|
16882 |
|
16883 | var colDef = this.params.colDef;
|
16884 | var doingFullWidth = colDef == null;
|
16885 | if (doingFullWidth) {
|
16886 | return true;
|
16887 | }
|
16888 | if (colDef.showRowGroup === true) {
|
16889 | return true;
|
16890 | }
|
16891 | var rowGroupCols = this.columnModel.getRowGroupColumns();
|
16892 |
|
16893 | if (!rowGroupCols || rowGroupCols.length === 0) {
|
16894 | return true;
|
16895 | }
|
16896 | var firstRowGroupCol = rowGroupCols[0];
|
16897 | return firstRowGroupCol.getId() === colDef.showRowGroup;
|
16898 | };
|
16899 |
|
16900 |
|
16901 |
|
16902 | GroupCellRendererCtrl.prototype.isEmbeddedRowMismatch = function () {
|
16903 | if (!this.params.fullWidth || !this.gridOptionsWrapper.isEmbedFullWidthRows()) {
|
16904 | return false;
|
16905 | }
|
16906 | var pinnedLeftCell = this.params.pinned === Constants.PINNED_LEFT;
|
16907 | var pinnedRightCell = this.params.pinned === Constants.PINNED_RIGHT;
|
16908 | var bodyCell = !pinnedLeftCell && !pinnedRightCell;
|
16909 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
16910 | if (this.columnModel.isPinningLeft()) {
|
16911 | return !pinnedRightCell;
|
16912 | }
|
16913 | return !bodyCell;
|
16914 | }
|
16915 | if (this.columnModel.isPinningLeft()) {
|
16916 | return !pinnedLeftCell;
|
16917 | }
|
16918 | return !bodyCell;
|
16919 | };
|
16920 | GroupCellRendererCtrl.prototype.findDisplayedGroupNode = function () {
|
16921 | var column = this.params.column;
|
16922 | var rowNode = this.params.node;
|
16923 | if (this.showingValueForOpenedParent) {
|
16924 | var pointer = rowNode.parent;
|
16925 | while (pointer != null) {
|
16926 | if (pointer.rowGroupColumn && column.isRowGroupDisplayed(pointer.rowGroupColumn.getId())) {
|
16927 | this.displayedGroupNode = pointer;
|
16928 | break;
|
16929 | }
|
16930 | pointer = pointer.parent;
|
16931 | }
|
16932 | }
|
16933 |
|
16934 | if (missing(this.displayedGroupNode)) {
|
16935 | this.displayedGroupNode = rowNode;
|
16936 | }
|
16937 | };
|
16938 | GroupCellRendererCtrl.prototype.setupShowingValueForOpenedParent = function () {
|
16939 |
|
16940 |
|
16941 | var rowNode = this.params.node;
|
16942 | var column = this.params.column;
|
16943 | if (!this.gridOptionsWrapper.isGroupHideOpenParents()) {
|
16944 | this.showingValueForOpenedParent = false;
|
16945 | return;
|
16946 | }
|
16947 |
|
16948 |
|
16949 |
|
16950 | if (!rowNode.groupData) {
|
16951 | this.showingValueForOpenedParent = false;
|
16952 | return;
|
16953 | }
|
16954 |
|
16955 |
|
16956 | var showingGroupNode = rowNode.rowGroupColumn != null;
|
16957 | if (showingGroupNode) {
|
16958 | var keyOfGroupingColumn = rowNode.rowGroupColumn.getId();
|
16959 | var configuredToShowThisGroupLevel = column.isRowGroupDisplayed(keyOfGroupingColumn);
|
16960 |
|
16961 | if (configuredToShowThisGroupLevel) {
|
16962 | this.showingValueForOpenedParent = false;
|
16963 | return;
|
16964 | }
|
16965 | }
|
16966 |
|
16967 |
|
16968 | var valPresent = rowNode.groupData[column.getId()] != null;
|
16969 | this.showingValueForOpenedParent = valPresent;
|
16970 | };
|
16971 | GroupCellRendererCtrl.prototype.addValueElement = function () {
|
16972 | if (this.displayedGroupNode.footer) {
|
16973 | this.addFooterValue();
|
16974 | }
|
16975 | else {
|
16976 | this.addGroupValue();
|
16977 | this.addChildCount();
|
16978 | }
|
16979 | };
|
16980 | GroupCellRendererCtrl.prototype.addGroupValue = function () {
|
16981 |
|
16982 | var paramsAdjusted = this.adjustParamsWithDetailsFromRelatedColumn();
|
16983 | var innerCompDetails = this.getInnerCompDetails(paramsAdjusted);
|
16984 | var valueFormatted = paramsAdjusted.valueFormatted, value = paramsAdjusted.value;
|
16985 | var valueWhenNoRenderer = valueFormatted != null ? valueFormatted : value;
|
16986 | this.comp.setInnerRenderer(innerCompDetails, valueWhenNoRenderer);
|
16987 | };
|
16988 | GroupCellRendererCtrl.prototype.adjustParamsWithDetailsFromRelatedColumn = function () {
|
16989 | var relatedColumn = this.displayedGroupNode.rowGroupColumn;
|
16990 | var column = this.params.column;
|
16991 | if (!relatedColumn) {
|
16992 | return this.params;
|
16993 | }
|
16994 | var notFullWidth = column != null;
|
16995 | if (notFullWidth) {
|
16996 | var showingThisRowGroup = column.isRowGroupDisplayed(relatedColumn.getId());
|
16997 | if (!showingThisRowGroup) {
|
16998 | return this.params;
|
16999 | }
|
17000 | }
|
17001 | var params = this.params;
|
17002 | var _a = this.params, value = _a.value, node = _a.node;
|
17003 | var valueFormatted = this.valueFormatterService.formatValue(relatedColumn, node, value);
|
17004 |
|
17005 |
|
17006 |
|
17007 | var paramsAdjusted = __assign$7(__assign$7({}, params), { valueFormatted: valueFormatted });
|
17008 | return paramsAdjusted;
|
17009 | };
|
17010 | GroupCellRendererCtrl.prototype.addFooterValue = function () {
|
17011 | var footerValueGetter = this.params.footerValueGetter;
|
17012 | var footerValue = '';
|
17013 | if (footerValueGetter) {
|
17014 |
|
17015 | var paramsClone = cloneObject(this.params);
|
17016 | paramsClone.value = this.params.value;
|
17017 | if (typeof footerValueGetter === 'function') {
|
17018 | footerValue = footerValueGetter(paramsClone);
|
17019 | }
|
17020 | else if (typeof footerValueGetter === 'string') {
|
17021 | footerValue = this.expressionService.evaluate(footerValueGetter, paramsClone);
|
17022 | }
|
17023 | else {
|
17024 | console.warn('AG Grid: footerValueGetter should be either a function or a string (expression)');
|
17025 | }
|
17026 | }
|
17027 | else {
|
17028 | footerValue = 'Total ' + (this.params.value != null ? this.params.value : '');
|
17029 | }
|
17030 | var innerCompDetails = this.getInnerCompDetails(this.params);
|
17031 | this.comp.setInnerRenderer(innerCompDetails, footerValue);
|
17032 | };
|
17033 | GroupCellRendererCtrl.prototype.getInnerCompDetails = function (params) {
|
17034 | var _this = this;
|
17035 |
|
17036 | if (params.fullWidth) {
|
17037 | return this.userComponentFactory.getFullWidthGroupRowInnerCellRenderer(this.gridOptions.groupRowRendererParams, params);
|
17038 | }
|
17039 |
|
17040 |
|
17041 |
|
17042 |
|
17043 |
|
17044 |
|
17045 |
|
17046 |
|
17047 |
|
17048 |
|
17049 |
|
17050 |
|
17051 |
|
17052 | var innerCompDetails = this.userComponentFactory
|
17053 | .getInnerRendererDetails(params, params);
|
17054 |
|
17055 |
|
17056 | var isGroupRowRenderer = function (details) { return details && details.componentClass == _this.compClass; };
|
17057 | if (innerCompDetails && !isGroupRowRenderer(innerCompDetails)) {
|
17058 |
|
17059 | return innerCompDetails;
|
17060 | }
|
17061 | var relatedColumn = this.displayedGroupNode.rowGroupColumn;
|
17062 | var relatedColDef = relatedColumn ? relatedColumn.getColDef() : undefined;
|
17063 | if (!relatedColDef) {
|
17064 | return;
|
17065 | }
|
17066 |
|
17067 | var relatedCompDetails = this.userComponentFactory
|
17068 | .getCellRendererDetails(relatedColDef, params);
|
17069 | if (relatedCompDetails && !isGroupRowRenderer(relatedCompDetails)) {
|
17070 |
|
17071 | return relatedCompDetails;
|
17072 | }
|
17073 | if (isGroupRowRenderer(relatedCompDetails) &&
|
17074 | relatedColDef.cellRendererParams &&
|
17075 | relatedColDef.cellRendererParams.innerRenderer) {
|
17076 |
|
17077 |
|
17078 | var res = this.userComponentFactory.getInnerRendererDetails(relatedColDef.cellRendererParams, params);
|
17079 | return res;
|
17080 | }
|
17081 | };
|
17082 | GroupCellRendererCtrl.prototype.addChildCount = function () {
|
17083 |
|
17084 |
|
17085 | if (this.params.suppressCount) {
|
17086 | return;
|
17087 | }
|
17088 | this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED, this.updateChildCount.bind(this));
|
17089 |
|
17090 | this.updateChildCount();
|
17091 | };
|
17092 | GroupCellRendererCtrl.prototype.updateChildCount = function () {
|
17093 | var allChildrenCount = this.displayedGroupNode.allChildrenCount;
|
17094 | var showingGroupForThisNode = this.isShowRowGroupForThisRow();
|
17095 | var showCount = showingGroupForThisNode && allChildrenCount != null && allChildrenCount >= 0;
|
17096 | var countString = showCount ? "(" + allChildrenCount + ")" : "";
|
17097 | this.comp.setChildCount(countString);
|
17098 | };
|
17099 | GroupCellRendererCtrl.prototype.isShowRowGroupForThisRow = function () {
|
17100 | if (this.gridOptionsWrapper.isTreeData()) {
|
17101 | return true;
|
17102 | }
|
17103 | var rowGroupColumn = this.displayedGroupNode.rowGroupColumn;
|
17104 | if (!rowGroupColumn) {
|
17105 | return false;
|
17106 | }
|
17107 |
|
17108 | var column = this.params.column;
|
17109 | var thisColumnIsInterested = column == null || column.isRowGroupDisplayed(rowGroupColumn.getId());
|
17110 | return thisColumnIsInterested;
|
17111 | };
|
17112 | GroupCellRendererCtrl.prototype.addExpandAndContract = function () {
|
17113 | var params = this.params;
|
17114 | var eExpandedIcon = createIconNoSpan('groupExpanded', this.gridOptionsWrapper, null);
|
17115 | var eContractedIcon = createIconNoSpan('groupContracted', this.gridOptionsWrapper, null);
|
17116 | if (eExpandedIcon) {
|
17117 | this.eExpanded.appendChild(eExpandedIcon);
|
17118 | }
|
17119 | if (eContractedIcon) {
|
17120 | this.eContracted.appendChild(eContractedIcon);
|
17121 | }
|
17122 | var eGroupCell = params.eGridCell;
|
17123 |
|
17124 | if (!this.gridOptionsWrapper.isEnableGroupEdit() && this.isExpandable() && !params.suppressDoubleClickExpand) {
|
17125 | this.addManagedListener(eGroupCell, 'dblclick', this.onCellDblClicked.bind(this));
|
17126 | }
|
17127 | this.addManagedListener(this.eExpanded, 'click', this.onExpandClicked.bind(this));
|
17128 | this.addManagedListener(this.eContracted, 'click', this.onExpandClicked.bind(this));
|
17129 |
|
17130 | this.addManagedListener(eGroupCell, 'keydown', this.onKeyDown.bind(this));
|
17131 | this.addManagedListener(params.node, RowNode.EVENT_EXPANDED_CHANGED, this.showExpandAndContractIcons.bind(this));
|
17132 | this.showExpandAndContractIcons();
|
17133 |
|
17134 |
|
17135 | var expandableChangedListener = this.onRowNodeIsExpandableChanged.bind(this);
|
17136 | this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED, expandableChangedListener);
|
17137 | this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_MASTER_CHANGED, expandableChangedListener);
|
17138 | this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_GROUP_CHANGED, expandableChangedListener);
|
17139 | this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_HAS_CHILDREN_CHANGED, expandableChangedListener);
|
17140 | };
|
17141 | GroupCellRendererCtrl.prototype.onExpandClicked = function (mouseEvent) {
|
17142 | if (isStopPropagationForAgGrid(mouseEvent)) {
|
17143 | return;
|
17144 | }
|
17145 |
|
17146 | stopPropagationForAgGrid(mouseEvent);
|
17147 | this.onExpandOrContract(mouseEvent);
|
17148 | };
|
17149 | GroupCellRendererCtrl.prototype.onExpandOrContract = function (e) {
|
17150 |
|
17151 | var rowNode = this.displayedGroupNode;
|
17152 | var nextExpandState = !rowNode.expanded;
|
17153 | rowNode.setExpanded(nextExpandState, e);
|
17154 | };
|
17155 | GroupCellRendererCtrl.prototype.isExpandable = function () {
|
17156 | if (this.showingValueForOpenedParent) {
|
17157 | return true;
|
17158 | }
|
17159 | var rowNode = this.displayedGroupNode;
|
17160 | var reducedLeafNode = this.columnModel.isPivotMode() && rowNode.leafGroup;
|
17161 | var expandableGroup = rowNode.isExpandable() && !rowNode.footer && !reducedLeafNode;
|
17162 | if (!expandableGroup) {
|
17163 | return false;
|
17164 | }
|
17165 |
|
17166 | var column = this.params.column;
|
17167 | var displayingForOneColumnOnly = column != null && typeof column.getColDef().showRowGroup === 'string';
|
17168 | if (displayingForOneColumnOnly) {
|
17169 | var showing = this.isShowRowGroupForThisRow();
|
17170 | return showing;
|
17171 | }
|
17172 | return true;
|
17173 | };
|
17174 | GroupCellRendererCtrl.prototype.showExpandAndContractIcons = function () {
|
17175 | var _a = this, params = _a.params, displayedGroup = _a.displayedGroupNode, columnModel = _a.columnModel;
|
17176 | var node = params.node;
|
17177 | var isExpandable = this.isExpandable();
|
17178 | if (isExpandable) {
|
17179 |
|
17180 |
|
17181 | var expanded = this.showingValueForOpenedParent ? true : node.expanded;
|
17182 | this.comp.setExpandedDisplayed(expanded);
|
17183 | this.comp.setContractedDisplayed(!expanded);
|
17184 | }
|
17185 | else {
|
17186 |
|
17187 | this.comp.setExpandedDisplayed(false);
|
17188 | this.comp.setContractedDisplayed(false);
|
17189 | }
|
17190 |
|
17191 | var pivotMode = columnModel.isPivotMode();
|
17192 | var pivotModeAndLeafGroup = pivotMode && displayedGroup.leafGroup;
|
17193 | var addExpandableCss = isExpandable && !pivotModeAndLeafGroup;
|
17194 | var isTotalFooterNode = node.footer && node.level === -1;
|
17195 | this.comp.addOrRemoveCssClass('ag-cell-expandable', addExpandableCss);
|
17196 | this.comp.addOrRemoveCssClass('ag-row-group', addExpandableCss);
|
17197 | if (pivotMode) {
|
17198 | this.comp.addOrRemoveCssClass('ag-pivot-leaf-group', pivotModeAndLeafGroup);
|
17199 | }
|
17200 | else if (!isTotalFooterNode) {
|
17201 | this.comp.addOrRemoveCssClass('ag-row-group-leaf-indent', !addExpandableCss);
|
17202 | }
|
17203 | };
|
17204 | GroupCellRendererCtrl.prototype.onRowNodeIsExpandableChanged = function () {
|
17205 |
|
17206 | this.showExpandAndContractIcons();
|
17207 |
|
17208 | this.setIndent();
|
17209 | this.refreshAriaExpanded();
|
17210 | };
|
17211 | GroupCellRendererCtrl.prototype.setupIndent = function () {
|
17212 |
|
17213 |
|
17214 |
|
17215 | var node = this.params.node;
|
17216 | var suppressPadding = this.params.suppressPadding;
|
17217 | if (!suppressPadding) {
|
17218 | this.addManagedListener(node, RowNode.EVENT_UI_LEVEL_CHANGED, this.setIndent.bind(this));
|
17219 | this.setIndent();
|
17220 | }
|
17221 | };
|
17222 | GroupCellRendererCtrl.prototype.setIndent = function () {
|
17223 | if (this.gridOptionsWrapper.isGroupHideOpenParents()) {
|
17224 | return;
|
17225 | }
|
17226 | var params = this.params;
|
17227 | var rowNode = params.node;
|
17228 |
|
17229 | var fullWithRow = !!params.colDef;
|
17230 | var treeData = this.gridOptionsWrapper.isTreeData();
|
17231 | var manyDimensionThisColumn = !fullWithRow || treeData || params.colDef.showRowGroup === true;
|
17232 | var paddingCount = manyDimensionThisColumn ? rowNode.uiLevel : 0;
|
17233 | var userProvidedPaddingPixelsTheDeprecatedWay = params.padding >= 0;
|
17234 | if (userProvidedPaddingPixelsTheDeprecatedWay) {
|
17235 | 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');
|
17236 | }
|
17237 | if (this.indentClass) {
|
17238 | this.comp.addOrRemoveCssClass(this.indentClass, false);
|
17239 | }
|
17240 | this.indentClass = 'ag-row-group-indent-' + paddingCount;
|
17241 | this.comp.addOrRemoveCssClass(this.indentClass, true);
|
17242 | };
|
17243 | GroupCellRendererCtrl.prototype.addFullWidthRowDraggerIfNeeded = function () {
|
17244 | var _this = this;
|
17245 | if (!this.params.fullWidth || !this.params.rowDrag) {
|
17246 | return;
|
17247 | }
|
17248 | var rowDragComp = new RowDragComp(function () { return _this.params.value; }, this.params.node);
|
17249 | this.createManagedBean(rowDragComp, this.context);
|
17250 | this.eGui.insertAdjacentElement('afterbegin', rowDragComp.getGui());
|
17251 | };
|
17252 | GroupCellRendererCtrl.prototype.isUserWantsSelected = function () {
|
17253 | var paramsCheckbox = this.params.checkbox;
|
17254 | if (typeof paramsCheckbox === 'function') {
|
17255 | return paramsCheckbox(this.params);
|
17256 | }
|
17257 | return paramsCheckbox === true;
|
17258 | };
|
17259 | GroupCellRendererCtrl.prototype.addCheckboxIfNeeded = function () {
|
17260 | var _this = this;
|
17261 | var rowNode = this.displayedGroupNode;
|
17262 | var checkboxNeeded = this.isUserWantsSelected() &&
|
17263 |
|
17264 | !rowNode.footer &&
|
17265 |
|
17266 | !rowNode.rowPinned &&
|
17267 |
|
17268 | !rowNode.detail;
|
17269 | if (checkboxNeeded) {
|
17270 | var cbSelectionComponent_1 = new CheckboxSelectionComponent();
|
17271 | this.getContext().createBean(cbSelectionComponent_1);
|
17272 | cbSelectionComponent_1.init({ rowNode: rowNode, column: this.params.column });
|
17273 | this.eCheckbox.appendChild(cbSelectionComponent_1.getGui());
|
17274 | this.addDestroyFunc(function () { return _this.getContext().destroyBean(cbSelectionComponent_1); });
|
17275 | }
|
17276 | this.comp.setCheckboxVisible(checkboxNeeded);
|
17277 | };
|
17278 | GroupCellRendererCtrl.prototype.onKeyDown = function (event) {
|
17279 | var enterKeyPressed = event.key === KeyCode.ENTER;
|
17280 | if (!enterKeyPressed || this.params.suppressEnterExpand) {
|
17281 | return;
|
17282 | }
|
17283 | var cellEditable = this.params.column && this.params.column.isCellEditable(this.params.node);
|
17284 | if (cellEditable) {
|
17285 | return;
|
17286 | }
|
17287 | this.onExpandOrContract(event);
|
17288 | };
|
17289 | GroupCellRendererCtrl.prototype.onCellDblClicked = function (mouseEvent) {
|
17290 | if (isStopPropagationForAgGrid(mouseEvent)) {
|
17291 | return;
|
17292 | }
|
17293 |
|
17294 |
|
17295 |
|
17296 |
|
17297 | var targetIsExpandIcon = isElementInEventPath(this.eExpanded, mouseEvent)
|
17298 | || isElementInEventPath(this.eContracted, mouseEvent);
|
17299 | if (!targetIsExpandIcon) {
|
17300 | this.onExpandOrContract(mouseEvent);
|
17301 | }
|
17302 | };
|
17303 | __decorate$A([
|
17304 | Autowired('expressionService')
|
17305 | ], GroupCellRendererCtrl.prototype, "expressionService", void 0);
|
17306 | __decorate$A([
|
17307 | Autowired('valueFormatterService')
|
17308 | ], GroupCellRendererCtrl.prototype, "valueFormatterService", void 0);
|
17309 | __decorate$A([
|
17310 | Autowired('columnModel')
|
17311 | ], GroupCellRendererCtrl.prototype, "columnModel", void 0);
|
17312 | __decorate$A([
|
17313 | Autowired('userComponentFactory')
|
17314 | ], GroupCellRendererCtrl.prototype, "userComponentFactory", void 0);
|
17315 | __decorate$A([
|
17316 | Autowired('gridOptions')
|
17317 | ], GroupCellRendererCtrl.prototype, "gridOptions", void 0);
|
17318 | return GroupCellRendererCtrl;
|
17319 | }(BeanStub));
|
17320 |
|
17321 |
|
17322 |
|
17323 |
|
17324 |
|
17325 |
|
17326 |
|
17327 | var __extends$F = (undefined && undefined.__extends) || (function () {
|
17328 | var extendStatics = function (d, b) {
|
17329 | extendStatics = Object.setPrototypeOf ||
|
17330 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
17331 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
17332 | return extendStatics(d, b);
|
17333 | };
|
17334 | return function (d, b) {
|
17335 | extendStatics(d, b);
|
17336 | function __() { this.constructor = d; }
|
17337 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17338 | };
|
17339 | })();
|
17340 | var __decorate$B = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
17341 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
17342 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
17343 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
17344 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
17345 | };
|
17346 | var GroupCellRenderer = (function (_super) {
|
17347 | __extends$F(GroupCellRenderer, _super);
|
17348 | function GroupCellRenderer() {
|
17349 | return _super.call(this, GroupCellRenderer.TEMPLATE) || this;
|
17350 | }
|
17351 | GroupCellRenderer.prototype.init = function (params) {
|
17352 | var _this = this;
|
17353 | var compProxy = {
|
17354 | setInnerRenderer: function (compDetails, valueToDisplay) { return _this.setRenderDetails(compDetails, valueToDisplay); },
|
17355 | setChildCount: function (count) { return _this.eChildCount.innerHTML = count; },
|
17356 | addOrRemoveCssClass: function (cssClass, value) { return _this.addOrRemoveCssClass(cssClass, value); },
|
17357 | setContractedDisplayed: function (expanded) { return setDisplayed(_this.eContracted, expanded); },
|
17358 | setExpandedDisplayed: function (expanded) { return setDisplayed(_this.eExpanded, expanded); },
|
17359 | setCheckboxVisible: function (visible) { return _this.eCheckbox.classList.toggle('ag-invisible', !visible); }
|
17360 | };
|
17361 | var ctrl = this.createManagedBean(new GroupCellRendererCtrl());
|
17362 | var fullWidth = !params.colDef;
|
17363 | var eGui = this.getGui();
|
17364 | ctrl.init(compProxy, eGui, this.eCheckbox, this.eExpanded, this.eContracted, this.constructor, params);
|
17365 | if (fullWidth) {
|
17366 | setAriaRole(eGui, 'gridcell');
|
17367 | }
|
17368 | };
|
17369 | GroupCellRenderer.prototype.setRenderDetails = function (compDetails, valueToDisplay) {
|
17370 | var _this = this;
|
17371 | if (compDetails) {
|
17372 | var componentPromise = compDetails.newAgStackInstance();
|
17373 | if (!componentPromise) {
|
17374 | return;
|
17375 | }
|
17376 | componentPromise.then(function (comp) {
|
17377 | if (!comp) {
|
17378 | return;
|
17379 | }
|
17380 | var destroyComp = function () { return _this.context.destroyBean(comp); };
|
17381 | if (_this.isAlive()) {
|
17382 | _this.eValue.appendChild(comp.getGui());
|
17383 | _this.addDestroyFunc(destroyComp);
|
17384 | }
|
17385 | else {
|
17386 | destroyComp();
|
17387 | }
|
17388 | });
|
17389 | }
|
17390 | else {
|
17391 | this.eValue.innerText = valueToDisplay;
|
17392 | }
|
17393 | };
|
17394 |
|
17395 |
|
17396 | GroupCellRenderer.prototype.destroy = function () {
|
17397 | this.getContext().destroyBean(this.innerCellRenderer);
|
17398 | _super.prototype.destroy.call(this);
|
17399 | };
|
17400 | GroupCellRenderer.prototype.refresh = function () {
|
17401 | return false;
|
17402 | };
|
17403 | 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>";
|
17404 | __decorate$B([
|
17405 | RefSelector('eExpanded')
|
17406 | ], GroupCellRenderer.prototype, "eExpanded", void 0);
|
17407 | __decorate$B([
|
17408 | RefSelector('eContracted')
|
17409 | ], GroupCellRenderer.prototype, "eContracted", void 0);
|
17410 | __decorate$B([
|
17411 | RefSelector('eCheckbox')
|
17412 | ], GroupCellRenderer.prototype, "eCheckbox", void 0);
|
17413 | __decorate$B([
|
17414 | RefSelector('eValue')
|
17415 | ], GroupCellRenderer.prototype, "eValue", void 0);
|
17416 | __decorate$B([
|
17417 | RefSelector('eChildCount')
|
17418 | ], GroupCellRenderer.prototype, "eChildCount", void 0);
|
17419 | return GroupCellRenderer;
|
17420 | }(Component));
|
17421 |
|
17422 |
|
17423 |
|
17424 |
|
17425 |
|
17426 |
|
17427 |
|
17428 | var __extends$G = (undefined && undefined.__extends) || (function () {
|
17429 | var extendStatics = function (d, b) {
|
17430 | extendStatics = Object.setPrototypeOf ||
|
17431 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
17432 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
17433 | return extendStatics(d, b);
|
17434 | };
|
17435 | return function (d, b) {
|
17436 | extendStatics(d, b);
|
17437 | function __() { this.constructor = d; }
|
17438 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17439 | };
|
17440 | })();
|
17441 | var __decorate$C = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
17442 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
17443 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
17444 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
17445 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
17446 | };
|
17447 | var LoadingCellRenderer = (function (_super) {
|
17448 | __extends$G(LoadingCellRenderer, _super);
|
17449 | function LoadingCellRenderer() {
|
17450 | return _super.call(this, LoadingCellRenderer.TEMPLATE) || this;
|
17451 | }
|
17452 | LoadingCellRenderer.prototype.init = function (params) {
|
17453 | params.node.failedLoad ? this.setupFailed() : this.setupLoading();
|
17454 | };
|
17455 | LoadingCellRenderer.prototype.setupFailed = function () {
|
17456 | this.eLoadingText.innerText = 'ERR';
|
17457 | };
|
17458 | LoadingCellRenderer.prototype.setupLoading = function () {
|
17459 | var eLoadingIcon = createIconNoSpan('groupLoading', this.gridOptionsWrapper, null);
|
17460 | if (eLoadingIcon) {
|
17461 | this.eLoadingIcon.appendChild(eLoadingIcon);
|
17462 | }
|
17463 | var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
|
17464 | this.eLoadingText.innerText = localeTextFunc('loadingOoo', 'Loading');
|
17465 | };
|
17466 | LoadingCellRenderer.prototype.refresh = function (params) {
|
17467 | return false;
|
17468 | };
|
17469 |
|
17470 |
|
17471 | LoadingCellRenderer.prototype.destroy = function () {
|
17472 | _super.prototype.destroy.call(this);
|
17473 | };
|
17474 | 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>";
|
17475 | __decorate$C([
|
17476 | RefSelector('eLoadingIcon')
|
17477 | ], LoadingCellRenderer.prototype, "eLoadingIcon", void 0);
|
17478 | __decorate$C([
|
17479 | RefSelector('eLoadingText')
|
17480 | ], LoadingCellRenderer.prototype, "eLoadingText", void 0);
|
17481 | return LoadingCellRenderer;
|
17482 | }(Component));
|
17483 |
|
17484 |
|
17485 |
|
17486 |
|
17487 |
|
17488 |
|
17489 |
|
17490 | var __extends$H = (undefined && undefined.__extends) || (function () {
|
17491 | var extendStatics = function (d, b) {
|
17492 | extendStatics = Object.setPrototypeOf ||
|
17493 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
17494 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
17495 | return extendStatics(d, b);
|
17496 | };
|
17497 | return function (d, b) {
|
17498 | extendStatics(d, b);
|
17499 | function __() { this.constructor = d; }
|
17500 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17501 | };
|
17502 | })();
|
17503 | var LoadingOverlayComponent = (function (_super) {
|
17504 | __extends$H(LoadingOverlayComponent, _super);
|
17505 | function LoadingOverlayComponent() {
|
17506 | return _super.call(this) || this;
|
17507 | }
|
17508 |
|
17509 |
|
17510 | LoadingOverlayComponent.prototype.destroy = function () {
|
17511 | _super.prototype.destroy.call(this);
|
17512 | };
|
17513 | LoadingOverlayComponent.prototype.init = function (params) {
|
17514 | var template = this.gridOptionsWrapper.getOverlayLoadingTemplate() ?
|
17515 | this.gridOptionsWrapper.getOverlayLoadingTemplate() : LoadingOverlayComponent.DEFAULT_LOADING_OVERLAY_TEMPLATE;
|
17516 | var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
|
17517 | var localisedTemplate = template.replace('[LOADING...]', localeTextFunc('loadingOoo', 'Loading...'));
|
17518 | this.setTemplate(localisedTemplate);
|
17519 | };
|
17520 | LoadingOverlayComponent.DEFAULT_LOADING_OVERLAY_TEMPLATE = '<span class="ag-overlay-loading-center">[LOADING...]</span>';
|
17521 | return LoadingOverlayComponent;
|
17522 | }(Component));
|
17523 |
|
17524 |
|
17525 |
|
17526 |
|
17527 |
|
17528 |
|
17529 |
|
17530 | var __extends$I = (undefined && undefined.__extends) || (function () {
|
17531 | var extendStatics = function (d, b) {
|
17532 | extendStatics = Object.setPrototypeOf ||
|
17533 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
17534 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
17535 | return extendStatics(d, b);
|
17536 | };
|
17537 | return function (d, b) {
|
17538 | extendStatics(d, b);
|
17539 | function __() { this.constructor = d; }
|
17540 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17541 | };
|
17542 | })();
|
17543 | var NoRowsOverlayComponent = (function (_super) {
|
17544 | __extends$I(NoRowsOverlayComponent, _super);
|
17545 | function NoRowsOverlayComponent() {
|
17546 | return _super.call(this) || this;
|
17547 | }
|
17548 |
|
17549 |
|
17550 | NoRowsOverlayComponent.prototype.destroy = function () {
|
17551 | _super.prototype.destroy.call(this);
|
17552 | };
|
17553 | NoRowsOverlayComponent.prototype.init = function (params) {
|
17554 | var template = this.gridOptionsWrapper.getOverlayNoRowsTemplate() ?
|
17555 | this.gridOptionsWrapper.getOverlayNoRowsTemplate() : NoRowsOverlayComponent.DEFAULT_NO_ROWS_TEMPLATE;
|
17556 | var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
|
17557 | var localisedTemplate = template.replace('[NO_ROWS_TO_SHOW]', localeTextFunc('noRowsToShow', 'No Rows To Show'));
|
17558 | this.setTemplate(localisedTemplate);
|
17559 | };
|
17560 | NoRowsOverlayComponent.DEFAULT_NO_ROWS_TEMPLATE = '<span class="ag-overlay-no-rows-center">[NO_ROWS_TO_SHOW]</span>';
|
17561 | return NoRowsOverlayComponent;
|
17562 | }(Component));
|
17563 |
|
17564 |
|
17565 |
|
17566 |
|
17567 |
|
17568 |
|
17569 |
|
17570 | var __extends$J = (undefined && undefined.__extends) || (function () {
|
17571 | var extendStatics = function (d, b) {
|
17572 | extendStatics = Object.setPrototypeOf ||
|
17573 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
17574 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
17575 | return extendStatics(d, b);
|
17576 | };
|
17577 | return function (d, b) {
|
17578 | extendStatics(d, b);
|
17579 | function __() { this.constructor = d; }
|
17580 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17581 | };
|
17582 | })();
|
17583 | var TooltipComponent = (function (_super) {
|
17584 | __extends$J(TooltipComponent, _super);
|
17585 | function TooltipComponent() {
|
17586 | return _super.call(this, "<div class=\"ag-tooltip\"></div>") || this;
|
17587 | }
|
17588 |
|
17589 | TooltipComponent.prototype.init = function (params) {
|
17590 | var value = params.value;
|
17591 | this.getGui().innerHTML = escapeString(value);
|
17592 | };
|
17593 | return TooltipComponent;
|
17594 | }(PopupComponent));
|
17595 |
|
17596 |
|
17597 |
|
17598 |
|
17599 |
|
17600 |
|
17601 |
|
17602 | var __extends$K = (undefined && undefined.__extends) || (function () {
|
17603 | var extendStatics = function (d, b) {
|
17604 | extendStatics = Object.setPrototypeOf ||
|
17605 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
17606 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
17607 | return extendStatics(d, b);
|
17608 | };
|
17609 | return function (d, b) {
|
17610 | extendStatics(d, b);
|
17611 | function __() { this.constructor = d; }
|
17612 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17613 | };
|
17614 | })();
|
17615 | var __decorate$D = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
17616 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
17617 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
17618 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
17619 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
17620 | };
|
17621 | var UserComponentRegistry = (function (_super) {
|
17622 | __extends$K(UserComponentRegistry, _super);
|
17623 | function UserComponentRegistry() {
|
17624 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
17625 | _this.agGridDefaults = {
|
17626 |
|
17627 | agDateInput: DefaultDateComponent,
|
17628 |
|
17629 | agColumnHeader: HeaderComp,
|
17630 | agColumnGroupHeader: HeaderGroupComp,
|
17631 |
|
17632 | agTextColumnFloatingFilter: TextFloatingFilter,
|
17633 | agNumberColumnFloatingFilter: NumberFloatingFilter,
|
17634 | agDateColumnFloatingFilter: DateFloatingFilter,
|
17635 | agReadOnlyFloatingFilter: ReadOnlyFloatingFilter,
|
17636 |
|
17637 | agAnimateShowChangeCellRenderer: AnimateShowChangeCellRenderer,
|
17638 | agAnimateSlideCellRenderer: AnimateSlideCellRenderer,
|
17639 | agGroupCellRenderer: GroupCellRenderer,
|
17640 | agGroupRowRenderer: GroupCellRenderer,
|
17641 | agLoadingCellRenderer: LoadingCellRenderer,
|
17642 |
|
17643 | agCellEditor: TextCellEditor,
|
17644 | agTextCellEditor: TextCellEditor,
|
17645 | agSelectCellEditor: SelectCellEditor,
|
17646 | agPopupTextCellEditor: PopupTextCellEditor,
|
17647 | agPopupSelectCellEditor: PopupSelectCellEditor,
|
17648 | agLargeTextCellEditor: LargeTextCellEditor,
|
17649 |
|
17650 | agTextColumnFilter: TextFilter,
|
17651 | agNumberColumnFilter: NumberFilter,
|
17652 | agDateColumnFilter: DateFilter,
|
17653 |
|
17654 | agLoadingOverlay: LoadingOverlayComponent,
|
17655 | agNoRowsOverlay: NoRowsOverlayComponent,
|
17656 |
|
17657 | agTooltipComponent: TooltipComponent
|
17658 | };
|
17659 | _this.agDeprecatedNames = {
|
17660 | set: {
|
17661 | newComponentName: 'agSetColumnFilter',
|
17662 | propertyHolder: 'filter'
|
17663 | },
|
17664 | text: {
|
17665 | newComponentName: 'agTextColumnFilter',
|
17666 | propertyHolder: 'filter'
|
17667 | },
|
17668 | number: {
|
17669 | newComponentName: 'agNumberColumnFilter',
|
17670 | propertyHolder: 'filter'
|
17671 | },
|
17672 | date: {
|
17673 | newComponentName: 'agDateColumnFilter',
|
17674 | propertyHolder: 'filter'
|
17675 | },
|
17676 | group: {
|
17677 | newComponentName: 'agGroupCellRenderer',
|
17678 | propertyHolder: 'cellRenderer'
|
17679 | },
|
17680 | animateShowChange: {
|
17681 | newComponentName: 'agAnimateShowChangeCellRenderer',
|
17682 | propertyHolder: 'cellRenderer'
|
17683 | },
|
17684 | animateSlide: {
|
17685 | newComponentName: 'agAnimateSlideCellRenderer',
|
17686 | propertyHolder: 'cellRenderer'
|
17687 | },
|
17688 | select: {
|
17689 | newComponentName: 'agSelectCellEditor',
|
17690 | propertyHolder: 'cellEditor'
|
17691 | },
|
17692 | largeText: {
|
17693 | newComponentName: 'agLargeTextCellEditor',
|
17694 | propertyHolder: 'cellEditor'
|
17695 | },
|
17696 | popupSelect: {
|
17697 | newComponentName: 'agPopupSelectCellEditor',
|
17698 | propertyHolder: 'cellEditor'
|
17699 | },
|
17700 | popupText: {
|
17701 | newComponentName: 'agPopupTextCellEditor',
|
17702 | propertyHolder: 'cellEditor'
|
17703 | },
|
17704 | richSelect: {
|
17705 | newComponentName: 'agRichSelectCellEditor',
|
17706 | propertyHolder: 'cellEditor'
|
17707 | },
|
17708 | headerComponent: {
|
17709 | newComponentName: 'agColumnHeader',
|
17710 | propertyHolder: 'headerComponent'
|
17711 | }
|
17712 | };
|
17713 | _this.jsComps = {};
|
17714 | _this.fwComps = {};
|
17715 | return _this;
|
17716 | }
|
17717 | UserComponentRegistry.prototype.init = function () {
|
17718 | var _this = this;
|
17719 | if (this.gridOptions.components != null) {
|
17720 | iterateObject(this.gridOptions.components, function (key, component) { return _this.registerJsComponent(key, component); });
|
17721 | }
|
17722 | if (this.gridOptions.frameworkComponents != null) {
|
17723 | iterateObject(this.gridOptions.frameworkComponents, function (key, component) { return _this.registerFwComponent(key, component); });
|
17724 | }
|
17725 | };
|
17726 | UserComponentRegistry.prototype.registerDefaultComponent = function (rawName, component) {
|
17727 | var name = this.translateIfDeprecated(rawName);
|
17728 | if (this.agGridDefaults[name]) {
|
17729 | console.error("Trying to overwrite a default component. You should call registerComponent");
|
17730 | return;
|
17731 | }
|
17732 | this.agGridDefaults[name] = component;
|
17733 | };
|
17734 | UserComponentRegistry.prototype.registerJsComponent = function (rawName, component) {
|
17735 | var name = this.translateIfDeprecated(rawName);
|
17736 | if (this.fwComps[name]) {
|
17737 | console.error("Trying to register a component that you have already registered for frameworks: " + name);
|
17738 | return;
|
17739 | }
|
17740 | this.jsComps[name] = component;
|
17741 | };
|
17742 | |
17743 |
|
17744 |
|
17745 |
|
17746 | UserComponentRegistry.prototype.registerFwComponent = function (rawName, component) {
|
17747 | 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.";
|
17748 | doOnce(function () { return console.warn(warningMessage); }, "UserComponentRegistry.frameworkComponentsDeprecated");
|
17749 | var name = this.translateIfDeprecated(rawName);
|
17750 | this.fwComps[name] = component;
|
17751 | };
|
17752 | UserComponentRegistry.prototype.retrieve = function (rawName) {
|
17753 | var name = this.translateIfDeprecated(rawName);
|
17754 | var createResult = function (component, componentFromFramework) { return ({ componentFromFramework: componentFromFramework, component: component }); };
|
17755 |
|
17756 |
|
17757 |
|
17758 | var registeredViaFrameworkComp = this.getFrameworkOverrides().frameworkComponent(name);
|
17759 | if (registeredViaFrameworkComp != null) {
|
17760 | return createResult(registeredViaFrameworkComp, true);
|
17761 | }
|
17762 | var frameworkComponent = this.fwComps[name];
|
17763 | if (frameworkComponent) {
|
17764 | return createResult(frameworkComponent, true);
|
17765 | }
|
17766 | var jsComponent = this.jsComps[name];
|
17767 | if (jsComponent) {
|
17768 | var isFwkComp = this.getFrameworkOverrides().isFrameworkComponent(jsComponent);
|
17769 | return createResult(jsComponent, isFwkComp);
|
17770 | }
|
17771 | var defaultComponent = this.agGridDefaults[name];
|
17772 | if (defaultComponent) {
|
17773 | return createResult(defaultComponent, false);
|
17774 | }
|
17775 | if (Object.keys(this.agGridDefaults).indexOf(name) < 0) {
|
17776 | console.warn("AG Grid: Looking for component [" + name + "] but it wasn't found.");
|
17777 | }
|
17778 | return null;
|
17779 | };
|
17780 | UserComponentRegistry.prototype.translateIfDeprecated = function (raw) {
|
17781 | var deprecatedInfo = this.agDeprecatedNames[raw];
|
17782 | if (deprecatedInfo != null) {
|
17783 | doOnce(function () {
|
17784 | 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);
|
17785 | }, 'DEPRECATE_COMPONENT_' + raw);
|
17786 | return deprecatedInfo.newComponentName;
|
17787 | }
|
17788 | return raw;
|
17789 | };
|
17790 | __decorate$D([
|
17791 | Autowired('gridOptions')
|
17792 | ], UserComponentRegistry.prototype, "gridOptions", void 0);
|
17793 | __decorate$D([
|
17794 | Autowired('agComponentUtils')
|
17795 | ], UserComponentRegistry.prototype, "agComponentUtils", void 0);
|
17796 | __decorate$D([
|
17797 | PostConstruct
|
17798 | ], UserComponentRegistry.prototype, "init", null);
|
17799 | UserComponentRegistry = __decorate$D([
|
17800 | Bean('userComponentRegistry')
|
17801 | ], UserComponentRegistry);
|
17802 | return UserComponentRegistry;
|
17803 | }(BeanStub));
|
17804 |
|
17805 |
|
17806 |
|
17807 |
|
17808 |
|
17809 |
|
17810 |
|
17811 | var DateComponent = {
|
17812 | propertyName: 'dateComponent',
|
17813 | cellRenderer: false
|
17814 | };
|
17815 | var HeaderComponent = {
|
17816 | propertyName: 'headerComponent',
|
17817 | cellRenderer: false
|
17818 | };
|
17819 | var HeaderGroupComponent = {
|
17820 | propertyName: 'headerGroupComponent',
|
17821 | cellRenderer: false
|
17822 | };
|
17823 | var CellRendererComponent = {
|
17824 | propertyName: 'cellRenderer',
|
17825 | cellRenderer: true
|
17826 | };
|
17827 | var CellEditorComponent = {
|
17828 | propertyName: 'cellEditor',
|
17829 | cellRenderer: false
|
17830 | };
|
17831 | var InnerRendererComponent = {
|
17832 | propertyName: 'innerRenderer',
|
17833 | cellRenderer: true
|
17834 | };
|
17835 | var LoadingOverlayComponent$1 = {
|
17836 | propertyName: 'loadingOverlayComponent',
|
17837 | cellRenderer: false
|
17838 | };
|
17839 | var NoRowsOverlayComponent$1 = {
|
17840 | propertyName: 'noRowsOverlayComponent',
|
17841 | cellRenderer: false
|
17842 | };
|
17843 | var TooltipComponent$1 = {
|
17844 | propertyName: 'tooltipComponent',
|
17845 | cellRenderer: false
|
17846 | };
|
17847 | var FilterComponent = {
|
17848 | propertyName: 'filter',
|
17849 | cellRenderer: false
|
17850 | };
|
17851 | var FloatingFilterComponent = {
|
17852 | propertyName: 'floatingFilterComponent',
|
17853 | cellRenderer: false
|
17854 | };
|
17855 | var ToolPanelComponent = {
|
17856 | propertyName: 'toolPanel',
|
17857 | cellRenderer: false
|
17858 | };
|
17859 | var StatusPanelComponent = {
|
17860 | propertyName: 'statusPanel',
|
17861 | cellRenderer: false
|
17862 | };
|
17863 | var FullWidth = {
|
17864 | propertyName: 'fullWidthCellRenderer',
|
17865 | cellRenderer: true
|
17866 | };
|
17867 | var FullWidthLoading = {
|
17868 | propertyName: 'loadingCellRenderer',
|
17869 | cellRenderer: true
|
17870 | };
|
17871 | var FullWidthGroup = {
|
17872 | propertyName: 'groupRowRenderer',
|
17873 | cellRenderer: true
|
17874 | };
|
17875 | var FullWidthDetail = {
|
17876 | propertyName: 'detailCellRenderer',
|
17877 | cellRenderer: true
|
17878 | };
|
17879 |
|
17880 |
|
17881 |
|
17882 |
|
17883 |
|
17884 |
|
17885 |
|
17886 | var FloatingFilterMapper = (function () {
|
17887 | function FloatingFilterMapper() {
|
17888 | }
|
17889 | FloatingFilterMapper.getFloatingFilterType = function (filterType) {
|
17890 | return this.filterToFloatingFilterMapping[filterType];
|
17891 | };
|
17892 | FloatingFilterMapper.filterToFloatingFilterMapping = {
|
17893 | set: 'agSetColumnFloatingFilter',
|
17894 | agSetColumnFilter: 'agSetColumnFloatingFilter',
|
17895 | multi: 'agMultiColumnFloatingFilter',
|
17896 | agMultiColumnFilter: 'agMultiColumnFloatingFilter',
|
17897 | number: 'agNumberColumnFloatingFilter',
|
17898 | agNumberColumnFilter: 'agNumberColumnFloatingFilter',
|
17899 | date: 'agDateColumnFloatingFilter',
|
17900 | agDateColumnFilter: 'agDateColumnFloatingFilter',
|
17901 | text: 'agTextColumnFloatingFilter',
|
17902 | agTextColumnFilter: 'agTextColumnFloatingFilter'
|
17903 | };
|
17904 | return FloatingFilterMapper;
|
17905 | }());
|
17906 |
|
17907 | /**
|
17908 | * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
|
17909 | * @version v27.3.0
|
17910 | * @link https://www.ag-grid.com/
|
17911 | * @license MIT
|
17912 | */
|
17913 | var __extends$L = (undefined && undefined.__extends) || (function () {
|
17914 | var extendStatics = function (d, b) {
|
17915 | extendStatics = Object.setPrototypeOf ||
|
17916 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
17917 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
17918 | return extendStatics(d, b);
|
17919 | };
|
17920 | return function (d, b) {
|
17921 | extendStatics(d, b);
|
17922 | function __() { this.constructor = d; }
|
17923 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17924 | };
|
17925 | })();
|
17926 | var __decorate$E = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
17927 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
17928 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
17929 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
17930 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
17931 | };
|
17932 | var UserComponentFactory = (function (_super) {
|
17933 | __extends$L(UserComponentFactory, _super);
|
17934 | function UserComponentFactory() {
|
17935 | return _super !== null && _super.apply(this, arguments) || this;
|
17936 | }
|
17937 | UserComponentFactory.prototype.getHeaderCompDetails = function (colDef, params) {
|
17938 | return this.getCompDetails(colDef, HeaderComponent, 'agColumnHeader', params);
|
17939 | };
|
17940 | UserComponentFactory.prototype.getHeaderGroupCompDetails = function (params) {
|
17941 | var colGroupDef = params.columnGroup.getColGroupDef();
|
17942 | return this.getCompDetails(colGroupDef, HeaderGroupComponent, 'agColumnGroupHeader', params);
|
17943 | };
|
17944 |
|
17945 |
|
17946 | UserComponentFactory.prototype.getFullWidthCellRendererDetails = function (params) {
|
17947 | return this.getCompDetails(this.gridOptions, FullWidth, null, params, true);
|
17948 | };
|
17949 | UserComponentFactory.prototype.getFullWidthLoadingCellRendererDetails = function (params) {
|
17950 | return this.getCompDetails(this.gridOptions, FullWidthLoading, 'agLoadingCellRenderer', params, true);
|
17951 | };
|
17952 | UserComponentFactory.prototype.getFullWidthGroupCellRendererDetails = function (params) {
|
17953 | return this.getCompDetails(this.gridOptions, FullWidthGroup, 'agGroupRowRenderer', params, true);
|
17954 | };
|
17955 | UserComponentFactory.prototype.getFullWidthDetailCellRendererDetails = function (params) {
|
17956 | return this.getCompDetails(this.gridOptions, FullWidthDetail, 'agDetailCellRenderer', params, true);
|
17957 | };
|
17958 |
|
17959 | UserComponentFactory.prototype.getInnerRendererDetails = function (def, params) {
|
17960 | return this.getCompDetails(def, InnerRendererComponent, null, params);
|
17961 | };
|
17962 | UserComponentFactory.prototype.getFullWidthGroupRowInnerCellRenderer = function (def, params) {
|
17963 | return this.getCompDetails(def, InnerRendererComponent, null, params);
|
17964 | };
|
17965 | UserComponentFactory.prototype.getCellRendererDetails = function (def, params) {
|
17966 | return this.getCompDetails(def, CellRendererComponent, null, params);
|
17967 | };
|
17968 |
|
17969 | UserComponentFactory.prototype.getCellEditorDetails = function (def, params) {
|
17970 | return this.getCompDetails(def, CellEditorComponent, 'agCellEditor', params, true);
|
17971 | };
|
17972 |
|
17973 | UserComponentFactory.prototype.getFilterDetails = function (def, params, defaultFilter) {
|
17974 | return this.getCompDetails(def, FilterComponent, defaultFilter, params, true);
|
17975 | };
|
17976 | UserComponentFactory.prototype.getDateCompDetails = function (params) {
|
17977 | return this.getCompDetails(this.gridOptions, DateComponent, 'agDateInput', params, true);
|
17978 | };
|
17979 | UserComponentFactory.prototype.getLoadingOverlayCompDetails = function (params) {
|
17980 | return this.getCompDetails(this.gridOptions, LoadingOverlayComponent$1, 'agLoadingOverlay', params, true);
|
17981 | };
|
17982 | UserComponentFactory.prototype.getNoRowsOverlayCompDetails = function (params) {
|
17983 | return this.getCompDetails(this.gridOptions, NoRowsOverlayComponent$1, 'agNoRowsOverlay', params, true);
|
17984 | };
|
17985 | UserComponentFactory.prototype.getTooltipCompDetails = function (params) {
|
17986 | return this.getCompDetails(params.colDef, TooltipComponent$1, 'agTooltipComponent', params, true);
|
17987 | };
|
17988 | UserComponentFactory.prototype.getSetFilterCellRendererDetails = function (def, params) {
|
17989 | return this.getCompDetails(def, CellRendererComponent, null, params);
|
17990 | };
|
17991 | UserComponentFactory.prototype.getFloatingFilterCompDetails = function (def, params, defaultFloatingFilter) {
|
17992 | return this.getCompDetails(def, FloatingFilterComponent, defaultFloatingFilter, params);
|
17993 | };
|
17994 | UserComponentFactory.prototype.getToolPanelCompDetails = function (toolPanelDef, params) {
|
17995 | return this.getCompDetails(toolPanelDef, ToolPanelComponent, null, params, true);
|
17996 | };
|
17997 | UserComponentFactory.prototype.getStatusPanelCompDetails = function (def, params) {
|
17998 | return this.getCompDetails(def, StatusPanelComponent, null, params, true);
|
17999 | };
|
18000 | UserComponentFactory.prototype.getCompDetails = function (defObject, type, defaultName, params, mandatory) {
|
18001 | var _this = this;
|
18002 | if (mandatory === void 0) { mandatory = false; }
|
18003 | var propertyName = type.propertyName, cellRenderer = type.cellRenderer;
|
18004 | 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;
|
18005 | var lookupFromRegistry = function (key) {
|
18006 | var item = _this.userComponentRegistry.retrieve(key);
|
18007 | if (item) {
|
18008 | jsComp = !item.componentFromFramework ? item.component : undefined;
|
18009 | fwComp = item.componentFromFramework ? item.component : undefined;
|
18010 | }
|
18011 | };
|
18012 |
|
18013 | if (compName != null) {
|
18014 | lookupFromRegistry(compName);
|
18015 | }
|
18016 |
|
18017 | if (jsComp == null && fwComp == null && defaultName != null) {
|
18018 | lookupFromRegistry(defaultName);
|
18019 | }
|
18020 |
|
18021 | if (jsComp && cellRenderer && !this.agComponentUtils.doesImplementIComponent(jsComp)) {
|
18022 | jsComp = this.agComponentUtils.adaptFunction(propertyName, jsComp);
|
18023 | }
|
18024 | if (!jsComp && !fwComp) {
|
18025 | if (mandatory) {
|
18026 | console.error("Could not find component " + compName + ", did you forget to configure this component?");
|
18027 | }
|
18028 | return;
|
18029 | }
|
18030 | var paramsMerged = this.mergeParamsWithApplicationProvidedParams(defObject, type, params, paramsFromSelector);
|
18031 | var componentFromFramework = jsComp == null;
|
18032 | var componentClass = jsComp ? jsComp : fwComp;
|
18033 | return {
|
18034 | componentFromFramework: componentFromFramework,
|
18035 | componentClass: componentClass,
|
18036 | params: paramsMerged,
|
18037 | type: type,
|
18038 | popupFromSelector: popupFromSelector,
|
18039 | popupPositionFromSelector: popupPositionFromSelector,
|
18040 | newAgStackInstance: function () { return _this.newAgStackInstance(componentClass, componentFromFramework, paramsMerged, type); }
|
18041 | };
|
18042 | };
|
18043 | UserComponentFactory.prototype.getCompKeys = function (defObject, type, params) {
|
18044 | var _this = this;
|
18045 | var propertyName = type.propertyName;
|
18046 | var compName;
|
18047 | var jsComp;
|
18048 | var fwComp;
|
18049 | var paramsFromSelector;
|
18050 | var popupFromSelector;
|
18051 | var popupPositionFromSelector;
|
18052 |
|
18053 |
|
18054 |
|
18055 |
|
18056 |
|
18057 | if (defObject) {
|
18058 | var defObjectAny = defObject;
|
18059 |
|
18060 | var selectorFunc = defObjectAny[propertyName + 'Selector'];
|
18061 | var selectorRes = selectorFunc ? selectorFunc(params) : null;
|
18062 | var assignComp = function (providedJsComp, providedFwComp) {
|
18063 | var xxxFrameworkDeprecatedWarn = function () {
|
18064 | 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.";
|
18065 | doOnce(function () { return console.warn(warningMessage); }, "UserComponentFactory." + propertyName + "FrameworkDeprecated");
|
18066 | };
|
18067 | if (typeof providedJsComp === 'string') {
|
18068 | compName = providedJsComp;
|
18069 | }
|
18070 | else if (typeof providedFwComp === 'string') {
|
18071 | xxxFrameworkDeprecatedWarn();
|
18072 | compName = providedFwComp;
|
18073 |
|
18074 | }
|
18075 | else if (providedJsComp != null && providedJsComp !== true) {
|
18076 | var isFwkComp = _this.getFrameworkOverrides().isFrameworkComponent(providedJsComp);
|
18077 | if (isFwkComp) {
|
18078 | fwComp = providedJsComp;
|
18079 | }
|
18080 | else {
|
18081 | jsComp = providedJsComp;
|
18082 | }
|
18083 | }
|
18084 | else if (providedFwComp != null) {
|
18085 | xxxFrameworkDeprecatedWarn();
|
18086 | fwComp = providedFwComp;
|
18087 | }
|
18088 | };
|
18089 | if (selectorRes) {
|
18090 | if (selectorRes.frameworkComponent != null) {
|
18091 | 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.";
|
18092 | doOnce(function () { return console.warn(warningMessage_1); }, "UserComponentFactory." + propertyName + "FrameworkSelectorDeprecated");
|
18093 | assignComp(selectorRes.frameworkComponent, undefined);
|
18094 | }
|
18095 | else {
|
18096 | assignComp(selectorRes.component, undefined);
|
18097 | }
|
18098 | paramsFromSelector = selectorRes.params;
|
18099 | popupFromSelector = selectorRes.popup;
|
18100 | popupPositionFromSelector = selectorRes.popupPosition;
|
18101 | }
|
18102 | else {
|
18103 |
|
18104 | assignComp(defObjectAny[propertyName], defObjectAny[propertyName + 'Framework']);
|
18105 | }
|
18106 | }
|
18107 | return { compName: compName, jsComp: jsComp, fwComp: fwComp, paramsFromSelector: paramsFromSelector, popupFromSelector: popupFromSelector, popupPositionFromSelector: popupPositionFromSelector };
|
18108 | };
|
18109 | UserComponentFactory.prototype.newAgStackInstance = function (ComponentClass, componentFromFramework, params, type) {
|
18110 | var propertyName = type.propertyName;
|
18111 | var jsComponent = !componentFromFramework;
|
18112 |
|
18113 | var instance;
|
18114 | if (jsComponent) {
|
18115 | instance = new ComponentClass();
|
18116 | }
|
18117 | else {
|
18118 |
|
18119 | var thisComponentConfig = this.componentMetadataProvider.retrieve(propertyName);
|
18120 | instance = this.frameworkComponentWrapper.wrap(ComponentClass, thisComponentConfig.mandatoryMethodList, thisComponentConfig.optionalMethodList, type);
|
18121 | }
|
18122 | var deferredInit = this.initComponent(instance, params);
|
18123 | if (deferredInit == null) {
|
18124 | return AgPromise.resolve(instance);
|
18125 | }
|
18126 | return deferredInit.then(function () { return instance; });
|
18127 | };
|
18128 |
|
18129 | UserComponentFactory.prototype.mergeParamsWithApplicationProvidedParams = function (defObject, type, paramsFromGrid, paramsFromSelector) {
|
18130 | if (paramsFromSelector === void 0) { paramsFromSelector = null; }
|
18131 | var params = {
|
18132 | context: this.gridOptionsWrapper.getContext(),
|
18133 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
18134 | api: this.gridOptionsWrapper.getApi()
|
18135 | };
|
18136 | mergeDeep(params, paramsFromGrid);
|
18137 |
|
18138 |
|
18139 | var defObjectAny = defObject;
|
18140 | var userParams = defObjectAny && defObjectAny[type.propertyName + 'Params'];
|
18141 | if (typeof userParams === 'function') {
|
18142 | var userParamsFromFunc = userParams(paramsFromGrid);
|
18143 | mergeDeep(params, userParamsFromFunc);
|
18144 | }
|
18145 | else if (typeof userParams === 'object') {
|
18146 | mergeDeep(params, userParams);
|
18147 | }
|
18148 | mergeDeep(params, paramsFromSelector);
|
18149 | return params;
|
18150 | };
|
18151 | UserComponentFactory.prototype.initComponent = function (component, params) {
|
18152 | this.context.createBean(component);
|
18153 | if (component.init == null) {
|
18154 | return;
|
18155 | }
|
18156 | return component.init(params);
|
18157 | };
|
18158 | UserComponentFactory.prototype.getDefaultFloatingFilterType = function (def) {
|
18159 | if (def == null) {
|
18160 | return null;
|
18161 | }
|
18162 | var defaultFloatingFilterType = null;
|
18163 | var _a = this.getCompKeys(def, FilterComponent), compName = _a.compName, jsComp = _a.jsComp, fwComp = _a.fwComp;
|
18164 | if (compName) {
|
18165 |
|
18166 | defaultFloatingFilterType = FloatingFilterMapper.getFloatingFilterType(compName);
|
18167 | }
|
18168 | else {
|
18169 | var usingDefaultFilter = (jsComp == null && fwComp == null) && (def.filter === true);
|
18170 | if (usingDefaultFilter) {
|
18171 | var setFilterModuleLoaded = ModuleRegistry.isRegistered(ModuleNames.SetFilterModule);
|
18172 | defaultFloatingFilterType = setFilterModuleLoaded ? 'agSetColumnFloatingFilter' : 'agTextColumnFloatingFilter';
|
18173 | }
|
18174 | }
|
18175 | return defaultFloatingFilterType;
|
18176 | };
|
18177 | __decorate$E([
|
18178 | Autowired('gridOptions')
|
18179 | ], UserComponentFactory.prototype, "gridOptions", void 0);
|
18180 | __decorate$E([
|
18181 | Autowired('agComponentUtils')
|
18182 | ], UserComponentFactory.prototype, "agComponentUtils", void 0);
|
18183 | __decorate$E([
|
18184 | Autowired('componentMetadataProvider')
|
18185 | ], UserComponentFactory.prototype, "componentMetadataProvider", void 0);
|
18186 | __decorate$E([
|
18187 | Autowired('userComponentRegistry')
|
18188 | ], UserComponentFactory.prototype, "userComponentRegistry", void 0);
|
18189 | __decorate$E([
|
18190 | Optional('frameworkComponentWrapper')
|
18191 | ], UserComponentFactory.prototype, "frameworkComponentWrapper", void 0);
|
18192 | UserComponentFactory = __decorate$E([
|
18193 | Bean('userComponentFactory')
|
18194 | ], UserComponentFactory);
|
18195 | return UserComponentFactory;
|
18196 | }(BeanStub));
|
18197 |
|
18198 |
|
18199 |
|
18200 |
|
18201 |
|
18202 |
|
18203 |
|
18204 |
|
18205 | var ExcelFactoryMode;
|
18206 | (function (ExcelFactoryMode) {
|
18207 | ExcelFactoryMode[ExcelFactoryMode["SINGLE_SHEET"] = 0] = "SINGLE_SHEET";
|
18208 | ExcelFactoryMode[ExcelFactoryMode["MULTI_SHEET"] = 1] = "MULTI_SHEET";
|
18209 | })(ExcelFactoryMode || (ExcelFactoryMode = {}));
|
18210 |
|
18211 |
|
18212 |
|
18213 |
|
18214 |
|
18215 |
|
18216 |
|
18217 | var __extends$M = (undefined && undefined.__extends) || (function () {
|
18218 | var extendStatics = function (d, b) {
|
18219 | extendStatics = Object.setPrototypeOf ||
|
18220 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
18221 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
18222 | return extendStatics(d, b);
|
18223 | };
|
18224 | return function (d, b) {
|
18225 | extendStatics(d, b);
|
18226 | function __() { this.constructor = d; }
|
18227 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
18228 | };
|
18229 | })();
|
18230 | var __decorate$F = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
18231 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
18232 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
18233 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
18234 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
18235 | };
|
18236 |
|
18237 |
|
18238 | var DragService = (function (_super) {
|
18239 | __extends$M(DragService, _super);
|
18240 | function DragService() {
|
18241 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
18242 | _this.dragEndFunctions = [];
|
18243 | _this.dragSources = [];
|
18244 | return _this;
|
18245 | }
|
18246 | DragService.prototype.init = function () {
|
18247 | this.logger = this.loggerFactory.create('DragService');
|
18248 | };
|
18249 | DragService.prototype.removeAllListeners = function () {
|
18250 | this.dragSources.forEach(this.removeListener.bind(this));
|
18251 | this.dragSources.length = 0;
|
18252 | };
|
18253 | DragService.prototype.removeListener = function (dragSourceAndListener) {
|
18254 | var element = dragSourceAndListener.dragSource.eElement;
|
18255 | var mouseDownListener = dragSourceAndListener.mouseDownListener;
|
18256 | element.removeEventListener('mousedown', mouseDownListener);
|
18257 |
|
18258 | if (dragSourceAndListener.touchEnabled) {
|
18259 | var touchStartListener = dragSourceAndListener.touchStartListener;
|
18260 | element.removeEventListener('touchstart', touchStartListener, { passive: true });
|
18261 | }
|
18262 | };
|
18263 | DragService.prototype.removeDragSource = function (params) {
|
18264 | var dragSourceAndListener = this.dragSources.find(function (item) { return item.dragSource === params; });
|
18265 | if (!dragSourceAndListener) {
|
18266 | return;
|
18267 | }
|
18268 | this.removeListener(dragSourceAndListener);
|
18269 | removeFromArray(this.dragSources, dragSourceAndListener);
|
18270 | };
|
18271 | DragService.prototype.isDragging = function () {
|
18272 | return this.dragging;
|
18273 | };
|
18274 | DragService.prototype.addDragSource = function (params, includeTouch) {
|
18275 | var _this = this;
|
18276 | if (includeTouch === void 0) { includeTouch = false; }
|
18277 | var mouseListener = this.onMouseDown.bind(this, params);
|
18278 | params.eElement.addEventListener('mousedown', mouseListener);
|
18279 | var touchListener = null;
|
18280 | var suppressTouch = this.gridOptionsWrapper.isSuppressTouch();
|
18281 | if (includeTouch && !suppressTouch) {
|
18282 | touchListener = function (touchEvent) {
|
18283 | if (touchEvent.cancelable) {
|
18284 | touchEvent.preventDefault();
|
18285 | }
|
18286 | _this.onTouchStart(params, touchEvent);
|
18287 | };
|
18288 | params.eElement.addEventListener('touchstart', touchListener, { passive: true });
|
18289 | }
|
18290 | this.dragSources.push({
|
18291 | dragSource: params,
|
18292 | mouseDownListener: mouseListener,
|
18293 | touchStartListener: touchListener,
|
18294 | touchEnabled: includeTouch
|
18295 | });
|
18296 | };
|
18297 |
|
18298 | DragService.prototype.onTouchStart = function (params, touchEvent) {
|
18299 | var _this = this;
|
18300 | this.currentDragParams = params;
|
18301 | this.dragging = false;
|
18302 | var touch = touchEvent.touches[0];
|
18303 | this.touchLastTime = touch;
|
18304 | this.touchStart = touch;
|
18305 | var touchMoveEvent = function (e) { return _this.onTouchMove(e, params.eElement); };
|
18306 | var touchEndEvent = function (e) { return _this.onTouchUp(e, params.eElement); };
|
18307 | var documentTouchMove = function (e) { if (e.cancelable) {
|
18308 | e.preventDefault();
|
18309 | } };
|
18310 | var target = params.eElement;
|
18311 | var events = [
|
18312 |
|
18313 |
|
18314 |
|
18315 | { target: document, type: 'touchmove', listener: documentTouchMove, options: { passive: false } },
|
18316 | { target: target, type: 'touchmove', listener: touchMoveEvent, options: { passive: true } },
|
18317 | { target: target, type: 'touchend', listener: touchEndEvent, options: { passive: true } },
|
18318 | { target: target, type: 'touchcancel', listener: touchEndEvent, options: { passive: true } }
|
18319 | ];
|
18320 |
|
18321 | this.addTemporaryEvents(events);
|
18322 |
|
18323 | if (params.dragStartPixels === 0) {
|
18324 | this.onCommonMove(touch, this.touchStart, params.eElement);
|
18325 | }
|
18326 | };
|
18327 |
|
18328 | DragService.prototype.onMouseDown = function (params, mouseEvent) {
|
18329 | var _this = this;
|
18330 | var e = mouseEvent;
|
18331 | if (params.skipMouseEvent && params.skipMouseEvent(mouseEvent)) {
|
18332 | return;
|
18333 | }
|
18334 |
|
18335 |
|
18336 |
|
18337 | if (e._alreadyProcessedByDragService) {
|
18338 | return;
|
18339 | }
|
18340 | e._alreadyProcessedByDragService = true;
|
18341 |
|
18342 | if (mouseEvent.button !== 0) {
|
18343 | return;
|
18344 | }
|
18345 | this.currentDragParams = params;
|
18346 | this.dragging = false;
|
18347 | this.mouseStartEvent = mouseEvent;
|
18348 | var eDocument = this.gridOptionsWrapper.getDocument();
|
18349 | var mouseMoveEvent = function (event) { return _this.onMouseMove(event, params.eElement); };
|
18350 | var mouseUpEvent = function (event) { return _this.onMouseUp(event, params.eElement); };
|
18351 | var contextEvent = function (event) { return event.preventDefault(); };
|
18352 | var target = eDocument;
|
18353 | var events = [
|
18354 | { target: target, type: 'mousemove', listener: mouseMoveEvent },
|
18355 | { target: target, type: 'mouseup', listener: mouseUpEvent },
|
18356 | { target: target, type: 'contextmenu', listener: contextEvent }
|
18357 | ];
|
18358 |
|
18359 | this.addTemporaryEvents(events);
|
18360 |
|
18361 | if (params.dragStartPixels === 0) {
|
18362 | this.onMouseMove(mouseEvent, params.eElement);
|
18363 | }
|
18364 | };
|
18365 | DragService.prototype.addTemporaryEvents = function (events) {
|
18366 | events.forEach(function (currentEvent) {
|
18367 | var target = currentEvent.target, type = currentEvent.type, listener = currentEvent.listener, options = currentEvent.options;
|
18368 | target.addEventListener(type, listener, options);
|
18369 | });
|
18370 | this.dragEndFunctions.push(function () {
|
18371 | events.forEach(function (currentEvent) {
|
18372 | var target = currentEvent.target, type = currentEvent.type, listener = currentEvent.listener, options = currentEvent.options;
|
18373 | target.removeEventListener(type, listener, options);
|
18374 | });
|
18375 | });
|
18376 | };
|
18377 |
|
18378 |
|
18379 | DragService.prototype.isEventNearStartEvent = function (currentEvent, startEvent) {
|
18380 |
|
18381 | var dragStartPixels = this.currentDragParams.dragStartPixels;
|
18382 | var requiredPixelDiff = exists(dragStartPixels) ? dragStartPixels : 4;
|
18383 | return areEventsNear(currentEvent, startEvent, requiredPixelDiff);
|
18384 | };
|
18385 | DragService.prototype.getFirstActiveTouch = function (touchList) {
|
18386 | for (var i = 0; i < touchList.length; i++) {
|
18387 | if (touchList[i].identifier === this.touchStart.identifier) {
|
18388 | return touchList[i];
|
18389 | }
|
18390 | }
|
18391 | return null;
|
18392 | };
|
18393 | DragService.prototype.onCommonMove = function (currentEvent, startEvent, el) {
|
18394 | if (!this.dragging) {
|
18395 |
|
18396 | if (!this.dragging && this.isEventNearStartEvent(currentEvent, startEvent)) {
|
18397 | return;
|
18398 | }
|
18399 | this.dragging = true;
|
18400 | var event_1 = {
|
18401 | type: Events.EVENT_DRAG_STARTED,
|
18402 | api: this.gridApi,
|
18403 | columnApi: this.columnApi,
|
18404 | target: el
|
18405 | };
|
18406 | this.eventService.dispatchEvent(event_1);
|
18407 | this.currentDragParams.onDragStart(startEvent);
|
18408 |
|
18409 |
|
18410 |
|
18411 |
|
18412 |
|
18413 |
|
18414 |
|
18415 | this.currentDragParams.onDragging(startEvent);
|
18416 | }
|
18417 | this.currentDragParams.onDragging(currentEvent);
|
18418 | };
|
18419 | DragService.prototype.onTouchMove = function (touchEvent, el) {
|
18420 | var touch = this.getFirstActiveTouch(touchEvent.touches);
|
18421 | if (!touch) {
|
18422 | return;
|
18423 | }
|
18424 |
|
18425 | this.onCommonMove(touch, this.touchStart, el);
|
18426 | };
|
18427 |
|
18428 |
|
18429 | DragService.prototype.onMouseMove = function (mouseEvent, el) {
|
18430 |
|
18431 |
|
18432 | if (isBrowserSafari() &&
|
18433 | mouseEvent.type === 'mousemove' &&
|
18434 | mouseEvent.cancelable &&
|
18435 | this.mouseEventService.isEventFromThisGrid(mouseEvent) &&
|
18436 | !this.isOverFormFieldElement(mouseEvent)) {
|
18437 | mouseEvent.preventDefault();
|
18438 | }
|
18439 | this.onCommonMove(mouseEvent, this.mouseStartEvent, el);
|
18440 | };
|
18441 | DragService.prototype.isOverFormFieldElement = function (mouseEvent) {
|
18442 | var _a, _b;
|
18443 | var el = mouseEvent.target;
|
18444 | var tagName = (_a = el) === null || _a === void 0 ? void 0 : _a.tagName.toLocaleLowerCase();
|
18445 | return !!((_b = tagName) === null || _b === void 0 ? void 0 : _b.match('^a$|textarea|input|select|button'));
|
18446 | };
|
18447 | DragService.prototype.onTouchUp = function (touchEvent, el) {
|
18448 | var touch = this.getFirstActiveTouch(touchEvent.changedTouches);
|
18449 |
|
18450 |
|
18451 |
|
18452 |
|
18453 |
|
18454 | if (!touch) {
|
18455 | touch = this.touchLastTime;
|
18456 | }
|
18457 |
|
18458 |
|
18459 |
|
18460 |
|
18461 | this.onUpCommon(touch, el);
|
18462 |
|
18463 |
|
18464 |
|
18465 |
|
18466 |
|
18467 | };
|
18468 | DragService.prototype.onMouseUp = function (mouseEvent, el) {
|
18469 | this.onUpCommon(mouseEvent, el);
|
18470 | };
|
18471 | DragService.prototype.onUpCommon = function (eventOrTouch, el) {
|
18472 | if (this.dragging) {
|
18473 | this.dragging = false;
|
18474 | this.currentDragParams.onDragStop(eventOrTouch);
|
18475 | var event_2 = {
|
18476 | type: Events.EVENT_DRAG_STOPPED,
|
18477 | api: this.gridApi,
|
18478 | columnApi: this.columnApi,
|
18479 | target: el
|
18480 | };
|
18481 | this.eventService.dispatchEvent(event_2);
|
18482 | }
|
18483 | this.mouseStartEvent = null;
|
18484 | this.touchStart = null;
|
18485 | this.touchLastTime = null;
|
18486 | this.currentDragParams = null;
|
18487 | this.dragEndFunctions.forEach(function (func) { return func(); });
|
18488 | this.dragEndFunctions.length = 0;
|
18489 | };
|
18490 | __decorate$F([
|
18491 | Autowired('loggerFactory')
|
18492 | ], DragService.prototype, "loggerFactory", void 0);
|
18493 | __decorate$F([
|
18494 | Autowired('columnApi')
|
18495 | ], DragService.prototype, "columnApi", void 0);
|
18496 | __decorate$F([
|
18497 | Autowired('gridApi')
|
18498 | ], DragService.prototype, "gridApi", void 0);
|
18499 | __decorate$F([
|
18500 | Autowired('mouseEventService')
|
18501 | ], DragService.prototype, "mouseEventService", void 0);
|
18502 | __decorate$F([
|
18503 | PostConstruct
|
18504 | ], DragService.prototype, "init", null);
|
18505 | __decorate$F([
|
18506 | PreDestroy
|
18507 | ], DragService.prototype, "removeAllListeners", null);
|
18508 | DragService = __decorate$F([
|
18509 | Bean('dragService')
|
18510 | ], DragService);
|
18511 | return DragService;
|
18512 | }(BeanStub));
|
18513 |
|
18514 |
|
18515 |
|
18516 |
|
18517 |
|
18518 |
|
18519 |
|
18520 | var __extends$N = (undefined && undefined.__extends) || (function () {
|
18521 | var extendStatics = function (d, b) {
|
18522 | extendStatics = Object.setPrototypeOf ||
|
18523 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
18524 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
18525 | return extendStatics(d, b);
|
18526 | };
|
18527 | return function (d, b) {
|
18528 | extendStatics(d, b);
|
18529 | function __() { this.constructor = d; }
|
18530 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
18531 | };
|
18532 | })();
|
18533 | var __assign$8 = (undefined && undefined.__assign) || function () {
|
18534 | __assign$8 = Object.assign || function(t) {
|
18535 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
18536 | s = arguments[i];
|
18537 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
18538 | t[p] = s[p];
|
18539 | }
|
18540 | return t;
|
18541 | };
|
18542 | return __assign$8.apply(this, arguments);
|
18543 | };
|
18544 | var __decorate$G = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
18545 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
18546 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
18547 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
18548 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
18549 | };
|
18550 | var FilterManager = (function (_super) {
|
18551 | __extends$N(FilterManager, _super);
|
18552 | function FilterManager() {
|
18553 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
18554 | _this.allColumnFilters = new Map();
|
18555 | _this.activeAggregateFilters = [];
|
18556 | _this.activeColumnFilters = [];
|
18557 | _this.quickFilter = null;
|
18558 | _this.quickFilterParts = null;
|
18559 |
|
18560 |
|
18561 |
|
18562 |
|
18563 |
|
18564 | _this.processingFilterChange = false;
|
18565 | return _this;
|
18566 | }
|
18567 | FilterManager_1 = FilterManager;
|
18568 | FilterManager.prototype.init = function () {
|
18569 | var _this = this;
|
18570 | this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, function () { return _this.onColumnsChanged(); });
|
18571 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, function () { return _this.refreshFiltersForAggregations(); });
|
18572 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_CHANGED, function () { return _this.refreshFiltersForAggregations(); });
|
18573 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, function () { return _this.refreshFiltersForAggregations(); });
|
18574 | this.quickFilter = this.parseQuickFilter(this.gridOptionsWrapper.getQuickFilterText());
|
18575 | this.setQuickFilterParts();
|
18576 | this.allowShowChangeAfterFilter = this.gridOptionsWrapper.isAllowShowChangeAfterFilter();
|
18577 | };
|
18578 | FilterManager.prototype.setQuickFilterParts = function () {
|
18579 | this.quickFilterParts = this.quickFilter ? this.quickFilter.split(' ') : null;
|
18580 | };
|
18581 | FilterManager.prototype.setFilterModel = function (model) {
|
18582 | var _this = this;
|
18583 | var allPromises = [];
|
18584 | var previousModel = this.getFilterModel();
|
18585 | if (model) {
|
18586 |
|
18587 | var modelKeys_1 = convertToSet(Object.keys(model));
|
18588 | this.allColumnFilters.forEach(function (filterWrapper, colId) {
|
18589 | var newModel = model[colId];
|
18590 | allPromises.push(_this.setModelOnFilterWrapper(filterWrapper.filterPromise, newModel));
|
18591 | modelKeys_1.delete(colId);
|
18592 | });
|
18593 |
|
18594 | modelKeys_1.forEach(function (colId) {
|
18595 | var column = _this.columnModel.getPrimaryColumn(colId) || _this.columnModel.getGridColumn(colId);
|
18596 | if (!column) {
|
18597 | console.warn('AG Grid: setFilterModel() - no column found for colId: ' + colId);
|
18598 | return;
|
18599 | }
|
18600 | if (!column.isFilterAllowed()) {
|
18601 | console.warn('AG Grid: setFilterModel() - unable to fully apply model, filtering disabled for colId: ' + colId);
|
18602 | return;
|
18603 | }
|
18604 | var filterWrapper = _this.getOrCreateFilterWrapper(column, 'NO_UI');
|
18605 | if (!filterWrapper) {
|
18606 | console.warn('AG-Grid: setFilterModel() - unable to fully apply model, unable to create filter for colId: ' + colId);
|
18607 | return;
|
18608 | }
|
18609 | allPromises.push(_this.setModelOnFilterWrapper(filterWrapper.filterPromise, model[colId]));
|
18610 | });
|
18611 | }
|
18612 | else {
|
18613 | this.allColumnFilters.forEach(function (filterWrapper) {
|
18614 | allPromises.push(_this.setModelOnFilterWrapper(filterWrapper.filterPromise, null));
|
18615 | });
|
18616 | }
|
18617 | AgPromise.all(allPromises).then(function () {
|
18618 | var currentModel = _this.getFilterModel();
|
18619 | var columns = [];
|
18620 | _this.allColumnFilters.forEach(function (filterWrapper, colId) {
|
18621 | var before = previousModel ? previousModel[colId] : null;
|
18622 | var after = currentModel ? currentModel[colId] : null;
|
18623 | if (!_.jsonEquals(before, after)) {
|
18624 | columns.push(filterWrapper.column);
|
18625 | }
|
18626 | });
|
18627 | if (columns.length > 0) {
|
18628 | _this.onFilterChanged({ columns: columns });
|
18629 | }
|
18630 | });
|
18631 | };
|
18632 | FilterManager.prototype.setModelOnFilterWrapper = function (filterPromise, newModel) {
|
18633 | return new AgPromise(function (resolve) {
|
18634 | filterPromise.then(function (filter) {
|
18635 | if (typeof filter.setModel !== 'function') {
|
18636 | console.warn('AG Grid: filter missing setModel method, which is needed for setFilterModel');
|
18637 | resolve();
|
18638 | }
|
18639 | (filter.setModel(newModel) || AgPromise.resolve()).then(function () { return resolve(); });
|
18640 | });
|
18641 | });
|
18642 | };
|
18643 | FilterManager.prototype.getFilterModel = function () {
|
18644 | var result = {};
|
18645 | this.allColumnFilters.forEach(function (filterWrapper, key) {
|
18646 |
|
18647 | var filterPromise = filterWrapper.filterPromise;
|
18648 | var filter = filterPromise.resolveNow(null, function (promiseFilter) { return promiseFilter; });
|
18649 | if (filter == null) {
|
18650 | return null;
|
18651 | }
|
18652 | if (typeof filter.getModel !== 'function') {
|
18653 | console.warn('AG Grid: filter API missing getModel method, which is needed for getFilterModel');
|
18654 | return;
|
18655 | }
|
18656 | var model = filter.getModel();
|
18657 | if (exists(model)) {
|
18658 | result[key] = model;
|
18659 | }
|
18660 | });
|
18661 | return result;
|
18662 | };
|
18663 | FilterManager.prototype.isColumnFilterPresent = function () {
|
18664 | return this.activeColumnFilters.length > 0;
|
18665 | };
|
18666 | FilterManager.prototype.isAggregateFilterPresent = function () {
|
18667 | return !!this.activeAggregateFilters.length;
|
18668 | };
|
18669 | FilterManager.prototype.doAggregateFiltersPass = function (node, filterToSkip) {
|
18670 | return this.doColumnFiltersPass(node, filterToSkip, true);
|
18671 | };
|
18672 |
|
18673 |
|
18674 |
|
18675 | FilterManager.prototype.updateActiveFilters = function () {
|
18676 | var _this = this;
|
18677 | this.activeColumnFilters.length = 0;
|
18678 | this.activeAggregateFilters.length = 0;
|
18679 | var isFilterActive = function (filter) {
|
18680 | if (!filter) {
|
18681 | return false;
|
18682 | }
|
18683 | if (!filter.isFilterActive) {
|
18684 | console.warn('AG Grid: Filter is missing isFilterActive() method');
|
18685 | return false;
|
18686 | }
|
18687 | return filter.isFilterActive();
|
18688 | };
|
18689 | var groupFilterEnabled = !!this.gridOptionsWrapper.getGroupAggFiltering();
|
18690 | var isAggFilter = function (column) {
|
18691 | var isSecondary = !column.isPrimary();
|
18692 |
|
18693 | if (isSecondary) {
|
18694 | return true;
|
18695 | }
|
18696 | var isShowingPrimaryColumns = !_this.columnModel.isPivotActive();
|
18697 | var isValueActive = column.isValueActive();
|
18698 |
|
18699 | if (!isValueActive || !isShowingPrimaryColumns) {
|
18700 | return false;
|
18701 | }
|
18702 |
|
18703 | if (_this.columnModel.isPivotMode()) {
|
18704 |
|
18705 |
|
18706 | return true;
|
18707 | }
|
18708 | else {
|
18709 |
|
18710 | return groupFilterEnabled;
|
18711 | }
|
18712 | };
|
18713 | this.allColumnFilters.forEach(function (filterWrapper) {
|
18714 | if (filterWrapper.filterPromise.resolveNow(false, isFilterActive)) {
|
18715 | var filterComp = filterWrapper.filterPromise.resolveNow(null, function (filter) { return filter; });
|
18716 | if (isAggFilter(filterWrapper.column)) {
|
18717 | _this.activeAggregateFilters.push(filterComp);
|
18718 | }
|
18719 | else {
|
18720 | _this.activeColumnFilters.push(filterComp);
|
18721 | }
|
18722 | }
|
18723 | });
|
18724 | };
|
18725 | FilterManager.prototype.updateFilterFlagInColumns = function (source, additionalEventAttributes) {
|
18726 | this.allColumnFilters.forEach(function (filterWrapper) {
|
18727 | var isFilterActive = filterWrapper.filterPromise.resolveNow(false, function (filter) { return filter.isFilterActive(); });
|
18728 | filterWrapper.column.setFilterActive(isFilterActive, source, additionalEventAttributes);
|
18729 | });
|
18730 | };
|
18731 | FilterManager.prototype.isAnyFilterPresent = function () {
|
18732 | return this.isQuickFilterPresent() || this.isColumnFilterPresent() || this.isAggregateFilterPresent() || this.gridOptionsWrapper.isExternalFilterPresent();
|
18733 | };
|
18734 | FilterManager.prototype.doColumnFiltersPass = function (node, filterToSkip, targetAggregates) {
|
18735 | var data = node.data, aggData = node.aggData;
|
18736 | var targetedFilters = targetAggregates ? this.activeAggregateFilters : this.activeColumnFilters;
|
18737 | var targetedData = targetAggregates ? aggData : data;
|
18738 | for (var i = 0; i < targetedFilters.length; i++) {
|
18739 | var filter = targetedFilters[i];
|
18740 | if (filter == null || filter === filterToSkip) {
|
18741 | continue;
|
18742 | }
|
18743 | if (typeof filter.doesFilterPass !== 'function') {
|
18744 |
|
18745 | throw new Error('Filter is missing method doesFilterPass');
|
18746 | }
|
18747 | if (!filter.doesFilterPass({ node: node, data: targetedData })) {
|
18748 | return false;
|
18749 | }
|
18750 | }
|
18751 | return true;
|
18752 | };
|
18753 | FilterManager.prototype.parseQuickFilter = function (newFilter) {
|
18754 | if (!exists(newFilter)) {
|
18755 | return null;
|
18756 | }
|
18757 | if (!this.gridOptionsWrapper.isRowModelDefault()) {
|
18758 | console.warn('AG Grid - Quick filtering only works with the Client-Side Row Model');
|
18759 | return null;
|
18760 | }
|
18761 | return newFilter.toUpperCase();
|
18762 | };
|
18763 | FilterManager.prototype.setQuickFilter = function (newFilter) {
|
18764 | if (newFilter != null && typeof newFilter !== 'string') {
|
18765 | console.warn("AG Grid - setQuickFilter() only supports string inputs, received: " + typeof newFilter);
|
18766 | return;
|
18767 | }
|
18768 | var parsedFilter = this.parseQuickFilter(newFilter);
|
18769 | if (this.quickFilter !== parsedFilter) {
|
18770 | this.quickFilter = parsedFilter;
|
18771 | this.setQuickFilterParts();
|
18772 | this.onFilterChanged();
|
18773 | }
|
18774 | };
|
18775 | FilterManager.prototype.refreshFiltersForAggregations = function () {
|
18776 | var isAggFiltering = this.gridOptionsWrapper.getGroupAggFiltering();
|
18777 | if (isAggFiltering) {
|
18778 | this.onFilterChanged();
|
18779 | }
|
18780 | };
|
18781 |
|
18782 |
|
18783 |
|
18784 |
|
18785 |
|
18786 |
|
18787 | FilterManager.prototype.callOnFilterChangedOutsideRenderCycle = function (params) {
|
18788 | var _this = this;
|
18789 | if (params === void 0) { params = {}; }
|
18790 | var action = function () { return _this.onFilterChanged(params); };
|
18791 | if (this.rowRenderer.isRefreshInProgress()) {
|
18792 | setTimeout(action, 0);
|
18793 | }
|
18794 | else {
|
18795 | action();
|
18796 | }
|
18797 | };
|
18798 | FilterManager.prototype.onFilterChanged = function (params) {
|
18799 | if (params === void 0) { params = {}; }
|
18800 | var filterInstance = params.filterInstance, additionalEventAttributes = params.additionalEventAttributes, columns = params.columns;
|
18801 | this.updateActiveFilters();
|
18802 | this.updateFilterFlagInColumns('filterChanged', additionalEventAttributes);
|
18803 | this.allColumnFilters.forEach(function (filterWrapper) {
|
18804 | if (!filterWrapper.filterPromise) {
|
18805 | return;
|
18806 | }
|
18807 | filterWrapper.filterPromise.then(function (filter) {
|
18808 | if (filter && filter !== filterInstance && filter.onAnyFilterChanged) {
|
18809 | filter.onAnyFilterChanged();
|
18810 | }
|
18811 | });
|
18812 | });
|
18813 | var filterChangedEvent = {
|
18814 | type: Events.EVENT_FILTER_CHANGED,
|
18815 | api: this.gridApi,
|
18816 | columnApi: this.columnApi,
|
18817 | columns: columns || [],
|
18818 | };
|
18819 | if (additionalEventAttributes) {
|
18820 | mergeDeep(filterChangedEvent, additionalEventAttributes);
|
18821 | }
|
18822 |
|
18823 |
|
18824 | this.processingFilterChange = true;
|
18825 | this.eventService.dispatchEvent(filterChangedEvent);
|
18826 | this.processingFilterChange = false;
|
18827 | };
|
18828 | FilterManager.prototype.isSuppressFlashingCellsBecauseFiltering = function () {
|
18829 |
|
18830 |
|
18831 | return !this.allowShowChangeAfterFilter && this.processingFilterChange;
|
18832 | };
|
18833 | FilterManager.prototype.isQuickFilterPresent = function () {
|
18834 | return this.quickFilter !== null;
|
18835 | };
|
18836 | FilterManager.prototype.doesRowPassOtherFilters = function (filterToSkip, node) {
|
18837 | return this.doesRowPassFilter({ rowNode: node, filterInstanceToSkip: filterToSkip });
|
18838 | };
|
18839 | FilterManager.prototype.doesRowPassQuickFilterNoCache = function (node, filterPart) {
|
18840 | var _this = this;
|
18841 | var columns = this.columnModel.getAllColumnsForQuickFilter();
|
18842 | return columns.some(function (column) {
|
18843 | var part = _this.getQuickFilterTextForColumn(column, node);
|
18844 | return exists(part) && part.indexOf(filterPart) >= 0;
|
18845 | });
|
18846 | };
|
18847 | FilterManager.prototype.doesRowPassQuickFilterCache = function (node, filterPart) {
|
18848 | if (!node.quickFilterAggregateText) {
|
18849 | this.aggregateRowForQuickFilter(node);
|
18850 | }
|
18851 | return node.quickFilterAggregateText.indexOf(filterPart) >= 0;
|
18852 | };
|
18853 | FilterManager.prototype.doesRowPassQuickFilter = function (node) {
|
18854 | var _this = this;
|
18855 | var usingCache = this.gridOptionsWrapper.isCacheQuickFilter();
|
18856 |
|
18857 | return this.quickFilterParts.every(function (part) {
|
18858 | return usingCache ? _this.doesRowPassQuickFilterCache(node, part) : _this.doesRowPassQuickFilterNoCache(node, part);
|
18859 | });
|
18860 | };
|
18861 | FilterManager.prototype.doesRowPassAggregateFilters = function (params) {
|
18862 | if (this.isAggregateFilterPresent() && !this.doAggregateFiltersPass(params.rowNode, params.filterInstanceToSkip)) {
|
18863 | return false;
|
18864 | }
|
18865 |
|
18866 | return true;
|
18867 | };
|
18868 | FilterManager.prototype.doesRowPassFilter = function (params) {
|
18869 |
|
18870 |
|
18871 |
|
18872 |
|
18873 | if (this.isQuickFilterPresent() && !this.doesRowPassQuickFilter(params.rowNode)) {
|
18874 | return false;
|
18875 | }
|
18876 |
|
18877 | if (this.gridOptionsWrapper.isExternalFilterPresent() && !this.gridOptionsWrapper.doesExternalFilterPass(params.rowNode)) {
|
18878 | return false;
|
18879 | }
|
18880 |
|
18881 | if (this.isColumnFilterPresent() && !this.doColumnFiltersPass(params.rowNode, params.filterInstanceToSkip)) {
|
18882 | return false;
|
18883 | }
|
18884 |
|
18885 | return true;
|
18886 | };
|
18887 | FilterManager.prototype.getQuickFilterTextForColumn = function (column, node) {
|
18888 | var value = this.valueService.getValue(column, node, true);
|
18889 | var colDef = column.getColDef();
|
18890 | if (colDef.getQuickFilterText) {
|
18891 | var params = {
|
18892 | value: value,
|
18893 | node: node,
|
18894 | data: node.data,
|
18895 | column: column,
|
18896 | colDef: colDef,
|
18897 | api: this.gridOptionsWrapper.getApi(),
|
18898 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
18899 | context: this.gridOptionsWrapper.getContext()
|
18900 | };
|
18901 | value = colDef.getQuickFilterText(params);
|
18902 | }
|
18903 | return exists(value) ? value.toString().toUpperCase() : null;
|
18904 | };
|
18905 | FilterManager.prototype.aggregateRowForQuickFilter = function (node) {
|
18906 | var _this = this;
|
18907 | var stringParts = [];
|
18908 | var columns = this.columnModel.getAllColumnsForQuickFilter();
|
18909 | columns.forEach(function (column) {
|
18910 | var part = _this.getQuickFilterTextForColumn(column, node);
|
18911 | if (exists(part)) {
|
18912 | stringParts.push(part);
|
18913 | }
|
18914 | });
|
18915 | node.quickFilterAggregateText = stringParts.join(FilterManager_1.QUICK_FILTER_SEPARATOR);
|
18916 | };
|
18917 | FilterManager.prototype.onNewRowsLoaded = function (source) {
|
18918 | this.allColumnFilters.forEach(function (filterWrapper) {
|
18919 | filterWrapper.filterPromise.then(function (filter) {
|
18920 | if (filter.onNewRowsLoaded) {
|
18921 | filter.onNewRowsLoaded();
|
18922 | }
|
18923 | });
|
18924 | });
|
18925 | this.updateFilterFlagInColumns(source);
|
18926 | this.updateActiveFilters();
|
18927 | };
|
18928 | FilterManager.prototype.createValueGetter = function (column) {
|
18929 | var _this = this;
|
18930 | return function (_a) {
|
18931 | var node = _a.node;
|
18932 | return _this.valueService.getValue(column, node, true);
|
18933 | };
|
18934 | };
|
18935 | FilterManager.prototype.getFilterComponent = function (column, source, createIfDoesNotExist) {
|
18936 | if (createIfDoesNotExist === void 0) { createIfDoesNotExist = true; }
|
18937 | var _a;
|
18938 | if (createIfDoesNotExist) {
|
18939 | return ((_a = this.getOrCreateFilterWrapper(column, source)) === null || _a === void 0 ? void 0 : _a.filterPromise) || null;
|
18940 | }
|
18941 | var filterWrapper = this.cachedFilter(column);
|
18942 | return filterWrapper ? filterWrapper.filterPromise : null;
|
18943 | };
|
18944 | FilterManager.prototype.isFilterActive = function (column) {
|
18945 | var filterWrapper = this.cachedFilter(column);
|
18946 | return !!filterWrapper && filterWrapper.filterPromise.resolveNow(false, function (filter) { return filter.isFilterActive(); });
|
18947 | };
|
18948 | FilterManager.prototype.getOrCreateFilterWrapper = function (column, source) {
|
18949 | if (!column.isFilterAllowed()) {
|
18950 | return null;
|
18951 | }
|
18952 | var filterWrapper = this.cachedFilter(column);
|
18953 | if (!filterWrapper) {
|
18954 | filterWrapper = this.createFilterWrapper(column, source);
|
18955 | this.allColumnFilters.set(column.getColId(), filterWrapper);
|
18956 | }
|
18957 | else if (source !== 'NO_UI') {
|
18958 | this.putIntoGui(filterWrapper, source);
|
18959 | }
|
18960 | return filterWrapper;
|
18961 | };
|
18962 | FilterManager.prototype.cachedFilter = function (column) {
|
18963 | return this.allColumnFilters.get(column.getColId());
|
18964 | };
|
18965 | FilterManager.prototype.createFilterInstance = function (column) {
|
18966 | var _this = this;
|
18967 | var defaultFilter = ModuleRegistry.isRegistered(ModuleNames.SetFilterModule) ? 'agSetColumnFilter' : 'agTextColumnFilter';
|
18968 | var colDef = column.getColDef();
|
18969 | var filterInstance;
|
18970 | var params = __assign$8(__assign$8({}, this.createFilterParams(column, colDef)), { filterModifiedCallback: function () {
|
18971 | var event = {
|
18972 | type: Events.EVENT_FILTER_MODIFIED,
|
18973 | api: _this.gridApi,
|
18974 | columnApi: _this.columnApi,
|
18975 | column: column,
|
18976 | filterInstance: filterInstance
|
18977 | };
|
18978 | _this.eventService.dispatchEvent(event);
|
18979 | }, filterChangedCallback: function (additionalEventAttributes) {
|
18980 | var params = { filterInstance: filterInstance, additionalEventAttributes: additionalEventAttributes, columns: [column] };
|
18981 | _this.callOnFilterChangedOutsideRenderCycle(params);
|
18982 | }, doesRowPassOtherFilter: function (node) { return _this.doesRowPassOtherFilters(filterInstance, node); } });
|
18983 | var compDetails = this.userComponentFactory.getFilterDetails(colDef, params, defaultFilter);
|
18984 | if (!compDetails) {
|
18985 | return null;
|
18986 | }
|
18987 | var componentPromise = compDetails.newAgStackInstance();
|
18988 | if (componentPromise) {
|
18989 | componentPromise.then(function (r) { return filterInstance = r; });
|
18990 | }
|
18991 | return componentPromise;
|
18992 | };
|
18993 | FilterManager.prototype.createFilterParams = function (column, colDef) {
|
18994 | var params = {
|
18995 | api: this.gridOptionsWrapper.getApi(),
|
18996 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
18997 | column: column,
|
18998 | colDef: cloneObject(colDef),
|
18999 | rowModel: this.rowModel,
|
19000 | filterChangedCallback: function () { },
|
19001 | filterModifiedCallback: function () { },
|
19002 | valueGetter: this.createValueGetter(column),
|
19003 | context: this.gridOptionsWrapper.getContext(),
|
19004 | doesRowPassOtherFilter: function () { return true; },
|
19005 | };
|
19006 | return params;
|
19007 | };
|
19008 | FilterManager.prototype.createFilterWrapper = function (column, source) {
|
19009 | var filterWrapper = {
|
19010 | column: column,
|
19011 | filterPromise: null,
|
19012 | compiledElement: null,
|
19013 | guiPromise: AgPromise.resolve(null)
|
19014 | };
|
19015 | filterWrapper.filterPromise = this.createFilterInstance(column);
|
19016 | if (filterWrapper.filterPromise) {
|
19017 | this.putIntoGui(filterWrapper, source);
|
19018 | }
|
19019 | return filterWrapper;
|
19020 | };
|
19021 | FilterManager.prototype.putIntoGui = function (filterWrapper, source) {
|
19022 | var _this = this;
|
19023 | var eFilterGui = document.createElement('div');
|
19024 | eFilterGui.className = 'ag-filter';
|
19025 | filterWrapper.guiPromise = new AgPromise(function (resolve) {
|
19026 | filterWrapper.filterPromise.then(function (filter) {
|
19027 | var guiFromFilter = filter.getGui();
|
19028 | if (!exists(guiFromFilter)) {
|
19029 | console.warn("AG Grid: getGui method from filter returned " + guiFromFilter + ", it should be a DOM element or an HTML template string.");
|
19030 | }
|
19031 |
|
19032 |
|
19033 |
|
19034 |
|
19035 | if (typeof guiFromFilter === 'string') {
|
19036 | guiFromFilter = loadTemplate(guiFromFilter);
|
19037 | }
|
19038 | eFilterGui.appendChild(guiFromFilter);
|
19039 | resolve(eFilterGui);
|
19040 | _this.eventService.dispatchEvent({
|
19041 | type: Events.EVENT_FILTER_OPENED,
|
19042 | column: filterWrapper.column,
|
19043 | source: source,
|
19044 | eGui: eFilterGui,
|
19045 | api: _this.gridApi,
|
19046 | columnApi: _this.columnApi
|
19047 | });
|
19048 | });
|
19049 | });
|
19050 | };
|
19051 | FilterManager.prototype.onColumnsChanged = function () {
|
19052 | var _this = this;
|
19053 | var columns = [];
|
19054 | this.allColumnFilters.forEach(function (wrapper, colId) {
|
19055 | var currentColumn;
|
19056 | if (wrapper.column.isPrimary()) {
|
19057 | currentColumn = _this.columnModel.getPrimaryColumn(colId);
|
19058 | }
|
19059 | else {
|
19060 | currentColumn = _this.columnModel.getGridColumn(colId);
|
19061 | }
|
19062 | if (currentColumn) {
|
19063 | return;
|
19064 | }
|
19065 | columns.push(wrapper.column);
|
19066 | _this.disposeFilterWrapper(wrapper, 'filterDestroyed');
|
19067 | });
|
19068 | if (columns.length > 0) {
|
19069 | this.onFilterChanged({ columns: columns });
|
19070 | }
|
19071 | };
|
19072 |
|
19073 | FilterManager.prototype.destroyFilter = function (column, source) {
|
19074 | if (source === void 0) { source = 'api'; }
|
19075 | var filterWrapper = this.allColumnFilters.get(column.getColId());
|
19076 | if (filterWrapper) {
|
19077 | this.disposeFilterWrapper(filterWrapper, source);
|
19078 | this.onFilterChanged({ columns: [column] });
|
19079 | }
|
19080 | };
|
19081 | FilterManager.prototype.disposeFilterWrapper = function (filterWrapper, source) {
|
19082 | var _this = this;
|
19083 | filterWrapper.filterPromise.then(function (filter) {
|
19084 | (filter.setModel(null) || AgPromise.resolve()).then(function () {
|
19085 | _this.getContext().destroyBean(filter);
|
19086 | filterWrapper.column.setFilterActive(false, source);
|
19087 | _this.allColumnFilters.delete(filterWrapper.column.getColId());
|
19088 | });
|
19089 | });
|
19090 | };
|
19091 | FilterManager.prototype.destroy = function () {
|
19092 | var _this = this;
|
19093 | _super.prototype.destroy.call(this);
|
19094 | this.allColumnFilters.forEach(function (filterWrapper) { return _this.disposeFilterWrapper(filterWrapper, 'filterDestroyed'); });
|
19095 | };
|
19096 | var FilterManager_1;
|
19097 | FilterManager.QUICK_FILTER_SEPARATOR = '\n';
|
19098 | __decorate$G([
|
19099 | Autowired('valueService')
|
19100 | ], FilterManager.prototype, "valueService", void 0);
|
19101 | __decorate$G([
|
19102 | Autowired('columnModel')
|
19103 | ], FilterManager.prototype, "columnModel", void 0);
|
19104 | __decorate$G([
|
19105 | Autowired('rowModel')
|
19106 | ], FilterManager.prototype, "rowModel", void 0);
|
19107 | __decorate$G([
|
19108 | Autowired('columnApi')
|
19109 | ], FilterManager.prototype, "columnApi", void 0);
|
19110 | __decorate$G([
|
19111 | Autowired('gridApi')
|
19112 | ], FilterManager.prototype, "gridApi", void 0);
|
19113 | __decorate$G([
|
19114 | Autowired('userComponentFactory')
|
19115 | ], FilterManager.prototype, "userComponentFactory", void 0);
|
19116 | __decorate$G([
|
19117 | Autowired('rowRenderer')
|
19118 | ], FilterManager.prototype, "rowRenderer", void 0);
|
19119 | __decorate$G([
|
19120 | PostConstruct
|
19121 | ], FilterManager.prototype, "init", null);
|
19122 | __decorate$G([
|
19123 | PreDestroy
|
19124 | ], FilterManager.prototype, "destroy", null);
|
19125 | FilterManager = FilterManager_1 = __decorate$G([
|
19126 | Bean('filterManager')
|
19127 | ], FilterManager);
|
19128 | return FilterManager;
|
19129 | }(BeanStub));
|
19130 |
|
19131 |
|
19132 |
|
19133 |
|
19134 |
|
19135 |
|
19136 |
|
19137 | var __extends$O = (undefined && undefined.__extends) || (function () {
|
19138 | var extendStatics = function (d, b) {
|
19139 | extendStatics = Object.setPrototypeOf ||
|
19140 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
19141 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
19142 | return extendStatics(d, b);
|
19143 | };
|
19144 | return function (d, b) {
|
19145 | extendStatics(d, b);
|
19146 | function __() { this.constructor = d; }
|
19147 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
19148 | };
|
19149 | })();
|
19150 | var AbstractHeaderCellComp = (function (_super) {
|
19151 | __extends$O(AbstractHeaderCellComp, _super);
|
19152 | function AbstractHeaderCellComp(template, ctrl) {
|
19153 | var _this = _super.call(this, template) || this;
|
19154 | _this.ctrl = ctrl;
|
19155 | return _this;
|
19156 | }
|
19157 | AbstractHeaderCellComp.prototype.getCtrl = function () {
|
19158 | return this.ctrl;
|
19159 | };
|
19160 | return AbstractHeaderCellComp;
|
19161 | }(Component));
|
19162 |
|
19163 |
|
19164 |
|
19165 |
|
19166 |
|
19167 |
|
19168 |
|
19169 | var __extends$P = (undefined && undefined.__extends) || (function () {
|
19170 | var extendStatics = function (d, b) {
|
19171 | extendStatics = Object.setPrototypeOf ||
|
19172 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
19173 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
19174 | return extendStatics(d, b);
|
19175 | };
|
19176 | return function (d, b) {
|
19177 | extendStatics(d, b);
|
19178 | function __() { this.constructor = d; }
|
19179 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
19180 | };
|
19181 | })();
|
19182 | var __decorate$H = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
19183 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
19184 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
19185 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
19186 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
19187 | };
|
19188 | var HeaderFilterCellComp = (function (_super) {
|
19189 | __extends$P(HeaderFilterCellComp, _super);
|
19190 | function HeaderFilterCellComp(ctrl) {
|
19191 | return _super.call(this, HeaderFilterCellComp.TEMPLATE, ctrl) || this;
|
19192 | }
|
19193 | HeaderFilterCellComp.prototype.postConstruct = function () {
|
19194 | var _this = this;
|
19195 | var eGui = this.getGui();
|
19196 | var compProxy = {
|
19197 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
19198 | addOrRemoveBodyCssClass: function (cssClassName, on) { return _this.eFloatingFilterBody.classList.toggle(cssClassName, on); },
|
19199 | addOrRemoveButtonWrapperCssClass: function (cssClassName, on) { return _this.eButtonWrapper.classList.toggle(cssClassName, on); },
|
19200 | setCompDetails: function (compDetails) { return _this.setCompDetails(compDetails); },
|
19201 | getFloatingFilterComp: function () { return _this.compPromise; },
|
19202 | setWidth: function (width) { return eGui.style.width = width; },
|
19203 | setMenuIcon: function (eIcon) { return _this.eButtonShowMainFilter.appendChild(eIcon); }
|
19204 | };
|
19205 | this.ctrl.setComp(compProxy, eGui, this.eButtonShowMainFilter, this.eFloatingFilterBody);
|
19206 | };
|
19207 | HeaderFilterCellComp.prototype.setCompDetails = function (compDetails) {
|
19208 | var _this = this;
|
19209 |
|
19210 | this.compPromise = compDetails.newAgStackInstance();
|
19211 | this.compPromise.then(function (comp) { return _this.afterCompCreated(comp); });
|
19212 | };
|
19213 | HeaderFilterCellComp.prototype.afterCompCreated = function (comp) {
|
19214 | var _this = this;
|
19215 | if (!comp) {
|
19216 | return;
|
19217 | }
|
19218 | this.addDestroyFunc(function () { return _this.context.destroyBean(comp); });
|
19219 | if (!this.isAlive()) {
|
19220 | return;
|
19221 | }
|
19222 | this.eFloatingFilterBody.appendChild(comp.getGui());
|
19223 | if (comp.afterGuiAttached) {
|
19224 | comp.afterGuiAttached();
|
19225 | }
|
19226 | };
|
19227 | 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>";
|
19228 | __decorate$H([
|
19229 | RefSelector('eFloatingFilterBody')
|
19230 | ], HeaderFilterCellComp.prototype, "eFloatingFilterBody", void 0);
|
19231 | __decorate$H([
|
19232 | RefSelector('eButtonWrapper')
|
19233 | ], HeaderFilterCellComp.prototype, "eButtonWrapper", void 0);
|
19234 | __decorate$H([
|
19235 | RefSelector('eButtonShowMainFilter')
|
19236 | ], HeaderFilterCellComp.prototype, "eButtonShowMainFilter", void 0);
|
19237 | __decorate$H([
|
19238 | PostConstruct
|
19239 | ], HeaderFilterCellComp.prototype, "postConstruct", null);
|
19240 | return HeaderFilterCellComp;
|
19241 | }(AbstractHeaderCellComp));
|
19242 |
|
19243 |
|
19244 |
|
19245 |
|
19246 |
|
19247 |
|
19248 |
|
19249 | var SideBarDefParser = (function () {
|
19250 | function SideBarDefParser() {
|
19251 | }
|
19252 | SideBarDefParser.parse = function (toParse) {
|
19253 | if (!toParse) {
|
19254 | return null;
|
19255 | }
|
19256 | if (toParse === true) {
|
19257 | return {
|
19258 | toolPanels: [
|
19259 | SideBarDefParser.DEFAULT_COLUMN_COMP,
|
19260 | SideBarDefParser.DEFAULT_FILTER_COMP,
|
19261 | ],
|
19262 | defaultToolPanel: 'columns'
|
19263 | };
|
19264 | }
|
19265 | if (typeof toParse === 'string') {
|
19266 | return SideBarDefParser.parse([toParse]);
|
19267 | }
|
19268 | if (Array.isArray(toParse)) {
|
19269 | var comps_1 = [];
|
19270 | toParse.forEach(function (key) {
|
19271 | var lookupResult = SideBarDefParser.DEFAULT_BY_KEY[key];
|
19272 | if (!lookupResult) {
|
19273 | 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(','));
|
19274 | return;
|
19275 | }
|
19276 | comps_1.push(lookupResult);
|
19277 | });
|
19278 | if (comps_1.length === 0) {
|
19279 | return null;
|
19280 | }
|
19281 | return {
|
19282 | toolPanels: comps_1,
|
19283 | defaultToolPanel: comps_1[0].id
|
19284 | };
|
19285 | }
|
19286 | var result = {
|
19287 | toolPanels: SideBarDefParser.parseComponents(toParse.toolPanels),
|
19288 | defaultToolPanel: toParse.defaultToolPanel,
|
19289 | hiddenByDefault: toParse.hiddenByDefault,
|
19290 | position: toParse.position
|
19291 | };
|
19292 | return result;
|
19293 | };
|
19294 | SideBarDefParser.parseComponents = function (from) {
|
19295 | var result = [];
|
19296 | if (!from) {
|
19297 | return result;
|
19298 | }
|
19299 | from.forEach(function (it) {
|
19300 | var toAdd = null;
|
19301 | if (typeof it === 'string') {
|
19302 | var lookupResult = SideBarDefParser.DEFAULT_BY_KEY[it];
|
19303 | if (!lookupResult) {
|
19304 | 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(','));
|
19305 | return;
|
19306 | }
|
19307 | toAdd = lookupResult;
|
19308 | }
|
19309 | else {
|
19310 | toAdd = it;
|
19311 | }
|
19312 | result.push(toAdd);
|
19313 | });
|
19314 | return result;
|
19315 | };
|
19316 | SideBarDefParser.DEFAULT_COLUMN_COMP = {
|
19317 | id: 'columns',
|
19318 | labelDefault: 'Columns',
|
19319 | labelKey: 'columns',
|
19320 | iconKey: 'columns',
|
19321 | toolPanel: 'agColumnsToolPanel',
|
19322 | };
|
19323 | SideBarDefParser.DEFAULT_FILTER_COMP = {
|
19324 | id: 'filters',
|
19325 | labelDefault: 'Filters',
|
19326 | labelKey: 'filters',
|
19327 | iconKey: 'filter',
|
19328 | toolPanel: 'agFiltersToolPanel',
|
19329 | };
|
19330 | SideBarDefParser.DEFAULT_BY_KEY = {
|
19331 | columns: SideBarDefParser.DEFAULT_COLUMN_COMP,
|
19332 | filters: SideBarDefParser.DEFAULT_FILTER_COMP
|
19333 | };
|
19334 | return SideBarDefParser;
|
19335 | }());
|
19336 |
|
19337 |
|
19338 |
|
19339 |
|
19340 |
|
19341 |
|
19342 |
|
19343 | var __assign$9 = (undefined && undefined.__assign) || function () {
|
19344 | __assign$9 = Object.assign || function(t) {
|
19345 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
19346 | s = arguments[i];
|
19347 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
19348 | t[p] = s[p];
|
19349 | }
|
19350 | return t;
|
19351 | };
|
19352 | return __assign$9.apply(this, arguments);
|
19353 | };
|
19354 | var __decorate$I = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
19355 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
19356 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
19357 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
19358 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
19359 | };
|
19360 | var __param$3 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
19361 | return function (target, key) { decorator(target, key, paramIndex); }
|
19362 | };
|
19363 | var __read$6 = (undefined && undefined.__read) || function (o, n) {
|
19364 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
19365 | if (!m) return o;
|
19366 | var i = m.call(o), r, ar = [], e;
|
19367 | try {
|
19368 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
19369 | }
|
19370 | catch (error) { e = { error: error }; }
|
19371 | finally {
|
19372 | try {
|
19373 | if (r && !r.done && (m = i["return"])) m.call(i);
|
19374 | }
|
19375 | finally { if (e) throw e.error; }
|
19376 | }
|
19377 | return ar;
|
19378 | };
|
19379 | var __spread$4 = (undefined && undefined.__spread) || function () {
|
19380 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$6(arguments[i]));
|
19381 | return ar;
|
19382 | };
|
19383 | var DEFAULT_ROW_HEIGHT = 25;
|
19384 | var DEFAULT_DETAIL_ROW_HEIGHT = 300;
|
19385 | var DEFAULT_VIEWPORT_ROW_MODEL_PAGE_SIZE = 5;
|
19386 | var DEFAULT_VIEWPORT_ROW_MODEL_BUFFER_SIZE = 5;
|
19387 | var DEFAULT_KEEP_DETAIL_ROW_COUNT = 10;
|
19388 | function isTrue(value) {
|
19389 | return value === true || value === 'true';
|
19390 | }
|
19391 | function toNumber(value) {
|
19392 | if (typeof value == 'number') {
|
19393 | return value;
|
19394 | }
|
19395 | if (typeof value == 'string') {
|
19396 | return parseInt(value, 10);
|
19397 | }
|
19398 | }
|
19399 | function zeroOrGreater(value, defaultValue) {
|
19400 | if (value >= 0) {
|
19401 | return value;
|
19402 | }
|
19403 |
|
19404 | return defaultValue;
|
19405 | }
|
19406 | function oneOrGreater(value, defaultValue) {
|
19407 | var valueNumber = parseInt(value, 10);
|
19408 | if (isNumeric(valueNumber) && valueNumber > 0) {
|
19409 | return valueNumber;
|
19410 | }
|
19411 | return defaultValue;
|
19412 | }
|
19413 | var GridOptionsWrapper = (function () {
|
19414 | function GridOptionsWrapper() {
|
19415 | this.propertyEventService = new EventService();
|
19416 | this.domDataKey = '__AG_' + Math.random().toString();
|
19417 | this.destroyed = false;
|
19418 | }
|
19419 | GridOptionsWrapper_1 = GridOptionsWrapper;
|
19420 | GridOptionsWrapper.prototype.agWire = function (gridApi, columnApi) {
|
19421 | this.gridOptions.api = gridApi;
|
19422 | this.gridOptions.columnApi = columnApi;
|
19423 | this.checkForDeprecated();
|
19424 | this.checkForViolations();
|
19425 | };
|
19426 | GridOptionsWrapper.prototype.destroy = function () {
|
19427 |
|
19428 |
|
19429 |
|
19430 | this.gridOptions.api = null;
|
19431 | this.gridOptions.columnApi = null;
|
19432 | this.destroyed = true;
|
19433 | };
|
19434 | GridOptionsWrapper.prototype.init = function () {
|
19435 | var _this = this;
|
19436 | if (this.gridOptions.suppressPropertyNamesCheck !== true) {
|
19437 | this.checkGridOptionsProperties();
|
19438 | this.checkColumnDefProperties();
|
19439 | }
|
19440 |
|
19441 | if (this.gridOptions.sideBar != null) {
|
19442 | this.gridOptions.sideBar = SideBarDefParser.parse(this.gridOptions.sideBar);
|
19443 | }
|
19444 | var async = this.useAsyncEvents();
|
19445 | this.eventService.addGlobalListener(this.globalEventHandler.bind(this), async);
|
19446 | if (this.isGroupSelectsChildren() && this.isSuppressParentsInRowNodes()) {
|
19447 | console.warn("AG Grid: 'groupSelectsChildren' does not work with 'suppressParentsInRowNodes', this selection method needs the part in rowNode to work");
|
19448 | }
|
19449 | if (this.isGroupSelectsChildren()) {
|
19450 | if (!this.isRowSelectionMulti()) {
|
19451 | console.warn("AG Grid: rowSelection must be 'multiple' for groupSelectsChildren to make sense");
|
19452 | }
|
19453 | if (this.isRowModelServerSide()) {
|
19454 | console.warn('AG Grid: group selects children is NOT support for Server Side Row Model. ' +
|
19455 | 'This is because the rows are lazy loaded, so selecting a group is not possible as' +
|
19456 | 'the grid has no way of knowing what the children are.');
|
19457 | }
|
19458 | }
|
19459 | if (this.isGroupRemoveSingleChildren() && this.isGroupHideOpenParents()) {
|
19460 | 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!");
|
19461 | }
|
19462 | if (this.isRowModelServerSide()) {
|
19463 | var msg = function (prop) { return "AG Grid: '" + prop + "' is not supported on the Server-Side Row Model"; };
|
19464 | if (exists(this.gridOptions.groupDefaultExpanded)) {
|
19465 | console.warn(msg('groupDefaultExpanded'));
|
19466 | }
|
19467 | if (exists(this.gridOptions.groupDefaultExpanded)) {
|
19468 | console.warn(msg('groupIncludeFooter'));
|
19469 | }
|
19470 | if (exists(this.gridOptions.groupDefaultExpanded)) {
|
19471 | console.warn(msg('groupIncludeTotalFooter'));
|
19472 | }
|
19473 | }
|
19474 | if (this.isEnableRangeSelection()) {
|
19475 | ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'enableRangeSelection');
|
19476 | }
|
19477 | if (!this.isEnableRangeSelection() && (this.isEnableRangeHandle() || this.isEnableFillHandle())) {
|
19478 | console.warn("AG Grid: 'enableRangeHandle' and 'enableFillHandle' will not work unless 'enableRangeSelection' is set to true");
|
19479 | }
|
19480 | var warnOfDeprecaredIcon = function (name) {
|
19481 | if (_this.gridOptions.icons && _this.gridOptions.icons[name]) {
|
19482 | 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/");
|
19483 | }
|
19484 | };
|
19485 | warnOfDeprecaredIcon('radioButtonOff');
|
19486 | warnOfDeprecaredIcon('radioButtonOn');
|
19487 | warnOfDeprecaredIcon('checkboxChecked');
|
19488 | warnOfDeprecaredIcon('checkboxUnchecked');
|
19489 | warnOfDeprecaredIcon('checkboxIndeterminate');
|
19490 |
|
19491 | this.getScrollbarWidth();
|
19492 | };
|
19493 | GridOptionsWrapper.prototype.checkColumnDefProperties = function () {
|
19494 | var _this = this;
|
19495 | if (this.gridOptions.columnDefs == null) {
|
19496 | return;
|
19497 | }
|
19498 | this.gridOptions.columnDefs.forEach(function (colDef) {
|
19499 | var userProperties = Object.getOwnPropertyNames(colDef);
|
19500 | var validProperties = __spread$4(ColDefUtil.ALL_PROPERTIES, ColDefUtil.FRAMEWORK_PROPERTIES);
|
19501 | _this.checkProperties(userProperties, validProperties, validProperties, 'colDef', 'https://www.ag-grid.com/javascript-grid-column-properties/');
|
19502 | });
|
19503 | };
|
19504 | GridOptionsWrapper.prototype.checkGridOptionsProperties = function () {
|
19505 | var userProperties = Object.getOwnPropertyNames(this.gridOptions);
|
19506 | var validProperties = __spread$4(PropertyKeys.ALL_PROPERTIES, PropertyKeys.FRAMEWORK_PROPERTIES, values(Events).map(function (event) { return ComponentUtil.getCallbackForEvent(event); }));
|
19507 | var validPropertiesAndExceptions = __spread$4(validProperties, ['api', 'columnApi']);
|
19508 | this.checkProperties(userProperties, validPropertiesAndExceptions, validProperties, 'gridOptions', 'https://www.ag-grid.com/javascript-data-grid/grid-options/');
|
19509 | };
|
19510 | GridOptionsWrapper.prototype.checkProperties = function (userProperties, validPropertiesAndExceptions, validProperties, containerName, docsUrl) {
|
19511 | var invalidProperties = fuzzyCheckStrings(userProperties, validPropertiesAndExceptions, validProperties);
|
19512 | iterateObject(invalidProperties, function (key, value) {
|
19513 | console.warn("ag-grid: invalid " + containerName + " property '" + key + "' did you mean any of these: " + value.slice(0, 8).join(", "));
|
19514 | });
|
19515 | if (Object.keys(invalidProperties).length > 0) {
|
19516 | console.warn("ag-grid: to see all the valid " + containerName + " properties please check: " + docsUrl);
|
19517 | }
|
19518 | };
|
19519 | |
19520 |
|
19521 |
|
19522 |
|
19523 |
|
19524 | GridOptionsWrapper.prototype.mergeGridCommonParams = function (callback) {
|
19525 | var _this = this;
|
19526 | if (callback) {
|
19527 | var wrapped = function (callbackParams) {
|
19528 | var mergedParams = __assign$9(__assign$9({}, callbackParams), { api: _this.getApi(), columnApi: _this.getColumnApi(), context: _this.getContext() });
|
19529 | return callback(mergedParams);
|
19530 | };
|
19531 | return wrapped;
|
19532 | }
|
19533 | return callback;
|
19534 | };
|
19535 | GridOptionsWrapper.prototype.getDomDataKey = function () {
|
19536 | return this.domDataKey;
|
19537 | };
|
19538 |
|
19539 | GridOptionsWrapper.prototype.getDomData = function (element, key) {
|
19540 | var domData = element[this.getDomDataKey()];
|
19541 | return domData ? domData[key] : undefined;
|
19542 | };
|
19543 | GridOptionsWrapper.prototype.setDomData = function (element, key, value) {
|
19544 | var domDataKey = this.getDomDataKey();
|
19545 | var domData = element[domDataKey];
|
19546 | if (missing(domData)) {
|
19547 | domData = {};
|
19548 | element[domDataKey] = domData;
|
19549 | }
|
19550 | domData[key] = value;
|
19551 | };
|
19552 | GridOptionsWrapper.prototype.isRowSelection = function () {
|
19553 | return this.gridOptions.rowSelection === 'single' || this.gridOptions.rowSelection === 'multiple';
|
19554 | };
|
19555 | GridOptionsWrapper.prototype.isSuppressRowDeselection = function () {
|
19556 | return isTrue(this.gridOptions.suppressRowDeselection);
|
19557 | };
|
19558 | GridOptionsWrapper.prototype.isRowSelectionMulti = function () {
|
19559 | return this.gridOptions.rowSelection === 'multiple';
|
19560 | };
|
19561 | GridOptionsWrapper.prototype.isRowMultiSelectWithClick = function () {
|
19562 | return isTrue(this.gridOptions.rowMultiSelectWithClick);
|
19563 | };
|
19564 | GridOptionsWrapper.prototype.getContext = function () {
|
19565 | return this.gridOptions.context;
|
19566 | };
|
19567 | GridOptionsWrapper.prototype.isPivotMode = function () {
|
19568 | return isTrue(this.gridOptions.pivotMode);
|
19569 | };
|
19570 | GridOptionsWrapper.prototype.isSuppressExpandablePivotGroups = function () {
|
19571 | return isTrue(this.gridOptions.suppressExpandablePivotGroups);
|
19572 | };
|
19573 | GridOptionsWrapper.prototype.getPivotColumnGroupTotals = function () {
|
19574 | return this.gridOptions.pivotColumnGroupTotals;
|
19575 | };
|
19576 | GridOptionsWrapper.prototype.getPivotRowTotals = function () {
|
19577 | return this.gridOptions.pivotRowTotals;
|
19578 | };
|
19579 | GridOptionsWrapper.prototype.isRowModelInfinite = function () {
|
19580 | return this.gridOptions.rowModelType === Constants.ROW_MODEL_TYPE_INFINITE;
|
19581 | };
|
19582 | GridOptionsWrapper.prototype.isRowModelViewport = function () {
|
19583 | return this.gridOptions.rowModelType === Constants.ROW_MODEL_TYPE_VIEWPORT;
|
19584 | };
|
19585 | GridOptionsWrapper.prototype.isRowModelServerSide = function () {
|
19586 | return this.gridOptions.rowModelType === Constants.ROW_MODEL_TYPE_SERVER_SIDE;
|
19587 | };
|
19588 | GridOptionsWrapper.prototype.isRowModelDefault = function () {
|
19589 | return (missing(this.gridOptions.rowModelType) ||
|
19590 | this.gridOptions.rowModelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE);
|
19591 | };
|
19592 | GridOptionsWrapper.prototype.isFullRowEdit = function () {
|
19593 | return this.gridOptions.editType === 'fullRow';
|
19594 | };
|
19595 | GridOptionsWrapper.prototype.isSuppressFocusAfterRefresh = function () {
|
19596 | return isTrue(this.gridOptions.suppressFocusAfterRefresh);
|
19597 | };
|
19598 | GridOptionsWrapper.prototype.isSuppressBrowserResizeObserver = function () {
|
19599 | return isTrue(this.gridOptions.suppressBrowserResizeObserver);
|
19600 | };
|
19601 | GridOptionsWrapper.prototype.isSuppressMaintainUnsortedOrder = function () {
|
19602 | return isTrue(this.gridOptions.suppressMaintainUnsortedOrder);
|
19603 | };
|
19604 | GridOptionsWrapper.prototype.isSuppressClearOnFillReduction = function () {
|
19605 | return isTrue(this.gridOptions.suppressClearOnFillReduction);
|
19606 | };
|
19607 | GridOptionsWrapper.prototype.isShowToolPanel = function () {
|
19608 | return isTrue(this.gridOptions.sideBar && Array.isArray(this.getSideBar().toolPanels));
|
19609 | };
|
19610 | GridOptionsWrapper.prototype.getSideBar = function () {
|
19611 | return this.gridOptions.sideBar;
|
19612 | };
|
19613 | GridOptionsWrapper.prototype.isSuppressTouch = function () {
|
19614 | return isTrue(this.gridOptions.suppressTouch);
|
19615 | };
|
19616 | GridOptionsWrapper.prototype.isMaintainColumnOrder = function () {
|
19617 | return isTrue(this.gridOptions.maintainColumnOrder);
|
19618 | };
|
19619 | GridOptionsWrapper.prototype.isSuppressRowTransform = function () {
|
19620 | return isTrue(this.gridOptions.suppressRowTransform);
|
19621 | };
|
19622 | GridOptionsWrapper.prototype.isSuppressColumnStateEvents = function () {
|
19623 | return isTrue(this.gridOptions.suppressColumnStateEvents);
|
19624 | };
|
19625 | GridOptionsWrapper.prototype.isAllowDragFromColumnsToolPanel = function () {
|
19626 | return isTrue(this.gridOptions.allowDragFromColumnsToolPanel);
|
19627 | };
|
19628 | GridOptionsWrapper.prototype.useAsyncEvents = function () {
|
19629 | return !isTrue(this.gridOptions.suppressAsyncEvents);
|
19630 | };
|
19631 | GridOptionsWrapper.prototype.isEnableCellChangeFlash = function () {
|
19632 | return isTrue(this.gridOptions.enableCellChangeFlash);
|
19633 | };
|
19634 | GridOptionsWrapper.prototype.getCellFlashDelay = function () {
|
19635 | return this.gridOptions.cellFlashDelay || 500;
|
19636 | };
|
19637 | GridOptionsWrapper.prototype.getCellFadeDelay = function () {
|
19638 | return this.gridOptions.cellFadeDelay || 1000;
|
19639 | };
|
19640 | GridOptionsWrapper.prototype.isGroupSelectsChildren = function () {
|
19641 | return isTrue(this.gridOptions.groupSelectsChildren);
|
19642 | };
|
19643 | GridOptionsWrapper.prototype.isSuppressRowHoverHighlight = function () {
|
19644 | return isTrue(this.gridOptions.suppressRowHoverHighlight);
|
19645 | };
|
19646 | GridOptionsWrapper.prototype.isColumnHoverHighlight = function () {
|
19647 | return isTrue(this.gridOptions.columnHoverHighlight);
|
19648 | };
|
19649 | GridOptionsWrapper.prototype.isGroupSelectsFiltered = function () {
|
19650 | return isTrue(this.gridOptions.groupSelectsFiltered);
|
19651 | };
|
19652 | GridOptionsWrapper.prototype.isGroupHideOpenParents = function () {
|
19653 | return isTrue(this.gridOptions.groupHideOpenParents);
|
19654 | };
|
19655 | GridOptionsWrapper.prototype.isGroupMaintainOrder = function () {
|
19656 | return isTrue(this.gridOptions.groupMaintainOrder);
|
19657 | };
|
19658 | GridOptionsWrapper.prototype.getAutoGroupColumnDef = function () {
|
19659 | return this.gridOptions.autoGroupColumnDef;
|
19660 | };
|
19661 | GridOptionsWrapper.prototype.isGroupMultiAutoColumn = function () {
|
19662 | if (this.gridOptions.groupDisplayType) {
|
19663 | return this.matchesGroupDisplayType('multipleColumns', this.gridOptions.groupDisplayType);
|
19664 | }
|
19665 |
|
19666 | return isTrue(this.gridOptions.groupHideOpenParents);
|
19667 | };
|
19668 | GridOptionsWrapper.prototype.isGroupUseEntireRow = function (pivotMode) {
|
19669 |
|
19670 | if (pivotMode) {
|
19671 | return false;
|
19672 | }
|
19673 | return this.gridOptions.groupDisplayType ?
|
19674 | this.matchesGroupDisplayType('groupRows', this.gridOptions.groupDisplayType) : false;
|
19675 | };
|
19676 | GridOptionsWrapper.prototype.isGroupSuppressAutoColumn = function () {
|
19677 | var isCustomRowGroups = this.gridOptions.groupDisplayType ?
|
19678 | this.matchesGroupDisplayType('custom', this.gridOptions.groupDisplayType) : false;
|
19679 | if (isCustomRowGroups) {
|
19680 | return true;
|
19681 | }
|
19682 | return this.gridOptions.treeDataDisplayType ?
|
19683 | this.matchesTreeDataDisplayType('custom', this.gridOptions.treeDataDisplayType) : false;
|
19684 | };
|
19685 | GridOptionsWrapper.prototype.isGroupRemoveSingleChildren = function () {
|
19686 | return isTrue(this.gridOptions.groupRemoveSingleChildren);
|
19687 | };
|
19688 | GridOptionsWrapper.prototype.isGroupRemoveLowestSingleChildren = function () {
|
19689 | return isTrue(this.gridOptions.groupRemoveLowestSingleChildren);
|
19690 | };
|
19691 | GridOptionsWrapper.prototype.isGroupIncludeFooter = function () {
|
19692 | return isTrue(this.gridOptions.groupIncludeFooter);
|
19693 | };
|
19694 | GridOptionsWrapper.prototype.isGroupIncludeTotalFooter = function () {
|
19695 | return isTrue(this.gridOptions.groupIncludeTotalFooter);
|
19696 | };
|
19697 | GridOptionsWrapper.prototype.isGroupSuppressBlankHeader = function () {
|
19698 | return isTrue(this.gridOptions.groupSuppressBlankHeader);
|
19699 | };
|
19700 | GridOptionsWrapper.prototype.isSuppressRowClickSelection = function () {
|
19701 | return isTrue(this.gridOptions.suppressRowClickSelection);
|
19702 | };
|
19703 | GridOptionsWrapper.prototype.isSuppressCellFocus = function () {
|
19704 | return isTrue(this.gridOptions.suppressCellFocus);
|
19705 | };
|
19706 | GridOptionsWrapper.prototype.isSuppressMultiSort = function () {
|
19707 | return isTrue(this.gridOptions.suppressMultiSort);
|
19708 | };
|
19709 | GridOptionsWrapper.prototype.isAlwaysMultiSort = function () {
|
19710 | return isTrue(this.gridOptions.alwaysMultiSort);
|
19711 | };
|
19712 | GridOptionsWrapper.prototype.isMultiSortKeyCtrl = function () {
|
19713 | return this.gridOptions.multiSortKey === 'ctrl';
|
19714 | };
|
19715 | GridOptionsWrapper.prototype.isPivotSuppressAutoColumn = function () {
|
19716 | return isTrue(this.gridOptions.pivotSuppressAutoColumn);
|
19717 | };
|
19718 | GridOptionsWrapper.prototype.isSuppressDragLeaveHidesColumns = function () {
|
19719 | return isTrue(this.gridOptions.suppressDragLeaveHidesColumns);
|
19720 | };
|
19721 | GridOptionsWrapper.prototype.isSuppressScrollOnNewData = function () {
|
19722 | return isTrue(this.gridOptions.suppressScrollOnNewData);
|
19723 | };
|
19724 | GridOptionsWrapper.prototype.isSuppressScrollWhenPopupsAreOpen = function () {
|
19725 | return isTrue(this.gridOptions.suppressScrollWhenPopupsAreOpen);
|
19726 | };
|
19727 | GridOptionsWrapper.prototype.isRowDragEntireRow = function () {
|
19728 | return isTrue(this.gridOptions.rowDragEntireRow);
|
19729 | };
|
19730 | GridOptionsWrapper.prototype.isSuppressRowDrag = function () {
|
19731 | return isTrue(this.gridOptions.suppressRowDrag);
|
19732 | };
|
19733 | GridOptionsWrapper.prototype.isRowDragManaged = function () {
|
19734 | return isTrue(this.gridOptions.rowDragManaged);
|
19735 | };
|
19736 | GridOptionsWrapper.prototype.isSuppressMoveWhenRowDragging = function () {
|
19737 | return isTrue(this.gridOptions.suppressMoveWhenRowDragging);
|
19738 | };
|
19739 | GridOptionsWrapper.prototype.isRowDragMultiRow = function () {
|
19740 | return isTrue(this.gridOptions.rowDragMultiRow);
|
19741 | };
|
19742 |
|
19743 | GridOptionsWrapper.prototype.getDomLayout = function () {
|
19744 | var domLayout = this.gridOptions.domLayout || Constants.DOM_LAYOUT_NORMAL;
|
19745 | var validLayouts = [
|
19746 | Constants.DOM_LAYOUT_PRINT,
|
19747 | Constants.DOM_LAYOUT_AUTO_HEIGHT,
|
19748 | Constants.DOM_LAYOUT_NORMAL
|
19749 | ];
|
19750 | if (validLayouts.indexOf(domLayout) === -1) {
|
19751 | doOnce(function () {
|
19752 | 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);
|
19753 | }, 'warn about dom layout values');
|
19754 | return Constants.DOM_LAYOUT_NORMAL;
|
19755 | }
|
19756 | return domLayout;
|
19757 | };
|
19758 | GridOptionsWrapper.prototype.isSuppressHorizontalScroll = function () {
|
19759 | return isTrue(this.gridOptions.suppressHorizontalScroll);
|
19760 | };
|
19761 | GridOptionsWrapper.prototype.isSuppressMaxRenderedRowRestriction = function () {
|
19762 | return isTrue(this.gridOptions.suppressMaxRenderedRowRestriction);
|
19763 | };
|
19764 | GridOptionsWrapper.prototype.isExcludeChildrenWhenTreeDataFiltering = function () {
|
19765 | return isTrue(this.gridOptions.excludeChildrenWhenTreeDataFiltering);
|
19766 | };
|
19767 | GridOptionsWrapper.prototype.isAlwaysShowHorizontalScroll = function () {
|
19768 | return isTrue(this.gridOptions.alwaysShowHorizontalScroll);
|
19769 | };
|
19770 | GridOptionsWrapper.prototype.isAlwaysShowVerticalScroll = function () {
|
19771 | return isTrue(this.gridOptions.alwaysShowVerticalScroll);
|
19772 | };
|
19773 | GridOptionsWrapper.prototype.isDebounceVerticalScrollbar = function () {
|
19774 | return isTrue(this.gridOptions.debounceVerticalScrollbar);
|
19775 | };
|
19776 | GridOptionsWrapper.prototype.isSuppressLoadingOverlay = function () {
|
19777 | return isTrue(this.gridOptions.suppressLoadingOverlay);
|
19778 | };
|
19779 | GridOptionsWrapper.prototype.isSuppressNoRowsOverlay = function () {
|
19780 | return isTrue(this.gridOptions.suppressNoRowsOverlay);
|
19781 | };
|
19782 | GridOptionsWrapper.prototype.isSuppressFieldDotNotation = function () {
|
19783 | return isTrue(this.gridOptions.suppressFieldDotNotation);
|
19784 | };
|
19785 | GridOptionsWrapper.prototype.getPinnedTopRowData = function () {
|
19786 | return this.gridOptions.pinnedTopRowData;
|
19787 | };
|
19788 | GridOptionsWrapper.prototype.getPinnedBottomRowData = function () {
|
19789 | return this.gridOptions.pinnedBottomRowData;
|
19790 | };
|
19791 | GridOptionsWrapper.prototype.isFunctionsPassive = function () {
|
19792 | return isTrue(this.gridOptions.functionsPassive);
|
19793 | };
|
19794 | GridOptionsWrapper.prototype.isSuppressChangeDetection = function () {
|
19795 | return isTrue(this.gridOptions.suppressChangeDetection);
|
19796 | };
|
19797 | GridOptionsWrapper.prototype.isSuppressAnimationFrame = function () {
|
19798 | return isTrue(this.gridOptions.suppressAnimationFrame);
|
19799 | };
|
19800 | GridOptionsWrapper.prototype.getQuickFilterText = function () {
|
19801 | return this.gridOptions.quickFilterText;
|
19802 | };
|
19803 | GridOptionsWrapper.prototype.isCacheQuickFilter = function () {
|
19804 | return isTrue(this.gridOptions.cacheQuickFilter);
|
19805 | };
|
19806 | GridOptionsWrapper.prototype.isUnSortIcon = function () {
|
19807 | return isTrue(this.gridOptions.unSortIcon);
|
19808 | };
|
19809 | GridOptionsWrapper.prototype.isSuppressMenuHide = function () {
|
19810 | return isTrue(this.gridOptions.suppressMenuHide);
|
19811 | };
|
19812 | GridOptionsWrapper.prototype.isEnterMovesDownAfterEdit = function () {
|
19813 | return isTrue(this.gridOptions.enterMovesDownAfterEdit);
|
19814 | };
|
19815 | GridOptionsWrapper.prototype.isEnterMovesDown = function () {
|
19816 | return isTrue(this.gridOptions.enterMovesDown);
|
19817 | };
|
19818 | GridOptionsWrapper.prototype.isUndoRedoCellEditing = function () {
|
19819 | return isTrue(this.gridOptions.undoRedoCellEditing);
|
19820 | };
|
19821 | GridOptionsWrapper.prototype.getUndoRedoCellEditingLimit = function () {
|
19822 | return toNumber(this.gridOptions.undoRedoCellEditingLimit);
|
19823 | };
|
19824 | GridOptionsWrapper.prototype.getRowStyle = function () {
|
19825 | return this.gridOptions.rowStyle;
|
19826 | };
|
19827 | GridOptionsWrapper.prototype.getRowClass = function () {
|
19828 | return this.gridOptions.rowClass;
|
19829 | };
|
19830 | GridOptionsWrapper.prototype.getRowStyleFunc = function () {
|
19831 | return this.mergeGridCommonParams(this.gridOptions.getRowStyle);
|
19832 | };
|
19833 | GridOptionsWrapper.prototype.getRowClassFunc = function () {
|
19834 | return this.mergeGridCommonParams(this.gridOptions.getRowClass);
|
19835 | };
|
19836 | GridOptionsWrapper.prototype.rowClassRules = function () {
|
19837 | return this.gridOptions.rowClassRules;
|
19838 | };
|
19839 | GridOptionsWrapper.prototype.getServerSideStoreType = function () {
|
19840 | return this.gridOptions.serverSideStoreType;
|
19841 | };
|
19842 | GridOptionsWrapper.prototype.getServerSideStoreParamsFunc = function () {
|
19843 | return this.mergeGridCommonParams(this.gridOptions.getServerSideStoreParams);
|
19844 | };
|
19845 | GridOptionsWrapper.prototype.getCreateChartContainerFunc = function () {
|
19846 | return this.mergeGridCommonParams(this.gridOptions.createChartContainer);
|
19847 | };
|
19848 | GridOptionsWrapper.prototype.getPopupParent = function () {
|
19849 | return this.gridOptions.popupParent;
|
19850 | };
|
19851 | GridOptionsWrapper.prototype.getBlockLoadDebounceMillis = function () {
|
19852 | return this.gridOptions.blockLoadDebounceMillis;
|
19853 | };
|
19854 | GridOptionsWrapper.prototype.getPostProcessPopupFunc = function () {
|
19855 | return this.mergeGridCommonParams(this.gridOptions.postProcessPopup);
|
19856 | };
|
19857 | GridOptionsWrapper.prototype.getPaginationNumberFormatterFunc = function () {
|
19858 | return this.mergeGridCommonParams(this.gridOptions.paginationNumberFormatter);
|
19859 | };
|
19860 | GridOptionsWrapper.prototype.getChildCountFunc = function () {
|
19861 | return this.gridOptions.getChildCount;
|
19862 | };
|
19863 | GridOptionsWrapper.prototype.getIsApplyServerSideTransactionFunc = function () {
|
19864 | return this.mergeGridCommonParams(this.gridOptions.isApplyServerSideTransaction);
|
19865 | };
|
19866 | GridOptionsWrapper.prototype.getInitialGroupOrderComparator = function () {
|
19867 | var _a = this.gridOptions, initialGroupOrderComparator = _a.initialGroupOrderComparator, defaultGroupOrderComparator = _a.defaultGroupOrderComparator;
|
19868 | if (initialGroupOrderComparator) {
|
19869 | return this.mergeGridCommonParams(initialGroupOrderComparator);
|
19870 | }
|
19871 |
|
19872 | if (defaultGroupOrderComparator) {
|
19873 | return function (params) { return defaultGroupOrderComparator(params.nodeA, params.nodeB); };
|
19874 | }
|
19875 | };
|
19876 | GridOptionsWrapper.prototype.getIsFullWidthCellFunc = function () {
|
19877 | var _a = this.gridOptions, isFullWidthRow = _a.isFullWidthRow, isFullWidthCell = _a.isFullWidthCell;
|
19878 | if (isFullWidthRow) {
|
19879 | return this.mergeGridCommonParams(isFullWidthRow);
|
19880 | }
|
19881 |
|
19882 | if (isFullWidthCell) {
|
19883 | return function (params) { return isFullWidthCell(params.rowNode); };
|
19884 | }
|
19885 | };
|
19886 | GridOptionsWrapper.prototype.getFullWidthCellRendererParams = function () {
|
19887 | return this.gridOptions.fullWidthCellRendererParams;
|
19888 | };
|
19889 | GridOptionsWrapper.prototype.isEmbedFullWidthRows = function () {
|
19890 | return isTrue(this.gridOptions.embedFullWidthRows) || isTrue(this.gridOptions.deprecatedEmbedFullWidthRows);
|
19891 | };
|
19892 | GridOptionsWrapper.prototype.isDetailRowAutoHeight = function () {
|
19893 | return isTrue(this.gridOptions.detailRowAutoHeight);
|
19894 | };
|
19895 | GridOptionsWrapper.prototype.getSuppressKeyboardEventFunc = function () {
|
19896 | return this.gridOptions.suppressKeyboardEvent;
|
19897 | };
|
19898 | GridOptionsWrapper.prototype.getBusinessKeyForNodeFunc = function () {
|
19899 | return this.gridOptions.getBusinessKeyForNode;
|
19900 | };
|
19901 | GridOptionsWrapper.prototype.getApi = function () {
|
19902 | return this.gridOptions.api;
|
19903 | };
|
19904 | GridOptionsWrapper.prototype.getColumnApi = function () {
|
19905 | return this.gridOptions.columnApi;
|
19906 | };
|
19907 | GridOptionsWrapper.prototype.isReadOnlyEdit = function () {
|
19908 | return isTrue(this.gridOptions.readOnlyEdit);
|
19909 | };
|
19910 | GridOptionsWrapper.prototype.isImmutableData = function () {
|
19911 |
|
19912 |
|
19913 | var getRowIdProvided = this.gridOptions.getRowId != null;
|
19914 | var immutableData = isTrue(this.gridOptions.immutableData);
|
19915 |
|
19916 |
|
19917 | var resetRowDataOnUpdate = isTrue(this.gridOptions.resetRowDataOnUpdate);
|
19918 | if (resetRowDataOnUpdate) {
|
19919 | return false;
|
19920 | }
|
19921 | return getRowIdProvided || immutableData;
|
19922 | };
|
19923 | GridOptionsWrapper.prototype.isEnsureDomOrder = function () {
|
19924 | return isTrue(this.gridOptions.ensureDomOrder);
|
19925 | };
|
19926 | GridOptionsWrapper.prototype.isEnableCharts = function () {
|
19927 | if (isTrue(this.gridOptions.enableCharts)) {
|
19928 | return ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'enableCharts');
|
19929 | }
|
19930 | return false;
|
19931 | };
|
19932 | GridOptionsWrapper.prototype.getColResizeDefault = function () {
|
19933 | return this.gridOptions.colResizeDefault;
|
19934 | };
|
19935 | GridOptionsWrapper.prototype.isSingleClickEdit = function () {
|
19936 | return isTrue(this.gridOptions.singleClickEdit);
|
19937 | };
|
19938 | GridOptionsWrapper.prototype.isSuppressClickEdit = function () {
|
19939 | return isTrue(this.gridOptions.suppressClickEdit);
|
19940 | };
|
19941 | GridOptionsWrapper.prototype.isStopEditingWhenCellsLoseFocus = function () {
|
19942 | return isTrue(this.gridOptions.stopEditingWhenCellsLoseFocus);
|
19943 | };
|
19944 | GridOptionsWrapper.prototype.getGroupDefaultExpanded = function () {
|
19945 | return this.gridOptions.groupDefaultExpanded;
|
19946 | };
|
19947 | GridOptionsWrapper.prototype.getMaxConcurrentDatasourceRequests = function () {
|
19948 | var res = toNumber(this.gridOptions.maxConcurrentDatasourceRequests);
|
19949 | if (res == null) {
|
19950 | return 2;
|
19951 | }
|
19952 | if (res <= 0) {
|
19953 | return;
|
19954 | }
|
19955 | return res;
|
19956 | };
|
19957 | GridOptionsWrapper.prototype.getMaxBlocksInCache = function () {
|
19958 | return this.gridOptions.maxBlocksInCache;
|
19959 | };
|
19960 | GridOptionsWrapper.prototype.getCacheOverflowSize = function () {
|
19961 | return this.gridOptions.cacheOverflowSize;
|
19962 | };
|
19963 | GridOptionsWrapper.prototype.getPaginationPageSize = function () {
|
19964 | return toNumber(this.gridOptions.paginationPageSize);
|
19965 | };
|
19966 | GridOptionsWrapper.prototype.isPaginateChildRows = function () {
|
19967 | var shouldPaginate = this.isGroupRemoveSingleChildren() || this.isGroupRemoveLowestSingleChildren();
|
19968 | if (shouldPaginate) {
|
19969 | return true;
|
19970 | }
|
19971 | return isTrue(this.gridOptions.paginateChildRows);
|
19972 | };
|
19973 | GridOptionsWrapper.prototype.getCacheBlockSize = function () {
|
19974 | return oneOrGreater(this.gridOptions.cacheBlockSize);
|
19975 | };
|
19976 | GridOptionsWrapper.prototype.getInfiniteInitialRowCount = function () {
|
19977 | return this.gridOptions.infiniteInitialRowCount;
|
19978 | };
|
19979 | GridOptionsWrapper.prototype.isPurgeClosedRowNodes = function () {
|
19980 | return isTrue(this.gridOptions.purgeClosedRowNodes);
|
19981 | };
|
19982 | GridOptionsWrapper.prototype.isSuppressPaginationPanel = function () {
|
19983 | return isTrue(this.gridOptions.suppressPaginationPanel);
|
19984 | };
|
19985 | GridOptionsWrapper.prototype.getRowData = function () {
|
19986 | return this.gridOptions.rowData;
|
19987 | };
|
19988 | GridOptionsWrapper.prototype.isEnableRtl = function () {
|
19989 | return isTrue(this.gridOptions.enableRtl);
|
19990 | };
|
19991 | GridOptionsWrapper.prototype.getRowGroupPanelShow = function () {
|
19992 | return this.gridOptions.rowGroupPanelShow;
|
19993 | };
|
19994 | GridOptionsWrapper.prototype.getPivotPanelShow = function () {
|
19995 | return this.gridOptions.pivotPanelShow;
|
19996 | };
|
19997 | GridOptionsWrapper.prototype.isAngularCompileRows = function () {
|
19998 | return isTrue(this.gridOptions.angularCompileRows);
|
19999 | };
|
20000 | GridOptionsWrapper.prototype.isAngularCompileFilters = function () {
|
20001 | return isTrue(this.gridOptions.angularCompileFilters);
|
20002 | };
|
20003 | GridOptionsWrapper.prototype.isDebug = function () {
|
20004 | return isTrue(this.gridOptions.debug);
|
20005 | };
|
20006 | GridOptionsWrapper.prototype.getColumnDefs = function () {
|
20007 | return this.gridOptions.columnDefs;
|
20008 | };
|
20009 | GridOptionsWrapper.prototype.getColumnTypes = function () {
|
20010 | return this.gridOptions.columnTypes;
|
20011 | };
|
20012 | GridOptionsWrapper.prototype.getDatasource = function () {
|
20013 | return this.gridOptions.datasource;
|
20014 | };
|
20015 | GridOptionsWrapper.prototype.getViewportDatasource = function () {
|
20016 | return this.gridOptions.viewportDatasource;
|
20017 | };
|
20018 | GridOptionsWrapper.prototype.getServerSideDatasource = function () {
|
20019 | return this.gridOptions.serverSideDatasource;
|
20020 | };
|
20021 | GridOptionsWrapper.prototype.isAccentedSort = function () {
|
20022 | return isTrue(this.gridOptions.accentedSort);
|
20023 | };
|
20024 | GridOptionsWrapper.prototype.isEnableBrowserTooltips = function () {
|
20025 | return isTrue(this.gridOptions.enableBrowserTooltips);
|
20026 | };
|
20027 | GridOptionsWrapper.prototype.isEnableCellExpressions = function () {
|
20028 | return isTrue(this.gridOptions.enableCellExpressions);
|
20029 | };
|
20030 | GridOptionsWrapper.prototype.isEnableGroupEdit = function () {
|
20031 | return isTrue(this.gridOptions.enableGroupEdit);
|
20032 | };
|
20033 | GridOptionsWrapper.prototype.isSuppressMiddleClickScrolls = function () {
|
20034 | return isTrue(this.gridOptions.suppressMiddleClickScrolls);
|
20035 | };
|
20036 | GridOptionsWrapper.prototype.isPreventDefaultOnContextMenu = function () {
|
20037 | return isTrue(this.gridOptions.preventDefaultOnContextMenu);
|
20038 | };
|
20039 | GridOptionsWrapper.prototype.isSuppressPreventDefaultOnMouseWheel = function () {
|
20040 | return isTrue(this.gridOptions.suppressPreventDefaultOnMouseWheel);
|
20041 | };
|
20042 | GridOptionsWrapper.prototype.isSuppressColumnVirtualisation = function () {
|
20043 | return isTrue(this.gridOptions.suppressColumnVirtualisation);
|
20044 | };
|
20045 | GridOptionsWrapper.prototype.isSuppressRowVirtualisation = function () {
|
20046 | return isTrue(this.gridOptions.suppressRowVirtualisation);
|
20047 | };
|
20048 | GridOptionsWrapper.prototype.isSuppressContextMenu = function () {
|
20049 | return isTrue(this.gridOptions.suppressContextMenu);
|
20050 | };
|
20051 | GridOptionsWrapper.prototype.isAllowContextMenuWithControlKey = function () {
|
20052 | return isTrue(this.gridOptions.allowContextMenuWithControlKey);
|
20053 | };
|
20054 | GridOptionsWrapper.prototype.isSuppressCopyRowsToClipboard = function () {
|
20055 | return isTrue(this.gridOptions.suppressCopyRowsToClipboard);
|
20056 | };
|
20057 | GridOptionsWrapper.prototype.isSuppressCopySingleCellRanges = function () {
|
20058 | return isTrue(this.gridOptions.suppressCopySingleCellRanges);
|
20059 | };
|
20060 | GridOptionsWrapper.prototype.isCopyHeadersToClipboard = function () {
|
20061 | return isTrue(this.gridOptions.copyHeadersToClipboard);
|
20062 | };
|
20063 | GridOptionsWrapper.prototype.isCopyGroupHeadersToClipboard = function () {
|
20064 | return isTrue(this.gridOptions.copyGroupHeadersToClipboard);
|
20065 | };
|
20066 | GridOptionsWrapper.prototype.isSuppressClipboardPaste = function () {
|
20067 | return isTrue(this.gridOptions.suppressClipboardPaste);
|
20068 | };
|
20069 | GridOptionsWrapper.prototype.isSuppressLastEmptyLineOnPaste = function () {
|
20070 | return isTrue(this.gridOptions.suppressLastEmptyLineOnPaste);
|
20071 | };
|
20072 | GridOptionsWrapper.prototype.isPagination = function () {
|
20073 | return isTrue(this.gridOptions.pagination);
|
20074 | };
|
20075 | GridOptionsWrapper.prototype.isSuppressEnterpriseResetOnNewColumns = function () {
|
20076 | return isTrue(this.gridOptions.suppressEnterpriseResetOnNewColumns);
|
20077 | };
|
20078 | GridOptionsWrapper.prototype.getProcessDataFromClipboardFunc = function () {
|
20079 | return this.mergeGridCommonParams(this.gridOptions.processDataFromClipboard);
|
20080 | };
|
20081 | GridOptionsWrapper.prototype.getAsyncTransactionWaitMillis = function () {
|
20082 | return exists(this.gridOptions.asyncTransactionWaitMillis) ? this.gridOptions.asyncTransactionWaitMillis : Constants.BATCH_WAIT_MILLIS;
|
20083 | };
|
20084 | GridOptionsWrapper.prototype.isSuppressMovableColumns = function () {
|
20085 | return isTrue(this.gridOptions.suppressMovableColumns);
|
20086 | };
|
20087 | GridOptionsWrapper.prototype.isAnimateRows = function () {
|
20088 |
|
20089 | if (this.isEnsureDomOrder()) {
|
20090 | return false;
|
20091 | }
|
20092 | return isTrue(this.gridOptions.animateRows);
|
20093 | };
|
20094 | GridOptionsWrapper.prototype.isSuppressColumnMoveAnimation = function () {
|
20095 | return isTrue(this.gridOptions.suppressColumnMoveAnimation);
|
20096 | };
|
20097 | GridOptionsWrapper.prototype.isSuppressAggFuncInHeader = function () {
|
20098 | return isTrue(this.gridOptions.suppressAggFuncInHeader);
|
20099 | };
|
20100 | GridOptionsWrapper.prototype.isSuppressAggAtRootLevel = function () {
|
20101 | return isTrue(this.gridOptions.suppressAggAtRootLevel);
|
20102 | };
|
20103 | GridOptionsWrapper.prototype.isSuppressAggFilteredOnly = function () {
|
20104 | var isGroupAggFiltering = this.getGroupAggFiltering() !== undefined;
|
20105 | return isGroupAggFiltering || isTrue(this.gridOptions.suppressAggFilteredOnly);
|
20106 | };
|
20107 | GridOptionsWrapper.prototype.isRemovePivotHeaderRowWhenSingleValueColumn = function () {
|
20108 | return isTrue(this.gridOptions.removePivotHeaderRowWhenSingleValueColumn);
|
20109 | };
|
20110 | GridOptionsWrapper.prototype.isShowOpenedGroup = function () {
|
20111 | return isTrue(this.gridOptions.showOpenedGroup);
|
20112 | };
|
20113 | GridOptionsWrapper.prototype.isReactUi = function () {
|
20114 | return isTrue(this.gridOptions.reactUi);
|
20115 | };
|
20116 | GridOptionsWrapper.prototype.isSuppressReactUi = function () {
|
20117 | return isTrue(this.gridOptions.suppressReactUi);
|
20118 | };
|
20119 | GridOptionsWrapper.prototype.isEnableRangeSelection = function () {
|
20120 | return ModuleRegistry.isRegistered(ModuleNames.RangeSelectionModule) && isTrue(this.gridOptions.enableRangeSelection);
|
20121 | };
|
20122 | GridOptionsWrapper.prototype.isEnableRangeHandle = function () {
|
20123 | return isTrue(this.gridOptions.enableRangeHandle);
|
20124 | };
|
20125 | GridOptionsWrapper.prototype.isEnableFillHandle = function () {
|
20126 | return isTrue(this.gridOptions.enableFillHandle);
|
20127 | };
|
20128 | GridOptionsWrapper.prototype.getFillHandleDirection = function () {
|
20129 | var direction = this.gridOptions.fillHandleDirection;
|
20130 | if (!direction) {
|
20131 | return 'xy';
|
20132 | }
|
20133 | if (direction !== 'x' && direction !== 'y' && direction !== 'xy') {
|
20134 | doOnce(function () { return console.warn("AG Grid: valid values for fillHandleDirection are 'x', 'y' and 'xy'. Default to 'xy'."); }, 'warn invalid fill direction');
|
20135 | return 'xy';
|
20136 | }
|
20137 | return direction;
|
20138 | };
|
20139 | GridOptionsWrapper.prototype.getFillOperation = function () {
|
20140 | return this.mergeGridCommonParams(this.gridOptions.fillOperation);
|
20141 | };
|
20142 | GridOptionsWrapper.prototype.isSuppressMultiRangeSelection = function () {
|
20143 | return isTrue(this.gridOptions.suppressMultiRangeSelection);
|
20144 | };
|
20145 | GridOptionsWrapper.prototype.isPaginationAutoPageSize = function () {
|
20146 | return isTrue(this.gridOptions.paginationAutoPageSize);
|
20147 | };
|
20148 | GridOptionsWrapper.prototype.isRememberGroupStateWhenNewData = function () {
|
20149 | return isTrue(this.gridOptions.rememberGroupStateWhenNewData);
|
20150 | };
|
20151 | GridOptionsWrapper.prototype.getIcons = function () {
|
20152 | return this.gridOptions.icons;
|
20153 | };
|
20154 | GridOptionsWrapper.prototype.getGroupAggFiltering = function () {
|
20155 | var userValue = this.gridOptions.groupAggFiltering;
|
20156 | if (typeof userValue === 'function') {
|
20157 | return this.mergeGridCommonParams(userValue);
|
20158 | }
|
20159 | if (isTrue(userValue)) {
|
20160 | return function () { return true; };
|
20161 | }
|
20162 | return undefined;
|
20163 | };
|
20164 | GridOptionsWrapper.prototype.getAggFuncs = function () {
|
20165 | return this.gridOptions.aggFuncs;
|
20166 | };
|
20167 | GridOptionsWrapper.prototype.getSortingOrder = function () {
|
20168 | return this.gridOptions.sortingOrder;
|
20169 | };
|
20170 | GridOptionsWrapper.prototype.getAlignedGrids = function () {
|
20171 | return this.gridOptions.alignedGrids;
|
20172 | };
|
20173 | GridOptionsWrapper.prototype.isMasterDetail = function () {
|
20174 | var masterDetail = isTrue(this.gridOptions.masterDetail);
|
20175 | if (masterDetail) {
|
20176 | return ModuleRegistry.assertRegistered(ModuleNames.MasterDetailModule, 'masterDetail');
|
20177 | }
|
20178 | else {
|
20179 | return false;
|
20180 | }
|
20181 | };
|
20182 | GridOptionsWrapper.prototype.isKeepDetailRows = function () {
|
20183 | return isTrue(this.gridOptions.keepDetailRows);
|
20184 | };
|
20185 | GridOptionsWrapper.prototype.getKeepDetailRowsCount = function () {
|
20186 | var keepDetailRowsCount = this.gridOptions.keepDetailRowsCount;
|
20187 | if (exists(keepDetailRowsCount) && keepDetailRowsCount > 0) {
|
20188 | return this.gridOptions.keepDetailRowsCount;
|
20189 | }
|
20190 | return DEFAULT_KEEP_DETAIL_ROW_COUNT;
|
20191 | };
|
20192 | GridOptionsWrapper.prototype.getIsRowMasterFunc = function () {
|
20193 | return this.gridOptions.isRowMaster;
|
20194 | };
|
20195 | GridOptionsWrapper.prototype.getIsRowSelectableFunc = function () {
|
20196 | return this.gridOptions.isRowSelectable;
|
20197 | };
|
20198 | GridOptionsWrapper.prototype.getGroupRowRendererParams = function () {
|
20199 | return this.gridOptions.groupRowRendererParams;
|
20200 | };
|
20201 | GridOptionsWrapper.prototype.getOverlayLoadingTemplate = function () {
|
20202 | return this.gridOptions.overlayLoadingTemplate;
|
20203 | };
|
20204 | GridOptionsWrapper.prototype.getOverlayNoRowsTemplate = function () {
|
20205 | return this.gridOptions.overlayNoRowsTemplate;
|
20206 | };
|
20207 | GridOptionsWrapper.prototype.isSuppressAutoSize = function () {
|
20208 | return isTrue(this.gridOptions.suppressAutoSize);
|
20209 | };
|
20210 | GridOptionsWrapper.prototype.isEnableCellTextSelection = function () {
|
20211 | return isTrue(this.gridOptions.enableCellTextSelection);
|
20212 | };
|
20213 | GridOptionsWrapper.prototype.isSuppressParentsInRowNodes = function () {
|
20214 | return isTrue(this.gridOptions.suppressParentsInRowNodes);
|
20215 | };
|
20216 | GridOptionsWrapper.prototype.isSuppressClipboardApi = function () {
|
20217 | return isTrue(this.gridOptions.suppressClipboardApi);
|
20218 | };
|
20219 | GridOptionsWrapper.prototype.isFunctionsReadOnly = function () {
|
20220 | return isTrue(this.gridOptions.functionsReadOnly);
|
20221 | };
|
20222 | GridOptionsWrapper.prototype.isEnableCellTextSelect = function () {
|
20223 | return isTrue(this.gridOptions.enableCellTextSelection);
|
20224 | };
|
20225 | GridOptionsWrapper.prototype.getDefaultColDef = function () {
|
20226 | return this.gridOptions.defaultColDef;
|
20227 | };
|
20228 | GridOptionsWrapper.prototype.getDefaultColGroupDef = function () {
|
20229 | return this.gridOptions.defaultColGroupDef;
|
20230 | };
|
20231 | GridOptionsWrapper.prototype.getDefaultExportParams = function (type) {
|
20232 | if (this.gridOptions.defaultExportParams) {
|
20233 | console.warn("AG Grid: Since v25.2 `defaultExportParams` has been replaced by `default" + capitalise(type) + "ExportParams`'");
|
20234 | if (type === 'csv') {
|
20235 | return this.gridOptions.defaultExportParams;
|
20236 | }
|
20237 | return this.gridOptions.defaultExportParams;
|
20238 | }
|
20239 | if (type === 'csv' && this.gridOptions.defaultCsvExportParams) {
|
20240 | return this.gridOptions.defaultCsvExportParams;
|
20241 | }
|
20242 | if (type === 'excel' && this.gridOptions.defaultExcelExportParams) {
|
20243 | return this.gridOptions.defaultExcelExportParams;
|
20244 | }
|
20245 | };
|
20246 | GridOptionsWrapper.prototype.isSuppressCsvExport = function () {
|
20247 | return isTrue(this.gridOptions.suppressCsvExport);
|
20248 | };
|
20249 | GridOptionsWrapper.prototype.isAllowShowChangeAfterFilter = function () {
|
20250 | return isTrue(this.gridOptions.allowShowChangeAfterFilter);
|
20251 | };
|
20252 | GridOptionsWrapper.prototype.isSuppressExcelExport = function () {
|
20253 | return isTrue(this.gridOptions.suppressExcelExport);
|
20254 | };
|
20255 | GridOptionsWrapper.prototype.isSuppressMakeColumnVisibleAfterUnGroup = function () {
|
20256 | return isTrue(this.gridOptions.suppressMakeColumnVisibleAfterUnGroup);
|
20257 | };
|
20258 | GridOptionsWrapper.prototype.getDataPathFunc = function () {
|
20259 | return this.gridOptions.getDataPath;
|
20260 | };
|
20261 | GridOptionsWrapper.prototype.getIsServerSideGroupFunc = function () {
|
20262 | return this.gridOptions.isServerSideGroup;
|
20263 | };
|
20264 | GridOptionsWrapper.prototype.getIsServerSideGroupOpenByDefaultFunc = function () {
|
20265 | return this.mergeGridCommonParams(this.gridOptions.isServerSideGroupOpenByDefault);
|
20266 | };
|
20267 | GridOptionsWrapper.prototype.getIsGroupOpenByDefaultFunc = function () {
|
20268 | return this.mergeGridCommonParams(this.gridOptions.isGroupOpenByDefault);
|
20269 | };
|
20270 | GridOptionsWrapper.prototype.getServerSideGroupKeyFunc = function () {
|
20271 | return this.gridOptions.getServerSideGroupKey;
|
20272 | };
|
20273 | GridOptionsWrapper.prototype.getGroupRowAggFunc = function () {
|
20274 | var _a = this.gridOptions, getGroupRowAgg = _a.getGroupRowAgg, groupRowAggNodes = _a.groupRowAggNodes;
|
20275 | if (getGroupRowAgg) {
|
20276 | return this.mergeGridCommonParams(getGroupRowAgg);
|
20277 | }
|
20278 |
|
20279 | if (groupRowAggNodes) {
|
20280 | return function (params) { return groupRowAggNodes(params.nodes); };
|
20281 | }
|
20282 | };
|
20283 | GridOptionsWrapper.prototype.getContextMenuItemsFunc = function () {
|
20284 | return this.mergeGridCommonParams(this.gridOptions.getContextMenuItems);
|
20285 | };
|
20286 | GridOptionsWrapper.prototype.getMainMenuItemsFunc = function () {
|
20287 | return this.mergeGridCommonParams(this.gridOptions.getMainMenuItems);
|
20288 | };
|
20289 | GridOptionsWrapper.prototype.getRowIdFunc = function () {
|
20290 | var _a = this.gridOptions, getRowId = _a.getRowId, getRowNodeId = _a.getRowNodeId;
|
20291 | if (getRowId) {
|
20292 | return this.mergeGridCommonParams(getRowId);
|
20293 | }
|
20294 |
|
20295 | if (getRowNodeId) {
|
20296 | return function (params) { return getRowNodeId(params.data); };
|
20297 | }
|
20298 | };
|
20299 | GridOptionsWrapper.prototype.getNavigateToNextHeaderFunc = function () {
|
20300 | return this.mergeGridCommonParams(this.gridOptions.navigateToNextHeader);
|
20301 | };
|
20302 | GridOptionsWrapper.prototype.getTabToNextHeaderFunc = function () {
|
20303 | return this.mergeGridCommonParams(this.gridOptions.tabToNextHeader);
|
20304 | };
|
20305 | GridOptionsWrapper.prototype.getNavigateToNextCellFunc = function () {
|
20306 | return this.mergeGridCommonParams(this.gridOptions.navigateToNextCell);
|
20307 | };
|
20308 | GridOptionsWrapper.prototype.getTabToNextCellFunc = function () {
|
20309 | return this.mergeGridCommonParams(this.gridOptions.tabToNextCell);
|
20310 | };
|
20311 | GridOptionsWrapper.prototype.getGridTabIndex = function () {
|
20312 | return (this.gridOptions.tabIndex || 0).toString();
|
20313 | };
|
20314 | GridOptionsWrapper.prototype.isTreeData = function () {
|
20315 | var usingTreeData = isTrue(this.gridOptions.treeData);
|
20316 | if (usingTreeData) {
|
20317 | return ModuleRegistry.assertRegistered(ModuleNames.RowGroupingModule, 'Tree Data');
|
20318 | }
|
20319 | return false;
|
20320 | };
|
20321 | GridOptionsWrapper.prototype.isValueCache = function () {
|
20322 | return isTrue(this.gridOptions.valueCache);
|
20323 | };
|
20324 | GridOptionsWrapper.prototype.isValueCacheNeverExpires = function () {
|
20325 | return isTrue(this.gridOptions.valueCacheNeverExpires);
|
20326 | };
|
20327 | GridOptionsWrapper.prototype.isDeltaSort = function () {
|
20328 | return isTrue(this.gridOptions.deltaSort);
|
20329 | };
|
20330 | GridOptionsWrapper.prototype.isAggregateOnlyChangedColumns = function () {
|
20331 | return isTrue(this.gridOptions.aggregateOnlyChangedColumns);
|
20332 | };
|
20333 | GridOptionsWrapper.prototype.getProcessSecondaryColDefFunc = function () {
|
20334 | return this.gridOptions.processSecondaryColDef;
|
20335 | };
|
20336 | GridOptionsWrapper.prototype.getProcessSecondaryColGroupDefFunc = function () {
|
20337 | return this.gridOptions.processSecondaryColGroupDef;
|
20338 | };
|
20339 | GridOptionsWrapper.prototype.getSendToClipboardFunc = function () {
|
20340 | return this.mergeGridCommonParams(this.gridOptions.sendToClipboard);
|
20341 | };
|
20342 | GridOptionsWrapper.prototype.getProcessRowPostCreateFunc = function () {
|
20343 | return this.mergeGridCommonParams(this.gridOptions.processRowPostCreate);
|
20344 | };
|
20345 | GridOptionsWrapper.prototype.getProcessCellForClipboardFunc = function () {
|
20346 | return this.mergeGridCommonParams(this.gridOptions.processCellForClipboard);
|
20347 | };
|
20348 | GridOptionsWrapper.prototype.getProcessHeaderForClipboardFunc = function () {
|
20349 | return this.mergeGridCommonParams(this.gridOptions.processHeaderForClipboard);
|
20350 | };
|
20351 | GridOptionsWrapper.prototype.getProcessGroupHeaderForClipboardFunc = function () {
|
20352 | return this.mergeGridCommonParams(this.gridOptions.processGroupHeaderForClipboard);
|
20353 | };
|
20354 | GridOptionsWrapper.prototype.getProcessCellFromClipboardFunc = function () {
|
20355 | return this.mergeGridCommonParams(this.gridOptions.processCellFromClipboard);
|
20356 | };
|
20357 | GridOptionsWrapper.prototype.getViewportRowModelPageSize = function () {
|
20358 | return oneOrGreater(this.gridOptions.viewportRowModelPageSize, DEFAULT_VIEWPORT_ROW_MODEL_PAGE_SIZE);
|
20359 | };
|
20360 | GridOptionsWrapper.prototype.getViewportRowModelBufferSize = function () {
|
20361 | return zeroOrGreater(this.gridOptions.viewportRowModelBufferSize, DEFAULT_VIEWPORT_ROW_MODEL_BUFFER_SIZE);
|
20362 | };
|
20363 | GridOptionsWrapper.prototype.isServerSideSortingAlwaysResets = function () {
|
20364 | return isTrue(this.gridOptions.serverSideSortingAlwaysResets);
|
20365 | };
|
20366 | GridOptionsWrapper.prototype.isServerSideFilteringAlwaysResets = function () {
|
20367 | return isTrue(this.gridOptions.serverSideFilteringAlwaysResets);
|
20368 | };
|
20369 | GridOptionsWrapper.prototype.getPostSortFunc = function () {
|
20370 | var _a = this.gridOptions, postSortRows = _a.postSortRows, postSort = _a.postSort;
|
20371 | if (postSortRows) {
|
20372 | return this.mergeGridCommonParams(postSortRows);
|
20373 | }
|
20374 |
|
20375 | if (postSort) {
|
20376 | return function (params) { return postSort(params.nodes); };
|
20377 | }
|
20378 | };
|
20379 | GridOptionsWrapper.prototype.getChartToolbarItemsFunc = function () {
|
20380 | return this.mergeGridCommonParams(this.gridOptions.getChartToolbarItems);
|
20381 | };
|
20382 | GridOptionsWrapper.prototype.getChartThemeOverrides = function () {
|
20383 | return this.gridOptions.chartThemeOverrides;
|
20384 | };
|
20385 | GridOptionsWrapper.prototype.getCustomChartThemes = function () {
|
20386 | return this.gridOptions.customChartThemes;
|
20387 | };
|
20388 | GridOptionsWrapper.prototype.getChartThemes = function () {
|
20389 |
|
20390 | return this.gridOptions.chartThemes || ['ag-default', 'ag-material', 'ag-pastel', 'ag-vivid', 'ag-solar'];
|
20391 | };
|
20392 | GridOptionsWrapper.prototype.getClipboardDelimiter = function () {
|
20393 | return exists(this.gridOptions.clipboardDelimiter) ? this.gridOptions.clipboardDelimiter : '\t';
|
20394 | };
|
20395 | GridOptionsWrapper.prototype.setProperty = function (key, value, force) {
|
20396 | if (force === void 0) { force = false; }
|
20397 | var gridOptionsNoType = this.gridOptions;
|
20398 | var previousValue = gridOptionsNoType[key];
|
20399 | if (force || previousValue !== value) {
|
20400 | gridOptionsNoType[key] = value;
|
20401 | var event_1 = {
|
20402 | type: key,
|
20403 | currentValue: value,
|
20404 | previousValue: previousValue
|
20405 | };
|
20406 | this.propertyEventService.dispatchEvent(event_1);
|
20407 | }
|
20408 | };
|
20409 | GridOptionsWrapper.prototype.addEventListener = function (key, listener) {
|
20410 | this.propertyEventService.addEventListener(key, listener);
|
20411 | };
|
20412 | GridOptionsWrapper.prototype.removeEventListener = function (key, listener) {
|
20413 | this.propertyEventService.removeEventListener(key, listener);
|
20414 | };
|
20415 | GridOptionsWrapper.prototype.isSkipHeaderOnAutoSize = function () {
|
20416 | return !!this.gridOptions.skipHeaderOnAutoSize;
|
20417 | };
|
20418 | GridOptionsWrapper.prototype.getAutoSizePadding = function () {
|
20419 | var value = this.gridOptions.autoSizePadding;
|
20420 | return value != null && value >= 0 ? value : 20;
|
20421 | };
|
20422 |
|
20423 | GridOptionsWrapper.prototype.getHeaderHeight = function () {
|
20424 | if (typeof this.gridOptions.headerHeight === 'number') {
|
20425 | return this.gridOptions.headerHeight;
|
20426 | }
|
20427 | return this.getFromTheme(25, 'headerHeight');
|
20428 | };
|
20429 | GridOptionsWrapper.prototype.getFloatingFiltersHeight = function () {
|
20430 | if (typeof this.gridOptions.floatingFiltersHeight === 'number') {
|
20431 | return this.gridOptions.floatingFiltersHeight;
|
20432 | }
|
20433 | return this.getFromTheme(25, 'headerHeight');
|
20434 | };
|
20435 | GridOptionsWrapper.prototype.getGroupHeaderHeight = function () {
|
20436 | if (typeof this.gridOptions.groupHeaderHeight === 'number') {
|
20437 | return this.gridOptions.groupHeaderHeight;
|
20438 | }
|
20439 | return this.getHeaderHeight();
|
20440 | };
|
20441 | GridOptionsWrapper.prototype.getPivotHeaderHeight = function () {
|
20442 | if (typeof this.gridOptions.pivotHeaderHeight === 'number') {
|
20443 | return this.gridOptions.pivotHeaderHeight;
|
20444 | }
|
20445 | return this.getHeaderHeight();
|
20446 | };
|
20447 | GridOptionsWrapper.prototype.getPivotGroupHeaderHeight = function () {
|
20448 | if (typeof this.gridOptions.pivotGroupHeaderHeight === 'number') {
|
20449 | return this.gridOptions.pivotGroupHeaderHeight;
|
20450 | }
|
20451 | return this.getGroupHeaderHeight();
|
20452 | };
|
20453 | GridOptionsWrapper.prototype.isExternalFilterPresent = function () {
|
20454 | if (typeof this.gridOptions.isExternalFilterPresent === 'function') {
|
20455 | return this.gridOptions.isExternalFilterPresent({ api: this.getApi(), columnApi: this.getColumnApi(), context: this.getContext() });
|
20456 | }
|
20457 | return false;
|
20458 | };
|
20459 | GridOptionsWrapper.prototype.doesExternalFilterPass = function (node) {
|
20460 | if (typeof this.gridOptions.doesExternalFilterPass === 'function') {
|
20461 | return this.gridOptions.doesExternalFilterPass(node);
|
20462 | }
|
20463 | return false;
|
20464 | };
|
20465 | GridOptionsWrapper.prototype.getTooltipDelay = function (type) {
|
20466 | var _a = this.gridOptions, tooltipShowDelay = _a.tooltipShowDelay, tooltipHideDelay = _a.tooltipHideDelay;
|
20467 | var delay = type === 'show' ? tooltipShowDelay : tooltipHideDelay;
|
20468 | var capitalisedType = capitalise(type);
|
20469 | if (exists(delay)) {
|
20470 | if (delay < 0) {
|
20471 | doOnce(function () { return console.warn("ag-grid: tooltip" + capitalisedType + "Delay should not be lower than 0"); }, "tooltip" + capitalisedType + "DelayWarn");
|
20472 | }
|
20473 | return Math.max(200, delay);
|
20474 | }
|
20475 | return null;
|
20476 | };
|
20477 | GridOptionsWrapper.prototype.isTooltipMouseTrack = function () {
|
20478 | return isTrue(this.gridOptions.tooltipMouseTrack);
|
20479 | };
|
20480 | GridOptionsWrapper.prototype.isSuppressModelUpdateAfterUpdateTransaction = function () {
|
20481 | return isTrue(this.gridOptions.suppressModelUpdateAfterUpdateTransaction);
|
20482 | };
|
20483 | GridOptionsWrapper.prototype.getDocument = function () {
|
20484 |
|
20485 |
|
20486 | var result = null;
|
20487 | if (this.gridOptions.getDocument && exists(this.gridOptions.getDocument)) {
|
20488 | result = this.gridOptions.getDocument();
|
20489 | }
|
20490 | else if (this.eGridDiv) {
|
20491 | result = this.eGridDiv.ownerDocument;
|
20492 | }
|
20493 | if (result && exists(result)) {
|
20494 | return result;
|
20495 | }
|
20496 | return document;
|
20497 | };
|
20498 | GridOptionsWrapper.prototype.getMinColWidth = function () {
|
20499 | var minColWidth = this.gridOptions.minColWidth;
|
20500 | if (exists(minColWidth) && minColWidth > GridOptionsWrapper_1.MIN_COL_WIDTH) {
|
20501 | return this.gridOptions.minColWidth;
|
20502 | }
|
20503 | var measuredMin = this.getFromTheme(null, 'headerCellMinWidth');
|
20504 | return exists(measuredMin) ? Math.max(measuredMin, GridOptionsWrapper_1.MIN_COL_WIDTH) : GridOptionsWrapper_1.MIN_COL_WIDTH;
|
20505 | };
|
20506 | GridOptionsWrapper.prototype.getMaxColWidth = function () {
|
20507 | if (this.gridOptions.maxColWidth && this.gridOptions.maxColWidth > GridOptionsWrapper_1.MIN_COL_WIDTH) {
|
20508 | return this.gridOptions.maxColWidth;
|
20509 | }
|
20510 | return null;
|
20511 | };
|
20512 | GridOptionsWrapper.prototype.getColWidth = function () {
|
20513 | if (typeof this.gridOptions.colWidth !== 'number' || this.gridOptions.colWidth < GridOptionsWrapper_1.MIN_COL_WIDTH) {
|
20514 | return 200;
|
20515 | }
|
20516 | return this.gridOptions.colWidth;
|
20517 | };
|
20518 | GridOptionsWrapper.prototype.getRowBuffer = function () {
|
20519 | var rowBuffer = this.gridOptions.rowBuffer;
|
20520 | if (typeof rowBuffer === 'number') {
|
20521 | if (rowBuffer < 0) {
|
20522 | doOnce(function () { return console.warn("AG Grid: rowBuffer should not be negative"); }, 'warn rowBuffer negative');
|
20523 | this.gridOptions.rowBuffer = rowBuffer = 0;
|
20524 | }
|
20525 | }
|
20526 | else {
|
20527 | rowBuffer = Constants.ROW_BUFFER_SIZE;
|
20528 | }
|
20529 | return rowBuffer;
|
20530 | };
|
20531 | GridOptionsWrapper.prototype.getRowBufferInPixels = function () {
|
20532 | var rowsToBuffer = this.getRowBuffer();
|
20533 | var defaultRowHeight = this.getRowHeightAsNumber();
|
20534 | return rowsToBuffer * defaultRowHeight;
|
20535 | };
|
20536 |
|
20537 |
|
20538 |
|
20539 | GridOptionsWrapper.prototype.getScrollbarWidth = function () {
|
20540 | if (this.scrollbarWidth == null) {
|
20541 | var useGridOptions = typeof this.gridOptions.scrollbarWidth === 'number' && this.gridOptions.scrollbarWidth >= 0;
|
20542 | var scrollbarWidth = useGridOptions ? this.gridOptions.scrollbarWidth : getScrollbarWidth();
|
20543 | if (scrollbarWidth != null) {
|
20544 | this.scrollbarWidth = scrollbarWidth;
|
20545 | this.eventService.dispatchEvent({
|
20546 | type: Events.EVENT_SCROLLBAR_WIDTH_CHANGED
|
20547 | });
|
20548 | }
|
20549 | }
|
20550 | return this.scrollbarWidth;
|
20551 | };
|
20552 | GridOptionsWrapper.prototype.checkForDeprecated = function () {
|
20553 |
|
20554 |
|
20555 | var options = this.gridOptions;
|
20556 | if (options.deprecatedEmbedFullWidthRows) {
|
20557 | console.warn("AG Grid: since v21.2, deprecatedEmbedFullWidthRows has been replaced with embedFullWidthRows.");
|
20558 | }
|
20559 | if (options.rowDeselection) {
|
20560 | 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.');
|
20561 | }
|
20562 | if (options.enableMultiRowDragging) {
|
20563 | options.rowDragMultiRow = true;
|
20564 | delete options.enableMultiRowDragging;
|
20565 | console.warn('AG Grid: since v26.1, `enableMultiRowDragging` is deprecated. Please use `rowDragMultiRow`.');
|
20566 | }
|
20567 | var checkRenamedProperty = function (oldProp, newProp, version) {
|
20568 | if (options[oldProp] != null) {
|
20569 | console.warn("AG Grid: since version " + version + ", '" + oldProp + "' is deprecated / renamed, please use the new property name '" + newProp + "' instead.");
|
20570 | if (options[newProp] == null) {
|
20571 | options[newProp] = options[oldProp];
|
20572 | }
|
20573 | }
|
20574 | };
|
20575 | checkRenamedProperty('batchUpdateWaitMillis', 'asyncTransactionWaitMillis', '23.1.x');
|
20576 | checkRenamedProperty('deltaRowDataMode', 'immutableData', '23.1.x');
|
20577 | if (options.immutableColumns || options.deltaColumnMode) {
|
20578 | 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');
|
20579 | }
|
20580 | checkRenamedProperty('suppressSetColumnStateEvents', 'suppressColumnStateEvents', '24.0.x');
|
20581 | if (options.groupRowInnerRenderer || options.groupRowInnerRendererParams || options.groupRowInnerRendererFramework) {
|
20582 | console.warn('AG Grid: since v24.0, grid properties groupRowInnerRenderer, groupRowInnerRendererFramework and groupRowInnerRendererParams are no longer used.');
|
20583 | console.warn(' Instead use the grid properties groupRowRendererParams.innerRenderer, groupRowRendererParams.innerRendererFramework and groupRowRendererParams.innerRendererParams.');
|
20584 | console.warn(' For example instead of this:');
|
20585 | console.warn(' groupRowInnerRenderer: "myRenderer"');
|
20586 | console.warn(' groupRowInnerRendererParams: {x: a}');
|
20587 | console.warn(' Replace with this:');
|
20588 | console.warn(' groupRowRendererParams: {');
|
20589 | console.warn(' innerRenderer: "myRenderer",');
|
20590 | console.warn(' innerRendererParams: {x: a}');
|
20591 | console.warn(' }');
|
20592 | console.warn(' We have copied the properties over for you. However to stop this error message, please change your application code.');
|
20593 | if (!options.groupRowRendererParams) {
|
20594 | options.groupRowRendererParams = {};
|
20595 | }
|
20596 | var params = options.groupRowRendererParams;
|
20597 | if (options.groupRowInnerRenderer) {
|
20598 | params.innerRenderer = options.groupRowInnerRenderer;
|
20599 | }
|
20600 | if (options.groupRowInnerRendererParams) {
|
20601 | params.innerRendererParams = options.groupRowInnerRendererParams;
|
20602 | }
|
20603 | if (options.groupRowInnerRendererFramework) {
|
20604 | params.innerRendererFramework = options.groupRowInnerRendererFramework;
|
20605 | }
|
20606 | }
|
20607 | if (options.rememberGroupStateWhenNewData) {
|
20608 | 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.');
|
20609 | }
|
20610 | if (options.detailCellRendererParams && options.detailCellRendererParams.autoHeight) {
|
20611 | 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');
|
20612 | options.detailRowAutoHeight = true;
|
20613 | }
|
20614 | if (options.suppressKeyboardEvent) {
|
20615 | 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.");
|
20616 | }
|
20617 | if (options.suppressEnterpriseResetOnNewColumns) {
|
20618 | 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.');
|
20619 | }
|
20620 | if (options.suppressColumnStateEvents) {
|
20621 | 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');
|
20622 | }
|
20623 | if (options.defaultExportParams) {
|
20624 | console.warn('AG Grid: since v25.2, the grid property `defaultExportParams` has been replaced by `defaultCsvExportParams` and `defaultExcelExportParams`.');
|
20625 | }
|
20626 | if (options.stopEditingWhenGridLosesFocus) {
|
20627 | console.warn('AG Grid: since v25.2.2, the grid property `stopEditingWhenGridLosesFocus` has been replaced by `stopEditingWhenCellsLoseFocus`.');
|
20628 | options.stopEditingWhenCellsLoseFocus = true;
|
20629 | }
|
20630 | if (options.applyColumnDefOrder) {
|
20631 | 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');
|
20632 | }
|
20633 | if (options.groupMultiAutoColumn) {
|
20634 | console.warn("AG Grid: since v26.0, the grid property `groupMultiAutoColumn` has been replaced by `groupDisplayType = 'multipleColumns'`");
|
20635 | options.groupDisplayType = 'multipleColumns';
|
20636 | }
|
20637 | if (options.groupUseEntireRow) {
|
20638 | console.warn("AG Grid: since v26.0, the grid property `groupUseEntireRow` has been replaced by `groupDisplayType = 'groupRows'`");
|
20639 | options.groupDisplayType = 'groupRows';
|
20640 | }
|
20641 | if (options.groupSuppressAutoColumn) {
|
20642 | var propName = options.treeData ? 'treeDataDisplayType' : 'groupDisplayType';
|
20643 | console.warn("AG Grid: since v26.0, the grid property `groupSuppressAutoColumn` has been replaced by `" + propName + " = 'custom'`");
|
20644 | options.groupDisplayType = 'custom';
|
20645 | }
|
20646 | if (options.defaultGroupOrderComparator) {
|
20647 | 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.");
|
20648 | }
|
20649 | if (options.defaultGroupSortComparator) {
|
20650 | console.warn("AG Grid: since v26.0, the grid property `defaultGroupSortComparator` has been replaced by `initialGroupOrderComparator`");
|
20651 | options.defaultGroupOrderComparator = options.defaultGroupSortComparator;
|
20652 | }
|
20653 | if (options.groupRowAggNodes) {
|
20654 | 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.");
|
20655 | }
|
20656 | if (options.postSort) {
|
20657 | 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.");
|
20658 | }
|
20659 | if (options.isFullWidthCell) {
|
20660 | 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.");
|
20661 | }
|
20662 | if (options.localeTextFunc) {
|
20663 | 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.");
|
20664 | }
|
20665 | if (options.colWidth) {
|
20666 | console.warn('AG Grid: since v26.1, the grid property `colWidth` is deprecated and should be set via `defaultColDef.width`.');
|
20667 | }
|
20668 | if (options.minColWidth) {
|
20669 | console.warn('AG Grid: since v26.1, the grid property `minColWidth` is deprecated and should be set via `defaultColDef.minWidth`.');
|
20670 | }
|
20671 | if (options.maxColWidth) {
|
20672 | console.warn('AG Grid: since v26.1, the grid property `maxColWidth` is deprecated and should be set via `defaultColDef.maxWidth`.');
|
20673 | }
|
20674 | if (options.reactUi) {
|
20675 | 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.');
|
20676 | }
|
20677 | if (options.suppressReactUi) {
|
20678 | console.warn('AG Grid: The legacy React rendering engine is deprecated and will be removed in the next major version of the grid.');
|
20679 | }
|
20680 | if (options.suppressCellSelection) {
|
20681 | console.warn('AG Grid: since v27.0, `suppressCellSelection` has been replaced by `suppressCellFocus`.');
|
20682 | options.suppressCellFocus = options.suppressCellSelection;
|
20683 | }
|
20684 | if (options.getRowNodeId) {
|
20685 | 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.');
|
20686 | }
|
20687 | if (options.immutableData) {
|
20688 | if (options.getRowId) {
|
20689 | 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`.');
|
20690 | }
|
20691 | else {
|
20692 | console.warn('AG Grid: since v27.1, `immutableData` is deprecated. To enable immutable data you must implement the `getRowId()` callback.');
|
20693 | }
|
20694 | }
|
20695 | if (options.clipboardDeliminator) {
|
20696 | console.warn('AG Grid: since v27.1, `clipboardDeliminator` has been replaced by `clipboardDelimiter`.');
|
20697 | options.clipboardDelimiter = options.clipboardDeliminator;
|
20698 | }
|
20699 | };
|
20700 | GridOptionsWrapper.prototype.checkForViolations = function () {
|
20701 | if (this.isTreeData()) {
|
20702 | this.treeDataViolations();
|
20703 | }
|
20704 | };
|
20705 | GridOptionsWrapper.prototype.treeDataViolations = function () {
|
20706 | if (this.isRowModelDefault()) {
|
20707 | if (missing(this.getDataPathFunc())) {
|
20708 | console.warn('AG Grid: property usingTreeData=true with rowModel=clientSide, but you did not ' +
|
20709 | 'provide getDataPath function, please provide getDataPath function if using tree data.');
|
20710 | }
|
20711 | }
|
20712 | if (this.isRowModelServerSide()) {
|
20713 | if (missing(this.getIsServerSideGroupFunc())) {
|
20714 | console.warn('AG Grid: property usingTreeData=true with rowModel=serverSide, but you did not ' +
|
20715 | 'provide isServerSideGroup function, please provide isServerSideGroup function if using tree data.');
|
20716 | }
|
20717 | if (missing(this.getServerSideGroupKeyFunc())) {
|
20718 | console.warn('AG Grid: property usingTreeData=true with rowModel=serverSide, but you did not ' +
|
20719 | 'provide getServerSideGroupKey function, please provide getServerSideGroupKey function if using tree data.');
|
20720 | }
|
20721 | }
|
20722 | };
|
20723 | GridOptionsWrapper.prototype.getLocaleTextFunc = function () {
|
20724 | var _this = this;
|
20725 | var _a = this.gridOptions, localeText = _a.localeText, getLocaleText = _a.getLocaleText, localeTextFunc = _a.localeTextFunc;
|
20726 | if (getLocaleText) {
|
20727 |
|
20728 | return function (key, defaultValue, variableValues) {
|
20729 | var params = {
|
20730 | key: key,
|
20731 | defaultValue: defaultValue,
|
20732 | variableValues: variableValues,
|
20733 | api: _this.getApi(),
|
20734 | columnApi: _this.getColumnApi(),
|
20735 | context: _this.getContext()
|
20736 | };
|
20737 | return getLocaleText(params);
|
20738 | };
|
20739 | }
|
20740 | if (localeTextFunc) {
|
20741 | return localeTextFunc;
|
20742 | }
|
20743 | return function (key, defaultValue, variableValues) {
|
20744 | var localisedText = localeText && localeText[key];
|
20745 | if (localisedText && variableValues && variableValues.length) {
|
20746 | var found = 0;
|
20747 | while (true) {
|
20748 | if (found >= variableValues.length) {
|
20749 | break;
|
20750 | }
|
20751 | var idx = localisedText.indexOf('${variable}');
|
20752 | if (idx === -1) {
|
20753 | break;
|
20754 | }
|
20755 | localisedText = localisedText.replace('${variable}', variableValues[found++]);
|
20756 | }
|
20757 | }
|
20758 | return (localisedText !== null && localisedText !== void 0 ? localisedText : defaultValue);
|
20759 | };
|
20760 | };
|
20761 |
|
20762 | GridOptionsWrapper.prototype.globalEventHandler = function (eventName, event) {
|
20763 |
|
20764 | if (this.destroyed) {
|
20765 | return;
|
20766 | }
|
20767 | var callbackMethodName = ComponentUtil.getCallbackForEvent(eventName);
|
20768 | if (typeof this.gridOptions[callbackMethodName] === 'function') {
|
20769 | this.gridOptions[callbackMethodName](event);
|
20770 | }
|
20771 | };
|
20772 | GridOptionsWrapper.prototype.setRowHeightVariable = function (height) {
|
20773 | var oldRowHeight = this.eGridDiv.style.getPropertyValue('--ag-line-height').trim();
|
20774 | var newRowHeight = height + "px";
|
20775 | if (oldRowHeight != newRowHeight) {
|
20776 | this.eGridDiv.style.setProperty('--ag-line-height', newRowHeight);
|
20777 | }
|
20778 | };
|
20779 |
|
20780 | GridOptionsWrapper.prototype.getRowHeightAsNumber = function () {
|
20781 | if (!this.gridOptions.rowHeight || missing(this.gridOptions.rowHeight)) {
|
20782 | return this.getDefaultRowHeight();
|
20783 | }
|
20784 | var rowHeight = this.gridOptions.rowHeight;
|
20785 | if (rowHeight && this.isNumeric(rowHeight)) {
|
20786 | this.setRowHeightVariable(rowHeight);
|
20787 | return rowHeight;
|
20788 | }
|
20789 | console.warn('AG Grid row height must be a number if not using standard row model');
|
20790 | return this.getDefaultRowHeight();
|
20791 | };
|
20792 | GridOptionsWrapper.prototype.isGetRowHeightFunction = function () {
|
20793 | return typeof this.gridOptions.getRowHeight === 'function';
|
20794 | };
|
20795 | GridOptionsWrapper.prototype.getRowHeightForNode = function (rowNode, allowEstimate, defaultRowHeight) {
|
20796 | if (allowEstimate === void 0) { allowEstimate = false; }
|
20797 | if (defaultRowHeight == null) {
|
20798 | defaultRowHeight = this.getDefaultRowHeight();
|
20799 | }
|
20800 |
|
20801 |
|
20802 |
|
20803 | if (this.isGetRowHeightFunction()) {
|
20804 | if (allowEstimate) {
|
20805 | return { height: defaultRowHeight, estimated: true };
|
20806 | }
|
20807 | var params = {
|
20808 | node: rowNode,
|
20809 | data: rowNode.data
|
20810 | };
|
20811 | var height = this.mergeGridCommonParams(this.gridOptions.getRowHeight)(params);
|
20812 | if (this.isNumeric(height)) {
|
20813 | if (height === 0) {
|
20814 | 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');
|
20815 | }
|
20816 | return { height: Math.max(1, height), estimated: false };
|
20817 | }
|
20818 | }
|
20819 | if (rowNode.detail && this.isMasterDetail()) {
|
20820 |
|
20821 |
|
20822 |
|
20823 | if (this.isDetailRowAutoHeight()) {
|
20824 | return { height: 1, estimated: false };
|
20825 | }
|
20826 | if (this.isNumeric(this.gridOptions.detailRowHeight)) {
|
20827 | return { height: this.gridOptions.detailRowHeight, estimated: false };
|
20828 | }
|
20829 | return { height: DEFAULT_DETAIL_ROW_HEIGHT, estimated: false };
|
20830 | }
|
20831 | var rowHeight = this.gridOptions.rowHeight && this.isNumeric(this.gridOptions.rowHeight) ? this.gridOptions.rowHeight : defaultRowHeight;
|
20832 | return { height: rowHeight, estimated: false };
|
20833 | };
|
20834 | GridOptionsWrapper.prototype.isDynamicRowHeight = function () {
|
20835 | return typeof this.gridOptions.getRowHeight === 'function';
|
20836 | };
|
20837 | GridOptionsWrapper.prototype.getListItemHeight = function () {
|
20838 | return this.getFromTheme(20, 'listItemHeight');
|
20839 | };
|
20840 | GridOptionsWrapper.prototype.chartMenuPanelWidth = function () {
|
20841 | return this.environment.chartMenuPanelWidth();
|
20842 | };
|
20843 | GridOptionsWrapper.prototype.isNumeric = function (value) {
|
20844 | return !isNaN(value) && typeof value === 'number' && isFinite(value);
|
20845 | };
|
20846 | GridOptionsWrapper.prototype.getFromTheme = function (defaultValue, sassVariableName) {
|
20847 | var theme = this.environment.getTheme().theme;
|
20848 | if (theme && theme.indexOf('ag-theme') === 0) {
|
20849 | return this.environment.getSassVariable(theme, sassVariableName);
|
20850 | }
|
20851 | return defaultValue;
|
20852 | };
|
20853 | GridOptionsWrapper.prototype.getDefaultRowHeight = function () {
|
20854 | return this.getFromTheme(DEFAULT_ROW_HEIGHT, 'rowHeight');
|
20855 | };
|
20856 | GridOptionsWrapper.prototype.matchesGroupDisplayType = function (toMatch, supplied) {
|
20857 | var groupDisplayTypeValues = ['groupRows', 'multipleColumns', 'custom', 'singleColumn'];
|
20858 | if (groupDisplayTypeValues.indexOf(supplied) < 0) {
|
20859 | console.warn("AG Grid: '" + supplied + "' is not a valid groupDisplayType value - possible values are: '" + groupDisplayTypeValues.join("', '") + "'");
|
20860 | return false;
|
20861 | }
|
20862 | return supplied === toMatch;
|
20863 | };
|
20864 | GridOptionsWrapper.prototype.matchesTreeDataDisplayType = function (toMatch, supplied) {
|
20865 | var treeDataDisplayTypeValues = ['auto', 'custom'];
|
20866 | if (treeDataDisplayTypeValues.indexOf(supplied) < 0) {
|
20867 | console.warn("AG Grid: '" + supplied + "' is not a valid treeDataDisplayType value - possible values are: '" + treeDataDisplayTypeValues.join("', '") + "'");
|
20868 | return false;
|
20869 | }
|
20870 | return supplied === toMatch;
|
20871 | };
|
20872 | var GridOptionsWrapper_1;
|
20873 | GridOptionsWrapper.MIN_COL_WIDTH = 10;
|
20874 | GridOptionsWrapper.PROP_HEADER_HEIGHT = 'headerHeight';
|
20875 | GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN = 'groupRemoveSingleChildren';
|
20876 | GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN = 'groupRemoveLowestSingleChildren';
|
20877 | GridOptionsWrapper.PROP_PIVOT_HEADER_HEIGHT = 'pivotHeaderHeight';
|
20878 | GridOptionsWrapper.PROP_SUPPRESS_CLIPBOARD_PASTE = 'suppressClipboardPaste';
|
20879 | GridOptionsWrapper.PROP_GROUP_HEADER_HEIGHT = 'groupHeaderHeight';
|
20880 | GridOptionsWrapper.PROP_PIVOT_GROUP_HEADER_HEIGHT = 'pivotGroupHeaderHeight';
|
20881 | GridOptionsWrapper.PROP_NAVIGATE_TO_NEXT_CELL = 'navigateToNextCell';
|
20882 | GridOptionsWrapper.PROP_TAB_TO_NEXT_CELL = 'tabToNextCell';
|
20883 | GridOptionsWrapper.PROP_NAVIGATE_TO_NEXT_HEADER = 'navigateToNextHeader';
|
20884 | GridOptionsWrapper.PROP_TAB_TO_NEXT_HEADER = 'tabToNextHeader';
|
20885 | GridOptionsWrapper.PROP_IS_EXTERNAL_FILTER_PRESENT = 'isExternalFilterPresent';
|
20886 | GridOptionsWrapper.PROP_DOES_EXTERNAL_FILTER_PASS = 'doesExternalFilterPass';
|
20887 | GridOptionsWrapper.PROP_FLOATING_FILTERS_HEIGHT = 'floatingFiltersHeight';
|
20888 | GridOptionsWrapper.PROP_SUPPRESS_ROW_CLICK_SELECTION = 'suppressRowClickSelection';
|
20889 | GridOptionsWrapper.PROP_SUPPRESS_ROW_DRAG = 'suppressRowDrag';
|
20890 | GridOptionsWrapper.PROP_SUPPRESS_MOVE_WHEN_ROW_DRAG = 'suppressMoveWhenRowDragging';
|
20891 | GridOptionsWrapper.PROP_GET_ROW_CLASS = 'getRowClass';
|
20892 | GridOptionsWrapper.PROP_GET_ROW_STYLE = 'getRowStyle';
|
20893 | GridOptionsWrapper.PROP_GET_ROW_HEIGHT = 'getRowHeight';
|
20894 | GridOptionsWrapper.PROP_POPUP_PARENT = 'popupParent';
|
20895 | GridOptionsWrapper.PROP_DOM_LAYOUT = 'domLayout';
|
20896 | GridOptionsWrapper.PROP_ROW_CLASS = 'rowClass';
|
20897 | GridOptionsWrapper.PROP_FILL_HANDLE_DIRECTION = 'fillHandleDirection';
|
20898 | GridOptionsWrapper.PROP_GROUP_ROW_AGG_NODES = 'groupRowAggNodes';
|
20899 | GridOptionsWrapper.PROP_GET_GROUP_ROW_AGG = 'getGroupRowAgg';
|
20900 | GridOptionsWrapper.PROP_GET_BUSINESS_KEY_FOR_NODE = 'getBusinessKeyForNode';
|
20901 | GridOptionsWrapper.PROP_GET_CHILD_COUNT = 'getChildCount';
|
20902 | GridOptionsWrapper.PROP_PROCESS_ROW_POST_CREATE = 'processRowPostCreate';
|
20903 | GridOptionsWrapper.PROP_GET_ROW_NODE_ID = 'getRowNodeId';
|
20904 | GridOptionsWrapper.PROP_GET_ROW_ID = 'getRowId';
|
20905 | GridOptionsWrapper.PROP_IS_FULL_WIDTH_CELL = 'isFullWidthCell';
|
20906 | GridOptionsWrapper.PROP_IS_FULL_WIDTH_ROW = 'isFullWidthRow';
|
20907 | GridOptionsWrapper.PROP_IS_ROW_SELECTABLE = 'isRowSelectable';
|
20908 | GridOptionsWrapper.PROP_IS_ROW_MASTER = 'isRowMaster';
|
20909 | GridOptionsWrapper.PROP_POST_SORT = 'postSort';
|
20910 | GridOptionsWrapper.PROP_POST_SORT_ROWS = 'postSortRows';
|
20911 | GridOptionsWrapper.PROP_GET_DOCUMENT = 'getDocument';
|
20912 | GridOptionsWrapper.PROP_POST_PROCESS_POPUP = 'postProcessPopup';
|
20913 | GridOptionsWrapper.PROP_DEFAULT_GROUP_ORDER_COMPARATOR = 'defaultGroupOrderComparator';
|
20914 | GridOptionsWrapper.PROP_INITIAL_GROUP_ORDER_COMPARATOR = 'initialGroupOrderComparator';
|
20915 | GridOptionsWrapper.PROP_PAGINATION_NUMBER_FORMATTER = 'paginationNumberFormatter';
|
20916 | GridOptionsWrapper.PROP_GET_CONTEXT_MENU_ITEMS = 'getContextMenuItems';
|
20917 | GridOptionsWrapper.PROP_GET_MAIN_MENU_ITEMS = 'getMainMenuItems';
|
20918 | GridOptionsWrapper.PROP_PROCESS_CELL_FOR_CLIPBOARD = 'processCellForClipboard';
|
20919 | GridOptionsWrapper.PROP_PROCESS_CELL_FROM_CLIPBOARD = 'processCellFromClipboard';
|
20920 | GridOptionsWrapper.PROP_SEND_TO_CLIPBOARD = 'sendToClipboard';
|
20921 | GridOptionsWrapper.PROP_PROCESS_TO_SECONDARY_COLDEF = 'processSecondaryColDef';
|
20922 | GridOptionsWrapper.PROP_PROCESS_SECONDARY_COL_GROUP_DEF = 'processSecondaryColGroupDef';
|
20923 | GridOptionsWrapper.PROP_GET_CHART_TOOLBAR_ITEMS = 'getChartToolbarItems';
|
20924 | GridOptionsWrapper.PROP_GET_SERVER_SIDE_STORE_PARAMS = 'getServerSideStoreParams';
|
20925 | GridOptionsWrapper.PROP_IS_SERVER_SIDE_GROUPS_OPEN_BY_DEFAULT = 'isServerSideGroupOpenByDefault';
|
20926 | GridOptionsWrapper.PROP_IS_APPLY_SERVER_SIDE_TRANSACTION = 'isApplyServerSideTransaction';
|
20927 | GridOptionsWrapper.PROP_IS_SERVER_SIDE_GROUP = 'isServerSideGroup';
|
20928 | GridOptionsWrapper.PROP_GET_SERVER_SIDE_GROUP_KEY = 'getServerSideGroupKey';
|
20929 | __decorate$I([
|
20930 | Autowired('gridOptions')
|
20931 | ], GridOptionsWrapper.prototype, "gridOptions", void 0);
|
20932 | __decorate$I([
|
20933 | Autowired('eventService')
|
20934 | ], GridOptionsWrapper.prototype, "eventService", void 0);
|
20935 | __decorate$I([
|
20936 | Autowired('environment')
|
20937 | ], GridOptionsWrapper.prototype, "environment", void 0);
|
20938 | __decorate$I([
|
20939 | Autowired('eGridDiv')
|
20940 | ], GridOptionsWrapper.prototype, "eGridDiv", void 0);
|
20941 | __decorate$I([
|
20942 | __param$3(0, Qualifier('gridApi')), __param$3(1, Qualifier('columnApi'))
|
20943 | ], GridOptionsWrapper.prototype, "agWire", null);
|
20944 | __decorate$I([
|
20945 | PreDestroy
|
20946 | ], GridOptionsWrapper.prototype, "destroy", null);
|
20947 | __decorate$I([
|
20948 | PostConstruct
|
20949 | ], GridOptionsWrapper.prototype, "init", null);
|
20950 | GridOptionsWrapper = GridOptionsWrapper_1 = __decorate$I([
|
20951 | Bean('gridOptionsWrapper')
|
20952 | ], GridOptionsWrapper);
|
20953 | return GridOptionsWrapper;
|
20954 | }());
|
20955 |
|
20956 |
|
20957 |
|
20958 |
|
20959 |
|
20960 |
|
20961 |
|
20962 | var __extends$Q = (undefined && undefined.__extends) || (function () {
|
20963 | var extendStatics = function (d, b) {
|
20964 | extendStatics = Object.setPrototypeOf ||
|
20965 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
20966 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
20967 | return extendStatics(d, b);
|
20968 | };
|
20969 | return function (d, b) {
|
20970 | extendStatics(d, b);
|
20971 | function __() { this.constructor = d; }
|
20972 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
20973 | };
|
20974 | })();
|
20975 | var __decorate$J = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
20976 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
20977 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
20978 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
20979 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
20980 | };
|
20981 | var LayoutCssClasses;
|
20982 | (function (LayoutCssClasses) {
|
20983 | LayoutCssClasses["AUTO_HEIGHT"] = "ag-layout-auto-height";
|
20984 | LayoutCssClasses["NORMAL"] = "ag-layout-normal";
|
20985 | LayoutCssClasses["PRINT"] = "ag-layout-print";
|
20986 | })(LayoutCssClasses || (LayoutCssClasses = {}));
|
20987 | var LayoutFeature = (function (_super) {
|
20988 | __extends$Q(LayoutFeature, _super);
|
20989 | function LayoutFeature(view) {
|
20990 | var _this = _super.call(this) || this;
|
20991 | _this.view = view;
|
20992 | return _this;
|
20993 | }
|
20994 | LayoutFeature.prototype.postConstruct = function () {
|
20995 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, this.updateLayoutClasses.bind(this));
|
20996 | this.updateLayoutClasses();
|
20997 | };
|
20998 | LayoutFeature.prototype.updateLayoutClasses = function () {
|
20999 | var domLayout = this.gridOptionsWrapper.getDomLayout();
|
21000 | var params = {
|
21001 | autoHeight: domLayout === Constants.DOM_LAYOUT_AUTO_HEIGHT,
|
21002 | normal: domLayout === Constants.DOM_LAYOUT_NORMAL,
|
21003 | print: domLayout === Constants.DOM_LAYOUT_PRINT
|
21004 | };
|
21005 | var cssClass = params.autoHeight ? LayoutCssClasses.AUTO_HEIGHT :
|
21006 | params.print ? LayoutCssClasses.PRINT : LayoutCssClasses.NORMAL;
|
21007 | this.view.updateLayoutClasses(cssClass, params);
|
21008 | };
|
21009 | __decorate$J([
|
21010 | Autowired('gridOptionsWrapper')
|
21011 | ], LayoutFeature.prototype, "gridOptionsWrapper", void 0);
|
21012 | __decorate$J([
|
21013 | PostConstruct
|
21014 | ], LayoutFeature.prototype, "postConstruct", null);
|
21015 | return LayoutFeature;
|
21016 | }(BeanStub));
|
21017 |
|
21018 |
|
21019 |
|
21020 |
|
21021 |
|
21022 |
|
21023 |
|
21024 | var __extends$R = (undefined && undefined.__extends) || (function () {
|
21025 | var extendStatics = function (d, b) {
|
21026 | extendStatics = Object.setPrototypeOf ||
|
21027 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
21028 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
21029 | return extendStatics(d, b);
|
21030 | };
|
21031 | return function (d, b) {
|
21032 | extendStatics(d, b);
|
21033 | function __() { this.constructor = d; }
|
21034 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
21035 | };
|
21036 | })();
|
21037 | var __decorate$K = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
21038 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
21039 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
21040 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
21041 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
21042 | };
|
21043 | var GridBodyScrollFeature = (function (_super) {
|
21044 | __extends$R(GridBodyScrollFeature, _super);
|
21045 | function GridBodyScrollFeature(eBodyViewport) {
|
21046 | var _this = _super.call(this) || this;
|
21047 | _this.scrollLeft = -1;
|
21048 | _this.nextScrollTop = -1;
|
21049 | _this.scrollTop = -1;
|
21050 | _this.eBodyViewport = eBodyViewport;
|
21051 | _this.resetLastHorizontalScrollElementDebounced = debounce(_this.resetLastHorizontalScrollElement.bind(_this), 500);
|
21052 | return _this;
|
21053 | }
|
21054 | GridBodyScrollFeature.prototype.postConstruct = function () {
|
21055 | var _this = this;
|
21056 | this.enableRtl = this.gridOptionsWrapper.isEnableRtl();
|
21057 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onDisplayedColumnsWidthChanged.bind(this));
|
21058 | this.ctrlsService.whenReady(function (p) {
|
21059 | _this.centerRowContainerCtrl = p.centerRowContainerCtrl;
|
21060 | _this.onDisplayedColumnsWidthChanged();
|
21061 | _this.addScrollListener();
|
21062 | });
|
21063 | };
|
21064 | GridBodyScrollFeature.prototype.addScrollListener = function () {
|
21065 | var fakeHScroll = this.ctrlsService.getFakeHScrollCtrl();
|
21066 | this.addManagedListener(this.centerRowContainerCtrl.getViewportElement(), 'scroll', this.onCenterViewportScroll.bind(this));
|
21067 | this.addManagedListener(fakeHScroll.getViewport(), 'scroll', this.onFakeHorizontalScroll.bind(this));
|
21068 | var onVerticalScroll = this.gridOptionsWrapper.isDebounceVerticalScrollbar() ?
|
21069 | debounce(this.onVerticalScroll.bind(this), 100)
|
21070 | : this.onVerticalScroll.bind(this);
|
21071 | this.addManagedListener(this.eBodyViewport, 'scroll', onVerticalScroll);
|
21072 | };
|
21073 | GridBodyScrollFeature.prototype.onDisplayedColumnsWidthChanged = function () {
|
21074 | if (this.enableRtl) {
|
21075 |
|
21076 |
|
21077 |
|
21078 |
|
21079 |
|
21080 | this.horizontallyScrollHeaderCenterAndFloatingCenter();
|
21081 | }
|
21082 | };
|
21083 | GridBodyScrollFeature.prototype.horizontallyScrollHeaderCenterAndFloatingCenter = function (scrollLeft) {
|
21084 |
|
21085 | var notYetInitialised = this.centerRowContainerCtrl == null;
|
21086 | if (notYetInitialised) {
|
21087 | return;
|
21088 | }
|
21089 | if (scrollLeft === undefined) {
|
21090 | scrollLeft = this.centerRowContainerCtrl.getCenterViewportScrollLeft();
|
21091 | }
|
21092 | var offset = this.enableRtl ? scrollLeft : -scrollLeft;
|
21093 | var topCenterContainer = this.ctrlsService.getTopCenterRowContainerCtrl();
|
21094 | var bottomCenterContainer = this.ctrlsService.getBottomCenterRowContainerCtrl();
|
21095 | var fakeHScroll = this.ctrlsService.getFakeHScrollCtrl();
|
21096 | var centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();
|
21097 | centerHeaderContainer.setHorizontalScroll(offset);
|
21098 | bottomCenterContainer.setContainerTranslateX(offset);
|
21099 | topCenterContainer.setContainerTranslateX(offset);
|
21100 | var partner = this.lastHorizontalScrollElement === this.centerRowContainerCtrl.getViewportElement() ?
|
21101 | fakeHScroll.getViewport() : this.centerRowContainerCtrl.getViewportElement();
|
21102 | setScrollLeft(partner, Math.abs(scrollLeft), this.enableRtl);
|
21103 | };
|
21104 | GridBodyScrollFeature.prototype.isControllingScroll = function (eDiv) {
|
21105 | if (!this.lastHorizontalScrollElement) {
|
21106 | this.lastHorizontalScrollElement = eDiv;
|
21107 | return true;
|
21108 | }
|
21109 | return eDiv === this.lastHorizontalScrollElement;
|
21110 | };
|
21111 | GridBodyScrollFeature.prototype.onFakeHorizontalScroll = function () {
|
21112 | var fakeHScrollViewport = this.ctrlsService.getFakeHScrollCtrl().getViewport();
|
21113 | if (!this.isControllingScroll(fakeHScrollViewport)) {
|
21114 | return;
|
21115 | }
|
21116 | this.onBodyHorizontalScroll(fakeHScrollViewport);
|
21117 | };
|
21118 | GridBodyScrollFeature.prototype.onCenterViewportScroll = function () {
|
21119 | var centerContainerViewport = this.centerRowContainerCtrl.getViewportElement();
|
21120 | if (!this.isControllingScroll(centerContainerViewport)) {
|
21121 | return;
|
21122 | }
|
21123 | this.onBodyHorizontalScroll(centerContainerViewport);
|
21124 | };
|
21125 | GridBodyScrollFeature.prototype.onBodyHorizontalScroll = function (eSource) {
|
21126 | var centerContainerViewport = this.centerRowContainerCtrl.getViewportElement();
|
21127 | var scrollLeft = centerContainerViewport.scrollLeft;
|
21128 | if (this.shouldBlockScrollUpdate('horizontal', scrollLeft, true)) {
|
21129 | return;
|
21130 | }
|
21131 |
|
21132 |
|
21133 |
|
21134 |
|
21135 |
|
21136 |
|
21137 | this.doHorizontalScroll(Math.round(getScrollLeft(eSource, this.enableRtl)));
|
21138 | this.resetLastHorizontalScrollElementDebounced();
|
21139 | };
|
21140 | GridBodyScrollFeature.prototype.onVerticalScroll = function () {
|
21141 | var scrollTop = this.eBodyViewport.scrollTop;
|
21142 | if (this.shouldBlockScrollUpdate('vertical', scrollTop, true)) {
|
21143 | return;
|
21144 | }
|
21145 | this.animationFrameService.setScrollTop(scrollTop);
|
21146 | this.nextScrollTop = scrollTop;
|
21147 | if (this.gridOptionsWrapper.isSuppressAnimationFrame()) {
|
21148 | this.scrollTop = this.nextScrollTop;
|
21149 | this.redrawRowsAfterScroll();
|
21150 | }
|
21151 | else {
|
21152 | this.animationFrameService.schedule();
|
21153 | }
|
21154 | };
|
21155 | GridBodyScrollFeature.prototype.resetLastHorizontalScrollElement = function () {
|
21156 | this.lastHorizontalScrollElement = null;
|
21157 | };
|
21158 | GridBodyScrollFeature.prototype.doHorizontalScroll = function (scrollLeft) {
|
21159 | var fakeHScrollViewport = this.ctrlsService.getFakeHScrollCtrl().getViewport();
|
21160 | var fakeScrollLeft = getScrollLeft(fakeHScrollViewport, this.enableRtl);
|
21161 | if (this.scrollLeft === scrollLeft && scrollLeft === fakeScrollLeft) {
|
21162 | return;
|
21163 | }
|
21164 | this.scrollLeft = scrollLeft;
|
21165 | this.fireScrollEvent('horizontal');
|
21166 | this.horizontallyScrollHeaderCenterAndFloatingCenter(scrollLeft);
|
21167 | this.onHorizontalViewportChanged();
|
21168 | };
|
21169 | GridBodyScrollFeature.prototype.fireScrollEvent = function (direction) {
|
21170 | var _this = this;
|
21171 | var bodyScrollEvent = {
|
21172 | type: Events.EVENT_BODY_SCROLL,
|
21173 | api: this.gridApi,
|
21174 | columnApi: this.columnApi,
|
21175 | direction: direction,
|
21176 | left: this.scrollLeft,
|
21177 | top: this.scrollTop
|
21178 | };
|
21179 | this.eventService.dispatchEvent(bodyScrollEvent);
|
21180 | window.clearTimeout(this.scrollTimer);
|
21181 | this.scrollTimer = undefined;
|
21182 | this.scrollTimer = window.setTimeout(function () {
|
21183 | var bodyScrollEndEvent = Object.assign({}, bodyScrollEvent, {
|
21184 | type: Events.EVENT_BODY_SCROLL_END
|
21185 | });
|
21186 | _this.eventService.dispatchEvent(bodyScrollEndEvent);
|
21187 | }, 100);
|
21188 | };
|
21189 | GridBodyScrollFeature.prototype.shouldBlockScrollUpdate = function (direction, scrollTo, touchOnly) {
|
21190 |
|
21191 |
|
21192 |
|
21193 |
|
21194 | if (touchOnly === void 0) { touchOnly = false; }
|
21195 |
|
21196 |
|
21197 |
|
21198 |
|
21199 |
|
21200 | if (touchOnly && !isIOSUserAgent()) {
|
21201 | return false;
|
21202 | }
|
21203 | if (direction === 'vertical') {
|
21204 | var clientHeight = getInnerHeight(this.eBodyViewport);
|
21205 | var scrollHeight = this.eBodyViewport.scrollHeight;
|
21206 | if (scrollTo < 0 || (scrollTo + clientHeight > scrollHeight)) {
|
21207 | return true;
|
21208 | }
|
21209 | }
|
21210 | if (direction === 'horizontal') {
|
21211 | var clientWidth = this.centerRowContainerCtrl.getCenterWidth();
|
21212 | var scrollWidth = this.centerRowContainerCtrl.getViewportElement().scrollWidth;
|
21213 | if (this.enableRtl && isRtlNegativeScroll()) {
|
21214 | if (scrollTo > 0) {
|
21215 | return true;
|
21216 | }
|
21217 | }
|
21218 | else if (scrollTo < 0) {
|
21219 | return true;
|
21220 | }
|
21221 | if (Math.abs(scrollTo) + clientWidth > scrollWidth) {
|
21222 | return true;
|
21223 | }
|
21224 | }
|
21225 | return false;
|
21226 | };
|
21227 | GridBodyScrollFeature.prototype.redrawRowsAfterScroll = function () {
|
21228 | this.fireScrollEvent('vertical');
|
21229 | };
|
21230 | GridBodyScrollFeature.prototype.onHorizontalViewportChanged = function () {
|
21231 | this.centerRowContainerCtrl.onHorizontalViewportChanged();
|
21232 | };
|
21233 |
|
21234 |
|
21235 |
|
21236 |
|
21237 |
|
21238 |
|
21239 | GridBodyScrollFeature.prototype.checkScrollLeft = function () {
|
21240 | if (this.scrollLeft !== this.centerRowContainerCtrl.getCenterViewportScrollLeft()) {
|
21241 | this.onBodyHorizontalScroll(this.centerRowContainerCtrl.getViewportElement());
|
21242 | }
|
21243 | };
|
21244 | GridBodyScrollFeature.prototype.executeAnimationFrameScroll = function () {
|
21245 | var frameNeeded = this.scrollTop != this.nextScrollTop;
|
21246 | if (frameNeeded) {
|
21247 | this.scrollTop = this.nextScrollTop;
|
21248 | this.redrawRowsAfterScroll();
|
21249 | }
|
21250 | return frameNeeded;
|
21251 | };
|
21252 |
|
21253 | GridBodyScrollFeature.prototype.setHorizontalScrollPosition = function (hScrollPosition) {
|
21254 | var minScrollLeft = 0;
|
21255 | var maxScrollLeft = this.centerRowContainerCtrl.getViewportElement().scrollWidth - this.centerRowContainerCtrl.getCenterWidth();
|
21256 | if (this.shouldBlockScrollUpdate('horizontal', hScrollPosition)) {
|
21257 | if (this.enableRtl && isRtlNegativeScroll()) {
|
21258 | hScrollPosition = hScrollPosition > 0 ? 0 : maxScrollLeft;
|
21259 | }
|
21260 | else {
|
21261 | hScrollPosition = Math.min(Math.max(hScrollPosition, minScrollLeft), maxScrollLeft);
|
21262 | }
|
21263 | }
|
21264 | setScrollLeft(this.centerRowContainerCtrl.getViewportElement(), Math.abs(hScrollPosition), this.enableRtl);
|
21265 |
|
21266 |
|
21267 |
|
21268 |
|
21269 | this.doHorizontalScroll(hScrollPosition);
|
21270 | };
|
21271 | GridBodyScrollFeature.prototype.setVerticalScrollPosition = function (vScrollPosition) {
|
21272 | this.eBodyViewport.scrollTop = vScrollPosition;
|
21273 | };
|
21274 | GridBodyScrollFeature.prototype.getVScrollPosition = function () {
|
21275 | var result = {
|
21276 | top: this.eBodyViewport.scrollTop,
|
21277 | bottom: this.eBodyViewport.scrollTop + this.eBodyViewport.offsetHeight
|
21278 | };
|
21279 | return result;
|
21280 | };
|
21281 | GridBodyScrollFeature.prototype.getHScrollPosition = function () {
|
21282 | return this.centerRowContainerCtrl.getHScrollPosition();
|
21283 | };
|
21284 | GridBodyScrollFeature.prototype.isHorizontalScrollShowing = function () {
|
21285 | return this.centerRowContainerCtrl.isHorizontalScrollShowing();
|
21286 | };
|
21287 |
|
21288 | GridBodyScrollFeature.prototype.scrollHorizontally = function (pixels) {
|
21289 | var oldScrollPosition = this.centerRowContainerCtrl.getViewportElement().scrollLeft;
|
21290 | this.setHorizontalScrollPosition(oldScrollPosition + pixels);
|
21291 | return this.centerRowContainerCtrl.getViewportElement().scrollLeft - oldScrollPosition;
|
21292 | };
|
21293 |
|
21294 | GridBodyScrollFeature.prototype.scrollToTop = function () {
|
21295 | this.eBodyViewport.scrollTop = 0;
|
21296 | };
|
21297 |
|
21298 | GridBodyScrollFeature.prototype.ensureNodeVisible = function (comparator, position) {
|
21299 | if (position === void 0) { position = null; }
|
21300 |
|
21301 | var rowCount = this.rowModel.getRowCount();
|
21302 | var comparatorIsAFunction = typeof comparator === 'function';
|
21303 | var indexToSelect = -1;
|
21304 |
|
21305 | for (var i = 0; i < rowCount; i++) {
|
21306 | var node = this.rowModel.getRow(i);
|
21307 | if (comparatorIsAFunction) {
|
21308 | if (comparator(node)) {
|
21309 | indexToSelect = i;
|
21310 | break;
|
21311 | }
|
21312 | }
|
21313 | else {
|
21314 |
|
21315 | if (comparator === node || comparator === node.data) {
|
21316 | indexToSelect = i;
|
21317 | break;
|
21318 | }
|
21319 | }
|
21320 | }
|
21321 | if (indexToSelect >= 0) {
|
21322 | this.ensureIndexVisible(indexToSelect, position);
|
21323 | }
|
21324 | };
|
21325 |
|
21326 |
|
21327 |
|
21328 |
|
21329 |
|
21330 |
|
21331 | GridBodyScrollFeature.prototype.ensureIndexVisible = function (index, position) {
|
21332 |
|
21333 | if (this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT) {
|
21334 | return;
|
21335 | }
|
21336 | var rowCount = this.paginationProxy.getRowCount();
|
21337 | if (typeof index !== 'number' || index < 0 || index >= rowCount) {
|
21338 | console.warn('invalid row index for ensureIndexVisible: ' + index);
|
21339 | return;
|
21340 | }
|
21341 | var isPaging = this.gridOptionsWrapper.isPagination();
|
21342 | var paginationPanelEnabled = isPaging && !this.gridOptionsWrapper.isSuppressPaginationPanel();
|
21343 | if (!paginationPanelEnabled) {
|
21344 | this.paginationProxy.goToPageWithIndex(index);
|
21345 | }
|
21346 | var rowNode = this.paginationProxy.getRow(index);
|
21347 | var rowGotShiftedDuringOperation;
|
21348 | do {
|
21349 | var startingRowTop = rowNode.rowTop;
|
21350 | var startingRowHeight = rowNode.rowHeight;
|
21351 | var paginationOffset = this.paginationProxy.getPixelOffset();
|
21352 | var rowTopPixel = rowNode.rowTop - paginationOffset;
|
21353 | var rowBottomPixel = rowTopPixel + rowNode.rowHeight;
|
21354 | var scrollPosition = this.getVScrollPosition();
|
21355 | var heightOffset = this.heightScaler.getDivStretchOffset();
|
21356 | var vScrollTop = scrollPosition.top + heightOffset;
|
21357 | var vScrollBottom = scrollPosition.bottom + heightOffset;
|
21358 | var viewportHeight = vScrollBottom - vScrollTop;
|
21359 |
|
21360 |
|
21361 | var pxTop = this.heightScaler.getScrollPositionForPixel(rowTopPixel);
|
21362 | var pxBottom = this.heightScaler.getScrollPositionForPixel(rowBottomPixel - viewportHeight);
|
21363 |
|
21364 | var pxMiddle = Math.min((pxTop + pxBottom) / 2, rowTopPixel);
|
21365 | var rowBelowViewport = vScrollTop > rowTopPixel;
|
21366 | var rowAboveViewport = vScrollBottom < rowBottomPixel;
|
21367 | var newScrollPosition = null;
|
21368 | if (position === 'top') {
|
21369 | newScrollPosition = pxTop;
|
21370 | }
|
21371 | else if (position === 'bottom') {
|
21372 | newScrollPosition = pxBottom;
|
21373 | }
|
21374 | else if (position === 'middle') {
|
21375 | newScrollPosition = pxMiddle;
|
21376 | }
|
21377 | else if (rowBelowViewport) {
|
21378 |
|
21379 | newScrollPosition = pxTop;
|
21380 | }
|
21381 | else if (rowAboveViewport) {
|
21382 |
|
21383 | newScrollPosition = pxBottom;
|
21384 | }
|
21385 | if (newScrollPosition !== null) {
|
21386 | this.eBodyViewport.scrollTop = newScrollPosition;
|
21387 | this.rowRenderer.redrawAfterScroll();
|
21388 | }
|
21389 |
|
21390 |
|
21391 |
|
21392 |
|
21393 | rowGotShiftedDuringOperation = (startingRowTop !== rowNode.rowTop)
|
21394 | || (startingRowHeight !== rowNode.rowHeight);
|
21395 | } while (rowGotShiftedDuringOperation);
|
21396 |
|
21397 | this.animationFrameService.flushAllFrames();
|
21398 | };
|
21399 | GridBodyScrollFeature.prototype.ensureColumnVisible = function (key, position) {
|
21400 | if (position === void 0) { position = 'auto'; }
|
21401 | var column = this.columnModel.getGridColumn(key);
|
21402 | if (!column) {
|
21403 | return;
|
21404 | }
|
21405 |
|
21406 | if (column.isPinned()) {
|
21407 | return;
|
21408 | }
|
21409 |
|
21410 | if (!this.columnModel.isColumnDisplayed(column)) {
|
21411 | return;
|
21412 | }
|
21413 | var newHorizontalScroll = this.getPositionedHorizontalScroll(column, position);
|
21414 | if (newHorizontalScroll !== null) {
|
21415 | this.centerRowContainerCtrl.setCenterViewportScrollLeft(newHorizontalScroll);
|
21416 | }
|
21417 |
|
21418 |
|
21419 |
|
21420 |
|
21421 | this.centerRowContainerCtrl.onHorizontalViewportChanged();
|
21422 |
|
21423 | this.animationFrameService.flushAllFrames();
|
21424 | };
|
21425 | GridBodyScrollFeature.prototype.getPositionedHorizontalScroll = function (column, position) {
|
21426 | var _a = this.isColumnOutsideViewport(column), columnBeforeStart = _a.columnBeforeStart, columnAfterEnd = _a.columnAfterEnd;
|
21427 | var viewportTooSmallForColumn = this.centerRowContainerCtrl.getCenterWidth() < column.getActualWidth();
|
21428 | var viewportWidth = this.centerRowContainerCtrl.getCenterWidth();
|
21429 | var isRtl = this.enableRtl;
|
21430 | var alignColToStart = (isRtl ? columnBeforeStart : columnAfterEnd) || viewportTooSmallForColumn;
|
21431 | var alignColToEnd = isRtl ? columnAfterEnd : columnBeforeStart;
|
21432 | if (position !== 'auto') {
|
21433 | alignColToStart = position === 'start';
|
21434 | alignColToEnd = position === 'end';
|
21435 | }
|
21436 | var isMiddle = position === 'middle';
|
21437 | if (alignColToStart || alignColToEnd || isMiddle) {
|
21438 | var _b = this.getColumnBounds(column), colLeft = _b.colLeft, colMiddle = _b.colMiddle, colRight = _b.colRight;
|
21439 | if (isMiddle) {
|
21440 | return colMiddle - viewportWidth / 2;
|
21441 | }
|
21442 | if (alignColToStart) {
|
21443 | return isRtl ? colRight : colLeft;
|
21444 | }
|
21445 | return isRtl ? (colLeft - viewportWidth) : (colRight - viewportWidth);
|
21446 | }
|
21447 | return null;
|
21448 | };
|
21449 | GridBodyScrollFeature.prototype.isColumnOutsideViewport = function (column) {
|
21450 | var _a = this.getViewportBounds(), viewportStart = _a.start, viewportEnd = _a.end;
|
21451 | var _b = this.getColumnBounds(column), colLeft = _b.colLeft, colRight = _b.colRight;
|
21452 | var isRtl = this.enableRtl;
|
21453 | var columnBeforeStart = isRtl ? (viewportStart > colRight) : (viewportEnd < colRight);
|
21454 | var columnAfterEnd = isRtl ? (viewportEnd < colLeft) : (viewportStart > colLeft);
|
21455 | return { columnBeforeStart: columnBeforeStart, columnAfterEnd: columnAfterEnd };
|
21456 | };
|
21457 | GridBodyScrollFeature.prototype.getColumnBounds = function (column) {
|
21458 | var isRtl = this.enableRtl;
|
21459 | var bodyWidth = this.columnModel.getBodyContainerWidth();
|
21460 | var colWidth = column.getActualWidth();
|
21461 | var colLeft = column.getLeft();
|
21462 | var multiplier = isRtl ? -1 : 1;
|
21463 | var colLeftPixel = isRtl ? (bodyWidth - colLeft) : colLeft;
|
21464 | var colRightPixel = colLeftPixel + colWidth * multiplier;
|
21465 | var colMidPixel = colLeftPixel + colWidth / 2 * multiplier;
|
21466 | return { colLeft: colLeftPixel, colMiddle: colMidPixel, colRight: colRightPixel };
|
21467 | };
|
21468 | GridBodyScrollFeature.prototype.getViewportBounds = function () {
|
21469 | var viewportWidth = this.centerRowContainerCtrl.getCenterWidth();
|
21470 | var scrollPosition = this.centerRowContainerCtrl.getCenterViewportScrollLeft();
|
21471 | var viewportStartPixel = scrollPosition;
|
21472 | var viewportEndPixel = viewportWidth + scrollPosition;
|
21473 | return { start: viewportStartPixel, end: viewportEndPixel, width: viewportWidth };
|
21474 | };
|
21475 | __decorate$K([
|
21476 | Autowired('ctrlsService')
|
21477 | ], GridBodyScrollFeature.prototype, "ctrlsService", void 0);
|
21478 | __decorate$K([
|
21479 | Autowired('animationFrameService')
|
21480 | ], GridBodyScrollFeature.prototype, "animationFrameService", void 0);
|
21481 | __decorate$K([
|
21482 | Autowired('columnApi')
|
21483 | ], GridBodyScrollFeature.prototype, "columnApi", void 0);
|
21484 | __decorate$K([
|
21485 | Autowired('gridApi')
|
21486 | ], GridBodyScrollFeature.prototype, "gridApi", void 0);
|
21487 | __decorate$K([
|
21488 | Autowired('paginationProxy')
|
21489 | ], GridBodyScrollFeature.prototype, "paginationProxy", void 0);
|
21490 | __decorate$K([
|
21491 | Autowired('rowModel')
|
21492 | ], GridBodyScrollFeature.prototype, "rowModel", void 0);
|
21493 | __decorate$K([
|
21494 | Autowired('rowContainerHeightService')
|
21495 | ], GridBodyScrollFeature.prototype, "heightScaler", void 0);
|
21496 | __decorate$K([
|
21497 | Autowired('rowRenderer')
|
21498 | ], GridBodyScrollFeature.prototype, "rowRenderer", void 0);
|
21499 | __decorate$K([
|
21500 | Autowired('columnModel')
|
21501 | ], GridBodyScrollFeature.prototype, "columnModel", void 0);
|
21502 | __decorate$K([
|
21503 | PostConstruct
|
21504 | ], GridBodyScrollFeature.prototype, "postConstruct", null);
|
21505 | return GridBodyScrollFeature;
|
21506 | }(BeanStub));
|
21507 |
|
21508 |
|
21509 |
|
21510 |
|
21511 |
|
21512 |
|
21513 |
|
21514 | var AutoScrollService = (function () {
|
21515 | function AutoScrollService(params) {
|
21516 | this.tickingInterval = null;
|
21517 | this.onScrollCallback = null;
|
21518 | this.scrollContainer = params.scrollContainer;
|
21519 | this.scrollHorizontally = params.scrollAxis.indexOf('x') !== -1;
|
21520 | this.scrollVertically = params.scrollAxis.indexOf('y') !== -1;
|
21521 | this.scrollByTick = params.scrollByTick != null ? params.scrollByTick : 20;
|
21522 | if (params.onScrollCallback) {
|
21523 | this.onScrollCallback = params.onScrollCallback;
|
21524 | }
|
21525 | if (this.scrollVertically) {
|
21526 | this.getVerticalPosition = params.getVerticalPosition;
|
21527 | this.setVerticalPosition = params.setVerticalPosition;
|
21528 | }
|
21529 | if (this.scrollHorizontally) {
|
21530 | this.getHorizontalPosition = params.getHorizontalPosition;
|
21531 | this.setHorizontalPosition = params.setHorizontalPosition;
|
21532 | }
|
21533 | this.shouldSkipVerticalScroll = params.shouldSkipVerticalScroll || (function () { return false; });
|
21534 | this.shouldSkipHorizontalScroll = params.shouldSkipHorizontalScroll || (function () { return false; });
|
21535 | }
|
21536 | AutoScrollService.prototype.check = function (mouseEvent, forceSkipVerticalScroll) {
|
21537 | if (forceSkipVerticalScroll === void 0) { forceSkipVerticalScroll = false; }
|
21538 | var skipVerticalScroll = forceSkipVerticalScroll || this.shouldSkipVerticalScroll();
|
21539 | if (skipVerticalScroll && this.shouldSkipHorizontalScroll()) {
|
21540 | return;
|
21541 | }
|
21542 | var rect = this.scrollContainer.getBoundingClientRect();
|
21543 | var scrollTick = this.scrollByTick;
|
21544 | this.tickLeft = mouseEvent.clientX < (rect.left + scrollTick);
|
21545 | this.tickRight = mouseEvent.clientX > (rect.right - scrollTick);
|
21546 | this.tickUp = mouseEvent.clientY < (rect.top + scrollTick) && !skipVerticalScroll;
|
21547 | this.tickDown = mouseEvent.clientY > (rect.bottom - scrollTick) && !skipVerticalScroll;
|
21548 | if (this.tickLeft || this.tickRight || this.tickUp || this.tickDown) {
|
21549 | this.ensureTickingStarted();
|
21550 | }
|
21551 | else {
|
21552 | this.ensureCleared();
|
21553 | }
|
21554 | };
|
21555 | AutoScrollService.prototype.ensureTickingStarted = function () {
|
21556 | if (this.tickingInterval === null) {
|
21557 | this.tickingInterval = window.setInterval(this.doTick.bind(this), 100);
|
21558 | this.tickCount = 0;
|
21559 | }
|
21560 | };
|
21561 | AutoScrollService.prototype.doTick = function () {
|
21562 | this.tickCount++;
|
21563 | var tickAmount;
|
21564 | tickAmount = this.tickCount > 20 ? 200 : (this.tickCount > 10 ? 80 : 40);
|
21565 | if (this.scrollVertically) {
|
21566 | var vScrollPosition = this.getVerticalPosition();
|
21567 | if (this.tickUp) {
|
21568 | this.setVerticalPosition(vScrollPosition - tickAmount);
|
21569 | }
|
21570 | if (this.tickDown) {
|
21571 | this.setVerticalPosition(vScrollPosition + tickAmount);
|
21572 | }
|
21573 | }
|
21574 | if (this.scrollHorizontally) {
|
21575 | var hScrollPosition = this.getHorizontalPosition();
|
21576 | if (this.tickLeft) {
|
21577 | this.setHorizontalPosition(hScrollPosition - tickAmount);
|
21578 | }
|
21579 | if (this.tickRight) {
|
21580 | this.setHorizontalPosition(hScrollPosition + tickAmount);
|
21581 | }
|
21582 | }
|
21583 | if (this.onScrollCallback) {
|
21584 | this.onScrollCallback();
|
21585 | }
|
21586 | };
|
21587 | AutoScrollService.prototype.ensureCleared = function () {
|
21588 | if (this.tickingInterval) {
|
21589 | window.clearInterval(this.tickingInterval);
|
21590 | this.tickingInterval = null;
|
21591 | }
|
21592 | };
|
21593 | return AutoScrollService;
|
21594 | }());
|
21595 |
|
21596 |
|
21597 |
|
21598 |
|
21599 |
|
21600 |
|
21601 |
|
21602 | var __extends$S = (undefined && undefined.__extends) || (function () {
|
21603 | var extendStatics = function (d, b) {
|
21604 | extendStatics = Object.setPrototypeOf ||
|
21605 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
21606 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
21607 | return extendStatics(d, b);
|
21608 | };
|
21609 | return function (d, b) {
|
21610 | extendStatics(d, b);
|
21611 | function __() { this.constructor = d; }
|
21612 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
21613 | };
|
21614 | })();
|
21615 | var __assign$a = (undefined && undefined.__assign) || function () {
|
21616 | __assign$a = Object.assign || function(t) {
|
21617 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
21618 | s = arguments[i];
|
21619 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
21620 | t[p] = s[p];
|
21621 | }
|
21622 | return t;
|
21623 | };
|
21624 | return __assign$a.apply(this, arguments);
|
21625 | };
|
21626 | var __decorate$L = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
21627 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
21628 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
21629 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
21630 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
21631 | };
|
21632 | var __read$7 = (undefined && undefined.__read) || function (o, n) {
|
21633 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
21634 | if (!m) return o;
|
21635 | var i = m.call(o), r, ar = [], e;
|
21636 | try {
|
21637 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
21638 | }
|
21639 | catch (error) { e = { error: error }; }
|
21640 | finally {
|
21641 | try {
|
21642 | if (r && !r.done && (m = i["return"])) m.call(i);
|
21643 | }
|
21644 | finally { if (e) throw e.error; }
|
21645 | }
|
21646 | return ar;
|
21647 | };
|
21648 | var __spread$5 = (undefined && undefined.__spread) || function () {
|
21649 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$7(arguments[i]));
|
21650 | return ar;
|
21651 | };
|
21652 | var RowDragFeature = (function (_super) {
|
21653 | __extends$S(RowDragFeature, _super);
|
21654 | function RowDragFeature(eContainer) {
|
21655 | var _this = _super.call(this) || this;
|
21656 | _this.isMultiRowDrag = false;
|
21657 | _this.isGridSorted = false;
|
21658 | _this.isGridFiltered = false;
|
21659 | _this.isRowGroupActive = false;
|
21660 | _this.eContainer = eContainer;
|
21661 | return _this;
|
21662 | }
|
21663 | RowDragFeature.prototype.postConstruct = function () {
|
21664 | var _this = this;
|
21665 | if (this.gridOptionsWrapper.isRowModelDefault()) {
|
21666 | this.clientSideRowModel = this.rowModel;
|
21667 | }
|
21668 | var refreshStatus = function () {
|
21669 | _this.onSortChanged();
|
21670 | _this.onFilterChanged();
|
21671 | _this.onRowGroupChanged();
|
21672 | };
|
21673 | this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
|
21674 | this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
|
21675 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.onRowGroupChanged.bind(this));
|
21676 | this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, function () {
|
21677 | refreshStatus();
|
21678 | });
|
21679 | refreshStatus();
|
21680 | this.ctrlsService.whenReady(function () {
|
21681 | var gridBodyCon = _this.ctrlsService.getGridBodyCtrl();
|
21682 | _this.autoScrollService = new AutoScrollService({
|
21683 | scrollContainer: gridBodyCon.getBodyViewportElement(),
|
21684 | scrollAxis: 'y',
|
21685 | getVerticalPosition: function () { return gridBodyCon.getScrollFeature().getVScrollPosition().top; },
|
21686 | setVerticalPosition: function (position) { return gridBodyCon.getScrollFeature().setVerticalScrollPosition(position); },
|
21687 | onScrollCallback: function () { _this.onDragging(_this.lastDraggingEvent); }
|
21688 | });
|
21689 | });
|
21690 | };
|
21691 | RowDragFeature.prototype.onSortChanged = function () {
|
21692 | this.isGridSorted = this.sortController.isSortActive();
|
21693 | };
|
21694 | RowDragFeature.prototype.onFilterChanged = function () {
|
21695 | this.isGridFiltered = this.filterManager.isAnyFilterPresent();
|
21696 | };
|
21697 | RowDragFeature.prototype.onRowGroupChanged = function () {
|
21698 | var rowGroups = this.columnModel.getRowGroupColumns();
|
21699 | this.isRowGroupActive = !missingOrEmpty(rowGroups);
|
21700 | };
|
21701 | RowDragFeature.prototype.getContainer = function () {
|
21702 | return this.eContainer;
|
21703 | };
|
21704 | RowDragFeature.prototype.isInterestedIn = function (type) {
|
21705 | return type === DragSourceType.RowDrag;
|
21706 | };
|
21707 | RowDragFeature.prototype.getIconName = function () {
|
21708 | var managedDrag = this.gridOptionsWrapper.isRowDragManaged();
|
21709 | if (managedDrag && this.shouldPreventRowMove()) {
|
21710 | return DragAndDropService.ICON_NOT_ALLOWED;
|
21711 | }
|
21712 | return DragAndDropService.ICON_MOVE;
|
21713 | };
|
21714 | RowDragFeature.prototype.shouldPreventRowMove = function () {
|
21715 | return this.isGridSorted || this.isGridFiltered || this.isRowGroupActive;
|
21716 | };
|
21717 | RowDragFeature.prototype.getRowNodes = function (draggingEvent) {
|
21718 | var _this = this;
|
21719 | if (!this.isFromThisGrid(draggingEvent)) {
|
21720 | return draggingEvent.dragItem.rowNodes || [];
|
21721 | }
|
21722 | var isRowDragMultiRow = this.gridOptionsWrapper.isRowDragMultiRow();
|
21723 | var selectedNodes = __spread$5(this.selectionService.getSelectedNodes()).sort(function (a, b) { return _this.getRowIndexNumber(a) - _this.getRowIndexNumber(b); });
|
21724 | var currentNode = draggingEvent.dragItem.rowNode;
|
21725 | if (isRowDragMultiRow && selectedNodes.indexOf(currentNode) !== -1) {
|
21726 | this.isMultiRowDrag = true;
|
21727 | return selectedNodes;
|
21728 | }
|
21729 | this.isMultiRowDrag = false;
|
21730 | return [currentNode];
|
21731 | };
|
21732 | RowDragFeature.prototype.onDragEnter = function (draggingEvent) {
|
21733 |
|
21734 | draggingEvent.dragItem.rowNodes = this.getRowNodes(draggingEvent);
|
21735 |
|
21736 |
|
21737 | this.dispatchGridEvent(Events.EVENT_ROW_DRAG_ENTER, draggingEvent);
|
21738 | this.getRowNodes(draggingEvent).forEach(function (rowNode) {
|
21739 | rowNode.setDragging(true);
|
21740 | });
|
21741 | this.onEnterOrDragging(draggingEvent);
|
21742 | };
|
21743 | RowDragFeature.prototype.onDragging = function (draggingEvent) {
|
21744 | this.onEnterOrDragging(draggingEvent);
|
21745 | };
|
21746 | RowDragFeature.prototype.isFromThisGrid = function (draggingEvent) {
|
21747 | var dragSourceDomDataKey = draggingEvent.dragSource.dragSourceDomDataKey;
|
21748 | return dragSourceDomDataKey === this.gridOptionsWrapper.getDomDataKey();
|
21749 | };
|
21750 | RowDragFeature.prototype.isDropZoneWithinThisGrid = function (draggingEvent) {
|
21751 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
21752 | var gridGui = gridBodyCon.getGui();
|
21753 | var dropZoneTarget = draggingEvent.dropZoneTarget;
|
21754 | return !gridGui.contains(dropZoneTarget);
|
21755 | };
|
21756 | RowDragFeature.prototype.onEnterOrDragging = function (draggingEvent) {
|
21757 |
|
21758 | this.dispatchGridEvent(Events.EVENT_ROW_DRAG_MOVE, draggingEvent);
|
21759 | this.lastDraggingEvent = draggingEvent;
|
21760 | var pixel = this.mouseEventService.getNormalisedPosition(draggingEvent).y;
|
21761 | var managedDrag = this.gridOptionsWrapper.isRowDragManaged();
|
21762 | if (managedDrag) {
|
21763 | this.doManagedDrag(draggingEvent, pixel);
|
21764 | }
|
21765 | this.autoScrollService.check(draggingEvent.event);
|
21766 | };
|
21767 | RowDragFeature.prototype.doManagedDrag = function (draggingEvent, pixel) {
|
21768 | var isFromThisGrid = this.isFromThisGrid(draggingEvent);
|
21769 | var managedDrag = this.gridOptionsWrapper.isRowDragManaged();
|
21770 | var rowNodes = draggingEvent.dragItem.rowNodes;
|
21771 | if (managedDrag && this.shouldPreventRowMove()) {
|
21772 | return;
|
21773 | }
|
21774 | if (this.gridOptionsWrapper.isSuppressMoveWhenRowDragging() || !isFromThisGrid) {
|
21775 | if (!this.isDropZoneWithinThisGrid(draggingEvent)) {
|
21776 | this.clientSideRowModel.highlightRowAtPixel(rowNodes[0], pixel);
|
21777 | }
|
21778 | }
|
21779 | else {
|
21780 | this.moveRows(rowNodes, pixel);
|
21781 | }
|
21782 | };
|
21783 | RowDragFeature.prototype.getRowIndexNumber = function (rowNode) {
|
21784 | return parseInt(last(rowNode.getRowIndexString().split('-')), 10);
|
21785 | };
|
21786 | RowDragFeature.prototype.moveRowAndClearHighlight = function (draggingEvent) {
|
21787 | var _this = this;
|
21788 | var lastHighlightedRowNode = this.clientSideRowModel.getLastHighlightedRowNode();
|
21789 | var isBelow = lastHighlightedRowNode && lastHighlightedRowNode.highlighted === RowHighlightPosition.Below;
|
21790 | var pixel = this.mouseEventService.getNormalisedPosition(draggingEvent).y;
|
21791 | var rowNodes = draggingEvent.dragItem.rowNodes;
|
21792 | var increment = isBelow ? 1 : 0;
|
21793 | if (this.isFromThisGrid(draggingEvent)) {
|
21794 | rowNodes.forEach(function (rowNode) {
|
21795 | if (rowNode.rowTop < pixel) {
|
21796 | increment -= 1;
|
21797 | }
|
21798 | });
|
21799 | this.moveRows(rowNodes, pixel, increment);
|
21800 | }
|
21801 | else {
|
21802 | var getRowIdFunc_1 = this.gridOptionsWrapper.getRowIdFunc();
|
21803 | var addIndex = this.clientSideRowModel.getRowIndexAtPixel(pixel) + 1;
|
21804 | if (this.clientSideRowModel.getHighlightPosition(pixel) === RowHighlightPosition.Above) {
|
21805 | addIndex--;
|
21806 | }
|
21807 | this.clientSideRowModel.updateRowData({
|
21808 | add: rowNodes
|
21809 | .map(function (node) { return node.data; })
|
21810 | .filter(function (data) { return !_this.clientSideRowModel.getRowNode(getRowIdFunc_1 ? getRowIdFunc_1({ data: data, level: 0 }) : data.id); }),
|
21811 | addIndex: addIndex
|
21812 | });
|
21813 | }
|
21814 | this.clearRowHighlight();
|
21815 | };
|
21816 | RowDragFeature.prototype.clearRowHighlight = function () {
|
21817 | this.clientSideRowModel.highlightRowAtPixel(null);
|
21818 | };
|
21819 | RowDragFeature.prototype.moveRows = function (rowNodes, pixel, increment) {
|
21820 | if (increment === void 0) { increment = 0; }
|
21821 | var rowWasMoved = this.clientSideRowModel.ensureRowsAtPixel(rowNodes, pixel, increment);
|
21822 | if (rowWasMoved) {
|
21823 | this.focusService.clearFocusedCell();
|
21824 | if (this.rangeService) {
|
21825 | this.rangeService.removeAllCellRanges();
|
21826 | }
|
21827 | }
|
21828 | };
|
21829 | RowDragFeature.prototype.addRowDropZone = function (params) {
|
21830 | var _this = this;
|
21831 | if (!params.getContainer()) {
|
21832 | doOnce(function () { return console.warn('AG Grid: addRowDropZone - A container target needs to be provided'); }, 'add-drop-zone-empty-target');
|
21833 | return;
|
21834 | }
|
21835 | if (this.dragAndDropService.findExternalZone(params)) {
|
21836 | console.warn('AG Grid: addRowDropZone - target already exists in the list of DropZones. Use `removeRowDropZone` before adding it again.');
|
21837 | return;
|
21838 | }
|
21839 | var processedParams = {
|
21840 | getContainer: params.getContainer
|
21841 | };
|
21842 | if (params.fromGrid) {
|
21843 | params.fromGrid = undefined;
|
21844 | processedParams = params;
|
21845 | }
|
21846 | else {
|
21847 | if (params.onDragEnter) {
|
21848 | processedParams.onDragEnter = function (e) {
|
21849 | params.onDragEnter(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_ENTER, e));
|
21850 | };
|
21851 | }
|
21852 | if (params.onDragLeave) {
|
21853 | processedParams.onDragLeave = function (e) {
|
21854 | params.onDragLeave(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_LEAVE, e));
|
21855 | };
|
21856 | }
|
21857 | if (params.onDragging) {
|
21858 | processedParams.onDragging = function (e) {
|
21859 | params.onDragging(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_MOVE, e));
|
21860 | };
|
21861 | }
|
21862 | if (params.onDragStop) {
|
21863 | processedParams.onDragStop = function (e) {
|
21864 | params.onDragStop(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_END, e));
|
21865 | };
|
21866 | }
|
21867 | }
|
21868 | this.dragAndDropService.addDropTarget(__assign$a({ isInterestedIn: function (type) { return type === DragSourceType.RowDrag; }, getIconName: function () { return DragAndDropService.ICON_MOVE; }, external: true }, processedParams));
|
21869 | };
|
21870 | RowDragFeature.prototype.getRowDropZone = function (events) {
|
21871 | var _this = this;
|
21872 | var getContainer = this.getContainer.bind(this);
|
21873 | var onDragEnter = this.onDragEnter.bind(this);
|
21874 | var onDragLeave = this.onDragLeave.bind(this);
|
21875 | var onDragging = this.onDragging.bind(this);
|
21876 | var onDragStop = this.onDragStop.bind(this);
|
21877 | if (!events) {
|
21878 | return { getContainer: getContainer, onDragEnter: onDragEnter, onDragLeave: onDragLeave, onDragging: onDragging, onDragStop: onDragStop, fromGrid: true };
|
21879 | }
|
21880 | return {
|
21881 | getContainer: getContainer,
|
21882 | onDragEnter: events.onDragEnter
|
21883 | ? (function (e) {
|
21884 | onDragEnter(e);
|
21885 | events.onDragEnter(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_ENTER, e));
|
21886 | })
|
21887 | : onDragEnter,
|
21888 | onDragLeave: events.onDragLeave
|
21889 | ? (function (e) {
|
21890 | onDragLeave(e);
|
21891 | events.onDragLeave(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_LEAVE, e));
|
21892 | })
|
21893 | : onDragLeave,
|
21894 | onDragging: events.onDragging
|
21895 | ? (function (e) {
|
21896 | onDragging(e);
|
21897 | events.onDragging(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_MOVE, e));
|
21898 | })
|
21899 | : onDragging,
|
21900 | onDragStop: events.onDragStop
|
21901 | ? (function (e) {
|
21902 | onDragStop(e);
|
21903 | events.onDragStop(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_END, e));
|
21904 | })
|
21905 | : onDragStop,
|
21906 | fromGrid: true
|
21907 | };
|
21908 | };
|
21909 | RowDragFeature.prototype.draggingToRowDragEvent = function (type, draggingEvent) {
|
21910 | var yNormalised = this.mouseEventService.getNormalisedPosition(draggingEvent).y;
|
21911 | var mouseIsPastLastRow = yNormalised > this.paginationProxy.getCurrentPageHeight();
|
21912 | var overIndex = -1;
|
21913 | var overNode;
|
21914 | if (!mouseIsPastLastRow) {
|
21915 | overIndex = this.rowModel.getRowIndexAtPixel(yNormalised);
|
21916 | overNode = this.rowModel.getRow(overIndex);
|
21917 | }
|
21918 | var vDirectionString;
|
21919 | switch (draggingEvent.vDirection) {
|
21920 | case VerticalDirection.Down:
|
21921 | vDirectionString = 'down';
|
21922 | break;
|
21923 | case VerticalDirection.Up:
|
21924 | vDirectionString = 'up';
|
21925 | break;
|
21926 | default:
|
21927 | vDirectionString = null;
|
21928 | break;
|
21929 | }
|
21930 | var event = {
|
21931 | type: type,
|
21932 | api: this.gridOptionsWrapper.getApi(),
|
21933 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
21934 | event: draggingEvent.event,
|
21935 | node: draggingEvent.dragItem.rowNode,
|
21936 | nodes: draggingEvent.dragItem.rowNodes,
|
21937 | overIndex: overIndex,
|
21938 | overNode: overNode,
|
21939 | y: yNormalised,
|
21940 | vDirection: vDirectionString
|
21941 | };
|
21942 | return event;
|
21943 | };
|
21944 | RowDragFeature.prototype.dispatchGridEvent = function (type, draggingEvent) {
|
21945 | var event = this.draggingToRowDragEvent(type, draggingEvent);
|
21946 | this.eventService.dispatchEvent(event);
|
21947 | };
|
21948 | RowDragFeature.prototype.onDragLeave = function (draggingEvent) {
|
21949 | this.dispatchGridEvent(Events.EVENT_ROW_DRAG_LEAVE, draggingEvent);
|
21950 | this.stopDragging(draggingEvent);
|
21951 | if (this.gridOptionsWrapper.isRowDragManaged()) {
|
21952 | this.clearRowHighlight();
|
21953 | }
|
21954 | if (this.isFromThisGrid(draggingEvent)) {
|
21955 | this.isMultiRowDrag = false;
|
21956 | }
|
21957 | };
|
21958 | RowDragFeature.prototype.onDragStop = function (draggingEvent) {
|
21959 | this.dispatchGridEvent(Events.EVENT_ROW_DRAG_END, draggingEvent);
|
21960 | this.stopDragging(draggingEvent);
|
21961 | if (this.gridOptionsWrapper.isRowDragManaged() &&
|
21962 | (this.gridOptionsWrapper.isSuppressMoveWhenRowDragging() || !this.isFromThisGrid(draggingEvent)) &&
|
21963 | !this.isDropZoneWithinThisGrid(draggingEvent)) {
|
21964 | this.moveRowAndClearHighlight(draggingEvent);
|
21965 | }
|
21966 | };
|
21967 | RowDragFeature.prototype.stopDragging = function (draggingEvent) {
|
21968 | this.autoScrollService.ensureCleared();
|
21969 | this.getRowNodes(draggingEvent).forEach(function (rowNode) {
|
21970 | rowNode.setDragging(false);
|
21971 | });
|
21972 | };
|
21973 | __decorate$L([
|
21974 | Autowired('dragAndDropService')
|
21975 | ], RowDragFeature.prototype, "dragAndDropService", void 0);
|
21976 | __decorate$L([
|
21977 | Autowired('rowModel')
|
21978 | ], RowDragFeature.prototype, "rowModel", void 0);
|
21979 | __decorate$L([
|
21980 | Autowired('paginationProxy')
|
21981 | ], RowDragFeature.prototype, "paginationProxy", void 0);
|
21982 | __decorate$L([
|
21983 | Autowired('columnModel')
|
21984 | ], RowDragFeature.prototype, "columnModel", void 0);
|
21985 | __decorate$L([
|
21986 | Autowired('focusService')
|
21987 | ], RowDragFeature.prototype, "focusService", void 0);
|
21988 | __decorate$L([
|
21989 | Autowired('sortController')
|
21990 | ], RowDragFeature.prototype, "sortController", void 0);
|
21991 | __decorate$L([
|
21992 | Autowired('filterManager')
|
21993 | ], RowDragFeature.prototype, "filterManager", void 0);
|
21994 | __decorate$L([
|
21995 | Autowired('selectionService')
|
21996 | ], RowDragFeature.prototype, "selectionService", void 0);
|
21997 | __decorate$L([
|
21998 | Autowired('mouseEventService')
|
21999 | ], RowDragFeature.prototype, "mouseEventService", void 0);
|
22000 | __decorate$L([
|
22001 | Autowired('ctrlsService')
|
22002 | ], RowDragFeature.prototype, "ctrlsService", void 0);
|
22003 | __decorate$L([
|
22004 | Optional('rangeService')
|
22005 | ], RowDragFeature.prototype, "rangeService", void 0);
|
22006 | __decorate$L([
|
22007 | Autowired('columnApi')
|
22008 | ], RowDragFeature.prototype, "columnApi", void 0);
|
22009 | __decorate$L([
|
22010 | Autowired('gridApi')
|
22011 | ], RowDragFeature.prototype, "gridApi", void 0);
|
22012 | __decorate$L([
|
22013 | PostConstruct
|
22014 | ], RowDragFeature.prototype, "postConstruct", null);
|
22015 | return RowDragFeature;
|
22016 | }(BeanStub));
|
22017 |
|
22018 |
|
22019 |
|
22020 |
|
22021 |
|
22022 |
|
22023 |
|
22024 | var __extends$T = (undefined && undefined.__extends) || (function () {
|
22025 | var extendStatics = function (d, b) {
|
22026 | extendStatics = Object.setPrototypeOf ||
|
22027 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
22028 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
22029 | return extendStatics(d, b);
|
22030 | };
|
22031 | return function (d, b) {
|
22032 | extendStatics(d, b);
|
22033 | function __() { this.constructor = d; }
|
22034 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
22035 | };
|
22036 | })();
|
22037 | var __decorate$M = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
22038 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
22039 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
22040 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
22041 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
22042 | };
|
22043 | var RowAnimationCssClasses;
|
22044 | (function (RowAnimationCssClasses) {
|
22045 | RowAnimationCssClasses["ANIMATION_ON"] = "ag-row-animation";
|
22046 | RowAnimationCssClasses["ANIMATION_OFF"] = "ag-row-no-animation";
|
22047 | })(RowAnimationCssClasses || (RowAnimationCssClasses = {}));
|
22048 | var CSS_CLASS_CELL_SELECTABLE = 'ag-selectable';
|
22049 | var CSS_CLASS_FORCE_VERTICAL_SCROLL = 'ag-force-vertical-scroll';
|
22050 | var CSS_CLASS_COLUMN_MOVING = 'ag-column-moving';
|
22051 | var GridBodyCtrl = (function (_super) {
|
22052 | __extends$T(GridBodyCtrl, _super);
|
22053 | function GridBodyCtrl() {
|
22054 | return _super !== null && _super.apply(this, arguments) || this;
|
22055 | }
|
22056 | GridBodyCtrl.prototype.getScrollFeature = function () {
|
22057 | return this.bodyScrollFeature;
|
22058 | };
|
22059 | GridBodyCtrl.prototype.getBodyViewportElement = function () {
|
22060 | return this.eBodyViewport;
|
22061 | };
|
22062 | GridBodyCtrl.prototype.setComp = function (comp, eGridBody, eBodyViewport, eTop, eBottom) {
|
22063 | this.comp = comp;
|
22064 | this.eGridBody = eGridBody;
|
22065 | this.eBodyViewport = eBodyViewport;
|
22066 | this.eTop = eTop;
|
22067 | this.eBottom = eBottom;
|
22068 | this.setCellTextSelection(this.gridOptionsWrapper.isEnableCellTextSelect());
|
22069 | this.createManagedBean(new LayoutFeature(this.comp));
|
22070 | this.bodyScrollFeature = this.createManagedBean(new GridBodyScrollFeature(this.eBodyViewport));
|
22071 | this.addRowDragListener();
|
22072 | this.setupRowAnimationCssClass();
|
22073 | this.addEventListeners();
|
22074 | this.addFocusListeners([eTop, eBodyViewport, eBottom]);
|
22075 | this.onGridColumnsChanged();
|
22076 | this.addBodyViewportListener();
|
22077 | this.setFloatingHeights();
|
22078 | this.disableBrowserDragging();
|
22079 | this.addStopEditingWhenGridLosesFocus();
|
22080 | this.ctrlsService.registerGridBodyCtrl(this);
|
22081 | };
|
22082 | GridBodyCtrl.prototype.getComp = function () {
|
22083 | return this.comp;
|
22084 | };
|
22085 | GridBodyCtrl.prototype.addEventListeners = function () {
|
22086 | this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.onGridColumnsChanged.bind(this));
|
22087 | this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, this.onScrollVisibilityChanged.bind(this));
|
22088 | this.addManagedListener(this.eventService, Events.EVENT_PINNED_ROW_DATA_CHANGED, this.setFloatingHeights.bind(this));
|
22089 | };
|
22090 | GridBodyCtrl.prototype.addFocusListeners = function (elements) {
|
22091 | var _this = this;
|
22092 | elements.forEach(function (element) {
|
22093 | _this.addManagedListener(element, 'focusin', function () {
|
22094 | element.classList.add('ag-has-focus');
|
22095 | });
|
22096 | _this.addManagedListener(element, 'focusout', function (e) {
|
22097 | if (!element.contains(e.relatedTarget)) {
|
22098 | element.classList.remove('ag-has-focus');
|
22099 | }
|
22100 | });
|
22101 | });
|
22102 | };
|
22103 |
|
22104 | GridBodyCtrl.prototype.setColumnMovingCss = function (moving) {
|
22105 | this.comp.setColumnMovingCss(moving ? CSS_CLASS_COLUMN_MOVING : null, moving);
|
22106 | };
|
22107 | GridBodyCtrl.prototype.setCellTextSelection = function (selectable) {
|
22108 | if (selectable === void 0) { selectable = false; }
|
22109 | var cssClass = selectable ? CSS_CLASS_CELL_SELECTABLE : null;
|
22110 | this.comp.setCellSelectableCss(cssClass, selectable);
|
22111 | };
|
22112 | GridBodyCtrl.prototype.onScrollVisibilityChanged = function () {
|
22113 | var visible = this.scrollVisibleService.isVerticalScrollShowing();
|
22114 | this.setVerticalScrollPaddingVisible(visible);
|
22115 | };
|
22116 | GridBodyCtrl.prototype.onGridColumnsChanged = function () {
|
22117 | var columns = this.columnModel.getAllGridColumns();
|
22118 | this.comp.setColumnCount(columns ? columns.length : 0);
|
22119 | };
|
22120 |
|
22121 |
|
22122 | GridBodyCtrl.prototype.disableBrowserDragging = function () {
|
22123 | this.addManagedListener(this.eGridBody, 'dragstart', function (event) {
|
22124 | if (event.target instanceof HTMLImageElement) {
|
22125 | event.preventDefault();
|
22126 | return false;
|
22127 | }
|
22128 | });
|
22129 | };
|
22130 | GridBodyCtrl.prototype.addStopEditingWhenGridLosesFocus = function () {
|
22131 | var _this = this;
|
22132 | if (!this.gridOptionsWrapper.isStopEditingWhenCellsLoseFocus()) {
|
22133 | return;
|
22134 | }
|
22135 | var focusOutListener = function (event) {
|
22136 |
|
22137 | var elementWithFocus = event.relatedTarget;
|
22138 | if (getTabIndex(elementWithFocus) === null) {
|
22139 | _this.rowRenderer.stopEditing();
|
22140 | return;
|
22141 | }
|
22142 | var clickInsideGrid =
|
22143 |
|
22144 | viewports.some(function (viewport) { return viewport.contains(elementWithFocus); })
|
22145 |
|
22146 | && _this.mouseEventService.isElementInThisGrid(elementWithFocus);
|
22147 | if (!clickInsideGrid) {
|
22148 | var popupService = _this.popupService;
|
22149 | clickInsideGrid =
|
22150 | popupService.getActivePopups().some(function (popup) { return popup.contains(elementWithFocus); }) ||
|
22151 | popupService.isElementWithinCustomPopup(elementWithFocus);
|
22152 | }
|
22153 | if (!clickInsideGrid) {
|
22154 | _this.rowRenderer.stopEditing();
|
22155 | }
|
22156 | };
|
22157 | var viewports = [this.eBodyViewport, this.eBottom, this.eTop];
|
22158 | viewports.forEach(function (viewport) { return _this.addManagedListener(viewport, 'focusout', focusOutListener); });
|
22159 | };
|
22160 | GridBodyCtrl.prototype.updateRowCount = function () {
|
22161 | var headerCount = this.headerNavigationService.getHeaderRowCount();
|
22162 | var modelType = this.paginationProxy.getType();
|
22163 | var rowCount = -1;
|
22164 | if (modelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
|
22165 | rowCount = 0;
|
22166 | this.paginationProxy.forEachNode(function (node) {
|
22167 | if (!node.group) {
|
22168 | rowCount++;
|
22169 | }
|
22170 | });
|
22171 | }
|
22172 | var total = rowCount === -1 ? -1 : (headerCount + rowCount);
|
22173 | this.comp.setRowCount(total);
|
22174 | };
|
22175 | GridBodyCtrl.prototype.registerBodyViewportResizeListener = function (listener) {
|
22176 | this.comp.registerBodyViewportResizeListener(listener);
|
22177 | };
|
22178 | GridBodyCtrl.prototype.setVerticalScrollPaddingVisible = function (visible) {
|
22179 | var overflowY = visible ? 'scroll' : 'hidden';
|
22180 | this.comp.setPinnedTopBottomOverflowY(overflowY);
|
22181 | };
|
22182 | GridBodyCtrl.prototype.isVerticalScrollShowing = function () {
|
22183 | var show = this.gridOptionsWrapper.isAlwaysShowVerticalScroll();
|
22184 | var cssClass = show ? CSS_CLASS_FORCE_VERTICAL_SCROLL : null;
|
22185 | this.comp.setAlwaysVerticalScrollClass(cssClass, show);
|
22186 | return show || isVerticalScrollShowing(this.eBodyViewport);
|
22187 | };
|
22188 | GridBodyCtrl.prototype.setupRowAnimationCssClass = function () {
|
22189 | var _this = this;
|
22190 | var listener = function () {
|
22191 |
|
22192 |
|
22193 | var animateRows = _this.gridOptionsWrapper.isAnimateRows() && !_this.rowContainerHeightService.isStretching();
|
22194 | var animateRowsCssClass = animateRows ? RowAnimationCssClasses.ANIMATION_ON : RowAnimationCssClasses.ANIMATION_OFF;
|
22195 | _this.comp.setRowAnimationCssOnBodyViewport(animateRowsCssClass, animateRows);
|
22196 | };
|
22197 | listener();
|
22198 | this.addManagedListener(this.eventService, Events.EVENT_HEIGHT_SCALE_CHANGED, listener);
|
22199 | };
|
22200 | GridBodyCtrl.prototype.getGridBodyElement = function () {
|
22201 | return this.eGridBody;
|
22202 | };
|
22203 | GridBodyCtrl.prototype.addBodyViewportListener = function () {
|
22204 | var _this = this;
|
22205 |
|
22206 |
|
22207 | var listener = function (mouseEvent) {
|
22208 | if (_this.gridOptionsWrapper.isPreventDefaultOnContextMenu()) {
|
22209 | mouseEvent.preventDefault();
|
22210 | }
|
22211 | var target = mouseEvent.target;
|
22212 | if (target === _this.eBodyViewport || target === _this.ctrlsService.getCenterRowContainerCtrl().getViewportElement()) {
|
22213 |
|
22214 | if (_this.contextMenuFactory) {
|
22215 | _this.contextMenuFactory.onContextMenu(mouseEvent, null, null, null, null, _this.eGridBody);
|
22216 | }
|
22217 | }
|
22218 | };
|
22219 | this.addManagedListener(this.eBodyViewport, 'contextmenu', listener);
|
22220 | this.addManagedListener(this.eBodyViewport, 'wheel', this.onWheel.bind(this));
|
22221 | };
|
22222 | GridBodyCtrl.prototype.onWheel = function (e) {
|
22223 | if (!this.gridOptionsWrapper.isSuppressScrollWhenPopupsAreOpen()) {
|
22224 | return;
|
22225 | }
|
22226 | if (this.popupService.hasAnchoredPopup()) {
|
22227 | e.preventDefault();
|
22228 | }
|
22229 | };
|
22230 | GridBodyCtrl.prototype.getGui = function () {
|
22231 | return this.eGridBody;
|
22232 | };
|
22233 |
|
22234 | GridBodyCtrl.prototype.scrollVertically = function (pixels) {
|
22235 | var oldScrollPosition = this.eBodyViewport.scrollTop;
|
22236 | this.bodyScrollFeature.setVerticalScrollPosition(oldScrollPosition + pixels);
|
22237 | return this.eBodyViewport.scrollTop - oldScrollPosition;
|
22238 | };
|
22239 | GridBodyCtrl.prototype.addRowDragListener = function () {
|
22240 | this.rowDragFeature = this.createManagedBean(new RowDragFeature(this.eBodyViewport));
|
22241 | this.dragAndDropService.addDropTarget(this.rowDragFeature);
|
22242 | };
|
22243 | GridBodyCtrl.prototype.getRowDragFeature = function () {
|
22244 | return this.rowDragFeature;
|
22245 | };
|
22246 | GridBodyCtrl.prototype.setFloatingHeights = function () {
|
22247 | var pinnedRowModel = this.pinnedRowModel;
|
22248 | var floatingTopHeight = pinnedRowModel.getPinnedTopTotalHeight();
|
22249 | if (floatingTopHeight) {
|
22250 |
|
22251 | floatingTopHeight += 1;
|
22252 | }
|
22253 | var floatingBottomHeight = pinnedRowModel.getPinnedBottomTotalHeight();
|
22254 | if (floatingBottomHeight) {
|
22255 |
|
22256 | floatingBottomHeight += 1;
|
22257 | }
|
22258 | this.comp.setTopHeight(floatingTopHeight);
|
22259 | this.comp.setBottomHeight(floatingBottomHeight);
|
22260 | this.comp.setTopDisplay(floatingTopHeight ? 'inherit' : 'none');
|
22261 | this.comp.setBottomDisplay(floatingBottomHeight ? 'inherit' : 'none');
|
22262 | };
|
22263 |
|
22264 |
|
22265 | GridBodyCtrl.prototype.sizeColumnsToFit = function (nextTimeout) {
|
22266 | var _this = this;
|
22267 | var removeScrollWidth = this.isVerticalScrollShowing();
|
22268 | var scrollWidthToRemove = removeScrollWidth ? this.gridOptionsWrapper.getScrollbarWidth() : 0;
|
22269 | var bodyViewportWidth = getInnerWidth(this.eBodyViewport);
|
22270 | var availableWidth = bodyViewportWidth - scrollWidthToRemove;
|
22271 | if (availableWidth > 0) {
|
22272 | this.columnModel.sizeColumnsToFit(availableWidth, "sizeColumnsToFit");
|
22273 | return;
|
22274 | }
|
22275 | if (nextTimeout === undefined) {
|
22276 | window.setTimeout(function () {
|
22277 | _this.sizeColumnsToFit(100);
|
22278 | }, 0);
|
22279 | }
|
22280 | else if (nextTimeout === 100) {
|
22281 | window.setTimeout(function () {
|
22282 | _this.sizeColumnsToFit(500);
|
22283 | }, 100);
|
22284 | }
|
22285 | else if (nextTimeout === 500) {
|
22286 | window.setTimeout(function () {
|
22287 | _this.sizeColumnsToFit(-1);
|
22288 | }, 500);
|
22289 | }
|
22290 | else {
|
22291 | console.warn('AG Grid: tried to call sizeColumnsToFit() but the grid is coming back with ' +
|
22292 | 'zero width, maybe the grid is not visible yet on the screen?');
|
22293 | }
|
22294 | };
|
22295 |
|
22296 | GridBodyCtrl.prototype.addScrollEventListener = function (listener) {
|
22297 | this.eBodyViewport.addEventListener('scroll', listener);
|
22298 | };
|
22299 |
|
22300 | GridBodyCtrl.prototype.removeScrollEventListener = function (listener) {
|
22301 | this.eBodyViewport.removeEventListener('scroll', listener);
|
22302 | };
|
22303 | __decorate$M([
|
22304 | Autowired('rowContainerHeightService')
|
22305 | ], GridBodyCtrl.prototype, "rowContainerHeightService", void 0);
|
22306 | __decorate$M([
|
22307 | Autowired('ctrlsService')
|
22308 | ], GridBodyCtrl.prototype, "ctrlsService", void 0);
|
22309 | __decorate$M([
|
22310 | Autowired('columnModel')
|
22311 | ], GridBodyCtrl.prototype, "columnModel", void 0);
|
22312 | __decorate$M([
|
22313 | Autowired('scrollVisibleService')
|
22314 | ], GridBodyCtrl.prototype, "scrollVisibleService", void 0);
|
22315 | __decorate$M([
|
22316 | Optional('contextMenuFactory')
|
22317 | ], GridBodyCtrl.prototype, "contextMenuFactory", void 0);
|
22318 | __decorate$M([
|
22319 | Autowired('headerNavigationService')
|
22320 | ], GridBodyCtrl.prototype, "headerNavigationService", void 0);
|
22321 | __decorate$M([
|
22322 | Autowired('paginationProxy')
|
22323 | ], GridBodyCtrl.prototype, "paginationProxy", void 0);
|
22324 | __decorate$M([
|
22325 | Autowired('dragAndDropService')
|
22326 | ], GridBodyCtrl.prototype, "dragAndDropService", void 0);
|
22327 | __decorate$M([
|
22328 | Autowired('pinnedRowModel')
|
22329 | ], GridBodyCtrl.prototype, "pinnedRowModel", void 0);
|
22330 | __decorate$M([
|
22331 | Autowired('rowRenderer')
|
22332 | ], GridBodyCtrl.prototype, "rowRenderer", void 0);
|
22333 | __decorate$M([
|
22334 | Autowired('popupService')
|
22335 | ], GridBodyCtrl.prototype, "popupService", void 0);
|
22336 | __decorate$M([
|
22337 | Autowired('mouseEventService')
|
22338 | ], GridBodyCtrl.prototype, "mouseEventService", void 0);
|
22339 | return GridBodyCtrl;
|
22340 | }(BeanStub));
|
22341 |
|
22342 |
|
22343 |
|
22344 |
|
22345 |
|
22346 |
|
22347 |
|
22348 | var SelectionHandleType;
|
22349 | (function (SelectionHandleType) {
|
22350 | SelectionHandleType[SelectionHandleType["FILL"] = 0] = "FILL";
|
22351 | SelectionHandleType[SelectionHandleType["RANGE"] = 1] = "RANGE";
|
22352 | })(SelectionHandleType || (SelectionHandleType = {}));
|
22353 | var CellRangeType;
|
22354 | (function (CellRangeType) {
|
22355 | CellRangeType[CellRangeType["VALUE"] = 0] = "VALUE";
|
22356 | CellRangeType[CellRangeType["DIMENSION"] = 1] = "DIMENSION";
|
22357 | })(CellRangeType || (CellRangeType = {}));
|
22358 |
|
22359 |
|
22360 |
|
22361 |
|
22362 |
|
22363 |
|
22364 |
|
22365 | var CSS_CELL_RANGE_SELECTED = 'ag-cell-range-selected';
|
22366 | var CSS_CELL_RANGE_CHART = 'ag-cell-range-chart';
|
22367 | var CSS_CELL_RANGE_SINGLE_CELL = 'ag-cell-range-single-cell';
|
22368 | var CSS_CELL_RANGE_CHART_CATEGORY = 'ag-cell-range-chart-category';
|
22369 | var CSS_CELL_RANGE_HANDLE = 'ag-cell-range-handle';
|
22370 | var CSS_CELL_RANGE_TOP = 'ag-cell-range-top';
|
22371 | var CSS_CELL_RANGE_RIGHT = 'ag-cell-range-right';
|
22372 | var CSS_CELL_RANGE_BOTTOM = 'ag-cell-range-bottom';
|
22373 | var CSS_CELL_RANGE_LEFT = 'ag-cell-range-left';
|
22374 | var CellRangeFeature = (function () {
|
22375 | function CellRangeFeature(beans, ctrl) {
|
22376 | this.beans = beans;
|
22377 | this.cellCtrl = ctrl;
|
22378 | }
|
22379 | CellRangeFeature.prototype.setComp = function (cellComp, eGui) {
|
22380 | this.cellComp = cellComp;
|
22381 | this.eGui = eGui;
|
22382 | this.onRangeSelectionChanged();
|
22383 | };
|
22384 | CellRangeFeature.prototype.onRangeSelectionChanged = function () {
|
22385 |
|
22386 | if (!this.cellComp) {
|
22387 | return;
|
22388 | }
|
22389 | this.rangeCount = this.beans.rangeService.getCellRangeCount(this.cellCtrl.getCellPosition());
|
22390 | this.hasChartRange = this.getHasChartRange();
|
22391 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED, this.rangeCount !== 0);
|
22392 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-1", this.rangeCount === 1);
|
22393 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-2", this.rangeCount === 2);
|
22394 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-3", this.rangeCount === 3);
|
22395 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-4", this.rangeCount >= 4);
|
22396 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_CHART, this.hasChartRange);
|
22397 | setAriaSelected(this.eGui, this.rangeCount > 0 ? true : undefined);
|
22398 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SINGLE_CELL, this.isSingleCell());
|
22399 | this.updateRangeBorders();
|
22400 | this.refreshHandle();
|
22401 | };
|
22402 | CellRangeFeature.prototype.updateRangeBorders = function () {
|
22403 | var rangeBorders = this.getRangeBorders();
|
22404 | var isSingleCell = this.isSingleCell();
|
22405 | var isTop = !isSingleCell && rangeBorders.top;
|
22406 | var isRight = !isSingleCell && rangeBorders.right;
|
22407 | var isBottom = !isSingleCell && rangeBorders.bottom;
|
22408 | var isLeft = !isSingleCell && rangeBorders.left;
|
22409 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_TOP, isTop);
|
22410 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_RIGHT, isRight);
|
22411 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_BOTTOM, isBottom);
|
22412 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_LEFT, isLeft);
|
22413 | };
|
22414 | CellRangeFeature.prototype.isSingleCell = function () {
|
22415 | var rangeService = this.beans.rangeService;
|
22416 | return this.rangeCount === 1 && rangeService && !rangeService.isMoreThanOneCell();
|
22417 | };
|
22418 | CellRangeFeature.prototype.getHasChartRange = function () {
|
22419 | var rangeService = this.beans.rangeService;
|
22420 | if (!this.rangeCount || !rangeService) {
|
22421 | return false;
|
22422 | }
|
22423 | var cellRanges = rangeService.getCellRanges();
|
22424 | return cellRanges.length > 0 && cellRanges.every(function (range) { return includes([CellRangeType.DIMENSION, CellRangeType.VALUE], range.type); });
|
22425 | };
|
22426 | CellRangeFeature.prototype.updateRangeBordersIfRangeCount = function () {
|
22427 |
|
22428 | if (this.rangeCount > 0) {
|
22429 | this.updateRangeBorders();
|
22430 | this.refreshHandle();
|
22431 | }
|
22432 | };
|
22433 | CellRangeFeature.prototype.getRangeBorders = function () {
|
22434 | var _this = this;
|
22435 | var isRtl = this.beans.gridOptionsWrapper.isEnableRtl();
|
22436 | var top = false;
|
22437 | var right = false;
|
22438 | var bottom = false;
|
22439 | var left = false;
|
22440 | var thisCol = this.cellCtrl.getCellPosition().column;
|
22441 | var _a = this.beans, rangeService = _a.rangeService, columnModel = _a.columnModel;
|
22442 | var leftCol;
|
22443 | var rightCol;
|
22444 | if (isRtl) {
|
22445 | leftCol = columnModel.getDisplayedColAfter(thisCol);
|
22446 | rightCol = columnModel.getDisplayedColBefore(thisCol);
|
22447 | }
|
22448 | else {
|
22449 | leftCol = columnModel.getDisplayedColBefore(thisCol);
|
22450 | rightCol = columnModel.getDisplayedColAfter(thisCol);
|
22451 | }
|
22452 | var ranges = rangeService.getCellRanges().filter(function (range) { return rangeService.isCellInSpecificRange(_this.cellCtrl.getCellPosition(), range); });
|
22453 |
|
22454 | if (!leftCol) {
|
22455 | left = true;
|
22456 | }
|
22457 |
|
22458 | if (!rightCol) {
|
22459 | right = true;
|
22460 | }
|
22461 | for (var i = 0; i < ranges.length; i++) {
|
22462 | if (top && right && bottom && left) {
|
22463 | break;
|
22464 | }
|
22465 | var range = ranges[i];
|
22466 | var startRow = rangeService.getRangeStartRow(range);
|
22467 | var endRow = rangeService.getRangeEndRow(range);
|
22468 | if (!top && this.beans.rowPositionUtils.sameRow(startRow, this.cellCtrl.getCellPosition())) {
|
22469 | top = true;
|
22470 | }
|
22471 | if (!bottom && this.beans.rowPositionUtils.sameRow(endRow, this.cellCtrl.getCellPosition())) {
|
22472 | bottom = true;
|
22473 | }
|
22474 | if (!left && leftCol && range.columns.indexOf(leftCol) < 0) {
|
22475 | left = true;
|
22476 | }
|
22477 | if (!right && rightCol && range.columns.indexOf(rightCol) < 0) {
|
22478 | right = true;
|
22479 | }
|
22480 | }
|
22481 | return { top: top, right: right, bottom: bottom, left: left };
|
22482 | };
|
22483 | CellRangeFeature.prototype.refreshHandle = function () {
|
22484 | if (!this.beans.rangeService) {
|
22485 | return;
|
22486 | }
|
22487 | var shouldHaveSelectionHandle = this.shouldHaveSelectionHandle();
|
22488 | if (this.selectionHandle && !shouldHaveSelectionHandle) {
|
22489 | this.selectionHandle = this.beans.context.destroyBean(this.selectionHandle);
|
22490 | }
|
22491 | if (shouldHaveSelectionHandle) {
|
22492 | this.addSelectionHandle();
|
22493 | }
|
22494 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_HANDLE, !!this.selectionHandle);
|
22495 | };
|
22496 | CellRangeFeature.prototype.shouldHaveSelectionHandle = function () {
|
22497 | var _a = this.beans, gridOptionsWrapper = _a.gridOptionsWrapper, rangeService = _a.rangeService;
|
22498 | var cellRanges = rangeService.getCellRanges();
|
22499 | var rangesLen = cellRanges.length;
|
22500 | if (this.rangeCount < 1 || rangesLen < 1) {
|
22501 | return false;
|
22502 | }
|
22503 | var cellRange = last(cellRanges);
|
22504 | var cellPosition = this.cellCtrl.getCellPosition();
|
22505 | var isFillHandleAvailable = gridOptionsWrapper.isEnableFillHandle() && !this.cellCtrl.isSuppressFillHandle();
|
22506 | var isRangeHandleAvailable = gridOptionsWrapper.isEnableRangeHandle();
|
22507 | var handleIsAvailable = rangesLen === 1 && !this.cellCtrl.isEditing() && (isFillHandleAvailable || isRangeHandleAvailable);
|
22508 | if (this.hasChartRange) {
|
22509 | var hasCategoryRange = cellRanges[0].type === CellRangeType.DIMENSION;
|
22510 | var isCategoryCell = hasCategoryRange && rangeService.isCellInSpecificRange(cellPosition, cellRanges[0]);
|
22511 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_CHART_CATEGORY, isCategoryCell);
|
22512 | handleIsAvailable = cellRange.type === CellRangeType.VALUE;
|
22513 | }
|
22514 | return handleIsAvailable &&
|
22515 | cellRange.endRow != null &&
|
22516 | rangeService.isContiguousRange(cellRange) &&
|
22517 | rangeService.isBottomRightCell(cellRange, cellPosition);
|
22518 | };
|
22519 | CellRangeFeature.prototype.addSelectionHandle = function () {
|
22520 | var _a = this.beans, gridOptionsWrapper = _a.gridOptionsWrapper, rangeService = _a.rangeService;
|
22521 | var cellRangeType = last(rangeService.getCellRanges()).type;
|
22522 | var selectionHandleFill = gridOptionsWrapper.isEnableFillHandle() && missing(cellRangeType);
|
22523 | var type = selectionHandleFill ? SelectionHandleType.FILL : SelectionHandleType.RANGE;
|
22524 | if (this.selectionHandle && this.selectionHandle.getType() !== type) {
|
22525 | this.selectionHandle = this.beans.context.destroyBean(this.selectionHandle);
|
22526 | }
|
22527 | if (!this.selectionHandle) {
|
22528 | this.selectionHandle = this.beans.selectionHandleFactory.createSelectionHandle(type);
|
22529 | }
|
22530 | this.selectionHandle.refresh(this.cellCtrl);
|
22531 | };
|
22532 | CellRangeFeature.prototype.destroy = function () {
|
22533 | this.beans.context.destroyBean(this.selectionHandle);
|
22534 | };
|
22535 | return CellRangeFeature;
|
22536 | }());
|
22537 |
|
22538 |
|
22539 |
|
22540 |
|
22541 |
|
22542 |
|
22543 |
|
22544 | var __extends$U = (undefined && undefined.__extends) || (function () {
|
22545 | var extendStatics = function (d, b) {
|
22546 | extendStatics = Object.setPrototypeOf ||
|
22547 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
22548 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
22549 | return extendStatics(d, b);
|
22550 | };
|
22551 | return function (d, b) {
|
22552 | extendStatics(d, b);
|
22553 | function __() { this.constructor = d; }
|
22554 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
22555 | };
|
22556 | })();
|
22557 |
|
22558 |
|
22559 |
|
22560 |
|
22561 |
|
22562 |
|
22563 | var CellPositionFeature = (function (_super) {
|
22564 | __extends$U(CellPositionFeature, _super);
|
22565 | function CellPositionFeature(ctrl, beans) {
|
22566 | var _this = _super.call(this) || this;
|
22567 | _this.cellCtrl = ctrl;
|
22568 | _this.beans = beans;
|
22569 | _this.column = ctrl.getColumn();
|
22570 | _this.rowNode = ctrl.getRowNode();
|
22571 | _this.setupColSpan();
|
22572 | _this.setupRowSpan();
|
22573 | return _this;
|
22574 | }
|
22575 | CellPositionFeature.prototype.setupRowSpan = function () {
|
22576 | this.rowSpan = this.column.getRowSpan(this.rowNode);
|
22577 | };
|
22578 | CellPositionFeature.prototype.setComp = function (eGui) {
|
22579 | this.eGui = eGui;
|
22580 | this.onLeftChanged();
|
22581 | this.onWidthChanged();
|
22582 | this.applyRowSpan();
|
22583 | };
|
22584 | CellPositionFeature.prototype.onDisplayColumnsChanged = function () {
|
22585 | var colsSpanning = this.getColSpanningList();
|
22586 | if (!areEqual(this.colsSpanning, colsSpanning)) {
|
22587 | this.colsSpanning = colsSpanning;
|
22588 | this.onWidthChanged();
|
22589 | this.onLeftChanged();
|
22590 | }
|
22591 | };
|
22592 | CellPositionFeature.prototype.setupColSpan = function () {
|
22593 |
|
22594 | if (this.column.getColDef().colSpan == null) {
|
22595 | return;
|
22596 | }
|
22597 | this.colsSpanning = this.getColSpanningList();
|
22598 |
|
22599 | this.addManagedListener(this.beans.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayColumnsChanged.bind(this));
|
22600 |
|
22601 |
|
22602 |
|
22603 |
|
22604 | this.addManagedListener(this.beans.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onWidthChanged.bind(this));
|
22605 | };
|
22606 | CellPositionFeature.prototype.onWidthChanged = function () {
|
22607 | if (!this.eGui) {
|
22608 | return;
|
22609 | }
|
22610 | var width = this.getCellWidth();
|
22611 | this.eGui.style.width = width + "px";
|
22612 | };
|
22613 | CellPositionFeature.prototype.getCellWidth = function () {
|
22614 | if (!this.colsSpanning) {
|
22615 | return this.column.getActualWidth();
|
22616 | }
|
22617 | return this.colsSpanning.reduce(function (width, col) { return width + col.getActualWidth(); }, 0);
|
22618 | };
|
22619 | CellPositionFeature.prototype.getColSpanningList = function () {
|
22620 | var colSpan = this.column.getColSpan(this.rowNode);
|
22621 | var colsSpanning = [];
|
22622 |
|
22623 | if (colSpan === 1) {
|
22624 | colsSpanning.push(this.column);
|
22625 | }
|
22626 | else {
|
22627 | var pointer = this.column;
|
22628 | var pinned = this.column.getPinned();
|
22629 | for (var i = 0; pointer && i < colSpan; i++) {
|
22630 | colsSpanning.push(pointer);
|
22631 | pointer = this.beans.columnModel.getDisplayedColAfter(pointer);
|
22632 | if (!pointer || missing(pointer)) {
|
22633 | break;
|
22634 | }
|
22635 |
|
22636 | if (pinned !== pointer.getPinned()) {
|
22637 | break;
|
22638 | }
|
22639 | }
|
22640 | }
|
22641 | return colsSpanning;
|
22642 | };
|
22643 | CellPositionFeature.prototype.onLeftChanged = function () {
|
22644 | if (!this.eGui) {
|
22645 | return;
|
22646 | }
|
22647 | var left = this.modifyLeftForPrintLayout(this.getCellLeft());
|
22648 | this.eGui.style.left = left + 'px';
|
22649 | };
|
22650 | CellPositionFeature.prototype.getCellLeft = function () {
|
22651 | var mostLeftCol;
|
22652 | if (this.beans.gridOptionsWrapper.isEnableRtl() && this.colsSpanning) {
|
22653 | mostLeftCol = last(this.colsSpanning);
|
22654 | }
|
22655 | else {
|
22656 | mostLeftCol = this.column;
|
22657 | }
|
22658 | return mostLeftCol.getLeft();
|
22659 | };
|
22660 | CellPositionFeature.prototype.modifyLeftForPrintLayout = function (leftPosition) {
|
22661 | if (!this.cellCtrl.isPrintLayout() || this.column.getPinned() === Constants.PINNED_LEFT) {
|
22662 | return leftPosition;
|
22663 | }
|
22664 | var leftWidth = this.beans.columnModel.getDisplayedColumnsLeftWidth();
|
22665 | if (this.column.getPinned() === Constants.PINNED_RIGHT) {
|
22666 | var bodyWidth = this.beans.columnModel.getBodyContainerWidth();
|
22667 | return leftWidth + bodyWidth + (leftPosition || 0);
|
22668 | }
|
22669 |
|
22670 | return leftWidth + (leftPosition || 0);
|
22671 | };
|
22672 | CellPositionFeature.prototype.applyRowSpan = function () {
|
22673 | if (this.rowSpan === 1) {
|
22674 | return;
|
22675 | }
|
22676 | var singleRowHeight = this.beans.gridOptionsWrapper.getRowHeightAsNumber();
|
22677 | var totalRowHeight = singleRowHeight * this.rowSpan;
|
22678 | this.eGui.style.height = totalRowHeight + "px";
|
22679 | this.eGui.style.zIndex = '1';
|
22680 | };
|
22681 |
|
22682 | CellPositionFeature.prototype.destroy = function () {
|
22683 | _super.prototype.destroy.call(this);
|
22684 | };
|
22685 | return CellPositionFeature;
|
22686 | }(BeanStub));
|
22687 |
|
22688 |
|
22689 |
|
22690 |
|
22691 |
|
22692 |
|
22693 |
|
22694 | var __extends$V = (undefined && undefined.__extends) || (function () {
|
22695 | var extendStatics = function (d, b) {
|
22696 | extendStatics = Object.setPrototypeOf ||
|
22697 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
22698 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
22699 | return extendStatics(d, b);
|
22700 | };
|
22701 | return function (d, b) {
|
22702 | extendStatics(d, b);
|
22703 | function __() { this.constructor = d; }
|
22704 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
22705 | };
|
22706 | })();
|
22707 | var CellCustomStyleFeature = (function (_super) {
|
22708 | __extends$V(CellCustomStyleFeature, _super);
|
22709 | function CellCustomStyleFeature(ctrl, beans) {
|
22710 | var _this = _super.call(this) || this;
|
22711 | _this.staticClasses = [];
|
22712 | _this.cellCtrl = ctrl;
|
22713 | _this.beans = beans;
|
22714 | _this.column = ctrl.getColumn();
|
22715 | _this.rowNode = ctrl.getRowNode();
|
22716 | return _this;
|
22717 | }
|
22718 | CellCustomStyleFeature.prototype.setComp = function (comp) {
|
22719 | this.cellComp = comp;
|
22720 | this.applyUserStyles();
|
22721 | this.applyCellClassRules();
|
22722 | this.applyClassesFromColDef();
|
22723 | };
|
22724 | CellCustomStyleFeature.prototype.applyCellClassRules = function () {
|
22725 | var _this = this;
|
22726 | var colDef = this.column.getColDef();
|
22727 | var cellClassParams = {
|
22728 | value: this.cellCtrl.getValue(),
|
22729 | data: this.rowNode.data,
|
22730 | node: this.rowNode,
|
22731 | colDef: colDef,
|
22732 | rowIndex: this.rowNode.rowIndex,
|
22733 | api: this.beans.gridOptionsWrapper.getApi(),
|
22734 | columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
|
22735 | context: this.beans.gridOptionsWrapper.getContext()
|
22736 | };
|
22737 | this.beans.stylingService.processClassRules(colDef.cellClassRules, cellClassParams, function (className) { return _this.cellComp.addOrRemoveCssClass(className, true); }, function (className) { return _this.cellComp.addOrRemoveCssClass(className, false); });
|
22738 | };
|
22739 | CellCustomStyleFeature.prototype.applyUserStyles = function () {
|
22740 | var colDef = this.column.getColDef();
|
22741 | if (!colDef.cellStyle) {
|
22742 | return;
|
22743 | }
|
22744 | var styles;
|
22745 | if (typeof colDef.cellStyle === 'function') {
|
22746 | var cellStyleParams = {
|
22747 | column: this.column,
|
22748 | value: this.cellCtrl.getValue(),
|
22749 | colDef: colDef,
|
22750 | data: this.rowNode.data,
|
22751 | node: this.rowNode,
|
22752 | rowIndex: this.rowNode.rowIndex,
|
22753 | api: this.beans.gridOptionsWrapper.getApi(),
|
22754 | columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
|
22755 | context: this.beans.gridOptionsWrapper.getContext(),
|
22756 | };
|
22757 | var cellStyleFunc = colDef.cellStyle;
|
22758 | styles = cellStyleFunc(cellStyleParams);
|
22759 | }
|
22760 | else {
|
22761 | styles = colDef.cellStyle;
|
22762 | }
|
22763 | this.cellComp.setUserStyles(styles);
|
22764 | };
|
22765 | CellCustomStyleFeature.prototype.applyClassesFromColDef = function () {
|
22766 | var _this = this;
|
22767 | var colDef = this.column.getColDef();
|
22768 | var cellClassParams = {
|
22769 | value: this.cellCtrl.getValue(),
|
22770 | data: this.rowNode.data,
|
22771 | node: this.rowNode,
|
22772 | colDef: colDef,
|
22773 | rowIndex: this.rowNode.rowIndex,
|
22774 | api: this.beans.gridOptionsWrapper.getApi(),
|
22775 | columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
|
22776 | context: this.beans.gridOptionsWrapper.getContext()
|
22777 | };
|
22778 | if (this.staticClasses.length) {
|
22779 | this.staticClasses.forEach(function (className) { return _this.cellComp.addOrRemoveCssClass(className, false); });
|
22780 | }
|
22781 | this.staticClasses = this.beans.stylingService.getStaticCellClasses(colDef, cellClassParams);
|
22782 | if (this.staticClasses.length) {
|
22783 | this.staticClasses.forEach(function (className) { return _this.cellComp.addOrRemoveCssClass(className, true); });
|
22784 | }
|
22785 | };
|
22786 |
|
22787 | CellCustomStyleFeature.prototype.destroy = function () {
|
22788 | _super.prototype.destroy.call(this);
|
22789 | };
|
22790 | return CellCustomStyleFeature;
|
22791 | }(BeanStub));
|
22792 |
|
22793 |
|
22794 |
|
22795 |
|
22796 |
|
22797 |
|
22798 |
|
22799 | var __extends$W = (undefined && undefined.__extends) || (function () {
|
22800 | var extendStatics = function (d, b) {
|
22801 | extendStatics = Object.setPrototypeOf ||
|
22802 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
22803 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
22804 | return extendStatics(d, b);
|
22805 | };
|
22806 | return function (d, b) {
|
22807 | extendStatics(d, b);
|
22808 | function __() { this.constructor = d; }
|
22809 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
22810 | };
|
22811 | })();
|
22812 | var TooltipFeature = (function (_super) {
|
22813 | __extends$W(TooltipFeature, _super);
|
22814 | function TooltipFeature(ctrl, beans) {
|
22815 | var _this = _super.call(this) || this;
|
22816 | _this.ctrl = ctrl;
|
22817 | _this.beans = beans;
|
22818 | return _this;
|
22819 | }
|
22820 | TooltipFeature.prototype.setComp = function (comp) {
|
22821 | this.comp = comp;
|
22822 | this.setupTooltip();
|
22823 | };
|
22824 | TooltipFeature.prototype.setupTooltip = function () {
|
22825 | this.browserTooltips = this.beans.gridOptionsWrapper.isEnableBrowserTooltips();
|
22826 | this.updateTooltipText();
|
22827 | if (this.browserTooltips) {
|
22828 | this.comp.setTitle(this.tooltip != null ? this.tooltip : undefined);
|
22829 | }
|
22830 | else {
|
22831 | this.createTooltipFeatureIfNeeded();
|
22832 | }
|
22833 | };
|
22834 | TooltipFeature.prototype.updateTooltipText = function () {
|
22835 | this.tooltip = this.ctrl.getTooltipValue();
|
22836 | };
|
22837 | TooltipFeature.prototype.createTooltipFeatureIfNeeded = function () {
|
22838 | var _this = this;
|
22839 | if (this.genericTooltipFeature != null) {
|
22840 | return;
|
22841 | }
|
22842 | var parent = {
|
22843 | getTooltipParams: function () { return _this.getTooltipParams(); },
|
22844 | getGui: function () { return _this.ctrl.getGui(); }
|
22845 | };
|
22846 | this.genericTooltipFeature = this.createManagedBean(new CustomTooltipFeature(parent), this.beans.context);
|
22847 | };
|
22848 | TooltipFeature.prototype.refreshToolTip = function () {
|
22849 | this.updateTooltipText();
|
22850 | if (this.browserTooltips) {
|
22851 | this.comp.setTitle(this.tooltip != null ? this.tooltip : undefined);
|
22852 | }
|
22853 | };
|
22854 | TooltipFeature.prototype.getTooltipParams = function () {
|
22855 | var ctrl = this.ctrl;
|
22856 | var column = ctrl.getColumn ? ctrl.getColumn() : undefined;
|
22857 | var colDef = ctrl.getColDef ? ctrl.getColDef() : undefined;
|
22858 | var rowNode = ctrl.getRowNode ? ctrl.getRowNode() : undefined;
|
22859 | return {
|
22860 | location: ctrl.getLocation(),
|
22861 | colDef: colDef,
|
22862 | column: column,
|
22863 | rowIndex: ctrl.getRowIndex ? ctrl.getRowIndex() : undefined,
|
22864 | node: rowNode,
|
22865 | data: rowNode ? rowNode.data : undefined,
|
22866 | value: this.getTooltipText(),
|
22867 | valueFormatted: ctrl.getValueFormatted ? ctrl.getValueFormatted() : undefined,
|
22868 | };
|
22869 | };
|
22870 | TooltipFeature.prototype.getTooltipText = function () {
|
22871 | return this.tooltip;
|
22872 | };
|
22873 |
|
22874 | TooltipFeature.prototype.destroy = function () {
|
22875 | _super.prototype.destroy.call(this);
|
22876 | };
|
22877 | return TooltipFeature;
|
22878 | }(BeanStub));
|
22879 |
|
22880 |
|
22881 |
|
22882 |
|
22883 |
|
22884 |
|
22885 |
|
22886 | var __decorate$N = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
22887 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
22888 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
22889 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
22890 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
22891 | };
|
22892 |
|
22893 |
|
22894 |
|
22895 |
|
22896 |
|
22897 | var Beans = (function () {
|
22898 | function Beans() {
|
22899 | }
|
22900 | Beans.prototype.postConstruct = function () {
|
22901 | this.doingMasterDetail = this.gridOptionsWrapper.isMasterDetail();
|
22902 | if (this.gridOptionsWrapper.isRowModelDefault()) {
|
22903 | this.clientSideRowModel = this.rowModel;
|
22904 | }
|
22905 | if (this.gridOptionsWrapper.isRowModelServerSide()) {
|
22906 | this.serverSideRowModel = this.rowModel;
|
22907 | }
|
22908 | };
|
22909 | __decorate$N([
|
22910 | Autowired('resizeObserverService')
|
22911 | ], Beans.prototype, "resizeObserverService", void 0);
|
22912 | __decorate$N([
|
22913 | Autowired('paginationProxy')
|
22914 | ], Beans.prototype, "paginationProxy", void 0);
|
22915 | __decorate$N([
|
22916 | Autowired('context')
|
22917 | ], Beans.prototype, "context", void 0);
|
22918 | __decorate$N([
|
22919 | Autowired('columnApi')
|
22920 | ], Beans.prototype, "columnApi", void 0);
|
22921 | __decorate$N([
|
22922 | Autowired('gridApi')
|
22923 | ], Beans.prototype, "gridApi", void 0);
|
22924 | __decorate$N([
|
22925 | Autowired('gridOptionsWrapper')
|
22926 | ], Beans.prototype, "gridOptionsWrapper", void 0);
|
22927 | __decorate$N([
|
22928 | Autowired('expressionService')
|
22929 | ], Beans.prototype, "expressionService", void 0);
|
22930 | __decorate$N([
|
22931 | Autowired('rowRenderer')
|
22932 | ], Beans.prototype, "rowRenderer", void 0);
|
22933 | __decorate$N([
|
22934 | Autowired('templateService')
|
22935 | ], Beans.prototype, "templateService", void 0);
|
22936 | __decorate$N([
|
22937 | Autowired('valueService')
|
22938 | ], Beans.prototype, "valueService", void 0);
|
22939 | __decorate$N([
|
22940 | Autowired('eventService')
|
22941 | ], Beans.prototype, "eventService", void 0);
|
22942 | __decorate$N([
|
22943 | Autowired('columnModel')
|
22944 | ], Beans.prototype, "columnModel", void 0);
|
22945 | __decorate$N([
|
22946 | Autowired('headerNavigationService')
|
22947 | ], Beans.prototype, "headerNavigationService", void 0);
|
22948 | __decorate$N([
|
22949 | Autowired('navigationService')
|
22950 | ], Beans.prototype, "navigationService", void 0);
|
22951 | __decorate$N([
|
22952 | Autowired('columnAnimationService')
|
22953 | ], Beans.prototype, "columnAnimationService", void 0);
|
22954 | __decorate$N([
|
22955 | Optional('rangeService')
|
22956 | ], Beans.prototype, "rangeService", void 0);
|
22957 | __decorate$N([
|
22958 | Autowired('focusService')
|
22959 | ], Beans.prototype, "focusService", void 0);
|
22960 | __decorate$N([
|
22961 | Optional('contextMenuFactory')
|
22962 | ], Beans.prototype, "contextMenuFactory", void 0);
|
22963 | __decorate$N([
|
22964 | Autowired('popupService')
|
22965 | ], Beans.prototype, "popupService", void 0);
|
22966 | __decorate$N([
|
22967 | Autowired('valueFormatterService')
|
22968 | ], Beans.prototype, "valueFormatterService", void 0);
|
22969 | __decorate$N([
|
22970 | Autowired('stylingService')
|
22971 | ], Beans.prototype, "stylingService", void 0);
|
22972 | __decorate$N([
|
22973 | Autowired('columnHoverService')
|
22974 | ], Beans.prototype, "columnHoverService", void 0);
|
22975 | __decorate$N([
|
22976 | Autowired('userComponentFactory')
|
22977 | ], Beans.prototype, "userComponentFactory", void 0);
|
22978 | __decorate$N([
|
22979 | Autowired('userComponentRegistry')
|
22980 | ], Beans.prototype, "userComponentRegistry", void 0);
|
22981 | __decorate$N([
|
22982 | Autowired('animationFrameService')
|
22983 | ], Beans.prototype, "animationFrameService", void 0);
|
22984 | __decorate$N([
|
22985 | Autowired('dragAndDropService')
|
22986 | ], Beans.prototype, "dragAndDropService", void 0);
|
22987 | __decorate$N([
|
22988 | Autowired('sortController')
|
22989 | ], Beans.prototype, "sortController", void 0);
|
22990 | __decorate$N([
|
22991 | Autowired('filterManager')
|
22992 | ], Beans.prototype, "filterManager", void 0);
|
22993 | __decorate$N([
|
22994 | Autowired('rowContainerHeightService')
|
22995 | ], Beans.prototype, "rowContainerHeightService", void 0);
|
22996 | __decorate$N([
|
22997 | Autowired('frameworkOverrides')
|
22998 | ], Beans.prototype, "frameworkOverrides", void 0);
|
22999 | __decorate$N([
|
23000 | Autowired('cellPositionUtils')
|
23001 | ], Beans.prototype, "cellPositionUtils", void 0);
|
23002 | __decorate$N([
|
23003 | Autowired('rowPositionUtils')
|
23004 | ], Beans.prototype, "rowPositionUtils", void 0);
|
23005 | __decorate$N([
|
23006 | Autowired('selectionService')
|
23007 | ], Beans.prototype, "selectionService", void 0);
|
23008 | __decorate$N([
|
23009 | Optional('selectionHandleFactory')
|
23010 | ], Beans.prototype, "selectionHandleFactory", void 0);
|
23011 | __decorate$N([
|
23012 | Autowired('rowCssClassCalculator')
|
23013 | ], Beans.prototype, "rowCssClassCalculator", void 0);
|
23014 | __decorate$N([
|
23015 | Autowired('rowModel')
|
23016 | ], Beans.prototype, "rowModel", void 0);
|
23017 | __decorate$N([
|
23018 | Autowired('ctrlsService')
|
23019 | ], Beans.prototype, "ctrlsService", void 0);
|
23020 | __decorate$N([
|
23021 | Autowired('ctrlsFactory')
|
23022 | ], Beans.prototype, "ctrlsFactory", void 0);
|
23023 | __decorate$N([
|
23024 | Autowired('agStackComponentsRegistry')
|
23025 | ], Beans.prototype, "agStackComponentsRegistry", void 0);
|
23026 | __decorate$N([
|
23027 | Autowired('valueCache')
|
23028 | ], Beans.prototype, "valueCache", void 0);
|
23029 | __decorate$N([
|
23030 | Autowired('rowNodeEventThrottle')
|
23031 | ], Beans.prototype, "rowNodeEventThrottle", void 0);
|
23032 | __decorate$N([
|
23033 | PostConstruct
|
23034 | ], Beans.prototype, "postConstruct", null);
|
23035 | Beans = __decorate$N([
|
23036 | Bean('beans')
|
23037 | ], Beans);
|
23038 | return Beans;
|
23039 | }());
|
23040 |
|
23041 |
|
23042 |
|
23043 |
|
23044 |
|
23045 |
|
23046 |
|
23047 | var __extends$X = (undefined && undefined.__extends) || (function () {
|
23048 | var extendStatics = function (d, b) {
|
23049 | extendStatics = Object.setPrototypeOf ||
|
23050 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
23051 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
23052 | return extendStatics(d, b);
|
23053 | };
|
23054 | return function (d, b) {
|
23055 | extendStatics(d, b);
|
23056 | function __() { this.constructor = d; }
|
23057 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
23058 | };
|
23059 | })();
|
23060 | var CellMouseListenerFeature = (function (_super) {
|
23061 | __extends$X(CellMouseListenerFeature, _super);
|
23062 | function CellMouseListenerFeature(ctrl, beans, column) {
|
23063 | var _this = _super.call(this) || this;
|
23064 | _this.cellCtrl = ctrl;
|
23065 | _this.beans = beans;
|
23066 | _this.column = column;
|
23067 | return _this;
|
23068 | }
|
23069 | CellMouseListenerFeature.prototype.onMouseEvent = function (eventName, mouseEvent) {
|
23070 | if (isStopPropagationForAgGrid(mouseEvent)) {
|
23071 | return;
|
23072 | }
|
23073 | switch (eventName) {
|
23074 | case 'click':
|
23075 | this.onCellClicked(mouseEvent);
|
23076 | break;
|
23077 | case 'mousedown':
|
23078 | case 'touchstart':
|
23079 | this.onMouseDown(mouseEvent);
|
23080 | break;
|
23081 | case 'dblclick':
|
23082 | this.onCellDoubleClicked(mouseEvent);
|
23083 | break;
|
23084 | case 'mouseout':
|
23085 | this.onMouseOut(mouseEvent);
|
23086 | break;
|
23087 | case 'mouseover':
|
23088 | this.onMouseOver(mouseEvent);
|
23089 | break;
|
23090 | }
|
23091 | };
|
23092 | CellMouseListenerFeature.prototype.onCellClicked = function (mouseEvent) {
|
23093 |
|
23094 | if (this.isDoubleClickOnIPad()) {
|
23095 | this.onCellDoubleClicked(mouseEvent);
|
23096 | mouseEvent.preventDefault();
|
23097 | return;
|
23098 | }
|
23099 | var _a = this.beans, eventService = _a.eventService, gridOptionsWrapper = _a.gridOptionsWrapper;
|
23100 | var cellClickedEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_CLICKED);
|
23101 | eventService.dispatchEvent(cellClickedEvent);
|
23102 | var colDef = this.column.getColDef();
|
23103 | if (colDef.onCellClicked) {
|
23104 |
|
23105 | window.setTimeout(function () { return colDef.onCellClicked(cellClickedEvent); }, 0);
|
23106 | }
|
23107 | var editOnSingleClick = (gridOptionsWrapper.isSingleClickEdit() || colDef.singleClickEdit)
|
23108 | && !gridOptionsWrapper.isSuppressClickEdit();
|
23109 | if (editOnSingleClick) {
|
23110 | this.cellCtrl.startRowOrCellEdit();
|
23111 | }
|
23112 | };
|
23113 |
|
23114 | CellMouseListenerFeature.prototype.isDoubleClickOnIPad = function () {
|
23115 | if (!isIOSUserAgent() || isEventSupported('dblclick')) {
|
23116 | return false;
|
23117 | }
|
23118 | var nowMillis = new Date().getTime();
|
23119 | var res = nowMillis - this.lastIPadMouseClickEvent < 200;
|
23120 | this.lastIPadMouseClickEvent = nowMillis;
|
23121 | return res;
|
23122 | };
|
23123 | CellMouseListenerFeature.prototype.onCellDoubleClicked = function (mouseEvent) {
|
23124 | var colDef = this.column.getColDef();
|
23125 |
|
23126 | var cellDoubleClickedEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_DOUBLE_CLICKED);
|
23127 | this.beans.eventService.dispatchEvent(cellDoubleClickedEvent);
|
23128 |
|
23129 | if (typeof colDef.onCellDoubleClicked === 'function') {
|
23130 |
|
23131 | window.setTimeout(function () { return colDef.onCellDoubleClicked(cellDoubleClickedEvent); }, 0);
|
23132 | }
|
23133 | var editOnDoubleClick = !this.beans.gridOptionsWrapper.isSingleClickEdit()
|
23134 | && !this.beans.gridOptionsWrapper.isSuppressClickEdit();
|
23135 | if (editOnDoubleClick) {
|
23136 | this.cellCtrl.startRowOrCellEdit(null, null, mouseEvent);
|
23137 | }
|
23138 | };
|
23139 | CellMouseListenerFeature.prototype.onMouseDown = function (mouseEvent) {
|
23140 | var ctrlKey = mouseEvent.ctrlKey, metaKey = mouseEvent.metaKey, shiftKey = mouseEvent.shiftKey;
|
23141 | var target = mouseEvent.target;
|
23142 | var _a = this.beans, eventService = _a.eventService, rangeService = _a.rangeService;
|
23143 |
|
23144 | if (this.isRightClickInExistingRange(mouseEvent)) {
|
23145 | return;
|
23146 | }
|
23147 | var ranges = rangeService && rangeService.getCellRanges().length != 0;
|
23148 | if (!shiftKey || !ranges) {
|
23149 |
|
23150 |
|
23151 |
|
23152 | var forceBrowserFocus = (isBrowserEdge()) && !this.cellCtrl.isEditing() && !isFocusableFormField(target);
|
23153 | this.cellCtrl.focusCell(forceBrowserFocus);
|
23154 | }
|
23155 |
|
23156 |
|
23157 | if (shiftKey && ranges) {
|
23158 |
|
23159 | mouseEvent.preventDefault();
|
23160 | }
|
23161 |
|
23162 |
|
23163 | if (this.containsWidget(target)) {
|
23164 | return;
|
23165 | }
|
23166 | if (rangeService) {
|
23167 | var thisCell = this.cellCtrl.getCellPosition();
|
23168 | if (shiftKey) {
|
23169 | rangeService.extendLatestRangeToCell(thisCell);
|
23170 | }
|
23171 | else {
|
23172 | var ctrlKeyPressed = ctrlKey || metaKey;
|
23173 | rangeService.setRangeToCell(thisCell, ctrlKeyPressed);
|
23174 | }
|
23175 | }
|
23176 | eventService.dispatchEvent(this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_DOWN));
|
23177 | };
|
23178 | CellMouseListenerFeature.prototype.isRightClickInExistingRange = function (mouseEvent) {
|
23179 | var rangeService = this.beans.rangeService;
|
23180 | if (rangeService) {
|
23181 | var cellInRange = rangeService.isCellInAnyRange(this.cellCtrl.getCellPosition());
|
23182 | if (cellInRange && mouseEvent.button === 2) {
|
23183 | return true;
|
23184 | }
|
23185 | }
|
23186 | return false;
|
23187 | };
|
23188 | CellMouseListenerFeature.prototype.containsWidget = function (target) {
|
23189 | return isElementChildOfClass(target, 'ag-selection-checkbox', 3);
|
23190 | };
|
23191 | CellMouseListenerFeature.prototype.onMouseOut = function (mouseEvent) {
|
23192 | if (this.mouseStayingInsideCell(mouseEvent)) {
|
23193 | return;
|
23194 | }
|
23195 | var cellMouseOutEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_OUT);
|
23196 | this.beans.eventService.dispatchEvent(cellMouseOutEvent);
|
23197 | this.beans.columnHoverService.clearMouseOver();
|
23198 | };
|
23199 | CellMouseListenerFeature.prototype.onMouseOver = function (mouseEvent) {
|
23200 | if (this.mouseStayingInsideCell(mouseEvent)) {
|
23201 | return;
|
23202 | }
|
23203 | var cellMouseOverEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_OVER);
|
23204 | this.beans.eventService.dispatchEvent(cellMouseOverEvent);
|
23205 | this.beans.columnHoverService.setMouseOver([this.column]);
|
23206 | };
|
23207 | CellMouseListenerFeature.prototype.mouseStayingInsideCell = function (e) {
|
23208 | if (!e.target || !e.relatedTarget) {
|
23209 | return false;
|
23210 | }
|
23211 | var eGui = this.cellCtrl.getGui();
|
23212 | var cellContainsTarget = eGui.contains(e.target);
|
23213 | var cellContainsRelatedTarget = eGui.contains(e.relatedTarget);
|
23214 | return cellContainsTarget && cellContainsRelatedTarget;
|
23215 | };
|
23216 | CellMouseListenerFeature.prototype.destroy = function () {
|
23217 | };
|
23218 | return CellMouseListenerFeature;
|
23219 | }(Beans));
|
23220 |
|
23221 |
|
23222 |
|
23223 |
|
23224 |
|
23225 |
|
23226 |
|
23227 | var __extends$Y = (undefined && undefined.__extends) || (function () {
|
23228 | var extendStatics = function (d, b) {
|
23229 | extendStatics = Object.setPrototypeOf ||
|
23230 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
23231 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
23232 | return extendStatics(d, b);
|
23233 | };
|
23234 | return function (d, b) {
|
23235 | extendStatics(d, b);
|
23236 | function __() { this.constructor = d; }
|
23237 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
23238 | };
|
23239 | })();
|
23240 | var CellKeyboardListenerFeature = (function (_super) {
|
23241 | __extends$Y(CellKeyboardListenerFeature, _super);
|
23242 | function CellKeyboardListenerFeature(ctrl, beans, column, rowNode, rowCtrl) {
|
23243 | var _this = _super.call(this) || this;
|
23244 | _this.cellCtrl = ctrl;
|
23245 | _this.beans = beans;
|
23246 | _this.rowNode = rowNode;
|
23247 | _this.rowCtrl = rowCtrl;
|
23248 | return _this;
|
23249 | }
|
23250 | CellKeyboardListenerFeature.prototype.setComp = function (eGui) {
|
23251 | this.eGui = eGui;
|
23252 | };
|
23253 | CellKeyboardListenerFeature.prototype.onKeyDown = function (event) {
|
23254 | var key = event.key;
|
23255 | switch (key) {
|
23256 | case KeyCode.ENTER:
|
23257 | this.onEnterKeyDown(event);
|
23258 | break;
|
23259 | case KeyCode.F2:
|
23260 | this.onF2KeyDown(event);
|
23261 | break;
|
23262 | case KeyCode.ESCAPE:
|
23263 | this.onEscapeKeyDown(event);
|
23264 | break;
|
23265 | case KeyCode.TAB:
|
23266 | this.onTabKeyDown(event);
|
23267 | break;
|
23268 | case KeyCode.BACKSPACE:
|
23269 | case KeyCode.DELETE:
|
23270 | this.onBackspaceOrDeleteKeyPressed(key, event);
|
23271 | break;
|
23272 | case KeyCode.DOWN:
|
23273 | case KeyCode.UP:
|
23274 | case KeyCode.RIGHT:
|
23275 | case KeyCode.LEFT:
|
23276 | this.onNavigationKeyPressed(event, key);
|
23277 | break;
|
23278 | }
|
23279 | };
|
23280 | CellKeyboardListenerFeature.prototype.onNavigationKeyPressed = function (event, key) {
|
23281 | if (this.cellCtrl.isEditing()) {
|
23282 | return;
|
23283 | }
|
23284 | if (event.shiftKey && this.cellCtrl.isRangeSelectionEnabled()) {
|
23285 | this.onShiftRangeSelect(event);
|
23286 | }
|
23287 | else {
|
23288 | this.beans.navigationService.navigateToNextCell(event, key, this.cellCtrl.getCellPosition(), true);
|
23289 | }
|
23290 |
|
23291 | event.preventDefault();
|
23292 | };
|
23293 | CellKeyboardListenerFeature.prototype.onShiftRangeSelect = function (event) {
|
23294 | if (!this.beans.rangeService) {
|
23295 | return;
|
23296 | }
|
23297 | var endCell = this.beans.rangeService.extendLatestRangeInDirection(event);
|
23298 | if (endCell) {
|
23299 | this.beans.navigationService.ensureCellVisible(endCell);
|
23300 | }
|
23301 | };
|
23302 | CellKeyboardListenerFeature.prototype.onTabKeyDown = function (event) {
|
23303 | this.beans.navigationService.onTabKeyDown(this.cellCtrl, event);
|
23304 | };
|
23305 | CellKeyboardListenerFeature.prototype.onBackspaceOrDeleteKeyPressed = function (key, event) {
|
23306 | if (!this.cellCtrl.isEditing()) {
|
23307 | this.cellCtrl.startRowOrCellEdit(key, undefined, event);
|
23308 | }
|
23309 | };
|
23310 | CellKeyboardListenerFeature.prototype.onEnterKeyDown = function (e) {
|
23311 | if (this.cellCtrl.isEditing() || this.rowCtrl.isEditing()) {
|
23312 | this.cellCtrl.stopEditingAndFocus();
|
23313 | }
|
23314 | else {
|
23315 | if (this.beans.gridOptionsWrapper.isEnterMovesDown()) {
|
23316 | this.beans.navigationService.navigateToNextCell(null, KeyCode.DOWN, this.cellCtrl.getCellPosition(), false);
|
23317 | }
|
23318 | else {
|
23319 | this.cellCtrl.startRowOrCellEdit(KeyCode.ENTER, undefined, e);
|
23320 | if (this.cellCtrl.isEditing()) {
|
23321 |
|
23322 |
|
23323 |
|
23324 |
|
23325 | e.preventDefault();
|
23326 | }
|
23327 | }
|
23328 | }
|
23329 | };
|
23330 | CellKeyboardListenerFeature.prototype.onF2KeyDown = function (event) {
|
23331 | if (!this.cellCtrl.isEditing()) {
|
23332 | this.cellCtrl.startRowOrCellEdit(KeyCode.F2, undefined, event);
|
23333 | }
|
23334 | };
|
23335 | CellKeyboardListenerFeature.prototype.onEscapeKeyDown = function (event) {
|
23336 | if (this.cellCtrl.isEditing()) {
|
23337 | this.cellCtrl.stopRowOrCellEdit(true);
|
23338 | this.cellCtrl.focusCell(true);
|
23339 | }
|
23340 | };
|
23341 | CellKeyboardListenerFeature.prototype.onKeyPress = function (event) {
|
23342 |
|
23343 |
|
23344 | var eventTarget = event.target;
|
23345 | var eventOnChildComponent = eventTarget !== this.eGui;
|
23346 | if (eventOnChildComponent || this.cellCtrl.isEditing()) {
|
23347 | return;
|
23348 | }
|
23349 | var pressedChar = String.fromCharCode(event.charCode);
|
23350 | if (pressedChar === ' ') {
|
23351 | this.onSpaceKeyPressed(event);
|
23352 | }
|
23353 | else if (isEventFromPrintableCharacter(event)) {
|
23354 | this.cellCtrl.startRowOrCellEdit(null, pressedChar, event);
|
23355 |
|
23356 |
|
23357 |
|
23358 |
|
23359 |
|
23360 | event.preventDefault();
|
23361 | }
|
23362 | };
|
23363 | CellKeyboardListenerFeature.prototype.onSpaceKeyPressed = function (event) {
|
23364 | var gridOptionsWrapper = this.beans.gridOptionsWrapper;
|
23365 | if (!this.cellCtrl.isEditing() && gridOptionsWrapper.isRowSelection()) {
|
23366 | var currentSelection = this.rowNode.isSelected();
|
23367 | var newSelection = !currentSelection;
|
23368 | if (newSelection || !gridOptionsWrapper.isSuppressRowDeselection()) {
|
23369 | var groupSelectsFiltered = this.beans.gridOptionsWrapper.isGroupSelectsFiltered();
|
23370 | var updatedCount = this.rowNode.setSelectedParams({
|
23371 | newValue: newSelection,
|
23372 | rangeSelect: event.shiftKey,
|
23373 | groupSelectsFiltered: groupSelectsFiltered
|
23374 | });
|
23375 | if (currentSelection === undefined && updatedCount === 0) {
|
23376 | this.rowNode.setSelectedParams({
|
23377 | newValue: false,
|
23378 | rangeSelect: event.shiftKey,
|
23379 | groupSelectsFiltered: groupSelectsFiltered
|
23380 | });
|
23381 | }
|
23382 | }
|
23383 | }
|
23384 |
|
23385 | event.preventDefault();
|
23386 | };
|
23387 | CellKeyboardListenerFeature.prototype.destroy = function () {
|
23388 | };
|
23389 | return CellKeyboardListenerFeature;
|
23390 | }(BeanStub));
|
23391 |
|
23392 |
|
23393 |
|
23394 |
|
23395 |
|
23396 |
|
23397 |
|
23398 | var __extends$Z = (undefined && undefined.__extends) || (function () {
|
23399 | var extendStatics = function (d, b) {
|
23400 | extendStatics = Object.setPrototypeOf ||
|
23401 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
23402 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
23403 | return extendStatics(d, b);
|
23404 | };
|
23405 | return function (d, b) {
|
23406 | extendStatics(d, b);
|
23407 | function __() { this.constructor = d; }
|
23408 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
23409 | };
|
23410 | })();
|
23411 | var __decorate$O = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
23412 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
23413 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
23414 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
23415 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
23416 | };
|
23417 | var DndSourceComp = (function (_super) {
|
23418 | __extends$Z(DndSourceComp, _super);
|
23419 | function DndSourceComp(rowNode, column, beans, eCell) {
|
23420 | var _this = _super.call(this, "<div class=\"ag-drag-handle ag-row-drag\" draggable=\"true\"></div>") || this;
|
23421 | _this.rowNode = rowNode;
|
23422 | _this.column = column;
|
23423 | _this.beans = beans;
|
23424 | _this.eCell = eCell;
|
23425 | return _this;
|
23426 | }
|
23427 | DndSourceComp.prototype.postConstruct = function () {
|
23428 | var eGui = this.getGui();
|
23429 | eGui.appendChild(createIconNoSpan('rowDrag', this.beans.gridOptionsWrapper, null));
|
23430 |
|
23431 | this.addGuiEventListener('mousedown', function (e) {
|
23432 | e.stopPropagation();
|
23433 | });
|
23434 | this.addDragSource();
|
23435 | this.checkVisibility();
|
23436 | };
|
23437 | DndSourceComp.prototype.addDragSource = function () {
|
23438 | this.addGuiEventListener('dragstart', this.onDragStart.bind(this));
|
23439 | };
|
23440 | DndSourceComp.prototype.onDragStart = function (dragEvent) {
|
23441 | var _this = this;
|
23442 | var providedOnRowDrag = this.column.getColDef().dndSourceOnRowDrag;
|
23443 | dragEvent.dataTransfer.setDragImage(this.eCell, 0, 0);
|
23444 |
|
23445 | var defaultOnRowDrag = function () {
|
23446 | try {
|
23447 | var jsonData = JSON.stringify(_this.rowNode.data);
|
23448 | dragEvent.dataTransfer.setData('application/json', jsonData);
|
23449 | dragEvent.dataTransfer.setData('text/plain', jsonData);
|
23450 | }
|
23451 | catch (e) {
|
23452 |
|
23453 | }
|
23454 | };
|
23455 | if (providedOnRowDrag) {
|
23456 | var params = {
|
23457 | rowNode: this.rowNode, dragEvent: dragEvent,
|
23458 | api: this.gridOptionsWrapper.getApi(),
|
23459 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
23460 | context: this.gridOptionsWrapper.getContext()
|
23461 | };
|
23462 | providedOnRowDrag(params);
|
23463 | }
|
23464 | else {
|
23465 | defaultOnRowDrag();
|
23466 | }
|
23467 | };
|
23468 | DndSourceComp.prototype.checkVisibility = function () {
|
23469 | var visible = this.column.isDndSource(this.rowNode);
|
23470 | this.setDisplayed(visible);
|
23471 | };
|
23472 | __decorate$O([
|
23473 | PostConstruct
|
23474 | ], DndSourceComp.prototype, "postConstruct", null);
|
23475 | return DndSourceComp;
|
23476 | }(Component));
|
23477 |
|
23478 |
|
23479 |
|
23480 |
|
23481 |
|
23482 |
|
23483 |
|
23484 | var __extends$_ = (undefined && undefined.__extends) || (function () {
|
23485 | var extendStatics = function (d, b) {
|
23486 | extendStatics = Object.setPrototypeOf ||
|
23487 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
23488 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
23489 | return extendStatics(d, b);
|
23490 | };
|
23491 | return function (d, b) {
|
23492 | extendStatics(d, b);
|
23493 | function __() { this.constructor = d; }
|
23494 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
23495 | };
|
23496 | })();
|
23497 | var __assign$b = (undefined && undefined.__assign) || function () {
|
23498 | __assign$b = Object.assign || function(t) {
|
23499 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
23500 | s = arguments[i];
|
23501 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
23502 | t[p] = s[p];
|
23503 | }
|
23504 | return t;
|
23505 | };
|
23506 | return __assign$b.apply(this, arguments);
|
23507 | };
|
23508 | var CSS_CELL = 'ag-cell';
|
23509 | var CSS_AUTO_HEIGHT = 'ag-cell-auto-height';
|
23510 | var CSS_NORMAL_HEIGHT = 'ag-cell-normal-height';
|
23511 | var CSS_CELL_FOCUS = 'ag-cell-focus';
|
23512 | var CSS_CELL_FIRST_RIGHT_PINNED = 'ag-cell-first-right-pinned';
|
23513 | var CSS_CELL_LAST_LEFT_PINNED = 'ag-cell-last-left-pinned';
|
23514 | var CSS_CELL_NOT_INLINE_EDITING = 'ag-cell-not-inline-editing';
|
23515 | var CSS_CELL_INLINE_EDITING = 'ag-cell-inline-editing';
|
23516 | var CSS_CELL_POPUP_EDITING = 'ag-cell-popup-editing';
|
23517 | var CSS_COLUMN_HOVER = 'ag-column-hover';
|
23518 | var CSS_CELL_WRAP_TEXT = 'ag-cell-wrap-text';
|
23519 | var instanceIdSequence$1 = 0;
|
23520 | var CellCtrl = (function (_super) {
|
23521 | __extends$_(CellCtrl, _super);
|
23522 | function CellCtrl(column, rowNode, beans, rowCtrl) {
|
23523 | var _this = _super.call(this) || this;
|
23524 | _this.suppressRefreshCell = false;
|
23525 | _this.column = column;
|
23526 | _this.rowNode = rowNode;
|
23527 | _this.beans = beans;
|
23528 | _this.rowCtrl = rowCtrl;
|
23529 |
|
23530 | _this.instanceId = column.getId() + '-' + instanceIdSequence$1++;
|
23531 | _this.createCellPosition();
|
23532 | _this.addFeatures();
|
23533 | return _this;
|
23534 | }
|
23535 | CellCtrl.prototype.addFeatures = function () {
|
23536 | var _this = this;
|
23537 | this.cellPositionFeature = new CellPositionFeature(this, this.beans);
|
23538 | this.addDestroyFunc(function () { return _this.cellPositionFeature.destroy(); });
|
23539 | this.cellCustomStyleFeature = new CellCustomStyleFeature(this, this.beans);
|
23540 | this.addDestroyFunc(function () { return _this.cellCustomStyleFeature.destroy(); });
|
23541 | this.cellMouseListenerFeature = new CellMouseListenerFeature(this, this.beans, this.column);
|
23542 | this.addDestroyFunc(function () { return _this.cellMouseListenerFeature.destroy(); });
|
23543 | this.cellKeyboardListenerFeature = new CellKeyboardListenerFeature(this, this.beans, this.column, this.rowNode, this.rowCtrl);
|
23544 | this.addDestroyFunc(function () { return _this.cellKeyboardListenerFeature.destroy(); });
|
23545 | var rangeSelectionEnabled = this.beans.rangeService && this.beans.gridOptionsWrapper.isEnableRangeSelection();
|
23546 | if (rangeSelectionEnabled) {
|
23547 | this.cellRangeFeature = new CellRangeFeature(this.beans, this);
|
23548 | this.addDestroyFunc(function () { return _this.cellRangeFeature.destroy(); });
|
23549 | }
|
23550 | this.addTooltipFeature();
|
23551 | };
|
23552 | CellCtrl.prototype.addTooltipFeature = function () {
|
23553 | var _this = this;
|
23554 | var getTooltipValue = function () {
|
23555 | var colDef = _this.column.getColDef();
|
23556 | var data = _this.rowNode.data;
|
23557 | if (colDef.tooltipField && exists(data)) {
|
23558 | return getValueUsingField(data, colDef.tooltipField, _this.column.isTooltipFieldContainsDots());
|
23559 | }
|
23560 | var valueGetter = colDef.tooltipValueGetter;
|
23561 | if (valueGetter) {
|
23562 | return valueGetter({
|
23563 | location: 'cell',
|
23564 | api: _this.beans.gridOptionsWrapper.getApi(),
|
23565 | columnApi: _this.beans.gridOptionsWrapper.getColumnApi(),
|
23566 | context: _this.beans.gridOptionsWrapper.getContext(),
|
23567 | colDef: _this.column.getColDef(),
|
23568 | column: _this.column,
|
23569 | rowIndex: _this.cellPosition.rowIndex,
|
23570 | node: _this.rowNode,
|
23571 | data: _this.rowNode.data,
|
23572 | value: _this.value,
|
23573 | valueFormatted: _this.valueFormatted,
|
23574 | });
|
23575 | }
|
23576 | return null;
|
23577 | };
|
23578 | var tooltipCtrl = {
|
23579 | getColumn: function () { return _this.column; },
|
23580 | getColDef: function () { return _this.column.getColDef(); },
|
23581 | getRowIndex: function () { return _this.cellPosition.rowIndex; },
|
23582 | getRowNode: function () { return _this.rowNode; },
|
23583 | getGui: function () { return _this.getGui(); },
|
23584 | getLocation: function () { return 'cell'; },
|
23585 | getTooltipValue: getTooltipValue,
|
23586 |
|
23587 | getValueFormatted: function () { return _this.valueFormatted; }
|
23588 | };
|
23589 | this.tooltipFeature = new TooltipFeature(tooltipCtrl, this.beans);
|
23590 | this.addDestroyFunc(function () { return _this.tooltipFeature.destroy(); });
|
23591 | };
|
23592 | CellCtrl.prototype.setComp = function (comp, eGui, eCellWrapper, printLayout, startEditing) {
|
23593 | this.cellComp = comp;
|
23594 | this.gow = this.beans.gridOptionsWrapper;
|
23595 | this.eGui = eGui;
|
23596 | this.eCellWrapper = eCellWrapper;
|
23597 | this.printLayout = printLayout;
|
23598 |
|
23599 |
|
23600 | this.updateAndFormatValue(true);
|
23601 | this.addDomData();
|
23602 | this.onCellFocused();
|
23603 | this.applyStaticCssClasses();
|
23604 | this.setWrapText();
|
23605 | this.onFirstRightPinnedChanged();
|
23606 | this.onLastLeftPinnedChanged();
|
23607 | this.onColumnHover();
|
23608 | this.setupControlComps();
|
23609 | this.setupAutoHeight();
|
23610 | this.setAriaColIndex();
|
23611 | if (!this.gow.isSuppressCellFocus()) {
|
23612 | this.cellComp.setTabIndex(-1);
|
23613 | }
|
23614 | var colIdSanitised = escapeString(this.column.getId());
|
23615 | this.cellComp.setColId(colIdSanitised);
|
23616 | this.cellComp.setRole('gridcell');
|
23617 | this.cellPositionFeature.setComp(eGui);
|
23618 | this.cellCustomStyleFeature.setComp(comp);
|
23619 | this.tooltipFeature.setComp(comp);
|
23620 | this.cellKeyboardListenerFeature.setComp(this.eGui);
|
23621 | if (this.cellRangeFeature) {
|
23622 | this.cellRangeFeature.setComp(comp, eGui);
|
23623 | }
|
23624 | if (startEditing && this.isCellEditable()) {
|
23625 | this.startEditing();
|
23626 | }
|
23627 | else {
|
23628 | this.showValue();
|
23629 | }
|
23630 | };
|
23631 | CellCtrl.prototype.setupAutoHeight = function () {
|
23632 | var _this = this;
|
23633 | if (!this.column.isAutoHeight()) {
|
23634 | return;
|
23635 | }
|
23636 | var eAutoHeightContainer = this.eCellWrapper;
|
23637 | var eParentCell = eAutoHeightContainer.parentElement;
|
23638 |
|
23639 |
|
23640 | var minRowHeight = this.beans.gridOptionsWrapper.getRowHeightForNode(this.rowNode).height;
|
23641 | var measureHeight = function (timesCalled) {
|
23642 | if (_this.editing) {
|
23643 | return;
|
23644 | }
|
23645 |
|
23646 |
|
23647 | if (!_this.isAlive()) {
|
23648 | return;
|
23649 | }
|
23650 | var _a = getElementSize(eParentCell), paddingTop = _a.paddingTop, paddingBottom = _a.paddingBottom;
|
23651 | var wrapperHeight = eAutoHeightContainer.offsetHeight;
|
23652 | var autoHeight = wrapperHeight + paddingTop + paddingBottom;
|
23653 | if (timesCalled < 5) {
|
23654 |
|
23655 |
|
23656 | var doc = _this.beans.gridOptionsWrapper.getDocument();
|
23657 | var notYetInDom = !doc || !doc.contains(eAutoHeightContainer);
|
23658 |
|
23659 |
|
23660 | var possiblyNoContentYet = autoHeight == 0;
|
23661 | if (notYetInDom || possiblyNoContentYet) {
|
23662 | _this.beans.frameworkOverrides.setTimeout(function () { return measureHeight(timesCalled + 1); }, 0);
|
23663 | return;
|
23664 | }
|
23665 | }
|
23666 | var newHeight = Math.max(autoHeight, minRowHeight);
|
23667 | _this.rowNode.setRowAutoHeight(newHeight, _this.column);
|
23668 | };
|
23669 | var listener = function () { return measureHeight(0); };
|
23670 |
|
23671 | listener();
|
23672 | var destroyResizeObserver = this.beans.resizeObserverService.observeResize(eAutoHeightContainer, listener);
|
23673 | this.addDestroyFunc(function () {
|
23674 | destroyResizeObserver();
|
23675 | _this.rowNode.setRowAutoHeight(undefined, _this.column);
|
23676 | });
|
23677 | };
|
23678 | CellCtrl.prototype.getInstanceId = function () {
|
23679 | return this.instanceId;
|
23680 | };
|
23681 | CellCtrl.prototype.showValue = function (forceNewCellRendererInstance) {
|
23682 | if (forceNewCellRendererInstance === void 0) { forceNewCellRendererInstance = false; }
|
23683 | var valueToDisplay = this.valueFormatted != null ? this.valueFormatted : this.value;
|
23684 | var params = this.createCellRendererParams();
|
23685 | var compDetails = this.beans.userComponentFactory.getCellRendererDetails(this.column.getColDef(), params);
|
23686 | this.cellComp.setRenderDetails(compDetails, valueToDisplay, forceNewCellRendererInstance);
|
23687 | this.refreshHandle();
|
23688 | };
|
23689 | CellCtrl.prototype.setupControlComps = function () {
|
23690 | var colDef = this.column.getColDef();
|
23691 | this.includeSelection = this.isIncludeControl(colDef.checkboxSelection);
|
23692 | this.includeRowDrag = this.isIncludeControl(colDef.rowDrag);
|
23693 | this.includeDndSource = this.isIncludeControl(colDef.dndSource);
|
23694 | this.cellComp.setIncludeSelection(this.includeSelection);
|
23695 | this.cellComp.setIncludeDndSource(this.includeDndSource);
|
23696 | this.cellComp.setIncludeRowDrag(this.includeRowDrag);
|
23697 | };
|
23698 | CellCtrl.prototype.isForceWrapper = function () {
|
23699 |
|
23700 | var forceWrapper = this.beans.gridOptionsWrapper.isEnableCellTextSelection() || this.column.isAutoHeight();
|
23701 | return forceWrapper;
|
23702 | };
|
23703 | CellCtrl.prototype.isIncludeControl = function (value) {
|
23704 | var rowNodePinned = this.rowNode.rowPinned != null;
|
23705 | var isFunc = typeof value === 'function';
|
23706 | var res = rowNodePinned ? false : isFunc || value === true;
|
23707 | return res;
|
23708 | };
|
23709 | CellCtrl.prototype.refreshShouldDestroy = function () {
|
23710 | var colDef = this.column.getColDef();
|
23711 | var selectionChanged = this.includeSelection != this.isIncludeControl(colDef.checkboxSelection);
|
23712 | var rowDragChanged = this.includeRowDrag != this.isIncludeControl(colDef.rowDrag);
|
23713 | var dndSourceChanged = this.includeDndSource != this.isIncludeControl(colDef.dndSource);
|
23714 | return selectionChanged || rowDragChanged || dndSourceChanged;
|
23715 | };
|
23716 |
|
23717 | CellCtrl.prototype.startEditing = function (key, charPress, cellStartedEdit, event) {
|
23718 | if (key === void 0) { key = null; }
|
23719 | if (charPress === void 0) { charPress = null; }
|
23720 | if (cellStartedEdit === void 0) { cellStartedEdit = false; }
|
23721 | if (event === void 0) { event = null; }
|
23722 | var _a, _b;
|
23723 | if (!this.isCellEditable() || this.editing) {
|
23724 | return;
|
23725 | }
|
23726 | var editorParams = this.createCellEditorParams(key, charPress, cellStartedEdit);
|
23727 | var colDef = this.column.getColDef();
|
23728 | var compDetails = this.beans.userComponentFactory.getCellEditorDetails(colDef, editorParams);
|
23729 |
|
23730 | var popup = ((_a = compDetails) === null || _a === void 0 ? void 0 : _a.popupFromSelector) != null ? compDetails.popupFromSelector : !!colDef.cellEditorPopup;
|
23731 | var position = ((_b = compDetails) === null || _b === void 0 ? void 0 : _b.popupPositionFromSelector) != null ? compDetails.popupPositionFromSelector : colDef.cellEditorPopupPosition;
|
23732 | this.setEditing(true, popup);
|
23733 | this.cellComp.setEditDetails(compDetails, popup, position);
|
23734 | var e = this.createEvent(event, Events.EVENT_CELL_EDITING_STARTED);
|
23735 | this.beans.eventService.dispatchEvent(e);
|
23736 | };
|
23737 | CellCtrl.prototype.setEditing = function (editing, inPopup) {
|
23738 | if (inPopup === void 0) { inPopup = false; }
|
23739 | if (this.editing === editing) {
|
23740 | return;
|
23741 | }
|
23742 | this.editing = editing;
|
23743 | this.editingInPopup = inPopup;
|
23744 | this.setInlineEditingClass();
|
23745 | };
|
23746 |
|
23747 | CellCtrl.prototype.stopRowOrCellEdit = function (cancel) {
|
23748 | if (cancel === void 0) { cancel = false; }
|
23749 | if (this.beans.gridOptionsWrapper.isFullRowEdit()) {
|
23750 | this.rowCtrl.stopRowEditing(cancel);
|
23751 | }
|
23752 | else {
|
23753 | this.stopEditing(cancel);
|
23754 | }
|
23755 | };
|
23756 | CellCtrl.prototype.onPopupEditorClosed = function () {
|
23757 | if (!this.isEditing()) {
|
23758 | return;
|
23759 | }
|
23760 |
|
23761 |
|
23762 |
|
23763 | this.stopEditingAndFocus();
|
23764 | };
|
23765 | CellCtrl.prototype.takeValueFromCellEditor = function (cancel) {
|
23766 | var noValueResult = { newValueExists: false };
|
23767 | if (cancel) {
|
23768 | return noValueResult;
|
23769 | }
|
23770 | var cellEditor = this.cellComp.getCellEditor();
|
23771 | if (!cellEditor) {
|
23772 | return noValueResult;
|
23773 | }
|
23774 | var userWantsToCancel = cellEditor.isCancelAfterEnd && cellEditor.isCancelAfterEnd();
|
23775 | if (userWantsToCancel) {
|
23776 | return noValueResult;
|
23777 | }
|
23778 | var newValue = cellEditor.getValue();
|
23779 | return {
|
23780 | newValue: newValue,
|
23781 | newValueExists: true
|
23782 | };
|
23783 | };
|
23784 | |
23785 |
|
23786 |
|
23787 | CellCtrl.prototype.saveNewValue = function (oldValue, newValue) {
|
23788 | if (newValue === oldValue) {
|
23789 | return false;
|
23790 | }
|
23791 | if (this.beans.gridOptionsWrapper.isReadOnlyEdit()) {
|
23792 | this.dispatchEventForSaveValueReadOnly(oldValue, newValue);
|
23793 | return false;
|
23794 | }
|
23795 |
|
23796 |
|
23797 |
|
23798 |
|
23799 | this.suppressRefreshCell = true;
|
23800 | var valueChanged = this.rowNode.setDataValue(this.column, newValue);
|
23801 | this.suppressRefreshCell = false;
|
23802 | return valueChanged;
|
23803 | };
|
23804 | CellCtrl.prototype.dispatchEventForSaveValueReadOnly = function (oldValue, newValue) {
|
23805 | var rowNode = this.rowNode;
|
23806 | var event = {
|
23807 | type: Events.EVENT_CELL_EDIT_REQUEST,
|
23808 | event: null,
|
23809 | rowIndex: rowNode.rowIndex,
|
23810 | rowPinned: rowNode.rowPinned,
|
23811 | column: this.column,
|
23812 | api: this.beans.gridApi,
|
23813 | columnApi: this.beans.columnApi,
|
23814 | colDef: this.column.getColDef(),
|
23815 | context: this.beans.gridOptionsWrapper.getContext(),
|
23816 | data: rowNode.data,
|
23817 | node: rowNode,
|
23818 | oldValue: oldValue,
|
23819 | newValue: newValue,
|
23820 | value: newValue,
|
23821 | source: undefined
|
23822 | };
|
23823 | this.beans.eventService.dispatchEvent(event);
|
23824 | };
|
23825 | |
23826 |
|
23827 |
|
23828 |
|
23829 |
|
23830 | CellCtrl.prototype.stopEditing = function (cancel) {
|
23831 | if (cancel === void 0) { cancel = false; }
|
23832 | if (!this.editing) {
|
23833 | return false;
|
23834 | }
|
23835 | var _a = this.takeValueFromCellEditor(cancel), newValue = _a.newValue, newValueExists = _a.newValueExists;
|
23836 | var oldValue = this.getValueFromValueService();
|
23837 | var valueChanged = false;
|
23838 | if (newValueExists) {
|
23839 | valueChanged = this.saveNewValue(oldValue, newValue);
|
23840 | }
|
23841 | this.setEditing(false);
|
23842 | this.cellComp.setEditDetails();
|
23843 | this.updateAndFormatValue();
|
23844 | this.refreshCell({ forceRefresh: true, suppressFlash: true });
|
23845 | this.dispatchEditingStoppedEvent(oldValue, newValue);
|
23846 | return valueChanged;
|
23847 | };
|
23848 | CellCtrl.prototype.dispatchEditingStoppedEvent = function (oldValue, newValue) {
|
23849 | var editingStoppedEvent = __assign$b(__assign$b({}, this.createEvent(null, Events.EVENT_CELL_EDITING_STOPPED)), { oldValue: oldValue,
|
23850 | newValue: newValue });
|
23851 | this.beans.eventService.dispatchEvent(editingStoppedEvent);
|
23852 | };
|
23853 |
|
23854 |
|
23855 | CellCtrl.prototype.setInlineEditingClass = function () {
|
23856 | if (!this.isAlive()) {
|
23857 | return;
|
23858 | }
|
23859 |
|
23860 |
|
23861 |
|
23862 |
|
23863 |
|
23864 |
|
23865 | var editingInline = this.editing && !this.editingInPopup;
|
23866 | var popupEditorShowing = this.editing && this.editingInPopup;
|
23867 | this.cellComp.addOrRemoveCssClass(CSS_CELL_INLINE_EDITING, editingInline);
|
23868 | this.cellComp.addOrRemoveCssClass(CSS_CELL_NOT_INLINE_EDITING, !editingInline);
|
23869 | this.cellComp.addOrRemoveCssClass(CSS_CELL_POPUP_EDITING, popupEditorShowing);
|
23870 | this.rowCtrl.setInlineEditingCss(this.editing);
|
23871 | };
|
23872 |
|
23873 |
|
23874 | CellCtrl.prototype.hackSayEditingInPopup = function () {
|
23875 | if (this.editingInPopup) {
|
23876 | return;
|
23877 | }
|
23878 | this.editingInPopup = true;
|
23879 | this.setInlineEditingClass();
|
23880 | };
|
23881 | CellCtrl.prototype.createCellEditorParams = function (key, charPress, cellStartedEdit) {
|
23882 | var res = {
|
23883 | value: this.getValueFromValueService(),
|
23884 | key: key,
|
23885 | eventKey: key,
|
23886 | charPress: charPress,
|
23887 | column: this.column,
|
23888 | colDef: this.column.getColDef(),
|
23889 | rowIndex: this.getCellPosition().rowIndex,
|
23890 | node: this.rowNode,
|
23891 | data: this.rowNode.data,
|
23892 | api: this.beans.gridOptionsWrapper.getApi(),
|
23893 | cellStartedEdit: cellStartedEdit,
|
23894 | columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
|
23895 | context: this.beans.gridOptionsWrapper.getContext(),
|
23896 | onKeyDown: this.onKeyDown.bind(this),
|
23897 | stopEditing: this.stopEditingAndFocus.bind(this),
|
23898 | eGridCell: this.getGui(),
|
23899 | parseValue: this.parseValue.bind(this),
|
23900 | formatValue: this.formatValue.bind(this)
|
23901 | };
|
23902 | return res;
|
23903 | };
|
23904 | CellCtrl.prototype.createCellRendererParams = function () {
|
23905 | var _this = this;
|
23906 | var addRowCompListener = function (eventType, listener) {
|
23907 | 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.');
|
23908 | _this.rowCtrl.addEventListener(eventType, listener);
|
23909 | };
|
23910 | var res = {
|
23911 | value: this.value,
|
23912 | valueFormatted: this.valueFormatted,
|
23913 | getValue: this.getValueFromValueService.bind(this),
|
23914 | setValue: function (value) { return _this.beans.valueService.setValue(_this.rowNode, _this.column, value); },
|
23915 | formatValue: this.formatValue.bind(this),
|
23916 | data: this.rowNode.data,
|
23917 | node: this.rowNode,
|
23918 | colDef: this.column.getColDef(),
|
23919 | column: this.column,
|
23920 | rowIndex: this.getCellPosition().rowIndex,
|
23921 | api: this.beans.gridOptionsWrapper.getApi(),
|
23922 | columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
|
23923 | context: this.beans.gridOptionsWrapper.getContext(),
|
23924 | refreshCell: this.refreshCell.bind(this),
|
23925 | eGridCell: this.getGui(),
|
23926 | eParentOfValue: this.cellComp.getParentOfValue(),
|
23927 | registerRowDragger: function (rowDraggerElement, dragStartPixels, value, suppressVisibilityChange) { return _this.registerRowDragger(rowDraggerElement, dragStartPixels, suppressVisibilityChange); },
|
23928 |
|
23929 |
|
23930 |
|
23931 |
|
23932 |
|
23933 | addRowCompListener: addRowCompListener
|
23934 | };
|
23935 | return res;
|
23936 | };
|
23937 | CellCtrl.prototype.parseValue = function (newValue) {
|
23938 | var colDef = this.column.getColDef();
|
23939 | var params = {
|
23940 | node: this.rowNode,
|
23941 | data: this.rowNode.data,
|
23942 | oldValue: this.getValue(),
|
23943 | newValue: newValue,
|
23944 | colDef: colDef,
|
23945 | column: this.column,
|
23946 | api: this.beans.gridOptionsWrapper.getApi(),
|
23947 | columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
|
23948 | context: this.beans.gridOptionsWrapper.getContext()
|
23949 | };
|
23950 | var valueParser = colDef.valueParser;
|
23951 | return exists(valueParser) ? this.beans.expressionService.evaluate(valueParser, params) : newValue;
|
23952 | };
|
23953 | CellCtrl.prototype.setFocusOutOnEditor = function () {
|
23954 | if (!this.editing) {
|
23955 | return;
|
23956 | }
|
23957 | var cellEditor = this.cellComp.getCellEditor();
|
23958 | if (cellEditor && cellEditor.focusOut) {
|
23959 | cellEditor.focusOut();
|
23960 | }
|
23961 | };
|
23962 | CellCtrl.prototype.setFocusInOnEditor = function () {
|
23963 | if (!this.editing) {
|
23964 | return;
|
23965 | }
|
23966 | var cellEditor = this.cellComp.getCellEditor();
|
23967 | if (cellEditor && cellEditor.focusIn) {
|
23968 |
|
23969 | cellEditor.focusIn();
|
23970 | }
|
23971 | else {
|
23972 |
|
23973 |
|
23974 |
|
23975 | this.focusCell(true);
|
23976 | }
|
23977 | };
|
23978 | CellCtrl.prototype.onCellChanged = function (event) {
|
23979 |
|
23980 |
|
23981 | if (!this.cellComp) {
|
23982 | return;
|
23983 | }
|
23984 | var eventImpactsThisCell = event.column === this.column;
|
23985 | if (eventImpactsThisCell) {
|
23986 | this.refreshCell({});
|
23987 | }
|
23988 | };
|
23989 |
|
23990 |
|
23991 |
|
23992 |
|
23993 |
|
23994 |
|
23995 | CellCtrl.prototype.refreshCell = function (params) {
|
23996 |
|
23997 | if (this.suppressRefreshCell || this.editing) {
|
23998 | return;
|
23999 | }
|
24000 |
|
24001 |
|
24002 |
|
24003 | if (!this.cellComp) {
|
24004 | return;
|
24005 | }
|
24006 | var colDef = this.column.getColDef();
|
24007 | var newData = params != null && !!params.newData;
|
24008 | var suppressFlash = (params != null && !!params.suppressFlash) || !!colDef.suppressCellFlash;
|
24009 |
|
24010 |
|
24011 |
|
24012 |
|
24013 |
|
24014 |
|
24015 | var noValueProvided = colDef.field == null && colDef.valueGetter == null && colDef.showRowGroup == null;
|
24016 | var forceRefresh = (params && params.forceRefresh) || noValueProvided || newData;
|
24017 | var valuesDifferent = this.updateAndFormatValue();
|
24018 | var dataNeedsUpdating = forceRefresh || valuesDifferent;
|
24019 | if (dataNeedsUpdating) {
|
24020 |
|
24021 |
|
24022 |
|
24023 | this.showValue(newData);
|
24024 |
|
24025 |
|
24026 | var processingFilterChange = this.beans.filterManager.isSuppressFlashingCellsBecauseFiltering();
|
24027 | var flashCell = !suppressFlash && !processingFilterChange &&
|
24028 | (this.beans.gridOptionsWrapper.isEnableCellChangeFlash() || colDef.enableCellChangeFlash);
|
24029 | if (flashCell) {
|
24030 | this.flashCell();
|
24031 | }
|
24032 | this.cellCustomStyleFeature.applyUserStyles();
|
24033 | this.cellCustomStyleFeature.applyClassesFromColDef();
|
24034 | }
|
24035 | this.refreshToolTip();
|
24036 |
|
24037 |
|
24038 | this.cellCustomStyleFeature.applyCellClassRules();
|
24039 | };
|
24040 |
|
24041 |
|
24042 | CellCtrl.prototype.stopEditingAndFocus = function (suppressNavigateAfterEdit) {
|
24043 | if (suppressNavigateAfterEdit === void 0) { suppressNavigateAfterEdit = false; }
|
24044 | this.stopRowOrCellEdit();
|
24045 | this.focusCell(true);
|
24046 | if (!suppressNavigateAfterEdit) {
|
24047 | this.navigateAfterEdit();
|
24048 | }
|
24049 | };
|
24050 | CellCtrl.prototype.navigateAfterEdit = function () {
|
24051 | var fullRowEdit = this.beans.gridOptionsWrapper.isFullRowEdit();
|
24052 | if (fullRowEdit) {
|
24053 | return;
|
24054 | }
|
24055 | var enterMovesDownAfterEdit = this.beans.gridOptionsWrapper.isEnterMovesDownAfterEdit();
|
24056 | if (enterMovesDownAfterEdit) {
|
24057 | this.beans.navigationService.navigateToNextCell(null, KeyCode.DOWN, this.getCellPosition(), false);
|
24058 | }
|
24059 | };
|
24060 |
|
24061 | CellCtrl.prototype.flashCell = function (delays) {
|
24062 | var flashDelay = delays && delays.flashDelay;
|
24063 | var fadeDelay = delays && delays.fadeDelay;
|
24064 | this.animateCell('data-changed', flashDelay, fadeDelay);
|
24065 | };
|
24066 | CellCtrl.prototype.animateCell = function (cssName, flashDelay, fadeDelay) {
|
24067 | var _this = this;
|
24068 | var fullName = "ag-cell-" + cssName;
|
24069 | var animationFullName = "ag-cell-" + cssName + "-animation";
|
24070 | var gridOptionsWrapper = this.beans.gridOptionsWrapper;
|
24071 | if (!flashDelay) {
|
24072 | flashDelay = gridOptionsWrapper.getCellFlashDelay();
|
24073 | }
|
24074 | if (!exists(fadeDelay)) {
|
24075 | fadeDelay = gridOptionsWrapper.getCellFadeDelay();
|
24076 | }
|
24077 |
|
24078 | this.cellComp.addOrRemoveCssClass(fullName, true);
|
24079 | this.cellComp.addOrRemoveCssClass(animationFullName, false);
|
24080 |
|
24081 | window.setTimeout(function () {
|
24082 | _this.cellComp.addOrRemoveCssClass(fullName, false);
|
24083 | _this.cellComp.addOrRemoveCssClass(animationFullName, true);
|
24084 | _this.eGui.style.transition = "background-color " + fadeDelay + "ms";
|
24085 | window.setTimeout(function () {
|
24086 |
|
24087 | _this.cellComp.addOrRemoveCssClass(animationFullName, false);
|
24088 | _this.eGui.style.transition = '';
|
24089 | }, fadeDelay);
|
24090 | }, flashDelay);
|
24091 | };
|
24092 | CellCtrl.prototype.onFlashCells = function (event) {
|
24093 | if (!this.cellComp) {
|
24094 | return;
|
24095 | }
|
24096 | var cellId = this.beans.cellPositionUtils.createId(this.getCellPosition());
|
24097 | var shouldFlash = event.cells[cellId];
|
24098 | if (shouldFlash) {
|
24099 | this.animateCell('highlight');
|
24100 | }
|
24101 | };
|
24102 | CellCtrl.prototype.isCellEditable = function () {
|
24103 | return this.column.isCellEditable(this.rowNode);
|
24104 | };
|
24105 | CellCtrl.prototype.isSuppressFillHandle = function () {
|
24106 | return this.column.isSuppressFillHandle();
|
24107 | };
|
24108 | CellCtrl.prototype.formatValue = function (value) {
|
24109 | var res = this.callValueFormatter(value);
|
24110 | return res != null ? res : value;
|
24111 | };
|
24112 | CellCtrl.prototype.callValueFormatter = function (value) {
|
24113 | return this.beans.valueFormatterService.formatValue(this.column, this.rowNode, value);
|
24114 | };
|
24115 | CellCtrl.prototype.updateAndFormatValue = function (force) {
|
24116 | if (force === void 0) { force = false; }
|
24117 | var oldValue = this.value;
|
24118 | var oldValueFormatted = this.valueFormatted;
|
24119 | this.value = this.getValueFromValueService();
|
24120 | this.valueFormatted = this.callValueFormatter(this.value);
|
24121 | var valuesDifferent = force ? true :
|
24122 | !this.valuesAreEqual(oldValue, this.value) || this.valueFormatted != oldValueFormatted;
|
24123 | return valuesDifferent;
|
24124 | };
|
24125 | CellCtrl.prototype.valuesAreEqual = function (val1, val2) {
|
24126 |
|
24127 | var colDef = this.column.getColDef();
|
24128 | return colDef.equals ? colDef.equals(val1, val2) : val1 === val2;
|
24129 | };
|
24130 | CellCtrl.prototype.getComp = function () {
|
24131 | return this.cellComp;
|
24132 | };
|
24133 | CellCtrl.prototype.getValueFromValueService = function () {
|
24134 |
|
24135 |
|
24136 |
|
24137 |
|
24138 | var lockedClosedGroup = this.rowNode.leafGroup && this.beans.columnModel.isPivotMode();
|
24139 | var isOpenGroup = this.rowNode.group && this.rowNode.expanded && !this.rowNode.footer && !lockedClosedGroup;
|
24140 |
|
24141 | var groupFootersEnabled = this.beans.gridOptionsWrapper.isGroupIncludeFooter();
|
24142 |
|
24143 | var groupAlwaysShowAggData = this.beans.gridOptionsWrapper.isGroupSuppressBlankHeader();
|
24144 |
|
24145 |
|
24146 | var ignoreAggData = (isOpenGroup && groupFootersEnabled) && !groupAlwaysShowAggData;
|
24147 | var value = this.beans.valueService.getValue(this.column, this.rowNode, false, ignoreAggData);
|
24148 | return value;
|
24149 | };
|
24150 | CellCtrl.prototype.getValue = function () {
|
24151 | return this.value;
|
24152 | };
|
24153 | CellCtrl.prototype.getValueFormatted = function () {
|
24154 | return this.valueFormatted;
|
24155 | };
|
24156 | CellCtrl.prototype.addDomData = function () {
|
24157 | var _this = this;
|
24158 | var element = this.getGui();
|
24159 | this.beans.gridOptionsWrapper.setDomData(element, CellCtrl.DOM_DATA_KEY_CELL_CTRL, this);
|
24160 | this.addDestroyFunc(function () { return _this.beans.gridOptionsWrapper.setDomData(element, CellCtrl.DOM_DATA_KEY_CELL_CTRL, null); });
|
24161 | };
|
24162 | CellCtrl.prototype.createEvent = function (domEvent, eventType) {
|
24163 | var event = {
|
24164 | type: eventType,
|
24165 | node: this.rowNode,
|
24166 | data: this.rowNode.data,
|
24167 | value: this.value,
|
24168 | column: this.column,
|
24169 | colDef: this.column.getColDef(),
|
24170 | context: this.beans.gridOptionsWrapper.getContext(),
|
24171 | api: this.beans.gridApi,
|
24172 | columnApi: this.beans.columnApi,
|
24173 | rowPinned: this.rowNode.rowPinned,
|
24174 | event: domEvent,
|
24175 | rowIndex: this.rowNode.rowIndex
|
24176 | };
|
24177 | return event;
|
24178 | };
|
24179 | CellCtrl.prototype.onKeyPress = function (event) {
|
24180 | this.cellKeyboardListenerFeature.onKeyPress(event);
|
24181 | };
|
24182 | CellCtrl.prototype.onKeyDown = function (event) {
|
24183 | this.cellKeyboardListenerFeature.onKeyDown(event);
|
24184 | };
|
24185 | CellCtrl.prototype.onMouseEvent = function (eventName, mouseEvent) {
|
24186 | this.cellMouseListenerFeature.onMouseEvent(eventName, mouseEvent);
|
24187 | };
|
24188 | CellCtrl.prototype.getGui = function () {
|
24189 | return this.eGui;
|
24190 | };
|
24191 | CellCtrl.prototype.refreshToolTip = function () {
|
24192 | this.tooltipFeature.refreshToolTip();
|
24193 | };
|
24194 | CellCtrl.prototype.getColSpanningList = function () {
|
24195 | return this.cellPositionFeature.getColSpanningList();
|
24196 | };
|
24197 | CellCtrl.prototype.onLeftChanged = function () {
|
24198 | if (!this.cellComp) {
|
24199 | return;
|
24200 | }
|
24201 | this.cellPositionFeature.onLeftChanged();
|
24202 | };
|
24203 | CellCtrl.prototype.onDisplayedColumnsChanged = function () {
|
24204 | if (!this.eGui) {
|
24205 | return;
|
24206 | }
|
24207 | this.setAriaColIndex();
|
24208 | };
|
24209 | CellCtrl.prototype.setAriaColIndex = function () {
|
24210 | var colIdx = this.beans.columnModel.getAriaColumnIndex(this.column);
|
24211 | setAriaColIndex(this.getGui(), colIdx);
|
24212 | };
|
24213 | CellCtrl.prototype.isSuppressNavigable = function () {
|
24214 | return this.column.isSuppressNavigable(this.rowNode);
|
24215 | };
|
24216 | CellCtrl.prototype.onWidthChanged = function () {
|
24217 | return this.cellPositionFeature.onWidthChanged();
|
24218 | };
|
24219 | CellCtrl.prototype.getColumn = function () {
|
24220 | return this.column;
|
24221 | };
|
24222 | CellCtrl.prototype.getRowNode = function () {
|
24223 | return this.rowNode;
|
24224 | };
|
24225 | CellCtrl.prototype.getBeans = function () {
|
24226 | return this.beans;
|
24227 | };
|
24228 | CellCtrl.prototype.isPrintLayout = function () {
|
24229 | return this.printLayout;
|
24230 | };
|
24231 | CellCtrl.prototype.appendChild = function (htmlElement) {
|
24232 | this.eGui.appendChild(htmlElement);
|
24233 | };
|
24234 | CellCtrl.prototype.refreshHandle = function () {
|
24235 | if (this.editing) {
|
24236 | return;
|
24237 | }
|
24238 | if (this.cellRangeFeature) {
|
24239 | this.cellRangeFeature.refreshHandle();
|
24240 | }
|
24241 | };
|
24242 | CellCtrl.prototype.getCellPosition = function () {
|
24243 | return this.cellPosition;
|
24244 | };
|
24245 | CellCtrl.prototype.isEditing = function () {
|
24246 | return this.editing;
|
24247 | };
|
24248 |
|
24249 | CellCtrl.prototype.startRowOrCellEdit = function (key, charPress, event) {
|
24250 | if (event === void 0) { event = null; }
|
24251 | if (this.beans.gridOptionsWrapper.isFullRowEdit()) {
|
24252 | this.rowCtrl.startRowEditing(key, charPress, this);
|
24253 | }
|
24254 | else {
|
24255 | this.startEditing(key, charPress, true, event);
|
24256 | }
|
24257 | };
|
24258 | CellCtrl.prototype.getRowCtrl = function () {
|
24259 | return this.rowCtrl;
|
24260 | };
|
24261 | CellCtrl.prototype.getRowPosition = function () {
|
24262 | return {
|
24263 | rowIndex: this.cellPosition.rowIndex,
|
24264 | rowPinned: this.cellPosition.rowPinned
|
24265 | };
|
24266 | };
|
24267 | CellCtrl.prototype.updateRangeBordersIfRangeCount = function () {
|
24268 | if (!this.cellComp) {
|
24269 | return;
|
24270 | }
|
24271 | if (this.cellRangeFeature) {
|
24272 | this.cellRangeFeature.updateRangeBordersIfRangeCount();
|
24273 | }
|
24274 | };
|
24275 | CellCtrl.prototype.onRangeSelectionChanged = function () {
|
24276 | if (!this.cellComp) {
|
24277 | return;
|
24278 | }
|
24279 | if (this.cellRangeFeature) {
|
24280 | this.cellRangeFeature.onRangeSelectionChanged();
|
24281 | }
|
24282 | };
|
24283 | CellCtrl.prototype.isRangeSelectionEnabled = function () {
|
24284 | return this.cellRangeFeature != null;
|
24285 | };
|
24286 | CellCtrl.prototype.focusCell = function (forceBrowserFocus) {
|
24287 | if (forceBrowserFocus === void 0) { forceBrowserFocus = false; }
|
24288 | this.beans.focusService.setFocusedCell(this.getCellPosition().rowIndex, this.column, this.rowNode.rowPinned, forceBrowserFocus);
|
24289 | };
|
24290 | CellCtrl.prototype.onRowIndexChanged = function () {
|
24291 |
|
24292 |
|
24293 | this.createCellPosition();
|
24294 |
|
24295 | this.onCellFocused();
|
24296 |
|
24297 | if (this.cellRangeFeature) {
|
24298 | this.cellRangeFeature.onRangeSelectionChanged();
|
24299 | }
|
24300 | };
|
24301 | CellCtrl.prototype.onFirstRightPinnedChanged = function () {
|
24302 | if (!this.cellComp) {
|
24303 | return;
|
24304 | }
|
24305 | var firstRightPinned = this.column.isFirstRightPinned();
|
24306 | this.cellComp.addOrRemoveCssClass(CSS_CELL_FIRST_RIGHT_PINNED, firstRightPinned);
|
24307 | };
|
24308 | CellCtrl.prototype.onLastLeftPinnedChanged = function () {
|
24309 | if (!this.cellComp) {
|
24310 | return;
|
24311 | }
|
24312 | var lastLeftPinned = this.column.isLastLeftPinned();
|
24313 | this.cellComp.addOrRemoveCssClass(CSS_CELL_LAST_LEFT_PINNED, lastLeftPinned);
|
24314 | };
|
24315 | CellCtrl.prototype.onCellFocused = function (event) {
|
24316 | if (!this.cellComp || this.gow.isSuppressCellFocus()) {
|
24317 | return;
|
24318 | }
|
24319 | var cellFocused = this.beans.focusService.isCellFocused(this.cellPosition);
|
24320 | this.cellComp.addOrRemoveCssClass(CSS_CELL_FOCUS, cellFocused);
|
24321 |
|
24322 | if (cellFocused && event && event.forceBrowserFocus) {
|
24323 | var focusEl = this.cellComp.getFocusableElement();
|
24324 | focusEl.focus();
|
24325 | }
|
24326 |
|
24327 | var fullRowEdit = this.beans.gridOptionsWrapper.isFullRowEdit();
|
24328 | if (!cellFocused && !fullRowEdit && this.editing) {
|
24329 | this.stopRowOrCellEdit();
|
24330 | }
|
24331 | };
|
24332 | CellCtrl.prototype.createCellPosition = function () {
|
24333 | this.cellPosition = {
|
24334 | rowIndex: this.rowNode.rowIndex,
|
24335 | rowPinned: makeNull(this.rowNode.rowPinned),
|
24336 | column: this.column
|
24337 | };
|
24338 | };
|
24339 |
|
24340 | CellCtrl.prototype.applyStaticCssClasses = function () {
|
24341 | this.cellComp.addOrRemoveCssClass(CSS_CELL, true);
|
24342 | this.cellComp.addOrRemoveCssClass(CSS_CELL_NOT_INLINE_EDITING, true);
|
24343 |
|
24344 |
|
24345 | var autoHeight = this.column.isAutoHeight() == true;
|
24346 | this.cellComp.addOrRemoveCssClass(CSS_AUTO_HEIGHT, autoHeight);
|
24347 | this.cellComp.addOrRemoveCssClass(CSS_NORMAL_HEIGHT, !autoHeight);
|
24348 | };
|
24349 | CellCtrl.prototype.onColumnHover = function () {
|
24350 | if (!this.cellComp) {
|
24351 | return;
|
24352 | }
|
24353 | if (!this.beans.gridOptionsWrapper.isColumnHoverHighlight()) {
|
24354 | return;
|
24355 | }
|
24356 | var isHovered = this.beans.columnHoverService.isHovered(this.column);
|
24357 | this.cellComp.addOrRemoveCssClass(CSS_COLUMN_HOVER, isHovered);
|
24358 | };
|
24359 | CellCtrl.prototype.onNewColumnsLoaded = function () {
|
24360 | if (!this.cellComp) {
|
24361 | return;
|
24362 | }
|
24363 | this.setWrapText();
|
24364 | if (!this.editing) {
|
24365 | this.refreshCell({ forceRefresh: true, suppressFlash: true });
|
24366 | }
|
24367 | };
|
24368 | CellCtrl.prototype.setWrapText = function () {
|
24369 | var value = this.column.getColDef().wrapText == true;
|
24370 | this.cellComp.addOrRemoveCssClass(CSS_CELL_WRAP_TEXT, value);
|
24371 | };
|
24372 | CellCtrl.prototype.dispatchCellContextMenuEvent = function (event) {
|
24373 | var colDef = this.column.getColDef();
|
24374 | var cellContextMenuEvent = this.createEvent(event, Events.EVENT_CELL_CONTEXT_MENU);
|
24375 | this.beans.eventService.dispatchEvent(cellContextMenuEvent);
|
24376 | if (colDef.onCellContextMenu) {
|
24377 |
|
24378 | window.setTimeout(function () { return colDef.onCellContextMenu(cellContextMenuEvent); }, 0);
|
24379 | }
|
24380 | };
|
24381 | CellCtrl.prototype.getCellRenderer = function () {
|
24382 | return this.cellComp ? this.cellComp.getCellRenderer() : null;
|
24383 | };
|
24384 | CellCtrl.prototype.getCellEditor = function () {
|
24385 | return this.cellComp ? this.cellComp.getCellEditor() : null;
|
24386 | };
|
24387 | CellCtrl.prototype.destroy = function () {
|
24388 | _super.prototype.destroy.call(this);
|
24389 | };
|
24390 | CellCtrl.prototype.createSelectionCheckbox = function () {
|
24391 | var cbSelectionComponent = new CheckboxSelectionComponent();
|
24392 | this.beans.context.createBean(cbSelectionComponent);
|
24393 | cbSelectionComponent.init({ rowNode: this.rowNode, column: this.column });
|
24394 |
|
24395 | return cbSelectionComponent;
|
24396 | };
|
24397 | CellCtrl.prototype.createDndSource = function () {
|
24398 | var dndSourceComp = new DndSourceComp(this.rowNode, this.column, this.beans, this.eGui);
|
24399 | this.beans.context.createBean(dndSourceComp);
|
24400 | return dndSourceComp;
|
24401 | };
|
24402 | CellCtrl.prototype.registerRowDragger = function (customElement, dragStartPixels, suppressVisibilityChange) {
|
24403 | var _this = this;
|
24404 |
|
24405 | if (this.customRowDragComp) {
|
24406 | this.customRowDragComp.setDragElement(customElement, dragStartPixels);
|
24407 | return;
|
24408 | }
|
24409 | var newComp = this.createRowDragComp(customElement, dragStartPixels, suppressVisibilityChange);
|
24410 | if (newComp) {
|
24411 | this.customRowDragComp = newComp;
|
24412 | this.addDestroyFunc(function () { return _this.beans.context.destroyBean(newComp); });
|
24413 | }
|
24414 | };
|
24415 | CellCtrl.prototype.createRowDragComp = function (customElement, dragStartPixels, suppressVisibilityChange) {
|
24416 | var _this = this;
|
24417 | var pagination = this.beans.gridOptionsWrapper.isPagination();
|
24418 | var rowDragManaged = this.beans.gridOptionsWrapper.isRowDragManaged();
|
24419 | var clientSideRowModelActive = this.beans.gridOptionsWrapper.isRowModelDefault();
|
24420 | if (rowDragManaged) {
|
24421 |
|
24422 | if (!clientSideRowModelActive) {
|
24423 | doOnce(function () { return console.warn('AG Grid: managed row dragging is only allowed in the Client Side Row Model'); }, 'CellComp.addRowDragging');
|
24424 | return;
|
24425 | }
|
24426 | if (pagination) {
|
24427 | doOnce(function () { return console.warn('AG Grid: managed row dragging is not possible when doing pagination'); }, 'CellComp.addRowDragging');
|
24428 | return;
|
24429 | }
|
24430 | }
|
24431 |
|
24432 | var rowDragComp = new RowDragComp(function () { return _this.value; }, this.rowNode, this.column, customElement, dragStartPixels, suppressVisibilityChange);
|
24433 | this.beans.context.createBean(rowDragComp);
|
24434 | return rowDragComp;
|
24435 | };
|
24436 | CellCtrl.DOM_DATA_KEY_CELL_CTRL = 'cellCtrl';
|
24437 | return CellCtrl;
|
24438 | }(BeanStub));
|
24439 |
|
24440 |
|
24441 |
|
24442 |
|
24443 |
|
24444 |
|
24445 |
|
24446 | var __extends$$ = (undefined && undefined.__extends) || (function () {
|
24447 | var extendStatics = function (d, b) {
|
24448 | extendStatics = Object.setPrototypeOf ||
|
24449 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
24450 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
24451 | return extendStatics(d, b);
|
24452 | };
|
24453 | return function (d, b) {
|
24454 | extendStatics(d, b);
|
24455 | function __() { this.constructor = d; }
|
24456 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
24457 | };
|
24458 | })();
|
24459 | var __read$8 = (undefined && undefined.__read) || function (o, n) {
|
24460 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
24461 | if (!m) return o;
|
24462 | var i = m.call(o), r, ar = [], e;
|
24463 | try {
|
24464 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
24465 | }
|
24466 | catch (error) { e = { error: error }; }
|
24467 | finally {
|
24468 | try {
|
24469 | if (r && !r.done && (m = i["return"])) m.call(i);
|
24470 | }
|
24471 | finally { if (e) throw e.error; }
|
24472 | }
|
24473 | return ar;
|
24474 | };
|
24475 | var __spread$6 = (undefined && undefined.__spread) || function () {
|
24476 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$8(arguments[i]));
|
24477 | return ar;
|
24478 | };
|
24479 | var RowType;
|
24480 | (function (RowType) {
|
24481 | RowType["Normal"] = "Normal";
|
24482 | RowType["FullWidth"] = "FullWidth";
|
24483 | RowType["FullWidthLoading"] = "FullWidthLoading";
|
24484 | RowType["FullWidthGroup"] = "FullWidthGroup";
|
24485 | RowType["FullWidthDetail"] = "FullWidthDetail";
|
24486 | })(RowType || (RowType = {}));
|
24487 | var instanceIdSequence$2 = 0;
|
24488 | var RowCtrl = (function (_super) {
|
24489 | __extends$$(RowCtrl, _super);
|
24490 | function RowCtrl(rowNode, beans, animateIn, useAnimationFrameForCreate, printLayout) {
|
24491 | var _this = _super.call(this) || this;
|
24492 | _this.allRowGuis = [];
|
24493 | _this.active = true;
|
24494 | _this.centerCellCtrls = { list: [], map: {} };
|
24495 | _this.leftCellCtrls = { list: [], map: {} };
|
24496 | _this.rightCellCtrls = { list: [], map: {} };
|
24497 | _this.lastMouseDownOnDragger = false;
|
24498 | _this.updateColumnListsPending = false;
|
24499 | _this.beans = beans;
|
24500 | _this.rowNode = rowNode;
|
24501 | _this.paginationPage = _this.beans.paginationProxy.getCurrentPage();
|
24502 | _this.useAnimationFrameForCreate = useAnimationFrameForCreate;
|
24503 | _this.printLayout = printLayout;
|
24504 | _this.instanceId = rowNode.id + '-' + instanceIdSequence$2++;
|
24505 | _this.setAnimateFlags(animateIn);
|
24506 | _this.rowFocused = _this.beans.focusService.isRowFocused(_this.rowNode.rowIndex, _this.rowNode.rowPinned);
|
24507 | _this.rowLevel = _this.beans.rowCssClassCalculator.calculateRowLevel(_this.rowNode);
|
24508 | _this.setRowType();
|
24509 | _this.addListeners();
|
24510 | _this.setInitialRowTop();
|
24511 | return _this;
|
24512 | }
|
24513 | RowCtrl.prototype.getBeans = function () {
|
24514 | return this.beans;
|
24515 | };
|
24516 | RowCtrl.prototype.getInstanceId = function () {
|
24517 | return this.instanceId;
|
24518 | };
|
24519 | RowCtrl.prototype.setComp = function (rowComp, element, containerType) {
|
24520 | var gui = { rowComp: rowComp, element: element, containerType: containerType };
|
24521 | this.allRowGuis.push(gui);
|
24522 | if (containerType === RowContainerType.LEFT) {
|
24523 | this.leftGui = gui;
|
24524 | }
|
24525 | else if (containerType === RowContainerType.RIGHT) {
|
24526 | this.rightGui = gui;
|
24527 | }
|
24528 | else if (containerType === RowContainerType.FULL_WIDTH) {
|
24529 | this.fullWidthGui = gui;
|
24530 | }
|
24531 | else {
|
24532 | this.centerGui = gui;
|
24533 | }
|
24534 | var allNormalPresent = this.leftGui != null && this.rightGui != null && this.centerGui != null;
|
24535 | var fullWidthPresent = this.fullWidthGui != null;
|
24536 | if (allNormalPresent || fullWidthPresent) {
|
24537 | this.initialiseRowComps();
|
24538 | }
|
24539 | };
|
24540 | RowCtrl.prototype.isCacheable = function () {
|
24541 | return this.rowType === RowType.FullWidthDetail
|
24542 | && this.beans.gridOptionsWrapper.isKeepDetailRows();
|
24543 | };
|
24544 | RowCtrl.prototype.setCached = function (cached) {
|
24545 | var displayValue = cached ? 'none' : '';
|
24546 | this.allRowGuis.forEach(function (rg) { return rg.element.style.display = displayValue; });
|
24547 | };
|
24548 | RowCtrl.prototype.initialiseRowComps = function () {
|
24549 | var _this = this;
|
24550 | var gow = this.beans.gridOptionsWrapper;
|
24551 | this.onRowHeightChanged();
|
24552 | this.updateRowIndexes();
|
24553 | this.setFocusedClasses();
|
24554 | this.setStylesFromGridOptions();
|
24555 | if (gow.isRowSelection() && this.rowNode.selectable) {
|
24556 | this.onRowSelected();
|
24557 | }
|
24558 | this.updateColumnLists(!this.useAnimationFrameForCreate);
|
24559 | if (this.slideRowIn) {
|
24560 | executeNextVMTurn(this.onTopChanged.bind(this));
|
24561 | }
|
24562 | if (this.fadeRowIn) {
|
24563 | executeNextVMTurn(function () {
|
24564 | _this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-opacity-zero', false); });
|
24565 | });
|
24566 | }
|
24567 | var businessKey = this.getRowBusinessKey();
|
24568 | var rowIdSanitised = escapeString(this.rowNode.id);
|
24569 | var businessKeySanitised = escapeString(businessKey);
|
24570 | this.allRowGuis.forEach(function (gui) {
|
24571 | var comp = gui.rowComp;
|
24572 | comp.setRole('row');
|
24573 | var initialRowClasses = _this.getInitialRowClasses(gui.containerType);
|
24574 | initialRowClasses.forEach(function (name) { return comp.addOrRemoveCssClass(name, true); });
|
24575 | if (_this.rowNode.group) {
|
24576 | setAriaExpanded(gui.element, _this.rowNode.expanded == true);
|
24577 | }
|
24578 | if (rowIdSanitised != null) {
|
24579 | comp.setRowId(rowIdSanitised);
|
24580 | }
|
24581 | if (businessKeySanitised != null) {
|
24582 | comp.setRowBusinessKey(businessKeySanitised);
|
24583 | }
|
24584 | if (_this.isFullWidth() && !_this.beans.gridOptionsWrapper.isSuppressCellFocus()) {
|
24585 | comp.setTabIndex(-1);
|
24586 | }
|
24587 |
|
24588 | gow.setDomData(gui.element, RowCtrl.DOM_DATA_KEY_ROW_CTRL, _this);
|
24589 | _this.addDestroyFunc(function () { return gow.setDomData(gui.element, RowCtrl.DOM_DATA_KEY_ROW_CTRL, null); });
|
24590 |
|
24591 |
|
24592 | if (_this.useAnimationFrameForCreate) {
|
24593 | _this.beans.animationFrameService.createTask(_this.addHoverFunctionality.bind(_this, gui.element), _this.rowNode.rowIndex, 'createTasksP2');
|
24594 | }
|
24595 | else {
|
24596 | _this.addHoverFunctionality(gui.element);
|
24597 | }
|
24598 | if (_this.isFullWidth()) {
|
24599 | _this.setupFullWidth(gui);
|
24600 | }
|
24601 | if (gow.isRowDragEntireRow()) {
|
24602 | _this.addRowDraggerToRow(gui);
|
24603 | }
|
24604 | if (_this.useAnimationFrameForCreate) {
|
24605 |
|
24606 |
|
24607 |
|
24608 |
|
24609 |
|
24610 |
|
24611 | _this.beans.animationFrameService.addDestroyTask(function () {
|
24612 | if (!_this.isAlive()) {
|
24613 | return;
|
24614 | }
|
24615 | gui.rowComp.addOrRemoveCssClass('ag-after-created', true);
|
24616 | });
|
24617 | }
|
24618 | });
|
24619 | this.executeProcessRowPostCreateFunc();
|
24620 | };
|
24621 | RowCtrl.prototype.addRowDraggerToRow = function (gui) {
|
24622 | var gow = this.beans.gridOptionsWrapper;
|
24623 | if (gow.isEnableRangeSelection()) {
|
24624 | doOnce(function () {
|
24625 | console.warn('AG Grid: Setting `rowDragEntireRow: true` in the gridOptions doesn\'t work with `enableRangeSelection: true`');
|
24626 | }, 'rowDragAndRangeSelectionEnabled');
|
24627 | return;
|
24628 | }
|
24629 | var rowDragComp = new RowDragComp(function () { return '1 row'; }, this.rowNode, undefined, gui.element, undefined, true);
|
24630 | this.createManagedBean(rowDragComp, this.beans.context);
|
24631 | };
|
24632 | RowCtrl.prototype.setupFullWidth = function (gui) {
|
24633 | var pinned = this.getPinnedForContainer(gui.containerType);
|
24634 | var params = this.createFullWidthParams(gui.element, pinned);
|
24635 | var masterDetailModuleLoaded = ModuleRegistry.isRegistered(ModuleNames.MasterDetailModule);
|
24636 | if (this.rowType == RowType.FullWidthDetail && !masterDetailModuleLoaded) {
|
24637 | if (ModuleRegistry.isPackageBased()) {
|
24638 | console.warn("AG Grid: cell renderer 'agDetailCellRenderer' (for master detail) not found. Can only be used with ag-grid-enterprise package.");
|
24639 | }
|
24640 | else {
|
24641 | console.warn("AG Grid: cell renderer 'agDetailCellRenderer' (for master detail) not found. Can only be used with AG Grid Enterprise Module " + ModuleNames.MasterDetailModule);
|
24642 | }
|
24643 | return;
|
24644 | }
|
24645 | var compDetails;
|
24646 | switch (this.rowType) {
|
24647 | case RowType.FullWidthDetail:
|
24648 | compDetails = this.beans.userComponentFactory.getFullWidthDetailCellRendererDetails(params);
|
24649 | break;
|
24650 | case RowType.FullWidthGroup:
|
24651 | compDetails = this.beans.userComponentFactory.getFullWidthGroupCellRendererDetails(params);
|
24652 | break;
|
24653 | case RowType.FullWidthLoading:
|
24654 | compDetails = this.beans.userComponentFactory.getFullWidthLoadingCellRendererDetails(params);
|
24655 | break;
|
24656 | default:
|
24657 | compDetails = this.beans.userComponentFactory.getFullWidthCellRendererDetails(params);
|
24658 | break;
|
24659 | }
|
24660 | gui.rowComp.showFullWidth(compDetails);
|
24661 | };
|
24662 | RowCtrl.prototype.isPrintLayout = function () {
|
24663 | return this.printLayout;
|
24664 | };
|
24665 |
|
24666 | RowCtrl.prototype.getCellElement = function (column) {
|
24667 | var cellCtrl = this.getCellCtrl(column);
|
24668 | return cellCtrl ? cellCtrl.getGui() : null;
|
24669 | };
|
24670 | RowCtrl.prototype.executeProcessRowPostCreateFunc = function () {
|
24671 | var func = this.beans.gridOptionsWrapper.getProcessRowPostCreateFunc();
|
24672 | if (!func) {
|
24673 | return;
|
24674 | }
|
24675 | var params = {
|
24676 | eRow: this.centerGui ? this.centerGui.element : undefined,
|
24677 | ePinnedLeftRow: this.leftGui ? this.leftGui.element : undefined,
|
24678 | ePinnedRightRow: this.rightGui ? this.rightGui.element : undefined,
|
24679 | node: this.rowNode,
|
24680 | rowIndex: this.rowNode.rowIndex,
|
24681 | addRenderedRowListener: this.addEventListener.bind(this),
|
24682 | };
|
24683 | func(params);
|
24684 | };
|
24685 | RowCtrl.prototype.setRowType = function () {
|
24686 | var isStub = this.rowNode.stub;
|
24687 | var isFullWidthCell = this.rowNode.isFullWidthCell();
|
24688 | var isDetailCell = this.beans.doingMasterDetail && this.rowNode.detail;
|
24689 | var pivotMode = this.beans.columnModel.isPivotMode();
|
24690 |
|
24691 |
|
24692 |
|
24693 |
|
24694 | var isGroupRow = !!this.rowNode.group && !this.rowNode.footer;
|
24695 | var isFullWidthGroup = isGroupRow && this.beans.gridOptionsWrapper.isGroupUseEntireRow(pivotMode);
|
24696 | if (isStub) {
|
24697 | this.rowType = RowType.FullWidthLoading;
|
24698 | }
|
24699 | else if (isDetailCell) {
|
24700 | this.rowType = RowType.FullWidthDetail;
|
24701 | }
|
24702 | else if (isFullWidthCell) {
|
24703 | this.rowType = RowType.FullWidth;
|
24704 | }
|
24705 | else if (isFullWidthGroup) {
|
24706 | this.rowType = RowType.FullWidthGroup;
|
24707 | }
|
24708 | else {
|
24709 | this.rowType = RowType.Normal;
|
24710 | }
|
24711 | };
|
24712 | RowCtrl.prototype.updateColumnLists = function (suppressAnimationFrame) {
|
24713 | var _this = this;
|
24714 | if (suppressAnimationFrame === void 0) { suppressAnimationFrame = false; }
|
24715 | if (this.isFullWidth()) {
|
24716 | return;
|
24717 | }
|
24718 | var noAnimation = suppressAnimationFrame
|
24719 | || this.beans.gridOptionsWrapper.isSuppressAnimationFrame()
|
24720 | || this.printLayout;
|
24721 | if (noAnimation) {
|
24722 | this.updateColumnListsImpl();
|
24723 | return;
|
24724 | }
|
24725 | if (this.updateColumnListsPending) {
|
24726 | return;
|
24727 | }
|
24728 | this.beans.animationFrameService.createTask(function () {
|
24729 | if (!_this.active) {
|
24730 | return;
|
24731 | }
|
24732 | _this.updateColumnListsImpl();
|
24733 | }, this.rowNode.rowIndex, 'createTasksP1');
|
24734 | this.updateColumnListsPending = true;
|
24735 | };
|
24736 | RowCtrl.prototype.createCellCtrls = function (prev, cols, pinned) {
|
24737 | var _this = this;
|
24738 | if (pinned === void 0) { pinned = null; }
|
24739 | var res = {
|
24740 | list: [],
|
24741 | map: {}
|
24742 | };
|
24743 | var addCell = function (colInstanceId, cellCtrl) {
|
24744 | res.list.push(cellCtrl);
|
24745 | res.map[colInstanceId] = cellCtrl;
|
24746 | };
|
24747 | cols.forEach(function (col) {
|
24748 |
|
24749 |
|
24750 |
|
24751 | var colInstanceId = col.getInstanceId();
|
24752 | var cellCtrl = prev.map[colInstanceId];
|
24753 | if (!cellCtrl) {
|
24754 | cellCtrl = new CellCtrl(col, _this.rowNode, _this.beans, _this);
|
24755 | }
|
24756 | addCell(colInstanceId, cellCtrl);
|
24757 | });
|
24758 | prev.list.forEach(function (prevCellCtrl) {
|
24759 | var cellInResult = res.map[prevCellCtrl.getColumn().getInstanceId()] != null;
|
24760 | if (cellInResult) {
|
24761 | return;
|
24762 | }
|
24763 | var keepCell = !_this.isCellEligibleToBeRemoved(prevCellCtrl, pinned);
|
24764 | if (keepCell) {
|
24765 | addCell(prevCellCtrl.getColumn().getInstanceId(), prevCellCtrl);
|
24766 | return;
|
24767 | }
|
24768 | prevCellCtrl.destroy();
|
24769 | });
|
24770 | return res;
|
24771 | };
|
24772 | RowCtrl.prototype.updateColumnListsImpl = function () {
|
24773 | var _this = this;
|
24774 | this.updateColumnListsPending = false;
|
24775 | var columnModel = this.beans.columnModel;
|
24776 | if (this.printLayout) {
|
24777 | this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, columnModel.getAllDisplayedColumns());
|
24778 | this.leftCellCtrls = { list: [], map: {} };
|
24779 | this.rightCellCtrls = { list: [], map: {} };
|
24780 | }
|
24781 | else {
|
24782 | var centerCols = columnModel.getViewportCenterColumnsForRow(this.rowNode);
|
24783 | this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, centerCols);
|
24784 | var leftCols = columnModel.getDisplayedLeftColumnsForRow(this.rowNode);
|
24785 | this.leftCellCtrls = this.createCellCtrls(this.leftCellCtrls, leftCols, Constants.PINNED_LEFT);
|
24786 | var rightCols = columnModel.getDisplayedRightColumnsForRow(this.rowNode);
|
24787 | this.rightCellCtrls = this.createCellCtrls(this.rightCellCtrls, rightCols, Constants.PINNED_RIGHT);
|
24788 | }
|
24789 | this.allRowGuis.forEach(function (item) {
|
24790 | var cellControls = item.containerType === RowContainerType.LEFT ? _this.leftCellCtrls :
|
24791 | item.containerType === RowContainerType.RIGHT ? _this.rightCellCtrls : _this.centerCellCtrls;
|
24792 | item.rowComp.setCellCtrls(cellControls.list);
|
24793 | });
|
24794 | };
|
24795 | RowCtrl.prototype.isCellEligibleToBeRemoved = function (cellCtrl, nextContainerPinned) {
|
24796 | var REMOVE_CELL = true;
|
24797 | var KEEP_CELL = false;
|
24798 |
|
24799 | var column = cellCtrl.getColumn();
|
24800 | if (column.getPinned() != nextContainerPinned) {
|
24801 | return REMOVE_CELL;
|
24802 | }
|
24803 |
|
24804 | var editing = cellCtrl.isEditing();
|
24805 | var focused = this.beans.focusService.isCellFocused(cellCtrl.getCellPosition());
|
24806 | var mightWantToKeepCell = editing || focused;
|
24807 | if (mightWantToKeepCell) {
|
24808 | var column_1 = cellCtrl.getColumn();
|
24809 | var displayedColumns = this.beans.columnModel.getAllDisplayedColumns();
|
24810 | var cellStillDisplayed = displayedColumns.indexOf(column_1) >= 0;
|
24811 | return cellStillDisplayed ? KEEP_CELL : REMOVE_CELL;
|
24812 | }
|
24813 | return REMOVE_CELL;
|
24814 | };
|
24815 | RowCtrl.prototype.setAnimateFlags = function (animateIn) {
|
24816 | if (animateIn) {
|
24817 | var oldRowTopExists = exists(this.rowNode.oldRowTop);
|
24818 |
|
24819 | this.slideRowIn = oldRowTopExists;
|
24820 |
|
24821 | this.fadeRowIn = !oldRowTopExists;
|
24822 | }
|
24823 | else {
|
24824 | this.slideRowIn = false;
|
24825 | this.fadeRowIn = false;
|
24826 | }
|
24827 | };
|
24828 | RowCtrl.prototype.isEditing = function () {
|
24829 | return this.editingRow;
|
24830 | };
|
24831 | RowCtrl.prototype.stopRowEditing = function (cancel) {
|
24832 | this.stopEditing(cancel);
|
24833 | };
|
24834 | RowCtrl.prototype.isFullWidth = function () {
|
24835 | return this.rowType !== RowType.Normal;
|
24836 | };
|
24837 | RowCtrl.prototype.getRowType = function () {
|
24838 | return this.rowType;
|
24839 | };
|
24840 | RowCtrl.prototype.refreshFullWidth = function () {
|
24841 | var _this = this;
|
24842 |
|
24843 | var tryRefresh = function (gui, pinned) {
|
24844 | if (!gui) {
|
24845 | return true;
|
24846 | }
|
24847 | var cellRenderer = gui.rowComp.getFullWidthCellRenderer();
|
24848 |
|
24849 |
|
24850 |
|
24851 |
|
24852 | if (!cellRenderer) {
|
24853 | return false;
|
24854 | }
|
24855 |
|
24856 | if (!cellRenderer.refresh) {
|
24857 | return false;
|
24858 | }
|
24859 | var params = _this.createFullWidthParams(gui.element, pinned);
|
24860 | var refreshSucceeded = cellRenderer.refresh(params);
|
24861 | return refreshSucceeded;
|
24862 | };
|
24863 | var fullWidthSuccess = tryRefresh(this.fullWidthGui, null);
|
24864 | var centerSuccess = tryRefresh(this.centerGui, null);
|
24865 | var leftSuccess = tryRefresh(this.leftGui, Constants.PINNED_LEFT);
|
24866 | var rightSuccess = tryRefresh(this.rightGui, Constants.PINNED_RIGHT);
|
24867 | var allFullWidthRowsRefreshed = fullWidthSuccess && centerSuccess && leftSuccess && rightSuccess;
|
24868 | return allFullWidthRowsRefreshed;
|
24869 | };
|
24870 | RowCtrl.prototype.addListeners = function () {
|
24871 | this.addManagedListener(this.rowNode, RowNode.EVENT_HEIGHT_CHANGED, this.onRowHeightChanged.bind(this));
|
24872 | this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_SELECTED, this.onRowSelected.bind(this));
|
24873 | this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_INDEX_CHANGED, this.onRowIndexChanged.bind(this));
|
24874 | this.addManagedListener(this.rowNode, RowNode.EVENT_TOP_CHANGED, this.onTopChanged.bind(this));
|
24875 | this.addManagedListener(this.rowNode, RowNode.EVENT_EXPANDED_CHANGED, this.updateExpandedCss.bind(this));
|
24876 | this.addManagedListener(this.rowNode, RowNode.EVENT_HAS_CHILDREN_CHANGED, this.updateExpandedCss.bind(this));
|
24877 | this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.onRowNodeDataChanged.bind(this));
|
24878 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.onRowNodeCellChanged.bind(this));
|
24879 | this.addManagedListener(this.rowNode, RowNode.EVENT_HIGHLIGHT_CHANGED, this.onRowNodeHighlightChanged.bind(this));
|
24880 | this.addManagedListener(this.rowNode, RowNode.EVENT_DRAGGING_CHANGED, this.onRowNodeDraggingChanged.bind(this));
|
24881 | this.addManagedListener(this.rowNode, RowNode.EVENT_UI_LEVEL_CHANGED, this.onUiLevelChanged.bind(this));
|
24882 | var eventService = this.beans.eventService;
|
24883 | this.addManagedListener(eventService, Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED, this.onPaginationPixelOffsetChanged.bind(this));
|
24884 | this.addManagedListener(eventService, Events.EVENT_HEIGHT_SCALE_CHANGED, this.onTopChanged.bind(this));
|
24885 | this.addManagedListener(eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
|
24886 | this.addManagedListener(eventService, Events.EVENT_VIRTUAL_COLUMNS_CHANGED, this.onVirtualColumnsChanged.bind(this));
|
24887 | this.addManagedListener(eventService, Events.EVENT_CELL_FOCUSED, this.onCellFocusChanged.bind(this));
|
24888 | this.addManagedListener(eventService, Events.EVENT_PAGINATION_CHANGED, this.onPaginationChanged.bind(this));
|
24889 | this.addManagedListener(eventService, Events.EVENT_MODEL_UPDATED, this.onModelUpdated.bind(this));
|
24890 | this.addManagedListener(eventService, Events.EVENT_COLUMN_MOVED, this.onColumnMoved.bind(this));
|
24891 | this.addListenersForCellComps();
|
24892 | };
|
24893 | RowCtrl.prototype.onColumnMoved = function () {
|
24894 | this.updateColumnLists();
|
24895 | };
|
24896 | RowCtrl.prototype.addListenersForCellComps = function () {
|
24897 | var _this = this;
|
24898 | this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_INDEX_CHANGED, function () {
|
24899 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onRowIndexChanged(); });
|
24900 | });
|
24901 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, function (event) {
|
24902 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onCellChanged(event); });
|
24903 | });
|
24904 | };
|
24905 | RowCtrl.prototype.onRowNodeDataChanged = function (event) {
|
24906 |
|
24907 |
|
24908 |
|
24909 | this.getAllCellCtrls().forEach(function (cellCtrl) {
|
24910 | return cellCtrl.refreshCell({
|
24911 | suppressFlash: !event.update,
|
24912 | newData: !event.update
|
24913 | });
|
24914 | });
|
24915 |
|
24916 |
|
24917 |
|
24918 |
|
24919 |
|
24920 | this.onRowSelected();
|
24921 |
|
24922 | this.postProcessCss();
|
24923 | };
|
24924 | RowCtrl.prototype.onRowNodeCellChanged = function () {
|
24925 |
|
24926 | this.postProcessCss();
|
24927 | };
|
24928 | RowCtrl.prototype.postProcessCss = function () {
|
24929 | this.setStylesFromGridOptions();
|
24930 | this.postProcessClassesFromGridOptions();
|
24931 | this.postProcessRowClassRules();
|
24932 | this.postProcessRowDragging();
|
24933 | };
|
24934 | RowCtrl.prototype.onRowNodeHighlightChanged = function () {
|
24935 | var highlighted = this.rowNode.highlighted;
|
24936 | this.allRowGuis.forEach(function (gui) {
|
24937 | var aboveOn = highlighted === RowHighlightPosition.Above;
|
24938 | var belowOn = highlighted === RowHighlightPosition.Below;
|
24939 | gui.rowComp.addOrRemoveCssClass('ag-row-highlight-above', aboveOn);
|
24940 | gui.rowComp.addOrRemoveCssClass('ag-row-highlight-below', belowOn);
|
24941 | });
|
24942 | };
|
24943 | RowCtrl.prototype.onRowNodeDraggingChanged = function () {
|
24944 | this.postProcessRowDragging();
|
24945 | };
|
24946 | RowCtrl.prototype.postProcessRowDragging = function () {
|
24947 | var dragging = this.rowNode.dragging;
|
24948 | this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-dragging', dragging); });
|
24949 | };
|
24950 | RowCtrl.prototype.updateExpandedCss = function () {
|
24951 | var expandable = this.rowNode.isExpandable();
|
24952 | var expanded = this.rowNode.expanded == true;
|
24953 | this.allRowGuis.forEach(function (gui) {
|
24954 | gui.rowComp.addOrRemoveCssClass('ag-row-group', expandable);
|
24955 | gui.rowComp.addOrRemoveCssClass('ag-row-group-expanded', expandable && expanded);
|
24956 | gui.rowComp.addOrRemoveCssClass('ag-row-group-contracted', expandable && !expanded);
|
24957 | setAriaExpanded(gui.element, expandable && expanded);
|
24958 | });
|
24959 | };
|
24960 | RowCtrl.prototype.onDisplayedColumnsChanged = function () {
|
24961 |
|
24962 |
|
24963 | this.updateColumnLists(true);
|
24964 | if (this.beans.columnModel.wasAutoRowHeightEverActive()) {
|
24965 | this.rowNode.checkAutoHeights();
|
24966 | }
|
24967 | };
|
24968 | RowCtrl.prototype.onVirtualColumnsChanged = function () {
|
24969 | this.updateColumnLists();
|
24970 | };
|
24971 | RowCtrl.prototype.getRowPosition = function () {
|
24972 | return {
|
24973 | rowPinned: makeNull(this.rowNode.rowPinned),
|
24974 | rowIndex: this.rowNode.rowIndex
|
24975 | };
|
24976 | };
|
24977 | RowCtrl.prototype.onKeyboardNavigate = function (keyboardEvent) {
|
24978 | var currentFullWidthComp = this.allRowGuis.find(function (c) { return c.element.contains(keyboardEvent.target); });
|
24979 | var currentFullWidthContainer = currentFullWidthComp ? currentFullWidthComp.element : null;
|
24980 | var isFullWidthContainerFocused = currentFullWidthContainer === keyboardEvent.target;
|
24981 | if (!isFullWidthContainerFocused) {
|
24982 | return;
|
24983 | }
|
24984 | var node = this.rowNode;
|
24985 | var lastFocusedCell = this.beans.focusService.getFocusedCell();
|
24986 | var cellPosition = {
|
24987 | rowIndex: node.rowIndex,
|
24988 | rowPinned: node.rowPinned,
|
24989 | column: (lastFocusedCell && lastFocusedCell.column)
|
24990 | };
|
24991 | this.beans.navigationService.navigateToNextCell(keyboardEvent, keyboardEvent.key, cellPosition, true);
|
24992 | keyboardEvent.preventDefault();
|
24993 | };
|
24994 | RowCtrl.prototype.onTabKeyDown = function (keyboardEvent) {
|
24995 | if (keyboardEvent.defaultPrevented || isStopPropagationForAgGrid(keyboardEvent)) {
|
24996 | return;
|
24997 | }
|
24998 | var currentFullWidthComp = this.allRowGuis.find(function (c) { return c.element.contains(keyboardEvent.target); });
|
24999 | var currentFullWidthContainer = currentFullWidthComp ? currentFullWidthComp.element : null;
|
25000 | var isFullWidthContainerFocused = currentFullWidthContainer === keyboardEvent.target;
|
25001 | var nextEl = null;
|
25002 | if (!isFullWidthContainerFocused) {
|
25003 | nextEl = this.beans.focusService.findNextFocusableElement(currentFullWidthContainer, false, keyboardEvent.shiftKey);
|
25004 | }
|
25005 | if ((this.isFullWidth() && isFullWidthContainerFocused) || !nextEl) {
|
25006 | this.beans.navigationService.onTabKeyDown(this, keyboardEvent);
|
25007 | }
|
25008 | };
|
25009 | RowCtrl.prototype.onFullWidthRowFocused = function (event) {
|
25010 | var _a;
|
25011 | var node = this.rowNode;
|
25012 | var isFocused = this.isFullWidth() && event.rowIndex === node.rowIndex && event.rowPinned == node.rowPinned;
|
25013 | var element = this.fullWidthGui ? this.fullWidthGui.element : (_a = this.centerGui) === null || _a === void 0 ? void 0 : _a.element;
|
25014 | if (!element) {
|
25015 | return;
|
25016 | }
|
25017 | element.classList.toggle('ag-full-width-focus', isFocused);
|
25018 | if (isFocused) {
|
25019 |
|
25020 |
|
25021 | element.focus({ preventScroll: true });
|
25022 | }
|
25023 | };
|
25024 | RowCtrl.prototype.refreshCell = function (cellCtrl) {
|
25025 | this.centerCellCtrls = this.removeCellCtrl(this.centerCellCtrls, cellCtrl);
|
25026 | this.leftCellCtrls = this.removeCellCtrl(this.leftCellCtrls, cellCtrl);
|
25027 | this.rightCellCtrls = this.removeCellCtrl(this.rightCellCtrls, cellCtrl);
|
25028 | this.updateColumnLists();
|
25029 | };
|
25030 | RowCtrl.prototype.removeCellCtrl = function (prev, cellCtrlToRemove) {
|
25031 | var res = {
|
25032 | list: [],
|
25033 | map: {}
|
25034 | };
|
25035 | prev.list.forEach(function (cellCtrl) {
|
25036 | if (cellCtrl === cellCtrlToRemove) {
|
25037 | return;
|
25038 | }
|
25039 | res.list.push(cellCtrl);
|
25040 | res.map[cellCtrl.getInstanceId()] = cellCtrl;
|
25041 | });
|
25042 | return res;
|
25043 | };
|
25044 | RowCtrl.prototype.onMouseEvent = function (eventName, mouseEvent) {
|
25045 | switch (eventName) {
|
25046 | case 'dblclick':
|
25047 | this.onRowDblClick(mouseEvent);
|
25048 | break;
|
25049 | case 'click':
|
25050 | this.onRowClick(mouseEvent);
|
25051 | break;
|
25052 | case 'touchstart':
|
25053 | case 'mousedown':
|
25054 | this.onRowMouseDown(mouseEvent);
|
25055 | break;
|
25056 | }
|
25057 | };
|
25058 | RowCtrl.prototype.createRowEvent = function (type, domEvent) {
|
25059 | return {
|
25060 | type: type,
|
25061 | node: this.rowNode,
|
25062 | data: this.rowNode.data,
|
25063 | rowIndex: this.rowNode.rowIndex,
|
25064 | rowPinned: this.rowNode.rowPinned,
|
25065 | context: this.beans.gridOptionsWrapper.getContext(),
|
25066 | api: this.beans.gridOptionsWrapper.getApi(),
|
25067 | columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
|
25068 | event: domEvent
|
25069 | };
|
25070 | };
|
25071 | RowCtrl.prototype.createRowEventWithSource = function (type, domEvent) {
|
25072 | var event = this.createRowEvent(type, domEvent);
|
25073 |
|
25074 |
|
25075 |
|
25076 |
|
25077 |
|
25078 |
|
25079 | event.source = this;
|
25080 | return event;
|
25081 | };
|
25082 | RowCtrl.prototype.onRowDblClick = function (mouseEvent) {
|
25083 | if (isStopPropagationForAgGrid(mouseEvent)) {
|
25084 | return;
|
25085 | }
|
25086 | var agEvent = this.createRowEventWithSource(Events.EVENT_ROW_DOUBLE_CLICKED, mouseEvent);
|
25087 | this.beans.eventService.dispatchEvent(agEvent);
|
25088 | };
|
25089 | RowCtrl.prototype.onRowMouseDown = function (mouseEvent) {
|
25090 | this.lastMouseDownOnDragger = isElementChildOfClass(mouseEvent.target, 'ag-row-drag', 3);
|
25091 | if (!this.isFullWidth()) {
|
25092 | return;
|
25093 | }
|
25094 | var node = this.rowNode;
|
25095 | var columnModel = this.beans.columnModel;
|
25096 | this.beans.focusService.setFocusedCell(node.rowIndex, columnModel.getAllDisplayedColumns()[0], node.rowPinned, true);
|
25097 | };
|
25098 | RowCtrl.prototype.onRowClick = function (mouseEvent) {
|
25099 | var stop = isStopPropagationForAgGrid(mouseEvent) || this.lastMouseDownOnDragger;
|
25100 | if (stop) {
|
25101 | return;
|
25102 | }
|
25103 | var agEvent = this.createRowEventWithSource(Events.EVENT_ROW_CLICKED, mouseEvent);
|
25104 | this.beans.eventService.dispatchEvent(agEvent);
|
25105 |
|
25106 | var multiSelectKeyPressed = mouseEvent.ctrlKey || mouseEvent.metaKey;
|
25107 | var shiftKeyPressed = mouseEvent.shiftKey;
|
25108 |
|
25109 |
|
25110 |
|
25111 |
|
25112 |
|
25113 |
|
25114 | var groupSelectsChildren = this.beans.gridOptionsWrapper.isGroupSelectsChildren();
|
25115 | if (
|
25116 |
|
25117 |
|
25118 | (groupSelectsChildren && this.rowNode.group) ||
|
25119 |
|
25120 |
|
25121 | !this.rowNode.selectable ||
|
25122 |
|
25123 | this.rowNode.rowPinned ||
|
25124 |
|
25125 | !this.beans.gridOptionsWrapper.isRowSelection() ||
|
25126 |
|
25127 | this.beans.gridOptionsWrapper.isSuppressRowClickSelection()) {
|
25128 | return;
|
25129 | }
|
25130 | var multiSelectOnClick = this.beans.gridOptionsWrapper.isRowMultiSelectWithClick();
|
25131 | var rowDeselectionWithCtrl = !this.beans.gridOptionsWrapper.isSuppressRowDeselection();
|
25132 | if (this.rowNode.isSelected()) {
|
25133 | if (multiSelectOnClick) {
|
25134 | this.rowNode.setSelectedParams({ newValue: false });
|
25135 | }
|
25136 | else if (multiSelectKeyPressed) {
|
25137 | if (rowDeselectionWithCtrl) {
|
25138 | this.rowNode.setSelectedParams({ newValue: false });
|
25139 | }
|
25140 | }
|
25141 | else {
|
25142 |
|
25143 | this.rowNode.setSelectedParams({ newValue: true, clearSelection: !shiftKeyPressed, rangeSelect: shiftKeyPressed });
|
25144 | }
|
25145 | }
|
25146 | else {
|
25147 | var clearSelection = multiSelectOnClick ? false : !multiSelectKeyPressed;
|
25148 | this.rowNode.setSelectedParams({ newValue: true, clearSelection: clearSelection, rangeSelect: shiftKeyPressed });
|
25149 | }
|
25150 | };
|
25151 | RowCtrl.prototype.setupDetailRowAutoHeight = function (eDetailGui) {
|
25152 | var _this = this;
|
25153 | if (this.rowType !== RowType.FullWidthDetail) {
|
25154 | return;
|
25155 | }
|
25156 | if (!this.beans.gridOptionsWrapper.isDetailRowAutoHeight()) {
|
25157 | return;
|
25158 | }
|
25159 | var checkRowSizeFunc = function () {
|
25160 | var clientHeight = eDetailGui.clientHeight;
|
25161 |
|
25162 |
|
25163 |
|
25164 |
|
25165 | if (clientHeight != null && clientHeight > 0) {
|
25166 |
|
25167 |
|
25168 | var updateRowHeightFunc = function () {
|
25169 | _this.rowNode.setRowHeight(clientHeight);
|
25170 | if (_this.beans.clientSideRowModel) {
|
25171 | _this.beans.clientSideRowModel.onRowHeightChanged();
|
25172 | }
|
25173 | else if (_this.beans.serverSideRowModel) {
|
25174 | _this.beans.serverSideRowModel.onRowHeightChanged();
|
25175 | }
|
25176 | };
|
25177 | _this.beans.frameworkOverrides.setTimeout(updateRowHeightFunc, 0);
|
25178 | }
|
25179 | };
|
25180 | var resizeObserverDestroyFunc = this.beans.resizeObserverService.observeResize(eDetailGui, checkRowSizeFunc);
|
25181 | this.addDestroyFunc(resizeObserverDestroyFunc);
|
25182 | checkRowSizeFunc();
|
25183 | };
|
25184 | RowCtrl.prototype.createFullWidthParams = function (eRow, pinned) {
|
25185 | var _this = this;
|
25186 | var params = {
|
25187 | fullWidth: true,
|
25188 | data: this.rowNode.data,
|
25189 | node: this.rowNode,
|
25190 | value: this.rowNode.key,
|
25191 | valueFormatted: this.rowNode.key,
|
25192 | rowIndex: this.rowNode.rowIndex,
|
25193 | api: this.beans.gridOptionsWrapper.getApi(),
|
25194 | columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
|
25195 | context: this.beans.gridOptionsWrapper.getContext(),
|
25196 |
|
25197 | eGridCell: eRow,
|
25198 | eParentOfValue: eRow,
|
25199 | pinned: pinned,
|
25200 | addRenderedRowListener: this.addEventListener.bind(this),
|
25201 | registerRowDragger: function (rowDraggerElement, dragStartPixels, value, suppressVisibilityChange) { return _this.addFullWidthRowDragging(rowDraggerElement, dragStartPixels, value, suppressVisibilityChange); }
|
25202 | };
|
25203 | return params;
|
25204 | };
|
25205 | RowCtrl.prototype.addFullWidthRowDragging = function (rowDraggerElement, dragStartPixels, value, suppressVisibilityChange) {
|
25206 | if (value === void 0) { value = ''; }
|
25207 | if (!this.isFullWidth()) {
|
25208 | return;
|
25209 | }
|
25210 | var rowDragComp = new RowDragComp(function () { return value; }, this.rowNode, undefined, rowDraggerElement, dragStartPixels, suppressVisibilityChange);
|
25211 | this.createManagedBean(rowDragComp, this.beans.context);
|
25212 | };
|
25213 | RowCtrl.prototype.onUiLevelChanged = function () {
|
25214 | var newLevel = this.beans.rowCssClassCalculator.calculateRowLevel(this.rowNode);
|
25215 | if (this.rowLevel != newLevel) {
|
25216 | var classToAdd_1 = 'ag-row-level-' + newLevel;
|
25217 | var classToRemove_1 = 'ag-row-level-' + this.rowLevel;
|
25218 | this.allRowGuis.forEach(function (gui) {
|
25219 | gui.rowComp.addOrRemoveCssClass(classToAdd_1, true);
|
25220 | gui.rowComp.addOrRemoveCssClass(classToRemove_1, false);
|
25221 | });
|
25222 | }
|
25223 | this.rowLevel = newLevel;
|
25224 | };
|
25225 | RowCtrl.prototype.isFirstRowOnPage = function () {
|
25226 | return this.rowNode.rowIndex === this.beans.paginationProxy.getPageFirstRow();
|
25227 | };
|
25228 | RowCtrl.prototype.isLastRowOnPage = function () {
|
25229 | return this.rowNode.rowIndex === this.beans.paginationProxy.getPageLastRow();
|
25230 | };
|
25231 | RowCtrl.prototype.onModelUpdated = function () {
|
25232 | this.refreshFirstAndLastRowStyles();
|
25233 | };
|
25234 | RowCtrl.prototype.refreshFirstAndLastRowStyles = function () {
|
25235 | var newFirst = this.isFirstRowOnPage();
|
25236 | var newLast = this.isLastRowOnPage();
|
25237 | if (this.firstRowOnPage !== newFirst) {
|
25238 | this.firstRowOnPage = newFirst;
|
25239 | this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-first', newFirst); });
|
25240 | }
|
25241 | if (this.lastRowOnPage !== newLast) {
|
25242 | this.lastRowOnPage = newLast;
|
25243 | this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-last', newLast); });
|
25244 | }
|
25245 | };
|
25246 | RowCtrl.prototype.stopEditing = function (cancel) {
|
25247 | if (cancel === void 0) { cancel = false; }
|
25248 | var cellEdits = this.getAllCellCtrls().map(function (cellCtrl) { return cellCtrl.stopEditing(cancel); });
|
25249 | if (!this.editingRow) {
|
25250 | return;
|
25251 | }
|
25252 | if (!cancel && cellEdits.some(function (edit) { return edit; })) {
|
25253 | var event_1 = this.createRowEvent(Events.EVENT_ROW_VALUE_CHANGED);
|
25254 | this.beans.eventService.dispatchEvent(event_1);
|
25255 | }
|
25256 | this.setEditingRow(false);
|
25257 | };
|
25258 | RowCtrl.prototype.setInlineEditingCss = function (editing) {
|
25259 | this.allRowGuis.forEach(function (gui) {
|
25260 | gui.rowComp.addOrRemoveCssClass("ag-row-inline-editing", editing);
|
25261 | gui.rowComp.addOrRemoveCssClass("ag-row-not-inline-editing", !editing);
|
25262 | });
|
25263 | };
|
25264 | RowCtrl.prototype.setEditingRow = function (value) {
|
25265 | this.editingRow = value;
|
25266 | this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-editing', value); });
|
25267 | var event = value ?
|
25268 | this.createRowEvent(Events.EVENT_ROW_EDITING_STARTED)
|
25269 | : this.createRowEvent(Events.EVENT_ROW_EDITING_STOPPED);
|
25270 | this.beans.eventService.dispatchEvent(event);
|
25271 | };
|
25272 | RowCtrl.prototype.startRowEditing = function (key, charPress, sourceRenderedCell, event) {
|
25273 | if (key === void 0) { key = null; }
|
25274 | if (charPress === void 0) { charPress = null; }
|
25275 | if (sourceRenderedCell === void 0) { sourceRenderedCell = null; }
|
25276 | if (event === void 0) { event = null; }
|
25277 |
|
25278 | if (this.editingRow) {
|
25279 | return;
|
25280 | }
|
25281 | this.getAllCellCtrls().forEach(function (cellCtrl) {
|
25282 | var cellStartedEdit = cellCtrl === sourceRenderedCell;
|
25283 | if (cellStartedEdit) {
|
25284 | cellCtrl.startEditing(key, charPress, cellStartedEdit, event);
|
25285 | }
|
25286 | else {
|
25287 | cellCtrl.startEditing(null, null, cellStartedEdit, event);
|
25288 | }
|
25289 | });
|
25290 | this.setEditingRow(true);
|
25291 | };
|
25292 | RowCtrl.prototype.getAllCellCtrls = function () {
|
25293 | var res = __spread$6(this.centerCellCtrls.list, this.leftCellCtrls.list, this.rightCellCtrls.list);
|
25294 | return res;
|
25295 | };
|
25296 | RowCtrl.prototype.postProcessClassesFromGridOptions = function () {
|
25297 | var _this = this;
|
25298 | var cssClasses = this.beans.rowCssClassCalculator.processClassesFromGridOptions(this.rowNode);
|
25299 | if (!cssClasses || !cssClasses.length) {
|
25300 | return;
|
25301 | }
|
25302 | cssClasses.forEach(function (classStr) {
|
25303 | _this.allRowGuis.forEach(function (c) { return c.rowComp.addOrRemoveCssClass(classStr, true); });
|
25304 | });
|
25305 | };
|
25306 | RowCtrl.prototype.postProcessRowClassRules = function () {
|
25307 | var _this = this;
|
25308 | this.beans.rowCssClassCalculator.processRowClassRules(this.rowNode, function (className) {
|
25309 | _this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass(className, true); });
|
25310 | }, function (className) {
|
25311 | _this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass(className, false); });
|
25312 | });
|
25313 | };
|
25314 | RowCtrl.prototype.setStylesFromGridOptions = function () {
|
25315 | var rowStyles = this.processStylesFromGridOptions();
|
25316 | this.allRowGuis.forEach(function (gui) { return gui.rowComp.setUserStyles(rowStyles); });
|
25317 | };
|
25318 | RowCtrl.prototype.getRowBusinessKey = function () {
|
25319 | var businessKeyForNodeFunc = this.beans.gridOptionsWrapper.getBusinessKeyForNodeFunc();
|
25320 | if (typeof businessKeyForNodeFunc !== 'function') {
|
25321 | return;
|
25322 | }
|
25323 | return businessKeyForNodeFunc(this.rowNode);
|
25324 | };
|
25325 | RowCtrl.prototype.getPinnedForContainer = function (rowContainerType) {
|
25326 | var pinned = rowContainerType === RowContainerType.LEFT ? Constants.PINNED_LEFT :
|
25327 | rowContainerType === RowContainerType.RIGHT ? Constants.PINNED_RIGHT : null;
|
25328 | return pinned;
|
25329 | };
|
25330 | RowCtrl.prototype.getInitialRowClasses = function (rowContainerType) {
|
25331 | var pinned = this.getPinnedForContainer(rowContainerType);
|
25332 | var params = {
|
25333 | rowNode: this.rowNode,
|
25334 | rowFocused: this.rowFocused,
|
25335 | fadeRowIn: this.fadeRowIn,
|
25336 | rowIsEven: this.rowNode.rowIndex % 2 === 0,
|
25337 | rowLevel: this.rowLevel,
|
25338 | fullWidthRow: this.isFullWidth(),
|
25339 | firstRowOnPage: this.isFirstRowOnPage(),
|
25340 | lastRowOnPage: this.isLastRowOnPage(),
|
25341 | printLayout: this.printLayout,
|
25342 | expandable: this.rowNode.isExpandable(),
|
25343 | pinned: pinned
|
25344 | };
|
25345 | return this.beans.rowCssClassCalculator.getInitialRowClasses(params);
|
25346 | };
|
25347 | RowCtrl.prototype.processStylesFromGridOptions = function () {
|
25348 |
|
25349 | var rowStyle = this.beans.gridOptionsWrapper.getRowStyle();
|
25350 | if (rowStyle && typeof rowStyle === 'function') {
|
25351 | console.warn('AG Grid: rowStyle should be an object of key/value styles, not be a function, use getRowStyle() instead');
|
25352 | return;
|
25353 | }
|
25354 |
|
25355 | var rowStyleFunc = this.beans.gridOptionsWrapper.getRowStyleFunc();
|
25356 | var rowStyleFuncResult;
|
25357 | if (rowStyleFunc) {
|
25358 | var params = {
|
25359 | data: this.rowNode.data,
|
25360 | node: this.rowNode,
|
25361 | rowIndex: this.rowNode.rowIndex
|
25362 | };
|
25363 | rowStyleFuncResult = rowStyleFunc(params);
|
25364 | }
|
25365 | return Object.assign({}, rowStyle, rowStyleFuncResult);
|
25366 | };
|
25367 | RowCtrl.prototype.onRowSelected = function () {
|
25368 | var _this = this;
|
25369 |
|
25370 |
|
25371 | var selected = !!this.rowNode.isSelected();
|
25372 | this.allRowGuis.forEach(function (gui) {
|
25373 | gui.rowComp.addOrRemoveCssClass('ag-row-selected', selected);
|
25374 | setAriaSelected(gui.element, selected ? true : undefined);
|
25375 | var ariaLabel = _this.createAriaLabel();
|
25376 | setAriaLabel(gui.element, ariaLabel == null ? '' : ariaLabel);
|
25377 | });
|
25378 | };
|
25379 | RowCtrl.prototype.createAriaLabel = function () {
|
25380 | var selected = this.rowNode.isSelected();
|
25381 | if (selected && this.beans.gridOptionsWrapper.isSuppressRowDeselection()) {
|
25382 | return undefined;
|
25383 | }
|
25384 | var translate = this.beans.gridOptionsWrapper.getLocaleTextFunc();
|
25385 | var label = translate(selected ? 'ariaRowDeselect' : 'ariaRowSelect', "Press SPACE to " + (selected ? 'deselect' : 'select') + " this row.");
|
25386 | return label;
|
25387 | };
|
25388 | RowCtrl.prototype.isUseAnimationFrameForCreate = function () {
|
25389 | return this.useAnimationFrameForCreate;
|
25390 | };
|
25391 | RowCtrl.prototype.addHoverFunctionality = function (eRow) {
|
25392 | var _this = this;
|
25393 |
|
25394 |
|
25395 | if (!this.active) {
|
25396 | return;
|
25397 | }
|
25398 |
|
25399 |
|
25400 |
|
25401 |
|
25402 |
|
25403 |
|
25404 |
|
25405 | this.addManagedListener(eRow, 'mouseenter', function () { return _this.rowNode.onMouseEnter(); });
|
25406 | this.addManagedListener(eRow, 'mouseleave', function () { return _this.rowNode.onMouseLeave(); });
|
25407 |
|
25408 | this.addManagedListener(this.rowNode, RowNode.EVENT_MOUSE_ENTER, function () {
|
25409 |
|
25410 |
|
25411 |
|
25412 | if (!_this.beans.gridOptionsWrapper.isSuppressRowHoverHighlight()) {
|
25413 | eRow.classList.add('ag-row-hover');
|
25414 | }
|
25415 | });
|
25416 | this.addManagedListener(this.rowNode, RowNode.EVENT_MOUSE_LEAVE, function () {
|
25417 | eRow.classList.remove('ag-row-hover');
|
25418 | });
|
25419 | };
|
25420 |
|
25421 |
|
25422 |
|
25423 |
|
25424 | RowCtrl.prototype.roundRowTopToBounds = function (rowTop) {
|
25425 | var gridBodyCon = this.beans.ctrlsService.getGridBodyCtrl();
|
25426 | var range = gridBodyCon.getScrollFeature().getVScrollPosition();
|
25427 | var minPixel = this.applyPaginationOffset(range.top, true) - 100;
|
25428 | var maxPixel = this.applyPaginationOffset(range.bottom, true) + 100;
|
25429 | return Math.min(Math.max(minPixel, rowTop), maxPixel);
|
25430 | };
|
25431 | RowCtrl.prototype.getFrameworkOverrides = function () {
|
25432 | return this.beans.frameworkOverrides;
|
25433 | };
|
25434 | RowCtrl.prototype.onRowHeightChanged = function () {
|
25435 |
|
25436 |
|
25437 |
|
25438 | if (this.rowNode.rowHeight == null) {
|
25439 | return;
|
25440 | }
|
25441 | var rowHeight = this.rowNode.rowHeight;
|
25442 | var defaultRowHeight = this.beans.gridOptionsWrapper.getDefaultRowHeight();
|
25443 | var isHeightFromFunc = this.beans.gridOptionsWrapper.isGetRowHeightFunction();
|
25444 | var heightFromFunc = isHeightFromFunc ? this.beans.gridOptionsWrapper.getRowHeightForNode(this.rowNode).height : undefined;
|
25445 | var lineHeight = heightFromFunc ? Math.min(defaultRowHeight, heightFromFunc) - 2 + "px" : undefined;
|
25446 | this.allRowGuis.forEach(function (gui) {
|
25447 | gui.element.style.height = rowHeight + "px";
|
25448 |
|
25449 |
|
25450 |
|
25451 |
|
25452 |
|
25453 |
|
25454 |
|
25455 |
|
25456 |
|
25457 |
|
25458 | if (lineHeight) {
|
25459 | gui.element.style.setProperty('--ag-line-height', lineHeight);
|
25460 | }
|
25461 | });
|
25462 | };
|
25463 | RowCtrl.prototype.addEventListener = function (eventType, listener) {
|
25464 | if (eventType === 'renderedRowRemoved' || eventType === 'rowRemoved') {
|
25465 | eventType = Events.EVENT_VIRTUAL_ROW_REMOVED;
|
25466 | console.warn('AG Grid: Since version 11, event renderedRowRemoved is now called ' + Events.EVENT_VIRTUAL_ROW_REMOVED);
|
25467 | }
|
25468 | _super.prototype.addEventListener.call(this, eventType, listener);
|
25469 | };
|
25470 | RowCtrl.prototype.removeEventListener = function (eventType, listener) {
|
25471 | if (eventType === 'renderedRowRemoved' || eventType === 'rowRemoved') {
|
25472 | eventType = Events.EVENT_VIRTUAL_ROW_REMOVED;
|
25473 | console.warn('AG Grid: Since version 11, event renderedRowRemoved and rowRemoved is now called ' + Events.EVENT_VIRTUAL_ROW_REMOVED);
|
25474 | }
|
25475 | _super.prototype.removeEventListener.call(this, eventType, listener);
|
25476 | };
|
25477 |
|
25478 | RowCtrl.prototype.destroyFirstPass = function () {
|
25479 | this.active = false;
|
25480 |
|
25481 |
|
25482 | this.setupRemoveAnimation();
|
25483 | var event = this.createRowEvent(Events.EVENT_VIRTUAL_ROW_REMOVED);
|
25484 | this.dispatchEvent(event);
|
25485 | this.beans.eventService.dispatchEvent(event);
|
25486 | _super.prototype.destroy.call(this);
|
25487 | };
|
25488 | RowCtrl.prototype.setupRemoveAnimation = function () {
|
25489 | var rowStillVisibleJustNotInViewport = this.rowNode.rowTop != null;
|
25490 | if (rowStillVisibleJustNotInViewport) {
|
25491 |
|
25492 |
|
25493 |
|
25494 |
|
25495 | var rowTop = this.roundRowTopToBounds(this.rowNode.rowTop);
|
25496 | this.setRowTop(rowTop);
|
25497 | }
|
25498 | else {
|
25499 | this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-opacity-zero', true); });
|
25500 | }
|
25501 | };
|
25502 | RowCtrl.prototype.destroySecondPass = function () {
|
25503 | this.allRowGuis.length = 0;
|
25504 | var destroyCellCtrls = function (ctrls) {
|
25505 | ctrls.list.forEach(function (c) { return c.destroy(); });
|
25506 | return { list: [], map: {} };
|
25507 | };
|
25508 | this.centerCellCtrls = destroyCellCtrls(this.centerCellCtrls);
|
25509 | this.leftCellCtrls = destroyCellCtrls(this.leftCellCtrls);
|
25510 | this.rightCellCtrls = destroyCellCtrls(this.rightCellCtrls);
|
25511 | };
|
25512 | RowCtrl.prototype.setFocusedClasses = function () {
|
25513 | var _this = this;
|
25514 | this.allRowGuis.forEach(function (gui) {
|
25515 | gui.rowComp.addOrRemoveCssClass('ag-row-focus', _this.rowFocused);
|
25516 | gui.rowComp.addOrRemoveCssClass('ag-row-no-focus', !_this.rowFocused);
|
25517 | });
|
25518 | };
|
25519 | RowCtrl.prototype.onCellFocusChanged = function () {
|
25520 | var rowFocused = this.beans.focusService.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned);
|
25521 | if (rowFocused !== this.rowFocused) {
|
25522 | this.rowFocused = rowFocused;
|
25523 | this.setFocusedClasses();
|
25524 | }
|
25525 |
|
25526 | if (!rowFocused && this.editingRow) {
|
25527 | this.stopEditing(false);
|
25528 | }
|
25529 | };
|
25530 | RowCtrl.prototype.onPaginationChanged = function () {
|
25531 | var currentPage = this.beans.paginationProxy.getCurrentPage();
|
25532 |
|
25533 |
|
25534 | if (this.paginationPage !== currentPage) {
|
25535 | this.paginationPage = currentPage;
|
25536 | this.onTopChanged();
|
25537 | }
|
25538 | this.refreshFirstAndLastRowStyles();
|
25539 | };
|
25540 | RowCtrl.prototype.onTopChanged = function () {
|
25541 | this.setRowTop(this.rowNode.rowTop);
|
25542 | };
|
25543 | RowCtrl.prototype.onPaginationPixelOffsetChanged = function () {
|
25544 |
|
25545 | this.onTopChanged();
|
25546 | };
|
25547 |
|
25548 |
|
25549 |
|
25550 | RowCtrl.prototype.applyPaginationOffset = function (topPx, reverse) {
|
25551 | if (reverse === void 0) { reverse = false; }
|
25552 | if (this.rowNode.isRowPinned()) {
|
25553 | return topPx;
|
25554 | }
|
25555 | var pixelOffset = this.beans.paginationProxy.getPixelOffset();
|
25556 | var multiplier = reverse ? 1 : -1;
|
25557 | return topPx + (pixelOffset * multiplier);
|
25558 | };
|
25559 | RowCtrl.prototype.setRowTop = function (pixels) {
|
25560 |
|
25561 | if (this.printLayout) {
|
25562 | return;
|
25563 | }
|
25564 |
|
25565 |
|
25566 | if (exists(pixels)) {
|
25567 | var afterPaginationPixels = this.applyPaginationOffset(pixels);
|
25568 | var afterScalingPixels = this.rowNode.isRowPinned() ? afterPaginationPixels : this.beans.rowContainerHeightService.getRealPixelPosition(afterPaginationPixels);
|
25569 | var topPx = afterScalingPixels + "px";
|
25570 | this.setRowTopStyle(topPx);
|
25571 | }
|
25572 | };
|
25573 | RowCtrl.prototype.getInitialRowTop = function () {
|
25574 | return this.initialTop;
|
25575 | };
|
25576 | RowCtrl.prototype.getInitialTransform = function () {
|
25577 | return this.initialTransform;
|
25578 | };
|
25579 | RowCtrl.prototype.setInitialRowTop = function () {
|
25580 |
|
25581 | if (this.printLayout) {
|
25582 | return '';
|
25583 | }
|
25584 |
|
25585 | var pixels = this.slideRowIn ? this.roundRowTopToBounds(this.rowNode.oldRowTop) : this.rowNode.rowTop;
|
25586 | var afterPaginationPixels = this.applyPaginationOffset(pixels);
|
25587 |
|
25588 | var afterScalingPixels = this.rowNode.isRowPinned() ? afterPaginationPixels : this.beans.rowContainerHeightService.getRealPixelPosition(afterPaginationPixels);
|
25589 | var res = afterScalingPixels + 'px';
|
25590 | var suppressRowTransform = this.beans.gridOptionsWrapper.isSuppressRowTransform();
|
25591 | if (suppressRowTransform) {
|
25592 | this.initialTop = res;
|
25593 | }
|
25594 | else {
|
25595 | this.initialTransform = "translateY(" + res + ")";
|
25596 | }
|
25597 | };
|
25598 | RowCtrl.prototype.setRowTopStyle = function (topPx) {
|
25599 | var suppressRowTransform = this.beans.gridOptionsWrapper.isSuppressRowTransform();
|
25600 | this.allRowGuis.forEach(function (gui) { return suppressRowTransform ?
|
25601 | gui.rowComp.setTop(topPx) :
|
25602 | gui.rowComp.setTransform("translateY(" + topPx + ")"); });
|
25603 | };
|
25604 | RowCtrl.prototype.getRowNode = function () {
|
25605 | return this.rowNode;
|
25606 | };
|
25607 | RowCtrl.prototype.getCellCtrl = function (column) {
|
25608 |
|
25609 | var res = null;
|
25610 | this.getAllCellCtrls().forEach(function (cellCtrl) {
|
25611 | if (cellCtrl.getColumn() == column) {
|
25612 | res = cellCtrl;
|
25613 | }
|
25614 | });
|
25615 | if (res != null) {
|
25616 | return res;
|
25617 | }
|
25618 |
|
25619 |
|
25620 |
|
25621 |
|
25622 |
|
25623 | this.getAllCellCtrls().forEach(function (cellCtrl) {
|
25624 | if (cellCtrl.getColSpanningList().indexOf(column) >= 0) {
|
25625 | res = cellCtrl;
|
25626 | }
|
25627 | });
|
25628 | return res;
|
25629 | };
|
25630 | RowCtrl.prototype.onRowIndexChanged = function () {
|
25631 |
|
25632 |
|
25633 |
|
25634 | if (this.rowNode.rowIndex != null) {
|
25635 | this.onCellFocusChanged();
|
25636 | this.updateRowIndexes();
|
25637 | this.postProcessCss();
|
25638 | }
|
25639 | };
|
25640 | RowCtrl.prototype.updateRowIndexes = function () {
|
25641 | var rowIndexStr = this.rowNode.getRowIndexString();
|
25642 | var headerRowCount = this.beans.headerNavigationService.getHeaderRowCount();
|
25643 | var rowIsEven = this.rowNode.rowIndex % 2 === 0;
|
25644 | var ariaRowIndex = headerRowCount + this.rowNode.rowIndex + 1;
|
25645 | this.allRowGuis.forEach(function (c) {
|
25646 | c.rowComp.setRowIndex(rowIndexStr);
|
25647 | c.rowComp.addOrRemoveCssClass('ag-row-even', rowIsEven);
|
25648 | c.rowComp.addOrRemoveCssClass('ag-row-odd', !rowIsEven);
|
25649 | setAriaRowIndex(c.element, ariaRowIndex);
|
25650 | });
|
25651 | };
|
25652 |
|
25653 | RowCtrl.prototype.getPinnedLeftRowElement = function () {
|
25654 | return this.leftGui ? this.leftGui.element : undefined;
|
25655 | };
|
25656 |
|
25657 | RowCtrl.prototype.getPinnedRightRowElement = function () {
|
25658 | return this.rightGui ? this.rightGui.element : undefined;
|
25659 | };
|
25660 |
|
25661 | RowCtrl.prototype.getBodyRowElement = function () {
|
25662 | return this.centerGui ? this.centerGui.element : undefined;
|
25663 | };
|
25664 |
|
25665 | RowCtrl.prototype.getFullWidthRowElement = function () {
|
25666 | return this.fullWidthGui ? this.fullWidthGui.element : undefined;
|
25667 | };
|
25668 | RowCtrl.DOM_DATA_KEY_ROW_CTRL = 'renderedRow';
|
25669 | return RowCtrl;
|
25670 | }(BeanStub));
|
25671 |
|
25672 |
|
25673 |
|
25674 |
|
25675 |
|
25676 |
|
25677 |
|
25678 | var __extends$10 = (undefined && undefined.__extends) || (function () {
|
25679 | var extendStatics = function (d, b) {
|
25680 | extendStatics = Object.setPrototypeOf ||
|
25681 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
25682 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
25683 | return extendStatics(d, b);
|
25684 | };
|
25685 | return function (d, b) {
|
25686 | extendStatics(d, b);
|
25687 | function __() { this.constructor = d; }
|
25688 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
25689 | };
|
25690 | })();
|
25691 | var __decorate$P = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
25692 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
25693 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
25694 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
25695 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
25696 | };
|
25697 | var __read$9 = (undefined && undefined.__read) || function (o, n) {
|
25698 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
25699 | if (!m) return o;
|
25700 | var i = m.call(o), r, ar = [], e;
|
25701 | try {
|
25702 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
25703 | }
|
25704 | catch (error) { e = { error: error }; }
|
25705 | finally {
|
25706 | try {
|
25707 | if (r && !r.done && (m = i["return"])) m.call(i);
|
25708 | }
|
25709 | finally { if (e) throw e.error; }
|
25710 | }
|
25711 | return ar;
|
25712 | };
|
25713 | var RowContainerEventsFeature = (function (_super) {
|
25714 | __extends$10(RowContainerEventsFeature, _super);
|
25715 | function RowContainerEventsFeature(element) {
|
25716 | var _this = _super.call(this) || this;
|
25717 | _this.element = element;
|
25718 | return _this;
|
25719 | }
|
25720 | RowContainerEventsFeature.prototype.postConstruct = function () {
|
25721 | this.addMouseListeners();
|
25722 | this.mockContextMenuForIPad();
|
25723 | this.addKeyboardEvents();
|
25724 | };
|
25725 | RowContainerEventsFeature.prototype.addKeyboardEvents = function () {
|
25726 | var _this = this;
|
25727 | var eventNames = ['keydown', 'keypress'];
|
25728 | eventNames.forEach(function (eventName) {
|
25729 | var listener = _this.processKeyboardEvent.bind(_this, eventName);
|
25730 | _this.addManagedListener(_this.element, eventName, listener);
|
25731 | });
|
25732 | };
|
25733 | RowContainerEventsFeature.prototype.addMouseListeners = function () {
|
25734 | var _this = this;
|
25735 | var mouseDownEvent = isEventSupported('touchstart') ? 'touchstart' : 'mousedown';
|
25736 | var eventNames = ['dblclick', 'contextmenu', 'mouseover', 'mouseout', 'click', mouseDownEvent];
|
25737 | eventNames.forEach(function (eventName) {
|
25738 | var listener = _this.processMouseEvent.bind(_this, eventName);
|
25739 | _this.addManagedListener(_this.element, eventName, listener);
|
25740 | });
|
25741 | };
|
25742 | RowContainerEventsFeature.prototype.processMouseEvent = function (eventName, mouseEvent) {
|
25743 | if (!this.mouseEventService.isEventFromThisGrid(mouseEvent) ||
|
25744 | isStopPropagationForAgGrid(mouseEvent)) {
|
25745 | return;
|
25746 | }
|
25747 | var rowComp = this.getRowForEvent(mouseEvent);
|
25748 | var cellCtrl = this.mouseEventService.getRenderedCellForEvent(mouseEvent);
|
25749 | if (eventName === "contextmenu") {
|
25750 | this.handleContextMenuMouseEvent(mouseEvent, null, rowComp, cellCtrl);
|
25751 | }
|
25752 | else {
|
25753 | if (cellCtrl) {
|
25754 | cellCtrl.onMouseEvent(eventName, mouseEvent);
|
25755 | }
|
25756 | if (rowComp) {
|
25757 | rowComp.onMouseEvent(eventName, mouseEvent);
|
25758 | }
|
25759 | }
|
25760 | };
|
25761 | RowContainerEventsFeature.prototype.mockContextMenuForIPad = function () {
|
25762 | var _this = this;
|
25763 |
|
25764 | if (!isIOSUserAgent()) {
|
25765 | return;
|
25766 | }
|
25767 | var touchListener = new TouchListener(this.element);
|
25768 | var longTapListener = function (event) {
|
25769 | var rowComp = _this.getRowForEvent(event.touchEvent);
|
25770 | var cellComp = _this.mouseEventService.getRenderedCellForEvent(event.touchEvent);
|
25771 | _this.handleContextMenuMouseEvent(null, event.touchEvent, rowComp, cellComp);
|
25772 | };
|
25773 | this.addManagedListener(touchListener, TouchListener.EVENT_LONG_TAP, longTapListener);
|
25774 | this.addDestroyFunc(function () { return touchListener.destroy(); });
|
25775 | };
|
25776 | RowContainerEventsFeature.prototype.getRowForEvent = function (event) {
|
25777 | var sourceElement = event.target;
|
25778 | while (sourceElement) {
|
25779 | var rowCon = this.gridOptionsWrapper.getDomData(sourceElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL);
|
25780 | if (rowCon) {
|
25781 | return rowCon;
|
25782 | }
|
25783 | sourceElement = sourceElement.parentElement;
|
25784 | }
|
25785 | return null;
|
25786 | };
|
25787 | RowContainerEventsFeature.prototype.handleContextMenuMouseEvent = function (mouseEvent, touchEvent, rowComp, cellCtrl) {
|
25788 | var rowNode = rowComp ? rowComp.getRowNode() : null;
|
25789 | var column = cellCtrl ? cellCtrl.getColumn() : null;
|
25790 | var value = null;
|
25791 | if (column) {
|
25792 | var event_1 = mouseEvent ? mouseEvent : touchEvent;
|
25793 | cellCtrl.dispatchCellContextMenuEvent(event_1);
|
25794 | value = this.valueService.getValue(column, rowNode);
|
25795 | }
|
25796 |
|
25797 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
25798 | var anchorToElement = cellCtrl ? cellCtrl.getGui() : gridBodyCon.getGridBodyElement();
|
25799 | if (this.contextMenuFactory) {
|
25800 | this.contextMenuFactory.onContextMenu(mouseEvent, touchEvent, rowNode, column, value, anchorToElement);
|
25801 | }
|
25802 | };
|
25803 | RowContainerEventsFeature.prototype.processKeyboardEvent = function (eventName, keyboardEvent) {
|
25804 | var cellComp = getCtrlForEvent(this.gridOptionsWrapper, keyboardEvent, CellCtrl.DOM_DATA_KEY_CELL_CTRL);
|
25805 | var rowComp = getCtrlForEvent(this.gridOptionsWrapper, keyboardEvent, RowCtrl.DOM_DATA_KEY_ROW_CTRL);
|
25806 | if (keyboardEvent.defaultPrevented) {
|
25807 | return;
|
25808 | }
|
25809 | if (cellComp) {
|
25810 | this.processCellKeyboardEvent(cellComp, eventName, keyboardEvent);
|
25811 | }
|
25812 | else if (rowComp && rowComp.isFullWidth()) {
|
25813 | this.processFullWidthRowKeyboardEvent(rowComp, eventName, keyboardEvent);
|
25814 | }
|
25815 | };
|
25816 | RowContainerEventsFeature.prototype.processCellKeyboardEvent = function (cellCtrl, eventName, keyboardEvent) {
|
25817 | var rowNode = cellCtrl.getRowNode();
|
25818 | var column = cellCtrl.getColumn();
|
25819 | var editing = cellCtrl.isEditing();
|
25820 | var gridProcessingAllowed = !isUserSuppressingKeyboardEvent(this.gridOptionsWrapper, keyboardEvent, rowNode, column, editing);
|
25821 | if (gridProcessingAllowed) {
|
25822 | switch (eventName) {
|
25823 | case 'keydown':
|
25824 |
|
25825 | var wasScrollKey = !editing && this.navigationService.handlePageScrollingKey(keyboardEvent);
|
25826 |
|
25827 | if (!wasScrollKey) {
|
25828 | cellCtrl.onKeyDown(keyboardEvent);
|
25829 | }
|
25830 |
|
25831 | this.doGridOperations(keyboardEvent, cellCtrl.isEditing());
|
25832 | break;
|
25833 | case 'keypress':
|
25834 | cellCtrl.onKeyPress(keyboardEvent);
|
25835 | break;
|
25836 | }
|
25837 | }
|
25838 | if (eventName === 'keydown') {
|
25839 | var cellKeyDownEvent = cellCtrl.createEvent(keyboardEvent, Events.EVENT_CELL_KEY_DOWN);
|
25840 | this.eventService.dispatchEvent(cellKeyDownEvent);
|
25841 | }
|
25842 | if (eventName === 'keypress') {
|
25843 | var cellKeyPressEvent = cellCtrl.createEvent(keyboardEvent, Events.EVENT_CELL_KEY_PRESS);
|
25844 | this.eventService.dispatchEvent(cellKeyPressEvent);
|
25845 | }
|
25846 | };
|
25847 | RowContainerEventsFeature.prototype.processFullWidthRowKeyboardEvent = function (rowComp, eventName, keyboardEvent) {
|
25848 | var rowNode = rowComp.getRowNode();
|
25849 | var focusedCell = this.focusService.getFocusedCell();
|
25850 | var column = (focusedCell && focusedCell.column);
|
25851 | var gridProcessingAllowed = !isUserSuppressingKeyboardEvent(this.gridOptionsWrapper, keyboardEvent, rowNode, column, false);
|
25852 | if (gridProcessingAllowed) {
|
25853 | var key = keyboardEvent.key;
|
25854 | if (eventName === 'keydown') {
|
25855 | switch (key) {
|
25856 | case KeyCode.UP:
|
25857 | case KeyCode.DOWN:
|
25858 | rowComp.onKeyboardNavigate(keyboardEvent);
|
25859 | break;
|
25860 | case KeyCode.TAB:
|
25861 | rowComp.onTabKeyDown(keyboardEvent);
|
25862 | }
|
25863 | }
|
25864 | }
|
25865 | if (eventName === 'keydown') {
|
25866 | var cellKeyDownEvent = rowComp.createRowEvent(Events.EVENT_CELL_KEY_DOWN, keyboardEvent);
|
25867 | this.eventService.dispatchEvent(cellKeyDownEvent);
|
25868 | }
|
25869 | if (eventName === 'keypress') {
|
25870 | var cellKeyPressEvent = rowComp.createRowEvent(Events.EVENT_CELL_KEY_PRESS, keyboardEvent);
|
25871 | this.eventService.dispatchEvent(cellKeyPressEvent);
|
25872 | }
|
25873 | };
|
25874 | RowContainerEventsFeature.prototype.doGridOperations = function (keyboardEvent, editing) {
|
25875 |
|
25876 | if (!keyboardEvent.ctrlKey && !keyboardEvent.metaKey) {
|
25877 | return;
|
25878 | }
|
25879 |
|
25880 |
|
25881 |
|
25882 | if (editing) {
|
25883 | return;
|
25884 | }
|
25885 |
|
25886 |
|
25887 | if (!this.mouseEventService.isEventFromThisGrid(keyboardEvent)) {
|
25888 | return;
|
25889 | }
|
25890 | switch (keyboardEvent.code) {
|
25891 | case KeyCode.A:
|
25892 | return this.onCtrlAndA(keyboardEvent);
|
25893 | case KeyCode.C:
|
25894 | return this.onCtrlAndC(keyboardEvent);
|
25895 | case KeyCode.V:
|
25896 | return this.onCtrlAndV();
|
25897 | case KeyCode.D:
|
25898 | return this.onCtrlAndD(keyboardEvent);
|
25899 | case KeyCode.Z:
|
25900 | return keyboardEvent.shiftKey ? this.undoRedoService.redo() : this.undoRedoService.undo();
|
25901 | case KeyCode.Y:
|
25902 | return this.undoRedoService.redo();
|
25903 | }
|
25904 | };
|
25905 | RowContainerEventsFeature.prototype.onCtrlAndA = function (event) {
|
25906 | var _a = this, pinnedRowModel = _a.pinnedRowModel, paginationProxy = _a.paginationProxy, rangeService = _a.rangeService;
|
25907 | var PINNED_BOTTOM = Constants.PINNED_BOTTOM, PINNED_TOP = Constants.PINNED_TOP;
|
25908 | if (rangeService && paginationProxy.isRowsToRender()) {
|
25909 | var _b = __read$9([
|
25910 | pinnedRowModel.isEmpty(PINNED_TOP),
|
25911 | pinnedRowModel.isEmpty(PINNED_BOTTOM)
|
25912 | ], 2), isEmptyPinnedTop = _b[0], isEmptyPinnedBottom = _b[1];
|
25913 | var floatingStart = isEmptyPinnedTop ? null : PINNED_TOP;
|
25914 | var floatingEnd = void 0;
|
25915 | var rowEnd = void 0;
|
25916 | if (isEmptyPinnedBottom) {
|
25917 | floatingEnd = null;
|
25918 | rowEnd = this.paginationProxy.getRowCount() - 1;
|
25919 | }
|
25920 | else {
|
25921 | floatingEnd = PINNED_BOTTOM;
|
25922 | rowEnd = pinnedRowModel.getPinnedBottomRowData().length - 1;
|
25923 | }
|
25924 | var allDisplayedColumns = this.columnModel.getAllDisplayedColumns();
|
25925 | if (missingOrEmpty(allDisplayedColumns)) {
|
25926 | return;
|
25927 | }
|
25928 | rangeService.setCellRange({
|
25929 | rowStartIndex: 0,
|
25930 | rowStartPinned: floatingStart,
|
25931 | rowEndIndex: rowEnd,
|
25932 | rowEndPinned: floatingEnd,
|
25933 | columnStart: allDisplayedColumns[0],
|
25934 | columnEnd: last(allDisplayedColumns)
|
25935 | });
|
25936 | }
|
25937 | event.preventDefault();
|
25938 | };
|
25939 | RowContainerEventsFeature.prototype.onCtrlAndC = function (event) {
|
25940 | if (!this.clipboardService || this.gridOptionsWrapper.isEnableCellTextSelection()) {
|
25941 | return;
|
25942 | }
|
25943 | this.clipboardService.copyToClipboard();
|
25944 | event.preventDefault();
|
25945 | };
|
25946 | RowContainerEventsFeature.prototype.onCtrlAndV = function () {
|
25947 | if (ModuleRegistry.isRegistered(ModuleNames.ClipboardModule) && !this.gridOptionsWrapper.isSuppressClipboardPaste()) {
|
25948 | this.clipboardService.pasteFromClipboard();
|
25949 | }
|
25950 | };
|
25951 | RowContainerEventsFeature.prototype.onCtrlAndD = function (event) {
|
25952 | if (ModuleRegistry.isRegistered(ModuleNames.ClipboardModule) && !this.gridOptionsWrapper.isSuppressClipboardPaste()) {
|
25953 | this.clipboardService.copyRangeDown();
|
25954 | }
|
25955 | event.preventDefault();
|
25956 | };
|
25957 | __decorate$P([
|
25958 | Autowired('mouseEventService')
|
25959 | ], RowContainerEventsFeature.prototype, "mouseEventService", void 0);
|
25960 | __decorate$P([
|
25961 | Autowired('valueService')
|
25962 | ], RowContainerEventsFeature.prototype, "valueService", void 0);
|
25963 | __decorate$P([
|
25964 | Optional('contextMenuFactory')
|
25965 | ], RowContainerEventsFeature.prototype, "contextMenuFactory", void 0);
|
25966 | __decorate$P([
|
25967 | Autowired('ctrlsService')
|
25968 | ], RowContainerEventsFeature.prototype, "ctrlsService", void 0);
|
25969 | __decorate$P([
|
25970 | Autowired('navigationService')
|
25971 | ], RowContainerEventsFeature.prototype, "navigationService", void 0);
|
25972 | __decorate$P([
|
25973 | Autowired('focusService')
|
25974 | ], RowContainerEventsFeature.prototype, "focusService", void 0);
|
25975 | __decorate$P([
|
25976 | Autowired('undoRedoService')
|
25977 | ], RowContainerEventsFeature.prototype, "undoRedoService", void 0);
|
25978 | __decorate$P([
|
25979 | Autowired('columnModel')
|
25980 | ], RowContainerEventsFeature.prototype, "columnModel", void 0);
|
25981 | __decorate$P([
|
25982 | Autowired('paginationProxy')
|
25983 | ], RowContainerEventsFeature.prototype, "paginationProxy", void 0);
|
25984 | __decorate$P([
|
25985 | Autowired('pinnedRowModel')
|
25986 | ], RowContainerEventsFeature.prototype, "pinnedRowModel", void 0);
|
25987 | __decorate$P([
|
25988 | Optional('rangeService')
|
25989 | ], RowContainerEventsFeature.prototype, "rangeService", void 0);
|
25990 | __decorate$P([
|
25991 | Optional('clipboardService')
|
25992 | ], RowContainerEventsFeature.prototype, "clipboardService", void 0);
|
25993 | __decorate$P([
|
25994 | PostConstruct
|
25995 | ], RowContainerEventsFeature.prototype, "postConstruct", null);
|
25996 | return RowContainerEventsFeature;
|
25997 | }(BeanStub));
|
25998 |
|
25999 |
|
26000 |
|
26001 |
|
26002 |
|
26003 |
|
26004 |
|
26005 | var __extends$11 = (undefined && undefined.__extends) || (function () {
|
26006 | var extendStatics = function (d, b) {
|
26007 | extendStatics = Object.setPrototypeOf ||
|
26008 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
26009 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
26010 | return extendStatics(d, b);
|
26011 | };
|
26012 | return function (d, b) {
|
26013 | extendStatics(d, b);
|
26014 | function __() { this.constructor = d; }
|
26015 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26016 | };
|
26017 | })();
|
26018 | var __decorate$Q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
26019 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
26020 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
26021 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
26022 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
26023 | };
|
26024 |
|
26025 |
|
26026 |
|
26027 | var ViewportSizeFeature = (function (_super) {
|
26028 | __extends$11(ViewportSizeFeature, _super);
|
26029 | function ViewportSizeFeature(centerContainerCtrl) {
|
26030 | var _this = _super.call(this) || this;
|
26031 | _this.centerContainerCtrl = centerContainerCtrl;
|
26032 | return _this;
|
26033 | }
|
26034 | ViewportSizeFeature.prototype.postConstruct = function () {
|
26035 | var _this = this;
|
26036 | this.ctrlsService.whenReady(function () {
|
26037 | _this.gridBodyCtrl = _this.ctrlsService.getGridBodyCtrl();
|
26038 | _this.listenForResize();
|
26039 | });
|
26040 | this.addManagedListener(this.eventService, Events.EVENT_SCROLLBAR_WIDTH_CHANGED, this.onScrollbarWidthChanged.bind(this));
|
26041 | };
|
26042 | ViewportSizeFeature.prototype.listenForResize = function () {
|
26043 | var _this = this;
|
26044 | var listener = function () { return _this.onCenterViewportResized(); };
|
26045 |
|
26046 | this.centerContainerCtrl.registerViewportResizeListener(listener);
|
26047 |
|
26048 | this.gridBodyCtrl.registerBodyViewportResizeListener(listener);
|
26049 | };
|
26050 | ViewportSizeFeature.prototype.onScrollbarWidthChanged = function () {
|
26051 | this.checkViewportAndScrolls();
|
26052 | };
|
26053 | ViewportSizeFeature.prototype.onCenterViewportResized = function () {
|
26054 | if (this.centerContainerCtrl.isViewportVisible()) {
|
26055 | this.checkViewportAndScrolls();
|
26056 | var newWidth = this.centerContainerCtrl.getCenterWidth();
|
26057 | if (newWidth !== this.centerWidth) {
|
26058 | this.centerWidth = newWidth;
|
26059 | this.columnModel.refreshFlexedColumns({ viewportWidth: this.centerWidth, updateBodyWidths: true, fireResizedEvent: true });
|
26060 | }
|
26061 | }
|
26062 | else {
|
26063 | this.bodyHeight = 0;
|
26064 | }
|
26065 | };
|
26066 |
|
26067 |
|
26068 | ViewportSizeFeature.prototype.checkViewportAndScrolls = function () {
|
26069 |
|
26070 | this.updateScrollVisibleService();
|
26071 |
|
26072 | this.checkBodyHeight();
|
26073 |
|
26074 | this.onHorizontalViewportChanged();
|
26075 | this.gridBodyCtrl.getScrollFeature().checkScrollLeft();
|
26076 | };
|
26077 | ViewportSizeFeature.prototype.getBodyHeight = function () {
|
26078 | return this.bodyHeight;
|
26079 | };
|
26080 | ViewportSizeFeature.prototype.checkBodyHeight = function () {
|
26081 | var eBodyViewport = this.gridBodyCtrl.getBodyViewportElement();
|
26082 | var bodyHeight = getInnerHeight(eBodyViewport);
|
26083 | if (this.bodyHeight !== bodyHeight) {
|
26084 | this.bodyHeight = bodyHeight;
|
26085 | var event_1 = {
|
26086 | type: Events.EVENT_BODY_HEIGHT_CHANGED,
|
26087 | api: this.gridApi,
|
26088 | columnApi: this.columnApi
|
26089 | };
|
26090 | this.eventService.dispatchEvent(event_1);
|
26091 | }
|
26092 | };
|
26093 | ViewportSizeFeature.prototype.updateScrollVisibleService = function () {
|
26094 |
|
26095 |
|
26096 |
|
26097 |
|
26098 |
|
26099 |
|
26100 | this.updateScrollVisibleServiceImpl();
|
26101 | setTimeout(this.updateScrollVisibleServiceImpl.bind(this), 500);
|
26102 | };
|
26103 | ViewportSizeFeature.prototype.updateScrollVisibleServiceImpl = function () {
|
26104 | var params = {
|
26105 | horizontalScrollShowing: this.isHorizontalScrollShowing(),
|
26106 | verticalScrollShowing: this.gridBodyCtrl.isVerticalScrollShowing()
|
26107 | };
|
26108 | this.scrollVisibleService.setScrollsVisible(params);
|
26109 |
|
26110 | this.gridBodyCtrl.setVerticalScrollPaddingVisible(params.verticalScrollShowing);
|
26111 | };
|
26112 | ViewportSizeFeature.prototype.isHorizontalScrollShowing = function () {
|
26113 | var isAlwaysShowHorizontalScroll = this.gridOptionsWrapper.isAlwaysShowHorizontalScroll();
|
26114 | return isAlwaysShowHorizontalScroll || this.centerContainerCtrl.isViewportHScrollShowing();
|
26115 | };
|
26116 |
|
26117 |
|
26118 |
|
26119 | ViewportSizeFeature.prototype.onHorizontalViewportChanged = function () {
|
26120 | var scrollWidth = this.centerContainerCtrl.getCenterWidth();
|
26121 | var scrollPosition = this.centerContainerCtrl.getViewportScrollLeft();
|
26122 | this.columnModel.setViewportPosition(scrollWidth, scrollPosition);
|
26123 | };
|
26124 | __decorate$Q([
|
26125 | Autowired('ctrlsService')
|
26126 | ], ViewportSizeFeature.prototype, "ctrlsService", void 0);
|
26127 | __decorate$Q([
|
26128 | Autowired('columnModel')
|
26129 | ], ViewportSizeFeature.prototype, "columnModel", void 0);
|
26130 | __decorate$Q([
|
26131 | Autowired('scrollVisibleService')
|
26132 | ], ViewportSizeFeature.prototype, "scrollVisibleService", void 0);
|
26133 | __decorate$Q([
|
26134 | Autowired('columnApi')
|
26135 | ], ViewportSizeFeature.prototype, "columnApi", void 0);
|
26136 | __decorate$Q([
|
26137 | Autowired('gridApi')
|
26138 | ], ViewportSizeFeature.prototype, "gridApi", void 0);
|
26139 | __decorate$Q([
|
26140 | PostConstruct
|
26141 | ], ViewportSizeFeature.prototype, "postConstruct", null);
|
26142 | return ViewportSizeFeature;
|
26143 | }(BeanStub));
|
26144 |
|
26145 |
|
26146 |
|
26147 |
|
26148 |
|
26149 |
|
26150 |
|
26151 | var __extends$12 = (undefined && undefined.__extends) || (function () {
|
26152 | var extendStatics = function (d, b) {
|
26153 | extendStatics = Object.setPrototypeOf ||
|
26154 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
26155 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
26156 | return extendStatics(d, b);
|
26157 | };
|
26158 | return function (d, b) {
|
26159 | extendStatics(d, b);
|
26160 | function __() { this.constructor = d; }
|
26161 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26162 | };
|
26163 | })();
|
26164 | var __decorate$R = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
26165 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
26166 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
26167 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
26168 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
26169 | };
|
26170 | var SetPinnedLeftWidthFeature = (function (_super) {
|
26171 | __extends$12(SetPinnedLeftWidthFeature, _super);
|
26172 | function SetPinnedLeftWidthFeature(element) {
|
26173 | var _this = _super.call(this) || this;
|
26174 | _this.element = element;
|
26175 | return _this;
|
26176 | }
|
26177 | SetPinnedLeftWidthFeature.prototype.postConstruct = function () {
|
26178 | this.addManagedListener(this.eventService, Events.EVENT_LEFT_PINNED_WIDTH_CHANGED, this.onPinnedLeftWidthChanged.bind(this));
|
26179 | };
|
26180 | SetPinnedLeftWidthFeature.prototype.onPinnedLeftWidthChanged = function () {
|
26181 | var leftWidth = this.pinnedWidthService.getPinnedLeftWidth();
|
26182 | var displayed = leftWidth > 0;
|
26183 | setDisplayed(this.element, displayed);
|
26184 | if (displayed) {
|
26185 | setFixedWidth(this.element, leftWidth);
|
26186 | }
|
26187 | };
|
26188 | __decorate$R([
|
26189 | Autowired('pinnedWidthService')
|
26190 | ], SetPinnedLeftWidthFeature.prototype, "pinnedWidthService", void 0);
|
26191 | __decorate$R([
|
26192 | PostConstruct
|
26193 | ], SetPinnedLeftWidthFeature.prototype, "postConstruct", null);
|
26194 | return SetPinnedLeftWidthFeature;
|
26195 | }(BeanStub));
|
26196 |
|
26197 |
|
26198 |
|
26199 |
|
26200 |
|
26201 |
|
26202 |
|
26203 | var __extends$13 = (undefined && undefined.__extends) || (function () {
|
26204 | var extendStatics = function (d, b) {
|
26205 | extendStatics = Object.setPrototypeOf ||
|
26206 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
26207 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
26208 | return extendStatics(d, b);
|
26209 | };
|
26210 | return function (d, b) {
|
26211 | extendStatics(d, b);
|
26212 | function __() { this.constructor = d; }
|
26213 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26214 | };
|
26215 | })();
|
26216 | var __decorate$S = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
26217 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
26218 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
26219 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
26220 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
26221 | };
|
26222 | var SetPinnedRightWidthFeature = (function (_super) {
|
26223 | __extends$13(SetPinnedRightWidthFeature, _super);
|
26224 | function SetPinnedRightWidthFeature(element) {
|
26225 | var _this = _super.call(this) || this;
|
26226 | _this.element = element;
|
26227 | return _this;
|
26228 | }
|
26229 | SetPinnedRightWidthFeature.prototype.postConstruct = function () {
|
26230 | this.addManagedListener(this.eventService, Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED, this.onPinnedRightWidthChanged.bind(this));
|
26231 | };
|
26232 | SetPinnedRightWidthFeature.prototype.onPinnedRightWidthChanged = function () {
|
26233 | var rightWidth = this.pinnedWidthService.getPinnedRightWidth();
|
26234 | var displayed = rightWidth > 0;
|
26235 | setDisplayed(this.element, displayed);
|
26236 | if (displayed) {
|
26237 | setFixedWidth(this.element, rightWidth);
|
26238 | }
|
26239 | };
|
26240 | __decorate$S([
|
26241 | Autowired('pinnedWidthService')
|
26242 | ], SetPinnedRightWidthFeature.prototype, "pinnedWidthService", void 0);
|
26243 | __decorate$S([
|
26244 | PostConstruct
|
26245 | ], SetPinnedRightWidthFeature.prototype, "postConstruct", null);
|
26246 | return SetPinnedRightWidthFeature;
|
26247 | }(BeanStub));
|
26248 |
|
26249 |
|
26250 |
|
26251 |
|
26252 |
|
26253 |
|
26254 |
|
26255 | var __extends$14 = (undefined && undefined.__extends) || (function () {
|
26256 | var extendStatics = function (d, b) {
|
26257 | extendStatics = Object.setPrototypeOf ||
|
26258 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
26259 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
26260 | return extendStatics(d, b);
|
26261 | };
|
26262 | return function (d, b) {
|
26263 | extendStatics(d, b);
|
26264 | function __() { this.constructor = d; }
|
26265 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26266 | };
|
26267 | })();
|
26268 | var __decorate$T = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
26269 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
26270 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
26271 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
26272 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
26273 | };
|
26274 | var SetHeightFeature = (function (_super) {
|
26275 | __extends$14(SetHeightFeature, _super);
|
26276 | function SetHeightFeature(eContainer, eWrapper) {
|
26277 | var _this = _super.call(this) || this;
|
26278 | _this.eContainer = eContainer;
|
26279 | _this.eWrapper = eWrapper;
|
26280 | return _this;
|
26281 | }
|
26282 | SetHeightFeature.prototype.postConstruct = function () {
|
26283 | this.addManagedListener(this.eventService, Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED, this.onHeightChanged.bind(this));
|
26284 | };
|
26285 | SetHeightFeature.prototype.onHeightChanged = function () {
|
26286 | var height = this.maxDivHeightScaler.getUiContainerHeight();
|
26287 | var heightString = height != null ? height + "px" : "";
|
26288 | this.eContainer.style.height = heightString;
|
26289 | if (this.eWrapper) {
|
26290 | this.eWrapper.style.height = heightString;
|
26291 | }
|
26292 | };
|
26293 | __decorate$T([
|
26294 | Autowired("rowContainerHeightService")
|
26295 | ], SetHeightFeature.prototype, "maxDivHeightScaler", void 0);
|
26296 | __decorate$T([
|
26297 | PostConstruct
|
26298 | ], SetHeightFeature.prototype, "postConstruct", null);
|
26299 | return SetHeightFeature;
|
26300 | }(BeanStub));
|
26301 |
|
26302 |
|
26303 |
|
26304 |
|
26305 |
|
26306 |
|
26307 |
|
26308 | var __extends$15 = (undefined && undefined.__extends) || (function () {
|
26309 | var extendStatics = function (d, b) {
|
26310 | extendStatics = Object.setPrototypeOf ||
|
26311 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
26312 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
26313 | return extendStatics(d, b);
|
26314 | };
|
26315 | return function (d, b) {
|
26316 | extendStatics(d, b);
|
26317 | function __() { this.constructor = d; }
|
26318 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26319 | };
|
26320 | })();
|
26321 | var __decorate$U = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
26322 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
26323 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
26324 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
26325 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
26326 | };
|
26327 | var DragListenerFeature = (function (_super) {
|
26328 | __extends$15(DragListenerFeature, _super);
|
26329 | function DragListenerFeature(eContainer) {
|
26330 | var _this = _super.call(this) || this;
|
26331 | _this.eContainer = eContainer;
|
26332 | return _this;
|
26333 | }
|
26334 | DragListenerFeature.prototype.postConstruct = function () {
|
26335 | var _this = this;
|
26336 | if (!this.gridOptionsWrapper.isEnableRangeSelection() ||
|
26337 | missing(this.rangeService)
|
26338 | ) {
|
26339 | return;
|
26340 | }
|
26341 | var params = {
|
26342 | dragStartPixels: 0,
|
26343 | eElement: this.eContainer,
|
26344 | onDragStart: this.rangeService.onDragStart.bind(this.rangeService),
|
26345 | onDragStop: this.rangeService.onDragStop.bind(this.rangeService),
|
26346 | onDragging: this.rangeService.onDragging.bind(this.rangeService)
|
26347 | };
|
26348 | this.dragService.addDragSource(params);
|
26349 | this.addDestroyFunc(function () { return _this.dragService.removeDragSource(params); });
|
26350 | };
|
26351 | __decorate$U([
|
26352 | Optional('rangeService')
|
26353 | ], DragListenerFeature.prototype, "rangeService", void 0);
|
26354 | __decorate$U([
|
26355 | Autowired('dragService')
|
26356 | ], DragListenerFeature.prototype, "dragService", void 0);
|
26357 | __decorate$U([
|
26358 | PostConstruct
|
26359 | ], DragListenerFeature.prototype, "postConstruct", null);
|
26360 | return DragListenerFeature;
|
26361 | }(BeanStub));
|
26362 |
|
26363 |
|
26364 |
|
26365 |
|
26366 |
|
26367 |
|
26368 |
|
26369 | var __extends$16 = (undefined && undefined.__extends) || (function () {
|
26370 | var extendStatics = function (d, b) {
|
26371 | extendStatics = Object.setPrototypeOf ||
|
26372 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
26373 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
26374 | return extendStatics(d, b);
|
26375 | };
|
26376 | return function (d, b) {
|
26377 | extendStatics(d, b);
|
26378 | function __() { this.constructor = d; }
|
26379 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26380 | };
|
26381 | })();
|
26382 | var __decorate$V = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
26383 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
26384 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
26385 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
26386 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
26387 | };
|
26388 | var CenterWidthFeature = (function (_super) {
|
26389 | __extends$16(CenterWidthFeature, _super);
|
26390 | function CenterWidthFeature(callback) {
|
26391 | var _this = _super.call(this) || this;
|
26392 | _this.callback = callback;
|
26393 | return _this;
|
26394 | }
|
26395 | CenterWidthFeature.prototype.postConstruct = function () {
|
26396 | var listener = this.setWidth.bind(this);
|
26397 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, listener);
|
26398 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);
|
26399 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, listener);
|
26400 | this.setWidth();
|
26401 | };
|
26402 | CenterWidthFeature.prototype.setWidth = function () {
|
26403 | var columnModel = this.columnModel;
|
26404 | var printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
|
26405 | var centerWidth = columnModel.getBodyContainerWidth();
|
26406 | var leftWidth = columnModel.getDisplayedColumnsLeftWidth();
|
26407 | var rightWidth = columnModel.getDisplayedColumnsRightWidth();
|
26408 | var totalWidth = printLayout ? centerWidth + leftWidth + rightWidth : centerWidth;
|
26409 | this.callback(totalWidth);
|
26410 | };
|
26411 | __decorate$V([
|
26412 | Autowired('columnModel')
|
26413 | ], CenterWidthFeature.prototype, "columnModel", void 0);
|
26414 | __decorate$V([
|
26415 | PostConstruct
|
26416 | ], CenterWidthFeature.prototype, "postConstruct", null);
|
26417 | return CenterWidthFeature;
|
26418 | }(BeanStub));
|
26419 |
|
26420 |
|
26421 |
|
26422 |
|
26423 |
|
26424 |
|
26425 |
|
26426 | var __extends$17 = (undefined && undefined.__extends) || (function () {
|
26427 | var extendStatics = function (d, b) {
|
26428 | extendStatics = Object.setPrototypeOf ||
|
26429 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
26430 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
26431 | return extendStatics(d, b);
|
26432 | };
|
26433 | return function (d, b) {
|
26434 | extendStatics(d, b);
|
26435 | function __() { this.constructor = d; }
|
26436 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26437 | };
|
26438 | })();
|
26439 | var __decorate$W = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
26440 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
26441 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
26442 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
26443 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
26444 | };
|
26445 | var __read$a = (undefined && undefined.__read) || function (o, n) {
|
26446 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
26447 | if (!m) return o;
|
26448 | var i = m.call(o), r, ar = [], e;
|
26449 | try {
|
26450 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
26451 | }
|
26452 | catch (error) { e = { error: error }; }
|
26453 | finally {
|
26454 | try {
|
26455 | if (r && !r.done && (m = i["return"])) m.call(i);
|
26456 | }
|
26457 | finally { if (e) throw e.error; }
|
26458 | }
|
26459 | return ar;
|
26460 | };
|
26461 | var __spread$7 = (undefined && undefined.__spread) || function () {
|
26462 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$a(arguments[i]));
|
26463 | return ar;
|
26464 | };
|
26465 | var RowContainerName;
|
26466 | (function (RowContainerName) {
|
26467 | RowContainerName["LEFT"] = "left";
|
26468 | RowContainerName["RIGHT"] = "right";
|
26469 | RowContainerName["CENTER"] = "center";
|
26470 | RowContainerName["FULL_WIDTH"] = "fullWidth";
|
26471 | RowContainerName["TOP_LEFT"] = "topLeft";
|
26472 | RowContainerName["TOP_RIGHT"] = "topRight";
|
26473 | RowContainerName["TOP_CENTER"] = "topCenter";
|
26474 | RowContainerName["TOP_FULL_WIDTH"] = "topFullWidth";
|
26475 | RowContainerName["BOTTOM_LEFT"] = "bottomLeft";
|
26476 | RowContainerName["BOTTOM_RIGHT"] = "bottomRight";
|
26477 | RowContainerName["BOTTOM_CENTER"] = "bottomCenter";
|
26478 | RowContainerName["BOTTOM_FULL_WIDTH"] = "bottomFullWidth";
|
26479 | })(RowContainerName || (RowContainerName = {}));
|
26480 | var RowContainerType;
|
26481 | (function (RowContainerType) {
|
26482 | RowContainerType["LEFT"] = "left";
|
26483 | RowContainerType["RIGHT"] = "right";
|
26484 | RowContainerType["CENTER"] = "center";
|
26485 | RowContainerType["FULL_WIDTH"] = "fullWidth";
|
26486 | })(RowContainerType || (RowContainerType = {}));
|
26487 | function getRowContainerTypeForName(name) {
|
26488 | switch (name) {
|
26489 | case RowContainerName.CENTER:
|
26490 | case RowContainerName.TOP_CENTER:
|
26491 | case RowContainerName.BOTTOM_CENTER:
|
26492 | return RowContainerType.CENTER;
|
26493 | case RowContainerName.LEFT:
|
26494 | case RowContainerName.TOP_LEFT:
|
26495 | case RowContainerName.BOTTOM_LEFT:
|
26496 | return RowContainerType.LEFT;
|
26497 | case RowContainerName.RIGHT:
|
26498 | case RowContainerName.TOP_RIGHT:
|
26499 | case RowContainerName.BOTTOM_RIGHT:
|
26500 | return RowContainerType.RIGHT;
|
26501 | case RowContainerName.FULL_WIDTH:
|
26502 | case RowContainerName.TOP_FULL_WIDTH:
|
26503 | case RowContainerName.BOTTOM_FULL_WIDTH:
|
26504 | return RowContainerType.FULL_WIDTH;
|
26505 | default:
|
26506 | throw Error('Invalid Row Container Type');
|
26507 | }
|
26508 | }
|
26509 | var ContainerCssClasses = convertToMap([
|
26510 | [RowContainerName.CENTER, 'ag-center-cols-container'],
|
26511 | [RowContainerName.LEFT, 'ag-pinned-left-cols-container'],
|
26512 | [RowContainerName.RIGHT, 'ag-pinned-right-cols-container'],
|
26513 | [RowContainerName.FULL_WIDTH, 'ag-full-width-container'],
|
26514 | [RowContainerName.TOP_CENTER, 'ag-floating-top-container'],
|
26515 | [RowContainerName.TOP_LEFT, 'ag-pinned-left-floating-top'],
|
26516 | [RowContainerName.TOP_RIGHT, 'ag-pinned-right-floating-top'],
|
26517 | [RowContainerName.TOP_FULL_WIDTH, 'ag-floating-top-full-width-container'],
|
26518 | [RowContainerName.BOTTOM_CENTER, 'ag-floating-bottom-container'],
|
26519 | [RowContainerName.BOTTOM_LEFT, 'ag-pinned-left-floating-bottom'],
|
26520 | [RowContainerName.BOTTOM_RIGHT, 'ag-pinned-right-floating-bottom'],
|
26521 | [RowContainerName.BOTTOM_FULL_WIDTH, 'ag-floating-bottom-full-width-container'],
|
26522 | ]);
|
26523 | var ViewportCssClasses = convertToMap([
|
26524 | [RowContainerName.CENTER, 'ag-center-cols-viewport'],
|
26525 | [RowContainerName.TOP_CENTER, 'ag-floating-top-viewport'],
|
26526 | [RowContainerName.BOTTOM_CENTER, 'ag-floating-bottom-viewport'],
|
26527 | ]);
|
26528 | var WrapperCssClasses = convertToMap([
|
26529 | [RowContainerName.CENTER, 'ag-center-cols-clipper'],
|
26530 | ]);
|
26531 | var RowContainerCtrl = (function (_super) {
|
26532 | __extends$17(RowContainerCtrl, _super);
|
26533 | function RowContainerCtrl(name) {
|
26534 | var _this = _super.call(this) || this;
|
26535 | _this.name = name;
|
26536 | return _this;
|
26537 | }
|
26538 | RowContainerCtrl.getRowContainerCssClasses = function (name) {
|
26539 | var containerClass = ContainerCssClasses.get(name);
|
26540 | var viewportClass = ViewportCssClasses.get(name);
|
26541 | var wrapperClass = WrapperCssClasses.get(name);
|
26542 | return { container: containerClass, viewport: viewportClass, wrapper: wrapperClass };
|
26543 | };
|
26544 | RowContainerCtrl.getPinned = function (name) {
|
26545 | switch (name) {
|
26546 | case RowContainerName.BOTTOM_LEFT:
|
26547 | case RowContainerName.TOP_LEFT:
|
26548 | case RowContainerName.LEFT:
|
26549 | return Constants.PINNED_LEFT;
|
26550 | case RowContainerName.BOTTOM_RIGHT:
|
26551 | case RowContainerName.TOP_RIGHT:
|
26552 | case RowContainerName.RIGHT:
|
26553 | return Constants.PINNED_RIGHT;
|
26554 | default:
|
26555 | return null;
|
26556 | }
|
26557 | };
|
26558 | RowContainerCtrl.prototype.postConstruct = function () {
|
26559 | var _this = this;
|
26560 | this.enableRtl = this.gridOptionsWrapper.isEnableRtl();
|
26561 | this.embedFullWidthRows = this.gridOptionsWrapper.isEmbedFullWidthRows();
|
26562 | this.forContainers([RowContainerName.CENTER], function () { return _this.viewportSizeFeature = _this.createManagedBean(new ViewportSizeFeature(_this)); });
|
26563 | };
|
26564 | RowContainerCtrl.prototype.registerWithCtrlsService = function () {
|
26565 | switch (this.name) {
|
26566 | case RowContainerName.CENTER:
|
26567 | this.ctrlsService.registerCenterRowContainerCtrl(this);
|
26568 | break;
|
26569 | case RowContainerName.LEFT:
|
26570 | this.ctrlsService.registerLeftRowContainerCtrl(this);
|
26571 | break;
|
26572 | case RowContainerName.RIGHT:
|
26573 | this.ctrlsService.registerRightRowContainerCtrl(this);
|
26574 | break;
|
26575 | case RowContainerName.TOP_CENTER:
|
26576 | this.ctrlsService.registerTopCenterRowContainerCtrl(this);
|
26577 | break;
|
26578 | case RowContainerName.TOP_LEFT:
|
26579 | this.ctrlsService.registerTopLeftRowContainerCon(this);
|
26580 | break;
|
26581 | case RowContainerName.TOP_RIGHT:
|
26582 | this.ctrlsService.registerTopRightRowContainerCtrl(this);
|
26583 | break;
|
26584 | case RowContainerName.BOTTOM_CENTER:
|
26585 | this.ctrlsService.registerBottomCenterRowContainerCtrl(this);
|
26586 | break;
|
26587 | case RowContainerName.BOTTOM_LEFT:
|
26588 | this.ctrlsService.registerBottomLeftRowContainerCtrl(this);
|
26589 | break;
|
26590 | case RowContainerName.BOTTOM_RIGHT:
|
26591 | this.ctrlsService.registerBottomRightRowContainerCtrl(this);
|
26592 | break;
|
26593 | }
|
26594 | };
|
26595 | RowContainerCtrl.prototype.forContainers = function (names, callback) {
|
26596 | if (names.indexOf(this.name) >= 0) {
|
26597 | callback();
|
26598 | }
|
26599 | };
|
26600 | RowContainerCtrl.prototype.getContainerElement = function () {
|
26601 | return this.eContainer;
|
26602 | };
|
26603 | RowContainerCtrl.prototype.getViewportSizeFeature = function () {
|
26604 | return this.viewportSizeFeature;
|
26605 | };
|
26606 | RowContainerCtrl.prototype.setComp = function (view, eContainer, eViewport, eWrapper) {
|
26607 | var _this = this;
|
26608 | this.comp = view;
|
26609 | this.eContainer = eContainer;
|
26610 | this.eViewport = eViewport;
|
26611 | this.eWrapper = eWrapper;
|
26612 | this.createManagedBean(new RowContainerEventsFeature(this.eContainer));
|
26613 | this.addPreventScrollWhileDragging();
|
26614 | this.listenOnDomOrder();
|
26615 | this.stopHScrollOnPinnedRows();
|
26616 | var allTopNoFW = [RowContainerName.TOP_CENTER, RowContainerName.TOP_LEFT, RowContainerName.TOP_RIGHT];
|
26617 | var allBottomNoFW = [RowContainerName.BOTTOM_CENTER, RowContainerName.BOTTOM_LEFT, RowContainerName.BOTTOM_RIGHT];
|
26618 | var allMiddleNoFW = [RowContainerName.CENTER, RowContainerName.LEFT, RowContainerName.RIGHT];
|
26619 | var allNoFW = __spread$7(allTopNoFW, allBottomNoFW, allMiddleNoFW);
|
26620 | var allMiddle = [RowContainerName.CENTER, RowContainerName.LEFT, RowContainerName.RIGHT, RowContainerName.FULL_WIDTH];
|
26621 | var allCenter = [RowContainerName.CENTER, RowContainerName.TOP_CENTER, RowContainerName.BOTTOM_CENTER];
|
26622 | var allLeft = [RowContainerName.LEFT, RowContainerName.BOTTOM_LEFT, RowContainerName.TOP_LEFT];
|
26623 | var allRight = [RowContainerName.RIGHT, RowContainerName.BOTTOM_RIGHT, RowContainerName.TOP_RIGHT];
|
26624 | this.forContainers(allLeft, function () { return _this.createManagedBean(new SetPinnedLeftWidthFeature(_this.eContainer)); });
|
26625 | this.forContainers(allRight, function () { return _this.createManagedBean(new SetPinnedRightWidthFeature(_this.eContainer)); });
|
26626 | this.forContainers(allMiddle, function () { return _this.createManagedBean(new SetHeightFeature(_this.eContainer, _this.eWrapper)); });
|
26627 | this.forContainers(allNoFW, function () { return _this.createManagedBean(new DragListenerFeature(_this.eContainer)); });
|
26628 | this.forContainers(allCenter, function () { return _this.createManagedBean(new CenterWidthFeature(function (width) { return _this.comp.setContainerWidth(width + "px"); })); });
|
26629 | this.addListeners();
|
26630 | this.registerWithCtrlsService();
|
26631 | };
|
26632 | RowContainerCtrl.prototype.addListeners = function () {
|
26633 | var _this = this;
|
26634 | this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, function () { return _this.onScrollVisibilityChanged(); });
|
26635 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, function () { return _this.onDisplayedColumnsChanged(); });
|
26636 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, function () { return _this.onDisplayedColumnsWidthChanged(); });
|
26637 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_ROWS_CHANGED, function () { return _this.onDisplayedRowsChanged(); });
|
26638 | this.onScrollVisibilityChanged();
|
26639 | this.onDisplayedColumnsChanged();
|
26640 | this.onDisplayedColumnsWidthChanged();
|
26641 | this.onDisplayedRowsChanged();
|
26642 | };
|
26643 | RowContainerCtrl.prototype.listenOnDomOrder = function () {
|
26644 | var _this = this;
|
26645 | var listener = function () { return _this.comp.setDomOrder(_this.gridOptionsWrapper.isEnsureDomOrder()); };
|
26646 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, listener);
|
26647 | listener();
|
26648 | };
|
26649 |
|
26650 |
|
26651 |
|
26652 | RowContainerCtrl.prototype.stopHScrollOnPinnedRows = function () {
|
26653 | var _this = this;
|
26654 | this.forContainers([RowContainerName.TOP_CENTER, RowContainerName.BOTTOM_CENTER], function () {
|
26655 | var resetScrollLeft = function () { return _this.eViewport.scrollLeft = 0; };
|
26656 | _this.addManagedListener(_this.eViewport, 'scroll', resetScrollLeft);
|
26657 | });
|
26658 | };
|
26659 | RowContainerCtrl.prototype.onDisplayedColumnsChanged = function () {
|
26660 | var _this = this;
|
26661 | this.forContainers([RowContainerName.CENTER], function () { return _this.onHorizontalViewportChanged(); });
|
26662 | };
|
26663 | RowContainerCtrl.prototype.onDisplayedColumnsWidthChanged = function () {
|
26664 | var _this = this;
|
26665 | this.forContainers([RowContainerName.CENTER], function () { return _this.onHorizontalViewportChanged(); });
|
26666 | };
|
26667 | RowContainerCtrl.prototype.onScrollVisibilityChanged = function () {
|
26668 | if (this.name !== RowContainerName.CENTER) {
|
26669 | return;
|
26670 | }
|
26671 | var visible = this.scrollVisibleService.isHorizontalScrollShowing();
|
26672 | var scrollbarWidth = visible ? (this.gridOptionsWrapper.getScrollbarWidth() || 0) : 0;
|
26673 | var height = scrollbarWidth == 0 ? '100%' : "calc(100% + " + scrollbarWidth + "px)";
|
26674 | this.comp.setViewportHeight(height);
|
26675 | };
|
26676 |
|
26677 |
|
26678 | RowContainerCtrl.prototype.addPreventScrollWhileDragging = function () {
|
26679 | var _this = this;
|
26680 | var preventScroll = function (e) {
|
26681 | if (_this.dragService.isDragging()) {
|
26682 | if (e.cancelable) {
|
26683 | e.preventDefault();
|
26684 | }
|
26685 | }
|
26686 | };
|
26687 | this.eContainer.addEventListener('touchmove', preventScroll, { passive: false });
|
26688 | this.addDestroyFunc(function () { return _this.eContainer.removeEventListener('touchmove', preventScroll); });
|
26689 | };
|
26690 |
|
26691 |
|
26692 |
|
26693 | RowContainerCtrl.prototype.onHorizontalViewportChanged = function () {
|
26694 | var scrollWidth = this.getCenterWidth();
|
26695 | var scrollPosition = this.getCenterViewportScrollLeft();
|
26696 | this.columnModel.setViewportPosition(scrollWidth, scrollPosition);
|
26697 | };
|
26698 | RowContainerCtrl.prototype.getCenterWidth = function () {
|
26699 | return getInnerWidth(this.eViewport);
|
26700 | };
|
26701 | RowContainerCtrl.prototype.getCenterViewportScrollLeft = function () {
|
26702 |
|
26703 | return getScrollLeft(this.eViewport, this.enableRtl);
|
26704 | };
|
26705 | RowContainerCtrl.prototype.registerViewportResizeListener = function (listener) {
|
26706 | var unsubscribeFromResize = this.resizeObserverService.observeResize(this.eViewport, listener);
|
26707 | this.addDestroyFunc(function () { return unsubscribeFromResize(); });
|
26708 | };
|
26709 | RowContainerCtrl.prototype.isViewportVisible = function () {
|
26710 | return isVisible(this.eViewport);
|
26711 | };
|
26712 | RowContainerCtrl.prototype.isViewportHScrollShowing = function () {
|
26713 | return isHorizontalScrollShowing(this.eViewport);
|
26714 | };
|
26715 | RowContainerCtrl.prototype.getViewportScrollLeft = function () {
|
26716 | return getScrollLeft(this.eViewport, this.enableRtl);
|
26717 | };
|
26718 | RowContainerCtrl.prototype.isHorizontalScrollShowing = function () {
|
26719 | var isAlwaysShowHorizontalScroll = this.gridOptionsWrapper.isAlwaysShowHorizontalScroll();
|
26720 | return isAlwaysShowHorizontalScroll || isHorizontalScrollShowing(this.eViewport);
|
26721 | };
|
26722 | RowContainerCtrl.prototype.getViewportElement = function () {
|
26723 | return this.eViewport;
|
26724 | };
|
26725 | RowContainerCtrl.prototype.setContainerTranslateX = function (amount) {
|
26726 | this.eContainer.style.transform = "translateX(" + amount + "px)";
|
26727 | };
|
26728 | RowContainerCtrl.prototype.getHScrollPosition = function () {
|
26729 | var res = {
|
26730 | left: this.eViewport.scrollLeft,
|
26731 | right: this.eViewport.scrollLeft + this.eViewport.offsetWidth
|
26732 | };
|
26733 | return res;
|
26734 | };
|
26735 | RowContainerCtrl.prototype.setCenterViewportScrollLeft = function (value) {
|
26736 |
|
26737 | setScrollLeft(this.eViewport, value, this.enableRtl);
|
26738 | };
|
26739 | RowContainerCtrl.prototype.onDisplayedRowsChanged = function () {
|
26740 | var _this = this;
|
26741 | var fullWithContainer = this.name === RowContainerName.TOP_FULL_WIDTH
|
26742 | || this.name === RowContainerName.BOTTOM_FULL_WIDTH
|
26743 | || this.name === RowContainerName.FULL_WIDTH;
|
26744 | var doesRowMatch = function (rowCtrl) {
|
26745 | var fullWidthRow = rowCtrl.isFullWidth();
|
26746 | var printLayout = _this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
|
26747 | var embedFW = _this.embedFullWidthRows || printLayout;
|
26748 | var match = fullWithContainer ?
|
26749 | !embedFW && fullWidthRow
|
26750 | : embedFW || !fullWidthRow;
|
26751 | return match;
|
26752 | };
|
26753 |
|
26754 | var allRowsRegardlessOfFullWidth = this.getRowCtrls();
|
26755 |
|
26756 | var rowsThisContainer = allRowsRegardlessOfFullWidth.filter(doesRowMatch);
|
26757 | this.comp.setRowCtrls(rowsThisContainer);
|
26758 | };
|
26759 | RowContainerCtrl.prototype.getRowCtrls = function () {
|
26760 | switch (this.name) {
|
26761 | case RowContainerName.TOP_CENTER:
|
26762 | case RowContainerName.TOP_LEFT:
|
26763 | case RowContainerName.TOP_RIGHT:
|
26764 | case RowContainerName.TOP_FULL_WIDTH:
|
26765 | return this.rowRenderer.getTopRowCtrls();
|
26766 | case RowContainerName.BOTTOM_CENTER:
|
26767 | case RowContainerName.BOTTOM_LEFT:
|
26768 | case RowContainerName.BOTTOM_RIGHT:
|
26769 | case RowContainerName.BOTTOM_FULL_WIDTH:
|
26770 | return this.rowRenderer.getBottomRowCtrls();
|
26771 | default:
|
26772 | return this.rowRenderer.getRowCtrls();
|
26773 | }
|
26774 | };
|
26775 | __decorate$W([
|
26776 | Autowired('scrollVisibleService')
|
26777 | ], RowContainerCtrl.prototype, "scrollVisibleService", void 0);
|
26778 | __decorate$W([
|
26779 | Autowired('dragService')
|
26780 | ], RowContainerCtrl.prototype, "dragService", void 0);
|
26781 | __decorate$W([
|
26782 | Autowired('ctrlsService')
|
26783 | ], RowContainerCtrl.prototype, "ctrlsService", void 0);
|
26784 | __decorate$W([
|
26785 | Autowired('columnModel')
|
26786 | ], RowContainerCtrl.prototype, "columnModel", void 0);
|
26787 | __decorate$W([
|
26788 | Autowired('resizeObserverService')
|
26789 | ], RowContainerCtrl.prototype, "resizeObserverService", void 0);
|
26790 | __decorate$W([
|
26791 | Autowired('rowRenderer')
|
26792 | ], RowContainerCtrl.prototype, "rowRenderer", void 0);
|
26793 | __decorate$W([
|
26794 | PostConstruct
|
26795 | ], RowContainerCtrl.prototype, "postConstruct", null);
|
26796 | return RowContainerCtrl;
|
26797 | }(BeanStub));
|
26798 |
|
26799 |
|
26800 |
|
26801 |
|
26802 |
|
26803 |
|
26804 |
|
26805 | var __extends$18 = (undefined && undefined.__extends) || (function () {
|
26806 | var extendStatics = function (d, b) {
|
26807 | extendStatics = Object.setPrototypeOf ||
|
26808 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
26809 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
26810 | return extendStatics(d, b);
|
26811 | };
|
26812 | return function (d, b) {
|
26813 | extendStatics(d, b);
|
26814 | function __() { this.constructor = d; }
|
26815 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26816 | };
|
26817 | })();
|
26818 | var __decorate$X = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
26819 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
26820 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
26821 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
26822 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
26823 | };
|
26824 | 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=\"" + RowContainerName.TOP_LEFT + "\"></ag-row-container>\n <ag-row-container ref=\"topCenterContainer\" name=\"" + RowContainerName.TOP_CENTER + "\"></ag-row-container>\n <ag-row-container ref=\"topRightContainer\" name=\"" + RowContainerName.TOP_RIGHT + "\"></ag-row-container>\n <ag-row-container ref=\"topFullWidthContainer\" name=\"" + 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=\"" + RowContainerName.LEFT + "\"></ag-row-container>\n <ag-row-container ref=\"centerContainer\" name=\"" + RowContainerName.CENTER + "\"></ag-row-container>\n <ag-row-container ref=\"rightContainer\" name=\"" + RowContainerName.RIGHT + "\"></ag-row-container>\n <ag-row-container ref=\"fullWidthContainer\" name=\"" + 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=\"" + RowContainerName.BOTTOM_LEFT + "\"></ag-row-container>\n <ag-row-container ref=\"bottomCenterContainer\" name=\"" + RowContainerName.BOTTOM_CENTER + "\"></ag-row-container>\n <ag-row-container ref=\"bottomRightContainer\" name=\"" + RowContainerName.BOTTOM_RIGHT + "\"></ag-row-container>\n <ag-row-container ref=\"bottomFullWidthContainer\" name=\"" + 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>";
|
26825 | var GridBodyComp = (function (_super) {
|
26826 | __extends$18(GridBodyComp, _super);
|
26827 | function GridBodyComp() {
|
26828 | return _super.call(this, GRID_BODY_TEMPLATE) || this;
|
26829 | }
|
26830 | GridBodyComp.prototype.init = function () {
|
26831 | var _this = this;
|
26832 | var setHeight = function (height, element) {
|
26833 | var heightString = height + "px";
|
26834 | element.style.minHeight = heightString;
|
26835 | element.style.height = heightString;
|
26836 | };
|
26837 | var compProxy = {
|
26838 | setRowAnimationCssOnBodyViewport: function (cssClass, animate) { return _this.setRowAnimationCssOnBodyViewport(cssClass, animate); },
|
26839 | setColumnCount: function (count) { return setAriaColCount(_this.getGui(), count); },
|
26840 | setRowCount: function (count) { return setAriaRowCount(_this.getGui(), count); },
|
26841 | setTopHeight: function (height) { return setHeight(height, _this.eTop); },
|
26842 | setBottomHeight: function (height) { return setHeight(height, _this.eBottom); },
|
26843 | setTopDisplay: function (display) { return _this.eTop.style.display = display; },
|
26844 | setBottomDisplay: function (display) { return _this.eBottom.style.display = display; },
|
26845 | setColumnMovingCss: function (cssClass, flag) { return _this.addOrRemoveCssClass(CSS_CLASS_COLUMN_MOVING, flag); },
|
26846 | updateLayoutClasses: function (cssClass, params) {
|
26847 | var bodyViewportClassList = _this.eBodyViewport.classList;
|
26848 | bodyViewportClassList.toggle(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
|
26849 | bodyViewportClassList.toggle(LayoutCssClasses.NORMAL, params.normal);
|
26850 | bodyViewportClassList.toggle(LayoutCssClasses.PRINT, params.print);
|
26851 | _this.addOrRemoveCssClass(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
|
26852 | _this.addOrRemoveCssClass(LayoutCssClasses.NORMAL, params.normal);
|
26853 | _this.addOrRemoveCssClass(LayoutCssClasses.PRINT, params.print);
|
26854 | },
|
26855 | setAlwaysVerticalScrollClass: function (cssClass, on) {
|
26856 | return _this.eBodyViewport.classList.toggle(CSS_CLASS_FORCE_VERTICAL_SCROLL, on);
|
26857 | },
|
26858 | registerBodyViewportResizeListener: function (listener) {
|
26859 | var unsubscribeFromResize = _this.resizeObserverService.observeResize(_this.eBodyViewport, listener);
|
26860 | _this.addDestroyFunc(function () { return unsubscribeFromResize(); });
|
26861 | },
|
26862 | setPinnedTopBottomOverflowY: function (overflow) { return _this.eTop.style.overflowY = _this.eBottom.style.overflowY = overflow; },
|
26863 | setCellSelectableCss: function (cssClass, selectable) {
|
26864 | [_this.eTop, _this.eBodyViewport, _this.eBottom]
|
26865 | .forEach(function (ct) { return ct.classList.toggle(CSS_CLASS_CELL_SELECTABLE, selectable); });
|
26866 | },
|
26867 | };
|
26868 | this.ctrl = this.createManagedBean(new GridBodyCtrl());
|
26869 | this.ctrl.setComp(compProxy, this.getGui(), this.eBodyViewport, this.eTop, this.eBottom);
|
26870 | if (this.rangeService || this.gridOptionsWrapper.isRowSelectionMulti()) {
|
26871 | setAriaMultiSelectable(this.getGui(), true);
|
26872 | }
|
26873 | };
|
26874 | GridBodyComp.prototype.setRowAnimationCssOnBodyViewport = function (cssClass, animateRows) {
|
26875 | var bodyViewportClassList = this.eBodyViewport.classList;
|
26876 | bodyViewportClassList.toggle(RowAnimationCssClasses.ANIMATION_ON, animateRows);
|
26877 | bodyViewportClassList.toggle(RowAnimationCssClasses.ANIMATION_OFF, !animateRows);
|
26878 | };
|
26879 | GridBodyComp.prototype.getFloatingTopBottom = function () {
|
26880 | return [this.eTop, this.eBottom];
|
26881 | };
|
26882 | __decorate$X([
|
26883 | Autowired('resizeObserverService')
|
26884 | ], GridBodyComp.prototype, "resizeObserverService", void 0);
|
26885 | __decorate$X([
|
26886 | Optional('rangeService')
|
26887 | ], GridBodyComp.prototype, "rangeService", void 0);
|
26888 | __decorate$X([
|
26889 | RefSelector('eBodyViewport')
|
26890 | ], GridBodyComp.prototype, "eBodyViewport", void 0);
|
26891 | __decorate$X([
|
26892 | RefSelector('eTop')
|
26893 | ], GridBodyComp.prototype, "eTop", void 0);
|
26894 | __decorate$X([
|
26895 | RefSelector('eBottom')
|
26896 | ], GridBodyComp.prototype, "eBottom", void 0);
|
26897 | __decorate$X([
|
26898 | RefSelector('gridHeader')
|
26899 | ], GridBodyComp.prototype, "headerRootComp", void 0);
|
26900 | __decorate$X([
|
26901 | PostConstruct
|
26902 | ], GridBodyComp.prototype, "init", null);
|
26903 | return GridBodyComp;
|
26904 | }(Component));
|
26905 |
|
26906 |
|
26907 |
|
26908 |
|
26909 |
|
26910 |
|
26911 |
|
26912 | var __extends$19 = (undefined && undefined.__extends) || (function () {
|
26913 | var extendStatics = function (d, b) {
|
26914 | extendStatics = Object.setPrototypeOf ||
|
26915 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
26916 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
26917 | return extendStatics(d, b);
|
26918 | };
|
26919 | return function (d, b) {
|
26920 | extendStatics(d, b);
|
26921 | function __() { this.constructor = d; }
|
26922 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26923 | };
|
26924 | })();
|
26925 | var __decorate$Y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
26926 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
26927 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
26928 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
26929 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
26930 | };
|
26931 | var ScrollVisibleService = (function (_super) {
|
26932 | __extends$19(ScrollVisibleService, _super);
|
26933 | function ScrollVisibleService() {
|
26934 | return _super !== null && _super.apply(this, arguments) || this;
|
26935 | }
|
26936 | ScrollVisibleService.prototype.postConstruct = function () {
|
26937 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
|
26938 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onDisplayedColumnsWidthChanged.bind(this));
|
26939 | };
|
26940 | ScrollVisibleService.prototype.onDisplayedColumnsChanged = function () {
|
26941 | this.update();
|
26942 | };
|
26943 | ScrollVisibleService.prototype.onDisplayedColumnsWidthChanged = function () {
|
26944 | this.update();
|
26945 | };
|
26946 | ScrollVisibleService.prototype.update = function () {
|
26947 |
|
26948 |
|
26949 |
|
26950 |
|
26951 |
|
26952 |
|
26953 | this.updateImpl();
|
26954 | setTimeout(this.updateImpl.bind(this), 500);
|
26955 | };
|
26956 | ScrollVisibleService.prototype.updateImpl = function () {
|
26957 | var centerRowCtrl = this.ctrlsService.getCenterRowContainerCtrl();
|
26958 | if (!centerRowCtrl) {
|
26959 | return;
|
26960 | }
|
26961 | var params = {
|
26962 | horizontalScrollShowing: centerRowCtrl.isHorizontalScrollShowing(),
|
26963 | verticalScrollShowing: this.isVerticalScrollShowing()
|
26964 | };
|
26965 | this.setScrollsVisible(params);
|
26966 | };
|
26967 | ScrollVisibleService.prototype.setScrollsVisible = function (params) {
|
26968 | var atLeastOneDifferent = this.horizontalScrollShowing !== params.horizontalScrollShowing ||
|
26969 | this.verticalScrollShowing !== params.verticalScrollShowing;
|
26970 | if (atLeastOneDifferent) {
|
26971 | this.horizontalScrollShowing = params.horizontalScrollShowing;
|
26972 | this.verticalScrollShowing = params.verticalScrollShowing;
|
26973 | var event_1 = {
|
26974 | type: Events.EVENT_SCROLL_VISIBILITY_CHANGED,
|
26975 | api: this.gridApi,
|
26976 | columnApi: this.columnApi
|
26977 | };
|
26978 | this.eventService.dispatchEvent(event_1);
|
26979 | }
|
26980 | };
|
26981 |
|
26982 | ScrollVisibleService.prototype.isHorizontalScrollShowing = function () {
|
26983 | return this.horizontalScrollShowing;
|
26984 | };
|
26985 |
|
26986 | ScrollVisibleService.prototype.isVerticalScrollShowing = function () {
|
26987 | return this.verticalScrollShowing;
|
26988 | };
|
26989 | __decorate$Y([
|
26990 | Autowired('columnApi')
|
26991 | ], ScrollVisibleService.prototype, "columnApi", void 0);
|
26992 | __decorate$Y([
|
26993 | Autowired('gridApi')
|
26994 | ], ScrollVisibleService.prototype, "gridApi", void 0);
|
26995 | __decorate$Y([
|
26996 | Autowired('ctrlsService')
|
26997 | ], ScrollVisibleService.prototype, "ctrlsService", void 0);
|
26998 | __decorate$Y([
|
26999 | PostConstruct
|
27000 | ], ScrollVisibleService.prototype, "postConstruct", null);
|
27001 | ScrollVisibleService = __decorate$Y([
|
27002 | Bean('scrollVisibleService')
|
27003 | ], ScrollVisibleService);
|
27004 | return ScrollVisibleService;
|
27005 | }(BeanStub));
|
27006 |
|
27007 |
|
27008 |
|
27009 |
|
27010 |
|
27011 |
|
27012 |
|
27013 | var __extends$1a = (undefined && undefined.__extends) || (function () {
|
27014 | var extendStatics = function (d, b) {
|
27015 | extendStatics = Object.setPrototypeOf ||
|
27016 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
27017 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
27018 | return extendStatics(d, b);
|
27019 | };
|
27020 | return function (d, b) {
|
27021 | extendStatics(d, b);
|
27022 | function __() { this.constructor = d; }
|
27023 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
27024 | };
|
27025 | })();
|
27026 | var __decorate$Z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
27027 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
27028 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
27029 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
27030 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
27031 | };
|
27032 | var MouseEventService = (function (_super) {
|
27033 | __extends$1a(MouseEventService, _super);
|
27034 | function MouseEventService() {
|
27035 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
27036 | _this.gridInstanceId = MouseEventService_1.gridInstanceSequence.next();
|
27037 | return _this;
|
27038 | }
|
27039 | MouseEventService_1 = MouseEventService;
|
27040 |
|
27041 |
|
27042 |
|
27043 | MouseEventService.prototype.stampTopLevelGridCompWithGridInstance = function (eGridDiv) {
|
27044 | eGridDiv[MouseEventService_1.GRID_DOM_KEY] = this.gridInstanceId;
|
27045 | };
|
27046 | MouseEventService.prototype.getRenderedCellForEvent = function (event) {
|
27047 | return getCtrlForEvent(this.gridOptionsWrapper, event, CellCtrl.DOM_DATA_KEY_CELL_CTRL);
|
27048 | };
|
27049 |
|
27050 |
|
27051 |
|
27052 | MouseEventService.prototype.isEventFromThisGrid = function (event) {
|
27053 | var res = this.isElementInThisGrid(event.target);
|
27054 | return res;
|
27055 | };
|
27056 | MouseEventService.prototype.isElementInThisGrid = function (element) {
|
27057 | var pointer = element;
|
27058 | while (pointer) {
|
27059 | var instanceId = pointer[MouseEventService_1.GRID_DOM_KEY];
|
27060 | if (exists(instanceId)) {
|
27061 | var eventFromThisGrid = instanceId === this.gridInstanceId;
|
27062 | return eventFromThisGrid;
|
27063 | }
|
27064 | pointer = pointer.parentElement;
|
27065 | }
|
27066 | return false;
|
27067 | };
|
27068 | MouseEventService.prototype.getCellPositionForEvent = function (event) {
|
27069 | var cellComp = this.getRenderedCellForEvent(event);
|
27070 | return cellComp ? cellComp.getCellPosition() : null;
|
27071 | };
|
27072 | MouseEventService.prototype.getNormalisedPosition = function (event) {
|
27073 | var gridPanelHasScrolls = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_NORMAL;
|
27074 | var e = event;
|
27075 | var x;
|
27076 | var y;
|
27077 | if (e.clientX != null || e.clientY != null) {
|
27078 | x = e.clientX;
|
27079 | y = e.clientY;
|
27080 | }
|
27081 | else {
|
27082 | x = e.x;
|
27083 | y = e.y;
|
27084 | }
|
27085 | if (gridPanelHasScrolls) {
|
27086 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
27087 | var vRange = gridBodyCon.getScrollFeature().getVScrollPosition();
|
27088 | var hRange = gridBodyCon.getScrollFeature().getHScrollPosition();
|
27089 | x += hRange.left;
|
27090 | y += vRange.top;
|
27091 | }
|
27092 | return { x: x, y: y };
|
27093 | };
|
27094 | var MouseEventService_1;
|
27095 | MouseEventService.gridInstanceSequence = new NumberSequence();
|
27096 | MouseEventService.GRID_DOM_KEY = '__ag_grid_instance';
|
27097 | __decorate$Z([
|
27098 | Autowired('ctrlsService')
|
27099 | ], MouseEventService.prototype, "ctrlsService", void 0);
|
27100 | MouseEventService = MouseEventService_1 = __decorate$Z([
|
27101 | Bean('mouseEventService')
|
27102 | ], MouseEventService);
|
27103 | return MouseEventService;
|
27104 | }(BeanStub));
|
27105 |
|
27106 |
|
27107 |
|
27108 |
|
27109 |
|
27110 |
|
27111 |
|
27112 | var __extends$1b = (undefined && undefined.__extends) || (function () {
|
27113 | var extendStatics = function (d, b) {
|
27114 | extendStatics = Object.setPrototypeOf ||
|
27115 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
27116 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
27117 | return extendStatics(d, b);
|
27118 | };
|
27119 | return function (d, b) {
|
27120 | extendStatics(d, b);
|
27121 | function __() { this.constructor = d; }
|
27122 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
27123 | };
|
27124 | })();
|
27125 | var __assign$c = (undefined && undefined.__assign) || function () {
|
27126 | __assign$c = Object.assign || function(t) {
|
27127 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
27128 | s = arguments[i];
|
27129 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
27130 | t[p] = s[p];
|
27131 | }
|
27132 | return t;
|
27133 | };
|
27134 | return __assign$c.apply(this, arguments);
|
27135 | };
|
27136 | var __decorate$_ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
27137 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
27138 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
27139 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
27140 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
27141 | };
|
27142 | var NavigationService = (function (_super) {
|
27143 | __extends$1b(NavigationService, _super);
|
27144 | function NavigationService() {
|
27145 | var _this = _super.call(this) || this;
|
27146 | _this.onPageDown = throttle(_this.onPageDown, 100);
|
27147 | _this.onPageUp = throttle(_this.onPageUp, 100);
|
27148 | return _this;
|
27149 | }
|
27150 | NavigationService.prototype.postConstruct = function () {
|
27151 | var _this = this;
|
27152 | this.ctrlsService.whenReady(function (p) {
|
27153 | _this.gridBodyCon = p.gridBodyCtrl;
|
27154 | });
|
27155 | };
|
27156 | NavigationService.prototype.handlePageScrollingKey = function (event) {
|
27157 | var key = event.key;
|
27158 | var alt = event.altKey;
|
27159 | var ctrl = event.ctrlKey || event.metaKey;
|
27160 | var rangeServiceShouldHandleShift = !!this.rangeService && event.shiftKey;
|
27161 | var currentCell = this.mouseEventService.getCellPositionForEvent(event);
|
27162 | if (!currentCell) {
|
27163 | return false;
|
27164 | }
|
27165 | var processed = false;
|
27166 | switch (key) {
|
27167 | case KeyCode.PAGE_HOME:
|
27168 | case KeyCode.PAGE_END:
|
27169 |
|
27170 | if (!ctrl && !alt) {
|
27171 | this.onHomeOrEndKey(key);
|
27172 | processed = true;
|
27173 | }
|
27174 | break;
|
27175 | case KeyCode.LEFT:
|
27176 | case KeyCode.RIGHT:
|
27177 | case KeyCode.UP:
|
27178 | case KeyCode.DOWN:
|
27179 |
|
27180 |
|
27181 | if (ctrl && !alt && !rangeServiceShouldHandleShift) {
|
27182 | this.onCtrlUpDownLeftRight(key, currentCell);
|
27183 | processed = true;
|
27184 | }
|
27185 | break;
|
27186 | case KeyCode.PAGE_DOWN:
|
27187 |
|
27188 | if (!ctrl && !alt) {
|
27189 | this.onPageDown(currentCell);
|
27190 | processed = true;
|
27191 | }
|
27192 | break;
|
27193 | case KeyCode.PAGE_UP:
|
27194 |
|
27195 | if (!ctrl && !alt) {
|
27196 | this.onPageUp(currentCell);
|
27197 | processed = true;
|
27198 | }
|
27199 | break;
|
27200 | }
|
27201 | if (processed) {
|
27202 | event.preventDefault();
|
27203 | }
|
27204 | return processed;
|
27205 | };
|
27206 | NavigationService.prototype.navigateTo = function (navigateParams) {
|
27207 | var scrollIndex = navigateParams.scrollIndex, scrollType = navigateParams.scrollType, scrollColumn = navigateParams.scrollColumn, focusIndex = navigateParams.focusIndex, focusColumn = navigateParams.focusColumn;
|
27208 | if (exists(scrollColumn) && !scrollColumn.isPinned()) {
|
27209 | this.gridBodyCon.getScrollFeature().ensureColumnVisible(scrollColumn);
|
27210 | }
|
27211 | if (exists(scrollIndex)) {
|
27212 | this.gridBodyCon.getScrollFeature().ensureIndexVisible(scrollIndex, scrollType);
|
27213 | }
|
27214 |
|
27215 | this.animationFrameService.flushAllFrames();
|
27216 |
|
27217 |
|
27218 | this.focusService.setFocusedCell(focusIndex, focusColumn, null, true);
|
27219 | if (this.rangeService) {
|
27220 | var cellPosition = { rowIndex: focusIndex, rowPinned: null, column: focusColumn };
|
27221 | this.rangeService.setRangeToCell(cellPosition);
|
27222 | }
|
27223 | };
|
27224 | NavigationService.prototype.onPageDown = function (gridCell) {
|
27225 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
27226 | var scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();
|
27227 | var pixelsInOnePage = this.getViewportHeight();
|
27228 | var pagingPixelOffset = this.paginationProxy.getPixelOffset();
|
27229 | var currentPageBottomPixel = scrollPosition.top + pixelsInOnePage;
|
27230 | var currentPageBottomRow = this.paginationProxy.getRowIndexAtPixel(currentPageBottomPixel + pagingPixelOffset);
|
27231 | if (this.columnModel.isAutoRowHeightActive()) {
|
27232 | this.navigateToNextPageWithAutoHeight(gridCell, currentPageBottomRow);
|
27233 | }
|
27234 | else {
|
27235 | this.navigateToNextPage(gridCell, currentPageBottomRow);
|
27236 | }
|
27237 | };
|
27238 | NavigationService.prototype.onPageUp = function (gridCell) {
|
27239 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
27240 | var scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();
|
27241 | var pagingPixelOffset = this.paginationProxy.getPixelOffset();
|
27242 | var currentPageTopPixel = scrollPosition.top;
|
27243 | var currentPageTopRow = this.paginationProxy.getRowIndexAtPixel(currentPageTopPixel + pagingPixelOffset);
|
27244 | if (this.columnModel.isAutoRowHeightActive()) {
|
27245 | this.navigateToNextPageWithAutoHeight(gridCell, currentPageTopRow, true);
|
27246 | }
|
27247 | else {
|
27248 | this.navigateToNextPage(gridCell, currentPageTopRow, true);
|
27249 | }
|
27250 | };
|
27251 | NavigationService.prototype.navigateToNextPage = function (gridCell, scrollIndex, up) {
|
27252 | if (up === void 0) { up = false; }
|
27253 | var _a, _b;
|
27254 | var pixelsInOnePage = this.getViewportHeight();
|
27255 | var firstRow = this.paginationProxy.getPageFirstRow();
|
27256 | var lastRow = this.paginationProxy.getPageLastRow();
|
27257 | var pagingPixelOffset = this.paginationProxy.getPixelOffset();
|
27258 | var currentRowNode = this.paginationProxy.getRow(gridCell.rowIndex);
|
27259 | var rowPixelDiff = up
|
27260 | ? (((_a = currentRowNode) === null || _a === void 0 ? void 0 : _a.rowHeight) - pixelsInOnePage - pagingPixelOffset)
|
27261 | : (pixelsInOnePage - pagingPixelOffset);
|
27262 | var nextCellPixel = ((_b = currentRowNode) === null || _b === void 0 ? void 0 : _b.rowTop) + rowPixelDiff;
|
27263 | var focusIndex = this.paginationProxy.getRowIndexAtPixel(nextCellPixel + pagingPixelOffset);
|
27264 | if (focusIndex === gridCell.rowIndex) {
|
27265 | var diff = up ? -1 : 1;
|
27266 | scrollIndex = focusIndex = gridCell.rowIndex + diff;
|
27267 | }
|
27268 | var scrollType;
|
27269 | if (up) {
|
27270 | scrollType = 'bottom';
|
27271 | if (focusIndex < firstRow) {
|
27272 | focusIndex = firstRow;
|
27273 | }
|
27274 | if (scrollIndex < firstRow) {
|
27275 | scrollIndex = firstRow;
|
27276 | }
|
27277 | }
|
27278 | else {
|
27279 | scrollType = 'top';
|
27280 | if (focusIndex > lastRow) {
|
27281 | focusIndex = lastRow;
|
27282 | }
|
27283 | if (scrollIndex > lastRow) {
|
27284 | scrollIndex = lastRow;
|
27285 | }
|
27286 | }
|
27287 | if (this.isRowTallerThanView(focusIndex)) {
|
27288 | scrollIndex = focusIndex;
|
27289 | scrollType = 'top';
|
27290 | }
|
27291 | this.navigateTo({
|
27292 | scrollIndex: scrollIndex,
|
27293 | scrollType: scrollType,
|
27294 | scrollColumn: null,
|
27295 | focusIndex: focusIndex,
|
27296 | focusColumn: gridCell.column
|
27297 | });
|
27298 | };
|
27299 | NavigationService.prototype.navigateToNextPageWithAutoHeight = function (gridCell, scrollIndex, up) {
|
27300 | var _this = this;
|
27301 | if (up === void 0) { up = false; }
|
27302 |
|
27303 |
|
27304 |
|
27305 |
|
27306 |
|
27307 |
|
27308 |
|
27309 | this.navigateTo({
|
27310 | scrollIndex: scrollIndex,
|
27311 | scrollType: up ? 'bottom' : 'top',
|
27312 | scrollColumn: null,
|
27313 | focusIndex: scrollIndex,
|
27314 | focusColumn: gridCell.column
|
27315 | });
|
27316 | setTimeout(function () {
|
27317 | var focusIndex = _this.getNextFocusIndexForAutoHeight(gridCell, up);
|
27318 | _this.navigateTo({
|
27319 | scrollIndex: scrollIndex,
|
27320 | scrollType: up ? 'bottom' : 'top',
|
27321 | scrollColumn: null,
|
27322 | focusIndex: focusIndex,
|
27323 | focusColumn: gridCell.column
|
27324 | });
|
27325 | }, 50);
|
27326 | };
|
27327 | NavigationService.prototype.getNextFocusIndexForAutoHeight = function (gridCell, up) {
|
27328 | if (up === void 0) { up = false; }
|
27329 | var _a;
|
27330 | var step = up ? -1 : 1;
|
27331 | var pixelsInOnePage = this.getViewportHeight();
|
27332 | var lastRowIndex = this.paginationProxy.getPageLastRow();
|
27333 | var pixelSum = 0;
|
27334 | var currentIndex = gridCell.rowIndex;
|
27335 | while (currentIndex >= 0 && currentIndex <= lastRowIndex) {
|
27336 | var currentCell = this.paginationProxy.getRow(currentIndex);
|
27337 | if (currentCell) {
|
27338 | var currentCellHeight = (_a = currentCell.rowHeight, (_a !== null && _a !== void 0 ? _a : 0));
|
27339 | if (pixelSum + currentCellHeight > pixelsInOnePage) {
|
27340 | break;
|
27341 | }
|
27342 | pixelSum += currentCellHeight;
|
27343 | }
|
27344 | currentIndex += step;
|
27345 | }
|
27346 | return Math.max(0, Math.min(currentIndex, lastRowIndex));
|
27347 | };
|
27348 | NavigationService.prototype.getViewportHeight = function () {
|
27349 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
27350 | var scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();
|
27351 | var scrollbarWidth = this.gridOptionsWrapper.getScrollbarWidth();
|
27352 | var pixelsInOnePage = scrollPosition.bottom - scrollPosition.top;
|
27353 | if (this.ctrlsService.getCenterRowContainerCtrl().isHorizontalScrollShowing()) {
|
27354 | pixelsInOnePage -= scrollbarWidth;
|
27355 | }
|
27356 | return pixelsInOnePage;
|
27357 | };
|
27358 | NavigationService.prototype.isRowTallerThanView = function (rowIndex) {
|
27359 | var rowNode = this.paginationProxy.getRow(rowIndex);
|
27360 | if (!rowNode) {
|
27361 | return false;
|
27362 | }
|
27363 | var rowHeight = rowNode.rowHeight;
|
27364 | if (typeof rowHeight !== 'number') {
|
27365 | return false;
|
27366 | }
|
27367 | return rowHeight > this.getViewportHeight();
|
27368 | };
|
27369 | NavigationService.prototype.onCtrlUpDownLeftRight = function (key, gridCell) {
|
27370 | var cellToFocus = this.cellNavigationService.getNextCellToFocus(key, gridCell, true);
|
27371 | var rowIndex = cellToFocus.rowIndex, column = cellToFocus.column;
|
27372 | this.navigateTo({
|
27373 | scrollIndex: rowIndex,
|
27374 | scrollType: null,
|
27375 | scrollColumn: column,
|
27376 | focusIndex: rowIndex,
|
27377 | focusColumn: column
|
27378 | });
|
27379 | };
|
27380 |
|
27381 |
|
27382 | NavigationService.prototype.onHomeOrEndKey = function (key) {
|
27383 | var homeKey = key === KeyCode.PAGE_HOME;
|
27384 | var allColumns = this.columnModel.getAllDisplayedColumns();
|
27385 | var columnToSelect = homeKey ? allColumns[0] : last(allColumns);
|
27386 | var scrollIndex = homeKey ? this.paginationProxy.getPageFirstRow() : this.paginationProxy.getPageLastRow();
|
27387 | this.navigateTo({
|
27388 | scrollIndex: scrollIndex,
|
27389 | scrollType: null,
|
27390 | scrollColumn: columnToSelect,
|
27391 | focusIndex: scrollIndex,
|
27392 | focusColumn: columnToSelect
|
27393 | });
|
27394 | };
|
27395 |
|
27396 | NavigationService.prototype.onTabKeyDown = function (previous, keyboardEvent) {
|
27397 | var backwards = keyboardEvent.shiftKey;
|
27398 | var movedToNextCell = this.tabToNextCellCommon(previous, backwards, keyboardEvent);
|
27399 | if (movedToNextCell) {
|
27400 |
|
27401 |
|
27402 | keyboardEvent.preventDefault();
|
27403 | return;
|
27404 | }
|
27405 |
|
27406 |
|
27407 | if (backwards) {
|
27408 | var _a = previous.getRowPosition(), rowIndex = _a.rowIndex, rowPinned = _a.rowPinned;
|
27409 | var firstRow = rowPinned ? rowIndex === 0 : rowIndex === this.paginationProxy.getPageFirstRow();
|
27410 | if (firstRow) {
|
27411 | keyboardEvent.preventDefault();
|
27412 | this.focusService.focusLastHeader(keyboardEvent);
|
27413 | }
|
27414 | }
|
27415 | else {
|
27416 |
|
27417 |
|
27418 |
|
27419 | if (previous instanceof CellCtrl) {
|
27420 | previous.focusCell(true);
|
27421 | }
|
27422 | if (this.focusService.focusNextGridCoreContainer(backwards)) {
|
27423 | keyboardEvent.preventDefault();
|
27424 | }
|
27425 | }
|
27426 | };
|
27427 |
|
27428 | NavigationService.prototype.tabToNextCell = function (backwards, event) {
|
27429 | var focusedCell = this.focusService.getFocusedCell();
|
27430 |
|
27431 | if (!focusedCell) {
|
27432 | return false;
|
27433 | }
|
27434 | var cellOrRow = this.getCellByPosition(focusedCell);
|
27435 |
|
27436 |
|
27437 | if (!cellOrRow) {
|
27438 | cellOrRow = this.rowRenderer.getRowByPosition(focusedCell);
|
27439 | if (!cellOrRow || !cellOrRow.isFullWidth()) {
|
27440 | return false;
|
27441 | }
|
27442 | }
|
27443 | return this.tabToNextCellCommon(cellOrRow, backwards, event);
|
27444 | };
|
27445 | NavigationService.prototype.tabToNextCellCommon = function (previous, backwards, event) {
|
27446 | var editing = previous.isEditing();
|
27447 |
|
27448 | if (!editing && previous instanceof CellCtrl) {
|
27449 | var cell = previous;
|
27450 | var row = cell.getRowCtrl();
|
27451 | if (row) {
|
27452 | editing = row.isEditing();
|
27453 | }
|
27454 | }
|
27455 | var res;
|
27456 | if (editing) {
|
27457 |
|
27458 | if (this.gridOptionsWrapper.isFullRowEdit()) {
|
27459 | res = this.moveToNextEditingRow(previous, backwards, event);
|
27460 | }
|
27461 | else {
|
27462 | res = this.moveToNextEditingCell(previous, backwards, event);
|
27463 | }
|
27464 | }
|
27465 | else {
|
27466 | res = this.moveToNextCellNotEditing(previous, backwards);
|
27467 | }
|
27468 |
|
27469 | return res || !!this.focusService.getFocusedHeader();
|
27470 | };
|
27471 | NavigationService.prototype.moveToNextEditingCell = function (previousCell, backwards, event) {
|
27472 | if (event === void 0) { event = null; }
|
27473 | var previousPos = previousCell.getCellPosition();
|
27474 |
|
27475 |
|
27476 |
|
27477 |
|
27478 | previousCell.stopEditing();
|
27479 |
|
27480 | var nextCell = this.findNextCellToFocusOn(previousPos, backwards, true);
|
27481 | if (nextCell == null) {
|
27482 | return false;
|
27483 | }
|
27484 |
|
27485 |
|
27486 | nextCell.startEditing(null, null, true, event);
|
27487 | nextCell.focusCell(false);
|
27488 | return true;
|
27489 | };
|
27490 | NavigationService.prototype.moveToNextEditingRow = function (previousCell, backwards, event) {
|
27491 | if (event === void 0) { event = null; }
|
27492 | var previousPos = previousCell.getCellPosition();
|
27493 |
|
27494 | var nextCell = this.findNextCellToFocusOn(previousPos, backwards, true);
|
27495 | if (nextCell == null) {
|
27496 | return false;
|
27497 | }
|
27498 | var nextPos = nextCell.getCellPosition();
|
27499 | var previousEditable = this.isCellEditable(previousPos);
|
27500 | var nextEditable = this.isCellEditable(nextPos);
|
27501 | var rowsMatch = nextPos && previousPos.rowIndex === nextPos.rowIndex && previousPos.rowPinned === nextPos.rowPinned;
|
27502 | if (previousEditable) {
|
27503 | previousCell.setFocusOutOnEditor();
|
27504 | }
|
27505 | if (!rowsMatch) {
|
27506 | var pRow = previousCell.getRowCtrl();
|
27507 | pRow.stopEditing();
|
27508 | var nRow = nextCell.getRowCtrl();
|
27509 | nRow.startRowEditing(undefined, undefined, undefined, event);
|
27510 | }
|
27511 | if (nextEditable) {
|
27512 | nextCell.setFocusInOnEditor();
|
27513 | nextCell.focusCell();
|
27514 | }
|
27515 | else {
|
27516 | nextCell.focusCell(true);
|
27517 | }
|
27518 | return true;
|
27519 | };
|
27520 | NavigationService.prototype.moveToNextCellNotEditing = function (previousCell, backwards) {
|
27521 | var displayedColumns = this.columnModel.getAllDisplayedColumns();
|
27522 | var cellPos;
|
27523 | if (previousCell instanceof RowCtrl) {
|
27524 | cellPos = __assign$c(__assign$c({}, previousCell.getRowPosition()), { column: backwards ? displayedColumns[0] : last(displayedColumns) });
|
27525 | }
|
27526 | else {
|
27527 | cellPos = previousCell.getCellPosition();
|
27528 | }
|
27529 |
|
27530 | var nextCell = this.findNextCellToFocusOn(cellPos, backwards, false);
|
27531 |
|
27532 |
|
27533 | if (nextCell instanceof CellCtrl) {
|
27534 | nextCell.focusCell(true);
|
27535 | }
|
27536 | else if (nextCell) {
|
27537 | return this.tryToFocusFullWidthRow(nextCell.getRowPosition(), backwards);
|
27538 | }
|
27539 | return exists(nextCell);
|
27540 | };
|
27541 |
|
27542 |
|
27543 | NavigationService.prototype.findNextCellToFocusOn = function (previousPosition, backwards, startEditing) {
|
27544 | var nextPosition = previousPosition;
|
27545 | while (true) {
|
27546 | if (previousPosition !== nextPosition) {
|
27547 | previousPosition = nextPosition;
|
27548 | }
|
27549 | if (!backwards) {
|
27550 | nextPosition = this.getLastCellOfColSpan(nextPosition);
|
27551 | }
|
27552 | nextPosition = this.cellNavigationService.getNextTabbedCell(nextPosition, backwards);
|
27553 |
|
27554 | var userFunc = this.gridOptionsWrapper.getTabToNextCellFunc();
|
27555 | if (exists(userFunc)) {
|
27556 | var params = {
|
27557 | backwards: backwards,
|
27558 | editing: startEditing,
|
27559 | previousCellPosition: previousPosition,
|
27560 | nextCellPosition: nextPosition ? nextPosition : null
|
27561 | };
|
27562 | var userCell = userFunc(params);
|
27563 | if (exists(userCell)) {
|
27564 | if (userCell.floating) {
|
27565 | 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');
|
27566 | userCell.rowPinned = userCell.floating;
|
27567 | }
|
27568 | nextPosition = {
|
27569 | rowIndex: userCell.rowIndex,
|
27570 | column: userCell.column,
|
27571 | rowPinned: userCell.rowPinned
|
27572 | };
|
27573 | }
|
27574 | else {
|
27575 | nextPosition = null;
|
27576 | }
|
27577 | }
|
27578 |
|
27579 |
|
27580 | if (!nextPosition) {
|
27581 | return null;
|
27582 | }
|
27583 | if (nextPosition.rowIndex < 0) {
|
27584 | var headerLen = this.headerNavigationService.getHeaderRowCount();
|
27585 | this.focusService.focusHeaderPosition({
|
27586 | headerPosition: {
|
27587 | headerRowIndex: headerLen + (nextPosition.rowIndex),
|
27588 | column: nextPosition.column
|
27589 | }
|
27590 | });
|
27591 | return null;
|
27592 | }
|
27593 |
|
27594 |
|
27595 |
|
27596 |
|
27597 |
|
27598 | var fullRowEdit = this.gridOptionsWrapper.isFullRowEdit();
|
27599 | if (startEditing && !fullRowEdit) {
|
27600 | var cellIsEditable = this.isCellEditable(nextPosition);
|
27601 | if (!cellIsEditable) {
|
27602 | continue;
|
27603 | }
|
27604 | }
|
27605 | this.ensureCellVisible(nextPosition);
|
27606 |
|
27607 |
|
27608 | var nextCell = this.getCellByPosition(nextPosition);
|
27609 |
|
27610 |
|
27611 | if (!nextCell) {
|
27612 | var row = this.rowRenderer.getRowByPosition(nextPosition);
|
27613 | if (!row || !row.isFullWidth()) {
|
27614 | continue;
|
27615 | }
|
27616 | else {
|
27617 | return row;
|
27618 | }
|
27619 | }
|
27620 | if (nextCell.isSuppressNavigable()) {
|
27621 | continue;
|
27622 | }
|
27623 |
|
27624 |
|
27625 | if (this.rangeService) {
|
27626 | this.rangeService.setRangeToCell(nextPosition);
|
27627 | }
|
27628 |
|
27629 | return nextCell;
|
27630 | }
|
27631 | };
|
27632 | NavigationService.prototype.isCellEditable = function (cell) {
|
27633 | var rowNode = this.lookupRowNodeForCell(cell);
|
27634 | if (rowNode) {
|
27635 | return cell.column.isCellEditable(rowNode);
|
27636 | }
|
27637 | return false;
|
27638 | };
|
27639 | NavigationService.prototype.getCellByPosition = function (cellPosition) {
|
27640 | var rowCtrl = this.rowRenderer.getRowByPosition(cellPosition);
|
27641 | if (!rowCtrl) {
|
27642 | return null;
|
27643 | }
|
27644 | return rowCtrl.getCellCtrl(cellPosition.column);
|
27645 | };
|
27646 | NavigationService.prototype.lookupRowNodeForCell = function (cell) {
|
27647 | if (cell.rowPinned === Constants.PINNED_TOP) {
|
27648 | return this.pinnedRowModel.getPinnedTopRow(cell.rowIndex);
|
27649 | }
|
27650 | if (cell.rowPinned === Constants.PINNED_BOTTOM) {
|
27651 | return this.pinnedRowModel.getPinnedBottomRow(cell.rowIndex);
|
27652 | }
|
27653 | return this.paginationProxy.getRow(cell.rowIndex);
|
27654 | };
|
27655 |
|
27656 |
|
27657 | NavigationService.prototype.navigateToNextCell = function (event, key, currentCell, allowUserOverride) {
|
27658 |
|
27659 | var nextCell = currentCell;
|
27660 | var hitEdgeOfGrid = false;
|
27661 | while (nextCell && (nextCell === currentCell || !this.isValidNavigateCell(nextCell))) {
|
27662 |
|
27663 |
|
27664 |
|
27665 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
27666 | if (key === KeyCode.LEFT) {
|
27667 | nextCell = this.getLastCellOfColSpan(nextCell);
|
27668 | }
|
27669 | }
|
27670 | else if (key === KeyCode.RIGHT) {
|
27671 | nextCell = this.getLastCellOfColSpan(nextCell);
|
27672 | }
|
27673 | nextCell = this.cellNavigationService.getNextCellToFocus(key, nextCell);
|
27674 |
|
27675 | hitEdgeOfGrid = missing(nextCell);
|
27676 | }
|
27677 | if (hitEdgeOfGrid && event && event.key === KeyCode.UP) {
|
27678 | nextCell = {
|
27679 | rowIndex: -1,
|
27680 | rowPinned: null,
|
27681 | column: currentCell.column
|
27682 | };
|
27683 | }
|
27684 |
|
27685 |
|
27686 | if (allowUserOverride) {
|
27687 | var userFunc = this.gridOptionsWrapper.getNavigateToNextCellFunc();
|
27688 | if (exists(userFunc)) {
|
27689 | var params = {
|
27690 | key: key,
|
27691 | previousCellPosition: currentCell,
|
27692 | nextCellPosition: nextCell ? nextCell : null,
|
27693 | event: event
|
27694 | };
|
27695 | var userCell = userFunc(params);
|
27696 | if (exists(userCell)) {
|
27697 | if (userCell.floating) {
|
27698 | 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');
|
27699 | userCell.rowPinned = userCell.floating;
|
27700 | }
|
27701 | nextCell = {
|
27702 | rowPinned: userCell.rowPinned,
|
27703 | rowIndex: userCell.rowIndex,
|
27704 | column: userCell.column
|
27705 | };
|
27706 | }
|
27707 | else {
|
27708 | nextCell = null;
|
27709 | }
|
27710 | }
|
27711 | }
|
27712 |
|
27713 | if (!nextCell) {
|
27714 | return;
|
27715 | }
|
27716 | if (nextCell.rowIndex < 0) {
|
27717 | var headerLen = this.headerNavigationService.getHeaderRowCount();
|
27718 | this.focusService.focusHeaderPosition({
|
27719 | headerPosition: { headerRowIndex: headerLen + (nextCell.rowIndex), column: currentCell.column },
|
27720 | event: event || undefined
|
27721 | });
|
27722 | return;
|
27723 | }
|
27724 |
|
27725 |
|
27726 | var normalisedPosition = this.getNormalisedPosition(nextCell);
|
27727 | if (normalisedPosition) {
|
27728 | this.focusPosition(normalisedPosition);
|
27729 | }
|
27730 | else {
|
27731 | this.tryToFocusFullWidthRow(nextCell);
|
27732 | }
|
27733 | };
|
27734 | NavigationService.prototype.getNormalisedPosition = function (cellPosition) {
|
27735 |
|
27736 | this.ensureCellVisible(cellPosition);
|
27737 | var cellComp = this.getCellByPosition(cellPosition);
|
27738 |
|
27739 | if (!cellComp) {
|
27740 | return null;
|
27741 | }
|
27742 | cellPosition = cellComp.getCellPosition();
|
27743 |
|
27744 |
|
27745 |
|
27746 |
|
27747 |
|
27748 | this.ensureCellVisible(cellPosition);
|
27749 | return cellPosition;
|
27750 | };
|
27751 | NavigationService.prototype.tryToFocusFullWidthRow = function (position, backwards) {
|
27752 | if (backwards === void 0) { backwards = false; }
|
27753 | var displayedColumns = this.columnModel.getAllDisplayedColumns();
|
27754 | var rowComp = this.rowRenderer.getRowByPosition(position);
|
27755 | if (!rowComp || !rowComp.isFullWidth()) {
|
27756 | return false;
|
27757 | }
|
27758 | var currentCellFocused = this.focusService.getFocusedCell();
|
27759 | var cellPosition = {
|
27760 | rowIndex: position.rowIndex,
|
27761 | rowPinned: position.rowPinned,
|
27762 | column: position.column || (backwards ? last(displayedColumns) : displayedColumns[0])
|
27763 | };
|
27764 | this.focusPosition(cellPosition);
|
27765 | var fromBelow = currentCellFocused != null ? this.rowPositionUtils.before(cellPosition, currentCellFocused) : false;
|
27766 | var focusEvent = {
|
27767 | type: Events.EVENT_FULL_WIDTH_ROW_FOCUSED,
|
27768 | api: this.gridApi,
|
27769 | columnApi: this.columnApi,
|
27770 | rowIndex: cellPosition.rowIndex,
|
27771 | rowPinned: cellPosition.rowPinned,
|
27772 | column: cellPosition.column,
|
27773 | isFullWidthCell: true,
|
27774 | floating: cellPosition.rowPinned,
|
27775 | fromBelow: fromBelow
|
27776 | };
|
27777 | this.eventService.dispatchEvent(focusEvent);
|
27778 | return true;
|
27779 | };
|
27780 | NavigationService.prototype.focusPosition = function (cellPosition) {
|
27781 | this.focusService.setFocusedCell(cellPosition.rowIndex, cellPosition.column, cellPosition.rowPinned, true);
|
27782 | if (this.rangeService) {
|
27783 | this.rangeService.setRangeToCell(cellPosition);
|
27784 | }
|
27785 | };
|
27786 | NavigationService.prototype.isValidNavigateCell = function (cell) {
|
27787 | var rowNode = this.rowPositionUtils.getRowNode(cell);
|
27788 |
|
27789 | return !!rowNode;
|
27790 | };
|
27791 | NavigationService.prototype.getLastCellOfColSpan = function (cell) {
|
27792 | var cellCtrl = this.getCellByPosition(cell);
|
27793 | if (!cellCtrl) {
|
27794 | return cell;
|
27795 | }
|
27796 | var colSpanningList = cellCtrl.getColSpanningList();
|
27797 | if (colSpanningList.length === 1) {
|
27798 | return cell;
|
27799 | }
|
27800 | return {
|
27801 | rowIndex: cell.rowIndex,
|
27802 | column: last(colSpanningList),
|
27803 | rowPinned: cell.rowPinned
|
27804 | };
|
27805 | };
|
27806 | NavigationService.prototype.ensureCellVisible = function (gridCell) {
|
27807 |
|
27808 | if (missing(gridCell.rowPinned)) {
|
27809 | this.gridBodyCon.getScrollFeature().ensureIndexVisible(gridCell.rowIndex);
|
27810 | }
|
27811 | if (!gridCell.column.isPinned()) {
|
27812 | this.gridBodyCon.getScrollFeature().ensureColumnVisible(gridCell.column);
|
27813 | }
|
27814 |
|
27815 |
|
27816 | this.gridBodyCon.getScrollFeature().horizontallyScrollHeaderCenterAndFloatingCenter();
|
27817 |
|
27818 | this.animationFrameService.flushAllFrames();
|
27819 | };
|
27820 | __decorate$_([
|
27821 | Autowired('columnApi')
|
27822 | ], NavigationService.prototype, "columnApi", void 0);
|
27823 | __decorate$_([
|
27824 | Autowired('gridApi')
|
27825 | ], NavigationService.prototype, "gridApi", void 0);
|
27826 | __decorate$_([
|
27827 | Autowired('mouseEventService')
|
27828 | ], NavigationService.prototype, "mouseEventService", void 0);
|
27829 | __decorate$_([
|
27830 | Autowired('paginationProxy')
|
27831 | ], NavigationService.prototype, "paginationProxy", void 0);
|
27832 | __decorate$_([
|
27833 | Autowired('focusService')
|
27834 | ], NavigationService.prototype, "focusService", void 0);
|
27835 | __decorate$_([
|
27836 | Autowired('animationFrameService')
|
27837 | ], NavigationService.prototype, "animationFrameService", void 0);
|
27838 | __decorate$_([
|
27839 | Optional('rangeService')
|
27840 | ], NavigationService.prototype, "rangeService", void 0);
|
27841 | __decorate$_([
|
27842 | Autowired('columnModel')
|
27843 | ], NavigationService.prototype, "columnModel", void 0);
|
27844 | __decorate$_([
|
27845 | Autowired('ctrlsService')
|
27846 | ], NavigationService.prototype, "ctrlsService", void 0);
|
27847 | __decorate$_([
|
27848 | Autowired('rowRenderer')
|
27849 | ], NavigationService.prototype, "rowRenderer", void 0);
|
27850 | __decorate$_([
|
27851 | Autowired('headerNavigationService')
|
27852 | ], NavigationService.prototype, "headerNavigationService", void 0);
|
27853 | __decorate$_([
|
27854 | Autowired("rowPositionUtils")
|
27855 | ], NavigationService.prototype, "rowPositionUtils", void 0);
|
27856 | __decorate$_([
|
27857 | Autowired("cellNavigationService")
|
27858 | ], NavigationService.prototype, "cellNavigationService", void 0);
|
27859 | __decorate$_([
|
27860 | Autowired("pinnedRowModel")
|
27861 | ], NavigationService.prototype, "pinnedRowModel", void 0);
|
27862 | __decorate$_([
|
27863 | PostConstruct
|
27864 | ], NavigationService.prototype, "postConstruct", null);
|
27865 | NavigationService = __decorate$_([
|
27866 | Bean('navigationService')
|
27867 | ], NavigationService);
|
27868 | return NavigationService;
|
27869 | }(BeanStub));
|
27870 |
|
27871 |
|
27872 |
|
27873 |
|
27874 |
|
27875 |
|
27876 |
|
27877 | var __extends$1c = (undefined && undefined.__extends) || (function () {
|
27878 | var extendStatics = function (d, b) {
|
27879 | extendStatics = Object.setPrototypeOf ||
|
27880 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
27881 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
27882 | return extendStatics(d, b);
|
27883 | };
|
27884 | return function (d, b) {
|
27885 | extendStatics(d, b);
|
27886 | function __() { this.constructor = d; }
|
27887 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
27888 | };
|
27889 | })();
|
27890 | var __decorate$$ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
27891 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
27892 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
27893 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
27894 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
27895 | };
|
27896 | var PopupEditorWrapper = (function (_super) {
|
27897 | __extends$1c(PopupEditorWrapper, _super);
|
27898 | function PopupEditorWrapper(params) {
|
27899 | var _this = _super.call(this, "<div class=\"ag-popup-editor\" tabindex=\"-1\"/>") || this;
|
27900 | _this.params = params;
|
27901 | return _this;
|
27902 | }
|
27903 | PopupEditorWrapper.prototype.postConstruct = function () {
|
27904 | this.gridOptionsWrapper.setDomData(this.getGui(), PopupEditorWrapper.DOM_KEY_POPUP_EDITOR_WRAPPER, true);
|
27905 | this.addKeyDownListener();
|
27906 | };
|
27907 | PopupEditorWrapper.prototype.addKeyDownListener = function () {
|
27908 | var _this = this;
|
27909 | var eGui = this.getGui();
|
27910 | var params = this.params;
|
27911 | var listener = function (event) {
|
27912 | if (!isUserSuppressingKeyboardEvent(_this.gridOptionsWrapper, event, params.node, params.column, true)) {
|
27913 | params.onKeyDown(event);
|
27914 | }
|
27915 | };
|
27916 | this.addManagedListener(eGui, 'keydown', listener);
|
27917 | };
|
27918 | PopupEditorWrapper.DOM_KEY_POPUP_EDITOR_WRAPPER = 'popupEditorWrapper';
|
27919 | __decorate$$([
|
27920 | PostConstruct
|
27921 | ], PopupEditorWrapper.prototype, "postConstruct", null);
|
27922 | return PopupEditorWrapper;
|
27923 | }(PopupComponent));
|
27924 |
|
27925 |
|
27926 |
|
27927 |
|
27928 |
|
27929 |
|
27930 |
|
27931 | var __extends$1d = (undefined && undefined.__extends) || (function () {
|
27932 | var extendStatics = function (d, b) {
|
27933 | extendStatics = Object.setPrototypeOf ||
|
27934 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
27935 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
27936 | return extendStatics(d, b);
|
27937 | };
|
27938 | return function (d, b) {
|
27939 | extendStatics(d, b);
|
27940 | function __() { this.constructor = d; }
|
27941 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
27942 | };
|
27943 | })();
|
27944 | var CellComp = (function (_super) {
|
27945 | __extends$1d(CellComp, _super);
|
27946 | function CellComp(beans, cellCtrl, printLayout, eRow, editingRow) {
|
27947 | var _this = _super.call(this) || this;
|
27948 |
|
27949 |
|
27950 |
|
27951 |
|
27952 |
|
27953 |
|
27954 | _this.rendererVersion = 0;
|
27955 | _this.editorVersion = 0;
|
27956 | _this.beans = beans;
|
27957 | _this.column = cellCtrl.getColumn();
|
27958 | _this.rowNode = cellCtrl.getRowNode();
|
27959 | _this.rowCtrl = cellCtrl.getRowCtrl();
|
27960 | _this.eRow = eRow;
|
27961 | _this.setTemplate( "<div comp-id=\"" + _this.getCompId() + "\"/>");
|
27962 | var eGui = _this.getGui();
|
27963 | _this.forceWrapper = cellCtrl.isForceWrapper();
|
27964 | _this.refreshWrapper(false);
|
27965 | var setAttribute = function (name, value, element) {
|
27966 | var actualElement = element ? element : eGui;
|
27967 | if (value != null && value != '') {
|
27968 | actualElement.setAttribute(name, value);
|
27969 | }
|
27970 | else {
|
27971 | actualElement.removeAttribute(name);
|
27972 | }
|
27973 | };
|
27974 | var compProxy = {
|
27975 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
27976 | setUserStyles: function (styles) { return addStylesToElement(eGui, styles); },
|
27977 | getFocusableElement: function () { return _this.getFocusableElement(); },
|
27978 | setTabIndex: function (tabIndex) { return setAttribute('tabindex', tabIndex.toString()); },
|
27979 | setRole: function (role) { return setAriaRole(eGui, role); },
|
27980 | setColId: function (colId) { return setAttribute('col-id', colId); },
|
27981 | setTitle: function (title) { return setAttribute('title', title); },
|
27982 | setIncludeSelection: function (include) { return _this.includeSelection = include; },
|
27983 | setIncludeRowDrag: function (include) { return _this.includeRowDrag = include; },
|
27984 | setIncludeDndSource: function (include) { return _this.includeDndSource = include; },
|
27985 | setRenderDetails: function (compDetails, valueToDisplay, force) {
|
27986 | return _this.setRenderDetails(compDetails, valueToDisplay, force);
|
27987 | },
|
27988 | setEditDetails: function (compDetails, popup, position) {
|
27989 | return _this.setEditDetails(compDetails, popup, position);
|
27990 | },
|
27991 | getCellEditor: function () { return _this.cellEditor || null; },
|
27992 | getCellRenderer: function () { return _this.cellRenderer || null; },
|
27993 | getParentOfValue: function () { return _this.getParentOfValue(); }
|
27994 | };
|
27995 | _this.cellCtrl = cellCtrl;
|
27996 | cellCtrl.setComp(compProxy, _this.getGui(), _this.eCellWrapper, printLayout, editingRow);
|
27997 | return _this;
|
27998 | }
|
27999 | CellComp.prototype.getParentOfValue = function () {
|
28000 | if (this.eCellValue) {
|
28001 |
|
28002 | return this.eCellValue;
|
28003 | }
|
28004 | if (this.eCellWrapper) {
|
28005 |
|
28006 | return this.eCellWrapper;
|
28007 | }
|
28008 |
|
28009 | return this.getGui();
|
28010 | };
|
28011 | CellComp.prototype.setRenderDetails = function (compDetails, valueToDisplay, forceNewCellRendererInstance) {
|
28012 |
|
28013 | var isInlineEditing = this.cellEditor && !this.cellEditorPopupWrapper;
|
28014 | if (isInlineEditing) {
|
28015 | return;
|
28016 | }
|
28017 |
|
28018 | this.firstRender = this.firstRender == null;
|
28019 |
|
28020 | var controlWrapperChanged = this.refreshWrapper(false);
|
28021 |
|
28022 | if (compDetails) {
|
28023 | var neverRefresh = forceNewCellRendererInstance || controlWrapperChanged;
|
28024 | var cellRendererRefreshSuccessful = neverRefresh ? false : this.refreshCellRenderer(compDetails);
|
28025 | if (!cellRendererRefreshSuccessful) {
|
28026 | this.destroyRenderer();
|
28027 | this.createCellRendererInstance(compDetails);
|
28028 | }
|
28029 | }
|
28030 | else {
|
28031 | this.destroyRenderer();
|
28032 | this.insertValueWithoutCellRenderer(valueToDisplay);
|
28033 | }
|
28034 | };
|
28035 | CellComp.prototype.setEditDetails = function (compDetails, popup, position) {
|
28036 | if (compDetails) {
|
28037 | this.createCellEditorInstance(compDetails, popup, position);
|
28038 | }
|
28039 | else {
|
28040 | this.destroyEditor();
|
28041 | }
|
28042 | };
|
28043 | CellComp.prototype.removeControls = function () {
|
28044 | this.checkboxSelectionComp = this.beans.context.destroyBean(this.checkboxSelectionComp);
|
28045 | this.dndSourceComp = this.beans.context.destroyBean(this.dndSourceComp);
|
28046 | this.rowDraggingComp = this.beans.context.destroyBean(this.rowDraggingComp);
|
28047 | };
|
28048 |
|
28049 | CellComp.prototype.refreshWrapper = function (editing) {
|
28050 | var providingControls = this.includeRowDrag || this.includeDndSource || this.includeSelection;
|
28051 | var usingWrapper = providingControls || this.forceWrapper;
|
28052 | var putWrapperIn = usingWrapper && this.eCellWrapper == null;
|
28053 | if (putWrapperIn) {
|
28054 | this.eCellWrapper = loadTemplate("<div class=\"ag-cell-wrapper\" role=\"presentation\"></div>");
|
28055 | this.getGui().appendChild(this.eCellWrapper);
|
28056 | }
|
28057 | var takeWrapperOut = !usingWrapper && this.eCellWrapper != null;
|
28058 | if (takeWrapperOut) {
|
28059 | removeFromParent(this.eCellWrapper);
|
28060 | this.eCellWrapper = undefined;
|
28061 | }
|
28062 | this.addOrRemoveCssClass('ag-cell-value', !usingWrapper);
|
28063 | var usingCellValue = !editing && usingWrapper;
|
28064 | var putCellValueIn = usingCellValue && this.eCellValue == null;
|
28065 | if (putCellValueIn) {
|
28066 | this.eCellValue = loadTemplate("<span class=\"ag-cell-value\" role=\"presentation\"></span>");
|
28067 | this.eCellWrapper.appendChild(this.eCellValue);
|
28068 | }
|
28069 | var takeCellValueOut = !usingCellValue && this.eCellValue != null;
|
28070 | if (takeCellValueOut) {
|
28071 | removeFromParent(this.eCellValue);
|
28072 | this.eCellValue = undefined;
|
28073 | }
|
28074 | var templateChanged = putWrapperIn || takeWrapperOut || putCellValueIn || takeCellValueOut;
|
28075 | if (templateChanged) {
|
28076 | this.removeControls();
|
28077 | }
|
28078 | if (!editing && providingControls) {
|
28079 | this.addControls();
|
28080 | }
|
28081 | return templateChanged;
|
28082 | };
|
28083 | CellComp.prototype.addControls = function () {
|
28084 | var id = this.eCellValue.id = "cell-" + this.getCompId();
|
28085 | var describedByIds = [];
|
28086 | if (this.includeRowDrag) {
|
28087 | if (this.rowDraggingComp == null) {
|
28088 | this.rowDraggingComp = this.cellCtrl.createRowDragComp();
|
28089 | if (this.rowDraggingComp) {
|
28090 |
|
28091 | this.eCellWrapper.insertBefore(this.rowDraggingComp.getGui(), this.eCellValue);
|
28092 | }
|
28093 | }
|
28094 | }
|
28095 | if (this.includeDndSource) {
|
28096 | if (this.dndSourceComp == null) {
|
28097 | this.dndSourceComp = this.cellCtrl.createDndSource();
|
28098 |
|
28099 | this.eCellWrapper.insertBefore(this.dndSourceComp.getGui(), this.eCellValue);
|
28100 | }
|
28101 | }
|
28102 | if (this.includeSelection) {
|
28103 | if (this.checkboxSelectionComp == null) {
|
28104 | this.checkboxSelectionComp = this.cellCtrl.createSelectionCheckbox();
|
28105 | this.eCellWrapper.insertBefore(this.checkboxSelectionComp.getGui(), this.eCellValue);
|
28106 | }
|
28107 | describedByIds.push(this.checkboxSelectionComp.getCheckboxId());
|
28108 | }
|
28109 | describedByIds.push(id);
|
28110 | setAriaDescribedBy(this.getGui(), describedByIds.join(' '));
|
28111 | };
|
28112 | CellComp.prototype.createCellEditorInstance = function (compDetails, popup, position) {
|
28113 | var _this = this;
|
28114 | var versionCopy = this.editorVersion;
|
28115 | var cellEditorPromise = compDetails.newAgStackInstance();
|
28116 | if (!cellEditorPromise) {
|
28117 | return;
|
28118 | }
|
28119 | var params = compDetails.params;
|
28120 | cellEditorPromise.then(function (c) { return _this.afterCellEditorCreated(versionCopy, c, params, popup, position); });
|
28121 |
|
28122 |
|
28123 |
|
28124 | var cellEditorAsync = missing(this.cellEditor);
|
28125 | if (cellEditorAsync && params.cellStartedEdit) {
|
28126 | this.cellCtrl.focusCell(true);
|
28127 | }
|
28128 | };
|
28129 | CellComp.prototype.insertValueWithoutCellRenderer = function (valueToDisplay) {
|
28130 | var eParent = this.getParentOfValue();
|
28131 | clearElement(eParent);
|
28132 | var escapedValue = valueToDisplay != null ? escapeString(valueToDisplay) : null;
|
28133 | if (escapedValue != null) {
|
28134 | eParent.innerHTML = escapedValue;
|
28135 | }
|
28136 | };
|
28137 | CellComp.prototype.destroyEditorAndRenderer = function () {
|
28138 | this.destroyRenderer();
|
28139 | this.destroyEditor();
|
28140 | };
|
28141 | CellComp.prototype.destroyRenderer = function () {
|
28142 | var context = this.beans.context;
|
28143 | this.cellRenderer = context.destroyBean(this.cellRenderer);
|
28144 | removeFromParent(this.cellRendererGui);
|
28145 | this.cellRendererGui = null;
|
28146 | this.rendererVersion++;
|
28147 | };
|
28148 | CellComp.prototype.destroyEditor = function () {
|
28149 | var context = this.beans.context;
|
28150 | if (this.hideEditorPopup) {
|
28151 | this.hideEditorPopup();
|
28152 | }
|
28153 | this.hideEditorPopup = undefined;
|
28154 | this.cellEditor = context.destroyBean(this.cellEditor);
|
28155 | this.cellEditorPopupWrapper = context.destroyBean(this.cellEditorPopupWrapper);
|
28156 | removeFromParent(this.cellEditorGui);
|
28157 | this.cellEditorGui = null;
|
28158 | this.editorVersion++;
|
28159 | };
|
28160 | CellComp.prototype.refreshCellRenderer = function (compClassAndParams) {
|
28161 | if (this.cellRenderer == null || this.cellRenderer.refresh == null) {
|
28162 | return false;
|
28163 | }
|
28164 |
|
28165 |
|
28166 | if (this.cellRendererClass !== compClassAndParams.componentClass) {
|
28167 | return false;
|
28168 | }
|
28169 |
|
28170 | var result = this.cellRenderer.refresh(compClassAndParams.params);
|
28171 |
|
28172 |
|
28173 |
|
28174 |
|
28175 | return result === true || result === undefined;
|
28176 | };
|
28177 | CellComp.prototype.createCellRendererInstance = function (compDetails) {
|
28178 | var _this = this;
|
28179 |
|
28180 |
|
28181 |
|
28182 |
|
28183 |
|
28184 | var angularCompileRows = this.beans.gridOptionsWrapper.isAngularCompileRows();
|
28185 | var suppressAnimationFrame = this.beans.gridOptionsWrapper.isSuppressAnimationFrame();
|
28186 | var useTaskService = !angularCompileRows && !suppressAnimationFrame;
|
28187 | var displayComponentVersionCopy = this.rendererVersion;
|
28188 | var componentClass = compDetails.componentClass;
|
28189 | var createCellRendererFunc = function () {
|
28190 | var staleTask = _this.rendererVersion !== displayComponentVersionCopy || !_this.isAlive();
|
28191 | if (staleTask) {
|
28192 | return;
|
28193 | }
|
28194 |
|
28195 |
|
28196 | var componentPromise = compDetails.newAgStackInstance();
|
28197 | var callback = _this.afterCellRendererCreated.bind(_this, displayComponentVersionCopy, componentClass);
|
28198 | if (componentPromise) {
|
28199 | componentPromise.then(callback);
|
28200 | }
|
28201 | };
|
28202 |
|
28203 |
|
28204 |
|
28205 | if (useTaskService && this.firstRender) {
|
28206 | this.beans.animationFrameService.createTask(createCellRendererFunc, this.rowNode.rowIndex, 'createTasksP2');
|
28207 | }
|
28208 | else {
|
28209 | createCellRendererFunc();
|
28210 | }
|
28211 | };
|
28212 | CellComp.prototype.getCtrl = function () {
|
28213 | return this.cellCtrl;
|
28214 | };
|
28215 | CellComp.prototype.getRowCtrl = function () {
|
28216 | return this.rowCtrl;
|
28217 | };
|
28218 | CellComp.prototype.getCellRenderer = function () {
|
28219 | return this.cellRenderer;
|
28220 | };
|
28221 | CellComp.prototype.getCellEditor = function () {
|
28222 | return this.cellEditor;
|
28223 | };
|
28224 | CellComp.prototype.afterCellRendererCreated = function (cellRendererVersion, cellRendererClass, cellRenderer) {
|
28225 | var staleTask = !this.isAlive() || cellRendererVersion !== this.rendererVersion;
|
28226 | if (staleTask) {
|
28227 | this.beans.context.destroyBean(cellRenderer);
|
28228 | return;
|
28229 | }
|
28230 | this.cellRenderer = cellRenderer;
|
28231 | this.cellRendererClass = cellRendererClass;
|
28232 | this.cellRendererGui = this.cellRenderer.getGui();
|
28233 | if (this.cellRendererGui != null) {
|
28234 | var eParent = this.getParentOfValue();
|
28235 | clearElement(eParent);
|
28236 | eParent.appendChild(this.cellRendererGui);
|
28237 | }
|
28238 | };
|
28239 | CellComp.prototype.afterCellEditorCreated = function (requestVersion, cellEditor, params, popup, position) {
|
28240 |
|
28241 |
|
28242 |
|
28243 | var staleComp = requestVersion !== this.editorVersion;
|
28244 | if (staleComp) {
|
28245 | this.beans.context.destroyBean(cellEditor);
|
28246 | return;
|
28247 | }
|
28248 | var editingCancelledByUserComp = cellEditor.isCancelBeforeStart && cellEditor.isCancelBeforeStart();
|
28249 | if (editingCancelledByUserComp) {
|
28250 | this.beans.context.destroyBean(cellEditor);
|
28251 | this.cellCtrl.stopEditing();
|
28252 | return;
|
28253 | }
|
28254 | if (!cellEditor.getGui) {
|
28255 | console.warn("AG Grid: cellEditor for column " + this.column.getId() + " is missing getGui() method");
|
28256 | this.beans.context.destroyBean(cellEditor);
|
28257 | return;
|
28258 | }
|
28259 | this.cellEditor = cellEditor;
|
28260 | this.cellEditorGui = cellEditor.getGui();
|
28261 | var cellEditorInPopup = popup || (cellEditor.isPopup !== undefined && cellEditor.isPopup());
|
28262 | if (cellEditorInPopup) {
|
28263 | if (!popup) {
|
28264 | this.cellCtrl.hackSayEditingInPopup();
|
28265 | }
|
28266 | this.addPopupCellEditor(params, position);
|
28267 | }
|
28268 | else {
|
28269 | this.addInCellEditor();
|
28270 | }
|
28271 | if (cellEditor.afterGuiAttached) {
|
28272 | cellEditor.afterGuiAttached();
|
28273 | }
|
28274 | };
|
28275 | CellComp.prototype.addInCellEditor = function () {
|
28276 | var eGui = this.getGui();
|
28277 |
|
28278 |
|
28279 | var eDocument = this.beans.gridOptionsWrapper.getDocument();
|
28280 | if (eGui.contains(eDocument.activeElement)) {
|
28281 | eGui.focus();
|
28282 | }
|
28283 | this.destroyRenderer();
|
28284 | this.refreshWrapper(true);
|
28285 | this.clearParentOfValue();
|
28286 | if (this.cellEditorGui) {
|
28287 | var eParent = this.getParentOfValue();
|
28288 | eParent.appendChild(this.cellEditorGui);
|
28289 | }
|
28290 | };
|
28291 | CellComp.prototype.addPopupCellEditor = function (params, position) {
|
28292 | var _this = this;
|
28293 | if (this.beans.gridOptionsWrapper.isFullRowEdit()) {
|
28294 | console.warn('AG Grid: popup cellEditor does not work with fullRowEdit - you cannot use them both ' +
|
28295 | '- either turn off fullRowEdit, or stop using popup editors.');
|
28296 | }
|
28297 | var cellEditor = this.cellEditor;
|
28298 |
|
28299 | this.cellEditorPopupWrapper = this.beans.context.createBean(new PopupEditorWrapper(params));
|
28300 | var ePopupGui = this.cellEditorPopupWrapper.getGui();
|
28301 | if (this.cellEditorGui) {
|
28302 | ePopupGui.appendChild(this.cellEditorGui);
|
28303 | }
|
28304 | var popupService = this.beans.popupService;
|
28305 | var useModelPopup = this.beans.gridOptionsWrapper.isStopEditingWhenCellsLoseFocus();
|
28306 |
|
28307 | var positionToUse = position != null ? position : cellEditor.getPopupPosition ? cellEditor.getPopupPosition() : 'over';
|
28308 | var positionParams = {
|
28309 | column: this.column,
|
28310 | rowNode: this.rowNode,
|
28311 | type: 'popupCellEditor',
|
28312 | eventSource: this.getGui(),
|
28313 | ePopup: ePopupGui,
|
28314 | keepWithinBounds: true
|
28315 | };
|
28316 | var positionCallback = positionToUse === 'under' ?
|
28317 | popupService.positionPopupUnderComponent.bind(popupService, positionParams)
|
28318 | : popupService.positionPopupOverComponent.bind(popupService, positionParams);
|
28319 | var translate = this.beans.gridOptionsWrapper.getLocaleTextFunc();
|
28320 | var addPopupRes = popupService.addPopup({
|
28321 | modal: useModelPopup,
|
28322 | eChild: ePopupGui,
|
28323 | closeOnEsc: true,
|
28324 | closedCallback: function () { _this.cellCtrl.onPopupEditorClosed(); },
|
28325 | anchorToElement: this.getGui(),
|
28326 | positionCallback: positionCallback,
|
28327 | ariaLabel: translate('ariaLabelCellEditor', 'Cell Editor')
|
28328 | });
|
28329 | if (addPopupRes) {
|
28330 | this.hideEditorPopup = addPopupRes.hideFunc;
|
28331 | }
|
28332 | };
|
28333 | CellComp.prototype.detach = function () {
|
28334 | this.eRow.removeChild(this.getGui());
|
28335 | };
|
28336 |
|
28337 |
|
28338 |
|
28339 |
|
28340 |
|
28341 |
|
28342 | CellComp.prototype.destroy = function () {
|
28343 | this.cellCtrl.stopEditing();
|
28344 | this.destroyEditorAndRenderer();
|
28345 | this.removeControls();
|
28346 | _super.prototype.destroy.call(this);
|
28347 | };
|
28348 | CellComp.prototype.clearParentOfValue = function () {
|
28349 | var eGui = this.getGui();
|
28350 |
|
28351 |
|
28352 | var eDocument = this.beans.gridOptionsWrapper.getDocument();
|
28353 | if (eGui.contains(eDocument.activeElement)) {
|
28354 | eGui.focus({
|
28355 | preventScroll: true
|
28356 | });
|
28357 | }
|
28358 | clearElement(this.getParentOfValue());
|
28359 | };
|
28360 | return CellComp;
|
28361 | }(Component));
|
28362 |
|
28363 |
|
28364 |
|
28365 |
|
28366 |
|
28367 |
|
28368 |
|
28369 | var __extends$1e = (undefined && undefined.__extends) || (function () {
|
28370 | var extendStatics = function (d, b) {
|
28371 | extendStatics = Object.setPrototypeOf ||
|
28372 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
28373 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
28374 | return extendStatics(d, b);
|
28375 | };
|
28376 | return function (d, b) {
|
28377 | extendStatics(d, b);
|
28378 | function __() { this.constructor = d; }
|
28379 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
28380 | };
|
28381 | })();
|
28382 | var RowComp = (function (_super) {
|
28383 | __extends$1e(RowComp, _super);
|
28384 | function RowComp(ctrl, beans, containerType) {
|
28385 | var _this = _super.call(this) || this;
|
28386 | _this.cellComps = {};
|
28387 | _this.beans = beans;
|
28388 | _this.rowCtrl = ctrl;
|
28389 | _this.setTemplate( "<div comp-id=\"" + _this.getCompId() + "\" style=\"" + _this.getInitialStyle() + "\"/>");
|
28390 | var eGui = _this.getGui();
|
28391 | var style = eGui.style;
|
28392 | var compProxy = {
|
28393 | setDomOrder: function (domOrder) { return _this.domOrder = domOrder; },
|
28394 | setCellCtrls: function (cellCtrls) { return _this.setCellCtrls(cellCtrls); },
|
28395 | showFullWidth: function (compDetails) { return _this.showFullWidth(compDetails); },
|
28396 | getFullWidthCellRenderer: function () { return _this.getFullWidthCellRenderer(); },
|
28397 | addOrRemoveCssClass: function (name, on) { return _this.addOrRemoveCssClass(name, on); },
|
28398 | setUserStyles: function (styles) { return addStylesToElement(eGui, styles); },
|
28399 | setTop: function (top) { return style.top = top; },
|
28400 | setTransform: function (transform) { return style.transform = transform; },
|
28401 | setRowIndex: function (rowIndex) { return eGui.setAttribute('row-index', rowIndex); },
|
28402 | setRole: function (role) { return setAriaRole(eGui, role); },
|
28403 | setRowId: function (rowId) { return eGui.setAttribute('row-id', rowId); },
|
28404 | setRowBusinessKey: function (businessKey) { return eGui.setAttribute('row-business-key', businessKey); },
|
28405 | setTabIndex: function (tabIndex) { return eGui.setAttribute('tabindex', tabIndex.toString()); }
|
28406 | };
|
28407 | ctrl.setComp(compProxy, _this.getGui(), containerType);
|
28408 | return _this;
|
28409 | }
|
28410 | RowComp.prototype.getInitialStyle = function () {
|
28411 | var transform = this.rowCtrl.getInitialTransform();
|
28412 | var top = this.rowCtrl.getInitialRowTop();
|
28413 | return transform ? "transform: " + transform : "top: " + top;
|
28414 | };
|
28415 | RowComp.prototype.showFullWidth = function (compDetails) {
|
28416 | var _this = this;
|
28417 | var callback = function (cellRenderer) {
|
28418 | if (_this.isAlive()) {
|
28419 | var eGui = cellRenderer.getGui();
|
28420 | _this.getGui().appendChild(eGui);
|
28421 | _this.rowCtrl.setupDetailRowAutoHeight(eGui);
|
28422 | _this.setFullWidthRowComp(cellRenderer);
|
28423 | }
|
28424 | else {
|
28425 | _this.beans.context.destroyBean(cellRenderer);
|
28426 | }
|
28427 | };
|
28428 |
|
28429 | var res = compDetails.newAgStackInstance();
|
28430 | if (!res) {
|
28431 | return;
|
28432 | }
|
28433 | res.then(callback);
|
28434 | };
|
28435 | RowComp.prototype.setCellCtrls = function (cellCtrls) {
|
28436 | var _this = this;
|
28437 | var cellsToRemove = Object.assign({}, this.cellComps);
|
28438 | cellCtrls.forEach(function (cellCtrl) {
|
28439 | var key = cellCtrl.getInstanceId();
|
28440 | var existingCellComp = _this.cellComps[key];
|
28441 | if (existingCellComp == null) {
|
28442 | _this.newCellComp(cellCtrl);
|
28443 | }
|
28444 | else {
|
28445 | cellsToRemove[key] = null;
|
28446 | }
|
28447 | });
|
28448 | var cellCompsToRemove = getAllValuesInObject(cellsToRemove)
|
28449 | .filter(function (cellComp) { return cellComp != null; });
|
28450 | this.destroyCells(cellCompsToRemove);
|
28451 | this.ensureDomOrder(cellCtrls);
|
28452 | };
|
28453 | RowComp.prototype.ensureDomOrder = function (cellCtrls) {
|
28454 | var _this = this;
|
28455 | if (!this.domOrder) {
|
28456 | return;
|
28457 | }
|
28458 | var elementsInOrder = [];
|
28459 | cellCtrls.forEach(function (cellCtrl) {
|
28460 | var cellComp = _this.cellComps[cellCtrl.getInstanceId()];
|
28461 | if (cellComp) {
|
28462 | elementsInOrder.push(cellComp.getGui());
|
28463 | }
|
28464 | });
|
28465 | setDomChildOrder(this.getGui(), elementsInOrder);
|
28466 | };
|
28467 | RowComp.prototype.newCellComp = function (cellCtrl) {
|
28468 | var cellComp = new CellComp(this.beans, cellCtrl, this.rowCtrl.isPrintLayout(), this.getGui(), this.rowCtrl.isEditing());
|
28469 | this.cellComps[cellCtrl.getInstanceId()] = cellComp;
|
28470 | this.getGui().appendChild(cellComp.getGui());
|
28471 | };
|
28472 | RowComp.prototype.destroy = function () {
|
28473 | _super.prototype.destroy.call(this);
|
28474 | this.destroyAllCells();
|
28475 | };
|
28476 | RowComp.prototype.destroyAllCells = function () {
|
28477 | var cellsToDestroy = getAllValuesInObject(this.cellComps).filter(function (cp) { return cp != null; });
|
28478 | this.destroyCells(cellsToDestroy);
|
28479 | };
|
28480 | RowComp.prototype.setFullWidthRowComp = function (fullWidthRowComponent) {
|
28481 | var _this = this;
|
28482 | if (this.fullWidthCellRenderer) {
|
28483 | console.error('AG Grid - should not be setting fullWidthRowComponent twice');
|
28484 | }
|
28485 | this.fullWidthCellRenderer = fullWidthRowComponent;
|
28486 | this.addDestroyFunc(function () {
|
28487 | _this.fullWidthCellRenderer = _this.beans.context.destroyBean(_this.fullWidthCellRenderer);
|
28488 | });
|
28489 | };
|
28490 | RowComp.prototype.getFullWidthCellRenderer = function () {
|
28491 | return this.fullWidthCellRenderer;
|
28492 | };
|
28493 | RowComp.prototype.destroyCells = function (cellComps) {
|
28494 | var _this = this;
|
28495 | cellComps.forEach(function (cellComp) {
|
28496 |
|
28497 | if (!cellComp) {
|
28498 | return;
|
28499 | }
|
28500 |
|
28501 | var instanceId = cellComp.getCtrl().getInstanceId();
|
28502 | if (_this.cellComps[instanceId] !== cellComp) {
|
28503 | return;
|
28504 | }
|
28505 | cellComp.detach();
|
28506 | cellComp.destroy();
|
28507 | _this.cellComps[instanceId] = null;
|
28508 | });
|
28509 | };
|
28510 | return RowComp;
|
28511 | }(Component));
|
28512 |
|
28513 |
|
28514 |
|
28515 |
|
28516 |
|
28517 |
|
28518 |
|
28519 | var __extends$1f = (undefined && undefined.__extends) || (function () {
|
28520 | var extendStatics = function (d, b) {
|
28521 | extendStatics = Object.setPrototypeOf ||
|
28522 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
28523 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
28524 | return extendStatics(d, b);
|
28525 | };
|
28526 | return function (d, b) {
|
28527 | extendStatics(d, b);
|
28528 | function __() { this.constructor = d; }
|
28529 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
28530 | };
|
28531 | })();
|
28532 | var __assign$d = (undefined && undefined.__assign) || function () {
|
28533 | __assign$d = Object.assign || function(t) {
|
28534 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
28535 | s = arguments[i];
|
28536 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
28537 | t[p] = s[p];
|
28538 | }
|
28539 | return t;
|
28540 | };
|
28541 | return __assign$d.apply(this, arguments);
|
28542 | };
|
28543 | var __decorate$10 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
28544 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28545 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
28546 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
28547 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
28548 | };
|
28549 | function templateFactory() {
|
28550 | var name = Component.elementGettingCreated.getAttribute('name');
|
28551 | var cssClasses = RowContainerCtrl.getRowContainerCssClasses(name);
|
28552 | var res;
|
28553 | var template1 = name === RowContainerName.CENTER;
|
28554 | var template2 = name === RowContainerName.TOP_CENTER || name === RowContainerName.BOTTOM_CENTER;
|
28555 | if (template1) {
|
28556 | res =
|
28557 | "<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>";
|
28558 | }
|
28559 | else if (template2) {
|
28560 | res =
|
28561 | "<div class=\"" + cssClasses.viewport + "\" ref=\"eViewport\" role=\"presentation\">\n <div class=\"" + cssClasses.container + "\" ref=\"eContainer\"></div>\n </div>";
|
28562 | }
|
28563 | else {
|
28564 | res =
|
28565 | "<div class=\"" + cssClasses.container + "\" ref=\"eContainer\"></div>";
|
28566 | }
|
28567 | return res;
|
28568 | }
|
28569 | var RowContainerComp = (function (_super) {
|
28570 | __extends$1f(RowContainerComp, _super);
|
28571 | function RowContainerComp() {
|
28572 | var _this = _super.call(this, templateFactory()) || this;
|
28573 | _this.rowComps = {};
|
28574 | _this.name = Component.elementGettingCreated.getAttribute('name');
|
28575 | _this.type = getRowContainerTypeForName(_this.name);
|
28576 | return _this;
|
28577 | }
|
28578 | RowContainerComp.prototype.postConstruct = function () {
|
28579 | var _this = this;
|
28580 | var compProxy = {
|
28581 | setViewportHeight: function (height) { return _this.eViewport.style.height = height; },
|
28582 | setRowCtrls: function (rowCtrls) { return _this.setRowCtrls(rowCtrls); },
|
28583 | setDomOrder: function (domOrder) {
|
28584 | _this.domOrder = domOrder;
|
28585 | },
|
28586 | setContainerWidth: function (width) { return _this.eContainer.style.width = width; }
|
28587 | };
|
28588 | var ctrl = this.createManagedBean(new RowContainerCtrl(this.name));
|
28589 | ctrl.setComp(compProxy, this.eContainer, this.eViewport, this.eWrapper);
|
28590 | };
|
28591 | RowContainerComp.prototype.preDestroy = function () {
|
28592 |
|
28593 | this.setRowCtrls([]);
|
28594 | };
|
28595 | RowContainerComp.prototype.setRowCtrls = function (rowCtrls) {
|
28596 | var _this = this;
|
28597 | var oldRows = __assign$d({}, this.rowComps);
|
28598 | this.rowComps = {};
|
28599 | this.lastPlacedElement = null;
|
28600 | var processRow = function (rowCon) {
|
28601 | var instanceId = rowCon.getInstanceId();
|
28602 | var existingRowComp = oldRows[instanceId];
|
28603 | if (existingRowComp) {
|
28604 | _this.rowComps[instanceId] = existingRowComp;
|
28605 | delete oldRows[instanceId];
|
28606 | _this.ensureDomOrder(existingRowComp.getGui());
|
28607 | }
|
28608 | else {
|
28609 | var rowComp = _this.newRowComp(rowCon);
|
28610 | _this.rowComps[instanceId] = rowComp;
|
28611 | _this.appendRow(rowComp.getGui());
|
28612 | }
|
28613 | };
|
28614 | rowCtrls.forEach(processRow);
|
28615 | getAllValuesInObject(oldRows).forEach(function (oldRowComp) {
|
28616 | _this.eContainer.removeChild(oldRowComp.getGui());
|
28617 | oldRowComp.destroy();
|
28618 | });
|
28619 | setAriaRole(this.eContainer, rowCtrls.length ? "rowgroup" : "presentation");
|
28620 | };
|
28621 | RowContainerComp.prototype.appendRow = function (element) {
|
28622 | if (this.domOrder) {
|
28623 | insertWithDomOrder(this.eContainer, element, this.lastPlacedElement);
|
28624 | }
|
28625 | else {
|
28626 | this.eContainer.appendChild(element);
|
28627 | }
|
28628 | this.lastPlacedElement = element;
|
28629 | };
|
28630 | RowContainerComp.prototype.ensureDomOrder = function (eRow) {
|
28631 | if (this.domOrder) {
|
28632 | ensureDomOrder(this.eContainer, eRow, this.lastPlacedElement);
|
28633 | this.lastPlacedElement = eRow;
|
28634 | }
|
28635 | };
|
28636 | RowContainerComp.prototype.newRowComp = function (rowCtrl) {
|
28637 | var pinned = RowContainerCtrl.getPinned(this.name);
|
28638 | var res = new RowComp(rowCtrl, this.beans, this.type);
|
28639 | return res;
|
28640 | };
|
28641 | __decorate$10([
|
28642 | Autowired('beans')
|
28643 | ], RowContainerComp.prototype, "beans", void 0);
|
28644 | __decorate$10([
|
28645 | RefSelector('eViewport')
|
28646 | ], RowContainerComp.prototype, "eViewport", void 0);
|
28647 | __decorate$10([
|
28648 | RefSelector('eContainer')
|
28649 | ], RowContainerComp.prototype, "eContainer", void 0);
|
28650 | __decorate$10([
|
28651 | RefSelector('eWrapper')
|
28652 | ], RowContainerComp.prototype, "eWrapper", void 0);
|
28653 | __decorate$10([
|
28654 | PostConstruct
|
28655 | ], RowContainerComp.prototype, "postConstruct", null);
|
28656 | __decorate$10([
|
28657 | PreDestroy
|
28658 | ], RowContainerComp.prototype, "preDestroy", null);
|
28659 | return RowContainerComp;
|
28660 | }(Component));
|
28661 |
|
28662 |
|
28663 |
|
28664 |
|
28665 |
|
28666 |
|
28667 |
|
28668 | var __decorate$11 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
28669 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28670 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
28671 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
28672 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
28673 | };
|
28674 | var BodyDropPivotTarget = (function () {
|
28675 | function BodyDropPivotTarget(pinned) {
|
28676 | this.columnsToAggregate = [];
|
28677 | this.columnsToGroup = [];
|
28678 | this.columnsToPivot = [];
|
28679 | this.pinned = pinned;
|
28680 | }
|
28681 |
|
28682 | BodyDropPivotTarget.prototype.onDragEnter = function (draggingEvent) {
|
28683 | var _this = this;
|
28684 | this.clearColumnsList();
|
28685 |
|
28686 | if (this.gridOptionsWrapper.isFunctionsReadOnly()) {
|
28687 | return;
|
28688 | }
|
28689 | var dragColumns = draggingEvent.dragItem.columns;
|
28690 | if (!dragColumns) {
|
28691 | return;
|
28692 | }
|
28693 | dragColumns.forEach(function (column) {
|
28694 |
|
28695 | if (!column.isPrimary()) {
|
28696 | return;
|
28697 | }
|
28698 | if (column.isAnyFunctionActive()) {
|
28699 | return;
|
28700 | }
|
28701 | if (column.isAllowValue()) {
|
28702 | _this.columnsToAggregate.push(column);
|
28703 | }
|
28704 | else if (column.isAllowRowGroup()) {
|
28705 | _this.columnsToGroup.push(column);
|
28706 | }
|
28707 | else if (column.isAllowPivot()) {
|
28708 | _this.columnsToPivot.push(column);
|
28709 | }
|
28710 | });
|
28711 | };
|
28712 | BodyDropPivotTarget.prototype.getIconName = function () {
|
28713 | var totalColumns = this.columnsToAggregate.length + this.columnsToGroup.length + this.columnsToPivot.length;
|
28714 | if (totalColumns > 0) {
|
28715 | return this.pinned ? DragAndDropService.ICON_PINNED : DragAndDropService.ICON_MOVE;
|
28716 | }
|
28717 | return null;
|
28718 | };
|
28719 |
|
28720 | BodyDropPivotTarget.prototype.onDragLeave = function (draggingEvent) {
|
28721 |
|
28722 | this.clearColumnsList();
|
28723 | };
|
28724 | BodyDropPivotTarget.prototype.clearColumnsList = function () {
|
28725 | this.columnsToAggregate.length = 0;
|
28726 | this.columnsToGroup.length = 0;
|
28727 | this.columnsToPivot.length = 0;
|
28728 | };
|
28729 |
|
28730 | BodyDropPivotTarget.prototype.onDragging = function (draggingEvent) {
|
28731 | };
|
28732 |
|
28733 | BodyDropPivotTarget.prototype.onDragStop = function (draggingEvent) {
|
28734 | if (this.columnsToAggregate.length > 0) {
|
28735 | this.columnModel.addValueColumns(this.columnsToAggregate, "toolPanelDragAndDrop");
|
28736 | }
|
28737 | if (this.columnsToGroup.length > 0) {
|
28738 | this.columnModel.addRowGroupColumns(this.columnsToGroup, "toolPanelDragAndDrop");
|
28739 | }
|
28740 | if (this.columnsToPivot.length > 0) {
|
28741 | this.columnModel.addPivotColumns(this.columnsToPivot, "toolPanelDragAndDrop");
|
28742 | }
|
28743 | };
|
28744 | __decorate$11([
|
28745 | Autowired('columnModel')
|
28746 | ], BodyDropPivotTarget.prototype, "columnModel", void 0);
|
28747 | __decorate$11([
|
28748 | Autowired('gridOptionsWrapper')
|
28749 | ], BodyDropPivotTarget.prototype, "gridOptionsWrapper", void 0);
|
28750 | return BodyDropPivotTarget;
|
28751 | }());
|
28752 |
|
28753 |
|
28754 |
|
28755 |
|
28756 |
|
28757 |
|
28758 |
|
28759 | var __decorate$12 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
28760 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28761 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
28762 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
28763 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
28764 | };
|
28765 | var MoveColumnFeature = (function () {
|
28766 | function MoveColumnFeature(pinned, eContainer) {
|
28767 | this.needToMoveLeft = false;
|
28768 | this.needToMoveRight = false;
|
28769 | this.pinned = pinned;
|
28770 | this.eContainer = eContainer;
|
28771 | this.centerContainer = !exists(pinned);
|
28772 | }
|
28773 | MoveColumnFeature.prototype.init = function () {
|
28774 | var _this = this;
|
28775 | this.ctrlsService.whenReady(function () {
|
28776 | _this.gridBodyCon = _this.ctrlsService.getGridBodyCtrl();
|
28777 | });
|
28778 | };
|
28779 | MoveColumnFeature.prototype.getIconName = function () {
|
28780 | return this.pinned ? DragAndDropService.ICON_PINNED : DragAndDropService.ICON_MOVE;
|
28781 | };
|
28782 | MoveColumnFeature.prototype.onDragEnter = function (draggingEvent) {
|
28783 |
|
28784 | var columns = draggingEvent.dragItem.columns;
|
28785 | var dragCameFromToolPanel = draggingEvent.dragSource.type === DragSourceType.ToolPanel;
|
28786 | if (dragCameFromToolPanel) {
|
28787 |
|
28788 | this.setColumnsVisible(columns, true, "uiColumnDragged");
|
28789 | }
|
28790 | else {
|
28791 |
|
28792 |
|
28793 |
|
28794 |
|
28795 | var visibleState_1 = draggingEvent.dragItem.visibleState;
|
28796 | var visibleColumns = (columns || []).filter(function (column) { return visibleState_1[column.getId()]; });
|
28797 | this.setColumnsVisible(visibleColumns, true, "uiColumnDragged");
|
28798 | }
|
28799 | this.setColumnsPinned(columns, this.pinned, "uiColumnDragged");
|
28800 | this.onDragging(draggingEvent, true);
|
28801 | };
|
28802 | MoveColumnFeature.prototype.onDragLeave = function (draggingEvent) {
|
28803 | var hideColumnOnExit = !this.gridOptionsWrapper.isSuppressDragLeaveHidesColumns() && !draggingEvent.fromNudge;
|
28804 | if (hideColumnOnExit) {
|
28805 | var dragItem = draggingEvent.dragSource.getDragItem();
|
28806 | var columns = dragItem.columns;
|
28807 | this.setColumnsVisible(columns, false, "uiColumnDragged");
|
28808 | }
|
28809 | this.ensureIntervalCleared();
|
28810 | };
|
28811 | MoveColumnFeature.prototype.setColumnsVisible = function (columns, visible, source) {
|
28812 | if (source === void 0) { source = "api"; }
|
28813 | if (columns) {
|
28814 | var allowedCols = columns.filter(function (c) { return !c.getColDef().lockVisible; });
|
28815 | this.columnModel.setColumnsVisible(allowedCols, visible, source);
|
28816 | }
|
28817 | };
|
28818 | MoveColumnFeature.prototype.setColumnsPinned = function (columns, pinned, source) {
|
28819 | if (source === void 0) { source = "api"; }
|
28820 | if (columns) {
|
28821 | var allowedCols = columns.filter(function (c) { return !c.getColDef().lockPinned; });
|
28822 | this.columnModel.setColumnsPinned(allowedCols, pinned, source);
|
28823 | }
|
28824 | };
|
28825 | MoveColumnFeature.prototype.onDragStop = function () {
|
28826 | this.ensureIntervalCleared();
|
28827 | };
|
28828 | MoveColumnFeature.prototype.normaliseX = function (x) {
|
28829 |
|
28830 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
28831 | var clientWidth = this.eContainer.clientWidth;
|
28832 | x = clientWidth - x;
|
28833 | }
|
28834 |
|
28835 | if (this.centerContainer) {
|
28836 | x += this.ctrlsService.getCenterRowContainerCtrl().getCenterViewportScrollLeft();
|
28837 | }
|
28838 | return x;
|
28839 | };
|
28840 | MoveColumnFeature.prototype.checkCenterForScrolling = function (xAdjustedForScroll) {
|
28841 | if (this.centerContainer) {
|
28842 |
|
28843 |
|
28844 | var firstVisiblePixel = this.ctrlsService.getCenterRowContainerCtrl().getCenterViewportScrollLeft();
|
28845 | var lastVisiblePixel = firstVisiblePixel + this.ctrlsService.getCenterRowContainerCtrl().getCenterWidth();
|
28846 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
28847 | this.needToMoveRight = xAdjustedForScroll < (firstVisiblePixel + 50);
|
28848 | this.needToMoveLeft = xAdjustedForScroll > (lastVisiblePixel - 50);
|
28849 | }
|
28850 | else {
|
28851 | this.needToMoveLeft = xAdjustedForScroll < (firstVisiblePixel + 50);
|
28852 | this.needToMoveRight = xAdjustedForScroll > (lastVisiblePixel - 50);
|
28853 | }
|
28854 | if (this.needToMoveLeft || this.needToMoveRight) {
|
28855 | this.ensureIntervalStarted();
|
28856 | }
|
28857 | else {
|
28858 | this.ensureIntervalCleared();
|
28859 | }
|
28860 | }
|
28861 | };
|
28862 | MoveColumnFeature.prototype.onDragging = function (draggingEvent, fromEnter) {
|
28863 | var _this = this;
|
28864 | if (fromEnter === void 0) { fromEnter = false; }
|
28865 | this.lastDraggingEvent = draggingEvent;
|
28866 |
|
28867 | if (missing(draggingEvent.hDirection)) {
|
28868 | return;
|
28869 | }
|
28870 | var mouseXNormalised = this.normaliseX(draggingEvent.x);
|
28871 |
|
28872 |
|
28873 |
|
28874 | if (!fromEnter) {
|
28875 | this.checkCenterForScrolling(mouseXNormalised);
|
28876 | }
|
28877 | var hDirectionNormalised = this.normaliseDirection(draggingEvent.hDirection);
|
28878 | var dragSourceType = draggingEvent.dragSource.type;
|
28879 | var columnsToMove = draggingEvent.dragSource.getDragItem().columns;
|
28880 | columnsToMove = columnsToMove.filter(function (col) {
|
28881 | if (col.getColDef().lockPinned) {
|
28882 |
|
28883 |
|
28884 | return col.getPinned() == _this.pinned;
|
28885 | }
|
28886 |
|
28887 | return true;
|
28888 | });
|
28889 | this.attemptMoveColumns(dragSourceType, columnsToMove, hDirectionNormalised, mouseXNormalised, fromEnter);
|
28890 | };
|
28891 | MoveColumnFeature.prototype.normaliseDirection = function (hDirection) {
|
28892 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
28893 | switch (hDirection) {
|
28894 | case HorizontalDirection.Left: return HorizontalDirection.Right;
|
28895 | case HorizontalDirection.Right: return HorizontalDirection.Left;
|
28896 | default: console.error("AG Grid: Unknown direction " + hDirection);
|
28897 | }
|
28898 | }
|
28899 | else {
|
28900 | return hDirection;
|
28901 | }
|
28902 | };
|
28903 |
|
28904 |
|
28905 | MoveColumnFeature.prototype.calculateOldIndex = function (movingCols) {
|
28906 | var gridCols = this.columnModel.getAllGridColumns();
|
28907 | var indexes = sortNumerically(movingCols.map(function (col) { return gridCols.indexOf(col); }));
|
28908 | var firstIndex = indexes[0];
|
28909 | var lastIndex = last(indexes);
|
28910 | var spread = lastIndex - firstIndex;
|
28911 | var gapsExist = spread !== indexes.length - 1;
|
28912 | return gapsExist ? null : firstIndex;
|
28913 | };
|
28914 | MoveColumnFeature.prototype.attemptMoveColumns = function (dragSourceType, allMovingColumns, hDirection, mouseX, fromEnter) {
|
28915 | var draggingLeft = hDirection === HorizontalDirection.Left;
|
28916 | var draggingRight = hDirection === HorizontalDirection.Right;
|
28917 |
|
28918 |
|
28919 |
|
28920 | var allMovingColumnsOrdered = allMovingColumns.slice();
|
28921 | this.columnModel.sortColumnsLikeGridColumns(allMovingColumnsOrdered);
|
28922 | var validMoves = this.calculateValidMoves(allMovingColumnsOrdered, draggingRight, mouseX);
|
28923 |
|
28924 |
|
28925 | var oldIndex = this.calculateOldIndex(allMovingColumnsOrdered);
|
28926 | if (validMoves.length === 0) {
|
28927 | return;
|
28928 | }
|
28929 | var firstValidMove = validMoves[0];
|
28930 |
|
28931 |
|
28932 |
|
28933 |
|
28934 |
|
28935 |
|
28936 |
|
28937 |
|
28938 | var constrainDirection = oldIndex !== null && !fromEnter;
|
28939 |
|
28940 | if (dragSourceType == DragSourceType.HeaderCell) {
|
28941 | constrainDirection = oldIndex !== null;
|
28942 | }
|
28943 | if (constrainDirection) {
|
28944 |
|
28945 | if (draggingLeft && firstValidMove >= oldIndex) {
|
28946 | return;
|
28947 | }
|
28948 |
|
28949 | if (draggingRight && firstValidMove <= oldIndex) {
|
28950 | return;
|
28951 | }
|
28952 | }
|
28953 | for (var i = 0; i < validMoves.length; i++) {
|
28954 | var move = validMoves[i];
|
28955 | if (!this.columnModel.doesMovePassRules(allMovingColumnsOrdered, move)) {
|
28956 | continue;
|
28957 | }
|
28958 | this.columnModel.moveColumns(allMovingColumnsOrdered, move, "uiColumnDragged");
|
28959 |
|
28960 | return;
|
28961 | }
|
28962 | };
|
28963 | MoveColumnFeature.prototype.calculateValidMoves = function (movingCols, draggingRight, mouseX) {
|
28964 | var isMoveBlocked = this.gridOptionsWrapper.isSuppressMovableColumns() || movingCols.some(function (col) { return col.getColDef().suppressMovable; });
|
28965 | if (isMoveBlocked) {
|
28966 | return [];
|
28967 | }
|
28968 |
|
28969 | var allDisplayedCols = this.columnModel.getDisplayedColumns(this.pinned);
|
28970 |
|
28971 |
|
28972 | var allGridCols = this.columnModel.getAllGridColumns();
|
28973 | var movingDisplayedCols = allDisplayedCols.filter(function (col) { return includes(movingCols, col); });
|
28974 | var otherDisplayedCols = allDisplayedCols.filter(function (col) { return !includes(movingCols, col); });
|
28975 | var otherGridCols = allGridCols.filter(function (col) { return !includes(movingCols, col); });
|
28976 |
|
28977 |
|
28978 |
|
28979 | var displayIndex = 0;
|
28980 | var availableWidth = mouseX;
|
28981 |
|
28982 |
|
28983 | if (draggingRight) {
|
28984 | var widthOfMovingDisplayedCols_1 = 0;
|
28985 | movingDisplayedCols.forEach(function (col) { return widthOfMovingDisplayedCols_1 += col.getActualWidth(); });
|
28986 | availableWidth -= widthOfMovingDisplayedCols_1;
|
28987 | }
|
28988 | if (availableWidth > 0) {
|
28989 |
|
28990 | for (var i = 0; i < otherDisplayedCols.length; i++) {
|
28991 | var col = otherDisplayedCols[i];
|
28992 | availableWidth -= col.getActualWidth();
|
28993 | if (availableWidth < 0) {
|
28994 | break;
|
28995 | }
|
28996 | displayIndex++;
|
28997 | }
|
28998 |
|
28999 | if (draggingRight) {
|
29000 | displayIndex++;
|
29001 | }
|
29002 | }
|
29003 |
|
29004 |
|
29005 | var firstValidMove;
|
29006 | if (displayIndex > 0) {
|
29007 | var leftColumn = otherDisplayedCols[displayIndex - 1];
|
29008 | firstValidMove = otherGridCols.indexOf(leftColumn) + 1;
|
29009 | }
|
29010 | else {
|
29011 | firstValidMove = otherGridCols.indexOf(otherDisplayedCols[0]);
|
29012 | if (firstValidMove === -1) {
|
29013 | firstValidMove = 0;
|
29014 | }
|
29015 | }
|
29016 | var validMoves = [firstValidMove];
|
29017 | var numberComparator = function (a, b) { return a - b; };
|
29018 |
|
29019 |
|
29020 |
|
29021 |
|
29022 |
|
29023 |
|
29024 |
|
29025 |
|
29026 |
|
29027 |
|
29028 | if (draggingRight) {
|
29029 |
|
29030 |
|
29031 | var pointer = firstValidMove + 1;
|
29032 | var lastIndex = allGridCols.length - 1;
|
29033 | while (pointer <= lastIndex) {
|
29034 | validMoves.push(pointer);
|
29035 | pointer++;
|
29036 | }
|
29037 |
|
29038 | validMoves.sort(numberComparator);
|
29039 | }
|
29040 | else {
|
29041 |
|
29042 |
|
29043 |
|
29044 |
|
29045 |
|
29046 | var pointer = firstValidMove;
|
29047 | var lastIndex = allGridCols.length - 1;
|
29048 | var displacedCol = allGridCols[pointer];
|
29049 | while (pointer <= lastIndex && this.isColumnHidden(allDisplayedCols, displacedCol)) {
|
29050 | pointer++;
|
29051 | validMoves.push(pointer);
|
29052 | displacedCol = allGridCols[pointer];
|
29053 | }
|
29054 |
|
29055 | pointer = firstValidMove - 1;
|
29056 | var firstDisplayIndex = 0;
|
29057 | while (pointer >= firstDisplayIndex) {
|
29058 | validMoves.push(pointer);
|
29059 | pointer--;
|
29060 | }
|
29061 |
|
29062 | validMoves.sort(numberComparator).reverse();
|
29063 | }
|
29064 | return validMoves;
|
29065 | };
|
29066 |
|
29067 | MoveColumnFeature.prototype.isColumnHidden = function (displayedColumns, col) {
|
29068 | return displayedColumns.indexOf(col) < 0;
|
29069 | };
|
29070 | MoveColumnFeature.prototype.ensureIntervalStarted = function () {
|
29071 | if (!this.movingIntervalId) {
|
29072 | this.intervalCount = 0;
|
29073 | this.failedMoveAttempts = 0;
|
29074 | this.movingIntervalId = window.setInterval(this.moveInterval.bind(this), 100);
|
29075 | if (this.needToMoveLeft) {
|
29076 | this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_LEFT, true);
|
29077 | }
|
29078 | else {
|
29079 | this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_RIGHT, true);
|
29080 | }
|
29081 | }
|
29082 | };
|
29083 | MoveColumnFeature.prototype.ensureIntervalCleared = function () {
|
29084 | if (this.movingIntervalId) {
|
29085 | window.clearInterval(this.movingIntervalId);
|
29086 | this.movingIntervalId = null;
|
29087 | this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_MOVE);
|
29088 | }
|
29089 | };
|
29090 | MoveColumnFeature.prototype.moveInterval = function () {
|
29091 |
|
29092 |
|
29093 | var pixelsToMove;
|
29094 | this.intervalCount++;
|
29095 | pixelsToMove = 10 + (this.intervalCount * 5);
|
29096 | if (pixelsToMove > 100) {
|
29097 | pixelsToMove = 100;
|
29098 | }
|
29099 | var pixelsMoved = null;
|
29100 | var scrollFeature = this.gridBodyCon.getScrollFeature();
|
29101 | if (this.needToMoveLeft) {
|
29102 | pixelsMoved = scrollFeature.scrollHorizontally(-pixelsToMove);
|
29103 | }
|
29104 | else if (this.needToMoveRight) {
|
29105 | pixelsMoved = scrollFeature.scrollHorizontally(pixelsToMove);
|
29106 | }
|
29107 | if (pixelsMoved !== 0) {
|
29108 | this.onDragging(this.lastDraggingEvent);
|
29109 | this.failedMoveAttempts = 0;
|
29110 | }
|
29111 | else {
|
29112 |
|
29113 |
|
29114 | this.failedMoveAttempts++;
|
29115 | var columns = this.lastDraggingEvent.dragItem.columns;
|
29116 | var columnsThatCanPin = columns.filter(function (c) { return !c.getColDef().lockPinned; });
|
29117 | if (columnsThatCanPin.length > 0) {
|
29118 | this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_PINNED);
|
29119 | if (this.failedMoveAttempts > 7) {
|
29120 | var pinType = this.needToMoveLeft ? Constants.PINNED_LEFT : Constants.PINNED_RIGHT;
|
29121 | this.setColumnsPinned(columnsThatCanPin, pinType, "uiColumnDragged");
|
29122 | this.dragAndDropService.nudge();
|
29123 | }
|
29124 | }
|
29125 | }
|
29126 | };
|
29127 | __decorate$12([
|
29128 | Autowired('columnModel')
|
29129 | ], MoveColumnFeature.prototype, "columnModel", void 0);
|
29130 | __decorate$12([
|
29131 | Autowired('dragAndDropService')
|
29132 | ], MoveColumnFeature.prototype, "dragAndDropService", void 0);
|
29133 | __decorate$12([
|
29134 | Autowired('gridOptionsWrapper')
|
29135 | ], MoveColumnFeature.prototype, "gridOptionsWrapper", void 0);
|
29136 | __decorate$12([
|
29137 | Autowired('ctrlsService')
|
29138 | ], MoveColumnFeature.prototype, "ctrlsService", void 0);
|
29139 | __decorate$12([
|
29140 | PostConstruct
|
29141 | ], MoveColumnFeature.prototype, "init", null);
|
29142 | return MoveColumnFeature;
|
29143 | }());
|
29144 |
|
29145 |
|
29146 |
|
29147 |
|
29148 |
|
29149 |
|
29150 |
|
29151 | var __extends$1g = (undefined && undefined.__extends) || (function () {
|
29152 | var extendStatics = function (d, b) {
|
29153 | extendStatics = Object.setPrototypeOf ||
|
29154 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
29155 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
29156 | return extendStatics(d, b);
|
29157 | };
|
29158 | return function (d, b) {
|
29159 | extendStatics(d, b);
|
29160 | function __() { this.constructor = d; }
|
29161 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29162 | };
|
29163 | })();
|
29164 | var __decorate$13 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
29165 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
29166 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
29167 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
29168 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
29169 | };
|
29170 | var BodyDropTarget = (function (_super) {
|
29171 | __extends$1g(BodyDropTarget, _super);
|
29172 | function BodyDropTarget(pinned, eContainer) {
|
29173 | var _this = _super.call(this) || this;
|
29174 | _this.pinned = pinned;
|
29175 | _this.eContainer = eContainer;
|
29176 | return _this;
|
29177 | }
|
29178 | BodyDropTarget.prototype.postConstruct = function () {
|
29179 | var _this = this;
|
29180 | this.ctrlsService.whenReady(function (p) {
|
29181 | switch (_this.pinned) {
|
29182 | case Constants.PINNED_LEFT:
|
29183 | _this.eSecondaryContainers = [
|
29184 | [p.gridBodyCtrl.getBodyViewportElement(), p.leftRowContainerCtrl.getContainerElement()],
|
29185 | [p.bottomLeftRowContainerCtrl.getContainerElement()],
|
29186 | [p.topLeftRowContainerCtrl.getContainerElement()]
|
29187 | ];
|
29188 | break;
|
29189 | case Constants.PINNED_RIGHT:
|
29190 | _this.eSecondaryContainers = [
|
29191 | [p.gridBodyCtrl.getBodyViewportElement(), p.rightRowContainerCtrl.getContainerElement()],
|
29192 | [p.bottomRightRowContainerCtrl.getContainerElement()],
|
29193 | [p.topRightRowContainerCtrl.getContainerElement()]
|
29194 | ];
|
29195 | break;
|
29196 | default:
|
29197 | _this.eSecondaryContainers = [
|
29198 | [p.gridBodyCtrl.getBodyViewportElement(), p.centerRowContainerCtrl.getViewportElement()],
|
29199 | [p.bottomCenterRowContainerCtrl.getViewportElement()],
|
29200 | [p.topCenterRowContainerCtrl.getViewportElement()]
|
29201 | ];
|
29202 | break;
|
29203 | }
|
29204 | });
|
29205 | };
|
29206 | BodyDropTarget.prototype.isInterestedIn = function (type) {
|
29207 | return type === DragSourceType.HeaderCell ||
|
29208 | (type === DragSourceType.ToolPanel && this.gridOptionsWrapper.isAllowDragFromColumnsToolPanel());
|
29209 | };
|
29210 | BodyDropTarget.prototype.getSecondaryContainers = function () {
|
29211 | return this.eSecondaryContainers;
|
29212 | };
|
29213 | BodyDropTarget.prototype.getContainer = function () {
|
29214 | return this.eContainer;
|
29215 | };
|
29216 | BodyDropTarget.prototype.init = function () {
|
29217 | this.moveColumnFeature = this.createManagedBean(new MoveColumnFeature(this.pinned, this.eContainer));
|
29218 | this.bodyDropPivotTarget = this.createManagedBean(new BodyDropPivotTarget(this.pinned));
|
29219 | this.dragAndDropService.addDropTarget(this);
|
29220 | };
|
29221 | BodyDropTarget.prototype.getIconName = function () {
|
29222 | return this.currentDropListener.getIconName();
|
29223 | };
|
29224 |
|
29225 |
|
29226 |
|
29227 | BodyDropTarget.prototype.isDropColumnInPivotMode = function (draggingEvent) {
|
29228 |
|
29229 |
|
29230 |
|
29231 | return this.columnModel.isPivotMode() && draggingEvent.dragSource.type === DragSourceType.ToolPanel;
|
29232 | };
|
29233 | BodyDropTarget.prototype.onDragEnter = function (draggingEvent) {
|
29234 |
|
29235 |
|
29236 |
|
29237 | this.currentDropListener = this.isDropColumnInPivotMode(draggingEvent) ? this.bodyDropPivotTarget : this.moveColumnFeature;
|
29238 | this.currentDropListener.onDragEnter(draggingEvent);
|
29239 | };
|
29240 | BodyDropTarget.prototype.onDragLeave = function (params) {
|
29241 | this.currentDropListener.onDragLeave(params);
|
29242 | };
|
29243 | BodyDropTarget.prototype.onDragging = function (params) {
|
29244 | this.currentDropListener.onDragging(params);
|
29245 | };
|
29246 | BodyDropTarget.prototype.onDragStop = function (params) {
|
29247 | this.currentDropListener.onDragStop(params);
|
29248 | };
|
29249 | __decorate$13([
|
29250 | Autowired('dragAndDropService')
|
29251 | ], BodyDropTarget.prototype, "dragAndDropService", void 0);
|
29252 | __decorate$13([
|
29253 | Autowired('columnModel')
|
29254 | ], BodyDropTarget.prototype, "columnModel", void 0);
|
29255 | __decorate$13([
|
29256 | Autowired('ctrlsService')
|
29257 | ], BodyDropTarget.prototype, "ctrlsService", void 0);
|
29258 | __decorate$13([
|
29259 | PostConstruct
|
29260 | ], BodyDropTarget.prototype, "postConstruct", null);
|
29261 | __decorate$13([
|
29262 | PostConstruct
|
29263 | ], BodyDropTarget.prototype, "init", null);
|
29264 | return BodyDropTarget;
|
29265 | }(BeanStub));
|
29266 |
|
29267 |
|
29268 |
|
29269 |
|
29270 |
|
29271 |
|
29272 |
|
29273 | var __read$b = (undefined && undefined.__read) || function (o, n) {
|
29274 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
29275 | if (!m) return o;
|
29276 | var i = m.call(o), r, ar = [], e;
|
29277 | try {
|
29278 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
29279 | }
|
29280 | catch (error) { e = { error: error }; }
|
29281 | finally {
|
29282 | try {
|
29283 | if (r && !r.done && (m = i["return"])) m.call(i);
|
29284 | }
|
29285 | finally { if (e) throw e.error; }
|
29286 | }
|
29287 | return ar;
|
29288 | };
|
29289 | var __spread$8 = (undefined && undefined.__spread) || function () {
|
29290 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$b(arguments[i]));
|
29291 | return ar;
|
29292 | };
|
29293 | var CssClassApplier = (function () {
|
29294 | function CssClassApplier() {
|
29295 | }
|
29296 | CssClassApplier.getHeaderClassesFromColDef = function (abstractColDef, gridOptionsWrapper, column, columnGroup) {
|
29297 | if (missing(abstractColDef)) {
|
29298 | return [];
|
29299 | }
|
29300 | return this.getColumnClassesFromCollDef(abstractColDef.headerClass, abstractColDef, gridOptionsWrapper, column, columnGroup);
|
29301 | };
|
29302 | CssClassApplier.getToolPanelClassesFromColDef = function (abstractColDef, gridOptionsWrapper, column, columnGroup) {
|
29303 | if (missing(abstractColDef)) {
|
29304 | return [];
|
29305 | }
|
29306 | return this.getColumnClassesFromCollDef(abstractColDef.toolPanelClass, abstractColDef, gridOptionsWrapper, column, columnGroup);
|
29307 | };
|
29308 | CssClassApplier.getClassParams = function (abstractColDef, gridOptionsWrapper, column, columnGroup) {
|
29309 | return {
|
29310 |
|
29311 |
|
29312 |
|
29313 | colDef: abstractColDef,
|
29314 | column: column,
|
29315 | columnGroup: columnGroup,
|
29316 | api: gridOptionsWrapper.getApi(),
|
29317 | columnApi: gridOptionsWrapper.getColumnApi(),
|
29318 | context: gridOptionsWrapper.getContext()
|
29319 | };
|
29320 | };
|
29321 | CssClassApplier.getColumnClassesFromCollDef = function (classesOrFunc, abstractColDef, gridOptionsWrapper, column, columnGroup) {
|
29322 | if (missing(classesOrFunc)) {
|
29323 | return [];
|
29324 | }
|
29325 | var classToUse;
|
29326 | if (typeof classesOrFunc === 'function') {
|
29327 | var params = this.getClassParams(abstractColDef, gridOptionsWrapper, column, columnGroup);
|
29328 | classToUse = classesOrFunc(params);
|
29329 | }
|
29330 | else {
|
29331 | classToUse = classesOrFunc;
|
29332 | }
|
29333 | if (typeof classToUse === 'string') {
|
29334 | return [classToUse];
|
29335 | }
|
29336 | if (Array.isArray(classToUse)) {
|
29337 | return __spread$8(classToUse);
|
29338 | }
|
29339 | return [];
|
29340 | };
|
29341 | return CssClassApplier;
|
29342 | }());
|
29343 |
|
29344 |
|
29345 |
|
29346 |
|
29347 |
|
29348 |
|
29349 |
|
29350 | var __extends$1h = (undefined && undefined.__extends) || (function () {
|
29351 | var extendStatics = function (d, b) {
|
29352 | extendStatics = Object.setPrototypeOf ||
|
29353 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
29354 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
29355 | return extendStatics(d, b);
|
29356 | };
|
29357 | return function (d, b) {
|
29358 | extendStatics(d, b);
|
29359 | function __() { this.constructor = d; }
|
29360 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29361 | };
|
29362 | })();
|
29363 | var __decorate$14 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
29364 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
29365 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
29366 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
29367 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
29368 | };
|
29369 | var HeaderCellComp = (function (_super) {
|
29370 | __extends$1h(HeaderCellComp, _super);
|
29371 | function HeaderCellComp(ctrl) {
|
29372 | var _this = _super.call(this, HeaderCellComp.TEMPLATE, ctrl) || this;
|
29373 | _this.headerCompVersion = 0;
|
29374 | _this.column = ctrl.getColumnGroupChild();
|
29375 | _this.pinned = ctrl.getPinned();
|
29376 | return _this;
|
29377 | }
|
29378 | HeaderCellComp.prototype.postConstruct = function () {
|
29379 | var _this = this;
|
29380 | var eGui = this.getGui();
|
29381 | var setAttribute = function (name, value, element) {
|
29382 | var actualElement = element ? element : eGui;
|
29383 | if (value != null && value != '') {
|
29384 | actualElement.setAttribute(name, value);
|
29385 | }
|
29386 | else {
|
29387 | actualElement.removeAttribute(name);
|
29388 | }
|
29389 | };
|
29390 | var compProxy = {
|
29391 | setWidth: function (width) { return eGui.style.width = width; },
|
29392 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
29393 | setColId: function (id) { return setAttribute('col-id', id); },
|
29394 | setTitle: function (title) { return setAttribute('title', title); },
|
29395 | setAriaDescription: function (label) { return setAriaDescription(eGui, label); },
|
29396 | setAriaSort: function (sort) { return sort ? setAriaSort(eGui, sort) : removeAriaSort(eGui); },
|
29397 | setUserCompDetails: function (compDetails) { return _this.setUserCompDetails(compDetails); },
|
29398 | getUserCompInstance: function () { return _this.headerComp; }
|
29399 | };
|
29400 | this.ctrl.setComp(compProxy, this.getGui(), this.eResize);
|
29401 | var selectAllGui = this.ctrl.getSelectAllGui();
|
29402 | this.eResize.insertAdjacentElement('afterend', selectAllGui);
|
29403 | };
|
29404 | HeaderCellComp.prototype.destroyHeaderComp = function () {
|
29405 | if (this.headerComp) {
|
29406 | this.getGui().removeChild(this.headerCompGui);
|
29407 | this.headerComp = this.destroyBean(this.headerComp);
|
29408 | this.headerCompGui = undefined;
|
29409 | }
|
29410 | };
|
29411 | HeaderCellComp.prototype.setUserCompDetails = function (compDetails) {
|
29412 | var _this = this;
|
29413 | this.headerCompVersion++;
|
29414 | var versionCopy = this.headerCompVersion;
|
29415 | compDetails.newAgStackInstance().then(function (comp) { return _this.afterCompCreated(versionCopy, comp); });
|
29416 | };
|
29417 | HeaderCellComp.prototype.afterCompCreated = function (version, headerComp) {
|
29418 | if (version != this.headerCompVersion || !this.isAlive()) {
|
29419 | this.destroyBean(headerComp);
|
29420 | return;
|
29421 | }
|
29422 | this.destroyHeaderComp();
|
29423 | this.headerComp = headerComp;
|
29424 | this.headerCompGui = headerComp.getGui();
|
29425 | this.getGui().appendChild(this.headerCompGui);
|
29426 | this.ctrl.setDragSource(this.headerCompGui);
|
29427 | };
|
29428 | 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>";
|
29429 | __decorate$14([
|
29430 | RefSelector('eResize')
|
29431 | ], HeaderCellComp.prototype, "eResize", void 0);
|
29432 | __decorate$14([
|
29433 | PostConstruct
|
29434 | ], HeaderCellComp.prototype, "postConstruct", null);
|
29435 | __decorate$14([
|
29436 | PreDestroy
|
29437 | ], HeaderCellComp.prototype, "destroyHeaderComp", null);
|
29438 | return HeaderCellComp;
|
29439 | }(AbstractHeaderCellComp));
|
29440 |
|
29441 |
|
29442 |
|
29443 |
|
29444 |
|
29445 |
|
29446 |
|
29447 | var __extends$1i = (undefined && undefined.__extends) || (function () {
|
29448 | var extendStatics = function (d, b) {
|
29449 | extendStatics = Object.setPrototypeOf ||
|
29450 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
29451 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
29452 | return extendStatics(d, b);
|
29453 | };
|
29454 | return function (d, b) {
|
29455 | extendStatics(d, b);
|
29456 | function __() { this.constructor = d; }
|
29457 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29458 | };
|
29459 | })();
|
29460 | var __decorate$15 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
29461 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
29462 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
29463 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
29464 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
29465 | };
|
29466 | var HeaderGroupCellComp = (function (_super) {
|
29467 | __extends$1i(HeaderGroupCellComp, _super);
|
29468 | function HeaderGroupCellComp(ctrl) {
|
29469 | return _super.call(this, HeaderGroupCellComp.TEMPLATE, ctrl) || this;
|
29470 | }
|
29471 | HeaderGroupCellComp.prototype.postConstruct = function () {
|
29472 | var _this = this;
|
29473 | var eGui = this.getGui();
|
29474 | var setAttribute = function (key, value) {
|
29475 | return value != undefined ? eGui.setAttribute(key, value) : eGui.removeAttribute(key);
|
29476 | };
|
29477 | var compProxy = {
|
29478 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
29479 | addOrRemoveResizableCssClass: function (cssClassName, on) { return _this.eResize.classList.toggle(cssClassName, on); },
|
29480 | setWidth: function (width) { return eGui.style.width = width; },
|
29481 | setColId: function (id) { return eGui.setAttribute("col-id", id); },
|
29482 | setAriaExpanded: function (expanded) { return setAttribute('aria-expanded', expanded); },
|
29483 | setTitle: function (title) { return setAttribute("title", title); },
|
29484 | setUserCompDetails: function (details) { return _this.setUserCompDetails(details); }
|
29485 | };
|
29486 | this.ctrl.setComp(compProxy, eGui, this.eResize);
|
29487 | };
|
29488 | HeaderGroupCellComp.prototype.setUserCompDetails = function (details) {
|
29489 | var _this = this;
|
29490 | details.newAgStackInstance().then(function (comp) { return _this.afterHeaderCompCreated(comp); });
|
29491 | };
|
29492 | HeaderGroupCellComp.prototype.afterHeaderCompCreated = function (headerGroupComp) {
|
29493 | var _this = this;
|
29494 | var destroyFunc = function () { return _this.destroyBean(headerGroupComp); };
|
29495 | if (!this.isAlive()) {
|
29496 | destroyFunc();
|
29497 | return;
|
29498 | }
|
29499 | this.getGui().appendChild(headerGroupComp.getGui());
|
29500 | this.addDestroyFunc(destroyFunc);
|
29501 | this.ctrl.setDragSource(headerGroupComp.getGui());
|
29502 | };
|
29503 | 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>";
|
29504 | __decorate$15([
|
29505 | Autowired('userComponentFactory')
|
29506 | ], HeaderGroupCellComp.prototype, "userComponentFactory", void 0);
|
29507 | __decorate$15([
|
29508 | RefSelector('eResize')
|
29509 | ], HeaderGroupCellComp.prototype, "eResize", void 0);
|
29510 | __decorate$15([
|
29511 | PostConstruct
|
29512 | ], HeaderGroupCellComp.prototype, "postConstruct", null);
|
29513 | return HeaderGroupCellComp;
|
29514 | }(AbstractHeaderCellComp));
|
29515 |
|
29516 |
|
29517 |
|
29518 |
|
29519 |
|
29520 |
|
29521 |
|
29522 | var __extends$1j = (undefined && undefined.__extends) || (function () {
|
29523 | var extendStatics = function (d, b) {
|
29524 | extendStatics = Object.setPrototypeOf ||
|
29525 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
29526 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
29527 | return extendStatics(d, b);
|
29528 | };
|
29529 | return function (d, b) {
|
29530 | extendStatics(d, b);
|
29531 | function __() { this.constructor = d; }
|
29532 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29533 | };
|
29534 | })();
|
29535 | var __decorate$16 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
29536 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
29537 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
29538 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
29539 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
29540 | };
|
29541 | var HeaderRowType;
|
29542 | (function (HeaderRowType) {
|
29543 | HeaderRowType["COLUMN_GROUP"] = "group";
|
29544 | HeaderRowType["COLUMN"] = "column";
|
29545 | HeaderRowType["FLOATING_FILTER"] = "filter";
|
29546 | })(HeaderRowType || (HeaderRowType = {}));
|
29547 | var HeaderRowComp = (function (_super) {
|
29548 | __extends$1j(HeaderRowComp, _super);
|
29549 | function HeaderRowComp(ctrl) {
|
29550 | var _this = _super.call(this) || this;
|
29551 | _this.headerComps = {};
|
29552 | var extraClass = ctrl.getType() == HeaderRowType.COLUMN_GROUP ? "ag-header-row-column-group" :
|
29553 | ctrl.getType() == HeaderRowType.FLOATING_FILTER ? "ag-header-row-column-filter" : "ag-header-row-column";
|
29554 | _this.setTemplate( "<div class=\"ag-header-row " + extraClass + "\" role=\"row\"></div>");
|
29555 | _this.ctrl = ctrl;
|
29556 | return _this;
|
29557 | }
|
29558 |
|
29559 | HeaderRowComp.prototype.init = function () {
|
29560 | var _this = this;
|
29561 | var compProxy = {
|
29562 | setTransform: function (transform) { return _this.getGui().style.transform = transform; },
|
29563 | setHeight: function (height) { return _this.getGui().style.height = height; },
|
29564 | setTop: function (top) { return _this.getGui().style.top = top; },
|
29565 | setHeaderCtrls: function (ctrls) { return _this.setHeaderCtrls(ctrls); },
|
29566 | setWidth: function (width) { return _this.getGui().style.width = width; },
|
29567 | setAriaRowIndex: function (rowIndex) { return setAriaRowIndex(_this.getGui(), rowIndex); }
|
29568 | };
|
29569 | this.ctrl.setComp(compProxy);
|
29570 | };
|
29571 | HeaderRowComp.prototype.destroyHeaderCtrls = function () {
|
29572 | this.setHeaderCtrls([]);
|
29573 | };
|
29574 | HeaderRowComp.prototype.setHeaderCtrls = function (ctrls) {
|
29575 | var _this = this;
|
29576 | if (!this.isAlive()) {
|
29577 | return;
|
29578 | }
|
29579 | var oldComps = this.headerComps;
|
29580 | this.headerComps = {};
|
29581 | ctrls.forEach(function (ctrl) {
|
29582 | var id = ctrl.getInstanceId();
|
29583 | var comp = oldComps[id];
|
29584 | delete oldComps[id];
|
29585 | if (comp == null) {
|
29586 | comp = _this.createHeaderComp(ctrl);
|
29587 | _this.getGui().appendChild(comp.getGui());
|
29588 | }
|
29589 | _this.headerComps[id] = comp;
|
29590 | });
|
29591 | iterateObject(oldComps, function (id, comp) {
|
29592 | _this.getGui().removeChild(comp.getGui());
|
29593 | _this.destroyBean(comp);
|
29594 | });
|
29595 | var ensureDomOrder = this.gridOptionsWrapper.isEnsureDomOrder();
|
29596 | if (ensureDomOrder) {
|
29597 | var comps = getAllValuesInObject(this.headerComps);
|
29598 |
|
29599 | comps.sort(function (a, b) {
|
29600 | var leftA = a.getCtrl().getColumnGroupChild().getLeft();
|
29601 | var leftB = b.getCtrl().getColumnGroupChild().getLeft();
|
29602 | return leftA - leftB;
|
29603 | });
|
29604 | var elementsInOrder = comps.map(function (c) { return c.getGui(); });
|
29605 | setDomChildOrder(this.getGui(), elementsInOrder);
|
29606 | }
|
29607 | };
|
29608 | HeaderRowComp.prototype.createHeaderComp = function (headerCtrl) {
|
29609 | var result;
|
29610 | switch (this.ctrl.getType()) {
|
29611 | case HeaderRowType.COLUMN_GROUP:
|
29612 | result = new HeaderGroupCellComp(headerCtrl);
|
29613 | break;
|
29614 | case HeaderRowType.FLOATING_FILTER:
|
29615 | result = new HeaderFilterCellComp(headerCtrl);
|
29616 | break;
|
29617 | default:
|
29618 | result = new HeaderCellComp(headerCtrl);
|
29619 | break;
|
29620 | }
|
29621 | this.createBean(result);
|
29622 | result.setParentComponent(this);
|
29623 | return result;
|
29624 | };
|
29625 | __decorate$16([
|
29626 | PostConstruct
|
29627 | ], HeaderRowComp.prototype, "init", null);
|
29628 | __decorate$16([
|
29629 | PreDestroy
|
29630 | ], HeaderRowComp.prototype, "destroyHeaderCtrls", null);
|
29631 | return HeaderRowComp;
|
29632 | }(Component));
|
29633 |
|
29634 |
|
29635 |
|
29636 |
|
29637 |
|
29638 |
|
29639 |
|
29640 | var __extends$1k = (undefined && undefined.__extends) || (function () {
|
29641 | var extendStatics = function (d, b) {
|
29642 | extendStatics = Object.setPrototypeOf ||
|
29643 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
29644 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
29645 | return extendStatics(d, b);
|
29646 | };
|
29647 | return function (d, b) {
|
29648 | extendStatics(d, b);
|
29649 | function __() { this.constructor = d; }
|
29650 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29651 | };
|
29652 | })();
|
29653 | var __decorate$17 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
29654 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
29655 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
29656 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
29657 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
29658 | };
|
29659 | var instanceIdSequence$3 = 0;
|
29660 | var AbstractHeaderCellCtrl = (function (_super) {
|
29661 | __extends$1k(AbstractHeaderCellCtrl, _super);
|
29662 | function AbstractHeaderCellCtrl(columnGroupChild, parentRowCtrl) {
|
29663 | var _this = _super.call(this) || this;
|
29664 | _this.lastFocusEvent = null;
|
29665 | _this.columnGroupChild = columnGroupChild;
|
29666 | _this.parentRowCtrl = parentRowCtrl;
|
29667 |
|
29668 | _this.instanceId = columnGroupChild.getUniqueId() + '-' + instanceIdSequence$3++;
|
29669 | return _this;
|
29670 | }
|
29671 | AbstractHeaderCellCtrl.prototype.shouldStopEventPropagation = function (e) {
|
29672 | var _a = this.focusService.getFocusedHeader(), headerRowIndex = _a.headerRowIndex, column = _a.column;
|
29673 | return isUserSuppressingHeaderKeyboardEvent(this.gridOptionsWrapper, e, headerRowIndex, column);
|
29674 | };
|
29675 | AbstractHeaderCellCtrl.prototype.setGui = function (eGui) {
|
29676 | this.eGui = eGui;
|
29677 | this.addDomData();
|
29678 | };
|
29679 | AbstractHeaderCellCtrl.prototype.addDomData = function () {
|
29680 | var _this = this;
|
29681 | var key = AbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL;
|
29682 | this.gridOptionsWrapper.setDomData(this.eGui, key, this);
|
29683 | this.addDestroyFunc(function () { return _this.gridOptionsWrapper.setDomData(_this.eGui, key, null); });
|
29684 | };
|
29685 | AbstractHeaderCellCtrl.prototype.getGui = function () {
|
29686 | return this.eGui;
|
29687 | };
|
29688 | AbstractHeaderCellCtrl.prototype.focus = function (event) {
|
29689 | if (!this.eGui) {
|
29690 | return false;
|
29691 | }
|
29692 | this.lastFocusEvent = event || null;
|
29693 | this.eGui.focus();
|
29694 | return true;
|
29695 | };
|
29696 | AbstractHeaderCellCtrl.prototype.getRowIndex = function () {
|
29697 | return this.parentRowCtrl.getRowIndex();
|
29698 | };
|
29699 | AbstractHeaderCellCtrl.prototype.getParentRowCtrl = function () {
|
29700 | return this.parentRowCtrl;
|
29701 | };
|
29702 | AbstractHeaderCellCtrl.prototype.getPinned = function () {
|
29703 | return this.parentRowCtrl.getPinned();
|
29704 | };
|
29705 | AbstractHeaderCellCtrl.prototype.getInstanceId = function () {
|
29706 | return this.instanceId;
|
29707 | };
|
29708 | AbstractHeaderCellCtrl.prototype.getColumnGroupChild = function () {
|
29709 | return this.columnGroupChild;
|
29710 | };
|
29711 | AbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL = 'headerCtrl';
|
29712 | __decorate$17([
|
29713 | Autowired('focusService')
|
29714 | ], AbstractHeaderCellCtrl.prototype, "focusService", void 0);
|
29715 | return AbstractHeaderCellCtrl;
|
29716 | }(BeanStub));
|
29717 |
|
29718 |
|
29719 |
|
29720 |
|
29721 |
|
29722 |
|
29723 |
|
29724 | var ClientSideRowModelSteps;
|
29725 | (function (ClientSideRowModelSteps) {
|
29726 | ClientSideRowModelSteps["EVERYTHING"] = "group";
|
29727 | ClientSideRowModelSteps["FILTER"] = "filter";
|
29728 | ClientSideRowModelSteps["SORT"] = "sort";
|
29729 | ClientSideRowModelSteps["MAP"] = "map";
|
29730 | ClientSideRowModelSteps["AGGREGATE"] = "aggregate";
|
29731 | ClientSideRowModelSteps["FILTER_AGGREGATES"] = "filter_aggregates";
|
29732 | ClientSideRowModelSteps["PIVOT"] = "pivot";
|
29733 | ClientSideRowModelSteps["NOTHING"] = "nothing";
|
29734 | })(ClientSideRowModelSteps || (ClientSideRowModelSteps = {}));
|
29735 |
|
29736 |
|
29737 |
|
29738 |
|
29739 |
|
29740 |
|
29741 |
|
29742 | var __decorate$18 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
29743 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
29744 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
29745 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
29746 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
29747 | };
|
29748 | function unwrapUserComp(comp) {
|
29749 | var compAsAny = comp;
|
29750 | var isProxy = compAsAny != null && compAsAny.getFrameworkComponentInstance != null;
|
29751 | return isProxy ? compAsAny.getFrameworkComponentInstance() : comp;
|
29752 | }
|
29753 | var GridApi = (function () {
|
29754 | function GridApi() {
|
29755 | this.detailGridInfoMap = {};
|
29756 | this.destroyCalled = false;
|
29757 | }
|
29758 | GridApi.prototype.registerOverlayWrapperComp = function (overlayWrapperComp) {
|
29759 | this.overlayWrapperComp = overlayWrapperComp;
|
29760 | };
|
29761 | GridApi.prototype.registerSideBarComp = function (sideBarComp) {
|
29762 | this.sideBarComp = sideBarComp;
|
29763 | };
|
29764 | GridApi.prototype.init = function () {
|
29765 | var _this = this;
|
29766 | switch (this.rowModel.getType()) {
|
29767 | case Constants.ROW_MODEL_TYPE_CLIENT_SIDE:
|
29768 | this.clientSideRowModel = this.rowModel;
|
29769 | break;
|
29770 | case Constants.ROW_MODEL_TYPE_INFINITE:
|
29771 | this.infiniteRowModel = this.rowModel;
|
29772 | break;
|
29773 | case Constants.ROW_MODEL_TYPE_SERVER_SIDE:
|
29774 | this.serverSideRowModel = this.rowModel;
|
29775 | break;
|
29776 | }
|
29777 | this.ctrlsService.whenReady(function () {
|
29778 | _this.gridBodyCtrl = _this.ctrlsService.getGridBodyCtrl();
|
29779 | });
|
29780 | };
|
29781 |
|
29782 | GridApi.prototype.__getAlignedGridService = function () {
|
29783 | return this.alignedGridsService;
|
29784 | };
|
29785 |
|
29786 | GridApi.prototype.__getContext = function () {
|
29787 | return this.context;
|
29788 | };
|
29789 |
|
29790 | GridApi.prototype.addDetailGridInfo = function (id, gridInfo) {
|
29791 | this.detailGridInfoMap[id] = gridInfo;
|
29792 | };
|
29793 |
|
29794 | GridApi.prototype.removeDetailGridInfo = function (id) {
|
29795 | this.detailGridInfoMap[id] = undefined;
|
29796 | };
|
29797 |
|
29798 | GridApi.prototype.getDetailGridInfo = function (id) {
|
29799 | return this.detailGridInfoMap[id];
|
29800 | };
|
29801 |
|
29802 | GridApi.prototype.forEachDetailGridInfo = function (callback) {
|
29803 | var index = 0;
|
29804 | iterateObject(this.detailGridInfoMap, function (id, gridInfo) {
|
29805 |
|
29806 | if (exists(gridInfo)) {
|
29807 | callback(gridInfo, index);
|
29808 | index++;
|
29809 | }
|
29810 | });
|
29811 | };
|
29812 |
|
29813 | GridApi.prototype.getDataAsCsv = function (params) {
|
29814 | if (ModuleRegistry.assertRegistered(ModuleNames.CsvExportModule, 'api.getDataAsCsv')) {
|
29815 | return this.csvCreator.getDataAsCsv(params);
|
29816 | }
|
29817 | };
|
29818 |
|
29819 | GridApi.prototype.exportDataAsCsv = function (params) {
|
29820 | if (ModuleRegistry.assertRegistered(ModuleNames.CsvExportModule, 'api.exportDataAsCSv')) {
|
29821 | this.csvCreator.exportDataAsCsv(params);
|
29822 | }
|
29823 | };
|
29824 | GridApi.prototype.getExcelExportMode = function (params) {
|
29825 | var baseParams = this.gridOptionsWrapper.getDefaultExportParams('excel');
|
29826 | var mergedParams = Object.assign({ exportMode: 'xlsx' }, baseParams, params);
|
29827 | return mergedParams.exportMode;
|
29828 | };
|
29829 |
|
29830 | GridApi.prototype.getDataAsExcel = function (params) {
|
29831 | if (!ModuleRegistry.assertRegistered(ModuleNames.ExcelExportModule, 'api.getDataAsExcel')) {
|
29832 | return;
|
29833 | }
|
29834 | var exportMode = this.getExcelExportMode(params);
|
29835 | if (this.excelCreator.getFactoryMode(exportMode) === ExcelFactoryMode.MULTI_SHEET) {
|
29836 | console.warn('AG Grid: The Excel Exporter is currently on Multi Sheet mode. End that operation by calling `api.getMultipleSheetAsExcel()` or `api.exportMultipleSheetsAsExcel()`');
|
29837 | return;
|
29838 | }
|
29839 | return this.excelCreator.getDataAsExcel(params);
|
29840 | };
|
29841 |
|
29842 | GridApi.prototype.exportDataAsExcel = function (params) {
|
29843 | if (!ModuleRegistry.assertRegistered(ModuleNames.ExcelExportModule, 'api.exportDataAsExcel')) {
|
29844 | return;
|
29845 | }
|
29846 | var exportMode = this.getExcelExportMode(params);
|
29847 | if (this.excelCreator.getFactoryMode(exportMode) === ExcelFactoryMode.MULTI_SHEET) {
|
29848 | console.warn('AG Grid: The Excel Exporter is currently on Multi Sheet mode. End that operation by calling `api.getMultipleSheetAsExcel()` or `api.exportMultipleSheetsAsExcel()`');
|
29849 | return;
|
29850 | }
|
29851 | this.excelCreator.exportDataAsExcel(params);
|
29852 | };
|
29853 |
|
29854 | GridApi.prototype.getSheetDataForExcel = function (params) {
|
29855 | if (!ModuleRegistry.assertRegistered(ModuleNames.ExcelExportModule, 'api.getSheetDataForExcel')) {
|
29856 | return;
|
29857 | }
|
29858 | var exportMode = this.getExcelExportMode(params);
|
29859 | this.excelCreator.setFactoryMode(ExcelFactoryMode.MULTI_SHEET, exportMode);
|
29860 | return this.excelCreator.getSheetDataForExcel(params);
|
29861 | };
|
29862 |
|
29863 | GridApi.prototype.getMultipleSheetsAsExcel = function (params) {
|
29864 | if (ModuleRegistry.assertRegistered(ModuleNames.ExcelExportModule, 'api.getMultipleSheetsAsExcel')) {
|
29865 | return this.excelCreator.getMultipleSheetsAsExcel(params);
|
29866 | }
|
29867 | };
|
29868 |
|
29869 | GridApi.prototype.exportMultipleSheetsAsExcel = function (params) {
|
29870 | if (ModuleRegistry.assertRegistered(ModuleNames.ExcelExportModule, 'api.exportMultipleSheetsAsExcel')) {
|
29871 | return this.excelCreator.exportMultipleSheetsAsExcel(params);
|
29872 | }
|
29873 | };
|
29874 |
|
29875 | GridApi.prototype.setEnterpriseDatasource = function (datasource) {
|
29876 | console.warn("AG Grid: since version 18.x, api.setEnterpriseDatasource() should be replaced with api.setServerSideDatasource()");
|
29877 | this.setServerSideDatasource(datasource);
|
29878 | };
|
29879 | |
29880 |
|
29881 |
|
29882 |
|
29883 |
|
29884 |
|
29885 |
|
29886 | GridApi.prototype.setGridAriaProperty = function (property, value) {
|
29887 | if (!property) {
|
29888 | return;
|
29889 | }
|
29890 | var eGrid = this.ctrlsService.getGridBodyCtrl().getGui();
|
29891 | var ariaProperty = "aria-" + property;
|
29892 | if (value === null) {
|
29893 | eGrid.removeAttribute(ariaProperty);
|
29894 | }
|
29895 | else {
|
29896 | eGrid.setAttribute(ariaProperty, value);
|
29897 | }
|
29898 | };
|
29899 |
|
29900 | GridApi.prototype.setServerSideDatasource = function (datasource) {
|
29901 | if (this.serverSideRowModel) {
|
29902 |
|
29903 | this.serverSideRowModel.setDatasource(datasource);
|
29904 | }
|
29905 | else {
|
29906 | console.warn("AG Grid: you can only use an enterprise datasource when gridOptions.rowModelType is '" + Constants.ROW_MODEL_TYPE_SERVER_SIDE + "'");
|
29907 | }
|
29908 | };
|
29909 |
|
29910 | GridApi.prototype.setDatasource = function (datasource) {
|
29911 | if (this.gridOptionsWrapper.isRowModelInfinite()) {
|
29912 | this.rowModel.setDatasource(datasource);
|
29913 | }
|
29914 | else {
|
29915 | console.warn("AG Grid: you can only use a datasource when gridOptions.rowModelType is '" + Constants.ROW_MODEL_TYPE_INFINITE + "'");
|
29916 | }
|
29917 | };
|
29918 |
|
29919 | GridApi.prototype.setViewportDatasource = function (viewportDatasource) {
|
29920 | if (this.gridOptionsWrapper.isRowModelViewport()) {
|
29921 |
|
29922 |
|
29923 |
|
29924 | this.rowModel.setViewportDatasource(viewportDatasource);
|
29925 | }
|
29926 | else {
|
29927 | console.warn("AG Grid: you can only use a viewport datasource when gridOptions.rowModelType is '" + Constants.ROW_MODEL_TYPE_VIEWPORT + "'");
|
29928 | }
|
29929 | };
|
29930 |
|
29931 | GridApi.prototype.setRowData = function (rowData) {
|
29932 |
|
29933 | var missingImmutableService = this.immutableService == null;
|
29934 | if (missingImmutableService) {
|
29935 | console.warn('AG Grid: you can only set rowData when using the Client Side Row Model');
|
29936 | return;
|
29937 | }
|
29938 |
|
29939 | if (this.immutableService.isActive()) {
|
29940 | this.immutableService.setRowData(rowData);
|
29941 | }
|
29942 | else {
|
29943 | this.selectionService.reset();
|
29944 | this.clientSideRowModel.setRowData(rowData);
|
29945 | }
|
29946 | };
|
29947 |
|
29948 | GridApi.prototype.setFloatingTopRowData = function (rows) {
|
29949 | console.warn('AG Grid: since v12, api.setFloatingTopRowData() is now api.setPinnedTopRowData()');
|
29950 | this.setPinnedTopRowData(rows);
|
29951 | };
|
29952 |
|
29953 | GridApi.prototype.setFloatingBottomRowData = function (rows) {
|
29954 | console.warn('AG Grid: since v12, api.setFloatingBottomRowData() is now api.setPinnedBottomRowData()');
|
29955 | this.setPinnedBottomRowData(rows);
|
29956 | };
|
29957 |
|
29958 | GridApi.prototype.getFloatingTopRowCount = function () {
|
29959 | console.warn('AG Grid: since v12, api.getFloatingTopRowCount() is now api.getPinnedTopRowCount()');
|
29960 | return this.getPinnedTopRowCount();
|
29961 | };
|
29962 |
|
29963 | GridApi.prototype.getFloatingBottomRowCount = function () {
|
29964 | console.warn('AG Grid: since v12, api.getFloatingBottomRowCount() is now api.getPinnedBottomRowCount()');
|
29965 | return this.getPinnedBottomRowCount();
|
29966 | };
|
29967 |
|
29968 | GridApi.prototype.getFloatingTopRow = function (index) {
|
29969 | console.warn('AG Grid: since v12, api.getFloatingTopRow() is now api.getPinnedTopRow()');
|
29970 | return this.getPinnedTopRow(index);
|
29971 | };
|
29972 |
|
29973 | GridApi.prototype.getFloatingBottomRow = function (index) {
|
29974 | console.warn('AG Grid: since v12, api.getFloatingBottomRow() is now api.getPinnedBottomRow()');
|
29975 | return this.getPinnedBottomRow(index);
|
29976 | };
|
29977 |
|
29978 | GridApi.prototype.setPinnedTopRowData = function (rows) {
|
29979 | this.pinnedRowModel.setPinnedTopRowData(rows);
|
29980 | };
|
29981 |
|
29982 | GridApi.prototype.setPinnedBottomRowData = function (rows) {
|
29983 | this.pinnedRowModel.setPinnedBottomRowData(rows);
|
29984 | };
|
29985 |
|
29986 | GridApi.prototype.getPinnedTopRowCount = function () {
|
29987 | return this.pinnedRowModel.getPinnedTopRowCount();
|
29988 | };
|
29989 |
|
29990 | GridApi.prototype.getPinnedBottomRowCount = function () {
|
29991 | return this.pinnedRowModel.getPinnedBottomRowCount();
|
29992 | };
|
29993 |
|
29994 | GridApi.prototype.getPinnedTopRow = function (index) {
|
29995 | return this.pinnedRowModel.getPinnedTopRow(index);
|
29996 | };
|
29997 |
|
29998 | GridApi.prototype.getPinnedBottomRow = function (index) {
|
29999 | return this.pinnedRowModel.getPinnedBottomRow(index);
|
30000 | };
|
30001 | |
30002 |
|
30003 |
|
30004 | GridApi.prototype.setColumnDefs = function (colDefs, source) {
|
30005 | if (source === void 0) { source = "api"; }
|
30006 | this.columnModel.setColumnDefs(colDefs, source);
|
30007 | };
|
30008 |
|
30009 | GridApi.prototype.setAutoGroupColumnDef = function (colDef, source) {
|
30010 | this.gridOptionsWrapper.setProperty('autoGroupColumnDef', colDef, true);
|
30011 | };
|
30012 |
|
30013 | GridApi.prototype.setDefaultColDef = function (colDef, source) {
|
30014 | this.gridOptionsWrapper.setProperty('defaultColDef', colDef, true);
|
30015 | };
|
30016 | GridApi.prototype.expireValueCache = function () {
|
30017 | this.valueCache.expire();
|
30018 | };
|
30019 | |
30020 |
|
30021 |
|
30022 |
|
30023 |
|
30024 | GridApi.prototype.getVerticalPixelRange = function () {
|
30025 | return this.gridBodyCtrl.getScrollFeature().getVScrollPosition();
|
30026 | };
|
30027 | |
30028 |
|
30029 |
|
30030 |
|
30031 |
|
30032 | GridApi.prototype.getHorizontalPixelRange = function () {
|
30033 | return this.gridBodyCtrl.getScrollFeature().getHScrollPosition();
|
30034 | };
|
30035 |
|
30036 | GridApi.prototype.setAlwaysShowHorizontalScroll = function (show) {
|
30037 | this.gridOptionsWrapper.setProperty('alwaysShowHorizontalScroll', show);
|
30038 | };
|
30039 |
|
30040 | GridApi.prototype.setAlwaysShowVerticalScroll = function (show) {
|
30041 | this.gridOptionsWrapper.setProperty('alwaysShowVerticalScroll', show);
|
30042 | };
|
30043 |
|
30044 | GridApi.prototype.refreshToolPanel = function () {
|
30045 | if (!this.sideBarComp) {
|
30046 | return;
|
30047 | }
|
30048 | this.sideBarComp.refresh();
|
30049 | };
|
30050 |
|
30051 | GridApi.prototype.refreshCells = function (params) {
|
30052 | if (params === void 0) { params = {}; }
|
30053 | if (Array.isArray(params)) {
|
30054 |
|
30055 | console.warn('since AG Grid v11.1, refreshCells() now takes parameters, please see the documentation.');
|
30056 | return;
|
30057 | }
|
30058 | this.rowRenderer.refreshCells(params);
|
30059 | };
|
30060 |
|
30061 | GridApi.prototype.flashCells = function (params) {
|
30062 | if (params === void 0) { params = {}; }
|
30063 | this.rowRenderer.flashCells(params);
|
30064 | };
|
30065 |
|
30066 | GridApi.prototype.redrawRows = function (params) {
|
30067 | if (params === void 0) { params = {}; }
|
30068 | var rowNodes = params ? params.rowNodes : undefined;
|
30069 | this.rowRenderer.redrawRows(rowNodes);
|
30070 | };
|
30071 | GridApi.prototype.setFunctionsReadOnly = function (readOnly) {
|
30072 | this.gridOptionsWrapper.setProperty('functionsReadOnly', readOnly);
|
30073 | };
|
30074 |
|
30075 | GridApi.prototype.refreshHeader = function () {
|
30076 | this.ctrlsService.getHeaderRowContainerCtrls().forEach(function (c) { return c.refresh(); });
|
30077 | };
|
30078 |
|
30079 | GridApi.prototype.isAnyFilterPresent = function () {
|
30080 | return this.filterManager.isAnyFilterPresent();
|
30081 | };
|
30082 |
|
30083 | GridApi.prototype.isColumnFilterPresent = function () {
|
30084 | return this.filterManager.isColumnFilterPresent() || this.filterManager.isAggregateFilterPresent();
|
30085 | };
|
30086 |
|
30087 | GridApi.prototype.isQuickFilterPresent = function () {
|
30088 | return this.filterManager.isQuickFilterPresent();
|
30089 | };
|
30090 | |
30091 |
|
30092 |
|
30093 |
|
30094 |
|
30095 | GridApi.prototype.getModel = function () {
|
30096 | return this.rowModel;
|
30097 | };
|
30098 |
|
30099 | GridApi.prototype.setRowNodeExpanded = function (rowNode, expanded) {
|
30100 | if (rowNode) {
|
30101 | rowNode.setExpanded(expanded);
|
30102 | }
|
30103 | };
|
30104 | |
30105 |
|
30106 |
|
30107 |
|
30108 | GridApi.prototype.onGroupExpandedOrCollapsed = function (deprecated_refreshFromIndex) {
|
30109 | if (missing(this.clientSideRowModel)) {
|
30110 | console.warn('AG Grid: cannot call onGroupExpandedOrCollapsed unless using normal row model');
|
30111 | }
|
30112 | if (exists(deprecated_refreshFromIndex)) {
|
30113 | console.warn('AG Grid: api.onGroupExpandedOrCollapsed - refreshFromIndex parameter is no longer used, the grid will refresh all rows');
|
30114 | }
|
30115 |
|
30116 |
|
30117 |
|
30118 |
|
30119 | this.clientSideRowModel.refreshModel({ step: ClientSideRowModelSteps.MAP });
|
30120 | };
|
30121 | GridApi.prototype.refreshInMemoryRowModel = function (step) {
|
30122 | console.warn("ag-grid: since version 18.x, api.refreshInMemoryRowModel() should be replaced with api.refreshClientSideRowModel()");
|
30123 | this.refreshClientSideRowModel(step);
|
30124 | };
|
30125 |
|
30126 | GridApi.prototype.refreshClientSideRowModel = function (step) {
|
30127 | if (missing(this.clientSideRowModel)) {
|
30128 | console.warn('cannot call refreshClientSideRowModel unless using normal row model');
|
30129 | }
|
30130 | var paramsStep = ClientSideRowModelSteps.EVERYTHING;
|
30131 | var stepsMapped = {
|
30132 | group: ClientSideRowModelSteps.EVERYTHING,
|
30133 | filter: ClientSideRowModelSteps.FILTER,
|
30134 | map: ClientSideRowModelSteps.MAP,
|
30135 | aggregate: ClientSideRowModelSteps.AGGREGATE,
|
30136 | sort: ClientSideRowModelSteps.SORT,
|
30137 | pivot: ClientSideRowModelSteps.PIVOT
|
30138 | };
|
30139 | if (exists(step)) {
|
30140 | paramsStep = stepsMapped[step];
|
30141 | }
|
30142 | if (missing(paramsStep)) {
|
30143 | console.error("AG Grid: invalid step " + step + ", available steps are " + Object.keys(stepsMapped).join(', '));
|
30144 | return;
|
30145 | }
|
30146 | var animate = !this.gridOptionsWrapper.isSuppressAnimationFrame();
|
30147 | var modelParams = {
|
30148 | step: paramsStep,
|
30149 | keepRenderedRows: true,
|
30150 | keepEditingRows: true,
|
30151 | animate: animate
|
30152 | };
|
30153 | this.clientSideRowModel.refreshModel(modelParams);
|
30154 | };
|
30155 |
|
30156 | GridApi.prototype.isAnimationFrameQueueEmpty = function () {
|
30157 | return this.animationFrameService.isQueueEmpty();
|
30158 | };
|
30159 | GridApi.prototype.flushAllAnimationFrames = function () {
|
30160 | this.animationFrameService.flushAllFrames();
|
30161 | };
|
30162 | |
30163 |
|
30164 |
|
30165 |
|
30166 |
|
30167 |
|
30168 | GridApi.prototype.getRowNode = function (id) {
|
30169 | return this.rowModel.getRowNode(id);
|
30170 | };
|
30171 | |
30172 |
|
30173 |
|
30174 |
|
30175 | GridApi.prototype.getSizesForCurrentTheme = function () {
|
30176 | return {
|
30177 | rowHeight: this.gridOptionsWrapper.getRowHeightAsNumber(),
|
30178 | headerHeight: this.gridOptionsWrapper.getHeaderHeight()
|
30179 | };
|
30180 | };
|
30181 |
|
30182 | GridApi.prototype.expandAll = function () {
|
30183 | if (this.clientSideRowModel) {
|
30184 | this.clientSideRowModel.expandOrCollapseAll(true);
|
30185 | }
|
30186 | else if (this.serverSideRowModel) {
|
30187 | this.serverSideRowModel.expandAll(true);
|
30188 | }
|
30189 | else {
|
30190 | console.warn('AG Grid: expandAll only works with Client Side Row Model and Server Side Row Model');
|
30191 | }
|
30192 | };
|
30193 |
|
30194 | GridApi.prototype.collapseAll = function () {
|
30195 | if (this.clientSideRowModel) {
|
30196 | this.clientSideRowModel.expandOrCollapseAll(false);
|
30197 | }
|
30198 | else if (this.serverSideRowModel) {
|
30199 | this.serverSideRowModel.expandAll(false);
|
30200 | }
|
30201 | else {
|
30202 | console.warn('AG Grid: collapseAll only works with Client Side Row Model and Server Side Row Model');
|
30203 | }
|
30204 | };
|
30205 |
|
30206 | GridApi.prototype.getToolPanelInstance = function (id) {
|
30207 | if (!this.sideBarComp) {
|
30208 | console.warn('AG Grid: toolPanel is only available in AG Grid Enterprise');
|
30209 | return;
|
30210 | }
|
30211 | var comp = this.sideBarComp.getToolPanelInstance(id);
|
30212 | return unwrapUserComp(comp);
|
30213 | };
|
30214 | GridApi.prototype.addVirtualRowListener = function (eventName, rowIndex, callback) {
|
30215 | if (typeof eventName !== 'string') {
|
30216 | console.warn('AG Grid: addVirtualRowListener is deprecated, please use addRenderedRowListener.');
|
30217 | }
|
30218 | this.addRenderedRowListener(eventName, rowIndex, callback);
|
30219 | };
|
30220 | |
30221 |
|
30222 |
|
30223 |
|
30224 |
|
30225 |
|
30226 |
|
30227 |
|
30228 | GridApi.prototype.addRenderedRowListener = function (eventName, rowIndex, callback) {
|
30229 | if (eventName === 'virtualRowSelected') {
|
30230 | console.warn("AG Grid: event virtualRowSelected is deprecated, to register for individual row\n selection events, add a listener directly to the row node.");
|
30231 | }
|
30232 | this.rowRenderer.addRenderedRowListener(eventName, rowIndex, callback);
|
30233 | };
|
30234 |
|
30235 | GridApi.prototype.setQuickFilter = function (newFilter) {
|
30236 | this.filterManager.setQuickFilter(newFilter);
|
30237 | };
|
30238 | GridApi.prototype.selectIndex = function (index, tryMulti, suppressEvents) {
|
30239 | console.warn('AG Grid: do not use api for selection, call node.setSelected(value) instead');
|
30240 | if (suppressEvents) {
|
30241 | console.warn('AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
|
30242 | }
|
30243 | this.selectionService.selectIndex(index, tryMulti);
|
30244 | };
|
30245 | GridApi.prototype.deselectIndex = function (index, suppressEvents) {
|
30246 | if (suppressEvents === void 0) { suppressEvents = false; }
|
30247 | console.warn('AG Grid: do not use api for selection, call node.setSelected(value) instead');
|
30248 | if (suppressEvents) {
|
30249 | console.warn('AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
|
30250 | }
|
30251 | this.selectionService.deselectIndex(index);
|
30252 | };
|
30253 | GridApi.prototype.selectNode = function (node, tryMulti, suppressEvents) {
|
30254 | if (tryMulti === void 0) { tryMulti = false; }
|
30255 | if (suppressEvents === void 0) { suppressEvents = false; }
|
30256 | console.warn('AG Grid: API for selection is deprecated, call node.setSelected(value) instead');
|
30257 | if (suppressEvents) {
|
30258 | console.warn('AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
|
30259 | }
|
30260 | node.setSelectedParams({ newValue: true, clearSelection: !tryMulti });
|
30261 | };
|
30262 | GridApi.prototype.deselectNode = function (node, suppressEvents) {
|
30263 | if (suppressEvents === void 0) { suppressEvents = false; }
|
30264 | console.warn('AG Grid: API for selection is deprecated, call node.setSelected(value) instead');
|
30265 | if (suppressEvents) {
|
30266 | console.warn('AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
|
30267 | }
|
30268 | node.setSelectedParams({ newValue: false });
|
30269 | };
|
30270 |
|
30271 | GridApi.prototype.selectAll = function () {
|
30272 | this.selectionService.selectAllRowNodes();
|
30273 | };
|
30274 |
|
30275 | GridApi.prototype.deselectAll = function () {
|
30276 | this.selectionService.deselectAllRowNodes();
|
30277 | };
|
30278 |
|
30279 | GridApi.prototype.selectAllFiltered = function () {
|
30280 | this.selectionService.selectAllRowNodes(true);
|
30281 | };
|
30282 |
|
30283 | GridApi.prototype.deselectAllFiltered = function () {
|
30284 | this.selectionService.deselectAllRowNodes(true);
|
30285 | };
|
30286 | GridApi.prototype.recomputeAggregates = function () {
|
30287 | if (missing(this.clientSideRowModel)) {
|
30288 | console.warn('cannot call recomputeAggregates unless using normal row model');
|
30289 | }
|
30290 | console.warn("recomputeAggregates is deprecated, please call api.refreshClientSideRowModel('aggregate') instead");
|
30291 | this.clientSideRowModel.refreshModel({ step: ClientSideRowModelSteps.AGGREGATE });
|
30292 | };
|
30293 |
|
30294 | GridApi.prototype.sizeColumnsToFit = function () {
|
30295 | this.gridBodyCtrl.sizeColumnsToFit();
|
30296 | };
|
30297 |
|
30298 | GridApi.prototype.showLoadingOverlay = function () {
|
30299 | this.overlayWrapperComp.showLoadingOverlay();
|
30300 | };
|
30301 |
|
30302 | GridApi.prototype.showNoRowsOverlay = function () {
|
30303 | this.overlayWrapperComp.showNoRowsOverlay();
|
30304 | };
|
30305 |
|
30306 | GridApi.prototype.hideOverlay = function () {
|
30307 | this.overlayWrapperComp.hideOverlay();
|
30308 | };
|
30309 | GridApi.prototype.isNodeSelected = function (node) {
|
30310 | console.warn('AG Grid: no need to call api.isNodeSelected(), just call node.isSelected() instead');
|
30311 | return node.isSelected();
|
30312 | };
|
30313 | GridApi.prototype.getSelectedNodesById = function () {
|
30314 | console.error('AG Grid: since version 3.4, getSelectedNodesById no longer exists, use getSelectedNodes() instead');
|
30315 | return null;
|
30316 | };
|
30317 | |
30318 |
|
30319 |
|
30320 |
|
30321 |
|
30322 | GridApi.prototype.getSelectedNodes = function () {
|
30323 | return this.selectionService.getSelectedNodes();
|
30324 | };
|
30325 |
|
30326 | GridApi.prototype.getSelectedRows = function () {
|
30327 | return this.selectionService.getSelectedRows();
|
30328 | };
|
30329 | |
30330 |
|
30331 |
|
30332 |
|
30333 |
|
30334 | GridApi.prototype.getBestCostNodeSelection = function () {
|
30335 | return this.selectionService.getBestCostNodeSelection();
|
30336 | };
|
30337 |
|
30338 | GridApi.prototype.getRenderedNodes = function () {
|
30339 | return this.rowRenderer.getRenderedNodes();
|
30340 | };
|
30341 | GridApi.prototype.ensureColIndexVisible = function (index) {
|
30342 | console.warn('AG Grid: ensureColIndexVisible(index) no longer supported, use ensureColumnVisible(colKey) instead.');
|
30343 | };
|
30344 | |
30345 |
|
30346 |
|
30347 |
|
30348 |
|
30349 |
|
30350 |
|
30351 |
|
30352 |
|
30353 | GridApi.prototype.ensureColumnVisible = function (key, position) {
|
30354 | if (position === void 0) { position = 'auto'; }
|
30355 | this.gridBodyCtrl.getScrollFeature().ensureColumnVisible(key, position);
|
30356 | };
|
30357 | |
30358 |
|
30359 |
|
30360 |
|
30361 |
|
30362 |
|
30363 |
|
30364 |
|
30365 |
|
30366 | GridApi.prototype.ensureIndexVisible = function (index, position) {
|
30367 | this.gridBodyCtrl.getScrollFeature().ensureIndexVisible(index, position);
|
30368 | };
|
30369 | |
30370 |
|
30371 |
|
30372 |
|
30373 |
|
30374 |
|
30375 |
|
30376 | GridApi.prototype.ensureNodeVisible = function (comparator, position) {
|
30377 | if (position === void 0) { position = null; }
|
30378 | this.gridBodyCtrl.getScrollFeature().ensureNodeVisible(comparator, position);
|
30379 | };
|
30380 | |
30381 |
|
30382 |
|
30383 |
|
30384 |
|
30385 |
|
30386 | GridApi.prototype.forEachLeafNode = function (callback) {
|
30387 | if (missing(this.clientSideRowModel)) {
|
30388 | console.warn('cannot call forEachNode unless using normal row model');
|
30389 | }
|
30390 | this.clientSideRowModel.forEachLeafNode(callback);
|
30391 | };
|
30392 | |
30393 |
|
30394 |
|
30395 |
|
30396 |
|
30397 |
|
30398 | GridApi.prototype.forEachNode = function (callback) {
|
30399 | this.rowModel.forEachNode(callback);
|
30400 | };
|
30401 |
|
30402 | GridApi.prototype.forEachNodeAfterFilter = function (callback) {
|
30403 | if (missing(this.clientSideRowModel)) {
|
30404 | console.warn('cannot call forEachNodeAfterFilter unless using normal row model');
|
30405 | }
|
30406 | this.clientSideRowModel.forEachNodeAfterFilter(callback);
|
30407 | };
|
30408 |
|
30409 | GridApi.prototype.forEachNodeAfterFilterAndSort = function (callback) {
|
30410 | if (missing(this.clientSideRowModel)) {
|
30411 | console.warn('cannot call forEachNodeAfterFilterAndSort unless using normal row model');
|
30412 | }
|
30413 | this.clientSideRowModel.forEachNodeAfterFilterAndSort(callback);
|
30414 | };
|
30415 | |
30416 |
|
30417 |
|
30418 |
|
30419 |
|
30420 | GridApi.prototype.getFilterInstance = function (key, callback) {
|
30421 | var res = this.getFilterInstanceImpl(key, function (instance) {
|
30422 | if (!callback) {
|
30423 | return;
|
30424 | }
|
30425 | var unwrapped = unwrapUserComp(instance);
|
30426 | callback(unwrapped);
|
30427 | });
|
30428 | var unwrapped = unwrapUserComp(res);
|
30429 | return unwrapped;
|
30430 | };
|
30431 | GridApi.prototype.getFilterInstanceImpl = function (key, callback) {
|
30432 | var column = this.columnModel.getPrimaryColumn(key);
|
30433 | if (!column) {
|
30434 | return undefined;
|
30435 | }
|
30436 | var filterPromise = this.filterManager.getFilterComponent(column, 'NO_UI');
|
30437 | var currentValue = filterPromise && filterPromise.resolveNow(null, function (filterComp) { return filterComp; });
|
30438 | if (currentValue) {
|
30439 | setTimeout(callback, 0, currentValue);
|
30440 | }
|
30441 | else if (filterPromise) {
|
30442 | filterPromise.then(function (comp) {
|
30443 | callback(comp);
|
30444 | });
|
30445 | }
|
30446 | return currentValue;
|
30447 | };
|
30448 |
|
30449 | GridApi.prototype.destroyFilter = function (key) {
|
30450 | var column = this.columnModel.getPrimaryColumn(key);
|
30451 | if (column) {
|
30452 | return this.filterManager.destroyFilter(column, "filterDestroyed");
|
30453 | }
|
30454 | };
|
30455 |
|
30456 | GridApi.prototype.getStatusPanel = function (key) {
|
30457 | if (!this.statusBarService) {
|
30458 | return;
|
30459 | }
|
30460 | var comp = this.statusBarService.getStatusPanel(key);
|
30461 | return unwrapUserComp(comp);
|
30462 | };
|
30463 | GridApi.prototype.getColumnDef = function (key) {
|
30464 | var column = this.columnModel.getPrimaryColumn(key);
|
30465 | if (column) {
|
30466 | return column.getColDef();
|
30467 | }
|
30468 | return null;
|
30469 | };
|
30470 | |
30471 |
|
30472 |
|
30473 | GridApi.prototype.getColumnDefs = function () { return this.columnModel.getColumnDefs(); };
|
30474 |
|
30475 | GridApi.prototype.onFilterChanged = function () {
|
30476 | this.filterManager.onFilterChanged();
|
30477 | };
|
30478 | |
30479 |
|
30480 |
|
30481 |
|
30482 | GridApi.prototype.onSortChanged = function () {
|
30483 | this.sortController.onSortChanged('api');
|
30484 | };
|
30485 |
|
30486 | GridApi.prototype.setFilterModel = function (model) {
|
30487 | this.filterManager.setFilterModel(model);
|
30488 | };
|
30489 |
|
30490 | GridApi.prototype.getFilterModel = function () {
|
30491 | return this.filterManager.getFilterModel();
|
30492 | };
|
30493 |
|
30494 | GridApi.prototype.getFocusedCell = function () {
|
30495 | return this.focusService.getFocusedCell();
|
30496 | };
|
30497 |
|
30498 | GridApi.prototype.clearFocusedCell = function () {
|
30499 | return this.focusService.clearFocusedCell();
|
30500 | };
|
30501 |
|
30502 | GridApi.prototype.setFocusedCell = function (rowIndex, colKey, rowPinned) {
|
30503 | this.focusService.setFocusedCell(rowIndex, colKey, rowPinned, true);
|
30504 | };
|
30505 |
|
30506 | GridApi.prototype.setSuppressRowDrag = function (value) {
|
30507 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SUPPRESS_ROW_DRAG, value);
|
30508 | };
|
30509 |
|
30510 | GridApi.prototype.setSuppressMoveWhenRowDragging = function (value) {
|
30511 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SUPPRESS_MOVE_WHEN_ROW_DRAG, value);
|
30512 | };
|
30513 |
|
30514 | GridApi.prototype.setSuppressRowClickSelection = function (value) {
|
30515 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SUPPRESS_ROW_CLICK_SELECTION, value);
|
30516 | };
|
30517 |
|
30518 | GridApi.prototype.addRowDropZone = function (params) {
|
30519 | this.gridBodyCtrl.getRowDragFeature().addRowDropZone(params);
|
30520 | };
|
30521 |
|
30522 | GridApi.prototype.removeRowDropZone = function (params) {
|
30523 | var activeDropTarget = this.dragAndDropService.findExternalZone(params);
|
30524 | if (activeDropTarget) {
|
30525 | this.dragAndDropService.removeDropTarget(activeDropTarget);
|
30526 | }
|
30527 | };
|
30528 |
|
30529 | GridApi.prototype.getRowDropZoneParams = function (events) {
|
30530 | return this.gridBodyCtrl.getRowDragFeature().getRowDropZone(events);
|
30531 | };
|
30532 |
|
30533 | GridApi.prototype.setHeaderHeight = function (headerHeight) {
|
30534 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_HEADER_HEIGHT, headerHeight);
|
30535 | };
|
30536 | |
30537 |
|
30538 |
|
30539 |
|
30540 | GridApi.prototype.setDomLayout = function (domLayout) {
|
30541 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_DOM_LAYOUT, domLayout);
|
30542 | };
|
30543 |
|
30544 | GridApi.prototype.setEnableCellTextSelection = function (selectable) {
|
30545 | this.gridBodyCtrl.setCellTextSelection(selectable);
|
30546 | };
|
30547 |
|
30548 | GridApi.prototype.setFillHandleDirection = function (direction) {
|
30549 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_FILL_HANDLE_DIRECTION, direction);
|
30550 | };
|
30551 |
|
30552 | GridApi.prototype.setGroupHeaderHeight = function (headerHeight) {
|
30553 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GROUP_HEADER_HEIGHT, headerHeight);
|
30554 | };
|
30555 |
|
30556 | GridApi.prototype.setFloatingFiltersHeight = function (headerHeight) {
|
30557 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_FLOATING_FILTERS_HEIGHT, headerHeight);
|
30558 | };
|
30559 |
|
30560 | GridApi.prototype.setPivotHeaderHeight = function (headerHeight) {
|
30561 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PIVOT_HEADER_HEIGHT, headerHeight);
|
30562 | };
|
30563 |
|
30564 | GridApi.prototype.setPivotGroupHeaderHeight = function (headerHeight) {
|
30565 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PIVOT_GROUP_HEADER_HEIGHT, headerHeight);
|
30566 | };
|
30567 | GridApi.prototype.setIsExternalFilterPresent = function (isExternalFilterPresentFunc) {
|
30568 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_EXTERNAL_FILTER_PRESENT, isExternalFilterPresentFunc);
|
30569 | };
|
30570 | GridApi.prototype.setDoesExternalFilterPass = function (doesExternalFilterPassFunc) {
|
30571 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_DOES_EXTERNAL_FILTER_PASS, doesExternalFilterPassFunc);
|
30572 | };
|
30573 | GridApi.prototype.setNavigateToNextCell = function (navigateToNextCellFunc) {
|
30574 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_NAVIGATE_TO_NEXT_CELL, navigateToNextCellFunc);
|
30575 | };
|
30576 | GridApi.prototype.setTabToNextCell = function (tabToNextCellFunc) {
|
30577 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_TAB_TO_NEXT_CELL, tabToNextCellFunc);
|
30578 | };
|
30579 | GridApi.prototype.setTabToNextHeader = function (tabToNextHeaderFunc) {
|
30580 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_TAB_TO_NEXT_HEADER, tabToNextHeaderFunc);
|
30581 | };
|
30582 | GridApi.prototype.setNavigateToNextHeader = function (navigateToNextHeaderFunc) {
|
30583 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_NAVIGATE_TO_NEXT_HEADER, navigateToNextHeaderFunc);
|
30584 | };
|
30585 | GridApi.prototype.setGroupRowAggNodes = function (groupRowAggNodesFunc) {
|
30586 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GROUP_ROW_AGG_NODES, groupRowAggNodesFunc);
|
30587 | };
|
30588 | GridApi.prototype.setGetGroupRowAgg = function (getGroupRowAggFunc) {
|
30589 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_GROUP_ROW_AGG, getGroupRowAggFunc);
|
30590 | };
|
30591 | GridApi.prototype.setGetBusinessKeyForNode = function (getBusinessKeyForNodeFunc) {
|
30592 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_BUSINESS_KEY_FOR_NODE, getBusinessKeyForNodeFunc);
|
30593 | };
|
30594 | GridApi.prototype.setGetChildCount = function (getChildCountFunc) {
|
30595 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_CHILD_COUNT, getChildCountFunc);
|
30596 | };
|
30597 | GridApi.prototype.setProcessRowPostCreate = function (processRowPostCreateFunc) {
|
30598 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PROCESS_ROW_POST_CREATE, processRowPostCreateFunc);
|
30599 | };
|
30600 | GridApi.prototype.setGetRowNodeId = function (getRowNodeIdFunc) {
|
30601 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_ROW_NODE_ID, getRowNodeIdFunc);
|
30602 | };
|
30603 | GridApi.prototype.setGetRowId = function (getRowIdFunc) {
|
30604 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_ROW_ID, getRowIdFunc);
|
30605 | };
|
30606 | GridApi.prototype.setGetRowClass = function (rowClassFunc) {
|
30607 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_ROW_CLASS, rowClassFunc);
|
30608 | };
|
30609 | GridApi.prototype.setIsFullWidthCell = function (isFullWidthCellFunc) {
|
30610 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_FULL_WIDTH_CELL, isFullWidthCellFunc);
|
30611 | };
|
30612 | GridApi.prototype.setIsFullWidthRow = function (isFullWidthRowFunc) {
|
30613 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_FULL_WIDTH_ROW, isFullWidthRowFunc);
|
30614 | };
|
30615 | GridApi.prototype.setIsRowSelectable = function (isRowSelectableFunc) {
|
30616 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_ROW_SELECTABLE, isRowSelectableFunc);
|
30617 | };
|
30618 | GridApi.prototype.setIsRowMaster = function (isRowMasterFunc) {
|
30619 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_ROW_MASTER, isRowMasterFunc);
|
30620 | };
|
30621 | GridApi.prototype.setPostSort = function (postSortFunc) {
|
30622 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_POST_SORT, postSortFunc);
|
30623 | };
|
30624 | GridApi.prototype.setPostSortRows = function (postSortRowsFunc) {
|
30625 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_POST_SORT_ROWS, postSortRowsFunc);
|
30626 | };
|
30627 | GridApi.prototype.setGetDocument = function (getDocumentFunc) {
|
30628 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_DOCUMENT, getDocumentFunc);
|
30629 | };
|
30630 | GridApi.prototype.setGetContextMenuItems = function (getContextMenuItemsFunc) {
|
30631 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_CONTEXT_MENU_ITEMS, getContextMenuItemsFunc);
|
30632 | };
|
30633 | GridApi.prototype.setGetMainMenuItems = function (getMainMenuItemsFunc) {
|
30634 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_MAIN_MENU_ITEMS, getMainMenuItemsFunc);
|
30635 | };
|
30636 | GridApi.prototype.setProcessCellForClipboard = function (processCellForClipboardFunc) {
|
30637 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PROCESS_CELL_FOR_CLIPBOARD, processCellForClipboardFunc);
|
30638 | };
|
30639 | GridApi.prototype.setSendToClipboard = function (sendToClipboardFunc) {
|
30640 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SEND_TO_CLIPBOARD, sendToClipboardFunc);
|
30641 | };
|
30642 | GridApi.prototype.setProcessCellFromClipboard = function (processCellFromClipboardFunc) {
|
30643 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PROCESS_CELL_FROM_CLIPBOARD, processCellFromClipboardFunc);
|
30644 | };
|
30645 | GridApi.prototype.setProcessSecondaryColDef = function (processSecondaryColDefFunc) {
|
30646 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PROCESS_TO_SECONDARY_COLDEF, processSecondaryColDefFunc);
|
30647 | };
|
30648 | GridApi.prototype.setProcessSecondaryColGroupDef = function (processSecondaryColGroupDefFunc) {
|
30649 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PROCESS_SECONDARY_COL_GROUP_DEF, processSecondaryColGroupDefFunc);
|
30650 | };
|
30651 | GridApi.prototype.setPostProcessPopup = function (postProcessPopupFunc) {
|
30652 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_POST_PROCESS_POPUP, postProcessPopupFunc);
|
30653 | };
|
30654 | GridApi.prototype.setDefaultGroupOrderComparator = function (defaultGroupOrderComparatorFunc) {
|
30655 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_DEFAULT_GROUP_ORDER_COMPARATOR, defaultGroupOrderComparatorFunc);
|
30656 | };
|
30657 | GridApi.prototype.setInitialGroupOrderComparator = function (initialGroupOrderComparatorFunc) {
|
30658 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_INITIAL_GROUP_ORDER_COMPARATOR, initialGroupOrderComparatorFunc);
|
30659 | };
|
30660 | GridApi.prototype.setGetChartToolbarItems = function (getChartToolbarItemsFunc) {
|
30661 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_CHART_TOOLBAR_ITEMS, getChartToolbarItemsFunc);
|
30662 | };
|
30663 | GridApi.prototype.setPaginationNumberFormatter = function (paginationNumberFormatterFunc) {
|
30664 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PAGINATION_NUMBER_FORMATTER, paginationNumberFormatterFunc);
|
30665 | };
|
30666 | GridApi.prototype.setGetServerSideStoreParams = function (getServerSideStoreParamsFunc) {
|
30667 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_SERVER_SIDE_STORE_PARAMS, getServerSideStoreParamsFunc);
|
30668 | };
|
30669 | GridApi.prototype.setIsServerSideGroupOpenByDefault = function (isServerSideGroupOpenByDefaultFunc) {
|
30670 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_SERVER_SIDE_GROUPS_OPEN_BY_DEFAULT, isServerSideGroupOpenByDefaultFunc);
|
30671 | };
|
30672 | GridApi.prototype.setIsApplyServerSideTransaction = function (isApplyServerSideTransactionFunc) {
|
30673 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_APPLY_SERVER_SIDE_TRANSACTION, isApplyServerSideTransactionFunc);
|
30674 | };
|
30675 | GridApi.prototype.setIsServerSideGroup = function (isServerSideGroupFunc) {
|
30676 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_SERVER_SIDE_GROUP, isServerSideGroupFunc);
|
30677 | };
|
30678 | GridApi.prototype.setGetServerSideGroupKey = function (getServerSideGroupKeyFunc) {
|
30679 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_SERVER_SIDE_GROUP_KEY, getServerSideGroupKeyFunc);
|
30680 | };
|
30681 | GridApi.prototype.setGetRowStyle = function (rowStyleFunc) {
|
30682 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_ROW_STYLE, rowStyleFunc);
|
30683 | };
|
30684 | GridApi.prototype.setGetRowHeight = function (rowHeightFunc) {
|
30685 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_ROW_HEIGHT, rowHeightFunc);
|
30686 | };
|
30687 |
|
30688 | GridApi.prototype.isSideBarVisible = function () {
|
30689 | return this.sideBarComp ? this.sideBarComp.isDisplayed() : false;
|
30690 | };
|
30691 |
|
30692 | GridApi.prototype.setSideBarVisible = function (show) {
|
30693 | if (!this.sideBarComp) {
|
30694 | if (show) {
|
30695 | console.warn('AG Grid: sideBar is not loaded');
|
30696 | }
|
30697 | return;
|
30698 | }
|
30699 | this.sideBarComp.setDisplayed(show);
|
30700 | };
|
30701 |
|
30702 | GridApi.prototype.setSideBarPosition = function (position) {
|
30703 | if (!this.sideBarComp) {
|
30704 | console.warn('AG Grid: sideBar is not loaded');
|
30705 | return;
|
30706 | }
|
30707 | this.sideBarComp.setSideBarPosition(position);
|
30708 | };
|
30709 |
|
30710 | GridApi.prototype.openToolPanel = function (key) {
|
30711 | if (!this.sideBarComp) {
|
30712 | console.warn('AG Grid: toolPanel is only available in AG Grid Enterprise');
|
30713 | return;
|
30714 | }
|
30715 | this.sideBarComp.openToolPanel(key);
|
30716 | };
|
30717 |
|
30718 | GridApi.prototype.closeToolPanel = function () {
|
30719 | if (!this.sideBarComp) {
|
30720 | console.warn('AG Grid: toolPanel is only available in AG Grid Enterprise');
|
30721 | return;
|
30722 | }
|
30723 | this.sideBarComp.close();
|
30724 | };
|
30725 |
|
30726 | GridApi.prototype.getOpenedToolPanel = function () {
|
30727 | return this.sideBarComp ? this.sideBarComp.openedItem() : null;
|
30728 | };
|
30729 |
|
30730 | GridApi.prototype.getSideBar = function () {
|
30731 | return this.gridOptionsWrapper.getSideBar();
|
30732 | };
|
30733 |
|
30734 | GridApi.prototype.setSideBar = function (def) {
|
30735 | this.gridOptionsWrapper.setProperty('sideBar', SideBarDefParser.parse(def));
|
30736 | };
|
30737 | GridApi.prototype.setSuppressClipboardPaste = function (value) {
|
30738 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SUPPRESS_CLIPBOARD_PASTE, value);
|
30739 | };
|
30740 |
|
30741 | GridApi.prototype.isToolPanelShowing = function () {
|
30742 | return this.sideBarComp.isToolPanelShowing();
|
30743 | };
|
30744 | GridApi.prototype.doLayout = function () {
|
30745 | 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";
|
30746 | doOnce(function () { return console.warn(message); }, 'doLayoutDeprecated');
|
30747 | };
|
30748 |
|
30749 | GridApi.prototype.resetRowHeights = function () {
|
30750 | if (exists(this.clientSideRowModel)) {
|
30751 | if (this.columnModel.isAutoRowHeightActive()) {
|
30752 | console.warn('AG Grid: calling gridApi.resetRowHeights() makes no sense when using Auto Row Height.');
|
30753 | return;
|
30754 | }
|
30755 | this.clientSideRowModel.resetRowHeights();
|
30756 | }
|
30757 | };
|
30758 | GridApi.prototype.setGroupRemoveSingleChildren = function (value) {
|
30759 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN, value);
|
30760 | };
|
30761 | GridApi.prototype.setGroupRemoveLowestSingleChildren = function (value) {
|
30762 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, value);
|
30763 | };
|
30764 |
|
30765 | GridApi.prototype.onRowHeightChanged = function () {
|
30766 | if (this.clientSideRowModel) {
|
30767 | this.clientSideRowModel.onRowHeightChanged();
|
30768 | }
|
30769 | else if (this.serverSideRowModel) {
|
30770 | this.serverSideRowModel.onRowHeightChanged();
|
30771 | }
|
30772 | };
|
30773 | |
30774 |
|
30775 |
|
30776 |
|
30777 | GridApi.prototype.getValue = function (colKey, rowNode) {
|
30778 | var column = this.columnModel.getPrimaryColumn(colKey);
|
30779 | if (missing(column)) {
|
30780 | column = this.columnModel.getGridColumn(colKey);
|
30781 | }
|
30782 | if (missing(column)) {
|
30783 | return null;
|
30784 | }
|
30785 | return this.valueService.getValue(column, rowNode);
|
30786 | };
|
30787 |
|
30788 | GridApi.prototype.addEventListener = function (eventType, listener) {
|
30789 | var async = this.gridOptionsWrapper.useAsyncEvents();
|
30790 | this.eventService.addEventListener(eventType, listener, async);
|
30791 | };
|
30792 |
|
30793 | GridApi.prototype.addGlobalListener = function (listener) {
|
30794 | var async = this.gridOptionsWrapper.useAsyncEvents();
|
30795 | this.eventService.addGlobalListener(listener, async);
|
30796 | };
|
30797 |
|
30798 | GridApi.prototype.removeEventListener = function (eventType, listener) {
|
30799 | var async = this.gridOptionsWrapper.useAsyncEvents();
|
30800 | this.eventService.removeEventListener(eventType, listener, async);
|
30801 | };
|
30802 |
|
30803 | GridApi.prototype.removeGlobalListener = function (listener) {
|
30804 | var async = this.gridOptionsWrapper.useAsyncEvents();
|
30805 | this.eventService.removeGlobalListener(listener, async);
|
30806 | };
|
30807 | GridApi.prototype.dispatchEvent = function (event) {
|
30808 | this.eventService.dispatchEvent(event);
|
30809 | };
|
30810 |
|
30811 | GridApi.prototype.destroy = function () {
|
30812 |
|
30813 |
|
30814 | if (this.destroyCalled) {
|
30815 | return;
|
30816 | }
|
30817 | this.destroyCalled = true;
|
30818 |
|
30819 | var gridCtrl = this.ctrlsService.getGridCtrl();
|
30820 | if (gridCtrl) {
|
30821 | gridCtrl.destroyGridUi();
|
30822 | }
|
30823 |
|
30824 | this.context.destroy();
|
30825 | };
|
30826 | GridApi.prototype.cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid = function () {
|
30827 |
|
30828 |
|
30829 |
|
30830 |
|
30831 |
|
30832 |
|
30833 | setTimeout(removeAllReferences.bind(window, this, 'Grid API'), 100);
|
30834 | };
|
30835 | GridApi.prototype.warnIfDestroyed = function (methodName) {
|
30836 | if (this.destroyCalled) {
|
30837 | console.warn("AG Grid: Grid API method " + methodName + " was called on a grid that was destroyed.");
|
30838 | }
|
30839 | return this.destroyCalled;
|
30840 | };
|
30841 |
|
30842 | GridApi.prototype.resetQuickFilter = function () {
|
30843 | if (this.warnIfDestroyed('resetQuickFilter')) {
|
30844 | return;
|
30845 | }
|
30846 | this.rowModel.forEachNode(function (node) { return node.quickFilterAggregateText = null; });
|
30847 | };
|
30848 | GridApi.prototype.getRangeSelections = function () {
|
30849 | 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.");
|
30850 | return null;
|
30851 | };
|
30852 |
|
30853 | GridApi.prototype.getCellRanges = function () {
|
30854 | if (this.rangeService) {
|
30855 | return this.rangeService.getCellRanges();
|
30856 | }
|
30857 | console.warn('AG Grid: cell range selection is only available in AG Grid Enterprise');
|
30858 | return null;
|
30859 | };
|
30860 | GridApi.prototype.camelCaseToHumanReadable = function (camelCase) {
|
30861 | return camelCaseToHumanText(camelCase);
|
30862 | };
|
30863 | GridApi.prototype.addRangeSelection = function (deprecatedNoLongerUsed) {
|
30864 | 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()');
|
30865 | };
|
30866 |
|
30867 | GridApi.prototype.addCellRange = function (params) {
|
30868 | if (!this.rangeService) {
|
30869 | console.warn('AG Grid: cell range selection is only available in AG Grid Enterprise');
|
30870 | }
|
30871 | this.rangeService.addCellRange(params);
|
30872 | };
|
30873 |
|
30874 | GridApi.prototype.clearRangeSelection = function () {
|
30875 | if (!this.rangeService) {
|
30876 | console.warn('AG Grid: cell range selection is only available in AG Grid Enterprise');
|
30877 | }
|
30878 | this.rangeService.removeAllCellRanges();
|
30879 | };
|
30880 |
|
30881 | GridApi.prototype.undoCellEditing = function () {
|
30882 | this.undoRedoService.undo();
|
30883 | };
|
30884 |
|
30885 | GridApi.prototype.redoCellEditing = function () {
|
30886 | this.undoRedoService.redo();
|
30887 | };
|
30888 |
|
30889 | GridApi.prototype.getCurrentUndoSize = function () {
|
30890 | return this.undoRedoService.getCurrentUndoStackSize();
|
30891 | };
|
30892 |
|
30893 | GridApi.prototype.getCurrentRedoSize = function () {
|
30894 | return this.undoRedoService.getCurrentRedoStackSize();
|
30895 | };
|
30896 |
|
30897 | GridApi.prototype.getChartModels = function () {
|
30898 | if (ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'api.getChartModels') &&
|
30899 | ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.getChartModels')) {
|
30900 | return this.chartService.getChartModels();
|
30901 | }
|
30902 | };
|
30903 |
|
30904 | GridApi.prototype.getChartRef = function (chartId) {
|
30905 | if (ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'api.getChartRef') &&
|
30906 | ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.getChartRef')) {
|
30907 | return this.chartService.getChartRef(chartId);
|
30908 | }
|
30909 | };
|
30910 |
|
30911 | GridApi.prototype.getChartImageDataURL = function (params) {
|
30912 | if (ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'api.getChartImageDataURL') &&
|
30913 | ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.getChartImageDataURL')) {
|
30914 | return this.chartService.getChartImageDataURL(params);
|
30915 | }
|
30916 | };
|
30917 |
|
30918 | GridApi.prototype.createRangeChart = function (params) {
|
30919 | if (ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'api.createRangeChart') &&
|
30920 | ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.createRangeChart')) {
|
30921 | return this.chartService.createRangeChart(params);
|
30922 | }
|
30923 | };
|
30924 |
|
30925 | GridApi.prototype.createCrossFilterChart = function (params) {
|
30926 | if (ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'api.createCrossFilterChart') &&
|
30927 | ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.createCrossFilterChart')) {
|
30928 | return this.chartService.createCrossFilterChart(params);
|
30929 | }
|
30930 | };
|
30931 |
|
30932 | GridApi.prototype.restoreChart = function (chartModel, chartContainer) {
|
30933 | if (ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'api.restoreChart') &&
|
30934 | ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.restoreChart')) {
|
30935 | return this.chartService.restoreChart(chartModel, chartContainer);
|
30936 | }
|
30937 | };
|
30938 |
|
30939 | GridApi.prototype.createPivotChart = function (params) {
|
30940 | if (ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'api.createPivotChart') &&
|
30941 | ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.createPivotChart')) {
|
30942 | return this.chartService.createPivotChart(params);
|
30943 | }
|
30944 | };
|
30945 |
|
30946 | GridApi.prototype.copySelectedRowsToClipboard = function (params) {
|
30947 | if (!this.clipboardService) {
|
30948 | console.warn('AG Grid: clipboard is only available in AG Grid Enterprise');
|
30949 | }
|
30950 | this.clipboardService.copySelectedRowsToClipboard(params);
|
30951 | };
|
30952 |
|
30953 | GridApi.prototype.copySelectedRangeToClipboard = function (params) {
|
30954 | if (!this.clipboardService) {
|
30955 | console.warn('AG Grid: clipboard is only available in AG Grid Enterprise');
|
30956 | }
|
30957 | this.clipboardService.copySelectedRangeToClipboard(params);
|
30958 | };
|
30959 |
|
30960 | GridApi.prototype.copySelectedRangeDown = function () {
|
30961 | if (!this.clipboardService) {
|
30962 | console.warn('AG Grid: clipboard is only available in AG Grid Enterprise');
|
30963 | }
|
30964 | this.clipboardService.copyRangeDown();
|
30965 | };
|
30966 |
|
30967 | GridApi.prototype.showColumnMenuAfterButtonClick = function (colKey, buttonElement) {
|
30968 |
|
30969 | var column = this.columnModel.getGridColumn(colKey);
|
30970 | this.menuFactory.showMenuAfterButtonClick(column, buttonElement, 'columnMenu');
|
30971 | };
|
30972 |
|
30973 | GridApi.prototype.showColumnMenuAfterMouseClick = function (colKey, mouseEvent) {
|
30974 |
|
30975 | var column = this.columnModel.getGridColumn(colKey);
|
30976 | if (!column) {
|
30977 | column = this.columnModel.getPrimaryColumn(colKey);
|
30978 | }
|
30979 | if (!column) {
|
30980 | console.error("AG Grid: column '" + colKey + "' not found");
|
30981 | return;
|
30982 | }
|
30983 | this.menuFactory.showMenuAfterMouseEvent(column, mouseEvent);
|
30984 | };
|
30985 |
|
30986 | GridApi.prototype.hidePopupMenu = function () {
|
30987 |
|
30988 | if (this.contextMenuFactory) {
|
30989 | this.contextMenuFactory.hideActiveMenu();
|
30990 | }
|
30991 |
|
30992 | this.menuFactory.hideActiveMenu();
|
30993 | };
|
30994 |
|
30995 | GridApi.prototype.setPopupParent = function (ePopupParent) {
|
30996 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_POPUP_PARENT, ePopupParent);
|
30997 | };
|
30998 |
|
30999 | GridApi.prototype.tabToNextCell = function (event) {
|
31000 | return this.navigationService.tabToNextCell(false, event);
|
31001 | };
|
31002 |
|
31003 | GridApi.prototype.tabToPreviousCell = function (event) {
|
31004 | return this.navigationService.tabToNextCell(true, event);
|
31005 | };
|
31006 |
|
31007 | GridApi.prototype.getCellRendererInstances = function (params) {
|
31008 | if (params === void 0) { params = {}; }
|
31009 | var res = this.rowRenderer.getCellRendererInstances(params);
|
31010 | var unwrapped = res.map(unwrapUserComp);
|
31011 | return unwrapped;
|
31012 | };
|
31013 |
|
31014 | GridApi.prototype.getCellEditorInstances = function (params) {
|
31015 | if (params === void 0) { params = {}; }
|
31016 | var res = this.rowRenderer.getCellEditorInstances(params);
|
31017 | var unwrapped = res.map(unwrapUserComp);
|
31018 | return unwrapped;
|
31019 | };
|
31020 |
|
31021 | GridApi.prototype.getEditingCells = function () {
|
31022 | return this.rowRenderer.getEditingCells();
|
31023 | };
|
31024 |
|
31025 | GridApi.prototype.stopEditing = function (cancel) {
|
31026 | if (cancel === void 0) { cancel = false; }
|
31027 | this.rowRenderer.stopEditing(cancel);
|
31028 | };
|
31029 |
|
31030 | GridApi.prototype.startEditingCell = function (params) {
|
31031 | var column = this.columnModel.getGridColumn(params.colKey);
|
31032 | if (!column) {
|
31033 | console.warn("AG Grid: no column found for " + params.colKey);
|
31034 | return;
|
31035 | }
|
31036 | var cellPosition = {
|
31037 | rowIndex: params.rowIndex,
|
31038 | rowPinned: params.rowPinned || null,
|
31039 | column: column
|
31040 | };
|
31041 | var notPinned = params.rowPinned == null;
|
31042 | if (notPinned) {
|
31043 | this.gridBodyCtrl.getScrollFeature().ensureIndexVisible(params.rowIndex);
|
31044 | }
|
31045 | var cell = this.navigationService.getCellByPosition(cellPosition);
|
31046 | if (!cell) {
|
31047 | return;
|
31048 | }
|
31049 | cell.startRowOrCellEdit(params.key, params.charPress);
|
31050 | };
|
31051 |
|
31052 | GridApi.prototype.addAggFunc = function (key, aggFunc) {
|
31053 | if (this.aggFuncService) {
|
31054 | this.aggFuncService.addAggFunc(key, aggFunc);
|
31055 | }
|
31056 | };
|
31057 |
|
31058 | GridApi.prototype.addAggFuncs = function (aggFuncs) {
|
31059 | if (this.aggFuncService) {
|
31060 | this.aggFuncService.addAggFuncs(aggFuncs);
|
31061 | }
|
31062 | };
|
31063 |
|
31064 | GridApi.prototype.clearAggFuncs = function () {
|
31065 | if (this.aggFuncService) {
|
31066 | this.aggFuncService.clear();
|
31067 | }
|
31068 | };
|
31069 |
|
31070 | GridApi.prototype.applyServerSideTransaction = function (transaction) {
|
31071 | if (!this.serverSideTransactionManager) {
|
31072 | console.warn('AG Grid: Cannot apply Server Side Transaction if not using the Server Side Row Model.');
|
31073 | return;
|
31074 | }
|
31075 | return this.serverSideTransactionManager.applyTransaction(transaction);
|
31076 | };
|
31077 | GridApi.prototype.applyServerSideTransactionAsync = function (transaction, callback) {
|
31078 | if (!this.serverSideTransactionManager) {
|
31079 | console.warn('AG Grid: Cannot apply Server Side Transaction if not using the Server Side Row Model.');
|
31080 | return;
|
31081 | }
|
31082 | return this.serverSideTransactionManager.applyTransactionAsync(transaction, callback);
|
31083 | };
|
31084 |
|
31085 | GridApi.prototype.retryServerSideLoads = function () {
|
31086 | if (!this.serverSideRowModel) {
|
31087 | console.warn('AG Grid: API retryServerSideLoads() can only be used when using Server-Side Row Model.');
|
31088 | return;
|
31089 | }
|
31090 | this.serverSideRowModel.retryLoads();
|
31091 | };
|
31092 | GridApi.prototype.flushServerSideAsyncTransactions = function () {
|
31093 | if (!this.serverSideTransactionManager) {
|
31094 | console.warn('AG Grid: Cannot flush Server Side Transaction if not using the Server Side Row Model.');
|
31095 | return;
|
31096 | }
|
31097 | return this.serverSideTransactionManager.flushAsyncTransactions();
|
31098 | };
|
31099 |
|
31100 | GridApi.prototype.applyTransaction = function (rowDataTransaction) {
|
31101 | if (!this.clientSideRowModel) {
|
31102 | console.error('AG Grid: updateRowData() only works with ClientSideRowModel. Working with InfiniteRowModel was deprecated in v23.1 and removed in v24.1');
|
31103 | return;
|
31104 | }
|
31105 | var res = this.clientSideRowModel.updateRowData(rowDataTransaction);
|
31106 |
|
31107 | this.rowRenderer.refreshFullWidthRows(res.update);
|
31108 |
|
31109 | if (!this.gridOptionsWrapper.isSuppressChangeDetection()) {
|
31110 | this.rowRenderer.refreshCells();
|
31111 | }
|
31112 | return res;
|
31113 | };
|
31114 |
|
31115 | GridApi.prototype.setDeltaSort = function (enable) {
|
31116 | this.gridOptionsWrapper.setProperty('deltaSort', enable);
|
31117 | };
|
31118 |
|
31119 | GridApi.prototype.updateRowData = function (rowDataTransaction) {
|
31120 | 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.';
|
31121 | doOnce(function () { return console.warn(message); }, 'updateRowData deprecated');
|
31122 | return this.applyTransaction(rowDataTransaction);
|
31123 | };
|
31124 |
|
31125 | GridApi.prototype.applyTransactionAsync = function (rowDataTransaction, callback) {
|
31126 | if (!this.clientSideRowModel) {
|
31127 | console.error('AG Grid: api.applyTransactionAsync() only works with ClientSideRowModel.');
|
31128 | return;
|
31129 | }
|
31130 | this.clientSideRowModel.batchUpdateRowData(rowDataTransaction, callback);
|
31131 | };
|
31132 |
|
31133 | GridApi.prototype.flushAsyncTransactions = function () {
|
31134 | if (!this.clientSideRowModel) {
|
31135 | console.error('AG Grid: api.applyTransactionAsync() only works with ClientSideRowModel.');
|
31136 | return;
|
31137 | }
|
31138 | this.clientSideRowModel.flushAsyncTransactions();
|
31139 | };
|
31140 |
|
31141 | GridApi.prototype.batchUpdateRowData = function (rowDataTransaction, callback) {
|
31142 | 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.';
|
31143 | doOnce(function () { return console.warn(message); }, 'batchUpdateRowData deprecated');
|
31144 | this.applyTransactionAsync(rowDataTransaction, callback);
|
31145 | };
|
31146 | GridApi.prototype.insertItemsAtIndex = function (index, items, skipRefresh) {
|
31147 | console.warn('AG Grid: insertItemsAtIndex() is deprecated, use updateRowData(transaction) instead.');
|
31148 | this.updateRowData({ add: items, addIndex: index, update: null, remove: null });
|
31149 | };
|
31150 | GridApi.prototype.removeItems = function (rowNodes, skipRefresh) {
|
31151 | console.warn('AG Grid: removeItems() is deprecated, use updateRowData(transaction) instead.');
|
31152 | var dataToRemove = rowNodes.map(function (rowNode) { return rowNode.data; });
|
31153 | this.updateRowData({ add: null, addIndex: null, update: null, remove: dataToRemove });
|
31154 | };
|
31155 | GridApi.prototype.addItems = function (items, skipRefresh) {
|
31156 | console.warn('AG Grid: addItems() is deprecated, use updateRowData(transaction) instead.');
|
31157 | this.updateRowData({ add: items, addIndex: null, update: null, remove: null });
|
31158 | };
|
31159 | GridApi.prototype.refreshVirtualPageCache = function () {
|
31160 | console.warn('AG Grid: refreshVirtualPageCache() is now called refreshInfiniteCache(), please call refreshInfiniteCache() instead');
|
31161 | this.refreshInfiniteCache();
|
31162 | };
|
31163 | GridApi.prototype.refreshInfinitePageCache = function () {
|
31164 | console.warn('AG Grid: refreshInfinitePageCache() is now called refreshInfiniteCache(), please call refreshInfiniteCache() instead');
|
31165 | this.refreshInfiniteCache();
|
31166 | };
|
31167 | |
31168 |
|
31169 |
|
31170 |
|
31171 |
|
31172 | GridApi.prototype.refreshInfiniteCache = function () {
|
31173 | if (this.infiniteRowModel) {
|
31174 | this.infiniteRowModel.refreshCache();
|
31175 | }
|
31176 | else {
|
31177 | console.warn("AG Grid: api.refreshInfiniteCache is only available when rowModelType='infinite'.");
|
31178 | }
|
31179 | };
|
31180 | GridApi.prototype.purgeVirtualPageCache = function () {
|
31181 | console.warn('AG Grid: purgeVirtualPageCache() is now called purgeInfiniteCache(), please call purgeInfiniteCache() instead');
|
31182 | this.purgeInfinitePageCache();
|
31183 | };
|
31184 | GridApi.prototype.purgeInfinitePageCache = function () {
|
31185 | console.warn('AG Grid: purgeInfinitePageCache() is now called purgeInfiniteCache(), please call purgeInfiniteCache() instead');
|
31186 | this.purgeInfiniteCache();
|
31187 | };
|
31188 | |
31189 |
|
31190 |
|
31191 |
|
31192 |
|
31193 |
|
31194 | GridApi.prototype.purgeInfiniteCache = function () {
|
31195 | if (this.infiniteRowModel) {
|
31196 | this.infiniteRowModel.purgeCache();
|
31197 | }
|
31198 | else {
|
31199 | console.warn("AG Grid: api.purgeInfiniteCache is only available when rowModelType='infinite'.");
|
31200 | }
|
31201 | };
|
31202 |
|
31203 | GridApi.prototype.purgeEnterpriseCache = function (route) {
|
31204 | console.warn("ag-grid: since version 18.x, api.purgeEnterpriseCache() should be replaced with api.purgeServerSideCache()");
|
31205 | this.purgeServerSideCache(route);
|
31206 | };
|
31207 |
|
31208 | GridApi.prototype.purgeServerSideCache = function (route) {
|
31209 | if (route === void 0) { route = []; }
|
31210 | if (this.serverSideRowModel) {
|
31211 | console.warn("AG Grid: since v25.0, api.purgeServerSideCache is deprecated. Please use api.refreshServerSideStore({purge: true}) instead.");
|
31212 | this.refreshServerSideStore({
|
31213 | route: route,
|
31214 | purge: true
|
31215 | });
|
31216 | }
|
31217 | else {
|
31218 | console.warn("AG Grid: api.purgeServerSideCache is only available when rowModelType='serverSide'.");
|
31219 | }
|
31220 | };
|
31221 | |
31222 |
|
31223 |
|
31224 |
|
31225 |
|
31226 | GridApi.prototype.refreshServerSideStore = function (params) {
|
31227 | if (this.serverSideRowModel) {
|
31228 | this.serverSideRowModel.refreshStore(params);
|
31229 | }
|
31230 | else {
|
31231 | console.warn("AG Grid: api.refreshServerSideStore is only available when rowModelType='serverSide'.");
|
31232 | }
|
31233 | };
|
31234 |
|
31235 | GridApi.prototype.getServerSideStoreState = function () {
|
31236 | if (this.serverSideRowModel) {
|
31237 | return this.serverSideRowModel.getStoreState();
|
31238 | }
|
31239 | else {
|
31240 | console.warn("AG Grid: api.getServerSideStoreState is only available when rowModelType='serverSide'.");
|
31241 | return [];
|
31242 | }
|
31243 | };
|
31244 | GridApi.prototype.getVirtualRowCount = function () {
|
31245 | console.warn('AG Grid: getVirtualRowCount() is now called getInfiniteRowCount(), please call getInfiniteRowCount() instead');
|
31246 | return this.getInfiniteRowCount();
|
31247 | };
|
31248 |
|
31249 | GridApi.prototype.getInfiniteRowCount = function () {
|
31250 | if (this.infiniteRowModel) {
|
31251 | return this.infiniteRowModel.getRowCount();
|
31252 | }
|
31253 | else {
|
31254 | console.warn("AG Grid: api.getVirtualRowCount is only available when rowModelType='virtual'.");
|
31255 | }
|
31256 | };
|
31257 | GridApi.prototype.isMaxRowFound = function () {
|
31258 | console.warn("AG Grid: api.isLastRowIndexKnown is deprecated, please use api.isLastRowIndexKnown()");
|
31259 | return this.isLastRowIndexKnown();
|
31260 | };
|
31261 |
|
31262 | GridApi.prototype.isLastRowIndexKnown = function () {
|
31263 | if (this.infiniteRowModel) {
|
31264 | return this.infiniteRowModel.isLastRowIndexKnown();
|
31265 | }
|
31266 | else {
|
31267 | console.warn("AG Grid: api.isMaxRowFound is only available when rowModelType='virtual'.");
|
31268 | }
|
31269 | };
|
31270 | GridApi.prototype.setVirtualRowCount = function (rowCount, maxRowFound) {
|
31271 | console.warn('AG Grid: setVirtualRowCount() is now called setInfiniteRowCount(), please call setInfiniteRowCount() instead');
|
31272 | this.setRowCount(rowCount, maxRowFound);
|
31273 | };
|
31274 | GridApi.prototype.setInfiniteRowCount = function (rowCount, maxRowFound) {
|
31275 | console.warn('AG Grid: setInfiniteRowCount() is now called setRowCount(), please call setRowCount() instead');
|
31276 | this.setRowCount(rowCount, maxRowFound);
|
31277 | };
|
31278 | |
31279 |
|
31280 |
|
31281 |
|
31282 |
|
31283 |
|
31284 |
|
31285 | GridApi.prototype.setRowCount = function (rowCount, maxRowFound) {
|
31286 | if (this.infiniteRowModel) {
|
31287 | this.infiniteRowModel.setRowCount(rowCount, maxRowFound);
|
31288 | }
|
31289 | else {
|
31290 | console.warn("AG Grid: api.setRowCount is only available for Infinite Row Model.");
|
31291 | }
|
31292 | };
|
31293 | GridApi.prototype.getVirtualPageState = function () {
|
31294 | console.warn('AG Grid: getVirtualPageState() is now called getCacheBlockState(), please call getCacheBlockState() instead');
|
31295 | return this.getCacheBlockState();
|
31296 | };
|
31297 | GridApi.prototype.getInfinitePageState = function () {
|
31298 | console.warn('AG Grid: getInfinitePageState() is now called getCacheBlockState(), please call getCacheBlockState() instead');
|
31299 | return this.getCacheBlockState();
|
31300 | };
|
31301 | |
31302 |
|
31303 |
|
31304 | GridApi.prototype.getCacheBlockState = function () {
|
31305 | return this.rowNodeBlockLoader.getBlockState();
|
31306 | };
|
31307 | GridApi.prototype.checkGridSize = function () {
|
31308 | console.warn("in AG Grid v25.2.0, checkGridSize() was removed, as it was legacy and didn't do anything uesful.");
|
31309 | };
|
31310 | GridApi.prototype.getFirstRenderedRow = function () {
|
31311 | console.warn('in AG Grid v12, getFirstRenderedRow() was renamed to getFirstDisplayedRow()');
|
31312 | return this.getFirstDisplayedRow();
|
31313 | };
|
31314 |
|
31315 | GridApi.prototype.getFirstDisplayedRow = function () {
|
31316 | return this.rowRenderer.getFirstVirtualRenderedRow();
|
31317 | };
|
31318 | GridApi.prototype.getLastRenderedRow = function () {
|
31319 | console.warn('in AG Grid v12, getLastRenderedRow() was renamed to getLastDisplayedRow()');
|
31320 | return this.getLastDisplayedRow();
|
31321 | };
|
31322 |
|
31323 | GridApi.prototype.getLastDisplayedRow = function () {
|
31324 | return this.rowRenderer.getLastVirtualRenderedRow();
|
31325 | };
|
31326 |
|
31327 | GridApi.prototype.getDisplayedRowAtIndex = function (index) {
|
31328 | return this.rowModel.getRow(index);
|
31329 | };
|
31330 |
|
31331 | GridApi.prototype.getDisplayedRowCount = function () {
|
31332 | return this.rowModel.getRowCount();
|
31333 | };
|
31334 | |
31335 |
|
31336 |
|
31337 |
|
31338 |
|
31339 | GridApi.prototype.paginationIsLastPageFound = function () {
|
31340 | return this.paginationProxy.isLastPageFound();
|
31341 | };
|
31342 |
|
31343 | GridApi.prototype.paginationGetPageSize = function () {
|
31344 | return this.paginationProxy.getPageSize();
|
31345 | };
|
31346 |
|
31347 | GridApi.prototype.paginationSetPageSize = function (size) {
|
31348 | this.gridOptionsWrapper.setProperty('paginationPageSize', size);
|
31349 | };
|
31350 |
|
31351 | GridApi.prototype.paginationGetCurrentPage = function () {
|
31352 | return this.paginationProxy.getCurrentPage();
|
31353 | };
|
31354 |
|
31355 | GridApi.prototype.paginationGetTotalPages = function () {
|
31356 | return this.paginationProxy.getTotalPages();
|
31357 | };
|
31358 |
|
31359 | GridApi.prototype.paginationGetRowCount = function () {
|
31360 | return this.paginationProxy.getMasterRowCount();
|
31361 | };
|
31362 |
|
31363 | GridApi.prototype.paginationGoToNextPage = function () {
|
31364 | this.paginationProxy.goToNextPage();
|
31365 | };
|
31366 |
|
31367 | GridApi.prototype.paginationGoToPreviousPage = function () {
|
31368 | this.paginationProxy.goToPreviousPage();
|
31369 | };
|
31370 |
|
31371 | GridApi.prototype.paginationGoToFirstPage = function () {
|
31372 | this.paginationProxy.goToFirstPage();
|
31373 | };
|
31374 |
|
31375 | GridApi.prototype.paginationGoToLastPage = function () {
|
31376 | this.paginationProxy.goToLastPage();
|
31377 | };
|
31378 |
|
31379 | GridApi.prototype.paginationGoToPage = function (page) {
|
31380 | this.paginationProxy.goToPage(page);
|
31381 | };
|
31382 | GridApi.prototype.setRowClass = function (className) {
|
31383 | this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_ROW_CLASS, className);
|
31384 | };
|
31385 | __decorate$18([
|
31386 | Optional('immutableService')
|
31387 | ], GridApi.prototype, "immutableService", void 0);
|
31388 | __decorate$18([
|
31389 | Optional('csvCreator')
|
31390 | ], GridApi.prototype, "csvCreator", void 0);
|
31391 | __decorate$18([
|
31392 | Optional('excelCreator')
|
31393 | ], GridApi.prototype, "excelCreator", void 0);
|
31394 | __decorate$18([
|
31395 | Autowired('rowRenderer')
|
31396 | ], GridApi.prototype, "rowRenderer", void 0);
|
31397 | __decorate$18([
|
31398 | Autowired('navigationService')
|
31399 | ], GridApi.prototype, "navigationService", void 0);
|
31400 | __decorate$18([
|
31401 | Autowired('filterManager')
|
31402 | ], GridApi.prototype, "filterManager", void 0);
|
31403 | __decorate$18([
|
31404 | Autowired('columnModel')
|
31405 | ], GridApi.prototype, "columnModel", void 0);
|
31406 | __decorate$18([
|
31407 | Autowired('selectionService')
|
31408 | ], GridApi.prototype, "selectionService", void 0);
|
31409 | __decorate$18([
|
31410 | Autowired('gridOptionsWrapper')
|
31411 | ], GridApi.prototype, "gridOptionsWrapper", void 0);
|
31412 | __decorate$18([
|
31413 | Autowired('valueService')
|
31414 | ], GridApi.prototype, "valueService", void 0);
|
31415 | __decorate$18([
|
31416 | Autowired('alignedGridsService')
|
31417 | ], GridApi.prototype, "alignedGridsService", void 0);
|
31418 | __decorate$18([
|
31419 | Autowired('eventService')
|
31420 | ], GridApi.prototype, "eventService", void 0);
|
31421 | __decorate$18([
|
31422 | Autowired('pinnedRowModel')
|
31423 | ], GridApi.prototype, "pinnedRowModel", void 0);
|
31424 | __decorate$18([
|
31425 | Autowired('context')
|
31426 | ], GridApi.prototype, "context", void 0);
|
31427 | __decorate$18([
|
31428 | Autowired('rowModel')
|
31429 | ], GridApi.prototype, "rowModel", void 0);
|
31430 | __decorate$18([
|
31431 | Autowired('sortController')
|
31432 | ], GridApi.prototype, "sortController", void 0);
|
31433 | __decorate$18([
|
31434 | Autowired('paginationProxy')
|
31435 | ], GridApi.prototype, "paginationProxy", void 0);
|
31436 | __decorate$18([
|
31437 | Autowired('focusService')
|
31438 | ], GridApi.prototype, "focusService", void 0);
|
31439 | __decorate$18([
|
31440 | Autowired('dragAndDropService')
|
31441 | ], GridApi.prototype, "dragAndDropService", void 0);
|
31442 | __decorate$18([
|
31443 | Optional('rangeService')
|
31444 | ], GridApi.prototype, "rangeService", void 0);
|
31445 | __decorate$18([
|
31446 | Optional('clipboardService')
|
31447 | ], GridApi.prototype, "clipboardService", void 0);
|
31448 | __decorate$18([
|
31449 | Optional('aggFuncService')
|
31450 | ], GridApi.prototype, "aggFuncService", void 0);
|
31451 | __decorate$18([
|
31452 | Autowired('menuFactory')
|
31453 | ], GridApi.prototype, "menuFactory", void 0);
|
31454 | __decorate$18([
|
31455 | Optional('contextMenuFactory')
|
31456 | ], GridApi.prototype, "contextMenuFactory", void 0);
|
31457 | __decorate$18([
|
31458 | Autowired('valueCache')
|
31459 | ], GridApi.prototype, "valueCache", void 0);
|
31460 | __decorate$18([
|
31461 | Autowired('animationFrameService')
|
31462 | ], GridApi.prototype, "animationFrameService", void 0);
|
31463 | __decorate$18([
|
31464 | Optional('statusBarService')
|
31465 | ], GridApi.prototype, "statusBarService", void 0);
|
31466 | __decorate$18([
|
31467 | Optional('chartService')
|
31468 | ], GridApi.prototype, "chartService", void 0);
|
31469 | __decorate$18([
|
31470 | Optional('undoRedoService')
|
31471 | ], GridApi.prototype, "undoRedoService", void 0);
|
31472 | __decorate$18([
|
31473 | Optional('rowNodeBlockLoader')
|
31474 | ], GridApi.prototype, "rowNodeBlockLoader", void 0);
|
31475 | __decorate$18([
|
31476 | Optional('ssrmTransactionManager')
|
31477 | ], GridApi.prototype, "serverSideTransactionManager", void 0);
|
31478 | __decorate$18([
|
31479 | Autowired('ctrlsService')
|
31480 | ], GridApi.prototype, "ctrlsService", void 0);
|
31481 | __decorate$18([
|
31482 | Optional('frameworkComponentWrapper')
|
31483 | ], GridApi.prototype, "frameworkComponentWrapper", void 0);
|
31484 | __decorate$18([
|
31485 | PostConstruct
|
31486 | ], GridApi.prototype, "init", null);
|
31487 | __decorate$18([
|
31488 | PreDestroy
|
31489 | ], GridApi.prototype, "cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid", null);
|
31490 | GridApi = __decorate$18([
|
31491 | Bean('gridApi')
|
31492 | ], GridApi);
|
31493 | return GridApi;
|
31494 | }());
|
31495 |
|
31496 |
|
31497 |
|
31498 |
|
31499 |
|
31500 |
|
31501 |
|
31502 | var __extends$1l = (undefined && undefined.__extends) || (function () {
|
31503 | var extendStatics = function (d, b) {
|
31504 | extendStatics = Object.setPrototypeOf ||
|
31505 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
31506 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
31507 | return extendStatics(d, b);
|
31508 | };
|
31509 | return function (d, b) {
|
31510 | extendStatics(d, b);
|
31511 | function __() { this.constructor = d; }
|
31512 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
31513 | };
|
31514 | })();
|
31515 | var __decorate$19 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
31516 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
31517 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
31518 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
31519 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
31520 | };
|
31521 | var SetLeftFeature = (function (_super) {
|
31522 | __extends$1l(SetLeftFeature, _super);
|
31523 | function SetLeftFeature(columnOrGroup, eCell, beans, colsSpanning) {
|
31524 | var _this = _super.call(this) || this;
|
31525 | _this.columnOrGroup = columnOrGroup;
|
31526 | _this.eCell = eCell;
|
31527 | _this.ariaEl = _this.eCell.querySelector('[role=columnheader]') || _this.eCell;
|
31528 | _this.colsSpanning = colsSpanning;
|
31529 | _this.beans = beans;
|
31530 | return _this;
|
31531 | }
|
31532 | SetLeftFeature.prototype.setColsSpanning = function (colsSpanning) {
|
31533 | this.colsSpanning = colsSpanning;
|
31534 | this.onLeftChanged();
|
31535 | };
|
31536 | SetLeftFeature.prototype.getColumnOrGroup = function () {
|
31537 | if (this.beans.gridOptionsWrapper.isEnableRtl() && this.colsSpanning) {
|
31538 | return last(this.colsSpanning);
|
31539 | }
|
31540 | return this.columnOrGroup;
|
31541 | };
|
31542 | SetLeftFeature.prototype.postConstruct = function () {
|
31543 | this.addManagedListener(this.columnOrGroup, Column.EVENT_LEFT_CHANGED, this.onLeftChanged.bind(this));
|
31544 | this.setLeftFirstTime();
|
31545 |
|
31546 |
|
31547 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onLeftChanged.bind(this));
|
31548 |
|
31549 | this.addManagedListener(this.beans.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, this.onLeftChanged.bind(this));
|
31550 | };
|
31551 | SetLeftFeature.prototype.setLeftFirstTime = function () {
|
31552 | var suppressMoveAnimation = this.beans.gridOptionsWrapper.isSuppressColumnMoveAnimation();
|
31553 | var oldLeftExists = exists(this.columnOrGroup.getOldLeft());
|
31554 | var animateColumnMove = this.beans.columnAnimationService.isActive() && oldLeftExists && !suppressMoveAnimation;
|
31555 | if (animateColumnMove) {
|
31556 | this.animateInLeft();
|
31557 | }
|
31558 | else {
|
31559 | this.onLeftChanged();
|
31560 | }
|
31561 | };
|
31562 | SetLeftFeature.prototype.animateInLeft = function () {
|
31563 | var _this = this;
|
31564 | var colOrGroup = this.getColumnOrGroup();
|
31565 | var left = colOrGroup.getLeft();
|
31566 | var oldLeft = colOrGroup.getOldLeft();
|
31567 | var oldActualLeft = this.modifyLeftForPrintLayout(colOrGroup, oldLeft);
|
31568 | var actualLeft = this.modifyLeftForPrintLayout(colOrGroup, left);
|
31569 | this.setLeft(oldActualLeft);
|
31570 |
|
31571 |
|
31572 |
|
31573 |
|
31574 |
|
31575 | this.actualLeft = actualLeft;
|
31576 | this.beans.columnAnimationService.executeNextVMTurn(function () {
|
31577 |
|
31578 | if (_this.actualLeft === actualLeft) {
|
31579 | _this.setLeft(actualLeft);
|
31580 | }
|
31581 | });
|
31582 | };
|
31583 | SetLeftFeature.prototype.onLeftChanged = function () {
|
31584 | var colOrGroup = this.getColumnOrGroup();
|
31585 | var left = colOrGroup.getLeft();
|
31586 | this.actualLeft = this.modifyLeftForPrintLayout(colOrGroup, left);
|
31587 | this.setLeft(this.actualLeft);
|
31588 | };
|
31589 | SetLeftFeature.prototype.modifyLeftForPrintLayout = function (colOrGroup, leftPosition) {
|
31590 | var printLayout = this.beans.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
|
31591 | if (!printLayout) {
|
31592 | return leftPosition;
|
31593 | }
|
31594 | if (colOrGroup.getPinned() === Constants.PINNED_LEFT) {
|
31595 | return leftPosition;
|
31596 | }
|
31597 | var leftWidth = this.beans.columnModel.getDisplayedColumnsLeftWidth();
|
31598 | if (colOrGroup.getPinned() === Constants.PINNED_RIGHT) {
|
31599 | var bodyWidth = this.beans.columnModel.getBodyContainerWidth();
|
31600 | return leftWidth + bodyWidth + leftPosition;
|
31601 | }
|
31602 |
|
31603 | return leftWidth + leftPosition;
|
31604 | };
|
31605 | SetLeftFeature.prototype.setLeft = function (value) {
|
31606 |
|
31607 |
|
31608 |
|
31609 | if (exists(value)) {
|
31610 | this.eCell.style.left = value + "px";
|
31611 | }
|
31612 | var indexColumn;
|
31613 | if (this.columnOrGroup instanceof Column) {
|
31614 | indexColumn = this.columnOrGroup;
|
31615 | }
|
31616 | else {
|
31617 | var columnGroup = this.columnOrGroup;
|
31618 | var children = columnGroup.getLeafColumns();
|
31619 | if (!children.length) {
|
31620 | return;
|
31621 | }
|
31622 | if (children.length > 1) {
|
31623 | setAriaColSpan(this.ariaEl, children.length);
|
31624 | }
|
31625 | indexColumn = children[0];
|
31626 | }
|
31627 | var index = this.beans.columnModel.getAriaColumnIndex(indexColumn);
|
31628 | setAriaColIndex(this.ariaEl, index);
|
31629 | };
|
31630 | __decorate$19([
|
31631 | PostConstruct
|
31632 | ], SetLeftFeature.prototype, "postConstruct", null);
|
31633 | return SetLeftFeature;
|
31634 | }(BeanStub));
|
31635 |
|
31636 |
|
31637 |
|
31638 |
|
31639 |
|
31640 |
|
31641 |
|
31642 | var __extends$1m = (undefined && undefined.__extends) || (function () {
|
31643 | var extendStatics = function (d, b) {
|
31644 | extendStatics = Object.setPrototypeOf ||
|
31645 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
31646 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
31647 | return extendStatics(d, b);
|
31648 | };
|
31649 | return function (d, b) {
|
31650 | extendStatics(d, b);
|
31651 | function __() { this.constructor = d; }
|
31652 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
31653 | };
|
31654 | })();
|
31655 | var __decorate$1a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
31656 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
31657 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
31658 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
31659 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
31660 | };
|
31661 | var HoverFeature = (function (_super) {
|
31662 | __extends$1m(HoverFeature, _super);
|
31663 | function HoverFeature(columns, element) {
|
31664 | var _this = _super.call(this) || this;
|
31665 | _this.columns = columns;
|
31666 | _this.element = element;
|
31667 | return _this;
|
31668 | }
|
31669 | HoverFeature.prototype.postConstruct = function () {
|
31670 | if (this.gridOptionsWrapper.isColumnHoverHighlight()) {
|
31671 | this.addMouseHoverListeners();
|
31672 | }
|
31673 | };
|
31674 | HoverFeature.prototype.addMouseHoverListeners = function () {
|
31675 | this.addManagedListener(this.element, 'mouseout', this.onMouseOut.bind(this));
|
31676 | this.addManagedListener(this.element, 'mouseover', this.onMouseOver.bind(this));
|
31677 | };
|
31678 | HoverFeature.prototype.onMouseOut = function () {
|
31679 | this.columnHoverService.clearMouseOver();
|
31680 | };
|
31681 | HoverFeature.prototype.onMouseOver = function () {
|
31682 | this.columnHoverService.setMouseOver(this.columns);
|
31683 | };
|
31684 | __decorate$1a([
|
31685 | Autowired('columnHoverService')
|
31686 | ], HoverFeature.prototype, "columnHoverService", void 0);
|
31687 | __decorate$1a([
|
31688 | PostConstruct
|
31689 | ], HoverFeature.prototype, "postConstruct", null);
|
31690 | return HoverFeature;
|
31691 | }(BeanStub));
|
31692 |
|
31693 |
|
31694 |
|
31695 |
|
31696 |
|
31697 |
|
31698 |
|
31699 | var __extends$1n = (undefined && undefined.__extends) || (function () {
|
31700 | var extendStatics = function (d, b) {
|
31701 | extendStatics = Object.setPrototypeOf ||
|
31702 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
31703 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
31704 | return extendStatics(d, b);
|
31705 | };
|
31706 | return function (d, b) {
|
31707 | extendStatics(d, b);
|
31708 | function __() { this.constructor = d; }
|
31709 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
31710 | };
|
31711 | })();
|
31712 | var __decorate$1b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
31713 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
31714 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
31715 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
31716 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
31717 | };
|
31718 | var HeaderFilterCellCtrl = (function (_super) {
|
31719 | __extends$1n(HeaderFilterCellCtrl, _super);
|
31720 | function HeaderFilterCellCtrl(column, parentRowCtrl) {
|
31721 | var _this = _super.call(this, column, parentRowCtrl) || this;
|
31722 | _this.column = column;
|
31723 | return _this;
|
31724 | }
|
31725 | HeaderFilterCellCtrl.prototype.setComp = function (comp, eGui, eButtonShowMainFilter, eFloatingFilterBody) {
|
31726 | _super.prototype.setGui.call(this, eGui);
|
31727 | this.comp = comp;
|
31728 | this.eButtonShowMainFilter = eButtonShowMainFilter;
|
31729 | this.eFloatingFilterBody = eFloatingFilterBody;
|
31730 | var colDef = this.column.getColDef();
|
31731 | var filterExists = !!colDef.filter || !!colDef.filterFramework;
|
31732 | var floatingFilterExists = !!colDef.floatingFilter;
|
31733 | this.active = filterExists && floatingFilterExists;
|
31734 | this.setupWidth();
|
31735 | this.setupLeft();
|
31736 | this.setupHover();
|
31737 | this.setupFocus();
|
31738 | this.setupUserComp();
|
31739 | this.setupSyncWithFilter();
|
31740 | this.setupUi();
|
31741 | this.addManagedListener(this.eButtonShowMainFilter, 'click', this.showParentFilter.bind(this));
|
31742 | };
|
31743 | HeaderFilterCellCtrl.prototype.setupUi = function () {
|
31744 | this.comp.addOrRemoveButtonWrapperCssClass('ag-hidden', !this.active || this.suppressFilterButton);
|
31745 | if (!this.active) {
|
31746 | return;
|
31747 | }
|
31748 | this.comp.addOrRemoveBodyCssClass('ag-floating-filter-full-body', this.suppressFilterButton);
|
31749 | this.comp.addOrRemoveBodyCssClass('ag-floating-filter-body', !this.suppressFilterButton);
|
31750 | var eMenuIcon = createIconNoSpan('filter', this.gridOptionsWrapper, this.column);
|
31751 | if (eMenuIcon) {
|
31752 | this.eButtonShowMainFilter.appendChild(eMenuIcon);
|
31753 | }
|
31754 | };
|
31755 | HeaderFilterCellCtrl.prototype.setupFocus = function () {
|
31756 | this.createManagedBean(new ManagedFocusFeature(this.eGui, {
|
31757 | shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this),
|
31758 | onTabKeyDown: this.onTabKeyDown.bind(this),
|
31759 | handleKeyDown: this.handleKeyDown.bind(this),
|
31760 | onFocusIn: this.onFocusIn.bind(this)
|
31761 | }));
|
31762 | };
|
31763 | HeaderFilterCellCtrl.prototype.onTabKeyDown = function (e) {
|
31764 | var eDocument = this.gridOptionsWrapper.getDocument();
|
31765 | var activeEl = eDocument.activeElement;
|
31766 | var wrapperHasFocus = activeEl === this.eGui;
|
31767 | if (wrapperHasFocus) {
|
31768 | return;
|
31769 | }
|
31770 | var nextFocusableEl = this.focusService.findNextFocusableElement(this.eGui, null, e.shiftKey);
|
31771 | if (nextFocusableEl) {
|
31772 | this.beans.headerNavigationService.scrollToColumn(this.column);
|
31773 | e.preventDefault();
|
31774 | nextFocusableEl.focus();
|
31775 | return;
|
31776 | }
|
31777 | var nextFocusableColumn = this.findNextColumnWithFloatingFilter(e.shiftKey);
|
31778 | if (!nextFocusableColumn) {
|
31779 | return;
|
31780 | }
|
31781 | if (this.focusService.focusHeaderPosition({
|
31782 | headerPosition: {
|
31783 | headerRowIndex: this.getParentRowCtrl().getRowIndex(),
|
31784 | column: nextFocusableColumn
|
31785 | },
|
31786 | event: e
|
31787 | })) {
|
31788 | e.preventDefault();
|
31789 | }
|
31790 | };
|
31791 | HeaderFilterCellCtrl.prototype.findNextColumnWithFloatingFilter = function (backwards) {
|
31792 | var columModel = this.beans.columnModel;
|
31793 | var nextCol = this.column;
|
31794 | do {
|
31795 | nextCol = backwards
|
31796 | ? columModel.getDisplayedColBefore(nextCol)
|
31797 | : columModel.getDisplayedColAfter(nextCol);
|
31798 | if (!nextCol) {
|
31799 | break;
|
31800 | }
|
31801 | } while (!nextCol.getColDef().filter || !nextCol.getColDef().floatingFilter);
|
31802 | return nextCol;
|
31803 | };
|
31804 | HeaderFilterCellCtrl.prototype.handleKeyDown = function (e) {
|
31805 | var eDocument = this.gridOptionsWrapper.getDocument();
|
31806 | var activeEl = eDocument.activeElement;
|
31807 | var wrapperHasFocus = activeEl === this.eGui;
|
31808 | switch (e.key) {
|
31809 | case KeyCode.UP:
|
31810 | case KeyCode.DOWN:
|
31811 | if (!wrapperHasFocus) {
|
31812 | e.preventDefault();
|
31813 | }
|
31814 | case KeyCode.LEFT:
|
31815 | case KeyCode.RIGHT:
|
31816 | if (wrapperHasFocus) {
|
31817 | return;
|
31818 | }
|
31819 | e.stopPropagation();
|
31820 | case KeyCode.ENTER:
|
31821 | if (wrapperHasFocus) {
|
31822 | if (this.focusService.focusInto(this.eGui)) {
|
31823 | e.preventDefault();
|
31824 | }
|
31825 | }
|
31826 | break;
|
31827 | case KeyCode.ESCAPE:
|
31828 | if (!wrapperHasFocus) {
|
31829 | this.eGui.focus();
|
31830 | }
|
31831 | }
|
31832 | };
|
31833 | HeaderFilterCellCtrl.prototype.onFocusIn = function (e) {
|
31834 | var isRelatedWithin = this.eGui.contains(e.relatedTarget);
|
31835 |
|
31836 |
|
31837 | if (isRelatedWithin) {
|
31838 | return;
|
31839 | }
|
31840 | var notFromHeaderWrapper = !!e.relatedTarget && !e.relatedTarget.classList.contains('ag-floating-filter');
|
31841 | var fromWithinHeader = !!e.relatedTarget && isElementChildOfClass(e.relatedTarget, 'ag-floating-filter');
|
31842 | if (notFromHeaderWrapper && fromWithinHeader && e.target === this.eGui) {
|
31843 | var lastFocusEvent = this.lastFocusEvent;
|
31844 | var fromTab = !!(lastFocusEvent && lastFocusEvent.key === KeyCode.TAB);
|
31845 | if (lastFocusEvent && fromTab) {
|
31846 | var shouldFocusLast = lastFocusEvent.shiftKey;
|
31847 | this.focusService.focusInto(this.eGui, shouldFocusLast);
|
31848 | }
|
31849 | }
|
31850 | var rowIndex = this.getRowIndex();
|
31851 | this.beans.focusService.setFocusedHeader(rowIndex, this.column);
|
31852 | };
|
31853 | HeaderFilterCellCtrl.prototype.setupHover = function () {
|
31854 | var _this = this;
|
31855 | this.createManagedBean(new HoverFeature([this.column], this.eGui));
|
31856 | var listener = function () {
|
31857 | if (!_this.gridOptionsWrapper.isColumnHoverHighlight()) {
|
31858 | return;
|
31859 | }
|
31860 | var hovered = _this.columnHoverService.isHovered(_this.column);
|
31861 | _this.comp.addOrRemoveCssClass('ag-column-hover', hovered);
|
31862 | };
|
31863 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, listener);
|
31864 | listener();
|
31865 | };
|
31866 | HeaderFilterCellCtrl.prototype.setupLeft = function () {
|
31867 | var setLeftFeature = new SetLeftFeature(this.column, this.eGui, this.beans);
|
31868 | this.createManagedBean(setLeftFeature);
|
31869 | };
|
31870 | HeaderFilterCellCtrl.prototype.setupUserComp = function () {
|
31871 | var _this = this;
|
31872 | if (!this.active) {
|
31873 | return;
|
31874 | }
|
31875 | var colDef = this.column.getColDef();
|
31876 | var filterParams = this.filterManager.createFilterParams(this.column, colDef);
|
31877 | var finalFilterParams = this.userComponentFactory.mergeParamsWithApplicationProvidedParams(colDef, FilterComponent, filterParams);
|
31878 | var defaultFloatingFilterType = this.userComponentFactory.getDefaultFloatingFilterType(colDef);
|
31879 | if (defaultFloatingFilterType == null) {
|
31880 | defaultFloatingFilterType = 'agReadOnlyFloatingFilter';
|
31881 | }
|
31882 | var params = {
|
31883 | column: this.column,
|
31884 | filterParams: finalFilterParams,
|
31885 | currentParentModel: function () { return _this.currentParentModel(); },
|
31886 | parentFilterInstance: function (cb) { return _this.parentFilterInstance(cb); },
|
31887 | showParentFilter: function () { return _this.showParentFilter(); },
|
31888 | suppressFilterButton: false
|
31889 | };
|
31890 |
|
31891 |
|
31892 | this.suppressFilterButton = colDef.floatingFilterComponentParams ? !!colDef.floatingFilterComponentParams.suppressFilterButton : false;
|
31893 | var compDetails = this.userComponentFactory.getFloatingFilterCompDetails(colDef, params, defaultFloatingFilterType);
|
31894 | if (compDetails) {
|
31895 | this.comp.setCompDetails(compDetails);
|
31896 | }
|
31897 | };
|
31898 | HeaderFilterCellCtrl.prototype.currentParentModel = function () {
|
31899 | var filterComponent = this.getFilterComponent(false);
|
31900 | return filterComponent ? filterComponent.resolveNow(null, function (filter) { return filter && filter.getModel(); }) : null;
|
31901 | };
|
31902 | HeaderFilterCellCtrl.prototype.getFilterComponent = function (createIfDoesNotExist) {
|
31903 | if (createIfDoesNotExist === void 0) { createIfDoesNotExist = true; }
|
31904 | return this.filterManager.getFilterComponent(this.column, 'NO_UI', createIfDoesNotExist);
|
31905 | };
|
31906 | HeaderFilterCellCtrl.prototype.parentFilterInstance = function (callback) {
|
31907 | var filterComponent = this.getFilterComponent();
|
31908 | if (filterComponent == null) {
|
31909 | return;
|
31910 | }
|
31911 | filterComponent.then(function (instance) {
|
31912 | callback(unwrapUserComp(instance));
|
31913 | });
|
31914 | };
|
31915 | HeaderFilterCellCtrl.prototype.showParentFilter = function () {
|
31916 | var eventSource = this.suppressFilterButton ? this.eFloatingFilterBody : this.eButtonShowMainFilter;
|
31917 | this.menuFactory.showMenuAfterButtonClick(this.column, eventSource, 'floatingFilter', 'filterMenuTab', ['filterMenuTab']);
|
31918 | };
|
31919 | HeaderFilterCellCtrl.prototype.setupSyncWithFilter = function () {
|
31920 | var _this = this;
|
31921 | if (!this.active) {
|
31922 | return;
|
31923 | }
|
31924 | var syncWithFilter = function (filterChangedEvent) {
|
31925 | var compPromise = _this.comp.getFloatingFilterComp();
|
31926 | if (!compPromise) {
|
31927 | return;
|
31928 | }
|
31929 | var parentModel = _this.currentParentModel();
|
31930 | compPromise.then(function (comp) {
|
31931 | if (comp) {
|
31932 | comp.onParentModelChanged(parentModel, filterChangedEvent);
|
31933 | }
|
31934 | });
|
31935 | };
|
31936 | this.addManagedListener(this.column, Column.EVENT_FILTER_CHANGED, syncWithFilter);
|
31937 | if (this.filterManager.isFilterActive(this.column)) {
|
31938 | syncWithFilter(null);
|
31939 | }
|
31940 | };
|
31941 | HeaderFilterCellCtrl.prototype.setupWidth = function () {
|
31942 | var _this = this;
|
31943 | var listener = function () {
|
31944 | var width = _this.column.getActualWidth() + "px";
|
31945 | _this.comp.setWidth(width);
|
31946 | };
|
31947 | this.addManagedListener(this.column, Column.EVENT_WIDTH_CHANGED, listener);
|
31948 | listener();
|
31949 | };
|
31950 | __decorate$1b([
|
31951 | Autowired('userComponentFactory')
|
31952 | ], HeaderFilterCellCtrl.prototype, "userComponentFactory", void 0);
|
31953 | __decorate$1b([
|
31954 | Autowired('filterManager')
|
31955 | ], HeaderFilterCellCtrl.prototype, "filterManager", void 0);
|
31956 | __decorate$1b([
|
31957 | Autowired('columnHoverService')
|
31958 | ], HeaderFilterCellCtrl.prototype, "columnHoverService", void 0);
|
31959 | __decorate$1b([
|
31960 | Autowired('gridApi')
|
31961 | ], HeaderFilterCellCtrl.prototype, "gridApi", void 0);
|
31962 | __decorate$1b([
|
31963 | Autowired('menuFactory')
|
31964 | ], HeaderFilterCellCtrl.prototype, "menuFactory", void 0);
|
31965 | __decorate$1b([
|
31966 | Autowired('beans')
|
31967 | ], HeaderFilterCellCtrl.prototype, "beans", void 0);
|
31968 | return HeaderFilterCellCtrl;
|
31969 | }(AbstractHeaderCellCtrl));
|
31970 |
|
31971 |
|
31972 |
|
31973 |
|
31974 |
|
31975 |
|
31976 |
|
31977 | var __extends$1o = (undefined && undefined.__extends) || (function () {
|
31978 | var extendStatics = function (d, b) {
|
31979 | extendStatics = Object.setPrototypeOf ||
|
31980 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
31981 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
31982 | return extendStatics(d, b);
|
31983 | };
|
31984 | return function (d, b) {
|
31985 | extendStatics(d, b);
|
31986 | function __() { this.constructor = d; }
|
31987 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
31988 | };
|
31989 | })();
|
31990 | var __decorate$1c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
31991 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
31992 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
31993 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
31994 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
31995 | };
|
31996 | var ResizeFeature = (function (_super) {
|
31997 | __extends$1o(ResizeFeature, _super);
|
31998 | function ResizeFeature(pinned, column, eResize, comp, ctrl) {
|
31999 | var _this = _super.call(this) || this;
|
32000 | _this.pinned = pinned;
|
32001 | _this.column = column;
|
32002 | _this.eResize = eResize;
|
32003 | _this.comp = comp;
|
32004 | _this.ctrl = ctrl;
|
32005 | return _this;
|
32006 | }
|
32007 | ResizeFeature.prototype.postConstruct = function () {
|
32008 | var _this = this;
|
32009 | var colDef = this.column.getColDef();
|
32010 | var destroyResizeFuncs = [];
|
32011 | var canResize;
|
32012 | var canAutosize;
|
32013 | var addResize = function () {
|
32014 | setDisplayed(_this.eResize, canResize);
|
32015 | if (!canResize) {
|
32016 | return;
|
32017 | }
|
32018 | var finishedWithResizeFunc = _this.horizontalResizeService.addResizeBar({
|
32019 | eResizeBar: _this.eResize,
|
32020 | onResizeStart: _this.onResizeStart.bind(_this),
|
32021 | onResizing: _this.onResizing.bind(_this, false),
|
32022 | onResizeEnd: _this.onResizing.bind(_this, true)
|
32023 | });
|
32024 | destroyResizeFuncs.push(finishedWithResizeFunc);
|
32025 | if (canAutosize) {
|
32026 | var skipHeaderOnAutoSize_1 = _this.gridOptionsWrapper.isSkipHeaderOnAutoSize();
|
32027 | var autoSizeColListener_1 = function () {
|
32028 | _this.columnModel.autoSizeColumn(_this.column, skipHeaderOnAutoSize_1, "uiColumnResized");
|
32029 | };
|
32030 | _this.eResize.addEventListener('dblclick', autoSizeColListener_1);
|
32031 | var touchListener_1 = new TouchListener(_this.eResize);
|
32032 | touchListener_1.addEventListener(TouchListener.EVENT_DOUBLE_TAP, autoSizeColListener_1);
|
32033 | _this.addDestroyFunc(function () {
|
32034 | _this.eResize.removeEventListener('dblclick', autoSizeColListener_1);
|
32035 | touchListener_1.removeEventListener(TouchListener.EVENT_DOUBLE_TAP, autoSizeColListener_1);
|
32036 | touchListener_1.destroy();
|
32037 | });
|
32038 | }
|
32039 | };
|
32040 | var removeResize = function () {
|
32041 | destroyResizeFuncs.forEach(function (f) { return f(); });
|
32042 | destroyResizeFuncs.length = 0;
|
32043 | };
|
32044 | var refresh = function () {
|
32045 | var resize = _this.column.isResizable();
|
32046 | var autoSize = !_this.gridOptionsWrapper.isSuppressAutoSize() && !colDef.suppressAutoSize;
|
32047 | var propertyChange = resize !== canResize || autoSize !== canAutosize;
|
32048 | if (propertyChange) {
|
32049 | canResize = resize;
|
32050 | canAutosize = autoSize;
|
32051 | removeResize();
|
32052 | addResize();
|
32053 | }
|
32054 | };
|
32055 | refresh();
|
32056 | this.addDestroyFunc(removeResize);
|
32057 | this.ctrl.addRefreshFunction(refresh);
|
32058 | };
|
32059 | ResizeFeature.prototype.onResizing = function (finished, resizeAmount) {
|
32060 | var resizeAmountNormalised = this.normaliseResizeAmount(resizeAmount);
|
32061 | var columnWidths = [{ key: this.column, newWidth: this.resizeStartWidth + resizeAmountNormalised }];
|
32062 | this.columnModel.setColumnWidths(columnWidths, this.resizeWithShiftKey, finished, "uiColumnDragged");
|
32063 | if (finished) {
|
32064 | this.comp.addOrRemoveCssClass('ag-column-resizing', false);
|
32065 | }
|
32066 | };
|
32067 | ResizeFeature.prototype.onResizeStart = function (shiftKey) {
|
32068 | this.resizeStartWidth = this.column.getActualWidth();
|
32069 | this.resizeWithShiftKey = shiftKey;
|
32070 | this.comp.addOrRemoveCssClass('ag-column-resizing', true);
|
32071 | };
|
32072 |
|
32073 |
|
32074 | ResizeFeature.prototype.normaliseResizeAmount = function (dragChange) {
|
32075 | var result = dragChange;
|
32076 | var notPinningLeft = this.pinned !== Constants.PINNED_LEFT;
|
32077 | var pinningRight = this.pinned === Constants.PINNED_RIGHT;
|
32078 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
32079 |
|
32080 | if (notPinningLeft) {
|
32081 | result *= -1;
|
32082 | }
|
32083 | }
|
32084 | else {
|
32085 |
|
32086 | if (pinningRight) {
|
32087 | result *= -1;
|
32088 | }
|
32089 | }
|
32090 | return result;
|
32091 | };
|
32092 | __decorate$1c([
|
32093 | Autowired('horizontalResizeService')
|
32094 | ], ResizeFeature.prototype, "horizontalResizeService", void 0);
|
32095 | __decorate$1c([
|
32096 | Autowired('columnModel')
|
32097 | ], ResizeFeature.prototype, "columnModel", void 0);
|
32098 | __decorate$1c([
|
32099 | PostConstruct
|
32100 | ], ResizeFeature.prototype, "postConstruct", null);
|
32101 | return ResizeFeature;
|
32102 | }(BeanStub));
|
32103 |
|
32104 |
|
32105 |
|
32106 |
|
32107 |
|
32108 |
|
32109 |
|
32110 | var __extends$1p = (undefined && undefined.__extends) || (function () {
|
32111 | var extendStatics = function (d, b) {
|
32112 | extendStatics = Object.setPrototypeOf ||
|
32113 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
32114 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
32115 | return extendStatics(d, b);
|
32116 | };
|
32117 | return function (d, b) {
|
32118 | extendStatics(d, b);
|
32119 | function __() { this.constructor = d; }
|
32120 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32121 | };
|
32122 | })();
|
32123 | var AgCheckbox = (function (_super) {
|
32124 | __extends$1p(AgCheckbox, _super);
|
32125 | function AgCheckbox(config, className, inputType) {
|
32126 | if (className === void 0) { className = 'ag-checkbox'; }
|
32127 | if (inputType === void 0) { inputType = 'checkbox'; }
|
32128 | var _this = _super.call(this, config, className, inputType) || this;
|
32129 | _this.labelAlignment = 'right';
|
32130 | _this.selected = false;
|
32131 | _this.readOnly = false;
|
32132 | _this.passive = false;
|
32133 | return _this;
|
32134 | }
|
32135 | AgCheckbox.prototype.addInputListeners = function () {
|
32136 | this.addManagedListener(this.eInput, 'click', this.onCheckboxClick.bind(this));
|
32137 | this.addManagedListener(this.eLabel, 'click', this.toggle.bind(this));
|
32138 | };
|
32139 | AgCheckbox.prototype.getNextValue = function () {
|
32140 | return this.selected === undefined ? true : !this.selected;
|
32141 | };
|
32142 | AgCheckbox.prototype.setPassive = function (passive) {
|
32143 | this.passive = passive;
|
32144 | };
|
32145 | AgCheckbox.prototype.isReadOnly = function () {
|
32146 | return this.readOnly;
|
32147 | };
|
32148 | AgCheckbox.prototype.setReadOnly = function (readOnly) {
|
32149 | this.eWrapper.classList.toggle('ag-disabled', readOnly);
|
32150 | this.eInput.disabled = readOnly;
|
32151 | this.readOnly = readOnly;
|
32152 | };
|
32153 | AgCheckbox.prototype.setDisabled = function (disabled) {
|
32154 | this.eWrapper.classList.toggle('ag-disabled', disabled);
|
32155 | return _super.prototype.setDisabled.call(this, disabled);
|
32156 | };
|
32157 | AgCheckbox.prototype.toggle = function () {
|
32158 | if (this.eInput.disabled) {
|
32159 | return;
|
32160 | }
|
32161 | var previousValue = this.isSelected();
|
32162 | var nextValue = this.getNextValue();
|
32163 | if (this.passive) {
|
32164 | this.dispatchChange(nextValue, previousValue);
|
32165 | }
|
32166 | else {
|
32167 | this.setValue(nextValue);
|
32168 | }
|
32169 | };
|
32170 | AgCheckbox.prototype.getValue = function () {
|
32171 | return this.isSelected();
|
32172 | };
|
32173 | AgCheckbox.prototype.setValue = function (value, silent) {
|
32174 | this.refreshSelectedClass(value);
|
32175 | this.setSelected(value, silent);
|
32176 | return this;
|
32177 | };
|
32178 | AgCheckbox.prototype.setName = function (name) {
|
32179 | var input = this.getInputElement();
|
32180 | input.name = name;
|
32181 | return this;
|
32182 | };
|
32183 | AgCheckbox.prototype.isSelected = function () {
|
32184 | return this.selected;
|
32185 | };
|
32186 | AgCheckbox.prototype.setSelected = function (selected, silent) {
|
32187 | if (this.isSelected() === selected) {
|
32188 | return;
|
32189 | }
|
32190 | this.previousValue = this.isSelected();
|
32191 | selected = this.selected = typeof selected === 'boolean' ? selected : undefined;
|
32192 | this.eInput.checked = selected;
|
32193 | this.eInput.indeterminate = selected === undefined;
|
32194 | if (!silent) {
|
32195 | this.dispatchChange(this.selected, this.previousValue);
|
32196 | }
|
32197 | };
|
32198 | AgCheckbox.prototype.dispatchChange = function (selected, previousValue, event) {
|
32199 | this.dispatchEvent({ type: AgCheckbox.EVENT_CHANGED, selected: selected, previousValue: previousValue, event: event });
|
32200 | var input = this.getInputElement();
|
32201 | var checkboxChangedEvent = {
|
32202 | type: Events.EVENT_CHECKBOX_CHANGED,
|
32203 | id: input.id,
|
32204 | name: input.name,
|
32205 | selected: selected,
|
32206 | previousValue: previousValue
|
32207 | };
|
32208 | this.eventService.dispatchEvent(checkboxChangedEvent);
|
32209 | };
|
32210 | AgCheckbox.prototype.onCheckboxClick = function (e) {
|
32211 | if (this.passive || this.eInput.disabled) {
|
32212 | return;
|
32213 | }
|
32214 | var previousValue = this.isSelected();
|
32215 | var selected = this.selected = e.target.checked;
|
32216 | this.refreshSelectedClass(selected);
|
32217 | this.dispatchChange(selected, previousValue, e);
|
32218 | };
|
32219 | AgCheckbox.prototype.refreshSelectedClass = function (value) {
|
32220 | this.eWrapper.classList.toggle('ag-checked', value === true);
|
32221 | this.eWrapper.classList.toggle('ag-indeterminate', value == null);
|
32222 | };
|
32223 | return AgCheckbox;
|
32224 | }(AgAbstractInputField));
|
32225 |
|
32226 |
|
32227 |
|
32228 |
|
32229 |
|
32230 |
|
32231 |
|
32232 | var __extends$1q = (undefined && undefined.__extends) || (function () {
|
32233 | var extendStatics = function (d, b) {
|
32234 | extendStatics = Object.setPrototypeOf ||
|
32235 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
32236 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
32237 | return extendStatics(d, b);
|
32238 | };
|
32239 | return function (d, b) {
|
32240 | extendStatics(d, b);
|
32241 | function __() { this.constructor = d; }
|
32242 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32243 | };
|
32244 | })();
|
32245 | var __decorate$1d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
32246 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
32247 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
32248 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
32249 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
32250 | };
|
32251 | var SelectAllFeature = (function (_super) {
|
32252 | __extends$1q(SelectAllFeature, _super);
|
32253 | function SelectAllFeature(column) {
|
32254 | var _this = _super.call(this) || this;
|
32255 | _this.cbSelectAllVisible = false;
|
32256 | _this.processingEventFromCheckbox = false;
|
32257 | _this.column = column;
|
32258 | var colDef = column.getColDef();
|
32259 | _this.filteredOnly = colDef ? !!colDef.headerCheckboxSelectionFilteredOnly : false;
|
32260 | return _this;
|
32261 | }
|
32262 | SelectAllFeature.prototype.onSpaceKeyPressed = function (e) {
|
32263 | var checkbox = this.cbSelectAll;
|
32264 | var eDocument = this.gridOptionsWrapper.getDocument();
|
32265 | if (checkbox.isDisplayed() && !checkbox.getGui().contains(eDocument.activeElement)) {
|
32266 | e.preventDefault();
|
32267 | checkbox.setValue(!checkbox.getValue());
|
32268 | }
|
32269 | };
|
32270 | SelectAllFeature.prototype.getCheckboxGui = function () {
|
32271 | return this.cbSelectAll.getGui();
|
32272 | };
|
32273 | SelectAllFeature.prototype.setComp = function (ctrl) {
|
32274 | this.headerCellCtrl = ctrl;
|
32275 | this.cbSelectAll = this.createManagedBean(new AgCheckbox());
|
32276 | this.cbSelectAll.addCssClass('ag-header-select-all');
|
32277 | setAriaRole(this.cbSelectAll.getGui(), 'presentation');
|
32278 | this.showOrHideSelectAll();
|
32279 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.showOrHideSelectAll.bind(this));
|
32280 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.showOrHideSelectAll.bind(this));
|
32281 | this.addManagedListener(this.eventService, Events.EVENT_SELECTION_CHANGED, this.onSelectionChanged.bind(this));
|
32282 | this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, this.onModelChanged.bind(this));
|
32283 | this.addManagedListener(this.cbSelectAll, AgCheckbox.EVENT_CHANGED, this.onCbSelectAll.bind(this));
|
32284 | this.cbSelectAll.getInputElement().setAttribute('tabindex', '-1');
|
32285 | this.refreshSelectAllLabel();
|
32286 | };
|
32287 | SelectAllFeature.prototype.showOrHideSelectAll = function () {
|
32288 | this.cbSelectAllVisible = this.isCheckboxSelection();
|
32289 | this.cbSelectAll.setDisplayed(this.cbSelectAllVisible);
|
32290 | if (this.cbSelectAllVisible) {
|
32291 |
|
32292 | this.checkRightRowModelType();
|
32293 |
|
32294 | this.updateStateOfCheckbox();
|
32295 | }
|
32296 | this.refreshSelectAllLabel();
|
32297 | };
|
32298 | SelectAllFeature.prototype.onModelChanged = function () {
|
32299 | if (!this.cbSelectAllVisible) {
|
32300 | return;
|
32301 | }
|
32302 | this.updateStateOfCheckbox();
|
32303 | };
|
32304 | SelectAllFeature.prototype.onSelectionChanged = function () {
|
32305 | if (!this.cbSelectAllVisible) {
|
32306 | return;
|
32307 | }
|
32308 | this.updateStateOfCheckbox();
|
32309 | };
|
32310 | SelectAllFeature.prototype.getNextCheckboxState = function (selectionCount) {
|
32311 |
|
32312 | if (selectionCount.selected === 0 && selectionCount.notSelected === 0) {
|
32313 | return false;
|
32314 | }
|
32315 |
|
32316 | if (selectionCount.selected > 0 && selectionCount.notSelected > 0) {
|
32317 | return null;
|
32318 | }
|
32319 |
|
32320 | if (selectionCount.selected > 0) {
|
32321 | return true;
|
32322 | }
|
32323 |
|
32324 | return false;
|
32325 | };
|
32326 | SelectAllFeature.prototype.updateStateOfCheckbox = function () {
|
32327 | if (this.processingEventFromCheckbox) {
|
32328 | return;
|
32329 | }
|
32330 | this.processingEventFromCheckbox = true;
|
32331 | var selectionCount = this.getSelectionCount();
|
32332 | var allSelected = this.getNextCheckboxState(selectionCount);
|
32333 | this.cbSelectAll.setValue(allSelected);
|
32334 | this.refreshSelectAllLabel();
|
32335 | this.processingEventFromCheckbox = false;
|
32336 | };
|
32337 | SelectAllFeature.prototype.refreshSelectAllLabel = function () {
|
32338 | if (!this.cbSelectAllVisible) {
|
32339 | this.headerCellCtrl.setAriaDescriptionProperty('selectAll', null);
|
32340 | }
|
32341 | else {
|
32342 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
32343 | var checked = this.cbSelectAll.getValue();
|
32344 | var ariaStatus = checked ? translate('ariaChecked', 'checked') : translate('ariaUnchecked', 'unchecked');
|
32345 | var ariaLabel = translate('ariaRowSelectAll', 'Press Space to toggle all rows selection');
|
32346 | this.headerCellCtrl.setAriaDescriptionProperty('selectAll', ariaLabel + " (" + ariaStatus + ")");
|
32347 | }
|
32348 | this.headerCellCtrl.refreshAriaDescription();
|
32349 | };
|
32350 | SelectAllFeature.prototype.getSelectionCount = function () {
|
32351 | var _this = this;
|
32352 | var selectedCount = 0;
|
32353 | var notSelectedCount = 0;
|
32354 | var callback = function (node) {
|
32355 | if (_this.gridOptionsWrapper.isGroupSelectsChildren() && node.group) {
|
32356 | return;
|
32357 | }
|
32358 | if (node.isSelected()) {
|
32359 | selectedCount++;
|
32360 | }
|
32361 | else if (!node.selectable) ;
|
32362 | else {
|
32363 | notSelectedCount++;
|
32364 | }
|
32365 | };
|
32366 | if (this.filteredOnly) {
|
32367 | this.gridApi.forEachNodeAfterFilter(callback);
|
32368 | }
|
32369 | else {
|
32370 | this.gridApi.forEachNode(callback);
|
32371 | }
|
32372 | return {
|
32373 | notSelected: notSelectedCount,
|
32374 | selected: selectedCount
|
32375 | };
|
32376 | };
|
32377 | SelectAllFeature.prototype.checkRightRowModelType = function () {
|
32378 | var rowModelType = this.rowModel.getType();
|
32379 | var rowModelMatches = rowModelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
|
32380 | if (!rowModelMatches) {
|
32381 | console.warn("AG Grid: selectAllCheckbox is only available if using normal row model, you are using " + rowModelType);
|
32382 | }
|
32383 | };
|
32384 | SelectAllFeature.prototype.onCbSelectAll = function () {
|
32385 | if (this.processingEventFromCheckbox) {
|
32386 | return;
|
32387 | }
|
32388 | if (!this.cbSelectAllVisible) {
|
32389 | return;
|
32390 | }
|
32391 | var value = this.cbSelectAll.getValue();
|
32392 | if (value) {
|
32393 | this.selectionService.selectAllRowNodes(this.filteredOnly);
|
32394 | }
|
32395 | else {
|
32396 | this.selectionService.deselectAllRowNodes(this.filteredOnly);
|
32397 | }
|
32398 | };
|
32399 | SelectAllFeature.prototype.isCheckboxSelection = function () {
|
32400 | var result = this.column.getColDef().headerCheckboxSelection;
|
32401 | if (typeof result === 'function') {
|
32402 | var func = result;
|
32403 | var params = {
|
32404 | column: this.column,
|
32405 | colDef: this.column.getColDef(),
|
32406 | columnApi: this.columnApi,
|
32407 | api: this.gridApi,
|
32408 | context: this.gridOptionsWrapper.getContext()
|
32409 | };
|
32410 | result = func(params);
|
32411 | }
|
32412 | if (result) {
|
32413 | if (this.gridOptionsWrapper.isRowModelServerSide()) {
|
32414 | console.warn('AG Grid: headerCheckboxSelection is not supported for Server Side Row Model');
|
32415 | return false;
|
32416 | }
|
32417 | if (this.gridOptionsWrapper.isRowModelInfinite()) {
|
32418 | console.warn('AG Grid: headerCheckboxSelection is not supported for Infinite Row Model');
|
32419 | return false;
|
32420 | }
|
32421 | if (this.gridOptionsWrapper.isRowModelViewport()) {
|
32422 | console.warn('AG Grid: headerCheckboxSelection is not supported for Viewport Row Model');
|
32423 | return false;
|
32424 | }
|
32425 |
|
32426 | return true;
|
32427 | }
|
32428 | return false;
|
32429 | };
|
32430 | __decorate$1d([
|
32431 | Autowired('gridApi')
|
32432 | ], SelectAllFeature.prototype, "gridApi", void 0);
|
32433 | __decorate$1d([
|
32434 | Autowired('columnApi')
|
32435 | ], SelectAllFeature.prototype, "columnApi", void 0);
|
32436 | __decorate$1d([
|
32437 | Autowired('rowModel')
|
32438 | ], SelectAllFeature.prototype, "rowModel", void 0);
|
32439 | __decorate$1d([
|
32440 | Autowired('selectionService')
|
32441 | ], SelectAllFeature.prototype, "selectionService", void 0);
|
32442 | return SelectAllFeature;
|
32443 | }(BeanStub));
|
32444 |
|
32445 |
|
32446 |
|
32447 |
|
32448 |
|
32449 |
|
32450 |
|
32451 | var __extends$1r = (undefined && undefined.__extends) || (function () {
|
32452 | var extendStatics = function (d, b) {
|
32453 | extendStatics = Object.setPrototypeOf ||
|
32454 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
32455 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
32456 | return extendStatics(d, b);
|
32457 | };
|
32458 | return function (d, b) {
|
32459 | extendStatics(d, b);
|
32460 | function __() { this.constructor = d; }
|
32461 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32462 | };
|
32463 | })();
|
32464 | var __decorate$1e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
32465 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
32466 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
32467 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
32468 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
32469 | };
|
32470 | var HeaderCellCtrl = (function (_super) {
|
32471 | __extends$1r(HeaderCellCtrl, _super);
|
32472 | function HeaderCellCtrl(column, parentRowCtrl) {
|
32473 | var _this = _super.call(this, column, parentRowCtrl) || this;
|
32474 | _this.refreshFunctions = [];
|
32475 | _this.userHeaderClasses = new Set();
|
32476 | _this.ariaDescriptionProperties = new Map();
|
32477 | _this.column = column;
|
32478 | return _this;
|
32479 | }
|
32480 | HeaderCellCtrl.prototype.setComp = function (comp, eGui, eResize) {
|
32481 | var _this = this;
|
32482 | _super.prototype.setGui.call(this, eGui);
|
32483 | this.comp = comp;
|
32484 | this.colDefVersion = this.columnModel.getColDefVersion();
|
32485 | this.updateState();
|
32486 | this.setupWidth();
|
32487 | this.setupMovingCss();
|
32488 | this.setupMenuClass();
|
32489 | this.setupSortableClass();
|
32490 | this.addColumnHoverListener();
|
32491 | this.setupFilterCss();
|
32492 | this.setupColId();
|
32493 | this.setupClassesFromColDef();
|
32494 | this.setupTooltip();
|
32495 | this.addActiveHeaderMouseListeners();
|
32496 | this.setupSelectAll();
|
32497 | this.setupUserComp();
|
32498 | this.refreshAria();
|
32499 | this.createManagedBean(new ResizeFeature(this.getPinned(), this.column, eResize, comp, this));
|
32500 | this.createManagedBean(new HoverFeature([this.column], eGui));
|
32501 | this.createManagedBean(new SetLeftFeature(this.column, eGui, this.beans));
|
32502 | this.createManagedBean(new ManagedFocusFeature(eGui, {
|
32503 | shouldStopEventPropagation: function (e) { return _this.shouldStopEventPropagation(e); },
|
32504 | onTabKeyDown: function () { return null; },
|
32505 | handleKeyDown: this.handleKeyDown.bind(this),
|
32506 | onFocusIn: this.onFocusIn.bind(this),
|
32507 | onFocusOut: this.onFocusOut.bind(this)
|
32508 | }));
|
32509 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onNewColumnsLoaded.bind(this));
|
32510 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, this.onColumnValueChanged.bind(this));
|
32511 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.onColumnRowGroupChanged.bind(this));
|
32512 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_CHANGED, this.onColumnPivotChanged.bind(this));
|
32513 | };
|
32514 | HeaderCellCtrl.prototype.setupUserComp = function () {
|
32515 | var compDetails = this.lookupUserCompDetails();
|
32516 | this.setCompDetails(compDetails);
|
32517 | };
|
32518 | HeaderCellCtrl.prototype.setCompDetails = function (compDetails) {
|
32519 | this.userCompDetails = compDetails;
|
32520 | this.comp.setUserCompDetails(compDetails);
|
32521 | };
|
32522 | HeaderCellCtrl.prototype.lookupUserCompDetails = function () {
|
32523 | var params = this.createParams();
|
32524 | var colDef = this.column.getColDef();
|
32525 | return this.userComponentFactory.getHeaderCompDetails(colDef, params);
|
32526 | };
|
32527 | HeaderCellCtrl.prototype.createParams = function () {
|
32528 | var _this = this;
|
32529 | var colDef = this.column.getColDef();
|
32530 | var params = {
|
32531 | column: this.column,
|
32532 | displayName: this.displayName,
|
32533 | enableSorting: colDef.sortable,
|
32534 | enableMenu: this.menuEnabled,
|
32535 | showColumnMenu: function (source) {
|
32536 | _this.gridApi.showColumnMenuAfterButtonClick(_this.column, source);
|
32537 | },
|
32538 | progressSort: function (multiSort) {
|
32539 | _this.sortController.progressSort(_this.column, !!multiSort, "uiColumnSorted");
|
32540 | },
|
32541 | setSort: function (sort, multiSort) {
|
32542 | _this.sortController.setSortForColumn(_this.column, sort, !!multiSort, "uiColumnSorted");
|
32543 | },
|
32544 | api: this.gridApi,
|
32545 | columnApi: this.columnApi,
|
32546 | context: this.gridOptionsWrapper.getContext(),
|
32547 | eGridHeader: this.getGui()
|
32548 | };
|
32549 | return params;
|
32550 | };
|
32551 | HeaderCellCtrl.prototype.setupSelectAll = function () {
|
32552 | this.selectAllFeature = this.createManagedBean(new SelectAllFeature(this.column));
|
32553 | this.selectAllFeature.setComp(this);
|
32554 | };
|
32555 | HeaderCellCtrl.prototype.getSelectAllGui = function () {
|
32556 | return this.selectAllFeature.getCheckboxGui();
|
32557 | };
|
32558 | HeaderCellCtrl.prototype.handleKeyDown = function (e) {
|
32559 | if (e.key === KeyCode.SPACE) {
|
32560 | this.selectAllFeature.onSpaceKeyPressed(e);
|
32561 | }
|
32562 | if (e.key === KeyCode.ENTER) {
|
32563 | this.onEnterKeyPressed(e);
|
32564 | }
|
32565 | };
|
32566 | HeaderCellCtrl.prototype.onEnterKeyPressed = function (e) {
|
32567 |
|
32568 | var headerComp = this.comp.getUserCompInstance();
|
32569 | if (!headerComp) {
|
32570 | return;
|
32571 | }
|
32572 | if (e.ctrlKey || e.metaKey) {
|
32573 | if (this.menuEnabled && headerComp.showMenu) {
|
32574 | e.preventDefault();
|
32575 | headerComp.showMenu();
|
32576 | }
|
32577 | }
|
32578 | else if (this.sortable) {
|
32579 | var multiSort = e.shiftKey;
|
32580 | this.sortController.progressSort(this.column, multiSort, "uiColumnSorted");
|
32581 | }
|
32582 | };
|
32583 | HeaderCellCtrl.prototype.isMenuEnabled = function () {
|
32584 | return this.menuEnabled;
|
32585 | };
|
32586 | HeaderCellCtrl.prototype.onFocusIn = function (e) {
|
32587 | if (!this.getGui().contains(e.relatedTarget)) {
|
32588 | var rowIndex = this.getRowIndex();
|
32589 | this.focusService.setFocusedHeader(rowIndex, this.column);
|
32590 | }
|
32591 | this.setActiveHeader(true);
|
32592 | };
|
32593 | HeaderCellCtrl.prototype.onFocusOut = function (e) {
|
32594 | if (this.getGui().contains(e.relatedTarget)) {
|
32595 | return;
|
32596 | }
|
32597 | this.setActiveHeader(false);
|
32598 | };
|
32599 | HeaderCellCtrl.prototype.setupTooltip = function () {
|
32600 | var _this = this;
|
32601 | var tooltipCtrl = {
|
32602 | getColumn: function () { return _this.column; },
|
32603 | getColDef: function () { return _this.column.getColDef(); },
|
32604 | getGui: function () { return _this.eGui; },
|
32605 | getLocation: function () { return 'header'; },
|
32606 | getTooltipValue: function () {
|
32607 | var res = _this.column.getColDef().headerTooltip;
|
32608 | return res;
|
32609 | },
|
32610 | };
|
32611 | var tooltipFeature = this.createManagedBean(new TooltipFeature(tooltipCtrl, this.beans));
|
32612 | tooltipFeature.setComp(this.comp);
|
32613 | this.refreshFunctions.push(function () { return tooltipFeature.refreshToolTip(); });
|
32614 | };
|
32615 | HeaderCellCtrl.prototype.setupClassesFromColDef = function () {
|
32616 | var _this = this;
|
32617 | var refreshHeaderClasses = function () {
|
32618 | var colDef = _this.column.getColDef();
|
32619 | var goa = _this.gridOptionsWrapper;
|
32620 | var classes = CssClassApplier.getHeaderClassesFromColDef(colDef, goa, _this.column, null);
|
32621 | var oldClasses = _this.userHeaderClasses;
|
32622 | _this.userHeaderClasses = new Set(classes);
|
32623 | classes.forEach(function (c) {
|
32624 | if (oldClasses.has(c)) {
|
32625 |
|
32626 | oldClasses.delete(c);
|
32627 | }
|
32628 | else {
|
32629 |
|
32630 | _this.comp.addOrRemoveCssClass(c, true);
|
32631 | }
|
32632 | });
|
32633 |
|
32634 | oldClasses.forEach(function (c) { return _this.comp.addOrRemoveCssClass(c, false); });
|
32635 | };
|
32636 | this.refreshFunctions.push(refreshHeaderClasses);
|
32637 | refreshHeaderClasses();
|
32638 | };
|
32639 | HeaderCellCtrl.prototype.setDragSource = function (eSource) {
|
32640 | var _this = this;
|
32641 | this.dragSourceElement = eSource;
|
32642 | this.removeDragSource();
|
32643 | if (!eSource) {
|
32644 | return;
|
32645 | }
|
32646 | if (!this.draggable) {
|
32647 | return;
|
32648 | }
|
32649 | this.moveDragSource = {
|
32650 | type: DragSourceType.HeaderCell,
|
32651 | eElement: eSource,
|
32652 | defaultIconName: DragAndDropService.ICON_HIDE,
|
32653 | getDragItem: function () { return _this.createDragItem(); },
|
32654 | dragItemName: this.displayName,
|
32655 | onDragStarted: function () { return _this.column.setMoving(true, "uiColumnMoved"); },
|
32656 | onDragStopped: function () { return _this.column.setMoving(false, "uiColumnMoved"); }
|
32657 | };
|
32658 | this.dragAndDropService.addDragSource(this.moveDragSource, true);
|
32659 | };
|
32660 | HeaderCellCtrl.prototype.createDragItem = function () {
|
32661 | var visibleState = {};
|
32662 | visibleState[this.column.getId()] = this.column.isVisible();
|
32663 | return {
|
32664 | columns: [this.column],
|
32665 | visibleState: visibleState
|
32666 | };
|
32667 | };
|
32668 | HeaderCellCtrl.prototype.removeDragSource = function () {
|
32669 | if (this.moveDragSource) {
|
32670 | this.dragAndDropService.removeDragSource(this.moveDragSource);
|
32671 | this.moveDragSource = undefined;
|
32672 | }
|
32673 | };
|
32674 | HeaderCellCtrl.prototype.onNewColumnsLoaded = function () {
|
32675 | var colDefVersionNow = this.columnModel.getColDefVersion();
|
32676 | if (colDefVersionNow != this.colDefVersion) {
|
32677 | this.colDefVersion = colDefVersionNow;
|
32678 | this.refresh();
|
32679 | }
|
32680 | };
|
32681 | HeaderCellCtrl.prototype.updateState = function () {
|
32682 | var colDef = this.column.getColDef();
|
32683 | this.menuEnabled = this.menuFactory.isMenuEnabled(this.column) && !colDef.suppressMenu;
|
32684 | this.sortable = colDef.sortable;
|
32685 | this.displayName = this.calculateDisplayName();
|
32686 | this.draggable = this.workOutDraggable();
|
32687 | };
|
32688 | HeaderCellCtrl.prototype.addRefreshFunction = function (func) {
|
32689 | this.refreshFunctions.push(func);
|
32690 | };
|
32691 | HeaderCellCtrl.prototype.refresh = function () {
|
32692 | this.updateState();
|
32693 | this.refreshHeaderComp();
|
32694 | this.refreshAria();
|
32695 | this.refreshFunctions.forEach(function (f) { return f(); });
|
32696 | };
|
32697 | HeaderCellCtrl.prototype.refreshHeaderComp = function () {
|
32698 | var newCompDetails = this.lookupUserCompDetails();
|
32699 | var compInstance = this.comp.getUserCompInstance();
|
32700 |
|
32701 | var attemptRefresh = compInstance != null && this.userCompDetails.componentClass == newCompDetails.componentClass;
|
32702 | var headerCompRefreshed = attemptRefresh ? this.attemptHeaderCompRefresh(newCompDetails.params) : false;
|
32703 | if (headerCompRefreshed) {
|
32704 |
|
32705 |
|
32706 |
|
32707 | this.setDragSource(this.dragSourceElement);
|
32708 | }
|
32709 | else {
|
32710 | this.setCompDetails(newCompDetails);
|
32711 | }
|
32712 | };
|
32713 | HeaderCellCtrl.prototype.attemptHeaderCompRefresh = function (params) {
|
32714 | var headerComp = this.comp.getUserCompInstance();
|
32715 | if (!headerComp) {
|
32716 | return false;
|
32717 | }
|
32718 |
|
32719 | if (!headerComp.refresh) {
|
32720 | return false;
|
32721 | }
|
32722 | var res = headerComp.refresh(params);
|
32723 | return res;
|
32724 | };
|
32725 | HeaderCellCtrl.prototype.calculateDisplayName = function () {
|
32726 | return this.columnModel.getDisplayNameForColumn(this.column, 'header', true);
|
32727 | };
|
32728 | HeaderCellCtrl.prototype.checkDisplayName = function () {
|
32729 |
|
32730 | if (this.displayName !== this.calculateDisplayName()) {
|
32731 | this.refresh();
|
32732 | }
|
32733 | };
|
32734 | HeaderCellCtrl.prototype.workOutDraggable = function () {
|
32735 | var colDef = this.column.getColDef();
|
32736 | var isSuppressMovableColumns = this.gridOptionsWrapper.isSuppressMovableColumns();
|
32737 | var colCanMove = !isSuppressMovableColumns && !colDef.suppressMovable && !colDef.lockPosition;
|
32738 |
|
32739 |
|
32740 | return !!colCanMove || !!colDef.enableRowGroup || !!colDef.enablePivot;
|
32741 | };
|
32742 | HeaderCellCtrl.prototype.onColumnRowGroupChanged = function () {
|
32743 | this.checkDisplayName();
|
32744 | };
|
32745 | HeaderCellCtrl.prototype.onColumnPivotChanged = function () {
|
32746 | this.checkDisplayName();
|
32747 | };
|
32748 | HeaderCellCtrl.prototype.onColumnValueChanged = function () {
|
32749 | this.checkDisplayName();
|
32750 | };
|
32751 | HeaderCellCtrl.prototype.setupWidth = function () {
|
32752 | var _this = this;
|
32753 | var listener = function () {
|
32754 | _this.comp.setWidth(_this.column.getActualWidth() + 'px');
|
32755 | };
|
32756 | this.addManagedListener(this.column, Column.EVENT_WIDTH_CHANGED, listener);
|
32757 | listener();
|
32758 | };
|
32759 | HeaderCellCtrl.prototype.setupMovingCss = function () {
|
32760 | var _this = this;
|
32761 | var listener = function () {
|
32762 |
|
32763 |
|
32764 | _this.comp.addOrRemoveCssClass('ag-header-cell-moving', _this.column.isMoving());
|
32765 | };
|
32766 | this.addManagedListener(this.column, Column.EVENT_MOVING_CHANGED, listener);
|
32767 | listener();
|
32768 | };
|
32769 | HeaderCellCtrl.prototype.setupMenuClass = function () {
|
32770 | var _this = this;
|
32771 | var listener = function () {
|
32772 | _this.comp.addOrRemoveCssClass('ag-column-menu-visible', _this.column.isMenuVisible());
|
32773 | };
|
32774 | this.addManagedListener(this.column, Column.EVENT_MENU_VISIBLE_CHANGED, listener);
|
32775 | listener();
|
32776 | };
|
32777 | HeaderCellCtrl.prototype.setupSortableClass = function () {
|
32778 | var _this = this;
|
32779 | var updateSortableCssClass = function () {
|
32780 | _this.comp.addOrRemoveCssClass('ag-header-cell-sortable', !!_this.sortable);
|
32781 | };
|
32782 | updateSortableCssClass();
|
32783 | this.addRefreshFunction(updateSortableCssClass);
|
32784 | this.addManagedListener(this.column, Column.EVENT_SORT_CHANGED, this.refreshAriaSort.bind(this));
|
32785 | };
|
32786 | HeaderCellCtrl.prototype.refreshAriaSort = function () {
|
32787 | if (this.sortable) {
|
32788 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
32789 | this.comp.setAriaSort(getAriaSortState(this.column));
|
32790 | this.setAriaDescriptionProperty('sort', translate('ariaSortableColumn', 'Press ENTER to sort.'));
|
32791 | }
|
32792 | else {
|
32793 | this.comp.setAriaSort();
|
32794 | this.setAriaDescriptionProperty('sort', null);
|
32795 | }
|
32796 | };
|
32797 | HeaderCellCtrl.prototype.refreshAriaMenu = function () {
|
32798 | if (this.menuEnabled) {
|
32799 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
32800 | this.setAriaDescriptionProperty('menu', translate('ariaMenuColumn', 'Press CTRL ENTER to open column menu.'));
|
32801 | }
|
32802 | else {
|
32803 | this.setAriaDescriptionProperty('menu', null);
|
32804 | }
|
32805 | };
|
32806 | HeaderCellCtrl.prototype.setAriaDescriptionProperty = function (property, value) {
|
32807 | if (value != null) {
|
32808 | this.ariaDescriptionProperties.set(property, value);
|
32809 | }
|
32810 | else {
|
32811 | this.ariaDescriptionProperties.delete(property);
|
32812 | }
|
32813 | };
|
32814 | HeaderCellCtrl.prototype.refreshAriaDescription = function () {
|
32815 | var descriptionArray = Array.from(this.ariaDescriptionProperties.values());
|
32816 | this.comp.setAriaDescription(descriptionArray.length ? descriptionArray.join(' ') : undefined);
|
32817 | };
|
32818 | HeaderCellCtrl.prototype.refreshAria = function () {
|
32819 | this.refreshAriaSort();
|
32820 | this.refreshAriaMenu();
|
32821 | this.refreshAriaDescription();
|
32822 | };
|
32823 | HeaderCellCtrl.prototype.addColumnHoverListener = function () {
|
32824 | var _this = this;
|
32825 | var listener = function () {
|
32826 | if (!_this.gridOptionsWrapper.isColumnHoverHighlight()) {
|
32827 | return;
|
32828 | }
|
32829 | var isHovered = _this.columnHoverService.isHovered(_this.column);
|
32830 | _this.comp.addOrRemoveCssClass('ag-column-hover', isHovered);
|
32831 | };
|
32832 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, listener);
|
32833 | listener();
|
32834 | };
|
32835 | HeaderCellCtrl.prototype.setupFilterCss = function () {
|
32836 | var _this = this;
|
32837 | var listener = function () {
|
32838 | _this.comp.addOrRemoveCssClass('ag-header-cell-filtered', _this.column.isFilterActive());
|
32839 | };
|
32840 | this.addManagedListener(this.column, Column.EVENT_FILTER_ACTIVE_CHANGED, listener);
|
32841 | listener();
|
32842 | };
|
32843 | HeaderCellCtrl.prototype.setupColId = function () {
|
32844 | this.comp.setColId(this.column.getColId());
|
32845 | };
|
32846 | HeaderCellCtrl.prototype.addActiveHeaderMouseListeners = function () {
|
32847 | var _this = this;
|
32848 | var listener = function (e) { return _this.setActiveHeader(e.type === 'mouseenter'); };
|
32849 | this.addManagedListener(this.getGui(), 'mouseenter', listener);
|
32850 | this.addManagedListener(this.getGui(), 'mouseleave', listener);
|
32851 | };
|
32852 | HeaderCellCtrl.prototype.setActiveHeader = function (active) {
|
32853 | this.comp.addOrRemoveCssClass('ag-header-active', active);
|
32854 | };
|
32855 | __decorate$1e([
|
32856 | Autowired('columnModel')
|
32857 | ], HeaderCellCtrl.prototype, "columnModel", void 0);
|
32858 | __decorate$1e([
|
32859 | Autowired('columnHoverService')
|
32860 | ], HeaderCellCtrl.prototype, "columnHoverService", void 0);
|
32861 | __decorate$1e([
|
32862 | Autowired('beans')
|
32863 | ], HeaderCellCtrl.prototype, "beans", void 0);
|
32864 | __decorate$1e([
|
32865 | Autowired('sortController')
|
32866 | ], HeaderCellCtrl.prototype, "sortController", void 0);
|
32867 | __decorate$1e([
|
32868 | Autowired('menuFactory')
|
32869 | ], HeaderCellCtrl.prototype, "menuFactory", void 0);
|
32870 | __decorate$1e([
|
32871 | Autowired('dragAndDropService')
|
32872 | ], HeaderCellCtrl.prototype, "dragAndDropService", void 0);
|
32873 | __decorate$1e([
|
32874 | Autowired('gridApi')
|
32875 | ], HeaderCellCtrl.prototype, "gridApi", void 0);
|
32876 | __decorate$1e([
|
32877 | Autowired('columnApi')
|
32878 | ], HeaderCellCtrl.prototype, "columnApi", void 0);
|
32879 | __decorate$1e([
|
32880 | Autowired('userComponentFactory')
|
32881 | ], HeaderCellCtrl.prototype, "userComponentFactory", void 0);
|
32882 | __decorate$1e([
|
32883 | PreDestroy
|
32884 | ], HeaderCellCtrl.prototype, "removeDragSource", null);
|
32885 | return HeaderCellCtrl;
|
32886 | }(AbstractHeaderCellCtrl));
|
32887 |
|
32888 |
|
32889 |
|
32890 |
|
32891 |
|
32892 |
|
32893 |
|
32894 | var __extends$1s = (undefined && undefined.__extends) || (function () {
|
32895 | var extendStatics = function (d, b) {
|
32896 | extendStatics = Object.setPrototypeOf ||
|
32897 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
32898 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
32899 | return extendStatics(d, b);
|
32900 | };
|
32901 | return function (d, b) {
|
32902 | extendStatics(d, b);
|
32903 | function __() { this.constructor = d; }
|
32904 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32905 | };
|
32906 | })();
|
32907 | var __decorate$1f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
32908 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
32909 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
32910 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
32911 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
32912 | };
|
32913 | var GroupResizeFeature = (function (_super) {
|
32914 | __extends$1s(GroupResizeFeature, _super);
|
32915 | function GroupResizeFeature(comp, eResize, pinned, columnGroup) {
|
32916 | var _this = _super.call(this) || this;
|
32917 | _this.eResize = eResize;
|
32918 | _this.comp = comp;
|
32919 | _this.pinned = pinned;
|
32920 | _this.columnGroup = columnGroup;
|
32921 | return _this;
|
32922 | }
|
32923 | GroupResizeFeature.prototype.postConstruct = function () {
|
32924 | var _this = this;
|
32925 | if (!this.columnGroup.isResizable()) {
|
32926 | this.comp.addOrRemoveResizableCssClass('ag-hidden', true);
|
32927 | return;
|
32928 | }
|
32929 | var finishedWithResizeFunc = this.horizontalResizeService.addResizeBar({
|
32930 | eResizeBar: this.eResize,
|
32931 | onResizeStart: this.onResizeStart.bind(this),
|
32932 | onResizing: this.onResizing.bind(this, false),
|
32933 | onResizeEnd: this.onResizing.bind(this, true)
|
32934 | });
|
32935 | this.addDestroyFunc(finishedWithResizeFunc);
|
32936 | if (!this.gridOptionsWrapper.isSuppressAutoSize()) {
|
32937 | var skipHeaderOnAutoSize_1 = this.gridOptionsWrapper.isSkipHeaderOnAutoSize();
|
32938 | this.eResize.addEventListener('dblclick', function () {
|
32939 |
|
32940 | var keys = [];
|
32941 | var leafCols = _this.columnGroup.getDisplayedLeafColumns();
|
32942 | leafCols.forEach(function (column) {
|
32943 |
|
32944 | if (!column.getColDef().suppressAutoSize) {
|
32945 | keys.push(column.getColId());
|
32946 | }
|
32947 | });
|
32948 | if (keys.length > 0) {
|
32949 | _this.columnModel.autoSizeColumns({
|
32950 | columns: keys,
|
32951 | skipHeader: skipHeaderOnAutoSize_1,
|
32952 | stopAtGroup: _this.columnGroup,
|
32953 | source: 'uiColumnResized'
|
32954 | });
|
32955 | }
|
32956 | _this.resizeLeafColumnsToFit();
|
32957 | });
|
32958 | }
|
32959 | };
|
32960 | GroupResizeFeature.prototype.onResizeStart = function (shiftKey) {
|
32961 | var _this = this;
|
32962 | this.calculateInitialValues();
|
32963 | var takeFromGroup = null;
|
32964 | if (shiftKey) {
|
32965 | takeFromGroup = this.columnModel.getDisplayedGroupAfter(this.columnGroup);
|
32966 | }
|
32967 | if (takeFromGroup) {
|
32968 | var takeFromLeafCols = takeFromGroup.getDisplayedLeafColumns();
|
32969 | this.resizeTakeFromCols = takeFromLeafCols.filter(function (col) { return col.isResizable(); });
|
32970 | this.resizeTakeFromStartWidth = 0;
|
32971 | this.resizeTakeFromCols.forEach(function (col) { return _this.resizeTakeFromStartWidth += col.getActualWidth(); });
|
32972 | this.resizeTakeFromRatios = [];
|
32973 | this.resizeTakeFromCols.forEach(function (col) { return _this.resizeTakeFromRatios.push(col.getActualWidth() / _this.resizeTakeFromStartWidth); });
|
32974 | }
|
32975 | else {
|
32976 | this.resizeTakeFromCols = null;
|
32977 | this.resizeTakeFromStartWidth = null;
|
32978 | this.resizeTakeFromRatios = null;
|
32979 | }
|
32980 | this.comp.addOrRemoveCssClass('ag-column-resizing', true);
|
32981 | };
|
32982 | GroupResizeFeature.prototype.onResizing = function (finished, resizeAmount) {
|
32983 | var resizeAmountNormalised = this.normaliseDragChange(resizeAmount);
|
32984 | var width = this.resizeStartWidth + resizeAmountNormalised;
|
32985 | this.resizeColumns(width, finished);
|
32986 | };
|
32987 | GroupResizeFeature.prototype.resizeLeafColumnsToFit = function () {
|
32988 | var preferredSize = this.autoWidthCalculator.getPreferredWidthForColumnGroup(this.columnGroup);
|
32989 | this.calculateInitialValues();
|
32990 | if (preferredSize > this.resizeStartWidth) {
|
32991 | this.resizeColumns(preferredSize, true);
|
32992 | }
|
32993 | };
|
32994 | GroupResizeFeature.prototype.resizeColumns = function (totalWidth, finished) {
|
32995 | if (finished === void 0) { finished = true; }
|
32996 | var resizeSets = [];
|
32997 | resizeSets.push({
|
32998 | columns: this.resizeCols,
|
32999 | ratios: this.resizeRatios,
|
33000 | width: totalWidth
|
33001 | });
|
33002 | if (this.resizeTakeFromCols) {
|
33003 | var diff = totalWidth - this.resizeStartWidth;
|
33004 | resizeSets.push({
|
33005 | columns: this.resizeTakeFromCols,
|
33006 | ratios: this.resizeTakeFromRatios,
|
33007 | width: this.resizeTakeFromStartWidth - diff
|
33008 | });
|
33009 | }
|
33010 | this.columnModel.resizeColumnSets({
|
33011 | resizeSets: resizeSets,
|
33012 | finished: finished,
|
33013 | source: 'uiColumnDragged'
|
33014 | });
|
33015 | if (finished) {
|
33016 | this.comp.addOrRemoveCssClass('ag-column-resizing', false);
|
33017 | }
|
33018 | };
|
33019 | GroupResizeFeature.prototype.calculateInitialValues = function () {
|
33020 | var _this = this;
|
33021 | var leafCols = this.columnGroup.getDisplayedLeafColumns();
|
33022 | this.resizeCols = leafCols.filter(function (col) { return col.isResizable(); });
|
33023 | this.resizeStartWidth = 0;
|
33024 | this.resizeCols.forEach(function (col) { return _this.resizeStartWidth += col.getActualWidth(); });
|
33025 | this.resizeRatios = [];
|
33026 | this.resizeCols.forEach(function (col) { return _this.resizeRatios.push(col.getActualWidth() / _this.resizeStartWidth); });
|
33027 | };
|
33028 |
|
33029 |
|
33030 | GroupResizeFeature.prototype.normaliseDragChange = function (dragChange) {
|
33031 | var result = dragChange;
|
33032 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
33033 |
|
33034 | if (this.pinned !== Constants.PINNED_LEFT) {
|
33035 | result *= -1;
|
33036 | }
|
33037 | }
|
33038 | else if (this.pinned === Constants.PINNED_RIGHT) {
|
33039 |
|
33040 | result *= -1;
|
33041 | }
|
33042 | return result;
|
33043 | };
|
33044 | __decorate$1f([
|
33045 | Autowired('horizontalResizeService')
|
33046 | ], GroupResizeFeature.prototype, "horizontalResizeService", void 0);
|
33047 | __decorate$1f([
|
33048 | Autowired('autoWidthCalculator')
|
33049 | ], GroupResizeFeature.prototype, "autoWidthCalculator", void 0);
|
33050 | __decorate$1f([
|
33051 | Autowired('columnModel')
|
33052 | ], GroupResizeFeature.prototype, "columnModel", void 0);
|
33053 | __decorate$1f([
|
33054 | PostConstruct
|
33055 | ], GroupResizeFeature.prototype, "postConstruct", null);
|
33056 | return GroupResizeFeature;
|
33057 | }(BeanStub));
|
33058 |
|
33059 |
|
33060 |
|
33061 |
|
33062 |
|
33063 |
|
33064 |
|
33065 | var __extends$1t = (undefined && undefined.__extends) || (function () {
|
33066 | var extendStatics = function (d, b) {
|
33067 | extendStatics = Object.setPrototypeOf ||
|
33068 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
33069 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
33070 | return extendStatics(d, b);
|
33071 | };
|
33072 | return function (d, b) {
|
33073 | extendStatics(d, b);
|
33074 | function __() { this.constructor = d; }
|
33075 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
33076 | };
|
33077 | })();
|
33078 | var __decorate$1g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
33079 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
33080 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
33081 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
33082 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
33083 | };
|
33084 | var GroupWidthFeature = (function (_super) {
|
33085 | __extends$1t(GroupWidthFeature, _super);
|
33086 | function GroupWidthFeature(comp, columnGroup) {
|
33087 | var _this = _super.call(this) || this;
|
33088 |
|
33089 | _this.removeChildListenersFuncs = [];
|
33090 | _this.columnGroup = columnGroup;
|
33091 | _this.comp = comp;
|
33092 | return _this;
|
33093 | }
|
33094 | GroupWidthFeature.prototype.postConstruct = function () {
|
33095 |
|
33096 | this.addListenersToChildrenColumns();
|
33097 |
|
33098 | this.addManagedListener(this.columnGroup, ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED, this.onDisplayedChildrenChanged.bind(this));
|
33099 | this.onWidthChanged();
|
33100 |
|
33101 |
|
33102 |
|
33103 | this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this));
|
33104 | };
|
33105 | GroupWidthFeature.prototype.addListenersToChildrenColumns = function () {
|
33106 | var _this = this;
|
33107 |
|
33108 | this.removeListenersOnChildrenColumns();
|
33109 |
|
33110 | var widthChangedListener = this.onWidthChanged.bind(this);
|
33111 | this.columnGroup.getLeafColumns().forEach(function (column) {
|
33112 | column.addEventListener(Column.EVENT_WIDTH_CHANGED, widthChangedListener);
|
33113 | column.addEventListener(Column.EVENT_VISIBLE_CHANGED, widthChangedListener);
|
33114 | _this.removeChildListenersFuncs.push(function () {
|
33115 | column.removeEventListener(Column.EVENT_WIDTH_CHANGED, widthChangedListener);
|
33116 | column.removeEventListener(Column.EVENT_VISIBLE_CHANGED, widthChangedListener);
|
33117 | });
|
33118 | });
|
33119 | };
|
33120 | GroupWidthFeature.prototype.removeListenersOnChildrenColumns = function () {
|
33121 | this.removeChildListenersFuncs.forEach(function (func) { return func(); });
|
33122 | this.removeChildListenersFuncs = [];
|
33123 | };
|
33124 | GroupWidthFeature.prototype.onDisplayedChildrenChanged = function () {
|
33125 | this.addListenersToChildrenColumns();
|
33126 | this.onWidthChanged();
|
33127 | };
|
33128 | GroupWidthFeature.prototype.onWidthChanged = function () {
|
33129 | this.comp.setWidth(this.columnGroup.getActualWidth() + 'px');
|
33130 | };
|
33131 | __decorate$1g([
|
33132 | PostConstruct
|
33133 | ], GroupWidthFeature.prototype, "postConstruct", null);
|
33134 | return GroupWidthFeature;
|
33135 | }(BeanStub));
|
33136 |
|
33137 |
|
33138 |
|
33139 |
|
33140 |
|
33141 |
|
33142 |
|
33143 | var __extends$1u = (undefined && undefined.__extends) || (function () {
|
33144 | var extendStatics = function (d, b) {
|
33145 | extendStatics = Object.setPrototypeOf ||
|
33146 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
33147 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
33148 | return extendStatics(d, b);
|
33149 | };
|
33150 | return function (d, b) {
|
33151 | extendStatics(d, b);
|
33152 | function __() { this.constructor = d; }
|
33153 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
33154 | };
|
33155 | })();
|
33156 | var __decorate$1h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
33157 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
33158 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
33159 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
33160 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
33161 | };
|
33162 | var HeaderGroupCellCtrl = (function (_super) {
|
33163 | __extends$1u(HeaderGroupCellCtrl, _super);
|
33164 | function HeaderGroupCellCtrl(columnGroup, parentRowCtrl) {
|
33165 | var _this = _super.call(this, columnGroup, parentRowCtrl) || this;
|
33166 | _this.columnGroup = columnGroup;
|
33167 | return _this;
|
33168 | }
|
33169 | HeaderGroupCellCtrl.prototype.setComp = function (comp, eGui, eResize) {
|
33170 | _super.prototype.setGui.call(this, eGui);
|
33171 | this.comp = comp;
|
33172 | this.displayName = this.columnModel.getDisplayNameForColumnGroup(this.columnGroup, 'header');
|
33173 | this.addClasses();
|
33174 | this.addAttributes();
|
33175 | this.setupMovingCss();
|
33176 | this.setupExpandable();
|
33177 | this.setupTooltip();
|
33178 | this.setupUserComp();
|
33179 | var pinned = this.getParentRowCtrl().getPinned();
|
33180 | var leafCols = this.columnGroup.getProvidedColumnGroup().getLeafColumns();
|
33181 | this.createManagedBean(new HoverFeature(leafCols, eGui));
|
33182 | this.createManagedBean(new SetLeftFeature(this.columnGroup, eGui, this.beans));
|
33183 | this.createManagedBean(new GroupWidthFeature(comp, this.columnGroup));
|
33184 | this.groupResizeFeature = this.createManagedBean(new GroupResizeFeature(comp, eResize, pinned, this.columnGroup));
|
33185 | this.createManagedBean(new ManagedFocusFeature(eGui, {
|
33186 | shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this),
|
33187 | onTabKeyDown: function () { return undefined; },
|
33188 | handleKeyDown: this.handleKeyDown.bind(this),
|
33189 | onFocusIn: this.onFocusIn.bind(this)
|
33190 | }));
|
33191 | };
|
33192 | HeaderGroupCellCtrl.prototype.resizeLeafColumnsToFit = function () {
|
33193 | this.groupResizeFeature.onResizeStart(false);
|
33194 | this.groupResizeFeature.resizeLeafColumnsToFit();
|
33195 | };
|
33196 | HeaderGroupCellCtrl.prototype.setupUserComp = function () {
|
33197 | var _this = this;
|
33198 | var displayName = this.displayName;
|
33199 | var params = {
|
33200 | displayName: this.displayName,
|
33201 | columnGroup: this.columnGroup,
|
33202 | setExpanded: function (expanded) {
|
33203 | _this.columnModel.setColumnGroupOpened(_this.columnGroup.getProvidedColumnGroup(), expanded, "gridInitializing");
|
33204 | },
|
33205 | api: this.gridApi,
|
33206 | columnApi: this.columnApi,
|
33207 | context: this.gridOptionsWrapper.getContext()
|
33208 | };
|
33209 | if (!displayName) {
|
33210 | var columnGroup = this.columnGroup;
|
33211 | var leafCols = columnGroup.getLeafColumns();
|
33212 |
|
33213 |
|
33214 |
|
33215 |
|
33216 |
|
33217 | while (columnGroup.getParent() && columnGroup.getParent().getLeafColumns().length === leafCols.length) {
|
33218 | columnGroup = columnGroup.getParent();
|
33219 | }
|
33220 | var colGroupDef = columnGroup.getColGroupDef();
|
33221 | if (colGroupDef) {
|
33222 | displayName = colGroupDef.headerName;
|
33223 | }
|
33224 | if (!displayName) {
|
33225 | displayName = leafCols ? this.columnModel.getDisplayNameForColumn(leafCols[0], 'header', true) : '';
|
33226 | }
|
33227 | }
|
33228 | var compDetails = this.userComponentFactory.getHeaderGroupCompDetails(params);
|
33229 | this.comp.setUserCompDetails(compDetails);
|
33230 | };
|
33231 | HeaderGroupCellCtrl.prototype.setupTooltip = function () {
|
33232 | var _this = this;
|
33233 | var colGroupDef = this.columnGroup.getColGroupDef();
|
33234 | var tooltipCtrl = {
|
33235 | getColumn: function () { return _this.columnGroup; },
|
33236 | getGui: function () { return _this.eGui; },
|
33237 | getLocation: function () { return 'headerGroup'; },
|
33238 | getTooltipValue: function () { return colGroupDef && colGroupDef.headerTooltip; }
|
33239 | };
|
33240 | if (colGroupDef) {
|
33241 | tooltipCtrl.getColDef = function () { return colGroupDef; };
|
33242 | }
|
33243 | var tooltipFeature = this.createManagedBean(new TooltipFeature(tooltipCtrl, this.beans));
|
33244 | tooltipFeature.setComp(this.comp);
|
33245 | };
|
33246 | HeaderGroupCellCtrl.prototype.setupExpandable = function () {
|
33247 | var providedColGroup = this.columnGroup.getProvidedColumnGroup();
|
33248 | this.refreshExpanded();
|
33249 | this.addManagedListener(providedColGroup, ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED, this.refreshExpanded.bind(this));
|
33250 | this.addManagedListener(providedColGroup, ProvidedColumnGroup.EVENT_EXPANDED_CHANGED, this.refreshExpanded.bind(this));
|
33251 | };
|
33252 | HeaderGroupCellCtrl.prototype.refreshExpanded = function () {
|
33253 | var column = this.columnGroup;
|
33254 | this.expandable = column.isExpandable();
|
33255 | var expanded = column.isExpanded();
|
33256 | if (this.expandable) {
|
33257 | this.comp.setAriaExpanded(expanded ? 'true' : 'false');
|
33258 | }
|
33259 | else {
|
33260 | this.comp.setAriaExpanded(undefined);
|
33261 | }
|
33262 | };
|
33263 | HeaderGroupCellCtrl.prototype.addAttributes = function () {
|
33264 | this.comp.setColId(this.columnGroup.getUniqueId());
|
33265 | };
|
33266 | HeaderGroupCellCtrl.prototype.addClasses = function () {
|
33267 | var _this = this;
|
33268 | var colGroupDef = this.columnGroup.getColGroupDef();
|
33269 | var classes = CssClassApplier.getHeaderClassesFromColDef(colGroupDef, this.gridOptionsWrapper, null, this.columnGroup);
|
33270 |
|
33271 |
|
33272 | classes.push(this.columnGroup.isPadding() ? "ag-header-group-cell-no-group" : "ag-header-group-cell-with-group");
|
33273 | classes.forEach(function (c) { return _this.comp.addOrRemoveCssClass(c, true); });
|
33274 | };
|
33275 | HeaderGroupCellCtrl.prototype.setupMovingCss = function () {
|
33276 | var _this = this;
|
33277 | var providedColumnGroup = this.columnGroup.getProvidedColumnGroup();
|
33278 | var leafColumns = providedColumnGroup.getLeafColumns();
|
33279 |
|
33280 |
|
33281 |
|
33282 | var listener = function () { return _this.comp.addOrRemoveCssClass('ag-header-cell-moving', _this.columnGroup.isMoving()); };
|
33283 | leafColumns.forEach(function (col) {
|
33284 | _this.addManagedListener(col, Column.EVENT_MOVING_CHANGED, listener);
|
33285 | });
|
33286 | listener();
|
33287 | };
|
33288 | HeaderGroupCellCtrl.prototype.onFocusIn = function (e) {
|
33289 | if (!this.eGui.contains(e.relatedTarget)) {
|
33290 | var rowIndex = this.getRowIndex();
|
33291 | this.beans.focusService.setFocusedHeader(rowIndex, this.columnGroup);
|
33292 | }
|
33293 | };
|
33294 | HeaderGroupCellCtrl.prototype.handleKeyDown = function (e) {
|
33295 | var eDocument = this.gridOptionsWrapper.getDocument();
|
33296 | var activeEl = eDocument.activeElement;
|
33297 | var wrapperHasFocus = activeEl === this.eGui;
|
33298 | if (!this.expandable || !wrapperHasFocus) {
|
33299 | return;
|
33300 | }
|
33301 | if (e.key === KeyCode.ENTER) {
|
33302 | var column = this.columnGroup;
|
33303 | var newExpandedValue = !column.isExpanded();
|
33304 | this.columnModel.setColumnGroupOpened(column.getProvidedColumnGroup(), newExpandedValue, "uiColumnExpanded");
|
33305 | }
|
33306 | };
|
33307 |
|
33308 |
|
33309 | HeaderGroupCellCtrl.prototype.setDragSource = function (eHeaderGroup) {
|
33310 | var _this = this;
|
33311 | if (this.isSuppressMoving()) {
|
33312 | return;
|
33313 | }
|
33314 | var allLeafColumns = this.columnGroup.getProvidedColumnGroup().getLeafColumns();
|
33315 | var dragSource = {
|
33316 | type: DragSourceType.HeaderCell,
|
33317 | eElement: eHeaderGroup,
|
33318 | defaultIconName: DragAndDropService.ICON_HIDE,
|
33319 | dragItemName: this.displayName,
|
33320 |
|
33321 | getDragItem: this.getDragItemForGroup.bind(this),
|
33322 | onDragStarted: function () { return allLeafColumns.forEach(function (col) { return col.setMoving(true, "uiColumnDragged"); }); },
|
33323 | onDragStopped: function () { return allLeafColumns.forEach(function (col) { return col.setMoving(false, "uiColumnDragged"); }); }
|
33324 | };
|
33325 | this.dragAndDropService.addDragSource(dragSource, true);
|
33326 | this.addDestroyFunc(function () { return _this.dragAndDropService.removeDragSource(dragSource); });
|
33327 | };
|
33328 |
|
33329 |
|
33330 | HeaderGroupCellCtrl.prototype.getDragItemForGroup = function () {
|
33331 | var allColumnsOriginalOrder = this.columnGroup.getProvidedColumnGroup().getLeafColumns();
|
33332 |
|
33333 | var visibleState = {};
|
33334 | allColumnsOriginalOrder.forEach(function (column) { return visibleState[column.getId()] = column.isVisible(); });
|
33335 | var allColumnsCurrentOrder = [];
|
33336 | this.columnModel.getAllDisplayedColumns().forEach(function (column) {
|
33337 | if (allColumnsOriginalOrder.indexOf(column) >= 0) {
|
33338 | allColumnsCurrentOrder.push(column);
|
33339 | removeFromArray(allColumnsOriginalOrder, column);
|
33340 | }
|
33341 | });
|
33342 |
|
33343 | allColumnsOriginalOrder.forEach(function (column) { return allColumnsCurrentOrder.push(column); });
|
33344 |
|
33345 | return {
|
33346 | columns: allColumnsCurrentOrder,
|
33347 | visibleState: visibleState
|
33348 | };
|
33349 | };
|
33350 | HeaderGroupCellCtrl.prototype.isSuppressMoving = function () {
|
33351 |
|
33352 | var childSuppressesMoving = false;
|
33353 | this.columnGroup.getLeafColumns().forEach(function (column) {
|
33354 | if (column.getColDef().suppressMovable || column.getColDef().lockPosition) {
|
33355 | childSuppressesMoving = true;
|
33356 | }
|
33357 | });
|
33358 | var result = childSuppressesMoving || this.gridOptionsWrapper.isSuppressMovableColumns();
|
33359 | return result;
|
33360 | };
|
33361 | __decorate$1h([
|
33362 | Autowired('beans')
|
33363 | ], HeaderGroupCellCtrl.prototype, "beans", void 0);
|
33364 | __decorate$1h([
|
33365 | Autowired('columnModel')
|
33366 | ], HeaderGroupCellCtrl.prototype, "columnModel", void 0);
|
33367 | __decorate$1h([
|
33368 | Autowired('dragAndDropService')
|
33369 | ], HeaderGroupCellCtrl.prototype, "dragAndDropService", void 0);
|
33370 | __decorate$1h([
|
33371 | Autowired('userComponentFactory')
|
33372 | ], HeaderGroupCellCtrl.prototype, "userComponentFactory", void 0);
|
33373 | __decorate$1h([
|
33374 | Autowired('gridApi')
|
33375 | ], HeaderGroupCellCtrl.prototype, "gridApi", void 0);
|
33376 | __decorate$1h([
|
33377 | Autowired('columnApi')
|
33378 | ], HeaderGroupCellCtrl.prototype, "columnApi", void 0);
|
33379 | return HeaderGroupCellCtrl;
|
33380 | }(AbstractHeaderCellCtrl));
|
33381 |
|
33382 |
|
33383 |
|
33384 |
|
33385 |
|
33386 |
|
33387 |
|
33388 | var __extends$1v = (undefined && undefined.__extends) || (function () {
|
33389 | var extendStatics = function (d, b) {
|
33390 | extendStatics = Object.setPrototypeOf ||
|
33391 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
33392 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
33393 | return extendStatics(d, b);
|
33394 | };
|
33395 | return function (d, b) {
|
33396 | extendStatics(d, b);
|
33397 | function __() { this.constructor = d; }
|
33398 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
33399 | };
|
33400 | })();
|
33401 | var __decorate$1i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
33402 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
33403 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
33404 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
33405 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
33406 | };
|
33407 | var instanceIdSequence$4 = 0;
|
33408 | var HeaderRowCtrl = (function (_super) {
|
33409 | __extends$1v(HeaderRowCtrl, _super);
|
33410 | function HeaderRowCtrl(rowIndex, pinned, type) {
|
33411 | var _this = _super.call(this) || this;
|
33412 | _this.instanceId = instanceIdSequence$4++;
|
33413 | _this.headerCellCtrls = {};
|
33414 | _this.rowIndex = rowIndex;
|
33415 | _this.pinned = pinned;
|
33416 | _this.type = type;
|
33417 | return _this;
|
33418 | }
|
33419 | HeaderRowCtrl.prototype.getInstanceId = function () {
|
33420 | return this.instanceId;
|
33421 | };
|
33422 | HeaderRowCtrl.prototype.setComp = function (comp) {
|
33423 | this.comp = comp;
|
33424 | this.onRowHeightChanged();
|
33425 | this.onVirtualColumnsChanged();
|
33426 | this.setWidth();
|
33427 | this.addEventListeners();
|
33428 | if (isBrowserSafari()) {
|
33429 |
|
33430 |
|
33431 | this.comp.setTransform('translateZ(0)');
|
33432 | }
|
33433 | comp.setAriaRowIndex(this.rowIndex + 1);
|
33434 | };
|
33435 | HeaderRowCtrl.prototype.addEventListeners = function () {
|
33436 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_RESIZED, this.onColumnResized.bind(this));
|
33437 |
|
33438 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, this.onDisplayedColumnsChanged.bind(this));
|
33439 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
|
33440 | this.addManagedListener(this.eventService, Events.EVENT_VIRTUAL_COLUMNS_CHANGED, this.onVirtualColumnsChanged.bind(this));
|
33441 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_HEADER_HEIGHT, this.onRowHeightChanged.bind(this));
|
33442 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_PIVOT_HEADER_HEIGHT, this.onRowHeightChanged.bind(this));
|
33443 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_GROUP_HEADER_HEIGHT, this.onRowHeightChanged.bind(this));
|
33444 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_PIVOT_GROUP_HEADER_HEIGHT, this.onRowHeightChanged.bind(this));
|
33445 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_FLOATING_FILTERS_HEIGHT, this.onRowHeightChanged.bind(this));
|
33446 | };
|
33447 | HeaderRowCtrl.prototype.getHeaderCellCtrl = function (column) {
|
33448 | return values(this.headerCellCtrls).find(function (cellCtrl) { return cellCtrl.getColumnGroupChild() === column; });
|
33449 | };
|
33450 | HeaderRowCtrl.prototype.onDisplayedColumnsChanged = function () {
|
33451 | this.onVirtualColumnsChanged();
|
33452 | this.setWidth();
|
33453 | };
|
33454 | HeaderRowCtrl.prototype.getType = function () {
|
33455 | return this.type;
|
33456 | };
|
33457 | HeaderRowCtrl.prototype.onColumnResized = function () {
|
33458 | this.setWidth();
|
33459 | };
|
33460 | HeaderRowCtrl.prototype.setWidth = function () {
|
33461 | var width = this.getWidthForRow();
|
33462 | this.comp.setWidth(width + "px");
|
33463 | };
|
33464 | HeaderRowCtrl.prototype.getWidthForRow = function () {
|
33465 | var printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
|
33466 | if (printLayout) {
|
33467 | var pinned = this.pinned != null;
|
33468 | if (pinned) {
|
33469 | return 0;
|
33470 | }
|
33471 | return this.columnModel.getContainerWidth(Constants.PINNED_RIGHT)
|
33472 | + this.columnModel.getContainerWidth(Constants.PINNED_LEFT)
|
33473 | + this.columnModel.getContainerWidth(null);
|
33474 | }
|
33475 |
|
33476 | return this.columnModel.getContainerWidth(this.pinned);
|
33477 | };
|
33478 | HeaderRowCtrl.prototype.onRowHeightChanged = function () {
|
33479 | var headerRowCount = this.columnModel.getHeaderRowCount();
|
33480 | var sizes = [];
|
33481 | var numberOfFloating = 0;
|
33482 | var groupHeight;
|
33483 | var headerHeight;
|
33484 | if (this.columnModel.hasFloatingFilters()) {
|
33485 | headerRowCount++;
|
33486 | numberOfFloating = 1;
|
33487 | }
|
33488 | if (this.columnModel.isPivotMode()) {
|
33489 | groupHeight = this.gridOptionsWrapper.getPivotGroupHeaderHeight();
|
33490 | headerHeight = this.gridOptionsWrapper.getPivotHeaderHeight();
|
33491 | }
|
33492 | else {
|
33493 | groupHeight = this.gridOptionsWrapper.getGroupHeaderHeight();
|
33494 | headerHeight = this.gridOptionsWrapper.getHeaderHeight();
|
33495 | }
|
33496 | var numberOfNonGroups = 1 + numberOfFloating;
|
33497 | var numberOfGroups = headerRowCount - numberOfNonGroups;
|
33498 | for (var i = 0; i < numberOfGroups; i++) {
|
33499 | sizes.push(groupHeight);
|
33500 | }
|
33501 | sizes.push(headerHeight);
|
33502 | for (var i = 0; i < numberOfFloating; i++) {
|
33503 | sizes.push(this.gridOptionsWrapper.getFloatingFiltersHeight());
|
33504 | }
|
33505 | var rowHeight = 0;
|
33506 | for (var i = 0; i < this.rowIndex; i++) {
|
33507 | rowHeight += sizes[i];
|
33508 | }
|
33509 | this.comp.setTop(rowHeight + 'px');
|
33510 | this.comp.setHeight(sizes[this.rowIndex] + 'px');
|
33511 | };
|
33512 | HeaderRowCtrl.prototype.getPinned = function () {
|
33513 | return this.pinned;
|
33514 | };
|
33515 | HeaderRowCtrl.prototype.getRowIndex = function () {
|
33516 | return this.rowIndex;
|
33517 | };
|
33518 | HeaderRowCtrl.prototype.onVirtualColumnsChanged = function () {
|
33519 | var _this = this;
|
33520 | var oldCtrls = this.headerCellCtrls;
|
33521 | this.headerCellCtrls = {};
|
33522 | var columns = this.getColumnsInViewport();
|
33523 | columns.forEach(function (child) {
|
33524 |
|
33525 |
|
33526 |
|
33527 |
|
33528 | if (child.isEmptyGroup()) {
|
33529 | return;
|
33530 | }
|
33531 | var idOfChild = child.getUniqueId();
|
33532 |
|
33533 | var headerCtrl = oldCtrls[idOfChild];
|
33534 | delete oldCtrls[idOfChild];
|
33535 |
|
33536 |
|
33537 |
|
33538 |
|
33539 | var forOldColumn = headerCtrl && headerCtrl.getColumnGroupChild() != child;
|
33540 | if (forOldColumn) {
|
33541 | _this.destroyBean(headerCtrl);
|
33542 | headerCtrl = undefined;
|
33543 | }
|
33544 | if (headerCtrl == null) {
|
33545 | switch (_this.type) {
|
33546 | case HeaderRowType.FLOATING_FILTER:
|
33547 | headerCtrl = _this.createBean(new HeaderFilterCellCtrl(child, _this));
|
33548 | break;
|
33549 | case HeaderRowType.COLUMN_GROUP:
|
33550 | headerCtrl = _this.createBean(new HeaderGroupCellCtrl(child, _this));
|
33551 | break;
|
33552 | default:
|
33553 | headerCtrl = _this.createBean(new HeaderCellCtrl(child, _this));
|
33554 | break;
|
33555 | }
|
33556 | }
|
33557 | _this.headerCellCtrls[idOfChild] = headerCtrl;
|
33558 | });
|
33559 |
|
33560 | var isFocusedAndDisplayed = function (ctrl) {
|
33561 | var isFocused = _this.focusService.isHeaderWrapperFocused(ctrl);
|
33562 | if (!isFocused) {
|
33563 | return false;
|
33564 | }
|
33565 | var isDisplayed = _this.columnModel.isDisplayed(ctrl.getColumnGroupChild());
|
33566 | return isDisplayed;
|
33567 | };
|
33568 | iterateObject(oldCtrls, function (id, oldCtrl) {
|
33569 | var keepCtrl = isFocusedAndDisplayed(oldCtrl);
|
33570 | if (keepCtrl) {
|
33571 | _this.headerCellCtrls[id] = oldCtrl;
|
33572 | }
|
33573 | else {
|
33574 | _this.destroyBean(oldCtrl);
|
33575 | }
|
33576 | });
|
33577 | var ctrlsToDisplay = getAllValuesInObject(this.headerCellCtrls);
|
33578 | this.comp.setHeaderCtrls(ctrlsToDisplay);
|
33579 | };
|
33580 | HeaderRowCtrl.prototype.destroyCtrls = function () {
|
33581 | var _this = this;
|
33582 | iterateObject(this.headerCellCtrls, function (key, ctrl) {
|
33583 | _this.destroyBean(ctrl);
|
33584 | });
|
33585 | this.headerCellCtrls = {};
|
33586 | };
|
33587 | HeaderRowCtrl.prototype.getColumnsInViewport = function () {
|
33588 | var printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
|
33589 | return printLayout ? this.getColumnsInViewportPrintLayout() : this.getColumnsInViewportNormalLayout();
|
33590 | };
|
33591 | HeaderRowCtrl.prototype.getColumnsInViewportPrintLayout = function () {
|
33592 | var _this = this;
|
33593 |
|
33594 | if (this.pinned != null) {
|
33595 | return [];
|
33596 | }
|
33597 | var viewportColumns = [];
|
33598 | var actualDepth = this.getActualDepth();
|
33599 | [Constants.PINNED_LEFT, null, Constants.PINNED_RIGHT].forEach(function (pinned) {
|
33600 | var items = _this.columnModel.getVirtualHeaderGroupRow(pinned, actualDepth);
|
33601 | viewportColumns = viewportColumns.concat(items);
|
33602 | });
|
33603 | return viewportColumns;
|
33604 | };
|
33605 | HeaderRowCtrl.prototype.getActualDepth = function () {
|
33606 | return this.type == HeaderRowType.FLOATING_FILTER ? this.rowIndex - 1 : this.rowIndex;
|
33607 | };
|
33608 | HeaderRowCtrl.prototype.getColumnsInViewportNormalLayout = function () {
|
33609 |
|
33610 | return this.columnModel.getVirtualHeaderGroupRow(this.pinned, this.getActualDepth());
|
33611 | };
|
33612 | HeaderRowCtrl.prototype.focusHeader = function (column, event) {
|
33613 | var allCtrls = getAllValuesInObject(this.headerCellCtrls);
|
33614 | var ctrl = allCtrls.find(function (ctrl) { return ctrl.getColumnGroupChild() == column; });
|
33615 | if (!ctrl) {
|
33616 | return false;
|
33617 | }
|
33618 | ctrl.focus(event);
|
33619 | return true;
|
33620 | };
|
33621 | __decorate$1i([
|
33622 | Autowired('columnModel')
|
33623 | ], HeaderRowCtrl.prototype, "columnModel", void 0);
|
33624 | __decorate$1i([
|
33625 | Autowired('focusService')
|
33626 | ], HeaderRowCtrl.prototype, "focusService", void 0);
|
33627 | __decorate$1i([
|
33628 | PreDestroy
|
33629 | ], HeaderRowCtrl.prototype, "destroyCtrls", null);
|
33630 | return HeaderRowCtrl;
|
33631 | }(BeanStub));
|
33632 |
|
33633 |
|
33634 |
|
33635 |
|
33636 |
|
33637 |
|
33638 |
|
33639 | var __extends$1w = (undefined && undefined.__extends) || (function () {
|
33640 | var extendStatics = function (d, b) {
|
33641 | extendStatics = Object.setPrototypeOf ||
|
33642 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
33643 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
33644 | return extendStatics(d, b);
|
33645 | };
|
33646 | return function (d, b) {
|
33647 | extendStatics(d, b);
|
33648 | function __() { this.constructor = d; }
|
33649 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
33650 | };
|
33651 | })();
|
33652 | var __decorate$1j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
33653 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
33654 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
33655 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
33656 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
33657 | };
|
33658 | var __read$c = (undefined && undefined.__read) || function (o, n) {
|
33659 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
33660 | if (!m) return o;
|
33661 | var i = m.call(o), r, ar = [], e;
|
33662 | try {
|
33663 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
33664 | }
|
33665 | catch (error) { e = { error: error }; }
|
33666 | finally {
|
33667 | try {
|
33668 | if (r && !r.done && (m = i["return"])) m.call(i);
|
33669 | }
|
33670 | finally { if (e) throw e.error; }
|
33671 | }
|
33672 | return ar;
|
33673 | };
|
33674 | var __spread$9 = (undefined && undefined.__spread) || function () {
|
33675 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$c(arguments[i]));
|
33676 | return ar;
|
33677 | };
|
33678 | var HeaderRowContainerCtrl = (function (_super) {
|
33679 | __extends$1w(HeaderRowContainerCtrl, _super);
|
33680 | function HeaderRowContainerCtrl(pinned) {
|
33681 | var _this = _super.call(this) || this;
|
33682 | _this.groupsRowCtrls = [];
|
33683 | _this.pinned = pinned;
|
33684 | return _this;
|
33685 | }
|
33686 | HeaderRowContainerCtrl.prototype.setComp = function (comp, eGui) {
|
33687 | this.comp = comp;
|
33688 | this.setupCenterWidth();
|
33689 | this.setupPinnedWidth();
|
33690 | this.setupDragAndDrop(eGui);
|
33691 | this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.onGridColumnsChanged.bind(this));
|
33692 | this.ctrlsService.registerHeaderContainer(this, this.pinned);
|
33693 | if (this.columnModel.isReady()) {
|
33694 | this.refresh();
|
33695 | }
|
33696 | };
|
33697 | HeaderRowContainerCtrl.prototype.setupDragAndDrop = function (dropContainer) {
|
33698 | var bodyDropTarget = new BodyDropTarget(this.pinned, dropContainer);
|
33699 | this.createManagedBean(bodyDropTarget);
|
33700 | };
|
33701 | HeaderRowContainerCtrl.prototype.refresh = function (keepColumns) {
|
33702 | var _this = this;
|
33703 | if (keepColumns === void 0) { keepColumns = false; }
|
33704 | var sequence = new NumberSequence();
|
33705 | var focusedHeaderPosition = this.focusService.getFocusHeaderToUseAfterRefresh();
|
33706 | var refreshColumnGroups = function () {
|
33707 | var groupRowCount = _this.columnModel.getHeaderRowCount() - 1;
|
33708 | _this.groupsRowCtrls = _this.destroyBeans(_this.groupsRowCtrls);
|
33709 | for (var i = 0; i < groupRowCount; i++) {
|
33710 | var ctrl = _this.createBean(new HeaderRowCtrl(sequence.next(), _this.pinned, HeaderRowType.COLUMN_GROUP));
|
33711 | _this.groupsRowCtrls.push(ctrl);
|
33712 | }
|
33713 | };
|
33714 | var refreshColumns = function () {
|
33715 | var rowIndex = sequence.next();
|
33716 | var needNewInstance = _this.columnsRowCtrl == null || !keepColumns || _this.columnsRowCtrl.getRowIndex() !== rowIndex;
|
33717 | if (needNewInstance) {
|
33718 | _this.destroyBean(_this.columnsRowCtrl);
|
33719 | _this.columnsRowCtrl = _this.createBean(new HeaderRowCtrl(rowIndex, _this.pinned, HeaderRowType.COLUMN));
|
33720 | }
|
33721 | };
|
33722 | var refreshFilters = function () {
|
33723 | var includeFloatingFilter = _this.columnModel.hasFloatingFilters();
|
33724 | var destroyPreviousComp = function () {
|
33725 | _this.filtersRowCtrl = _this.destroyBean(_this.filtersRowCtrl);
|
33726 | };
|
33727 | if (!includeFloatingFilter) {
|
33728 | destroyPreviousComp();
|
33729 | return;
|
33730 | }
|
33731 | var rowIndex = sequence.next();
|
33732 | if (_this.filtersRowCtrl) {
|
33733 | var rowIndexMismatch = _this.filtersRowCtrl.getRowIndex() !== rowIndex;
|
33734 | if (!keepColumns || rowIndexMismatch) {
|
33735 | destroyPreviousComp();
|
33736 | }
|
33737 | }
|
33738 | if (!_this.filtersRowCtrl) {
|
33739 | _this.filtersRowCtrl = _this.createBean(new HeaderRowCtrl(rowIndex, _this.pinned, HeaderRowType.FLOATING_FILTER));
|
33740 | }
|
33741 | };
|
33742 | refreshColumnGroups();
|
33743 | refreshColumns();
|
33744 | refreshFilters();
|
33745 | var allCtrls = this.getAllCtrls();
|
33746 | this.comp.setCtrls(allCtrls);
|
33747 | this.restoreFocusOnHeader(focusedHeaderPosition);
|
33748 | };
|
33749 | HeaderRowContainerCtrl.prototype.restoreFocusOnHeader = function (position) {
|
33750 | if (position == null || position.column.getPinned() != this.pinned) {
|
33751 | return;
|
33752 | }
|
33753 | this.focusService.focusHeaderPosition({ headerPosition: position });
|
33754 | };
|
33755 | HeaderRowContainerCtrl.prototype.getAllCtrls = function () {
|
33756 | var res = __spread$9(this.groupsRowCtrls, [this.columnsRowCtrl]);
|
33757 | if (this.filtersRowCtrl) {
|
33758 | res.push(this.filtersRowCtrl);
|
33759 | }
|
33760 | return res;
|
33761 | };
|
33762 |
|
33763 |
|
33764 | HeaderRowContainerCtrl.prototype.onGridColumnsChanged = function () {
|
33765 | this.refresh(true);
|
33766 | };
|
33767 | HeaderRowContainerCtrl.prototype.setupCenterWidth = function () {
|
33768 | var _this = this;
|
33769 | if (this.pinned != null) {
|
33770 | return;
|
33771 | }
|
33772 | this.createManagedBean(new CenterWidthFeature(function (width) { return _this.comp.setCenterWidth(width + "px"); }));
|
33773 | };
|
33774 | HeaderRowContainerCtrl.prototype.setHorizontalScroll = function (offset) {
|
33775 | this.comp.setContainerTransform("translateX(" + offset + "px)");
|
33776 | };
|
33777 | HeaderRowContainerCtrl.prototype.setupPinnedWidth = function () {
|
33778 | var _this = this;
|
33779 | if (this.pinned == null) {
|
33780 | return;
|
33781 | }
|
33782 | var pinningLeft = this.pinned === Constants.PINNED_LEFT;
|
33783 | var pinningRight = this.pinned === Constants.PINNED_RIGHT;
|
33784 | var listener = function () {
|
33785 | var width = pinningLeft ? _this.pinnedWidthService.getPinnedLeftWidth() : _this.pinnedWidthService.getPinnedRightWidth();
|
33786 | if (width == null) {
|
33787 | return;
|
33788 | }
|
33789 | var hidden = width == 0;
|
33790 | var isRtl = _this.gridOptionsWrapper.isEnableRtl();
|
33791 | var scrollbarWidth = _this.gridOptionsWrapper.getScrollbarWidth();
|
33792 |
|
33793 |
|
33794 |
|
33795 | var addPaddingForScrollbar = _this.scrollVisibleService.isVerticalScrollShowing() && ((isRtl && pinningLeft) || (!isRtl && pinningRight));
|
33796 | var widthWithPadding = addPaddingForScrollbar ? width + scrollbarWidth : width;
|
33797 | _this.comp.setPinnedContainerWidth(widthWithPadding + 'px');
|
33798 | _this.comp.addOrRemoveCssClass('ag-hidden', hidden);
|
33799 | };
|
33800 | this.addManagedListener(this.eventService, Events.EVENT_LEFT_PINNED_WIDTH_CHANGED, listener);
|
33801 | this.addManagedListener(this.eventService, Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED, listener);
|
33802 | this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, listener);
|
33803 | this.addManagedListener(this.eventService, Events.EVENT_SCROLLBAR_WIDTH_CHANGED, listener);
|
33804 | };
|
33805 | HeaderRowContainerCtrl.prototype.getHeaderCtrlForColumn = function (column) {
|
33806 | if (column instanceof Column) {
|
33807 | if (!this.columnsRowCtrl) {
|
33808 | return;
|
33809 | }
|
33810 | return this.columnsRowCtrl.getHeaderCellCtrl(column);
|
33811 | }
|
33812 | if (this.groupsRowCtrls.length === 0) {
|
33813 | return;
|
33814 | }
|
33815 | for (var i = 0; i < this.groupsRowCtrls.length; i++) {
|
33816 | var ctrl = this.groupsRowCtrls[i].getHeaderCellCtrl(column);
|
33817 | if (ctrl) {
|
33818 | return ctrl;
|
33819 | }
|
33820 | }
|
33821 | };
|
33822 | HeaderRowContainerCtrl.prototype.getHtmlElementForColumnHeader = function (column) {
|
33823 |
|
33824 | var cellCtrl = this.getHeaderCtrlForColumn(column);
|
33825 | if (!cellCtrl) {
|
33826 | return null;
|
33827 | }
|
33828 | return cellCtrl.getGui();
|
33829 | };
|
33830 | HeaderRowContainerCtrl.prototype.getRowType = function (rowIndex) {
|
33831 | var allCtrls = this.getAllCtrls();
|
33832 | var ctrl = allCtrls[rowIndex];
|
33833 | return ctrl ? ctrl.getType() : undefined;
|
33834 | };
|
33835 | HeaderRowContainerCtrl.prototype.focusHeader = function (rowIndex, column, event) {
|
33836 | var allCtrls = this.getAllCtrls();
|
33837 | var ctrl = allCtrls[rowIndex];
|
33838 | if (!ctrl) {
|
33839 | return false;
|
33840 | }
|
33841 | return ctrl.focusHeader(column, event);
|
33842 | };
|
33843 | HeaderRowContainerCtrl.prototype.getRowCount = function () {
|
33844 | return this.getAllCtrls().length;
|
33845 | };
|
33846 | __decorate$1j([
|
33847 | Autowired('ctrlsService')
|
33848 | ], HeaderRowContainerCtrl.prototype, "ctrlsService", void 0);
|
33849 | __decorate$1j([
|
33850 | Autowired('scrollVisibleService')
|
33851 | ], HeaderRowContainerCtrl.prototype, "scrollVisibleService", void 0);
|
33852 | __decorate$1j([
|
33853 | Autowired('pinnedWidthService')
|
33854 | ], HeaderRowContainerCtrl.prototype, "pinnedWidthService", void 0);
|
33855 | __decorate$1j([
|
33856 | Autowired('columnModel')
|
33857 | ], HeaderRowContainerCtrl.prototype, "columnModel", void 0);
|
33858 | __decorate$1j([
|
33859 | Autowired('focusService')
|
33860 | ], HeaderRowContainerCtrl.prototype, "focusService", void 0);
|
33861 | return HeaderRowContainerCtrl;
|
33862 | }(BeanStub));
|
33863 |
|
33864 |
|
33865 |
|
33866 |
|
33867 |
|
33868 |
|
33869 |
|
33870 | var __extends$1x = (undefined && undefined.__extends) || (function () {
|
33871 | var extendStatics = function (d, b) {
|
33872 | extendStatics = Object.setPrototypeOf ||
|
33873 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
33874 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
33875 | return extendStatics(d, b);
|
33876 | };
|
33877 | return function (d, b) {
|
33878 | extendStatics(d, b);
|
33879 | function __() { this.constructor = d; }
|
33880 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
33881 | };
|
33882 | })();
|
33883 | var __decorate$1k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
33884 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
33885 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
33886 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
33887 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
33888 | };
|
33889 | var HeaderRowContainerComp = (function (_super) {
|
33890 | __extends$1x(HeaderRowContainerComp, _super);
|
33891 | function HeaderRowContainerComp(pinned) {
|
33892 | var _this = _super.call(this) || this;
|
33893 | _this.headerRowComps = {};
|
33894 | _this.rowCompsList = [];
|
33895 | _this.pinned = pinned;
|
33896 | return _this;
|
33897 | }
|
33898 | HeaderRowContainerComp.prototype.init = function () {
|
33899 | var _this = this;
|
33900 | this.selectAndSetTemplate();
|
33901 | var compProxy = {
|
33902 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
33903 | setCtrls: function (ctrls) { return _this.setCtrls(ctrls); },
|
33904 |
|
33905 | setCenterWidth: function (width) { return _this.eCenterContainer.style.width = width; },
|
33906 | setContainerTransform: function (transform) { return _this.eCenterContainer.style.transform = transform; },
|
33907 |
|
33908 | setPinnedContainerWidth: function (width) {
|
33909 | var eGui = _this.getGui();
|
33910 | eGui.style.width = width;
|
33911 | eGui.style.maxWidth = width;
|
33912 | eGui.style.minWidth = width;
|
33913 | }
|
33914 | };
|
33915 | var ctrl = this.createManagedBean(new HeaderRowContainerCtrl(this.pinned));
|
33916 | ctrl.setComp(compProxy, this.getGui());
|
33917 | };
|
33918 | HeaderRowContainerComp.prototype.selectAndSetTemplate = function () {
|
33919 | var pinnedLeft = this.pinned == Constants.PINNED_LEFT;
|
33920 | var pinnedRight = this.pinned == Constants.PINNED_RIGHT;
|
33921 | var template = pinnedLeft ? HeaderRowContainerComp.PINNED_LEFT_TEMPLATE :
|
33922 | pinnedRight ? HeaderRowContainerComp.PINNED_RIGHT_TEMPLATE : HeaderRowContainerComp.CENTER_TEMPLATE;
|
33923 | this.setTemplate(template);
|
33924 |
|
33925 |
|
33926 | this.eRowContainer = this.eCenterContainer ? this.eCenterContainer : this.getGui();
|
33927 | };
|
33928 | HeaderRowContainerComp.prototype.destroyRowComps = function () {
|
33929 | this.setCtrls([]);
|
33930 | };
|
33931 | HeaderRowContainerComp.prototype.destroyRowComp = function (rowComp) {
|
33932 | this.destroyBean(rowComp);
|
33933 | this.eRowContainer.removeChild(rowComp.getGui());
|
33934 | };
|
33935 | HeaderRowContainerComp.prototype.setCtrls = function (ctrls) {
|
33936 | var _this = this;
|
33937 | var oldRowComps = this.headerRowComps;
|
33938 | this.headerRowComps = {};
|
33939 | this.rowCompsList = [];
|
33940 | var prevGui;
|
33941 | var appendEnsuringDomOrder = function (rowComp) {
|
33942 | var eGui = rowComp.getGui();
|
33943 | var notAlreadyIn = eGui.parentElement != _this.eRowContainer;
|
33944 | if (notAlreadyIn) {
|
33945 | _this.eRowContainer.appendChild(eGui);
|
33946 | }
|
33947 | if (prevGui) {
|
33948 | ensureDomOrder(_this.eRowContainer, eGui, prevGui);
|
33949 | }
|
33950 | prevGui = eGui;
|
33951 | };
|
33952 | ctrls.forEach(function (ctrl) {
|
33953 | var ctrlId = ctrl.getInstanceId();
|
33954 | var existingComp = oldRowComps[ctrlId];
|
33955 | delete oldRowComps[ctrlId];
|
33956 | var rowComp = existingComp ? existingComp : _this.createBean(new HeaderRowComp(ctrl));
|
33957 | _this.headerRowComps[ctrlId] = rowComp;
|
33958 | _this.rowCompsList.push(rowComp);
|
33959 | appendEnsuringDomOrder(rowComp);
|
33960 | });
|
33961 | getAllValuesInObject(oldRowComps).forEach(function (c) { return _this.destroyRowComp(c); });
|
33962 | };
|
33963 | HeaderRowContainerComp.PINNED_LEFT_TEMPLATE = "<div class=\"ag-pinned-left-header\" role=\"presentation\"/>";
|
33964 | HeaderRowContainerComp.PINNED_RIGHT_TEMPLATE = "<div class=\"ag-pinned-right-header\" role=\"presentation\"/>";
|
33965 | HeaderRowContainerComp.CENTER_TEMPLATE = "<div class=\"ag-header-viewport\" role=\"presentation\">\n <div class=\"ag-header-container\" ref=\"eCenterContainer\" role=\"rowgroup\"></div>\n </div>";
|
33966 | __decorate$1k([
|
33967 | RefSelector('eCenterContainer')
|
33968 | ], HeaderRowContainerComp.prototype, "eCenterContainer", void 0);
|
33969 | __decorate$1k([
|
33970 | PostConstruct
|
33971 | ], HeaderRowContainerComp.prototype, "init", null);
|
33972 | __decorate$1k([
|
33973 | PreDestroy
|
33974 | ], HeaderRowContainerComp.prototype, "destroyRowComps", null);
|
33975 | return HeaderRowContainerComp;
|
33976 | }(Component));
|
33977 |
|
33978 |
|
33979 |
|
33980 |
|
33981 |
|
33982 |
|
33983 |
|
33984 | var __extends$1y = (undefined && undefined.__extends) || (function () {
|
33985 | var extendStatics = function (d, b) {
|
33986 | extendStatics = Object.setPrototypeOf ||
|
33987 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
33988 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
33989 | return extendStatics(d, b);
|
33990 | };
|
33991 | return function (d, b) {
|
33992 | extendStatics(d, b);
|
33993 | function __() { this.constructor = d; }
|
33994 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
33995 | };
|
33996 | })();
|
33997 | var __decorate$1l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
33998 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
33999 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34000 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34001 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34002 | };
|
34003 | var HeaderNavigationDirection;
|
34004 | (function (HeaderNavigationDirection) {
|
34005 | HeaderNavigationDirection[HeaderNavigationDirection["UP"] = 0] = "UP";
|
34006 | HeaderNavigationDirection[HeaderNavigationDirection["DOWN"] = 1] = "DOWN";
|
34007 | HeaderNavigationDirection[HeaderNavigationDirection["LEFT"] = 2] = "LEFT";
|
34008 | HeaderNavigationDirection[HeaderNavigationDirection["RIGHT"] = 3] = "RIGHT";
|
34009 | })(HeaderNavigationDirection || (HeaderNavigationDirection = {}));
|
34010 | var HeaderNavigationService = (function (_super) {
|
34011 | __extends$1y(HeaderNavigationService, _super);
|
34012 | function HeaderNavigationService() {
|
34013 | return _super !== null && _super.apply(this, arguments) || this;
|
34014 | }
|
34015 | HeaderNavigationService.prototype.postConstruct = function () {
|
34016 | var _this = this;
|
34017 | this.ctrlsService.whenReady(function (p) {
|
34018 | _this.gridBodyCon = p.gridBodyCtrl;
|
34019 | });
|
34020 | };
|
34021 | HeaderNavigationService.prototype.getHeaderRowCount = function () {
|
34022 | var centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();
|
34023 | return centerHeaderContainer ? centerHeaderContainer.getRowCount() : 0;
|
34024 | };
|
34025 | HeaderNavigationService.prototype.getHeaderRowType = function (rowIndex) {
|
34026 | var centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();
|
34027 | if (centerHeaderContainer) {
|
34028 | return centerHeaderContainer.getRowType(rowIndex);
|
34029 | }
|
34030 | };
|
34031 | |
34032 |
|
34033 |
|
34034 |
|
34035 | HeaderNavigationService.prototype.navigateVertically = function (direction, fromHeader, event) {
|
34036 | if (!fromHeader) {
|
34037 | fromHeader = this.focusService.getFocusedHeader();
|
34038 | }
|
34039 | if (!fromHeader) {
|
34040 | return false;
|
34041 | }
|
34042 | var headerRowIndex = fromHeader.headerRowIndex, column = fromHeader.column;
|
34043 | var rowLen = this.getHeaderRowCount();
|
34044 | var isUp = direction === HeaderNavigationDirection.UP;
|
34045 | var nextRow = isUp ? headerRowIndex - 1 : headerRowIndex + 1;
|
34046 | var nextFocusColumn = null;
|
34047 | var skipColumn = false;
|
34048 | if (nextRow < 0) {
|
34049 | nextRow = 0;
|
34050 | nextFocusColumn = column;
|
34051 | skipColumn = true;
|
34052 | }
|
34053 | if (nextRow >= rowLen) {
|
34054 | nextRow = -1;
|
34055 | }
|
34056 | var currentRowType = this.getHeaderRowType(headerRowIndex);
|
34057 | if (!skipColumn) {
|
34058 | if (currentRowType === HeaderRowType.COLUMN_GROUP) {
|
34059 | var currentColumn = column;
|
34060 | nextFocusColumn = isUp ? column.getParent() : currentColumn.getDisplayedChildren()[0];
|
34061 | }
|
34062 | else if (currentRowType === HeaderRowType.FLOATING_FILTER) {
|
34063 | nextFocusColumn = column;
|
34064 | }
|
34065 | else {
|
34066 | var currentColumn = column;
|
34067 | nextFocusColumn = isUp ? currentColumn.getParent() : currentColumn;
|
34068 | }
|
34069 | if (!nextFocusColumn) {
|
34070 | return false;
|
34071 | }
|
34072 | }
|
34073 | return this.focusService.focusHeaderPosition({
|
34074 | headerPosition: { headerRowIndex: nextRow, column: nextFocusColumn },
|
34075 | allowUserOverride: true,
|
34076 | event: event
|
34077 | });
|
34078 | };
|
34079 | |
34080 |
|
34081 |
|
34082 |
|
34083 | HeaderNavigationService.prototype.navigateHorizontally = function (direction, fromTab, event) {
|
34084 | if (fromTab === void 0) { fromTab = false; }
|
34085 | var focusedHeader = this.focusService.getFocusedHeader();
|
34086 | var isLeft = direction === HeaderNavigationDirection.LEFT;
|
34087 | var isRtl = this.gridOptionsWrapper.isEnableRtl();
|
34088 | var nextHeader;
|
34089 | var normalisedDirection;
|
34090 |
|
34091 | if (isLeft !== isRtl) {
|
34092 | normalisedDirection = 'Before';
|
34093 | nextHeader = this.headerPositionUtils.findHeader(focusedHeader, normalisedDirection);
|
34094 | }
|
34095 | else {
|
34096 | normalisedDirection = 'After';
|
34097 | nextHeader = this.headerPositionUtils.findHeader(focusedHeader, normalisedDirection);
|
34098 | }
|
34099 | if (nextHeader) {
|
34100 | return this.focusService.focusHeaderPosition({
|
34101 | headerPosition: nextHeader,
|
34102 | direction: normalisedDirection,
|
34103 | fromTab: fromTab,
|
34104 | allowUserOverride: true,
|
34105 | event: event
|
34106 | });
|
34107 | }
|
34108 | if (!fromTab) {
|
34109 | return true;
|
34110 | }
|
34111 | return this.focusNextHeaderRow(focusedHeader, normalisedDirection, event);
|
34112 | };
|
34113 | HeaderNavigationService.prototype.focusNextHeaderRow = function (focusedHeader, direction, event) {
|
34114 | var currentIndex = focusedHeader.headerRowIndex;
|
34115 | var nextPosition = null;
|
34116 | var nextRowIndex;
|
34117 | if (direction === 'Before') {
|
34118 | if (currentIndex > 0) {
|
34119 | nextRowIndex = currentIndex - 1;
|
34120 | nextPosition = this.headerPositionUtils.findColAtEdgeForHeaderRow(nextRowIndex, 'end');
|
34121 | }
|
34122 | }
|
34123 | else {
|
34124 | nextRowIndex = currentIndex + 1;
|
34125 | nextPosition = this.headerPositionUtils.findColAtEdgeForHeaderRow(nextRowIndex, 'start');
|
34126 | }
|
34127 | return this.focusService.focusHeaderPosition({
|
34128 | headerPosition: nextPosition,
|
34129 | direction: direction,
|
34130 | fromTab: true,
|
34131 | allowUserOverride: true,
|
34132 | event: event
|
34133 | });
|
34134 | };
|
34135 | HeaderNavigationService.prototype.scrollToColumn = function (column, direction) {
|
34136 | if (direction === void 0) { direction = 'After'; }
|
34137 | if (column.getPinned()) {
|
34138 | return;
|
34139 | }
|
34140 | var columnToScrollTo;
|
34141 | if (column instanceof ColumnGroup) {
|
34142 | var columns = column.getDisplayedLeafColumns();
|
34143 | columnToScrollTo = direction === 'Before' ? last(columns) : columns[0];
|
34144 | }
|
34145 | else {
|
34146 | columnToScrollTo = column;
|
34147 | }
|
34148 | this.gridBodyCon.getScrollFeature().ensureColumnVisible(columnToScrollTo);
|
34149 |
|
34150 |
|
34151 | this.gridBodyCon.getScrollFeature().horizontallyScrollHeaderCenterAndFloatingCenter();
|
34152 |
|
34153 | this.animationFrameService.flushAllFrames();
|
34154 | };
|
34155 | __decorate$1l([
|
34156 | Autowired('focusService')
|
34157 | ], HeaderNavigationService.prototype, "focusService", void 0);
|
34158 | __decorate$1l([
|
34159 | Autowired('headerPositionUtils')
|
34160 | ], HeaderNavigationService.prototype, "headerPositionUtils", void 0);
|
34161 | __decorate$1l([
|
34162 | Autowired('animationFrameService')
|
34163 | ], HeaderNavigationService.prototype, "animationFrameService", void 0);
|
34164 | __decorate$1l([
|
34165 | Autowired('ctrlsService')
|
34166 | ], HeaderNavigationService.prototype, "ctrlsService", void 0);
|
34167 | __decorate$1l([
|
34168 | PostConstruct
|
34169 | ], HeaderNavigationService.prototype, "postConstruct", null);
|
34170 | HeaderNavigationService = __decorate$1l([
|
34171 | Bean('headerNavigationService')
|
34172 | ], HeaderNavigationService);
|
34173 | return HeaderNavigationService;
|
34174 | }(BeanStub));
|
34175 |
|
34176 |
|
34177 |
|
34178 |
|
34179 |
|
34180 |
|
34181 |
|
34182 | var __extends$1z = (undefined && undefined.__extends) || (function () {
|
34183 | var extendStatics = function (d, b) {
|
34184 | extendStatics = Object.setPrototypeOf ||
|
34185 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34186 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
34187 | return extendStatics(d, b);
|
34188 | };
|
34189 | return function (d, b) {
|
34190 | extendStatics(d, b);
|
34191 | function __() { this.constructor = d; }
|
34192 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34193 | };
|
34194 | })();
|
34195 | var __decorate$1m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34196 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34197 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34198 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34199 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34200 | };
|
34201 | var GridHeaderCtrl = (function (_super) {
|
34202 | __extends$1z(GridHeaderCtrl, _super);
|
34203 | function GridHeaderCtrl() {
|
34204 | return _super !== null && _super.apply(this, arguments) || this;
|
34205 | }
|
34206 | GridHeaderCtrl.prototype.setComp = function (comp, eGui, eFocusableElement) {
|
34207 | this.comp = comp;
|
34208 | this.eGui = eGui;
|
34209 | this.createManagedBean(new ManagedFocusFeature(eFocusableElement, {
|
34210 | onTabKeyDown: this.onTabKeyDown.bind(this),
|
34211 | handleKeyDown: this.handleKeyDown.bind(this),
|
34212 | onFocusOut: this.onFocusOut.bind(this)
|
34213 | }));
|
34214 |
|
34215 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, this.onPivotModeChanged.bind(this));
|
34216 | this.onPivotModeChanged();
|
34217 | this.setupHeaderHeight();
|
34218 | this.ctrlsService.registerGridHeaderCtrl(this);
|
34219 | };
|
34220 | GridHeaderCtrl.prototype.setupHeaderHeight = function () {
|
34221 | var listener = this.setHeaderHeight.bind(this);
|
34222 | listener();
|
34223 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_HEADER_HEIGHT, listener);
|
34224 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_PIVOT_HEADER_HEIGHT, listener);
|
34225 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_GROUP_HEADER_HEIGHT, listener);
|
34226 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_PIVOT_GROUP_HEADER_HEIGHT, listener);
|
34227 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_FLOATING_FILTERS_HEIGHT, listener);
|
34228 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);
|
34229 | };
|
34230 | GridHeaderCtrl.prototype.setHeaderHeight = function () {
|
34231 | var _a = this, columnModel = _a.columnModel, gridOptionsWrapper = _a.gridOptionsWrapper;
|
34232 | var numberOfFloating = 0;
|
34233 | var headerRowCount = columnModel.getHeaderRowCount();
|
34234 | var totalHeaderHeight;
|
34235 | var groupHeight;
|
34236 | var headerHeight;
|
34237 | var hasFloatingFilters = columnModel.hasFloatingFilters();
|
34238 | if (hasFloatingFilters) {
|
34239 | headerRowCount++;
|
34240 | numberOfFloating = 1;
|
34241 | }
|
34242 | if (columnModel.isPivotMode()) {
|
34243 | groupHeight = gridOptionsWrapper.getPivotGroupHeaderHeight();
|
34244 | headerHeight = gridOptionsWrapper.getPivotHeaderHeight();
|
34245 | }
|
34246 | else {
|
34247 | groupHeight = gridOptionsWrapper.getGroupHeaderHeight();
|
34248 | headerHeight = gridOptionsWrapper.getHeaderHeight();
|
34249 | }
|
34250 | var numberOfNonGroups = 1 + numberOfFloating;
|
34251 | var numberOfGroups = headerRowCount - numberOfNonGroups;
|
34252 | totalHeaderHeight = numberOfFloating * gridOptionsWrapper.getFloatingFiltersHeight();
|
34253 | totalHeaderHeight += numberOfGroups * groupHeight;
|
34254 | totalHeaderHeight += headerHeight;
|
34255 |
|
34256 |
|
34257 | var px = totalHeaderHeight + 1 + "px";
|
34258 | this.comp.setHeightAndMinHeight(px);
|
34259 | };
|
34260 | GridHeaderCtrl.prototype.onPivotModeChanged = function () {
|
34261 | var pivotMode = this.columnModel.isPivotMode();
|
34262 | this.comp.addOrRemoveCssClass('ag-pivot-on', pivotMode);
|
34263 | this.comp.addOrRemoveCssClass('ag-pivot-off', !pivotMode);
|
34264 | };
|
34265 | GridHeaderCtrl.prototype.onTabKeyDown = function (e) {
|
34266 | var isRtl = this.gridOptionsWrapper.isEnableRtl();
|
34267 | var direction = e.shiftKey !== isRtl
|
34268 | ? HeaderNavigationDirection.LEFT
|
34269 | : HeaderNavigationDirection.RIGHT;
|
34270 | if (this.headerNavigationService.navigateHorizontally(direction, true, e) ||
|
34271 | this.focusService.focusNextGridCoreContainer(e.shiftKey)) {
|
34272 | e.preventDefault();
|
34273 | }
|
34274 | };
|
34275 | GridHeaderCtrl.prototype.handleKeyDown = function (e) {
|
34276 | var direction = null;
|
34277 | switch (e.key) {
|
34278 | case KeyCode.LEFT:
|
34279 | direction = HeaderNavigationDirection.LEFT;
|
34280 | case KeyCode.RIGHT:
|
34281 | if (!exists(direction)) {
|
34282 | direction = HeaderNavigationDirection.RIGHT;
|
34283 | }
|
34284 | this.headerNavigationService.navigateHorizontally(direction, false, e);
|
34285 | break;
|
34286 | case KeyCode.UP:
|
34287 | direction = HeaderNavigationDirection.UP;
|
34288 | case KeyCode.DOWN:
|
34289 | if (!exists(direction)) {
|
34290 | direction = HeaderNavigationDirection.DOWN;
|
34291 | }
|
34292 | if (this.headerNavigationService.navigateVertically(direction, null, e)) {
|
34293 | e.preventDefault();
|
34294 | }
|
34295 | break;
|
34296 | default:
|
34297 | return;
|
34298 | }
|
34299 | };
|
34300 | GridHeaderCtrl.prototype.onFocusOut = function (e) {
|
34301 | var eDocument = this.gridOptionsWrapper.getDocument();
|
34302 | var relatedTarget = e.relatedTarget;
|
34303 | if (!relatedTarget && this.eGui.contains(eDocument.activeElement)) {
|
34304 | return;
|
34305 | }
|
34306 | if (!this.eGui.contains(relatedTarget)) {
|
34307 | this.focusService.clearFocusedHeader();
|
34308 | }
|
34309 | };
|
34310 | __decorate$1m([
|
34311 | Autowired('headerNavigationService')
|
34312 | ], GridHeaderCtrl.prototype, "headerNavigationService", void 0);
|
34313 | __decorate$1m([
|
34314 | Autowired('focusService')
|
34315 | ], GridHeaderCtrl.prototype, "focusService", void 0);
|
34316 | __decorate$1m([
|
34317 | Autowired('columnModel')
|
34318 | ], GridHeaderCtrl.prototype, "columnModel", void 0);
|
34319 | __decorate$1m([
|
34320 | Autowired('ctrlsService')
|
34321 | ], GridHeaderCtrl.prototype, "ctrlsService", void 0);
|
34322 | return GridHeaderCtrl;
|
34323 | }(BeanStub));
|
34324 |
|
34325 |
|
34326 |
|
34327 |
|
34328 |
|
34329 |
|
34330 |
|
34331 | var __extends$1A = (undefined && undefined.__extends) || (function () {
|
34332 | var extendStatics = function (d, b) {
|
34333 | extendStatics = Object.setPrototypeOf ||
|
34334 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34335 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
34336 | return extendStatics(d, b);
|
34337 | };
|
34338 | return function (d, b) {
|
34339 | extendStatics(d, b);
|
34340 | function __() { this.constructor = d; }
|
34341 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34342 | };
|
34343 | })();
|
34344 | var __decorate$1n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34345 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34346 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34347 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34348 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34349 | };
|
34350 | var GridHeaderComp = (function (_super) {
|
34351 | __extends$1A(GridHeaderComp, _super);
|
34352 | function GridHeaderComp() {
|
34353 | return _super.call(this, GridHeaderComp.TEMPLATE) || this;
|
34354 | }
|
34355 | GridHeaderComp.prototype.postConstruct = function () {
|
34356 | var _this = this;
|
34357 | var compProxy = {
|
34358 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
34359 | setHeightAndMinHeight: function (height) {
|
34360 | _this.getGui().style.height = height;
|
34361 | _this.getGui().style.minHeight = height;
|
34362 | }
|
34363 | };
|
34364 | var ctrl = this.createManagedBean(new GridHeaderCtrl());
|
34365 | ctrl.setComp(compProxy, this.getGui(), this.getFocusableElement());
|
34366 | var addContainer = function (container) {
|
34367 | _this.createManagedBean(container);
|
34368 | _this.appendChild(container);
|
34369 | };
|
34370 | addContainer(new HeaderRowContainerComp(Constants.PINNED_LEFT));
|
34371 | addContainer(new HeaderRowContainerComp(null));
|
34372 | addContainer(new HeaderRowContainerComp(Constants.PINNED_RIGHT));
|
34373 | };
|
34374 | GridHeaderComp.TEMPLATE = "<div class=\"ag-header\" role=\"presentation\"/>";
|
34375 | __decorate$1n([
|
34376 | PostConstruct
|
34377 | ], GridHeaderComp.prototype, "postConstruct", null);
|
34378 | return GridHeaderComp;
|
34379 | }(Component));
|
34380 |
|
34381 |
|
34382 |
|
34383 |
|
34384 |
|
34385 |
|
34386 |
|
34387 | var __extends$1B = (undefined && undefined.__extends) || (function () {
|
34388 | var extendStatics = function (d, b) {
|
34389 | extendStatics = Object.setPrototypeOf ||
|
34390 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34391 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
34392 | return extendStatics(d, b);
|
34393 | };
|
34394 | return function (d, b) {
|
34395 | extendStatics(d, b);
|
34396 | function __() { this.constructor = d; }
|
34397 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34398 | };
|
34399 | })();
|
34400 | var __decorate$1o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34401 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34402 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34403 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34404 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34405 | };
|
34406 | var HorizontalResizeService = (function (_super) {
|
34407 | __extends$1B(HorizontalResizeService, _super);
|
34408 | function HorizontalResizeService() {
|
34409 | return _super !== null && _super.apply(this, arguments) || this;
|
34410 | }
|
34411 | HorizontalResizeService.prototype.addResizeBar = function (params) {
|
34412 | var _this = this;
|
34413 | var dragSource = {
|
34414 | dragStartPixels: params.dragStartPixels || 0,
|
34415 | eElement: params.eResizeBar,
|
34416 | onDragStart: this.onDragStart.bind(this, params),
|
34417 | onDragStop: this.onDragStop.bind(this, params),
|
34418 | onDragging: this.onDragging.bind(this, params)
|
34419 | };
|
34420 | this.dragService.addDragSource(dragSource, true);
|
34421 |
|
34422 |
|
34423 | var finishedWithResizeFunc = function () { return _this.dragService.removeDragSource(dragSource); };
|
34424 | return finishedWithResizeFunc;
|
34425 | };
|
34426 | HorizontalResizeService.prototype.onDragStart = function (params, mouseEvent) {
|
34427 | this.dragStartX = mouseEvent.clientX;
|
34428 | this.setResizeIcons();
|
34429 | var shiftKey = mouseEvent instanceof MouseEvent && mouseEvent.shiftKey === true;
|
34430 | params.onResizeStart(shiftKey);
|
34431 | };
|
34432 | HorizontalResizeService.prototype.setResizeIcons = function () {
|
34433 | var ctrl = this.ctrlsService.getGridCtrl();
|
34434 |
|
34435 | ctrl.setResizeCursor(true);
|
34436 |
|
34437 | ctrl.disableUserSelect(true);
|
34438 | };
|
34439 | HorizontalResizeService.prototype.onDragStop = function (params, mouseEvent) {
|
34440 | params.onResizeEnd(this.resizeAmount);
|
34441 | this.resetIcons();
|
34442 | };
|
34443 | HorizontalResizeService.prototype.resetIcons = function () {
|
34444 | var ctrl = this.ctrlsService.getGridCtrl();
|
34445 | ctrl.setResizeCursor(false);
|
34446 | ctrl.disableUserSelect(false);
|
34447 | };
|
34448 | HorizontalResizeService.prototype.onDragging = function (params, mouseEvent) {
|
34449 | this.resizeAmount = mouseEvent.clientX - this.dragStartX;
|
34450 | params.onResizing(this.resizeAmount);
|
34451 | };
|
34452 | __decorate$1o([
|
34453 | Autowired('dragService')
|
34454 | ], HorizontalResizeService.prototype, "dragService", void 0);
|
34455 | __decorate$1o([
|
34456 | Autowired('ctrlsService')
|
34457 | ], HorizontalResizeService.prototype, "ctrlsService", void 0);
|
34458 | HorizontalResizeService = __decorate$1o([
|
34459 | Bean('horizontalResizeService')
|
34460 | ], HorizontalResizeService);
|
34461 | return HorizontalResizeService;
|
34462 | }(BeanStub));
|
34463 |
|
34464 |
|
34465 |
|
34466 |
|
34467 |
|
34468 |
|
34469 |
|
34470 | var __extends$1C = (undefined && undefined.__extends) || (function () {
|
34471 | var extendStatics = function (d, b) {
|
34472 | extendStatics = Object.setPrototypeOf ||
|
34473 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34474 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
34475 | return extendStatics(d, b);
|
34476 | };
|
34477 | return function (d, b) {
|
34478 | extendStatics(d, b);
|
34479 | function __() { this.constructor = d; }
|
34480 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34481 | };
|
34482 | })();
|
34483 | var __decorate$1p = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34484 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34485 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34486 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34487 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34488 | };
|
34489 | var StandardMenuFactory = (function (_super) {
|
34490 | __extends$1C(StandardMenuFactory, _super);
|
34491 | function StandardMenuFactory() {
|
34492 | return _super !== null && _super.apply(this, arguments) || this;
|
34493 | }
|
34494 | StandardMenuFactory.prototype.hideActiveMenu = function () {
|
34495 | if (this.hidePopup) {
|
34496 | this.hidePopup();
|
34497 | }
|
34498 | };
|
34499 | StandardMenuFactory.prototype.showMenuAfterMouseEvent = function (column, mouseEvent) {
|
34500 | var _this = this;
|
34501 | this.showPopup(column, function (eMenu) {
|
34502 | _this.popupService.positionPopupUnderMouseEvent({
|
34503 | column: column,
|
34504 | type: 'columnMenu',
|
34505 | mouseEvent: mouseEvent,
|
34506 | ePopup: eMenu
|
34507 | });
|
34508 | }, mouseEvent.target);
|
34509 | };
|
34510 | StandardMenuFactory.prototype.showMenuAfterButtonClick = function (column, eventSource, containerType) {
|
34511 | var _this = this;
|
34512 | this.showPopup(column, function (eMenu) {
|
34513 | _this.popupService.positionPopupUnderComponent({
|
34514 | type: containerType,
|
34515 | eventSource: eventSource,
|
34516 | ePopup: eMenu,
|
34517 | keepWithinBounds: true,
|
34518 | column: column
|
34519 | });
|
34520 | }, eventSource);
|
34521 | };
|
34522 | StandardMenuFactory.prototype.showPopup = function (column, positionCallback, eventSource) {
|
34523 | var _this = this;
|
34524 | var filterWrapper = this.filterManager.getOrCreateFilterWrapper(column, 'COLUMN_MENU');
|
34525 | if (!filterWrapper) {
|
34526 | throw new Error('AG Grid - unable to show popup filter, filter instantiation failed');
|
34527 | }
|
34528 | var eMenu = document.createElement('div');
|
34529 | setAriaRole(eMenu, 'presentation');
|
34530 | eMenu.classList.add('ag-menu');
|
34531 | this.tabListener = this.addManagedListener(eMenu, 'keydown', function (e) { return _this.trapFocusWithin(e, eMenu); });
|
34532 | filterWrapper.guiPromise.then(function (gui) { return eMenu.appendChild(gui); });
|
34533 | var hidePopup;
|
34534 | var anchorToElement = eventSource || this.ctrlsService.getGridBodyCtrl().getGui();
|
34535 | var closedCallback = function (e) {
|
34536 | column.setMenuVisible(false, 'contextMenu');
|
34537 | var isKeyboardEvent = e instanceof KeyboardEvent;
|
34538 | if (_this.tabListener) {
|
34539 | _this.tabListener = _this.tabListener();
|
34540 | }
|
34541 | if (isKeyboardEvent && eventSource && isVisible(eventSource)) {
|
34542 | var focusableEl = _this.focusService.findTabbableParent(eventSource);
|
34543 | if (focusableEl) {
|
34544 | focusableEl.focus();
|
34545 | }
|
34546 | }
|
34547 | };
|
34548 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
34549 | var addPopupRes = this.popupService.addPopup({
|
34550 | modal: true,
|
34551 | eChild: eMenu,
|
34552 | closeOnEsc: true,
|
34553 | closedCallback: closedCallback,
|
34554 | positionCallback: function () { return positionCallback(eMenu); },
|
34555 | anchorToElement: anchorToElement,
|
34556 | ariaLabel: translate('ariaLabelColumnMenu', 'Column Menu')
|
34557 | });
|
34558 | if (addPopupRes) {
|
34559 | this.hidePopup = hidePopup = addPopupRes.hideFunc;
|
34560 | }
|
34561 | filterWrapper.filterPromise.then(function (filter) {
|
34562 |
|
34563 |
|
34564 | positionCallback(eMenu);
|
34565 | if (filter.afterGuiAttached) {
|
34566 | filter.afterGuiAttached({ container: 'columnMenu', hidePopup: hidePopup });
|
34567 | }
|
34568 | });
|
34569 | column.setMenuVisible(true, 'contextMenu');
|
34570 | };
|
34571 | StandardMenuFactory.prototype.trapFocusWithin = function (e, menu) {
|
34572 | if (e.key !== KeyCode.TAB ||
|
34573 | e.defaultPrevented ||
|
34574 | this.focusService.findNextFocusableElement(menu, false, e.shiftKey)) {
|
34575 | return;
|
34576 | }
|
34577 | e.preventDefault();
|
34578 | this.focusService.focusInto(menu, e.shiftKey);
|
34579 | };
|
34580 | StandardMenuFactory.prototype.isMenuEnabled = function (column) {
|
34581 |
|
34582 | return column.isFilterAllowed();
|
34583 | };
|
34584 | __decorate$1p([
|
34585 | Autowired('filterManager')
|
34586 | ], StandardMenuFactory.prototype, "filterManager", void 0);
|
34587 | __decorate$1p([
|
34588 | Autowired('popupService')
|
34589 | ], StandardMenuFactory.prototype, "popupService", void 0);
|
34590 | __decorate$1p([
|
34591 | Autowired('focusService')
|
34592 | ], StandardMenuFactory.prototype, "focusService", void 0);
|
34593 | __decorate$1p([
|
34594 | Autowired('ctrlsService')
|
34595 | ], StandardMenuFactory.prototype, "ctrlsService", void 0);
|
34596 | StandardMenuFactory = __decorate$1p([
|
34597 | Bean('menuFactory')
|
34598 | ], StandardMenuFactory);
|
34599 | return StandardMenuFactory;
|
34600 | }(BeanStub));
|
34601 |
|
34602 |
|
34603 |
|
34604 |
|
34605 |
|
34606 |
|
34607 |
|
34608 | var __extends$1D = (undefined && undefined.__extends) || (function () {
|
34609 | var extendStatics = function (d, b) {
|
34610 | extendStatics = Object.setPrototypeOf ||
|
34611 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34612 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
34613 | return extendStatics(d, b);
|
34614 | };
|
34615 | return function (d, b) {
|
34616 | extendStatics(d, b);
|
34617 | function __() { this.constructor = d; }
|
34618 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34619 | };
|
34620 | })();
|
34621 | var __decorate$1q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34622 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34623 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34624 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34625 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34626 | };
|
34627 | var TabbedLayout = (function (_super) {
|
34628 | __extends$1D(TabbedLayout, _super);
|
34629 | function TabbedLayout(params) {
|
34630 | var _this = _super.call(this, TabbedLayout.getTemplate(params.cssClass)) || this;
|
34631 | _this.items = [];
|
34632 | _this.tabbedItemScrollMap = new Map();
|
34633 | _this.params = params;
|
34634 | if (params.items) {
|
34635 | params.items.forEach(function (item) { return _this.addItem(item); });
|
34636 | }
|
34637 | return _this;
|
34638 | }
|
34639 | TabbedLayout.prototype.postConstruct = function () {
|
34640 | this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), {
|
34641 | onTabKeyDown: this.onTabKeyDown.bind(this),
|
34642 | handleKeyDown: this.handleKeyDown.bind(this)
|
34643 | }));
|
34644 | };
|
34645 | TabbedLayout.getTemplate = function (cssClass) {
|
34646 | 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>";
|
34647 | };
|
34648 | TabbedLayout.prototype.handleKeyDown = function (e) {
|
34649 | var eDocument = this.gridOptionsWrapper.getDocument();
|
34650 | switch (e.key) {
|
34651 | case KeyCode.RIGHT:
|
34652 | case KeyCode.LEFT:
|
34653 | if (!this.eHeader.contains(eDocument.activeElement)) {
|
34654 | return;
|
34655 | }
|
34656 | var currentPosition = this.items.indexOf(this.activeItem);
|
34657 | var nextPosition = e.key === KeyCode.RIGHT ? Math.min(currentPosition + 1, this.items.length - 1) : Math.max(currentPosition - 1, 0);
|
34658 | if (currentPosition === nextPosition) {
|
34659 | return;
|
34660 | }
|
34661 | e.preventDefault();
|
34662 | var nextItem = this.items[nextPosition];
|
34663 | this.showItemWrapper(nextItem);
|
34664 | nextItem.eHeaderButton.focus();
|
34665 | break;
|
34666 | case KeyCode.UP:
|
34667 | case KeyCode.DOWN:
|
34668 | e.stopPropagation();
|
34669 | break;
|
34670 | }
|
34671 | };
|
34672 | TabbedLayout.prototype.onTabKeyDown = function (e) {
|
34673 | if (e.defaultPrevented) {
|
34674 | return;
|
34675 | }
|
34676 | var _a = this, focusService = _a.focusService, eHeader = _a.eHeader, eBody = _a.eBody, activeItem = _a.activeItem;
|
34677 | var eDocument = this.gridOptionsWrapper.getDocument();
|
34678 | var activeElement = eDocument.activeElement;
|
34679 | e.preventDefault();
|
34680 | if (eHeader.contains(activeElement)) {
|
34681 |
|
34682 | focusService.focusInto(eBody, e.shiftKey);
|
34683 | }
|
34684 | else {
|
34685 |
|
34686 | if (focusService.isFocusUnderManagedComponent(eBody)) {
|
34687 |
|
34688 | activeItem.eHeaderButton.focus();
|
34689 | }
|
34690 | else {
|
34691 | var nextEl = focusService.findNextFocusableElement(eBody, false, e.shiftKey);
|
34692 | if (nextEl) {
|
34693 |
|
34694 | nextEl.focus();
|
34695 | }
|
34696 | else {
|
34697 |
|
34698 | activeItem.eHeaderButton.focus();
|
34699 | }
|
34700 | }
|
34701 | }
|
34702 | };
|
34703 | TabbedLayout.prototype.setAfterAttachedParams = function (params) {
|
34704 | this.afterAttachedParams = params;
|
34705 | };
|
34706 | TabbedLayout.prototype.showFirstItem = function () {
|
34707 | if (this.items.length > 0) {
|
34708 | this.showItemWrapper(this.items[0]);
|
34709 | }
|
34710 | };
|
34711 | TabbedLayout.prototype.addItem = function (item) {
|
34712 | var eHeaderButton = document.createElement('span');
|
34713 | setAriaRole(eHeaderButton, 'tab');
|
34714 | eHeaderButton.setAttribute('tabIndex', '-1');
|
34715 | eHeaderButton.appendChild(item.title);
|
34716 | eHeaderButton.classList.add('ag-tab');
|
34717 | this.eHeader.appendChild(eHeaderButton);
|
34718 | setAriaLabel(eHeaderButton, item.titleLabel);
|
34719 | var wrapper = {
|
34720 | tabbedItem: item,
|
34721 | eHeaderButton: eHeaderButton
|
34722 | };
|
34723 | this.items.push(wrapper);
|
34724 | eHeaderButton.addEventListener('click', this.showItemWrapper.bind(this, wrapper));
|
34725 | };
|
34726 | TabbedLayout.prototype.showItem = function (tabbedItem) {
|
34727 | var itemWrapper = this.items.find(function (wrapper) { return wrapper.tabbedItem === tabbedItem; });
|
34728 | if (itemWrapper) {
|
34729 | this.showItemWrapper(itemWrapper);
|
34730 | }
|
34731 | };
|
34732 | TabbedLayout.prototype.showItemWrapper = function (wrapper) {
|
34733 | var _this = this;
|
34734 | var tabbedItem = wrapper.tabbedItem, eHeaderButton = wrapper.eHeaderButton;
|
34735 | if (this.params.onItemClicked) {
|
34736 | this.params.onItemClicked({ item: tabbedItem });
|
34737 | }
|
34738 | if (this.activeItem === wrapper) {
|
34739 | callIfPresent(this.params.onActiveItemClicked);
|
34740 | return;
|
34741 | }
|
34742 | if (this.lastScrollListener) {
|
34743 | this.lastScrollListener = this.lastScrollListener();
|
34744 | }
|
34745 | clearElement(this.eBody);
|
34746 | tabbedItem.bodyPromise.then(function (body) {
|
34747 | _this.eBody.appendChild(body);
|
34748 | var onlyUnmanaged = !_this.focusService.isKeyboardMode();
|
34749 | _this.focusService.focusInto(_this.eBody, false, onlyUnmanaged);
|
34750 | if (tabbedItem.afterAttachedCallback) {
|
34751 | tabbedItem.afterAttachedCallback(_this.afterAttachedParams);
|
34752 | }
|
34753 | if (_this.params.keepScrollPosition) {
|
34754 | var scrollableContainer_1 = (tabbedItem.getScrollableContainer && tabbedItem.getScrollableContainer()) || body;
|
34755 | _this.lastScrollListener = _this.addManagedListener(scrollableContainer_1, 'scroll', function () {
|
34756 | _this.tabbedItemScrollMap.set(tabbedItem.name, scrollableContainer_1.scrollTop);
|
34757 | });
|
34758 | var scrollPosition_1 = _this.tabbedItemScrollMap.get(tabbedItem.name);
|
34759 | if (scrollPosition_1 !== undefined) {
|
34760 |
|
34761 | setTimeout(function () {
|
34762 | scrollableContainer_1.scrollTop = scrollPosition_1;
|
34763 | }, 0);
|
34764 | }
|
34765 | }
|
34766 | });
|
34767 | if (this.activeItem) {
|
34768 | this.activeItem.eHeaderButton.classList.remove('ag-tab-selected');
|
34769 | }
|
34770 | eHeaderButton.classList.add('ag-tab-selected');
|
34771 | this.activeItem = wrapper;
|
34772 | };
|
34773 | __decorate$1q([
|
34774 | Autowired('focusService')
|
34775 | ], TabbedLayout.prototype, "focusService", void 0);
|
34776 | __decorate$1q([
|
34777 | RefSelector('eHeader')
|
34778 | ], TabbedLayout.prototype, "eHeader", void 0);
|
34779 | __decorate$1q([
|
34780 | RefSelector('eBody')
|
34781 | ], TabbedLayout.prototype, "eBody", void 0);
|
34782 | __decorate$1q([
|
34783 | PostConstruct
|
34784 | ], TabbedLayout.prototype, "postConstruct", null);
|
34785 | return TabbedLayout;
|
34786 | }(Component));
|
34787 |
|
34788 |
|
34789 |
|
34790 |
|
34791 |
|
34792 |
|
34793 |
|
34794 |
|
34795 |
|
34796 |
|
34797 | function simpleHttpRequest(params) {
|
34798 | return new AgPromise(function (resolve) {
|
34799 | var httpRequest = new XMLHttpRequest();
|
34800 | httpRequest.open('GET', params.url);
|
34801 | httpRequest.send();
|
34802 | httpRequest.onreadystatechange = function () {
|
34803 | if (httpRequest.readyState === 4 && httpRequest.status === 200) {
|
34804 | resolve(JSON.parse(httpRequest.responseText));
|
34805 | }
|
34806 | };
|
34807 | });
|
34808 | }
|
34809 |
|
34810 |
|
34811 |
|
34812 |
|
34813 |
|
34814 |
|
34815 |
|
34816 | var __extends$1E = (undefined && undefined.__extends) || (function () {
|
34817 | var extendStatics = function (d, b) {
|
34818 | extendStatics = Object.setPrototypeOf ||
|
34819 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34820 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
34821 | return extendStatics(d, b);
|
34822 | };
|
34823 | return function (d, b) {
|
34824 | extendStatics(d, b);
|
34825 | function __() { this.constructor = d; }
|
34826 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34827 | };
|
34828 | })();
|
34829 | var __decorate$1r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34830 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34831 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34832 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34833 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34834 | };
|
34835 | var DEBOUNCE_DELAY = 50;
|
34836 | var ResizeObserverService = (function (_super) {
|
34837 | __extends$1E(ResizeObserverService, _super);
|
34838 | function ResizeObserverService() {
|
34839 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
34840 | _this.polyfillFunctions = [];
|
34841 | return _this;
|
34842 | }
|
34843 | ResizeObserverService.prototype.observeResize = function (element, callback) {
|
34844 | var _this = this;
|
34845 | var eDocument = this.gridOptionsWrapper.getDocument();
|
34846 | var win = (eDocument.defaultView || window);
|
34847 |
|
34848 |
|
34849 | var debouncedCallback = debounce(callback, DEBOUNCE_DELAY);
|
34850 | var useBrowserResizeObserver = function () {
|
34851 | var resizeObserver = new win.ResizeObserver(debouncedCallback);
|
34852 | resizeObserver.observe(element);
|
34853 | return function () { return resizeObserver.disconnect(); };
|
34854 | };
|
34855 | var usePolyfill = function () {
|
34856 |
|
34857 | var widthLastTime = offsetWidth(element);
|
34858 | var heightLastTime = offsetHeight(element);
|
34859 |
|
34860 | var running = true;
|
34861 | var periodicallyCheckWidthAndHeight = function () {
|
34862 | if (running) {
|
34863 | var newWidth = offsetWidth(element);
|
34864 | var newHeight = offsetHeight(element);
|
34865 | var changed = newWidth !== widthLastTime || newHeight !== heightLastTime;
|
34866 | if (changed) {
|
34867 | widthLastTime = newWidth;
|
34868 | heightLastTime = newHeight;
|
34869 | callback();
|
34870 | }
|
34871 | _this.doNextPolyfillTurn(periodicallyCheckWidthAndHeight);
|
34872 | }
|
34873 | };
|
34874 | periodicallyCheckWidthAndHeight();
|
34875 |
|
34876 | return function () { return running = false; };
|
34877 | };
|
34878 | var suppressResize = this.gridOptionsWrapper.isSuppressBrowserResizeObserver();
|
34879 | var resizeObserverExists = !!win.ResizeObserver;
|
34880 | if (resizeObserverExists && !suppressResize) {
|
34881 | return useBrowserResizeObserver();
|
34882 | }
|
34883 | return usePolyfill();
|
34884 | };
|
34885 | ResizeObserverService.prototype.doNextPolyfillTurn = function (func) {
|
34886 | this.polyfillFunctions.push(func);
|
34887 | this.schedulePolyfill();
|
34888 | };
|
34889 | ResizeObserverService.prototype.schedulePolyfill = function () {
|
34890 | var _this = this;
|
34891 | if (this.polyfillScheduled) {
|
34892 | return;
|
34893 | }
|
34894 | var executeAllFuncs = function () {
|
34895 | var funcs = _this.polyfillFunctions;
|
34896 |
|
34897 |
|
34898 | _this.polyfillScheduled = false;
|
34899 | _this.polyfillFunctions = [];
|
34900 | funcs.forEach(function (f) { return f(); });
|
34901 | };
|
34902 | this.polyfillScheduled = true;
|
34903 | this.getFrameworkOverrides().setTimeout(executeAllFuncs, DEBOUNCE_DELAY);
|
34904 | };
|
34905 | ResizeObserverService = __decorate$1r([
|
34906 | Bean('resizeObserverService')
|
34907 | ], ResizeObserverService);
|
34908 | return ResizeObserverService;
|
34909 | }(BeanStub));
|
34910 |
|
34911 |
|
34912 |
|
34913 |
|
34914 |
|
34915 |
|
34916 |
|
34917 | var __extends$1F = (undefined && undefined.__extends) || (function () {
|
34918 | var extendStatics = function (d, b) {
|
34919 | extendStatics = Object.setPrototypeOf ||
|
34920 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34921 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
34922 | return extendStatics(d, b);
|
34923 | };
|
34924 | return function (d, b) {
|
34925 | extendStatics(d, b);
|
34926 | function __() { this.constructor = d; }
|
34927 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34928 | };
|
34929 | })();
|
34930 | var __decorate$1s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34931 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34932 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34933 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34934 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34935 | };
|
34936 | var AnimationFrameService = (function (_super) {
|
34937 | __extends$1F(AnimationFrameService, _super);
|
34938 | function AnimationFrameService() {
|
34939 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
34940 |
|
34941 |
|
34942 |
|
34943 | _this.createTasksP1 = { list: [], sorted: false };
|
34944 | _this.createTasksP2 = { list: [], sorted: false };
|
34945 |
|
34946 |
|
34947 |
|
34948 | _this.destroyTasks = [];
|
34949 | _this.ticking = false;
|
34950 |
|
34951 |
|
34952 | _this.scrollGoingDown = true;
|
34953 | _this.lastScrollTop = 0;
|
34954 | _this.taskCount = 0;
|
34955 | _this.cancelledTasks = new Set();
|
34956 | return _this;
|
34957 | }
|
34958 | AnimationFrameService.prototype.setScrollTop = function (scrollTop) {
|
34959 | this.scrollGoingDown = scrollTop > this.lastScrollTop;
|
34960 | this.lastScrollTop = scrollTop;
|
34961 | };
|
34962 | AnimationFrameService.prototype.init = function () {
|
34963 | this.useAnimationFrame = !this.gridOptionsWrapper.isSuppressAnimationFrame();
|
34964 | };
|
34965 | AnimationFrameService.prototype.isOn = function () {
|
34966 | return this.useAnimationFrame;
|
34967 | };
|
34968 |
|
34969 |
|
34970 |
|
34971 |
|
34972 | AnimationFrameService.prototype.verifyAnimationFrameOn = function (methodName) {
|
34973 | if (this.useAnimationFrame === false) {
|
34974 | console.warn("AG Grid: AnimationFrameService." + methodName + " called but animation frames are off");
|
34975 | }
|
34976 | };
|
34977 | AnimationFrameService.prototype.createTask = function (task, index, list) {
|
34978 | this.verifyAnimationFrameOn(list);
|
34979 | var taskItem = { task: task, index: index, createOrder: ++this.taskCount };
|
34980 | this.addTaskToList(this[list], taskItem);
|
34981 | this.schedule();
|
34982 | };
|
34983 | AnimationFrameService.prototype.cancelTask = function (task) {
|
34984 | this.cancelledTasks.add(task);
|
34985 | };
|
34986 | AnimationFrameService.prototype.addTaskToList = function (taskList, task) {
|
34987 | taskList.list.push(task);
|
34988 | taskList.sorted = false;
|
34989 | };
|
34990 | AnimationFrameService.prototype.sortTaskList = function (taskList) {
|
34991 | if (taskList.sorted) {
|
34992 | return;
|
34993 | }
|
34994 | var sortDirection = this.scrollGoingDown ? 1 : -1;
|
34995 |
|
34996 |
|
34997 | taskList.list.sort(function (a, b) { return a.index !== b.index ? sortDirection * (b.index - a.index) : b.createOrder - a.createOrder; });
|
34998 | taskList.sorted = true;
|
34999 | };
|
35000 | AnimationFrameService.prototype.addDestroyTask = function (task) {
|
35001 | this.verifyAnimationFrameOn('createTasksP3');
|
35002 | this.destroyTasks.push(task);
|
35003 | this.schedule();
|
35004 | };
|
35005 | AnimationFrameService.prototype.executeFrame = function (millis) {
|
35006 | this.verifyAnimationFrameOn('executeFrame');
|
35007 | var p1TaskList = this.createTasksP1;
|
35008 | var p1Tasks = p1TaskList.list;
|
35009 | var p2TaskList = this.createTasksP2;
|
35010 | var p2Tasks = p2TaskList.list;
|
35011 | var destroyTasks = this.destroyTasks;
|
35012 | var frameStart = new Date().getTime();
|
35013 | var duration = (new Date().getTime()) - frameStart;
|
35014 |
|
35015 | var noMaxMillis = millis <= 0;
|
35016 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
35017 | while (noMaxMillis || duration < millis) {
|
35018 | var gridBodyDidSomething = gridBodyCon.getScrollFeature().executeAnimationFrameScroll();
|
35019 | if (!gridBodyDidSomething) {
|
35020 | var task = void 0;
|
35021 | if (p1Tasks.length) {
|
35022 | this.sortTaskList(p1TaskList);
|
35023 | task = p1Tasks.pop().task;
|
35024 | }
|
35025 | else if (p2Tasks.length) {
|
35026 | this.sortTaskList(p2TaskList);
|
35027 | task = p2Tasks.pop().task;
|
35028 | }
|
35029 | else if (destroyTasks.length) {
|
35030 | task = destroyTasks.pop();
|
35031 | }
|
35032 | else {
|
35033 | this.cancelledTasks.clear();
|
35034 | break;
|
35035 | }
|
35036 | if (!this.cancelledTasks.has(task)) {
|
35037 | task();
|
35038 | }
|
35039 | }
|
35040 | duration = (new Date().getTime()) - frameStart;
|
35041 | }
|
35042 | if (p1Tasks.length || p2Tasks.length || destroyTasks.length) {
|
35043 | this.requestFrame();
|
35044 | }
|
35045 | else {
|
35046 | this.stopTicking();
|
35047 | }
|
35048 | };
|
35049 | AnimationFrameService.prototype.stopTicking = function () {
|
35050 | this.ticking = false;
|
35051 | };
|
35052 | AnimationFrameService.prototype.flushAllFrames = function () {
|
35053 | if (!this.useAnimationFrame) {
|
35054 | return;
|
35055 | }
|
35056 | this.executeFrame(-1);
|
35057 | };
|
35058 | AnimationFrameService.prototype.schedule = function () {
|
35059 | if (!this.useAnimationFrame) {
|
35060 | return;
|
35061 | }
|
35062 | if (!this.ticking) {
|
35063 | this.ticking = true;
|
35064 | this.requestFrame();
|
35065 | }
|
35066 | };
|
35067 | AnimationFrameService.prototype.requestFrame = function () {
|
35068 |
|
35069 |
|
35070 | var callback = this.executeFrame.bind(this, 60);
|
35071 | var eDocument = this.gridOptionsWrapper.getDocument();
|
35072 | var win = (eDocument.defaultView || window);
|
35073 | if (win.requestAnimationFrame) {
|
35074 | win.requestAnimationFrame(callback);
|
35075 | }
|
35076 | else if (win.webkitRequestAnimationFrame) {
|
35077 | win.webkitRequestAnimationFrame(callback);
|
35078 | }
|
35079 | else {
|
35080 | win.setTimeout(callback, 0);
|
35081 | }
|
35082 | };
|
35083 | AnimationFrameService.prototype.isQueueEmpty = function () {
|
35084 | return !this.ticking;
|
35085 | };
|
35086 |
|
35087 |
|
35088 |
|
35089 |
|
35090 | AnimationFrameService.prototype.debounce = function (func) {
|
35091 | var _this = this;
|
35092 | var pending = false;
|
35093 | return function () {
|
35094 | if (!_this.isOn()) {
|
35095 | _this.getFrameworkOverrides().setTimeout(func, 0);
|
35096 | return;
|
35097 | }
|
35098 | if (pending) {
|
35099 | return;
|
35100 | }
|
35101 | pending = true;
|
35102 | _this.addDestroyTask(function () {
|
35103 | pending = false;
|
35104 | func();
|
35105 | });
|
35106 | };
|
35107 | };
|
35108 | __decorate$1s([
|
35109 | Autowired('ctrlsService')
|
35110 | ], AnimationFrameService.prototype, "ctrlsService", void 0);
|
35111 | __decorate$1s([
|
35112 | PostConstruct
|
35113 | ], AnimationFrameService.prototype, "init", null);
|
35114 | AnimationFrameService = __decorate$1s([
|
35115 | Bean('animationFrameService')
|
35116 | ], AnimationFrameService);
|
35117 | return AnimationFrameService;
|
35118 | }(BeanStub));
|
35119 |
|
35120 |
|
35121 |
|
35122 |
|
35123 |
|
35124 |
|
35125 |
|
35126 | var __extends$1G = (undefined && undefined.__extends) || (function () {
|
35127 | var extendStatics = function (d, b) {
|
35128 | extendStatics = Object.setPrototypeOf ||
|
35129 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
35130 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
35131 | return extendStatics(d, b);
|
35132 | };
|
35133 | return function (d, b) {
|
35134 | extendStatics(d, b);
|
35135 | function __() { this.constructor = d; }
|
35136 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
35137 | };
|
35138 | })();
|
35139 | var __decorate$1t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
35140 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
35141 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
35142 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
35143 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
35144 | };
|
35145 | var RESIZE_CONTAINER_STYLE = 'ag-resizer-wrapper';
|
35146 | 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>";
|
35147 | var PositionableFeature = (function (_super) {
|
35148 | __extends$1G(PositionableFeature, _super);
|
35149 | function PositionableFeature(element, config) {
|
35150 | var _this = _super.call(this) || this;
|
35151 | _this.element = element;
|
35152 | _this.dragStartPosition = {
|
35153 | x: 0,
|
35154 | y: 0
|
35155 | };
|
35156 | _this.position = {
|
35157 | x: 0,
|
35158 | y: 0
|
35159 | };
|
35160 | _this.lastSize = {
|
35161 | width: -1,
|
35162 | height: -1
|
35163 | };
|
35164 | _this.positioned = false;
|
35165 | _this.resizersAdded = false;
|
35166 | _this.resizeListeners = [];
|
35167 | _this.boundaryEl = null;
|
35168 | _this.isResizing = false;
|
35169 | _this.isMoving = false;
|
35170 | _this.resizable = {};
|
35171 | _this.movable = false;
|
35172 | _this.currentResizer = null;
|
35173 | _this.config = Object.assign({}, { popup: false }, config);
|
35174 | return _this;
|
35175 | }
|
35176 | PositionableFeature.prototype.center = function () {
|
35177 | var _a = this.offsetParent, clientHeight = _a.clientHeight, clientWidth = _a.clientWidth;
|
35178 | var x = (clientWidth / 2) - (this.getWidth() / 2);
|
35179 | var y = (clientHeight / 2) - (this.getHeight() / 2);
|
35180 | this.offsetElement(x, y);
|
35181 | };
|
35182 | PositionableFeature.prototype.initialisePosition = function () {
|
35183 | 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;
|
35184 | if (!this.offsetParent) {
|
35185 | this.setOffsetParent();
|
35186 | }
|
35187 | var computedMinHeight = 0;
|
35188 | var computedMinWidth = 0;
|
35189 |
|
35190 |
|
35191 | var isVisible = !!this.element.offsetParent;
|
35192 | if (isVisible) {
|
35193 | var boundaryEl = this.findBoundaryElement();
|
35194 | var offsetParentComputedStyles = window.getComputedStyle(boundaryEl);
|
35195 | if (offsetParentComputedStyles.minWidth != null) {
|
35196 | var paddingWidth = boundaryEl.offsetWidth - this.element.offsetWidth;
|
35197 | computedMinWidth = parseInt(offsetParentComputedStyles.minWidth, 10) - paddingWidth;
|
35198 | }
|
35199 | if (offsetParentComputedStyles.minHeight != null) {
|
35200 | var paddingHeight = boundaryEl.offsetHeight - this.element.offsetHeight;
|
35201 | computedMinHeight = parseInt(offsetParentComputedStyles.minHeight, 10) - paddingHeight;
|
35202 | }
|
35203 | }
|
35204 | this.minHeight = minHeight || computedMinHeight;
|
35205 | this.minWidth = minWidth || computedMinWidth;
|
35206 | if (width) {
|
35207 | this.setWidth(width);
|
35208 | }
|
35209 | if (height) {
|
35210 | this.setHeight(height);
|
35211 | }
|
35212 | if (!width || !height) {
|
35213 | this.refreshSize();
|
35214 | }
|
35215 | if (centered) {
|
35216 | this.center();
|
35217 | }
|
35218 | else if (x || y) {
|
35219 | this.offsetElement(x, y);
|
35220 | }
|
35221 | else if (isVisible && forcePopupParentAsOffsetParent && this.boundaryEl) {
|
35222 | var top_1 = parseFloat(this.boundaryEl.style.top);
|
35223 | var left = parseFloat(this.boundaryEl.style.left);
|
35224 | this.offsetElement(isNaN(left) ? 0 : left, isNaN(top_1) ? 0 : top_1);
|
35225 | }
|
35226 | this.positioned = !!this.offsetParent;
|
35227 | };
|
35228 | PositionableFeature.prototype.isPositioned = function () {
|
35229 | return this.positioned;
|
35230 | };
|
35231 | PositionableFeature.prototype.getPosition = function () {
|
35232 | return this.position;
|
35233 | };
|
35234 | PositionableFeature.prototype.setMovable = function (movable, moveElement) {
|
35235 | if (!this.config.popup || movable === this.movable) {
|
35236 | return;
|
35237 | }
|
35238 | this.movable = movable;
|
35239 | var params = this.moveElementDragListener || {
|
35240 | eElement: moveElement,
|
35241 | onDragStart: this.onMoveStart.bind(this),
|
35242 | onDragging: this.onMove.bind(this),
|
35243 | onDragStop: this.onMoveEnd.bind(this)
|
35244 | };
|
35245 | if (movable) {
|
35246 | this.dragService.addDragSource(params);
|
35247 | this.moveElementDragListener = params;
|
35248 | }
|
35249 | else {
|
35250 | this.dragService.removeDragSource(params);
|
35251 | this.moveElementDragListener = undefined;
|
35252 | }
|
35253 | };
|
35254 | PositionableFeature.prototype.setResizable = function (resizable) {
|
35255 | var _this = this;
|
35256 | this.clearResizeListeners();
|
35257 | if (resizable) {
|
35258 | this.addResizers();
|
35259 | }
|
35260 | else {
|
35261 | this.removeResizers();
|
35262 | }
|
35263 | if (typeof resizable === 'boolean') {
|
35264 | if (resizable === false) {
|
35265 | return;
|
35266 | }
|
35267 | resizable = {
|
35268 | topLeft: resizable,
|
35269 | top: resizable,
|
35270 | topRight: resizable,
|
35271 | right: resizable,
|
35272 | bottomRight: resizable,
|
35273 | bottom: resizable,
|
35274 | bottomLeft: resizable,
|
35275 | left: resizable
|
35276 | };
|
35277 | }
|
35278 | Object.keys(resizable).forEach(function (side) {
|
35279 | var resizableStructure = resizable;
|
35280 | var val = !!resizableStructure[side];
|
35281 | var resizerEl = _this.getResizerElement(side);
|
35282 | var params = {
|
35283 | dragStartPixels: 0,
|
35284 | eElement: resizerEl,
|
35285 | onDragStart: function (e) { return _this.onResizeStart(e, side); },
|
35286 | onDragging: _this.onResize.bind(_this),
|
35287 | onDragStop: function (e) { return _this.onResizeEnd(e, side); },
|
35288 | };
|
35289 | if (!!_this.resizable[side] !== val || (!_this.isAlive() && !val)) {
|
35290 | if (val) {
|
35291 | _this.dragService.addDragSource(params);
|
35292 | _this.resizeListeners.push(params);
|
35293 | resizerEl.style.pointerEvents = 'all';
|
35294 | }
|
35295 | else {
|
35296 | resizerEl.style.pointerEvents = 'none';
|
35297 | }
|
35298 | }
|
35299 | });
|
35300 | };
|
35301 | PositionableFeature.prototype.removeSizeFromEl = function () {
|
35302 | this.element.style.removeProperty('height');
|
35303 | this.element.style.removeProperty('width');
|
35304 | this.element.style.removeProperty('flex');
|
35305 | };
|
35306 | PositionableFeature.prototype.restoreLastSize = function () {
|
35307 | this.element.style.flex = '0 0 auto';
|
35308 | var _a = this.lastSize, height = _a.height, width = _a.width;
|
35309 | if (width !== -1) {
|
35310 | this.element.style.width = width + "px";
|
35311 | }
|
35312 | if (height !== -1) {
|
35313 | this.element.style.height = height + "px";
|
35314 | }
|
35315 | };
|
35316 | PositionableFeature.prototype.getHeight = function () {
|
35317 | return this.element.offsetHeight;
|
35318 | };
|
35319 | PositionableFeature.prototype.setHeight = function (height) {
|
35320 | var popup = this.config.popup;
|
35321 | var eGui = this.element;
|
35322 | var isPercent = false;
|
35323 | if (typeof height === 'string' && height.indexOf('%') !== -1) {
|
35324 | setFixedHeight(eGui, height);
|
35325 | height = getAbsoluteHeight(eGui);
|
35326 | isPercent = true;
|
35327 | }
|
35328 | else if (this.positioned) {
|
35329 | var elRect = this.element.getBoundingClientRect();
|
35330 | var parentRect = this.offsetParent.getBoundingClientRect();
|
35331 | height = Math.max(this.minHeight, height);
|
35332 | var clientHeight = this.offsetParent.clientHeight;
|
35333 | var yPosition = popup ? this.position.y : elRect.top;
|
35334 | var parentTop = popup ? 0 : parentRect.top;
|
35335 | if (clientHeight && (height + yPosition > clientHeight + parentTop)) {
|
35336 | height = clientHeight - yPosition;
|
35337 | }
|
35338 | }
|
35339 | if (this.getHeight() === height) {
|
35340 | return;
|
35341 | }
|
35342 | if (!isPercent) {
|
35343 | if (popup) {
|
35344 | setFixedHeight(eGui, height);
|
35345 | }
|
35346 | else {
|
35347 | eGui.style.height = height + "px";
|
35348 | eGui.style.flex = '0 0 auto';
|
35349 | this.lastSize.height = typeof height === 'number' ? height : parseFloat(height);
|
35350 | }
|
35351 | }
|
35352 | else {
|
35353 | eGui.style.maxHeight = 'unset';
|
35354 | eGui.style.minHeight = 'unset';
|
35355 | }
|
35356 | };
|
35357 | PositionableFeature.prototype.getWidth = function () {
|
35358 | return this.element.offsetWidth;
|
35359 | };
|
35360 | PositionableFeature.prototype.setWidth = function (width) {
|
35361 | var eGui = this.element;
|
35362 | var popup = this.config.popup;
|
35363 | var isPercent = false;
|
35364 | if (typeof width === 'string' && width.indexOf('%') !== -1) {
|
35365 | setFixedWidth(eGui, width);
|
35366 | width = getAbsoluteWidth(eGui);
|
35367 | isPercent = true;
|
35368 | }
|
35369 | else if (this.positioned) {
|
35370 | width = Math.max(this.minWidth, width);
|
35371 | var clientWidth = this.offsetParent.clientWidth;
|
35372 | var xPosition = popup ? this.position.x : this.element.getBoundingClientRect().left;
|
35373 | if (clientWidth && (width + xPosition > clientWidth)) {
|
35374 | width = clientWidth - xPosition;
|
35375 | }
|
35376 | }
|
35377 | if (this.getWidth() === width) {
|
35378 | return;
|
35379 | }
|
35380 | if (!isPercent) {
|
35381 | if (this.config.popup) {
|
35382 | setFixedWidth(eGui, width);
|
35383 | }
|
35384 | else {
|
35385 | eGui.style.width = width + "px";
|
35386 | eGui.style.flex = ' unset';
|
35387 | this.lastSize.width = typeof width === 'number' ? width : parseFloat(width);
|
35388 | }
|
35389 | }
|
35390 | else {
|
35391 | eGui.style.maxWidth = 'unset';
|
35392 | eGui.style.minWidth = 'unset';
|
35393 | }
|
35394 | };
|
35395 | PositionableFeature.prototype.offsetElement = function (x, y) {
|
35396 | if (x === void 0) { x = 0; }
|
35397 | if (y === void 0) { y = 0; }
|
35398 | var ePopup = this.config.forcePopupParentAsOffsetParent ? this.boundaryEl : this.element;
|
35399 | this.popupService.positionPopup({
|
35400 | ePopup: ePopup,
|
35401 | x: x,
|
35402 | y: y,
|
35403 | keepWithinBounds: true
|
35404 | });
|
35405 | this.setPosition(parseFloat(ePopup.style.left), parseFloat(ePopup.style.top));
|
35406 | };
|
35407 | PositionableFeature.prototype.setPosition = function (x, y) {
|
35408 | this.position.x = x;
|
35409 | this.position.y = y;
|
35410 | };
|
35411 | PositionableFeature.prototype.updateDragStartPosition = function (x, y) {
|
35412 | this.dragStartPosition = { x: x, y: y };
|
35413 | };
|
35414 | PositionableFeature.prototype.calculateMouseMovement = function (params) {
|
35415 | var e = params.e, isLeft = params.isLeft, isTop = params.isTop, anywhereWithin = params.anywhereWithin, topBuffer = params.topBuffer;
|
35416 | var xDiff = e.clientX - this.dragStartPosition.x;
|
35417 | var yDiff = e.clientY - this.dragStartPosition.y;
|
35418 | var movementX = this.shouldSkipX(e, !!isLeft, !!anywhereWithin, xDiff) ? 0 : xDiff;
|
35419 | var movementY = this.shouldSkipY(e, !!isTop, topBuffer, yDiff) ? 0 : yDiff;
|
35420 | return { movementX: movementX, movementY: movementY };
|
35421 | };
|
35422 | PositionableFeature.prototype.shouldSkipX = function (e, isLeft, anywhereWithin, diff) {
|
35423 | var elRect = this.element.getBoundingClientRect();
|
35424 | var parentRect = this.offsetParent.getBoundingClientRect();
|
35425 | var boundaryElRect = this.boundaryEl.getBoundingClientRect();
|
35426 | var xPosition = this.config.popup ? this.position.x : elRect.left;
|
35427 |
|
35428 | var skipX = ((xPosition <= 0 && parentRect.left >= e.clientX) ||
|
35429 | (parentRect.right <= e.clientX && parentRect.right <= boundaryElRect.right));
|
35430 | if (skipX) {
|
35431 | return true;
|
35432 | }
|
35433 | if (isLeft) {
|
35434 | skipX = (
|
35435 |
|
35436 |
|
35437 | (diff < 0 && e.clientX > xPosition + parentRect.left) ||
|
35438 |
|
35439 |
|
35440 | (diff > 0 && e.clientX < xPosition + parentRect.left));
|
35441 | }
|
35442 | else {
|
35443 | if (anywhereWithin) {
|
35444 |
|
35445 |
|
35446 | skipX = ((diff < 0 && e.clientX > boundaryElRect.right) ||
|
35447 | (diff > 0 && e.clientX < xPosition + parentRect.left));
|
35448 | }
|
35449 | else {
|
35450 | skipX = (
|
35451 |
|
35452 |
|
35453 |
|
35454 | (diff < 0 && e.clientX > boundaryElRect.right) ||
|
35455 |
|
35456 |
|
35457 | (diff > 0 && e.clientX < boundaryElRect.right));
|
35458 | }
|
35459 | }
|
35460 | return skipX;
|
35461 | };
|
35462 | PositionableFeature.prototype.shouldSkipY = function (e, isTop, topBuffer, diff) {
|
35463 | if (topBuffer === void 0) { topBuffer = 0; }
|
35464 | var elRect = this.element.getBoundingClientRect();
|
35465 | var parentRect = this.offsetParent.getBoundingClientRect();
|
35466 | var boundaryElRect = this.boundaryEl.getBoundingClientRect();
|
35467 | var yPosition = this.config.popup ? this.position.y : elRect.top;
|
35468 |
|
35469 | var skipY = ((yPosition <= 0 && parentRect.top >= e.clientY) ||
|
35470 | (parentRect.bottom <= e.clientY && parentRect.bottom <= boundaryElRect.bottom));
|
35471 | if (skipY) {
|
35472 | return true;
|
35473 | }
|
35474 | if (isTop) {
|
35475 | skipY = (
|
35476 |
|
35477 |
|
35478 |
|
35479 | (diff < 0 && e.clientY > yPosition + parentRect.top + topBuffer) ||
|
35480 |
|
35481 |
|
35482 | (diff > 0 && e.clientY < yPosition + parentRect.top));
|
35483 | }
|
35484 | else {
|
35485 | skipY = (
|
35486 |
|
35487 |
|
35488 | (diff < 0 && e.clientY > boundaryElRect.bottom) ||
|
35489 |
|
35490 |
|
35491 | (diff > 0 && e.clientY < boundaryElRect.bottom));
|
35492 | }
|
35493 | return skipY;
|
35494 | };
|
35495 | PositionableFeature.prototype.createResizeMap = function () {
|
35496 | var eGui = this.element;
|
35497 | this.resizerMap = {
|
35498 | topLeft: { element: eGui.querySelector('[ref=eTopLeftResizer]') },
|
35499 | top: { element: eGui.querySelector('[ref=eTopResizer]') },
|
35500 | topRight: { element: eGui.querySelector('[ref=eTopRightResizer]') },
|
35501 | right: { element: eGui.querySelector('[ref=eRightResizer]') },
|
35502 | bottomRight: { element: eGui.querySelector('[ref=eBottomRightResizer]') },
|
35503 | bottom: { element: eGui.querySelector('[ref=eBottomResizer]') },
|
35504 | bottomLeft: { element: eGui.querySelector('[ref=eBottomLeftResizer]') },
|
35505 | left: { element: eGui.querySelector('[ref=eLeftResizer]') }
|
35506 | };
|
35507 | };
|
35508 | PositionableFeature.prototype.addResizers = function () {
|
35509 | if (this.resizersAdded) {
|
35510 | return;
|
35511 | }
|
35512 | var eGui = this.element;
|
35513 | if (!eGui) {
|
35514 | return;
|
35515 | }
|
35516 | var parser = new DOMParser();
|
35517 | var resizers = parser.parseFromString(RESIZE_TEMPLATE, 'text/html').body;
|
35518 | eGui.appendChild(resizers.firstChild);
|
35519 | this.createResizeMap();
|
35520 | this.resizersAdded = true;
|
35521 | };
|
35522 | PositionableFeature.prototype.removeResizers = function () {
|
35523 | this.resizerMap = undefined;
|
35524 | var resizerEl = this.element.querySelector("." + RESIZE_CONTAINER_STYLE);
|
35525 | if (resizerEl) {
|
35526 | this.element.removeChild(resizerEl);
|
35527 | }
|
35528 | this.resizersAdded = false;
|
35529 | };
|
35530 | PositionableFeature.prototype.getResizerElement = function (side) {
|
35531 | return this.resizerMap[side].element;
|
35532 | };
|
35533 | PositionableFeature.prototype.onResizeStart = function (e, side) {
|
35534 | this.boundaryEl = this.findBoundaryElement();
|
35535 | if (!this.positioned) {
|
35536 | this.initialisePosition();
|
35537 | }
|
35538 | this.currentResizer = {
|
35539 | isTop: !!side.match(/top/i),
|
35540 | isRight: !!side.match(/right/i),
|
35541 | isBottom: !!side.match(/bottom/i),
|
35542 | isLeft: !!side.match(/left/i),
|
35543 | };
|
35544 | this.element.classList.add('ag-resizing');
|
35545 | this.resizerMap[side].element.classList.add('ag-active');
|
35546 | var _a = this.config, popup = _a.popup, forcePopupParentAsOffsetParent = _a.forcePopupParentAsOffsetParent;
|
35547 | if (!popup && !forcePopupParentAsOffsetParent) {
|
35548 | this.applySizeToSiblings(this.currentResizer.isBottom || this.currentResizer.isTop);
|
35549 | }
|
35550 | this.isResizing = true;
|
35551 | this.updateDragStartPosition(e.clientX, e.clientY);
|
35552 | };
|
35553 | PositionableFeature.prototype.getSiblings = function () {
|
35554 | var element = this.element;
|
35555 | var parent = element.parentElement;
|
35556 | if (!parent) {
|
35557 | return null;
|
35558 | }
|
35559 | return Array.prototype.slice.call(parent.children).filter(function (el) { return !el.classList.contains('ag-hidden'); });
|
35560 | };
|
35561 | PositionableFeature.prototype.getMinSizeOfSiblings = function () {
|
35562 | var siblings = this.getSiblings() || [];
|
35563 | var height = 0;
|
35564 | var width = 0;
|
35565 | for (var i = 0; i < siblings.length; i++) {
|
35566 | var currentEl = siblings[i];
|
35567 | var isFlex = !!currentEl.style.flex && currentEl.style.flex !== '0 0 auto';
|
35568 | if (currentEl === this.element) {
|
35569 | continue;
|
35570 | }
|
35571 | var nextHeight = this.minHeight || 0;
|
35572 | var nextWidth = this.minWidth || 0;
|
35573 | if (isFlex) {
|
35574 | var computedStyle = window.getComputedStyle(currentEl);
|
35575 | if (computedStyle.minHeight) {
|
35576 | nextHeight = parseInt(computedStyle.minHeight, 10);
|
35577 | }
|
35578 | if (computedStyle.minWidth) {
|
35579 | nextWidth = parseInt(computedStyle.minWidth, 10);
|
35580 | }
|
35581 | }
|
35582 | else {
|
35583 | nextHeight = currentEl.offsetHeight;
|
35584 | nextWidth = currentEl.offsetWidth;
|
35585 | }
|
35586 | height += nextHeight;
|
35587 | width += nextWidth;
|
35588 | }
|
35589 | return { height: height, width: width };
|
35590 | };
|
35591 | PositionableFeature.prototype.applySizeToSiblings = function (vertical) {
|
35592 | var containerToFlex = null;
|
35593 | var siblings = this.getSiblings();
|
35594 | if (!siblings) {
|
35595 | return;
|
35596 | }
|
35597 | for (var i = 0; i < siblings.length; i++) {
|
35598 | var el = siblings[i];
|
35599 | if (el === containerToFlex) {
|
35600 | continue;
|
35601 | }
|
35602 | if (vertical) {
|
35603 | el.style.height = el.offsetHeight + "px";
|
35604 | }
|
35605 | else {
|
35606 | el.style.width = el.offsetWidth + "px";
|
35607 | }
|
35608 | el.style.flex = '0 0 auto';
|
35609 | if (el === this.element) {
|
35610 | containerToFlex = siblings[i + 1];
|
35611 | }
|
35612 | }
|
35613 | if (containerToFlex) {
|
35614 | containerToFlex.style.removeProperty('height');
|
35615 | containerToFlex.style.removeProperty('min-height');
|
35616 | containerToFlex.style.removeProperty('max-height');
|
35617 | containerToFlex.style.flex = '1 1 auto';
|
35618 | }
|
35619 | };
|
35620 | PositionableFeature.prototype.onResize = function (e) {
|
35621 | if (!this.isResizing || !this.currentResizer) {
|
35622 | return;
|
35623 | }
|
35624 | var _a = this.config, popup = _a.popup, forcePopupParentAsOffsetParent = _a.forcePopupParentAsOffsetParent;
|
35625 | var _b = this.currentResizer, isTop = _b.isTop, isRight = _b.isRight, isBottom = _b.isBottom, isLeft = _b.isLeft;
|
35626 | var isHorizontal = isRight || isLeft;
|
35627 | var isVertical = isBottom || isTop;
|
35628 | var _c = this.calculateMouseMovement({ e: e, isLeft: isLeft, isTop: isTop }), movementX = _c.movementX, movementY = _c.movementY;
|
35629 | var xPosition = this.position.x;
|
35630 | var yPosition = this.position.y;
|
35631 | var offsetLeft = 0;
|
35632 | var offsetTop = 0;
|
35633 | if (isHorizontal && movementX) {
|
35634 | var direction = isLeft ? -1 : 1;
|
35635 | var oldWidth = this.getWidth();
|
35636 | var newWidth = oldWidth + (movementX * direction);
|
35637 | var skipWidth = false;
|
35638 | if (isLeft) {
|
35639 | offsetLeft = oldWidth - newWidth;
|
35640 | if (xPosition + offsetLeft <= 0 || newWidth <= this.minWidth) {
|
35641 | skipWidth = true;
|
35642 | offsetLeft = 0;
|
35643 | }
|
35644 | }
|
35645 | if (!skipWidth) {
|
35646 | this.setWidth(newWidth);
|
35647 | }
|
35648 | }
|
35649 | if (isVertical && movementY) {
|
35650 | var direction = isTop ? -1 : 1;
|
35651 | var oldHeight = this.getHeight();
|
35652 | var newHeight = oldHeight + (movementY * direction);
|
35653 | var skipHeight = false;
|
35654 | if (isTop) {
|
35655 | offsetTop = oldHeight - newHeight;
|
35656 | if (yPosition + offsetTop <= 0 || newHeight <= this.minHeight) {
|
35657 | skipHeight = true;
|
35658 | offsetTop = 0;
|
35659 | }
|
35660 | }
|
35661 | else {
|
35662 |
|
35663 | if (!this.config.popup &&
|
35664 | !this.config.forcePopupParentAsOffsetParent &&
|
35665 | oldHeight < newHeight &&
|
35666 | (this.getMinSizeOfSiblings().height + newHeight) > this.element.parentElement.offsetHeight) {
|
35667 | skipHeight = true;
|
35668 | }
|
35669 | }
|
35670 | if (!skipHeight) {
|
35671 | this.setHeight(newHeight);
|
35672 | }
|
35673 | }
|
35674 | this.updateDragStartPosition(e.clientX, e.clientY);
|
35675 | if ((popup || forcePopupParentAsOffsetParent) && offsetLeft || offsetTop) {
|
35676 | this.offsetElement(xPosition + offsetLeft, yPosition + offsetTop);
|
35677 | }
|
35678 | };
|
35679 | PositionableFeature.prototype.onResizeEnd = function (e, side) {
|
35680 | this.isResizing = false;
|
35681 | this.currentResizer = null;
|
35682 | this.boundaryEl = null;
|
35683 | var params = {
|
35684 | type: 'resize',
|
35685 | api: this.gridOptionsWrapper.getApi(),
|
35686 | columnApi: this.gridOptionsWrapper.getColumnApi()
|
35687 | };
|
35688 | this.element.classList.remove('ag-resizing');
|
35689 | this.resizerMap[side].element.classList.remove('ag-active');
|
35690 | this.dispatchEvent(params);
|
35691 | };
|
35692 | PositionableFeature.prototype.refreshSize = function () {
|
35693 | var eGui = this.element;
|
35694 | if (this.config.popup) {
|
35695 | if (!this.config.width) {
|
35696 | this.setWidth(eGui.offsetWidth);
|
35697 | }
|
35698 | if (!this.config.height) {
|
35699 | this.setHeight(eGui.offsetHeight);
|
35700 | }
|
35701 | }
|
35702 | };
|
35703 | PositionableFeature.prototype.onMoveStart = function (e) {
|
35704 | this.boundaryEl = this.findBoundaryElement();
|
35705 | if (!this.positioned) {
|
35706 | this.initialisePosition();
|
35707 | }
|
35708 | this.isMoving = true;
|
35709 | this.element.classList.add('ag-moving');
|
35710 | this.updateDragStartPosition(e.clientX, e.clientY);
|
35711 | };
|
35712 | PositionableFeature.prototype.onMove = function (e) {
|
35713 | if (!this.isMoving) {
|
35714 | return;
|
35715 | }
|
35716 | var _a = this.position, x = _a.x, y = _a.y;
|
35717 | var topBuffer;
|
35718 | if (this.config.calculateTopBuffer) {
|
35719 | topBuffer = this.config.calculateTopBuffer();
|
35720 | }
|
35721 | var _b = this.calculateMouseMovement({
|
35722 | e: e,
|
35723 | isTop: true,
|
35724 | anywhereWithin: true,
|
35725 | topBuffer: topBuffer
|
35726 | }), movementX = _b.movementX, movementY = _b.movementY;
|
35727 | this.offsetElement(x + movementX, y + movementY);
|
35728 | this.updateDragStartPosition(e.clientX, e.clientY);
|
35729 | };
|
35730 | PositionableFeature.prototype.onMoveEnd = function () {
|
35731 | this.isMoving = false;
|
35732 | this.boundaryEl = null;
|
35733 | this.element.classList.remove('ag-moving');
|
35734 | };
|
35735 | PositionableFeature.prototype.setOffsetParent = function () {
|
35736 | if (this.config.forcePopupParentAsOffsetParent) {
|
35737 | this.offsetParent = this.popupService.getPopupParent();
|
35738 | }
|
35739 | else {
|
35740 | this.offsetParent = this.element.offsetParent;
|
35741 | }
|
35742 | };
|
35743 | PositionableFeature.prototype.findBoundaryElement = function () {
|
35744 | var el = this.element;
|
35745 | while (el) {
|
35746 | if (window.getComputedStyle(el).position !== 'static') {
|
35747 | return el;
|
35748 | }
|
35749 | el = el.parentElement;
|
35750 | }
|
35751 | return this.element;
|
35752 | };
|
35753 | PositionableFeature.prototype.clearResizeListeners = function () {
|
35754 | while (this.resizeListeners.length) {
|
35755 | var params = this.resizeListeners.pop();
|
35756 | this.dragService.removeDragSource(params);
|
35757 | }
|
35758 | };
|
35759 | PositionableFeature.prototype.destroy = function () {
|
35760 | _super.prototype.destroy.call(this);
|
35761 | if (this.moveElementDragListener) {
|
35762 | this.dragService.removeDragSource(this.moveElementDragListener);
|
35763 | }
|
35764 | this.clearResizeListeners();
|
35765 | this.removeResizers();
|
35766 | };
|
35767 | __decorate$1t([
|
35768 | Autowired('popupService')
|
35769 | ], PositionableFeature.prototype, "popupService", void 0);
|
35770 | __decorate$1t([
|
35771 | Autowired('dragService')
|
35772 | ], PositionableFeature.prototype, "dragService", void 0);
|
35773 | return PositionableFeature;
|
35774 | }(BeanStub));
|
35775 |
|
35776 |
|
35777 |
|
35778 |
|
35779 |
|
35780 |
|
35781 |
|
35782 | var __extends$1H = (undefined && undefined.__extends) || (function () {
|
35783 | var extendStatics = function (d, b) {
|
35784 | extendStatics = Object.setPrototypeOf ||
|
35785 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
35786 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
35787 | return extendStatics(d, b);
|
35788 | };
|
35789 | return function (d, b) {
|
35790 | extendStatics(d, b);
|
35791 | function __() { this.constructor = d; }
|
35792 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
35793 | };
|
35794 | })();
|
35795 | var __decorate$1u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
35796 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
35797 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
35798 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
35799 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
35800 | };
|
35801 | var AutoWidthCalculator = (function (_super) {
|
35802 | __extends$1H(AutoWidthCalculator, _super);
|
35803 | function AutoWidthCalculator() {
|
35804 | return _super !== null && _super.apply(this, arguments) || this;
|
35805 | }
|
35806 | AutoWidthCalculator.prototype.postConstruct = function () {
|
35807 | var _this = this;
|
35808 | this.ctrlsService.whenReady(function (p) {
|
35809 | _this.centerRowContainerCtrl = p.centerRowContainerCtrl;
|
35810 | });
|
35811 | };
|
35812 |
|
35813 |
|
35814 |
|
35815 |
|
35816 | AutoWidthCalculator.prototype.getPreferredWidthForColumn = function (column, skipHeader) {
|
35817 | var eHeaderCell = this.getHeaderCellForColumn(column);
|
35818 |
|
35819 | if (!eHeaderCell) {
|
35820 | return -1;
|
35821 | }
|
35822 | var elements = this.rowRenderer.getAllCellsForColumn(column);
|
35823 | if (!skipHeader) {
|
35824 |
|
35825 |
|
35826 |
|
35827 | elements.push(eHeaderCell);
|
35828 | }
|
35829 | return this.addElementsToContainerAndGetWidth(elements);
|
35830 | };
|
35831 | AutoWidthCalculator.prototype.getPreferredWidthForColumnGroup = function (columnGroup) {
|
35832 | var eHeaderCell = this.getHeaderCellForColumn(columnGroup);
|
35833 | if (!eHeaderCell) {
|
35834 | return -1;
|
35835 | }
|
35836 | return this.addElementsToContainerAndGetWidth([eHeaderCell]);
|
35837 | };
|
35838 | AutoWidthCalculator.prototype.addElementsToContainerAndGetWidth = function (elements) {
|
35839 | var _this = this;
|
35840 | var eDummyContainer = document.createElement('span');
|
35841 |
|
35842 | eDummyContainer.style.position = 'fixed';
|
35843 |
|
35844 |
|
35845 | var eBodyContainer = this.centerRowContainerCtrl.getContainerElement();
|
35846 | eBodyContainer.appendChild(eDummyContainer);
|
35847 | elements.forEach(function (el) { return _this.cloneItemIntoDummy(el, eDummyContainer); });
|
35848 |
|
35849 |
|
35850 | var dummyContainerWidth = eDummyContainer.offsetWidth;
|
35851 |
|
35852 | eBodyContainer.removeChild(eDummyContainer);
|
35853 |
|
35854 |
|
35855 | var autoSizePadding = this.gridOptionsWrapper.getAutoSizePadding();
|
35856 | return dummyContainerWidth + autoSizePadding;
|
35857 | };
|
35858 | AutoWidthCalculator.prototype.getHeaderCellForColumn = function (column) {
|
35859 |
|
35860 | var element = null;
|
35861 | this.ctrlsService.getHeaderRowContainerCtrls().forEach(function (container) {
|
35862 | var res = container.getHtmlElementForColumnHeader(column);
|
35863 | if (res != null) {
|
35864 | element = res;
|
35865 | }
|
35866 | });
|
35867 | return element;
|
35868 | };
|
35869 | AutoWidthCalculator.prototype.cloneItemIntoDummy = function (eCell, eDummyContainer) {
|
35870 |
|
35871 | var eCellClone = eCell.cloneNode(true);
|
35872 |
|
35873 | eCellClone.style.width = '';
|
35874 |
|
35875 | eCellClone.style.position = 'static';
|
35876 | eCellClone.style.left = '';
|
35877 |
|
35878 |
|
35879 |
|
35880 | var eCloneParent = document.createElement('div');
|
35881 | var eCloneParentClassList = eCloneParent.classList;
|
35882 | var isHeader = ['ag-header-cell', 'ag-header-group-cell'].some(function (cls) { return eCellClone.classList.contains(cls); });
|
35883 | if (isHeader) {
|
35884 | eCloneParentClassList.add('ag-header', 'ag-header-row');
|
35885 | eCloneParent.style.position = 'static';
|
35886 | }
|
35887 | else {
|
35888 | eCloneParentClassList.add('ag-row');
|
35889 | }
|
35890 |
|
35891 |
|
35892 |
|
35893 | var pointer = eCell.parentElement;
|
35894 | while (pointer) {
|
35895 | var isRow = ['ag-header-row', 'ag-row'].some(function (cls) { return pointer.classList.contains(cls); });
|
35896 | if (isRow) {
|
35897 | for (var i = 0; i < pointer.classList.length; i++) {
|
35898 | var item = pointer.classList[i];
|
35899 |
|
35900 |
|
35901 |
|
35902 | if (item != 'ag-row-position-absolute') {
|
35903 | eCloneParentClassList.add(item);
|
35904 | }
|
35905 | }
|
35906 | break;
|
35907 | }
|
35908 | pointer = pointer.parentElement;
|
35909 | }
|
35910 |
|
35911 |
|
35912 |
|
35913 | eCloneParent.appendChild(eCellClone);
|
35914 | eDummyContainer.appendChild(eCloneParent);
|
35915 | };
|
35916 | __decorate$1u([
|
35917 | Autowired('rowRenderer')
|
35918 | ], AutoWidthCalculator.prototype, "rowRenderer", void 0);
|
35919 | __decorate$1u([
|
35920 | Autowired('ctrlsService')
|
35921 | ], AutoWidthCalculator.prototype, "ctrlsService", void 0);
|
35922 | __decorate$1u([
|
35923 | Autowired('rowCssClassCalculator')
|
35924 | ], AutoWidthCalculator.prototype, "rowCssClassCalculator", void 0);
|
35925 | __decorate$1u([
|
35926 | PostConstruct
|
35927 | ], AutoWidthCalculator.prototype, "postConstruct", null);
|
35928 | AutoWidthCalculator = __decorate$1u([
|
35929 | Bean('autoWidthCalculator')
|
35930 | ], AutoWidthCalculator);
|
35931 | return AutoWidthCalculator;
|
35932 | }(BeanStub));
|
35933 |
|
35934 |
|
35935 |
|
35936 |
|
35937 |
|
35938 |
|
35939 |
|
35940 | var __extends$1I = (undefined && undefined.__extends) || (function () {
|
35941 | var extendStatics = function (d, b) {
|
35942 | extendStatics = Object.setPrototypeOf ||
|
35943 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
35944 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
35945 | return extendStatics(d, b);
|
35946 | };
|
35947 | return function (d, b) {
|
35948 | extendStatics(d, b);
|
35949 | function __() { this.constructor = d; }
|
35950 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
35951 | };
|
35952 | })();
|
35953 | var __decorate$1v = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
35954 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
35955 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
35956 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
35957 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
35958 | };
|
35959 | var __read$d = (undefined && undefined.__read) || function (o, n) {
|
35960 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
35961 | if (!m) return o;
|
35962 | var i = m.call(o), r, ar = [], e;
|
35963 | try {
|
35964 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
35965 | }
|
35966 | catch (error) { e = { error: error }; }
|
35967 | finally {
|
35968 | try {
|
35969 | if (r && !r.done && (m = i["return"])) m.call(i);
|
35970 | }
|
35971 | finally { if (e) throw e.error; }
|
35972 | }
|
35973 | return ar;
|
35974 | };
|
35975 | var __spread$a = (undefined && undefined.__spread) || function () {
|
35976 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$d(arguments[i]));
|
35977 | return ar;
|
35978 | };
|
35979 | var RowRenderer = (function (_super) {
|
35980 | __extends$1I(RowRenderer, _super);
|
35981 | function RowRenderer() {
|
35982 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
35983 | _this.destroyFuncsForColumnListeners = [];
|
35984 |
|
35985 |
|
35986 | _this.rowCtrlsByRowIndex = {};
|
35987 | _this.zombieRowCtrls = {};
|
35988 | _this.allRowCtrls = [];
|
35989 | _this.topRowCtrls = [];
|
35990 | _this.bottomRowCtrls = [];
|
35991 |
|
35992 |
|
35993 |
|
35994 |
|
35995 | _this.refreshInProgress = false;
|
35996 | return _this;
|
35997 | }
|
35998 | RowRenderer.prototype.postConstruct = function () {
|
35999 | var _this = this;
|
36000 | this.ctrlsService.whenReady(function () {
|
36001 | _this.gridBodyCtrl = _this.ctrlsService.getGridBodyCtrl();
|
36002 | _this.initialise();
|
36003 | });
|
36004 | };
|
36005 | RowRenderer.prototype.initialise = function () {
|
36006 | this.addManagedListener(this.eventService, Events.EVENT_PAGINATION_CHANGED, this.onPageLoaded.bind(this));
|
36007 | this.addManagedListener(this.eventService, Events.EVENT_PINNED_ROW_DATA_CHANGED, this.onPinnedRowDataChanged.bind(this));
|
36008 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
|
36009 | this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, this.redrawAfterScroll.bind(this));
|
36010 | this.addManagedListener(this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, this.redrawAfterScroll.bind(this));
|
36011 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, this.onDomLayoutChanged.bind(this));
|
36012 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_ROW_CLASS, this.redrawRows.bind(this));
|
36013 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onNewColumnsLoaded.bind(this));
|
36014 | this.registerCellEventListeners();
|
36015 | this.initialiseCache();
|
36016 | this.printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
|
36017 | this.embedFullWidthRows = this.printLayout || this.gridOptionsWrapper.isEmbedFullWidthRows();
|
36018 | this.redrawAfterModelUpdate();
|
36019 | };
|
36020 | RowRenderer.prototype.initialiseCache = function () {
|
36021 | if (this.gridOptionsWrapper.isKeepDetailRows()) {
|
36022 | var countProp = this.gridOptionsWrapper.getKeepDetailRowsCount();
|
36023 | var count = countProp != null ? countProp : 3;
|
36024 | this.cachedRowCtrls = new RowCtrlCache(count);
|
36025 | }
|
36026 | };
|
36027 | RowRenderer.prototype.getRowCtrls = function () {
|
36028 | return this.allRowCtrls;
|
36029 | };
|
36030 | RowRenderer.prototype.updateAllRowCtrls = function () {
|
36031 | var liveList = getAllValuesInObject(this.rowCtrlsByRowIndex);
|
36032 | if (this.gridOptionsWrapper.isEnsureDomOrder()) {
|
36033 | liveList.sort(function (a, b) { return a.getRowNode().rowIndex - b.getRowNode.rowIndex; });
|
36034 | }
|
36035 | var zombieList = getAllValuesInObject(this.zombieRowCtrls);
|
36036 | var cachedList = this.cachedRowCtrls ? this.cachedRowCtrls.getEntries() : [];
|
36037 | this.allRowCtrls = __spread$a(liveList, zombieList, cachedList);
|
36038 | };
|
36039 |
|
36040 |
|
36041 |
|
36042 | RowRenderer.prototype.registerCellEventListeners = function () {
|
36043 | var _this = this;
|
36044 | this.addManagedListener(this.eventService, Events.EVENT_CELL_FOCUSED, function (event) {
|
36045 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onCellFocused(event); });
|
36046 | _this.getFullWidthRowCtrls().forEach(function (rowCtrl) {
|
36047 | rowCtrl.onFullWidthRowFocused(event);
|
36048 | });
|
36049 | });
|
36050 | this.addManagedListener(this.eventService, Events.EVENT_FLASH_CELLS, function (event) {
|
36051 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onFlashCells(event); });
|
36052 | });
|
36053 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, function () {
|
36054 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onColumnHover(); });
|
36055 | });
|
36056 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, function () {
|
36057 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onDisplayedColumnsChanged(); });
|
36058 | });
|
36059 |
|
36060 |
|
36061 |
|
36062 |
|
36063 |
|
36064 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, function () {
|
36065 | if (_this.printLayout) {
|
36066 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onLeftChanged(); });
|
36067 | }
|
36068 | });
|
36069 | var rangeSelectionEnabled = this.gridOptionsWrapper.isEnableRangeSelection();
|
36070 | if (rangeSelectionEnabled) {
|
36071 | this.addManagedListener(this.eventService, Events.EVENT_RANGE_SELECTION_CHANGED, function () {
|
36072 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onRangeSelectionChanged(); });
|
36073 | });
|
36074 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, function () {
|
36075 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.updateRangeBordersIfRangeCount(); });
|
36076 | });
|
36077 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, function () {
|
36078 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.updateRangeBordersIfRangeCount(); });
|
36079 | });
|
36080 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, function () {
|
36081 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.updateRangeBordersIfRangeCount(); });
|
36082 | });
|
36083 | }
|
36084 |
|
36085 | this.refreshListenersToColumnsForCellComps();
|
36086 |
|
36087 | this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.refreshListenersToColumnsForCellComps.bind(this));
|
36088 | this.addDestroyFunc(this.removeGridColumnListeners.bind(this));
|
36089 | };
|
36090 |
|
36091 | RowRenderer.prototype.removeGridColumnListeners = function () {
|
36092 | this.destroyFuncsForColumnListeners.forEach(function (func) { return func(); });
|
36093 | this.destroyFuncsForColumnListeners.length = 0;
|
36094 | };
|
36095 |
|
36096 |
|
36097 |
|
36098 |
|
36099 | RowRenderer.prototype.refreshListenersToColumnsForCellComps = function () {
|
36100 | var _this = this;
|
36101 | this.removeGridColumnListeners();
|
36102 | var cols = this.columnModel.getAllGridColumns();
|
36103 | if (!cols) {
|
36104 | return;
|
36105 | }
|
36106 | cols.forEach(function (col) {
|
36107 | var forEachCellWithThisCol = function (callback) {
|
36108 | _this.getAllCellCtrls().forEach(function (cellCtrl) {
|
36109 | if (cellCtrl.getColumn() === col) {
|
36110 | callback(cellCtrl);
|
36111 | }
|
36112 | });
|
36113 | };
|
36114 | var leftChangedListener = function () {
|
36115 | forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onLeftChanged(); });
|
36116 | };
|
36117 | var widthChangedListener = function () {
|
36118 | forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onWidthChanged(); });
|
36119 | };
|
36120 | var firstRightPinnedChangedListener = function () {
|
36121 | forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onFirstRightPinnedChanged(); });
|
36122 | };
|
36123 | var lastLeftPinnedChangedListener = function () {
|
36124 | forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onLastLeftPinnedChanged(); });
|
36125 | };
|
36126 | col.addEventListener(Column.EVENT_LEFT_CHANGED, leftChangedListener);
|
36127 | col.addEventListener(Column.EVENT_WIDTH_CHANGED, widthChangedListener);
|
36128 | col.addEventListener(Column.EVENT_FIRST_RIGHT_PINNED_CHANGED, firstRightPinnedChangedListener);
|
36129 | col.addEventListener(Column.EVENT_LAST_LEFT_PINNED_CHANGED, lastLeftPinnedChangedListener);
|
36130 | _this.destroyFuncsForColumnListeners.push(function () {
|
36131 | col.removeEventListener(Column.EVENT_LEFT_CHANGED, leftChangedListener);
|
36132 | col.removeEventListener(Column.EVENT_WIDTH_CHANGED, widthChangedListener);
|
36133 | col.removeEventListener(Column.EVENT_FIRST_RIGHT_PINNED_CHANGED, firstRightPinnedChangedListener);
|
36134 | col.removeEventListener(Column.EVENT_LAST_LEFT_PINNED_CHANGED, lastLeftPinnedChangedListener);
|
36135 | });
|
36136 | });
|
36137 | };
|
36138 | RowRenderer.prototype.onDomLayoutChanged = function () {
|
36139 | var printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
|
36140 | var embedFullWidthRows = printLayout || this.gridOptionsWrapper.isEmbedFullWidthRows();
|
36141 |
|
36142 |
|
36143 | var destroyRows = embedFullWidthRows !== this.embedFullWidthRows || this.printLayout !== printLayout;
|
36144 | this.printLayout = printLayout;
|
36145 | this.embedFullWidthRows = embedFullWidthRows;
|
36146 | if (destroyRows) {
|
36147 | this.redrawAfterModelUpdate();
|
36148 | }
|
36149 | };
|
36150 |
|
36151 |
|
36152 | RowRenderer.prototype.datasourceChanged = function () {
|
36153 | this.firstRenderedRow = 0;
|
36154 | this.lastRenderedRow = -1;
|
36155 | var rowIndexesToRemove = Object.keys(this.rowCtrlsByRowIndex);
|
36156 | this.removeRowCtrls(rowIndexesToRemove);
|
36157 | };
|
36158 | RowRenderer.prototype.onPageLoaded = function (event) {
|
36159 | var params = {
|
36160 | recycleRows: event.keepRenderedRows,
|
36161 | animate: event.animate,
|
36162 | newData: event.newData,
|
36163 | newPage: event.newPage,
|
36164 |
|
36165 |
|
36166 |
|
36167 |
|
36168 | onlyBody: true
|
36169 | };
|
36170 | this.redrawAfterModelUpdate(params);
|
36171 | };
|
36172 | RowRenderer.prototype.getAllCellsForColumn = function (column) {
|
36173 | var res = [];
|
36174 | this.getAllRowCtrls().forEach(function (rowCtrl) {
|
36175 | var eCell = rowCtrl.getCellElement(column);
|
36176 | if (eCell) {
|
36177 | res.push(eCell);
|
36178 | }
|
36179 | });
|
36180 | return res;
|
36181 | };
|
36182 | RowRenderer.prototype.refreshFloatingRowComps = function () {
|
36183 | this.refreshFloatingRows(this.topRowCtrls, this.pinnedRowModel.getPinnedTopRowData());
|
36184 | this.refreshFloatingRows(this.bottomRowCtrls, this.pinnedRowModel.getPinnedBottomRowData());
|
36185 | };
|
36186 | RowRenderer.prototype.getTopRowCtrls = function () {
|
36187 | return this.topRowCtrls;
|
36188 | };
|
36189 | RowRenderer.prototype.getBottomRowCtrls = function () {
|
36190 | return this.bottomRowCtrls;
|
36191 | };
|
36192 | RowRenderer.prototype.refreshFloatingRows = function (rowComps, rowNodes) {
|
36193 | var _this = this;
|
36194 | rowComps.forEach(function (row) {
|
36195 | row.destroyFirstPass();
|
36196 | row.destroySecondPass();
|
36197 | });
|
36198 | rowComps.length = 0;
|
36199 | if (!rowNodes) {
|
36200 | return;
|
36201 | }
|
36202 | rowNodes.forEach(function (rowNode) {
|
36203 | var rowCtrl = new RowCtrl(rowNode, _this.beans, false, false, _this.printLayout);
|
36204 | rowComps.push(rowCtrl);
|
36205 | });
|
36206 | };
|
36207 | RowRenderer.prototype.onPinnedRowDataChanged = function () {
|
36208 |
|
36209 | var params = {
|
36210 | recycleRows: true
|
36211 | };
|
36212 | this.redrawAfterModelUpdate(params);
|
36213 | };
|
36214 |
|
36215 | RowRenderer.prototype.getRenderedIndexesForRowNodes = function (rowNodes) {
|
36216 | var result = [];
|
36217 | if (missing(rowNodes)) {
|
36218 | return result;
|
36219 | }
|
36220 | iterateObject(this.rowCtrlsByRowIndex, function (index, renderedRow) {
|
36221 | var rowNode = renderedRow.getRowNode();
|
36222 | if (rowNodes.indexOf(rowNode) >= 0) {
|
36223 | result.push(index);
|
36224 | }
|
36225 | });
|
36226 | return result;
|
36227 | };
|
36228 | RowRenderer.prototype.redrawRows = function (rowNodes) {
|
36229 |
|
36230 | var partialRefresh = rowNodes != null && rowNodes.length > 0;
|
36231 | if (partialRefresh) {
|
36232 | var indexesToRemove = this.getRenderedIndexesForRowNodes(rowNodes);
|
36233 |
|
36234 | this.removeRowCtrls(indexesToRemove);
|
36235 | }
|
36236 |
|
36237 | this.redrawAfterModelUpdate({
|
36238 | recycleRows: partialRefresh
|
36239 | });
|
36240 | };
|
36241 | RowRenderer.prototype.getCellToRestoreFocusToAfterRefresh = function (params) {
|
36242 | var focusedCell = params.suppressKeepFocus ? null : this.focusService.getFocusCellToUseAfterRefresh();
|
36243 | if (focusedCell == null) {
|
36244 | return null;
|
36245 | }
|
36246 |
|
36247 |
|
36248 |
|
36249 |
|
36250 |
|
36251 |
|
36252 | var eDocument = this.gridOptionsWrapper.getDocument();
|
36253 | var activeElement = eDocument.activeElement;
|
36254 | var cellDomData = this.gridOptionsWrapper.getDomData(activeElement, CellCtrl.DOM_DATA_KEY_CELL_CTRL);
|
36255 | var rowDomData = this.gridOptionsWrapper.getDomData(activeElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL);
|
36256 | var gridElementFocused = cellDomData || rowDomData;
|
36257 | return gridElementFocused ? focusedCell : null;
|
36258 | };
|
36259 |
|
36260 |
|
36261 |
|
36262 |
|
36263 |
|
36264 |
|
36265 | RowRenderer.prototype.redrawAfterModelUpdate = function (params) {
|
36266 | if (params === void 0) { params = {}; }
|
36267 | this.getLockOnRefresh();
|
36268 | var focusedCell = this.getCellToRestoreFocusToAfterRefresh(params);
|
36269 | this.updateContainerHeights();
|
36270 | this.scrollToTopIfNewData(params);
|
36271 |
|
36272 |
|
36273 | var recycleRows = !this.printLayout && !!params.recycleRows;
|
36274 | var animate = params.animate && this.gridOptionsWrapper.isAnimateRows();
|
36275 |
|
36276 |
|
36277 | var rowsToRecycle = recycleRows ? this.recycleRows() : null;
|
36278 | if (!recycleRows) {
|
36279 | this.removeAllRowComps();
|
36280 | }
|
36281 | var isFocusedCellGettingRecycled = function () {
|
36282 | if (focusedCell == null || rowsToRecycle == null) {
|
36283 | return false;
|
36284 | }
|
36285 | var res = false;
|
36286 | iterateObject(rowsToRecycle, function (key, rowComp) {
|
36287 | var rowNode = rowComp.getRowNode();
|
36288 | var rowIndexEqual = rowNode.rowIndex == focusedCell.rowIndex;
|
36289 | var pinnedEqual = rowNode.rowPinned == focusedCell.rowPinned;
|
36290 | if (rowIndexEqual && pinnedEqual) {
|
36291 | res = true;
|
36292 | }
|
36293 | });
|
36294 | return res;
|
36295 | };
|
36296 | var focusedCellRecycled = isFocusedCellGettingRecycled();
|
36297 | this.redraw(rowsToRecycle, animate);
|
36298 | if (!params.onlyBody) {
|
36299 | this.refreshFloatingRowComps();
|
36300 | }
|
36301 | this.dispatchDisplayedRowsChanged();
|
36302 |
|
36303 |
|
36304 | if (!focusedCellRecycled) {
|
36305 | this.restoreFocusedCell(focusedCell);
|
36306 | }
|
36307 | this.releaseLockOnRefresh();
|
36308 | };
|
36309 | RowRenderer.prototype.scrollToTopIfNewData = function (params) {
|
36310 | var scrollToTop = params.newData || params.newPage;
|
36311 | var suppressScrollToTop = this.gridOptionsWrapper.isSuppressScrollOnNewData();
|
36312 | if (scrollToTop && !suppressScrollToTop) {
|
36313 | this.gridBodyCtrl.getScrollFeature().scrollToTop();
|
36314 | }
|
36315 | };
|
36316 | RowRenderer.prototype.updateContainerHeights = function () {
|
36317 |
|
36318 | if (this.printLayout) {
|
36319 | this.rowContainerHeightService.setModelHeight(null);
|
36320 | return;
|
36321 | }
|
36322 | var containerHeight = this.paginationProxy.getCurrentPageHeight();
|
36323 |
|
36324 |
|
36325 |
|
36326 |
|
36327 |
|
36328 | if (containerHeight === 0) {
|
36329 | containerHeight = 1;
|
36330 | }
|
36331 | this.rowContainerHeightService.setModelHeight(containerHeight);
|
36332 | };
|
36333 | RowRenderer.prototype.getLockOnRefresh = function () {
|
36334 | if (this.refreshInProgress) {
|
36335 | throw new Error("AG Grid: cannot get grid to draw rows when it is in the middle of drawing rows. " +
|
36336 | "Your code probably called a grid API method while the grid was in the render stage. To overcome " +
|
36337 | "this, put the API call into a timeout, e.g. instead of api.redrawRows(), " +
|
36338 | "call setTimeout(function() { api.redrawRows(); }, 0). To see what part of your code " +
|
36339 | "that caused the refresh check this stacktrace.");
|
36340 | }
|
36341 | this.refreshInProgress = true;
|
36342 | };
|
36343 | RowRenderer.prototype.releaseLockOnRefresh = function () {
|
36344 | this.refreshInProgress = false;
|
36345 | };
|
36346 | RowRenderer.prototype.isRefreshInProgress = function () {
|
36347 | return this.refreshInProgress;
|
36348 | };
|
36349 |
|
36350 |
|
36351 |
|
36352 |
|
36353 | RowRenderer.prototype.restoreFocusedCell = function (cellPosition) {
|
36354 | if (cellPosition) {
|
36355 | this.focusService.setFocusedCell(cellPosition.rowIndex, cellPosition.column, cellPosition.rowPinned, true);
|
36356 | }
|
36357 | };
|
36358 | RowRenderer.prototype.stopEditing = function (cancel) {
|
36359 | if (cancel === void 0) { cancel = false; }
|
36360 | this.getAllRowCtrls().forEach(function (rowCtrl) {
|
36361 | rowCtrl.stopEditing(cancel);
|
36362 | });
|
36363 | };
|
36364 | RowRenderer.prototype.onNewColumnsLoaded = function () {
|
36365 |
|
36366 |
|
36367 |
|
36368 | this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onNewColumnsLoaded(); });
|
36369 | };
|
36370 | RowRenderer.prototype.getAllCellCtrls = function () {
|
36371 | var res = [];
|
36372 | this.getAllRowCtrls().forEach(function (rowCtrl) { return res = res.concat(rowCtrl.getAllCellCtrls()); });
|
36373 | return res;
|
36374 | };
|
36375 | RowRenderer.prototype.getAllRowCtrls = function () {
|
36376 | var _this = this;
|
36377 | var res = __spread$a(this.topRowCtrls, this.bottomRowCtrls);
|
36378 | Object.keys(this.rowCtrlsByRowIndex).forEach(function (key) { return res.push(_this.rowCtrlsByRowIndex[key]); });
|
36379 | return res;
|
36380 | };
|
36381 | RowRenderer.prototype.addRenderedRowListener = function (eventName, rowIndex, callback) {
|
36382 | var rowComp = this.rowCtrlsByRowIndex[rowIndex];
|
36383 | if (rowComp) {
|
36384 | rowComp.addEventListener(eventName, callback);
|
36385 | }
|
36386 | };
|
36387 | RowRenderer.prototype.flashCells = function (params) {
|
36388 | if (params === void 0) { params = {}; }
|
36389 | var flashDelay = params.flashDelay, fadeDelay = params.fadeDelay;
|
36390 | this.getCellCtrls(params.rowNodes, params.columns)
|
36391 | .forEach(function (cellCtrl) { return cellCtrl.flashCell({ flashDelay: flashDelay, fadeDelay: fadeDelay }); });
|
36392 | };
|
36393 | RowRenderer.prototype.refreshCells = function (params) {
|
36394 | if (params === void 0) { params = {}; }
|
36395 | var refreshCellParams = {
|
36396 | forceRefresh: params.force,
|
36397 | newData: false,
|
36398 | suppressFlash: params.suppressFlash
|
36399 | };
|
36400 | this.getCellCtrls(params.rowNodes, params.columns)
|
36401 | .forEach(function (cellCtrl) {
|
36402 | if (cellCtrl.refreshShouldDestroy()) {
|
36403 | var rowCtrl = cellCtrl.getRowCtrl();
|
36404 | if (rowCtrl) {
|
36405 | rowCtrl.refreshCell(cellCtrl);
|
36406 | }
|
36407 | }
|
36408 | else {
|
36409 | cellCtrl.refreshCell(refreshCellParams);
|
36410 | }
|
36411 | });
|
36412 | this.getFullWidthRowCtrls(params.rowNodes).forEach(function (fullWidthRowCtrl) {
|
36413 | fullWidthRowCtrl.refreshFullWidth();
|
36414 | });
|
36415 | };
|
36416 | RowRenderer.prototype.getCellRendererInstances = function (params) {
|
36417 | var res = this.getCellCtrls(params.rowNodes, params.columns)
|
36418 | .map(function (cellCtrl) { return cellCtrl.getCellRenderer(); })
|
36419 | .filter(function (renderer) { return renderer != null; });
|
36420 | return res;
|
36421 | };
|
36422 | RowRenderer.prototype.getCellEditorInstances = function (params) {
|
36423 | var res = [];
|
36424 | this.getCellCtrls(params.rowNodes, params.columns).forEach(function (cellCtrl) {
|
36425 | var cellEditor = cellCtrl.getCellEditor();
|
36426 | if (cellEditor) {
|
36427 | res.push(cellEditor);
|
36428 | }
|
36429 | });
|
36430 | return res;
|
36431 | };
|
36432 | RowRenderer.prototype.getEditingCells = function () {
|
36433 | var res = [];
|
36434 | this.getAllCellCtrls().forEach(function (cellCtrl) {
|
36435 | if (cellCtrl.isEditing()) {
|
36436 | var cellPosition = cellCtrl.getCellPosition();
|
36437 | res.push(cellPosition);
|
36438 | }
|
36439 | });
|
36440 | return res;
|
36441 | };
|
36442 | RowRenderer.prototype.mapRowNodes = function (rowNodes) {
|
36443 | if (!rowNodes) {
|
36444 | return;
|
36445 | }
|
36446 | var res = {
|
36447 | top: {},
|
36448 | bottom: {},
|
36449 | normal: {}
|
36450 | };
|
36451 | rowNodes.forEach(function (rowNode) {
|
36452 | var id = rowNode.id;
|
36453 | if (rowNode.rowPinned === Constants.PINNED_TOP) {
|
36454 | res.top[id] = rowNode;
|
36455 | }
|
36456 | else if (rowNode.rowPinned === Constants.PINNED_BOTTOM) {
|
36457 | res.bottom[id] = rowNode;
|
36458 | }
|
36459 | else {
|
36460 | res.normal[id] = rowNode;
|
36461 | }
|
36462 | });
|
36463 | return res;
|
36464 | };
|
36465 | RowRenderer.prototype.isRowInMap = function (rowNode, rowIdsMap) {
|
36466 |
|
36467 | var id = rowNode.id;
|
36468 | var floating = rowNode.rowPinned;
|
36469 | if (floating === Constants.PINNED_BOTTOM) {
|
36470 | return rowIdsMap.bottom[id] != null;
|
36471 | }
|
36472 | else if (floating === Constants.PINNED_TOP) {
|
36473 | return rowIdsMap.top[id] != null;
|
36474 | }
|
36475 | else {
|
36476 | return rowIdsMap.normal[id] != null;
|
36477 | }
|
36478 | };
|
36479 |
|
36480 |
|
36481 | RowRenderer.prototype.getCellCtrls = function (rowNodes, columns) {
|
36482 | var _this = this;
|
36483 | var rowIdsMap = this.mapRowNodes(rowNodes);
|
36484 | var res = [];
|
36485 | var colIdsMap;
|
36486 | if (exists(columns)) {
|
36487 | colIdsMap = {};
|
36488 | columns.forEach(function (colKey) {
|
36489 | var column = _this.columnModel.getGridColumn(colKey);
|
36490 | if (exists(column)) {
|
36491 | colIdsMap[column.getId()] = true;
|
36492 | }
|
36493 | });
|
36494 | }
|
36495 | var processRow = function (rowComp) {
|
36496 | var rowNode = rowComp.getRowNode();
|
36497 |
|
36498 | if (rowIdsMap != null && !_this.isRowInMap(rowNode, rowIdsMap)) {
|
36499 | return;
|
36500 | }
|
36501 | rowComp.getAllCellCtrls().forEach(function (cellCtrl) {
|
36502 | var colId = cellCtrl.getColumn().getId();
|
36503 | var excludeColFromRefresh = colIdsMap && !colIdsMap[colId];
|
36504 | if (excludeColFromRefresh) {
|
36505 | return;
|
36506 | }
|
36507 | res.push(cellCtrl);
|
36508 | });
|
36509 | };
|
36510 | iterateObject(this.rowCtrlsByRowIndex, function (index, rowComp) {
|
36511 | processRow(rowComp);
|
36512 | });
|
36513 | if (this.topRowCtrls) {
|
36514 | this.topRowCtrls.forEach(processRow);
|
36515 | }
|
36516 | if (this.bottomRowCtrls) {
|
36517 | this.bottomRowCtrls.forEach(processRow);
|
36518 | }
|
36519 | return res;
|
36520 | };
|
36521 | RowRenderer.prototype.destroy = function () {
|
36522 | this.removeAllRowComps();
|
36523 | _super.prototype.destroy.call(this);
|
36524 | };
|
36525 | RowRenderer.prototype.removeAllRowComps = function () {
|
36526 | var rowIndexesToRemove = Object.keys(this.rowCtrlsByRowIndex);
|
36527 | this.removeRowCtrls(rowIndexesToRemove);
|
36528 | };
|
36529 | RowRenderer.prototype.recycleRows = function () {
|
36530 |
|
36531 | var stubNodeIndexes = [];
|
36532 | iterateObject(this.rowCtrlsByRowIndex, function (index, rowComp) {
|
36533 | var stubNode = rowComp.getRowNode().id == null;
|
36534 | if (stubNode) {
|
36535 | stubNodeIndexes.push(index);
|
36536 | }
|
36537 | });
|
36538 | this.removeRowCtrls(stubNodeIndexes);
|
36539 |
|
36540 | var nodesByIdMap = {};
|
36541 | iterateObject(this.rowCtrlsByRowIndex, function (index, rowComp) {
|
36542 | var rowNode = rowComp.getRowNode();
|
36543 | nodesByIdMap[rowNode.id] = rowComp;
|
36544 | });
|
36545 | this.rowCtrlsByRowIndex = {};
|
36546 | return nodesByIdMap;
|
36547 | };
|
36548 |
|
36549 | RowRenderer.prototype.removeRowCtrls = function (rowsToRemove) {
|
36550 | var _this = this;
|
36551 |
|
36552 |
|
36553 | rowsToRemove.forEach(function (indexToRemove) {
|
36554 | var rowCtrl = _this.rowCtrlsByRowIndex[indexToRemove];
|
36555 | if (rowCtrl) {
|
36556 | rowCtrl.destroyFirstPass();
|
36557 | rowCtrl.destroySecondPass();
|
36558 | }
|
36559 | delete _this.rowCtrlsByRowIndex[indexToRemove];
|
36560 | });
|
36561 | };
|
36562 |
|
36563 |
|
36564 |
|
36565 |
|
36566 | RowRenderer.prototype.redrawAfterScroll = function () {
|
36567 | this.getLockOnRefresh();
|
36568 | this.redraw(null, false, true);
|
36569 | this.releaseLockOnRefresh();
|
36570 | this.dispatchDisplayedRowsChanged();
|
36571 | };
|
36572 | RowRenderer.prototype.removeRowCompsNotToDraw = function (indexesToDraw) {
|
36573 |
|
36574 | var indexesToDrawMap = {};
|
36575 | indexesToDraw.forEach(function (index) { return (indexesToDrawMap[index] = true); });
|
36576 | var existingIndexes = Object.keys(this.rowCtrlsByRowIndex);
|
36577 | var indexesNotToDraw = existingIndexes.filter(function (index) { return !indexesToDrawMap[index]; });
|
36578 | this.removeRowCtrls(indexesNotToDraw);
|
36579 | };
|
36580 | RowRenderer.prototype.calculateIndexesToDraw = function (rowsToRecycle) {
|
36581 | var _this = this;
|
36582 |
|
36583 | var indexesToDraw = createArrayOfNumbers(this.firstRenderedRow, this.lastRenderedRow);
|
36584 | var checkRowToDraw = function (indexStr, rowComp) {
|
36585 | var index = rowComp.getRowNode().rowIndex;
|
36586 | if (index == null) {
|
36587 | return;
|
36588 | }
|
36589 | if (index < _this.firstRenderedRow || index > _this.lastRenderedRow) {
|
36590 | if (_this.doNotUnVirtualiseRow(rowComp)) {
|
36591 | indexesToDraw.push(index);
|
36592 | }
|
36593 | }
|
36594 | };
|
36595 |
|
36596 | iterateObject(this.rowCtrlsByRowIndex, checkRowToDraw);
|
36597 |
|
36598 | iterateObject(rowsToRecycle, checkRowToDraw);
|
36599 | indexesToDraw.sort(function (a, b) { return a - b; });
|
36600 | return indexesToDraw;
|
36601 | };
|
36602 | RowRenderer.prototype.redraw = function (rowsToRecycle, animate, afterScroll) {
|
36603 | var _this = this;
|
36604 | if (animate === void 0) { animate = false; }
|
36605 | if (afterScroll === void 0) { afterScroll = false; }
|
36606 | this.rowContainerHeightService.updateOffset();
|
36607 | this.workOutFirstAndLastRowsToRender();
|
36608 |
|
36609 |
|
36610 |
|
36611 |
|
36612 |
|
36613 |
|
36614 | var indexesToDraw = this.calculateIndexesToDraw(rowsToRecycle);
|
36615 | this.removeRowCompsNotToDraw(indexesToDraw);
|
36616 |
|
36617 |
|
36618 | if (this.printLayout) {
|
36619 | animate = false;
|
36620 | }
|
36621 | indexesToDraw.forEach(function (rowIndex) {
|
36622 | var rowCtrl = _this.createOrUpdateRowCtrl(rowIndex, rowsToRecycle, animate, afterScroll);
|
36623 | if (exists(rowCtrl)) ;
|
36624 | });
|
36625 | if (rowsToRecycle) {
|
36626 | var useAnimationFrame = afterScroll && !this.gridOptionsWrapper.isSuppressAnimationFrame() && !this.printLayout;
|
36627 | if (useAnimationFrame) {
|
36628 | this.beans.animationFrameService.addDestroyTask(function () {
|
36629 | _this.destroyRowCtrls(rowsToRecycle, animate);
|
36630 | _this.updateAllRowCtrls();
|
36631 | _this.dispatchDisplayedRowsChanged();
|
36632 | });
|
36633 | }
|
36634 | else {
|
36635 | this.destroyRowCtrls(rowsToRecycle, animate);
|
36636 | }
|
36637 | }
|
36638 | this.updateAllRowCtrls();
|
36639 | this.gridBodyCtrl.updateRowCount();
|
36640 | };
|
36641 | RowRenderer.prototype.dispatchDisplayedRowsChanged = function () {
|
36642 | var event = { type: Events.EVENT_DISPLAYED_ROWS_CHANGED };
|
36643 | this.eventService.dispatchEvent(event);
|
36644 | };
|
36645 | RowRenderer.prototype.onDisplayedColumnsChanged = function () {
|
36646 | var pinningLeft = this.columnModel.isPinningLeft();
|
36647 | var pinningRight = this.columnModel.isPinningRight();
|
36648 | var atLeastOneChanged = this.pinningLeft !== pinningLeft || pinningRight !== this.pinningRight;
|
36649 | if (atLeastOneChanged) {
|
36650 | this.pinningLeft = pinningLeft;
|
36651 | this.pinningRight = pinningRight;
|
36652 | if (this.embedFullWidthRows) {
|
36653 | this.redrawFullWidthEmbeddedRows();
|
36654 | }
|
36655 | }
|
36656 | };
|
36657 |
|
36658 |
|
36659 | RowRenderer.prototype.redrawFullWidthEmbeddedRows = function () {
|
36660 |
|
36661 |
|
36662 | var rowsToRemove = [];
|
36663 | this.getFullWidthRowCtrls().forEach(function (fullWidthCtrl) {
|
36664 | var rowIndex = fullWidthCtrl.getRowNode().rowIndex;
|
36665 | rowsToRemove.push(rowIndex.toString());
|
36666 | });
|
36667 | this.refreshFloatingRowComps();
|
36668 | this.removeRowCtrls(rowsToRemove);
|
36669 | this.redrawAfterScroll();
|
36670 | };
|
36671 | RowRenderer.prototype.getFullWidthRowCtrls = function (rowNodes) {
|
36672 | var _this = this;
|
36673 | var rowNodesMap = this.mapRowNodes(rowNodes);
|
36674 | return getAllValuesInObject(this.rowCtrlsByRowIndex).filter(function (rowCtrl) {
|
36675 |
|
36676 | if (!rowCtrl.isFullWidth()) {
|
36677 | return false;
|
36678 | }
|
36679 |
|
36680 | var rowNode = rowCtrl.getRowNode();
|
36681 | if (rowNodesMap != null && !_this.isRowInMap(rowNode, rowNodesMap)) {
|
36682 | return false;
|
36683 | }
|
36684 | return true;
|
36685 | });
|
36686 | };
|
36687 | RowRenderer.prototype.refreshFullWidthRows = function (rowNodesToRefresh) {
|
36688 | var rowsToRemove = [];
|
36689 | var selectivelyRefreshing = !!rowNodesToRefresh;
|
36690 | var idsToRefresh = selectivelyRefreshing ? {} : undefined;
|
36691 | if (selectivelyRefreshing && idsToRefresh) {
|
36692 | rowNodesToRefresh.forEach(function (r) { return idsToRefresh[r.id] = true; });
|
36693 | }
|
36694 | this.getFullWidthRowCtrls().forEach(function (fullWidthRowCtrl) {
|
36695 | var rowNode = fullWidthRowCtrl.getRowNode();
|
36696 | if (selectivelyRefreshing && idsToRefresh) {
|
36697 |
|
36698 |
|
36699 |
|
36700 |
|
36701 | var parentId = (rowNode.level > 0 && rowNode.parent) ? rowNode.parent.id : undefined;
|
36702 | var skipThisNode = !idsToRefresh[rowNode.id] && !idsToRefresh[parentId];
|
36703 | if (skipThisNode) {
|
36704 | return;
|
36705 | }
|
36706 | }
|
36707 | var fullWidthRowsRefreshed = fullWidthRowCtrl.refreshFullWidth();
|
36708 | if (!fullWidthRowsRefreshed) {
|
36709 | var rowIndex = fullWidthRowCtrl.getRowNode().rowIndex;
|
36710 | rowsToRemove.push(rowIndex.toString());
|
36711 | }
|
36712 | });
|
36713 | this.removeRowCtrls(rowsToRemove);
|
36714 | this.redrawAfterScroll();
|
36715 | };
|
36716 | RowRenderer.prototype.createOrUpdateRowCtrl = function (rowIndex, rowsToRecycle, animate, afterScroll) {
|
36717 | var rowNode;
|
36718 | var rowCtrl = this.rowCtrlsByRowIndex[rowIndex];
|
36719 |
|
36720 | if (!rowCtrl) {
|
36721 | rowNode = this.paginationProxy.getRow(rowIndex);
|
36722 | if (exists(rowNode) && exists(rowsToRecycle) && rowsToRecycle[rowNode.id] && rowNode.alreadyRendered) {
|
36723 | rowCtrl = rowsToRecycle[rowNode.id];
|
36724 | rowsToRecycle[rowNode.id] = null;
|
36725 | }
|
36726 | }
|
36727 | var creatingNewRowCtrl = !rowCtrl;
|
36728 | if (creatingNewRowCtrl) {
|
36729 |
|
36730 | if (!rowNode) {
|
36731 | rowNode = this.paginationProxy.getRow(rowIndex);
|
36732 | }
|
36733 | if (exists(rowNode)) {
|
36734 | rowCtrl = this.createRowCon(rowNode, animate, afterScroll);
|
36735 | }
|
36736 | else {
|
36737 |
|
36738 |
|
36739 | return;
|
36740 | }
|
36741 | }
|
36742 | if (rowNode) {
|
36743 |
|
36744 |
|
36745 | rowNode.alreadyRendered = true;
|
36746 | }
|
36747 | this.rowCtrlsByRowIndex[rowIndex] = rowCtrl;
|
36748 | return rowCtrl;
|
36749 | };
|
36750 | RowRenderer.prototype.destroyRowCtrls = function (rowCtrlsMap, animate) {
|
36751 | var _this = this;
|
36752 | var executeInAWhileFuncs = [];
|
36753 | iterateObject(rowCtrlsMap, function (nodeId, rowCtrl) {
|
36754 |
|
36755 | if (!rowCtrl) {
|
36756 | return;
|
36757 | }
|
36758 | if (_this.cachedRowCtrls && rowCtrl.isCacheable()) {
|
36759 | _this.cachedRowCtrls.addRow(rowCtrl);
|
36760 | return;
|
36761 | }
|
36762 | rowCtrl.destroyFirstPass();
|
36763 | if (animate) {
|
36764 | _this.zombieRowCtrls[rowCtrl.getInstanceId()] = rowCtrl;
|
36765 | executeInAWhileFuncs.push(function () {
|
36766 | rowCtrl.destroySecondPass();
|
36767 | delete _this.zombieRowCtrls[rowCtrl.getInstanceId()];
|
36768 | });
|
36769 | }
|
36770 | else {
|
36771 | rowCtrl.destroySecondPass();
|
36772 | }
|
36773 | });
|
36774 | if (animate) {
|
36775 |
|
36776 |
|
36777 | executeInAWhileFuncs.push(function () {
|
36778 | _this.updateAllRowCtrls();
|
36779 | _this.dispatchDisplayedRowsChanged();
|
36780 | });
|
36781 | executeInAWhile(executeInAWhileFuncs);
|
36782 | }
|
36783 | };
|
36784 | RowRenderer.prototype.workOutFirstAndLastRowsToRender = function () {
|
36785 | var _this = this;
|
36786 | var newFirst;
|
36787 | var newLast;
|
36788 | if (!this.paginationProxy.isRowsToRender()) {
|
36789 | newFirst = 0;
|
36790 | newLast = -1;
|
36791 | }
|
36792 | else if (this.printLayout) {
|
36793 | newFirst = this.paginationProxy.getPageFirstRow();
|
36794 | newLast = this.paginationProxy.getPageLastRow();
|
36795 | }
|
36796 | else {
|
36797 | var bufferPixels = this.gridOptionsWrapper.getRowBufferInPixels();
|
36798 | var gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();
|
36799 | var suppressRowVirtualisation = this.gridOptionsWrapper.isSuppressRowVirtualisation();
|
36800 | var rowHeightsChanged = false;
|
36801 | var firstPixel = void 0;
|
36802 | var lastPixel = void 0;
|
36803 | do {
|
36804 | var paginationOffset = this.paginationProxy.getPixelOffset();
|
36805 | var _a = this.paginationProxy.getCurrentPagePixelRange(), pageFirstPixel = _a.pageFirstPixel, pageLastPixel = _a.pageLastPixel;
|
36806 | var divStretchOffset = this.rowContainerHeightService.getDivStretchOffset();
|
36807 | if (suppressRowVirtualisation) {
|
36808 | firstPixel = pageFirstPixel + divStretchOffset;
|
36809 | lastPixel = pageLastPixel + divStretchOffset;
|
36810 | }
|
36811 | else {
|
36812 | var bodyVRange = gridBodyCtrl.getScrollFeature().getVScrollPosition();
|
36813 | var bodyTopPixel = bodyVRange.top;
|
36814 | var bodyBottomPixel = bodyVRange.bottom;
|
36815 | firstPixel = Math.max(bodyTopPixel + paginationOffset - bufferPixels, pageFirstPixel) + divStretchOffset;
|
36816 | lastPixel = Math.min(bodyBottomPixel + paginationOffset + bufferPixels, pageLastPixel) + divStretchOffset;
|
36817 | }
|
36818 |
|
36819 | rowHeightsChanged = this.ensureAllRowsInRangeHaveHeightsCalculated(firstPixel, lastPixel);
|
36820 | } while (rowHeightsChanged);
|
36821 | var firstRowIndex = this.paginationProxy.getRowIndexAtPixel(firstPixel);
|
36822 | var lastRowIndex = this.paginationProxy.getRowIndexAtPixel(lastPixel);
|
36823 | var pageFirstRow = this.paginationProxy.getPageFirstRow();
|
36824 | var pageLastRow = this.paginationProxy.getPageLastRow();
|
36825 |
|
36826 | if (firstRowIndex < pageFirstRow) {
|
36827 | firstRowIndex = pageFirstRow;
|
36828 | }
|
36829 | if (lastRowIndex > pageLastRow) {
|
36830 | lastRowIndex = pageLastRow;
|
36831 | }
|
36832 | newFirst = firstRowIndex;
|
36833 | newLast = lastRowIndex;
|
36834 | }
|
36835 |
|
36836 |
|
36837 |
|
36838 |
|
36839 | var rowLayoutNormal = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_NORMAL;
|
36840 | var suppressRowCountRestriction = this.gridOptionsWrapper.isSuppressMaxRenderedRowRestriction();
|
36841 | var rowBufferMaxSize = Math.max(this.gridOptionsWrapper.getRowBuffer(), 500);
|
36842 | if (rowLayoutNormal && !suppressRowCountRestriction) {
|
36843 | if (newLast - newFirst > rowBufferMaxSize) {
|
36844 | newLast = newFirst + rowBufferMaxSize;
|
36845 | }
|
36846 | }
|
36847 | var firstDiffers = newFirst !== this.firstRenderedRow;
|
36848 | var lastDiffers = newLast !== this.lastRenderedRow;
|
36849 | if (firstDiffers || lastDiffers) {
|
36850 | this.firstRenderedRow = newFirst;
|
36851 | this.lastRenderedRow = newLast;
|
36852 | var event_1 = {
|
36853 | type: Events.EVENT_VIEWPORT_CHANGED,
|
36854 | firstRow: newFirst,
|
36855 | lastRow: newLast,
|
36856 | api: this.gridApi,
|
36857 | columnApi: this.columnApi
|
36858 | };
|
36859 | this.eventService.dispatchEvent(event_1);
|
36860 | }
|
36861 |
|
36862 | if (this.paginationProxy.isRowsToRender()) {
|
36863 | var event_2 = {
|
36864 | type: Events.EVENT_FIRST_DATA_RENDERED,
|
36865 | firstRow: newFirst,
|
36866 | lastRow: newLast,
|
36867 | api: this.gridApi,
|
36868 | columnApi: this.columnApi
|
36869 | };
|
36870 |
|
36871 |
|
36872 |
|
36873 | window.setTimeout(function () { return _this.eventService.dispatchEventOnce(event_2); }, 50);
|
36874 | }
|
36875 | };
|
36876 | RowRenderer.prototype.ensureAllRowsInRangeHaveHeightsCalculated = function (topPixel, bottomPixel) {
|
36877 |
|
36878 |
|
36879 | var res = this.paginationProxy.ensureRowHeightsValid(topPixel, bottomPixel, -1, -1);
|
36880 | if (res) {
|
36881 | this.updateContainerHeights();
|
36882 | }
|
36883 | return res;
|
36884 | };
|
36885 | RowRenderer.prototype.getFirstVirtualRenderedRow = function () {
|
36886 | return this.firstRenderedRow;
|
36887 | };
|
36888 | RowRenderer.prototype.getLastVirtualRenderedRow = function () {
|
36889 | return this.lastRenderedRow;
|
36890 | };
|
36891 |
|
36892 |
|
36893 |
|
36894 |
|
36895 |
|
36896 |
|
36897 |
|
36898 |
|
36899 |
|
36900 |
|
36901 |
|
36902 | RowRenderer.prototype.doNotUnVirtualiseRow = function (rowComp) {
|
36903 | var REMOVE_ROW = false;
|
36904 | var KEEP_ROW = true;
|
36905 | var rowNode = rowComp.getRowNode();
|
36906 | var rowHasFocus = this.focusService.isRowNodeFocused(rowNode);
|
36907 | var rowIsEditing = rowComp.isEditing();
|
36908 | var rowIsDetail = rowNode.detail;
|
36909 | var mightWantToKeepRow = rowHasFocus || rowIsEditing || rowIsDetail;
|
36910 |
|
36911 | if (!mightWantToKeepRow) {
|
36912 | return REMOVE_ROW;
|
36913 | }
|
36914 |
|
36915 |
|
36916 |
|
36917 | var rowNodePresent = this.paginationProxy.isRowPresent(rowNode);
|
36918 | return rowNodePresent ? KEEP_ROW : REMOVE_ROW;
|
36919 | };
|
36920 | RowRenderer.prototype.createRowCon = function (rowNode, animate, afterScroll) {
|
36921 | var rowCtrlFromCache = this.cachedRowCtrls ? this.cachedRowCtrls.getRow(rowNode) : null;
|
36922 | if (rowCtrlFromCache) {
|
36923 | return rowCtrlFromCache;
|
36924 | }
|
36925 |
|
36926 |
|
36927 |
|
36928 |
|
36929 |
|
36930 | var suppressAnimationFrame = this.gridOptionsWrapper.isSuppressAnimationFrame();
|
36931 | var useAnimationFrameForCreate = afterScroll && !suppressAnimationFrame && !this.printLayout;
|
36932 | var res = new RowCtrl(rowNode, this.beans, animate, useAnimationFrameForCreate, this.printLayout);
|
36933 | return res;
|
36934 | };
|
36935 | RowRenderer.prototype.getRenderedNodes = function () {
|
36936 | var renderedRows = this.rowCtrlsByRowIndex;
|
36937 | return Object.keys(renderedRows).map(function (key) { return renderedRows[key].getRowNode(); });
|
36938 | };
|
36939 | RowRenderer.prototype.getRowByPosition = function (rowPosition) {
|
36940 | var rowComponent;
|
36941 | switch (rowPosition.rowPinned) {
|
36942 | case Constants.PINNED_TOP:
|
36943 | rowComponent = this.topRowCtrls[rowPosition.rowIndex];
|
36944 | break;
|
36945 | case Constants.PINNED_BOTTOM:
|
36946 | rowComponent = this.bottomRowCtrls[rowPosition.rowIndex];
|
36947 | break;
|
36948 | default:
|
36949 | rowComponent = this.rowCtrlsByRowIndex[rowPosition.rowIndex];
|
36950 | break;
|
36951 | }
|
36952 | return rowComponent;
|
36953 | };
|
36954 | RowRenderer.prototype.getRowNode = function (gridRow) {
|
36955 | switch (gridRow.rowPinned) {
|
36956 | case Constants.PINNED_TOP:
|
36957 | return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];
|
36958 | case Constants.PINNED_BOTTOM:
|
36959 | return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];
|
36960 | default:
|
36961 | return this.rowModel.getRow(gridRow.rowIndex);
|
36962 | }
|
36963 | };
|
36964 |
|
36965 |
|
36966 | RowRenderer.prototype.isRangeInRenderedViewport = function (startIndex, endIndex) {
|
36967 |
|
36968 | var parentClosed = startIndex == null || endIndex == null;
|
36969 | if (parentClosed) {
|
36970 | return false;
|
36971 | }
|
36972 | var blockAfterViewport = startIndex > this.lastRenderedRow;
|
36973 | var blockBeforeViewport = endIndex < this.firstRenderedRow;
|
36974 | var blockInsideViewport = !blockBeforeViewport && !blockAfterViewport;
|
36975 | return blockInsideViewport;
|
36976 | };
|
36977 | __decorate$1v([
|
36978 | Autowired("paginationProxy")
|
36979 | ], RowRenderer.prototype, "paginationProxy", void 0);
|
36980 | __decorate$1v([
|
36981 | Autowired("columnModel")
|
36982 | ], RowRenderer.prototype, "columnModel", void 0);
|
36983 | __decorate$1v([
|
36984 | Autowired("pinnedRowModel")
|
36985 | ], RowRenderer.prototype, "pinnedRowModel", void 0);
|
36986 | __decorate$1v([
|
36987 | Autowired("rowModel")
|
36988 | ], RowRenderer.prototype, "rowModel", void 0);
|
36989 | __decorate$1v([
|
36990 | Autowired("focusService")
|
36991 | ], RowRenderer.prototype, "focusService", void 0);
|
36992 | __decorate$1v([
|
36993 | Autowired("columnApi")
|
36994 | ], RowRenderer.prototype, "columnApi", void 0);
|
36995 | __decorate$1v([
|
36996 | Autowired("gridApi")
|
36997 | ], RowRenderer.prototype, "gridApi", void 0);
|
36998 | __decorate$1v([
|
36999 | Autowired("beans")
|
37000 | ], RowRenderer.prototype, "beans", void 0);
|
37001 | __decorate$1v([
|
37002 | Autowired("rowContainerHeightService")
|
37003 | ], RowRenderer.prototype, "rowContainerHeightService", void 0);
|
37004 | __decorate$1v([
|
37005 | Optional("ctrlsService")
|
37006 | ], RowRenderer.prototype, "ctrlsService", void 0);
|
37007 | __decorate$1v([
|
37008 | PostConstruct
|
37009 | ], RowRenderer.prototype, "postConstruct", null);
|
37010 | RowRenderer = __decorate$1v([
|
37011 | Bean("rowRenderer")
|
37012 | ], RowRenderer);
|
37013 | return RowRenderer;
|
37014 | }(BeanStub));
|
37015 | var RowCtrlCache = (function () {
|
37016 | function RowCtrlCache(maxCount) {
|
37017 |
|
37018 | this.entriesMap = {};
|
37019 |
|
37020 | this.entriesList = [];
|
37021 | this.maxCount = maxCount;
|
37022 | }
|
37023 | RowCtrlCache.prototype.addRow = function (rowCtrl) {
|
37024 | this.entriesMap[rowCtrl.getRowNode().id] = rowCtrl;
|
37025 | this.entriesList.push(rowCtrl);
|
37026 | rowCtrl.setCached(true);
|
37027 | if (this.entriesList.length > this.maxCount) {
|
37028 | var rowCtrlToDestroy = this.entriesList[0];
|
37029 | rowCtrlToDestroy.destroyFirstPass();
|
37030 | rowCtrlToDestroy.destroySecondPass();
|
37031 | this.removeFromCache(rowCtrlToDestroy);
|
37032 | }
|
37033 | };
|
37034 | RowCtrlCache.prototype.getRow = function (rowNode) {
|
37035 | if (rowNode == null || rowNode.id == null) {
|
37036 | return null;
|
37037 | }
|
37038 | var res = this.entriesMap[rowNode.id];
|
37039 | if (!res) {
|
37040 | return null;
|
37041 | }
|
37042 | this.removeFromCache(res);
|
37043 | res.setCached(false);
|
37044 |
|
37045 |
|
37046 | var rowNodeMismatch = res.getRowNode() != rowNode;
|
37047 | return rowNodeMismatch ? null : res;
|
37048 | };
|
37049 | RowCtrlCache.prototype.removeFromCache = function (rowCtrl) {
|
37050 | var rowNodeId = rowCtrl.getRowNode().id;
|
37051 | delete this.entriesMap[rowNodeId];
|
37052 | removeFromArray(this.entriesList, rowCtrl);
|
37053 | };
|
37054 | RowCtrlCache.prototype.getEntries = function () {
|
37055 | return this.entriesList;
|
37056 | };
|
37057 | return RowCtrlCache;
|
37058 | }());
|
37059 |
|
37060 |
|
37061 |
|
37062 |
|
37063 |
|
37064 |
|
37065 |
|
37066 | var __extends$1J = (undefined && undefined.__extends) || (function () {
|
37067 | var extendStatics = function (d, b) {
|
37068 | extendStatics = Object.setPrototypeOf ||
|
37069 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
37070 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
37071 | return extendStatics(d, b);
|
37072 | };
|
37073 | return function (d, b) {
|
37074 | extendStatics(d, b);
|
37075 | function __() { this.constructor = d; }
|
37076 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
37077 | };
|
37078 | })();
|
37079 | var __decorate$1w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
37080 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
37081 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
37082 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
37083 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
37084 | };
|
37085 | var ValueFormatterService = (function (_super) {
|
37086 | __extends$1J(ValueFormatterService, _super);
|
37087 | function ValueFormatterService() {
|
37088 | return _super !== null && _super.apply(this, arguments) || this;
|
37089 | }
|
37090 | ValueFormatterService.prototype.formatValue = function (column, node, value, suppliedFormatter, useFormatterFromColumn) {
|
37091 | if (useFormatterFromColumn === void 0) { useFormatterFromColumn = true; }
|
37092 | var result = null;
|
37093 | var formatter;
|
37094 | var colDef = column.getColDef();
|
37095 | if (suppliedFormatter) {
|
37096 |
|
37097 | formatter = suppliedFormatter;
|
37098 | }
|
37099 | else if (useFormatterFromColumn) {
|
37100 |
|
37101 | formatter = node && node.rowPinned && colDef.pinnedRowValueFormatter ?
|
37102 | colDef.pinnedRowValueFormatter : colDef.valueFormatter;
|
37103 | }
|
37104 | if (formatter) {
|
37105 | var params = {
|
37106 | value: value,
|
37107 | node: node,
|
37108 | data: node ? node.data : null,
|
37109 | colDef: colDef,
|
37110 | column: column,
|
37111 | api: this.gridOptionsWrapper.getApi(),
|
37112 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
37113 | context: this.gridOptionsWrapper.getContext()
|
37114 | };
|
37115 | result = this.expressionService.evaluate(formatter, params);
|
37116 | }
|
37117 | else if (colDef.refData) {
|
37118 | return colDef.refData[value] || '';
|
37119 | }
|
37120 |
|
37121 | if (result == null && Array.isArray(value)) {
|
37122 | result = value.join(', ');
|
37123 | }
|
37124 | return result;
|
37125 | };
|
37126 | __decorate$1w([
|
37127 | Autowired('expressionService')
|
37128 | ], ValueFormatterService.prototype, "expressionService", void 0);
|
37129 | ValueFormatterService = __decorate$1w([
|
37130 | Bean('valueFormatterService')
|
37131 | ], ValueFormatterService);
|
37132 | return ValueFormatterService;
|
37133 | }(BeanStub));
|
37134 |
|
37135 |
|
37136 |
|
37137 |
|
37138 |
|
37139 |
|
37140 |
|
37141 | var __extends$1K = (undefined && undefined.__extends) || (function () {
|
37142 | var extendStatics = function (d, b) {
|
37143 | extendStatics = Object.setPrototypeOf ||
|
37144 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
37145 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
37146 | return extendStatics(d, b);
|
37147 | };
|
37148 | return function (d, b) {
|
37149 | extendStatics(d, b);
|
37150 | function __() { this.constructor = d; }
|
37151 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
37152 | };
|
37153 | })();
|
37154 | var __decorate$1x = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
37155 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
37156 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
37157 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
37158 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
37159 | };
|
37160 | var PinnedRowModel = (function (_super) {
|
37161 | __extends$1K(PinnedRowModel, _super);
|
37162 | function PinnedRowModel() {
|
37163 | return _super !== null && _super.apply(this, arguments) || this;
|
37164 | }
|
37165 | PinnedRowModel.prototype.init = function () {
|
37166 | this.setPinnedTopRowData(this.gridOptionsWrapper.getPinnedTopRowData());
|
37167 | this.setPinnedBottomRowData(this.gridOptionsWrapper.getPinnedBottomRowData());
|
37168 | };
|
37169 | PinnedRowModel.prototype.isEmpty = function (floating) {
|
37170 | var rows = floating === Constants.PINNED_TOP ? this.pinnedTopRows : this.pinnedBottomRows;
|
37171 | return missingOrEmpty(rows);
|
37172 | };
|
37173 | PinnedRowModel.prototype.isRowsToRender = function (floating) {
|
37174 | return !this.isEmpty(floating);
|
37175 | };
|
37176 | PinnedRowModel.prototype.getRowAtPixel = function (pixel, floating) {
|
37177 | var rows = floating === Constants.PINNED_TOP ? this.pinnedTopRows : this.pinnedBottomRows;
|
37178 | if (missingOrEmpty(rows)) {
|
37179 | return 0;
|
37180 | }
|
37181 | for (var i = 0; i < rows.length; i++) {
|
37182 | var rowNode = rows[i];
|
37183 | var rowTopPixel = rowNode.rowTop + rowNode.rowHeight - 1;
|
37184 |
|
37185 |
|
37186 | if (rowTopPixel >= pixel) {
|
37187 | return i;
|
37188 | }
|
37189 | }
|
37190 | return rows.length - 1;
|
37191 | };
|
37192 | PinnedRowModel.prototype.setPinnedTopRowData = function (rowData) {
|
37193 | this.pinnedTopRows = this.createNodesFromData(rowData, true);
|
37194 | var event = {
|
37195 | type: Events.EVENT_PINNED_ROW_DATA_CHANGED,
|
37196 | api: this.gridApi,
|
37197 | columnApi: this.columnApi
|
37198 | };
|
37199 | this.eventService.dispatchEvent(event);
|
37200 | };
|
37201 | PinnedRowModel.prototype.setPinnedBottomRowData = function (rowData) {
|
37202 | this.pinnedBottomRows = this.createNodesFromData(rowData, false);
|
37203 | var event = {
|
37204 | type: Events.EVENT_PINNED_ROW_DATA_CHANGED,
|
37205 | api: this.gridApi,
|
37206 | columnApi: this.columnApi
|
37207 | };
|
37208 | this.eventService.dispatchEvent(event);
|
37209 | };
|
37210 | PinnedRowModel.prototype.createNodesFromData = function (allData, isTop) {
|
37211 | var _this = this;
|
37212 | var rowNodes = [];
|
37213 | if (allData) {
|
37214 | var nextRowTop_1 = 0;
|
37215 | allData.forEach(function (dataItem, index) {
|
37216 | var rowNode = new RowNode(_this.beans);
|
37217 | rowNode.data = dataItem;
|
37218 | var idPrefix = isTop ? RowNode.ID_PREFIX_TOP_PINNED : RowNode.ID_PREFIX_BOTTOM_PINNED;
|
37219 | rowNode.id = idPrefix + index;
|
37220 | rowNode.rowPinned = isTop ? Constants.PINNED_TOP : Constants.PINNED_BOTTOM;
|
37221 | rowNode.setRowTop(nextRowTop_1);
|
37222 | rowNode.setRowHeight(_this.gridOptionsWrapper.getRowHeightForNode(rowNode).height);
|
37223 | rowNode.setRowIndex(index);
|
37224 | nextRowTop_1 += rowNode.rowHeight;
|
37225 | rowNodes.push(rowNode);
|
37226 | });
|
37227 | }
|
37228 | return rowNodes;
|
37229 | };
|
37230 | PinnedRowModel.prototype.getPinnedTopRowData = function () {
|
37231 | return this.pinnedTopRows;
|
37232 | };
|
37233 | PinnedRowModel.prototype.getPinnedBottomRowData = function () {
|
37234 | return this.pinnedBottomRows;
|
37235 | };
|
37236 | PinnedRowModel.prototype.getPinnedTopTotalHeight = function () {
|
37237 | return this.getTotalHeight(this.pinnedTopRows);
|
37238 | };
|
37239 | PinnedRowModel.prototype.getPinnedTopRowCount = function () {
|
37240 | return this.pinnedTopRows ? this.pinnedTopRows.length : 0;
|
37241 | };
|
37242 | PinnedRowModel.prototype.getPinnedBottomRowCount = function () {
|
37243 | return this.pinnedBottomRows ? this.pinnedBottomRows.length : 0;
|
37244 | };
|
37245 | PinnedRowModel.prototype.getPinnedTopRow = function (index) {
|
37246 | return this.pinnedTopRows[index];
|
37247 | };
|
37248 | PinnedRowModel.prototype.getPinnedBottomRow = function (index) {
|
37249 | return this.pinnedBottomRows[index];
|
37250 | };
|
37251 | PinnedRowModel.prototype.forEachPinnedTopRow = function (callback) {
|
37252 | if (missingOrEmpty(this.pinnedTopRows)) {
|
37253 | return;
|
37254 | }
|
37255 | this.pinnedTopRows.forEach(callback);
|
37256 | };
|
37257 | PinnedRowModel.prototype.forEachPinnedBottomRow = function (callback) {
|
37258 | if (missingOrEmpty(this.pinnedBottomRows)) {
|
37259 | return;
|
37260 | }
|
37261 | this.pinnedBottomRows.forEach(callback);
|
37262 | };
|
37263 | PinnedRowModel.prototype.getPinnedBottomTotalHeight = function () {
|
37264 | return this.getTotalHeight(this.pinnedBottomRows);
|
37265 | };
|
37266 | PinnedRowModel.prototype.getTotalHeight = function (rowNodes) {
|
37267 | if (!rowNodes || rowNodes.length === 0) {
|
37268 | return 0;
|
37269 | }
|
37270 | var lastNode = last(rowNodes);
|
37271 | return lastNode.rowTop + lastNode.rowHeight;
|
37272 | };
|
37273 | __decorate$1x([
|
37274 | Autowired('columnApi')
|
37275 | ], PinnedRowModel.prototype, "columnApi", void 0);
|
37276 | __decorate$1x([
|
37277 | Autowired('gridApi')
|
37278 | ], PinnedRowModel.prototype, "gridApi", void 0);
|
37279 | __decorate$1x([
|
37280 | Autowired('beans')
|
37281 | ], PinnedRowModel.prototype, "beans", void 0);
|
37282 | __decorate$1x([
|
37283 | PostConstruct
|
37284 | ], PinnedRowModel.prototype, "init", null);
|
37285 | PinnedRowModel = __decorate$1x([
|
37286 | Bean('pinnedRowModel')
|
37287 | ], PinnedRowModel);
|
37288 | return PinnedRowModel;
|
37289 | }(BeanStub));
|
37290 |
|
37291 |
|
37292 |
|
37293 |
|
37294 |
|
37295 |
|
37296 |
|
37297 | var ServerSideTransactionResultStatus;
|
37298 | (function (ServerSideTransactionResultStatus) {
|
37299 |
|
37300 | ServerSideTransactionResultStatus["Applied"] = "Applied";
|
37301 | |
37302 |
|
37303 |
|
37304 |
|
37305 | ServerSideTransactionResultStatus["StoreNotFound"] = "StoreNotFound";
|
37306 | |
37307 |
|
37308 |
|
37309 | ServerSideTransactionResultStatus["StoreLoading"] = "StoreLoading";
|
37310 | |
37311 |
|
37312 |
|
37313 | ServerSideTransactionResultStatus["StoreWaitingToLoad"] = "StoreWaitingToLoad";
|
37314 | |
37315 |
|
37316 |
|
37317 | ServerSideTransactionResultStatus["StoreLoadingFailed"] = "StoreLoadingFailed";
|
37318 | |
37319 |
|
37320 |
|
37321 | ServerSideTransactionResultStatus["StoreWrongType"] = "StoreWrongType";
|
37322 | |
37323 |
|
37324 |
|
37325 |
|
37326 | ServerSideTransactionResultStatus["Cancelled"] = "Cancelled";
|
37327 | })(ServerSideTransactionResultStatus || (ServerSideTransactionResultStatus = {}));
|
37328 |
|
37329 |
|
37330 |
|
37331 |
|
37332 |
|
37333 |
|
37334 |
|
37335 |
|
37336 |
|
37337 |
|
37338 |
|
37339 |
|
37340 |
|
37341 | var ChangedPath = (function () {
|
37342 | function ChangedPath(keepingColumns, rootNode) {
|
37343 |
|
37344 |
|
37345 |
|
37346 |
|
37347 |
|
37348 |
|
37349 | this.active = true;
|
37350 |
|
37351 |
|
37352 | this.nodeIdsToColumns = {};
|
37353 |
|
37354 | this.mapToItems = {};
|
37355 | this.keepingColumns = keepingColumns;
|
37356 | this.pathRoot = {
|
37357 | rowNode: rootNode,
|
37358 | children: null
|
37359 | };
|
37360 | this.mapToItems[rootNode.id] = this.pathRoot;
|
37361 | }
|
37362 |
|
37363 |
|
37364 |
|
37365 | ChangedPath.prototype.setInactive = function () {
|
37366 | this.active = false;
|
37367 | };
|
37368 | ChangedPath.prototype.isActive = function () {
|
37369 | return this.active;
|
37370 | };
|
37371 | ChangedPath.prototype.depthFirstSearchChangedPath = function (pathItem, callback) {
|
37372 | if (pathItem.children) {
|
37373 | for (var i = 0; i < pathItem.children.length; i++) {
|
37374 | this.depthFirstSearchChangedPath(pathItem.children[i], callback);
|
37375 | }
|
37376 | }
|
37377 | callback(pathItem.rowNode);
|
37378 | };
|
37379 | ChangedPath.prototype.depthFirstSearchEverything = function (rowNode, callback, traverseEverything) {
|
37380 | if (rowNode.childrenAfterGroup) {
|
37381 | for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) {
|
37382 | var childNode = rowNode.childrenAfterGroup[i];
|
37383 | if (childNode.childrenAfterGroup) {
|
37384 | this.depthFirstSearchEverything(rowNode.childrenAfterGroup[i], callback, traverseEverything);
|
37385 | }
|
37386 | else if (traverseEverything) {
|
37387 | callback(childNode);
|
37388 | }
|
37389 | }
|
37390 | }
|
37391 | callback(rowNode);
|
37392 | };
|
37393 |
|
37394 |
|
37395 | ChangedPath.prototype.forEachChangedNodeDepthFirst = function (callback, traverseLeafNodes) {
|
37396 | if (traverseLeafNodes === void 0) { traverseLeafNodes = false; }
|
37397 | if (this.active) {
|
37398 |
|
37399 |
|
37400 | this.depthFirstSearchChangedPath(this.pathRoot, callback);
|
37401 | }
|
37402 | else {
|
37403 |
|
37404 | this.depthFirstSearchEverything(this.pathRoot.rowNode, callback, traverseLeafNodes);
|
37405 | }
|
37406 | };
|
37407 | ChangedPath.prototype.executeFromRootNode = function (callback) {
|
37408 | callback(this.pathRoot.rowNode);
|
37409 | };
|
37410 | ChangedPath.prototype.createPathItems = function (rowNode) {
|
37411 | var pointer = rowNode;
|
37412 | var newEntryCount = 0;
|
37413 | while (!this.mapToItems[pointer.id]) {
|
37414 | var newEntry = {
|
37415 | rowNode: pointer,
|
37416 | children: null
|
37417 | };
|
37418 | this.mapToItems[pointer.id] = newEntry;
|
37419 | newEntryCount++;
|
37420 | pointer = pointer.parent;
|
37421 | }
|
37422 | return newEntryCount;
|
37423 | };
|
37424 | ChangedPath.prototype.populateColumnsMap = function (rowNode, columns) {
|
37425 | var _this = this;
|
37426 | if (!this.keepingColumns || !columns) {
|
37427 | return;
|
37428 | }
|
37429 | var pointer = rowNode;
|
37430 | while (pointer) {
|
37431 |
|
37432 |
|
37433 | if (!this.nodeIdsToColumns[pointer.id]) {
|
37434 | this.nodeIdsToColumns[pointer.id] = {};
|
37435 | }
|
37436 | columns.forEach(function (col) { return _this.nodeIdsToColumns[pointer.id][col.getId()] = true; });
|
37437 | pointer = pointer.parent;
|
37438 | }
|
37439 | };
|
37440 | ChangedPath.prototype.linkPathItems = function (rowNode, newEntryCount) {
|
37441 | var pointer = rowNode;
|
37442 | for (var i = 0; i < newEntryCount; i++) {
|
37443 | var thisItem = this.mapToItems[pointer.id];
|
37444 | var parentItem = this.mapToItems[pointer.parent.id];
|
37445 | if (!parentItem.children) {
|
37446 | parentItem.children = [];
|
37447 | }
|
37448 | parentItem.children.push(thisItem);
|
37449 | pointer = pointer.parent;
|
37450 | }
|
37451 | };
|
37452 |
|
37453 |
|
37454 |
|
37455 | ChangedPath.prototype.addParentNode = function (rowNode, columns) {
|
37456 | if (!rowNode || rowNode.isRowPinned()) {
|
37457 | return;
|
37458 | }
|
37459 |
|
37460 |
|
37461 |
|
37462 |
|
37463 |
|
37464 | var newEntryCount = this.createPathItems(rowNode);
|
37465 |
|
37466 | this.linkPathItems(rowNode, newEntryCount);
|
37467 |
|
37468 | this.populateColumnsMap(rowNode, columns);
|
37469 | };
|
37470 | ChangedPath.prototype.canSkip = function (rowNode) {
|
37471 | return this.active && !this.mapToItems[rowNode.id];
|
37472 | };
|
37473 | ChangedPath.prototype.getValueColumnsForNode = function (rowNode, valueColumns) {
|
37474 | if (!this.keepingColumns) {
|
37475 | return valueColumns;
|
37476 | }
|
37477 | var colsForThisNode = this.nodeIdsToColumns[rowNode.id];
|
37478 | var result = valueColumns.filter(function (col) { return colsForThisNode[col.getId()]; });
|
37479 | return result;
|
37480 | };
|
37481 | ChangedPath.prototype.getNotValueColumnsForNode = function (rowNode, valueColumns) {
|
37482 | if (!this.keepingColumns) {
|
37483 | return null;
|
37484 | }
|
37485 | var colsForThisNode = this.nodeIdsToColumns[rowNode.id];
|
37486 | var result = valueColumns.filter(function (col) { return !colsForThisNode[col.getId()]; });
|
37487 | return result;
|
37488 | };
|
37489 | return ChangedPath;
|
37490 | }());
|
37491 |
|
37492 |
|
37493 |
|
37494 |
|
37495 |
|
37496 |
|
37497 |
|
37498 | var __extends$1L = (undefined && undefined.__extends) || (function () {
|
37499 | var extendStatics = function (d, b) {
|
37500 | extendStatics = Object.setPrototypeOf ||
|
37501 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
37502 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
37503 | return extendStatics(d, b);
|
37504 | };
|
37505 | return function (d, b) {
|
37506 | extendStatics(d, b);
|
37507 | function __() { this.constructor = d; }
|
37508 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
37509 | };
|
37510 | })();
|
37511 | var RowNodeBlock = (function (_super) {
|
37512 | __extends$1L(RowNodeBlock, _super);
|
37513 | function RowNodeBlock(id) {
|
37514 | var _this = _super.call(this) || this;
|
37515 | _this.state = RowNodeBlock.STATE_WAITING_TO_LOAD;
|
37516 | _this.version = 0;
|
37517 | _this.id = id;
|
37518 | return _this;
|
37519 | }
|
37520 | RowNodeBlock.prototype.getId = function () {
|
37521 | return this.id;
|
37522 | };
|
37523 | RowNodeBlock.prototype.load = function () {
|
37524 | this.state = RowNodeBlock.STATE_LOADING;
|
37525 | this.loadFromDatasource();
|
37526 | };
|
37527 | RowNodeBlock.prototype.getVersion = function () {
|
37528 | return this.version;
|
37529 | };
|
37530 | RowNodeBlock.prototype.setStateWaitingToLoad = function () {
|
37531 |
|
37532 | this.version++;
|
37533 | this.state = RowNodeBlock.STATE_WAITING_TO_LOAD;
|
37534 | };
|
37535 | RowNodeBlock.prototype.getState = function () {
|
37536 | return this.state;
|
37537 | };
|
37538 | RowNodeBlock.prototype.pageLoadFailed = function (version) {
|
37539 | var requestMostRecentAndLive = this.isRequestMostRecentAndLive(version);
|
37540 | if (requestMostRecentAndLive) {
|
37541 | this.state = RowNodeBlock.STATE_FAILED;
|
37542 | this.processServerFail();
|
37543 | }
|
37544 | this.dispatchLoadCompleted(false);
|
37545 | };
|
37546 | RowNodeBlock.prototype.success = function (version, params) {
|
37547 | this.successCommon(version, params);
|
37548 | };
|
37549 | RowNodeBlock.prototype.pageLoaded = function (version, rows, lastRow) {
|
37550 | this.successCommon(version, { rowData: rows, rowCount: lastRow });
|
37551 | };
|
37552 | RowNodeBlock.prototype.isRequestMostRecentAndLive = function (version) {
|
37553 |
|
37554 |
|
37555 | var thisIsMostRecentRequest = version === this.version;
|
37556 |
|
37557 |
|
37558 | var weAreNotDestroyed = this.isAlive();
|
37559 | return thisIsMostRecentRequest && weAreNotDestroyed;
|
37560 | };
|
37561 | RowNodeBlock.prototype.successCommon = function (version, params) {
|
37562 |
|
37563 |
|
37564 |
|
37565 | this.dispatchLoadCompleted();
|
37566 | var requestMostRecentAndLive = this.isRequestMostRecentAndLive(version);
|
37567 | if (requestMostRecentAndLive) {
|
37568 | this.state = RowNodeBlock.STATE_LOADED;
|
37569 | this.processServerResult(params);
|
37570 | }
|
37571 | };
|
37572 | RowNodeBlock.prototype.dispatchLoadCompleted = function (success) {
|
37573 | if (success === void 0) { success = true; }
|
37574 |
|
37575 |
|
37576 | var event = {
|
37577 | type: RowNodeBlock.EVENT_LOAD_COMPLETE,
|
37578 | success: success,
|
37579 | block: this
|
37580 | };
|
37581 | this.dispatchEvent(event);
|
37582 | };
|
37583 | RowNodeBlock.EVENT_LOAD_COMPLETE = 'loadComplete';
|
37584 | RowNodeBlock.STATE_WAITING_TO_LOAD = 'needsLoading';
|
37585 | RowNodeBlock.STATE_LOADING = 'loading';
|
37586 | RowNodeBlock.STATE_LOADED = 'loaded';
|
37587 | RowNodeBlock.STATE_FAILED = 'failed';
|
37588 | return RowNodeBlock;
|
37589 | }(BeanStub));
|
37590 |
|
37591 |
|
37592 |
|
37593 |
|
37594 |
|
37595 |
|
37596 |
|
37597 | var __extends$1M = (undefined && undefined.__extends) || (function () {
|
37598 | var extendStatics = function (d, b) {
|
37599 | extendStatics = Object.setPrototypeOf ||
|
37600 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
37601 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
37602 | return extendStatics(d, b);
|
37603 | };
|
37604 | return function (d, b) {
|
37605 | extendStatics(d, b);
|
37606 | function __() { this.constructor = d; }
|
37607 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
37608 | };
|
37609 | })();
|
37610 | var __decorate$1y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
37611 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
37612 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
37613 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
37614 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
37615 | };
|
37616 | var __param$4 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
37617 | return function (target, key) { decorator(target, key, paramIndex); }
|
37618 | };
|
37619 | var RowNodeBlockLoader = (function (_super) {
|
37620 | __extends$1M(RowNodeBlockLoader, _super);
|
37621 | function RowNodeBlockLoader() {
|
37622 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
37623 | _this.activeBlockLoadsCount = 0;
|
37624 | _this.blocks = [];
|
37625 | _this.active = true;
|
37626 | return _this;
|
37627 | }
|
37628 | RowNodeBlockLoader_1 = RowNodeBlockLoader;
|
37629 | RowNodeBlockLoader.prototype.postConstruct = function () {
|
37630 | this.maxConcurrentRequests = this.gridOptionsWrapper.getMaxConcurrentDatasourceRequests();
|
37631 | var blockLoadDebounceMillis = this.gridOptionsWrapper.getBlockLoadDebounceMillis();
|
37632 | if (blockLoadDebounceMillis && blockLoadDebounceMillis > 0) {
|
37633 | this.checkBlockToLoadDebounce = _.debounce(this.performCheckBlocksToLoad.bind(this), blockLoadDebounceMillis);
|
37634 | }
|
37635 | };
|
37636 | RowNodeBlockLoader.prototype.setBeans = function (loggerFactory) {
|
37637 | this.logger = loggerFactory.create('RowNodeBlockLoader');
|
37638 | };
|
37639 | RowNodeBlockLoader.prototype.addBlock = function (block) {
|
37640 | this.blocks.push(block);
|
37641 |
|
37642 |
|
37643 |
|
37644 | block.addEventListener(RowNodeBlock.EVENT_LOAD_COMPLETE, this.loadComplete.bind(this));
|
37645 | this.checkBlockToLoad();
|
37646 | };
|
37647 | RowNodeBlockLoader.prototype.removeBlock = function (block) {
|
37648 | _.removeFromArray(this.blocks, block);
|
37649 | };
|
37650 | RowNodeBlockLoader.prototype.destroy = function () {
|
37651 | _super.prototype.destroy.call(this);
|
37652 | this.active = false;
|
37653 | };
|
37654 | RowNodeBlockLoader.prototype.loadComplete = function () {
|
37655 | this.activeBlockLoadsCount--;
|
37656 | this.checkBlockToLoad();
|
37657 | if (this.activeBlockLoadsCount == 0) {
|
37658 | this.dispatchEvent({ type: RowNodeBlockLoader_1.BLOCK_LOADER_FINISHED_EVENT });
|
37659 | }
|
37660 | };
|
37661 | RowNodeBlockLoader.prototype.checkBlockToLoad = function () {
|
37662 | if (this.checkBlockToLoadDebounce) {
|
37663 | this.checkBlockToLoadDebounce();
|
37664 | }
|
37665 | else {
|
37666 | this.performCheckBlocksToLoad();
|
37667 | }
|
37668 | };
|
37669 | RowNodeBlockLoader.prototype.performCheckBlocksToLoad = function () {
|
37670 | if (!this.active) {
|
37671 | return;
|
37672 | }
|
37673 | this.printCacheStatus();
|
37674 | if (this.maxConcurrentRequests != null && this.activeBlockLoadsCount >= this.maxConcurrentRequests) {
|
37675 | this.logger.log("checkBlockToLoad: max loads exceeded");
|
37676 | return;
|
37677 | }
|
37678 | var blockToLoad = null;
|
37679 | this.blocks.forEach(function (block) {
|
37680 | if (block.getState() === RowNodeBlock.STATE_WAITING_TO_LOAD) {
|
37681 | blockToLoad = block;
|
37682 | }
|
37683 | });
|
37684 | if (blockToLoad) {
|
37685 | blockToLoad.load();
|
37686 | this.activeBlockLoadsCount++;
|
37687 | this.printCacheStatus();
|
37688 | }
|
37689 | };
|
37690 | RowNodeBlockLoader.prototype.getBlockState = function () {
|
37691 | var result = {};
|
37692 | this.blocks.forEach(function (block) {
|
37693 | var _a = block.getBlockStateJson(), id = _a.id, state = _a.state;
|
37694 | result[id] = state;
|
37695 | });
|
37696 | return result;
|
37697 | };
|
37698 | RowNodeBlockLoader.prototype.printCacheStatus = function () {
|
37699 | if (this.logger.isLogging()) {
|
37700 | this.logger.log("printCacheStatus: activePageLoadsCount = " + this.activeBlockLoadsCount + ","
|
37701 | + (" blocks = " + JSON.stringify(this.getBlockState())));
|
37702 | }
|
37703 | };
|
37704 | RowNodeBlockLoader.prototype.isLoading = function () {
|
37705 | return this.activeBlockLoadsCount > 0;
|
37706 | };
|
37707 | var RowNodeBlockLoader_1;
|
37708 | RowNodeBlockLoader.BLOCK_LOADER_FINISHED_EVENT = 'blockLoaderFinished';
|
37709 | __decorate$1y([
|
37710 | PostConstruct
|
37711 | ], RowNodeBlockLoader.prototype, "postConstruct", null);
|
37712 | __decorate$1y([
|
37713 | __param$4(0, Qualifier('loggerFactory'))
|
37714 | ], RowNodeBlockLoader.prototype, "setBeans", null);
|
37715 | RowNodeBlockLoader = RowNodeBlockLoader_1 = __decorate$1y([
|
37716 | Bean('rowNodeBlockLoader')
|
37717 | ], RowNodeBlockLoader);
|
37718 | return RowNodeBlockLoader;
|
37719 | }(BeanStub));
|
37720 |
|
37721 |
|
37722 |
|
37723 |
|
37724 |
|
37725 |
|
37726 |
|
37727 | var __extends$1N = (undefined && undefined.__extends) || (function () {
|
37728 | var extendStatics = function (d, b) {
|
37729 | extendStatics = Object.setPrototypeOf ||
|
37730 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
37731 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
37732 | return extendStatics(d, b);
|
37733 | };
|
37734 | return function (d, b) {
|
37735 | extendStatics(d, b);
|
37736 | function __() { this.constructor = d; }
|
37737 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
37738 | };
|
37739 | })();
|
37740 | var __decorate$1z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
37741 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
37742 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
37743 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
37744 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
37745 | };
|
37746 | var PaginationProxy = (function (_super) {
|
37747 | __extends$1N(PaginationProxy, _super);
|
37748 | function PaginationProxy() {
|
37749 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
37750 | _this.currentPage = 0;
|
37751 | _this.topDisplayedRowIndex = 0;
|
37752 | _this.bottomDisplayedRowIndex = 0;
|
37753 | _this.pixelOffset = 0;
|
37754 | _this.masterRowCount = 0;
|
37755 | return _this;
|
37756 | }
|
37757 | PaginationProxy.prototype.postConstruct = function () {
|
37758 | this.active = this.gridOptionsWrapper.isPagination();
|
37759 | this.paginateChildRows = this.gridOptionsWrapper.isPaginateChildRows();
|
37760 | this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, this.onModelUpdated.bind(this));
|
37761 | this.addManagedListener(this.gridOptionsWrapper, 'paginationPageSize', this.onPaginationPageSizeChanged.bind(this));
|
37762 | this.onModelUpdated();
|
37763 | };
|
37764 | PaginationProxy.prototype.ensureRowHeightsValid = function (startPixel, endPixel, startLimitIndex, endLimitIndex) {
|
37765 | var res = this.rowModel.ensureRowHeightsValid(startPixel, endPixel, this.getPageFirstRow(), this.getPageLastRow());
|
37766 | if (res) {
|
37767 | this.calculatePages();
|
37768 | }
|
37769 | return res;
|
37770 | };
|
37771 | PaginationProxy.prototype.onModelUpdated = function (modelUpdatedEvent) {
|
37772 | this.calculatePages();
|
37773 | var paginationChangedEvent = {
|
37774 | type: Events.EVENT_PAGINATION_CHANGED,
|
37775 | animate: modelUpdatedEvent ? modelUpdatedEvent.animate : false,
|
37776 | newData: modelUpdatedEvent ? modelUpdatedEvent.newData : false,
|
37777 | newPage: modelUpdatedEvent ? modelUpdatedEvent.newPage : false,
|
37778 | keepRenderedRows: modelUpdatedEvent ? modelUpdatedEvent.keepRenderedRows : false,
|
37779 | api: this.gridApi,
|
37780 | columnApi: this.columnApi
|
37781 | };
|
37782 | this.eventService.dispatchEvent(paginationChangedEvent);
|
37783 | };
|
37784 | PaginationProxy.prototype.onPaginationPageSizeChanged = function () {
|
37785 | this.calculatePages();
|
37786 | var paginationChangedEvent = {
|
37787 | type: Events.EVENT_PAGINATION_CHANGED,
|
37788 | animate: false,
|
37789 | newData: false,
|
37790 | newPage: false,
|
37791 |
|
37792 |
|
37793 | keepRenderedRows: true,
|
37794 | api: this.gridApi,
|
37795 | columnApi: this.columnApi
|
37796 | };
|
37797 | this.eventService.dispatchEvent(paginationChangedEvent);
|
37798 | };
|
37799 | PaginationProxy.prototype.goToPage = function (page) {
|
37800 | if (!this.active || this.currentPage === page) {
|
37801 | return;
|
37802 | }
|
37803 | this.currentPage = page;
|
37804 | var event = {
|
37805 | type: Events.EVENT_MODEL_UPDATED,
|
37806 | animate: false,
|
37807 | keepRenderedRows: false,
|
37808 | newData: false,
|
37809 | newPage: true,
|
37810 | api: this.gridApi,
|
37811 | columnApi: this.columnApi
|
37812 | };
|
37813 | this.onModelUpdated(event);
|
37814 | };
|
37815 | PaginationProxy.prototype.getPixelOffset = function () {
|
37816 | return this.pixelOffset;
|
37817 | };
|
37818 | PaginationProxy.prototype.getRow = function (index) {
|
37819 | return this.rowModel.getRow(index);
|
37820 | };
|
37821 | PaginationProxy.prototype.getRowNode = function (id) {
|
37822 | return this.rowModel.getRowNode(id);
|
37823 | };
|
37824 | PaginationProxy.prototype.getRowIndexAtPixel = function (pixel) {
|
37825 | return this.rowModel.getRowIndexAtPixel(pixel);
|
37826 | };
|
37827 | PaginationProxy.prototype.getCurrentPageHeight = function () {
|
37828 | if (missing(this.topRowBounds) || missing(this.bottomRowBounds)) {
|
37829 | return 0;
|
37830 | }
|
37831 | return Math.max(this.bottomRowBounds.rowTop + this.bottomRowBounds.rowHeight - this.topRowBounds.rowTop, 0);
|
37832 | };
|
37833 | PaginationProxy.prototype.getCurrentPagePixelRange = function () {
|
37834 | var pageFirstPixel = this.topRowBounds ? this.topRowBounds.rowTop : 0;
|
37835 | var pageLastPixel = this.bottomRowBounds ? this.bottomRowBounds.rowTop + this.bottomRowBounds.rowHeight : 0;
|
37836 | return { pageFirstPixel: pageFirstPixel, pageLastPixel: pageLastPixel };
|
37837 | };
|
37838 | PaginationProxy.prototype.isRowPresent = function (rowNode) {
|
37839 | if (!this.rowModel.isRowPresent(rowNode)) {
|
37840 | return false;
|
37841 | }
|
37842 | var nodeIsInPage = rowNode.rowIndex >= this.topDisplayedRowIndex && rowNode.rowIndex <= this.bottomDisplayedRowIndex;
|
37843 | return nodeIsInPage;
|
37844 | };
|
37845 | PaginationProxy.prototype.isEmpty = function () {
|
37846 | return this.rowModel.isEmpty();
|
37847 | };
|
37848 | PaginationProxy.prototype.isRowsToRender = function () {
|
37849 | return this.rowModel.isRowsToRender();
|
37850 | };
|
37851 | PaginationProxy.prototype.getNodesInRangeForSelection = function (firstInRange, lastInRange) {
|
37852 | return this.rowModel.getNodesInRangeForSelection(firstInRange, lastInRange);
|
37853 | };
|
37854 | PaginationProxy.prototype.forEachNode = function (callback) {
|
37855 | return this.rowModel.forEachNode(callback);
|
37856 | };
|
37857 | PaginationProxy.prototype.getType = function () {
|
37858 | return this.rowModel.getType();
|
37859 | };
|
37860 | PaginationProxy.prototype.getRowBounds = function (index) {
|
37861 | var res = this.rowModel.getRowBounds(index);
|
37862 | res.rowIndex = index;
|
37863 | return res;
|
37864 | };
|
37865 | PaginationProxy.prototype.getPageFirstRow = function () {
|
37866 | return this.topRowBounds ? this.topRowBounds.rowIndex : -1;
|
37867 | };
|
37868 | PaginationProxy.prototype.getPageLastRow = function () {
|
37869 | return this.bottomRowBounds ? this.bottomRowBounds.rowIndex : -1;
|
37870 | };
|
37871 | PaginationProxy.prototype.getRowCount = function () {
|
37872 | return this.rowModel.getRowCount();
|
37873 | };
|
37874 | PaginationProxy.prototype.getPageForIndex = function (index) {
|
37875 | return Math.floor(index / this.pageSize);
|
37876 | };
|
37877 | PaginationProxy.prototype.goToPageWithIndex = function (index) {
|
37878 | if (!this.active) {
|
37879 | return;
|
37880 | }
|
37881 | var pageNumber = this.getPageForIndex(index);
|
37882 | this.goToPage(pageNumber);
|
37883 | };
|
37884 | PaginationProxy.prototype.isRowInPage = function (row) {
|
37885 | if (!this.active) {
|
37886 | return true;
|
37887 | }
|
37888 | var rowPage = this.getPageForIndex(row.rowIndex);
|
37889 | return rowPage === this.currentPage;
|
37890 | };
|
37891 | PaginationProxy.prototype.isLastPageFound = function () {
|
37892 | return this.rowModel.isLastRowIndexKnown();
|
37893 | };
|
37894 | PaginationProxy.prototype.getCurrentPage = function () {
|
37895 | return this.currentPage;
|
37896 | };
|
37897 | PaginationProxy.prototype.goToNextPage = function () {
|
37898 | this.goToPage(this.currentPage + 1);
|
37899 | };
|
37900 | PaginationProxy.prototype.goToPreviousPage = function () {
|
37901 | this.goToPage(this.currentPage - 1);
|
37902 | };
|
37903 | PaginationProxy.prototype.goToFirstPage = function () {
|
37904 | this.goToPage(0);
|
37905 | };
|
37906 | PaginationProxy.prototype.goToLastPage = function () {
|
37907 | var rowCount = this.rowModel.getRowCount();
|
37908 | var lastPage = Math.floor(rowCount / this.pageSize);
|
37909 | this.goToPage(lastPage);
|
37910 | };
|
37911 | PaginationProxy.prototype.getPageSize = function () {
|
37912 | return this.pageSize;
|
37913 | };
|
37914 | PaginationProxy.prototype.getTotalPages = function () {
|
37915 | return this.totalPages;
|
37916 | };
|
37917 | PaginationProxy.prototype.setPageSize = function () {
|
37918 |
|
37919 | this.pageSize = this.gridOptionsWrapper.getPaginationPageSize();
|
37920 | if (this.pageSize == null || this.pageSize < 1) {
|
37921 | this.pageSize = 100;
|
37922 | }
|
37923 | };
|
37924 | PaginationProxy.prototype.calculatePages = function () {
|
37925 | if (this.active) {
|
37926 | this.setPageSize();
|
37927 | if (this.paginateChildRows) {
|
37928 | this.calculatePagesAllRows();
|
37929 | }
|
37930 | else {
|
37931 | this.calculatePagesMasterRowsOnly();
|
37932 | }
|
37933 | }
|
37934 | else {
|
37935 | this.calculatedPagesNotActive();
|
37936 | }
|
37937 | this.topRowBounds = this.rowModel.getRowBounds(this.topDisplayedRowIndex);
|
37938 | if (this.topRowBounds) {
|
37939 | this.topRowBounds.rowIndex = this.topDisplayedRowIndex;
|
37940 | }
|
37941 | this.bottomRowBounds = this.rowModel.getRowBounds(this.bottomDisplayedRowIndex);
|
37942 | if (this.bottomRowBounds) {
|
37943 | this.bottomRowBounds.rowIndex = this.bottomDisplayedRowIndex;
|
37944 | }
|
37945 | this.setPixelOffset(exists(this.topRowBounds) ? this.topRowBounds.rowTop : 0);
|
37946 | };
|
37947 | PaginationProxy.prototype.setPixelOffset = function (value) {
|
37948 | if (this.pixelOffset === value) {
|
37949 | return;
|
37950 | }
|
37951 | this.pixelOffset = value;
|
37952 | this.eventService.dispatchEvent({ type: Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED });
|
37953 | };
|
37954 | PaginationProxy.prototype.setZeroRows = function () {
|
37955 | this.masterRowCount = 0;
|
37956 | this.topDisplayedRowIndex = 0;
|
37957 | this.bottomDisplayedRowIndex = -1;
|
37958 | this.currentPage = 0;
|
37959 | this.totalPages = 0;
|
37960 | };
|
37961 | PaginationProxy.prototype.calculatePagesMasterRowsOnly = function () {
|
37962 |
|
37963 |
|
37964 |
|
37965 | this.masterRowCount = this.rowModel.getTopLevelRowCount();
|
37966 |
|
37967 | if (this.masterRowCount <= 0) {
|
37968 | this.setZeroRows();
|
37969 | return;
|
37970 | }
|
37971 | var masterLastRowIndex = this.masterRowCount - 1;
|
37972 | this.totalPages = Math.floor((masterLastRowIndex) / this.pageSize) + 1;
|
37973 | if (this.currentPage >= this.totalPages) {
|
37974 | this.currentPage = this.totalPages - 1;
|
37975 | }
|
37976 | if (!isNumeric(this.currentPage) || this.currentPage < 0) {
|
37977 | this.currentPage = 0;
|
37978 | }
|
37979 | var masterPageStartIndex = this.pageSize * this.currentPage;
|
37980 | var masterPageEndIndex = (this.pageSize * (this.currentPage + 1)) - 1;
|
37981 | if (masterPageEndIndex > masterLastRowIndex) {
|
37982 | masterPageEndIndex = masterLastRowIndex;
|
37983 | }
|
37984 | this.topDisplayedRowIndex = this.rowModel.getTopLevelRowDisplayedIndex(masterPageStartIndex);
|
37985 |
|
37986 | if (masterPageEndIndex === masterLastRowIndex) {
|
37987 |
|
37988 | this.bottomDisplayedRowIndex = this.rowModel.getRowCount() - 1;
|
37989 | }
|
37990 | else {
|
37991 | var firstIndexNotToShow = this.rowModel.getTopLevelRowDisplayedIndex(masterPageEndIndex + 1);
|
37992 |
|
37993 |
|
37994 |
|
37995 | this.bottomDisplayedRowIndex = firstIndexNotToShow - 1;
|
37996 | }
|
37997 | };
|
37998 | PaginationProxy.prototype.getMasterRowCount = function () {
|
37999 | return this.masterRowCount;
|
38000 | };
|
38001 | PaginationProxy.prototype.calculatePagesAllRows = function () {
|
38002 | this.masterRowCount = this.rowModel.getRowCount();
|
38003 | if (this.masterRowCount === 0) {
|
38004 | this.setZeroRows();
|
38005 | return;
|
38006 | }
|
38007 | var maxRowIndex = this.masterRowCount - 1;
|
38008 | this.totalPages = Math.floor((maxRowIndex) / this.pageSize) + 1;
|
38009 | if (this.currentPage >= this.totalPages) {
|
38010 | this.currentPage = this.totalPages - 1;
|
38011 | }
|
38012 | if (!isNumeric(this.currentPage) || this.currentPage < 0) {
|
38013 | this.currentPage = 0;
|
38014 | }
|
38015 | this.topDisplayedRowIndex = this.pageSize * this.currentPage;
|
38016 | this.bottomDisplayedRowIndex = (this.pageSize * (this.currentPage + 1)) - 1;
|
38017 | if (this.bottomDisplayedRowIndex > maxRowIndex) {
|
38018 | this.bottomDisplayedRowIndex = maxRowIndex;
|
38019 | }
|
38020 | };
|
38021 | PaginationProxy.prototype.calculatedPagesNotActive = function () {
|
38022 | this.pageSize = this.rowModel.getRowCount();
|
38023 | this.totalPages = 1;
|
38024 | this.currentPage = 0;
|
38025 | this.topDisplayedRowIndex = 0;
|
38026 | this.bottomDisplayedRowIndex = this.rowModel.getRowCount() - 1;
|
38027 | };
|
38028 | __decorate$1z([
|
38029 | Autowired('rowModel')
|
38030 | ], PaginationProxy.prototype, "rowModel", void 0);
|
38031 | __decorate$1z([
|
38032 | Autowired('columnApi')
|
38033 | ], PaginationProxy.prototype, "columnApi", void 0);
|
38034 | __decorate$1z([
|
38035 | Autowired('gridApi')
|
38036 | ], PaginationProxy.prototype, "gridApi", void 0);
|
38037 | __decorate$1z([
|
38038 | PostConstruct
|
38039 | ], PaginationProxy.prototype, "postConstruct", null);
|
38040 | PaginationProxy = __decorate$1z([
|
38041 | Bean('paginationProxy')
|
38042 | ], PaginationProxy);
|
38043 | return PaginationProxy;
|
38044 | }(BeanStub));
|
38045 |
|
38046 |
|
38047 |
|
38048 |
|
38049 |
|
38050 |
|
38051 |
|
38052 | var __extends$1O = (undefined && undefined.__extends) || (function () {
|
38053 | var extendStatics = function (d, b) {
|
38054 | extendStatics = Object.setPrototypeOf ||
|
38055 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38056 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
38057 | return extendStatics(d, b);
|
38058 | };
|
38059 | return function (d, b) {
|
38060 | extendStatics(d, b);
|
38061 | function __() { this.constructor = d; }
|
38062 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38063 | };
|
38064 | })();
|
38065 | var __decorate$1A = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
38066 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
38067 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
38068 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
38069 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
38070 | };
|
38071 | var StylingService = (function (_super) {
|
38072 | __extends$1O(StylingService, _super);
|
38073 | function StylingService() {
|
38074 | return _super !== null && _super.apply(this, arguments) || this;
|
38075 | }
|
38076 | StylingService.prototype.processAllCellClasses = function (colDef, params, onApplicableClass, onNotApplicableClass) {
|
38077 | this.processClassRules(colDef.cellClassRules, params, onApplicableClass, onNotApplicableClass);
|
38078 | this.processStaticCellClasses(colDef, params, onApplicableClass);
|
38079 | };
|
38080 | StylingService.prototype.processClassRules = function (classRules, params, onApplicableClass, onNotApplicableClass) {
|
38081 | if (classRules == null) {
|
38082 | return;
|
38083 | }
|
38084 | var classNames = Object.keys(classRules);
|
38085 | var classesToApply = {};
|
38086 | var classesToRemove = {};
|
38087 | var _loop_1 = function (i) {
|
38088 | var className = classNames[i];
|
38089 | var rule = classRules[className];
|
38090 | var resultOfRule;
|
38091 | if (typeof rule === 'string') {
|
38092 | resultOfRule = this_1.expressionService.evaluate(rule, params);
|
38093 | }
|
38094 | else if (typeof rule === 'function') {
|
38095 | resultOfRule = rule(params);
|
38096 | }
|
38097 |
|
38098 | className.split(' ').forEach(function (singleClass) {
|
38099 | if (singleClass == null || singleClass.trim() == '') {
|
38100 | return;
|
38101 | }
|
38102 | resultOfRule ? classesToApply[singleClass] = true : classesToRemove[singleClass] = true;
|
38103 | });
|
38104 | };
|
38105 | var this_1 = this;
|
38106 | for (var i = 0; i < classNames.length; i++) {
|
38107 | _loop_1(i);
|
38108 | }
|
38109 |
|
38110 |
|
38111 |
|
38112 | if (onNotApplicableClass) {
|
38113 | Object.keys(classesToRemove).forEach(onNotApplicableClass);
|
38114 | }
|
38115 | Object.keys(classesToApply).forEach(onApplicableClass);
|
38116 | };
|
38117 | StylingService.prototype.getStaticCellClasses = function (colDef, params) {
|
38118 | var cellClass = colDef.cellClass;
|
38119 | if (!cellClass) {
|
38120 | return [];
|
38121 | }
|
38122 | var classOrClasses;
|
38123 | if (typeof cellClass === 'function') {
|
38124 | var cellClassFunc = cellClass;
|
38125 | classOrClasses = cellClassFunc(params);
|
38126 | }
|
38127 | else {
|
38128 | classOrClasses = cellClass;
|
38129 | }
|
38130 | if (typeof classOrClasses === 'string') {
|
38131 | classOrClasses = [classOrClasses];
|
38132 | }
|
38133 | return classOrClasses || [];
|
38134 | };
|
38135 | StylingService.prototype.processStaticCellClasses = function (colDef, params, onApplicableClass) {
|
38136 | var classOrClasses = this.getStaticCellClasses(colDef, params);
|
38137 | classOrClasses.forEach(function (cssClassItem) {
|
38138 | onApplicableClass(cssClassItem);
|
38139 | });
|
38140 | };
|
38141 | __decorate$1A([
|
38142 | Autowired('expressionService')
|
38143 | ], StylingService.prototype, "expressionService", void 0);
|
38144 | StylingService = __decorate$1A([
|
38145 | Bean('stylingService')
|
38146 | ], StylingService);
|
38147 | return StylingService;
|
38148 | }(BeanStub));
|
38149 |
|
38150 |
|
38151 |
|
38152 |
|
38153 |
|
38154 |
|
38155 |
|
38156 | var __extends$1P = (undefined && undefined.__extends) || (function () {
|
38157 | var extendStatics = function (d, b) {
|
38158 | extendStatics = Object.setPrototypeOf ||
|
38159 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38160 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
38161 | return extendStatics(d, b);
|
38162 | };
|
38163 | return function (d, b) {
|
38164 | extendStatics(d, b);
|
38165 | function __() { this.constructor = d; }
|
38166 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38167 | };
|
38168 | })();
|
38169 | var AgRadioButton = (function (_super) {
|
38170 | __extends$1P(AgRadioButton, _super);
|
38171 | function AgRadioButton(config) {
|
38172 | return _super.call(this, config, 'ag-radio-button', 'radio') || this;
|
38173 | }
|
38174 | AgRadioButton.prototype.isSelected = function () {
|
38175 | return this.eInput.checked;
|
38176 | };
|
38177 | AgRadioButton.prototype.toggle = function () {
|
38178 | if (this.eInput.disabled) {
|
38179 | return;
|
38180 | }
|
38181 |
|
38182 | if (!this.isSelected()) {
|
38183 | this.setValue(true);
|
38184 | }
|
38185 | };
|
38186 | AgRadioButton.prototype.addInputListeners = function () {
|
38187 | _super.prototype.addInputListeners.call(this);
|
38188 | this.addManagedListener(this.eventService, Events.EVENT_CHECKBOX_CHANGED, this.onChange.bind(this));
|
38189 | };
|
38190 | |
38191 |
|
38192 |
|
38193 |
|
38194 |
|
38195 |
|
38196 | AgRadioButton.prototype.onChange = function (event) {
|
38197 | if (event.selected &&
|
38198 | event.name &&
|
38199 | this.eInput.name &&
|
38200 | this.eInput.name === event.name &&
|
38201 | event.id &&
|
38202 | this.eInput.id !== event.id) {
|
38203 | this.setValue(false, true);
|
38204 | }
|
38205 | };
|
38206 | return AgRadioButton;
|
38207 | }(AgCheckbox));
|
38208 |
|
38209 |
|
38210 |
|
38211 |
|
38212 |
|
38213 |
|
38214 |
|
38215 | var __extends$1Q = (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 AgToggleButton = (function (_super) {
|
38229 | __extends$1Q(AgToggleButton, _super);
|
38230 | function AgToggleButton(config) {
|
38231 | return _super.call(this, config, 'ag-toggle-button') || this;
|
38232 | }
|
38233 | AgToggleButton.prototype.setValue = function (value, silent) {
|
38234 | _super.prototype.setValue.call(this, value, silent);
|
38235 | this.addOrRemoveCssClass('ag-selected', this.getValue());
|
38236 | return this;
|
38237 | };
|
38238 | return AgToggleButton;
|
38239 | }(AgCheckbox));
|
38240 |
|
38241 |
|
38242 |
|
38243 |
|
38244 |
|
38245 |
|
38246 |
|
38247 | var __extends$1R = (undefined && undefined.__extends) || (function () {
|
38248 | var extendStatics = function (d, b) {
|
38249 | extendStatics = Object.setPrototypeOf ||
|
38250 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38251 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
38252 | return extendStatics(d, b);
|
38253 | };
|
38254 | return function (d, b) {
|
38255 | extendStatics(d, b);
|
38256 | function __() { this.constructor = d; }
|
38257 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38258 | };
|
38259 | })();
|
38260 | var AgInputTextField = (function (_super) {
|
38261 | __extends$1R(AgInputTextField, _super);
|
38262 | function AgInputTextField(config, className, inputType) {
|
38263 | if (className === void 0) { className = 'ag-text-field'; }
|
38264 | if (inputType === void 0) { inputType = 'text'; }
|
38265 | return _super.call(this, config, className, inputType) || this;
|
38266 | }
|
38267 | AgInputTextField.prototype.postConstruct = function () {
|
38268 | _super.prototype.postConstruct.call(this);
|
38269 | if (this.config.allowedCharPattern) {
|
38270 | this.preventDisallowedCharacters();
|
38271 | }
|
38272 | };
|
38273 | AgInputTextField.prototype.setValue = function (value, silent) {
|
38274 | var ret = _super.prototype.setValue.call(this, value, silent);
|
38275 | if (this.eInput.value !== value) {
|
38276 | this.eInput.value = exists(value) ? value : '';
|
38277 | }
|
38278 | return ret;
|
38279 | };
|
38280 | AgInputTextField.prototype.preventDisallowedCharacters = function () {
|
38281 | var pattern = new RegExp("[" + this.config.allowedCharPattern + "]");
|
38282 | var preventDisallowedCharacters = function (event) {
|
38283 | if (event.key && !pattern.test(event.key)) {
|
38284 | event.preventDefault();
|
38285 | }
|
38286 | };
|
38287 | this.addManagedListener(this.eInput, 'keypress', preventDisallowedCharacters);
|
38288 | this.addManagedListener(this.eInput, 'paste', function (e) {
|
38289 | var _a;
|
38290 | var text = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text');
|
38291 | if (text && text.split('').some(function (c) { return !pattern.test(c); })) {
|
38292 | e.preventDefault();
|
38293 | }
|
38294 | });
|
38295 | };
|
38296 | return AgInputTextField;
|
38297 | }(AgAbstractInputField));
|
38298 |
|
38299 |
|
38300 |
|
38301 |
|
38302 |
|
38303 |
|
38304 |
|
38305 | var __extends$1S = (undefined && undefined.__extends) || (function () {
|
38306 | var extendStatics = function (d, b) {
|
38307 | extendStatics = Object.setPrototypeOf ||
|
38308 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38309 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
38310 | return extendStatics(d, b);
|
38311 | };
|
38312 | return function (d, b) {
|
38313 | extendStatics(d, b);
|
38314 | function __() { this.constructor = d; }
|
38315 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38316 | };
|
38317 | })();
|
38318 | var AgInputTextArea = (function (_super) {
|
38319 | __extends$1S(AgInputTextArea, _super);
|
38320 | function AgInputTextArea(config) {
|
38321 | return _super.call(this, config, 'ag-text-area', null, 'textarea') || this;
|
38322 | }
|
38323 | AgInputTextArea.prototype.setValue = function (value, silent) {
|
38324 | var ret = _super.prototype.setValue.call(this, value, silent);
|
38325 | this.eInput.value = value;
|
38326 | return ret;
|
38327 | };
|
38328 | AgInputTextArea.prototype.setCols = function (cols) {
|
38329 | this.eInput.cols = cols;
|
38330 | return this;
|
38331 | };
|
38332 | AgInputTextArea.prototype.setRows = function (rows) {
|
38333 | this.eInput.rows = rows;
|
38334 | return this;
|
38335 | };
|
38336 | return AgInputTextArea;
|
38337 | }(AgAbstractInputField));
|
38338 |
|
38339 |
|
38340 |
|
38341 |
|
38342 |
|
38343 |
|
38344 |
|
38345 | var __extends$1T = (undefined && undefined.__extends) || (function () {
|
38346 | var extendStatics = function (d, b) {
|
38347 | extendStatics = Object.setPrototypeOf ||
|
38348 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38349 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
38350 | return extendStatics(d, b);
|
38351 | };
|
38352 | return function (d, b) {
|
38353 | extendStatics(d, b);
|
38354 | function __() { this.constructor = d; }
|
38355 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38356 | };
|
38357 | })();
|
38358 | var AgInputNumberField = (function (_super) {
|
38359 | __extends$1T(AgInputNumberField, _super);
|
38360 | function AgInputNumberField(config) {
|
38361 | return _super.call(this, config, 'ag-number-field', 'number') || this;
|
38362 | }
|
38363 | AgInputNumberField.prototype.postConstruct = function () {
|
38364 | var _this = this;
|
38365 | _super.prototype.postConstruct.call(this);
|
38366 | this.addManagedListener(this.eInput, 'blur', function () {
|
38367 | var floatedValue = parseFloat(_this.eInput.value);
|
38368 | var value = isNaN(floatedValue) ? '' : _this.normalizeValue(floatedValue.toString());
|
38369 | if (_this.value !== value) {
|
38370 | _this.setValue(value);
|
38371 | }
|
38372 | });
|
38373 | this.eInput.step = 'any';
|
38374 | };
|
38375 | AgInputNumberField.prototype.normalizeValue = function (value) {
|
38376 | if (value === '') {
|
38377 | return '';
|
38378 | }
|
38379 | if (this.precision) {
|
38380 | value = this.adjustPrecision(value);
|
38381 | }
|
38382 | var val = parseFloat(value);
|
38383 | if (this.min != null && val < this.min) {
|
38384 | value = this.min.toString();
|
38385 | }
|
38386 | else if (this.max != null && val > this.max) {
|
38387 | value = this.max.toString();
|
38388 | }
|
38389 | return value;
|
38390 | };
|
38391 | AgInputNumberField.prototype.adjustPrecision = function (value) {
|
38392 | if (this.precision) {
|
38393 | var floatString = parseFloat(value).toFixed(this.precision);
|
38394 | value = parseFloat(floatString).toString();
|
38395 | }
|
38396 | return value;
|
38397 | };
|
38398 | AgInputNumberField.prototype.setMin = function (min) {
|
38399 | if (this.min === min) {
|
38400 | return this;
|
38401 | }
|
38402 | this.min = min;
|
38403 | addOrRemoveAttribute(this.eInput, 'min', min);
|
38404 | return this;
|
38405 | };
|
38406 | AgInputNumberField.prototype.setMax = function (max) {
|
38407 | if (this.max === max) {
|
38408 | return this;
|
38409 | }
|
38410 | this.max = max;
|
38411 | addOrRemoveAttribute(this.eInput, 'max', max);
|
38412 | return this;
|
38413 | };
|
38414 | AgInputNumberField.prototype.setPrecision = function (precision) {
|
38415 | this.precision = precision;
|
38416 | return this;
|
38417 | };
|
38418 | AgInputNumberField.prototype.setStep = function (step) {
|
38419 | if (this.step === step) {
|
38420 | return this;
|
38421 | }
|
38422 | this.step = step;
|
38423 | addOrRemoveAttribute(this.eInput, 'step', step);
|
38424 | return this;
|
38425 | };
|
38426 | AgInputNumberField.prototype.setValue = function (value, silent) {
|
38427 | value = this.adjustPrecision(value);
|
38428 | var normalizedValue = this.normalizeValue(value);
|
38429 | if (value != normalizedValue) {
|
38430 | return this;
|
38431 | }
|
38432 | return _super.prototype.setValue.call(this, value, silent);
|
38433 | };
|
38434 | return AgInputNumberField;
|
38435 | }(AgInputTextField));
|
38436 |
|
38437 |
|
38438 |
|
38439 |
|
38440 |
|
38441 |
|
38442 |
|
38443 | var __extends$1U = (undefined && undefined.__extends) || (function () {
|
38444 | var extendStatics = function (d, b) {
|
38445 | extendStatics = Object.setPrototypeOf ||
|
38446 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38447 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
38448 | return extendStatics(d, b);
|
38449 | };
|
38450 | return function (d, b) {
|
38451 | extendStatics(d, b);
|
38452 | function __() { this.constructor = d; }
|
38453 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38454 | };
|
38455 | })();
|
38456 | var AgInputRange = (function (_super) {
|
38457 | __extends$1U(AgInputRange, _super);
|
38458 | function AgInputRange(config) {
|
38459 | return _super.call(this, config, 'ag-range-field', 'range') || this;
|
38460 | }
|
38461 | AgInputRange.prototype.postConstruct = function () {
|
38462 | _super.prototype.postConstruct.call(this);
|
38463 | var _a = this.config, min = _a.min, max = _a.max, step = _a.step;
|
38464 | if (min != null) {
|
38465 | this.setMinValue(min);
|
38466 | }
|
38467 | if (max != null) {
|
38468 | this.setMaxValue(max);
|
38469 | }
|
38470 | this.setStep(step || 1);
|
38471 | };
|
38472 | AgInputRange.prototype.addInputListeners = function () {
|
38473 | var _this = this;
|
38474 | this.addManagedListener(this.eInput, 'input', function (e) {
|
38475 | var value = e.target.value;
|
38476 | _this.setValue(value);
|
38477 | });
|
38478 | };
|
38479 | AgInputRange.prototype.setMinValue = function (value) {
|
38480 | this.min = value;
|
38481 | this.eInput.setAttribute('min', value.toString());
|
38482 | return this;
|
38483 | };
|
38484 | AgInputRange.prototype.setMaxValue = function (value) {
|
38485 | this.max = value;
|
38486 | this.eInput.setAttribute('max', value.toString());
|
38487 | return this;
|
38488 | };
|
38489 | AgInputRange.prototype.setStep = function (value) {
|
38490 | this.eInput.setAttribute('step', value.toString());
|
38491 | return this;
|
38492 | };
|
38493 | AgInputRange.prototype.setValue = function (value, silent) {
|
38494 | if (this.min != null) {
|
38495 | value = Math.max(parseFloat(value), this.min).toString();
|
38496 | }
|
38497 | if (this.max != null) {
|
38498 | value = Math.min(parseFloat(value), this.max).toString();
|
38499 | }
|
38500 | var ret = _super.prototype.setValue.call(this, value, silent);
|
38501 | this.eInput.value = value;
|
38502 | return ret;
|
38503 | };
|
38504 | return AgInputRange;
|
38505 | }(AgAbstractInputField));
|
38506 |
|
38507 |
|
38508 |
|
38509 |
|
38510 |
|
38511 |
|
38512 |
|
38513 | var __extends$1V = (undefined && undefined.__extends) || (function () {
|
38514 | var extendStatics = function (d, b) {
|
38515 | extendStatics = Object.setPrototypeOf ||
|
38516 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38517 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
38518 | return extendStatics(d, b);
|
38519 | };
|
38520 | return function (d, b) {
|
38521 | extendStatics(d, b);
|
38522 | function __() { this.constructor = d; }
|
38523 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38524 | };
|
38525 | })();
|
38526 | var __decorate$1B = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
38527 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
38528 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
38529 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
38530 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
38531 | };
|
38532 | var AgSlider = (function (_super) {
|
38533 | __extends$1V(AgSlider, _super);
|
38534 | function AgSlider(config) {
|
38535 | var _this = _super.call(this, config, AgSlider.TEMPLATE) || this;
|
38536 | _this.labelAlignment = 'top';
|
38537 | return _this;
|
38538 | }
|
38539 | AgSlider.prototype.init = function () {
|
38540 | this.eSlider.addCssClass('ag-slider-field');
|
38541 | };
|
38542 | AgSlider.prototype.onValueChange = function (callbackFn) {
|
38543 | var _this = this;
|
38544 | var eventChanged = AgAbstractField.EVENT_CHANGED;
|
38545 | this.addManagedListener(this.eText, eventChanged, function () {
|
38546 | var textValue = parseFloat(_this.eText.getValue());
|
38547 | _this.eSlider.setValue(textValue.toString(), true);
|
38548 | callbackFn(textValue || 0);
|
38549 | });
|
38550 | this.addManagedListener(this.eSlider, eventChanged, function () {
|
38551 | var sliderValue = _this.eSlider.getValue();
|
38552 | _this.eText.setValue(sliderValue, true);
|
38553 | callbackFn(parseFloat(sliderValue));
|
38554 | });
|
38555 | return this;
|
38556 | };
|
38557 | AgSlider.prototype.setSliderWidth = function (width) {
|
38558 | this.eSlider.setWidth(width);
|
38559 | return this;
|
38560 | };
|
38561 | AgSlider.prototype.setTextFieldWidth = function (width) {
|
38562 | this.eText.setWidth(width);
|
38563 | return this;
|
38564 | };
|
38565 | AgSlider.prototype.setMinValue = function (minValue) {
|
38566 | this.eSlider.setMinValue(minValue);
|
38567 | this.eText.setMin(minValue);
|
38568 | return this;
|
38569 | };
|
38570 | AgSlider.prototype.setMaxValue = function (maxValue) {
|
38571 | this.eSlider.setMaxValue(maxValue);
|
38572 | this.eText.setMax(maxValue);
|
38573 | return this;
|
38574 | };
|
38575 | AgSlider.prototype.getValue = function () {
|
38576 | return this.eText.getValue();
|
38577 | };
|
38578 | AgSlider.prototype.setValue = function (value) {
|
38579 | if (this.getValue() === value) {
|
38580 | return this;
|
38581 | }
|
38582 | this.eText.setValue(value, true);
|
38583 | this.eSlider.setValue(value, true);
|
38584 | this.dispatchEvent({ type: AgAbstractField.EVENT_CHANGED });
|
38585 | return this;
|
38586 | };
|
38587 | AgSlider.prototype.setStep = function (step) {
|
38588 | this.eSlider.setStep(step);
|
38589 | this.eText.setStep(step);
|
38590 | return this;
|
38591 | };
|
38592 | 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>";
|
38593 | __decorate$1B([
|
38594 | RefSelector('eLabel')
|
38595 | ], AgSlider.prototype, "eLabel", void 0);
|
38596 | __decorate$1B([
|
38597 | RefSelector('eSlider')
|
38598 | ], AgSlider.prototype, "eSlider", void 0);
|
38599 | __decorate$1B([
|
38600 | RefSelector('eText')
|
38601 | ], AgSlider.prototype, "eText", void 0);
|
38602 | __decorate$1B([
|
38603 | PostConstruct
|
38604 | ], AgSlider.prototype, "init", null);
|
38605 | return AgSlider;
|
38606 | }(AgAbstractLabel));
|
38607 |
|
38608 |
|
38609 |
|
38610 |
|
38611 |
|
38612 |
|
38613 |
|
38614 | var __extends$1W = (undefined && undefined.__extends) || (function () {
|
38615 | var extendStatics = function (d, b) {
|
38616 | extendStatics = Object.setPrototypeOf ||
|
38617 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38618 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
38619 | return extendStatics(d, b);
|
38620 | };
|
38621 | return function (d, b) {
|
38622 | extendStatics(d, b);
|
38623 | function __() { this.constructor = d; }
|
38624 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38625 | };
|
38626 | })();
|
38627 | var __decorate$1C = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
38628 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
38629 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
38630 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
38631 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
38632 | };
|
38633 | var AgAngleSelect = (function (_super) {
|
38634 | __extends$1W(AgAngleSelect, _super);
|
38635 | function AgAngleSelect(config) {
|
38636 | var _this = _super.call(this, config, AgAngleSelect.TEMPLATE) || this;
|
38637 | _this.radius = 0;
|
38638 | _this.offsetX = 0;
|
38639 | _this.offsetY = 0;
|
38640 | return _this;
|
38641 | }
|
38642 | AgAngleSelect.prototype.postConstruct = function () {
|
38643 | var _this = this;
|
38644 | _super.prototype.postConstruct.call(this);
|
38645 | this.dragListener = {
|
38646 | eElement: this.eParentCircle,
|
38647 | dragStartPixels: 0,
|
38648 | onDragStart: function (e) {
|
38649 | _this.parentCircleRect = _this.eParentCircle.getBoundingClientRect();
|
38650 | },
|
38651 | onDragging: function (e) { return _this.calculateAngleDrag(e); },
|
38652 | onDragStop: function () { }
|
38653 | };
|
38654 | this.dragService.addDragSource(this.dragListener);
|
38655 | this.eAngleValue
|
38656 | .setLabel('')
|
38657 | .setLabelWidth(5)
|
38658 | .setInputWidth(45)
|
38659 | .setMin(0)
|
38660 | .setMax(360)
|
38661 | .setValue("" + this.degrees)
|
38662 | .onValueChange(function (value) {
|
38663 | if (value == null || value === '') {
|
38664 | value = '0';
|
38665 | }
|
38666 | value = _this.eAngleValue.normalizeValue(value);
|
38667 | var floatValue = parseFloat(value);
|
38668 | if (floatValue > 180) {
|
38669 | floatValue = floatValue - 360;
|
38670 | }
|
38671 | _this.setValue(floatValue);
|
38672 | });
|
38673 | this.updateNumberInput();
|
38674 | if (exists(this.getValue())) {
|
38675 | this.eAngleValue.setValue(this.normalizeNegativeValue(this.getValue()).toString());
|
38676 | }
|
38677 | this.addManagedListener(this, AgAbstractField.EVENT_CHANGED, function () {
|
38678 | var eDocument = _this.gridOptionsWrapper.getDocument();
|
38679 | if (_this.eAngleValue.getInputElement().contains(eDocument.activeElement)) {
|
38680 | return;
|
38681 | }
|
38682 | _this.updateNumberInput();
|
38683 | });
|
38684 | };
|
38685 | AgAngleSelect.prototype.updateNumberInput = function () {
|
38686 | var normalizedValue = this.normalizeNegativeValue(this.getValue());
|
38687 | this.eAngleValue.setValue(normalizedValue.toString());
|
38688 | };
|
38689 | AgAngleSelect.prototype.positionChildCircle = function (radians) {
|
38690 | var rect = this.parentCircleRect || { width: 24, height: 24 };
|
38691 | var eChildCircle = this.eChildCircle;
|
38692 | var centerX = rect.width / 2;
|
38693 | var centerY = rect.height / 2;
|
38694 | eChildCircle.style.left = centerX + Math.cos(radians) * 8 + "px";
|
38695 | eChildCircle.style.top = centerY + Math.sin(radians) * 8 + "px";
|
38696 | };
|
38697 | AgAngleSelect.prototype.calculatePolar = function () {
|
38698 | var x = this.offsetX;
|
38699 | var y = this.offsetY;
|
38700 | var radians = Math.atan2(y, x);
|
38701 | this.degrees = this.toDegrees(radians);
|
38702 | this.radius = Math.sqrt((x * x) + (y * y));
|
38703 | this.positionChildCircle(radians);
|
38704 | };
|
38705 | AgAngleSelect.prototype.calculateCartesian = function () {
|
38706 | var radians = this.toRadians(this.getValue());
|
38707 | var radius = this.getRadius();
|
38708 | this
|
38709 | .setOffsetX(Math.cos(radians) * radius)
|
38710 | .setOffsetY(Math.sin(radians) * radius);
|
38711 | };
|
38712 | AgAngleSelect.prototype.setOffsetX = function (offset) {
|
38713 | if (this.offsetX !== offset) {
|
38714 | this.offsetX = offset;
|
38715 | this.calculatePolar();
|
38716 | }
|
38717 | return this;
|
38718 | };
|
38719 | AgAngleSelect.prototype.setOffsetY = function (offset) {
|
38720 | if (this.offsetY !== offset) {
|
38721 | this.offsetY = offset;
|
38722 | this.calculatePolar();
|
38723 | }
|
38724 | return this;
|
38725 | };
|
38726 | AgAngleSelect.prototype.calculateAngleDrag = function (e) {
|
38727 | var rect = this.parentCircleRect;
|
38728 | var centerX = rect.width / 2;
|
38729 | var centerY = rect.height / 2;
|
38730 | var x = e.clientX - rect.left;
|
38731 | var y = e.clientY - rect.top;
|
38732 | var dx = x - centerX;
|
38733 | var dy = y - centerY;
|
38734 | var radians = Math.atan2(dy, dx);
|
38735 | this.setValue(radians, true);
|
38736 | };
|
38737 | AgAngleSelect.prototype.toDegrees = function (radians) {
|
38738 | return radians / Math.PI * 180;
|
38739 | };
|
38740 | AgAngleSelect.prototype.toRadians = function (degrees) {
|
38741 | return degrees / 180 * Math.PI;
|
38742 | };
|
38743 | AgAngleSelect.prototype.normalizeNegativeValue = function (degrees) {
|
38744 | return degrees < 0 ? 360 + degrees : degrees;
|
38745 | };
|
38746 | AgAngleSelect.prototype.normalizeAngle180 = function (radians) {
|
38747 | radians %= Math.PI * 2;
|
38748 | if (radians < -Math.PI) {
|
38749 | radians += Math.PI * 2;
|
38750 | }
|
38751 | else if (radians >= Math.PI) {
|
38752 | radians -= Math.PI * 2;
|
38753 | }
|
38754 | return radians;
|
38755 | };
|
38756 | AgAngleSelect.prototype.getRadius = function () {
|
38757 | return this.radius;
|
38758 | };
|
38759 | AgAngleSelect.prototype.setRadius = function (r) {
|
38760 | if (this.radius === r) {
|
38761 | return this;
|
38762 | }
|
38763 | this.radius = r;
|
38764 | this.calculateCartesian();
|
38765 | return this;
|
38766 | };
|
38767 | AgAngleSelect.prototype.onValueChange = function (callbackFn) {
|
38768 | var _this = this;
|
38769 | this.addManagedListener(this, AgAbstractField.EVENT_CHANGED, function () {
|
38770 | callbackFn(_this.degrees);
|
38771 | });
|
38772 | return this;
|
38773 | };
|
38774 | AgAngleSelect.prototype.getValue = function (radians) {
|
38775 | return radians ? this.toRadians(this.degrees) : this.degrees;
|
38776 | };
|
38777 | AgAngleSelect.prototype.setValue = function (degrees, radians) {
|
38778 | var radiansValue;
|
38779 | if (!radians) {
|
38780 | radiansValue = this.normalizeAngle180(this.toRadians(degrees));
|
38781 | }
|
38782 | else {
|
38783 | radiansValue = degrees;
|
38784 | }
|
38785 | degrees = this.toDegrees(radiansValue);
|
38786 | if (this.degrees !== degrees) {
|
38787 | this.degrees = Math.floor(degrees);
|
38788 | this.calculateCartesian();
|
38789 | this.positionChildCircle(radiansValue);
|
38790 | this.dispatchEvent({ type: AgAbstractField.EVENT_CHANGED });
|
38791 | }
|
38792 | return this;
|
38793 | };
|
38794 | AgAngleSelect.prototype.setWidth = function (width) {
|
38795 | setFixedWidth(this.getGui(), width);
|
38796 | return this;
|
38797 | };
|
38798 | AgAngleSelect.prototype.destroy = function () {
|
38799 | this.dragService.removeDragSource(this.dragListener);
|
38800 | _super.prototype.destroy.call(this);
|
38801 | };
|
38802 | 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>";
|
38803 | __decorate$1C([
|
38804 | RefSelector('eLabel')
|
38805 | ], AgAngleSelect.prototype, "eLabel", void 0);
|
38806 | __decorate$1C([
|
38807 | RefSelector('eParentCircle')
|
38808 | ], AgAngleSelect.prototype, "eParentCircle", void 0);
|
38809 | __decorate$1C([
|
38810 | RefSelector('eChildCircle')
|
38811 | ], AgAngleSelect.prototype, "eChildCircle", void 0);
|
38812 | __decorate$1C([
|
38813 | RefSelector('eAngleValue')
|
38814 | ], AgAngleSelect.prototype, "eAngleValue", void 0);
|
38815 | __decorate$1C([
|
38816 | Autowired('dragService')
|
38817 | ], AgAngleSelect.prototype, "dragService", void 0);
|
38818 | return AgAngleSelect;
|
38819 | }(AgAbstractLabel));
|
38820 |
|
38821 |
|
38822 |
|
38823 |
|
38824 |
|
38825 |
|
38826 |
|
38827 | var __extends$1X = (undefined && undefined.__extends) || (function () {
|
38828 | var extendStatics = function (d, b) {
|
38829 | extendStatics = Object.setPrototypeOf ||
|
38830 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38831 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
38832 | return extendStatics(d, b);
|
38833 | };
|
38834 | return function (d, b) {
|
38835 | extendStatics(d, b);
|
38836 | function __() { this.constructor = d; }
|
38837 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38838 | };
|
38839 | })();
|
38840 | var __decorate$1D = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
38841 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
38842 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
38843 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
38844 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
38845 | };
|
38846 | var __read$e = (undefined && undefined.__read) || function (o, n) {
|
38847 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
38848 | if (!m) return o;
|
38849 | var i = m.call(o), r, ar = [], e;
|
38850 | try {
|
38851 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
38852 | }
|
38853 | catch (error) { e = { error: error }; }
|
38854 | finally {
|
38855 | try {
|
38856 | if (r && !r.done && (m = i["return"])) m.call(i);
|
38857 | }
|
38858 | finally { if (e) throw e.error; }
|
38859 | }
|
38860 | return ar;
|
38861 | };
|
38862 | var AgColorPanel = (function (_super) {
|
38863 | __extends$1X(AgColorPanel, _super);
|
38864 | function AgColorPanel(config) {
|
38865 | var _this = _super.call(this, AgColorPanel.TEMPLATE) || this;
|
38866 | _this.H = 1;
|
38867 | _this.S = 1;
|
38868 | _this.B = 1;
|
38869 | _this.A = 1;
|
38870 | _this.isSpectrumDragging = false;
|
38871 | _this.isSpectrumHueDragging = false;
|
38872 | _this.isSpectrumAlphaDragging = false;
|
38873 | _this.colorChanged = false;
|
38874 | _this.picker = config.picker;
|
38875 | return _this;
|
38876 | }
|
38877 | AgColorPanel.prototype.postConstruct = function () {
|
38878 | var eGui = this.getGui();
|
38879 | this.initRecentColors();
|
38880 | this.addManagedListener(this.spectrumVal, 'mousedown', this.onSpectrumDraggerDown.bind(this));
|
38881 | this.addManagedListener(eGui, 'mousemove', this.onSpectrumDraggerMove.bind(this));
|
38882 | this.addManagedListener(this.spectrumHue, 'mousedown', this.onSpectrumHueDown.bind(this));
|
38883 | this.addManagedListener(eGui, 'mousemove', this.onSpectrumHueMove.bind(this));
|
38884 | this.addManagedListener(this.spectrumAlpha, 'mousedown', this.onSpectrumAlphaDown.bind(this));
|
38885 | this.addManagedListener(eGui, 'mousemove', this.onSpectrumAlphaMove.bind(this));
|
38886 |
|
38887 |
|
38888 |
|
38889 | this.addManagedListener(document, 'mouseup', this.onMouseUp.bind(this));
|
38890 | this.addManagedListener(this.recentColors, 'click', this.onRecentColorClick.bind(this));
|
38891 | };
|
38892 | AgColorPanel.prototype.refreshSpectrumRect = function () {
|
38893 | return this.spectrumValRect = this.spectrumVal.getBoundingClientRect();
|
38894 | };
|
38895 | AgColorPanel.prototype.refreshHueRect = function () {
|
38896 | return this.spectrumHueRect = this.spectrumHue.getBoundingClientRect();
|
38897 | };
|
38898 | AgColorPanel.prototype.refreshAlphaRect = function () {
|
38899 | return this.spectrumAlphaRect = this.spectrumAlpha.getBoundingClientRect();
|
38900 | };
|
38901 | AgColorPanel.prototype.onSpectrumDraggerDown = function (e) {
|
38902 | this.refreshSpectrumRect();
|
38903 | this.isSpectrumDragging = true;
|
38904 | this.moveDragger(e);
|
38905 | };
|
38906 | AgColorPanel.prototype.onSpectrumDraggerMove = function (e) {
|
38907 | if (this.isSpectrumDragging) {
|
38908 | this.moveDragger(e);
|
38909 | }
|
38910 | };
|
38911 | AgColorPanel.prototype.onSpectrumHueDown = function (e) {
|
38912 | this.refreshHueRect();
|
38913 | this.isSpectrumHueDragging = true;
|
38914 | this.moveHueSlider(e);
|
38915 | };
|
38916 | AgColorPanel.prototype.onSpectrumHueMove = function (e) {
|
38917 | if (this.isSpectrumHueDragging) {
|
38918 | this.moveHueSlider(e);
|
38919 | }
|
38920 | };
|
38921 | AgColorPanel.prototype.onSpectrumAlphaDown = function (e) {
|
38922 | this.refreshAlphaRect();
|
38923 | this.isSpectrumAlphaDragging = true;
|
38924 | this.moveAlphaSlider(e);
|
38925 | };
|
38926 | AgColorPanel.prototype.onSpectrumAlphaMove = function (e) {
|
38927 | if (this.isSpectrumAlphaDragging) {
|
38928 | this.moveAlphaSlider(e);
|
38929 | }
|
38930 | };
|
38931 | AgColorPanel.prototype.onMouseUp = function () {
|
38932 | this.isSpectrumDragging = false;
|
38933 | this.isSpectrumHueDragging = false;
|
38934 | this.isSpectrumAlphaDragging = false;
|
38935 | };
|
38936 | AgColorPanel.prototype.moveDragger = function (e) {
|
38937 | var valRect = this.spectrumValRect;
|
38938 | if (valRect) {
|
38939 | var x = e.clientX - valRect.left;
|
38940 | var y = e.clientY - valRect.top;
|
38941 | x = Math.max(x, 0);
|
38942 | x = Math.min(x, valRect.width);
|
38943 | y = Math.max(y, 0);
|
38944 | y = Math.min(y, valRect.height);
|
38945 | this.setSpectrumValue(x / valRect.width, 1 - y / valRect.height);
|
38946 | }
|
38947 | };
|
38948 | AgColorPanel.prototype.moveHueSlider = function (e) {
|
38949 | var hueRect = this.spectrumHueRect;
|
38950 | if (hueRect) {
|
38951 | var slider = this.spectrumHueSlider;
|
38952 | var sliderRect = slider.getBoundingClientRect();
|
38953 | var x = e.clientX - hueRect.left;
|
38954 | x = Math.max(x, 0);
|
38955 | x = Math.min(x, hueRect.width);
|
38956 | this.H = 1 - x / hueRect.width;
|
38957 | slider.style.left = (x + sliderRect.width / 2) + 'px';
|
38958 | this.update();
|
38959 | }
|
38960 | };
|
38961 | AgColorPanel.prototype.moveAlphaSlider = function (e) {
|
38962 | var alphaRect = this.spectrumAlphaRect;
|
38963 | if (alphaRect) {
|
38964 | var slider = this.spectrumAlphaSlider;
|
38965 | var sliderRect = slider.getBoundingClientRect();
|
38966 | var x = e.clientX - alphaRect.left;
|
38967 | x = Math.max(x, 0);
|
38968 | x = Math.min(x, alphaRect.width);
|
38969 | this.A = x / alphaRect.width;
|
38970 | slider.style.left = (x + sliderRect.width / 2) + 'px';
|
38971 | this.update();
|
38972 | }
|
38973 | };
|
38974 | AgColorPanel.prototype.update = function () {
|
38975 | var color = Color.fromHSB(this.H * 360, this.S, this.B, this.A);
|
38976 | var spectrumColor = Color.fromHSB(this.H * 360, 1, 1);
|
38977 | var rgbaColor = color.toRgbaString();
|
38978 |
|
38979 | var colorPicker = this.picker;
|
38980 | var existingColor = Color.fromString(colorPicker.getValue());
|
38981 | if (existingColor.toRgbaString() !== rgbaColor) {
|
38982 | this.colorChanged = true;
|
38983 | }
|
38984 | colorPicker.setValue(rgbaColor);
|
38985 | this.spectrumColor.style.backgroundColor = spectrumColor.toRgbaString();
|
38986 | this.spectrumDragger.style.backgroundColor = rgbaColor;
|
38987 | };
|
38988 | |
38989 |
|
38990 |
|
38991 |
|
38992 | AgColorPanel.prototype.setSpectrumValue = function (saturation, brightness) {
|
38993 | var valRect = this.spectrumValRect || this.refreshSpectrumRect();
|
38994 | if (valRect) {
|
38995 | var dragger = this.spectrumDragger;
|
38996 | var draggerRect = dragger.getBoundingClientRect();
|
38997 | saturation = Math.max(0, saturation);
|
38998 | saturation = Math.min(1, saturation);
|
38999 | brightness = Math.max(0, brightness);
|
39000 | brightness = Math.min(1, brightness);
|
39001 | this.S = saturation;
|
39002 | this.B = brightness;
|
39003 | dragger.style.left = (saturation * valRect.width - draggerRect.width / 2) + 'px';
|
39004 | dragger.style.top = ((1 - brightness) * valRect.height - draggerRect.height / 2) + 'px';
|
39005 | this.update();
|
39006 | }
|
39007 | };
|
39008 | AgColorPanel.prototype.initRecentColors = function () {
|
39009 | var recentColors = AgColorPanel.recentColors;
|
39010 | var innerHtml = recentColors.map(function (color, index) {
|
39011 | return "<div class=\"ag-recent-color\" id=" + index + " style=\"background-color: " + color + "; width: 15px; height: 15px;\" recent-color=\"" + color + "\"></div>";
|
39012 | });
|
39013 | this.recentColors.innerHTML = innerHtml.join('');
|
39014 | };
|
39015 | AgColorPanel.prototype.setValue = function (val) {
|
39016 | var color = Color.fromString(val);
|
39017 | var _a = __read$e(color.toHSB(), 3), h = _a[0], s = _a[1], b = _a[2];
|
39018 | this.H = (isNaN(h) ? 0 : h) / 360;
|
39019 | this.A = color.a;
|
39020 | var spectrumHueRect = this.spectrumHueRect || this.refreshHueRect();
|
39021 | var spectrumAlphaRect = this.spectrumAlphaRect || this.refreshAlphaRect();
|
39022 | this.spectrumHueSlider.style.left = ((this.H - 1) * -spectrumHueRect.width) + "px";
|
39023 | this.spectrumAlphaSlider.style.left = (this.A * spectrumAlphaRect.width) + "px";
|
39024 | this.setSpectrumValue(s, b);
|
39025 | };
|
39026 | AgColorPanel.prototype.onRecentColorClick = function (e) {
|
39027 | var target = e.target;
|
39028 | if (!exists(target.id)) {
|
39029 | return;
|
39030 | }
|
39031 | var id = parseInt(target.id, 10);
|
39032 | this.setValue(AgColorPanel.recentColors[id]);
|
39033 | this.destroy();
|
39034 | };
|
39035 | AgColorPanel.prototype.addRecentColor = function () {
|
39036 | var color = Color.fromHSB(this.H * 360, this.S, this.B, this.A);
|
39037 | var rgbaColor = color.toRgbaString();
|
39038 | var recentColors = AgColorPanel.recentColors;
|
39039 | if (!this.colorChanged || recentColors[0] === rgbaColor) {
|
39040 | return;
|
39041 | }
|
39042 |
|
39043 | recentColors = recentColors.filter(function (currentColor) { return currentColor != rgbaColor; });
|
39044 |
|
39045 | recentColors = [rgbaColor].concat(recentColors);
|
39046 |
|
39047 | if (recentColors.length > AgColorPanel.maxRecentColors) {
|
39048 | recentColors = recentColors.slice(0, AgColorPanel.maxRecentColors);
|
39049 | }
|
39050 | AgColorPanel.recentColors = recentColors;
|
39051 | };
|
39052 | AgColorPanel.prototype.destroy = function () {
|
39053 | this.addRecentColor();
|
39054 | _super.prototype.destroy.call(this);
|
39055 | };
|
39056 | AgColorPanel.maxRecentColors = 8;
|
39057 | AgColorPanel.recentColors = [];
|
39058 | 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>";
|
39059 | __decorate$1D([
|
39060 | RefSelector('spectrumColor')
|
39061 | ], AgColorPanel.prototype, "spectrumColor", void 0);
|
39062 | __decorate$1D([
|
39063 | RefSelector('spectrumVal')
|
39064 | ], AgColorPanel.prototype, "spectrumVal", void 0);
|
39065 | __decorate$1D([
|
39066 | RefSelector('spectrumDragger')
|
39067 | ], AgColorPanel.prototype, "spectrumDragger", void 0);
|
39068 | __decorate$1D([
|
39069 | RefSelector('spectrumHue')
|
39070 | ], AgColorPanel.prototype, "spectrumHue", void 0);
|
39071 | __decorate$1D([
|
39072 | RefSelector('spectrumHueSlider')
|
39073 | ], AgColorPanel.prototype, "spectrumHueSlider", void 0);
|
39074 | __decorate$1D([
|
39075 | RefSelector('spectrumAlpha')
|
39076 | ], AgColorPanel.prototype, "spectrumAlpha", void 0);
|
39077 | __decorate$1D([
|
39078 | RefSelector('spectrumAlphaSlider')
|
39079 | ], AgColorPanel.prototype, "spectrumAlphaSlider", void 0);
|
39080 | __decorate$1D([
|
39081 | RefSelector('recentColors')
|
39082 | ], AgColorPanel.prototype, "recentColors", void 0);
|
39083 | __decorate$1D([
|
39084 | PostConstruct
|
39085 | ], AgColorPanel.prototype, "postConstruct", null);
|
39086 | return AgColorPanel;
|
39087 | }(Component));
|
39088 |
|
39089 |
|
39090 |
|
39091 |
|
39092 |
|
39093 |
|
39094 |
|
39095 | var __extends$1Y = (undefined && undefined.__extends) || (function () {
|
39096 | var extendStatics = function (d, b) {
|
39097 | extendStatics = Object.setPrototypeOf ||
|
39098 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
39099 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
39100 | return extendStatics(d, b);
|
39101 | };
|
39102 | return function (d, b) {
|
39103 | extendStatics(d, b);
|
39104 | function __() { this.constructor = d; }
|
39105 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39106 | };
|
39107 | })();
|
39108 | var __decorate$1E = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
39109 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
39110 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
39111 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
39112 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
39113 | };
|
39114 | var AgPanel = (function (_super) {
|
39115 | __extends$1Y(AgPanel, _super);
|
39116 | function AgPanel(config) {
|
39117 | var _this = _super.call(this, AgPanel.getTemplate(config)) || this;
|
39118 | _this.closable = true;
|
39119 | _this.config = config;
|
39120 | return _this;
|
39121 | }
|
39122 | AgPanel.getTemplate = function (config) {
|
39123 | var cssIdentifier = (config && config.cssIdentifier) || 'default';
|
39124 | 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>";
|
39125 | };
|
39126 | AgPanel.prototype.postConstruct = function () {
|
39127 | var _this = this;
|
39128 | 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;
|
39129 | this.positionableFeature = new PositionableFeature(this.getGui(), {
|
39130 | minWidth: minWidth, width: width, minHeight: minHeight, height: height, centered: centered, x: x, y: y, popup: popup,
|
39131 | calculateTopBuffer: function () { return _this.positionableFeature.getHeight() - _this.getBodyHeight(); }
|
39132 | });
|
39133 | this.createManagedBean(this.positionableFeature);
|
39134 | var eGui = this.getGui();
|
39135 | if (component) {
|
39136 | this.setBodyComponent(component);
|
39137 | }
|
39138 | if (!hideTitleBar) {
|
39139 | if (title) {
|
39140 | this.setTitle(title);
|
39141 | }
|
39142 | this.setClosable(closable != null ? closable : this.closable);
|
39143 | }
|
39144 | else {
|
39145 | this.eTitleBar.classList.add('ag-hidden');
|
39146 | }
|
39147 | this.addManagedListener(this.eTitleBar, 'mousedown', function (e) {
|
39148 | var eDocument = _this.gridOptionsWrapper.getDocument();
|
39149 | if (eGui.contains(e.relatedTarget) ||
|
39150 | eGui.contains(eDocument.activeElement) ||
|
39151 | _this.eTitleBarButtons.contains(e.target)) {
|
39152 | e.preventDefault();
|
39153 | return;
|
39154 | }
|
39155 | var focusEl = _this.eContentWrapper.querySelector('button, [href], input, select, textarea, [tabindex]');
|
39156 | if (focusEl) {
|
39157 | focusEl.focus();
|
39158 | }
|
39159 | });
|
39160 | if (popup && this.positionableFeature.isPositioned()) {
|
39161 | return;
|
39162 | }
|
39163 | if (this.renderComponent) {
|
39164 | this.renderComponent();
|
39165 | }
|
39166 | this.positionableFeature.initialisePosition();
|
39167 | this.eContentWrapper.style.height = '0';
|
39168 | };
|
39169 | AgPanel.prototype.renderComponent = function () {
|
39170 | var _this = this;
|
39171 | var eGui = this.getGui();
|
39172 | eGui.focus();
|
39173 | this.close = function () {
|
39174 | eGui.parentElement.removeChild(eGui);
|
39175 | _this.destroy();
|
39176 | };
|
39177 | };
|
39178 | AgPanel.prototype.getHeight = function () {
|
39179 | return this.positionableFeature.getHeight();
|
39180 | };
|
39181 | AgPanel.prototype.setHeight = function (height) {
|
39182 | this.positionableFeature.setHeight(height);
|
39183 | };
|
39184 | AgPanel.prototype.getWidth = function () {
|
39185 | return this.positionableFeature.getWidth();
|
39186 | };
|
39187 | AgPanel.prototype.setWidth = function (width) {
|
39188 | this.positionableFeature.setWidth(width);
|
39189 | };
|
39190 | AgPanel.prototype.setClosable = function (closable) {
|
39191 | if (closable !== this.closable) {
|
39192 | this.closable = closable;
|
39193 | }
|
39194 | if (closable) {
|
39195 | var closeButtonComp = this.closeButtonComp = new Component(AgPanel.CLOSE_BTN_TEMPLATE);
|
39196 | this.getContext().createBean(closeButtonComp);
|
39197 | var eGui = closeButtonComp.getGui();
|
39198 | var child = createIconNoSpan('close', this.gridOptionsWrapper);
|
39199 | child.classList.add('ag-panel-title-bar-button-icon');
|
39200 | eGui.appendChild(child);
|
39201 | this.addTitleBarButton(closeButtonComp);
|
39202 | closeButtonComp.addManagedListener(eGui, 'click', this.onBtClose.bind(this));
|
39203 | }
|
39204 | else if (this.closeButtonComp) {
|
39205 | var eGui = this.closeButtonComp.getGui();
|
39206 | eGui.parentElement.removeChild(eGui);
|
39207 | this.closeButtonComp = this.destroyBean(this.closeButtonComp);
|
39208 | }
|
39209 | };
|
39210 | AgPanel.prototype.setBodyComponent = function (bodyComponent) {
|
39211 | bodyComponent.setParentComponent(this);
|
39212 | this.eContentWrapper.appendChild(bodyComponent.getGui());
|
39213 | };
|
39214 | AgPanel.prototype.addTitleBarButton = function (button, position) {
|
39215 | var eTitleBarButtons = this.eTitleBarButtons;
|
39216 | var buttons = eTitleBarButtons.children;
|
39217 | var len = buttons.length;
|
39218 | if (position == null) {
|
39219 | position = len;
|
39220 | }
|
39221 | position = Math.max(0, Math.min(position, len));
|
39222 | button.addCssClass('ag-panel-title-bar-button');
|
39223 | var eGui = button.getGui();
|
39224 | if (position === 0) {
|
39225 | eTitleBarButtons.insertAdjacentElement('afterbegin', eGui);
|
39226 | }
|
39227 | else if (position === len) {
|
39228 | eTitleBarButtons.insertAdjacentElement('beforeend', eGui);
|
39229 | }
|
39230 | else {
|
39231 | buttons[position - 1].insertAdjacentElement('afterend', eGui);
|
39232 | }
|
39233 | button.setParentComponent(this);
|
39234 | };
|
39235 | AgPanel.prototype.getBodyHeight = function () {
|
39236 | return getInnerHeight(this.eContentWrapper);
|
39237 | };
|
39238 | AgPanel.prototype.getBodyWidth = function () {
|
39239 | return getInnerWidth(this.eContentWrapper);
|
39240 | };
|
39241 | AgPanel.prototype.setTitle = function (title) {
|
39242 | this.eTitle.innerText = title;
|
39243 | };
|
39244 |
|
39245 | AgPanel.prototype.onBtClose = function () {
|
39246 | this.close();
|
39247 | };
|
39248 | AgPanel.prototype.destroy = function () {
|
39249 | if (this.closeButtonComp) {
|
39250 | this.closeButtonComp = this.destroyBean(this.closeButtonComp);
|
39251 | }
|
39252 | var eGui = this.getGui();
|
39253 | if (eGui && eGui.offsetParent) {
|
39254 | this.close();
|
39255 | }
|
39256 | _super.prototype.destroy.call(this);
|
39257 | };
|
39258 | AgPanel.CLOSE_BTN_TEMPLATE = "<div class=\"ag-button\"></div>";
|
39259 | __decorate$1E([
|
39260 | RefSelector('eContentWrapper')
|
39261 | ], AgPanel.prototype, "eContentWrapper", void 0);
|
39262 | __decorate$1E([
|
39263 | RefSelector('eTitleBar')
|
39264 | ], AgPanel.prototype, "eTitleBar", void 0);
|
39265 | __decorate$1E([
|
39266 | RefSelector('eTitleBarButtons')
|
39267 | ], AgPanel.prototype, "eTitleBarButtons", void 0);
|
39268 | __decorate$1E([
|
39269 | RefSelector('eTitle')
|
39270 | ], AgPanel.prototype, "eTitle", void 0);
|
39271 | __decorate$1E([
|
39272 | PostConstruct
|
39273 | ], AgPanel.prototype, "postConstruct", null);
|
39274 | return AgPanel;
|
39275 | }(Component));
|
39276 |
|
39277 |
|
39278 |
|
39279 |
|
39280 |
|
39281 |
|
39282 |
|
39283 | var __extends$1Z = (undefined && undefined.__extends) || (function () {
|
39284 | var extendStatics = function (d, b) {
|
39285 | extendStatics = Object.setPrototypeOf ||
|
39286 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
39287 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
39288 | return extendStatics(d, b);
|
39289 | };
|
39290 | return function (d, b) {
|
39291 | extendStatics(d, b);
|
39292 | function __() { this.constructor = d; }
|
39293 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39294 | };
|
39295 | })();
|
39296 | var __assign$e = (undefined && undefined.__assign) || function () {
|
39297 | __assign$e = Object.assign || function(t) {
|
39298 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
39299 | s = arguments[i];
|
39300 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
39301 | t[p] = s[p];
|
39302 | }
|
39303 | return t;
|
39304 | };
|
39305 | return __assign$e.apply(this, arguments);
|
39306 | };
|
39307 | var __decorate$1F = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
39308 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
39309 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
39310 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
39311 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
39312 | };
|
39313 | var AgDialog = (function (_super) {
|
39314 | __extends$1Z(AgDialog, _super);
|
39315 | function AgDialog(config) {
|
39316 | var _this = _super.call(this, __assign$e(__assign$e({}, config), { popup: true })) || this;
|
39317 | _this.isMaximizable = false;
|
39318 | _this.isMaximized = false;
|
39319 | _this.maximizeListeners = [];
|
39320 | _this.resizeListenerDestroy = null;
|
39321 | _this.lastPosition = {
|
39322 | x: 0,
|
39323 | y: 0,
|
39324 | width: 0,
|
39325 | height: 0
|
39326 | };
|
39327 | return _this;
|
39328 | }
|
39329 | AgDialog.prototype.postConstruct = function () {
|
39330 | var _this = this;
|
39331 | var eGui = this.getGui();
|
39332 | var _a = this.config, movable = _a.movable, resizable = _a.resizable, maximizable = _a.maximizable;
|
39333 | this.addCssClass('ag-dialog');
|
39334 | _super.prototype.postConstruct.call(this);
|
39335 | this.addManagedListener(eGui, 'focusin', function (e) {
|
39336 | if (eGui.contains(e.relatedTarget)) {
|
39337 | return;
|
39338 | }
|
39339 | _this.popupService.bringPopupToFront(eGui);
|
39340 | });
|
39341 | if (movable) {
|
39342 | this.setMovable(movable);
|
39343 | }
|
39344 | if (maximizable) {
|
39345 | this.setMaximizable(maximizable);
|
39346 | }
|
39347 | if (resizable) {
|
39348 | this.setResizable(resizable);
|
39349 | }
|
39350 | };
|
39351 | AgDialog.prototype.renderComponent = function () {
|
39352 | var eGui = this.getGui();
|
39353 | var _a = this.config, alwaysOnTop = _a.alwaysOnTop, modal = _a.modal, title = _a.title;
|
39354 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
39355 | var addPopupRes = this.popupService.addPopup({
|
39356 | modal: modal,
|
39357 | eChild: eGui,
|
39358 | closeOnEsc: true,
|
39359 | closedCallback: this.destroy.bind(this),
|
39360 | alwaysOnTop: alwaysOnTop,
|
39361 | ariaLabel: title || translate('ariaLabelDialog', 'Dialog')
|
39362 | });
|
39363 | if (addPopupRes) {
|
39364 | this.close = addPopupRes.hideFunc;
|
39365 | }
|
39366 | };
|
39367 | AgDialog.prototype.toggleMaximize = function () {
|
39368 | var position = this.positionableFeature.getPosition();
|
39369 | if (this.isMaximized) {
|
39370 | var _a = this.lastPosition, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
39371 | this.setWidth(width);
|
39372 | this.setHeight(height);
|
39373 | this.positionableFeature.offsetElement(x, y);
|
39374 | }
|
39375 | else {
|
39376 | this.lastPosition.width = this.getWidth();
|
39377 | this.lastPosition.height = this.getHeight();
|
39378 | this.lastPosition.x = position.x;
|
39379 | this.lastPosition.y = position.y;
|
39380 | this.positionableFeature.offsetElement(0, 0);
|
39381 | this.setHeight('100%');
|
39382 | this.setWidth('100%');
|
39383 | }
|
39384 | this.isMaximized = !this.isMaximized;
|
39385 | this.refreshMaximizeIcon();
|
39386 | };
|
39387 | AgDialog.prototype.refreshMaximizeIcon = function () {
|
39388 | setDisplayed(this.maximizeIcon, !this.isMaximized);
|
39389 | setDisplayed(this.minimizeIcon, this.isMaximized);
|
39390 | };
|
39391 | AgDialog.prototype.clearMaximizebleListeners = function () {
|
39392 | if (this.maximizeListeners.length) {
|
39393 | this.maximizeListeners.forEach(function (destroyListener) { return destroyListener(); });
|
39394 | this.maximizeListeners.length = 0;
|
39395 | }
|
39396 | if (this.resizeListenerDestroy) {
|
39397 | this.resizeListenerDestroy();
|
39398 | this.resizeListenerDestroy = null;
|
39399 | }
|
39400 | };
|
39401 | AgDialog.prototype.destroy = function () {
|
39402 | this.maximizeButtonComp = this.destroyBean(this.maximizeButtonComp);
|
39403 | this.clearMaximizebleListeners();
|
39404 | _super.prototype.destroy.call(this);
|
39405 | };
|
39406 | AgDialog.prototype.setResizable = function (resizable) {
|
39407 | this.positionableFeature.setResizable(resizable);
|
39408 | };
|
39409 | AgDialog.prototype.setMovable = function (movable) {
|
39410 | this.positionableFeature.setMovable(movable, this.eTitleBar);
|
39411 | };
|
39412 | AgDialog.prototype.setMaximizable = function (maximizable) {
|
39413 | var _this = this;
|
39414 | if (!maximizable) {
|
39415 | this.clearMaximizebleListeners();
|
39416 | if (this.maximizeButtonComp) {
|
39417 | this.destroyBean(this.maximizeButtonComp);
|
39418 | this.maximizeButtonComp = this.maximizeIcon = this.minimizeIcon = undefined;
|
39419 | }
|
39420 | return;
|
39421 | }
|
39422 | var eTitleBar = this.eTitleBar;
|
39423 | if (!eTitleBar || maximizable === this.isMaximizable) {
|
39424 | return;
|
39425 | }
|
39426 | var maximizeButtonComp = this.maximizeButtonComp =
|
39427 | this.createBean(new Component( "<div class=\"ag-dialog-button\"></span>"));
|
39428 | var eGui = maximizeButtonComp.getGui();
|
39429 | eGui.appendChild(this.maximizeIcon = createIconNoSpan('maximize', this.gridOptionsWrapper));
|
39430 | this.maximizeIcon.classList.add('ag-panel-title-bar-button-icon');
|
39431 | eGui.appendChild(this.minimizeIcon = createIconNoSpan('minimize', this.gridOptionsWrapper));
|
39432 | this.minimizeIcon.classList.add('ag-panel-title-bar-button-icon', 'ag-hidden');
|
39433 | maximizeButtonComp.addManagedListener(eGui, 'click', this.toggleMaximize.bind(this));
|
39434 | this.addTitleBarButton(maximizeButtonComp, 0);
|
39435 | this.maximizeListeners.push(this.addManagedListener(eTitleBar, 'dblclick', this.toggleMaximize.bind(this)));
|
39436 | this.resizeListenerDestroy = this.addManagedListener(this, 'resize', function () {
|
39437 | _this.isMaximized = false;
|
39438 | _this.refreshMaximizeIcon();
|
39439 | });
|
39440 | };
|
39441 | __decorate$1F([
|
39442 | Autowired('popupService')
|
39443 | ], AgDialog.prototype, "popupService", void 0);
|
39444 | return AgDialog;
|
39445 | }(AgPanel));
|
39446 |
|
39447 |
|
39448 |
|
39449 |
|
39450 |
|
39451 |
|
39452 |
|
39453 | var __extends$1_ = (undefined && undefined.__extends) || (function () {
|
39454 | var extendStatics = function (d, b) {
|
39455 | extendStatics = Object.setPrototypeOf ||
|
39456 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
39457 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
39458 | return extendStatics(d, b);
|
39459 | };
|
39460 | return function (d, b) {
|
39461 | extendStatics(d, b);
|
39462 | function __() { this.constructor = d; }
|
39463 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39464 | };
|
39465 | })();
|
39466 | var AgColorPicker = (function (_super) {
|
39467 | __extends$1_(AgColorPicker, _super);
|
39468 | function AgColorPicker(config) {
|
39469 | var _this = _super.call(this, config, 'ag-color-picker', 'colorPicker') || this;
|
39470 | if (config && config.color) {
|
39471 | _this.value = config.color;
|
39472 | }
|
39473 | return _this;
|
39474 | }
|
39475 | AgColorPicker.prototype.postConstruct = function () {
|
39476 | _super.prototype.postConstruct.call(this);
|
39477 | if (this.value) {
|
39478 | this.setValue(this.value);
|
39479 | }
|
39480 | };
|
39481 | AgColorPicker.prototype.showPicker = function () {
|
39482 | var _this = this;
|
39483 | var eGuiRect = this.getGui().getBoundingClientRect();
|
39484 | var colorDialog = this.createBean(new AgDialog({
|
39485 | closable: false,
|
39486 | modal: true,
|
39487 | hideTitleBar: true,
|
39488 | minWidth: 190,
|
39489 | width: 190,
|
39490 | height: 250,
|
39491 | x: eGuiRect.right - 190,
|
39492 | y: eGuiRect.top - 250
|
39493 | }));
|
39494 | this.isPickerDisplayed = true;
|
39495 | colorDialog.addCssClass('ag-color-dialog');
|
39496 | setAriaExpanded(this.eWrapper, true);
|
39497 | var colorPanel = this.createBean(new AgColorPanel({ picker: this }));
|
39498 | colorPanel.addDestroyFunc(function () {
|
39499 | if (colorDialog.isAlive()) {
|
39500 | _this.destroyBean(colorDialog);
|
39501 | }
|
39502 | });
|
39503 | colorDialog.setParentComponent(this);
|
39504 | colorDialog.setBodyComponent(colorPanel);
|
39505 | colorPanel.setValue(this.getValue());
|
39506 | colorDialog.addDestroyFunc(function () {
|
39507 |
|
39508 |
|
39509 | if (!_this.isDestroyingPicker) {
|
39510 | _this.isDestroyingPicker = true;
|
39511 | if (colorPanel.isAlive()) {
|
39512 | _this.destroyBean(colorPanel);
|
39513 | }
|
39514 | }
|
39515 | else {
|
39516 | _this.isDestroyingPicker = false;
|
39517 | }
|
39518 | if (_this.isAlive()) {
|
39519 | setAriaExpanded(_this.eWrapper, false);
|
39520 | _this.getFocusableElement().focus();
|
39521 | }
|
39522 | _this.isPickerDisplayed = false;
|
39523 | });
|
39524 | return colorDialog;
|
39525 | };
|
39526 | AgColorPicker.prototype.setValue = function (color) {
|
39527 | if (this.value === color) {
|
39528 | return this;
|
39529 | }
|
39530 | this.eDisplayField.style.backgroundColor = color;
|
39531 | return _super.prototype.setValue.call(this, color);
|
39532 | };
|
39533 | AgColorPicker.prototype.getValue = function () {
|
39534 | return this.value;
|
39535 | };
|
39536 | return AgColorPicker;
|
39537 | }(AgPickerField));
|
39538 |
|
39539 |
|
39540 |
|
39541 |
|
39542 |
|
39543 |
|
39544 |
|
39545 | var __extends$1$ = (undefined && undefined.__extends) || (function () {
|
39546 | var extendStatics = function (d, b) {
|
39547 | extendStatics = Object.setPrototypeOf ||
|
39548 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
39549 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
39550 | return extendStatics(d, b);
|
39551 | };
|
39552 | return function (d, b) {
|
39553 | extendStatics(d, b);
|
39554 | function __() { this.constructor = d; }
|
39555 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39556 | };
|
39557 | })();
|
39558 | var __decorate$1G = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
39559 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
39560 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
39561 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
39562 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
39563 | };
|
39564 | var AgGroupComponent = (function (_super) {
|
39565 | __extends$1$(AgGroupComponent, _super);
|
39566 | function AgGroupComponent(params) {
|
39567 | if (params === void 0) { params = {}; }
|
39568 | var _this = _super.call(this, AgGroupComponent.getTemplate(params)) || this;
|
39569 | _this.suppressEnabledCheckbox = true;
|
39570 | _this.suppressOpenCloseIcons = false;
|
39571 | var title = params.title, enabled = params.enabled, items = params.items, suppressEnabledCheckbox = params.suppressEnabledCheckbox, suppressOpenCloseIcons = params.suppressOpenCloseIcons;
|
39572 | _this.title = title;
|
39573 | _this.cssIdentifier = params.cssIdentifier || 'default';
|
39574 | _this.enabled = enabled != null ? enabled : true;
|
39575 | _this.items = items || [];
|
39576 | _this.alignItems = params.alignItems || 'center';
|
39577 | if (suppressEnabledCheckbox != null) {
|
39578 | _this.suppressEnabledCheckbox = suppressEnabledCheckbox;
|
39579 | }
|
39580 | if (suppressOpenCloseIcons != null) {
|
39581 | _this.suppressOpenCloseIcons = suppressOpenCloseIcons;
|
39582 | }
|
39583 | return _this;
|
39584 | }
|
39585 | AgGroupComponent.getTemplate = function (params) {
|
39586 | var cssIdentifier = params.cssIdentifier || 'default';
|
39587 | var direction = params.direction || 'vertical';
|
39588 | 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>";
|
39589 | };
|
39590 | AgGroupComponent.prototype.postConstruct = function () {
|
39591 | if (this.items.length) {
|
39592 | var initialItems = this.items;
|
39593 | this.items = [];
|
39594 | this.addItems(initialItems);
|
39595 | }
|
39596 | var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
|
39597 | this.cbGroupEnabled.setLabel(localeTextFunc('enabled', 'Enabled'));
|
39598 | if (this.title) {
|
39599 | this.setTitle(this.title);
|
39600 | }
|
39601 | if (this.enabled) {
|
39602 | this.setEnabled(this.enabled);
|
39603 | }
|
39604 | this.setAlignItems(this.alignItems);
|
39605 | this.hideEnabledCheckbox(this.suppressEnabledCheckbox);
|
39606 | this.hideOpenCloseIcons(this.suppressOpenCloseIcons);
|
39607 | this.setupExpandContract();
|
39608 | this.refreshAriaStatus();
|
39609 | this.refreshChildDisplay();
|
39610 | };
|
39611 | AgGroupComponent.prototype.setupExpandContract = function () {
|
39612 | var _this = this;
|
39613 | this.eGroupClosedIcon.appendChild(createIcon('columnSelectClosed', this.gridOptionsWrapper, null));
|
39614 | this.eGroupOpenedIcon.appendChild(createIcon('columnSelectOpen', this.gridOptionsWrapper, null));
|
39615 | this.addManagedListener(this.eTitleBar, 'click', function () { return _this.toggleGroupExpand(); });
|
39616 | this.addManagedListener(this.eTitleBar, 'keydown', function (e) {
|
39617 | switch (e.key) {
|
39618 | case KeyCode.ENTER:
|
39619 | case KeyCode.SPACE:
|
39620 | e.preventDefault();
|
39621 | _this.toggleGroupExpand();
|
39622 | break;
|
39623 | case KeyCode.RIGHT:
|
39624 | case KeyCode.LEFT:
|
39625 | e.preventDefault();
|
39626 | _this.toggleGroupExpand(e.key === KeyCode.RIGHT);
|
39627 | break;
|
39628 | }
|
39629 | });
|
39630 | };
|
39631 | AgGroupComponent.prototype.refreshAriaStatus = function () {
|
39632 | if (!this.suppressOpenCloseIcons) {
|
39633 | setAriaExpanded(this.eTitleBar, this.expanded);
|
39634 | }
|
39635 | };
|
39636 | AgGroupComponent.prototype.refreshChildDisplay = function () {
|
39637 | var showIcon = !this.suppressOpenCloseIcons;
|
39638 | setDisplayed(this.eToolbar, this.expanded && !this.suppressEnabledCheckbox);
|
39639 | setDisplayed(this.eGroupOpenedIcon, showIcon && this.expanded);
|
39640 | setDisplayed(this.eGroupClosedIcon, showIcon && !this.expanded);
|
39641 | };
|
39642 | AgGroupComponent.prototype.isExpanded = function () {
|
39643 | return this.expanded;
|
39644 | };
|
39645 | AgGroupComponent.prototype.setAlignItems = function (alignment) {
|
39646 | if (this.alignItems !== alignment) {
|
39647 | this.removeCssClass("ag-group-item-alignment-" + this.alignItems);
|
39648 | }
|
39649 | this.alignItems = alignment;
|
39650 | var newCls = "ag-group-item-alignment-" + this.alignItems;
|
39651 | this.addCssClass(newCls);
|
39652 | return this;
|
39653 | };
|
39654 | AgGroupComponent.prototype.toggleGroupExpand = function (expanded) {
|
39655 | if (this.suppressOpenCloseIcons) {
|
39656 | this.expanded = true;
|
39657 | this.refreshChildDisplay();
|
39658 | setDisplayed(this.eContainer, true);
|
39659 | return this;
|
39660 | }
|
39661 | expanded = expanded != null ? expanded : !this.expanded;
|
39662 | if (this.expanded === expanded) {
|
39663 | return this;
|
39664 | }
|
39665 | this.expanded = expanded;
|
39666 | this.refreshAriaStatus();
|
39667 | this.refreshChildDisplay();
|
39668 | setDisplayed(this.eContainer, expanded);
|
39669 | this.dispatchEvent({ type: this.expanded ? AgGroupComponent.EVENT_EXPANDED : AgGroupComponent.EVENT_COLLAPSED });
|
39670 | return this;
|
39671 | };
|
39672 | AgGroupComponent.prototype.addItems = function (items) {
|
39673 | var _this = this;
|
39674 | items.forEach(function (item) { return _this.addItem(item); });
|
39675 | };
|
39676 | AgGroupComponent.prototype.addItem = function (item) {
|
39677 | var container = this.eContainer;
|
39678 | var el = item instanceof Component ? item.getGui() : item;
|
39679 | el.classList.add('ag-group-item', "ag-" + this.cssIdentifier + "-group-item");
|
39680 | container.appendChild(el);
|
39681 | this.items.push(el);
|
39682 | };
|
39683 | AgGroupComponent.prototype.hideItem = function (hide, index) {
|
39684 | var itemToHide = this.items[index];
|
39685 | itemToHide.classList.toggle('ag-hidden', hide);
|
39686 | };
|
39687 | AgGroupComponent.prototype.setTitle = function (title) {
|
39688 | this.eTitle.innerText = title;
|
39689 | return this;
|
39690 | };
|
39691 | AgGroupComponent.prototype.addCssClassToTitleBar = function (cssClass) {
|
39692 | this.eTitleBar.classList.add(cssClass);
|
39693 | };
|
39694 | AgGroupComponent.prototype.setEnabled = function (enabled, skipToggle) {
|
39695 | this.enabled = enabled;
|
39696 | this.refreshDisabledStyles();
|
39697 | this.toggleGroupExpand(enabled);
|
39698 | if (!skipToggle) {
|
39699 | this.cbGroupEnabled.setValue(enabled);
|
39700 | }
|
39701 | return this;
|
39702 | };
|
39703 | AgGroupComponent.prototype.isEnabled = function () {
|
39704 | return this.enabled;
|
39705 | };
|
39706 | AgGroupComponent.prototype.onEnableChange = function (callbackFn) {
|
39707 | var _this = this;
|
39708 | this.cbGroupEnabled.onValueChange(function (newSelection) {
|
39709 | _this.setEnabled(newSelection, true);
|
39710 | callbackFn(newSelection);
|
39711 | });
|
39712 | return this;
|
39713 | };
|
39714 | AgGroupComponent.prototype.hideEnabledCheckbox = function (hide) {
|
39715 | this.suppressEnabledCheckbox = hide;
|
39716 | this.refreshChildDisplay();
|
39717 | this.refreshDisabledStyles();
|
39718 | return this;
|
39719 | };
|
39720 | AgGroupComponent.prototype.hideOpenCloseIcons = function (hide) {
|
39721 | this.suppressOpenCloseIcons = hide;
|
39722 | if (hide) {
|
39723 | this.toggleGroupExpand(true);
|
39724 | }
|
39725 | return this;
|
39726 | };
|
39727 | AgGroupComponent.prototype.refreshDisabledStyles = function () {
|
39728 | this.addOrRemoveCssClass('ag-disabled', !this.enabled);
|
39729 | if (this.suppressEnabledCheckbox && !this.enabled) {
|
39730 | this.eTitleBar.classList.add('ag-disabled-group-title-bar');
|
39731 | this.eTitleBar.removeAttribute('tabindex');
|
39732 | }
|
39733 | else {
|
39734 | this.eTitleBar.classList.remove('ag-disabled-group-title-bar');
|
39735 | this.eTitleBar.setAttribute('tabindex', '0');
|
39736 | }
|
39737 | this.eContainer.classList.toggle('ag-disabled-group-container', !this.enabled);
|
39738 | };
|
39739 | AgGroupComponent.EVENT_EXPANDED = 'expanded';
|
39740 | AgGroupComponent.EVENT_COLLAPSED = 'collapsed';
|
39741 | __decorate$1G([
|
39742 | RefSelector('eTitleBar')
|
39743 | ], AgGroupComponent.prototype, "eTitleBar", void 0);
|
39744 | __decorate$1G([
|
39745 | RefSelector('eGroupOpenedIcon')
|
39746 | ], AgGroupComponent.prototype, "eGroupOpenedIcon", void 0);
|
39747 | __decorate$1G([
|
39748 | RefSelector('eGroupClosedIcon')
|
39749 | ], AgGroupComponent.prototype, "eGroupClosedIcon", void 0);
|
39750 | __decorate$1G([
|
39751 | RefSelector('eToolbar')
|
39752 | ], AgGroupComponent.prototype, "eToolbar", void 0);
|
39753 | __decorate$1G([
|
39754 | RefSelector('cbGroupEnabled')
|
39755 | ], AgGroupComponent.prototype, "cbGroupEnabled", void 0);
|
39756 | __decorate$1G([
|
39757 | RefSelector('eTitle')
|
39758 | ], AgGroupComponent.prototype, "eTitle", void 0);
|
39759 | __decorate$1G([
|
39760 | RefSelector('eContainer')
|
39761 | ], AgGroupComponent.prototype, "eContainer", void 0);
|
39762 | __decorate$1G([
|
39763 | PostConstruct
|
39764 | ], AgGroupComponent.prototype, "postConstruct", null);
|
39765 | return AgGroupComponent;
|
39766 | }(Component));
|
39767 |
|
39768 |
|
39769 |
|
39770 |
|
39771 |
|
39772 |
|
39773 |
|
39774 | var __extends$20 = (undefined && undefined.__extends) || (function () {
|
39775 | var extendStatics = function (d, b) {
|
39776 | extendStatics = Object.setPrototypeOf ||
|
39777 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
39778 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
39779 | return extendStatics(d, b);
|
39780 | };
|
39781 | return function (d, b) {
|
39782 | extendStatics(d, b);
|
39783 | function __() { this.constructor = d; }
|
39784 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39785 | };
|
39786 | })();
|
39787 | var __decorate$1H = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
39788 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
39789 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
39790 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
39791 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
39792 | };
|
39793 | var TabGuardCtrl = (function (_super) {
|
39794 | __extends$20(TabGuardCtrl, _super);
|
39795 | function TabGuardCtrl(params) {
|
39796 | var _this = _super.call(this) || this;
|
39797 | _this.skipTabGuardFocus = false;
|
39798 | 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;
|
39799 | _this.comp = comp;
|
39800 | _this.eTopGuard = eTopGuard;
|
39801 | _this.eBottomGuard = eBottomGuard;
|
39802 | _this.providedFocusInnerElement = focusInnerElement;
|
39803 | _this.eFocusableElement = eFocusableElement;
|
39804 | _this.providedFocusIn = onFocusIn;
|
39805 | _this.providedFocusOut = onFocusOut;
|
39806 | _this.providedShouldStopEventPropagation = shouldStopEventPropagation;
|
39807 | _this.providedOnTabKeyDown = onTabKeyDown;
|
39808 | _this.providedHandleKeyDown = handleKeyDown;
|
39809 | return _this;
|
39810 | }
|
39811 | TabGuardCtrl.prototype.postConstruct = function () {
|
39812 | var _this = this;
|
39813 | this.createManagedBean(new ManagedFocusFeature(this.eFocusableElement, {
|
39814 | shouldStopEventPropagation: function () { return _this.shouldStopEventPropagation(); },
|
39815 | onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
|
39816 | handleKeyDown: function (e) { return _this.handleKeyDown(e); },
|
39817 | onFocusIn: function (e) { return _this.onFocusIn(e); },
|
39818 | onFocusOut: function (e) { return _this.onFocusOut(e); }
|
39819 | }));
|
39820 | this.activateTabGuards();
|
39821 | [this.eTopGuard, this.eBottomGuard].forEach(function (guard) { return _this.addManagedListener(guard, 'focus', _this.onFocus.bind(_this)); });
|
39822 | };
|
39823 | TabGuardCtrl.prototype.handleKeyDown = function (e) {
|
39824 | if (this.providedHandleKeyDown) {
|
39825 | this.providedHandleKeyDown(e);
|
39826 | }
|
39827 | };
|
39828 | TabGuardCtrl.prototype.tabGuardsAreActive = function () {
|
39829 | return !!this.eTopGuard && this.eTopGuard.hasAttribute('tabIndex');
|
39830 | };
|
39831 | TabGuardCtrl.prototype.shouldStopEventPropagation = function () {
|
39832 | if (this.providedShouldStopEventPropagation) {
|
39833 | return this.providedShouldStopEventPropagation();
|
39834 | }
|
39835 | return false;
|
39836 | };
|
39837 | TabGuardCtrl.prototype.activateTabGuards = function () {
|
39838 | this.comp.setTabIndex(this.getGridTabIndex());
|
39839 | };
|
39840 | TabGuardCtrl.prototype.deactivateTabGuards = function () {
|
39841 | this.comp.setTabIndex();
|
39842 | };
|
39843 | TabGuardCtrl.prototype.onFocus = function (e) {
|
39844 | if (this.skipTabGuardFocus) {
|
39845 | this.skipTabGuardFocus = false;
|
39846 | return;
|
39847 | }
|
39848 | var fromBottom = e.target === this.eBottomGuard;
|
39849 | if (this.providedFocusInnerElement) {
|
39850 | this.providedFocusInnerElement(fromBottom);
|
39851 | }
|
39852 | else {
|
39853 | this.focusInnerElement(fromBottom);
|
39854 | }
|
39855 | };
|
39856 | TabGuardCtrl.prototype.onFocusIn = function (e) {
|
39857 | if (this.providedFocusIn && this.providedFocusIn(e)) {
|
39858 | return;
|
39859 | }
|
39860 | this.deactivateTabGuards();
|
39861 | };
|
39862 | TabGuardCtrl.prototype.onFocusOut = function (e) {
|
39863 | if (this.providedFocusOut && this.providedFocusOut(e)) {
|
39864 | return;
|
39865 | }
|
39866 | if (!this.eFocusableElement.contains(e.relatedTarget)) {
|
39867 | this.activateTabGuards();
|
39868 | }
|
39869 | };
|
39870 | TabGuardCtrl.prototype.onTabKeyDown = function (e) {
|
39871 | var _this = this;
|
39872 | if (this.providedOnTabKeyDown) {
|
39873 | this.providedOnTabKeyDown(e);
|
39874 | return;
|
39875 | }
|
39876 | if (e.defaultPrevented) {
|
39877 | return;
|
39878 | }
|
39879 | var tabGuardsAreActive = this.tabGuardsAreActive();
|
39880 | if (tabGuardsAreActive) {
|
39881 | this.deactivateTabGuards();
|
39882 | }
|
39883 | var nextRoot = this.getNextFocusableElement(e.shiftKey);
|
39884 | if (tabGuardsAreActive) {
|
39885 |
|
39886 |
|
39887 | setTimeout(function () { return _this.activateTabGuards(); }, 0);
|
39888 | }
|
39889 | if (!nextRoot) {
|
39890 | return;
|
39891 | }
|
39892 | nextRoot.focus();
|
39893 | e.preventDefault();
|
39894 | };
|
39895 | TabGuardCtrl.prototype.getGridTabIndex = function () {
|
39896 | return this.gridOptionsWrapper.getGridTabIndex();
|
39897 | };
|
39898 | TabGuardCtrl.prototype.focusInnerElement = function (fromBottom) {
|
39899 | if (fromBottom === void 0) { fromBottom = false; }
|
39900 | var focusable = this.focusService.findFocusableElements(this.eFocusableElement);
|
39901 | if (this.tabGuardsAreActive()) {
|
39902 |
|
39903 | focusable.splice(0, 1);
|
39904 | focusable.splice(focusable.length - 1, 1);
|
39905 | }
|
39906 | if (!focusable.length) {
|
39907 | return;
|
39908 | }
|
39909 | focusable[fromBottom ? focusable.length - 1 : 0].focus();
|
39910 | };
|
39911 | TabGuardCtrl.prototype.getNextFocusableElement = function (backwards) {
|
39912 | return this.focusService.findNextFocusableElement(this.eFocusableElement, false, backwards);
|
39913 | };
|
39914 | TabGuardCtrl.prototype.forceFocusOutOfContainer = function (up) {
|
39915 | if (up === void 0) { up = false; }
|
39916 | var tabGuardToFocus = up ? this.eTopGuard : this.eBottomGuard;
|
39917 | this.activateTabGuards();
|
39918 | this.skipTabGuardFocus = true;
|
39919 | tabGuardToFocus.focus();
|
39920 | };
|
39921 | __decorate$1H([
|
39922 | Autowired('focusService')
|
39923 | ], TabGuardCtrl.prototype, "focusService", void 0);
|
39924 | __decorate$1H([
|
39925 | PostConstruct
|
39926 | ], TabGuardCtrl.prototype, "postConstruct", null);
|
39927 | return TabGuardCtrl;
|
39928 | }(BeanStub));
|
39929 |
|
39930 |
|
39931 |
|
39932 |
|
39933 |
|
39934 |
|
39935 |
|
39936 | var __extends$21 = (undefined && undefined.__extends) || (function () {
|
39937 | var extendStatics = function (d, b) {
|
39938 | extendStatics = Object.setPrototypeOf ||
|
39939 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
39940 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
39941 | return extendStatics(d, b);
|
39942 | };
|
39943 | return function (d, b) {
|
39944 | extendStatics(d, b);
|
39945 | function __() { this.constructor = d; }
|
39946 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39947 | };
|
39948 | })();
|
39949 | var __read$f = (undefined && undefined.__read) || function (o, n) {
|
39950 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
39951 | if (!m) return o;
|
39952 | var i = m.call(o), r, ar = [], e;
|
39953 | try {
|
39954 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
39955 | }
|
39956 | catch (error) { e = { error: error }; }
|
39957 | finally {
|
39958 | try {
|
39959 | if (r && !r.done && (m = i["return"])) m.call(i);
|
39960 | }
|
39961 | finally { if (e) throw e.error; }
|
39962 | }
|
39963 | return ar;
|
39964 | };
|
39965 | var __spread$b = (undefined && undefined.__spread) || function () {
|
39966 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$f(arguments[i]));
|
39967 | return ar;
|
39968 | };
|
39969 | var TabGuardComp = (function (_super) {
|
39970 | __extends$21(TabGuardComp, _super);
|
39971 | function TabGuardComp() {
|
39972 | return _super !== null && _super.apply(this, arguments) || this;
|
39973 | }
|
39974 | TabGuardComp.prototype.initialiseTabGuard = function (params) {
|
39975 | this.eTopGuard = this.createTabGuard('top');
|
39976 | this.eBottomGuard = this.createTabGuard('bottom');
|
39977 | this.eFocusableElement = this.getFocusableElement();
|
39978 | var tabGuards = [this.eTopGuard, this.eBottomGuard];
|
39979 | var compProxy = {
|
39980 | setTabIndex: function (tabIndex) {
|
39981 | tabGuards.forEach(function (tabGuard) { return tabIndex != null ? tabGuard.setAttribute('tabIndex', tabIndex) : tabGuard.removeAttribute('tabIndex'); });
|
39982 | }
|
39983 | };
|
39984 | this.addTabGuards(this.eTopGuard, this.eBottomGuard);
|
39985 | this.tabGuardCtrl = this.createManagedBean(new TabGuardCtrl({
|
39986 | comp: compProxy,
|
39987 | eTopGuard: this.eTopGuard,
|
39988 | eBottomGuard: this.eBottomGuard,
|
39989 | eFocusableElement: this.eFocusableElement,
|
39990 | onFocusIn: params.onFocusIn,
|
39991 | onFocusOut: params.onFocusOut,
|
39992 | focusInnerElement: params.focusInnerElement,
|
39993 | handleKeyDown: params.handleKeyDown,
|
39994 | onTabKeyDown: params.onTabKeyDown,
|
39995 | shouldStopEventPropagation: params.shouldStopEventPropagation
|
39996 | }));
|
39997 | };
|
39998 | TabGuardComp.prototype.createTabGuard = function (side) {
|
39999 | var tabGuard = document.createElement('div');
|
40000 | tabGuard.classList.add('ag-tab-guard', "ag-tab-guard-" + side);
|
40001 | setAriaRole(tabGuard, 'presentation');
|
40002 | return tabGuard;
|
40003 | };
|
40004 | TabGuardComp.prototype.addTabGuards = function (topTabGuard, bottomTabGuard) {
|
40005 | this.eFocusableElement.insertAdjacentElement('afterbegin', topTabGuard);
|
40006 | this.eFocusableElement.insertAdjacentElement('beforeend', bottomTabGuard);
|
40007 | };
|
40008 | TabGuardComp.prototype.removeAllChildrenExceptTabGuards = function () {
|
40009 | var tabGuards = [this.eTopGuard, this.eBottomGuard];
|
40010 | clearElement(this.getFocusableElement());
|
40011 | this.addTabGuards.apply(this, __spread$b(tabGuards));
|
40012 | };
|
40013 | TabGuardComp.prototype.forceFocusOutOfContainer = function (up) {
|
40014 | if (up === void 0) { up = false; }
|
40015 | this.tabGuardCtrl.forceFocusOutOfContainer(up);
|
40016 | };
|
40017 | TabGuardComp.prototype.appendChild = function (newChild, container) {
|
40018 | if (!isNodeOrElement(newChild)) {
|
40019 | newChild = newChild.getGui();
|
40020 | }
|
40021 | var bottomTabGuard = this.eBottomGuard;
|
40022 | if (bottomTabGuard) {
|
40023 | bottomTabGuard.insertAdjacentElement('beforebegin', newChild);
|
40024 | }
|
40025 | else {
|
40026 | _super.prototype.appendChild.call(this, newChild, container);
|
40027 | }
|
40028 | };
|
40029 | return TabGuardComp;
|
40030 | }(Component));
|
40031 |
|
40032 |
|
40033 |
|
40034 |
|
40035 |
|
40036 |
|
40037 |
|
40038 | var __extends$22 = (undefined && undefined.__extends) || (function () {
|
40039 | var extendStatics = function (d, b) {
|
40040 | extendStatics = Object.setPrototypeOf ||
|
40041 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
40042 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
40043 | return extendStatics(d, b);
|
40044 | };
|
40045 | return function (d, b) {
|
40046 | extendStatics(d, b);
|
40047 | function __() { this.constructor = d; }
|
40048 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
40049 | };
|
40050 | })();
|
40051 | var __assign$f = (undefined && undefined.__assign) || function () {
|
40052 | __assign$f = Object.assign || function(t) {
|
40053 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
40054 | s = arguments[i];
|
40055 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
40056 | t[p] = s[p];
|
40057 | }
|
40058 | return t;
|
40059 | };
|
40060 | return __assign$f.apply(this, arguments);
|
40061 | };
|
40062 | var __decorate$1I = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
40063 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
40064 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
40065 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
40066 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
40067 | };
|
40068 | var AgMenuList = (function (_super) {
|
40069 | __extends$22(AgMenuList, _super);
|
40070 | function AgMenuList(level) {
|
40071 | if (level === void 0) { level = 1; }
|
40072 | var _this = _super.call(this, "<div class=\"ag-menu-list\" role=\"tree\"></div>") || this;
|
40073 | _this.level = level;
|
40074 | _this.menuItems = [];
|
40075 | return _this;
|
40076 | }
|
40077 | AgMenuList.prototype.postConstruct = function () {
|
40078 | var _this = this;
|
40079 | this.initialiseTabGuard({
|
40080 | onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
|
40081 | handleKeyDown: function (e) { return _this.handleKeyDown(e); }
|
40082 | });
|
40083 | };
|
40084 | AgMenuList.prototype.onTabKeyDown = function (e) {
|
40085 | var parent = this.getParentComponent();
|
40086 | var parentGui = parent && parent.getGui();
|
40087 | var isManaged = parentGui && parentGui.classList.contains('ag-focus-managed');
|
40088 | if (!isManaged) {
|
40089 | e.preventDefault();
|
40090 | }
|
40091 | if (e.shiftKey) {
|
40092 | this.closeIfIsChild(e);
|
40093 | }
|
40094 | };
|
40095 | AgMenuList.prototype.handleKeyDown = function (e) {
|
40096 | switch (e.key) {
|
40097 | case KeyCode.UP:
|
40098 | case KeyCode.RIGHT:
|
40099 | case KeyCode.DOWN:
|
40100 | case KeyCode.LEFT:
|
40101 | e.preventDefault();
|
40102 | this.handleNavKey(e.key);
|
40103 | break;
|
40104 | case KeyCode.ESCAPE:
|
40105 | var topMenu = this.findTopMenu();
|
40106 | if (topMenu) {
|
40107 | this.focusService.focusInto(topMenu.getGui());
|
40108 | }
|
40109 | break;
|
40110 | }
|
40111 | };
|
40112 | AgMenuList.prototype.clearActiveItem = function () {
|
40113 | if (this.activeMenuItem) {
|
40114 | this.activeMenuItem.deactivate();
|
40115 | this.activeMenuItem = null;
|
40116 | }
|
40117 | };
|
40118 | AgMenuList.prototype.addMenuItems = function (menuItems) {
|
40119 | var _this = this;
|
40120 | if (menuItems == null) {
|
40121 | return;
|
40122 | }
|
40123 | menuItems.forEach(function (menuItemOrString) {
|
40124 | if (menuItemOrString === 'separator') {
|
40125 | _this.addSeparator();
|
40126 | }
|
40127 | else if (typeof menuItemOrString === 'string') {
|
40128 | console.warn("AG Grid: unrecognised menu item " + menuItemOrString);
|
40129 | }
|
40130 | else {
|
40131 | _this.addItem(menuItemOrString);
|
40132 | }
|
40133 | });
|
40134 | };
|
40135 | AgMenuList.prototype.addItem = function (menuItemDef) {
|
40136 | var _this = this;
|
40137 | var menuItem = this.createManagedBean(new AgMenuItemComponent(__assign$f(__assign$f({}, menuItemDef), { isAnotherSubMenuOpen: function () { return _this.menuItems.some(function (m) { return m.isSubMenuOpen(); }); } })));
|
40138 | menuItem.setParentComponent(this);
|
40139 | setAriaLevel(menuItem.getGui(), this.level);
|
40140 | this.menuItems.push(menuItem);
|
40141 | this.appendChild(menuItem.getGui());
|
40142 | this.addManagedListener(menuItem, AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED, function (event) {
|
40143 | _this.dispatchEvent(event);
|
40144 | });
|
40145 | this.addManagedListener(menuItem, AgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED, function (event) {
|
40146 | if (_this.activeMenuItem && _this.activeMenuItem !== event.menuItem) {
|
40147 | _this.activeMenuItem.deactivate();
|
40148 | }
|
40149 | _this.activeMenuItem = event.menuItem;
|
40150 | });
|
40151 | };
|
40152 | AgMenuList.prototype.activateFirstItem = function () {
|
40153 | var item = this.menuItems.filter(function (currentItem) { return !currentItem.isDisabled(); })[0];
|
40154 | if (!item) {
|
40155 | return;
|
40156 | }
|
40157 | item.activate();
|
40158 | };
|
40159 | AgMenuList.prototype.addSeparator = function () {
|
40160 | 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>";
|
40161 | this.appendChild(loadTemplate(separatorHtml));
|
40162 | };
|
40163 | AgMenuList.prototype.findTopMenu = function () {
|
40164 | var parent = this.getParentComponent();
|
40165 | if (!parent && this instanceof AgMenuList) {
|
40166 | return this;
|
40167 | }
|
40168 | while (true) {
|
40169 | var nextParent = parent && parent.getParentComponent && parent.getParentComponent();
|
40170 | if (!nextParent || (!(nextParent instanceof AgMenuList || nextParent instanceof AgMenuItemComponent))) {
|
40171 | break;
|
40172 | }
|
40173 | parent = nextParent;
|
40174 | }
|
40175 | return parent instanceof AgMenuList ? parent : undefined;
|
40176 | };
|
40177 | AgMenuList.prototype.handleNavKey = function (key) {
|
40178 | switch (key) {
|
40179 | case KeyCode.UP:
|
40180 | case KeyCode.DOWN:
|
40181 | var nextItem = this.findNextItem(key === KeyCode.UP);
|
40182 | if (nextItem && nextItem !== this.activeMenuItem) {
|
40183 | nextItem.activate();
|
40184 | }
|
40185 | return;
|
40186 | }
|
40187 | var left = this.gridOptionsWrapper.isEnableRtl() ? KeyCode.RIGHT : KeyCode.LEFT;
|
40188 | if (key === left) {
|
40189 | this.closeIfIsChild();
|
40190 | }
|
40191 | else {
|
40192 | this.openChild();
|
40193 | }
|
40194 | };
|
40195 | AgMenuList.prototype.closeIfIsChild = function (e) {
|
40196 | var parentItem = this.getParentComponent();
|
40197 | if (parentItem && parentItem instanceof AgMenuItemComponent) {
|
40198 | if (e) {
|
40199 | e.preventDefault();
|
40200 | }
|
40201 | parentItem.closeSubMenu();
|
40202 | parentItem.getGui().focus();
|
40203 | }
|
40204 | };
|
40205 | AgMenuList.prototype.openChild = function () {
|
40206 | if (this.activeMenuItem) {
|
40207 | this.activeMenuItem.openSubMenu(true);
|
40208 | }
|
40209 | };
|
40210 | AgMenuList.prototype.findNextItem = function (up) {
|
40211 | var items = this.menuItems.filter(function (item) { return !item.isDisabled(); });
|
40212 | if (!items.length) {
|
40213 | return;
|
40214 | }
|
40215 | if (!this.activeMenuItem) {
|
40216 | return up ? last(items) : items[0];
|
40217 | }
|
40218 | if (up) {
|
40219 | items.reverse();
|
40220 | }
|
40221 | var nextItem;
|
40222 | var foundCurrent = false;
|
40223 | for (var i = 0; i < items.length; i++) {
|
40224 | var item = items[i];
|
40225 | if (!foundCurrent) {
|
40226 | if (item === this.activeMenuItem) {
|
40227 | foundCurrent = true;
|
40228 | }
|
40229 | continue;
|
40230 | }
|
40231 | nextItem = item;
|
40232 | break;
|
40233 | }
|
40234 | return nextItem || this.activeMenuItem;
|
40235 | };
|
40236 | AgMenuList.prototype.destroy = function () {
|
40237 | this.clearActiveItem();
|
40238 | _super.prototype.destroy.call(this);
|
40239 | };
|
40240 | __decorate$1I([
|
40241 | Autowired('focusService')
|
40242 | ], AgMenuList.prototype, "focusService", void 0);
|
40243 | __decorate$1I([
|
40244 | PostConstruct
|
40245 | ], AgMenuList.prototype, "postConstruct", null);
|
40246 | return AgMenuList;
|
40247 | }(TabGuardComp));
|
40248 |
|
40249 |
|
40250 |
|
40251 |
|
40252 |
|
40253 |
|
40254 |
|
40255 | var __extends$23 = (undefined && undefined.__extends) || (function () {
|
40256 | var extendStatics = function (d, b) {
|
40257 | extendStatics = Object.setPrototypeOf ||
|
40258 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
40259 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
40260 | return extendStatics(d, b);
|
40261 | };
|
40262 | return function (d, b) {
|
40263 | extendStatics(d, b);
|
40264 | function __() { this.constructor = d; }
|
40265 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
40266 | };
|
40267 | })();
|
40268 | var __decorate$1J = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
40269 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
40270 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
40271 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
40272 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
40273 | };
|
40274 | var AgMenuPanel = (function (_super) {
|
40275 | __extends$23(AgMenuPanel, _super);
|
40276 | function AgMenuPanel(wrappedComponent) {
|
40277 | var _this = _super.call(this) || this;
|
40278 | _this.wrappedComponent = wrappedComponent;
|
40279 | _this.setTemplateFromElement(wrappedComponent.getGui());
|
40280 | return _this;
|
40281 | }
|
40282 | AgMenuPanel.prototype.postConstruct = function () {
|
40283 | var _this = this;
|
40284 | this.initialiseTabGuard({
|
40285 | onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
|
40286 | handleKeyDown: function (e) { return _this.handleKeyDown(e); }
|
40287 | });
|
40288 | };
|
40289 | AgMenuPanel.prototype.handleKeyDown = function (e) {
|
40290 | if (e.key === KeyCode.ESCAPE) {
|
40291 | this.closePanel();
|
40292 | }
|
40293 | };
|
40294 | AgMenuPanel.prototype.onTabKeyDown = function (e) {
|
40295 | if (e.defaultPrevented) {
|
40296 | return;
|
40297 | }
|
40298 | this.closePanel();
|
40299 | e.preventDefault();
|
40300 | };
|
40301 | AgMenuPanel.prototype.closePanel = function () {
|
40302 | var menuItem = this.parentComponent;
|
40303 | menuItem.closeSubMenu();
|
40304 | setTimeout(function () { return menuItem.getGui().focus(); }, 0);
|
40305 | };
|
40306 | __decorate$1J([
|
40307 | PostConstruct
|
40308 | ], AgMenuPanel.prototype, "postConstruct", null);
|
40309 | return AgMenuPanel;
|
40310 | }(TabGuardComp));
|
40311 |
|
40312 |
|
40313 |
|
40314 |
|
40315 |
|
40316 |
|
40317 |
|
40318 | var __extends$24 = (undefined && undefined.__extends) || (function () {
|
40319 | var extendStatics = function (d, b) {
|
40320 | extendStatics = Object.setPrototypeOf ||
|
40321 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
40322 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
40323 | return extendStatics(d, b);
|
40324 | };
|
40325 | return function (d, b) {
|
40326 | extendStatics(d, b);
|
40327 | function __() { this.constructor = d; }
|
40328 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
40329 | };
|
40330 | })();
|
40331 | var __decorate$1K = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
40332 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
40333 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
40334 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
40335 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
40336 | };
|
40337 | var AgMenuItemComponent = (function (_super) {
|
40338 | __extends$24(AgMenuItemComponent, _super);
|
40339 | function AgMenuItemComponent(params) {
|
40340 | var _this = _super.call(this) || this;
|
40341 | _this.params = params;
|
40342 | _this.isActive = false;
|
40343 | _this.subMenuIsOpen = false;
|
40344 | _this.setTemplate( "<div class=\"" + _this.getClassName() + "\" tabindex=\"-1\" role=\"treeitem\"></div>");
|
40345 | return _this;
|
40346 | }
|
40347 | AgMenuItemComponent.prototype.init = function () {
|
40348 | var _this = this;
|
40349 | this.addIcon();
|
40350 | this.addName();
|
40351 | this.addShortcut();
|
40352 | this.addSubMenu();
|
40353 | this.addTooltip();
|
40354 | var eGui = this.getGui();
|
40355 | if (this.params.disabled) {
|
40356 | this.addCssClass(this.getClassName('disabled'));
|
40357 | setAriaDisabled(eGui, true);
|
40358 | }
|
40359 | else {
|
40360 | this.addGuiEventListener('click', function (e) { return _this.onItemSelected(e); });
|
40361 | this.addGuiEventListener('keydown', function (e) {
|
40362 | if (e.key === KeyCode.ENTER || e.key === KeyCode.SPACE) {
|
40363 | e.preventDefault();
|
40364 | _this.onItemSelected(e);
|
40365 | }
|
40366 | });
|
40367 | this.addGuiEventListener('mousedown', function (e) {
|
40368 |
|
40369 |
|
40370 | e.stopPropagation();
|
40371 | e.preventDefault();
|
40372 | });
|
40373 | this.addGuiEventListener('mouseenter', function () { return _this.onMouseEnter(); });
|
40374 | this.addGuiEventListener('mouseleave', function () { return _this.onMouseLeave(); });
|
40375 | }
|
40376 | if (this.params.cssClasses) {
|
40377 | this.params.cssClasses.forEach(function (it) { return _this.addCssClass(it); });
|
40378 | }
|
40379 | };
|
40380 | AgMenuItemComponent.prototype.isDisabled = function () {
|
40381 | return !!this.params.disabled;
|
40382 | };
|
40383 | AgMenuItemComponent.prototype.openSubMenu = function (activateFirstItem) {
|
40384 | var _this = this;
|
40385 | if (activateFirstItem === void 0) { activateFirstItem = false; }
|
40386 | this.closeSubMenu();
|
40387 | if (!this.params.subMenu) {
|
40388 | return;
|
40389 | }
|
40390 | var ePopup = loadTemplate( "<div class=\"ag-menu\" role=\"presentation\"></div>");
|
40391 | var destroySubMenu;
|
40392 | if (this.params.subMenu instanceof Array) {
|
40393 | var currentLevel = getAriaLevel(this.getGui());
|
40394 | var nextLevel = isNaN(currentLevel) ? 1 : (currentLevel + 1);
|
40395 | var childMenu_1 = this.createBean(new AgMenuList(nextLevel));
|
40396 | childMenu_1.setParentComponent(this);
|
40397 | childMenu_1.addMenuItems(this.params.subMenu);
|
40398 | ePopup.appendChild(childMenu_1.getGui());
|
40399 |
|
40400 | this.addManagedListener(childMenu_1, AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED, function (e) { return _this.dispatchEvent(e); });
|
40401 | childMenu_1.addGuiEventListener('mouseenter', function () { return _this.cancelDeactivate(); });
|
40402 | destroySubMenu = function () { return _this.destroyBean(childMenu_1); };
|
40403 | if (activateFirstItem) {
|
40404 | setTimeout(function () { return childMenu_1.activateFirstItem(); }, 0);
|
40405 | }
|
40406 | }
|
40407 | else {
|
40408 | var subMenu_1 = this.params.subMenu;
|
40409 | var menuPanel = this.createBean(new AgMenuPanel(subMenu_1));
|
40410 | menuPanel.setParentComponent(this);
|
40411 | var subMenuGui_1 = menuPanel.getGui();
|
40412 | var mouseEvent_1 = 'mouseenter';
|
40413 | var mouseEnterListener_1 = function () { return _this.cancelDeactivate(); };
|
40414 | subMenuGui_1.addEventListener(mouseEvent_1, mouseEnterListener_1);
|
40415 | destroySubMenu = function () { return subMenuGui_1.removeEventListener(mouseEvent_1, mouseEnterListener_1); };
|
40416 | ePopup.appendChild(subMenuGui_1);
|
40417 | if (subMenu_1.afterGuiAttached) {
|
40418 | setTimeout(function () { return subMenu_1.afterGuiAttached(); }, 0);
|
40419 | }
|
40420 | }
|
40421 | var eGui = this.getGui();
|
40422 | var positionCallback = this.popupService.positionPopupForMenu.bind(this.popupService, { eventSource: eGui, ePopup: ePopup });
|
40423 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
40424 | var addPopupRes = this.popupService.addPopup({
|
40425 | modal: true,
|
40426 | eChild: ePopup,
|
40427 | positionCallback: positionCallback,
|
40428 | anchorToElement: eGui,
|
40429 | ariaLabel: translate('ariaLabelSubMenu', 'SubMenu')
|
40430 | });
|
40431 | this.subMenuIsOpen = true;
|
40432 | setAriaExpanded(eGui, true);
|
40433 | this.hideSubMenu = function () {
|
40434 | if (addPopupRes) {
|
40435 | addPopupRes.hideFunc();
|
40436 | }
|
40437 | _this.subMenuIsOpen = false;
|
40438 | setAriaExpanded(eGui, false);
|
40439 | destroySubMenu();
|
40440 | };
|
40441 | };
|
40442 | AgMenuItemComponent.prototype.closeSubMenu = function () {
|
40443 | if (!this.hideSubMenu) {
|
40444 | return;
|
40445 | }
|
40446 | this.hideSubMenu();
|
40447 | this.hideSubMenu = null;
|
40448 | setAriaExpanded(this.getGui(), false);
|
40449 | };
|
40450 | AgMenuItemComponent.prototype.isSubMenuOpen = function () {
|
40451 | return this.subMenuIsOpen;
|
40452 | };
|
40453 | AgMenuItemComponent.prototype.activate = function (openSubMenu) {
|
40454 | var _this = this;
|
40455 | this.cancelActivate();
|
40456 | if (this.params.disabled) {
|
40457 | return;
|
40458 | }
|
40459 | this.isActive = true;
|
40460 | this.addCssClass(this.getClassName('active'));
|
40461 | this.getGui().focus();
|
40462 | if (openSubMenu && this.params.subMenu) {
|
40463 | window.setTimeout(function () {
|
40464 | if (_this.isAlive() && _this.isActive) {
|
40465 | _this.openSubMenu();
|
40466 | }
|
40467 | }, 300);
|
40468 | }
|
40469 | this.onItemActivated();
|
40470 | };
|
40471 | AgMenuItemComponent.prototype.deactivate = function () {
|
40472 | this.cancelDeactivate();
|
40473 | this.removeCssClass(this.getClassName('active'));
|
40474 | this.isActive = false;
|
40475 | if (this.subMenuIsOpen) {
|
40476 | this.hideSubMenu();
|
40477 | }
|
40478 | };
|
40479 | AgMenuItemComponent.prototype.addIcon = function () {
|
40480 | if (!this.params.checked && !this.params.icon && this.params.isCompact) {
|
40481 | return;
|
40482 | }
|
40483 | var icon = loadTemplate( "<span ref=\"eIcon\" class=\"" + this.getClassName('part') + " " + this.getClassName('icon') + "\" role=\"presentation\"></span>");
|
40484 | if (this.params.checked) {
|
40485 | icon.appendChild(createIconNoSpan('check', this.gridOptionsWrapper));
|
40486 | }
|
40487 | else if (this.params.icon) {
|
40488 | if (isNodeOrElement(this.params.icon)) {
|
40489 | icon.appendChild(this.params.icon);
|
40490 | }
|
40491 | else if (typeof this.params.icon === 'string') {
|
40492 | icon.innerHTML = this.params.icon;
|
40493 | }
|
40494 | else {
|
40495 | console.warn('AG Grid: menu item icon must be DOM node or string');
|
40496 | }
|
40497 | }
|
40498 | this.getGui().appendChild(icon);
|
40499 | };
|
40500 | AgMenuItemComponent.prototype.addName = function () {
|
40501 | if (!this.params.name && this.params.isCompact) {
|
40502 | return;
|
40503 | }
|
40504 | var name = loadTemplate( "<span ref=\"eName\" class=\"" + this.getClassName('part') + " " + this.getClassName('text') + "\">" + (this.params.name || '') + "</span>");
|
40505 | this.getGui().appendChild(name);
|
40506 | };
|
40507 | AgMenuItemComponent.prototype.addTooltip = function () {
|
40508 | if (!this.params.tooltip) {
|
40509 | return;
|
40510 | }
|
40511 | this.tooltip = this.params.tooltip;
|
40512 | if (this.gridOptionsWrapper.isEnableBrowserTooltips()) {
|
40513 | this.getGui().setAttribute('title', this.tooltip);
|
40514 | }
|
40515 | else {
|
40516 | this.createManagedBean(new CustomTooltipFeature(this));
|
40517 | }
|
40518 | };
|
40519 | AgMenuItemComponent.prototype.getTooltipParams = function () {
|
40520 | return {
|
40521 | location: 'menu',
|
40522 | value: this.tooltip
|
40523 | };
|
40524 | };
|
40525 | AgMenuItemComponent.prototype.addShortcut = function () {
|
40526 | if (!this.params.shortcut && this.params.isCompact) {
|
40527 | return;
|
40528 | }
|
40529 | var shortcut = loadTemplate( "<span ref=\"eShortcut\" class=\"" + this.getClassName('part') + " " + this.getClassName('shortcut') + "\">" + (this.params.shortcut || '') + "</span>");
|
40530 | this.getGui().appendChild(shortcut);
|
40531 | };
|
40532 | AgMenuItemComponent.prototype.addSubMenu = function () {
|
40533 | if (!this.params.subMenu && this.params.isCompact) {
|
40534 | return;
|
40535 | }
|
40536 | var pointer = loadTemplate( "<span ref=\"ePopupPointer\" class=\"" + this.getClassName('part') + " " + this.getClassName('popup-pointer') + "\"></span>");
|
40537 | var eGui = this.getGui();
|
40538 | if (this.params.subMenu) {
|
40539 | var iconName = this.gridOptionsWrapper.isEnableRtl() ? 'smallLeft' : 'smallRight';
|
40540 | setAriaExpanded(eGui, false);
|
40541 | pointer.appendChild(createIconNoSpan(iconName, this.gridOptionsWrapper));
|
40542 | }
|
40543 | eGui.appendChild(pointer);
|
40544 | };
|
40545 | AgMenuItemComponent.prototype.onItemSelected = function (event) {
|
40546 | if (this.params.action) {
|
40547 | this.params.action();
|
40548 | }
|
40549 | else {
|
40550 | this.openSubMenu(event && event.type === 'keydown');
|
40551 | }
|
40552 | if (this.params.subMenu && !this.params.action) {
|
40553 | return;
|
40554 | }
|
40555 | var e = {
|
40556 | type: AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED,
|
40557 | action: this.params.action,
|
40558 | checked: this.params.checked,
|
40559 | cssClasses: this.params.cssClasses,
|
40560 | disabled: this.params.disabled,
|
40561 | icon: this.params.icon,
|
40562 | name: this.params.name,
|
40563 | shortcut: this.params.shortcut,
|
40564 | subMenu: this.params.subMenu,
|
40565 | tooltip: this.params.tooltip,
|
40566 | event: event
|
40567 | };
|
40568 | this.dispatchEvent(e);
|
40569 | };
|
40570 | AgMenuItemComponent.prototype.onItemActivated = function () {
|
40571 | var event = {
|
40572 | type: AgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED,
|
40573 | menuItem: this,
|
40574 | };
|
40575 | this.dispatchEvent(event);
|
40576 | };
|
40577 | AgMenuItemComponent.prototype.cancelActivate = function () {
|
40578 | if (this.activateTimeoutId) {
|
40579 | window.clearTimeout(this.activateTimeoutId);
|
40580 | this.activateTimeoutId = 0;
|
40581 | }
|
40582 | };
|
40583 | AgMenuItemComponent.prototype.cancelDeactivate = function () {
|
40584 | if (this.deactivateTimeoutId) {
|
40585 | window.clearTimeout(this.deactivateTimeoutId);
|
40586 | this.deactivateTimeoutId = 0;
|
40587 | }
|
40588 | };
|
40589 | AgMenuItemComponent.prototype.onMouseEnter = function () {
|
40590 | var _this = this;
|
40591 | this.cancelDeactivate();
|
40592 | if (this.params.isAnotherSubMenuOpen()) {
|
40593 |
|
40594 | this.activateTimeoutId = window.setTimeout(function () { return _this.activate(true); }, AgMenuItemComponent.ACTIVATION_DELAY);
|
40595 | }
|
40596 | else {
|
40597 |
|
40598 | this.activate(true);
|
40599 | }
|
40600 | };
|
40601 | AgMenuItemComponent.prototype.onMouseLeave = function () {
|
40602 | var _this = this;
|
40603 | this.cancelActivate();
|
40604 | if (this.isSubMenuOpen()) {
|
40605 |
|
40606 | this.deactivateTimeoutId = window.setTimeout(function () { return _this.deactivate(); }, AgMenuItemComponent.ACTIVATION_DELAY);
|
40607 | }
|
40608 | else {
|
40609 |
|
40610 | this.deactivate();
|
40611 | }
|
40612 | };
|
40613 | AgMenuItemComponent.prototype.getClassName = function (suffix) {
|
40614 | var prefix = this.params.isCompact ? 'ag-compact-menu-option' : 'ag-menu-option';
|
40615 | return suffix ? prefix + "-" + suffix : prefix;
|
40616 | };
|
40617 | AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED = 'menuItemSelected';
|
40618 | AgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED = 'menuItemActivated';
|
40619 | AgMenuItemComponent.ACTIVATION_DELAY = 80;
|
40620 | __decorate$1K([
|
40621 | Autowired('popupService')
|
40622 | ], AgMenuItemComponent.prototype, "popupService", void 0);
|
40623 | __decorate$1K([
|
40624 | PostConstruct
|
40625 | ], AgMenuItemComponent.prototype, "init", null);
|
40626 | return AgMenuItemComponent;
|
40627 | }(Component));
|
40628 |
|
40629 |
|
40630 |
|
40631 |
|
40632 |
|
40633 |
|
40634 |
|
40635 | var __extends$25 = (undefined && undefined.__extends) || (function () {
|
40636 | var extendStatics = function (d, b) {
|
40637 | extendStatics = Object.setPrototypeOf ||
|
40638 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
40639 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
40640 | return extendStatics(d, b);
|
40641 | };
|
40642 | return function (d, b) {
|
40643 | extendStatics(d, b);
|
40644 | function __() { this.constructor = d; }
|
40645 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
40646 | };
|
40647 | })();
|
40648 | var __decorate$1L = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
40649 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
40650 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
40651 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
40652 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
40653 | };
|
40654 | var __read$g = (undefined && undefined.__read) || function (o, n) {
|
40655 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
40656 | if (!m) return o;
|
40657 | var i = m.call(o), r, ar = [], e;
|
40658 | try {
|
40659 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
40660 | }
|
40661 | catch (error) { e = { error: error }; }
|
40662 | finally {
|
40663 | try {
|
40664 | if (r && !r.done && (m = i["return"])) m.call(i);
|
40665 | }
|
40666 | finally { if (e) throw e.error; }
|
40667 | }
|
40668 | return ar;
|
40669 | };
|
40670 | var __spread$c = (undefined && undefined.__spread) || function () {
|
40671 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$g(arguments[i]));
|
40672 | return ar;
|
40673 | };
|
40674 | var FocusService = (function (_super) {
|
40675 | __extends$25(FocusService, _super);
|
40676 | function FocusService() {
|
40677 | return _super !== null && _super.apply(this, arguments) || this;
|
40678 | }
|
40679 | FocusService_1 = FocusService;
|
40680 | |
40681 |
|
40682 |
|
40683 |
|
40684 |
|
40685 |
|
40686 |
|
40687 | FocusService.addKeyboardModeEvents = function (doc, controller) {
|
40688 | var docControllers = FocusService_1.instancesMonitored.get(doc);
|
40689 | if (docControllers && docControllers.length > 0) {
|
40690 | if (docControllers.indexOf(controller) === -1) {
|
40691 | docControllers.push(controller);
|
40692 | }
|
40693 | }
|
40694 | else {
|
40695 | FocusService_1.instancesMonitored.set(doc, [controller]);
|
40696 | doc.addEventListener('keydown', FocusService_1.toggleKeyboardMode);
|
40697 | doc.addEventListener('mousedown', FocusService_1.toggleKeyboardMode);
|
40698 | }
|
40699 | };
|
40700 | |
40701 |
|
40702 |
|
40703 |
|
40704 |
|
40705 |
|
40706 |
|
40707 | FocusService.removeKeyboardModeEvents = function (doc, controller) {
|
40708 | var docControllers = FocusService_1.instancesMonitored.get(doc);
|
40709 | var newControllers = [];
|
40710 | if (docControllers && docControllers.length) {
|
40711 | newControllers = __spread$c(docControllers).filter(function (currentGridCore) { return currentGridCore !== controller; });
|
40712 | FocusService_1.instancesMonitored.set(doc, newControllers);
|
40713 | }
|
40714 | if (newControllers.length === 0) {
|
40715 | doc.removeEventListener('keydown', FocusService_1.toggleKeyboardMode);
|
40716 | doc.removeEventListener('mousedown', FocusService_1.toggleKeyboardMode);
|
40717 | }
|
40718 | };
|
40719 | |
40720 |
|
40721 |
|
40722 |
|
40723 |
|
40724 |
|
40725 |
|
40726 | FocusService.toggleKeyboardMode = function (event) {
|
40727 | var isKeyboardActive = FocusService_1.keyboardModeActive;
|
40728 | var isKeyboardEvent = event.type === 'keydown';
|
40729 | if (isKeyboardEvent) {
|
40730 |
|
40731 | if (event.ctrlKey || event.metaKey || event.altKey) {
|
40732 | return;
|
40733 | }
|
40734 | }
|
40735 | if (isKeyboardActive && isKeyboardEvent || !isKeyboardActive && !isKeyboardEvent) {
|
40736 | return;
|
40737 | }
|
40738 | FocusService_1.keyboardModeActive = isKeyboardEvent;
|
40739 | var doc = event.target.ownerDocument;
|
40740 | if (!doc) {
|
40741 | return;
|
40742 | }
|
40743 | var controllersForDoc = FocusService_1.instancesMonitored.get(doc);
|
40744 | if (controllersForDoc) {
|
40745 | controllersForDoc.forEach(function (controller) {
|
40746 | controller.dispatchEvent({ type: isKeyboardEvent ? Events.EVENT_KEYBOARD_FOCUS : Events.EVENT_MOUSE_FOCUS });
|
40747 | });
|
40748 | }
|
40749 | };
|
40750 | FocusService.prototype.init = function () {
|
40751 | var _this = this;
|
40752 | var clearFocusedCellListener = this.clearFocusedCell.bind(this);
|
40753 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, clearFocusedCellListener);
|
40754 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onColumnEverythingChanged.bind(this));
|
40755 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, clearFocusedCellListener);
|
40756 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, clearFocusedCellListener);
|
40757 | this.ctrlsService.whenReady(function (p) {
|
40758 | _this.gridCtrl = p.gridCtrl;
|
40759 | var doc = _this.gridOptionsWrapper.getDocument();
|
40760 | FocusService_1.addKeyboardModeEvents(doc, _this.gridCtrl);
|
40761 | _this.addDestroyFunc(function () { return _this.unregisterGridCompController(_this.gridCtrl); });
|
40762 | });
|
40763 | };
|
40764 | FocusService.prototype.unregisterGridCompController = function (gridCompController) {
|
40765 | var doc = this.gridOptionsWrapper.getDocument();
|
40766 | FocusService_1.removeKeyboardModeEvents(doc, gridCompController);
|
40767 | };
|
40768 | FocusService.prototype.onColumnEverythingChanged = function () {
|
40769 |
|
40770 |
|
40771 | if (!this.focusedCellPosition) {
|
40772 | return;
|
40773 | }
|
40774 | var col = this.focusedCellPosition.column;
|
40775 | var colFromColumnModel = this.columnModel.getGridColumn(col.getId());
|
40776 | if (col !== colFromColumnModel) {
|
40777 | this.clearFocusedCell();
|
40778 | }
|
40779 | };
|
40780 | FocusService.prototype.isKeyboardMode = function () {
|
40781 | return FocusService_1.keyboardModeActive;
|
40782 | };
|
40783 |
|
40784 |
|
40785 |
|
40786 |
|
40787 |
|
40788 |
|
40789 |
|
40790 | FocusService.prototype.getFocusCellToUseAfterRefresh = function () {
|
40791 | var eDocument = this.gridOptionsWrapper.getDocument();
|
40792 | if (this.gridOptionsWrapper.isSuppressFocusAfterRefresh() || !this.focusedCellPosition) {
|
40793 | return null;
|
40794 | }
|
40795 |
|
40796 |
|
40797 |
|
40798 | if (this.isDomDataMissingInHierarchy(eDocument.activeElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL)) {
|
40799 | return null;
|
40800 | }
|
40801 | return this.focusedCellPosition;
|
40802 | };
|
40803 | FocusService.prototype.getFocusHeaderToUseAfterRefresh = function () {
|
40804 | var eDocument = this.gridOptionsWrapper.getDocument();
|
40805 | if (this.gridOptionsWrapper.isSuppressFocusAfterRefresh() || !this.focusedHeaderPosition) {
|
40806 | return null;
|
40807 | }
|
40808 |
|
40809 |
|
40810 | if (this.isDomDataMissingInHierarchy(eDocument.activeElement, AbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL)) {
|
40811 | return null;
|
40812 | }
|
40813 | return this.focusedHeaderPosition;
|
40814 | };
|
40815 | FocusService.prototype.isDomDataMissingInHierarchy = function (eBrowserCell, key) {
|
40816 | var ePointer = eBrowserCell;
|
40817 | while (ePointer) {
|
40818 | var data = this.gridOptionsWrapper.getDomData(ePointer, key);
|
40819 | if (data) {
|
40820 | return false;
|
40821 | }
|
40822 | ePointer = ePointer.parentNode;
|
40823 | }
|
40824 | return true;
|
40825 | };
|
40826 | FocusService.prototype.clearFocusedCell = function () {
|
40827 | this.focusedCellPosition = null;
|
40828 | this.onCellFocused(false);
|
40829 | };
|
40830 | FocusService.prototype.getFocusedCell = function () {
|
40831 | return this.focusedCellPosition;
|
40832 | };
|
40833 | FocusService.prototype.setFocusedCell = function (rowIndex, colKey, floating, forceBrowserFocus) {
|
40834 | if (forceBrowserFocus === void 0) { forceBrowserFocus = false; }
|
40835 | var gridColumn = this.columnModel.getGridColumn(colKey);
|
40836 |
|
40837 |
|
40838 |
|
40839 | if (!gridColumn) {
|
40840 | this.focusedCellPosition = null;
|
40841 | return;
|
40842 | }
|
40843 | this.focusedCellPosition = gridColumn ? { rowIndex: rowIndex, rowPinned: makeNull(floating), column: gridColumn } : null;
|
40844 | this.onCellFocused(forceBrowserFocus);
|
40845 | };
|
40846 | FocusService.prototype.isCellFocused = function (cellPosition) {
|
40847 | if (this.focusedCellPosition == null) {
|
40848 | return false;
|
40849 | }
|
40850 | return this.focusedCellPosition.column === cellPosition.column &&
|
40851 | this.isRowFocused(cellPosition.rowIndex, cellPosition.rowPinned);
|
40852 | };
|
40853 | FocusService.prototype.isRowNodeFocused = function (rowNode) {
|
40854 | return this.isRowFocused(rowNode.rowIndex, rowNode.rowPinned);
|
40855 | };
|
40856 | FocusService.prototype.isHeaderWrapperFocused = function (headerCtrl) {
|
40857 | if (this.focusedHeaderPosition == null) {
|
40858 | return false;
|
40859 | }
|
40860 | var column = headerCtrl.getColumnGroupChild();
|
40861 | var headerRowIndex = headerCtrl.getRowIndex();
|
40862 | var pinned = headerCtrl.getPinned();
|
40863 | var _a = this.focusedHeaderPosition, focusedColumn = _a.column, focusedHeaderRowIndex = _a.headerRowIndex;
|
40864 | return column === focusedColumn &&
|
40865 | headerRowIndex === focusedHeaderRowIndex &&
|
40866 | pinned == focusedColumn.getPinned();
|
40867 | };
|
40868 | FocusService.prototype.clearFocusedHeader = function () {
|
40869 | this.focusedHeaderPosition = null;
|
40870 | };
|
40871 | FocusService.prototype.getFocusedHeader = function () {
|
40872 | return this.focusedHeaderPosition;
|
40873 | };
|
40874 | FocusService.prototype.setFocusedHeader = function (headerRowIndex, column) {
|
40875 | this.focusedHeaderPosition = { headerRowIndex: headerRowIndex, column: column };
|
40876 | };
|
40877 | FocusService.prototype.focusHeaderPosition = function (params) {
|
40878 | var direction = params.direction, fromTab = params.fromTab, allowUserOverride = params.allowUserOverride, event = params.event;
|
40879 | var headerPosition = params.headerPosition;
|
40880 | if (allowUserOverride) {
|
40881 | var gridOptionsWrapper = this.gridOptionsWrapper;
|
40882 | var currentPosition = this.getFocusedHeader();
|
40883 | var headerRowCount = this.headerNavigationService.getHeaderRowCount();
|
40884 | if (fromTab) {
|
40885 | var userFunc = gridOptionsWrapper.getTabToNextHeaderFunc();
|
40886 | if (userFunc) {
|
40887 | var params_1 = {
|
40888 | backwards: direction === 'Before',
|
40889 | previousHeaderPosition: currentPosition,
|
40890 | nextHeaderPosition: headerPosition,
|
40891 | headerRowCount: headerRowCount,
|
40892 | };
|
40893 | headerPosition = userFunc(params_1);
|
40894 | }
|
40895 | }
|
40896 | else {
|
40897 | var userFunc = gridOptionsWrapper.getNavigateToNextHeaderFunc();
|
40898 | if (userFunc && event) {
|
40899 | var params_2 = {
|
40900 | key: event.key,
|
40901 | previousHeaderPosition: currentPosition,
|
40902 | nextHeaderPosition: headerPosition,
|
40903 | headerRowCount: headerRowCount,
|
40904 | event: event,
|
40905 | };
|
40906 | headerPosition = userFunc(params_2);
|
40907 | }
|
40908 | }
|
40909 | }
|
40910 | if (!headerPosition) {
|
40911 | return false;
|
40912 | }
|
40913 | if (headerPosition.headerRowIndex === -1) {
|
40914 | return this.focusGridView(headerPosition.column);
|
40915 | }
|
40916 | this.headerNavigationService.scrollToColumn(headerPosition.column, direction);
|
40917 | var headerRowContainerCtrl = this.ctrlsService.getHeaderRowContainerCtrl(headerPosition.column.getPinned());
|
40918 |
|
40919 | var focusSuccess = headerRowContainerCtrl.focusHeader(headerPosition.headerRowIndex, headerPosition.column, event);
|
40920 | return focusSuccess;
|
40921 | };
|
40922 | FocusService.prototype.focusFirstHeader = function () {
|
40923 | var firstColumn = this.columnModel.getAllDisplayedColumns()[0];
|
40924 | if (!firstColumn) {
|
40925 | return false;
|
40926 | }
|
40927 | if (firstColumn.getParent()) {
|
40928 | firstColumn = this.columnModel.getColumnGroupAtLevel(firstColumn, 0);
|
40929 | }
|
40930 | return this.focusHeaderPosition({
|
40931 | headerPosition: { headerRowIndex: 0, column: firstColumn }
|
40932 | });
|
40933 | };
|
40934 | FocusService.prototype.focusLastHeader = function (event) {
|
40935 | var headerRowIndex = this.headerNavigationService.getHeaderRowCount() - 1;
|
40936 | var column = last(this.columnModel.getAllDisplayedColumns());
|
40937 | return this.focusHeaderPosition({
|
40938 | headerPosition: { headerRowIndex: headerRowIndex, column: column },
|
40939 | event: event
|
40940 | });
|
40941 | };
|
40942 | FocusService.prototype.isAnyCellFocused = function () {
|
40943 | return !!this.focusedCellPosition;
|
40944 | };
|
40945 | FocusService.prototype.isRowFocused = function (rowIndex, floating) {
|
40946 | if (this.focusedCellPosition == null) {
|
40947 | return false;
|
40948 | }
|
40949 | return this.focusedCellPosition.rowIndex === rowIndex && this.focusedCellPosition.rowPinned === makeNull(floating);
|
40950 | };
|
40951 | FocusService.prototype.findFocusableElements = function (rootNode, exclude, onlyUnmanaged) {
|
40952 | if (onlyUnmanaged === void 0) { onlyUnmanaged = false; }
|
40953 | var focusableString = Constants.FOCUSABLE_SELECTOR;
|
40954 | var excludeString = Constants.FOCUSABLE_EXCLUDE;
|
40955 | if (exclude) {
|
40956 | excludeString += ', ' + exclude;
|
40957 | }
|
40958 | if (onlyUnmanaged) {
|
40959 | excludeString += ', [tabindex="-1"]';
|
40960 | }
|
40961 | var nodes = Array.prototype.slice.apply(rootNode.querySelectorAll(focusableString));
|
40962 | var excludeNodes = Array.prototype.slice.apply(rootNode.querySelectorAll(excludeString));
|
40963 | if (!excludeNodes.length) {
|
40964 | return nodes;
|
40965 | }
|
40966 | var diff = function (a, b) { return a.filter(function (element) { return b.indexOf(element) === -1; }); };
|
40967 | return diff(nodes, excludeNodes);
|
40968 | };
|
40969 | FocusService.prototype.focusInto = function (rootNode, up, onlyUnmanaged) {
|
40970 | if (up === void 0) { up = false; }
|
40971 | if (onlyUnmanaged === void 0) { onlyUnmanaged = false; }
|
40972 | var focusableElements = this.findFocusableElements(rootNode, null, onlyUnmanaged);
|
40973 | var toFocus = up ? last(focusableElements) : focusableElements[0];
|
40974 | if (toFocus) {
|
40975 | toFocus.focus();
|
40976 | return true;
|
40977 | }
|
40978 | return false;
|
40979 | };
|
40980 | FocusService.prototype.findNextFocusableElement = function (rootNode, onlyManaged, backwards) {
|
40981 | if (rootNode === void 0) { rootNode = this.eGridDiv; }
|
40982 | var focusable = this.findFocusableElements(rootNode, onlyManaged ? ':not([tabindex="-1"])' : null);
|
40983 | var eDocument = this.gridOptionsWrapper.getDocument();
|
40984 | var activeEl = eDocument.activeElement;
|
40985 | var currentIndex;
|
40986 | if (onlyManaged) {
|
40987 | currentIndex = focusable.findIndex(function (el) { return el.contains(activeEl); });
|
40988 | }
|
40989 | else {
|
40990 | currentIndex = focusable.indexOf(activeEl);
|
40991 | }
|
40992 | var nextIndex = currentIndex + (backwards ? -1 : 1);
|
40993 | if (nextIndex < 0 || nextIndex >= focusable.length) {
|
40994 | return null;
|
40995 | }
|
40996 | return focusable[nextIndex];
|
40997 | };
|
40998 | FocusService.prototype.isFocusUnderManagedComponent = function (rootNode) {
|
40999 | var eDocument = this.gridOptionsWrapper.getDocument();
|
41000 | var managedContainers = rootNode.querySelectorAll("." + ManagedFocusFeature.FOCUS_MANAGED_CLASS);
|
41001 | if (!managedContainers.length) {
|
41002 | return false;
|
41003 | }
|
41004 | for (var i = 0; i < managedContainers.length; i++) {
|
41005 | if (managedContainers[i].contains(eDocument.activeElement)) {
|
41006 | return true;
|
41007 | }
|
41008 | }
|
41009 | return false;
|
41010 | };
|
41011 | FocusService.prototype.findTabbableParent = function (node, limit) {
|
41012 | if (limit === void 0) { limit = 5; }
|
41013 | var counter = 0;
|
41014 | while (node && getTabIndex(node) === null && ++counter <= limit) {
|
41015 | node = node.parentElement;
|
41016 | }
|
41017 | if (getTabIndex(node) === null) {
|
41018 | return null;
|
41019 | }
|
41020 | return node;
|
41021 | };
|
41022 | FocusService.prototype.onCellFocused = function (forceBrowserFocus) {
|
41023 | var event = {
|
41024 | type: Events.EVENT_CELL_FOCUSED,
|
41025 | forceBrowserFocus: forceBrowserFocus,
|
41026 | rowIndex: null,
|
41027 | column: null,
|
41028 | floating: null,
|
41029 | api: this.gridApi,
|
41030 | columnApi: this.columnApi,
|
41031 | rowPinned: null,
|
41032 | isFullWidthCell: false
|
41033 | };
|
41034 | if (this.focusedCellPosition) {
|
41035 | var rowIndex = event.rowIndex = this.focusedCellPosition.rowIndex;
|
41036 | var rowPinned = event.rowPinned = this.focusedCellPosition.rowPinned;
|
41037 | event.column = this.focusedCellPosition.column;
|
41038 | var rowCtrl = this.rowRenderer.getRowByPosition({ rowIndex: rowIndex, rowPinned: rowPinned });
|
41039 | if (rowCtrl) {
|
41040 | event.isFullWidthCell = rowCtrl.isFullWidth();
|
41041 | }
|
41042 | }
|
41043 | this.eventService.dispatchEvent(event);
|
41044 | };
|
41045 | FocusService.prototype.focusGridView = function (column, backwards) {
|
41046 |
|
41047 |
|
41048 |
|
41049 | if (this.gridOptionsWrapper.isSuppressCellFocus()) {
|
41050 | if (backwards) {
|
41051 | return this.focusLastHeader();
|
41052 | }
|
41053 | return this.focusNextGridCoreContainer(false);
|
41054 | }
|
41055 | var nextRow = backwards
|
41056 | ? this.rowPositionUtils.getLastRow()
|
41057 | : this.rowPositionUtils.getFirstRow();
|
41058 | if (!nextRow) {
|
41059 | return false;
|
41060 | }
|
41061 | var rowIndex = nextRow.rowIndex, rowPinned = nextRow.rowPinned;
|
41062 | var focusedHeader = this.getFocusedHeader();
|
41063 | if (!column && focusedHeader) {
|
41064 | column = focusedHeader.column;
|
41065 | }
|
41066 | if (rowIndex == null || !column) {
|
41067 | return false;
|
41068 | }
|
41069 | this.navigationService.ensureCellVisible({ rowIndex: rowIndex, column: column, rowPinned: rowPinned });
|
41070 | this.setFocusedCell(rowIndex, column, makeNull(rowPinned), true);
|
41071 | if (this.rangeService) {
|
41072 | var cellPosition = { rowIndex: rowIndex, rowPinned: rowPinned, column: column };
|
41073 | this.rangeService.setRangeToCell(cellPosition);
|
41074 | }
|
41075 | return true;
|
41076 | };
|
41077 | FocusService.prototype.focusNextGridCoreContainer = function (backwards) {
|
41078 | if (this.gridCtrl.focusNextInnerContainer(backwards)) {
|
41079 | return true;
|
41080 | }
|
41081 | if (!backwards && !this.gridCtrl.isDetailGrid()) {
|
41082 | this.gridCtrl.forceFocusOutOfContainer();
|
41083 | }
|
41084 | return false;
|
41085 | };
|
41086 | var FocusService_1;
|
41087 | FocusService.AG_KEYBOARD_FOCUS = 'ag-keyboard-focus';
|
41088 | FocusService.keyboardModeActive = false;
|
41089 | FocusService.instancesMonitored = new Map();
|
41090 | __decorate$1L([
|
41091 | Autowired('eGridDiv')
|
41092 | ], FocusService.prototype, "eGridDiv", void 0);
|
41093 | __decorate$1L([
|
41094 | Autowired('columnModel')
|
41095 | ], FocusService.prototype, "columnModel", void 0);
|
41096 | __decorate$1L([
|
41097 | Autowired('headerNavigationService')
|
41098 | ], FocusService.prototype, "headerNavigationService", void 0);
|
41099 | __decorate$1L([
|
41100 | Autowired('columnApi')
|
41101 | ], FocusService.prototype, "columnApi", void 0);
|
41102 | __decorate$1L([
|
41103 | Autowired('gridApi')
|
41104 | ], FocusService.prototype, "gridApi", void 0);
|
41105 | __decorate$1L([
|
41106 | Autowired('rowRenderer')
|
41107 | ], FocusService.prototype, "rowRenderer", void 0);
|
41108 | __decorate$1L([
|
41109 | Autowired('rowPositionUtils')
|
41110 | ], FocusService.prototype, "rowPositionUtils", void 0);
|
41111 | __decorate$1L([
|
41112 | Optional('rangeService')
|
41113 | ], FocusService.prototype, "rangeService", void 0);
|
41114 | __decorate$1L([
|
41115 | Autowired('navigationService')
|
41116 | ], FocusService.prototype, "navigationService", void 0);
|
41117 | __decorate$1L([
|
41118 | Autowired('ctrlsService')
|
41119 | ], FocusService.prototype, "ctrlsService", void 0);
|
41120 | __decorate$1L([
|
41121 | PostConstruct
|
41122 | ], FocusService.prototype, "init", null);
|
41123 | FocusService = FocusService_1 = __decorate$1L([
|
41124 | Bean('focusService')
|
41125 | ], FocusService);
|
41126 | return FocusService;
|
41127 | }(BeanStub));
|
41128 |
|
41129 |
|
41130 |
|
41131 |
|
41132 |
|
41133 |
|
41134 |
|
41135 | var __extends$26 = (undefined && undefined.__extends) || (function () {
|
41136 | var extendStatics = function (d, b) {
|
41137 | extendStatics = Object.setPrototypeOf ||
|
41138 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
41139 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
41140 | return extendStatics(d, b);
|
41141 | };
|
41142 | return function (d, b) {
|
41143 | extendStatics(d, b);
|
41144 | function __() { this.constructor = d; }
|
41145 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
41146 | };
|
41147 | })();
|
41148 | var __decorate$1M = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
41149 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
41150 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
41151 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
41152 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
41153 | };
|
41154 | var DIRECTION;
|
41155 | (function (DIRECTION) {
|
41156 | DIRECTION[DIRECTION["vertical"] = 0] = "vertical";
|
41157 | DIRECTION[DIRECTION["horizontal"] = 1] = "horizontal";
|
41158 | })(DIRECTION || (DIRECTION = {}));
|
41159 | var instanceIdSeq = 0;
|
41160 | var PopupService = (function (_super) {
|
41161 | __extends$26(PopupService, _super);
|
41162 | function PopupService() {
|
41163 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
41164 | _this.popupList = [];
|
41165 | return _this;
|
41166 | }
|
41167 | PopupService.prototype.postConstruct = function () {
|
41168 | var _this = this;
|
41169 | this.ctrlsService.whenReady(function (p) {
|
41170 | _this.gridCtrl = p.gridCtrl;
|
41171 | _this.addManagedListener(_this.gridCtrl, Events.EVENT_KEYBOARD_FOCUS, function () {
|
41172 | _this.popupList.forEach(function (popup) { return popup.element.classList.add(FocusService.AG_KEYBOARD_FOCUS); });
|
41173 | });
|
41174 | _this.addManagedListener(_this.gridCtrl, Events.EVENT_MOUSE_FOCUS, function () {
|
41175 | _this.popupList.forEach(function (popup) { return popup.element.classList.remove(FocusService.AG_KEYBOARD_FOCUS); });
|
41176 | });
|
41177 | });
|
41178 | };
|
41179 | PopupService.prototype.getPopupParent = function () {
|
41180 | var ePopupParent = this.gridOptionsWrapper.getPopupParent();
|
41181 | if (ePopupParent) {
|
41182 | return ePopupParent;
|
41183 | }
|
41184 | return this.gridCtrl.getGui();
|
41185 | };
|
41186 | PopupService.prototype.positionPopupForMenu = function (params) {
|
41187 | var sourceRect = params.eventSource.getBoundingClientRect();
|
41188 | var parentRect = this.getParentRect();
|
41189 | var y = this.keepXYWithinBounds(params.ePopup, sourceRect.top - parentRect.top, DIRECTION.vertical);
|
41190 | var minWidth = (params.ePopup.clientWidth > 0) ? params.ePopup.clientWidth : 200;
|
41191 | params.ePopup.style.minWidth = minWidth + "px";
|
41192 | var widthOfParent = parentRect.right - parentRect.left;
|
41193 | var maxX = widthOfParent - minWidth;
|
41194 |
|
41195 |
|
41196 |
|
41197 | var x;
|
41198 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
41199 |
|
41200 | x = xLeftPosition();
|
41201 | if (x < 0) {
|
41202 | x = xRightPosition();
|
41203 | }
|
41204 | if (x > maxX) {
|
41205 | x = 0;
|
41206 | }
|
41207 | }
|
41208 | else {
|
41209 |
|
41210 | x = xRightPosition();
|
41211 | if (x > maxX) {
|
41212 | x = xLeftPosition();
|
41213 | }
|
41214 | if (x < 0) {
|
41215 | x = 0;
|
41216 | }
|
41217 | }
|
41218 | params.ePopup.style.left = x + "px";
|
41219 | params.ePopup.style.top = y + "px";
|
41220 | function xRightPosition() {
|
41221 | return sourceRect.right - parentRect.left - 2;
|
41222 | }
|
41223 | function xLeftPosition() {
|
41224 | return sourceRect.left - parentRect.left - minWidth;
|
41225 | }
|
41226 | };
|
41227 | PopupService.prototype.positionPopupUnderMouseEvent = function (params) {
|
41228 | var ePopup = params.ePopup, nudgeX = params.nudgeX, nudgeY = params.nudgeY;
|
41229 | var _a = this.calculatePointerAlign(params.mouseEvent), x = _a.x, y = _a.y;
|
41230 | this.positionPopup({
|
41231 | ePopup: ePopup,
|
41232 | x: x,
|
41233 | y: y,
|
41234 | nudgeX: nudgeX,
|
41235 | nudgeY: nudgeY,
|
41236 | keepWithinBounds: true
|
41237 | });
|
41238 | this.callPostProcessPopup(params.type, params.ePopup, null, params.mouseEvent, params.column, params.rowNode);
|
41239 | };
|
41240 | PopupService.prototype.calculatePointerAlign = function (e) {
|
41241 | var parentRect = this.getParentRect();
|
41242 | return {
|
41243 | x: e.clientX - parentRect.left,
|
41244 | y: e.clientY - parentRect.top
|
41245 | };
|
41246 | };
|
41247 | PopupService.prototype.positionPopupUnderComponent = function (params) {
|
41248 | var sourceRect = params.eventSource.getBoundingClientRect();
|
41249 | var alignSide = params.alignSide || 'left';
|
41250 | var parentRect = this.getParentRect();
|
41251 | var x = sourceRect.left - parentRect.left;
|
41252 | if (alignSide === 'right') {
|
41253 | x -= (params.ePopup.offsetWidth - sourceRect.width);
|
41254 | }
|
41255 | this.positionPopup({
|
41256 | ePopup: params.ePopup,
|
41257 | nudgeX: params.nudgeX,
|
41258 | nudgeY: params.nudgeY,
|
41259 | x: x,
|
41260 | y: sourceRect.top - parentRect.top + sourceRect.height,
|
41261 | keepWithinBounds: params.keepWithinBounds
|
41262 | });
|
41263 | this.callPostProcessPopup(params.type, params.ePopup, params.eventSource, null, params.column, params.rowNode);
|
41264 | };
|
41265 | PopupService.prototype.positionPopupOverComponent = function (params) {
|
41266 | var sourceRect = params.eventSource.getBoundingClientRect();
|
41267 | var parentRect = this.getParentRect();
|
41268 | this.positionPopup({
|
41269 | ePopup: params.ePopup,
|
41270 | nudgeX: params.nudgeX,
|
41271 | nudgeY: params.nudgeY,
|
41272 | x: sourceRect.left - parentRect.left,
|
41273 | y: sourceRect.top - parentRect.top,
|
41274 | keepWithinBounds: params.keepWithinBounds
|
41275 | });
|
41276 | this.callPostProcessPopup(params.type, params.ePopup, params.eventSource, null, params.column, params.rowNode);
|
41277 | };
|
41278 | PopupService.prototype.callPostProcessPopup = function (type, ePopup, eventSource, mouseEvent, column, rowNode) {
|
41279 | var callback = this.gridOptionsWrapper.getPostProcessPopupFunc();
|
41280 | if (callback) {
|
41281 | var params = {
|
41282 | column: column,
|
41283 | rowNode: rowNode,
|
41284 | ePopup: ePopup,
|
41285 | type: type,
|
41286 | eventSource: eventSource,
|
41287 | mouseEvent: mouseEvent
|
41288 | };
|
41289 | callback(params);
|
41290 | }
|
41291 | };
|
41292 | PopupService.prototype.positionPopup = function (params) {
|
41293 | var ePopup = params.ePopup, keepWithinBounds = params.keepWithinBounds, nudgeX = params.nudgeX, nudgeY = params.nudgeY;
|
41294 | var x = params.x, y = params.y;
|
41295 | if (nudgeX) {
|
41296 | x += nudgeX;
|
41297 | }
|
41298 | if (nudgeY) {
|
41299 | y += nudgeY;
|
41300 | }
|
41301 |
|
41302 | if (keepWithinBounds) {
|
41303 | x = this.keepXYWithinBounds(ePopup, x, DIRECTION.horizontal);
|
41304 | y = this.keepXYWithinBounds(ePopup, y, DIRECTION.vertical);
|
41305 | }
|
41306 | ePopup.style.left = x + "px";
|
41307 | ePopup.style.top = y + "px";
|
41308 | };
|
41309 | PopupService.prototype.getActivePopups = function () {
|
41310 | return this.popupList.map(function (popup) { return popup.element; });
|
41311 | };
|
41312 | PopupService.prototype.getPopupList = function () {
|
41313 | return this.popupList;
|
41314 | };
|
41315 | PopupService.prototype.getParentRect = function () {
|
41316 |
|
41317 |
|
41318 |
|
41319 |
|
41320 | var eDocument = this.gridOptionsWrapper.getDocument();
|
41321 | var popupParent = this.getPopupParent();
|
41322 | if (popupParent === eDocument.body) {
|
41323 | popupParent = eDocument.documentElement;
|
41324 | }
|
41325 | var style = getComputedStyle(popupParent);
|
41326 | var bounds = popupParent.getBoundingClientRect();
|
41327 | return {
|
41328 | top: bounds.top + parseFloat(style.borderTopWidth) || 0,
|
41329 | left: bounds.left + parseFloat(style.borderLeftWidth) || 0,
|
41330 | right: bounds.right + parseFloat(style.borderRightWidth) || 0,
|
41331 | bottom: bounds.bottom + parseFloat(style.borderBottomWidth) || 0,
|
41332 | };
|
41333 | };
|
41334 | PopupService.prototype.keepXYWithinBounds = function (ePopup, position, direction) {
|
41335 | var isVertical = direction === DIRECTION.vertical;
|
41336 | var sizeProperty = isVertical ? 'clientHeight' : 'clientWidth';
|
41337 | var anchorProperty = isVertical ? 'top' : 'left';
|
41338 | var offsetProperty = isVertical ? 'offsetHeight' : 'offsetWidth';
|
41339 | var scrollPositionProperty = isVertical ? 'scrollTop' : 'scrollLeft';
|
41340 | var eDocument = this.gridOptionsWrapper.getDocument();
|
41341 | var docElement = eDocument.documentElement;
|
41342 | var popupParent = this.getPopupParent();
|
41343 | var parentRect = popupParent.getBoundingClientRect();
|
41344 | var documentRect = eDocument.documentElement.getBoundingClientRect();
|
41345 | var isBody = popupParent === eDocument.body;
|
41346 | var offsetSize = ePopup[offsetProperty];
|
41347 | var getSize = isVertical ? getAbsoluteHeight : getAbsoluteWidth;
|
41348 | var sizeOfParent = isBody ? (getSize(docElement) + docElement[scrollPositionProperty]) : popupParent[sizeProperty];
|
41349 | if (isBody) {
|
41350 | sizeOfParent -= Math.abs(documentRect[anchorProperty] - parentRect[anchorProperty]);
|
41351 | }
|
41352 | var max = sizeOfParent - offsetSize;
|
41353 | return Math.min(Math.max(position, 0), Math.abs(max));
|
41354 | };
|
41355 | PopupService.prototype.keepPopupPositionedRelativeTo = function (params) {
|
41356 | var _this = this;
|
41357 | var eParent = this.getPopupParent();
|
41358 | var parentRect = eParent.getBoundingClientRect();
|
41359 | var sourceRect = params.element.getBoundingClientRect();
|
41360 | var initialDiffTop = parentRect.top - sourceRect.top;
|
41361 | var initialDiffLeft = parentRect.left - sourceRect.left;
|
41362 | var lastDiffTop = initialDiffTop;
|
41363 | var lastDiffLeft = initialDiffLeft;
|
41364 | var topPx = params.ePopup.style.top;
|
41365 | var top = parseInt(topPx.substring(0, topPx.length - 1), 10);
|
41366 | var leftPx = params.ePopup.style.left;
|
41367 | var left = parseInt(leftPx.substring(0, leftPx.length - 1), 10);
|
41368 | return new AgPromise(function (resolve) {
|
41369 | _this.getFrameworkOverrides().setInterval(function () {
|
41370 | var pRect = eParent.getBoundingClientRect();
|
41371 | var sRect = params.element.getBoundingClientRect();
|
41372 | var elementNotInDom = sRect.top == 0 && sRect.left == 0 && sRect.height == 0 && sRect.width == 0;
|
41373 | if (elementNotInDom) {
|
41374 | params.hidePopup();
|
41375 | return;
|
41376 | }
|
41377 | var currentDiffTop = pRect.top - sRect.top;
|
41378 | if (currentDiffTop != lastDiffTop) {
|
41379 | var newTop = _this.keepXYWithinBounds(params.ePopup, top + initialDiffTop - currentDiffTop, DIRECTION.vertical);
|
41380 | params.ePopup.style.top = newTop + "px";
|
41381 | }
|
41382 | lastDiffTop = currentDiffTop;
|
41383 | var currentDiffLeft = pRect.left - sRect.left;
|
41384 | if (currentDiffLeft != lastDiffLeft) {
|
41385 | var newLeft = _this.keepXYWithinBounds(params.ePopup, left + initialDiffLeft - currentDiffLeft, DIRECTION.horizontal);
|
41386 | params.ePopup.style.left = newLeft + "px";
|
41387 | }
|
41388 | lastDiffLeft = currentDiffLeft;
|
41389 | }, 200).then(function (intervalId) {
|
41390 | var result = function () {
|
41391 | if (intervalId != null) {
|
41392 | window.clearInterval(intervalId);
|
41393 | }
|
41394 | };
|
41395 | resolve(result);
|
41396 | });
|
41397 | });
|
41398 | };
|
41399 | PopupService.prototype.addPopup = function (params) {
|
41400 | var _this = this;
|
41401 | 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;
|
41402 | var eDocument = this.gridOptionsWrapper.getDocument();
|
41403 | var destroyPositionTracker = new AgPromise(function (resolve) { return resolve(function () { }); });
|
41404 | if (!eDocument) {
|
41405 | console.warn('ag-grid: could not find the document, document is empty');
|
41406 | return { hideFunc: function () { }, stopAnchoringPromise: destroyPositionTracker };
|
41407 | }
|
41408 | var pos = this.popupList.findIndex(function (popup) { return popup.element === eChild; });
|
41409 | if (pos !== -1) {
|
41410 | var popup = this.popupList[pos];
|
41411 | return { hideFunc: popup.hideFunc, stopAnchoringPromise: popup.stopAnchoringPromise };
|
41412 | }
|
41413 | var ePopupParent = this.getPopupParent();
|
41414 | if (eChild.style.top == null) {
|
41415 | eChild.style.top = '0px';
|
41416 | }
|
41417 | if (eChild.style.left == null) {
|
41418 | eChild.style.left = '0px';
|
41419 | }
|
41420 |
|
41421 |
|
41422 | var eWrapper = document.createElement('div');
|
41423 | var theme = this.environment.getTheme().theme;
|
41424 | if (theme) {
|
41425 | eWrapper.classList.add(theme);
|
41426 | }
|
41427 | eWrapper.classList.add('ag-popup');
|
41428 | eChild.classList.add(this.gridOptionsWrapper.isEnableRtl() ? 'ag-rtl' : 'ag-ltr', 'ag-popup-child');
|
41429 | if (!eChild.hasAttribute('role')) {
|
41430 | setAriaRole(eChild, 'dialog');
|
41431 | }
|
41432 | setAriaLabel(eChild, ariaLabel);
|
41433 | if (this.focusService.isKeyboardMode()) {
|
41434 | eChild.classList.add(FocusService.AG_KEYBOARD_FOCUS);
|
41435 | }
|
41436 | eWrapper.appendChild(eChild);
|
41437 | ePopupParent.appendChild(eWrapper);
|
41438 | if (alwaysOnTop) {
|
41439 | this.setAlwaysOnTop(eWrapper, true);
|
41440 | }
|
41441 | else {
|
41442 | this.bringPopupToFront(eWrapper);
|
41443 | }
|
41444 | var popupHidden = false;
|
41445 | var hidePopupOnKeyboardEvent = function (event) {
|
41446 | if (!eWrapper.contains(eDocument.activeElement)) {
|
41447 | return;
|
41448 | }
|
41449 | var key = event.key;
|
41450 | if (key === KeyCode.ESCAPE) {
|
41451 | hidePopup({ keyboardEvent: event });
|
41452 | }
|
41453 | };
|
41454 | var hidePopupOnMouseEvent = function (event) { return hidePopup({ mouseEvent: event }); };
|
41455 | var hidePopupOnTouchEvent = function (event) { return hidePopup({ touchEvent: event }); };
|
41456 | var hidePopup = function (popupParams) {
|
41457 | if (popupParams === void 0) { popupParams = {}; }
|
41458 | var mouseEvent = popupParams.mouseEvent, touchEvent = popupParams.touchEvent, keyboardEvent = popupParams.keyboardEvent;
|
41459 | if (
|
41460 |
|
41461 |
|
41462 | _this.isEventFromCurrentPopup({ mouseEvent: mouseEvent, touchEvent: touchEvent }, eChild) ||
|
41463 |
|
41464 | _this.isEventSameChainAsOriginalEvent({ originalMouseEvent: click, mouseEvent: mouseEvent, touchEvent: touchEvent }) ||
|
41465 |
|
41466 |
|
41467 | popupHidden) {
|
41468 | return;
|
41469 | }
|
41470 | popupHidden = true;
|
41471 | ePopupParent.removeChild(eWrapper);
|
41472 | eDocument.removeEventListener('keydown', hidePopupOnKeyboardEvent);
|
41473 | eDocument.removeEventListener('mousedown', hidePopupOnMouseEvent);
|
41474 | eDocument.removeEventListener('touchstart', hidePopupOnTouchEvent);
|
41475 | eDocument.removeEventListener('contextmenu', hidePopupOnMouseEvent);
|
41476 | _this.eventService.removeEventListener(Events.EVENT_DRAG_STARTED, hidePopupOnMouseEvent);
|
41477 | if (closedCallback) {
|
41478 | closedCallback(mouseEvent || touchEvent || keyboardEvent);
|
41479 | }
|
41480 | _this.popupList = _this.popupList.filter(function (popup) { return popup.element !== eChild; });
|
41481 | if (destroyPositionTracker) {
|
41482 | destroyPositionTracker.then(function (destroyFunc) { return destroyFunc && destroyFunc(); });
|
41483 | }
|
41484 | };
|
41485 | if (afterGuiAttached) {
|
41486 | afterGuiAttached({ hidePopup: hidePopup });
|
41487 | }
|
41488 |
|
41489 |
|
41490 | window.setTimeout(function () {
|
41491 | if (closeOnEsc) {
|
41492 | eDocument.addEventListener('keydown', hidePopupOnKeyboardEvent);
|
41493 | }
|
41494 | if (modal) {
|
41495 | eDocument.addEventListener('mousedown', hidePopupOnMouseEvent);
|
41496 | _this.eventService.addEventListener(Events.EVENT_DRAG_STARTED, hidePopupOnMouseEvent);
|
41497 | eDocument.addEventListener('touchstart', hidePopupOnTouchEvent);
|
41498 | eDocument.addEventListener('contextmenu', hidePopupOnMouseEvent);
|
41499 | }
|
41500 | }, 0);
|
41501 | if (positionCallback) {
|
41502 | positionCallback();
|
41503 | }
|
41504 | if (anchorToElement) {
|
41505 |
|
41506 |
|
41507 | destroyPositionTracker = this.keepPopupPositionedRelativeTo({
|
41508 | element: anchorToElement,
|
41509 | ePopup: eChild,
|
41510 | hidePopup: hidePopup
|
41511 | });
|
41512 | }
|
41513 | this.popupList.push({
|
41514 | element: eChild,
|
41515 | wrapper: eWrapper,
|
41516 | hideFunc: hidePopup,
|
41517 | stopAnchoringPromise: destroyPositionTracker,
|
41518 | instanceId: instanceIdSeq++,
|
41519 | isAnchored: !!anchorToElement
|
41520 | });
|
41521 | return {
|
41522 | hideFunc: hidePopup,
|
41523 | stopAnchoringPromise: destroyPositionTracker
|
41524 | };
|
41525 | };
|
41526 | PopupService.prototype.hasAnchoredPopup = function () {
|
41527 | return this.popupList.some(function (popup) { return popup.isAnchored; });
|
41528 | };
|
41529 | PopupService.prototype.isEventFromCurrentPopup = function (params, target) {
|
41530 | var mouseEvent = params.mouseEvent, touchEvent = params.touchEvent;
|
41531 | var event = mouseEvent ? mouseEvent : touchEvent;
|
41532 | if (!event) {
|
41533 | return false;
|
41534 | }
|
41535 | var indexOfThisChild = this.popupList.findIndex(function (popup) { return popup.element === target; });
|
41536 | if (indexOfThisChild === -1) {
|
41537 | return false;
|
41538 | }
|
41539 | for (var i = indexOfThisChild; i < this.popupList.length; i++) {
|
41540 | var popup = this.popupList[i];
|
41541 | if (isElementInEventPath(popup.element, event)) {
|
41542 | return true;
|
41543 | }
|
41544 | }
|
41545 |
|
41546 |
|
41547 |
|
41548 | return this.isElementWithinCustomPopup(event.target);
|
41549 | };
|
41550 | PopupService.prototype.isElementWithinCustomPopup = function (el) {
|
41551 | var eDocument = this.gridOptionsWrapper.getDocument();
|
41552 | while (el && el !== eDocument.body) {
|
41553 | if (el.classList.contains('ag-custom-component-popup') || el.parentElement === null) {
|
41554 | return true;
|
41555 | }
|
41556 | el = el.parentElement;
|
41557 | }
|
41558 | return false;
|
41559 | };
|
41560 |
|
41561 |
|
41562 | PopupService.prototype.isEventSameChainAsOriginalEvent = function (params) {
|
41563 | var originalMouseEvent = params.originalMouseEvent, mouseEvent = params.mouseEvent, touchEvent = params.touchEvent;
|
41564 |
|
41565 |
|
41566 |
|
41567 |
|
41568 | var mouseEventOrTouch = null;
|
41569 | if (mouseEvent) {
|
41570 |
|
41571 | mouseEventOrTouch = mouseEvent;
|
41572 | }
|
41573 | else if (touchEvent) {
|
41574 |
|
41575 | mouseEventOrTouch = touchEvent.touches[0];
|
41576 | }
|
41577 | if (mouseEventOrTouch && originalMouseEvent) {
|
41578 |
|
41579 |
|
41580 | var screenX_1 = mouseEvent ? mouseEvent.screenX : 0;
|
41581 | var screenY_1 = mouseEvent ? mouseEvent.screenY : 0;
|
41582 | var xMatch = Math.abs(originalMouseEvent.screenX - screenX_1) < 5;
|
41583 | var yMatch = Math.abs(originalMouseEvent.screenY - screenY_1) < 5;
|
41584 | if (xMatch && yMatch) {
|
41585 | return true;
|
41586 | }
|
41587 | }
|
41588 | return false;
|
41589 | };
|
41590 | PopupService.prototype.getWrapper = function (ePopup) {
|
41591 | while (!ePopup.classList.contains('ag-popup') && ePopup.parentElement) {
|
41592 | ePopup = ePopup.parentElement;
|
41593 | }
|
41594 | return ePopup.classList.contains('ag-popup') ? ePopup : null;
|
41595 | };
|
41596 | PopupService.prototype.setAlwaysOnTop = function (ePopup, alwaysOnTop) {
|
41597 | var eWrapper = this.getWrapper(ePopup);
|
41598 | if (!eWrapper) {
|
41599 | return;
|
41600 | }
|
41601 | eWrapper.classList.toggle('ag-always-on-top', !!alwaysOnTop);
|
41602 | if (alwaysOnTop) {
|
41603 | this.bringPopupToFront(eWrapper);
|
41604 | }
|
41605 | };
|
41606 | PopupService.prototype.bringPopupToFront = function (ePopup) {
|
41607 | var parent = this.getPopupParent();
|
41608 | var popupList = Array.prototype.slice.call(parent.querySelectorAll('.ag-popup'));
|
41609 | var popupLen = popupList.length;
|
41610 | var alwaysOnTopList = Array.prototype.slice.call(parent.querySelectorAll('.ag-popup.ag-always-on-top'));
|
41611 | var onTopLength = alwaysOnTopList.length;
|
41612 | var eWrapper = this.getWrapper(ePopup);
|
41613 | if (!eWrapper || popupLen <= 1 || !parent.contains(ePopup)) {
|
41614 | return;
|
41615 | }
|
41616 | var pos = popupList.indexOf(eWrapper);
|
41617 | var innerEls = eWrapper.querySelectorAll('div');
|
41618 | var innerElsScrollMap = [];
|
41619 | innerEls.forEach(function (el) {
|
41620 | if (el.scrollTop !== 0) {
|
41621 | innerElsScrollMap.push([el, el.scrollTop]);
|
41622 | }
|
41623 | });
|
41624 | if (onTopLength) {
|
41625 | var isPopupAlwaysOnTop = eWrapper.classList.contains('ag-always-on-top');
|
41626 | if (isPopupAlwaysOnTop) {
|
41627 | if (pos !== popupLen - 1) {
|
41628 | last(alwaysOnTopList).insertAdjacentElement('afterend', eWrapper);
|
41629 | }
|
41630 | }
|
41631 | else if (pos !== popupLen - onTopLength - 1) {
|
41632 | alwaysOnTopList[0].insertAdjacentElement('beforebegin', eWrapper);
|
41633 | }
|
41634 | }
|
41635 | else if (pos !== popupLen - 1) {
|
41636 | last(popupList).insertAdjacentElement('afterend', eWrapper);
|
41637 | }
|
41638 | while (innerElsScrollMap.length) {
|
41639 | var currentEl = innerElsScrollMap.pop();
|
41640 | currentEl[0].scrollTop = currentEl[1];
|
41641 | }
|
41642 | var params = {
|
41643 | type: 'popupToFront',
|
41644 | api: this.gridOptionsWrapper.getApi(),
|
41645 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
41646 | eWrapper: eWrapper
|
41647 | };
|
41648 | this.eventService.dispatchEvent(params);
|
41649 | };
|
41650 | __decorate$1M([
|
41651 | Autowired('environment')
|
41652 | ], PopupService.prototype, "environment", void 0);
|
41653 | __decorate$1M([
|
41654 | Autowired('focusService')
|
41655 | ], PopupService.prototype, "focusService", void 0);
|
41656 | __decorate$1M([
|
41657 | Autowired('ctrlsService')
|
41658 | ], PopupService.prototype, "ctrlsService", void 0);
|
41659 | __decorate$1M([
|
41660 | PostConstruct
|
41661 | ], PopupService.prototype, "postConstruct", null);
|
41662 | PopupService = __decorate$1M([
|
41663 | Bean('popupService')
|
41664 | ], PopupService);
|
41665 | return PopupService;
|
41666 | }(BeanStub));
|
41667 |
|
41668 |
|
41669 |
|
41670 |
|
41671 |
|
41672 |
|
41673 |
|
41674 | var __extends$27 = (undefined && undefined.__extends) || (function () {
|
41675 | var extendStatics = function (d, b) {
|
41676 | extendStatics = Object.setPrototypeOf ||
|
41677 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
41678 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
41679 | return extendStatics(d, b);
|
41680 | };
|
41681 | return function (d, b) {
|
41682 | extendStatics(d, b);
|
41683 | function __() { this.constructor = d; }
|
41684 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
41685 | };
|
41686 | })();
|
41687 | var __decorate$1N = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
41688 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
41689 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
41690 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
41691 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
41692 | };
|
41693 | var VirtualList = (function (_super) {
|
41694 | __extends$27(VirtualList, _super);
|
41695 | function VirtualList(cssIdentifier, ariaRole, listName) {
|
41696 | if (cssIdentifier === void 0) { cssIdentifier = 'default'; }
|
41697 | if (ariaRole === void 0) { ariaRole = 'listbox'; }
|
41698 | var _this = _super.call(this, VirtualList.getTemplate(cssIdentifier)) || this;
|
41699 | _this.cssIdentifier = cssIdentifier;
|
41700 | _this.ariaRole = ariaRole;
|
41701 | _this.listName = listName;
|
41702 | _this.renderedRows = new Map();
|
41703 | _this.rowHeight = 20;
|
41704 | _this.isDestroyed = false;
|
41705 | return _this;
|
41706 | }
|
41707 | VirtualList.prototype.postConstruct = function () {
|
41708 | var _this = this;
|
41709 | this.addScrollListener();
|
41710 | this.rowHeight = this.getItemHeight();
|
41711 | this.addResizeObserver();
|
41712 | this.initialiseTabGuard({
|
41713 | onFocusIn: function (e) { return _this.onFocusIn(e); },
|
41714 | onFocusOut: function (e) { return _this.onFocusOut(e); },
|
41715 | focusInnerElement: function (fromBottom) { return _this.focusInnerElement(fromBottom); },
|
41716 | onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
|
41717 | handleKeyDown: function (e) { return _this.handleKeyDown(e); }
|
41718 | });
|
41719 | this.setAriaProperties();
|
41720 | };
|
41721 | VirtualList.prototype.setAriaProperties = function () {
|
41722 | var translate = this.gridOptionsWrapper.getLocaleTextFunc();
|
41723 | var listName = translate('ariaDefaultListName', this.listName || 'List');
|
41724 | var ariaEl = this.eContainer;
|
41725 | setAriaRole(ariaEl, this.ariaRole);
|
41726 | setAriaLabel(ariaEl, listName);
|
41727 | };
|
41728 | VirtualList.prototype.addResizeObserver = function () {
|
41729 | var listener = this.drawVirtualRows.bind(this);
|
41730 | var destroyObserver = this.resizeObserverService.observeResize(this.getGui(), listener);
|
41731 | this.addDestroyFunc(destroyObserver);
|
41732 | };
|
41733 | VirtualList.prototype.focusInnerElement = function (fromBottom) {
|
41734 | this.focusRow(fromBottom ? this.model.getRowCount() - 1 : 0);
|
41735 | };
|
41736 | VirtualList.prototype.onFocusIn = function (e) {
|
41737 | var target = e.target;
|
41738 | if (target.classList.contains('ag-virtual-list-item')) {
|
41739 | this.lastFocusedRowIndex = getAriaPosInSet(target) - 1;
|
41740 | }
|
41741 | return false;
|
41742 | };
|
41743 | VirtualList.prototype.onFocusOut = function (e) {
|
41744 | if (!this.getFocusableElement().contains(e.relatedTarget)) {
|
41745 | this.lastFocusedRowIndex = null;
|
41746 | }
|
41747 | return false;
|
41748 | };
|
41749 | VirtualList.prototype.handleKeyDown = function (e) {
|
41750 | switch (e.key) {
|
41751 | case KeyCode.UP:
|
41752 | case KeyCode.DOWN:
|
41753 | if (this.navigate(e.key === KeyCode.UP)) {
|
41754 | e.preventDefault();
|
41755 | }
|
41756 | break;
|
41757 | }
|
41758 | };
|
41759 | VirtualList.prototype.onTabKeyDown = function (e) {
|
41760 | if (this.navigate(e.shiftKey)) {
|
41761 | e.preventDefault();
|
41762 | }
|
41763 | else {
|
41764 |
|
41765 | this.focusService.focusInto(this.getGui(), !e.shiftKey);
|
41766 | }
|
41767 | };
|
41768 | VirtualList.prototype.navigate = function (up) {
|
41769 | if (this.lastFocusedRowIndex == null) {
|
41770 | return false;
|
41771 | }
|
41772 | var nextRow = this.lastFocusedRowIndex + (up ? -1 : 1);
|
41773 | if (nextRow < 0 || nextRow >= this.model.getRowCount()) {
|
41774 | return false;
|
41775 | }
|
41776 | this.focusRow(nextRow);
|
41777 | return true;
|
41778 | };
|
41779 | VirtualList.prototype.getLastFocusedRow = function () {
|
41780 | return this.lastFocusedRowIndex;
|
41781 | };
|
41782 | VirtualList.prototype.focusRow = function (rowNumber) {
|
41783 | var _this = this;
|
41784 | this.ensureIndexVisible(rowNumber);
|
41785 | window.setTimeout(function () {
|
41786 | var renderedRow = _this.renderedRows.get(rowNumber);
|
41787 | if (renderedRow) {
|
41788 | renderedRow.eDiv.focus();
|
41789 | }
|
41790 | }, 10);
|
41791 | };
|
41792 | VirtualList.prototype.getComponentAt = function (rowIndex) {
|
41793 | var comp = this.renderedRows.get(rowIndex);
|
41794 | return comp && comp.rowComponent;
|
41795 | };
|
41796 | VirtualList.getTemplate = function (cssIdentifier) {
|
41797 | 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>";
|
41798 | };
|
41799 | VirtualList.prototype.getItemHeight = function () {
|
41800 | return this.gridOptionsWrapper.getListItemHeight();
|
41801 | };
|
41802 | VirtualList.prototype.ensureIndexVisible = function (index) {
|
41803 | var lastRow = this.model.getRowCount();
|
41804 | if (typeof index !== 'number' || index < 0 || index >= lastRow) {
|
41805 | console.warn('AG Grid: invalid row index for ensureIndexVisible: ' + index);
|
41806 | return;
|
41807 | }
|
41808 | var rowTopPixel = index * this.rowHeight;
|
41809 | var rowBottomPixel = rowTopPixel + this.rowHeight;
|
41810 | var eGui = this.getGui();
|
41811 | var viewportTopPixel = eGui.scrollTop;
|
41812 | var viewportHeight = eGui.offsetHeight;
|
41813 | var viewportBottomPixel = viewportTopPixel + viewportHeight;
|
41814 | var viewportScrolledPastRow = viewportTopPixel > rowTopPixel;
|
41815 | var viewportScrolledBeforeRow = viewportBottomPixel < rowBottomPixel;
|
41816 | if (viewportScrolledPastRow) {
|
41817 |
|
41818 | eGui.scrollTop = rowTopPixel;
|
41819 | }
|
41820 | else if (viewportScrolledBeforeRow) {
|
41821 |
|
41822 | var newScrollPosition = rowBottomPixel - viewportHeight;
|
41823 | eGui.scrollTop = newScrollPosition;
|
41824 | }
|
41825 | };
|
41826 | VirtualList.prototype.setComponentCreator = function (componentCreator) {
|
41827 | this.componentCreator = componentCreator;
|
41828 | };
|
41829 | VirtualList.prototype.getRowHeight = function () {
|
41830 | return this.rowHeight;
|
41831 | };
|
41832 | VirtualList.prototype.getScrollTop = function () {
|
41833 | return this.getGui().scrollTop;
|
41834 | };
|
41835 | VirtualList.prototype.setRowHeight = function (rowHeight) {
|
41836 | this.rowHeight = rowHeight;
|
41837 | this.refresh();
|
41838 | };
|
41839 | VirtualList.prototype.refresh = function () {
|
41840 | var _this = this;
|
41841 | if (this.model == null || this.isDestroyed) {
|
41842 | return;
|
41843 | }
|
41844 | var rowCount = this.model.getRowCount();
|
41845 | this.eContainer.style.height = rowCount * this.rowHeight + "px";
|
41846 |
|
41847 | waitUntil(function () { return _this.eContainer.clientHeight >= rowCount * _this.rowHeight; }, function () {
|
41848 | if (_this.isDestroyed) {
|
41849 | return;
|
41850 | }
|
41851 | _this.clearVirtualRows();
|
41852 | _this.drawVirtualRows();
|
41853 | });
|
41854 | };
|
41855 | VirtualList.prototype.clearVirtualRows = function () {
|
41856 | var _this = this;
|
41857 | this.renderedRows.forEach(function (_, rowIndex) { return _this.removeRow(rowIndex); });
|
41858 | };
|
41859 | VirtualList.prototype.drawVirtualRows = function () {
|
41860 | var gui = this.getGui();
|
41861 | var topPixel = gui.scrollTop;
|
41862 | var bottomPixel = topPixel + gui.offsetHeight;
|
41863 | var firstRow = Math.floor(topPixel / this.rowHeight);
|
41864 | var lastRow = Math.floor(bottomPixel / this.rowHeight);
|
41865 | this.ensureRowsRendered(firstRow, lastRow);
|
41866 | };
|
41867 | VirtualList.prototype.ensureRowsRendered = function (start, finish) {
|
41868 | var _this = this;
|
41869 |
|
41870 | this.renderedRows.forEach(function (_, rowIndex) {
|
41871 | if ((rowIndex < start || rowIndex > finish) && rowIndex !== _this.lastFocusedRowIndex) {
|
41872 | _this.removeRow(rowIndex);
|
41873 | }
|
41874 | });
|
41875 |
|
41876 | for (var rowIndex = start; rowIndex <= finish; rowIndex++) {
|
41877 | if (this.renderedRows.has(rowIndex)) {
|
41878 | continue;
|
41879 | }
|
41880 |
|
41881 | if (rowIndex < this.model.getRowCount()) {
|
41882 | this.insertRow(rowIndex);
|
41883 | }
|
41884 | }
|
41885 | };
|
41886 | VirtualList.prototype.insertRow = function (rowIndex) {
|
41887 | var _this = this;
|
41888 | var value = this.model.getRow(rowIndex);
|
41889 | var eDiv = document.createElement('div');
|
41890 | eDiv.classList.add('ag-virtual-list-item', "ag-" + this.cssIdentifier + "-virtual-list-item");
|
41891 | setAriaRole(eDiv, this.ariaRole === 'tree' ? 'treeitem' : 'option');
|
41892 | setAriaSetSize(eDiv, this.model.getRowCount());
|
41893 | setAriaPosInSet(eDiv, rowIndex + 1);
|
41894 | eDiv.setAttribute('tabindex', '-1');
|
41895 | if (typeof this.model.isRowSelected === 'function') {
|
41896 | var isSelected = this.model.isRowSelected(rowIndex);
|
41897 | setAriaSelected(eDiv, !!isSelected);
|
41898 | setAriaChecked(eDiv, isSelected);
|
41899 | }
|
41900 | eDiv.style.height = this.rowHeight + "px";
|
41901 | eDiv.style.top = this.rowHeight * rowIndex + "px";
|
41902 | var rowComponent = this.componentCreator(value, eDiv);
|
41903 | rowComponent.addGuiEventListener('focusin', function () { return _this.lastFocusedRowIndex = rowIndex; });
|
41904 | eDiv.appendChild(rowComponent.getGui());
|
41905 |
|
41906 | if (this.renderedRows.has(rowIndex - 1)) {
|
41907 | this.renderedRows.get(rowIndex - 1).eDiv.insertAdjacentElement('afterend', eDiv);
|
41908 | }
|
41909 | else if (this.renderedRows.has(rowIndex + 1)) {
|
41910 | this.renderedRows.get(rowIndex + 1).eDiv.insertAdjacentElement('beforebegin', eDiv);
|
41911 | }
|
41912 | else {
|
41913 | this.eContainer.appendChild(eDiv);
|
41914 | }
|
41915 | this.renderedRows.set(rowIndex, { rowComponent: rowComponent, eDiv: eDiv });
|
41916 | };
|
41917 | VirtualList.prototype.removeRow = function (rowIndex) {
|
41918 | var component = this.renderedRows.get(rowIndex);
|
41919 | this.eContainer.removeChild(component.eDiv);
|
41920 | this.destroyBean(component.rowComponent);
|
41921 | this.renderedRows.delete(rowIndex);
|
41922 | };
|
41923 | VirtualList.prototype.addScrollListener = function () {
|
41924 | var _this = this;
|
41925 | this.addGuiEventListener('scroll', function () { return _this.drawVirtualRows(); });
|
41926 | };
|
41927 | VirtualList.prototype.setModel = function (model) {
|
41928 | this.model = model;
|
41929 | };
|
41930 | VirtualList.prototype.destroy = function () {
|
41931 | if (this.isDestroyed) {
|
41932 | return;
|
41933 | }
|
41934 | this.clearVirtualRows();
|
41935 | this.isDestroyed = true;
|
41936 | _super.prototype.destroy.call(this);
|
41937 | };
|
41938 | __decorate$1N([
|
41939 | Autowired('resizeObserverService')
|
41940 | ], VirtualList.prototype, "resizeObserverService", void 0);
|
41941 | __decorate$1N([
|
41942 | Autowired('focusService')
|
41943 | ], VirtualList.prototype, "focusService", void 0);
|
41944 | __decorate$1N([
|
41945 | RefSelector('eContainer')
|
41946 | ], VirtualList.prototype, "eContainer", void 0);
|
41947 | __decorate$1N([
|
41948 | PostConstruct
|
41949 | ], VirtualList.prototype, "postConstruct", null);
|
41950 | return VirtualList;
|
41951 | }(TabGuardComp));
|
41952 |
|
41953 |
|
41954 |
|
41955 |
|
41956 |
|
41957 |
|
41958 |
|
41959 | var OUTSIDE_ANGULAR_EVENTS = ['mouseover', 'mouseout', 'mouseenter', 'mouseleave'];
|
41960 | var PASSIVE_EVENTS$1 = ['touchstart', 'touchend', 'touchmove', 'touchcancel'];
|
41961 |
|
41962 | var VanillaFrameworkOverrides = (function () {
|
41963 | function VanillaFrameworkOverrides() {
|
41964 | this.isOutsideAngular = function (eventType) { return includes(OUTSIDE_ANGULAR_EVENTS, eventType); };
|
41965 | }
|
41966 |
|
41967 | VanillaFrameworkOverrides.prototype.setTimeout = function (action, timeout) {
|
41968 | window.setTimeout(action, timeout);
|
41969 | };
|
41970 | VanillaFrameworkOverrides.prototype.setInterval = function (action, timeout) {
|
41971 | return new AgPromise(function (resolve) {
|
41972 | resolve(window.setInterval(action, timeout));
|
41973 | });
|
41974 | };
|
41975 |
|
41976 | VanillaFrameworkOverrides.prototype.addEventListener = function (element, type, listener, useCapture) {
|
41977 | var isPassive = includes(PASSIVE_EVENTS$1, type);
|
41978 | element.addEventListener(type, listener, { capture: !!useCapture, passive: isPassive });
|
41979 | };
|
41980 |
|
41981 | VanillaFrameworkOverrides.prototype.dispatchEvent = function (eventType, listener, global) {
|
41982 | listener();
|
41983 | };
|
41984 | VanillaFrameworkOverrides.prototype.frameworkComponent = function (name) {
|
41985 | return null;
|
41986 | };
|
41987 | VanillaFrameworkOverrides.prototype.isFrameworkComponent = function (comp) {
|
41988 | return false;
|
41989 | };
|
41990 | return VanillaFrameworkOverrides;
|
41991 | }());
|
41992 |
|
41993 |
|
41994 |
|
41995 |
|
41996 |
|
41997 |
|
41998 |
|
41999 | var __extends$28 = (undefined && undefined.__extends) || (function () {
|
42000 | var extendStatics = function (d, b) {
|
42001 | extendStatics = Object.setPrototypeOf ||
|
42002 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
42003 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
42004 | return extendStatics(d, b);
|
42005 | };
|
42006 | return function (d, b) {
|
42007 | extendStatics(d, b);
|
42008 | function __() { this.constructor = d; }
|
42009 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
42010 | };
|
42011 | })();
|
42012 | var __decorate$1O = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
42013 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
42014 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
42015 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
42016 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
42017 | };
|
42018 | var CellNavigationService = (function (_super) {
|
42019 | __extends$28(CellNavigationService, _super);
|
42020 | function CellNavigationService() {
|
42021 | return _super !== null && _super.apply(this, arguments) || this;
|
42022 | }
|
42023 |
|
42024 | CellNavigationService.prototype.getNextCellToFocus = function (key, focusedCell, ctrlPressed) {
|
42025 | if (ctrlPressed === void 0) { ctrlPressed = false; }
|
42026 | if (ctrlPressed) {
|
42027 | return this.getNextCellToFocusWithCtrlPressed(key, focusedCell);
|
42028 | }
|
42029 | return this.getNextCellToFocusWithoutCtrlPressed(key, focusedCell);
|
42030 | };
|
42031 | CellNavigationService.prototype.getNextCellToFocusWithCtrlPressed = function (key, focusedCell) {
|
42032 | var upKey = key === KeyCode.UP;
|
42033 | var downKey = key === KeyCode.DOWN;
|
42034 | var leftKey = key === KeyCode.LEFT;
|
42035 | var column;
|
42036 | var rowIndex;
|
42037 | if (upKey || downKey) {
|
42038 | rowIndex = upKey ? this.paginationProxy.getPageFirstRow() : this.paginationProxy.getPageLastRow();
|
42039 | column = focusedCell.column;
|
42040 | }
|
42041 | else {
|
42042 | var allColumns = this.columnModel.getAllDisplayedColumns();
|
42043 | var isRtl = this.gridOptionsWrapper.isEnableRtl();
|
42044 | rowIndex = focusedCell.rowIndex;
|
42045 | column = leftKey !== isRtl ? allColumns[0] : last(allColumns);
|
42046 | }
|
42047 | return {
|
42048 | rowIndex: rowIndex,
|
42049 | rowPinned: null,
|
42050 | column: column
|
42051 | };
|
42052 | };
|
42053 | CellNavigationService.prototype.getNextCellToFocusWithoutCtrlPressed = function (key, focusedCell) {
|
42054 |
|
42055 |
|
42056 | var pointer = focusedCell;
|
42057 | var finished = false;
|
42058 |
|
42059 |
|
42060 |
|
42061 | while (!finished) {
|
42062 | switch (key) {
|
42063 | case KeyCode.UP:
|
42064 | pointer = this.getCellAbove(pointer);
|
42065 | break;
|
42066 | case KeyCode.DOWN:
|
42067 | pointer = this.getCellBelow(pointer);
|
42068 | break;
|
42069 | case KeyCode.RIGHT:
|
42070 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
42071 | pointer = this.getCellToLeft(pointer);
|
42072 | }
|
42073 | else {
|
42074 | pointer = this.getCellToRight(pointer);
|
42075 | }
|
42076 | break;
|
42077 | case KeyCode.LEFT:
|
42078 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
42079 | pointer = this.getCellToRight(pointer);
|
42080 | }
|
42081 | else {
|
42082 | pointer = this.getCellToLeft(pointer);
|
42083 | }
|
42084 | break;
|
42085 | default:
|
42086 | pointer = null;
|
42087 | console.warn('AG Grid: unknown key for navigation ' + key);
|
42088 | break;
|
42089 | }
|
42090 | if (pointer) {
|
42091 | finished = this.isCellGoodToFocusOn(pointer);
|
42092 | }
|
42093 | else {
|
42094 | finished = true;
|
42095 | }
|
42096 | }
|
42097 | return pointer;
|
42098 | };
|
42099 | CellNavigationService.prototype.isCellGoodToFocusOn = function (gridCell) {
|
42100 | var column = gridCell.column;
|
42101 | var rowNode;
|
42102 | switch (gridCell.rowPinned) {
|
42103 | case Constants.PINNED_TOP:
|
42104 | rowNode = this.pinnedRowModel.getPinnedTopRow(gridCell.rowIndex);
|
42105 | break;
|
42106 | case Constants.PINNED_BOTTOM:
|
42107 | rowNode = this.pinnedRowModel.getPinnedBottomRow(gridCell.rowIndex);
|
42108 | break;
|
42109 | default:
|
42110 | rowNode = this.rowModel.getRow(gridCell.rowIndex);
|
42111 | break;
|
42112 | }
|
42113 | if (!rowNode) {
|
42114 | return false;
|
42115 | }
|
42116 | var suppressNavigable = column.isSuppressNavigable(rowNode);
|
42117 | return !suppressNavigable;
|
42118 | };
|
42119 | CellNavigationService.prototype.getCellToLeft = function (lastCell) {
|
42120 | if (!lastCell) {
|
42121 | return null;
|
42122 | }
|
42123 | var colToLeft = this.columnModel.getDisplayedColBefore(lastCell.column);
|
42124 | if (!colToLeft) {
|
42125 | return null;
|
42126 | }
|
42127 | return {
|
42128 | rowIndex: lastCell.rowIndex,
|
42129 | column: colToLeft,
|
42130 | rowPinned: lastCell.rowPinned
|
42131 | };
|
42132 | };
|
42133 | CellNavigationService.prototype.getCellToRight = function (lastCell) {
|
42134 | if (!lastCell) {
|
42135 | return null;
|
42136 | }
|
42137 | var colToRight = this.columnModel.getDisplayedColAfter(lastCell.column);
|
42138 |
|
42139 | if (!colToRight) {
|
42140 | return null;
|
42141 | }
|
42142 | return {
|
42143 | rowIndex: lastCell.rowIndex,
|
42144 | column: colToRight,
|
42145 | rowPinned: lastCell.rowPinned
|
42146 | };
|
42147 | };
|
42148 | CellNavigationService.prototype.getRowBelow = function (rowPosition) {
|
42149 |
|
42150 | var index = rowPosition.rowIndex;
|
42151 | var pinned = rowPosition.rowPinned;
|
42152 | if (this.isLastRowInContainer(rowPosition)) {
|
42153 | switch (pinned) {
|
42154 | case Constants.PINNED_BOTTOM:
|
42155 |
|
42156 | return null;
|
42157 | case Constants.PINNED_TOP:
|
42158 |
|
42159 |
|
42160 | if (this.rowModel.isRowsToRender()) {
|
42161 | return { rowIndex: this.paginationProxy.getPageFirstRow(), rowPinned: null };
|
42162 | }
|
42163 | if (this.pinnedRowModel.isRowsToRender(Constants.PINNED_BOTTOM)) {
|
42164 | return { rowIndex: 0, rowPinned: Constants.PINNED_BOTTOM };
|
42165 | }
|
42166 | return null;
|
42167 | default:
|
42168 |
|
42169 | if (this.pinnedRowModel.isRowsToRender(Constants.PINNED_BOTTOM)) {
|
42170 | return { rowIndex: 0, rowPinned: Constants.PINNED_BOTTOM };
|
42171 | }
|
42172 | return null;
|
42173 | }
|
42174 | }
|
42175 | return { rowIndex: index + 1, rowPinned: pinned };
|
42176 | };
|
42177 | CellNavigationService.prototype.getCellBelow = function (lastCell) {
|
42178 | if (!lastCell) {
|
42179 | return null;
|
42180 | }
|
42181 | var rowBelow = this.getRowBelow(lastCell);
|
42182 | if (rowBelow) {
|
42183 | return {
|
42184 | rowIndex: rowBelow.rowIndex,
|
42185 | column: lastCell.column,
|
42186 | rowPinned: rowBelow.rowPinned
|
42187 | };
|
42188 | }
|
42189 | return null;
|
42190 | };
|
42191 | CellNavigationService.prototype.isLastRowInContainer = function (rowPosition) {
|
42192 | var pinned = rowPosition.rowPinned;
|
42193 | var index = rowPosition.rowIndex;
|
42194 | if (pinned === Constants.PINNED_TOP) {
|
42195 | var lastTopIndex = this.pinnedRowModel.getPinnedTopRowData().length - 1;
|
42196 | return lastTopIndex <= index;
|
42197 | }
|
42198 | if (pinned === Constants.PINNED_BOTTOM) {
|
42199 | var lastBottomIndex = this.pinnedRowModel.getPinnedBottomRowData().length - 1;
|
42200 | return lastBottomIndex <= index;
|
42201 | }
|
42202 | var lastBodyIndex = this.paginationProxy.getPageLastRow();
|
42203 | return lastBodyIndex <= index;
|
42204 | };
|
42205 | CellNavigationService.prototype.getRowAbove = function (rowPosition) {
|
42206 |
|
42207 | var index = rowPosition.rowIndex;
|
42208 | var pinned = rowPosition.rowPinned;
|
42209 | var isFirstRow = pinned ? index === 0 : index === this.paginationProxy.getPageFirstRow();
|
42210 |
|
42211 | if (isFirstRow) {
|
42212 | if (pinned === Constants.PINNED_TOP) {
|
42213 | return null;
|
42214 | }
|
42215 | if (!pinned) {
|
42216 | if (this.pinnedRowModel.isRowsToRender(Constants.PINNED_TOP)) {
|
42217 | return this.getLastFloatingTopRow();
|
42218 | }
|
42219 | return null;
|
42220 | }
|
42221 |
|
42222 | if (this.rowModel.isRowsToRender()) {
|
42223 | return this.getLastBodyCell();
|
42224 | }
|
42225 | if (this.pinnedRowModel.isRowsToRender(Constants.PINNED_TOP)) {
|
42226 | return this.getLastFloatingTopRow();
|
42227 | }
|
42228 | return null;
|
42229 | }
|
42230 | return { rowIndex: index - 1, rowPinned: pinned };
|
42231 | };
|
42232 | CellNavigationService.prototype.getCellAbove = function (lastCell) {
|
42233 | if (!lastCell) {
|
42234 | return null;
|
42235 | }
|
42236 | var rowAbove = this.getRowAbove({ rowIndex: lastCell.rowIndex, rowPinned: lastCell.rowPinned });
|
42237 | if (rowAbove) {
|
42238 | return {
|
42239 | rowIndex: rowAbove.rowIndex,
|
42240 | column: lastCell.column,
|
42241 | rowPinned: rowAbove.rowPinned
|
42242 | };
|
42243 | }
|
42244 | return null;
|
42245 | };
|
42246 | CellNavigationService.prototype.getLastBodyCell = function () {
|
42247 | var lastBodyRow = this.paginationProxy.getPageLastRow();
|
42248 | return { rowIndex: lastBodyRow, rowPinned: null };
|
42249 | };
|
42250 | CellNavigationService.prototype.getLastFloatingTopRow = function () {
|
42251 | var lastFloatingRow = this.pinnedRowModel.getPinnedTopRowData().length - 1;
|
42252 | return { rowIndex: lastFloatingRow, rowPinned: Constants.PINNED_TOP };
|
42253 | };
|
42254 | CellNavigationService.prototype.getNextTabbedCell = function (gridCell, backwards) {
|
42255 | if (backwards) {
|
42256 | return this.getNextTabbedCellBackwards(gridCell);
|
42257 | }
|
42258 | return this.getNextTabbedCellForwards(gridCell);
|
42259 | };
|
42260 | CellNavigationService.prototype.getNextTabbedCellForwards = function (gridCell) {
|
42261 | var displayedColumns = this.columnModel.getAllDisplayedColumns();
|
42262 | var newRowIndex = gridCell.rowIndex;
|
42263 | var newFloating = gridCell.rowPinned;
|
42264 |
|
42265 | var newColumn = this.columnModel.getDisplayedColAfter(gridCell.column);
|
42266 |
|
42267 | if (!newColumn) {
|
42268 | newColumn = displayedColumns[0];
|
42269 | var rowBelow = this.getRowBelow(gridCell);
|
42270 | if (missing(rowBelow)) {
|
42271 | return null;
|
42272 | }
|
42273 |
|
42274 |
|
42275 | if (!rowBelow.rowPinned && !this.paginationProxy.isRowInPage(rowBelow)) {
|
42276 | return null;
|
42277 | }
|
42278 | newRowIndex = rowBelow ? rowBelow.rowIndex : null;
|
42279 | newFloating = rowBelow ? rowBelow.rowPinned : null;
|
42280 | }
|
42281 | return { rowIndex: newRowIndex, column: newColumn, rowPinned: newFloating };
|
42282 | };
|
42283 | CellNavigationService.prototype.getNextTabbedCellBackwards = function (gridCell) {
|
42284 | var displayedColumns = this.columnModel.getAllDisplayedColumns();
|
42285 | var newRowIndex = gridCell.rowIndex;
|
42286 | var newFloating = gridCell.rowPinned;
|
42287 |
|
42288 | var newColumn = this.columnModel.getDisplayedColBefore(gridCell.column);
|
42289 |
|
42290 | if (!newColumn) {
|
42291 | newColumn = last(displayedColumns);
|
42292 | var rowAbove = this.getRowAbove({ rowIndex: gridCell.rowIndex, rowPinned: gridCell.rowPinned });
|
42293 | if (missing(rowAbove)) {
|
42294 | return null;
|
42295 | }
|
42296 |
|
42297 |
|
42298 | if (!rowAbove.rowPinned && !this.paginationProxy.isRowInPage(rowAbove)) {
|
42299 | return null;
|
42300 | }
|
42301 | newRowIndex = rowAbove ? rowAbove.rowIndex : null;
|
42302 | newFloating = rowAbove ? rowAbove.rowPinned : null;
|
42303 | }
|
42304 | return { rowIndex: newRowIndex, column: newColumn, rowPinned: newFloating };
|
42305 | };
|
42306 | __decorate$1O([
|
42307 | Autowired('columnModel')
|
42308 | ], CellNavigationService.prototype, "columnModel", void 0);
|
42309 | __decorate$1O([
|
42310 | Autowired('rowModel')
|
42311 | ], CellNavigationService.prototype, "rowModel", void 0);
|
42312 | __decorate$1O([
|
42313 | Autowired('pinnedRowModel')
|
42314 | ], CellNavigationService.prototype, "pinnedRowModel", void 0);
|
42315 | __decorate$1O([
|
42316 | Autowired('paginationProxy')
|
42317 | ], CellNavigationService.prototype, "paginationProxy", void 0);
|
42318 | CellNavigationService = __decorate$1O([
|
42319 | Bean('cellNavigationService')
|
42320 | ], CellNavigationService);
|
42321 | return CellNavigationService;
|
42322 | }(BeanStub));
|
42323 |
|
42324 |
|
42325 |
|
42326 |
|
42327 |
|
42328 |
|
42329 |
|
42330 | var __extends$29 = (undefined && undefined.__extends) || (function () {
|
42331 | var extendStatics = function (d, b) {
|
42332 | extendStatics = Object.setPrototypeOf ||
|
42333 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
42334 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
42335 | return extendStatics(d, b);
|
42336 | };
|
42337 | return function (d, b) {
|
42338 | extendStatics(d, b);
|
42339 | function __() { this.constructor = d; }
|
42340 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
42341 | };
|
42342 | })();
|
42343 | var __decorate$1P = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
42344 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
42345 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
42346 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
42347 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
42348 | };
|
42349 | var __param$5 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
42350 | return function (target, key) { decorator(target, key, paramIndex); }
|
42351 | };
|
42352 | var AlignedGridsService = (function (_super) {
|
42353 | __extends$29(AlignedGridsService, _super);
|
42354 | function AlignedGridsService() {
|
42355 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
42356 |
|
42357 |
|
42358 |
|
42359 | _this.consuming = false;
|
42360 | return _this;
|
42361 | }
|
42362 | AlignedGridsService.prototype.setBeans = function (loggerFactory) {
|
42363 | this.logger = loggerFactory.create('AlignedGridsService');
|
42364 | };
|
42365 | AlignedGridsService.prototype.init = function () {
|
42366 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, this.fireColumnEvent.bind(this));
|
42367 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, this.fireColumnEvent.bind(this));
|
42368 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, this.fireColumnEvent.bind(this));
|
42369 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, this.fireColumnEvent.bind(this));
|
42370 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_RESIZED, this.fireColumnEvent.bind(this));
|
42371 | this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, this.fireScrollEvent.bind(this));
|
42372 | };
|
42373 |
|
42374 | AlignedGridsService.prototype.fireEvent = function (callback) {
|
42375 |
|
42376 |
|
42377 | if (this.consuming) {
|
42378 | return;
|
42379 | }
|
42380 |
|
42381 | var otherGrids = this.gridOptionsWrapper.getAlignedGrids();
|
42382 | if (otherGrids) {
|
42383 | otherGrids.forEach(function (otherGridOptions) {
|
42384 | if (otherGridOptions.api) {
|
42385 | var alignedGridService = otherGridOptions.api.__getAlignedGridService();
|
42386 | callback(alignedGridService);
|
42387 | }
|
42388 | });
|
42389 | }
|
42390 | };
|
42391 |
|
42392 |
|
42393 | AlignedGridsService.prototype.onEvent = function (callback) {
|
42394 | this.consuming = true;
|
42395 | callback();
|
42396 | this.consuming = false;
|
42397 | };
|
42398 | AlignedGridsService.prototype.fireColumnEvent = function (event) {
|
42399 | this.fireEvent(function (alignedGridsService) {
|
42400 | alignedGridsService.onColumnEvent(event);
|
42401 | });
|
42402 | };
|
42403 | AlignedGridsService.prototype.fireScrollEvent = function (event) {
|
42404 | if (event.direction !== 'horizontal') {
|
42405 | return;
|
42406 | }
|
42407 | this.fireEvent(function (alignedGridsService) {
|
42408 | alignedGridsService.onScrollEvent(event);
|
42409 | });
|
42410 | };
|
42411 | AlignedGridsService.prototype.onScrollEvent = function (event) {
|
42412 | var _this = this;
|
42413 | this.onEvent(function () {
|
42414 | var gridBodyCon = _this.ctrlsService.getGridBodyCtrl();
|
42415 | gridBodyCon.getScrollFeature().setHorizontalScrollPosition(event.left);
|
42416 | });
|
42417 | };
|
42418 | AlignedGridsService.prototype.getMasterColumns = function (event) {
|
42419 | var result = [];
|
42420 | if (event.columns) {
|
42421 | event.columns.forEach(function (column) {
|
42422 | result.push(column);
|
42423 | });
|
42424 | }
|
42425 | else if (event.column) {
|
42426 | result.push(event.column);
|
42427 | }
|
42428 | return result;
|
42429 | };
|
42430 | AlignedGridsService.prototype.getColumnIds = function (event) {
|
42431 | var result = [];
|
42432 | if (event.columns) {
|
42433 | event.columns.forEach(function (column) {
|
42434 | result.push(column.getColId());
|
42435 | });
|
42436 | }
|
42437 | else if (event.column) {
|
42438 | result.push(event.column.getColId());
|
42439 | }
|
42440 | return result;
|
42441 | };
|
42442 | AlignedGridsService.prototype.onColumnEvent = function (event) {
|
42443 | var _this = this;
|
42444 | this.onEvent(function () {
|
42445 | switch (event.type) {
|
42446 | case Events.EVENT_COLUMN_MOVED:
|
42447 | case Events.EVENT_COLUMN_VISIBLE:
|
42448 | case Events.EVENT_COLUMN_PINNED:
|
42449 | case Events.EVENT_COLUMN_RESIZED:
|
42450 | var colEvent = event;
|
42451 | _this.processColumnEvent(colEvent);
|
42452 | break;
|
42453 | case Events.EVENT_COLUMN_GROUP_OPENED:
|
42454 | var groupOpenedEvent = event;
|
42455 | _this.processGroupOpenedEvent(groupOpenedEvent);
|
42456 | break;
|
42457 | case Events.EVENT_COLUMN_PIVOT_CHANGED:
|
42458 |
|
42459 |
|
42460 | console.warn('AG Grid: pivoting is not supported with aligned grids. ' +
|
42461 | 'You can only use one of these features at a time in a grid.');
|
42462 | break;
|
42463 | }
|
42464 | });
|
42465 | };
|
42466 | AlignedGridsService.prototype.processGroupOpenedEvent = function (groupOpenedEvent) {
|
42467 |
|
42468 | var masterColumnGroup = groupOpenedEvent.columnGroup;
|
42469 | var otherColumnGroup = null;
|
42470 | if (masterColumnGroup) {
|
42471 | var groupId = masterColumnGroup.getGroupId();
|
42472 | otherColumnGroup = this.columnModel.getProvidedColumnGroup(groupId);
|
42473 | }
|
42474 | if (masterColumnGroup && !otherColumnGroup) {
|
42475 | return;
|
42476 | }
|
42477 | this.logger.log('onColumnEvent-> processing ' + groupOpenedEvent + ' expanded = ' + masterColumnGroup.isExpanded());
|
42478 | this.columnModel.setColumnGroupOpened(otherColumnGroup, masterColumnGroup.isExpanded(), "alignedGridChanged");
|
42479 | };
|
42480 | AlignedGridsService.prototype.processColumnEvent = function (colEvent) {
|
42481 | var _this = this;
|
42482 |
|
42483 |
|
42484 | var masterColumn = colEvent.column;
|
42485 | var otherColumn = null;
|
42486 | if (masterColumn) {
|
42487 | otherColumn = this.columnModel.getPrimaryColumn(masterColumn.getColId());
|
42488 | }
|
42489 |
|
42490 |
|
42491 | if (masterColumn && !otherColumn) {
|
42492 | return;
|
42493 | }
|
42494 |
|
42495 |
|
42496 | var masterColumns = this.getMasterColumns(colEvent);
|
42497 | switch (colEvent.type) {
|
42498 | case Events.EVENT_COLUMN_MOVED:
|
42499 |
|
42500 |
|
42501 |
|
42502 | {
|
42503 | var movedEvent = colEvent;
|
42504 | var srcColState = colEvent.columnApi.getColumnState();
|
42505 | var destColState = srcColState.map(function (s) { return ({ colId: s.colId }); });
|
42506 | this.columnModel.applyColumnState({ state: destColState, applyOrder: true }, "alignedGridChanged");
|
42507 | this.logger.log("onColumnEvent-> processing " + colEvent.type + " toIndex = " + movedEvent.toIndex);
|
42508 | }
|
42509 | break;
|
42510 | case Events.EVENT_COLUMN_VISIBLE:
|
42511 |
|
42512 |
|
42513 |
|
42514 | {
|
42515 | var visibleEvent = colEvent;
|
42516 | var srcColState = colEvent.columnApi.getColumnState();
|
42517 | var destColState = srcColState.map(function (s) { return ({ colId: s.colId, hide: s.hide }); });
|
42518 | this.columnModel.applyColumnState({ state: destColState }, "alignedGridChanged");
|
42519 | this.logger.log("onColumnEvent-> processing " + colEvent.type + " visible = " + visibleEvent.visible);
|
42520 | }
|
42521 | break;
|
42522 | case Events.EVENT_COLUMN_PINNED:
|
42523 | {
|
42524 | var pinnedEvent = colEvent;
|
42525 | var srcColState = colEvent.columnApi.getColumnState();
|
42526 | var destColState = srcColState.map(function (s) { return ({ colId: s.colId, pinned: s.pinned }); });
|
42527 | this.columnModel.applyColumnState({ state: destColState }, "alignedGridChanged");
|
42528 | this.logger.log("onColumnEvent-> processing " + colEvent.type + " pinned = " + pinnedEvent.pinned);
|
42529 | }
|
42530 | break;
|
42531 | case Events.EVENT_COLUMN_RESIZED:
|
42532 | var resizedEvent_1 = colEvent;
|
42533 | masterColumns.forEach(function (column) {
|
42534 | _this.logger.log("onColumnEvent-> processing " + colEvent.type + " actualWidth = " + column.getActualWidth());
|
42535 | var columnWidths = [{ key: column.getColId(), newWidth: column.getActualWidth() }];
|
42536 | _this.columnModel.setColumnWidths(columnWidths, false, resizedEvent_1.finished, "alignedGridChanged");
|
42537 | });
|
42538 | break;
|
42539 | }
|
42540 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
42541 | var isVerticalScrollShowing = gridBodyCon.isVerticalScrollShowing();
|
42542 | var alignedGrids = this.gridOptionsWrapper.getAlignedGrids();
|
42543 | if (alignedGrids) {
|
42544 | alignedGrids.forEach(function (grid) {
|
42545 | if (grid.api) {
|
42546 | grid.api.setAlwaysShowVerticalScroll(isVerticalScrollShowing);
|
42547 | }
|
42548 | });
|
42549 | }
|
42550 | };
|
42551 | __decorate$1P([
|
42552 | Autowired('columnModel')
|
42553 | ], AlignedGridsService.prototype, "columnModel", void 0);
|
42554 | __decorate$1P([
|
42555 | Autowired('ctrlsService')
|
42556 | ], AlignedGridsService.prototype, "ctrlsService", void 0);
|
42557 | __decorate$1P([
|
42558 | __param$5(0, Qualifier('loggerFactory'))
|
42559 | ], AlignedGridsService.prototype, "setBeans", null);
|
42560 | __decorate$1P([
|
42561 | PostConstruct
|
42562 | ], AlignedGridsService.prototype, "init", null);
|
42563 | AlignedGridsService = __decorate$1P([
|
42564 | Bean('alignedGridsService')
|
42565 | ], AlignedGridsService);
|
42566 | return AlignedGridsService;
|
42567 | }(BeanStub));
|
42568 |
|
42569 |
|
42570 |
|
42571 |
|
42572 |
|
42573 |
|
42574 |
|
42575 | var __extends$2a = (undefined && undefined.__extends) || (function () {
|
42576 | var extendStatics = function (d, b) {
|
42577 | extendStatics = Object.setPrototypeOf ||
|
42578 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
42579 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
42580 | return extendStatics(d, b);
|
42581 | };
|
42582 | return function (d, b) {
|
42583 | extendStatics(d, b);
|
42584 | function __() { this.constructor = d; }
|
42585 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
42586 | };
|
42587 | })();
|
42588 | var __decorate$1Q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
42589 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
42590 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
42591 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
42592 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
42593 | };
|
42594 | var __param$6 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
42595 | return function (target, key) { decorator(target, key, paramIndex); }
|
42596 | };
|
42597 | var SelectionService = (function (_super) {
|
42598 | __extends$2a(SelectionService, _super);
|
42599 | function SelectionService() {
|
42600 | return _super !== null && _super.apply(this, arguments) || this;
|
42601 | }
|
42602 | SelectionService.prototype.setBeans = function (loggerFactory) {
|
42603 | this.logger = loggerFactory.create('selectionService');
|
42604 | this.reset();
|
42605 | };
|
42606 | SelectionService.prototype.init = function () {
|
42607 | this.groupSelectsChildren = this.gridOptionsWrapper.isGroupSelectsChildren();
|
42608 | this.addManagedListener(this.eventService, Events.EVENT_ROW_SELECTED, this.onRowSelected.bind(this));
|
42609 | };
|
42610 | SelectionService.prototype.setLastSelectedNode = function (rowNode) {
|
42611 | this.lastSelectedNode = rowNode;
|
42612 | };
|
42613 | SelectionService.prototype.getLastSelectedNode = function () {
|
42614 | return this.lastSelectedNode;
|
42615 | };
|
42616 | SelectionService.prototype.getSelectedNodes = function () {
|
42617 | var selectedNodes = [];
|
42618 | iterateObject(this.selectedNodes, function (key, rowNode) {
|
42619 | if (rowNode) {
|
42620 | selectedNodes.push(rowNode);
|
42621 | }
|
42622 | });
|
42623 | return selectedNodes;
|
42624 | };
|
42625 | SelectionService.prototype.getSelectedRows = function () {
|
42626 | var selectedRows = [];
|
42627 | iterateObject(this.selectedNodes, function (key, rowNode) {
|
42628 | if (rowNode && rowNode.data) {
|
42629 | selectedRows.push(rowNode.data);
|
42630 | }
|
42631 | });
|
42632 | return selectedRows;
|
42633 | };
|
42634 | SelectionService.prototype.removeGroupsFromSelection = function () {
|
42635 | var _this = this;
|
42636 | iterateObject(this.selectedNodes, function (key, rowNode) {
|
42637 | if (rowNode && rowNode.group) {
|
42638 | _this.selectedNodes[rowNode.id] = undefined;
|
42639 | }
|
42640 | });
|
42641 | };
|
42642 |
|
42643 | SelectionService.prototype.updateGroupsFromChildrenSelections = function (changedPath) {
|
42644 |
|
42645 | if (!this.gridOptionsWrapper.isGroupSelectsChildren()) {
|
42646 | return;
|
42647 | }
|
42648 |
|
42649 | if (this.rowModel.getType() !== Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
|
42650 | return;
|
42651 | }
|
42652 | var clientSideRowModel = this.rowModel;
|
42653 | var rootNode = clientSideRowModel.getRootNode();
|
42654 | if (!changedPath) {
|
42655 | changedPath = new ChangedPath(true, rootNode);
|
42656 | changedPath.setInactive();
|
42657 | }
|
42658 | changedPath.forEachChangedNodeDepthFirst(function (rowNode) {
|
42659 | if (rowNode !== rootNode) {
|
42660 | rowNode.calculateSelectedFromChildren();
|
42661 | }
|
42662 | });
|
42663 |
|
42664 |
|
42665 |
|
42666 |
|
42667 |
|
42668 |
|
42669 | };
|
42670 | SelectionService.prototype.getNodeForIdIfSelected = function (id) {
|
42671 | return this.selectedNodes[id];
|
42672 | };
|
42673 | SelectionService.prototype.clearOtherNodes = function (rowNodeToKeepSelected) {
|
42674 | var _this = this;
|
42675 | var groupsToRefresh = {};
|
42676 | var updatedCount = 0;
|
42677 | iterateObject(this.selectedNodes, function (key, otherRowNode) {
|
42678 | if (otherRowNode && otherRowNode.id !== rowNodeToKeepSelected.id) {
|
42679 | var rowNode = _this.selectedNodes[otherRowNode.id];
|
42680 | updatedCount += rowNode.setSelectedParams({
|
42681 | newValue: false,
|
42682 | clearSelection: false,
|
42683 | suppressFinishActions: true
|
42684 | });
|
42685 | if (_this.groupSelectsChildren && otherRowNode.parent) {
|
42686 | groupsToRefresh[otherRowNode.parent.id] = otherRowNode.parent;
|
42687 | }
|
42688 | }
|
42689 | });
|
42690 | iterateObject(groupsToRefresh, function (key, group) {
|
42691 | group.calculateSelectedFromChildren();
|
42692 | });
|
42693 | return updatedCount;
|
42694 | };
|
42695 | SelectionService.prototype.onRowSelected = function (event) {
|
42696 | var rowNode = event.node;
|
42697 |
|
42698 | if (this.groupSelectsChildren && rowNode.group) {
|
42699 | return;
|
42700 | }
|
42701 | if (rowNode.isSelected()) {
|
42702 | this.selectedNodes[rowNode.id] = rowNode;
|
42703 | }
|
42704 | else {
|
42705 | this.selectedNodes[rowNode.id] = undefined;
|
42706 | }
|
42707 | };
|
42708 | SelectionService.prototype.syncInRowNode = function (rowNode, oldNode) {
|
42709 | this.syncInOldRowNode(rowNode, oldNode);
|
42710 | this.syncInNewRowNode(rowNode);
|
42711 | };
|
42712 |
|
42713 |
|
42714 |
|
42715 |
|
42716 |
|
42717 |
|
42718 |
|
42719 |
|
42720 |
|
42721 |
|
42722 |
|
42723 | SelectionService.prototype.syncInOldRowNode = function (rowNode, oldNode) {
|
42724 | var oldNodeHasDifferentId = exists(oldNode) && (rowNode.id !== oldNode.id);
|
42725 | if (oldNodeHasDifferentId && oldNode) {
|
42726 | var id = oldNode.id;
|
42727 | var oldNodeSelected = this.selectedNodes[id] == rowNode;
|
42728 | if (oldNodeSelected) {
|
42729 | this.selectedNodes[oldNode.id] = oldNode;
|
42730 | }
|
42731 | }
|
42732 | };
|
42733 | SelectionService.prototype.syncInNewRowNode = function (rowNode) {
|
42734 | if (exists(this.selectedNodes[rowNode.id])) {
|
42735 | rowNode.setSelectedInitialValue(true);
|
42736 | this.selectedNodes[rowNode.id] = rowNode;
|
42737 | }
|
42738 | else {
|
42739 | rowNode.setSelectedInitialValue(false);
|
42740 | }
|
42741 | };
|
42742 | SelectionService.prototype.reset = function () {
|
42743 | this.logger.log('reset');
|
42744 | this.selectedNodes = {};
|
42745 | this.lastSelectedNode = null;
|
42746 | };
|
42747 |
|
42748 |
|
42749 |
|
42750 |
|
42751 |
|
42752 | SelectionService.prototype.getBestCostNodeSelection = function () {
|
42753 | if (this.rowModel.getType() !== Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
|
42754 | console.warn('AG Grid: `getBestCostNodeSelection` is only available when using normal row model');
|
42755 | return;
|
42756 | }
|
42757 | var clientSideRowModel = this.rowModel;
|
42758 | var topLevelNodes = clientSideRowModel.getTopLevelNodes();
|
42759 | if (topLevelNodes === null) {
|
42760 | console.warn('AG Grid: `selectAll` not available doing `rowModel=virtual`');
|
42761 | return;
|
42762 | }
|
42763 | var result = [];
|
42764 |
|
42765 | function traverse(nodes) {
|
42766 | for (var i = 0, l = nodes.length; i < l; i++) {
|
42767 | var node = nodes[i];
|
42768 | if (node.isSelected()) {
|
42769 | result.push(node);
|
42770 | }
|
42771 | else {
|
42772 |
|
42773 |
|
42774 | var maybeGroup = node;
|
42775 | if (maybeGroup.group && maybeGroup.children) {
|
42776 | traverse(maybeGroup.children);
|
42777 | }
|
42778 | }
|
42779 | }
|
42780 | }
|
42781 | traverse(topLevelNodes);
|
42782 | return result;
|
42783 | };
|
42784 | SelectionService.prototype.setRowModel = function (rowModel) {
|
42785 | this.rowModel = rowModel;
|
42786 | };
|
42787 | SelectionService.prototype.isEmpty = function () {
|
42788 | var count = 0;
|
42789 | iterateObject(this.selectedNodes, function (nodeId, rowNode) {
|
42790 | if (rowNode) {
|
42791 | count++;
|
42792 | }
|
42793 | });
|
42794 | return count === 0;
|
42795 | };
|
42796 | SelectionService.prototype.deselectAllRowNodes = function (justFiltered) {
|
42797 | if (justFiltered === void 0) { justFiltered = false; }
|
42798 | var callback = function (rowNode) { return rowNode.selectThisNode(false); };
|
42799 | var rowModelClientSide = this.rowModel.getType() === Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
|
42800 | if (justFiltered) {
|
42801 | if (!rowModelClientSide) {
|
42802 | console.error('AG Grid: selecting just filtered only works with In Memory Row Model');
|
42803 | return;
|
42804 | }
|
42805 | var clientSideRowModel = this.rowModel;
|
42806 | clientSideRowModel.forEachNodeAfterFilter(callback);
|
42807 | }
|
42808 | else {
|
42809 | iterateObject(this.selectedNodes, function (id, rowNode) {
|
42810 |
|
42811 | if (rowNode) {
|
42812 | callback(rowNode);
|
42813 | }
|
42814 | });
|
42815 |
|
42816 | this.reset();
|
42817 | }
|
42818 |
|
42819 | if (rowModelClientSide && this.groupSelectsChildren) {
|
42820 | this.updateGroupsFromChildrenSelections();
|
42821 | }
|
42822 | var event = {
|
42823 | type: Events.EVENT_SELECTION_CHANGED,
|
42824 | api: this.gridApi,
|
42825 | columnApi: this.columnApi
|
42826 | };
|
42827 | this.eventService.dispatchEvent(event);
|
42828 | };
|
42829 | SelectionService.prototype.selectAllRowNodes = function (justFiltered) {
|
42830 | if (justFiltered === void 0) { justFiltered = false; }
|
42831 | if (this.rowModel.getType() !== Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
|
42832 | throw new Error("selectAll only available with normal row model, ie not " + this.rowModel.getType());
|
42833 | }
|
42834 | var clientSideRowModel = this.rowModel;
|
42835 | var callback = function (rowNode) { return rowNode.selectThisNode(true); };
|
42836 | if (justFiltered) {
|
42837 | clientSideRowModel.forEachNodeAfterFilter(callback);
|
42838 | }
|
42839 | else {
|
42840 | clientSideRowModel.forEachNode(callback);
|
42841 | }
|
42842 |
|
42843 | if (this.rowModel.getType() === Constants.ROW_MODEL_TYPE_CLIENT_SIDE && this.groupSelectsChildren) {
|
42844 | this.updateGroupsFromChildrenSelections();
|
42845 | }
|
42846 | var event = {
|
42847 | type: Events.EVENT_SELECTION_CHANGED,
|
42848 | api: this.gridApi,
|
42849 | columnApi: this.columnApi
|
42850 | };
|
42851 | this.eventService.dispatchEvent(event);
|
42852 | };
|
42853 | |
42854 |
|
42855 |
|
42856 |
|
42857 | SelectionService.prototype.selectNode = function (rowNode, tryMulti) {
|
42858 | if (rowNode) {
|
42859 | rowNode.setSelectedParams({ newValue: true, clearSelection: !tryMulti });
|
42860 | }
|
42861 | };
|
42862 | |
42863 |
|
42864 |
|
42865 |
|
42866 | SelectionService.prototype.deselectIndex = function (rowIndex) {
|
42867 | var node = this.rowModel.getRow(rowIndex);
|
42868 | this.deselectNode(node);
|
42869 | };
|
42870 | |
42871 |
|
42872 |
|
42873 |
|
42874 | SelectionService.prototype.deselectNode = function (rowNode) {
|
42875 | if (rowNode) {
|
42876 | rowNode.setSelectedParams({ newValue: false, clearSelection: false });
|
42877 | }
|
42878 | };
|
42879 | |
42880 |
|
42881 |
|
42882 |
|
42883 | SelectionService.prototype.selectIndex = function (index, tryMulti) {
|
42884 | var node = this.rowModel.getRow(index);
|
42885 | this.selectNode(node, tryMulti);
|
42886 | };
|
42887 | __decorate$1Q([
|
42888 | Autowired('rowModel')
|
42889 | ], SelectionService.prototype, "rowModel", void 0);
|
42890 | __decorate$1Q([
|
42891 | Autowired('columnApi')
|
42892 | ], SelectionService.prototype, "columnApi", void 0);
|
42893 | __decorate$1Q([
|
42894 | Autowired('gridApi')
|
42895 | ], SelectionService.prototype, "gridApi", void 0);
|
42896 | __decorate$1Q([
|
42897 | __param$6(0, Qualifier('loggerFactory'))
|
42898 | ], SelectionService.prototype, "setBeans", null);
|
42899 | __decorate$1Q([
|
42900 | PostConstruct
|
42901 | ], SelectionService.prototype, "init", null);
|
42902 | SelectionService = __decorate$1Q([
|
42903 | Bean('selectionService')
|
42904 | ], SelectionService);
|
42905 | return SelectionService;
|
42906 | }(BeanStub));
|
42907 |
|
42908 |
|
42909 |
|
42910 |
|
42911 |
|
42912 |
|
42913 |
|
42914 | var __decorate$1R = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
42915 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
42916 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
42917 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
42918 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
42919 | };
|
42920 | var ColumnApi = (function () {
|
42921 | function ColumnApi() {
|
42922 | }
|
42923 |
|
42924 | ColumnApi.prototype.sizeColumnsToFit = function (gridWidth) {
|
42925 |
|
42926 |
|
42927 | if (typeof gridWidth === "undefined") {
|
42928 | console.error('AG Grid: missing parameter to columnApi.sizeColumnsToFit(gridWidth)');
|
42929 | }
|
42930 | this.columnModel.sizeColumnsToFit(gridWidth, 'api');
|
42931 | };
|
42932 |
|
42933 | ColumnApi.prototype.setColumnGroupOpened = function (group, newValue) { this.columnModel.setColumnGroupOpened(group, newValue, 'api'); };
|
42934 |
|
42935 | ColumnApi.prototype.getColumnGroup = function (name, instanceId) { return this.columnModel.getColumnGroup(name, instanceId); };
|
42936 |
|
42937 | ColumnApi.prototype.getProvidedColumnGroup = function (name) { return this.columnModel.getProvidedColumnGroup(name); };
|
42938 |
|
42939 | ColumnApi.prototype.getDisplayNameForColumn = function (column, location) { return this.columnModel.getDisplayNameForColumn(column, location) || ''; };
|
42940 |
|
42941 | ColumnApi.prototype.getDisplayNameForColumnGroup = function (columnGroup, location) { return this.columnModel.getDisplayNameForColumnGroup(columnGroup, location) || ''; };
|
42942 |
|
42943 | ColumnApi.prototype.getColumn = function (key) { return this.columnModel.getPrimaryColumn(key); };
|
42944 |
|
42945 | ColumnApi.prototype.applyColumnState = function (params) { return this.columnModel.applyColumnState(params, 'api'); };
|
42946 |
|
42947 | ColumnApi.prototype.getColumnState = function () { return this.columnModel.getColumnState(); };
|
42948 |
|
42949 | ColumnApi.prototype.resetColumnState = function () { this.columnModel.resetColumnState('api'); };
|
42950 |
|
42951 | ColumnApi.prototype.getColumnGroupState = function () { return this.columnModel.getColumnGroupState(); };
|
42952 |
|
42953 | ColumnApi.prototype.setColumnGroupState = function (stateItems) { this.columnModel.setColumnGroupState(stateItems, 'api'); };
|
42954 |
|
42955 | ColumnApi.prototype.resetColumnGroupState = function () { this.columnModel.resetColumnGroupState('api'); };
|
42956 |
|
42957 | ColumnApi.prototype.isPinning = function () { return this.columnModel.isPinningLeft() || this.columnModel.isPinningRight(); };
|
42958 |
|
42959 | ColumnApi.prototype.isPinningLeft = function () { return this.columnModel.isPinningLeft(); };
|
42960 |
|
42961 | ColumnApi.prototype.isPinningRight = function () { return this.columnModel.isPinningRight(); };
|
42962 |
|
42963 | ColumnApi.prototype.getDisplayedColAfter = function (col) { return this.columnModel.getDisplayedColAfter(col); };
|
42964 |
|
42965 | ColumnApi.prototype.getDisplayedColBefore = function (col) { return this.columnModel.getDisplayedColBefore(col); };
|
42966 |
|
42967 | ColumnApi.prototype.setColumnVisible = function (key, visible) { this.columnModel.setColumnVisible(key, visible, 'api'); };
|
42968 |
|
42969 | ColumnApi.prototype.setColumnsVisible = function (keys, visible) { this.columnModel.setColumnsVisible(keys, visible, 'api'); };
|
42970 |
|
42971 | ColumnApi.prototype.setColumnPinned = function (key, pinned) { this.columnModel.setColumnPinned(key, pinned, 'api'); };
|
42972 |
|
42973 | ColumnApi.prototype.setColumnsPinned = function (keys, pinned) { this.columnModel.setColumnsPinned(keys, pinned, 'api'); };
|
42974 |
|
42975 | ColumnApi.prototype.getAllColumns = function () { return this.columnModel.getAllPrimaryColumns(); };
|
42976 | |
42977 |
|
42978 |
|
42979 |
|
42980 |
|
42981 |
|
42982 |
|
42983 | ColumnApi.prototype.getAllGridColumns = function () { return this.columnModel.getAllGridColumns(); };
|
42984 |
|
42985 | ColumnApi.prototype.getDisplayedLeftColumns = function () { return this.columnModel.getDisplayedLeftColumns(); };
|
42986 |
|
42987 | ColumnApi.prototype.getDisplayedCenterColumns = function () { return this.columnModel.getDisplayedCenterColumns(); };
|
42988 |
|
42989 | ColumnApi.prototype.getDisplayedRightColumns = function () { return this.columnModel.getDisplayedRightColumns(); };
|
42990 |
|
42991 | ColumnApi.prototype.getAllDisplayedColumns = function () { return this.columnModel.getAllDisplayedColumns(); };
|
42992 |
|
42993 | ColumnApi.prototype.getAllDisplayedVirtualColumns = function () { return this.columnModel.getViewportColumns(); };
|
42994 |
|
42995 | ColumnApi.prototype.moveColumn = function (key, toIndex) {
|
42996 | if (typeof key === 'number') {
|
42997 |
|
42998 | 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');
|
42999 | this.columnModel.moveColumnByIndex(key, toIndex, 'api');
|
43000 | }
|
43001 | else {
|
43002 | this.columnModel.moveColumn(key, toIndex, 'api');
|
43003 | }
|
43004 | };
|
43005 |
|
43006 | ColumnApi.prototype.moveColumnByIndex = function (fromIndex, toIndex) { this.columnModel.moveColumnByIndex(fromIndex, toIndex, 'api'); };
|
43007 |
|
43008 | ColumnApi.prototype.moveColumns = function (columnsToMoveKeys, toIndex) { this.columnModel.moveColumns(columnsToMoveKeys, toIndex, 'api'); };
|
43009 |
|
43010 | ColumnApi.prototype.moveRowGroupColumn = function (fromIndex, toIndex) { this.columnModel.moveRowGroupColumn(fromIndex, toIndex); };
|
43011 |
|
43012 | ColumnApi.prototype.setColumnAggFunc = function (key, aggFunc) { this.columnModel.setColumnAggFunc(key, aggFunc); };
|
43013 |
|
43014 | ColumnApi.prototype.setColumnWidth = function (key, newWidth, finished, source) {
|
43015 | if (finished === void 0) { finished = true; }
|
43016 | this.columnModel.setColumnWidths([{ key: key, newWidth: newWidth }], false, finished, source);
|
43017 | };
|
43018 |
|
43019 | ColumnApi.prototype.setColumnWidths = function (columnWidths, finished, source) {
|
43020 | if (finished === void 0) { finished = true; }
|
43021 | this.columnModel.setColumnWidths(columnWidths, false, finished, source);
|
43022 | };
|
43023 |
|
43024 | ColumnApi.prototype.setPivotMode = function (pivotMode) { this.columnModel.setPivotMode(pivotMode); };
|
43025 |
|
43026 | ColumnApi.prototype.isPivotMode = function () { return this.columnModel.isPivotMode(); };
|
43027 |
|
43028 | ColumnApi.prototype.getSecondaryPivotColumn = function (pivotKeys, valueColKey) { return this.columnModel.getSecondaryPivotColumn(pivotKeys, valueColKey); };
|
43029 |
|
43030 | ColumnApi.prototype.setValueColumns = function (colKeys) { this.columnModel.setValueColumns(colKeys, 'api'); };
|
43031 |
|
43032 | ColumnApi.prototype.getValueColumns = function () { return this.columnModel.getValueColumns(); };
|
43033 |
|
43034 | ColumnApi.prototype.removeValueColumn = function (colKey) { this.columnModel.removeValueColumn(colKey, 'api'); };
|
43035 |
|
43036 | ColumnApi.prototype.removeValueColumns = function (colKeys) { this.columnModel.removeValueColumns(colKeys, 'api'); };
|
43037 |
|
43038 | ColumnApi.prototype.addValueColumn = function (colKey) { this.columnModel.addValueColumn(colKey, 'api'); };
|
43039 |
|
43040 | ColumnApi.prototype.addValueColumns = function (colKeys) { this.columnModel.addValueColumns(colKeys, 'api'); };
|
43041 |
|
43042 | ColumnApi.prototype.setRowGroupColumns = function (colKeys) { this.columnModel.setRowGroupColumns(colKeys, 'api'); };
|
43043 |
|
43044 | ColumnApi.prototype.removeRowGroupColumn = function (colKey) { this.columnModel.removeRowGroupColumn(colKey, 'api'); };
|
43045 |
|
43046 | ColumnApi.prototype.removeRowGroupColumns = function (colKeys) { this.columnModel.removeRowGroupColumns(colKeys, 'api'); };
|
43047 |
|
43048 | ColumnApi.prototype.addRowGroupColumn = function (colKey) { this.columnModel.addRowGroupColumn(colKey, 'api'); };
|
43049 |
|
43050 | ColumnApi.prototype.addRowGroupColumns = function (colKeys) { this.columnModel.addRowGroupColumns(colKeys, 'api'); };
|
43051 |
|
43052 | ColumnApi.prototype.getRowGroupColumns = function () { return this.columnModel.getRowGroupColumns(); };
|
43053 |
|
43054 | ColumnApi.prototype.setPivotColumns = function (colKeys) { this.columnModel.setPivotColumns(colKeys, 'api'); };
|
43055 |
|
43056 | ColumnApi.prototype.removePivotColumn = function (colKey) { this.columnModel.removePivotColumn(colKey, 'api'); };
|
43057 |
|
43058 | ColumnApi.prototype.removePivotColumns = function (colKeys) { this.columnModel.removePivotColumns(colKeys, 'api'); };
|
43059 |
|
43060 | ColumnApi.prototype.addPivotColumn = function (colKey) { this.columnModel.addPivotColumn(colKey, 'api'); };
|
43061 |
|
43062 | ColumnApi.prototype.addPivotColumns = function (colKeys) { this.columnModel.addPivotColumns(colKeys, 'api'); };
|
43063 |
|
43064 | ColumnApi.prototype.getPivotColumns = function () { return this.columnModel.getPivotColumns(); };
|
43065 |
|
43066 | ColumnApi.prototype.getLeftDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeLeft(); };
|
43067 |
|
43068 | ColumnApi.prototype.getCenterDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeCentre(); };
|
43069 |
|
43070 | ColumnApi.prototype.getRightDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeRight(); };
|
43071 |
|
43072 | ColumnApi.prototype.getAllDisplayedColumnGroups = function () { return this.columnModel.getAllDisplayedTrees(); };
|
43073 |
|
43074 | ColumnApi.prototype.autoSizeColumn = function (key, skipHeader) { return this.columnModel.autoSizeColumn(key, skipHeader, 'api'); };
|
43075 |
|
43076 | ColumnApi.prototype.autoSizeColumns = function (keys, skipHeader) {
|
43077 | this.columnModel.autoSizeColumns({ columns: keys, skipHeader: skipHeader });
|
43078 | };
|
43079 |
|
43080 | ColumnApi.prototype.autoSizeAllColumns = function (skipHeader) { this.columnModel.autoSizeAllColumns(skipHeader, 'api'); };
|
43081 |
|
43082 | ColumnApi.prototype.setSecondaryColumns = function (colDefs) { this.columnModel.setSecondaryColumns(colDefs, 'api'); };
|
43083 |
|
43084 | ColumnApi.prototype.getSecondaryColumns = function () { return this.columnModel.getSecondaryColumns(); };
|
43085 |
|
43086 | ColumnApi.prototype.getPrimaryColumns = function () { return this.columnModel.getAllPrimaryColumns(); };
|
43087 | ColumnApi.prototype.cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid = function () {
|
43088 |
|
43089 |
|
43090 |
|
43091 |
|
43092 |
|
43093 |
|
43094 | setTimeout(_.removeAllReferences.bind(window, this, 'Column API'), 100);
|
43095 | };
|
43096 |
|
43097 |
|
43098 |
|
43099 |
|
43100 |
|
43101 |
|
43102 | ColumnApi.prototype.columnGroupOpened = function (group, newValue) {
|
43103 | console.error('AG Grid: columnGroupOpened no longer exists, use setColumnGroupOpened');
|
43104 | this.setColumnGroupOpened(group, newValue);
|
43105 | };
|
43106 |
|
43107 | ColumnApi.prototype.hideColumns = function (colIds, hide) {
|
43108 | console.error('AG Grid: hideColumns is deprecated, use setColumnsVisible');
|
43109 | this.columnModel.setColumnsVisible(colIds, !hide, 'api');
|
43110 | };
|
43111 |
|
43112 | ColumnApi.prototype.hideColumn = function (colId, hide) {
|
43113 | console.error('AG Grid: hideColumn is deprecated, use setColumnVisible');
|
43114 | this.columnModel.setColumnVisible(colId, !hide, 'api');
|
43115 | };
|
43116 |
|
43117 | ColumnApi.prototype.setState = function (columnState) {
|
43118 | console.error('AG Grid: setState is deprecated, use setColumnState');
|
43119 | return this.setColumnState(columnState);
|
43120 | };
|
43121 |
|
43122 | ColumnApi.prototype.getState = function () {
|
43123 | console.error('AG Grid: getState is deprecated, use getColumnState');
|
43124 | return this.getColumnState();
|
43125 | };
|
43126 |
|
43127 | ColumnApi.prototype.resetState = function () {
|
43128 | console.error('AG Grid: resetState is deprecated, use resetColumnState');
|
43129 | this.resetColumnState();
|
43130 | };
|
43131 |
|
43132 | ColumnApi.prototype.getAggregationColumns = function () {
|
43133 | console.error('AG Grid: getAggregationColumns is deprecated, use getValueColumns');
|
43134 | return this.columnModel.getValueColumns();
|
43135 | };
|
43136 |
|
43137 | ColumnApi.prototype.removeAggregationColumn = function (colKey) {
|
43138 | console.error('AG Grid: removeAggregationColumn is deprecated, use removeValueColumn');
|
43139 | this.columnModel.removeValueColumn(colKey, 'api');
|
43140 | };
|
43141 |
|
43142 | ColumnApi.prototype.removeAggregationColumns = function (colKeys) {
|
43143 | console.error('AG Grid: removeAggregationColumns is deprecated, use removeValueColumns');
|
43144 | this.columnModel.removeValueColumns(colKeys, 'api');
|
43145 | };
|
43146 |
|
43147 | ColumnApi.prototype.addAggregationColumn = function (colKey) {
|
43148 | console.error('AG Grid: addAggregationColumn is deprecated, use addValueColumn');
|
43149 | this.columnModel.addValueColumn(colKey, 'api');
|
43150 | };
|
43151 |
|
43152 | ColumnApi.prototype.addAggregationColumns = function (colKeys) {
|
43153 | console.error('AG Grid: addAggregationColumns is deprecated, use addValueColumns');
|
43154 | this.columnModel.addValueColumns(colKeys, 'api');
|
43155 | };
|
43156 |
|
43157 | ColumnApi.prototype.setColumnAggFunction = function (column, aggFunc) {
|
43158 | console.error('AG Grid: setColumnAggFunction is deprecated, use setColumnAggFunc');
|
43159 | this.columnModel.setColumnAggFunc(column, aggFunc, 'api');
|
43160 | };
|
43161 |
|
43162 | ColumnApi.prototype.getDisplayNameForCol = function (column) {
|
43163 | console.error('AG Grid: getDisplayNameForCol is deprecated, use getDisplayNameForColumn');
|
43164 | return this.getDisplayNameForColumn(column, null);
|
43165 | };
|
43166 |
|
43167 | ColumnApi.prototype.setColumnState = function (columnState) {
|
43168 | console.error('AG Grid: setColumnState is deprecated, use applyColumnState');
|
43169 | return this.columnModel.applyColumnState({ state: columnState, applyOrder: true }, 'api');
|
43170 | };
|
43171 |
|
43172 | ColumnApi.prototype.getOriginalColumnGroup = function (name) {
|
43173 | console.error('AG Grid: getOriginalColumnGroup is deprecated, use getProvidedColumnGroup');
|
43174 | return this.columnModel.getProvidedColumnGroup(name);
|
43175 | };
|
43176 | __decorate$1R([
|
43177 | Autowired('columnModel')
|
43178 | ], ColumnApi.prototype, "columnModel", void 0);
|
43179 | __decorate$1R([
|
43180 | PreDestroy
|
43181 | ], ColumnApi.prototype, "cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid", null);
|
43182 | ColumnApi = __decorate$1R([
|
43183 | Bean('columnApi')
|
43184 | ], ColumnApi);
|
43185 | return ColumnApi;
|
43186 | }());
|
43187 |
|
43188 |
|
43189 |
|
43190 |
|
43191 |
|
43192 |
|
43193 |
|
43194 | var __extends$2b = (undefined && undefined.__extends) || (function () {
|
43195 | var extendStatics = function (d, b) {
|
43196 | extendStatics = Object.setPrototypeOf ||
|
43197 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43198 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
43199 | return extendStatics(d, b);
|
43200 | };
|
43201 | return function (d, b) {
|
43202 | extendStatics(d, b);
|
43203 | function __() { this.constructor = d; }
|
43204 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43205 | };
|
43206 | })();
|
43207 | var __decorate$1S = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43208 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43209 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43210 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43211 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43212 | };
|
43213 | var ValueService = (function (_super) {
|
43214 | __extends$2b(ValueService, _super);
|
43215 | function ValueService() {
|
43216 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
43217 | _this.initialised = false;
|
43218 | return _this;
|
43219 | }
|
43220 | ValueService.prototype.init = function () {
|
43221 | var _this = this;
|
43222 | this.cellExpressions = this.gridOptionsWrapper.isEnableCellExpressions();
|
43223 | this.initialised = true;
|
43224 |
|
43225 |
|
43226 | this.eventService.addEventListener(Events.EVENT_CELL_VALUE_CHANGED, function (event) { return _this.callColumnCellValueChangedHandler(event); }, this.gridOptionsWrapper.useAsyncEvents());
|
43227 | };
|
43228 | ValueService.prototype.getValue = function (column, rowNode, forFilter, ignoreAggData) {
|
43229 | if (forFilter === void 0) { forFilter = false; }
|
43230 | if (ignoreAggData === void 0) { ignoreAggData = false; }
|
43231 |
|
43232 |
|
43233 | if (!this.initialised) {
|
43234 | this.init();
|
43235 | }
|
43236 | if (!rowNode) {
|
43237 | return;
|
43238 | }
|
43239 |
|
43240 | var colDef = column.getColDef();
|
43241 | var field = colDef.field;
|
43242 | var colId = column.getId();
|
43243 | var data = rowNode.data;
|
43244 | var result;
|
43245 |
|
43246 | var groupDataExists = rowNode.groupData && rowNode.groupData[colId] !== undefined;
|
43247 | var aggDataExists = !ignoreAggData && rowNode.aggData && rowNode.aggData[colId] !== undefined;
|
43248 | if (forFilter && colDef.filterValueGetter) {
|
43249 | result = this.executeFilterValueGetter(colDef.filterValueGetter, data, column, rowNode);
|
43250 | }
|
43251 | else if (this.gridOptionsWrapper.isTreeData() && aggDataExists) {
|
43252 | result = rowNode.aggData[colId];
|
43253 | }
|
43254 | else if (this.gridOptionsWrapper.isTreeData() && colDef.valueGetter) {
|
43255 | result = this.executeValueGetter(colDef.valueGetter, data, column, rowNode);
|
43256 | }
|
43257 | else if (this.gridOptionsWrapper.isTreeData() && (field && data)) {
|
43258 | result = getValueUsingField(data, field, column.isFieldContainsDots());
|
43259 | }
|
43260 | else if (groupDataExists) {
|
43261 | result = rowNode.groupData[colId];
|
43262 | }
|
43263 | else if (aggDataExists) {
|
43264 | result = rowNode.aggData[colId];
|
43265 | }
|
43266 | else if (colDef.valueGetter) {
|
43267 | result = this.executeValueGetter(colDef.valueGetter, data, column, rowNode);
|
43268 | }
|
43269 | else if (field && data) {
|
43270 | result = getValueUsingField(data, field, column.isFieldContainsDots());
|
43271 | }
|
43272 |
|
43273 | if (this.cellExpressions && (typeof result === 'string') && result.indexOf('=') === 0) {
|
43274 | var cellValueGetter = result.substring(1);
|
43275 | result = this.executeValueGetter(cellValueGetter, data, column, rowNode);
|
43276 | }
|
43277 | if (result == null) {
|
43278 | var openedGroup = this.getOpenedGroup(rowNode, column);
|
43279 | if (openedGroup != null) {
|
43280 | return openedGroup;
|
43281 | }
|
43282 | }
|
43283 | return result;
|
43284 | };
|
43285 | ValueService.prototype.getOpenedGroup = function (rowNode, column) {
|
43286 | if (!this.gridOptionsWrapper.isShowOpenedGroup()) {
|
43287 | return;
|
43288 | }
|
43289 | var colDef = column.getColDef();
|
43290 | if (!colDef.showRowGroup) {
|
43291 | return;
|
43292 | }
|
43293 | var showRowGroup = column.getColDef().showRowGroup;
|
43294 | var pointer = rowNode.parent;
|
43295 | while (pointer != null) {
|
43296 | if (pointer.rowGroupColumn && (showRowGroup === true || showRowGroup === pointer.rowGroupColumn.getId())) {
|
43297 | return pointer.key;
|
43298 | }
|
43299 | pointer = pointer.parent;
|
43300 | }
|
43301 | return undefined;
|
43302 | };
|
43303 | |
43304 |
|
43305 |
|
43306 |
|
43307 |
|
43308 |
|
43309 |
|
43310 |
|
43311 | ValueService.prototype.setValue = function (rowNode, colKey, newValue, eventSource) {
|
43312 | var column = this.columnModel.getPrimaryColumn(colKey);
|
43313 | if (!rowNode || !column) {
|
43314 | return false;
|
43315 | }
|
43316 |
|
43317 |
|
43318 | if (missing(rowNode.data)) {
|
43319 | rowNode.data = {};
|
43320 | }
|
43321 |
|
43322 | var _a = column.getColDef(), field = _a.field, newValueHandler = _a.newValueHandler, valueSetter = _a.valueSetter;
|
43323 |
|
43324 | if (missing(field) && missing(newValueHandler) && missing(valueSetter)) {
|
43325 |
|
43326 | console.warn("AG Grid: you need either field or valueSetter set on colDef for editing to work");
|
43327 | return false;
|
43328 | }
|
43329 | var params = {
|
43330 | node: rowNode,
|
43331 | data: rowNode.data,
|
43332 | oldValue: this.getValue(column, rowNode),
|
43333 | newValue: newValue,
|
43334 | colDef: column.getColDef(),
|
43335 | column: column,
|
43336 | api: this.gridOptionsWrapper.getApi(),
|
43337 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
43338 | context: this.gridOptionsWrapper.getContext()
|
43339 | };
|
43340 | params.newValue = newValue;
|
43341 | var valueWasDifferent;
|
43342 | if (newValueHandler && exists(newValueHandler)) {
|
43343 | valueWasDifferent = newValueHandler(params);
|
43344 | }
|
43345 | else if (exists(valueSetter)) {
|
43346 | valueWasDifferent = this.expressionService.evaluate(valueSetter, params);
|
43347 | }
|
43348 | else {
|
43349 | valueWasDifferent = this.setValueUsingField(rowNode.data, field, newValue, column.isFieldContainsDots());
|
43350 | }
|
43351 |
|
43352 |
|
43353 |
|
43354 | if (valueWasDifferent === undefined) {
|
43355 | valueWasDifferent = true;
|
43356 | }
|
43357 |
|
43358 |
|
43359 |
|
43360 | if (!valueWasDifferent) {
|
43361 | return false;
|
43362 | }
|
43363 |
|
43364 | rowNode.resetQuickFilterAggregateText();
|
43365 | this.valueCache.onDataChanged();
|
43366 | params.newValue = this.getValue(column, rowNode);
|
43367 | var event = {
|
43368 | type: Events.EVENT_CELL_VALUE_CHANGED,
|
43369 | event: null,
|
43370 | rowIndex: rowNode.rowIndex,
|
43371 | rowPinned: rowNode.rowPinned,
|
43372 | column: params.column,
|
43373 | api: params.api,
|
43374 | columnApi: params.columnApi,
|
43375 | colDef: params.colDef,
|
43376 | context: params.context,
|
43377 | data: rowNode.data,
|
43378 | node: rowNode,
|
43379 | oldValue: params.oldValue,
|
43380 | newValue: params.newValue,
|
43381 | value: params.newValue,
|
43382 | source: eventSource
|
43383 | };
|
43384 | this.eventService.dispatchEvent(event);
|
43385 | return true;
|
43386 | };
|
43387 | ValueService.prototype.callColumnCellValueChangedHandler = function (event) {
|
43388 | var onCellValueChanged = event.colDef.onCellValueChanged;
|
43389 | if (typeof onCellValueChanged === 'function') {
|
43390 | onCellValueChanged({
|
43391 | node: event.node,
|
43392 | data: event.data,
|
43393 | oldValue: event.oldValue,
|
43394 | newValue: event.newValue,
|
43395 | colDef: event.colDef,
|
43396 | column: event.column,
|
43397 | api: event.api,
|
43398 | columnApi: event.columnApi,
|
43399 | context: event.context
|
43400 | });
|
43401 | }
|
43402 | };
|
43403 | ValueService.prototype.setValueUsingField = function (data, field, newValue, isFieldContainsDots) {
|
43404 | if (!field) {
|
43405 | return false;
|
43406 | }
|
43407 |
|
43408 | var valuesAreSame = false;
|
43409 | if (!isFieldContainsDots) {
|
43410 | data[field] = newValue;
|
43411 | }
|
43412 | else {
|
43413 |
|
43414 | var fieldPieces = field.split('.');
|
43415 | var currentObject = data;
|
43416 | while (fieldPieces.length > 0 && currentObject) {
|
43417 | var fieldPiece = fieldPieces.shift();
|
43418 | if (fieldPieces.length === 0) {
|
43419 | currentObject[fieldPiece] = newValue;
|
43420 | }
|
43421 | else {
|
43422 | currentObject = currentObject[fieldPiece];
|
43423 | }
|
43424 | }
|
43425 | }
|
43426 | return !valuesAreSame;
|
43427 | };
|
43428 | ValueService.prototype.executeFilterValueGetter = function (valueGetter, data, column, rowNode) {
|
43429 | var params = {
|
43430 | data: data,
|
43431 | node: rowNode,
|
43432 | column: column,
|
43433 | colDef: column.getColDef(),
|
43434 | api: this.gridOptionsWrapper.getApi(),
|
43435 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
43436 | context: this.gridOptionsWrapper.getContext(),
|
43437 | getValue: this.getValueCallback.bind(this, rowNode)
|
43438 | };
|
43439 | return this.expressionService.evaluate(valueGetter, params);
|
43440 | };
|
43441 | ValueService.prototype.executeValueGetter = function (valueGetter, data, column, rowNode) {
|
43442 | var colId = column.getId();
|
43443 |
|
43444 | var valueFromCache = this.valueCache.getValue(rowNode, colId);
|
43445 | if (valueFromCache !== undefined) {
|
43446 | return valueFromCache;
|
43447 | }
|
43448 | var params = {
|
43449 | data: data,
|
43450 | node: rowNode,
|
43451 | column: column,
|
43452 | colDef: column.getColDef(),
|
43453 | api: this.gridOptionsWrapper.getApi(),
|
43454 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
43455 | context: this.gridOptionsWrapper.getContext(),
|
43456 | getValue: this.getValueCallback.bind(this, rowNode)
|
43457 | };
|
43458 | var result = this.expressionService.evaluate(valueGetter, params);
|
43459 |
|
43460 | this.valueCache.setValue(rowNode, colId, result);
|
43461 | return result;
|
43462 | };
|
43463 | ValueService.prototype.getValueCallback = function (node, field) {
|
43464 | var otherColumn = this.columnModel.getPrimaryColumn(field);
|
43465 | if (otherColumn) {
|
43466 | return this.getValue(otherColumn, node);
|
43467 | }
|
43468 | return null;
|
43469 | };
|
43470 |
|
43471 | ValueService.prototype.getKeyForNode = function (col, rowNode) {
|
43472 | var value = this.getValue(col, rowNode);
|
43473 | var keyCreator = col.getColDef().keyCreator;
|
43474 | var result = value;
|
43475 | if (keyCreator) {
|
43476 | var keyParams = {
|
43477 | value: value,
|
43478 | colDef: col.getColDef(),
|
43479 | column: col,
|
43480 | node: rowNode,
|
43481 | data: rowNode.data,
|
43482 | api: this.gridOptionsWrapper.getApi(),
|
43483 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
43484 | context: this.gridOptionsWrapper.getContext()
|
43485 | };
|
43486 | result = keyCreator(keyParams);
|
43487 | }
|
43488 |
|
43489 | if (typeof result === 'string' || result == null) {
|
43490 | return result;
|
43491 | }
|
43492 | result = String(result);
|
43493 | if (result === '[object Object]') {
|
43494 | doOnce(function () {
|
43495 | 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');
|
43496 | }, 'getKeyForNode - warn about [object,object]');
|
43497 | }
|
43498 | return result;
|
43499 | };
|
43500 | __decorate$1S([
|
43501 | Autowired('expressionService')
|
43502 | ], ValueService.prototype, "expressionService", void 0);
|
43503 | __decorate$1S([
|
43504 | Autowired('columnModel')
|
43505 | ], ValueService.prototype, "columnModel", void 0);
|
43506 | __decorate$1S([
|
43507 | Autowired('valueCache')
|
43508 | ], ValueService.prototype, "valueCache", void 0);
|
43509 | __decorate$1S([
|
43510 | PostConstruct
|
43511 | ], ValueService.prototype, "init", null);
|
43512 | ValueService = __decorate$1S([
|
43513 | Bean('valueService')
|
43514 | ], ValueService);
|
43515 | return ValueService;
|
43516 | }(BeanStub));
|
43517 |
|
43518 |
|
43519 |
|
43520 |
|
43521 |
|
43522 |
|
43523 |
|
43524 | var __extends$2c = (undefined && undefined.__extends) || (function () {
|
43525 | var extendStatics = function (d, b) {
|
43526 | extendStatics = Object.setPrototypeOf ||
|
43527 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43528 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
43529 | return extendStatics(d, b);
|
43530 | };
|
43531 | return function (d, b) {
|
43532 | extendStatics(d, b);
|
43533 | function __() { this.constructor = d; }
|
43534 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43535 | };
|
43536 | })();
|
43537 | var __decorate$1T = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43538 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43539 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43540 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43541 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43542 | };
|
43543 | var __param$7 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
43544 | return function (target, key) { decorator(target, key, paramIndex); }
|
43545 | };
|
43546 | var ExpressionService = (function (_super) {
|
43547 | __extends$2c(ExpressionService, _super);
|
43548 | function ExpressionService() {
|
43549 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
43550 | _this.expressionToFunctionCache = {};
|
43551 | return _this;
|
43552 | }
|
43553 | ExpressionService.prototype.setBeans = function (loggerFactory) {
|
43554 | this.logger = loggerFactory.create('ExpressionService');
|
43555 | };
|
43556 | ExpressionService.prototype.evaluate = function (expressionOrFunc, params) {
|
43557 | if (typeof expressionOrFunc === 'function') {
|
43558 |
|
43559 | var func = expressionOrFunc;
|
43560 | return func(params);
|
43561 | }
|
43562 | else if (typeof expressionOrFunc === 'string') {
|
43563 |
|
43564 | var expression = expressionOrFunc;
|
43565 | return this.evaluateExpression(expression, params);
|
43566 | }
|
43567 | else {
|
43568 | console.error('AG Grid: value should be either a string or a function', expressionOrFunc);
|
43569 | }
|
43570 | };
|
43571 | ExpressionService.prototype.evaluateExpression = function (expression, params) {
|
43572 | try {
|
43573 | var javaScriptFunction = this.createExpressionFunction(expression);
|
43574 |
|
43575 |
|
43576 | 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);
|
43577 | return result;
|
43578 | }
|
43579 | catch (e) {
|
43580 |
|
43581 |
|
43582 |
|
43583 | console.log('Processing of the expression failed');
|
43584 |
|
43585 | console.log('Expression = ' + expression);
|
43586 |
|
43587 | console.log('Params =', params);
|
43588 |
|
43589 | console.log('Exception = ' + e);
|
43590 | return null;
|
43591 | }
|
43592 | };
|
43593 | ExpressionService.prototype.createExpressionFunction = function (expression) {
|
43594 |
|
43595 | if (this.expressionToFunctionCache[expression]) {
|
43596 | return this.expressionToFunctionCache[expression];
|
43597 | }
|
43598 |
|
43599 | var functionBody = this.createFunctionBody(expression);
|
43600 | var theFunction = new Function('x, ctx, oldValue, newValue, value, node, data, colDef, rowIndex, api, columnApi, getValue, column, columnGroup', functionBody);
|
43601 |
|
43602 | this.expressionToFunctionCache[expression] = theFunction;
|
43603 | return theFunction;
|
43604 | };
|
43605 | ExpressionService.prototype.createFunctionBody = function (expression) {
|
43606 |
|
43607 |
|
43608 | if (expression.indexOf('return') >= 0) {
|
43609 | return expression;
|
43610 | }
|
43611 | else {
|
43612 | return 'return ' + expression + ';';
|
43613 | }
|
43614 | };
|
43615 | __decorate$1T([
|
43616 | __param$7(0, Qualifier('loggerFactory'))
|
43617 | ], ExpressionService.prototype, "setBeans", null);
|
43618 | ExpressionService = __decorate$1T([
|
43619 | Bean('expressionService')
|
43620 | ], ExpressionService);
|
43621 | return ExpressionService;
|
43622 | }(BeanStub));
|
43623 |
|
43624 |
|
43625 |
|
43626 |
|
43627 |
|
43628 |
|
43629 |
|
43630 | var __extends$2d = (undefined && undefined.__extends) || (function () {
|
43631 | var extendStatics = function (d, b) {
|
43632 | extendStatics = Object.setPrototypeOf ||
|
43633 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43634 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
43635 | return extendStatics(d, b);
|
43636 | };
|
43637 | return function (d, b) {
|
43638 | extendStatics(d, b);
|
43639 | function __() { this.constructor = d; }
|
43640 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43641 | };
|
43642 | })();
|
43643 | var __decorate$1U = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43644 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43645 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43646 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43647 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43648 | };
|
43649 | var TemplateService = (function (_super) {
|
43650 | __extends$2d(TemplateService, _super);
|
43651 | function TemplateService() {
|
43652 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
43653 | _this.templateCache = {};
|
43654 | _this.waitingCallbacks = {};
|
43655 | return _this;
|
43656 | }
|
43657 |
|
43658 |
|
43659 | TemplateService.prototype.getTemplate = function (url, callback) {
|
43660 | var templateFromCache = this.templateCache[url];
|
43661 | if (templateFromCache) {
|
43662 | return templateFromCache;
|
43663 | }
|
43664 | var callbackList = this.waitingCallbacks[url];
|
43665 | var that = this;
|
43666 | if (!callbackList) {
|
43667 |
|
43668 | callbackList = [];
|
43669 | this.waitingCallbacks[url] = callbackList;
|
43670 |
|
43671 | var client = new XMLHttpRequest();
|
43672 | client.onload = function () {
|
43673 | that.handleHttpResult(this, url);
|
43674 | };
|
43675 | client.open("GET", url);
|
43676 | client.send();
|
43677 | }
|
43678 |
|
43679 | if (callback) {
|
43680 | callbackList.push(callback);
|
43681 | }
|
43682 |
|
43683 | return null;
|
43684 | };
|
43685 | TemplateService.prototype.handleHttpResult = function (httpResult, url) {
|
43686 | if (httpResult.status !== 200 || httpResult.response === null) {
|
43687 | console.warn("AG Grid: Unable to get template error " + httpResult.status + " - " + url);
|
43688 | return;
|
43689 | }
|
43690 |
|
43691 |
|
43692 | this.templateCache[url] = httpResult.response || httpResult.responseText;
|
43693 |
|
43694 | var callbacks = this.waitingCallbacks[url];
|
43695 | for (var i = 0; i < callbacks.length; i++) {
|
43696 | var callback = callbacks[i];
|
43697 |
|
43698 |
|
43699 |
|
43700 | callback();
|
43701 | }
|
43702 | };
|
43703 | TemplateService = __decorate$1U([
|
43704 | Bean('templateService')
|
43705 | ], TemplateService);
|
43706 | return TemplateService;
|
43707 | }(BeanStub));
|
43708 |
|
43709 |
|
43710 |
|
43711 |
|
43712 |
|
43713 |
|
43714 |
|
43715 | var __extends$2e = (undefined && undefined.__extends) || (function () {
|
43716 | var extendStatics = function (d, b) {
|
43717 | extendStatics = Object.setPrototypeOf ||
|
43718 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43719 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
43720 | return extendStatics(d, b);
|
43721 | };
|
43722 | return function (d, b) {
|
43723 | extendStatics(d, b);
|
43724 | function __() { this.constructor = d; }
|
43725 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43726 | };
|
43727 | })();
|
43728 | var __decorate$1V = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43729 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43730 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43731 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43732 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43733 | };
|
43734 | var __param$8 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
43735 | return function (target, key) { decorator(target, key, paramIndex); }
|
43736 | };
|
43737 | var LoggerFactory = (function (_super) {
|
43738 | __extends$2e(LoggerFactory, _super);
|
43739 | function LoggerFactory() {
|
43740 | return _super !== null && _super.apply(this, arguments) || this;
|
43741 | }
|
43742 | LoggerFactory.prototype.setBeans = function (gridOptionsWrapper) {
|
43743 | this.logging = gridOptionsWrapper.isDebug();
|
43744 | };
|
43745 | LoggerFactory.prototype.create = function (name) {
|
43746 | return new Logger(name, this.isLogging.bind(this));
|
43747 | };
|
43748 | LoggerFactory.prototype.isLogging = function () {
|
43749 | return this.logging;
|
43750 | };
|
43751 | __decorate$1V([
|
43752 | __param$8(0, Qualifier('gridOptionsWrapper'))
|
43753 | ], LoggerFactory.prototype, "setBeans", null);
|
43754 | LoggerFactory = __decorate$1V([
|
43755 | Bean('loggerFactory')
|
43756 | ], LoggerFactory);
|
43757 | return LoggerFactory;
|
43758 | }(BeanStub));
|
43759 | var Logger = (function () {
|
43760 | function Logger(name, isLoggingFunc) {
|
43761 | this.name = name;
|
43762 | this.isLoggingFunc = isLoggingFunc;
|
43763 | }
|
43764 | Logger.prototype.isLogging = function () {
|
43765 | return this.isLoggingFunc();
|
43766 | };
|
43767 | Logger.prototype.log = function (message) {
|
43768 | if (this.isLoggingFunc()) {
|
43769 |
|
43770 | console.log('AG Grid.' + this.name + ': ' + message);
|
43771 | }
|
43772 | };
|
43773 | return Logger;
|
43774 | }());
|
43775 |
|
43776 |
|
43777 |
|
43778 |
|
43779 |
|
43780 |
|
43781 |
|
43782 | var __extends$2f = (undefined && undefined.__extends) || (function () {
|
43783 | var extendStatics = function (d, b) {
|
43784 | extendStatics = Object.setPrototypeOf ||
|
43785 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43786 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
43787 | return extendStatics(d, b);
|
43788 | };
|
43789 | return function (d, b) {
|
43790 | extendStatics(d, b);
|
43791 | function __() { this.constructor = d; }
|
43792 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43793 | };
|
43794 | })();
|
43795 | var __decorate$1W = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43796 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43797 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43798 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43799 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43800 | };
|
43801 | var GridCtrl = (function (_super) {
|
43802 | __extends$2f(GridCtrl, _super);
|
43803 | function GridCtrl() {
|
43804 | return _super !== null && _super.apply(this, arguments) || this;
|
43805 | }
|
43806 | GridCtrl.prototype.setComp = function (view, eGridDiv, eGui) {
|
43807 | var _this = this;
|
43808 | this.view = view;
|
43809 | this.eGridHostDiv = eGridDiv;
|
43810 | this.eGui = eGui;
|
43811 | this.mouseEventService.stampTopLevelGridCompWithGridInstance(eGridDiv);
|
43812 | this.createManagedBean(new LayoutFeature(this.view));
|
43813 |
|
43814 |
|
43815 | this.addRtlSupport();
|
43816 | this.addManagedListener(this, Events.EVENT_KEYBOARD_FOCUS, function () {
|
43817 | _this.view.addOrRemoveKeyboardFocusClass(true);
|
43818 | });
|
43819 | this.addManagedListener(this, Events.EVENT_MOUSE_FOCUS, function () {
|
43820 | _this.view.addOrRemoveKeyboardFocusClass(false);
|
43821 | });
|
43822 | var unsubscribeFromResize = this.resizeObserverService.observeResize(this.eGridHostDiv, this.onGridSizeChanged.bind(this));
|
43823 | this.addDestroyFunc(function () { return unsubscribeFromResize(); });
|
43824 | this.ctrlsService.registerGridCtrl(this);
|
43825 | };
|
43826 | GridCtrl.prototype.isDetailGrid = function () {
|
43827 | var _a, _b;
|
43828 | var el = this.focusService.findTabbableParent(this.getGui());
|
43829 | return ((_b = (_a = el) === null || _a === void 0 ? void 0 : _a.getAttribute('row-id')) === null || _b === void 0 ? void 0 : _b.startsWith('detail')) || false;
|
43830 | };
|
43831 | GridCtrl.prototype.showDropZones = function () {
|
43832 | return ModuleRegistry.isRegistered(ModuleNames.RowGroupingModule);
|
43833 | };
|
43834 | GridCtrl.prototype.showSideBar = function () {
|
43835 | return ModuleRegistry.isRegistered(ModuleNames.SideBarModule);
|
43836 | };
|
43837 | GridCtrl.prototype.showStatusBar = function () {
|
43838 | return ModuleRegistry.isRegistered(ModuleNames.StatusBarModule);
|
43839 | };
|
43840 | GridCtrl.prototype.showWatermark = function () {
|
43841 | return ModuleRegistry.isRegistered(ModuleNames.EnterpriseCoreModule);
|
43842 | };
|
43843 | GridCtrl.prototype.onGridSizeChanged = function () {
|
43844 | var event = {
|
43845 | type: Events.EVENT_GRID_SIZE_CHANGED,
|
43846 | api: this.gridApi,
|
43847 | columnApi: this.columnApi,
|
43848 | clientWidth: this.eGridHostDiv.clientWidth,
|
43849 | clientHeight: this.eGridHostDiv.clientHeight
|
43850 | };
|
43851 | this.eventService.dispatchEvent(event);
|
43852 | };
|
43853 | GridCtrl.prototype.addRtlSupport = function () {
|
43854 | var cssClass = this.gridOptionsWrapper.isEnableRtl() ? 'ag-rtl' : 'ag-ltr';
|
43855 | this.view.setRtlClass(cssClass);
|
43856 | };
|
43857 | GridCtrl.prototype.destroyGridUi = function () {
|
43858 | this.view.destroyGridUi();
|
43859 | };
|
43860 | GridCtrl.prototype.getGui = function () {
|
43861 | return this.eGui;
|
43862 | };
|
43863 | GridCtrl.prototype.setResizeCursor = function (on) {
|
43864 | this.view.setCursor(on ? 'ew-resize' : null);
|
43865 | };
|
43866 | GridCtrl.prototype.disableUserSelect = function (on) {
|
43867 | this.view.setUserSelect(on ? 'none' : null);
|
43868 | };
|
43869 | GridCtrl.prototype.focusNextInnerContainer = function (backwards) {
|
43870 | var eDocument = this.gridOptionsWrapper.getDocument();
|
43871 | var focusableContainers = this.view.getFocusableContainers();
|
43872 | var idxWithFocus = focusableContainers.findIndex(function (container) { return container.contains(eDocument.activeElement); });
|
43873 | var nextIdx = idxWithFocus + (backwards ? -1 : 1);
|
43874 | if (nextIdx <= 0 || nextIdx >= focusableContainers.length) {
|
43875 | return false;
|
43876 | }
|
43877 | return this.focusService.focusInto(focusableContainers[nextIdx]);
|
43878 | };
|
43879 | GridCtrl.prototype.focusInnerElement = function (fromBottom) {
|
43880 | var focusableContainers = this.view.getFocusableContainers();
|
43881 | if (fromBottom) {
|
43882 | if (focusableContainers.length > 1) {
|
43883 | return this.focusService.focusInto(last(focusableContainers), true);
|
43884 | }
|
43885 | var lastColumn = last(this.columnModel.getAllDisplayedColumns());
|
43886 | if (this.focusService.focusGridView(lastColumn, true)) {
|
43887 | return true;
|
43888 | }
|
43889 | }
|
43890 | return this.focusService.focusFirstHeader();
|
43891 | };
|
43892 | GridCtrl.prototype.forceFocusOutOfContainer = function (up) {
|
43893 | if (up === void 0) { up = false; }
|
43894 | this.view.forceFocusOutOfContainer(up);
|
43895 | };
|
43896 | __decorate$1W([
|
43897 | Autowired('columnApi')
|
43898 | ], GridCtrl.prototype, "columnApi", void 0);
|
43899 | __decorate$1W([
|
43900 | Autowired('gridApi')
|
43901 | ], GridCtrl.prototype, "gridApi", void 0);
|
43902 | __decorate$1W([
|
43903 | Autowired('focusService')
|
43904 | ], GridCtrl.prototype, "focusService", void 0);
|
43905 | __decorate$1W([
|
43906 | Autowired('resizeObserverService')
|
43907 | ], GridCtrl.prototype, "resizeObserverService", void 0);
|
43908 | __decorate$1W([
|
43909 | Autowired('columnModel')
|
43910 | ], GridCtrl.prototype, "columnModel", void 0);
|
43911 | __decorate$1W([
|
43912 | Autowired('ctrlsService')
|
43913 | ], GridCtrl.prototype, "ctrlsService", void 0);
|
43914 | __decorate$1W([
|
43915 | Autowired('mouseEventService')
|
43916 | ], GridCtrl.prototype, "mouseEventService", void 0);
|
43917 | return GridCtrl;
|
43918 | }(BeanStub));
|
43919 |
|
43920 |
|
43921 |
|
43922 |
|
43923 |
|
43924 |
|
43925 |
|
43926 | var __extends$2g = (undefined && undefined.__extends) || (function () {
|
43927 | var extendStatics = function (d, b) {
|
43928 | extendStatics = Object.setPrototypeOf ||
|
43929 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43930 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
43931 | return extendStatics(d, b);
|
43932 | };
|
43933 | return function (d, b) {
|
43934 | extendStatics(d, b);
|
43935 | function __() { this.constructor = d; }
|
43936 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43937 | };
|
43938 | })();
|
43939 | var __decorate$1X = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43940 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43941 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43942 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43943 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43944 | };
|
43945 | var GridComp = (function (_super) {
|
43946 | __extends$2g(GridComp, _super);
|
43947 | function GridComp(eGridDiv) {
|
43948 | var _this = _super.call(this, undefined) || this;
|
43949 | _this.eGridDiv = eGridDiv;
|
43950 | return _this;
|
43951 | }
|
43952 | GridComp.prototype.postConstruct = function () {
|
43953 | var _this = this;
|
43954 | this.logger = this.loggerFactory.create('GridComp');
|
43955 | var compProxy = {
|
43956 | destroyGridUi: function () { return _this.destroyBean(_this); },
|
43957 | setRtlClass: function (cssClass) { return _this.addCssClass(cssClass); },
|
43958 | addOrRemoveKeyboardFocusClass: function (addOrRemove) { return _this.addOrRemoveCssClass(FocusService.AG_KEYBOARD_FOCUS, addOrRemove); },
|
43959 | forceFocusOutOfContainer: this.forceFocusOutOfContainer.bind(this),
|
43960 | updateLayoutClasses: this.updateLayoutClasses.bind(this),
|
43961 | getFocusableContainers: this.getFocusableContainers.bind(this),
|
43962 | setUserSelect: function (value) {
|
43963 | _this.getGui().style.userSelect = value != null ? value : '';
|
43964 | _this.getGui().style.webkitUserSelect = value != null ? value : '';
|
43965 | },
|
43966 | setCursor: function (value) {
|
43967 | _this.getGui().style.cursor = value != null ? value : '';
|
43968 | }
|
43969 | };
|
43970 | this.ctrl = this.createManagedBean(new GridCtrl());
|
43971 | var template = this.createTemplate();
|
43972 | this.setTemplate(template);
|
43973 | this.ctrl.setComp(compProxy, this.eGridDiv, this.getGui());
|
43974 | this.insertGridIntoDom();
|
43975 | this.initialiseTabGuard({
|
43976 |
|
43977 | onTabKeyDown: function () { return undefined; },
|
43978 | focusInnerElement: function (fromBottom) { return _this.ctrl.focusInnerElement(fromBottom); }
|
43979 | });
|
43980 | };
|
43981 | GridComp.prototype.insertGridIntoDom = function () {
|
43982 | var _this = this;
|
43983 | var eGui = this.getGui();
|
43984 | this.eGridDiv.appendChild(eGui);
|
43985 | this.addDestroyFunc(function () {
|
43986 | _this.eGridDiv.removeChild(eGui);
|
43987 | _this.logger.log('Grid removed from DOM');
|
43988 | });
|
43989 | };
|
43990 | GridComp.prototype.updateLayoutClasses = function (cssClass, params) {
|
43991 | var eRootWrapperBodyClassList = this.eRootWrapperBody.classList;
|
43992 | eRootWrapperBodyClassList.toggle(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
|
43993 | eRootWrapperBodyClassList.toggle(LayoutCssClasses.NORMAL, params.normal);
|
43994 | eRootWrapperBodyClassList.toggle(LayoutCssClasses.PRINT, params.print);
|
43995 | this.addOrRemoveCssClass(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
|
43996 | this.addOrRemoveCssClass(LayoutCssClasses.NORMAL, params.normal);
|
43997 | this.addOrRemoveCssClass(LayoutCssClasses.PRINT, params.print);
|
43998 | };
|
43999 | GridComp.prototype.createTemplate = function () {
|
44000 | var dropZones = this.ctrl.showDropZones() ? '<ag-grid-header-drop-zones></ag-grid-header-drop-zones>' : '';
|
44001 | var sideBar = this.ctrl.showSideBar() ? '<ag-side-bar ref="sideBar"></ag-side-bar>' : '';
|
44002 | var statusBar = this.ctrl.showStatusBar() ? '<ag-status-bar ref="statusBar"></ag-status-bar>' : '';
|
44003 | var watermark = this.ctrl.showWatermark() ? '<ag-watermark></ag-watermark>' : '';
|
44004 | 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>";
|
44005 | return template;
|
44006 | };
|
44007 | GridComp.prototype.getFocusableElement = function () {
|
44008 | return this.eRootWrapperBody;
|
44009 | };
|
44010 | GridComp.prototype.getFocusableContainers = function () {
|
44011 | var focusableContainers = [
|
44012 | this.gridBodyComp.getGui()
|
44013 | ];
|
44014 | if (this.sideBarComp) {
|
44015 | focusableContainers.push(this.sideBarComp.getGui());
|
44016 | }
|
44017 | return focusableContainers.filter(function (el) { return isVisible(el); });
|
44018 | };
|
44019 | __decorate$1X([
|
44020 | Autowired('loggerFactory')
|
44021 | ], GridComp.prototype, "loggerFactory", void 0);
|
44022 | __decorate$1X([
|
44023 | RefSelector('gridBody')
|
44024 | ], GridComp.prototype, "gridBodyComp", void 0);
|
44025 | __decorate$1X([
|
44026 | RefSelector('sideBar')
|
44027 | ], GridComp.prototype, "sideBarComp", void 0);
|
44028 | __decorate$1X([
|
44029 | RefSelector('rootWrapperBody')
|
44030 | ], GridComp.prototype, "eRootWrapperBody", void 0);
|
44031 | __decorate$1X([
|
44032 | PostConstruct
|
44033 | ], GridComp.prototype, "postConstruct", null);
|
44034 | return GridComp;
|
44035 | }(TabGuardComp));
|
44036 |
|
44037 |
|
44038 |
|
44039 |
|
44040 |
|
44041 |
|
44042 |
|
44043 | var __extends$2h = (undefined && undefined.__extends) || (function () {
|
44044 | var extendStatics = function (d, b) {
|
44045 | extendStatics = Object.setPrototypeOf ||
|
44046 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44047 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
44048 | return extendStatics(d, b);
|
44049 | };
|
44050 | return function (d, b) {
|
44051 | extendStatics(d, b);
|
44052 | function __() { this.constructor = d; }
|
44053 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44054 | };
|
44055 | })();
|
44056 | var __decorate$1Y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44057 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44058 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44059 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44060 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44061 | };
|
44062 | var SortController = (function (_super) {
|
44063 | __extends$2h(SortController, _super);
|
44064 | function SortController() {
|
44065 | return _super !== null && _super.apply(this, arguments) || this;
|
44066 | }
|
44067 | SortController_1 = SortController;
|
44068 | SortController.prototype.progressSort = function (column, multiSort, source) {
|
44069 | var nextDirection = this.getNextSortDirection(column);
|
44070 | this.setSortForColumn(column, nextDirection, multiSort, source);
|
44071 | };
|
44072 | SortController.prototype.setSortForColumn = function (column, sort, multiSort, source) {
|
44073 |
|
44074 | if (sort !== Constants.SORT_ASC && sort !== Constants.SORT_DESC) {
|
44075 | sort = null;
|
44076 | }
|
44077 |
|
44078 | column.setSort(sort, source);
|
44079 | var doingMultiSort = (multiSort || this.gridOptionsWrapper.isAlwaysMultiSort()) && !this.gridOptionsWrapper.isSuppressMultiSort();
|
44080 |
|
44081 | if (!doingMultiSort) {
|
44082 | this.clearSortBarThisColumn(column, source);
|
44083 | }
|
44084 |
|
44085 | this.updateSortIndex(column);
|
44086 | this.dispatchSortChangedEvents(source);
|
44087 | };
|
44088 | SortController.prototype.updateSortIndex = function (lastColToChange) {
|
44089 |
|
44090 | var allSortedCols = this.getColumnsWithSortingOrdered();
|
44091 | var sortIndex = 0;
|
44092 | allSortedCols.forEach(function (col) {
|
44093 | if (col !== lastColToChange) {
|
44094 | col.setSortIndex(sortIndex);
|
44095 | sortIndex++;
|
44096 | }
|
44097 | });
|
44098 |
|
44099 | if (lastColToChange.getSort()) {
|
44100 | lastColToChange.setSortIndex(sortIndex);
|
44101 | }
|
44102 |
|
44103 | var allCols = this.columnModel.getPrimaryAndSecondaryAndAutoColumns();
|
44104 | allCols.filter(function (col) { return col.getSort() == null; }).forEach(function (col) { return col.setSortIndex(); });
|
44105 | };
|
44106 |
|
44107 |
|
44108 | SortController.prototype.onSortChanged = function (source) {
|
44109 | this.dispatchSortChangedEvents(source);
|
44110 | };
|
44111 | SortController.prototype.isSortActive = function () {
|
44112 |
|
44113 | var allCols = this.columnModel.getPrimaryAndSecondaryAndAutoColumns();
|
44114 | var sortedCols = allCols.filter(function (column) { return !!column.getSort(); });
|
44115 | return sortedCols && sortedCols.length > 0;
|
44116 | };
|
44117 | SortController.prototype.dispatchSortChangedEvents = function (source) {
|
44118 | var event = {
|
44119 | type: Events.EVENT_SORT_CHANGED,
|
44120 | api: this.gridApi,
|
44121 | columnApi: this.columnApi,
|
44122 | source: source
|
44123 | };
|
44124 | this.eventService.dispatchEvent(event);
|
44125 | };
|
44126 | SortController.prototype.clearSortBarThisColumn = function (columnToSkip, source) {
|
44127 | this.columnModel.getPrimaryAndSecondaryAndAutoColumns().forEach(function (columnToClear) {
|
44128 |
|
44129 | if (columnToClear !== columnToSkip) {
|
44130 |
|
44131 |
|
44132 | columnToClear.setSort(undefined, source);
|
44133 | }
|
44134 | });
|
44135 | };
|
44136 | SortController.prototype.getNextSortDirection = function (column) {
|
44137 | var sortingOrder;
|
44138 | if (column.getColDef().sortingOrder) {
|
44139 | sortingOrder = column.getColDef().sortingOrder;
|
44140 | }
|
44141 | else if (this.gridOptionsWrapper.getSortingOrder()) {
|
44142 | sortingOrder = this.gridOptionsWrapper.getSortingOrder();
|
44143 | }
|
44144 | else {
|
44145 | sortingOrder = SortController_1.DEFAULT_SORTING_ORDER;
|
44146 | }
|
44147 | if (!Array.isArray(sortingOrder) || sortingOrder.length <= 0) {
|
44148 | console.warn("AG Grid: sortingOrder must be an array with at least one element, currently it's " + sortingOrder);
|
44149 | return null;
|
44150 | }
|
44151 | var currentIndex = sortingOrder.indexOf(column.getSort());
|
44152 | var notInArray = currentIndex < 0;
|
44153 | var lastItemInArray = currentIndex == sortingOrder.length - 1;
|
44154 | var result;
|
44155 | if (notInArray || lastItemInArray) {
|
44156 | result = sortingOrder[0];
|
44157 | }
|
44158 | else {
|
44159 | result = sortingOrder[currentIndex + 1];
|
44160 | }
|
44161 |
|
44162 | if (SortController_1.DEFAULT_SORTING_ORDER.indexOf(result) < 0) {
|
44163 | console.warn('AG Grid: invalid sort type ' + result);
|
44164 | return null;
|
44165 | }
|
44166 | return result;
|
44167 | };
|
44168 | SortController.prototype.getColumnsWithSortingOrdered = function () {
|
44169 |
|
44170 | var allColumnsIncludingAuto = this.columnModel.getPrimaryAndSecondaryAndAutoColumns();
|
44171 | var columnsWithSorting = allColumnsIncludingAuto.filter(function (column) { return !!column.getSort(); });
|
44172 |
|
44173 |
|
44174 |
|
44175 | var allColsIndexes = {};
|
44176 | allColumnsIncludingAuto.forEach(function (col, index) { return allColsIndexes[col.getId()] = index; });
|
44177 |
|
44178 | columnsWithSorting.sort(function (a, b) {
|
44179 | var iA = a.getSortIndex();
|
44180 | var iB = b.getSortIndex();
|
44181 | if (iA != null && iB != null) {
|
44182 | return iA - iB;
|
44183 | }
|
44184 | else if (iA == null && iB == null) {
|
44185 |
|
44186 | var posA = allColsIndexes[a.getId()];
|
44187 | var posB = allColsIndexes[b.getId()];
|
44188 | return posA > posB ? 1 : -1;
|
44189 | }
|
44190 | else if (iB == null) {
|
44191 | return -1;
|
44192 | }
|
44193 | else {
|
44194 | return 1;
|
44195 | }
|
44196 | });
|
44197 | return columnsWithSorting;
|
44198 | };
|
44199 |
|
44200 | SortController.prototype.getSortModel = function () {
|
44201 | return this.getColumnsWithSortingOrdered().map(function (column) { return ({
|
44202 | sort: column.getSort(),
|
44203 | colId: column.getId()
|
44204 | }); });
|
44205 | };
|
44206 | SortController.prototype.getSortOptions = function () {
|
44207 | return this.getColumnsWithSortingOrdered().map(function (column) { return ({
|
44208 | sort: column.getSort(),
|
44209 | column: column
|
44210 | }); });
|
44211 | };
|
44212 | var SortController_1;
|
44213 | SortController.DEFAULT_SORTING_ORDER = [Constants.SORT_ASC, Constants.SORT_DESC, null];
|
44214 | __decorate$1Y([
|
44215 | Autowired('columnModel')
|
44216 | ], SortController.prototype, "columnModel", void 0);
|
44217 | __decorate$1Y([
|
44218 | Autowired('columnApi')
|
44219 | ], SortController.prototype, "columnApi", void 0);
|
44220 | __decorate$1Y([
|
44221 | Autowired('gridApi')
|
44222 | ], SortController.prototype, "gridApi", void 0);
|
44223 | SortController = SortController_1 = __decorate$1Y([
|
44224 | Bean('sortController')
|
44225 | ], SortController);
|
44226 | return SortController;
|
44227 | }(BeanStub));
|
44228 |
|
44229 |
|
44230 |
|
44231 |
|
44232 |
|
44233 |
|
44234 |
|
44235 | var __extends$2i = (undefined && undefined.__extends) || (function () {
|
44236 | var extendStatics = function (d, b) {
|
44237 | extendStatics = Object.setPrototypeOf ||
|
44238 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44239 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
44240 | return extendStatics(d, b);
|
44241 | };
|
44242 | return function (d, b) {
|
44243 | extendStatics(d, b);
|
44244 | function __() { this.constructor = d; }
|
44245 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44246 | };
|
44247 | })();
|
44248 | var __decorate$1Z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44249 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44250 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44251 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44252 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44253 | };
|
44254 | var ColumnHoverService = (function (_super) {
|
44255 | __extends$2i(ColumnHoverService, _super);
|
44256 | function ColumnHoverService() {
|
44257 | return _super !== null && _super.apply(this, arguments) || this;
|
44258 | }
|
44259 | ColumnHoverService.prototype.setMouseOver = function (columns) {
|
44260 | this.selectedColumns = columns;
|
44261 | var event = {
|
44262 | type: Events.EVENT_COLUMN_HOVER_CHANGED,
|
44263 | api: this.gridApi,
|
44264 | columnApi: this.columnApi
|
44265 | };
|
44266 | this.eventService.dispatchEvent(event);
|
44267 | };
|
44268 | ColumnHoverService.prototype.clearMouseOver = function () {
|
44269 | this.selectedColumns = null;
|
44270 | var event = {
|
44271 | type: Events.EVENT_COLUMN_HOVER_CHANGED,
|
44272 | api: this.gridApi,
|
44273 | columnApi: this.columnApi
|
44274 | };
|
44275 | this.eventService.dispatchEvent(event);
|
44276 | };
|
44277 | ColumnHoverService.prototype.isHovered = function (column) {
|
44278 | return !!this.selectedColumns && this.selectedColumns.indexOf(column) >= 0;
|
44279 | };
|
44280 | __decorate$1Z([
|
44281 | Autowired('columnApi')
|
44282 | ], ColumnHoverService.prototype, "columnApi", void 0);
|
44283 | __decorate$1Z([
|
44284 | Autowired('gridApi')
|
44285 | ], ColumnHoverService.prototype, "gridApi", void 0);
|
44286 | ColumnHoverService = __decorate$1Z([
|
44287 | Bean('columnHoverService')
|
44288 | ], ColumnHoverService);
|
44289 | return ColumnHoverService;
|
44290 | }(BeanStub));
|
44291 |
|
44292 |
|
44293 |
|
44294 |
|
44295 |
|
44296 |
|
44297 |
|
44298 | var __extends$2j = (undefined && undefined.__extends) || (function () {
|
44299 | var extendStatics = function (d, b) {
|
44300 | extendStatics = Object.setPrototypeOf ||
|
44301 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44302 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
44303 | return extendStatics(d, b);
|
44304 | };
|
44305 | return function (d, b) {
|
44306 | extendStatics(d, b);
|
44307 | function __() { this.constructor = d; }
|
44308 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44309 | };
|
44310 | })();
|
44311 | var __decorate$1_ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44312 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44313 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44314 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44315 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44316 | };
|
44317 | var ColumnAnimationService = (function (_super) {
|
44318 | __extends$2j(ColumnAnimationService, _super);
|
44319 | function ColumnAnimationService() {
|
44320 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
44321 | _this.executeNextFuncs = [];
|
44322 | _this.executeLaterFuncs = [];
|
44323 | _this.active = false;
|
44324 | _this.animationThreadCount = 0;
|
44325 | return _this;
|
44326 | }
|
44327 | ColumnAnimationService.prototype.postConstruct = function () {
|
44328 | var _this = this;
|
44329 | this.ctrlsService.whenReady(function (p) { return _this.gridBodyCtrl = p.gridBodyCtrl; });
|
44330 | };
|
44331 | ColumnAnimationService.prototype.isActive = function () {
|
44332 | return this.active;
|
44333 | };
|
44334 | ColumnAnimationService.prototype.start = function () {
|
44335 | if (this.active) {
|
44336 | return;
|
44337 | }
|
44338 | if (this.gridOptionsWrapper.isSuppressColumnMoveAnimation()) {
|
44339 | return;
|
44340 | }
|
44341 |
|
44342 |
|
44343 |
|
44344 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
44345 | return;
|
44346 | }
|
44347 | this.ensureAnimationCssClassPresent();
|
44348 | this.active = true;
|
44349 | };
|
44350 | ColumnAnimationService.prototype.finish = function () {
|
44351 | if (!this.active) {
|
44352 | return;
|
44353 | }
|
44354 | this.flush();
|
44355 | this.active = false;
|
44356 | };
|
44357 | ColumnAnimationService.prototype.executeNextVMTurn = function (func) {
|
44358 | if (this.active) {
|
44359 | this.executeNextFuncs.push(func);
|
44360 | }
|
44361 | else {
|
44362 | func();
|
44363 | }
|
44364 | };
|
44365 | ColumnAnimationService.prototype.executeLaterVMTurn = function (func) {
|
44366 | if (this.active) {
|
44367 | this.executeLaterFuncs.push(func);
|
44368 | }
|
44369 | else {
|
44370 | func();
|
44371 | }
|
44372 | };
|
44373 | ColumnAnimationService.prototype.ensureAnimationCssClassPresent = function () {
|
44374 | var _this = this;
|
44375 |
|
44376 |
|
44377 | this.animationThreadCount++;
|
44378 | var animationThreadCountCopy = this.animationThreadCount;
|
44379 | this.gridBodyCtrl.setColumnMovingCss(true);
|
44380 | this.executeLaterFuncs.push(function () {
|
44381 |
|
44382 | if (_this.animationThreadCount === animationThreadCountCopy) {
|
44383 | _this.gridBodyCtrl.setColumnMovingCss(false);
|
44384 | }
|
44385 | });
|
44386 | };
|
44387 | ColumnAnimationService.prototype.flush = function () {
|
44388 | var nowFuncs = this.executeNextFuncs;
|
44389 | this.executeNextFuncs = [];
|
44390 | var waitFuncs = this.executeLaterFuncs;
|
44391 | this.executeLaterFuncs = [];
|
44392 | if (nowFuncs.length === 0 && waitFuncs.length === 0) {
|
44393 | return;
|
44394 | }
|
44395 | window.setTimeout(function () { return nowFuncs.forEach(function (func) { return func(); }); }, 0);
|
44396 | window.setTimeout(function () { return waitFuncs.forEach(function (func) { return func(); }); }, 300);
|
44397 | };
|
44398 | __decorate$1_([
|
44399 | Autowired('ctrlsService')
|
44400 | ], ColumnAnimationService.prototype, "ctrlsService", void 0);
|
44401 | __decorate$1_([
|
44402 | PostConstruct
|
44403 | ], ColumnAnimationService.prototype, "postConstruct", null);
|
44404 | ColumnAnimationService = __decorate$1_([
|
44405 | Bean('columnAnimationService')
|
44406 | ], ColumnAnimationService);
|
44407 | return ColumnAnimationService;
|
44408 | }(BeanStub));
|
44409 |
|
44410 |
|
44411 |
|
44412 |
|
44413 |
|
44414 |
|
44415 |
|
44416 | var __extends$2k = (undefined && undefined.__extends) || (function () {
|
44417 | var extendStatics = function (d, b) {
|
44418 | extendStatics = Object.setPrototypeOf ||
|
44419 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44420 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
44421 | return extendStatics(d, b);
|
44422 | };
|
44423 | return function (d, b) {
|
44424 | extendStatics(d, b);
|
44425 | function __() { this.constructor = d; }
|
44426 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44427 | };
|
44428 | })();
|
44429 | var __decorate$1$ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44430 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44431 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44432 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44433 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44434 | };
|
44435 | var AutoGroupColService = (function (_super) {
|
44436 | __extends$2k(AutoGroupColService, _super);
|
44437 | function AutoGroupColService() {
|
44438 | return _super !== null && _super.apply(this, arguments) || this;
|
44439 | }
|
44440 | AutoGroupColService_1 = AutoGroupColService;
|
44441 | AutoGroupColService.prototype.createAutoGroupColumns = function (existingCols, rowGroupColumns) {
|
44442 | var _this = this;
|
44443 | var groupAutoColumns = [];
|
44444 | var doingTreeData = this.gridOptionsWrapper.isTreeData();
|
44445 | var doingMultiAutoColumn = this.gridOptionsWrapper.isGroupMultiAutoColumn();
|
44446 | if (doingTreeData && doingMultiAutoColumn) {
|
44447 | console.warn('AG Grid: you cannot mix groupMultiAutoColumn with treeData, only one column can be used to display groups when doing tree data');
|
44448 | doingMultiAutoColumn = false;
|
44449 | }
|
44450 |
|
44451 |
|
44452 | if (doingMultiAutoColumn) {
|
44453 | rowGroupColumns.forEach(function (rowGroupCol, index) {
|
44454 | groupAutoColumns.push(_this.createOneAutoGroupColumn(existingCols, rowGroupCol, index));
|
44455 | });
|
44456 | }
|
44457 | else {
|
44458 | groupAutoColumns.push(this.createOneAutoGroupColumn(existingCols));
|
44459 | }
|
44460 | return groupAutoColumns;
|
44461 | };
|
44462 |
|
44463 | AutoGroupColService.prototype.createOneAutoGroupColumn = function (existingCols, rowGroupCol, index) {
|
44464 |
|
44465 | var defaultAutoColDef = this.generateDefaultColDef(rowGroupCol);
|
44466 |
|
44467 | var colId;
|
44468 | if (rowGroupCol) {
|
44469 | colId = Constants.GROUP_AUTO_COLUMN_ID + "-" + rowGroupCol.getId();
|
44470 | }
|
44471 | else {
|
44472 | colId = AutoGroupColService_1.GROUP_AUTO_COLUMN_BUNDLE_ID;
|
44473 | }
|
44474 | var userAutoColDef = this.gridOptionsWrapper.getAutoGroupColumnDef();
|
44475 | mergeDeep(defaultAutoColDef, userAutoColDef);
|
44476 | defaultAutoColDef = this.columnFactory.mergeColDefs(defaultAutoColDef);
|
44477 | defaultAutoColDef.colId = colId;
|
44478 |
|
44479 | if (!this.gridOptionsWrapper.isTreeData()) {
|
44480 |
|
44481 |
|
44482 | var noFieldOrValueGetter = missing(defaultAutoColDef.field) && missing(defaultAutoColDef.valueGetter) && missing(defaultAutoColDef.filterValueGetter);
|
44483 | if (noFieldOrValueGetter) {
|
44484 | defaultAutoColDef.filter = false;
|
44485 | }
|
44486 | }
|
44487 |
|
44488 | if (index && index > 0) {
|
44489 | defaultAutoColDef.headerCheckboxSelection = false;
|
44490 | }
|
44491 | var existingCol = existingCols.find(function (col) { return col.getId() == colId; });
|
44492 | if (existingCol) {
|
44493 | existingCol.setColDef(defaultAutoColDef, null);
|
44494 | this.columnFactory.applyColumnState(existingCol, defaultAutoColDef);
|
44495 | return existingCol;
|
44496 | }
|
44497 | var newCol = new Column(defaultAutoColDef, null, colId, true);
|
44498 | this.context.createBean(newCol);
|
44499 | return newCol;
|
44500 | };
|
44501 | AutoGroupColService.prototype.generateDefaultColDef = function (rowGroupCol) {
|
44502 | var userDef = this.gridOptionsWrapper.getAutoGroupColumnDef();
|
44503 | var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
|
44504 | var res = {
|
44505 | headerName: localeTextFunc('group', 'Group')
|
44506 | };
|
44507 | var userHasProvidedGroupCellRenderer = userDef &&
|
44508 | (userDef.cellRenderer || userDef.cellRendererFramework || userDef.cellRendererSelector);
|
44509 |
|
44510 | if (!userHasProvidedGroupCellRenderer) {
|
44511 | res.cellRenderer = 'agGroupCellRenderer';
|
44512 | }
|
44513 |
|
44514 |
|
44515 | if (rowGroupCol) {
|
44516 | var colDef = rowGroupCol.getColDef();
|
44517 | Object.assign(res, {
|
44518 |
|
44519 | headerName: this.columnModel.getDisplayNameForColumn(rowGroupCol, 'header'),
|
44520 | headerValueGetter: colDef.headerValueGetter
|
44521 | });
|
44522 | if (colDef.cellRenderer || colDef.cellRendererFramework) {
|
44523 | Object.assign(res, {
|
44524 | cellRendererParams: {
|
44525 | innerRenderer: colDef.cellRenderer,
|
44526 | innerRendererFramework: colDef.cellRendererFramework,
|
44527 | innerRendererParams: colDef.cellRendererParams
|
44528 | }
|
44529 | });
|
44530 | }
|
44531 | res.showRowGroup = rowGroupCol.getColId();
|
44532 | }
|
44533 | else {
|
44534 | res.showRowGroup = true;
|
44535 | }
|
44536 | return res;
|
44537 | };
|
44538 | var AutoGroupColService_1;
|
44539 | AutoGroupColService.GROUP_AUTO_COLUMN_BUNDLE_ID = Constants.GROUP_AUTO_COLUMN_ID;
|
44540 | __decorate$1$([
|
44541 | Autowired('columnModel')
|
44542 | ], AutoGroupColService.prototype, "columnModel", void 0);
|
44543 | __decorate$1$([
|
44544 | Autowired('columnFactory')
|
44545 | ], AutoGroupColService.prototype, "columnFactory", void 0);
|
44546 | AutoGroupColService = AutoGroupColService_1 = __decorate$1$([
|
44547 | Bean('autoGroupColService')
|
44548 | ], AutoGroupColService);
|
44549 | return AutoGroupColService;
|
44550 | }(BeanStub));
|
44551 |
|
44552 |
|
44553 |
|
44554 |
|
44555 |
|
44556 |
|
44557 |
|
44558 | var __extends$2l = (undefined && undefined.__extends) || (function () {
|
44559 | var extendStatics = function (d, b) {
|
44560 | extendStatics = Object.setPrototypeOf ||
|
44561 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44562 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
44563 | return extendStatics(d, b);
|
44564 | };
|
44565 | return function (d, b) {
|
44566 | extendStatics(d, b);
|
44567 | function __() { this.constructor = d; }
|
44568 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44569 | };
|
44570 | })();
|
44571 | var __decorate$20 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44572 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44573 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44574 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44575 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44576 | };
|
44577 | var PaginationAutoPageSizeService = (function (_super) {
|
44578 | __extends$2l(PaginationAutoPageSizeService, _super);
|
44579 | function PaginationAutoPageSizeService() {
|
44580 | return _super !== null && _super.apply(this, arguments) || this;
|
44581 | }
|
44582 | PaginationAutoPageSizeService.prototype.postConstruct = function () {
|
44583 | var _this = this;
|
44584 | this.ctrlsService.whenReady(function (p) {
|
44585 | _this.centerRowContainerCon = p.centerRowContainerCtrl;
|
44586 | _this.addManagedListener(_this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, _this.onBodyHeightChanged.bind(_this));
|
44587 | _this.addManagedListener(_this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, _this.onScrollVisibilityChanged.bind(_this));
|
44588 | _this.checkPageSize();
|
44589 | });
|
44590 | };
|
44591 | PaginationAutoPageSizeService.prototype.notActive = function () {
|
44592 | return !this.gridOptionsWrapper.isPaginationAutoPageSize();
|
44593 | };
|
44594 | PaginationAutoPageSizeService.prototype.onScrollVisibilityChanged = function () {
|
44595 | this.checkPageSize();
|
44596 | };
|
44597 | PaginationAutoPageSizeService.prototype.onBodyHeightChanged = function () {
|
44598 | this.checkPageSize();
|
44599 | };
|
44600 | PaginationAutoPageSizeService.prototype.checkPageSize = function () {
|
44601 | if (this.notActive()) {
|
44602 | return;
|
44603 | }
|
44604 | var rowHeight = this.gridOptionsWrapper.getRowHeightAsNumber();
|
44605 | var bodyHeight = this.centerRowContainerCon.getViewportSizeFeature().getBodyHeight();
|
44606 | if (bodyHeight > 0) {
|
44607 | var newPageSize = Math.floor(bodyHeight / rowHeight);
|
44608 | this.gridOptionsWrapper.setProperty('paginationPageSize', newPageSize);
|
44609 | }
|
44610 | };
|
44611 | __decorate$20([
|
44612 | Autowired('ctrlsService')
|
44613 | ], PaginationAutoPageSizeService.prototype, "ctrlsService", void 0);
|
44614 | __decorate$20([
|
44615 | PostConstruct
|
44616 | ], PaginationAutoPageSizeService.prototype, "postConstruct", null);
|
44617 | PaginationAutoPageSizeService = __decorate$20([
|
44618 | Bean('paginationAutoPageSizeService')
|
44619 | ], PaginationAutoPageSizeService);
|
44620 | return PaginationAutoPageSizeService;
|
44621 | }(BeanStub));
|
44622 |
|
44623 |
|
44624 |
|
44625 |
|
44626 |
|
44627 |
|
44628 |
|
44629 | var __extends$2m = (undefined && undefined.__extends) || (function () {
|
44630 | var extendStatics = function (d, b) {
|
44631 | extendStatics = Object.setPrototypeOf ||
|
44632 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44633 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
44634 | return extendStatics(d, b);
|
44635 | };
|
44636 | return function (d, b) {
|
44637 | extendStatics(d, b);
|
44638 | function __() { this.constructor = d; }
|
44639 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44640 | };
|
44641 | })();
|
44642 | var __decorate$21 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44643 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44644 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44645 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44646 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44647 | };
|
44648 | var ValueCache = (function (_super) {
|
44649 | __extends$2m(ValueCache, _super);
|
44650 | function ValueCache() {
|
44651 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
44652 | _this.cacheVersion = 0;
|
44653 | return _this;
|
44654 | }
|
44655 | ValueCache.prototype.init = function () {
|
44656 | this.active = this.gridOptionsWrapper.isValueCache();
|
44657 | this.neverExpires = this.gridOptionsWrapper.isValueCacheNeverExpires();
|
44658 | };
|
44659 | ValueCache.prototype.onDataChanged = function () {
|
44660 | if (this.neverExpires) {
|
44661 | return;
|
44662 | }
|
44663 | this.expire();
|
44664 | };
|
44665 | ValueCache.prototype.expire = function () {
|
44666 | this.cacheVersion++;
|
44667 | };
|
44668 | ValueCache.prototype.setValue = function (rowNode, colId, value) {
|
44669 | if (this.active) {
|
44670 | if (rowNode.__cacheVersion !== this.cacheVersion) {
|
44671 | rowNode.__cacheVersion = this.cacheVersion;
|
44672 | rowNode.__cacheData = {};
|
44673 | }
|
44674 | rowNode.__cacheData[colId] = value;
|
44675 | }
|
44676 | };
|
44677 | ValueCache.prototype.getValue = function (rowNode, colId) {
|
44678 | if (!this.active || rowNode.__cacheVersion !== this.cacheVersion) {
|
44679 | return undefined;
|
44680 | }
|
44681 | return rowNode.__cacheData[colId];
|
44682 | };
|
44683 | __decorate$21([
|
44684 | PostConstruct
|
44685 | ], ValueCache.prototype, "init", null);
|
44686 | ValueCache = __decorate$21([
|
44687 | Bean('valueCache')
|
44688 | ], ValueCache);
|
44689 | return ValueCache;
|
44690 | }(BeanStub));
|
44691 |
|
44692 |
|
44693 |
|
44694 |
|
44695 |
|
44696 |
|
44697 |
|
44698 | var __extends$2n = (undefined && undefined.__extends) || (function () {
|
44699 | var extendStatics = function (d, b) {
|
44700 | extendStatics = Object.setPrototypeOf ||
|
44701 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44702 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
44703 | return extendStatics(d, b);
|
44704 | };
|
44705 | return function (d, b) {
|
44706 | extendStatics(d, b);
|
44707 | function __() { this.constructor = d; }
|
44708 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44709 | };
|
44710 | })();
|
44711 | var __decorate$22 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44712 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44713 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44714 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44715 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44716 | };
|
44717 | var ChangeDetectionService = (function (_super) {
|
44718 | __extends$2n(ChangeDetectionService, _super);
|
44719 | function ChangeDetectionService() {
|
44720 | return _super !== null && _super.apply(this, arguments) || this;
|
44721 | }
|
44722 | ChangeDetectionService.prototype.init = function () {
|
44723 | if (this.rowModel.getType() === Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
|
44724 | this.clientSideRowModel = this.rowModel;
|
44725 | }
|
44726 | this.addManagedListener(this.eventService, Events.EVENT_CELL_VALUE_CHANGED, this.onCellValueChanged.bind(this));
|
44727 | };
|
44728 | ChangeDetectionService.prototype.onCellValueChanged = function (event) {
|
44729 |
|
44730 |
|
44731 |
|
44732 |
|
44733 |
|
44734 |
|
44735 | if (event.source === Constants.SOURCE_PASTE) {
|
44736 | return;
|
44737 | }
|
44738 | this.doChangeDetection(event.node, event.column);
|
44739 | };
|
44740 | ChangeDetectionService.prototype.doChangeDetection = function (rowNode, column) {
|
44741 | if (this.gridOptionsWrapper.isSuppressChangeDetection()) {
|
44742 | return;
|
44743 | }
|
44744 |
|
44745 | if (this.clientSideRowModel && !rowNode.isRowPinned()) {
|
44746 | var onlyChangedColumns = this.gridOptionsWrapper.isAggregateOnlyChangedColumns();
|
44747 | var changedPath = new ChangedPath(onlyChangedColumns, this.clientSideRowModel.getRootNode());
|
44748 | changedPath.addParentNode(rowNode.parent, [column]);
|
44749 | this.clientSideRowModel.doAggregate(changedPath);
|
44750 | }
|
44751 |
|
44752 | this.rowRenderer.refreshCells();
|
44753 | };
|
44754 | __decorate$22([
|
44755 | Autowired('rowModel')
|
44756 | ], ChangeDetectionService.prototype, "rowModel", void 0);
|
44757 | __decorate$22([
|
44758 | Autowired('rowRenderer')
|
44759 | ], ChangeDetectionService.prototype, "rowRenderer", void 0);
|
44760 | __decorate$22([
|
44761 | PostConstruct
|
44762 | ], ChangeDetectionService.prototype, "init", null);
|
44763 | ChangeDetectionService = __decorate$22([
|
44764 | Bean('changeDetectionService')
|
44765 | ], ChangeDetectionService);
|
44766 | return ChangeDetectionService;
|
44767 | }(BeanStub));
|
44768 |
|
44769 |
|
44770 |
|
44771 |
|
44772 |
|
44773 |
|
44774 |
|
44775 | var __extends$2o = (undefined && undefined.__extends) || (function () {
|
44776 | var extendStatics = function (d, b) {
|
44777 | extendStatics = Object.setPrototypeOf ||
|
44778 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44779 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
44780 | return extendStatics(d, b);
|
44781 | };
|
44782 | return function (d, b) {
|
44783 | extendStatics(d, b);
|
44784 | function __() { this.constructor = d; }
|
44785 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44786 | };
|
44787 | })();
|
44788 | var __decorate$23 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44789 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44790 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44791 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44792 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44793 | };
|
44794 | var AgComponentUtils = (function (_super) {
|
44795 | __extends$2o(AgComponentUtils, _super);
|
44796 | function AgComponentUtils() {
|
44797 | return _super !== null && _super.apply(this, arguments) || this;
|
44798 | }
|
44799 | AgComponentUtils.prototype.adaptFunction = function (propertyName, jsCompFunc) {
|
44800 | var metadata = this.componentMetadataProvider.retrieve(propertyName);
|
44801 | if (metadata && metadata.functionAdapter) {
|
44802 | return metadata.functionAdapter(jsCompFunc);
|
44803 | }
|
44804 | return null;
|
44805 | };
|
44806 | AgComponentUtils.prototype.adaptCellRendererFunction = function (callback) {
|
44807 | var Adapter = (function () {
|
44808 | function Adapter() {
|
44809 | }
|
44810 | Adapter.prototype.refresh = function (params) {
|
44811 | return false;
|
44812 | };
|
44813 | Adapter.prototype.getGui = function () {
|
44814 | return this.eGui;
|
44815 | };
|
44816 | Adapter.prototype.init = function (params) {
|
44817 | var callbackResult = callback(params);
|
44818 | var type = typeof callbackResult;
|
44819 | if (type === 'string' || type === 'number' || type === 'boolean') {
|
44820 | this.eGui = loadTemplate('<span>' + callbackResult + '</span>');
|
44821 | return;
|
44822 | }
|
44823 | if (callbackResult == null) {
|
44824 | this.eGui = loadTemplate('<span></span>');
|
44825 | return;
|
44826 | }
|
44827 | this.eGui = callbackResult;
|
44828 | };
|
44829 | return Adapter;
|
44830 | }());
|
44831 | return Adapter;
|
44832 | };
|
44833 | AgComponentUtils.prototype.doesImplementIComponent = function (candidate) {
|
44834 | if (!candidate) {
|
44835 | return false;
|
44836 | }
|
44837 | return candidate.prototype && 'getGui' in candidate.prototype;
|
44838 | };
|
44839 | __decorate$23([
|
44840 | Autowired("componentMetadataProvider")
|
44841 | ], AgComponentUtils.prototype, "componentMetadataProvider", void 0);
|
44842 | AgComponentUtils = __decorate$23([
|
44843 | Bean("agComponentUtils")
|
44844 | ], AgComponentUtils);
|
44845 | return AgComponentUtils;
|
44846 | }(BeanStub));
|
44847 |
|
44848 |
|
44849 |
|
44850 |
|
44851 |
|
44852 |
|
44853 |
|
44854 | var __extends$2p = (undefined && undefined.__extends) || (function () {
|
44855 | var extendStatics = function (d, b) {
|
44856 | extendStatics = Object.setPrototypeOf ||
|
44857 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44858 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
44859 | return extendStatics(d, b);
|
44860 | };
|
44861 | return function (d, b) {
|
44862 | extendStatics(d, b);
|
44863 | function __() { this.constructor = d; }
|
44864 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44865 | };
|
44866 | })();
|
44867 | var __decorate$24 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44868 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44869 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44870 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44871 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44872 | };
|
44873 | var ComponentMetadataProvider = (function (_super) {
|
44874 | __extends$2p(ComponentMetadataProvider, _super);
|
44875 | function ComponentMetadataProvider() {
|
44876 | return _super !== null && _super.apply(this, arguments) || this;
|
44877 | }
|
44878 | ComponentMetadataProvider.prototype.postConstruct = function () {
|
44879 | this.componentMetaData = {
|
44880 | dateComponent: {
|
44881 | mandatoryMethodList: ['getDate', 'setDate'],
|
44882 | optionalMethodList: ['afterGuiAttached', 'setInputPlaceholder', 'setInputAriaLabel']
|
44883 | },
|
44884 | detailCellRenderer: {
|
44885 | mandatoryMethodList: [],
|
44886 | optionalMethodList: ['refresh'],
|
44887 | functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
|
44888 | },
|
44889 | headerComponent: {
|
44890 | mandatoryMethodList: [],
|
44891 | optionalMethodList: ['refresh']
|
44892 | },
|
44893 | headerGroupComponent: {
|
44894 | mandatoryMethodList: [],
|
44895 | optionalMethodList: []
|
44896 | },
|
44897 | loadingCellRenderer: {
|
44898 | mandatoryMethodList: [],
|
44899 | optionalMethodList: []
|
44900 | },
|
44901 | loadingOverlayComponent: {
|
44902 | mandatoryMethodList: [],
|
44903 | optionalMethodList: []
|
44904 | },
|
44905 | noRowsOverlayComponent: {
|
44906 | mandatoryMethodList: [],
|
44907 | optionalMethodList: []
|
44908 | },
|
44909 | floatingFilterComponent: {
|
44910 | mandatoryMethodList: ['onParentModelChanged'],
|
44911 | optionalMethodList: ['afterGuiAttached']
|
44912 | },
|
44913 | floatingFilterWrapperComponent: {
|
44914 | mandatoryMethodList: [],
|
44915 | optionalMethodList: []
|
44916 | },
|
44917 | cellRenderer: {
|
44918 | mandatoryMethodList: [],
|
44919 | optionalMethodList: ['refresh', 'afterGuiAttached'],
|
44920 | functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
|
44921 | },
|
44922 | cellEditor: {
|
44923 | mandatoryMethodList: ['getValue'],
|
44924 | optionalMethodList: ['isPopup', 'isCancelBeforeStart', 'isCancelAfterEnd', 'getPopupPosition', 'focusIn', 'focusOut', 'afterGuiAttached']
|
44925 | },
|
44926 | innerRenderer: {
|
44927 | mandatoryMethodList: [],
|
44928 | optionalMethodList: ['afterGuiAttached'],
|
44929 | functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
|
44930 | },
|
44931 | fullWidthCellRenderer: {
|
44932 | mandatoryMethodList: [],
|
44933 | optionalMethodList: ['refresh', 'afterGuiAttached'],
|
44934 | functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
|
44935 | },
|
44936 | pinnedRowCellRenderer: {
|
44937 | mandatoryMethodList: [],
|
44938 | optionalMethodList: ['refresh', 'afterGuiAttached'],
|
44939 | functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
|
44940 | },
|
44941 | groupRowRenderer: {
|
44942 | mandatoryMethodList: [],
|
44943 | optionalMethodList: ['afterGuiAttached'],
|
44944 | functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
|
44945 | },
|
44946 | filter: {
|
44947 | mandatoryMethodList: ['isFilterActive', 'doesFilterPass', 'getModel', 'setModel'],
|
44948 | optionalMethodList: ['afterGuiAttached', 'onNewRowsLoaded', 'getModelAsString', 'onFloatingFilterChanged']
|
44949 | },
|
44950 | filterComponent: {
|
44951 | mandatoryMethodList: ['isFilterActive', 'doesFilterPass', 'getModel', 'setModel'],
|
44952 | optionalMethodList: ['afterGuiAttached', 'onNewRowsLoaded', 'getModelAsString', 'onFloatingFilterChanged']
|
44953 | },
|
44954 | statusPanel: {
|
44955 | mandatoryMethodList: [],
|
44956 | optionalMethodList: ['afterGuiAttached'],
|
44957 | },
|
44958 | toolPanel: {
|
44959 | mandatoryMethodList: [],
|
44960 | optionalMethodList: ['refresh', 'afterGuiAttached']
|
44961 | },
|
44962 | tooltipComponent: {
|
44963 | mandatoryMethodList: [],
|
44964 | optionalMethodList: []
|
44965 | }
|
44966 | };
|
44967 | };
|
44968 | ComponentMetadataProvider.prototype.retrieve = function (name) {
|
44969 | return this.componentMetaData[name];
|
44970 | };
|
44971 | __decorate$24([
|
44972 | Autowired("agComponentUtils")
|
44973 | ], ComponentMetadataProvider.prototype, "agComponentUtils", void 0);
|
44974 | __decorate$24([
|
44975 | PostConstruct
|
44976 | ], ComponentMetadataProvider.prototype, "postConstruct", null);
|
44977 | ComponentMetadataProvider = __decorate$24([
|
44978 | Bean("componentMetadataProvider")
|
44979 | ], ComponentMetadataProvider);
|
44980 | return ComponentMetadataProvider;
|
44981 | }(BeanStub));
|
44982 |
|
44983 |
|
44984 |
|
44985 |
|
44986 |
|
44987 |
|
44988 |
|
44989 | var __extends$2q = (undefined && undefined.__extends) || (function () {
|
44990 | var extendStatics = function (d, b) {
|
44991 | extendStatics = Object.setPrototypeOf ||
|
44992 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44993 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
44994 | return extendStatics(d, b);
|
44995 | };
|
44996 | return function (d, b) {
|
44997 | extendStatics(d, b);
|
44998 | function __() { this.constructor = d; }
|
44999 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45000 | };
|
45001 | })();
|
45002 | var __decorate$25 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45003 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45004 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45005 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45006 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45007 | };
|
45008 | var MAT_GRID_SIZE = 8;
|
45009 | var BASE_GRID_SIZE = 4;
|
45010 | var BALHAM_GRID_SIZE = 4;
|
45011 | var ALPINE_GRID_SIZE = 6;
|
45012 | var HARD_CODED_SIZES = {
|
45013 |
|
45014 | 'ag-theme-custom': {
|
45015 | headerHeight: 25,
|
45016 | headerCellMinWidth: 24,
|
45017 | listItemHeight: BASE_GRID_SIZE * 5,
|
45018 | rowHeight: 25,
|
45019 | chartMenuPanelWidth: 220
|
45020 | },
|
45021 | 'ag-theme-material': {
|
45022 | headerHeight: MAT_GRID_SIZE * 7,
|
45023 | headerCellMinWidth: 48,
|
45024 | listItemHeight: MAT_GRID_SIZE * 4,
|
45025 | rowHeight: MAT_GRID_SIZE * 6,
|
45026 | chartMenuPanelWidth: 240
|
45027 | },
|
45028 | 'ag-theme-balham': {
|
45029 | headerHeight: BALHAM_GRID_SIZE * 8,
|
45030 | headerCellMinWidth: 24,
|
45031 | listItemHeight: BALHAM_GRID_SIZE * 6,
|
45032 | rowHeight: BALHAM_GRID_SIZE * 7,
|
45033 | chartMenuPanelWidth: 220
|
45034 | },
|
45035 | 'ag-theme-alpine': {
|
45036 | headerHeight: ALPINE_GRID_SIZE * 8,
|
45037 | headerCellMinWidth: 36,
|
45038 | listItemHeight: ALPINE_GRID_SIZE * 4,
|
45039 | rowHeight: ALPINE_GRID_SIZE * 7,
|
45040 | chartMenuPanelWidth: 240
|
45041 | }
|
45042 | };
|
45043 |
|
45044 |
|
45045 |
|
45046 |
|
45047 |
|
45048 |
|
45049 |
|
45050 |
|
45051 |
|
45052 |
|
45053 | var SASS_PROPERTY_BUILDER = {
|
45054 | headerHeight: ['ag-header-row'],
|
45055 | headerCellMinWidth: ['ag-header-cell'],
|
45056 | listItemHeight: ['ag-virtual-list-item'],
|
45057 | rowHeight: ['ag-row'],
|
45058 | chartMenuPanelWidth: ['ag-chart-docked-container']
|
45059 | };
|
45060 | var CALCULATED_SIZES = {};
|
45061 | var Environment = (function (_super) {
|
45062 | __extends$2q(Environment, _super);
|
45063 | function Environment() {
|
45064 | return _super !== null && _super.apply(this, arguments) || this;
|
45065 | }
|
45066 | Environment.prototype.getSassVariable = function (theme, key) {
|
45067 | var useTheme = 'ag-theme-' + (theme.match('material') ? 'material' : theme.match('balham') ? 'balham' : theme.match('alpine') ? 'alpine' : 'custom');
|
45068 | var defaultValue = HARD_CODED_SIZES[useTheme][key];
|
45069 | var calculatedValue = 0;
|
45070 | if (!CALCULATED_SIZES[theme]) {
|
45071 | CALCULATED_SIZES[theme] = {};
|
45072 | }
|
45073 | var size = CALCULATED_SIZES[theme][key];
|
45074 | if (size != null) {
|
45075 | return size;
|
45076 | }
|
45077 | if (SASS_PROPERTY_BUILDER[key]) {
|
45078 | var classList = SASS_PROPERTY_BUILDER[key];
|
45079 | var div = document.createElement('div');
|
45080 | div.classList.add(theme);
|
45081 | div.style.position = 'absolute';
|
45082 | var el = classList.reduce(function (prevEl, currentClass) {
|
45083 | var currentDiv = document.createElement('div');
|
45084 | currentDiv.style.position = 'static';
|
45085 | currentDiv.classList.add(currentClass);
|
45086 | prevEl.appendChild(currentDiv);
|
45087 | return currentDiv;
|
45088 | }, div);
|
45089 | if (document.body) {
|
45090 | document.body.appendChild(div);
|
45091 | var sizeName = key.toLowerCase().indexOf('height') !== -1 ? 'height' : 'width';
|
45092 | calculatedValue = parseInt(window.getComputedStyle(el)[sizeName], 10);
|
45093 | document.body.removeChild(div);
|
45094 | }
|
45095 | }
|
45096 | CALCULATED_SIZES[theme][key] = calculatedValue || defaultValue;
|
45097 | return CALCULATED_SIZES[theme][key];
|
45098 | };
|
45099 | Environment.prototype.isThemeDark = function () {
|
45100 | var theme = this.getTheme().theme;
|
45101 | return !!theme && theme.indexOf('dark') >= 0;
|
45102 | };
|
45103 | Environment.prototype.chartMenuPanelWidth = function () {
|
45104 | var theme = this.getTheme().themeFamily;
|
45105 | return this.getSassVariable(theme, 'chartMenuPanelWidth');
|
45106 | };
|
45107 | Environment.prototype.getTheme = function () {
|
45108 | var reg = /\bag-(material|(?:theme-([\w\-]*)))\b/;
|
45109 | var el = this.eGridDiv;
|
45110 | var themeMatch = null;
|
45111 | while (el) {
|
45112 | themeMatch = reg.exec(el.className);
|
45113 | if (!themeMatch) {
|
45114 | el = el.parentElement || undefined;
|
45115 | }
|
45116 | else {
|
45117 | break;
|
45118 | }
|
45119 | }
|
45120 | if (!themeMatch) {
|
45121 | return {};
|
45122 | }
|
45123 | var theme = themeMatch[0];
|
45124 | var usingOldTheme = themeMatch[2] === undefined;
|
45125 | if (usingOldTheme) {
|
45126 | var newTheme_1 = theme.replace('ag-', 'ag-theme-');
|
45127 | 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');
|
45128 | }
|
45129 | return { theme: theme, el: el, themeFamily: theme.replace(/-dark$/, '') };
|
45130 | };
|
45131 | __decorate$25([
|
45132 | Autowired('eGridDiv')
|
45133 | ], Environment.prototype, "eGridDiv", void 0);
|
45134 | Environment = __decorate$25([
|
45135 | Bean('environment')
|
45136 | ], Environment);
|
45137 | return Environment;
|
45138 | }(BeanStub));
|
45139 |
|
45140 |
|
45141 |
|
45142 |
|
45143 |
|
45144 |
|
45145 |
|
45146 | var __extends$2r = (undefined && undefined.__extends) || (function () {
|
45147 | var extendStatics = function (d, b) {
|
45148 | extendStatics = Object.setPrototypeOf ||
|
45149 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45150 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
45151 | return extendStatics(d, b);
|
45152 | };
|
45153 | return function (d, b) {
|
45154 | extendStatics(d, b);
|
45155 | function __() { this.constructor = d; }
|
45156 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45157 | };
|
45158 | })();
|
45159 | var __decorate$26 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45160 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45161 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45162 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45163 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45164 | };
|
45165 | var __param$9 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
45166 | return function (target, key) { decorator(target, key, paramIndex); }
|
45167 | };
|
45168 |
|
45169 |
|
45170 |
|
45171 |
|
45172 | var RowContainerHeightService = (function (_super) {
|
45173 | __extends$2r(RowContainerHeightService, _super);
|
45174 | function RowContainerHeightService() {
|
45175 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
45176 |
|
45177 | _this.scrollY = 0;
|
45178 |
|
45179 | _this.uiBodyHeight = 0;
|
45180 | return _this;
|
45181 | }
|
45182 | RowContainerHeightService.prototype.agWire = function (loggerFactory) {
|
45183 | this.logger = loggerFactory.create("RowContainerHeightService");
|
45184 | };
|
45185 | RowContainerHeightService.prototype.postConstruct = function () {
|
45186 | this.addManagedListener(this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, this.updateOffset.bind(this));
|
45187 | this.maxDivHeight = getMaxDivHeight();
|
45188 | this.logger.log('maxDivHeight = ' + this.maxDivHeight);
|
45189 | };
|
45190 | RowContainerHeightService.prototype.isStretching = function () {
|
45191 | return this.stretching;
|
45192 | };
|
45193 | RowContainerHeightService.prototype.getDivStretchOffset = function () {
|
45194 | return this.divStretchOffset;
|
45195 | };
|
45196 | RowContainerHeightService.prototype.updateOffset = function () {
|
45197 | if (!this.stretching) {
|
45198 | return;
|
45199 | }
|
45200 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
45201 | var newScrollY = gridBodyCon.getScrollFeature().getVScrollPosition().top;
|
45202 | var newBodyHeight = this.getUiBodyHeight();
|
45203 | var atLeastOneChanged = newScrollY !== this.scrollY || newBodyHeight !== this.uiBodyHeight;
|
45204 | if (atLeastOneChanged) {
|
45205 | this.scrollY = newScrollY;
|
45206 | this.uiBodyHeight = newBodyHeight;
|
45207 | this.calculateOffset();
|
45208 | }
|
45209 | };
|
45210 | RowContainerHeightService.prototype.calculateOffset = function () {
|
45211 | this.setUiContainerHeight(this.maxDivHeight);
|
45212 | this.pixelsToShave = this.modelHeight - this.uiContainerHeight;
|
45213 | this.maxScrollY = this.uiContainerHeight - this.uiBodyHeight;
|
45214 | var scrollPercent = this.scrollY / this.maxScrollY;
|
45215 | var divStretchOffset = scrollPercent * this.pixelsToShave;
|
45216 | this.logger.log("Div Stretch Offset = " + divStretchOffset + " (" + this.pixelsToShave + " * " + scrollPercent + ")");
|
45217 | this.setDivStretchOffset(divStretchOffset);
|
45218 | };
|
45219 | RowContainerHeightService.prototype.setUiContainerHeight = function (height) {
|
45220 | if (height !== this.uiContainerHeight) {
|
45221 | this.uiContainerHeight = height;
|
45222 | this.eventService.dispatchEvent({ type: Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED });
|
45223 | }
|
45224 | };
|
45225 | RowContainerHeightService.prototype.clearOffset = function () {
|
45226 | this.setUiContainerHeight(this.modelHeight);
|
45227 | this.pixelsToShave = 0;
|
45228 | this.setDivStretchOffset(0);
|
45229 | };
|
45230 | RowContainerHeightService.prototype.setDivStretchOffset = function (newOffset) {
|
45231 |
|
45232 | var newOffsetFloor = typeof newOffset === 'number' ? Math.floor(newOffset) : null;
|
45233 | if (this.divStretchOffset === newOffsetFloor) {
|
45234 | return;
|
45235 | }
|
45236 | this.divStretchOffset = newOffsetFloor;
|
45237 | this.eventService.dispatchEvent({ type: Events.EVENT_HEIGHT_SCALE_CHANGED });
|
45238 | };
|
45239 | RowContainerHeightService.prototype.setModelHeight = function (modelHeight) {
|
45240 | this.modelHeight = modelHeight;
|
45241 | this.stretching = modelHeight != null
|
45242 | && this.maxDivHeight > 0
|
45243 | && modelHeight > this.maxDivHeight;
|
45244 | if (this.stretching) {
|
45245 | this.calculateOffset();
|
45246 | }
|
45247 | else {
|
45248 | this.clearOffset();
|
45249 | }
|
45250 | };
|
45251 | RowContainerHeightService.prototype.getUiContainerHeight = function () {
|
45252 | return this.uiContainerHeight;
|
45253 | };
|
45254 | RowContainerHeightService.prototype.getRealPixelPosition = function (modelPixel) {
|
45255 | return modelPixel - this.divStretchOffset;
|
45256 | };
|
45257 | RowContainerHeightService.prototype.getUiBodyHeight = function () {
|
45258 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
45259 | var pos = gridBodyCon.getScrollFeature().getVScrollPosition();
|
45260 | return pos.bottom - pos.top;
|
45261 | };
|
45262 | RowContainerHeightService.prototype.getScrollPositionForPixel = function (rowTop) {
|
45263 | if (this.pixelsToShave <= 0) {
|
45264 | return rowTop;
|
45265 | }
|
45266 | var modelMaxScroll = this.modelHeight - this.getUiBodyHeight();
|
45267 | var scrollPercent = rowTop / modelMaxScroll;
|
45268 | var scrollPixel = this.maxScrollY * scrollPercent;
|
45269 | return scrollPixel;
|
45270 | };
|
45271 | __decorate$26([
|
45272 | Autowired('ctrlsService')
|
45273 | ], RowContainerHeightService.prototype, "ctrlsService", void 0);
|
45274 | __decorate$26([
|
45275 | __param$9(0, Qualifier("loggerFactory"))
|
45276 | ], RowContainerHeightService.prototype, "agWire", null);
|
45277 | __decorate$26([
|
45278 | PostConstruct
|
45279 | ], RowContainerHeightService.prototype, "postConstruct", null);
|
45280 | RowContainerHeightService = __decorate$26([
|
45281 | Bean('rowContainerHeightService')
|
45282 | ], RowContainerHeightService);
|
45283 | return RowContainerHeightService;
|
45284 | }(BeanStub));
|
45285 |
|
45286 |
|
45287 |
|
45288 |
|
45289 |
|
45290 |
|
45291 |
|
45292 | var __extends$2s = (undefined && undefined.__extends) || (function () {
|
45293 | var extendStatics = function (d, b) {
|
45294 | extendStatics = Object.setPrototypeOf ||
|
45295 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45296 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
45297 | return extendStatics(d, b);
|
45298 | };
|
45299 | return function (d, b) {
|
45300 | extendStatics(d, b);
|
45301 | function __() { this.constructor = d; }
|
45302 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45303 | };
|
45304 | })();
|
45305 | var __decorate$27 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45306 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45307 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45308 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45309 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45310 | };
|
45311 | var SelectableService = (function (_super) {
|
45312 | __extends$2s(SelectableService, _super);
|
45313 | function SelectableService() {
|
45314 | return _super !== null && _super.apply(this, arguments) || this;
|
45315 | }
|
45316 | SelectableService.prototype.init = function () {
|
45317 | this.groupSelectsChildren = this.gridOptionsWrapper.isGroupSelectsChildren();
|
45318 | this.isRowSelectableFunc = this.gridOptionsWrapper.getIsRowSelectableFunc();
|
45319 | };
|
45320 | SelectableService.prototype.updateSelectableAfterGrouping = function (rowNode) {
|
45321 | if (this.isRowSelectableFunc) {
|
45322 | var nextChildrenFunc = function (node) { return node.childrenAfterGroup; };
|
45323 | this.recurseDown(rowNode.childrenAfterGroup, nextChildrenFunc);
|
45324 | }
|
45325 | };
|
45326 | SelectableService.prototype.recurseDown = function (children, nextChildrenFunc) {
|
45327 | var _this = this;
|
45328 | if (!children) {
|
45329 | return;
|
45330 | }
|
45331 | children.forEach(function (child) {
|
45332 | if (!child.group) {
|
45333 | return;
|
45334 | }
|
45335 | if (child.hasChildren()) {
|
45336 | _this.recurseDown(nextChildrenFunc(child), nextChildrenFunc);
|
45337 | }
|
45338 | var rowSelectable;
|
45339 | if (_this.groupSelectsChildren) {
|
45340 |
|
45341 | var firstSelectable = (nextChildrenFunc(child) || []).find(function (rowNode) { return rowNode.selectable === true; });
|
45342 | rowSelectable = exists(firstSelectable);
|
45343 | }
|
45344 | else {
|
45345 |
|
45346 | rowSelectable = _this.isRowSelectableFunc ? _this.isRowSelectableFunc(child) : false;
|
45347 | }
|
45348 | child.setRowSelectable(rowSelectable);
|
45349 | });
|
45350 | };
|
45351 | __decorate$27([
|
45352 | PostConstruct
|
45353 | ], SelectableService.prototype, "init", null);
|
45354 | SelectableService = __decorate$27([
|
45355 | Bean('selectableService')
|
45356 | ], SelectableService);
|
45357 | return SelectableService;
|
45358 | }(BeanStub));
|
45359 |
|
45360 |
|
45361 |
|
45362 |
|
45363 |
|
45364 |
|
45365 |
|
45366 | var __extends$2t = (undefined && undefined.__extends) || (function () {
|
45367 | var extendStatics = function (d, b) {
|
45368 | extendStatics = Object.setPrototypeOf ||
|
45369 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45370 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
45371 | return extendStatics(d, b);
|
45372 | };
|
45373 | return function (d, b) {
|
45374 | extendStatics(d, b);
|
45375 | function __() { this.constructor = d; }
|
45376 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45377 | };
|
45378 | })();
|
45379 | var __decorate$28 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45380 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45381 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45382 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45383 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45384 | };
|
45385 | var PaginationComp = (function (_super) {
|
45386 | __extends$2t(PaginationComp, _super);
|
45387 | function PaginationComp() {
|
45388 | var _this = _super.call(this) || this;
|
45389 | _this.previousAndFirstButtonsDisabled = false;
|
45390 | _this.nextButtonDisabled = false;
|
45391 | _this.lastButtonDisabled = false;
|
45392 | return _this;
|
45393 | }
|
45394 | PaginationComp.prototype.postConstruct = function () {
|
45395 | var _this = this;
|
45396 | var isRtl = this.gridOptionsWrapper.isEnableRtl();
|
45397 | this.setTemplate(this.getTemplate());
|
45398 | this.btFirst.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'last' : 'first', this.gridOptionsWrapper));
|
45399 | this.btPrevious.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'next' : 'previous', this.gridOptionsWrapper));
|
45400 | this.btNext.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'previous' : 'next', this.gridOptionsWrapper));
|
45401 | this.btLast.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'first' : 'last', this.gridOptionsWrapper));
|
45402 | var isPaging = this.gridOptionsWrapper.isPagination();
|
45403 | var paginationPanelEnabled = isPaging && !this.gridOptionsWrapper.isSuppressPaginationPanel();
|
45404 | if (!paginationPanelEnabled) {
|
45405 | this.setDisplayed(false);
|
45406 | return;
|
45407 | }
|
45408 | this.addManagedListener(this.eventService, Events.EVENT_PAGINATION_CHANGED, this.onPaginationChanged.bind(this));
|
45409 | [
|
45410 | { el: this.btFirst, fn: this.onBtFirst.bind(this) },
|
45411 | { el: this.btPrevious, fn: this.onBtPrevious.bind(this) },
|
45412 | { el: this.btNext, fn: this.onBtNext.bind(this) },
|
45413 | { el: this.btLast, fn: this.onBtLast.bind(this) }
|
45414 | ].forEach(function (item) {
|
45415 | var el = item.el, fn = item.fn;
|
45416 | _this.addManagedListener(el, 'click', fn);
|
45417 | _this.addManagedListener(el, 'keydown', function (e) {
|
45418 | if (e.key === KeyCode.ENTER || e.key === KeyCode.SPACE) {
|
45419 | e.preventDefault();
|
45420 | fn();
|
45421 | }
|
45422 | });
|
45423 | });
|
45424 | this.onPaginationChanged();
|
45425 | };
|
45426 | PaginationComp.prototype.onPaginationChanged = function () {
|
45427 | this.enableOrDisableButtons();
|
45428 | this.updateRowLabels();
|
45429 | this.setCurrentPageLabel();
|
45430 | this.setTotalLabels();
|
45431 | };
|
45432 | PaginationComp.prototype.onBtFirst = function () {
|
45433 | if (!this.previousAndFirstButtonsDisabled) {
|
45434 | this.paginationProxy.goToFirstPage();
|
45435 | }
|
45436 | };
|
45437 | PaginationComp.prototype.setCurrentPageLabel = function () {
|
45438 | var pagesExist = this.paginationProxy.getTotalPages() > 0;
|
45439 | var currentPage = this.paginationProxy.getCurrentPage();
|
45440 | var toDisplay = pagesExist ? currentPage + 1 : 0;
|
45441 | this.lbCurrent.innerHTML = this.formatNumber(toDisplay);
|
45442 | };
|
45443 | PaginationComp.prototype.formatNumber = function (value) {
|
45444 | var userFunc = this.gridOptionsWrapper.getPaginationNumberFormatterFunc();
|
45445 | if (userFunc) {
|
45446 | var params = { value: value };
|
45447 | return userFunc(params);
|
45448 | }
|
45449 | var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
|
45450 | var thousandSeparator = localeTextFunc('thousandSeparator', ',');
|
45451 | var decimalSeparator = localeTextFunc('decimalSeparator', '.');
|
45452 | return formatNumberCommas(value, thousandSeparator, decimalSeparator);
|
45453 | };
|
45454 | PaginationComp.prototype.getTemplate = function () {
|
45455 | var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
|
45456 | var strPage = localeTextFunc('page', 'Page');
|
45457 | var strTo = localeTextFunc('to', 'to');
|
45458 | var strOf = localeTextFunc('of', 'of');
|
45459 | var strFirst = localeTextFunc('firstPage', 'First Page');
|
45460 | var strPrevious = localeTextFunc('previousPage', 'Previous Page');
|
45461 | var strNext = localeTextFunc('nextPage', 'Next Page');
|
45462 | var strLast = localeTextFunc('lastPage', 'Last Page');
|
45463 | var compId = this.getCompId();
|
45464 | 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>";
|
45465 | };
|
45466 | PaginationComp.prototype.onBtNext = function () {
|
45467 | if (!this.nextButtonDisabled) {
|
45468 | this.paginationProxy.goToNextPage();
|
45469 | }
|
45470 | };
|
45471 | PaginationComp.prototype.onBtPrevious = function () {
|
45472 | if (!this.previousAndFirstButtonsDisabled) {
|
45473 | this.paginationProxy.goToPreviousPage();
|
45474 | }
|
45475 | };
|
45476 | PaginationComp.prototype.onBtLast = function () {
|
45477 | if (!this.lastButtonDisabled) {
|
45478 | this.paginationProxy.goToLastPage();
|
45479 | }
|
45480 | };
|
45481 | PaginationComp.prototype.enableOrDisableButtons = function () {
|
45482 | var currentPage = this.paginationProxy.getCurrentPage();
|
45483 | var maxRowFound = this.paginationProxy.isLastPageFound();
|
45484 | var totalPages = this.paginationProxy.getTotalPages();
|
45485 | this.previousAndFirstButtonsDisabled = currentPage === 0;
|
45486 | this.toggleButtonDisabled(this.btFirst, this.previousAndFirstButtonsDisabled);
|
45487 | this.toggleButtonDisabled(this.btPrevious, this.previousAndFirstButtonsDisabled);
|
45488 | var zeroPagesToDisplay = this.isZeroPagesToDisplay();
|
45489 | var onLastPage = maxRowFound && currentPage === (totalPages - 1);
|
45490 | this.nextButtonDisabled = onLastPage || zeroPagesToDisplay;
|
45491 | this.lastButtonDisabled = !maxRowFound || zeroPagesToDisplay || currentPage === (totalPages - 1);
|
45492 | this.toggleButtonDisabled(this.btNext, this.nextButtonDisabled);
|
45493 | this.toggleButtonDisabled(this.btLast, this.lastButtonDisabled);
|
45494 | };
|
45495 | PaginationComp.prototype.toggleButtonDisabled = function (button, disabled) {
|
45496 | setAriaDisabled(button, disabled);
|
45497 | button.classList.toggle('ag-disabled', disabled);
|
45498 | if (disabled) {
|
45499 | button.removeAttribute('tabindex');
|
45500 | }
|
45501 | else {
|
45502 | button.setAttribute('tabindex', '0');
|
45503 | }
|
45504 | };
|
45505 | PaginationComp.prototype.updateRowLabels = function () {
|
45506 | var currentPage = this.paginationProxy.getCurrentPage();
|
45507 | var pageSize = this.paginationProxy.getPageSize();
|
45508 | var maxRowFound = this.paginationProxy.isLastPageFound();
|
45509 | var rowCount = this.paginationProxy.isLastPageFound() ?
|
45510 | this.paginationProxy.getMasterRowCount() : null;
|
45511 | var startRow;
|
45512 | var endRow;
|
45513 | if (this.isZeroPagesToDisplay()) {
|
45514 | startRow = endRow = 0;
|
45515 | }
|
45516 | else {
|
45517 | startRow = (pageSize * currentPage) + 1;
|
45518 | endRow = startRow + pageSize - 1;
|
45519 | if (maxRowFound && endRow > rowCount) {
|
45520 | endRow = rowCount;
|
45521 | }
|
45522 | }
|
45523 | this.lbFirstRowOnPage.innerHTML = this.formatNumber(startRow);
|
45524 | if (this.rowNodeBlockLoader.isLoading()) {
|
45525 | this.lbLastRowOnPage.innerHTML = '?';
|
45526 | }
|
45527 | else {
|
45528 | this.lbLastRowOnPage.innerHTML = this.formatNumber(endRow);
|
45529 | }
|
45530 | };
|
45531 | PaginationComp.prototype.isZeroPagesToDisplay = function () {
|
45532 | var maxRowFound = this.paginationProxy.isLastPageFound();
|
45533 | var totalPages = this.paginationProxy.getTotalPages();
|
45534 | return maxRowFound && totalPages === 0;
|
45535 | };
|
45536 | PaginationComp.prototype.setTotalLabels = function () {
|
45537 | var lastPageFound = this.paginationProxy.isLastPageFound();
|
45538 | var totalPages = this.paginationProxy.getTotalPages();
|
45539 | var rowCount = lastPageFound ? this.paginationProxy.getMasterRowCount() : null;
|
45540 |
|
45541 |
|
45542 |
|
45543 | if (rowCount === 1) {
|
45544 | var firstRow = this.paginationProxy.getRow(0);
|
45545 |
|
45546 | var hiddenGroupRow = firstRow && firstRow.group && !(firstRow.groupData || firstRow.aggData);
|
45547 | if (hiddenGroupRow) {
|
45548 | this.setTotalLabelsToZero();
|
45549 | return;
|
45550 | }
|
45551 | }
|
45552 | if (lastPageFound) {
|
45553 | this.lbTotal.innerHTML = this.formatNumber(totalPages);
|
45554 | this.lbRecordCount.innerHTML = this.formatNumber(rowCount);
|
45555 | }
|
45556 | else {
|
45557 | var moreText = this.gridOptionsWrapper.getLocaleTextFunc()('more', 'more');
|
45558 | this.lbTotal.innerHTML = moreText;
|
45559 | this.lbRecordCount.innerHTML = moreText;
|
45560 | }
|
45561 | };
|
45562 | PaginationComp.prototype.setTotalLabelsToZero = function () {
|
45563 | this.lbFirstRowOnPage.innerHTML = this.formatNumber(0);
|
45564 | this.lbCurrent.innerHTML = this.formatNumber(0);
|
45565 | this.lbLastRowOnPage.innerHTML = this.formatNumber(0);
|
45566 | this.lbTotal.innerHTML = this.formatNumber(0);
|
45567 | this.lbRecordCount.innerHTML = this.formatNumber(0);
|
45568 | };
|
45569 | __decorate$28([
|
45570 | Autowired('paginationProxy')
|
45571 | ], PaginationComp.prototype, "paginationProxy", void 0);
|
45572 | __decorate$28([
|
45573 | Autowired('rowNodeBlockLoader')
|
45574 | ], PaginationComp.prototype, "rowNodeBlockLoader", void 0);
|
45575 | __decorate$28([
|
45576 | RefSelector('btFirst')
|
45577 | ], PaginationComp.prototype, "btFirst", void 0);
|
45578 | __decorate$28([
|
45579 | RefSelector('btPrevious')
|
45580 | ], PaginationComp.prototype, "btPrevious", void 0);
|
45581 | __decorate$28([
|
45582 | RefSelector('btNext')
|
45583 | ], PaginationComp.prototype, "btNext", void 0);
|
45584 | __decorate$28([
|
45585 | RefSelector('btLast')
|
45586 | ], PaginationComp.prototype, "btLast", void 0);
|
45587 | __decorate$28([
|
45588 | RefSelector('lbRecordCount')
|
45589 | ], PaginationComp.prototype, "lbRecordCount", void 0);
|
45590 | __decorate$28([
|
45591 | RefSelector('lbFirstRowOnPage')
|
45592 | ], PaginationComp.prototype, "lbFirstRowOnPage", void 0);
|
45593 | __decorate$28([
|
45594 | RefSelector('lbLastRowOnPage')
|
45595 | ], PaginationComp.prototype, "lbLastRowOnPage", void 0);
|
45596 | __decorate$28([
|
45597 | RefSelector('lbCurrent')
|
45598 | ], PaginationComp.prototype, "lbCurrent", void 0);
|
45599 | __decorate$28([
|
45600 | RefSelector('lbTotal')
|
45601 | ], PaginationComp.prototype, "lbTotal", void 0);
|
45602 | __decorate$28([
|
45603 | PostConstruct
|
45604 | ], PaginationComp.prototype, "postConstruct", null);
|
45605 | return PaginationComp;
|
45606 | }(Component));
|
45607 |
|
45608 |
|
45609 |
|
45610 |
|
45611 |
|
45612 |
|
45613 |
|
45614 | var __extends$2u = (undefined && undefined.__extends) || (function () {
|
45615 | var extendStatics = function (d, b) {
|
45616 | extendStatics = Object.setPrototypeOf ||
|
45617 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45618 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
45619 | return extendStatics(d, b);
|
45620 | };
|
45621 | return function (d, b) {
|
45622 | extendStatics(d, b);
|
45623 | function __() { this.constructor = d; }
|
45624 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45625 | };
|
45626 | })();
|
45627 | var __decorate$29 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45628 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45629 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45630 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45631 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45632 | };
|
45633 | var LoadingType;
|
45634 | (function (LoadingType) {
|
45635 | LoadingType[LoadingType["Loading"] = 0] = "Loading";
|
45636 | LoadingType[LoadingType["NoRows"] = 1] = "NoRows";
|
45637 | })(LoadingType || (LoadingType = {}));
|
45638 | var OverlayWrapperComponent = (function (_super) {
|
45639 | __extends$2u(OverlayWrapperComponent, _super);
|
45640 | function OverlayWrapperComponent() {
|
45641 | var _this = _super.call(this, OverlayWrapperComponent.TEMPLATE) || this;
|
45642 | _this.inProgress = false;
|
45643 | _this.destroyRequested = false;
|
45644 | _this.manuallyDisplayed = false;
|
45645 | return _this;
|
45646 | }
|
45647 | OverlayWrapperComponent.prototype.updateLayoutClasses = function (cssClass, params) {
|
45648 | var overlayWrapperClassList = this.eOverlayWrapper.classList;
|
45649 | overlayWrapperClassList.toggle(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
|
45650 | overlayWrapperClassList.toggle(LayoutCssClasses.NORMAL, params.normal);
|
45651 | overlayWrapperClassList.toggle(LayoutCssClasses.PRINT, params.print);
|
45652 | };
|
45653 | OverlayWrapperComponent.prototype.postConstruct = function () {
|
45654 | this.createManagedBean(new LayoutFeature(this));
|
45655 | this.setDisplayed(false);
|
45656 | this.addManagedListener(this.eventService, Events.EVENT_ROW_DATA_CHANGED, this.onRowDataChanged.bind(this));
|
45657 | this.addManagedListener(this.eventService, Events.EVENT_ROW_DATA_UPDATED, this.onRowDataChanged.bind(this));
|
45658 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onNewColumnsLoaded.bind(this));
|
45659 | if (this.gridOptionsWrapper.isRowModelDefault() && !this.gridOptionsWrapper.getRowData()) {
|
45660 | this.showLoadingOverlay();
|
45661 | }
|
45662 | this.gridApi.registerOverlayWrapperComp(this);
|
45663 | };
|
45664 | OverlayWrapperComponent.prototype.setWrapperTypeClass = function (loadingType) {
|
45665 | var overlayWrapperClassList = this.eOverlayWrapper.classList;
|
45666 | overlayWrapperClassList.toggle('ag-overlay-loading-wrapper', loadingType === LoadingType.Loading);
|
45667 | overlayWrapperClassList.toggle('ag-overlay-no-rows-wrapper', loadingType === LoadingType.NoRows);
|
45668 | };
|
45669 | OverlayWrapperComponent.prototype.showLoadingOverlay = function () {
|
45670 | if (this.gridOptionsWrapper.isSuppressLoadingOverlay()) {
|
45671 | return;
|
45672 | }
|
45673 | var params = {};
|
45674 | var compDetails = this.userComponentFactory.getLoadingOverlayCompDetails(params);
|
45675 | var promise = compDetails.newAgStackInstance();
|
45676 | this.showOverlay(promise, LoadingType.Loading);
|
45677 | };
|
45678 | OverlayWrapperComponent.prototype.showNoRowsOverlay = function () {
|
45679 | if (this.gridOptionsWrapper.isSuppressNoRowsOverlay()) {
|
45680 | return;
|
45681 | }
|
45682 | var params = {};
|
45683 | var compDetails = this.userComponentFactory.getNoRowsOverlayCompDetails(params);
|
45684 | var promise = compDetails.newAgStackInstance();
|
45685 | this.showOverlay(promise, LoadingType.NoRows);
|
45686 | };
|
45687 | OverlayWrapperComponent.prototype.showOverlay = function (workItem, type) {
|
45688 | var _this = this;
|
45689 | if (this.inProgress) {
|
45690 | return;
|
45691 | }
|
45692 | this.setWrapperTypeClass(type);
|
45693 | this.destroyActiveOverlay();
|
45694 | this.inProgress = true;
|
45695 | if (workItem) {
|
45696 | workItem.then(function (comp) {
|
45697 | _this.inProgress = false;
|
45698 | _this.eOverlayWrapper.appendChild(comp.getGui());
|
45699 | _this.activeOverlay = comp;
|
45700 | if (_this.destroyRequested) {
|
45701 | _this.destroyRequested = false;
|
45702 | _this.destroyActiveOverlay();
|
45703 | }
|
45704 | });
|
45705 | }
|
45706 | this.manuallyDisplayed = this.columnModel.isReady() && !this.paginationProxy.isEmpty();
|
45707 | this.setDisplayed(true);
|
45708 | };
|
45709 | OverlayWrapperComponent.prototype.destroyActiveOverlay = function () {
|
45710 | if (this.inProgress) {
|
45711 | this.destroyRequested = true;
|
45712 | return;
|
45713 | }
|
45714 | if (!this.activeOverlay) {
|
45715 | return;
|
45716 | }
|
45717 | this.activeOverlay = this.getContext().destroyBean(this.activeOverlay);
|
45718 | clearElement(this.eOverlayWrapper);
|
45719 | };
|
45720 | OverlayWrapperComponent.prototype.hideOverlay = function () {
|
45721 | this.manuallyDisplayed = false;
|
45722 | this.destroyActiveOverlay();
|
45723 | this.setDisplayed(false);
|
45724 | };
|
45725 | OverlayWrapperComponent.prototype.destroy = function () {
|
45726 | this.destroyActiveOverlay();
|
45727 | _super.prototype.destroy.call(this);
|
45728 | };
|
45729 | OverlayWrapperComponent.prototype.showOrHideOverlay = function () {
|
45730 | var isEmpty = this.paginationProxy.isEmpty();
|
45731 | var isSuppressNoRowsOverlay = this.gridOptionsWrapper.isSuppressNoRowsOverlay();
|
45732 | if (isEmpty && !isSuppressNoRowsOverlay) {
|
45733 | this.showNoRowsOverlay();
|
45734 | }
|
45735 | else {
|
45736 | this.hideOverlay();
|
45737 | }
|
45738 | };
|
45739 | OverlayWrapperComponent.prototype.onRowDataChanged = function () {
|
45740 | this.showOrHideOverlay();
|
45741 | };
|
45742 | OverlayWrapperComponent.prototype.onNewColumnsLoaded = function () {
|
45743 |
|
45744 |
|
45745 |
|
45746 |
|
45747 | if (this.columnModel.isReady() && !this.paginationProxy.isEmpty() && !this.manuallyDisplayed) {
|
45748 | this.hideOverlay();
|
45749 | }
|
45750 | };
|
45751 |
|
45752 |
|
45753 | 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>";
|
45754 | __decorate$29([
|
45755 | Autowired('userComponentFactory')
|
45756 | ], OverlayWrapperComponent.prototype, "userComponentFactory", void 0);
|
45757 | __decorate$29([
|
45758 | Autowired('paginationProxy')
|
45759 | ], OverlayWrapperComponent.prototype, "paginationProxy", void 0);
|
45760 | __decorate$29([
|
45761 | Autowired('gridApi')
|
45762 | ], OverlayWrapperComponent.prototype, "gridApi", void 0);
|
45763 | __decorate$29([
|
45764 | Autowired('columnModel')
|
45765 | ], OverlayWrapperComponent.prototype, "columnModel", void 0);
|
45766 | __decorate$29([
|
45767 | RefSelector('eOverlayWrapper')
|
45768 | ], OverlayWrapperComponent.prototype, "eOverlayWrapper", void 0);
|
45769 | __decorate$29([
|
45770 | PostConstruct
|
45771 | ], OverlayWrapperComponent.prototype, "postConstruct", null);
|
45772 | return OverlayWrapperComponent;
|
45773 | }(Component));
|
45774 |
|
45775 |
|
45776 |
|
45777 |
|
45778 |
|
45779 |
|
45780 |
|
45781 | var __extends$2v = (undefined && undefined.__extends) || (function () {
|
45782 | var extendStatics = function (d, b) {
|
45783 | extendStatics = Object.setPrototypeOf ||
|
45784 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45785 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
45786 | return extendStatics(d, b);
|
45787 | };
|
45788 | return function (d, b) {
|
45789 | extendStatics(d, b);
|
45790 | function __() { this.constructor = d; }
|
45791 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45792 | };
|
45793 | })();
|
45794 | var __decorate$2a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45795 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45796 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45797 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45798 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45799 | };
|
45800 | var RowPositionUtils = (function (_super) {
|
45801 | __extends$2v(RowPositionUtils, _super);
|
45802 | function RowPositionUtils() {
|
45803 | return _super !== null && _super.apply(this, arguments) || this;
|
45804 | }
|
45805 | RowPositionUtils.prototype.getFirstRow = function () {
|
45806 | var rowIndex = 0;
|
45807 | var rowPinned;
|
45808 | if (this.pinnedRowModel.getPinnedTopRowCount()) {
|
45809 | rowPinned = Constants.PINNED_TOP;
|
45810 | }
|
45811 | else if (this.rowModel.getRowCount()) {
|
45812 | rowPinned = null;
|
45813 | rowIndex = this.paginationProxy.getPageFirstRow();
|
45814 | }
|
45815 | else if (this.pinnedRowModel.getPinnedBottomRowCount()) {
|
45816 | rowPinned = Constants.PINNED_BOTTOM;
|
45817 | }
|
45818 | return rowPinned === undefined ? null : { rowIndex: rowIndex, rowPinned: rowPinned };
|
45819 | };
|
45820 | RowPositionUtils.prototype.getLastRow = function () {
|
45821 | var rowIndex;
|
45822 | var rowPinned = null;
|
45823 | var pinnedBottomCount = this.pinnedRowModel.getPinnedBottomRowCount();
|
45824 | var pinnedTopCount = this.pinnedRowModel.getPinnedTopRowCount();
|
45825 | if (pinnedBottomCount) {
|
45826 | rowPinned = Constants.PINNED_BOTTOM;
|
45827 | rowIndex = pinnedBottomCount - 1;
|
45828 | }
|
45829 | else if (this.rowModel.getRowCount()) {
|
45830 | rowPinned = null;
|
45831 | rowIndex = this.paginationProxy.getPageLastRow();
|
45832 | }
|
45833 | else if (pinnedTopCount) {
|
45834 | rowPinned = Constants.PINNED_TOP;
|
45835 | rowIndex = pinnedTopCount - 1;
|
45836 | }
|
45837 | return rowIndex === undefined ? null : { rowIndex: rowIndex, rowPinned: rowPinned };
|
45838 | };
|
45839 | RowPositionUtils.prototype.getRowNode = function (gridRow) {
|
45840 | switch (gridRow.rowPinned) {
|
45841 | case Constants.PINNED_TOP:
|
45842 | return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];
|
45843 | case Constants.PINNED_BOTTOM:
|
45844 | return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];
|
45845 | default:
|
45846 | return this.rowModel.getRow(gridRow.rowIndex);
|
45847 | }
|
45848 | };
|
45849 | RowPositionUtils.prototype.sameRow = function (rowA, rowB) {
|
45850 |
|
45851 | if (!rowA && !rowB) {
|
45852 | return true;
|
45853 | }
|
45854 |
|
45855 | if ((rowA && !rowB) || (!rowA && rowB)) {
|
45856 | return false;
|
45857 | }
|
45858 |
|
45859 | return rowA.rowIndex === rowB.rowIndex && rowA.rowPinned == rowB.rowPinned;
|
45860 | };
|
45861 |
|
45862 | RowPositionUtils.prototype.before = function (rowA, rowB) {
|
45863 | switch (rowA.rowPinned) {
|
45864 | case Constants.PINNED_TOP:
|
45865 |
|
45866 | if (rowB.rowPinned !== Constants.PINNED_TOP) {
|
45867 | return true;
|
45868 | }
|
45869 | break;
|
45870 | case Constants.PINNED_BOTTOM:
|
45871 |
|
45872 | if (rowB.rowPinned !== Constants.PINNED_BOTTOM) {
|
45873 | return false;
|
45874 | }
|
45875 | break;
|
45876 | default:
|
45877 |
|
45878 | if (exists(rowB.rowPinned)) {
|
45879 | return rowB.rowPinned !== Constants.PINNED_TOP;
|
45880 | }
|
45881 | break;
|
45882 | }
|
45883 | return rowA.rowIndex < rowB.rowIndex;
|
45884 | };
|
45885 | __decorate$2a([
|
45886 | Autowired('rowModel')
|
45887 | ], RowPositionUtils.prototype, "rowModel", void 0);
|
45888 | __decorate$2a([
|
45889 | Autowired('pinnedRowModel')
|
45890 | ], RowPositionUtils.prototype, "pinnedRowModel", void 0);
|
45891 | __decorate$2a([
|
45892 | Autowired('paginationProxy')
|
45893 | ], RowPositionUtils.prototype, "paginationProxy", void 0);
|
45894 | RowPositionUtils = __decorate$2a([
|
45895 | Bean('rowPositionUtils')
|
45896 | ], RowPositionUtils);
|
45897 | return RowPositionUtils;
|
45898 | }(BeanStub));
|
45899 |
|
45900 |
|
45901 |
|
45902 |
|
45903 |
|
45904 |
|
45905 |
|
45906 | var __extends$2w = (undefined && undefined.__extends) || (function () {
|
45907 | var extendStatics = function (d, b) {
|
45908 | extendStatics = Object.setPrototypeOf ||
|
45909 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45910 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
45911 | return extendStatics(d, b);
|
45912 | };
|
45913 | return function (d, b) {
|
45914 | extendStatics(d, b);
|
45915 | function __() { this.constructor = d; }
|
45916 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45917 | };
|
45918 | })();
|
45919 | var __decorate$2b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45920 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45921 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45922 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45923 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45924 | };
|
45925 | var CellPositionUtils = (function (_super) {
|
45926 | __extends$2w(CellPositionUtils, _super);
|
45927 | function CellPositionUtils() {
|
45928 | return _super !== null && _super.apply(this, arguments) || this;
|
45929 | }
|
45930 | CellPositionUtils.prototype.createId = function (cellPosition) {
|
45931 | var rowIndex = cellPosition.rowIndex, rowPinned = cellPosition.rowPinned, column = cellPosition.column;
|
45932 | return this.createIdFromValues(rowIndex, column, rowPinned);
|
45933 | };
|
45934 | CellPositionUtils.prototype.createIdFromValues = function (rowIndex, column, rowPinned) {
|
45935 | return rowIndex + "." + (rowPinned == null ? 'null' : rowPinned) + "." + column.getId();
|
45936 | };
|
45937 | CellPositionUtils.prototype.equals = function (cellA, cellB) {
|
45938 | var colsMatch = cellA.column === cellB.column;
|
45939 | var floatingMatch = cellA.rowPinned === cellB.rowPinned;
|
45940 | var indexMatch = cellA.rowIndex === cellB.rowIndex;
|
45941 | return colsMatch && floatingMatch && indexMatch;
|
45942 | };
|
45943 | CellPositionUtils = __decorate$2b([
|
45944 | Bean('cellPositionUtils')
|
45945 | ], CellPositionUtils);
|
45946 | return CellPositionUtils;
|
45947 | }(BeanStub));
|
45948 |
|
45949 |
|
45950 |
|
45951 |
|
45952 |
|
45953 |
|
45954 |
|
45955 | var __extends$2x = (undefined && undefined.__extends) || (function () {
|
45956 | var extendStatics = function (d, b) {
|
45957 | extendStatics = Object.setPrototypeOf ||
|
45958 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45959 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
45960 | return extendStatics(d, b);
|
45961 | };
|
45962 | return function (d, b) {
|
45963 | extendStatics(d, b);
|
45964 | function __() { this.constructor = d; }
|
45965 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45966 | };
|
45967 | })();
|
45968 | var UndoRedoAction = (function () {
|
45969 | function UndoRedoAction(cellValueChanges) {
|
45970 | this.cellValueChanges = cellValueChanges;
|
45971 | }
|
45972 | return UndoRedoAction;
|
45973 | }());
|
45974 | var FillUndoRedoAction = (function (_super) {
|
45975 | __extends$2x(FillUndoRedoAction, _super);
|
45976 | function FillUndoRedoAction(cellValueChanges, initialRange, finalRange) {
|
45977 | var _this = _super.call(this, cellValueChanges) || this;
|
45978 | _this.initialRange = initialRange;
|
45979 | _this.finalRange = finalRange;
|
45980 | return _this;
|
45981 | }
|
45982 | return FillUndoRedoAction;
|
45983 | }(UndoRedoAction));
|
45984 | var UndoRedoStack = (function () {
|
45985 | function UndoRedoStack(maxStackSize) {
|
45986 | this.actionStack = [];
|
45987 | this.maxStackSize = maxStackSize ? maxStackSize : UndoRedoStack.DEFAULT_STACK_SIZE;
|
45988 | this.actionStack = new Array(this.maxStackSize);
|
45989 | }
|
45990 | UndoRedoStack.prototype.pop = function () {
|
45991 | return this.actionStack.pop();
|
45992 | };
|
45993 | UndoRedoStack.prototype.push = function (item) {
|
45994 | var shouldAddActions = item.cellValueChanges && item.cellValueChanges.length > 0;
|
45995 | if (!shouldAddActions) {
|
45996 | return;
|
45997 | }
|
45998 | if (this.actionStack.length === this.maxStackSize) {
|
45999 | this.actionStack.shift();
|
46000 | }
|
46001 | this.actionStack.push(item);
|
46002 | };
|
46003 | UndoRedoStack.prototype.clear = function () {
|
46004 | this.actionStack = [];
|
46005 | };
|
46006 | UndoRedoStack.prototype.getCurrentStackSize = function () {
|
46007 | return this.actionStack.length;
|
46008 | };
|
46009 | UndoRedoStack.DEFAULT_STACK_SIZE = 10;
|
46010 | return UndoRedoStack;
|
46011 | }());
|
46012 |
|
46013 |
|
46014 |
|
46015 |
|
46016 |
|
46017 |
|
46018 |
|
46019 | var __extends$2y = (undefined && undefined.__extends) || (function () {
|
46020 | var extendStatics = function (d, b) {
|
46021 | extendStatics = Object.setPrototypeOf ||
|
46022 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
46023 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
46024 | return extendStatics(d, b);
|
46025 | };
|
46026 | return function (d, b) {
|
46027 | extendStatics(d, b);
|
46028 | function __() { this.constructor = d; }
|
46029 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
46030 | };
|
46031 | })();
|
46032 | var __decorate$2c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46033 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46034 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46035 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46036 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46037 | };
|
46038 | var UndoRedoService = (function (_super) {
|
46039 | __extends$2y(UndoRedoService, _super);
|
46040 | function UndoRedoService() {
|
46041 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
46042 | _this.cellValueChanges = [];
|
46043 | _this.activeCellEdit = null;
|
46044 | _this.activeRowEdit = null;
|
46045 | _this.isPasting = false;
|
46046 | _this.isFilling = false;
|
46047 | _this.onCellValueChanged = function (event) {
|
46048 | var eventCell = { column: event.column, rowIndex: event.rowIndex, rowPinned: event.rowPinned };
|
46049 | var isCellEditing = _this.activeCellEdit !== null && _this.cellPositionUtils.equals(_this.activeCellEdit, eventCell);
|
46050 | var isRowEditing = _this.activeRowEdit !== null && _this.rowPositionUtils.sameRow(_this.activeRowEdit, eventCell);
|
46051 | var shouldCaptureAction = isCellEditing || isRowEditing || _this.isPasting || _this.isFilling;
|
46052 | if (!shouldCaptureAction) {
|
46053 | return;
|
46054 | }
|
46055 | var rowPinned = event.rowPinned, rowIndex = event.rowIndex, column = event.column, oldValue = event.oldValue, value = event.value;
|
46056 | var cellValueChange = {
|
46057 | rowPinned: rowPinned,
|
46058 | rowIndex: rowIndex,
|
46059 | columnId: column.getColId(),
|
46060 | newValue: value,
|
46061 | oldValue: oldValue
|
46062 | };
|
46063 | _this.cellValueChanges.push(cellValueChange);
|
46064 | };
|
46065 | _this.clearStacks = function () {
|
46066 | _this.undoStack.clear();
|
46067 | _this.redoStack.clear();
|
46068 | };
|
46069 | return _this;
|
46070 | }
|
46071 | UndoRedoService.prototype.init = function () {
|
46072 | if (!this.gridOptionsWrapper.isUndoRedoCellEditing()) {
|
46073 | return;
|
46074 | }
|
46075 | var undoRedoLimit = this.gridOptionsWrapper.getUndoRedoCellEditingLimit();
|
46076 | if (undoRedoLimit <= 0) {
|
46077 | return;
|
46078 | }
|
46079 | this.undoStack = new UndoRedoStack(undoRedoLimit);
|
46080 | this.redoStack = new UndoRedoStack(undoRedoLimit);
|
46081 | this.addRowEditingListeners();
|
46082 | this.addCellEditingListeners();
|
46083 | this.addPasteListeners();
|
46084 | this.addFillListeners();
|
46085 | this.addManagedListener(this.eventService, Events.EVENT_CELL_VALUE_CHANGED, this.onCellValueChanged);
|
46086 |
|
46087 |
|
46088 | this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, this.clearStacks);
|
46089 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, this.clearStacks);
|
46090 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.clearStacks);
|
46091 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, this.clearStacks);
|
46092 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.clearStacks);
|
46093 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, this.clearStacks);
|
46094 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, this.clearStacks);
|
46095 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, this.clearStacks);
|
46096 | this.addManagedListener(this.eventService, Events.EVENT_ROW_DRAG_END, this.clearStacks);
|
46097 | };
|
46098 | UndoRedoService.prototype.getCurrentUndoStackSize = function () {
|
46099 | return this.undoStack ? this.undoStack.getCurrentStackSize() : 0;
|
46100 | };
|
46101 | UndoRedoService.prototype.getCurrentRedoStackSize = function () {
|
46102 | return this.redoStack ? this.redoStack.getCurrentStackSize() : 0;
|
46103 | };
|
46104 | UndoRedoService.prototype.undo = function () {
|
46105 | if (!this.undoStack) {
|
46106 | return;
|
46107 | }
|
46108 | var undoAction = this.undoStack.pop();
|
46109 | if (!undoAction || !undoAction.cellValueChanges) {
|
46110 | return;
|
46111 | }
|
46112 | this.processAction(undoAction, function (cellValueChange) { return cellValueChange.oldValue; });
|
46113 | if (undoAction instanceof FillUndoRedoAction) {
|
46114 | this.processRangeAndCellFocus(undoAction.cellValueChanges, undoAction.initialRange);
|
46115 | }
|
46116 | else {
|
46117 | this.processRangeAndCellFocus(undoAction.cellValueChanges);
|
46118 | }
|
46119 | this.redoStack.push(undoAction);
|
46120 | };
|
46121 | UndoRedoService.prototype.redo = function () {
|
46122 | if (!this.redoStack) {
|
46123 | return;
|
46124 | }
|
46125 | var redoAction = this.redoStack.pop();
|
46126 | if (!redoAction || !redoAction.cellValueChanges) {
|
46127 | return;
|
46128 | }
|
46129 | this.processAction(redoAction, function (cellValueChange) { return cellValueChange.newValue; });
|
46130 | if (redoAction instanceof FillUndoRedoAction) {
|
46131 | this.processRangeAndCellFocus(redoAction.cellValueChanges, redoAction.finalRange);
|
46132 | }
|
46133 | else {
|
46134 | this.processRangeAndCellFocus(redoAction.cellValueChanges);
|
46135 | }
|
46136 | this.undoStack.push(redoAction);
|
46137 | };
|
46138 | UndoRedoService.prototype.processAction = function (action, valueExtractor) {
|
46139 | var _this = this;
|
46140 | action.cellValueChanges.forEach(function (cellValueChange) {
|
46141 | var rowIndex = cellValueChange.rowIndex, rowPinned = cellValueChange.rowPinned, columnId = cellValueChange.columnId;
|
46142 | var rowPosition = { rowIndex: rowIndex, rowPinned: rowPinned };
|
46143 | var currentRow = _this.getRowNode(rowPosition);
|
46144 |
|
46145 | if (!currentRow.displayed) {
|
46146 | return;
|
46147 | }
|
46148 | currentRow.setDataValue(columnId, valueExtractor(cellValueChange));
|
46149 | });
|
46150 | };
|
46151 | UndoRedoService.prototype.processRangeAndCellFocus = function (cellValueChanges, range) {
|
46152 | var lastFocusedCell;
|
46153 | if (range) {
|
46154 | var startRow = range.startRow;
|
46155 | var endRow = range.endRow;
|
46156 | lastFocusedCell = {
|
46157 | rowPinned: startRow.rowPinned,
|
46158 | rowIndex: startRow.rowIndex,
|
46159 | columnId: range.startColumn.getColId()
|
46160 | };
|
46161 | this.setLastFocusedCell(lastFocusedCell);
|
46162 | var cellRangeParams = {
|
46163 | rowStartIndex: startRow.rowIndex,
|
46164 | rowStartPinned: startRow.rowPinned,
|
46165 | rowEndIndex: endRow.rowIndex,
|
46166 | rowEndPinned: endRow.rowPinned,
|
46167 | columnStart: range.startColumn,
|
46168 | columns: range.columns
|
46169 | };
|
46170 | this.gridApi.addCellRange(cellRangeParams);
|
46171 | return;
|
46172 | }
|
46173 | var cellValueChange = cellValueChanges[0];
|
46174 | var rowIndex = cellValueChange.rowIndex, rowPinned = cellValueChange.rowPinned;
|
46175 | var rowPosition = { rowIndex: rowIndex, rowPinned: rowPinned };
|
46176 | var row = this.getRowNode(rowPosition);
|
46177 | lastFocusedCell = {
|
46178 | rowPinned: cellValueChange.rowPinned,
|
46179 | rowIndex: row.rowIndex,
|
46180 | columnId: cellValueChange.columnId
|
46181 | };
|
46182 | this.setLastFocusedCell(lastFocusedCell);
|
46183 | };
|
46184 | UndoRedoService.prototype.setLastFocusedCell = function (lastFocusedCell) {
|
46185 | var rowIndex = lastFocusedCell.rowIndex, columnId = lastFocusedCell.columnId, rowPinned = lastFocusedCell.rowPinned;
|
46186 | this.gridApi.ensureIndexVisible(rowIndex);
|
46187 | this.gridApi.ensureColumnVisible(columnId);
|
46188 | if (ModuleRegistry.isRegistered(ModuleNames.RangeSelectionModule)) {
|
46189 | this.gridApi.clearRangeSelection();
|
46190 | }
|
46191 | this.focusService.setFocusedCell(rowIndex, columnId, rowPinned, true);
|
46192 | };
|
46193 | UndoRedoService.prototype.addRowEditingListeners = function () {
|
46194 | var _this = this;
|
46195 | this.addManagedListener(this.eventService, Events.EVENT_ROW_EDITING_STARTED, function (e) {
|
46196 | _this.activeRowEdit = { rowIndex: e.rowIndex, rowPinned: e.rowPinned };
|
46197 | });
|
46198 | this.addManagedListener(this.eventService, Events.EVENT_ROW_EDITING_STOPPED, function () {
|
46199 | var action = new UndoRedoAction(_this.cellValueChanges);
|
46200 | _this.pushActionsToUndoStack(action);
|
46201 | _this.activeRowEdit = null;
|
46202 | });
|
46203 | };
|
46204 | UndoRedoService.prototype.addCellEditingListeners = function () {
|
46205 | var _this = this;
|
46206 | this.addManagedListener(this.eventService, Events.EVENT_CELL_EDITING_STARTED, function (e) {
|
46207 | _this.activeCellEdit = { column: e.column, rowIndex: e.rowIndex, rowPinned: e.rowPinned };
|
46208 | });
|
46209 | this.addManagedListener(this.eventService, Events.EVENT_CELL_EDITING_STOPPED, function () {
|
46210 | _this.activeCellEdit = null;
|
46211 | var shouldPushAction = !_this.activeRowEdit && !_this.isPasting && !_this.isFilling;
|
46212 | if (shouldPushAction) {
|
46213 | var action = new UndoRedoAction(_this.cellValueChanges);
|
46214 | _this.pushActionsToUndoStack(action);
|
46215 | }
|
46216 | });
|
46217 | };
|
46218 | UndoRedoService.prototype.addPasteListeners = function () {
|
46219 | var _this = this;
|
46220 | this.addManagedListener(this.eventService, Events.EVENT_PASTE_START, function () {
|
46221 | _this.isPasting = true;
|
46222 | });
|
46223 | this.addManagedListener(this.eventService, Events.EVENT_PASTE_END, function () {
|
46224 | var action = new UndoRedoAction(_this.cellValueChanges);
|
46225 | _this.pushActionsToUndoStack(action);
|
46226 | _this.isPasting = false;
|
46227 | });
|
46228 | };
|
46229 | UndoRedoService.prototype.addFillListeners = function () {
|
46230 | var _this = this;
|
46231 | this.addManagedListener(this.eventService, Events.EVENT_FILL_START, function () {
|
46232 | _this.isFilling = true;
|
46233 | });
|
46234 | this.addManagedListener(this.eventService, Events.EVENT_FILL_END, function (event) {
|
46235 | var action = new FillUndoRedoAction(_this.cellValueChanges, event.initialRange, event.finalRange);
|
46236 | _this.pushActionsToUndoStack(action);
|
46237 | _this.isFilling = false;
|
46238 | });
|
46239 | };
|
46240 | UndoRedoService.prototype.pushActionsToUndoStack = function (action) {
|
46241 | this.undoStack.push(action);
|
46242 | this.cellValueChanges = [];
|
46243 | this.redoStack.clear();
|
46244 | };
|
46245 | UndoRedoService.prototype.getRowNode = function (gridRow) {
|
46246 | switch (gridRow.rowPinned) {
|
46247 | case Constants.PINNED_TOP:
|
46248 | return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];
|
46249 | case Constants.PINNED_BOTTOM:
|
46250 | return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];
|
46251 | default:
|
46252 | return this.rowModel.getRow(gridRow.rowIndex);
|
46253 | }
|
46254 | };
|
46255 | __decorate$2c([
|
46256 | Autowired('focusService')
|
46257 | ], UndoRedoService.prototype, "focusService", void 0);
|
46258 | __decorate$2c([
|
46259 | Autowired('gridApi')
|
46260 | ], UndoRedoService.prototype, "gridApi", void 0);
|
46261 | __decorate$2c([
|
46262 | Autowired('rowModel')
|
46263 | ], UndoRedoService.prototype, "rowModel", void 0);
|
46264 | __decorate$2c([
|
46265 | Autowired('pinnedRowModel')
|
46266 | ], UndoRedoService.prototype, "pinnedRowModel", void 0);
|
46267 | __decorate$2c([
|
46268 | Autowired('cellPositionUtils')
|
46269 | ], UndoRedoService.prototype, "cellPositionUtils", void 0);
|
46270 | __decorate$2c([
|
46271 | Autowired('rowPositionUtils')
|
46272 | ], UndoRedoService.prototype, "rowPositionUtils", void 0);
|
46273 | __decorate$2c([
|
46274 | PostConstruct
|
46275 | ], UndoRedoService.prototype, "init", null);
|
46276 | UndoRedoService = __decorate$2c([
|
46277 | Bean('undoRedoService')
|
46278 | ], UndoRedoService);
|
46279 | return UndoRedoService;
|
46280 | }(BeanStub));
|
46281 |
|
46282 |
|
46283 |
|
46284 |
|
46285 |
|
46286 |
|
46287 |
|
46288 | var __extends$2z = (undefined && undefined.__extends) || (function () {
|
46289 | var extendStatics = function (d, b) {
|
46290 | extendStatics = Object.setPrototypeOf ||
|
46291 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
46292 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
46293 | return extendStatics(d, b);
|
46294 | };
|
46295 | return function (d, b) {
|
46296 | extendStatics(d, b);
|
46297 | function __() { this.constructor = d; }
|
46298 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
46299 | };
|
46300 | })();
|
46301 | var __decorate$2d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46302 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46303 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46304 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46305 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46306 | };
|
46307 | var HeaderPositionUtils = (function (_super) {
|
46308 | __extends$2z(HeaderPositionUtils, _super);
|
46309 | function HeaderPositionUtils() {
|
46310 | return _super !== null && _super.apply(this, arguments) || this;
|
46311 | }
|
46312 | HeaderPositionUtils.prototype.findHeader = function (focusedHeader, direction) {
|
46313 | var nextColumn;
|
46314 | var getGroupMethod;
|
46315 | var getColMethod;
|
46316 | if (focusedHeader.column instanceof ColumnGroup) {
|
46317 | getGroupMethod = "getDisplayedGroup" + direction;
|
46318 | nextColumn = this.columnModel[getGroupMethod](focusedHeader.column);
|
46319 | }
|
46320 | else {
|
46321 | getColMethod = "getDisplayedCol" + direction;
|
46322 | nextColumn = this.columnModel[getColMethod](focusedHeader.column);
|
46323 | }
|
46324 | if (nextColumn) {
|
46325 | return {
|
46326 | column: nextColumn,
|
46327 | headerRowIndex: focusedHeader.headerRowIndex
|
46328 | };
|
46329 | }
|
46330 | };
|
46331 | HeaderPositionUtils.prototype.findColAtEdgeForHeaderRow = function (level, position) {
|
46332 | var displayedColumns = this.columnModel.getAllDisplayedColumns();
|
46333 | var column = displayedColumns[position === 'start' ? 0 : displayedColumns.length - 1];
|
46334 | if (!column) {
|
46335 | return;
|
46336 | }
|
46337 | var childContainer = this.ctrlsService.getHeaderRowContainerCtrl(column.getPinned());
|
46338 | var type = childContainer.getRowType(level);
|
46339 | if (type == HeaderRowType.COLUMN_GROUP) {
|
46340 | var columnGroup = this.columnModel.getColumnGroupAtLevel(column, level);
|
46341 | return {
|
46342 | headerRowIndex: level,
|
46343 | column: columnGroup
|
46344 | };
|
46345 | }
|
46346 | return {
|
46347 |
|
46348 | headerRowIndex: type == null ? -1 : level,
|
46349 | column: column
|
46350 | };
|
46351 | };
|
46352 | __decorate$2d([
|
46353 | Autowired('columnModel')
|
46354 | ], HeaderPositionUtils.prototype, "columnModel", void 0);
|
46355 | __decorate$2d([
|
46356 | Autowired('ctrlsService')
|
46357 | ], HeaderPositionUtils.prototype, "ctrlsService", void 0);
|
46358 | HeaderPositionUtils = __decorate$2d([
|
46359 | Bean('headerPositionUtils')
|
46360 | ], HeaderPositionUtils);
|
46361 | return HeaderPositionUtils;
|
46362 | }(BeanStub));
|
46363 |
|
46364 |
|
46365 |
|
46366 |
|
46367 |
|
46368 |
|
46369 |
|
46370 | var __decorate$2e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46371 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46372 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46373 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46374 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46375 | };
|
46376 | var ColumnDefFactory = (function () {
|
46377 | function ColumnDefFactory() {
|
46378 | }
|
46379 | ColumnDefFactory.prototype.buildColumnDefs = function (cols, rowGroupColumns, pivotColumns) {
|
46380 | var _this = this;
|
46381 | var res = [];
|
46382 | var colGroupDefs = {};
|
46383 | cols.forEach(function (col) {
|
46384 | var colDef = _this.createDefFromColumn(col, rowGroupColumns, pivotColumns);
|
46385 | var addToResult = true;
|
46386 | var childDef = colDef;
|
46387 | var pointer = col.getOriginalParent();
|
46388 | while (pointer) {
|
46389 | var parentDef = null;
|
46390 |
|
46391 |
|
46392 |
|
46393 | if (pointer.isPadding()) {
|
46394 | pointer = pointer.getOriginalParent();
|
46395 | continue;
|
46396 | }
|
46397 |
|
46398 | var existingParentDef = colGroupDefs[pointer.getGroupId()];
|
46399 | if (existingParentDef) {
|
46400 | existingParentDef.children.push(childDef);
|
46401 |
|
46402 | addToResult = false;
|
46403 |
|
46404 |
|
46405 | break;
|
46406 | }
|
46407 | parentDef = _this.createDefFromGroup(pointer);
|
46408 | if (parentDef) {
|
46409 | parentDef.children = [childDef];
|
46410 | colGroupDefs[parentDef.groupId] = parentDef;
|
46411 | childDef = parentDef;
|
46412 | pointer = pointer.getOriginalParent();
|
46413 | }
|
46414 | }
|
46415 | if (addToResult) {
|
46416 | res.push(childDef);
|
46417 | }
|
46418 | });
|
46419 | return res;
|
46420 | };
|
46421 | ColumnDefFactory.prototype.createDefFromGroup = function (group) {
|
46422 | var defCloned = deepCloneDefinition(group.getColGroupDef(), ['children']);
|
46423 | if (defCloned) {
|
46424 | defCloned.groupId = group.getGroupId();
|
46425 | }
|
46426 | return defCloned;
|
46427 | };
|
46428 | ColumnDefFactory.prototype.createDefFromColumn = function (col, rowGroupColumns, pivotColumns) {
|
46429 | var colDefCloned = deepCloneDefinition(col.getColDef());
|
46430 | colDefCloned.colId = col.getColId();
|
46431 | colDefCloned.width = col.getActualWidth();
|
46432 | colDefCloned.rowGroup = col.isRowGroupActive();
|
46433 | colDefCloned.rowGroupIndex = col.isRowGroupActive() ? rowGroupColumns.indexOf(col) : null;
|
46434 | colDefCloned.pivot = col.isPivotActive();
|
46435 | colDefCloned.pivotIndex = col.isPivotActive() ? pivotColumns.indexOf(col) : null;
|
46436 | colDefCloned.aggFunc = col.isValueActive() ? col.getAggFunc() : null;
|
46437 | colDefCloned.hide = col.isVisible() ? undefined : true;
|
46438 | colDefCloned.pinned = col.isPinned() ? col.getPinned() : null;
|
46439 | colDefCloned.sort = col.getSort() ? col.getSort() : null;
|
46440 | colDefCloned.sortIndex = col.getSortIndex() != null ? col.getSortIndex() : null;
|
46441 | return colDefCloned;
|
46442 | };
|
46443 | ColumnDefFactory = __decorate$2e([
|
46444 | Bean('columnDefFactory')
|
46445 | ], ColumnDefFactory);
|
46446 | return ColumnDefFactory;
|
46447 | }());
|
46448 |
|
46449 |
|
46450 |
|
46451 |
|
46452 |
|
46453 |
|
46454 |
|
46455 | var __decorate$2f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46456 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46457 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46458 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46459 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46460 | };
|
46461 | var RowCssClassCalculator = (function () {
|
46462 | function RowCssClassCalculator() {
|
46463 | }
|
46464 | RowCssClassCalculator.prototype.getInitialRowClasses = function (params) {
|
46465 | var classes = [];
|
46466 | if (exists(params.extraCssClass)) {
|
46467 | classes.push(params.extraCssClass);
|
46468 | }
|
46469 | classes.push('ag-row');
|
46470 | classes.push(params.rowFocused ? 'ag-row-focus' : 'ag-row-no-focus');
|
46471 | if (params.fadeRowIn) {
|
46472 | classes.push('ag-opacity-zero');
|
46473 | }
|
46474 | classes.push(params.rowIsEven ? 'ag-row-even' : 'ag-row-odd');
|
46475 | if (params.rowNode.isRowPinned()) {
|
46476 | classes.push('ag-row-pinned');
|
46477 | }
|
46478 | if (params.rowNode.isSelected()) {
|
46479 | classes.push('ag-row-selected');
|
46480 | }
|
46481 | if (params.rowNode.footer) {
|
46482 | classes.push('ag-row-footer');
|
46483 | }
|
46484 | classes.push('ag-row-level-' + params.rowLevel);
|
46485 | if (params.rowNode.stub) {
|
46486 | classes.push('ag-row-loading');
|
46487 | }
|
46488 | if (params.fullWidthRow) {
|
46489 | classes.push('ag-full-width-row');
|
46490 | }
|
46491 | if (params.expandable) {
|
46492 | classes.push('ag-row-group');
|
46493 | classes.push(params.rowNode.expanded ? 'ag-row-group-expanded' : 'ag-row-group-contracted');
|
46494 | }
|
46495 | if (params.rowNode.dragging) {
|
46496 | classes.push('ag-row-dragging');
|
46497 | }
|
46498 | pushAll(classes, this.processClassesFromGridOptions(params.rowNode));
|
46499 | pushAll(classes, this.preProcessRowClassRules(params.rowNode));
|
46500 |
|
46501 | classes.push(params.printLayout ? 'ag-row-position-relative' : 'ag-row-position-absolute');
|
46502 | if (params.firstRowOnPage) {
|
46503 | classes.push('ag-row-first');
|
46504 | }
|
46505 | if (params.lastRowOnPage) {
|
46506 | classes.push('ag-row-last');
|
46507 | }
|
46508 | if (params.fullWidthRow) {
|
46509 | if (params.pinned === Constants.PINNED_LEFT) {
|
46510 | classes.push('ag-cell-last-left-pinned');
|
46511 | }
|
46512 | if (params.pinned === Constants.PINNED_RIGHT) {
|
46513 | classes.push('ag-cell-first-right-pinned');
|
46514 | }
|
46515 | }
|
46516 | return classes;
|
46517 | };
|
46518 | RowCssClassCalculator.prototype.processClassesFromGridOptions = function (rowNode) {
|
46519 | var res = [];
|
46520 | var process = function (rowCls) {
|
46521 | if (typeof rowCls === 'string') {
|
46522 | res.push(rowCls);
|
46523 | }
|
46524 | else if (Array.isArray(rowCls)) {
|
46525 | rowCls.forEach(function (e) { return res.push(e); });
|
46526 | }
|
46527 | };
|
46528 |
|
46529 | var rowClass = this.gridOptionsWrapper.getRowClass();
|
46530 | if (rowClass) {
|
46531 | if (typeof rowClass === 'function') {
|
46532 | console.warn('AG Grid: rowClass should not be a function, please use getRowClass instead');
|
46533 | return [];
|
46534 | }
|
46535 | process(rowClass);
|
46536 | }
|
46537 |
|
46538 | var rowClassFunc = this.gridOptionsWrapper.getRowClassFunc();
|
46539 | if (rowClassFunc) {
|
46540 | var params = {
|
46541 | data: rowNode.data,
|
46542 | node: rowNode,
|
46543 | rowIndex: rowNode.rowIndex
|
46544 | };
|
46545 | var rowClassFuncResult = rowClassFunc(params);
|
46546 | process(rowClassFuncResult);
|
46547 | }
|
46548 | return res;
|
46549 | };
|
46550 | RowCssClassCalculator.prototype.preProcessRowClassRules = function (rowNode) {
|
46551 | var res = [];
|
46552 | this.processRowClassRules(rowNode, function (className) {
|
46553 | res.push(className);
|
46554 | }, function (className) {
|
46555 |
|
46556 |
|
46557 | });
|
46558 | return res;
|
46559 | };
|
46560 | RowCssClassCalculator.prototype.processRowClassRules = function (rowNode, onApplicableClass, onNotApplicableClass) {
|
46561 | var rowClassParams = {
|
46562 | data: rowNode.data,
|
46563 | node: rowNode,
|
46564 | rowIndex: rowNode.rowIndex,
|
46565 | api: this.gridOptionsWrapper.getApi(),
|
46566 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
46567 | context: this.gridOptionsWrapper.getContext()
|
46568 | };
|
46569 | this.stylingService.processClassRules(this.gridOptionsWrapper.rowClassRules(), rowClassParams, onApplicableClass, onNotApplicableClass);
|
46570 | };
|
46571 | RowCssClassCalculator.prototype.calculateRowLevel = function (rowNode) {
|
46572 | if (rowNode.group) {
|
46573 | return rowNode.level;
|
46574 | }
|
46575 |
|
46576 | return rowNode.parent ? (rowNode.parent.level + 1) : 0;
|
46577 | };
|
46578 | __decorate$2f([
|
46579 | Autowired('stylingService')
|
46580 | ], RowCssClassCalculator.prototype, "stylingService", void 0);
|
46581 | __decorate$2f([
|
46582 | Autowired('gridOptionsWrapper')
|
46583 | ], RowCssClassCalculator.prototype, "gridOptionsWrapper", void 0);
|
46584 | RowCssClassCalculator = __decorate$2f([
|
46585 | Bean('rowCssClassCalculator')
|
46586 | ], RowCssClassCalculator);
|
46587 | return RowCssClassCalculator;
|
46588 | }());
|
46589 |
|
46590 |
|
46591 |
|
46592 |
|
46593 |
|
46594 |
|
46595 |
|
46596 | var __decorate$2g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46597 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46598 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46599 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46600 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46601 | };
|
46602 |
|
46603 | var RowNodeSorter = (function () {
|
46604 | function RowNodeSorter() {
|
46605 | }
|
46606 | RowNodeSorter.prototype.doFullSort = function (rowNodes, sortOptions) {
|
46607 | var mapper = function (rowNode, pos) { return ({ currentPos: pos, rowNode: rowNode }); };
|
46608 | var sortedRowNodes = rowNodes.map(mapper);
|
46609 | sortedRowNodes.sort(this.compareRowNodes.bind(this, sortOptions));
|
46610 | return sortedRowNodes.map(function (item) { return item.rowNode; });
|
46611 | };
|
46612 | RowNodeSorter.prototype.compareRowNodes = function (sortOptions, sortedNodeA, sortedNodeB) {
|
46613 | var nodeA = sortedNodeA.rowNode;
|
46614 | var nodeB = sortedNodeB.rowNode;
|
46615 |
|
46616 | for (var i = 0, len = sortOptions.length; i < len; i++) {
|
46617 | var sortOption = sortOptions[i];
|
46618 | var isInverted = sortOption.sort === Constants.SORT_DESC;
|
46619 | var valueA = this.getValue(nodeA, sortOption.column);
|
46620 | var valueB = this.getValue(nodeB, sortOption.column);
|
46621 | var comparatorResult = void 0;
|
46622 | var providedComparator = this.getComparator(sortOption, nodeA);
|
46623 | if (providedComparator) {
|
46624 |
|
46625 | comparatorResult = providedComparator(valueA, valueB, nodeA, nodeB, isInverted);
|
46626 | }
|
46627 | else {
|
46628 |
|
46629 | comparatorResult = _.defaultComparator(valueA, valueB, this.gridOptionsWrapper.isAccentedSort());
|
46630 | }
|
46631 |
|
46632 |
|
46633 | var validResult = !isNaN(comparatorResult);
|
46634 | if (validResult && comparatorResult !== 0) {
|
46635 | return sortOption.sort === Constants.SORT_ASC ? comparatorResult : comparatorResult * -1;
|
46636 | }
|
46637 | }
|
46638 |
|
46639 | return sortedNodeA.currentPos - sortedNodeB.currentPos;
|
46640 | };
|
46641 | RowNodeSorter.prototype.getComparator = function (sortOption, rowNode) {
|
46642 | var column = sortOption.column;
|
46643 |
|
46644 | var comparatorOnCol = column.getColDef().comparator;
|
46645 | if (comparatorOnCol != null) {
|
46646 | return comparatorOnCol;
|
46647 | }
|
46648 |
|
46649 | if (rowNode.rowGroupColumn) {
|
46650 | return rowNode.rowGroupColumn.getColDef().comparator;
|
46651 | }
|
46652 | if (!column.getColDef().showRowGroup) {
|
46653 | return;
|
46654 | }
|
46655 |
|
46656 | var groupLeafField = !rowNode.group && column.getColDef().field;
|
46657 | if (!groupLeafField) {
|
46658 | return;
|
46659 | }
|
46660 | var primaryColumn = this.columnModel.getPrimaryColumn(groupLeafField);
|
46661 | if (!primaryColumn) {
|
46662 | return;
|
46663 | }
|
46664 | return primaryColumn.getColDef().comparator;
|
46665 | };
|
46666 | RowNodeSorter.prototype.getValue = function (nodeA, column) {
|
46667 | return this.valueService.getValue(column, nodeA, false, false);
|
46668 | };
|
46669 | __decorate$2g([
|
46670 | Autowired('gridOptionsWrapper')
|
46671 | ], RowNodeSorter.prototype, "gridOptionsWrapper", void 0);
|
46672 | __decorate$2g([
|
46673 | Autowired('valueService')
|
46674 | ], RowNodeSorter.prototype, "valueService", void 0);
|
46675 | __decorate$2g([
|
46676 | Autowired('columnModel')
|
46677 | ], RowNodeSorter.prototype, "columnModel", void 0);
|
46678 | RowNodeSorter = __decorate$2g([
|
46679 | Bean('rowNodeSorter')
|
46680 | ], RowNodeSorter);
|
46681 | return RowNodeSorter;
|
46682 | }());
|
46683 |
|
46684 |
|
46685 |
|
46686 |
|
46687 |
|
46688 |
|
46689 |
|
46690 | var __extends$2A = (undefined && undefined.__extends) || (function () {
|
46691 | var extendStatics = function (d, b) {
|
46692 | extendStatics = Object.setPrototypeOf ||
|
46693 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
46694 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
46695 | return extendStatics(d, b);
|
46696 | };
|
46697 | return function (d, b) {
|
46698 | extendStatics(d, b);
|
46699 | function __() { this.constructor = d; }
|
46700 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
46701 | };
|
46702 | })();
|
46703 | var __decorate$2h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46704 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46705 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46706 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46707 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46708 | };
|
46709 | var CtrlsService = (function (_super) {
|
46710 | __extends$2A(CtrlsService, _super);
|
46711 | function CtrlsService() {
|
46712 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
46713 | _this.ready = false;
|
46714 | _this.readyCallbacks = [];
|
46715 | return _this;
|
46716 | }
|
46717 | CtrlsService_1 = CtrlsService;
|
46718 | CtrlsService.prototype.checkReady = function () {
|
46719 | this.ready =
|
46720 | this.gridCtrl != null
|
46721 | && this.gridBodyCtrl != null
|
46722 | && this.centerRowContainerCtrl != null
|
46723 | && this.leftRowContainerCtrl != null
|
46724 | && this.rightRowContainerCtrl != null
|
46725 | && this.bottomCenterRowContainerCtrl != null
|
46726 | && this.bottomLeftRowContainerCtrl != null
|
46727 | && this.bottomRightRowContainerCtrl != null
|
46728 | && this.topCenterRowContainerCtrl != null
|
46729 | && this.topLeftRowContainerCtrl != null
|
46730 | && this.topRightRowContainerCtrl != null
|
46731 | && this.centerHeaderRowContainerCtrl != null
|
46732 | && this.leftHeaderRowContainerCtrl != null
|
46733 | && this.rightHeaderRowContainerCtrl != null
|
46734 | && this.fakeHScrollCtrl != null
|
46735 | && this.gridHeaderCtrl != null;
|
46736 | if (this.ready) {
|
46737 | var p_1 = this.createReadyParams();
|
46738 | this.readyCallbacks.forEach(function (c) { return c(p_1); });
|
46739 | this.readyCallbacks.length = 0;
|
46740 | }
|
46741 | };
|
46742 | CtrlsService.prototype.whenReady = function (callback) {
|
46743 | if (this.ready) {
|
46744 | callback(this.createReadyParams());
|
46745 | }
|
46746 | else {
|
46747 | this.readyCallbacks.push(callback);
|
46748 | }
|
46749 | };
|
46750 | CtrlsService.prototype.createReadyParams = function () {
|
46751 | return {
|
46752 | centerRowContainerCtrl: this.centerRowContainerCtrl,
|
46753 | leftRowContainerCtrl: this.leftRowContainerCtrl,
|
46754 | rightRowContainerCtrl: this.rightRowContainerCtrl,
|
46755 | bottomCenterRowContainerCtrl: this.bottomCenterRowContainerCtrl,
|
46756 | bottomLeftRowContainerCtrl: this.bottomLeftRowContainerCtrl,
|
46757 | bottomRightRowContainerCtrl: this.bottomRightRowContainerCtrl,
|
46758 | topCenterRowContainerCtrl: this.topCenterRowContainerCtrl,
|
46759 | topLeftRowContainerCtrl: this.topLeftRowContainerCtrl,
|
46760 | topRightRowContainerCtrl: this.topRightRowContainerCtrl,
|
46761 | centerHeaderRowContainerCtrl: this.centerHeaderRowContainerCtrl,
|
46762 | leftHeaderRowContainerCtrl: this.leftHeaderRowContainerCtrl,
|
46763 | rightHeaderRowContainerCtrl: this.rightHeaderRowContainerCtrl,
|
46764 | fakeHScrollCtrl: this.fakeHScrollCtrl,
|
46765 | gridBodyCtrl: this.gridBodyCtrl,
|
46766 | gridCtrl: this.gridCtrl,
|
46767 | gridHeaderCtrl: this.gridHeaderCtrl,
|
46768 | };
|
46769 | };
|
46770 | CtrlsService.prototype.registerFakeHScrollCtrl = function (ctrl) {
|
46771 | this.fakeHScrollCtrl = ctrl;
|
46772 | this.checkReady();
|
46773 | };
|
46774 | CtrlsService.prototype.registerGridHeaderCtrl = function (gridHeaderCtrl) {
|
46775 | this.gridHeaderCtrl = gridHeaderCtrl;
|
46776 | this.checkReady();
|
46777 | };
|
46778 | CtrlsService.prototype.registerCenterRowContainerCtrl = function (ctrl) {
|
46779 | this.centerRowContainerCtrl = ctrl;
|
46780 | this.checkReady();
|
46781 | };
|
46782 | CtrlsService.prototype.registerLeftRowContainerCtrl = function (ctrl) {
|
46783 | this.leftRowContainerCtrl = ctrl;
|
46784 | this.checkReady();
|
46785 | };
|
46786 | CtrlsService.prototype.registerRightRowContainerCtrl = function (ctrl) {
|
46787 | this.rightRowContainerCtrl = ctrl;
|
46788 | this.checkReady();
|
46789 | };
|
46790 | CtrlsService.prototype.registerTopCenterRowContainerCtrl = function (ctrl) {
|
46791 | this.topCenterRowContainerCtrl = ctrl;
|
46792 | this.checkReady();
|
46793 | };
|
46794 | CtrlsService.prototype.registerTopLeftRowContainerCon = function (ctrl) {
|
46795 | this.topLeftRowContainerCtrl = ctrl;
|
46796 | this.checkReady();
|
46797 | };
|
46798 | CtrlsService.prototype.registerTopRightRowContainerCtrl = function (ctrl) {
|
46799 | this.topRightRowContainerCtrl = ctrl;
|
46800 | this.checkReady();
|
46801 | };
|
46802 | CtrlsService.prototype.registerBottomCenterRowContainerCtrl = function (ctrl) {
|
46803 | this.bottomCenterRowContainerCtrl = ctrl;
|
46804 | this.checkReady();
|
46805 | };
|
46806 | CtrlsService.prototype.registerBottomLeftRowContainerCtrl = function (ctrl) {
|
46807 | this.bottomLeftRowContainerCtrl = ctrl;
|
46808 | this.checkReady();
|
46809 | };
|
46810 | CtrlsService.prototype.registerBottomRightRowContainerCtrl = function (ctrl) {
|
46811 | this.bottomRightRowContainerCtrl = ctrl;
|
46812 | this.checkReady();
|
46813 | };
|
46814 | CtrlsService.prototype.registerHeaderContainer = function (ctrl, pinned) {
|
46815 | switch (pinned) {
|
46816 | case Constants.PINNED_LEFT:
|
46817 | this.leftHeaderRowContainerCtrl = ctrl;
|
46818 | break;
|
46819 | case Constants.PINNED_RIGHT:
|
46820 | this.rightHeaderRowContainerCtrl = ctrl;
|
46821 | break;
|
46822 | default:
|
46823 | this.centerHeaderRowContainerCtrl = ctrl;
|
46824 | break;
|
46825 | }
|
46826 | this.checkReady();
|
46827 | };
|
46828 | CtrlsService.prototype.registerGridBodyCtrl = function (ctrl) {
|
46829 | this.gridBodyCtrl = ctrl;
|
46830 | this.checkReady();
|
46831 | };
|
46832 | CtrlsService.prototype.registerGridCtrl = function (ctrl) {
|
46833 | this.gridCtrl = ctrl;
|
46834 | this.checkReady();
|
46835 | };
|
46836 | CtrlsService.prototype.getFakeHScrollCtrl = function () {
|
46837 | return this.fakeHScrollCtrl;
|
46838 | };
|
46839 | CtrlsService.prototype.getGridHeaderCtrl = function () {
|
46840 | return this.gridHeaderCtrl;
|
46841 | };
|
46842 | CtrlsService.prototype.getGridCtrl = function () {
|
46843 | return this.gridCtrl;
|
46844 | };
|
46845 | CtrlsService.prototype.getCenterRowContainerCtrl = function () {
|
46846 | return this.centerRowContainerCtrl;
|
46847 | };
|
46848 | CtrlsService.prototype.getTopCenterRowContainerCtrl = function () {
|
46849 | return this.topCenterRowContainerCtrl;
|
46850 | };
|
46851 | CtrlsService.prototype.getBottomCenterRowContainerCtrl = function () {
|
46852 | return this.bottomCenterRowContainerCtrl;
|
46853 | };
|
46854 | CtrlsService.prototype.getGridBodyCtrl = function () {
|
46855 | return this.gridBodyCtrl;
|
46856 | };
|
46857 | CtrlsService.prototype.getHeaderRowContainerCtrls = function () {
|
46858 | return [this.leftHeaderRowContainerCtrl, this.rightHeaderRowContainerCtrl, this.centerHeaderRowContainerCtrl];
|
46859 | };
|
46860 | CtrlsService.prototype.getHeaderRowContainerCtrl = function (pinned) {
|
46861 | switch (pinned) {
|
46862 | case Constants.PINNED_LEFT: return this.leftHeaderRowContainerCtrl;
|
46863 | case Constants.PINNED_RIGHT: return this.rightHeaderRowContainerCtrl;
|
46864 | default: return this.centerHeaderRowContainerCtrl;
|
46865 | }
|
46866 | };
|
46867 | var CtrlsService_1;
|
46868 | CtrlsService.NAME = 'ctrlsService';
|
46869 | CtrlsService = CtrlsService_1 = __decorate$2h([
|
46870 | Bean(CtrlsService_1.NAME)
|
46871 | ], CtrlsService);
|
46872 | return CtrlsService;
|
46873 | }(BeanStub));
|
46874 |
|
46875 |
|
46876 |
|
46877 |
|
46878 |
|
46879 |
|
46880 |
|
46881 | var __extends$2B = (undefined && undefined.__extends) || (function () {
|
46882 | var extendStatics = function (d, b) {
|
46883 | extendStatics = Object.setPrototypeOf ||
|
46884 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
46885 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
46886 | return extendStatics(d, b);
|
46887 | };
|
46888 | return function (d, b) {
|
46889 | extendStatics(d, b);
|
46890 | function __() { this.constructor = d; }
|
46891 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
46892 | };
|
46893 | })();
|
46894 | var __decorate$2i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46895 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46896 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46897 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46898 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46899 | };
|
46900 | var CtrlsFactory = (function (_super) {
|
46901 | __extends$2B(CtrlsFactory, _super);
|
46902 | function CtrlsFactory() {
|
46903 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
46904 | _this.registry = {};
|
46905 | return _this;
|
46906 | }
|
46907 | CtrlsFactory.prototype.register = function (meta) {
|
46908 | this.registry[meta.controllerName] = meta.controllerClass;
|
46909 | };
|
46910 | CtrlsFactory.prototype.getInstance = function (name) {
|
46911 | var ControllerClass = this.registry[name];
|
46912 | if (ControllerClass == null) {
|
46913 | return undefined;
|
46914 | }
|
46915 | return new ControllerClass();
|
46916 | };
|
46917 | CtrlsFactory = __decorate$2i([
|
46918 | Bean('ctrlsFactory')
|
46919 | ], CtrlsFactory);
|
46920 | return CtrlsFactory;
|
46921 | }(BeanStub));
|
46922 |
|
46923 |
|
46924 |
|
46925 |
|
46926 |
|
46927 |
|
46928 |
|
46929 | var __extends$2C = (undefined && undefined.__extends) || (function () {
|
46930 | var extendStatics = function (d, b) {
|
46931 | extendStatics = Object.setPrototypeOf ||
|
46932 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
46933 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
46934 | return extendStatics(d, b);
|
46935 | };
|
46936 | return function (d, b) {
|
46937 | extendStatics(d, b);
|
46938 | function __() { this.constructor = d; }
|
46939 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
46940 | };
|
46941 | })();
|
46942 | var __decorate$2j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46943 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46944 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46945 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46946 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46947 | };
|
46948 | var FakeHScrollCtrl = (function (_super) {
|
46949 | __extends$2C(FakeHScrollCtrl, _super);
|
46950 | function FakeHScrollCtrl() {
|
46951 | return _super.call(this) || this;
|
46952 | }
|
46953 | FakeHScrollCtrl.prototype.setComp = function (view, eGui, eViewport, eContainer) {
|
46954 | this.view = view;
|
46955 | this.eViewport = eViewport;
|
46956 | this.eContainer = eContainer;
|
46957 | this.eGui = eGui;
|
46958 | this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, this.onScrollVisibilityChanged.bind(this));
|
46959 | this.onScrollVisibilityChanged();
|
46960 |
|
46961 | var spacerWidthsListener = this.setFakeHScrollSpacerWidths.bind(this);
|
46962 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, spacerWidthsListener);
|
46963 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, spacerWidthsListener);
|
46964 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, spacerWidthsListener);
|
46965 | this.setFakeHScrollSpacerWidths();
|
46966 | if (this.invisibleScrollbar) {
|
46967 | this.hideAndShowInvisibleScrollAsNeeded();
|
46968 | this.addActiveListenerToggles();
|
46969 | }
|
46970 | this.ctrlsService.registerFakeHScrollCtrl(this);
|
46971 | };
|
46972 | FakeHScrollCtrl.prototype.addActiveListenerToggles = function () {
|
46973 | var _this = this;
|
46974 | var activateEvents = ['mouseenter', 'mousedown', 'touchstart'];
|
46975 | var deactivateEvents = ['mouseleave', 'mouseup', 'touchend'];
|
46976 | activateEvents.forEach(function (eventName) { return _this.addManagedListener(_this.eGui, eventName, function () { return _this.view.addOrRemoveCssClass('ag-scrollbar-active', true); }); });
|
46977 | deactivateEvents.forEach(function (eventName) { return _this.addManagedListener(_this.eGui, eventName, function () { return _this.view.addOrRemoveCssClass('ag-scrollbar-active', false); }); });
|
46978 | };
|
46979 | FakeHScrollCtrl.prototype.postConstruct = function () {
|
46980 | this.enableRtl = this.gridOptionsWrapper.isEnableRtl();
|
46981 | this.invisibleScrollbar = isInvisibleScrollbar();
|
46982 | };
|
46983 | FakeHScrollCtrl.prototype.onScrollVisibilityChanged = function () {
|
46984 | this.setScrollVisible();
|
46985 | this.setFakeHScrollSpacerWidths();
|
46986 | };
|
46987 | FakeHScrollCtrl.prototype.hideAndShowInvisibleScrollAsNeeded = function () {
|
46988 | var _this = this;
|
46989 | this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, function (params) {
|
46990 | if (params.direction === 'horizontal') {
|
46991 | _this.view.addOrRemoveCssClass('ag-scrollbar-scrolling', true);
|
46992 | }
|
46993 | });
|
46994 | this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL_END, function () { return _this.view.addOrRemoveCssClass('ag-scrollbar-scrolling', false); });
|
46995 | };
|
46996 | FakeHScrollCtrl.prototype.setFakeHScrollSpacerWidths = function () {
|
46997 | var vScrollShowing = this.scrollVisibleService.isVerticalScrollShowing();
|
46998 |
|
46999 |
|
47000 | var rightSpacing = this.columnModel.getDisplayedColumnsRightWidth();
|
47001 | var scrollOnRight = !this.enableRtl && vScrollShowing;
|
47002 | var scrollbarWidth = this.gridOptionsWrapper.getScrollbarWidth();
|
47003 | if (scrollOnRight) {
|
47004 | rightSpacing += scrollbarWidth;
|
47005 | }
|
47006 | this.view.setRightSpacerFixedWidth(rightSpacing);
|
47007 | this.view.includeRightSpacerScrollerCss('ag-scroller-corner', rightSpacing <= scrollbarWidth);
|
47008 |
|
47009 |
|
47010 | var leftSpacing = this.columnModel.getDisplayedColumnsLeftWidth();
|
47011 | var scrollOnLeft = this.enableRtl && vScrollShowing;
|
47012 | if (scrollOnLeft) {
|
47013 | leftSpacing += scrollbarWidth;
|
47014 | }
|
47015 | this.view.setLeftSpacerFixedWidth(leftSpacing);
|
47016 | this.view.includeLeftSpacerScrollerCss('ag-scroller-corner', leftSpacing <= scrollbarWidth);
|
47017 | };
|
47018 | FakeHScrollCtrl.prototype.setScrollVisible = function () {
|
47019 | var hScrollShowing = this.scrollVisibleService.isHorizontalScrollShowing();
|
47020 | var invisibleScrollbar = this.invisibleScrollbar;
|
47021 | var isSuppressHorizontalScroll = this.gridOptionsWrapper.isSuppressHorizontalScroll();
|
47022 | var scrollbarWidth = hScrollShowing ? (this.gridOptionsWrapper.getScrollbarWidth() || 0) : 0;
|
47023 | var adjustedScrollbarWidth = (scrollbarWidth === 0 && invisibleScrollbar) ? 15 : scrollbarWidth;
|
47024 | var scrollContainerSize = !isSuppressHorizontalScroll ? adjustedScrollbarWidth : 0;
|
47025 | this.view.addOrRemoveCssClass('ag-scrollbar-invisible', invisibleScrollbar);
|
47026 | this.view.setHeight(scrollContainerSize);
|
47027 | this.view.setViewportHeight(scrollContainerSize);
|
47028 | this.view.setContainerHeight(scrollContainerSize);
|
47029 | };
|
47030 | FakeHScrollCtrl.prototype.getViewport = function () {
|
47031 | return this.eViewport;
|
47032 | };
|
47033 | FakeHScrollCtrl.prototype.getContainer = function () {
|
47034 | return this.eContainer;
|
47035 | };
|
47036 | __decorate$2j([
|
47037 | Autowired('scrollVisibleService')
|
47038 | ], FakeHScrollCtrl.prototype, "scrollVisibleService", void 0);
|
47039 | __decorate$2j([
|
47040 | Autowired('columnModel')
|
47041 | ], FakeHScrollCtrl.prototype, "columnModel", void 0);
|
47042 | __decorate$2j([
|
47043 | Autowired('ctrlsService')
|
47044 | ], FakeHScrollCtrl.prototype, "ctrlsService", void 0);
|
47045 | __decorate$2j([
|
47046 | PostConstruct
|
47047 | ], FakeHScrollCtrl.prototype, "postConstruct", null);
|
47048 | return FakeHScrollCtrl;
|
47049 | }(BeanStub));
|
47050 |
|
47051 |
|
47052 |
|
47053 |
|
47054 |
|
47055 |
|
47056 |
|
47057 | var __extends$2D = (undefined && undefined.__extends) || (function () {
|
47058 | var extendStatics = function (d, b) {
|
47059 | extendStatics = Object.setPrototypeOf ||
|
47060 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
47061 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
47062 | return extendStatics(d, b);
|
47063 | };
|
47064 | return function (d, b) {
|
47065 | extendStatics(d, b);
|
47066 | function __() { this.constructor = d; }
|
47067 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
47068 | };
|
47069 | })();
|
47070 | var __decorate$2k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
47071 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
47072 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
47073 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
47074 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
47075 | };
|
47076 | var FakeHScrollComp = (function (_super) {
|
47077 | __extends$2D(FakeHScrollComp, _super);
|
47078 | function FakeHScrollComp() {
|
47079 | return _super.call(this, FakeHScrollComp.TEMPLATE) || this;
|
47080 | }
|
47081 | FakeHScrollComp.prototype.postConstruct = function () {
|
47082 | var _this = this;
|
47083 | var compProxy = {
|
47084 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
47085 | setHeight: function (height) { return setFixedHeight(_this.getGui(), height); },
|
47086 | setContainerHeight: function (height) { return setFixedHeight(_this.eContainer, height); },
|
47087 | setViewportHeight: function (height) { return setFixedHeight(_this.eViewport, height); },
|
47088 | setRightSpacerFixedWidth: function (width) { return setFixedWidth(_this.eRightSpacer, width); },
|
47089 | setLeftSpacerFixedWidth: function (width) { return setFixedWidth(_this.eLeftSpacer, width); },
|
47090 | includeLeftSpacerScrollerCss: function (cssClass, include) {
|
47091 | return _this.eLeftSpacer.classList.toggle(cssClass, include);
|
47092 | },
|
47093 | includeRightSpacerScrollerCss: function (cssClass, include) {
|
47094 | return _this.eRightSpacer.classList.toggle(cssClass, include);
|
47095 | },
|
47096 | };
|
47097 | var ctrl = this.createManagedBean(new FakeHScrollCtrl());
|
47098 | ctrl.setComp(compProxy, this.getGui(), this.eViewport, this.eContainer);
|
47099 | this.createManagedBean(new CenterWidthFeature(function (width) { return _this.eContainer.style.width = width + "px"; }));
|
47100 | };
|
47101 | 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>";
|
47102 | __decorate$2k([
|
47103 | RefSelector('eLeftSpacer')
|
47104 | ], FakeHScrollComp.prototype, "eLeftSpacer", void 0);
|
47105 | __decorate$2k([
|
47106 | RefSelector('eRightSpacer')
|
47107 | ], FakeHScrollComp.prototype, "eRightSpacer", void 0);
|
47108 | __decorate$2k([
|
47109 | RefSelector('eViewport')
|
47110 | ], FakeHScrollComp.prototype, "eViewport", void 0);
|
47111 | __decorate$2k([
|
47112 | RefSelector('eContainer')
|
47113 | ], FakeHScrollComp.prototype, "eContainer", void 0);
|
47114 | __decorate$2k([
|
47115 | PostConstruct
|
47116 | ], FakeHScrollComp.prototype, "postConstruct", null);
|
47117 | return FakeHScrollComp;
|
47118 | }(Component));
|
47119 |
|
47120 |
|
47121 |
|
47122 |
|
47123 |
|
47124 |
|
47125 |
|
47126 | var __extends$2E = (undefined && undefined.__extends) || (function () {
|
47127 | var extendStatics = function (d, b) {
|
47128 | extendStatics = Object.setPrototypeOf ||
|
47129 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
47130 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
47131 | return extendStatics(d, b);
|
47132 | };
|
47133 | return function (d, b) {
|
47134 | extendStatics(d, b);
|
47135 | function __() { this.constructor = d; }
|
47136 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
47137 | };
|
47138 | })();
|
47139 | var __decorate$2l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
47140 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
47141 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
47142 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
47143 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
47144 | };
|
47145 | var PinnedWidthService = (function (_super) {
|
47146 | __extends$2E(PinnedWidthService, _super);
|
47147 | function PinnedWidthService() {
|
47148 | return _super !== null && _super.apply(this, arguments) || this;
|
47149 | }
|
47150 | PinnedWidthService.prototype.postConstruct = function () {
|
47151 | var listener = this.checkContainerWidths.bind(this);
|
47152 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);
|
47153 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, listener);
|
47154 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, listener);
|
47155 | };
|
47156 | PinnedWidthService.prototype.checkContainerWidths = function () {
|
47157 | var printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
|
47158 | var newLeftWidth = printLayout ? 0 : this.columnModel.getDisplayedColumnsLeftWidth();
|
47159 | var newRightWidth = printLayout ? 0 : this.columnModel.getDisplayedColumnsRightWidth();
|
47160 | if (newLeftWidth != this.leftWidth) {
|
47161 | this.leftWidth = newLeftWidth;
|
47162 | this.eventService.dispatchEvent({ type: Events.EVENT_LEFT_PINNED_WIDTH_CHANGED });
|
47163 | }
|
47164 | if (newRightWidth != this.rightWidth) {
|
47165 | this.rightWidth = newRightWidth;
|
47166 | this.eventService.dispatchEvent({ type: Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED });
|
47167 | }
|
47168 | };
|
47169 | PinnedWidthService.prototype.getPinnedRightWidth = function () {
|
47170 | return this.rightWidth;
|
47171 | };
|
47172 | PinnedWidthService.prototype.getPinnedLeftWidth = function () {
|
47173 | return this.leftWidth;
|
47174 | };
|
47175 | __decorate$2l([
|
47176 | Autowired('columnModel')
|
47177 | ], PinnedWidthService.prototype, "columnModel", void 0);
|
47178 | __decorate$2l([
|
47179 | PostConstruct
|
47180 | ], PinnedWidthService.prototype, "postConstruct", null);
|
47181 | PinnedWidthService = __decorate$2l([
|
47182 | Bean('pinnedWidthService')
|
47183 | ], PinnedWidthService);
|
47184 | return PinnedWidthService;
|
47185 | }(BeanStub));
|
47186 |
|
47187 |
|
47188 |
|
47189 |
|
47190 |
|
47191 |
|
47192 |
|
47193 | var __extends$2F = (undefined && undefined.__extends) || (function () {
|
47194 | var extendStatics = function (d, b) {
|
47195 | extendStatics = Object.setPrototypeOf ||
|
47196 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
47197 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
47198 | return extendStatics(d, b);
|
47199 | };
|
47200 | return function (d, b) {
|
47201 | extendStatics(d, b);
|
47202 | function __() { this.constructor = d; }
|
47203 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
47204 | };
|
47205 | })();
|
47206 | var __decorate$2m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
47207 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
47208 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
47209 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
47210 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
47211 | };
|
47212 | var RowNodeEventThrottle = (function (_super) {
|
47213 | __extends$2F(RowNodeEventThrottle, _super);
|
47214 | function RowNodeEventThrottle() {
|
47215 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
47216 | _this.events = [];
|
47217 | return _this;
|
47218 | }
|
47219 | RowNodeEventThrottle.prototype.postConstruct = function () {
|
47220 | if (this.rowModel.getType() == Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
|
47221 | this.clientSideRowModel = this.rowModel;
|
47222 | }
|
47223 | };
|
47224 |
|
47225 |
|
47226 |
|
47227 |
|
47228 |
|
47229 |
|
47230 |
|
47231 |
|
47232 |
|
47233 |
|
47234 |
|
47235 | RowNodeEventThrottle.prototype.dispatchExpanded = function (event) {
|
47236 | var _this = this;
|
47237 |
|
47238 | if (this.clientSideRowModel == null) {
|
47239 | this.eventService.dispatchEvent(event);
|
47240 | return;
|
47241 | }
|
47242 | this.events.push(event);
|
47243 | var func = function () {
|
47244 | if (_this.clientSideRowModel) {
|
47245 | _this.clientSideRowModel.onRowGroupOpened();
|
47246 | }
|
47247 | _this.events.forEach(function (e) { return _this.eventService.dispatchEvent(e); });
|
47248 | _this.events = [];
|
47249 | };
|
47250 | if (this.dispatchExpandedDebounced == null) {
|
47251 | this.dispatchExpandedDebounced = this.animationFrameService.debounce(func);
|
47252 | }
|
47253 | this.dispatchExpandedDebounced();
|
47254 | };
|
47255 | __decorate$2m([
|
47256 | Autowired('animationFrameService')
|
47257 | ], RowNodeEventThrottle.prototype, "animationFrameService", void 0);
|
47258 | __decorate$2m([
|
47259 | Autowired('rowModel')
|
47260 | ], RowNodeEventThrottle.prototype, "rowModel", void 0);
|
47261 | __decorate$2m([
|
47262 | PostConstruct
|
47263 | ], RowNodeEventThrottle.prototype, "postConstruct", null);
|
47264 | RowNodeEventThrottle = __decorate$2m([
|
47265 | Bean('rowNodeEventThrottle')
|
47266 | ], RowNodeEventThrottle);
|
47267 | return RowNodeEventThrottle;
|
47268 | }(BeanStub));
|
47269 |
|
47270 |
|
47271 |
|
47272 |
|
47273 |
|
47274 |
|
47275 |
|
47276 | var __read$h = (undefined && undefined.__read) || function (o, n) {
|
47277 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
47278 | if (!m) return o;
|
47279 | var i = m.call(o), r, ar = [], e;
|
47280 | try {
|
47281 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
47282 | }
|
47283 | catch (error) { e = { error: error }; }
|
47284 | finally {
|
47285 | try {
|
47286 | if (r && !r.done && (m = i["return"])) m.call(i);
|
47287 | }
|
47288 | finally { if (e) throw e.error; }
|
47289 | }
|
47290 | return ar;
|
47291 | };
|
47292 | var __spread$d = (undefined && undefined.__spread) || function () {
|
47293 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$h(arguments[i]));
|
47294 | return ar;
|
47295 | };
|
47296 |
|
47297 |
|
47298 | var Grid = (function () {
|
47299 | function Grid(eGridDiv, gridOptions, params) {
|
47300 | if (!gridOptions) {
|
47301 | console.error('AG Grid: no gridOptions provided to the grid');
|
47302 | return;
|
47303 | }
|
47304 | this.gridOptions = gridOptions;
|
47305 | new GridCoreCreator().create(eGridDiv, gridOptions, function (context) {
|
47306 | var gridComp = new GridComp(eGridDiv);
|
47307 | context.createBean(gridComp);
|
47308 | }, undefined, params);
|
47309 | }
|
47310 | Grid.prototype.destroy = function () {
|
47311 | if (this.gridOptions && this.gridOptions.api) {
|
47312 | this.gridOptions.api.destroy();
|
47313 | }
|
47314 | };
|
47315 | return Grid;
|
47316 | }());
|
47317 |
|
47318 |
|
47319 | var GridCoreCreator = (function () {
|
47320 | function GridCoreCreator() {
|
47321 | }
|
47322 | GridCoreCreator.prototype.create = function (eGridDiv, gridOptions, createUi, acceptChanges, params) {
|
47323 | var _this = this;
|
47324 | var debug = !!gridOptions.debug;
|
47325 | var registeredModules = this.getRegisteredModules(params);
|
47326 | var beanClasses = this.createBeansList(gridOptions.rowModelType, registeredModules);
|
47327 | var providedBeanInstances = this.createProvidedBeans(eGridDiv, gridOptions, params);
|
47328 | if (!beanClasses) {
|
47329 | return;
|
47330 | }
|
47331 | var contextParams = {
|
47332 | providedBeanInstances: providedBeanInstances,
|
47333 | beanClasses: beanClasses,
|
47334 | debug: debug
|
47335 | };
|
47336 | var logger = new Logger('AG Grid', function () { return gridOptions.debug; });
|
47337 | var contextLogger = new Logger('Context', function () { return contextParams.debug; });
|
47338 | var context = new Context(contextParams, contextLogger);
|
47339 | var beans = context.getBean('beans');
|
47340 | this.registerModuleUserComponents(beans, registeredModules);
|
47341 | this.registerStackComponents(beans, registeredModules);
|
47342 | this.registerControllers(beans, registeredModules);
|
47343 | createUi(context);
|
47344 |
|
47345 | beans.ctrlsService.whenReady(function () {
|
47346 | _this.setColumnsAndData(beans);
|
47347 | _this.dispatchGridReadyEvent(beans, gridOptions);
|
47348 | var isEnterprise = ModuleRegistry.isRegistered(ModuleNames.EnterpriseCoreModule);
|
47349 | logger.log("initialised successfully, enterprise = " + isEnterprise);
|
47350 | });
|
47351 | if (acceptChanges) {
|
47352 | acceptChanges(context);
|
47353 | }
|
47354 | };
|
47355 | GridCoreCreator.prototype.registerControllers = function (beans, registeredModules) {
|
47356 | registeredModules.forEach(function (module) {
|
47357 | if (module.controllers) {
|
47358 | module.controllers.forEach(function (meta) { return beans.ctrlsFactory.register(meta); });
|
47359 | }
|
47360 | });
|
47361 | };
|
47362 | GridCoreCreator.prototype.registerStackComponents = function (beans, registeredModules) {
|
47363 | var agStackComponents = this.createAgStackComponentsList(registeredModules);
|
47364 | beans.agStackComponentsRegistry.setupComponents(agStackComponents);
|
47365 | };
|
47366 | GridCoreCreator.prototype.getRegisteredModules = function (params) {
|
47367 | var passedViaConstructor = params ? params.modules : null;
|
47368 | var registered = ModuleRegistry.getRegisteredModules();
|
47369 | var allModules = [];
|
47370 | var mapNames = {};
|
47371 |
|
47372 | function addModule(moduleBased, mod) {
|
47373 | function addIndividualModule(currentModule) {
|
47374 | if (!mapNames[currentModule.moduleName]) {
|
47375 | mapNames[currentModule.moduleName] = true;
|
47376 | allModules.push(currentModule);
|
47377 | ModuleRegistry.register(currentModule, moduleBased);
|
47378 | }
|
47379 | }
|
47380 | addIndividualModule(mod);
|
47381 | if (mod.dependantModules) {
|
47382 | mod.dependantModules.forEach(addModule.bind(null, moduleBased));
|
47383 | }
|
47384 | }
|
47385 | if (passedViaConstructor) {
|
47386 | passedViaConstructor.forEach(addModule.bind(null, true));
|
47387 | }
|
47388 | if (registered) {
|
47389 | registered.forEach(addModule.bind(null, !ModuleRegistry.isPackageBased()));
|
47390 | }
|
47391 | return allModules;
|
47392 | };
|
47393 | GridCoreCreator.prototype.registerModuleUserComponents = function (beans, registeredModules) {
|
47394 | var moduleUserComps = this.extractModuleEntity(registeredModules, function (module) { return module.userComponents ? module.userComponents : []; });
|
47395 | moduleUserComps.forEach(function (compMeta) {
|
47396 | beans.userComponentRegistry.registerDefaultComponent(compMeta.componentName, compMeta.componentClass);
|
47397 | });
|
47398 | };
|
47399 | GridCoreCreator.prototype.createProvidedBeans = function (eGridDiv, gridOptions, params) {
|
47400 | var frameworkOverrides = params ? params.frameworkOverrides : null;
|
47401 | if (missing(frameworkOverrides)) {
|
47402 | frameworkOverrides = new VanillaFrameworkOverrides();
|
47403 | }
|
47404 | var seed = {
|
47405 | gridOptions: gridOptions,
|
47406 | eGridDiv: eGridDiv,
|
47407 | globalEventListener: params ? params.globalEventListener : null,
|
47408 | frameworkOverrides: frameworkOverrides
|
47409 | };
|
47410 | if (params && params.providedBeanInstances) {
|
47411 | Object.assign(seed, params.providedBeanInstances);
|
47412 | }
|
47413 | return seed;
|
47414 | };
|
47415 | GridCoreCreator.prototype.createAgStackComponentsList = function (registeredModules) {
|
47416 | var components = [
|
47417 | { componentName: 'AgCheckbox', componentClass: AgCheckbox },
|
47418 | { componentName: 'AgRadioButton', componentClass: AgRadioButton },
|
47419 | { componentName: 'AgToggleButton', componentClass: AgToggleButton },
|
47420 | { componentName: 'AgInputTextField', componentClass: AgInputTextField },
|
47421 | { componentName: 'AgInputTextArea', componentClass: AgInputTextArea },
|
47422 | { componentName: 'AgInputNumberField', componentClass: AgInputNumberField },
|
47423 | { componentName: 'AgInputRange', componentClass: AgInputRange },
|
47424 | { componentName: 'AgSelect', componentClass: AgSelect },
|
47425 | { componentName: 'AgSlider', componentClass: AgSlider },
|
47426 | { componentName: 'AgAngleSelect', componentClass: AgAngleSelect },
|
47427 | { componentName: 'AgColorPicker', componentClass: AgColorPicker },
|
47428 | { componentName: 'AgGridBody', componentClass: GridBodyComp },
|
47429 | { componentName: 'AgHeaderRoot', componentClass: GridHeaderComp },
|
47430 | { componentName: 'AgPagination', componentClass: PaginationComp },
|
47431 | { componentName: 'AgOverlayWrapper', componentClass: OverlayWrapperComponent },
|
47432 | { componentName: 'AgGroupComponent', componentClass: AgGroupComponent },
|
47433 | { componentName: 'AgPanel', componentClass: AgPanel },
|
47434 | { componentName: 'AgDialog', componentClass: AgDialog },
|
47435 | { componentName: 'AgRowContainer', componentClass: RowContainerComp },
|
47436 | { componentName: 'AgFakeHorizontalScroll', componentClass: FakeHScrollComp }
|
47437 | ];
|
47438 | var moduleAgStackComps = this.extractModuleEntity(registeredModules, function (module) { return module.agStackComponents ? module.agStackComponents : []; });
|
47439 | components = components.concat(moduleAgStackComps);
|
47440 | return components;
|
47441 | };
|
47442 | GridCoreCreator.prototype.createBeansList = function (rowModelType, registeredModules) {
|
47443 | var rowModelClass = this.getRowModelClass(rowModelType, registeredModules);
|
47444 | if (!rowModelClass) {
|
47445 | return;
|
47446 | }
|
47447 |
|
47448 | var beans = [
|
47449 | rowModelClass, Beans, RowPositionUtils, CellPositionUtils, HeaderPositionUtils,
|
47450 | PaginationAutoPageSizeService, GridApi, UserComponentRegistry, AgComponentUtils,
|
47451 | ComponentMetadataProvider, ResizeObserverService, UserComponentFactory,
|
47452 | RowContainerHeightService, HorizontalResizeService,
|
47453 | PinnedRowModel, DragService, DisplayedGroupCreator, EventService, GridOptionsWrapper,
|
47454 | PopupService, SelectionService, FilterManager, ColumnModel, HeaderNavigationService,
|
47455 | PaginationProxy, RowRenderer, ExpressionService, ColumnFactory, TemplateService,
|
47456 | AlignedGridsService, NavigationService, ValueCache, ValueService, LoggerFactory,
|
47457 | ColumnUtils, AutoWidthCalculator, StandardMenuFactory, DragAndDropService, ColumnApi,
|
47458 | FocusService, MouseEventService, Environment, CellNavigationService, ValueFormatterService,
|
47459 | StylingService, ScrollVisibleService, SortController, ColumnHoverService, ColumnAnimationService,
|
47460 | SelectableService, AutoGroupColService, ChangeDetectionService, AnimationFrameService,
|
47461 | UndoRedoService, AgStackComponentsRegistry, ColumnDefFactory,
|
47462 | RowCssClassCalculator, RowNodeBlockLoader, RowNodeSorter, CtrlsService,
|
47463 | PinnedWidthService, RowNodeEventThrottle, CtrlsFactory
|
47464 | ];
|
47465 | var moduleBeans = this.extractModuleEntity(registeredModules, function (module) { return module.beans ? module.beans : []; });
|
47466 | beans.push.apply(beans, __spread$d(moduleBeans));
|
47467 |
|
47468 |
|
47469 | var beansNoDuplicates = [];
|
47470 | beans.forEach(function (bean) {
|
47471 | if (beansNoDuplicates.indexOf(bean) < 0) {
|
47472 | beansNoDuplicates.push(bean);
|
47473 | }
|
47474 | });
|
47475 | return beansNoDuplicates;
|
47476 | };
|
47477 | GridCoreCreator.prototype.extractModuleEntity = function (moduleEntities, extractor) {
|
47478 | return [].concat.apply([], __spread$d(moduleEntities.map(extractor)));
|
47479 | };
|
47480 | GridCoreCreator.prototype.setColumnsAndData = function (beans) {
|
47481 | var columnDefs = beans.gridOptionsWrapper.getColumnDefs();
|
47482 | beans.columnModel.setColumnDefs(columnDefs || [], "gridInitializing");
|
47483 | beans.rowModel.start();
|
47484 | };
|
47485 | GridCoreCreator.prototype.dispatchGridReadyEvent = function (beans, gridOptions) {
|
47486 | var readyEvent = {
|
47487 | type: Events.EVENT_GRID_READY,
|
47488 | api: gridOptions.api,
|
47489 | columnApi: gridOptions.columnApi
|
47490 | };
|
47491 | beans.eventService.dispatchEvent(readyEvent);
|
47492 | };
|
47493 | GridCoreCreator.prototype.getRowModelClass = function (rowModelType, registeredModules) {
|
47494 |
|
47495 | if (!rowModelType) {
|
47496 | rowModelType = Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
|
47497 | }
|
47498 | var rowModelClasses = {};
|
47499 | registeredModules.forEach(function (module) {
|
47500 | iterateObject(module.rowModels, function (key, value) {
|
47501 | rowModelClasses[key] = value;
|
47502 | });
|
47503 | });
|
47504 | var rowModelClass = rowModelClasses[rowModelType];
|
47505 | if (exists(rowModelClass)) {
|
47506 | return rowModelClass;
|
47507 | }
|
47508 | if (ModuleRegistry.isPackageBased()) {
|
47509 | if ([Constants.ROW_MODEL_TYPE_VIEWPORT, Constants.ROW_MODEL_TYPE_SERVER_SIDE].includes(rowModelType))
|
47510 |
|
47511 | 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/");
|
47512 | else {
|
47513 | console.error('AG Grid: could not find row model for rowModelType ' + rowModelType);
|
47514 | }
|
47515 | }
|
47516 | else {
|
47517 | if (rowModelType === Constants.ROW_MODEL_TYPE_INFINITE) {
|
47518 | console.error("AG Grid: Row Model \"Infinite\" not found. Please ensure the " + ModuleNames.InfiniteRowModelModule + " module is registered. Please see: https://www.ag-grid.com/javascript-grid/modules/");
|
47519 | }
|
47520 | else if (rowModelType === Constants.ROW_MODEL_TYPE_VIEWPORT) {
|
47521 | console.error("AG Grid: Row Model \"Viewport\" not found. Please ensure the AG Grid Enterprise Module " + ModuleNames.ViewportRowModelModule + " module is registered. Please see: https://www.ag-grid.com/javascript-grid/modules/");
|
47522 | }
|
47523 | else if (rowModelType === Constants.ROW_MODEL_TYPE_SERVER_SIDE) {
|
47524 | console.error("AG Grid: Row Model \"Server Side\" not found. Please ensure the AG Grid Enterprise Module " + ModuleNames.ServerSideRowModelModule + " module is registered. Please see: https://www.ag-grid.com/javascript-grid/modules/");
|
47525 | }
|
47526 | else if (rowModelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
|
47527 | console.error("AG Grid: Row Model \"Client Side\" not found. Please ensure the " + ModuleNames.ClientSideRowModelModule + " module is registered. Please see: https://www.ag-grid.com/javascript-grid/modules/");
|
47528 | }
|
47529 | else {
|
47530 | console.error('AG Grid: could not find row model for rowModelType ' + rowModelType);
|
47531 | }
|
47532 | }
|
47533 | };
|
47534 | return GridCoreCreator;
|
47535 | }());
|
47536 |
|
47537 |
|
47538 |
|
47539 |
|
47540 |
|
47541 |
|
47542 |
|
47543 | function defaultGroupComparator(valueA, valueB, nodeA, nodeB, accentedCompare) {
|
47544 | if (accentedCompare === void 0) { accentedCompare = false; }
|
47545 | console.warn('AG Grid: Since ag-grid 11.0.0 defaultGroupComparator is not necessary. You can remove this from your colDef');
|
47546 | var nodeAIsGroup = exists(nodeA) && nodeA.group;
|
47547 | var nodeBIsGroup = exists(nodeB) && nodeB.group;
|
47548 | var bothAreGroups = nodeAIsGroup && nodeBIsGroup;
|
47549 | var bothAreNormal = !nodeAIsGroup && !nodeBIsGroup;
|
47550 | if (bothAreGroups) {
|
47551 | return defaultComparator(nodeA.key, nodeB.key, accentedCompare);
|
47552 | }
|
47553 | if (bothAreNormal) {
|
47554 | return defaultComparator(valueA, valueB, accentedCompare);
|
47555 | }
|
47556 | if (nodeAIsGroup) {
|
47557 | return 1;
|
47558 | }
|
47559 | return -1;
|
47560 | }
|
47561 |
|
47562 |
|
47563 |
|
47564 |
|
47565 |
|
47566 |
|
47567 |
|
47568 | var BaseComponentWrapper = (function () {
|
47569 | function BaseComponentWrapper() {
|
47570 | }
|
47571 | BaseComponentWrapper.prototype.wrap = function (OriginalConstructor, mandatoryMethodList, optionalMethodList, componentType) {
|
47572 | var _this = this;
|
47573 | if (optionalMethodList === void 0) { optionalMethodList = []; }
|
47574 | var wrapper = this.createWrapper(OriginalConstructor, componentType);
|
47575 | mandatoryMethodList.forEach((function (methodName) {
|
47576 | _this.createMethod(wrapper, methodName, true);
|
47577 | }));
|
47578 | optionalMethodList.forEach((function (methodName) {
|
47579 | _this.createMethod(wrapper, methodName, false);
|
47580 | }));
|
47581 | return wrapper;
|
47582 | };
|
47583 | BaseComponentWrapper.prototype.unwrap = function (comp) {
|
47584 | return comp;
|
47585 | };
|
47586 | BaseComponentWrapper.prototype.createMethod = function (wrapper, methodName, mandatory) {
|
47587 | wrapper.addMethod(methodName, this.createMethodProxy(wrapper, methodName, mandatory));
|
47588 | };
|
47589 | BaseComponentWrapper.prototype.createMethodProxy = function (wrapper, methodName, mandatory) {
|
47590 | return function () {
|
47591 | if (wrapper.hasMethod(methodName)) {
|
47592 | return wrapper.callMethod(methodName, arguments);
|
47593 | }
|
47594 | if (mandatory) {
|
47595 | console.warn('AG Grid: Framework component is missing the method ' + methodName + '()');
|
47596 | }
|
47597 | return null;
|
47598 | };
|
47599 | };
|
47600 | return BaseComponentWrapper;
|
47601 | }());
|
47602 |
|
47603 |
|
47604 |
|
47605 |
|
47606 |
|
47607 |
|
47608 |
|
47609 | var BarColumnLabelPlacement;
|
47610 | (function (BarColumnLabelPlacement) {
|
47611 | BarColumnLabelPlacement["InsideBase"] = "insideBase";
|
47612 | BarColumnLabelPlacement["InsideEnd"] = "insideEnd";
|
47613 | BarColumnLabelPlacement["Center"] = "center";
|
47614 | BarColumnLabelPlacement["OutsideEnd"] = "outsideEnd";
|
47615 | })(BarColumnLabelPlacement || (BarColumnLabelPlacement = {}));
|
47616 |
|
47617 |
|
47618 |
|
47619 |
|
47620 |
|
47621 |
|
47622 |
|
47623 | var globalObj = typeof global === 'undefined' ? {} : global;
|
47624 | globalObj.HTMLElement = typeof HTMLElement === 'undefined' ? {} : HTMLElement;
|
47625 | globalObj.HTMLButtonElement = typeof HTMLButtonElement === 'undefined' ? {} : HTMLButtonElement;
|
47626 | globalObj.HTMLSelectElement = typeof HTMLSelectElement === 'undefined' ? {} : HTMLSelectElement;
|
47627 | globalObj.HTMLInputElement = typeof HTMLInputElement === 'undefined' ? {} : HTMLInputElement;
|
47628 | globalObj.Node = typeof Node === 'undefined' ? {} : Node;
|
47629 | globalObj.MouseEvent = typeof MouseEvent === 'undefined' ? {} : MouseEvent;
|
47630 |
|
47631 | var __read$i = (undefined && undefined.__read) || function (o, n) {
|
47632 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
47633 | if (!m) return o;
|
47634 | var i = m.call(o), r, ar = [], e;
|
47635 | try {
|
47636 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
47637 | }
|
47638 | catch (error) { e = { error: error }; }
|
47639 | finally {
|
47640 | try {
|
47641 | if (r && !r.done && (m = i["return"])) m.call(i);
|
47642 | }
|
47643 | finally { if (e) throw e.error; }
|
47644 | }
|
47645 | return ar;
|
47646 | };
|
47647 | var __spread$e = (undefined && undefined.__spread) || function () {
|
47648 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$i(arguments[i]));
|
47649 | return ar;
|
47650 | };
|
47651 | var ClientSideNodeManager = (function () {
|
47652 | function ClientSideNodeManager(rootNode, gridOptionsWrapper, eventService, columnModel, gridApi, columnApi, selectionService, beans) {
|
47653 | this.nextId = 0;
|
47654 |
|
47655 | this.allNodesMap = {};
|
47656 | this.rootNode = rootNode;
|
47657 | this.gridOptionsWrapper = gridOptionsWrapper;
|
47658 | this.eventService = eventService;
|
47659 | this.columnModel = columnModel;
|
47660 | this.gridApi = gridApi;
|
47661 | this.columnApi = columnApi;
|
47662 | this.beans = beans;
|
47663 | this.selectionService = selectionService;
|
47664 | this.rootNode.group = true;
|
47665 | this.rootNode.level = -1;
|
47666 | this.rootNode.id = ClientSideNodeManager.ROOT_NODE_ID;
|
47667 | this.rootNode.allLeafChildren = [];
|
47668 | this.rootNode.childrenAfterGroup = [];
|
47669 | this.rootNode.childrenAfterSort = [];
|
47670 | this.rootNode.childrenAfterAggFilter = [];
|
47671 | this.rootNode.childrenAfterFilter = [];
|
47672 |
|
47673 | this.postConstruct();
|
47674 | }
|
47675 |
|
47676 | ClientSideNodeManager.prototype.postConstruct = function () {
|
47677 |
|
47678 | this.suppressParentsInRowNodes = this.gridOptionsWrapper.isSuppressParentsInRowNodes();
|
47679 | this.isRowMasterFunc = this.gridOptionsWrapper.getIsRowMasterFunc();
|
47680 | this.doingTreeData = this.gridOptionsWrapper.isTreeData();
|
47681 | this.doingMasterDetail = this.gridOptionsWrapper.isMasterDetail();
|
47682 | };
|
47683 | ClientSideNodeManager.prototype.getCopyOfNodesMap = function () {
|
47684 | return _.cloneObject(this.allNodesMap);
|
47685 | };
|
47686 | ClientSideNodeManager.prototype.getRowNode = function (id) {
|
47687 | return this.allNodesMap[id];
|
47688 | };
|
47689 | ClientSideNodeManager.prototype.setRowData = function (rowData) {
|
47690 | var _this = this;
|
47691 | if (typeof rowData === 'string') {
|
47692 | 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');
|
47693 | return;
|
47694 | }
|
47695 | var rootNode = this.rootNode;
|
47696 | var sibling = this.rootNode.sibling;
|
47697 | rootNode.childrenAfterFilter = null;
|
47698 | rootNode.childrenAfterGroup = null;
|
47699 | rootNode.childrenAfterAggFilter = null;
|
47700 | rootNode.childrenAfterSort = null;
|
47701 | rootNode.childrenMapped = null;
|
47702 | rootNode.updateHasChildren();
|
47703 | this.nextId = 0;
|
47704 | this.allNodesMap = {};
|
47705 | if (rowData) {
|
47706 |
|
47707 |
|
47708 |
|
47709 | rootNode.allLeafChildren = rowData.map(function (dataItem) { return _this.createNode(dataItem, _this.rootNode, ClientSideNodeManager.TOP_LEVEL); });
|
47710 | }
|
47711 | else {
|
47712 | rootNode.allLeafChildren = [];
|
47713 | rootNode.childrenAfterGroup = [];
|
47714 | }
|
47715 | if (sibling) {
|
47716 | sibling.childrenAfterFilter = rootNode.childrenAfterFilter;
|
47717 | sibling.childrenAfterGroup = rootNode.childrenAfterGroup;
|
47718 | sibling.childrenAfterAggFilter = rootNode.childrenAfterAggFilter;
|
47719 | sibling.childrenAfterSort = rootNode.childrenAfterSort;
|
47720 | sibling.childrenMapped = rootNode.childrenMapped;
|
47721 | sibling.allLeafChildren = rootNode.allLeafChildren;
|
47722 | }
|
47723 | };
|
47724 | ClientSideNodeManager.prototype.updateRowData = function (rowDataTran, rowNodeOrder) {
|
47725 | var rowNodeTransaction = {
|
47726 | remove: [],
|
47727 | update: [],
|
47728 | add: []
|
47729 | };
|
47730 | var nodesToUnselect = [];
|
47731 | this.executeRemove(rowDataTran, rowNodeTransaction, nodesToUnselect);
|
47732 | this.executeUpdate(rowDataTran, rowNodeTransaction, nodesToUnselect);
|
47733 | this.executeAdd(rowDataTran, rowNodeTransaction);
|
47734 | this.updateSelection(nodesToUnselect);
|
47735 | if (rowNodeOrder) {
|
47736 | _.sortRowNodesByOrder(this.rootNode.allLeafChildren, rowNodeOrder);
|
47737 | }
|
47738 | return rowNodeTransaction;
|
47739 | };
|
47740 | ClientSideNodeManager.prototype.updateSelection = function (nodesToUnselect) {
|
47741 | var selectionChanged = nodesToUnselect.length > 0;
|
47742 | if (selectionChanged) {
|
47743 | nodesToUnselect.forEach(function (rowNode) {
|
47744 | rowNode.setSelected(false, false, true);
|
47745 | });
|
47746 | }
|
47747 |
|
47748 |
|
47749 |
|
47750 |
|
47751 | this.selectionService.updateGroupsFromChildrenSelections();
|
47752 | if (selectionChanged) {
|
47753 | var event_1 = {
|
47754 | type: Events.EVENT_SELECTION_CHANGED,
|
47755 | api: this.gridApi,
|
47756 | columnApi: this.columnApi
|
47757 | };
|
47758 | this.eventService.dispatchEvent(event_1);
|
47759 | }
|
47760 | };
|
47761 | ClientSideNodeManager.prototype.executeAdd = function (rowDataTran, rowNodeTransaction) {
|
47762 | var _this = this;
|
47763 | var add = rowDataTran.add, addIndex = rowDataTran.addIndex;
|
47764 | if (_.missingOrEmpty(add)) {
|
47765 | return;
|
47766 | }
|
47767 |
|
47768 | var newNodes = add.map(function (item) { return _this.createNode(item, _this.rootNode, ClientSideNodeManager.TOP_LEVEL); });
|
47769 |
|
47770 | var useIndex = typeof addIndex === 'number' && addIndex >= 0;
|
47771 | var nodesBeforeIndex;
|
47772 | var nodesAfterIndex;
|
47773 | if (useIndex) {
|
47774 |
|
47775 |
|
47776 |
|
47777 |
|
47778 | var allLeafChildren_1 = this.rootNode.allLeafChildren;
|
47779 |
|
47780 |
|
47781 | var normalizedAddIndex = addIndex === 0 ? 0 : (allLeafChildren_1.reduce(function (prevIdx, currNode, currIdx) {
|
47782 | var _a;
|
47783 | var rowIndex = currNode.rowIndex;
|
47784 | var prevValueAtIndex = (_a = allLeafChildren_1[prevIdx]) === null || _a === void 0 ? void 0 : _a.rowIndex;
|
47785 | var shouldUpdateIndex = rowIndex != null && prevValueAtIndex != null && rowIndex < addIndex && rowIndex > prevValueAtIndex;
|
47786 | return shouldUpdateIndex ? currIdx : prevIdx;
|
47787 | }, 0) + 1);
|
47788 | nodesBeforeIndex = allLeafChildren_1.slice(0, normalizedAddIndex);
|
47789 | nodesAfterIndex = allLeafChildren_1.slice(normalizedAddIndex, allLeafChildren_1.length);
|
47790 | }
|
47791 | else {
|
47792 | nodesBeforeIndex = this.rootNode.allLeafChildren;
|
47793 | nodesAfterIndex = [];
|
47794 | }
|
47795 | this.rootNode.allLeafChildren = __spread$e(nodesBeforeIndex, newNodes, nodesAfterIndex);
|
47796 | if (this.rootNode.sibling) {
|
47797 | this.rootNode.sibling.allLeafChildren = this.rootNode.allLeafChildren;
|
47798 | }
|
47799 |
|
47800 | rowNodeTransaction.add = newNodes;
|
47801 | };
|
47802 | ClientSideNodeManager.prototype.executeRemove = function (rowDataTran, rowNodeTransaction, nodesToUnselect) {
|
47803 | var _this = this;
|
47804 | var remove = rowDataTran.remove;
|
47805 | if (_.missingOrEmpty(remove)) {
|
47806 | return;
|
47807 | }
|
47808 | var rowIdsRemoved = {};
|
47809 | remove.forEach(function (item) {
|
47810 | var rowNode = _this.lookupRowNode(item);
|
47811 | if (!rowNode) {
|
47812 | return;
|
47813 | }
|
47814 |
|
47815 |
|
47816 | if (rowNode.isSelected()) {
|
47817 | nodesToUnselect.push(rowNode);
|
47818 | }
|
47819 |
|
47820 | rowNode.clearRowTopAndRowIndex();
|
47821 |
|
47822 |
|
47823 | rowIdsRemoved[rowNode.id] = true;
|
47824 |
|
47825 | delete _this.allNodesMap[rowNode.id];
|
47826 | rowNodeTransaction.remove.push(rowNode);
|
47827 | });
|
47828 | this.rootNode.allLeafChildren = this.rootNode.allLeafChildren.filter(function (rowNode) { return !rowIdsRemoved[rowNode.id]; });
|
47829 | if (this.rootNode.sibling) {
|
47830 | this.rootNode.sibling.allLeafChildren = this.rootNode.allLeafChildren;
|
47831 | }
|
47832 | };
|
47833 | ClientSideNodeManager.prototype.executeUpdate = function (rowDataTran, rowNodeTransaction, nodesToUnselect) {
|
47834 | var _this = this;
|
47835 | var update = rowDataTran.update;
|
47836 | if (_.missingOrEmpty(update)) {
|
47837 | return;
|
47838 | }
|
47839 | update.forEach(function (item) {
|
47840 | var rowNode = _this.lookupRowNode(item);
|
47841 | if (!rowNode) {
|
47842 | return;
|
47843 | }
|
47844 | rowNode.updateData(item);
|
47845 | if (!rowNode.selectable && rowNode.isSelected()) {
|
47846 | nodesToUnselect.push(rowNode);
|
47847 | }
|
47848 | _this.setMasterForRow(rowNode, item, ClientSideNodeManager.TOP_LEVEL, false);
|
47849 | rowNodeTransaction.update.push(rowNode);
|
47850 | });
|
47851 | };
|
47852 | ClientSideNodeManager.prototype.lookupRowNode = function (data) {
|
47853 | var getRowIdFunc = this.gridOptionsWrapper.getRowIdFunc();
|
47854 | var rowNode;
|
47855 | if (getRowIdFunc) {
|
47856 |
|
47857 | var id = getRowIdFunc({ data: data, level: 0 });
|
47858 | rowNode = this.allNodesMap[id];
|
47859 | if (!rowNode) {
|
47860 | console.error("AG Grid: could not find row id=" + id + ", data item was not found for this id");
|
47861 | return null;
|
47862 | }
|
47863 | }
|
47864 | else {
|
47865 |
|
47866 | rowNode = this.rootNode.allLeafChildren.find(function (node) { return node.data === data; });
|
47867 | if (!rowNode) {
|
47868 | console.error("AG Grid: could not find data item as object was not found", data);
|
47869 | console.error("Consider using getRowId to help the Grid find matching row data");
|
47870 | return null;
|
47871 | }
|
47872 | }
|
47873 | return rowNode || null;
|
47874 | };
|
47875 | ClientSideNodeManager.prototype.createNode = function (dataItem, parent, level) {
|
47876 | var node = new RowNode(this.beans);
|
47877 | node.group = false;
|
47878 | this.setMasterForRow(node, dataItem, level, true);
|
47879 | if (parent && !this.suppressParentsInRowNodes) {
|
47880 | node.parent = parent;
|
47881 | }
|
47882 | node.level = level;
|
47883 | node.setDataAndId(dataItem, this.nextId.toString());
|
47884 | if (this.allNodesMap[node.id]) {
|
47885 | console.warn("AG Grid: duplicate node id '" + node.id + "' detected from getRowId callback, this could cause issues in your grid.");
|
47886 | }
|
47887 | this.allNodesMap[node.id] = node;
|
47888 | this.nextId++;
|
47889 | return node;
|
47890 | };
|
47891 | ClientSideNodeManager.prototype.setMasterForRow = function (rowNode, data, level, setExpanded) {
|
47892 | if (this.doingTreeData) {
|
47893 | rowNode.setMaster(false);
|
47894 | if (setExpanded) {
|
47895 | rowNode.expanded = false;
|
47896 | }
|
47897 | }
|
47898 | else {
|
47899 |
|
47900 | if (this.doingMasterDetail) {
|
47901 |
|
47902 |
|
47903 | if (this.isRowMasterFunc) {
|
47904 | rowNode.setMaster(this.isRowMasterFunc(data));
|
47905 | }
|
47906 | else {
|
47907 | rowNode.setMaster(true);
|
47908 | }
|
47909 | }
|
47910 | else {
|
47911 | rowNode.setMaster(false);
|
47912 | }
|
47913 | if (setExpanded) {
|
47914 | var rowGroupColumns = this.columnModel.getRowGroupColumns();
|
47915 | var numRowGroupColumns = rowGroupColumns ? rowGroupColumns.length : 0;
|
47916 |
|
47917 | var masterRowLevel = level + numRowGroupColumns;
|
47918 | rowNode.expanded = rowNode.master ? this.isExpanded(masterRowLevel) : false;
|
47919 | }
|
47920 | }
|
47921 | };
|
47922 | ClientSideNodeManager.prototype.isExpanded = function (level) {
|
47923 | var expandByDefault = this.gridOptionsWrapper.getGroupDefaultExpanded();
|
47924 | if (expandByDefault === -1) {
|
47925 | return true;
|
47926 | }
|
47927 | return level < expandByDefault;
|
47928 | };
|
47929 | ClientSideNodeManager.TOP_LEVEL = 0;
|
47930 | ClientSideNodeManager.ROOT_NODE_ID = 'ROOT_NODE_ID';
|
47931 | return ClientSideNodeManager;
|
47932 | }());
|
47933 |
|
47934 | var __extends$2G = (undefined && undefined.__extends) || (function () {
|
47935 | var extendStatics = function (d, b) {
|
47936 | extendStatics = Object.setPrototypeOf ||
|
47937 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
47938 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
47939 | return extendStatics(d, b);
|
47940 | };
|
47941 | return function (d, b) {
|
47942 | extendStatics(d, b);
|
47943 | function __() { this.constructor = d; }
|
47944 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
47945 | };
|
47946 | })();
|
47947 | var __decorate$2n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
47948 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
47949 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
47950 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
47951 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
47952 | };
|
47953 | var RecursionType;
|
47954 | (function (RecursionType) {
|
47955 | RecursionType[RecursionType["Normal"] = 0] = "Normal";
|
47956 | RecursionType[RecursionType["AfterFilter"] = 1] = "AfterFilter";
|
47957 | RecursionType[RecursionType["AfterFilterAndSort"] = 2] = "AfterFilterAndSort";
|
47958 | RecursionType[RecursionType["PivotNodes"] = 3] = "PivotNodes";
|
47959 | })(RecursionType || (RecursionType = {}));
|
47960 | var ClientSideRowModel = (function (_super) {
|
47961 | __extends$2G(ClientSideRowModel, _super);
|
47962 | function ClientSideRowModel() {
|
47963 | return _super !== null && _super.apply(this, arguments) || this;
|
47964 | }
|
47965 | ClientSideRowModel.prototype.init = function () {
|
47966 | var refreshEverythingFunc = this.refreshModel.bind(this, { step: ClientSideRowModelSteps.EVERYTHING });
|
47967 | var animate = !this.gridOptionsWrapper.isSuppressAnimationFrame();
|
47968 | var refreshEverythingAfterColsChangedFunc = this.refreshModel.bind(this, {
|
47969 | step: ClientSideRowModelSteps.EVERYTHING,
|
47970 | afterColumnsChanged: true,
|
47971 | keepRenderedRows: true,
|
47972 | animate: animate
|
47973 | });
|
47974 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, refreshEverythingAfterColsChangedFunc);
|
47975 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, refreshEverythingFunc);
|
47976 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, this.onValueChanged.bind(this));
|
47977 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_CHANGED, this.refreshModel.bind(this, { step: ClientSideRowModelSteps.PIVOT }));
|
47978 | this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
|
47979 | this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
|
47980 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, refreshEverythingFunc);
|
47981 | var refreshMapListener = this.refreshModel.bind(this, {
|
47982 | step: ClientSideRowModelSteps.MAP,
|
47983 | keepRenderedRows: true,
|
47984 | animate: animate
|
47985 | });
|
47986 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN, refreshMapListener);
|
47987 | this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, refreshMapListener);
|
47988 | this.rootNode = new RowNode(this.beans);
|
47989 | this.nodeManager = new ClientSideNodeManager(this.rootNode, this.gridOptionsWrapper, this.eventService, this.columnModel, this.gridApi, this.columnApi, this.selectionService, this.beans);
|
47990 | };
|
47991 | ClientSideRowModel.prototype.start = function () {
|
47992 | var rowData = this.gridOptionsWrapper.getRowData();
|
47993 | if (rowData) {
|
47994 | this.setRowData(rowData);
|
47995 | }
|
47996 | };
|
47997 | ClientSideRowModel.prototype.ensureRowHeightsValid = function (startPixel, endPixel, startLimitIndex, endLimitIndex) {
|
47998 | var atLeastOneChange;
|
47999 | var res = false;
|
48000 |
|
48001 |
|
48002 |
|
48003 | do {
|
48004 | atLeastOneChange = false;
|
48005 | var rowAtStartPixel = this.getRowIndexAtPixel(startPixel);
|
48006 | var rowAtEndPixel = this.getRowIndexAtPixel(endPixel);
|
48007 |
|
48008 | var firstRow = Math.max(rowAtStartPixel, startLimitIndex);
|
48009 | var lastRow = Math.min(rowAtEndPixel, endLimitIndex);
|
48010 | for (var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++) {
|
48011 | var rowNode = this.getRow(rowIndex);
|
48012 | if (rowNode.rowHeightEstimated) {
|
48013 | var rowHeight = this.gridOptionsWrapper.getRowHeightForNode(rowNode);
|
48014 | rowNode.setRowHeight(rowHeight.height);
|
48015 | atLeastOneChange = true;
|
48016 | res = true;
|
48017 | }
|
48018 | }
|
48019 | if (atLeastOneChange) {
|
48020 | this.setRowTopAndRowIndex();
|
48021 | }
|
48022 | } while (atLeastOneChange);
|
48023 | return res;
|
48024 | };
|
48025 | ClientSideRowModel.prototype.setRowTopAndRowIndex = function () {
|
48026 | var defaultRowHeight = this.gridOptionsWrapper.getDefaultRowHeight();
|
48027 | var nextRowTop = 0;
|
48028 |
|
48029 |
|
48030 |
|
48031 |
|
48032 | var displayedRowsMapped = new Set();
|
48033 |
|
48034 |
|
48035 | var allowEstimate = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_NORMAL;
|
48036 | for (var i = 0; i < this.rowsToDisplay.length; i++) {
|
48037 | var rowNode = this.rowsToDisplay[i];
|
48038 | if (rowNode.id != null) {
|
48039 | displayedRowsMapped.add(rowNode.id);
|
48040 | }
|
48041 | if (rowNode.rowHeight == null) {
|
48042 | var rowHeight = this.gridOptionsWrapper.getRowHeightForNode(rowNode, allowEstimate, defaultRowHeight);
|
48043 | rowNode.setRowHeight(rowHeight.height, rowHeight.estimated);
|
48044 | }
|
48045 | rowNode.setRowTop(nextRowTop);
|
48046 | rowNode.setRowIndex(i);
|
48047 | nextRowTop += rowNode.rowHeight;
|
48048 | }
|
48049 | return displayedRowsMapped;
|
48050 | };
|
48051 | ClientSideRowModel.prototype.clearRowTopAndRowIndex = function (changedPath, displayedRowsMapped) {
|
48052 | var changedPathActive = changedPath.isActive();
|
48053 | var clearIfNotDisplayed = function (rowNode) {
|
48054 | if (rowNode && rowNode.id != null && !displayedRowsMapped.has(rowNode.id)) {
|
48055 | rowNode.clearRowTopAndRowIndex();
|
48056 | }
|
48057 | };
|
48058 | var recurse = function (rowNode) {
|
48059 | clearIfNotDisplayed(rowNode);
|
48060 | clearIfNotDisplayed(rowNode.detailNode);
|
48061 | clearIfNotDisplayed(rowNode.sibling);
|
48062 | if (rowNode.hasChildren()) {
|
48063 | if (rowNode.childrenAfterGroup) {
|
48064 |
|
48065 |
|
48066 |
|
48067 |
|
48068 |
|
48069 | var isRootNode = rowNode.level == -1;
|
48070 |
|
48071 | var skipChildren = changedPathActive && !isRootNode && !rowNode.expanded;
|
48072 | if (!skipChildren) {
|
48073 | rowNode.childrenAfterGroup.forEach(recurse);
|
48074 | }
|
48075 | }
|
48076 | }
|
48077 | };
|
48078 | recurse(this.rootNode);
|
48079 | };
|
48080 |
|
48081 | ClientSideRowModel.prototype.ensureRowsAtPixel = function (rowNodes, pixel, increment) {
|
48082 | var _this = this;
|
48083 | if (increment === void 0) { increment = 0; }
|
48084 | var indexAtPixelNow = this.getRowIndexAtPixel(pixel);
|
48085 | var rowNodeAtPixelNow = this.getRow(indexAtPixelNow);
|
48086 | var animate = !this.gridOptionsWrapper.isSuppressAnimationFrame();
|
48087 | if (rowNodeAtPixelNow === rowNodes[0]) {
|
48088 | return false;
|
48089 | }
|
48090 | rowNodes.forEach(function (rowNode) {
|
48091 | _.removeFromArray(_this.rootNode.allLeafChildren, rowNode);
|
48092 | });
|
48093 | rowNodes.forEach(function (rowNode, idx) {
|
48094 | _.insertIntoArray(_this.rootNode.allLeafChildren, rowNode, Math.max(indexAtPixelNow + increment, 0) + idx);
|
48095 | });
|
48096 | this.refreshModel({
|
48097 | step: ClientSideRowModelSteps.EVERYTHING,
|
48098 | keepRenderedRows: true,
|
48099 | keepEditingRows: true,
|
48100 | animate: animate
|
48101 | });
|
48102 | return true;
|
48103 | };
|
48104 | ClientSideRowModel.prototype.highlightRowAtPixel = function (rowNode, pixel) {
|
48105 | var indexAtPixelNow = pixel != null ? this.getRowIndexAtPixel(pixel) : null;
|
48106 | var rowNodeAtPixelNow = indexAtPixelNow != null ? this.getRow(indexAtPixelNow) : null;
|
48107 | if (!rowNodeAtPixelNow || !rowNode || rowNodeAtPixelNow === rowNode || pixel == null) {
|
48108 | if (this.lastHighlightedRow) {
|
48109 | this.lastHighlightedRow.setHighlighted(null);
|
48110 | this.lastHighlightedRow = null;
|
48111 | }
|
48112 | return;
|
48113 | }
|
48114 | var highlight = this.getHighlightPosition(pixel, rowNodeAtPixelNow);
|
48115 | if (this.lastHighlightedRow && this.lastHighlightedRow !== rowNodeAtPixelNow) {
|
48116 | this.lastHighlightedRow.setHighlighted(null);
|
48117 | this.lastHighlightedRow = null;
|
48118 | }
|
48119 | rowNodeAtPixelNow.setHighlighted(highlight);
|
48120 | this.lastHighlightedRow = rowNodeAtPixelNow;
|
48121 | };
|
48122 | ClientSideRowModel.prototype.getHighlightPosition = function (pixel, rowNode) {
|
48123 | if (!rowNode) {
|
48124 | var index = this.getRowIndexAtPixel(pixel);
|
48125 | rowNode = this.getRow(index || 0);
|
48126 | if (!rowNode) {
|
48127 | return RowHighlightPosition.Below;
|
48128 | }
|
48129 | }
|
48130 | var rowTop = rowNode.rowTop, rowHeight = rowNode.rowHeight;
|
48131 | return pixel - rowTop < rowHeight / 2 ? RowHighlightPosition.Above : RowHighlightPosition.Below;
|
48132 | };
|
48133 | ClientSideRowModel.prototype.getLastHighlightedRowNode = function () {
|
48134 | return this.lastHighlightedRow;
|
48135 | };
|
48136 | ClientSideRowModel.prototype.isLastRowIndexKnown = function () {
|
48137 | return true;
|
48138 | };
|
48139 | ClientSideRowModel.prototype.getRowCount = function () {
|
48140 | if (this.rowsToDisplay) {
|
48141 | return this.rowsToDisplay.length;
|
48142 | }
|
48143 | return 0;
|
48144 | };
|
48145 | ClientSideRowModel.prototype.getTopLevelRowCount = function () {
|
48146 | var showingRootNode = this.rowsToDisplay && this.rowsToDisplay[0] === this.rootNode;
|
48147 | if (showingRootNode) {
|
48148 | return 1;
|
48149 | }
|
48150 | var filteredChildren = this.rootNode.childrenAfterAggFilter;
|
48151 | return filteredChildren ? filteredChildren.length : 0;
|
48152 | };
|
48153 | ClientSideRowModel.prototype.getTopLevelRowDisplayedIndex = function (topLevelIndex) {
|
48154 | var showingRootNode = this.rowsToDisplay && this.rowsToDisplay[0] === this.rootNode;
|
48155 | if (showingRootNode) {
|
48156 | return topLevelIndex;
|
48157 | }
|
48158 | var rowNode = this.rootNode.childrenAfterSort[topLevelIndex];
|
48159 | if (this.gridOptionsWrapper.isGroupHideOpenParents()) {
|
48160 |
|
48161 | while (rowNode.expanded && rowNode.childrenAfterSort && rowNode.childrenAfterSort.length > 0) {
|
48162 | rowNode = rowNode.childrenAfterSort[0];
|
48163 | }
|
48164 | }
|
48165 | return rowNode.rowIndex;
|
48166 | };
|
48167 | ClientSideRowModel.prototype.getRowBounds = function (index) {
|
48168 | if (_.missing(this.rowsToDisplay)) {
|
48169 | return null;
|
48170 | }
|
48171 | var rowNode = this.rowsToDisplay[index];
|
48172 | if (rowNode) {
|
48173 | return {
|
48174 | rowTop: rowNode.rowTop,
|
48175 | rowHeight: rowNode.rowHeight
|
48176 | };
|
48177 | }
|
48178 | return null;
|
48179 | };
|
48180 | ClientSideRowModel.prototype.onRowGroupOpened = function () {
|
48181 | var animate = this.gridOptionsWrapper.isAnimateRows();
|
48182 | this.refreshModel({ step: ClientSideRowModelSteps.MAP, keepRenderedRows: true, animate: animate });
|
48183 | };
|
48184 | ClientSideRowModel.prototype.onFilterChanged = function (event) {
|
48185 | if (event.afterDataChange) {
|
48186 | return;
|
48187 | }
|
48188 | var animate = this.gridOptionsWrapper.isAnimateRows();
|
48189 | var primaryOrQuickFilterChanged = event.columns.length === 0 || event.columns.some(function (col) { return col.isPrimary(); });
|
48190 | var step = primaryOrQuickFilterChanged ? ClientSideRowModelSteps.FILTER : ClientSideRowModelSteps.FILTER_AGGREGATES;
|
48191 | this.refreshModel({ step: step, keepRenderedRows: true, animate: animate });
|
48192 | };
|
48193 | ClientSideRowModel.prototype.onSortChanged = function () {
|
48194 | var animate = this.gridOptionsWrapper.isAnimateRows();
|
48195 | this.refreshModel({ step: ClientSideRowModelSteps.SORT, keepRenderedRows: true, animate: animate, keepEditingRows: true });
|
48196 | };
|
48197 | ClientSideRowModel.prototype.getType = function () {
|
48198 | return Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
|
48199 | };
|
48200 | ClientSideRowModel.prototype.onValueChanged = function () {
|
48201 | if (this.columnModel.isPivotActive()) {
|
48202 | this.refreshModel({ step: ClientSideRowModelSteps.PIVOT });
|
48203 | }
|
48204 | else {
|
48205 | this.refreshModel({ step: ClientSideRowModelSteps.AGGREGATE });
|
48206 | }
|
48207 | };
|
48208 | ClientSideRowModel.prototype.createChangePath = function (rowNodeTransactions) {
|
48209 |
|
48210 |
|
48211 |
|
48212 |
|
48213 |
|
48214 |
|
48215 |
|
48216 | var noTransactions = _.missingOrEmpty(rowNodeTransactions);
|
48217 | var changedPath = new ChangedPath(false, this.rootNode);
|
48218 | if (noTransactions || this.gridOptionsWrapper.isTreeData()) {
|
48219 | changedPath.setInactive();
|
48220 | }
|
48221 | return changedPath;
|
48222 | };
|
48223 | ClientSideRowModel.prototype.isSuppressModelUpdateAfterUpdateTransaction = function (params) {
|
48224 | if (!this.gridOptionsWrapper.isSuppressModelUpdateAfterUpdateTransaction()) {
|
48225 | return false;
|
48226 | }
|
48227 |
|
48228 | if (params.rowNodeTransactions == null) {
|
48229 | return false;
|
48230 | }
|
48231 | var transWithAddsOrDeletes = params.rowNodeTransactions.filter(function (tx) {
|
48232 | return (tx.add != null && tx.add.length > 0) || (tx.remove != null && tx.remove.length > 0);
|
48233 | });
|
48234 | var transactionsContainUpdatesOnly = transWithAddsOrDeletes == null || transWithAddsOrDeletes.length == 0;
|
48235 | return transactionsContainUpdatesOnly;
|
48236 | };
|
48237 | ClientSideRowModel.prototype.refreshModel = function (params) {
|
48238 | if (this.isSuppressModelUpdateAfterUpdateTransaction(params)) {
|
48239 | return;
|
48240 | }
|
48241 |
|
48242 |
|
48243 |
|
48244 |
|
48245 |
|
48246 |
|
48247 |
|
48248 |
|
48249 |
|
48250 |
|
48251 | var changedPath = this.createChangePath(params.rowNodeTransactions);
|
48252 | switch (params.step) {
|
48253 | case ClientSideRowModelSteps.EVERYTHING:
|
48254 | this.doRowGrouping(params.groupState, params.rowNodeTransactions, params.rowNodeOrder, changedPath, !!params.afterColumnsChanged);
|
48255 | case ClientSideRowModelSteps.FILTER:
|
48256 | this.doFilter(changedPath);
|
48257 | case ClientSideRowModelSteps.PIVOT:
|
48258 | this.doPivot(changedPath);
|
48259 | case ClientSideRowModelSteps.AGGREGATE:
|
48260 | this.doAggregate(changedPath);
|
48261 | case ClientSideRowModelSteps.FILTER_AGGREGATES:
|
48262 | this.doFilterAggregates(changedPath);
|
48263 | case ClientSideRowModelSteps.SORT:
|
48264 | this.doSort(params.rowNodeTransactions, changedPath);
|
48265 | case ClientSideRowModelSteps.MAP:
|
48266 | this.doRowsToDisplay();
|
48267 | }
|
48268 |
|
48269 |
|
48270 |
|
48271 | var displayedNodesMapped = this.setRowTopAndRowIndex();
|
48272 | this.clearRowTopAndRowIndex(changedPath, displayedNodesMapped);
|
48273 | var event = {
|
48274 | type: Events.EVENT_MODEL_UPDATED,
|
48275 | api: this.gridApi,
|
48276 | columnApi: this.columnApi,
|
48277 | animate: params.animate,
|
48278 | keepRenderedRows: params.keepRenderedRows,
|
48279 | newData: params.newData,
|
48280 | newPage: false
|
48281 | };
|
48282 | this.eventService.dispatchEvent(event);
|
48283 | };
|
48284 | ClientSideRowModel.prototype.isEmpty = function () {
|
48285 | var rowsMissing = _.missing(this.rootNode.allLeafChildren) || this.rootNode.allLeafChildren.length === 0;
|
48286 | return _.missing(this.rootNode) || rowsMissing || !this.columnModel.isReady();
|
48287 | };
|
48288 | ClientSideRowModel.prototype.isRowsToRender = function () {
|
48289 | return _.exists(this.rowsToDisplay) && this.rowsToDisplay.length > 0;
|
48290 | };
|
48291 | ClientSideRowModel.prototype.getNodesInRangeForSelection = function (firstInRange, lastInRange) {
|
48292 |
|
48293 | var firstRowHit = !lastInRange;
|
48294 | var lastRowHit = false;
|
48295 | var lastRow;
|
48296 | var result = [];
|
48297 | var groupsSelectChildren = this.gridOptionsWrapper.isGroupSelectsChildren();
|
48298 | this.forEachNodeAfterFilterAndSort(function (rowNode) {
|
48299 | var lookingForLastRow = firstRowHit && !lastRowHit;
|
48300 |
|
48301 | if (!firstRowHit) {
|
48302 | if (rowNode === lastInRange || rowNode === firstInRange) {
|
48303 | firstRowHit = true;
|
48304 | }
|
48305 | }
|
48306 | var skipThisGroupNode = rowNode.group && groupsSelectChildren;
|
48307 | if (!skipThisGroupNode) {
|
48308 | var inRange = firstRowHit && !lastRowHit;
|
48309 | var childOfLastRow = rowNode.isParentOfNode(lastRow);
|
48310 | if (inRange || childOfLastRow) {
|
48311 | result.push(rowNode);
|
48312 | }
|
48313 | }
|
48314 | if (lookingForLastRow) {
|
48315 | if (rowNode === lastInRange || rowNode === firstInRange) {
|
48316 | lastRowHit = true;
|
48317 | if (rowNode === lastInRange) {
|
48318 | lastRow = lastInRange;
|
48319 | }
|
48320 | else {
|
48321 | lastRow = firstInRange;
|
48322 | }
|
48323 | }
|
48324 | }
|
48325 | });
|
48326 | return result;
|
48327 | };
|
48328 | ClientSideRowModel.prototype.setDatasource = function (datasource) {
|
48329 | console.error('AG Grid: should never call setDatasource on clientSideRowController');
|
48330 | };
|
48331 | ClientSideRowModel.prototype.getTopLevelNodes = function () {
|
48332 | return this.rootNode ? this.rootNode.childrenAfterGroup : null;
|
48333 | };
|
48334 | ClientSideRowModel.prototype.getRootNode = function () {
|
48335 | return this.rootNode;
|
48336 | };
|
48337 | ClientSideRowModel.prototype.getRow = function (index) {
|
48338 | return this.rowsToDisplay[index];
|
48339 | };
|
48340 | ClientSideRowModel.prototype.isRowPresent = function (rowNode) {
|
48341 | return this.rowsToDisplay.indexOf(rowNode) >= 0;
|
48342 | };
|
48343 | ClientSideRowModel.prototype.getRowIndexAtPixel = function (pixelToMatch) {
|
48344 | if (this.isEmpty()) {
|
48345 | return -1;
|
48346 | }
|
48347 |
|
48348 |
|
48349 | var bottomPointer = 0;
|
48350 | var topPointer = this.rowsToDisplay.length - 1;
|
48351 |
|
48352 | if (pixelToMatch <= 0) {
|
48353 |
|
48354 | return 0;
|
48355 | }
|
48356 | var lastNode = _.last(this.rowsToDisplay);
|
48357 | if (lastNode.rowTop <= pixelToMatch) {
|
48358 | return this.rowsToDisplay.length - 1;
|
48359 | }
|
48360 | while (true) {
|
48361 | var midPointer = Math.floor((bottomPointer + topPointer) / 2);
|
48362 | var currentRowNode = this.rowsToDisplay[midPointer];
|
48363 | if (this.isRowInPixel(currentRowNode, pixelToMatch)) {
|
48364 | return midPointer;
|
48365 | }
|
48366 | if (currentRowNode.rowTop < pixelToMatch) {
|
48367 | bottomPointer = midPointer + 1;
|
48368 | }
|
48369 | else if (currentRowNode.rowTop > pixelToMatch) {
|
48370 | topPointer = midPointer - 1;
|
48371 | }
|
48372 | }
|
48373 | };
|
48374 | ClientSideRowModel.prototype.isRowInPixel = function (rowNode, pixelToMatch) {
|
48375 | var topPixel = rowNode.rowTop;
|
48376 | var bottomPixel = rowNode.rowTop + rowNode.rowHeight;
|
48377 | var pixelInRow = topPixel <= pixelToMatch && bottomPixel > pixelToMatch;
|
48378 | return pixelInRow;
|
48379 | };
|
48380 | ClientSideRowModel.prototype.forEachLeafNode = function (callback) {
|
48381 | if (this.rootNode.allLeafChildren) {
|
48382 | this.rootNode.allLeafChildren.forEach(function (rowNode, index) { return callback(rowNode, index); });
|
48383 | }
|
48384 | };
|
48385 | ClientSideRowModel.prototype.forEachNode = function (callback) {
|
48386 | this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterGroup, callback, RecursionType.Normal, 0);
|
48387 | };
|
48388 | ClientSideRowModel.prototype.forEachNodeAfterFilter = function (callback) {
|
48389 | this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterAggFilter, callback, RecursionType.AfterFilter, 0);
|
48390 | };
|
48391 | ClientSideRowModel.prototype.forEachNodeAfterFilterAndSort = function (callback) {
|
48392 | this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterSort, callback, RecursionType.AfterFilterAndSort, 0);
|
48393 | };
|
48394 | ClientSideRowModel.prototype.forEachPivotNode = function (callback) {
|
48395 | this.recursivelyWalkNodesAndCallback([this.rootNode], callback, RecursionType.PivotNodes, 0);
|
48396 | };
|
48397 |
|
48398 |
|
48399 |
|
48400 |
|
48401 |
|
48402 | ClientSideRowModel.prototype.recursivelyWalkNodesAndCallback = function (nodes, callback, recursionType, index) {
|
48403 | if (!nodes) {
|
48404 | return index;
|
48405 | }
|
48406 | for (var i = 0; i < nodes.length; i++) {
|
48407 | var node = nodes[i];
|
48408 | callback(node, index++);
|
48409 |
|
48410 | if (node.hasChildren()) {
|
48411 |
|
48412 | var nodeChildren = null;
|
48413 | switch (recursionType) {
|
48414 | case RecursionType.Normal:
|
48415 | nodeChildren = node.childrenAfterGroup;
|
48416 | break;
|
48417 | case RecursionType.AfterFilter:
|
48418 | nodeChildren = node.childrenAfterAggFilter;
|
48419 | break;
|
48420 | case RecursionType.AfterFilterAndSort:
|
48421 | nodeChildren = node.childrenAfterSort;
|
48422 | break;
|
48423 | case RecursionType.PivotNodes:
|
48424 |
|
48425 | nodeChildren = !node.leafGroup ? node.childrenAfterSort : null;
|
48426 | break;
|
48427 | }
|
48428 | if (nodeChildren) {
|
48429 | index = this.recursivelyWalkNodesAndCallback(nodeChildren, callback, recursionType, index);
|
48430 | }
|
48431 | }
|
48432 | }
|
48433 | return index;
|
48434 | };
|
48435 |
|
48436 |
|
48437 | ClientSideRowModel.prototype.doAggregate = function (changedPath) {
|
48438 | if (this.aggregationStage) {
|
48439 | this.aggregationStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
|
48440 | }
|
48441 | };
|
48442 | ClientSideRowModel.prototype.doFilterAggregates = function (changedPath) {
|
48443 | if (this.filterAggregatesStage) {
|
48444 | this.filterAggregatesStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
|
48445 | }
|
48446 | else {
|
48447 |
|
48448 | this.rootNode.childrenAfterAggFilter = this.rootNode.childrenAfterFilter;
|
48449 | }
|
48450 | };
|
48451 |
|
48452 |
|
48453 | ClientSideRowModel.prototype.expandOrCollapseAll = function (expand) {
|
48454 | var usingTreeData = this.gridOptionsWrapper.isTreeData();
|
48455 | var usingPivotMode = this.columnModel.isPivotActive();
|
48456 | var recursiveExpandOrCollapse = function (rowNodes) {
|
48457 | if (!rowNodes) {
|
48458 | return;
|
48459 | }
|
48460 | rowNodes.forEach(function (rowNode) {
|
48461 | var actionRow = function () {
|
48462 | rowNode.expanded = expand;
|
48463 | recursiveExpandOrCollapse(rowNode.childrenAfterGroup);
|
48464 | };
|
48465 | if (usingTreeData) {
|
48466 | var hasChildren = _.exists(rowNode.childrenAfterGroup);
|
48467 | if (hasChildren) {
|
48468 | actionRow();
|
48469 | }
|
48470 | return;
|
48471 | }
|
48472 | if (usingPivotMode) {
|
48473 | var notLeafGroup = !rowNode.leafGroup;
|
48474 | if (notLeafGroup) {
|
48475 | actionRow();
|
48476 | }
|
48477 | return;
|
48478 | }
|
48479 | var isRowGroup = rowNode.group;
|
48480 | if (isRowGroup) {
|
48481 | actionRow();
|
48482 | }
|
48483 | });
|
48484 | };
|
48485 | if (this.rootNode) {
|
48486 | recursiveExpandOrCollapse(this.rootNode.childrenAfterGroup);
|
48487 | }
|
48488 | this.refreshModel({ step: ClientSideRowModelSteps.MAP });
|
48489 | var eventSource = expand ? 'expandAll' : 'collapseAll';
|
48490 | var event = {
|
48491 | api: this.gridApi,
|
48492 | columnApi: this.columnApi,
|
48493 | type: Events.EVENT_EXPAND_COLLAPSE_ALL,
|
48494 | source: eventSource
|
48495 | };
|
48496 | this.eventService.dispatchEvent(event);
|
48497 | };
|
48498 | ClientSideRowModel.prototype.doSort = function (rowNodeTransactions, changedPath) {
|
48499 | this.sortStage.execute({
|
48500 | rowNode: this.rootNode,
|
48501 | rowNodeTransactions: rowNodeTransactions,
|
48502 | changedPath: changedPath
|
48503 | });
|
48504 | };
|
48505 | ClientSideRowModel.prototype.doRowGrouping = function (groupState, rowNodeTransactions, rowNodeOrder, changedPath, afterColumnsChanged) {
|
48506 | if (this.groupStage) {
|
48507 | if (rowNodeTransactions) {
|
48508 | this.groupStage.execute({
|
48509 | rowNode: this.rootNode,
|
48510 | rowNodeTransactions: rowNodeTransactions,
|
48511 | rowNodeOrder: rowNodeOrder,
|
48512 | changedPath: changedPath
|
48513 | });
|
48514 | }
|
48515 | else {
|
48516 | this.groupStage.execute({
|
48517 | rowNode: this.rootNode,
|
48518 | changedPath: changedPath,
|
48519 | afterColumnsChanged: afterColumnsChanged
|
48520 | });
|
48521 |
|
48522 | this.restoreGroupState(groupState);
|
48523 | }
|
48524 | if (this.gridOptionsWrapper.isGroupSelectsChildren()) {
|
48525 | this.selectionService.updateGroupsFromChildrenSelections(changedPath);
|
48526 | }
|
48527 | }
|
48528 | else {
|
48529 | this.rootNode.childrenAfterGroup = this.rootNode.allLeafChildren;
|
48530 | if (this.rootNode.sibling) {
|
48531 | this.rootNode.sibling.childrenAfterGroup = this.rootNode.childrenAfterGroup;
|
48532 | }
|
48533 | this.rootNode.updateHasChildren();
|
48534 | }
|
48535 | };
|
48536 | ClientSideRowModel.prototype.restoreGroupState = function (groupState) {
|
48537 | if (!groupState) {
|
48538 | return;
|
48539 | }
|
48540 | _.traverseNodesWithKey(this.rootNode.childrenAfterGroup, function (node, key) {
|
48541 |
|
48542 |
|
48543 |
|
48544 | if (typeof groupState[key] === 'boolean') {
|
48545 | node.expanded = groupState[key];
|
48546 | }
|
48547 | });
|
48548 | };
|
48549 | ClientSideRowModel.prototype.doFilter = function (changedPath) {
|
48550 | this.filterStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
|
48551 | };
|
48552 | ClientSideRowModel.prototype.doPivot = function (changedPath) {
|
48553 | if (this.pivotStage) {
|
48554 | this.pivotStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
|
48555 | }
|
48556 | };
|
48557 | ClientSideRowModel.prototype.getGroupState = function () {
|
48558 | if (!this.rootNode.childrenAfterGroup || !this.gridOptionsWrapper.isRememberGroupStateWhenNewData()) {
|
48559 | return null;
|
48560 | }
|
48561 | var result = {};
|
48562 | _.traverseNodesWithKey(this.rootNode.childrenAfterGroup, function (node, key) { return result[key] = node.expanded; });
|
48563 | return result;
|
48564 | };
|
48565 | ClientSideRowModel.prototype.getCopyOfNodesMap = function () {
|
48566 | return this.nodeManager.getCopyOfNodesMap();
|
48567 | };
|
48568 | ClientSideRowModel.prototype.getRowNode = function (id) {
|
48569 |
|
48570 | var idIsGroup = typeof id == 'string' && id.indexOf(RowNode.ID_PREFIX_ROW_GROUP) == 0;
|
48571 | if (idIsGroup) {
|
48572 |
|
48573 |
|
48574 |
|
48575 |
|
48576 | var res_1 = undefined;
|
48577 | this.forEachNode(function (node) {
|
48578 | if (node.id === id) {
|
48579 | res_1 = node;
|
48580 | }
|
48581 | });
|
48582 | return res_1;
|
48583 | }
|
48584 | return this.nodeManager.getRowNode(id);
|
48585 | };
|
48586 |
|
48587 | ClientSideRowModel.prototype.setRowData = function (rowData) {
|
48588 |
|
48589 |
|
48590 |
|
48591 | var groupState = this.getGroupState();
|
48592 | this.nodeManager.setRowData(rowData);
|
48593 |
|
48594 | this.selectionService.reset();
|
48595 |
|
48596 | this.filterManager.onNewRowsLoaded('rowDataUpdated');
|
48597 |
|
48598 |
|
48599 | var rowDataChangedEvent = {
|
48600 | type: Events.EVENT_ROW_DATA_CHANGED,
|
48601 | api: this.gridApi,
|
48602 | columnApi: this.columnApi
|
48603 | };
|
48604 | this.eventService.dispatchEvent(rowDataChangedEvent);
|
48605 | this.refreshModel({
|
48606 | step: ClientSideRowModelSteps.EVERYTHING,
|
48607 | groupState: groupState,
|
48608 | newData: true
|
48609 | });
|
48610 | };
|
48611 | ClientSideRowModel.prototype.batchUpdateRowData = function (rowDataTransaction, callback) {
|
48612 | var _this = this;
|
48613 | if (this.applyAsyncTransactionsTimeout == null) {
|
48614 | this.rowDataTransactionBatch = [];
|
48615 | var waitMillis = this.gridOptionsWrapper.getAsyncTransactionWaitMillis();
|
48616 | this.applyAsyncTransactionsTimeout = window.setTimeout(function () {
|
48617 | _this.executeBatchUpdateRowData();
|
48618 | }, waitMillis);
|
48619 | }
|
48620 | this.rowDataTransactionBatch.push({ rowDataTransaction: rowDataTransaction, callback: callback });
|
48621 | };
|
48622 | ClientSideRowModel.prototype.flushAsyncTransactions = function () {
|
48623 | if (this.applyAsyncTransactionsTimeout != null) {
|
48624 | clearTimeout(this.applyAsyncTransactionsTimeout);
|
48625 | this.executeBatchUpdateRowData();
|
48626 | }
|
48627 | };
|
48628 | ClientSideRowModel.prototype.executeBatchUpdateRowData = function () {
|
48629 | var _this = this;
|
48630 | this.valueCache.onDataChanged();
|
48631 | var callbackFuncsBound = [];
|
48632 | var rowNodeTrans = [];
|
48633 |
|
48634 |
|
48635 | var forceRowNodeOrder = false;
|
48636 | if (this.rowDataTransactionBatch) {
|
48637 | this.rowDataTransactionBatch.forEach(function (tranItem) {
|
48638 | var rowNodeTran = _this.nodeManager.updateRowData(tranItem.rowDataTransaction, undefined);
|
48639 | rowNodeTrans.push(rowNodeTran);
|
48640 | if (tranItem.callback) {
|
48641 | callbackFuncsBound.push(tranItem.callback.bind(null, rowNodeTran));
|
48642 | }
|
48643 | if (typeof tranItem.rowDataTransaction.addIndex === 'number') {
|
48644 | forceRowNodeOrder = true;
|
48645 | }
|
48646 | });
|
48647 | }
|
48648 | this.commonUpdateRowData(rowNodeTrans, undefined, forceRowNodeOrder);
|
48649 |
|
48650 | if (callbackFuncsBound.length > 0) {
|
48651 | window.setTimeout(function () {
|
48652 | callbackFuncsBound.forEach(function (func) { return func(); });
|
48653 | }, 0);
|
48654 | }
|
48655 | if (rowNodeTrans.length > 0) {
|
48656 | var event_1 = {
|
48657 | api: this.gridOptionsWrapper.getApi(),
|
48658 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
48659 | type: Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED,
|
48660 | results: rowNodeTrans
|
48661 | };
|
48662 | this.eventService.dispatchEvent(event_1);
|
48663 | }
|
48664 | this.rowDataTransactionBatch = null;
|
48665 | this.applyAsyncTransactionsTimeout = undefined;
|
48666 | };
|
48667 | ClientSideRowModel.prototype.updateRowData = function (rowDataTran, rowNodeOrder) {
|
48668 | this.valueCache.onDataChanged();
|
48669 | var rowNodeTran = this.nodeManager.updateRowData(rowDataTran, rowNodeOrder);
|
48670 |
|
48671 |
|
48672 |
|
48673 | var forceRowNodeOrder = typeof rowDataTran.addIndex === 'number';
|
48674 | this.commonUpdateRowData([rowNodeTran], rowNodeOrder, forceRowNodeOrder);
|
48675 | return rowNodeTran;
|
48676 | };
|
48677 | ClientSideRowModel.prototype.createRowNodeOrder = function () {
|
48678 | var suppressSortOrder = this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder();
|
48679 | if (suppressSortOrder) {
|
48680 | return;
|
48681 | }
|
48682 | var orderMap = {};
|
48683 | if (this.rootNode && this.rootNode.allLeafChildren) {
|
48684 | for (var index = 0; index < this.rootNode.allLeafChildren.length; index++) {
|
48685 | var node = this.rootNode.allLeafChildren[index];
|
48686 | orderMap[node.id] = index;
|
48687 | }
|
48688 | }
|
48689 | return orderMap;
|
48690 | };
|
48691 |
|
48692 | ClientSideRowModel.prototype.commonUpdateRowData = function (rowNodeTrans, rowNodeOrder, forceRowNodeOrder) {
|
48693 | var animate = !this.gridOptionsWrapper.isSuppressAnimationFrame();
|
48694 | if (forceRowNodeOrder) {
|
48695 | rowNodeOrder = this.createRowNodeOrder();
|
48696 | }
|
48697 | this.refreshModel({
|
48698 | step: ClientSideRowModelSteps.EVERYTHING,
|
48699 | rowNodeTransactions: rowNodeTrans,
|
48700 | rowNodeOrder: rowNodeOrder,
|
48701 | keepRenderedRows: true,
|
48702 | keepEditingRows: true,
|
48703 | animate: animate
|
48704 | });
|
48705 | var event = {
|
48706 | type: Events.EVENT_ROW_DATA_UPDATED,
|
48707 | api: this.gridApi,
|
48708 | columnApi: this.columnApi
|
48709 | };
|
48710 | this.eventService.dispatchEvent(event);
|
48711 | };
|
48712 | ClientSideRowModel.prototype.doRowsToDisplay = function () {
|
48713 | this.rowsToDisplay = this.flattenStage.execute({ rowNode: this.rootNode });
|
48714 | };
|
48715 | ClientSideRowModel.prototype.onRowHeightChanged = function () {
|
48716 | this.refreshModel({ step: ClientSideRowModelSteps.MAP, keepRenderedRows: true, keepEditingRows: true });
|
48717 | };
|
48718 | ClientSideRowModel.prototype.resetRowHeights = function () {
|
48719 | var atLeastOne = false;
|
48720 | this.forEachNode(function (rowNode) {
|
48721 | rowNode.setRowHeight(rowNode.rowHeight, true);
|
48722 |
|
48723 |
|
48724 |
|
48725 | var detailNode = rowNode.detailNode;
|
48726 | if (detailNode) {
|
48727 | detailNode.setRowHeight(detailNode.rowHeight, true);
|
48728 | }
|
48729 | atLeastOne = true;
|
48730 | });
|
48731 | if (atLeastOne) {
|
48732 | this.onRowHeightChanged();
|
48733 | }
|
48734 | };
|
48735 | __decorate$2n([
|
48736 | Autowired('columnModel')
|
48737 | ], ClientSideRowModel.prototype, "columnModel", void 0);
|
48738 | __decorate$2n([
|
48739 | Autowired('selectionService')
|
48740 | ], ClientSideRowModel.prototype, "selectionService", void 0);
|
48741 | __decorate$2n([
|
48742 | Autowired('filterManager')
|
48743 | ], ClientSideRowModel.prototype, "filterManager", void 0);
|
48744 | __decorate$2n([
|
48745 | Autowired('valueCache')
|
48746 | ], ClientSideRowModel.prototype, "valueCache", void 0);
|
48747 | __decorate$2n([
|
48748 | Autowired('columnApi')
|
48749 | ], ClientSideRowModel.prototype, "columnApi", void 0);
|
48750 | __decorate$2n([
|
48751 | Autowired('gridApi')
|
48752 | ], ClientSideRowModel.prototype, "gridApi", void 0);
|
48753 | __decorate$2n([
|
48754 | Autowired('animationFrameService')
|
48755 | ], ClientSideRowModel.prototype, "animationFrameService", void 0);
|
48756 | __decorate$2n([
|
48757 | Autowired('beans')
|
48758 | ], ClientSideRowModel.prototype, "beans", void 0);
|
48759 | __decorate$2n([
|
48760 | Autowired('filterStage')
|
48761 | ], ClientSideRowModel.prototype, "filterStage", void 0);
|
48762 | __decorate$2n([
|
48763 | Autowired('sortStage')
|
48764 | ], ClientSideRowModel.prototype, "sortStage", void 0);
|
48765 | __decorate$2n([
|
48766 | Autowired('flattenStage')
|
48767 | ], ClientSideRowModel.prototype, "flattenStage", void 0);
|
48768 | __decorate$2n([
|
48769 | Optional('groupStage')
|
48770 | ], ClientSideRowModel.prototype, "groupStage", void 0);
|
48771 | __decorate$2n([
|
48772 | Optional('aggregationStage')
|
48773 | ], ClientSideRowModel.prototype, "aggregationStage", void 0);
|
48774 | __decorate$2n([
|
48775 | Optional('pivotStage')
|
48776 | ], ClientSideRowModel.prototype, "pivotStage", void 0);
|
48777 | __decorate$2n([
|
48778 | Optional('filterAggregatesStage')
|
48779 | ], ClientSideRowModel.prototype, "filterAggregatesStage", void 0);
|
48780 | __decorate$2n([
|
48781 | PostConstruct
|
48782 | ], ClientSideRowModel.prototype, "init", null);
|
48783 | ClientSideRowModel = __decorate$2n([
|
48784 | Bean('rowModel')
|
48785 | ], ClientSideRowModel);
|
48786 | return ClientSideRowModel;
|
48787 | }(BeanStub));
|
48788 |
|
48789 | var __extends$2H = (undefined && undefined.__extends) || (function () {
|
48790 | var extendStatics = function (d, b) {
|
48791 | extendStatics = Object.setPrototypeOf ||
|
48792 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
48793 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
48794 | return extendStatics(d, b);
|
48795 | };
|
48796 | return function (d, b) {
|
48797 | extendStatics(d, b);
|
48798 | function __() { this.constructor = d; }
|
48799 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
48800 | };
|
48801 | })();
|
48802 | var __decorate$2o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
48803 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
48804 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
48805 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
48806 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
48807 | };
|
48808 | var FilterStage = (function (_super) {
|
48809 | __extends$2H(FilterStage, _super);
|
48810 | function FilterStage() {
|
48811 | return _super !== null && _super.apply(this, arguments) || this;
|
48812 | }
|
48813 | FilterStage.prototype.execute = function (params) {
|
48814 | var changedPath = params.changedPath;
|
48815 | this.filterService.filter(changedPath);
|
48816 | };
|
48817 | __decorate$2o([
|
48818 | Autowired('filterService')
|
48819 | ], FilterStage.prototype, "filterService", void 0);
|
48820 | FilterStage = __decorate$2o([
|
48821 | Bean('filterStage')
|
48822 | ], FilterStage);
|
48823 | return FilterStage;
|
48824 | }(BeanStub));
|
48825 |
|
48826 | var __extends$2I = (undefined && undefined.__extends) || (function () {
|
48827 | var extendStatics = function (d, b) {
|
48828 | extendStatics = Object.setPrototypeOf ||
|
48829 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
48830 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
48831 | return extendStatics(d, b);
|
48832 | };
|
48833 | return function (d, b) {
|
48834 | extendStatics(d, b);
|
48835 | function __() { this.constructor = d; }
|
48836 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
48837 | };
|
48838 | })();
|
48839 | var __decorate$2p = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
48840 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
48841 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
48842 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
48843 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
48844 | };
|
48845 | var SortStage = (function (_super) {
|
48846 | __extends$2I(SortStage, _super);
|
48847 | function SortStage() {
|
48848 | return _super !== null && _super.apply(this, arguments) || this;
|
48849 | }
|
48850 | SortStage.prototype.execute = function (params) {
|
48851 | var sortOptions = this.sortController.getSortOptions();
|
48852 | var sortActive = _.exists(sortOptions) && sortOptions.length > 0;
|
48853 | var deltaSort = sortActive
|
48854 | && _.exists(params.rowNodeTransactions)
|
48855 |
|
48856 |
|
48857 |
|
48858 |
|
48859 | && this.gridOptionsWrapper.isDeltaSort();
|
48860 | var sortContainsGroupColumns = sortOptions.some(function (opt) { return !!opt.column.getColDef().showRowGroup; });
|
48861 | this.sortService.sort(sortOptions, sortActive, deltaSort, params.rowNodeTransactions, params.changedPath, sortContainsGroupColumns);
|
48862 | };
|
48863 | __decorate$2p([
|
48864 | Autowired('sortService')
|
48865 | ], SortStage.prototype, "sortService", void 0);
|
48866 | __decorate$2p([
|
48867 | Autowired('sortController')
|
48868 | ], SortStage.prototype, "sortController", void 0);
|
48869 | __decorate$2p([
|
48870 | Autowired('columnModel')
|
48871 | ], SortStage.prototype, "columnModel", void 0);
|
48872 | SortStage = __decorate$2p([
|
48873 | Bean('sortStage')
|
48874 | ], SortStage);
|
48875 | return SortStage;
|
48876 | }(BeanStub));
|
48877 |
|
48878 | var __extends$2J = (undefined && undefined.__extends) || (function () {
|
48879 | var extendStatics = function (d, b) {
|
48880 | extendStatics = Object.setPrototypeOf ||
|
48881 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
48882 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
48883 | return extendStatics(d, b);
|
48884 | };
|
48885 | return function (d, b) {
|
48886 | extendStatics(d, b);
|
48887 | function __() { this.constructor = d; }
|
48888 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
48889 | };
|
48890 | })();
|
48891 | var __decorate$2q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
48892 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
48893 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
48894 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
48895 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
48896 | };
|
48897 | var FlattenStage = (function (_super) {
|
48898 | __extends$2J(FlattenStage, _super);
|
48899 | function FlattenStage() {
|
48900 | return _super !== null && _super.apply(this, arguments) || this;
|
48901 | }
|
48902 | FlattenStage.prototype.execute = function (params) {
|
48903 | var rootNode = params.rowNode;
|
48904 |
|
48905 |
|
48906 | var result = [];
|
48907 |
|
48908 | var nextRowTop = { value: 0 };
|
48909 | var skipLeafNodes = this.columnModel.isPivotMode();
|
48910 |
|
48911 |
|
48912 | var showRootNode = skipLeafNodes && rootNode.leafGroup;
|
48913 | var topList = showRootNode ? [rootNode] : rootNode.childrenAfterSort;
|
48914 | this.recursivelyAddToRowsToDisplay(topList, result, nextRowTop, skipLeafNodes, 0);
|
48915 |
|
48916 | var atLeastOneRowPresent = result.length > 0;
|
48917 | var includeGroupTotalFooter = !showRootNode
|
48918 |
|
48919 | && atLeastOneRowPresent
|
48920 | && this.gridOptionsWrapper.isGroupIncludeTotalFooter();
|
48921 | if (includeGroupTotalFooter) {
|
48922 | this.ensureFooterNodeExists(rootNode);
|
48923 | this.addRowNodeToRowsToDisplay(rootNode.sibling, result, nextRowTop, 0);
|
48924 | }
|
48925 | return result;
|
48926 | };
|
48927 | FlattenStage.prototype.recursivelyAddToRowsToDisplay = function (rowsToFlatten, result, nextRowTop, skipLeafNodes, uiLevel) {
|
48928 | if (_.missingOrEmpty(rowsToFlatten)) {
|
48929 | return;
|
48930 | }
|
48931 | var hideOpenParents = this.gridOptionsWrapper.isGroupHideOpenParents();
|
48932 |
|
48933 | var groupRemoveSingleChildren = this.gridOptionsWrapper.isGroupRemoveSingleChildren();
|
48934 | var groupRemoveLowestSingleChildren = !groupRemoveSingleChildren && this.gridOptionsWrapper.isGroupRemoveLowestSingleChildren();
|
48935 | for (var i = 0; i < rowsToFlatten.length; i++) {
|
48936 | var rowNode = rowsToFlatten[i];
|
48937 |
|
48938 | var isParent = rowNode.hasChildren();
|
48939 | var isSkippedLeafNode = skipLeafNodes && !isParent;
|
48940 | var isRemovedSingleChildrenGroup = groupRemoveSingleChildren &&
|
48941 | isParent &&
|
48942 | rowNode.childrenAfterGroup.length === 1;
|
48943 | var isRemovedLowestSingleChildrenGroup = groupRemoveLowestSingleChildren &&
|
48944 | isParent &&
|
48945 | rowNode.leafGroup &&
|
48946 | rowNode.childrenAfterGroup.length === 1;
|
48947 |
|
48948 |
|
48949 |
|
48950 | var neverAllowToExpand = skipLeafNodes && rowNode.leafGroup;
|
48951 | var isHiddenOpenParent = hideOpenParents && rowNode.expanded && !rowNode.master && (!neverAllowToExpand);
|
48952 | var thisRowShouldBeRendered = !isSkippedLeafNode && !isHiddenOpenParent &&
|
48953 | !isRemovedSingleChildrenGroup && !isRemovedLowestSingleChildrenGroup;
|
48954 | if (thisRowShouldBeRendered) {
|
48955 | this.addRowNodeToRowsToDisplay(rowNode, result, nextRowTop, uiLevel);
|
48956 | }
|
48957 |
|
48958 | if (skipLeafNodes && rowNode.leafGroup) {
|
48959 | continue;
|
48960 | }
|
48961 | if (isParent) {
|
48962 | var excludedParent = isRemovedSingleChildrenGroup || isRemovedLowestSingleChildrenGroup;
|
48963 |
|
48964 |
|
48965 | if (rowNode.expanded || excludedParent) {
|
48966 |
|
48967 | var uiLevelForChildren = excludedParent ? uiLevel : uiLevel + 1;
|
48968 | this.recursivelyAddToRowsToDisplay(rowNode.childrenAfterSort, result, nextRowTop, skipLeafNodes, uiLevelForChildren);
|
48969 |
|
48970 | if (this.gridOptionsWrapper.isGroupIncludeFooter()) {
|
48971 | this.ensureFooterNodeExists(rowNode);
|
48972 | this.addRowNodeToRowsToDisplay(rowNode.sibling, result, nextRowTop, uiLevel);
|
48973 | }
|
48974 | }
|
48975 | }
|
48976 | else if (rowNode.master && rowNode.expanded) {
|
48977 | var detailNode = this.createDetailNode(rowNode);
|
48978 | this.addRowNodeToRowsToDisplay(detailNode, result, nextRowTop, uiLevel);
|
48979 | }
|
48980 | }
|
48981 | };
|
48982 |
|
48983 | FlattenStage.prototype.addRowNodeToRowsToDisplay = function (rowNode, result, nextRowTop, uiLevel) {
|
48984 | var isGroupMultiAutoColumn = this.gridOptionsWrapper.isGroupMultiAutoColumn();
|
48985 | result.push(rowNode);
|
48986 | rowNode.setUiLevel(isGroupMultiAutoColumn ? 0 : uiLevel);
|
48987 | };
|
48988 | FlattenStage.prototype.ensureFooterNodeExists = function (groupNode) {
|
48989 |
|
48990 |
|
48991 | if (_.exists(groupNode.sibling)) {
|
48992 | return;
|
48993 | }
|
48994 | var footerNode = new RowNode(this.beans);
|
48995 | Object.keys(groupNode).forEach(function (key) {
|
48996 | footerNode[key] = groupNode[key];
|
48997 | });
|
48998 | footerNode.footer = true;
|
48999 | footerNode.setRowTop(null);
|
49000 | footerNode.setRowIndex(null);
|
49001 |
|
49002 |
|
49003 | footerNode.oldRowTop = null;
|
49004 | if (_.exists(footerNode.id)) {
|
49005 | footerNode.id = 'rowGroupFooter_' + footerNode.id;
|
49006 | }
|
49007 |
|
49008 |
|
49009 |
|
49010 | footerNode.sibling = groupNode;
|
49011 | groupNode.sibling = footerNode;
|
49012 | };
|
49013 | FlattenStage.prototype.createDetailNode = function (masterNode) {
|
49014 | if (_.exists(masterNode.detailNode)) {
|
49015 | return masterNode.detailNode;
|
49016 | }
|
49017 | var detailNode = new RowNode(this.beans);
|
49018 | detailNode.detail = true;
|
49019 | detailNode.selectable = false;
|
49020 | detailNode.parent = masterNode;
|
49021 | if (_.exists(masterNode.id)) {
|
49022 | detailNode.id = 'detail_' + masterNode.id;
|
49023 | }
|
49024 | detailNode.data = masterNode.data;
|
49025 | detailNode.level = masterNode.level + 1;
|
49026 | masterNode.detailNode = detailNode;
|
49027 | return detailNode;
|
49028 | };
|
49029 | __decorate$2q([
|
49030 | Autowired('columnModel')
|
49031 | ], FlattenStage.prototype, "columnModel", void 0);
|
49032 | __decorate$2q([
|
49033 | Autowired('beans')
|
49034 | ], FlattenStage.prototype, "beans", void 0);
|
49035 | FlattenStage = __decorate$2q([
|
49036 | Bean('flattenStage')
|
49037 | ], FlattenStage);
|
49038 | return FlattenStage;
|
49039 | }(BeanStub));
|
49040 |
|
49041 | var __extends$2K = (undefined && undefined.__extends) || (function () {
|
49042 | var extendStatics = function (d, b) {
|
49043 | extendStatics = Object.setPrototypeOf ||
|
49044 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
49045 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
49046 | return extendStatics(d, b);
|
49047 | };
|
49048 | return function (d, b) {
|
49049 | extendStatics(d, b);
|
49050 | function __() { this.constructor = d; }
|
49051 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
49052 | };
|
49053 | })();
|
49054 | var __decorate$2r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
49055 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
49056 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
49057 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
49058 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
49059 | };
|
49060 | var SortService = (function (_super) {
|
49061 | __extends$2K(SortService, _super);
|
49062 | function SortService() {
|
49063 | return _super !== null && _super.apply(this, arguments) || this;
|
49064 | }
|
49065 | SortService.prototype.init = function () {
|
49066 | this.postSortFunc = this.gridOptionsWrapper.getPostSortFunc();
|
49067 | };
|
49068 | SortService.prototype.sort = function (sortOptions, sortActive, useDeltaSort, rowNodeTransactions, changedPath, sortContainsGroupColumns) {
|
49069 | var _this = this;
|
49070 | var groupMaintainOrder = this.gridOptionsWrapper.isGroupMaintainOrder();
|
49071 | var groupColumnsPresent = this.columnModel.getAllGridColumns().some(function (c) { return c.isRowGroupActive(); });
|
49072 | var allDirtyNodes = {};
|
49073 | if (useDeltaSort && rowNodeTransactions) {
|
49074 | allDirtyNodes = this.calculateDirtyNodes(rowNodeTransactions);
|
49075 | }
|
49076 | var isPivotMode = this.columnModel.isPivotMode();
|
49077 | var callback = function (rowNode) {
|
49078 |
|
49079 | _this.pullDownGroupDataForHideOpenParents(rowNode.childrenAfterAggFilter, true);
|
49080 |
|
49081 | var skipSortingPivotLeafs = isPivotMode && rowNode.leafGroup;
|
49082 |
|
49083 |
|
49084 |
|
49085 | var skipSortingGroups = groupMaintainOrder && groupColumnsPresent && !rowNode.leafGroup && !sortContainsGroupColumns;
|
49086 | if (!sortActive || skipSortingGroups || skipSortingPivotLeafs) {
|
49087 |
|
49088 | var childrenToBeSorted = rowNode.childrenAfterAggFilter.slice(0);
|
49089 | if (groupMaintainOrder && rowNode.childrenAfterSort) {
|
49090 | var indexedOrders_1 = rowNode.childrenAfterSort.reduce(function (acc, row, idx) {
|
49091 | acc[row.id] = idx;
|
49092 | return acc;
|
49093 | }, {});
|
49094 | childrenToBeSorted.sort(function (row1, row2) { return (indexedOrders_1[row1.id] || 0) - (indexedOrders_1[row2.id] || 0); });
|
49095 | }
|
49096 | rowNode.childrenAfterSort = childrenToBeSorted;
|
49097 | }
|
49098 | else if (useDeltaSort) {
|
49099 | rowNode.childrenAfterSort = _this.doDeltaSort(rowNode, allDirtyNodes, changedPath, sortOptions);
|
49100 | }
|
49101 | else {
|
49102 | rowNode.childrenAfterSort = _this.rowNodeSorter.doFullSort(rowNode.childrenAfterAggFilter, sortOptions);
|
49103 | }
|
49104 | if (rowNode.sibling) {
|
49105 | rowNode.sibling.childrenAfterSort = rowNode.childrenAfterSort;
|
49106 | }
|
49107 | _this.updateChildIndexes(rowNode);
|
49108 | if (_this.postSortFunc) {
|
49109 | var params = { nodes: rowNode.childrenAfterSort };
|
49110 | _this.postSortFunc(params);
|
49111 | }
|
49112 | };
|
49113 | if (changedPath) {
|
49114 | changedPath.forEachChangedNodeDepthFirst(callback);
|
49115 | }
|
49116 | this.updateGroupDataForHideOpenParents(changedPath);
|
49117 | };
|
49118 | SortService.prototype.calculateDirtyNodes = function (rowNodeTransactions) {
|
49119 | var dirtyNodes = {};
|
49120 | var addNodesFunc = function (rowNodes) {
|
49121 | if (rowNodes) {
|
49122 | rowNodes.forEach(function (rowNode) { return dirtyNodes[rowNode.id] = true; });
|
49123 | }
|
49124 | };
|
49125 |
|
49126 | if (rowNodeTransactions) {
|
49127 | rowNodeTransactions.forEach(function (tran) {
|
49128 | addNodesFunc(tran.add);
|
49129 | addNodesFunc(tran.update);
|
49130 | addNodesFunc(tran.remove);
|
49131 | });
|
49132 | }
|
49133 | return dirtyNodes;
|
49134 | };
|
49135 | SortService.prototype.doDeltaSort = function (rowNode, allTouchedNodes, changedPath, sortOptions) {
|
49136 | var _this = this;
|
49137 | var unsortedRows = rowNode.childrenAfterAggFilter;
|
49138 | var oldSortedRows = rowNode.childrenAfterSort;
|
49139 | if (!oldSortedRows) {
|
49140 | return this.rowNodeSorter.doFullSort(unsortedRows, sortOptions);
|
49141 | }
|
49142 | var untouchedRowsMap = {};
|
49143 | var touchedRows = [];
|
49144 | unsortedRows.forEach(function (row) {
|
49145 | if (allTouchedNodes[row.id] || !changedPath.canSkip(row)) {
|
49146 | touchedRows.push(row);
|
49147 | }
|
49148 | else {
|
49149 | untouchedRowsMap[row.id] = true;
|
49150 | }
|
49151 | });
|
49152 | var sortedUntouchedRows = oldSortedRows.filter(function (child) { return untouchedRowsMap[child.id]; });
|
49153 | var mapNodeToSortedNode = function (rowNode, pos) { return ({ currentPos: pos, rowNode: rowNode }); };
|
49154 | var sortedChangedRows = touchedRows
|
49155 | .map(mapNodeToSortedNode)
|
49156 | .sort(function (a, b) { return _this.rowNodeSorter.compareRowNodes(sortOptions, a, b); });
|
49157 | return this.mergeSortedArrays(sortOptions, sortedChangedRows, sortedUntouchedRows.map(mapNodeToSortedNode)).map(function (_a) {
|
49158 | var rowNode = _a.rowNode;
|
49159 | return rowNode;
|
49160 | });
|
49161 | };
|
49162 |
|
49163 | SortService.prototype.mergeSortedArrays = function (sortOptions, arr1, arr2) {
|
49164 | var res = [];
|
49165 | var i = 0;
|
49166 | var j = 0;
|
49167 |
|
49168 | while (i < arr1.length && j < arr2.length) {
|
49169 |
|
49170 |
|
49171 |
|
49172 |
|
49173 |
|
49174 | var compareResult = this.rowNodeSorter.compareRowNodes(sortOptions, arr1[i], arr2[j]);
|
49175 | if (compareResult < 0) {
|
49176 | res.push(arr1[i++]);
|
49177 | }
|
49178 | else {
|
49179 | res.push(arr2[j++]);
|
49180 | }
|
49181 | }
|
49182 |
|
49183 | while (i < arr1.length) {
|
49184 | res.push(arr1[i++]);
|
49185 | }
|
49186 |
|
49187 | while (j < arr2.length) {
|
49188 | res.push(arr2[j++]);
|
49189 | }
|
49190 | return res;
|
49191 | };
|
49192 | SortService.prototype.updateChildIndexes = function (rowNode) {
|
49193 | if (_.missing(rowNode.childrenAfterSort)) {
|
49194 | return;
|
49195 | }
|
49196 | var listToSort = rowNode.childrenAfterSort;
|
49197 | for (var i = 0; i < listToSort.length; i++) {
|
49198 | var child = listToSort[i];
|
49199 | var firstChild = i === 0;
|
49200 | var lastChild = i === rowNode.childrenAfterSort.length - 1;
|
49201 | child.setFirstChild(firstChild);
|
49202 | child.setLastChild(lastChild);
|
49203 | child.setChildIndex(i);
|
49204 | }
|
49205 | };
|
49206 | SortService.prototype.updateGroupDataForHideOpenParents = function (changedPath) {
|
49207 | var _this = this;
|
49208 | if (!this.gridOptionsWrapper.isGroupHideOpenParents()) {
|
49209 | return;
|
49210 | }
|
49211 | if (this.gridOptionsWrapper.isTreeData()) {
|
49212 | 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).";
|
49213 | _.doOnce(function () { return console.warn(msg_1); }, 'sortService.hideOpenParentsWithTreeData');
|
49214 | return false;
|
49215 | }
|
49216 |
|
49217 | var callback = function (rowNode) {
|
49218 | _this.pullDownGroupDataForHideOpenParents(rowNode.childrenAfterSort, false);
|
49219 | rowNode.childrenAfterSort.forEach(function (child) {
|
49220 | if (child.hasChildren()) {
|
49221 | callback(child);
|
49222 | }
|
49223 | });
|
49224 | };
|
49225 | if (changedPath) {
|
49226 | changedPath.executeFromRootNode(function (rowNode) { return callback(rowNode); });
|
49227 | }
|
49228 | };
|
49229 | SortService.prototype.pullDownGroupDataForHideOpenParents = function (rowNodes, clearOperation) {
|
49230 | var _this = this;
|
49231 | if (!this.gridOptionsWrapper.isGroupHideOpenParents() || _.missing(rowNodes)) {
|
49232 | return;
|
49233 | }
|
49234 | rowNodes.forEach(function (childRowNode) {
|
49235 | var groupDisplayCols = _this.columnModel.getGroupDisplayColumns();
|
49236 | groupDisplayCols.forEach(function (groupDisplayCol) {
|
49237 | var showRowGroup = groupDisplayCol.getColDef().showRowGroup;
|
49238 | if (typeof showRowGroup !== 'string') {
|
49239 | console.error('AG Grid: groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup');
|
49240 | return;
|
49241 | }
|
49242 | var displayingGroupKey = showRowGroup;
|
49243 | var rowGroupColumn = _this.columnModel.getPrimaryColumn(displayingGroupKey);
|
49244 | var thisRowNodeMatches = rowGroupColumn === childRowNode.rowGroupColumn;
|
49245 | if (thisRowNodeMatches) {
|
49246 | return;
|
49247 | }
|
49248 | if (clearOperation) {
|
49249 |
|
49250 | childRowNode.setGroupValue(groupDisplayCol.getId(), undefined);
|
49251 | }
|
49252 | else {
|
49253 |
|
49254 | var parentToStealFrom = childRowNode.getFirstChildOfFirstChild(rowGroupColumn);
|
49255 | if (parentToStealFrom) {
|
49256 | childRowNode.setGroupValue(groupDisplayCol.getId(), parentToStealFrom.key);
|
49257 | }
|
49258 | }
|
49259 | });
|
49260 | });
|
49261 | };
|
49262 | __decorate$2r([
|
49263 | Autowired('columnModel')
|
49264 | ], SortService.prototype, "columnModel", void 0);
|
49265 | __decorate$2r([
|
49266 | Autowired('rowNodeSorter')
|
49267 | ], SortService.prototype, "rowNodeSorter", void 0);
|
49268 | __decorate$2r([
|
49269 | PostConstruct
|
49270 | ], SortService.prototype, "init", null);
|
49271 | SortService = __decorate$2r([
|
49272 | Bean('sortService')
|
49273 | ], SortService);
|
49274 | return SortService;
|
49275 | }(BeanStub));
|
49276 |
|
49277 | var __extends$2L = (undefined && undefined.__extends) || (function () {
|
49278 | var extendStatics = function (d, b) {
|
49279 | extendStatics = Object.setPrototypeOf ||
|
49280 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
49281 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
49282 | return extendStatics(d, b);
|
49283 | };
|
49284 | return function (d, b) {
|
49285 | extendStatics(d, b);
|
49286 | function __() { this.constructor = d; }
|
49287 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
49288 | };
|
49289 | })();
|
49290 | var __decorate$2s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
49291 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
49292 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
49293 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
49294 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
49295 | };
|
49296 | var FilterService = (function (_super) {
|
49297 | __extends$2L(FilterService, _super);
|
49298 | function FilterService() {
|
49299 | return _super !== null && _super.apply(this, arguments) || this;
|
49300 | }
|
49301 | FilterService.prototype.filter = function (changedPath) {
|
49302 | var filterActive = this.filterManager.isColumnFilterPresent()
|
49303 | || this.filterManager.isQuickFilterPresent()
|
49304 | || this.gridOptionsWrapper.isExternalFilterPresent();
|
49305 | this.filterNodes(filterActive, changedPath);
|
49306 | };
|
49307 | FilterService.prototype.filterNodes = function (filterActive, changedPath) {
|
49308 | var _this = this;
|
49309 | var filterCallback = function (rowNode, includeChildNodes) {
|
49310 |
|
49311 | if (rowNode.hasChildren()) {
|
49312 |
|
49313 | if (filterActive && !includeChildNodes) {
|
49314 | rowNode.childrenAfterFilter = rowNode.childrenAfterGroup.filter(function (childNode) {
|
49315 |
|
49316 |
|
49317 | var passBecauseChildren = childNode.childrenAfterFilter && childNode.childrenAfterFilter.length > 0;
|
49318 |
|
49319 |
|
49320 | var passBecauseDataPasses = childNode.data
|
49321 | && _this.filterManager.doesRowPassFilter({ rowNode: childNode });
|
49322 |
|
49323 | return passBecauseChildren || passBecauseDataPasses;
|
49324 | });
|
49325 | }
|
49326 | else {
|
49327 |
|
49328 | rowNode.childrenAfterFilter = rowNode.childrenAfterGroup;
|
49329 | }
|
49330 | }
|
49331 | else {
|
49332 | rowNode.childrenAfterFilter = rowNode.childrenAfterGroup;
|
49333 | }
|
49334 | if (rowNode.sibling) {
|
49335 | rowNode.sibling.childrenAfterFilter = rowNode.childrenAfterFilter;
|
49336 | }
|
49337 | };
|
49338 | if (this.doingTreeDataFiltering()) {
|
49339 | var treeDataDepthFirstFilter_1 = function (rowNode, alreadyFoundInParent) {
|
49340 |
|
49341 |
|
49342 | if (rowNode.childrenAfterGroup) {
|
49343 | for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) {
|
49344 | var childNode = rowNode.childrenAfterGroup[i];
|
49345 |
|
49346 | var foundInParent = alreadyFoundInParent
|
49347 | || _this.filterManager.doesRowPassFilter({ rowNode: childNode });
|
49348 | if (childNode.childrenAfterGroup) {
|
49349 | treeDataDepthFirstFilter_1(rowNode.childrenAfterGroup[i], foundInParent);
|
49350 | }
|
49351 | else {
|
49352 | filterCallback(childNode, foundInParent);
|
49353 | }
|
49354 | }
|
49355 | }
|
49356 | filterCallback(rowNode, alreadyFoundInParent);
|
49357 | };
|
49358 | var treeDataFilterCallback = function (rowNode) { return treeDataDepthFirstFilter_1(rowNode, false); };
|
49359 | changedPath.executeFromRootNode(treeDataFilterCallback);
|
49360 | }
|
49361 | else {
|
49362 | var defaultFilterCallback = function (rowNode) { return filterCallback(rowNode, false); };
|
49363 | changedPath.forEachChangedNodeDepthFirst(defaultFilterCallback, true);
|
49364 | }
|
49365 | };
|
49366 | FilterService.prototype.doingTreeDataFiltering = function () {
|
49367 | return this.gridOptionsWrapper.isTreeData() && !this.gridOptionsWrapper.isExcludeChildrenWhenTreeDataFiltering();
|
49368 | };
|
49369 | __decorate$2s([
|
49370 | Autowired('filterManager')
|
49371 | ], FilterService.prototype, "filterManager", void 0);
|
49372 | FilterService = __decorate$2s([
|
49373 | Bean("filterService")
|
49374 | ], FilterService);
|
49375 | return FilterService;
|
49376 | }(BeanStub));
|
49377 |
|
49378 | var __extends$2M = (undefined && undefined.__extends) || (function () {
|
49379 | var extendStatics = function (d, b) {
|
49380 | extendStatics = Object.setPrototypeOf ||
|
49381 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
49382 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
49383 | return extendStatics(d, b);
|
49384 | };
|
49385 | return function (d, b) {
|
49386 | extendStatics(d, b);
|
49387 | function __() { this.constructor = d; }
|
49388 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
49389 | };
|
49390 | })();
|
49391 | var __decorate$2t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
49392 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
49393 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
49394 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
49395 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
49396 | };
|
49397 | var __read$j = (undefined && undefined.__read) || function (o, n) {
|
49398 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
49399 | if (!m) return o;
|
49400 | var i = m.call(o), r, ar = [], e;
|
49401 | try {
|
49402 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
49403 | }
|
49404 | catch (error) { e = { error: error }; }
|
49405 | finally {
|
49406 | try {
|
49407 | if (r && !r.done && (m = i["return"])) m.call(i);
|
49408 | }
|
49409 | finally { if (e) throw e.error; }
|
49410 | }
|
49411 | return ar;
|
49412 | };
|
49413 | var ImmutableService = (function (_super) {
|
49414 | __extends$2M(ImmutableService, _super);
|
49415 | function ImmutableService() {
|
49416 | return _super !== null && _super.apply(this, arguments) || this;
|
49417 | }
|
49418 | ImmutableService.prototype.postConstruct = function () {
|
49419 | if (this.rowModel.getType() === Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
|
49420 | this.clientSideRowModel = this.rowModel;
|
49421 | }
|
49422 | };
|
49423 | ImmutableService.prototype.isActive = function () {
|
49424 | return this.gridOptionsWrapper.isImmutableData();
|
49425 | };
|
49426 | ImmutableService.prototype.setRowData = function (rowData) {
|
49427 | var transactionAndMap = this.createTransactionForRowData(rowData);
|
49428 | if (!transactionAndMap) {
|
49429 | return;
|
49430 | }
|
49431 | var _a = __read$j(transactionAndMap, 2), transaction = _a[0], orderIdMap = _a[1];
|
49432 | var nodeTransaction = this.clientSideRowModel.updateRowData(transaction, orderIdMap);
|
49433 |
|
49434 |
|
49435 | if (nodeTransaction) {
|
49436 | this.rowRenderer.refreshFullWidthRows(nodeTransaction.update);
|
49437 | }
|
49438 |
|
49439 | var rowDataChangedEvent = {
|
49440 | type: Events.EVENT_ROW_DATA_CHANGED,
|
49441 | api: this.gridApi,
|
49442 | columnApi: this.columnApi
|
49443 | };
|
49444 | this.eventService.dispatchEvent(rowDataChangedEvent);
|
49445 | };
|
49446 |
|
49447 | ImmutableService.prototype.createTransactionForRowData = function (rowData) {
|
49448 | if (_.missing(this.clientSideRowModel)) {
|
49449 | console.error('AG Grid: ImmutableService only works with ClientSideRowModel');
|
49450 | return;
|
49451 | }
|
49452 | var getRowIdFunc = this.gridOptionsWrapper.getRowIdFunc();
|
49453 | if (getRowIdFunc == null) {
|
49454 | console.error('AG Grid: ImmutableService requires getRowId() callback to be implemented, your row data needs IDs!');
|
49455 | return;
|
49456 | }
|
49457 |
|
49458 | var transaction = {
|
49459 | remove: [],
|
49460 | update: [],
|
49461 | add: []
|
49462 | };
|
49463 | var existingNodesMap = this.clientSideRowModel.getCopyOfNodesMap();
|
49464 | var suppressSortOrder = this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder();
|
49465 | var orderMap = suppressSortOrder ? undefined : {};
|
49466 | if (_.exists(rowData)) {
|
49467 |
|
49468 |
|
49469 |
|
49470 |
|
49471 | rowData.forEach(function (data, index) {
|
49472 | var id = getRowIdFunc({ data: data, level: 0 });
|
49473 | var existingNode = existingNodesMap[id];
|
49474 | if (orderMap) {
|
49475 | orderMap[id] = index;
|
49476 | }
|
49477 | if (existingNode) {
|
49478 | var dataHasChanged = existingNode.data !== data;
|
49479 | if (dataHasChanged) {
|
49480 | transaction.update.push(data);
|
49481 | }
|
49482 |
|
49483 |
|
49484 | existingNodesMap[id] = undefined;
|
49485 | }
|
49486 | else {
|
49487 | transaction.add.push(data);
|
49488 | }
|
49489 | });
|
49490 | }
|
49491 |
|
49492 | _.iterateObject(existingNodesMap, function (id, rowNode) {
|
49493 | if (rowNode) {
|
49494 | transaction.remove.push(rowNode.data);
|
49495 | }
|
49496 | });
|
49497 | return [transaction, orderMap];
|
49498 | };
|
49499 | __decorate$2t([
|
49500 | Autowired('rowModel')
|
49501 | ], ImmutableService.prototype, "rowModel", void 0);
|
49502 | __decorate$2t([
|
49503 | Autowired('rowRenderer')
|
49504 | ], ImmutableService.prototype, "rowRenderer", void 0);
|
49505 | __decorate$2t([
|
49506 | Autowired('columnApi')
|
49507 | ], ImmutableService.prototype, "columnApi", void 0);
|
49508 | __decorate$2t([
|
49509 | Autowired('gridApi')
|
49510 | ], ImmutableService.prototype, "gridApi", void 0);
|
49511 | __decorate$2t([
|
49512 | PostConstruct
|
49513 | ], ImmutableService.prototype, "postConstruct", null);
|
49514 | ImmutableService = __decorate$2t([
|
49515 | Bean('immutableService')
|
49516 | ], ImmutableService);
|
49517 | return ImmutableService;
|
49518 | }(BeanStub));
|
49519 |
|
49520 | var ClientSideRowModelModule = {
|
49521 | moduleName: ModuleNames.ClientSideRowModelModule,
|
49522 | beans: [FilterStage, SortStage, FlattenStage, SortService, FilterService, ImmutableService],
|
49523 | rowModels: { clientSide: ClientSideRowModel }
|
49524 | };
|
49525 |
|
49526 | var __extends$2N = (undefined && undefined.__extends) || (function () {
|
49527 | var extendStatics = function (d, b) {
|
49528 | extendStatics = Object.setPrototypeOf ||
|
49529 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
49530 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
49531 | return extendStatics(d, b);
|
49532 | };
|
49533 | return function (d, b) {
|
49534 | extendStatics(d, b);
|
49535 | function __() { this.constructor = d; }
|
49536 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
49537 | };
|
49538 | })();
|
49539 | var __decorate$2u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
49540 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
49541 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
49542 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
49543 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
49544 | };
|
49545 | var InfiniteBlock = (function (_super) {
|
49546 | __extends$2N(InfiniteBlock, _super);
|
49547 | function InfiniteBlock(id, parentCache, params) {
|
49548 | var _this = _super.call(this, id) || this;
|
49549 | _this.parentCache = parentCache;
|
49550 | _this.params = params;
|
49551 |
|
49552 |
|
49553 | _this.startRow = id * params.blockSize;
|
49554 | _this.endRow = _this.startRow + params.blockSize;
|
49555 | return _this;
|
49556 | }
|
49557 | InfiniteBlock.prototype.postConstruct = function () {
|
49558 | this.createRowNodes();
|
49559 | };
|
49560 | InfiniteBlock.prototype.getBlockStateJson = function () {
|
49561 | return {
|
49562 | id: '' + this.getId(),
|
49563 | state: {
|
49564 | blockNumber: this.getId(),
|
49565 | startRow: this.getStartRow(),
|
49566 | endRow: this.getEndRow(),
|
49567 | pageStatus: this.getState()
|
49568 | }
|
49569 | };
|
49570 | };
|
49571 | InfiniteBlock.prototype.setDataAndId = function (rowNode, data, index) {
|
49572 |
|
49573 |
|
49574 |
|
49575 | if (!rowNode.id && rowNode.alreadyRendered) {
|
49576 | rowNode.alreadyRendered = false;
|
49577 | }
|
49578 | if (_.exists(data)) {
|
49579 |
|
49580 |
|
49581 |
|
49582 |
|
49583 | rowNode.setDataAndId(data, index.toString());
|
49584 | }
|
49585 | else {
|
49586 | rowNode.setDataAndId(undefined, undefined);
|
49587 | }
|
49588 | };
|
49589 | InfiniteBlock.prototype.loadFromDatasource = function () {
|
49590 | var _this = this;
|
49591 | var params = this.createLoadParams();
|
49592 | if (_.missing(this.params.datasource.getRows)) {
|
49593 | console.warn("AG Grid: datasource is missing getRows method");
|
49594 | return;
|
49595 | }
|
49596 |
|
49597 | window.setTimeout(function () {
|
49598 | _this.params.datasource.getRows(params);
|
49599 | }, 0);
|
49600 | };
|
49601 | InfiniteBlock.prototype.processServerFail = function () {
|
49602 |
|
49603 | };
|
49604 | InfiniteBlock.prototype.createLoadParams = function () {
|
49605 |
|
49606 |
|
49607 |
|
49608 |
|
49609 | var params = {
|
49610 | startRow: this.getStartRow(),
|
49611 | endRow: this.getEndRow(),
|
49612 | successCallback: this.pageLoaded.bind(this, this.getVersion()),
|
49613 | failCallback: this.pageLoadFailed.bind(this, this.getVersion()),
|
49614 | sortModel: this.params.sortModel,
|
49615 | filterModel: this.params.filterModel,
|
49616 | context: this.gridOptionsWrapper.getContext()
|
49617 | };
|
49618 | return params;
|
49619 | };
|
49620 | InfiniteBlock.prototype.forEachNode = function (callback, sequence, rowCount) {
|
49621 | var _this = this;
|
49622 | this.rowNodes.forEach(function (rowNode, index) {
|
49623 | var rowIndex = _this.startRow + index;
|
49624 | if (rowIndex < rowCount) {
|
49625 | callback(rowNode, sequence.next());
|
49626 | }
|
49627 | });
|
49628 | };
|
49629 | InfiniteBlock.prototype.getLastAccessed = function () {
|
49630 | return this.lastAccessed;
|
49631 | };
|
49632 | InfiniteBlock.prototype.getRow = function (rowIndex, dontTouchLastAccessed) {
|
49633 | if (dontTouchLastAccessed === void 0) { dontTouchLastAccessed = false; }
|
49634 | if (!dontTouchLastAccessed) {
|
49635 | this.lastAccessed = this.params.lastAccessedSequence.next();
|
49636 | }
|
49637 | var localIndex = rowIndex - this.startRow;
|
49638 | return this.rowNodes[localIndex];
|
49639 | };
|
49640 | InfiniteBlock.prototype.getStartRow = function () {
|
49641 | return this.startRow;
|
49642 | };
|
49643 | InfiniteBlock.prototype.getEndRow = function () {
|
49644 | return this.endRow;
|
49645 | };
|
49646 |
|
49647 | InfiniteBlock.prototype.createRowNodes = function () {
|
49648 | this.rowNodes = [];
|
49649 | for (var i = 0; i < this.params.blockSize; i++) {
|
49650 | var rowIndex = this.startRow + i;
|
49651 | var rowNode = new RowNode(this.beans);
|
49652 | rowNode.setRowHeight(this.params.rowHeight);
|
49653 | rowNode.uiLevel = 0;
|
49654 | rowNode.setRowIndex(rowIndex);
|
49655 | rowNode.setRowTop(this.params.rowHeight * rowIndex);
|
49656 | this.rowNodes.push(rowNode);
|
49657 | }
|
49658 | };
|
49659 | InfiniteBlock.prototype.processServerResult = function (params) {
|
49660 | var _this = this;
|
49661 | this.rowNodes.forEach(function (rowNode, index) {
|
49662 | var data = params.rowData ? params.rowData[index] : undefined;
|
49663 | _this.setDataAndId(rowNode, data, _this.startRow + index);
|
49664 | });
|
49665 | var finalRowCount = params.rowCount != null && params.rowCount >= 0 ? params.rowCount : undefined;
|
49666 | this.parentCache.pageLoaded(this, finalRowCount);
|
49667 | };
|
49668 | InfiniteBlock.prototype.destroyRowNodes = function () {
|
49669 | this.rowNodes.forEach(function (rowNode) {
|
49670 |
|
49671 |
|
49672 | rowNode.clearRowTopAndRowIndex();
|
49673 | });
|
49674 | };
|
49675 | __decorate$2u([
|
49676 | Autowired('beans')
|
49677 | ], InfiniteBlock.prototype, "beans", void 0);
|
49678 | __decorate$2u([
|
49679 | PostConstruct
|
49680 | ], InfiniteBlock.prototype, "postConstruct", null);
|
49681 | __decorate$2u([
|
49682 | PreDestroy
|
49683 | ], InfiniteBlock.prototype, "destroyRowNodes", null);
|
49684 | return InfiniteBlock;
|
49685 | }(RowNodeBlock));
|
49686 |
|
49687 | var __extends$2O = (undefined && undefined.__extends) || (function () {
|
49688 | var extendStatics = function (d, b) {
|
49689 | extendStatics = Object.setPrototypeOf ||
|
49690 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
49691 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
49692 | return extendStatics(d, b);
|
49693 | };
|
49694 | return function (d, b) {
|
49695 | extendStatics(d, b);
|
49696 | function __() { this.constructor = d; }
|
49697 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
49698 | };
|
49699 | })();
|
49700 | var __decorate$2v = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
49701 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
49702 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
49703 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
49704 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
49705 | };
|
49706 | var __param$a = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
49707 | return function (target, key) { decorator(target, key, paramIndex); }
|
49708 | };
|
49709 | var InfiniteCache = (function (_super) {
|
49710 | __extends$2O(InfiniteCache, _super);
|
49711 | function InfiniteCache(params) {
|
49712 | var _this = _super.call(this) || this;
|
49713 | _this.lastRowIndexKnown = false;
|
49714 | _this.blocks = {};
|
49715 | _this.blockCount = 0;
|
49716 | _this.rowCount = params.initialRowCount;
|
49717 | _this.params = params;
|
49718 | return _this;
|
49719 | }
|
49720 | InfiniteCache.prototype.setBeans = function (loggerFactory) {
|
49721 | this.logger = loggerFactory.create('InfiniteCache');
|
49722 | };
|
49723 |
|
49724 |
|
49725 |
|
49726 | InfiniteCache.prototype.getRow = function (rowIndex, dontCreatePage) {
|
49727 | if (dontCreatePage === void 0) { dontCreatePage = false; }
|
49728 | var blockId = Math.floor(rowIndex / this.params.blockSize);
|
49729 | var block = this.blocks[blockId];
|
49730 | if (!block) {
|
49731 | if (dontCreatePage) {
|
49732 | return undefined;
|
49733 | }
|
49734 | block = this.createBlock(blockId);
|
49735 | }
|
49736 | return block.getRow(rowIndex);
|
49737 | };
|
49738 | InfiniteCache.prototype.createBlock = function (blockNumber) {
|
49739 | var newBlock = this.createBean(new InfiniteBlock(blockNumber, this, this.params));
|
49740 | this.blocks[newBlock.getId()] = newBlock;
|
49741 | this.blockCount++;
|
49742 | this.purgeBlocksIfNeeded(newBlock);
|
49743 | this.params.rowNodeBlockLoader.addBlock(newBlock);
|
49744 | return newBlock;
|
49745 | };
|
49746 |
|
49747 |
|
49748 |
|
49749 |
|
49750 | InfiniteCache.prototype.refreshCache = function () {
|
49751 | var nothingToRefresh = this.blockCount == 0;
|
49752 | if (nothingToRefresh) {
|
49753 | this.purgeCache();
|
49754 | return;
|
49755 | }
|
49756 | this.getBlocksInOrder().forEach(function (block) { return block.setStateWaitingToLoad(); });
|
49757 | this.params.rowNodeBlockLoader.checkBlockToLoad();
|
49758 | };
|
49759 | InfiniteCache.prototype.destroyAllBlocks = function () {
|
49760 | var _this = this;
|
49761 | this.getBlocksInOrder().forEach(function (block) { return _this.destroyBlock(block); });
|
49762 | };
|
49763 | InfiniteCache.prototype.getRowCount = function () {
|
49764 | return this.rowCount;
|
49765 | };
|
49766 | InfiniteCache.prototype.isLastRowIndexKnown = function () {
|
49767 | return this.lastRowIndexKnown;
|
49768 | };
|
49769 |
|
49770 | InfiniteCache.prototype.pageLoaded = function (block, lastRow) {
|
49771 |
|
49772 |
|
49773 | if (!this.isAlive()) {
|
49774 | return;
|
49775 | }
|
49776 | this.logger.log("onPageLoaded: page = " + block.getId() + ", lastRow = " + lastRow);
|
49777 | this.checkRowCount(block, lastRow);
|
49778 |
|
49779 |
|
49780 |
|
49781 | this.onCacheUpdated();
|
49782 | };
|
49783 | InfiniteCache.prototype.purgeBlocksIfNeeded = function (blockToExclude) {
|
49784 | var _this = this;
|
49785 |
|
49786 |
|
49787 | var blocksForPurging = this.getBlocksInOrder().filter(function (b) { return b != blockToExclude; });
|
49788 | var lastAccessedComparator = function (a, b) { return b.getLastAccessed() - a.getLastAccessed(); };
|
49789 | blocksForPurging.sort(lastAccessedComparator);
|
49790 |
|
49791 |
|
49792 |
|
49793 | var maxBlocksProvided = this.params.maxBlocksInCache > 0;
|
49794 | var blocksToKeep = maxBlocksProvided ? this.params.maxBlocksInCache - 1 : null;
|
49795 | var emptyBlocksToKeep = InfiniteCache.MAX_EMPTY_BLOCKS_TO_KEEP - 1;
|
49796 | blocksForPurging.forEach(function (block, index) {
|
49797 | var purgeBecauseBlockEmpty = block.getState() === InfiniteBlock.STATE_WAITING_TO_LOAD && index >= emptyBlocksToKeep;
|
49798 | var purgeBecauseCacheFull = maxBlocksProvided ? index >= blocksToKeep : false;
|
49799 | if (purgeBecauseBlockEmpty || purgeBecauseCacheFull) {
|
49800 |
|
49801 |
|
49802 |
|
49803 | if (_this.isBlockCurrentlyDisplayed(block)) {
|
49804 | return;
|
49805 | }
|
49806 |
|
49807 | if (_this.isBlockFocused(block)) {
|
49808 | return;
|
49809 | }
|
49810 |
|
49811 | _this.removeBlockFromCache(block);
|
49812 | }
|
49813 | });
|
49814 | };
|
49815 | InfiniteCache.prototype.isBlockFocused = function (block) {
|
49816 | var focusedCell = this.focusService.getFocusCellToUseAfterRefresh();
|
49817 | if (!focusedCell) {
|
49818 | return false;
|
49819 | }
|
49820 | if (focusedCell.rowPinned != null) {
|
49821 | return false;
|
49822 | }
|
49823 | var blockIndexStart = block.getStartRow();
|
49824 | var blockIndexEnd = block.getEndRow();
|
49825 | var hasFocus = focusedCell.rowIndex >= blockIndexStart && focusedCell.rowIndex < blockIndexEnd;
|
49826 | return hasFocus;
|
49827 | };
|
49828 | InfiniteCache.prototype.isBlockCurrentlyDisplayed = function (block) {
|
49829 | var startIndex = block.getStartRow();
|
49830 | var endIndex = block.getEndRow() - 1;
|
49831 | return this.rowRenderer.isRangeInRenderedViewport(startIndex, endIndex);
|
49832 | };
|
49833 | InfiniteCache.prototype.removeBlockFromCache = function (blockToRemove) {
|
49834 | if (!blockToRemove) {
|
49835 | return;
|
49836 | }
|
49837 | this.destroyBlock(blockToRemove);
|
49838 |
|
49839 |
|
49840 |
|
49841 | };
|
49842 | InfiniteCache.prototype.checkRowCount = function (block, lastRow) {
|
49843 |
|
49844 |
|
49845 | if (typeof lastRow === 'number' && lastRow >= 0) {
|
49846 | this.rowCount = lastRow;
|
49847 | this.lastRowIndexKnown = true;
|
49848 | }
|
49849 | else if (!this.lastRowIndexKnown) {
|
49850 |
|
49851 | var lastRowIndex = (block.getId() + 1) * this.params.blockSize;
|
49852 | var lastRowIndexPlusOverflow = lastRowIndex + this.params.overflowSize;
|
49853 | if (this.rowCount < lastRowIndexPlusOverflow) {
|
49854 | this.rowCount = lastRowIndexPlusOverflow;
|
49855 | }
|
49856 | }
|
49857 | };
|
49858 | InfiniteCache.prototype.setRowCount = function (rowCount, lastRowIndexKnown) {
|
49859 | this.rowCount = rowCount;
|
49860 |
|
49861 |
|
49862 | if (_.exists(lastRowIndexKnown)) {
|
49863 | this.lastRowIndexKnown = lastRowIndexKnown;
|
49864 | }
|
49865 |
|
49866 |
|
49867 |
|
49868 | if (!this.lastRowIndexKnown) {
|
49869 | if (this.rowCount % this.params.blockSize === 0) {
|
49870 | this.rowCount++;
|
49871 | }
|
49872 | }
|
49873 | this.onCacheUpdated();
|
49874 | };
|
49875 | InfiniteCache.prototype.forEachNodeDeep = function (callback) {
|
49876 | var _this = this;
|
49877 | var sequence = new NumberSequence();
|
49878 | this.getBlocksInOrder().forEach(function (block) { return block.forEachNode(callback, sequence, _this.rowCount); });
|
49879 | };
|
49880 | InfiniteCache.prototype.getBlocksInOrder = function () {
|
49881 |
|
49882 | var blockComparator = function (a, b) { return a.getId() - b.getId(); };
|
49883 | var blocks = _.getAllValuesInObject(this.blocks).sort(blockComparator);
|
49884 | return blocks;
|
49885 | };
|
49886 | InfiniteCache.prototype.destroyBlock = function (block) {
|
49887 | delete this.blocks[block.getId()];
|
49888 | this.destroyBean(block);
|
49889 | this.blockCount--;
|
49890 | this.params.rowNodeBlockLoader.removeBlock(block);
|
49891 | };
|
49892 |
|
49893 | InfiniteCache.prototype.onCacheUpdated = function () {
|
49894 | if (this.isAlive()) {
|
49895 |
|
49896 |
|
49897 |
|
49898 |
|
49899 | this.destroyAllBlocksPastVirtualRowCount();
|
49900 |
|
49901 |
|
49902 | var event_1 = {
|
49903 | type: Events.EVENT_STORE_UPDATED
|
49904 | };
|
49905 | this.eventService.dispatchEvent(event_1);
|
49906 | }
|
49907 | };
|
49908 | InfiniteCache.prototype.destroyAllBlocksPastVirtualRowCount = function () {
|
49909 | var _this = this;
|
49910 | var blocksToDestroy = [];
|
49911 | this.getBlocksInOrder().forEach(function (block) {
|
49912 | var startRow = block.getId() * _this.params.blockSize;
|
49913 | if (startRow >= _this.rowCount) {
|
49914 | blocksToDestroy.push(block);
|
49915 | }
|
49916 | });
|
49917 | if (blocksToDestroy.length > 0) {
|
49918 | blocksToDestroy.forEach(function (block) { return _this.destroyBlock(block); });
|
49919 | }
|
49920 | };
|
49921 | InfiniteCache.prototype.purgeCache = function () {
|
49922 | var _this = this;
|
49923 | this.getBlocksInOrder().forEach(function (block) { return _this.removeBlockFromCache(block); });
|
49924 | this.lastRowIndexKnown = false;
|
49925 |
|
49926 |
|
49927 |
|
49928 |
|
49929 | if (this.rowCount === 0) {
|
49930 | this.rowCount = this.params.initialRowCount;
|
49931 | }
|
49932 | this.onCacheUpdated();
|
49933 | };
|
49934 | InfiniteCache.prototype.getRowNodesInRange = function (firstInRange, lastInRange) {
|
49935 | var _this = this;
|
49936 | var result = [];
|
49937 | var lastBlockId = -1;
|
49938 | var inActiveRange = false;
|
49939 | var numberSequence = new NumberSequence();
|
49940 |
|
49941 | if (_.missing(firstInRange)) {
|
49942 | inActiveRange = true;
|
49943 | }
|
49944 | var foundGapInSelection = false;
|
49945 | this.getBlocksInOrder().forEach(function (block) {
|
49946 | if (foundGapInSelection) {
|
49947 | return;
|
49948 | }
|
49949 | if (inActiveRange && (lastBlockId + 1 !== block.getId())) {
|
49950 | foundGapInSelection = true;
|
49951 | return;
|
49952 | }
|
49953 | lastBlockId = block.getId();
|
49954 | block.forEachNode(function (rowNode) {
|
49955 | var hitFirstOrLast = rowNode === firstInRange || rowNode === lastInRange;
|
49956 | if (inActiveRange || hitFirstOrLast) {
|
49957 | result.push(rowNode);
|
49958 | }
|
49959 | if (hitFirstOrLast) {
|
49960 | inActiveRange = !inActiveRange;
|
49961 | }
|
49962 | }, numberSequence, _this.rowCount);
|
49963 | });
|
49964 |
|
49965 | var invalidRange = foundGapInSelection || inActiveRange;
|
49966 | return invalidRange ? [] : result;
|
49967 | };
|
49968 |
|
49969 |
|
49970 |
|
49971 | InfiniteCache.MAX_EMPTY_BLOCKS_TO_KEEP = 2;
|
49972 | __decorate$2v([
|
49973 | Autowired('rowRenderer')
|
49974 | ], InfiniteCache.prototype, "rowRenderer", void 0);
|
49975 | __decorate$2v([
|
49976 | Autowired("focusService")
|
49977 | ], InfiniteCache.prototype, "focusService", void 0);
|
49978 | __decorate$2v([
|
49979 | __param$a(0, Qualifier('loggerFactory'))
|
49980 | ], InfiniteCache.prototype, "setBeans", null);
|
49981 | __decorate$2v([
|
49982 | PreDestroy
|
49983 | ], InfiniteCache.prototype, "destroyAllBlocks", null);
|
49984 | return InfiniteCache;
|
49985 | }(BeanStub));
|
49986 |
|
49987 | var __extends$2P = (undefined && undefined.__extends) || (function () {
|
49988 | var extendStatics = function (d, b) {
|
49989 | extendStatics = Object.setPrototypeOf ||
|
49990 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
49991 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
49992 | return extendStatics(d, b);
|
49993 | };
|
49994 | return function (d, b) {
|
49995 | extendStatics(d, b);
|
49996 | function __() { this.constructor = d; }
|
49997 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
49998 | };
|
49999 | })();
|
50000 | var __decorate$2w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
50001 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
50002 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
50003 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
50004 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
50005 | };
|
50006 | var InfiniteRowModel = (function (_super) {
|
50007 | __extends$2P(InfiniteRowModel, _super);
|
50008 | function InfiniteRowModel() {
|
50009 | return _super !== null && _super.apply(this, arguments) || this;
|
50010 | }
|
50011 | InfiniteRowModel.prototype.getRowBounds = function (index) {
|
50012 | return {
|
50013 | rowHeight: this.rowHeight,
|
50014 | rowTop: this.rowHeight * index
|
50015 | };
|
50016 | };
|
50017 |
|
50018 | InfiniteRowModel.prototype.ensureRowHeightsValid = function (startPixel, endPixel, startLimitIndex, endLimitIndex) {
|
50019 | return false;
|
50020 | };
|
50021 | InfiniteRowModel.prototype.init = function () {
|
50022 | var _this = this;
|
50023 | if (!this.gridOptionsWrapper.isRowModelInfinite()) {
|
50024 | return;
|
50025 | }
|
50026 | this.rowHeight = this.gridOptionsWrapper.getRowHeightAsNumber();
|
50027 | this.addEventListeners();
|
50028 | this.addDestroyFunc(function () { return _this.destroyCache(); });
|
50029 | this.verifyProps();
|
50030 | };
|
50031 | InfiniteRowModel.prototype.verifyProps = function () {
|
50032 | if (this.gridOptionsWrapper.getInitialGroupOrderComparator() != null) {
|
50033 | 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.";
|
50034 | _.doOnce(function () { return console.warn(message_1); }, 'IRM.InitialGroupOrderComparator');
|
50035 | }
|
50036 | };
|
50037 | InfiniteRowModel.prototype.start = function () {
|
50038 | this.setDatasource(this.gridOptionsWrapper.getDatasource());
|
50039 | };
|
50040 | InfiniteRowModel.prototype.destroyDatasource = function () {
|
50041 | if (this.datasource) {
|
50042 | this.getContext().destroyBean(this.datasource);
|
50043 | this.rowRenderer.datasourceChanged();
|
50044 | this.datasource = null;
|
50045 | }
|
50046 | };
|
50047 | InfiniteRowModel.prototype.addEventListeners = function () {
|
50048 | this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
|
50049 | this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
|
50050 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onColumnEverything.bind(this));
|
50051 | this.addManagedListener(this.eventService, Events.EVENT_STORE_UPDATED, this.onCacheUpdated.bind(this));
|
50052 | };
|
50053 | InfiniteRowModel.prototype.onFilterChanged = function () {
|
50054 | this.reset();
|
50055 | };
|
50056 | InfiniteRowModel.prototype.onSortChanged = function () {
|
50057 | this.reset();
|
50058 | };
|
50059 | InfiniteRowModel.prototype.onColumnEverything = function () {
|
50060 | var resetRequired;
|
50061 |
|
50062 |
|
50063 |
|
50064 | if (this.cacheParams) {
|
50065 | resetRequired = this.isSortModelDifferent();
|
50066 | }
|
50067 | else {
|
50068 |
|
50069 | resetRequired = true;
|
50070 | }
|
50071 | if (resetRequired) {
|
50072 | this.reset();
|
50073 | }
|
50074 | };
|
50075 | InfiniteRowModel.prototype.isSortModelDifferent = function () {
|
50076 | return !_.jsonEquals(this.cacheParams.sortModel, this.sortController.getSortModel());
|
50077 | };
|
50078 | InfiniteRowModel.prototype.getType = function () {
|
50079 | return Constants.ROW_MODEL_TYPE_INFINITE;
|
50080 | };
|
50081 | InfiniteRowModel.prototype.setDatasource = function (datasource) {
|
50082 | this.destroyDatasource();
|
50083 | this.datasource = datasource;
|
50084 |
|
50085 | if (datasource) {
|
50086 | this.reset();
|
50087 | }
|
50088 | };
|
50089 | InfiniteRowModel.prototype.isEmpty = function () {
|
50090 | return !this.infiniteCache;
|
50091 | };
|
50092 | InfiniteRowModel.prototype.isRowsToRender = function () {
|
50093 | return !!this.infiniteCache;
|
50094 | };
|
50095 | InfiniteRowModel.prototype.getNodesInRangeForSelection = function (firstInRange, lastInRange) {
|
50096 | return this.infiniteCache ? this.infiniteCache.getRowNodesInRange(firstInRange, lastInRange) : [];
|
50097 | };
|
50098 | InfiniteRowModel.prototype.reset = function () {
|
50099 |
|
50100 |
|
50101 | if (!this.datasource) {
|
50102 | return;
|
50103 | }
|
50104 |
|
50105 |
|
50106 |
|
50107 | var getRowIdFunc = this.gridOptionsWrapper.getRowIdFunc();
|
50108 | var userGeneratingIds = getRowIdFunc != null;
|
50109 | if (!userGeneratingIds) {
|
50110 | this.selectionService.reset();
|
50111 | }
|
50112 | this.resetCache();
|
50113 | var event = this.createModelUpdatedEvent();
|
50114 | this.eventService.dispatchEvent(event);
|
50115 | };
|
50116 | InfiniteRowModel.prototype.createModelUpdatedEvent = function () {
|
50117 | return {
|
50118 | type: Events.EVENT_MODEL_UPDATED,
|
50119 | api: this.gridApi,
|
50120 | columnApi: this.columnApi,
|
50121 |
|
50122 |
|
50123 | newPage: false,
|
50124 | newData: false,
|
50125 | keepRenderedRows: true,
|
50126 | animate: false
|
50127 | };
|
50128 | };
|
50129 | InfiniteRowModel.prototype.resetCache = function () {
|
50130 |
|
50131 | this.destroyCache();
|
50132 | this.cacheParams = {
|
50133 |
|
50134 | datasource: this.datasource,
|
50135 |
|
50136 | filterModel: this.filterManager.getFilterModel(),
|
50137 | sortModel: this.sortController.getSortModel(),
|
50138 | rowNodeBlockLoader: this.rowNodeBlockLoader,
|
50139 |
|
50140 |
|
50141 |
|
50142 | initialRowCount: this.defaultIfInvalid(this.gridOptionsWrapper.getInfiniteInitialRowCount(), 1),
|
50143 | maxBlocksInCache: this.gridOptionsWrapper.getMaxBlocksInCache(),
|
50144 | rowHeight: this.gridOptionsWrapper.getRowHeightAsNumber(),
|
50145 |
|
50146 |
|
50147 | overflowSize: this.defaultIfInvalid(this.gridOptionsWrapper.getCacheOverflowSize(), 1),
|
50148 |
|
50149 |
|
50150 | blockSize: this.defaultIfInvalid(this.gridOptionsWrapper.getCacheBlockSize(), 100),
|
50151 |
|
50152 |
|
50153 | lastAccessedSequence: new NumberSequence()
|
50154 | };
|
50155 | this.infiniteCache = this.createBean(new InfiniteCache(this.cacheParams));
|
50156 | };
|
50157 | InfiniteRowModel.prototype.defaultIfInvalid = function (value, defaultValue) {
|
50158 | return value > 0 ? value : defaultValue;
|
50159 | };
|
50160 | InfiniteRowModel.prototype.destroyCache = function () {
|
50161 | if (this.infiniteCache) {
|
50162 | this.infiniteCache = this.destroyBean(this.infiniteCache);
|
50163 | }
|
50164 | };
|
50165 | InfiniteRowModel.prototype.onCacheUpdated = function () {
|
50166 | var event = this.createModelUpdatedEvent();
|
50167 | this.eventService.dispatchEvent(event);
|
50168 | };
|
50169 | InfiniteRowModel.prototype.getRow = function (rowIndex) {
|
50170 | if (!this.infiniteCache) {
|
50171 | return undefined;
|
50172 | }
|
50173 | if (rowIndex >= this.infiniteCache.getRowCount()) {
|
50174 | return undefined;
|
50175 | }
|
50176 | return this.infiniteCache.getRow(rowIndex);
|
50177 | };
|
50178 | InfiniteRowModel.prototype.getRowNode = function (id) {
|
50179 | var result;
|
50180 | this.forEachNode(function (rowNode) {
|
50181 | if (rowNode.id === id) {
|
50182 | result = rowNode;
|
50183 | }
|
50184 | });
|
50185 | return result;
|
50186 | };
|
50187 | InfiniteRowModel.prototype.forEachNode = function (callback) {
|
50188 | if (this.infiniteCache) {
|
50189 | this.infiniteCache.forEachNodeDeep(callback);
|
50190 | }
|
50191 | };
|
50192 | InfiniteRowModel.prototype.getTopLevelRowCount = function () {
|
50193 | return this.getRowCount();
|
50194 | };
|
50195 | InfiniteRowModel.prototype.getTopLevelRowDisplayedIndex = function (topLevelIndex) {
|
50196 | return topLevelIndex;
|
50197 | };
|
50198 | InfiniteRowModel.prototype.getRowIndexAtPixel = function (pixel) {
|
50199 | if (this.rowHeight !== 0) {
|
50200 | var rowIndexForPixel = Math.floor(pixel / this.rowHeight);
|
50201 | var lastRowIndex = this.getRowCount() - 1;
|
50202 | if (rowIndexForPixel > lastRowIndex) {
|
50203 | return lastRowIndex;
|
50204 | }
|
50205 | return rowIndexForPixel;
|
50206 | }
|
50207 | return 0;
|
50208 | };
|
50209 | InfiniteRowModel.prototype.getRowCount = function () {
|
50210 | return this.infiniteCache ? this.infiniteCache.getRowCount() : 0;
|
50211 | };
|
50212 | InfiniteRowModel.prototype.isRowPresent = function (rowNode) {
|
50213 | var foundRowNode = this.getRowNode(rowNode.id);
|
50214 | return !!foundRowNode;
|
50215 | };
|
50216 | InfiniteRowModel.prototype.refreshCache = function () {
|
50217 | if (this.infiniteCache) {
|
50218 | this.infiniteCache.refreshCache();
|
50219 | }
|
50220 | };
|
50221 | InfiniteRowModel.prototype.purgeCache = function () {
|
50222 | if (this.infiniteCache) {
|
50223 | this.infiniteCache.purgeCache();
|
50224 | }
|
50225 | };
|
50226 |
|
50227 | InfiniteRowModel.prototype.isLastRowIndexKnown = function () {
|
50228 | if (this.infiniteCache) {
|
50229 | return this.infiniteCache.isLastRowIndexKnown();
|
50230 | }
|
50231 | return false;
|
50232 | };
|
50233 | InfiniteRowModel.prototype.setRowCount = function (rowCount, lastRowIndexKnown) {
|
50234 | if (this.infiniteCache) {
|
50235 | this.infiniteCache.setRowCount(rowCount, lastRowIndexKnown);
|
50236 | }
|
50237 | };
|
50238 | __decorate$2w([
|
50239 | Autowired('filterManager')
|
50240 | ], InfiniteRowModel.prototype, "filterManager", void 0);
|
50241 | __decorate$2w([
|
50242 | Autowired('sortController')
|
50243 | ], InfiniteRowModel.prototype, "sortController", void 0);
|
50244 | __decorate$2w([
|
50245 | Autowired('selectionService')
|
50246 | ], InfiniteRowModel.prototype, "selectionService", void 0);
|
50247 | __decorate$2w([
|
50248 | Autowired('gridApi')
|
50249 | ], InfiniteRowModel.prototype, "gridApi", void 0);
|
50250 | __decorate$2w([
|
50251 | Autowired('columnApi')
|
50252 | ], InfiniteRowModel.prototype, "columnApi", void 0);
|
50253 | __decorate$2w([
|
50254 | Autowired('rowRenderer')
|
50255 | ], InfiniteRowModel.prototype, "rowRenderer", void 0);
|
50256 | __decorate$2w([
|
50257 | Autowired('rowNodeBlockLoader')
|
50258 | ], InfiniteRowModel.prototype, "rowNodeBlockLoader", void 0);
|
50259 | __decorate$2w([
|
50260 | PostConstruct
|
50261 | ], InfiniteRowModel.prototype, "init", null);
|
50262 | __decorate$2w([
|
50263 | PreDestroy
|
50264 | ], InfiniteRowModel.prototype, "destroyDatasource", null);
|
50265 | InfiniteRowModel = __decorate$2w([
|
50266 | Bean('rowModel')
|
50267 | ], InfiniteRowModel);
|
50268 | return InfiniteRowModel;
|
50269 | }(BeanStub));
|
50270 |
|
50271 | var InfiniteRowModelModule = {
|
50272 | moduleName: ModuleNames.InfiniteRowModelModule,
|
50273 | rowModels: { infinite: InfiniteRowModel }
|
50274 | };
|
50275 |
|
50276 | var BaseCreator = (function () {
|
50277 | function BaseCreator() {
|
50278 | }
|
50279 | BaseCreator.prototype.setBeans = function (beans) {
|
50280 | this.beans = beans;
|
50281 | };
|
50282 | BaseCreator.prototype.getFileName = function (fileName) {
|
50283 | var extension = this.getDefaultFileExtension();
|
50284 | if (fileName == null || !fileName.length) {
|
50285 | fileName = this.getDefaultFileName();
|
50286 | }
|
50287 | return fileName.indexOf('.') === -1 ? fileName + "." + extension : fileName;
|
50288 | };
|
50289 | BaseCreator.prototype.getData = function (params) {
|
50290 | var serializingSession = this.createSerializingSession(params);
|
50291 | var data = this.beans.gridSerializer.serialize(serializingSession, params);
|
50292 | return data;
|
50293 | };
|
50294 | return BaseCreator;
|
50295 | }());
|
50296 |
|
50297 | var BaseGridSerializingSession = (function () {
|
50298 | function BaseGridSerializingSession(config) {
|
50299 | this.groupColumns = [];
|
50300 | var columnModel = config.columnModel, valueService = config.valueService, gridOptionsWrapper = config.gridOptionsWrapper, processCellCallback = config.processCellCallback, processHeaderCallback = config.processHeaderCallback, processGroupHeaderCallback = config.processGroupHeaderCallback, processRowGroupCallback = config.processRowGroupCallback;
|
50301 | this.columnModel = columnModel;
|
50302 | this.valueService = valueService;
|
50303 | this.gridOptionsWrapper = gridOptionsWrapper;
|
50304 | this.processCellCallback = processCellCallback;
|
50305 | this.processHeaderCallback = processHeaderCallback;
|
50306 | this.processGroupHeaderCallback = processGroupHeaderCallback;
|
50307 | this.processRowGroupCallback = processRowGroupCallback;
|
50308 | }
|
50309 | BaseGridSerializingSession.prototype.prepare = function (columnsToExport) {
|
50310 | this.groupColumns = columnsToExport.filter(function (col) { return !!col.getColDef().showRowGroup; });
|
50311 | };
|
50312 | BaseGridSerializingSession.prototype.extractHeaderValue = function (column) {
|
50313 | var value = this.getHeaderName(this.processHeaderCallback, column);
|
50314 | return value != null ? value : '';
|
50315 | };
|
50316 | BaseGridSerializingSession.prototype.extractRowCellValue = function (column, index, accumulatedRowIndex, type, node) {
|
50317 |
|
50318 | var groupIndex = this.gridOptionsWrapper.isGroupMultiAutoColumn() ? node.rowGroupIndex : 0;
|
50319 | var renderGroupSummaryCell =
|
50320 |
|
50321 | node && node.group
|
50322 | && (
|
50323 |
|
50324 | index === groupIndex && this.groupColumns.indexOf(column) !== -1
|
50325 |
|
50326 | || (index === 0 && this.gridOptionsWrapper.isGroupUseEntireRow(this.columnModel.isPivotMode())));
|
50327 | var valueForCell;
|
50328 | if (renderGroupSummaryCell) {
|
50329 | valueForCell = this.createValueForGroupNode(node);
|
50330 | }
|
50331 | else {
|
50332 | valueForCell = this.valueService.getValue(column, node);
|
50333 | }
|
50334 | var value = this.processCell(accumulatedRowIndex, node, column, valueForCell, this.processCellCallback, type);
|
50335 | return value != null ? value : '';
|
50336 | };
|
50337 | BaseGridSerializingSession.prototype.getHeaderName = function (callback, column) {
|
50338 | if (callback) {
|
50339 | return callback({
|
50340 | column: column,
|
50341 | api: this.gridOptionsWrapper.getApi(),
|
50342 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
50343 | context: this.gridOptionsWrapper.getContext()
|
50344 | });
|
50345 | }
|
50346 | return this.columnModel.getDisplayNameForColumn(column, 'csv', true);
|
50347 | };
|
50348 | BaseGridSerializingSession.prototype.createValueForGroupNode = function (node) {
|
50349 | if (this.processRowGroupCallback) {
|
50350 | return this.processRowGroupCallback({
|
50351 | node: node,
|
50352 | api: this.gridOptionsWrapper.getApi(),
|
50353 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
50354 | context: this.gridOptionsWrapper.getContext(),
|
50355 | });
|
50356 | }
|
50357 | var keys = [node.key];
|
50358 | if (!this.gridOptionsWrapper.isGroupMultiAutoColumn()) {
|
50359 | while (node.parent) {
|
50360 | node = node.parent;
|
50361 | keys.push(node.key);
|
50362 | }
|
50363 | }
|
50364 | return keys.reverse().join(' -> ');
|
50365 | };
|
50366 | BaseGridSerializingSession.prototype.processCell = function (accumulatedRowIndex, rowNode, column, value, processCellCallback, type) {
|
50367 | if (processCellCallback) {
|
50368 | return processCellCallback({
|
50369 | accumulatedRowIndex: accumulatedRowIndex,
|
50370 | column: column,
|
50371 | node: rowNode,
|
50372 | value: value,
|
50373 | api: this.gridOptionsWrapper.getApi(),
|
50374 | columnApi: this.gridOptionsWrapper.getColumnApi(),
|
50375 | context: this.gridOptionsWrapper.getContext(),
|
50376 | type: type
|
50377 | });
|
50378 | }
|
50379 | return value != null ? value : '';
|
50380 | };
|
50381 | return BaseGridSerializingSession;
|
50382 | }());
|
50383 |
|
50384 | var Downloader = (function () {
|
50385 | function Downloader() {
|
50386 | }
|
50387 | Downloader.download = function (fileName, content) {
|
50388 | var win = document.defaultView || window;
|
50389 | if (!win) {
|
50390 | console.warn('AG Grid: There is no `window` associated with the current `document`');
|
50391 | return;
|
50392 | }
|
50393 | var element = document.createElement('a');
|
50394 |
|
50395 | var url = win.URL.createObjectURL(content);
|
50396 | element.setAttribute('href', url);
|
50397 | element.setAttribute('download', fileName);
|
50398 | element.style.display = 'none';
|
50399 | document.body.appendChild(element);
|
50400 | element.dispatchEvent(new MouseEvent('click', {
|
50401 | bubbles: false,
|
50402 | cancelable: true,
|
50403 | view: win
|
50404 | }));
|
50405 | document.body.removeChild(element);
|
50406 | win.setTimeout(function () {
|
50407 |
|
50408 | win.URL.revokeObjectURL(url);
|
50409 | }, 0);
|
50410 | };
|
50411 | return Downloader;
|
50412 | }());
|
50413 |
|
50414 | var __extends$2Q = (undefined && undefined.__extends) || (function () {
|
50415 | var extendStatics = function (d, b) {
|
50416 | extendStatics = Object.setPrototypeOf ||
|
50417 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
50418 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
50419 | return extendStatics(d, b);
|
50420 | };
|
50421 | return function (d, b) {
|
50422 | extendStatics(d, b);
|
50423 | function __() { this.constructor = d; }
|
50424 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
50425 | };
|
50426 | })();
|
50427 | var LINE_SEPARATOR = '\r\n';
|
50428 | var CsvSerializingSession = (function (_super) {
|
50429 | __extends$2Q(CsvSerializingSession, _super);
|
50430 | function CsvSerializingSession(config) {
|
50431 | var _this = _super.call(this, config) || this;
|
50432 | _this.isFirstLine = true;
|
50433 | _this.result = '';
|
50434 | var suppressQuotes = config.suppressQuotes, columnSeparator = config.columnSeparator;
|
50435 | _this.suppressQuotes = suppressQuotes;
|
50436 | _this.columnSeparator = columnSeparator;
|
50437 | return _this;
|
50438 | }
|
50439 | CsvSerializingSession.prototype.addCustomContent = function (content) {
|
50440 | var _this = this;
|
50441 | if (!content) {
|
50442 | return;
|
50443 | }
|
50444 | if (typeof content === 'string') {
|
50445 | if (!/^\s*\n/.test(content)) {
|
50446 | this.beginNewLine();
|
50447 | }
|
50448 |
|
50449 | content = content.replace(/\r?\n/g, LINE_SEPARATOR);
|
50450 | this.result += content;
|
50451 | }
|
50452 | else {
|
50453 | content.forEach(function (row) {
|
50454 | _this.beginNewLine();
|
50455 | row.forEach(function (cell, index) {
|
50456 | if (index !== 0) {
|
50457 | _this.result += _this.columnSeparator;
|
50458 | }
|
50459 | _this.result += _this.putInQuotes(cell.data.value || '');
|
50460 | if (cell.mergeAcross) {
|
50461 | _this.appendEmptyCells(cell.mergeAcross);
|
50462 | }
|
50463 | });
|
50464 | });
|
50465 | }
|
50466 | };
|
50467 | CsvSerializingSession.prototype.onNewHeaderGroupingRow = function () {
|
50468 | this.beginNewLine();
|
50469 | return {
|
50470 | onColumn: this.onNewHeaderGroupingRowColumn.bind(this)
|
50471 | };
|
50472 | };
|
50473 | CsvSerializingSession.prototype.onNewHeaderGroupingRowColumn = function (header, index, span) {
|
50474 | if (index != 0) {
|
50475 | this.result += this.columnSeparator;
|
50476 | }
|
50477 | this.result += this.putInQuotes(header);
|
50478 | this.appendEmptyCells(span);
|
50479 | };
|
50480 | CsvSerializingSession.prototype.appendEmptyCells = function (count) {
|
50481 | for (var i = 1; i <= count; i++) {
|
50482 | this.result += this.columnSeparator + this.putInQuotes("");
|
50483 | }
|
50484 | };
|
50485 | CsvSerializingSession.prototype.onNewHeaderRow = function () {
|
50486 | this.beginNewLine();
|
50487 | return {
|
50488 | onColumn: this.onNewHeaderRowColumn.bind(this)
|
50489 | };
|
50490 | };
|
50491 | CsvSerializingSession.prototype.onNewHeaderRowColumn = function (column, index) {
|
50492 | if (index != 0) {
|
50493 | this.result += this.columnSeparator;
|
50494 | }
|
50495 | this.result += this.putInQuotes(this.extractHeaderValue(column));
|
50496 | };
|
50497 | CsvSerializingSession.prototype.onNewBodyRow = function () {
|
50498 | this.beginNewLine();
|
50499 | return {
|
50500 | onColumn: this.onNewBodyRowColumn.bind(this)
|
50501 | };
|
50502 | };
|
50503 | CsvSerializingSession.prototype.onNewBodyRowColumn = function (column, index, node) {
|
50504 | if (index != 0) {
|
50505 | this.result += this.columnSeparator;
|
50506 | }
|
50507 | this.result += this.putInQuotes(this.extractRowCellValue(column, index, index, Constants.EXPORT_TYPE_CSV, node));
|
50508 | };
|
50509 | CsvSerializingSession.prototype.putInQuotes = function (value) {
|
50510 | if (this.suppressQuotes) {
|
50511 | return value;
|
50512 | }
|
50513 | if (value === null || value === undefined) {
|
50514 | return '""';
|
50515 | }
|
50516 | var stringValue;
|
50517 | if (typeof value === 'string') {
|
50518 | stringValue = value;
|
50519 | }
|
50520 | else if (typeof value.toString === 'function') {
|
50521 | stringValue = value.toString();
|
50522 | }
|
50523 | else {
|
50524 | console.warn('AG Grid: unknown value type during csv conversion');
|
50525 | stringValue = '';
|
50526 | }
|
50527 |
|
50528 | var valueEscaped = stringValue.replace(/"/g, "\"\"");
|
50529 | return '"' + valueEscaped + '"';
|
50530 | };
|
50531 | CsvSerializingSession.prototype.parse = function () {
|
50532 | return this.result;
|
50533 | };
|
50534 | CsvSerializingSession.prototype.beginNewLine = function () {
|
50535 | if (!this.isFirstLine) {
|
50536 | this.result += LINE_SEPARATOR;
|
50537 | }
|
50538 | this.isFirstLine = false;
|
50539 | };
|
50540 | return CsvSerializingSession;
|
50541 | }(BaseGridSerializingSession));
|
50542 |
|
50543 | var __extends$2R = (undefined && undefined.__extends) || (function () {
|
50544 | var extendStatics = function (d, b) {
|
50545 | extendStatics = Object.setPrototypeOf ||
|
50546 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
50547 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
50548 | return extendStatics(d, b);
|
50549 | };
|
50550 | return function (d, b) {
|
50551 | extendStatics(d, b);
|
50552 | function __() { this.constructor = d; }
|
50553 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
50554 | };
|
50555 | })();
|
50556 | var __decorate$2x = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
50557 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
50558 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
50559 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
50560 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
50561 | };
|
50562 | var CsvCreator = (function (_super) {
|
50563 | __extends$2R(CsvCreator, _super);
|
50564 | function CsvCreator() {
|
50565 | return _super !== null && _super.apply(this, arguments) || this;
|
50566 | }
|
50567 | CsvCreator.prototype.postConstruct = function () {
|
50568 | this.setBeans({
|
50569 | gridSerializer: this.gridSerializer,
|
50570 | gridOptionsWrapper: this.gridOptionsWrapper
|
50571 | });
|
50572 | };
|
50573 | CsvCreator.prototype.getMergedParams = function (params) {
|
50574 | var baseParams = this.gridOptionsWrapper.getDefaultExportParams('csv');
|
50575 | return Object.assign({}, baseParams, params);
|
50576 | };
|
50577 | CsvCreator.prototype.export = function (userParams) {
|
50578 | if (this.isExportSuppressed()) {
|
50579 | console.warn("AG Grid: Export cancelled. Export is not allowed as per your configuration.");
|
50580 | return '';
|
50581 | }
|
50582 | var mergedParams = this.getMergedParams(userParams);
|
50583 | var data = this.getData(mergedParams);
|
50584 | var packagedFile = new Blob(["\ufeff", data], { type: 'text/plain' });
|
50585 | Downloader.download(this.getFileName(mergedParams.fileName), packagedFile);
|
50586 | return data;
|
50587 | };
|
50588 | CsvCreator.prototype.exportDataAsCsv = function (params) {
|
50589 | return this.export(params);
|
50590 | };
|
50591 | CsvCreator.prototype.getDataAsCsv = function (params) {
|
50592 | var mergedParams = this.getMergedParams(params);
|
50593 | return this.getData(mergedParams);
|
50594 | };
|
50595 | CsvCreator.prototype.getDefaultFileName = function () {
|
50596 | return 'export.csv';
|
50597 | };
|
50598 | CsvCreator.prototype.getDefaultFileExtension = function () {
|
50599 | return 'csv';
|
50600 | };
|
50601 | CsvCreator.prototype.createSerializingSession = function (params) {
|
50602 | var _a = this, columnModel = _a.columnModel, valueService = _a.valueService, gridOptionsWrapper = _a.gridOptionsWrapper;
|
50603 | var _b = params, processCellCallback = _b.processCellCallback, processHeaderCallback = _b.processHeaderCallback, processGroupHeaderCallback = _b.processGroupHeaderCallback, processRowGroupCallback = _b.processRowGroupCallback, suppressQuotes = _b.suppressQuotes, columnSeparator = _b.columnSeparator;
|
50604 | return new CsvSerializingSession({
|
50605 | columnModel: columnModel,
|
50606 | valueService: valueService,
|
50607 | gridOptionsWrapper: gridOptionsWrapper,
|
50608 | processCellCallback: processCellCallback || undefined,
|
50609 | processHeaderCallback: processHeaderCallback || undefined,
|
50610 | processGroupHeaderCallback: processGroupHeaderCallback || undefined,
|
50611 | processRowGroupCallback: processRowGroupCallback || undefined,
|
50612 | suppressQuotes: suppressQuotes || false,
|
50613 | columnSeparator: columnSeparator || ','
|
50614 | });
|
50615 | };
|
50616 | CsvCreator.prototype.isExportSuppressed = function () {
|
50617 | return this.gridOptionsWrapper.isSuppressCsvExport();
|
50618 | };
|
50619 | __decorate$2x([
|
50620 | Autowired('columnModel')
|
50621 | ], CsvCreator.prototype, "columnModel", void 0);
|
50622 | __decorate$2x([
|
50623 | Autowired('valueService')
|
50624 | ], CsvCreator.prototype, "valueService", void 0);
|
50625 | __decorate$2x([
|
50626 | Autowired('gridSerializer')
|
50627 | ], CsvCreator.prototype, "gridSerializer", void 0);
|
50628 | __decorate$2x([
|
50629 | Autowired('gridOptionsWrapper')
|
50630 | ], CsvCreator.prototype, "gridOptionsWrapper", void 0);
|
50631 | __decorate$2x([
|
50632 | PostConstruct
|
50633 | ], CsvCreator.prototype, "postConstruct", null);
|
50634 | CsvCreator = __decorate$2x([
|
50635 | Bean('csvCreator')
|
50636 | ], CsvCreator);
|
50637 | return CsvCreator;
|
50638 | }(BaseCreator));
|
50639 |
|
50640 | var __extends$2S = (undefined && undefined.__extends) || (function () {
|
50641 | var extendStatics = function (d, b) {
|
50642 | extendStatics = Object.setPrototypeOf ||
|
50643 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
50644 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
50645 | return extendStatics(d, b);
|
50646 | };
|
50647 | return function (d, b) {
|
50648 | extendStatics(d, b);
|
50649 | function __() { this.constructor = d; }
|
50650 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
50651 | };
|
50652 | })();
|
50653 | var __decorate$2y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
50654 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
50655 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
50656 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
50657 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
50658 | };
|
50659 | var RowType$1;
|
50660 | (function (RowType) {
|
50661 | RowType[RowType["HEADER_GROUPING"] = 0] = "HEADER_GROUPING";
|
50662 | RowType[RowType["HEADER"] = 1] = "HEADER";
|
50663 | RowType[RowType["BODY"] = 2] = "BODY";
|
50664 | })(RowType$1 || (RowType$1 = {}));
|
50665 | var GridSerializer = (function (_super) {
|
50666 | __extends$2S(GridSerializer, _super);
|
50667 | function GridSerializer() {
|
50668 | return _super !== null && _super.apply(this, arguments) || this;
|
50669 | }
|
50670 | GridSerializer.prototype.serialize = function (gridSerializingSession, params) {
|
50671 | if (params === void 0) { params = {}; }
|
50672 | var columnsToExport = this.getColumnsToExport(params.allColumns, params.columnKeys);
|
50673 | var serializeChain = _.compose(
|
50674 |
|
50675 | 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));
|
50676 | return serializeChain(gridSerializingSession).parse();
|
50677 | };
|
50678 | GridSerializer.prototype.processRow = function (gridSerializingSession, params, columnsToExport, node) {
|
50679 | var _this = this;
|
50680 | var rowSkipper = params.shouldRowBeSkipped || (function () { return false; });
|
50681 | var gridOptionsWrapper = this.gridOptionsWrapper;
|
50682 | var context = gridOptionsWrapper.getContext();
|
50683 | var api = gridOptionsWrapper.getApi();
|
50684 | var columnApi = gridOptionsWrapper.getColumnApi();
|
50685 | var skipSingleChildrenGroup = gridOptionsWrapper.isGroupRemoveSingleChildren();
|
50686 | var hideOpenParents = gridOptionsWrapper.isGroupHideOpenParents();
|
50687 | var skipLowestSingleChildrenGroup = gridOptionsWrapper.isGroupRemoveLowestSingleChildren();
|
50688 | var isLeafNode = this.columnModel.isPivotMode() ? node.leafGroup : !node.group;
|
50689 | var skipRowGroups = params.skipGroups || params.skipRowGroups;
|
50690 | var shouldSkipLowestGroup = skipLowestSingleChildrenGroup && node.leafGroup;
|
50691 | var shouldSkipCurrentGroup = node.allChildrenCount === 1 && (skipSingleChildrenGroup || shouldSkipLowestGroup);
|
50692 | if (skipRowGroups && params.skipGroups) {
|
50693 | _.doOnce(function () { return console.warn('AG Grid: Since v25.2 `skipGroups` has been renamed to `skipRowGroups`.'); }, 'gridSerializer-skipGroups');
|
50694 | }
|
50695 | var rowPosition = { rowIndex: node.rowIndex, rowPinned: node.rowPinned };
|
50696 | if ((!isLeafNode && (params.skipRowGroups || shouldSkipCurrentGroup || hideOpenParents)) ||
|
50697 | (params.onlySelected && !node.isSelected()) ||
|
50698 | (params.rowNodes && !params.rowNodes.some(function (position) { return _this.rowPositionUtils.sameRow(position, rowPosition); })) ||
|
50699 | (params.skipPinnedTop && node.rowPinned === 'top') ||
|
50700 | (params.skipPinnedBottom && node.rowPinned === 'bottom')) {
|
50701 | return;
|
50702 | }
|
50703 |
|
50704 |
|
50705 | var nodeIsRootNode = node.level === -1;
|
50706 | if (nodeIsRootNode && !node.leafGroup) {
|
50707 | return;
|
50708 | }
|
50709 | var shouldRowBeSkipped = rowSkipper({ node: node, api: api, columnApi: columnApi, context: context });
|
50710 | if (shouldRowBeSkipped) {
|
50711 | return;
|
50712 | }
|
50713 | var rowAccumulator = gridSerializingSession.onNewBodyRow();
|
50714 | columnsToExport.forEach(function (column, index) {
|
50715 | rowAccumulator.onColumn(column, index, node);
|
50716 | });
|
50717 | if (params.getCustomContentBelowRow) {
|
50718 | var content = params.getCustomContentBelowRow({ node: node, api: api, columnApi: columnApi, context: context });
|
50719 | if (content) {
|
50720 | gridSerializingSession.addCustomContent(content);
|
50721 | }
|
50722 | }
|
50723 | };
|
50724 | GridSerializer.prototype.appendContent = function (params) {
|
50725 | return function (gridSerializingSession) {
|
50726 | var appendContent = params.customFooter || params.appendContent;
|
50727 | if (appendContent) {
|
50728 | if (params.customFooter) {
|
50729 | _.doOnce(function () { return console.warn('AG Grid: Since version 25.2.0 the `customFooter` param has been deprecated. Use `appendContent` instead.'); }, 'gridSerializer-customFooter');
|
50730 | }
|
50731 | gridSerializingSession.addCustomContent(appendContent);
|
50732 | }
|
50733 | return gridSerializingSession;
|
50734 | };
|
50735 | };
|
50736 | GridSerializer.prototype.prependContent = function (params) {
|
50737 | return function (gridSerializingSession) {
|
50738 | var prependContent = params.customHeader || params.prependContent;
|
50739 | if (prependContent) {
|
50740 | if (params.customHeader) {
|
50741 | _.doOnce(function () { return console.warn('AG Grid: Since version 25.2.0 the `customHeader` param has been deprecated. Use `prependContent` instead.'); }, 'gridSerializer-customHeader');
|
50742 | }
|
50743 | gridSerializingSession.addCustomContent(prependContent);
|
50744 | }
|
50745 | return gridSerializingSession;
|
50746 | };
|
50747 | };
|
50748 | GridSerializer.prototype.prepareSession = function (columnsToExport) {
|
50749 | return function (gridSerializingSession) {
|
50750 | gridSerializingSession.prepare(columnsToExport);
|
50751 | return gridSerializingSession;
|
50752 | };
|
50753 | };
|
50754 | GridSerializer.prototype.exportColumnGroups = function (params, columnsToExport) {
|
50755 | var _this = this;
|
50756 | return function (gridSerializingSession) {
|
50757 | if (!params.skipColumnGroupHeaders) {
|
50758 | var groupInstanceIdCreator = new GroupInstanceIdCreator();
|
50759 | var displayedGroups = _this.displayedGroupCreator.createDisplayedGroups(columnsToExport, _this.columnModel.getGridBalancedTree(), groupInstanceIdCreator, null);
|
50760 | _this.recursivelyAddHeaderGroups(displayedGroups, gridSerializingSession, params.processGroupHeaderCallback);
|
50761 | }
|
50762 | else if (params.columnGroups) {
|
50763 | _.doOnce(function () { return console.warn('AG Grid: Since v25.2 the `columnGroups` param has deprecated, and groups are exported by default.'); }, 'gridSerializer-columnGroups');
|
50764 | }
|
50765 | return gridSerializingSession;
|
50766 | };
|
50767 | };
|
50768 | GridSerializer.prototype.exportHeaders = function (params, columnsToExport) {
|
50769 | return function (gridSerializingSession) {
|
50770 | if (!params.skipHeader && !params.skipColumnHeaders) {
|
50771 | var gridRowIterator_1 = gridSerializingSession.onNewHeaderRow();
|
50772 | columnsToExport.forEach(function (column, index) {
|
50773 | gridRowIterator_1.onColumn(column, index, undefined);
|
50774 | });
|
50775 | }
|
50776 | else if (params.skipHeader) {
|
50777 | _.doOnce(function () { return console.warn('AG Grid: Since v25.2 the `skipHeader` param has been renamed to `skipColumnHeaders`.'); }, 'gridSerializer-skipHeader');
|
50778 | }
|
50779 | return gridSerializingSession;
|
50780 | };
|
50781 | };
|
50782 | GridSerializer.prototype.processPinnedTopRows = function (params, columnsToExport) {
|
50783 | var _this = this;
|
50784 | return function (gridSerializingSession) {
|
50785 | var processRow = _this.processRow.bind(_this, gridSerializingSession, params, columnsToExport);
|
50786 | _this.pinnedRowModel.forEachPinnedTopRow(processRow);
|
50787 | return gridSerializingSession;
|
50788 | };
|
50789 | };
|
50790 | GridSerializer.prototype.processRows = function (params, columnsToExport) {
|
50791 | var _this = this;
|
50792 | return function (gridSerializingSession) {
|
50793 |
|
50794 | var rowModel = _this.rowModel;
|
50795 | var rowModelType = rowModel.getType();
|
50796 | var usingCsrm = rowModelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
|
50797 | var usingSsrm = rowModelType === Constants.ROW_MODEL_TYPE_SERVER_SIDE;
|
50798 | var onlySelectedNonStandardModel = !usingCsrm && params.onlySelected;
|
50799 | var processRow = _this.processRow.bind(_this, gridSerializingSession, params, columnsToExport);
|
50800 | if (_this.columnModel.isPivotMode()) {
|
50801 | if (usingCsrm) {
|
50802 | rowModel.forEachPivotNode(processRow);
|
50803 | }
|
50804 | else {
|
50805 |
|
50806 | rowModel.forEachNode(processRow);
|
50807 | }
|
50808 | }
|
50809 | else {
|
50810 |
|
50811 |
|
50812 |
|
50813 |
|
50814 |
|
50815 | if (params.onlySelectedAllPages || onlySelectedNonStandardModel) {
|
50816 | var selectedNodes = _this.selectionService.getSelectedNodes();
|
50817 | selectedNodes.forEach(processRow);
|
50818 | }
|
50819 | else {
|
50820 |
|
50821 |
|
50822 |
|
50823 | if (usingCsrm) {
|
50824 | rowModel.forEachNodeAfterFilterAndSort(processRow);
|
50825 | }
|
50826 | else if (usingSsrm) {
|
50827 | rowModel.forEachNodeAfterFilterAndSort(processRow);
|
50828 | }
|
50829 | else {
|
50830 | rowModel.forEachNode(processRow);
|
50831 | }
|
50832 | }
|
50833 | }
|
50834 | return gridSerializingSession;
|
50835 | };
|
50836 | };
|
50837 | GridSerializer.prototype.processPinnedBottomRows = function (params, columnsToExport) {
|
50838 | var _this = this;
|
50839 | return function (gridSerializingSession) {
|
50840 | var processRow = _this.processRow.bind(_this, gridSerializingSession, params, columnsToExport);
|
50841 | _this.pinnedRowModel.forEachPinnedBottomRow(processRow);
|
50842 | return gridSerializingSession;
|
50843 | };
|
50844 | };
|
50845 | GridSerializer.prototype.getColumnsToExport = function (allColumns, columnKeys) {
|
50846 | if (allColumns === void 0) { allColumns = false; }
|
50847 | var isPivotMode = this.columnModel.isPivotMode();
|
50848 | if (columnKeys && columnKeys.length) {
|
50849 | return this.columnModel.getGridColumns(columnKeys);
|
50850 | }
|
50851 | if (allColumns && !isPivotMode) {
|
50852 |
|
50853 | var columns = this.gridOptionsWrapper.isTreeData()
|
50854 | ? this.columnModel.getGridColumns([Constants.GROUP_AUTO_COLUMN_ID])
|
50855 | : [];
|
50856 | return columns.concat(this.columnModel.getAllPrimaryColumns() || []);
|
50857 | }
|
50858 | return this.columnModel.getAllDisplayedColumns();
|
50859 | };
|
50860 | GridSerializer.prototype.recursivelyAddHeaderGroups = function (displayedGroups, gridSerializingSession, processGroupHeaderCallback) {
|
50861 | var directChildrenHeaderGroups = [];
|
50862 | displayedGroups.forEach(function (columnGroupChild) {
|
50863 | var columnGroup = columnGroupChild;
|
50864 | if (!columnGroup.getChildren) {
|
50865 | return;
|
50866 | }
|
50867 | columnGroup.getChildren().forEach(function (it) { return directChildrenHeaderGroups.push(it); });
|
50868 | });
|
50869 | if (displayedGroups.length > 0 && displayedGroups[0] instanceof ColumnGroup) {
|
50870 | this.doAddHeaderHeader(gridSerializingSession, displayedGroups, processGroupHeaderCallback);
|
50871 | }
|
50872 | if (directChildrenHeaderGroups && directChildrenHeaderGroups.length > 0) {
|
50873 | this.recursivelyAddHeaderGroups(directChildrenHeaderGroups, gridSerializingSession, processGroupHeaderCallback);
|
50874 | }
|
50875 | };
|
50876 | GridSerializer.prototype.doAddHeaderHeader = function (gridSerializingSession, displayedGroups, processGroupHeaderCallback) {
|
50877 | var _this = this;
|
50878 | var gridRowIterator = gridSerializingSession.onNewHeaderGroupingRow();
|
50879 | var columnIndex = 0;
|
50880 | displayedGroups.forEach(function (columnGroupChild) {
|
50881 | var columnGroup = columnGroupChild;
|
50882 | var name;
|
50883 | if (processGroupHeaderCallback) {
|
50884 | name = processGroupHeaderCallback({
|
50885 | columnGroup: columnGroup,
|
50886 | api: _this.gridOptionsWrapper.getApi(),
|
50887 | columnApi: _this.gridOptionsWrapper.getColumnApi(),
|
50888 | context: _this.gridOptionsWrapper.getContext()
|
50889 | });
|
50890 | }
|
50891 | else {
|
50892 | name = _this.columnModel.getDisplayNameForColumnGroup(columnGroup, 'header');
|
50893 | }
|
50894 | var collapsibleGroupRanges = columnGroup.getLeafColumns().reduce(function (collapsibleGroups, currentColumn, currentIdx, arr) {
|
50895 | var lastGroup = _.last(collapsibleGroups);
|
50896 | var groupShow = currentColumn.getColumnGroupShow() === 'open';
|
50897 | if (!groupShow) {
|
50898 | if (lastGroup && lastGroup[1] == null) {
|
50899 | lastGroup[1] = currentIdx - 1;
|
50900 | }
|
50901 | }
|
50902 | else if (!lastGroup || lastGroup[1] != null) {
|
50903 | lastGroup = [currentIdx];
|
50904 | collapsibleGroups.push(lastGroup);
|
50905 | }
|
50906 | if (currentIdx === arr.length - 1 && lastGroup && lastGroup[1] == null) {
|
50907 | lastGroup[1] = currentIdx;
|
50908 | }
|
50909 | return collapsibleGroups;
|
50910 | }, []);
|
50911 | gridRowIterator.onColumn(name || '', columnIndex++, columnGroup.getLeafColumns().length - 1, collapsibleGroupRanges);
|
50912 | });
|
50913 | };
|
50914 | __decorate$2y([
|
50915 | Autowired('displayedGroupCreator')
|
50916 | ], GridSerializer.prototype, "displayedGroupCreator", void 0);
|
50917 | __decorate$2y([
|
50918 | Autowired('columnModel')
|
50919 | ], GridSerializer.prototype, "columnModel", void 0);
|
50920 | __decorate$2y([
|
50921 | Autowired('rowModel')
|
50922 | ], GridSerializer.prototype, "rowModel", void 0);
|
50923 | __decorate$2y([
|
50924 | Autowired('pinnedRowModel')
|
50925 | ], GridSerializer.prototype, "pinnedRowModel", void 0);
|
50926 | __decorate$2y([
|
50927 | Autowired('selectionService')
|
50928 | ], GridSerializer.prototype, "selectionService", void 0);
|
50929 | __decorate$2y([
|
50930 | Autowired('rowPositionUtils')
|
50931 | ], GridSerializer.prototype, "rowPositionUtils", void 0);
|
50932 | GridSerializer = __decorate$2y([
|
50933 | Bean("gridSerializer")
|
50934 | ], GridSerializer);
|
50935 | return GridSerializer;
|
50936 | }(BeanStub));
|
50937 |
|
50938 | var CsvExportModule = {
|
50939 | moduleName: ModuleNames.CsvExportModule,
|
50940 | beans: [CsvCreator, GridSerializer]
|
50941 | };
|
50942 |
|
50943 | var LINE_SEPARATOR$1 = '\r\n';
|
50944 | var XmlFactory = (function () {
|
50945 | function XmlFactory() {
|
50946 | }
|
50947 | XmlFactory.createHeader = function (headerElement) {
|
50948 | if (headerElement === void 0) { headerElement = {}; }
|
50949 | var headerStart = '<?';
|
50950 | var headerEnd = '?>';
|
50951 | var keys = ['version'];
|
50952 | if (!headerElement.version) {
|
50953 | headerElement.version = "1.0";
|
50954 | }
|
50955 | if (headerElement.encoding) {
|
50956 | keys.push('encoding');
|
50957 | }
|
50958 | if (headerElement.standalone) {
|
50959 | keys.push('standalone');
|
50960 | }
|
50961 | var att = keys.map(function (key) { return key + "=\"" + headerElement[key] + "\""; }).join(' ');
|
50962 | return headerStart + "xml " + att + " " + headerEnd;
|
50963 | };
|
50964 | XmlFactory.createXml = function (xmlElement, booleanTransformer) {
|
50965 | var _this = this;
|
50966 | var props = '';
|
50967 | if (xmlElement.properties) {
|
50968 | if (xmlElement.properties.prefixedAttributes) {
|
50969 | xmlElement.properties.prefixedAttributes.forEach(function (prefixedSet) {
|
50970 | Object.keys(prefixedSet.map).forEach(function (key) {
|
50971 | props += _this.returnAttributeIfPopulated(prefixedSet.prefix + key, prefixedSet.map[key], booleanTransformer);
|
50972 | });
|
50973 | });
|
50974 | }
|
50975 | if (xmlElement.properties.rawMap) {
|
50976 | Object.keys(xmlElement.properties.rawMap).forEach(function (key) {
|
50977 | props += _this.returnAttributeIfPopulated(key, xmlElement.properties.rawMap[key], booleanTransformer);
|
50978 | });
|
50979 | }
|
50980 | }
|
50981 | var result = '<' + xmlElement.name + props;
|
50982 | if (!xmlElement.children && xmlElement.textNode == null) {
|
50983 | return result + '/>' + LINE_SEPARATOR$1;
|
50984 | }
|
50985 | if (xmlElement.textNode != null) {
|
50986 | return result + '>' + xmlElement.textNode + '</' + xmlElement.name + '>' + LINE_SEPARATOR$1;
|
50987 | }
|
50988 | result += '>' + LINE_SEPARATOR$1;
|
50989 | if (xmlElement.children) {
|
50990 | xmlElement.children.forEach(function (it) {
|
50991 | result += _this.createXml(it, booleanTransformer);
|
50992 | });
|
50993 | }
|
50994 | return result + '</' + xmlElement.name + '>' + LINE_SEPARATOR$1;
|
50995 | };
|
50996 | XmlFactory.returnAttributeIfPopulated = function (key, value, booleanTransformer) {
|
50997 | if (!value && value !== '' && value !== 0) {
|
50998 | return '';
|
50999 | }
|
51000 | var xmlValue = value;
|
51001 | if ((typeof (value) === 'boolean')) {
|
51002 | if (booleanTransformer) {
|
51003 | xmlValue = booleanTransformer(value);
|
51004 | }
|
51005 | }
|
51006 | return " " + key + "=\"" + xmlValue + "\"";
|
51007 | };
|
51008 | return XmlFactory;
|
51009 | }());
|
51010 |
|
51011 | var __values$3 = (undefined && undefined.__values) || function(o) {
|
51012 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
51013 | if (m) return m.call(o);
|
51014 | if (o && typeof o.length === "number") return {
|
51015 | next: function () {
|
51016 | if (o && i >= o.length) o = void 0;
|
51017 | return { value: o && o[i++], done: !o };
|
51018 | }
|
51019 | };
|
51020 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
51021 | };
|
51022 |
|
51023 |
|
51024 | var crcTable = new Uint32Array([
|
51025 | 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
51026 | 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
51027 | 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
|
51028 | 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
51029 | 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
51030 | 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
|
51031 | 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
|
51032 | 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
51033 | 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
|
51034 | 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
51035 | 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
|
51036 | 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
51037 | 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
|
51038 | 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
|
51039 | 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
51040 | 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
51041 | 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
|
51042 | 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
|
51043 | 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
|
51044 | 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
51045 | 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
|
51046 | 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
|
51047 | 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
|
51048 | 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
51049 | 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
51050 | 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
|
51051 | 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
|
51052 | 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
51053 | 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
|
51054 | 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
51055 | 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
|
51056 | 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
51057 | 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
|
51058 | 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
|
51059 | 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
51060 | 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
51061 | 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
|
51062 | 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
|
51063 | 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
|
51064 | 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
51065 | 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
|
51066 | 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
51067 | 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
51068 | ]);
|
51069 | var ZipContainer = (function () {
|
51070 | function ZipContainer() {
|
51071 | }
|
51072 | ZipContainer.addFolders = function (paths) {
|
51073 | paths.forEach(this.addFolder.bind(this));
|
51074 | };
|
51075 | ZipContainer.addFolder = function (path) {
|
51076 | this.folders.push({
|
51077 | path: path,
|
51078 | created: new Date(),
|
51079 | isBase64: false
|
51080 | });
|
51081 | };
|
51082 | ZipContainer.addFile = function (path, content, isBase64) {
|
51083 | if (isBase64 === void 0) { isBase64 = false; }
|
51084 | this.files.push({
|
51085 | path: path,
|
51086 | created: new Date(),
|
51087 | content: content,
|
51088 | isBase64: isBase64
|
51089 | });
|
51090 | };
|
51091 | ZipContainer.getContent = function (mimeType) {
|
51092 | if (mimeType === void 0) { mimeType = 'application/zip'; }
|
51093 | var textOutput = this.buildFileStream();
|
51094 | var uInt8Output = this.buildUint8Array(textOutput);
|
51095 | this.clearStream();
|
51096 | return new Blob([uInt8Output], { type: mimeType });
|
51097 | };
|
51098 | ZipContainer.clearStream = function () {
|
51099 | this.folders = [];
|
51100 | this.files = [];
|
51101 | };
|
51102 | ZipContainer.buildFileStream = function (fData) {
|
51103 | var e_1, _a;
|
51104 | if (fData === void 0) { fData = ''; }
|
51105 | var totalFiles = this.folders.concat(this.files);
|
51106 | var len = totalFiles.length;
|
51107 | var foData = '';
|
51108 | var lL = 0;
|
51109 | var cL = 0;
|
51110 | try {
|
51111 | for (var totalFiles_1 = __values$3(totalFiles), totalFiles_1_1 = totalFiles_1.next(); !totalFiles_1_1.done; totalFiles_1_1 = totalFiles_1.next()) {
|
51112 | var currentFile = totalFiles_1_1.value;
|
51113 | var _b = this.getHeader(currentFile, lL), fileHeader = _b.fileHeader, folderHeader = _b.folderHeader, content = _b.content;
|
51114 | lL += fileHeader.length + content.length;
|
51115 | cL += folderHeader.length;
|
51116 | fData += fileHeader + content;
|
51117 | foData += folderHeader;
|
51118 | }
|
51119 | }
|
51120 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
51121 | finally {
|
51122 | try {
|
51123 | if (totalFiles_1_1 && !totalFiles_1_1.done && (_a = totalFiles_1.return)) _a.call(totalFiles_1);
|
51124 | }
|
51125 | finally { if (e_1) throw e_1.error; }
|
51126 | }
|
51127 | var foEnd = this.buildFolderEnd(len, cL, lL);
|
51128 | return fData + foData + foEnd;
|
51129 | };
|
51130 | ZipContainer.getHeader = function (currentFile, offset) {
|
51131 | var content = currentFile.content, path = currentFile.path, created = currentFile.created, isBase64 = currentFile.isBase64;
|
51132 | var utf8_encode = _.utf8_encode, decToHex = _.decToHex;
|
51133 | var utfPath = utf8_encode(path);
|
51134 | var isUTF8 = utfPath !== path;
|
51135 | var time = this.convertTime(created);
|
51136 | var dt = this.convertDate(created);
|
51137 | var extraFields = '';
|
51138 | if (isUTF8) {
|
51139 | var uExtraFieldPath = decToHex(1, 1) + decToHex(this.getFromCrc32Table(utfPath), 4) + utfPath;
|
51140 | extraFields = "\x75\x70" + decToHex(uExtraFieldPath.length, 2) + uExtraFieldPath;
|
51141 | }
|
51142 | var _a = !content ? { size: 0, content: '' } : this.getConvertedContent(content, isBase64), size = _a.size, convertedContent = _a.content;
|
51143 | var header = '\x0A\x00' +
|
51144 | (isUTF8 ? '\x00\x08' : '\x00\x00') +
|
51145 | '\x00\x00' +
|
51146 | decToHex(time, 2) +
|
51147 | decToHex(dt, 2) +
|
51148 | decToHex(size ? this.getFromCrc32Table(convertedContent) : 0, 4) +
|
51149 | decToHex(size, 4) +
|
51150 | decToHex(size, 4) +
|
51151 | decToHex(utfPath.length, 2) +
|
51152 | decToHex(extraFields.length, 2);
|
51153 | var fileHeader = 'PK\x03\x04' + header + utfPath + extraFields;
|
51154 | var folderHeader = 'PK\x01\x02' +
|
51155 | '\x14\x00' +
|
51156 | header +
|
51157 | '\x00\x00' +
|
51158 | '\x00\x00' +
|
51159 | '\x00\x00' +
|
51160 | (content ? '\x00\x00\x00\x00' : '\x10\x00\x00\x00') +
|
51161 | decToHex(offset, 4) +
|
51162 | utfPath +
|
51163 | extraFields;
|
51164 | return { fileHeader: fileHeader, folderHeader: folderHeader, content: convertedContent || '' };
|
51165 | };
|
51166 | ZipContainer.getConvertedContent = function (content, isBase64) {
|
51167 | if (isBase64 === void 0) { isBase64 = false; }
|
51168 | if (isBase64) {
|
51169 | content = content.split(';base64,')[1];
|
51170 | }
|
51171 | content = isBase64 ? atob(content) : content;
|
51172 | return {
|
51173 | size: content.length,
|
51174 | content: content
|
51175 | };
|
51176 | };
|
51177 | ZipContainer.buildFolderEnd = function (tLen, cLen, lLen) {
|
51178 | var decToHex = _.decToHex;
|
51179 | return 'PK\x05\x06' +
|
51180 | '\x00\x00' +
|
51181 | '\x00\x00' +
|
51182 | decToHex(tLen, 2) +
|
51183 | decToHex(tLen, 2) +
|
51184 | decToHex(cLen, 4) +
|
51185 | decToHex(lLen, 4) +
|
51186 | '\x00\x00';
|
51187 | };
|
51188 | ZipContainer.buildUint8Array = function (content) {
|
51189 | var uint8 = new Uint8Array(content.length);
|
51190 | for (var i = 0; i < uint8.length; i++) {
|
51191 | uint8[i] = content.charCodeAt(i);
|
51192 | }
|
51193 | return uint8;
|
51194 | };
|
51195 | ZipContainer.getFromCrc32Table = function (content) {
|
51196 | if (!content.length) {
|
51197 | return 0;
|
51198 | }
|
51199 | var size = content.length;
|
51200 | var iterable = new Uint8Array(size);
|
51201 | for (var i = 0; i < size; i++) {
|
51202 | iterable[i] = content.charCodeAt(i);
|
51203 | }
|
51204 | var crc = 0 ^ (-1);
|
51205 | var j = 0;
|
51206 | var k = 0;
|
51207 | var l = 0;
|
51208 | for (var i = 0; i < size; i++) {
|
51209 | j = iterable[i];
|
51210 | k = (crc ^ j) & 0xFF;
|
51211 | l = crcTable[k];
|
51212 | crc = (crc >>> 8) ^ l;
|
51213 | }
|
51214 | return crc ^ (-1);
|
51215 | };
|
51216 | ZipContainer.convertTime = function (date) {
|
51217 | var time = date.getHours();
|
51218 | time <<= 6;
|
51219 | time = time | date.getMinutes();
|
51220 | time <<= 5;
|
51221 | time = time | date.getSeconds() / 2;
|
51222 | return time;
|
51223 | };
|
51224 | ZipContainer.convertDate = function (date) {
|
51225 | var dt = date.getFullYear() - 1980;
|
51226 | dt <<= 4;
|
51227 | dt = dt | (date.getMonth() + 1);
|
51228 | dt <<= 5;
|
51229 | dt = dt | date.getDate();
|
51230 | return dt;
|
51231 | };
|
51232 | ZipContainer.folders = [];
|
51233 | ZipContainer.files = [];
|
51234 | return ZipContainer;
|
51235 | }());
|
51236 |
|
51237 | var AllCommunityModules = [ClientSideRowModelModule, InfiniteRowModelModule, CsvExportModule];
|
51238 |
|
51239 | export { AbstractHeaderCellCtrl, AgAbstractField, AgAngleSelect, AgCheckbox, AgColorPicker, AgDialog, AgGroupComponent, AgInputNumberField, AgInputRange, AgInputTextArea, AgInputTextField, AgMenuItemComponent, AgMenuList, AgMenuPanel, AgPanel, AgPromise, AgPromiseStatus, AgRadioButton, AgSelect, AgSlider, AgStackComponentsRegistry, AgToggleButton, AlignedGridsService, AllCommunityModules, AnimateShowChangeCellRenderer, AnimateSlideCellRenderer, AnimationFrameService, AutoScrollService, AutoWidthCalculator, Autowired, BarColumnLabelPlacement, BaseComponentWrapper, BaseCreator, BaseGridSerializingSession, Bean, BeanStub, Beans, BodyDropPivotTarget, BodyDropTarget, CellComp, CellCtrl, CellNavigationService, CellPositionUtils, CellRangeType, ChangedPath, CheckboxSelectionComponent, ClientSideRowModelModule, ClientSideRowModelSteps, ColDefUtil, Color, Column, ColumnApi, ColumnFactory, ColumnGroup, ColumnKeyCreator, ColumnModel, ColumnUtils, Component, ComponentUtil, Constants, Context, CssClassApplier, CssClassManager, CsvCreator, CsvExportModule, CtrlsService, CustomTooltipFeature, DateFilter, DisplayedGroupCreator, Downloader, DragAndDropService, DragService, DragSourceType, Environment, EventService, Events, ExcelFactoryMode, ExpressionService, FilterManager, FloatingFilterMapper, FocusService, Grid, GridApi, GridBodyComp, GridBodyCtrl, GridComp, GridCoreCreator, GridCtrl, GridHeaderComp, GridHeaderCtrl, GridOptionsWrapper, GridSerializer, GroupCellRenderer, GroupCellRendererCtrl, GroupInstanceIdCreator, HeaderCellCtrl, HeaderFilterCellComp, HeaderFilterCellCtrl, HeaderGroupCellCtrl, HeaderNavigationDirection, HeaderNavigationService, HeaderPositionUtils, HeaderRowComp, HeaderRowContainerComp, HeaderRowContainerCtrl, HeaderRowCtrl, HeaderRowType, HorizontalDirection, HorizontalResizeService, InfiniteRowModelModule, KeyCode, LargeTextCellEditor, LayoutCssClasses, Logger, LoggerFactory, ManagedFocusFeature, ModuleNames, ModuleRegistry, MouseEventService, MoveColumnFeature, NavigationService, NumberFilter, NumberSequence, Optional, PaginationProxy, PinnedRowModel, PopupComponent, PopupEditorWrapper, PopupSelectCellEditor, PopupService, PopupTextCellEditor, PositionableFeature, PostConstruct, PreConstruct, PreDestroy, PropertyKeys, ProvidedColumnGroup, ProvidedFilter, Qualifier, QuerySelector, RefSelector, ResizeObserverService, RowAnimationCssClasses, RowContainerComp, RowContainerCtrl, RowContainerName, RowContainerType, RowCtrl, RowHighlightPosition, RowNode, RowNodeBlock, RowNodeBlockLoader, RowNodeSorter, RowPositionUtils, RowRenderer, RowType$1 as RowType, ScalarFilter, ScrollVisibleService, SelectCellEditor, SelectableService, SelectionHandleType, SelectionService, ServerSideTransactionResultStatus, SetLeftFeature, SimpleFilter, SortController, StandardMenuFactory, StylingService, TabGuardComp, TabGuardCtrl, TabbedLayout, TemplateService, TextCellEditor, TextFilter, TextFloatingFilter, Timer, TouchListener, UserComponentFactory, UserComponentRegistry, ValueCache, ValueFormatterService, ValueService, VanillaFrameworkOverrides, VerticalDirection, VirtualList, XmlFactory, ZipContainer, _, defaultGroupComparator, getRowContainerTypeForName, simpleHttpRequest, stringToArray };
|