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 |
|
376 | keys.forEach(function (key, i) {
|
377 | if (!objectToUpdate[key]) {
|
378 | objectToUpdate[key] = {};
|
379 | }
|
380 | if (i < keys.length - 1) {
|
381 | objectToUpdate = objectToUpdate[key];
|
382 | }
|
383 | });
|
384 | objectToUpdate[keys[keys.length - 1]] = value;
|
385 | }
|
386 | function getValueUsingField(data, field, fieldContainsDots) {
|
387 | if (!field || !data) {
|
388 | return;
|
389 | }
|
390 |
|
391 | if (!fieldContainsDots) {
|
392 | return data[field];
|
393 | }
|
394 |
|
395 | var fields = field.split('.');
|
396 | var currentObject = data;
|
397 | for (var i = 0; i < fields.length; i++) {
|
398 | if (currentObject == null) {
|
399 | return undefined;
|
400 | }
|
401 | currentObject = currentObject[fields[i]];
|
402 | }
|
403 | return currentObject;
|
404 | }
|
405 |
|
406 |
|
407 | function removeAllReferences(obj, objectName) {
|
408 | Object.keys(obj).forEach(function (key) {
|
409 | var value = obj[key];
|
410 |
|
411 |
|
412 | if (typeof value === 'object') {
|
413 | obj[key] = undefined;
|
414 | }
|
415 | });
|
416 | var proto = Object.getPrototypeOf(obj);
|
417 | var properties = {};
|
418 | Object.keys(proto).forEach(function (key) {
|
419 | var value = proto[key];
|
420 |
|
421 | if (typeof value === 'function') {
|
422 | var func = function () {
|
423 | 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.");
|
424 | };
|
425 | properties[key] = { value: func, writable: true };
|
426 | }
|
427 | });
|
428 | Object.defineProperties(obj, properties);
|
429 | }
|
430 | function isNonNullObject(value) {
|
431 | return typeof value === 'object' && value !== null;
|
432 | }
|
433 |
|
434 | var ObjectUtils = Object.freeze({
|
435 | __proto__: null,
|
436 | iterateObject: iterateObject,
|
437 | cloneObject: cloneObject,
|
438 | deepCloneObject: deepCloneObject,
|
439 | deepCloneDefinition: deepCloneDefinition,
|
440 | getProperty: getProperty,
|
441 | setProperty: setProperty,
|
442 | copyPropertiesIfPresent: copyPropertiesIfPresent,
|
443 | copyPropertyIfPresent: copyPropertyIfPresent,
|
444 | getAllKeysInObjects: getAllKeysInObjects,
|
445 | getAllValuesInObject: getAllValuesInObject,
|
446 | mergeDeep: mergeDeep,
|
447 | missingOrEmptyObject: missingOrEmptyObject,
|
448 | get: get,
|
449 | set: set,
|
450 | getValueUsingField: getValueUsingField,
|
451 | removeAllReferences: removeAllReferences,
|
452 | isNonNullObject: isNonNullObject
|
453 | });
|
454 |
|
455 | /**
|
456 | * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
|
457 | * @version v29.2.0
|
458 | * @link https://www.ag-grid.com/
|
459 | * @license MIT
|
460 | */
|
461 | var doOnceFlags = {};
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 | function doOnce(func, key) {
|
468 | if (doOnceFlags[key]) {
|
469 | return;
|
470 | }
|
471 | func();
|
472 | doOnceFlags[key] = true;
|
473 | }
|
474 | function getFunctionName(funcConstructor) {
|
475 |
|
476 | if (funcConstructor.name) {
|
477 | return funcConstructor.name;
|
478 | }
|
479 |
|
480 | var matches = /function\s+([^\(]+)/.exec(funcConstructor.toString());
|
481 | return matches && matches.length === 2 ? matches[1].trim() : null;
|
482 | }
|
483 | function isFunction(val) {
|
484 | return !!(val && val.constructor && val.call && val.apply);
|
485 | }
|
486 | function executeInAWhile(funcs) {
|
487 | executeAfter(funcs, 400);
|
488 | }
|
489 | var executeNextVMTurnFuncs = [];
|
490 | var executeNextVMTurnPending = false;
|
491 | function executeNextVMTurn(func) {
|
492 | executeNextVMTurnFuncs.push(func);
|
493 | if (executeNextVMTurnPending) {
|
494 | return;
|
495 | }
|
496 | executeNextVMTurnPending = true;
|
497 | window.setTimeout(function () {
|
498 | var funcsCopy = executeNextVMTurnFuncs.slice();
|
499 | executeNextVMTurnFuncs.length = 0;
|
500 | executeNextVMTurnPending = false;
|
501 | funcsCopy.forEach(function (func) { return func(); });
|
502 | }, 0);
|
503 | }
|
504 | function executeAfter(funcs, milliseconds) {
|
505 | if (milliseconds === void 0) { milliseconds = 0; }
|
506 | if (funcs.length > 0) {
|
507 | window.setTimeout(function () { return funcs.forEach(function (func) { return func(); }); }, milliseconds);
|
508 | }
|
509 | }
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 | function debounce(func, delay) {
|
516 | var timeout;
|
517 |
|
518 | return function () {
|
519 | var args = [];
|
520 | for (var _i = 0; _i < arguments.length; _i++) {
|
521 | args[_i] = arguments[_i];
|
522 | }
|
523 | var context = this;
|
524 | window.clearTimeout(timeout);
|
525 |
|
526 | timeout = window.setTimeout(function () {
|
527 | func.apply(context, args);
|
528 | }, delay);
|
529 | };
|
530 | }
|
531 |
|
532 |
|
533 |
|
534 |
|
535 |
|
536 | function throttle(func, wait) {
|
537 | var previousCall = 0;
|
538 | return function () {
|
539 | var args = [];
|
540 | for (var _i = 0; _i < arguments.length; _i++) {
|
541 | args[_i] = arguments[_i];
|
542 | }
|
543 | var context = this;
|
544 | var currentCall = new Date().getTime();
|
545 | if (currentCall - previousCall < wait) {
|
546 | return;
|
547 | }
|
548 | previousCall = currentCall;
|
549 | func.apply(context, args);
|
550 | };
|
551 | }
|
552 | function waitUntil(condition, callback, timeout, timeoutMessage) {
|
553 | if (timeout === void 0) { timeout = 100; }
|
554 | var timeStamp = new Date().getTime();
|
555 | var interval = null;
|
556 | var executed = false;
|
557 | var internalCallback = function () {
|
558 | var reachedTimeout = ((new Date().getTime()) - timeStamp) > timeout;
|
559 | if (condition() || reachedTimeout) {
|
560 | callback();
|
561 | executed = true;
|
562 | if (interval != null) {
|
563 | window.clearInterval(interval);
|
564 | interval = null;
|
565 | }
|
566 | if (reachedTimeout && timeoutMessage) {
|
567 | console.warn(timeoutMessage);
|
568 | }
|
569 | }
|
570 | };
|
571 | internalCallback();
|
572 | if (!executed) {
|
573 | interval = window.setInterval(internalCallback, 10);
|
574 | }
|
575 | }
|
576 | function compose() {
|
577 | var fns = [];
|
578 | for (var _i = 0; _i < arguments.length; _i++) {
|
579 | fns[_i] = arguments[_i];
|
580 | }
|
581 | return function (arg) { return fns.reduce(function (composed, f) { return f(composed); }, arg); };
|
582 | }
|
583 | function callIfPresent(func) {
|
584 | if (func) {
|
585 | func();
|
586 | }
|
587 | }
|
588 | var noop = function () { return; };
|
589 |
|
590 | var FunctionUtils = Object.freeze({
|
591 | __proto__: null,
|
592 | doOnce: doOnce,
|
593 | getFunctionName: getFunctionName,
|
594 | isFunction: isFunction,
|
595 | executeInAWhile: executeInAWhile,
|
596 | executeNextVMTurn: executeNextVMTurn,
|
597 | executeAfter: executeAfter,
|
598 | debounce: debounce,
|
599 | throttle: throttle,
|
600 | waitUntil: waitUntil,
|
601 | compose: compose,
|
602 | callIfPresent: callIfPresent,
|
603 | noop: noop
|
604 | });
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 | var __read$v = (undefined && undefined.__read) || function (o, n) {
|
613 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
614 | if (!m) return o;
|
615 | var i = m.call(o), r, ar = [], e;
|
616 | try {
|
617 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
618 | }
|
619 | catch (error) { e = { error: error }; }
|
620 | finally {
|
621 | try {
|
622 | if (r && !r.done && (m = i["return"])) m.call(i);
|
623 | }
|
624 | finally { if (e) throw e.error; }
|
625 | }
|
626 | return ar;
|
627 | };
|
628 | var __spread$o = (undefined && undefined.__spread) || function () {
|
629 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$v(arguments[i]));
|
630 | return ar;
|
631 | };
|
632 | var Context = (function () {
|
633 | function Context(params, logger) {
|
634 | this.beanWrappers = {};
|
635 | this.destroyed = false;
|
636 | if (!params || !params.beanClasses) {
|
637 | return;
|
638 | }
|
639 | this.contextParams = params;
|
640 | this.logger = logger;
|
641 | this.logger.log(">> creating ag-Application Context");
|
642 | this.createBeans();
|
643 | var beanInstances = this.getBeanInstances();
|
644 | this.wireBeans(beanInstances);
|
645 | this.logger.log(">> ag-Application Context ready - component is alive");
|
646 | }
|
647 | Context.prototype.getBeanInstances = function () {
|
648 | return values(this.beanWrappers).map(function (beanEntry) { return beanEntry.beanInstance; });
|
649 | };
|
650 | Context.prototype.createBean = function (bean, afterPreCreateCallback) {
|
651 | if (!bean) {
|
652 | throw Error("Can't wire to bean since it is null");
|
653 | }
|
654 | this.wireBeans([bean], afterPreCreateCallback);
|
655 | return bean;
|
656 | };
|
657 | Context.prototype.wireBeans = function (beanInstances, afterPreCreateCallback) {
|
658 | this.autoWireBeans(beanInstances);
|
659 | this.methodWireBeans(beanInstances);
|
660 | this.callLifeCycleMethods(beanInstances, 'preConstructMethods');
|
661 |
|
662 |
|
663 | if (exists(afterPreCreateCallback)) {
|
664 | beanInstances.forEach(afterPreCreateCallback);
|
665 | }
|
666 | this.callLifeCycleMethods(beanInstances, 'postConstructMethods');
|
667 | };
|
668 | Context.prototype.createBeans = function () {
|
669 | var _this = this;
|
670 |
|
671 | this.contextParams.beanClasses.forEach(this.createBeanWrapper.bind(this));
|
672 |
|
673 |
|
674 | iterateObject(this.beanWrappers, function (key, beanEntry) {
|
675 | var constructorParamsMeta;
|
676 | if (beanEntry.bean.__agBeanMetaData && beanEntry.bean.__agBeanMetaData.autowireMethods && beanEntry.bean.__agBeanMetaData.autowireMethods.agConstructor) {
|
677 | constructorParamsMeta = beanEntry.bean.__agBeanMetaData.autowireMethods.agConstructor;
|
678 | }
|
679 | var constructorParams = _this.getBeansForParameters(constructorParamsMeta, beanEntry.bean.name);
|
680 | var newInstance = new (beanEntry.bean.bind.apply(beanEntry.bean, __spread$o([null], constructorParams)));
|
681 | beanEntry.beanInstance = newInstance;
|
682 | });
|
683 | var createdBeanNames = Object.keys(this.beanWrappers).join(', ');
|
684 | this.logger.log("created beans: " + createdBeanNames);
|
685 | };
|
686 |
|
687 | Context.prototype.createBeanWrapper = function (BeanClass) {
|
688 | var metaData = BeanClass.__agBeanMetaData;
|
689 | if (!metaData) {
|
690 | var beanName = void 0;
|
691 | if (BeanClass.prototype.constructor) {
|
692 | beanName = getFunctionName(BeanClass.prototype.constructor);
|
693 | }
|
694 | else {
|
695 | beanName = "" + BeanClass;
|
696 | }
|
697 | console.error("Context item " + beanName + " is not a bean");
|
698 | return;
|
699 | }
|
700 | var beanEntry = {
|
701 | bean: BeanClass,
|
702 | beanInstance: null,
|
703 | beanName: metaData.beanName
|
704 | };
|
705 | this.beanWrappers[metaData.beanName] = beanEntry;
|
706 | };
|
707 | Context.prototype.autoWireBeans = function (beanInstances) {
|
708 | var _this = this;
|
709 | beanInstances.forEach(function (beanInstance) {
|
710 | _this.forEachMetaDataInHierarchy(beanInstance, function (metaData, beanName) {
|
711 | var attributes = metaData.agClassAttributes;
|
712 | if (!attributes) {
|
713 | return;
|
714 | }
|
715 | attributes.forEach(function (attribute) {
|
716 | var otherBean = _this.lookupBeanInstance(beanName, attribute.beanName, attribute.optional);
|
717 | beanInstance[attribute.attributeName] = otherBean;
|
718 | });
|
719 | });
|
720 | });
|
721 | };
|
722 | Context.prototype.methodWireBeans = function (beanInstances) {
|
723 | var _this = this;
|
724 | beanInstances.forEach(function (beanInstance) {
|
725 | _this.forEachMetaDataInHierarchy(beanInstance, function (metaData, beanName) {
|
726 | iterateObject(metaData.autowireMethods, function (methodName, wireParams) {
|
727 |
|
728 | if (methodName === "agConstructor") {
|
729 | return;
|
730 | }
|
731 | var initParams = _this.getBeansForParameters(wireParams, beanName);
|
732 | beanInstance[methodName].apply(beanInstance, initParams);
|
733 | });
|
734 | });
|
735 | });
|
736 | };
|
737 | Context.prototype.forEachMetaDataInHierarchy = function (beanInstance, callback) {
|
738 | var prototype = Object.getPrototypeOf(beanInstance);
|
739 | while (prototype != null) {
|
740 | var constructor = prototype.constructor;
|
741 | if (constructor.hasOwnProperty('__agBeanMetaData')) {
|
742 | var metaData = constructor.__agBeanMetaData;
|
743 | var beanName = this.getBeanName(constructor);
|
744 | callback(metaData, beanName);
|
745 | }
|
746 | prototype = Object.getPrototypeOf(prototype);
|
747 | }
|
748 | };
|
749 | Context.prototype.getBeanName = function (constructor) {
|
750 | if (constructor.__agBeanMetaData && constructor.__agBeanMetaData.beanName) {
|
751 | return constructor.__agBeanMetaData.beanName;
|
752 | }
|
753 | var constructorString = constructor.toString();
|
754 | var beanName = constructorString.substring(9, constructorString.indexOf("("));
|
755 | return beanName;
|
756 | };
|
757 | Context.prototype.getBeansForParameters = function (parameters, beanName) {
|
758 | var _this = this;
|
759 | var beansList = [];
|
760 | if (parameters) {
|
761 | iterateObject(parameters, function (paramIndex, otherBeanName) {
|
762 | var otherBean = _this.lookupBeanInstance(beanName, otherBeanName);
|
763 | beansList[Number(paramIndex)] = otherBean;
|
764 | });
|
765 | }
|
766 | return beansList;
|
767 | };
|
768 | Context.prototype.lookupBeanInstance = function (wiringBean, beanName, optional) {
|
769 | if (optional === void 0) { optional = false; }
|
770 | if (beanName === "context") {
|
771 | return this;
|
772 | }
|
773 | if (this.contextParams.providedBeanInstances && this.contextParams.providedBeanInstances.hasOwnProperty(beanName)) {
|
774 | return this.contextParams.providedBeanInstances[beanName];
|
775 | }
|
776 | var beanEntry = this.beanWrappers[beanName];
|
777 | if (beanEntry) {
|
778 | return beanEntry.beanInstance;
|
779 | }
|
780 | if (!optional) {
|
781 | console.error("AG Grid: unable to find bean reference " + beanName + " while initialising " + wiringBean);
|
782 | }
|
783 | return null;
|
784 | };
|
785 | Context.prototype.callLifeCycleMethods = function (beanInstances, lifeCycleMethod) {
|
786 | var _this = this;
|
787 | beanInstances.forEach(function (beanInstance) { return _this.callLifeCycleMethodsOnBean(beanInstance, lifeCycleMethod); });
|
788 | };
|
789 | Context.prototype.callLifeCycleMethodsOnBean = function (beanInstance, lifeCycleMethod, methodToIgnore) {
|
790 |
|
791 | var allMethods = {};
|
792 |
|
793 | this.forEachMetaDataInHierarchy(beanInstance, function (metaData) {
|
794 | var methods = metaData[lifeCycleMethod];
|
795 | if (methods) {
|
796 | methods.forEach(function (methodName) {
|
797 | if (methodName != methodToIgnore) {
|
798 | allMethods[methodName] = true;
|
799 | }
|
800 | });
|
801 | }
|
802 | });
|
803 | var allMethodsList = Object.keys(allMethods);
|
804 | allMethodsList.forEach(function (methodName) { return beanInstance[methodName](); });
|
805 | };
|
806 | Context.prototype.getBean = function (name) {
|
807 | return this.lookupBeanInstance("getBean", name, true);
|
808 | };
|
809 | Context.prototype.destroy = function () {
|
810 | if (this.destroyed) {
|
811 | return;
|
812 | }
|
813 | this.logger.log(">> Shutting down ag-Application Context");
|
814 | var beanInstances = this.getBeanInstances();
|
815 | this.destroyBeans(beanInstances);
|
816 | this.contextParams.providedBeanInstances = null;
|
817 | this.destroyed = true;
|
818 | this.logger.log(">> ag-Application Context shut down - component is dead");
|
819 | };
|
820 | Context.prototype.destroyBean = function (bean) {
|
821 | if (!bean) {
|
822 | return;
|
823 | }
|
824 | this.destroyBeans([bean]);
|
825 | };
|
826 | Context.prototype.destroyBeans = function (beans) {
|
827 | var _this = this;
|
828 | if (!beans) {
|
829 | return [];
|
830 | }
|
831 | beans.forEach(function (bean) {
|
832 | _this.callLifeCycleMethodsOnBean(bean, 'preDestroyMethods', 'destroy');
|
833 |
|
834 | var beanAny = bean;
|
835 | if (typeof beanAny.destroy === 'function') {
|
836 | beanAny.destroy();
|
837 | }
|
838 | });
|
839 | return [];
|
840 | };
|
841 | return Context;
|
842 | }());
|
843 | function PreConstruct(target, methodName, descriptor) {
|
844 | var props = getOrCreateProps$1(target.constructor);
|
845 | if (!props.preConstructMethods) {
|
846 | props.preConstructMethods = [];
|
847 | }
|
848 | props.preConstructMethods.push(methodName);
|
849 | }
|
850 | function PostConstruct(target, methodName, descriptor) {
|
851 | var props = getOrCreateProps$1(target.constructor);
|
852 | if (!props.postConstructMethods) {
|
853 | props.postConstructMethods = [];
|
854 | }
|
855 | props.postConstructMethods.push(methodName);
|
856 | }
|
857 | function PreDestroy(target, methodName, descriptor) {
|
858 | var props = getOrCreateProps$1(target.constructor);
|
859 | if (!props.preDestroyMethods) {
|
860 | props.preDestroyMethods = [];
|
861 | }
|
862 | props.preDestroyMethods.push(methodName);
|
863 | }
|
864 | function Bean(beanName) {
|
865 | return function (classConstructor) {
|
866 | var props = getOrCreateProps$1(classConstructor);
|
867 | props.beanName = beanName;
|
868 | };
|
869 | }
|
870 | function Autowired(name) {
|
871 | return function (target, propertyKey, descriptor) {
|
872 | autowiredFunc(target, name, false, target, propertyKey, null);
|
873 | };
|
874 | }
|
875 | function Optional(name) {
|
876 | return function (target, propertyKey, descriptor) {
|
877 | autowiredFunc(target, name, true, target, propertyKey, null);
|
878 | };
|
879 | }
|
880 | function autowiredFunc(target, name, optional, classPrototype, methodOrAttributeName, index) {
|
881 | if (name === null) {
|
882 | console.error("AG Grid: Autowired name should not be null");
|
883 | return;
|
884 | }
|
885 | if (typeof index === "number") {
|
886 | console.error("AG Grid: Autowired should be on an attribute");
|
887 | return;
|
888 | }
|
889 |
|
890 | var props = getOrCreateProps$1(target.constructor);
|
891 | if (!props.agClassAttributes) {
|
892 | props.agClassAttributes = [];
|
893 | }
|
894 | props.agClassAttributes.push({
|
895 | attributeName: methodOrAttributeName,
|
896 | beanName: name,
|
897 | optional: optional
|
898 | });
|
899 | }
|
900 | function Qualifier(name) {
|
901 | return function (classPrototype, methodOrAttributeName, index) {
|
902 | var constructor = typeof classPrototype == "function" ? classPrototype : classPrototype.constructor;
|
903 | var props;
|
904 | if (typeof index === "number") {
|
905 |
|
906 | var methodName = void 0;
|
907 | if (methodOrAttributeName) {
|
908 | props = getOrCreateProps$1(constructor);
|
909 | methodName = methodOrAttributeName;
|
910 | }
|
911 | else {
|
912 | props = getOrCreateProps$1(constructor);
|
913 | methodName = "agConstructor";
|
914 | }
|
915 | if (!props.autowireMethods) {
|
916 | props.autowireMethods = {};
|
917 | }
|
918 | if (!props.autowireMethods[methodName]) {
|
919 | props.autowireMethods[methodName] = {};
|
920 | }
|
921 | props.autowireMethods[methodName][index] = name;
|
922 | }
|
923 | };
|
924 | }
|
925 | function getOrCreateProps$1(target) {
|
926 | if (!target.hasOwnProperty("__agBeanMetaData")) {
|
927 | target.__agBeanMetaData = {};
|
928 | }
|
929 | return target.__agBeanMetaData;
|
930 | }
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 | var __decorate$2z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
939 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
940 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
941 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
942 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
943 | };
|
944 | var __param$a = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
945 | return function (target, key) { decorator(target, key, paramIndex); }
|
946 | };
|
947 | var EventService = (function () {
|
948 | function EventService() {
|
949 | this.allSyncListeners = new Map();
|
950 | this.allAsyncListeners = new Map();
|
951 | this.globalSyncListeners = new Set();
|
952 | this.globalAsyncListeners = new Set();
|
953 | this.asyncFunctionsQueue = [];
|
954 | this.scheduled = false;
|
955 |
|
956 | this.firedEvents = {};
|
957 | }
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 | EventService.prototype.setBeans = function (loggerFactory, gridOptionsService, frameworkOverrides, globalEventListener) {
|
968 | if (globalEventListener === void 0) { globalEventListener = null; }
|
969 | this.frameworkOverrides = frameworkOverrides;
|
970 | this.gridOptionsService = gridOptionsService;
|
971 | if (globalEventListener) {
|
972 | var async = gridOptionsService.useAsyncEvents();
|
973 | this.addGlobalListener(globalEventListener, async);
|
974 | }
|
975 | };
|
976 | EventService.prototype.getListeners = function (eventType, async, autoCreateListenerCollection) {
|
977 | var listenerMap = async ? this.allAsyncListeners : this.allSyncListeners;
|
978 | var listeners = listenerMap.get(eventType);
|
979 |
|
980 |
|
981 |
|
982 |
|
983 | if (!listeners && autoCreateListenerCollection) {
|
984 | listeners = new Set();
|
985 | listenerMap.set(eventType, listeners);
|
986 | }
|
987 | return listeners;
|
988 | };
|
989 | EventService.prototype.noRegisteredListenersExist = function () {
|
990 | return this.allSyncListeners.size === 0 && this.allAsyncListeners.size === 0 &&
|
991 | this.globalSyncListeners.size === 0 && this.globalAsyncListeners.size === 0;
|
992 | };
|
993 | EventService.prototype.addEventListener = function (eventType, listener, async) {
|
994 | if (async === void 0) { async = false; }
|
995 | this.getListeners(eventType, async, true).add(listener);
|
996 | };
|
997 | EventService.prototype.removeEventListener = function (eventType, listener, async) {
|
998 | if (async === void 0) { async = false; }
|
999 | var listeners = this.getListeners(eventType, async, false);
|
1000 | if (!listeners) {
|
1001 | return;
|
1002 | }
|
1003 | listeners.delete(listener);
|
1004 | if (listeners.size === 0) {
|
1005 | var listenerMap = async ? this.allAsyncListeners : this.allSyncListeners;
|
1006 | listenerMap.delete(eventType);
|
1007 | }
|
1008 | };
|
1009 | EventService.prototype.addGlobalListener = function (listener, async) {
|
1010 | if (async === void 0) { async = false; }
|
1011 | (async ? this.globalAsyncListeners : this.globalSyncListeners).add(listener);
|
1012 | };
|
1013 | EventService.prototype.removeGlobalListener = function (listener, async) {
|
1014 | if (async === void 0) { async = false; }
|
1015 | (async ? this.globalAsyncListeners : this.globalSyncListeners).delete(listener);
|
1016 | };
|
1017 | EventService.prototype.dispatchEvent = function (event) {
|
1018 | var agEvent = event;
|
1019 | if (this.gridOptionsService) {
|
1020 |
|
1021 |
|
1022 | var _a = this.gridOptionsService, api = _a.api, columnApi = _a.columnApi, context = _a.context;
|
1023 | agEvent.api = api;
|
1024 | agEvent.columnApi = columnApi;
|
1025 | agEvent.context = context;
|
1026 | }
|
1027 | this.dispatchToListeners(agEvent, true);
|
1028 | this.dispatchToListeners(agEvent, false);
|
1029 | this.firedEvents[agEvent.type] = true;
|
1030 | };
|
1031 | EventService.prototype.dispatchEventOnce = function (event) {
|
1032 | if (!this.firedEvents[event.type]) {
|
1033 | this.dispatchEvent(event);
|
1034 | }
|
1035 | };
|
1036 | EventService.prototype.dispatchToListeners = function (event, async) {
|
1037 | var _this = this;
|
1038 | var eventType = event.type;
|
1039 | if (async && 'event' in event) {
|
1040 | var browserEvent = event.event;
|
1041 | if (browserEvent instanceof Event) {
|
1042 |
|
1043 |
|
1044 | event.eventPath = browserEvent.composedPath();
|
1045 | }
|
1046 | }
|
1047 | var processEventListeners = function (listeners) { return listeners.forEach(function (listener) {
|
1048 | if (async) {
|
1049 | _this.dispatchAsync(function () { return listener(event); });
|
1050 | }
|
1051 | else {
|
1052 | listener(event);
|
1053 | }
|
1054 | }); };
|
1055 | var listeners = this.getListeners(eventType, async, false);
|
1056 | if (listeners) {
|
1057 | processEventListeners(listeners);
|
1058 | }
|
1059 | var globalListeners = async ? this.globalAsyncListeners : this.globalSyncListeners;
|
1060 | globalListeners.forEach(function (listener) {
|
1061 | if (async) {
|
1062 | _this.dispatchAsync(function () { return _this.frameworkOverrides.dispatchEvent(eventType, function () { return listener(eventType, event); }, true); });
|
1063 | }
|
1064 | else {
|
1065 | _this.frameworkOverrides.dispatchEvent(eventType, function () { return listener(eventType, event); }, true);
|
1066 | }
|
1067 | });
|
1068 | };
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 | EventService.prototype.dispatchAsync = function (func) {
|
1074 |
|
1075 | this.asyncFunctionsQueue.push(func);
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 | if (!this.scheduled) {
|
1081 |
|
1082 | window.setTimeout(this.flushAsyncQueue.bind(this), 0);
|
1083 |
|
1084 | this.scheduled = true;
|
1085 | }
|
1086 | };
|
1087 |
|
1088 | EventService.prototype.flushAsyncQueue = function () {
|
1089 | this.scheduled = false;
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 | var queueCopy = this.asyncFunctionsQueue.slice();
|
1096 | this.asyncFunctionsQueue = [];
|
1097 |
|
1098 | queueCopy.forEach(function (func) { return func(); });
|
1099 | };
|
1100 | __decorate$2z([
|
1101 | __param$a(0, Qualifier('loggerFactory')),
|
1102 | __param$a(1, Qualifier('gridOptionsService')),
|
1103 | __param$a(2, Qualifier('frameworkOverrides')),
|
1104 | __param$a(3, Qualifier('globalEventListener'))
|
1105 | ], EventService.prototype, "setBeans", null);
|
1106 | EventService = __decorate$2z([
|
1107 | Bean('eventService')
|
1108 | ], EventService);
|
1109 | return EventService;
|
1110 | }());
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 | var ModuleNames;
|
1119 | (function (ModuleNames) {
|
1120 | ModuleNames["CommunityCoreModule"] = "@ag-grid-community/core";
|
1121 |
|
1122 | ModuleNames["InfiniteRowModelModule"] = "@ag-grid-community/infinite-row-model";
|
1123 | ModuleNames["ClientSideRowModelModule"] = "@ag-grid-community/client-side-row-model";
|
1124 | ModuleNames["CsvExportModule"] = "@ag-grid-community/csv-export";
|
1125 |
|
1126 | ModuleNames["EnterpriseCoreModule"] = "@ag-grid-enterprise/core";
|
1127 |
|
1128 | ModuleNames["RowGroupingModule"] = "@ag-grid-enterprise/row-grouping";
|
1129 | ModuleNames["ColumnsToolPanelModule"] = "@ag-grid-enterprise/column-tool-panel";
|
1130 | ModuleNames["FiltersToolPanelModule"] = "@ag-grid-enterprise/filter-tool-panel";
|
1131 | ModuleNames["MenuModule"] = "@ag-grid-enterprise/menu";
|
1132 | ModuleNames["SetFilterModule"] = "@ag-grid-enterprise/set-filter";
|
1133 | ModuleNames["MultiFilterModule"] = "@ag-grid-enterprise/multi-filter";
|
1134 | ModuleNames["StatusBarModule"] = "@ag-grid-enterprise/status-bar";
|
1135 | ModuleNames["SideBarModule"] = "@ag-grid-enterprise/side-bar";
|
1136 | ModuleNames["RangeSelectionModule"] = "@ag-grid-enterprise/range-selection";
|
1137 | ModuleNames["MasterDetailModule"] = "@ag-grid-enterprise/master-detail";
|
1138 | ModuleNames["RichSelectModule"] = "@ag-grid-enterprise/rich-select";
|
1139 | ModuleNames["GridChartsModule"] = "@ag-grid-enterprise/charts";
|
1140 | ModuleNames["ViewportRowModelModule"] = "@ag-grid-enterprise/viewport-row-model";
|
1141 | ModuleNames["ServerSideRowModelModule"] = "@ag-grid-enterprise/server-side-row-model";
|
1142 | ModuleNames["ExcelExportModule"] = "@ag-grid-enterprise/excel-export";
|
1143 | ModuleNames["ClipboardModule"] = "@ag-grid-enterprise/clipboard";
|
1144 | ModuleNames["SparklinesModule"] = "@ag-grid-enterprise/sparklines";
|
1145 |
|
1146 |
|
1147 | ModuleNames["AngularModule"] = "@ag-grid-community/angular";
|
1148 | ModuleNames["ReactModule"] = "@ag-grid-community/react";
|
1149 | ModuleNames["VueModule"] = "@ag-grid-community/vue";
|
1150 |
|
1151 |
|
1152 |
|
1153 | })(ModuleNames || (ModuleNames = {}));
|
1154 |
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 | var __read$u = (undefined && undefined.__read) || function (o, n) {
|
1162 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
1163 | if (!m) return o;
|
1164 | var i = m.call(o), r, ar = [], e;
|
1165 | try {
|
1166 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
1167 | }
|
1168 | catch (error) { e = { error: error }; }
|
1169 | finally {
|
1170 | try {
|
1171 | if (r && !r.done && (m = i["return"])) m.call(i);
|
1172 | }
|
1173 | finally { if (e) throw e.error; }
|
1174 | }
|
1175 | return ar;
|
1176 | };
|
1177 | var ModuleRegistry = (function () {
|
1178 | function ModuleRegistry() {
|
1179 | }
|
1180 | ModuleRegistry.register = function (module, moduleBased) {
|
1181 | if (moduleBased === void 0) { moduleBased = true; }
|
1182 | ModuleRegistry.runVersionChecks(module);
|
1183 | ModuleRegistry.modulesMap[module.moduleName] = module;
|
1184 | ModuleRegistry.setModuleBased(moduleBased);
|
1185 | };
|
1186 | ModuleRegistry.runVersionChecks = function (module) {
|
1187 | if (!ModuleRegistry.currentModuleVersion) {
|
1188 | ModuleRegistry.currentModuleVersion = module.version;
|
1189 | }
|
1190 | if (!module.version) {
|
1191 | console.error("AG Grid: You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. '" + module.moduleName + "' is incompatible. Please update all modules to the same version.");
|
1192 | }
|
1193 | else if (module.version !== ModuleRegistry.currentModuleVersion) {
|
1194 | console.error("AG Grid: You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. '" + module.moduleName + "' is version " + module.version + " but the other modules are version " + this.currentModuleVersion + ". Please update all modules to the same version.");
|
1195 | }
|
1196 | if (module.validate) {
|
1197 | var result = module.validate();
|
1198 | if (!result.isValid) {
|
1199 | var errorResult = result;
|
1200 | console.error("AG Grid: " + errorResult.message);
|
1201 | }
|
1202 | }
|
1203 | };
|
1204 | ModuleRegistry.setModuleBased = function (moduleBased) {
|
1205 | if (ModuleRegistry.moduleBased === undefined) {
|
1206 | ModuleRegistry.moduleBased = moduleBased;
|
1207 | }
|
1208 | else {
|
1209 | if (ModuleRegistry.moduleBased !== moduleBased) {
|
1210 | doOnce(function () {
|
1211 | 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.");
|
1212 | console.warn('Please see https://www.ag-grid.com/javascript-grid/packages-modules/ for more information.');
|
1213 | }, 'ModulePackageCheck');
|
1214 | }
|
1215 | }
|
1216 | };
|
1217 | |
1218 |
|
1219 |
|
1220 | ModuleRegistry.setIsBundled = function () {
|
1221 | ModuleRegistry.isBundled = true;
|
1222 | };
|
1223 |
|
1224 | ModuleRegistry.registerModules = function (modules, moduleBased) {
|
1225 | if (moduleBased === void 0) { moduleBased = true; }
|
1226 | ModuleRegistry.setModuleBased(moduleBased);
|
1227 | if (!modules) {
|
1228 | return;
|
1229 | }
|
1230 | modules.forEach(function (module) { return ModuleRegistry.register(module, moduleBased); });
|
1231 | };
|
1232 | ModuleRegistry.assertRegistered = function (moduleName, reason) {
|
1233 | var _a;
|
1234 | if (this.isRegistered(moduleName)) {
|
1235 | return true;
|
1236 | }
|
1237 | var warningKey = reason + moduleName;
|
1238 | var warningMessage;
|
1239 | if (ModuleRegistry.isBundled) {
|
1240 | {
|
1241 | warningMessage =
|
1242 | "AG Grid: unable to use " + reason + " as 'ag-grid-enterprise' has not been loaded. Check you are using the Enterprise bundle:\n \n <script src=\"https://cdn.jsdelivr.net/npm/ag-grid-enterprise@AG_GRID_VERSION/dist/ag-grid-enterprise.min.js\"></script>\n \nFor more info see: https://ag-grid.com/javascript-data-grid/getting-started/#getting-started-with-ag-grid-enterprise";
|
1243 | }
|
1244 | }
|
1245 | else if (ModuleRegistry.moduleBased || ModuleRegistry.moduleBased === undefined) {
|
1246 | var modName = (_a = Object.entries(ModuleNames).find(function (_a) {
|
1247 | var _b = __read$u(_a, 2); _b[0]; var v = _b[1];
|
1248 | return v === moduleName;
|
1249 | })) === null || _a === void 0 ? void 0 : _a[0];
|
1250 | warningMessage =
|
1251 | "AG Grid: unable to use " + reason + " as the " + modName + " is not registered. Check if you have registered the module:\n \n import { ModuleRegistry } from '@ag-grid-community/core';\n import { " + modName + " } from '" + moduleName + "';\n \n ModuleRegistry.registerModules([ " + modName + " ]);\n\nFor more info see: https://www.ag-grid.com/javascript-grid/modules/";
|
1252 | }
|
1253 | else {
|
1254 | warningMessage =
|
1255 | "AG Grid: unable to use " + reason + " as package 'ag-grid-enterprise' has not been imported. Check that you have imported the package:\n \n import 'ag-grid-enterprise';\n \nFor more info see: https://www.ag-grid.com/javascript-grid/packages/";
|
1256 | }
|
1257 | doOnce(function () {
|
1258 | console.warn(warningMessage);
|
1259 | }, warningKey);
|
1260 | return false;
|
1261 | };
|
1262 | ModuleRegistry.isRegistered = function (moduleName) {
|
1263 | return !!ModuleRegistry.modulesMap[moduleName];
|
1264 | };
|
1265 | ModuleRegistry.getRegisteredModules = function () {
|
1266 | return values(ModuleRegistry.modulesMap);
|
1267 | };
|
1268 | ModuleRegistry.isPackageBased = function () {
|
1269 | return !ModuleRegistry.moduleBased;
|
1270 | };
|
1271 |
|
1272 | ModuleRegistry.modulesMap = {};
|
1273 | return ModuleRegistry;
|
1274 | }());
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 | var __decorate$2y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
1283 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
1284 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
1285 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
1286 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
1287 | };
|
1288 | var instanceIdSequence$4 = 0;
|
1289 | function getNextColInstanceId() {
|
1290 | return instanceIdSequence$4++;
|
1291 | }
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 | var Column = (function () {
|
1299 | function Column(colDef, userProvidedColDef, colId, primary) {
|
1300 |
|
1301 |
|
1302 | this.instanceId = getNextColInstanceId();
|
1303 |
|
1304 | this.autoHeaderHeight = null;
|
1305 | this.moving = false;
|
1306 | this.menuVisible = false;
|
1307 | this.filterActive = false;
|
1308 | this.eventService = new EventService();
|
1309 | this.rowGroupActive = false;
|
1310 | this.pivotActive = false;
|
1311 | this.aggregationActive = false;
|
1312 | this.colDef = colDef;
|
1313 | this.userProvidedColDef = userProvidedColDef;
|
1314 | this.colId = colId;
|
1315 | this.primary = primary;
|
1316 | this.setState(colDef);
|
1317 | }
|
1318 | Column.prototype.getInstanceId = function () {
|
1319 | return this.instanceId;
|
1320 | };
|
1321 | Column.prototype.setState = function (colDef) {
|
1322 |
|
1323 | if (colDef.sort !== undefined) {
|
1324 | if (colDef.sort === 'asc' || colDef.sort === 'desc') {
|
1325 | this.sort = colDef.sort;
|
1326 | }
|
1327 | }
|
1328 | else {
|
1329 | if (colDef.initialSort === 'asc' || colDef.initialSort === 'desc') {
|
1330 | this.sort = colDef.initialSort;
|
1331 | }
|
1332 | }
|
1333 |
|
1334 | var sortIndex = attrToNumber(colDef.sortIndex);
|
1335 | var initialSortIndex = attrToNumber(colDef.initialSortIndex);
|
1336 | if (sortIndex !== undefined) {
|
1337 | if (sortIndex !== null) {
|
1338 | this.sortIndex = sortIndex;
|
1339 | }
|
1340 | }
|
1341 | else {
|
1342 | if (initialSortIndex !== null) {
|
1343 | this.sortIndex = initialSortIndex;
|
1344 | }
|
1345 | }
|
1346 |
|
1347 | var hide = attrToBoolean(colDef.hide);
|
1348 | var initialHide = attrToBoolean(colDef.initialHide);
|
1349 | if (hide !== undefined) {
|
1350 | this.visible = !hide;
|
1351 | }
|
1352 | else {
|
1353 | this.visible = !initialHide;
|
1354 | }
|
1355 |
|
1356 | if (colDef.pinned !== undefined) {
|
1357 | this.setPinned(colDef.pinned);
|
1358 | }
|
1359 | else {
|
1360 | this.setPinned(colDef.initialPinned);
|
1361 | }
|
1362 |
|
1363 | var flex = attrToNumber(colDef.flex);
|
1364 | var initialFlex = attrToNumber(colDef.initialFlex);
|
1365 | if (flex !== undefined) {
|
1366 | this.flex = flex;
|
1367 | }
|
1368 | else if (initialFlex !== undefined) {
|
1369 | this.flex = initialFlex;
|
1370 | }
|
1371 | };
|
1372 |
|
1373 | Column.prototype.setColDef = function (colDef, userProvidedColDef) {
|
1374 | this.colDef = colDef;
|
1375 | this.userProvidedColDef = userProvidedColDef;
|
1376 | this.initMinAndMaxWidths();
|
1377 | this.initDotNotation();
|
1378 | this.eventService.dispatchEvent(this.createColumnEvent('colDefChanged', "api"));
|
1379 | };
|
1380 | |
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 | Column.prototype.getUserProvidedColDef = function () {
|
1386 | return this.userProvidedColDef;
|
1387 | };
|
1388 | Column.prototype.setParent = function (parent) {
|
1389 | this.parent = parent;
|
1390 | };
|
1391 |
|
1392 | Column.prototype.getParent = function () {
|
1393 | return this.parent;
|
1394 | };
|
1395 | Column.prototype.setOriginalParent = function (originalParent) {
|
1396 | this.originalParent = originalParent;
|
1397 | };
|
1398 | Column.prototype.getOriginalParent = function () {
|
1399 | return this.originalParent;
|
1400 | };
|
1401 |
|
1402 | Column.prototype.initialise = function () {
|
1403 | this.initMinAndMaxWidths();
|
1404 | this.resetActualWidth('gridInitializing');
|
1405 | this.initDotNotation();
|
1406 | this.validate();
|
1407 | };
|
1408 | Column.prototype.initDotNotation = function () {
|
1409 | var suppressDotNotation = this.gridOptionsService.is('suppressFieldDotNotation');
|
1410 | this.fieldContainsDots = exists(this.colDef.field) && this.colDef.field.indexOf('.') >= 0 && !suppressDotNotation;
|
1411 | this.tooltipFieldContainsDots = exists(this.colDef.tooltipField) && this.colDef.tooltipField.indexOf('.') >= 0 && !suppressDotNotation;
|
1412 | };
|
1413 | Column.prototype.initMinAndMaxWidths = function () {
|
1414 | var colDef = this.colDef;
|
1415 | this.minWidth = this.columnUtils.calculateColMinWidth(colDef);
|
1416 | this.maxWidth = this.columnUtils.calculateColMaxWidth(colDef);
|
1417 | };
|
1418 | Column.prototype.resetActualWidth = function (source) {
|
1419 | if (source === void 0) { source = 'api'; }
|
1420 | var initialWidth = this.columnUtils.calculateColInitialWidth(this.colDef);
|
1421 | this.setActualWidth(initialWidth, source, true);
|
1422 | };
|
1423 | Column.prototype.isEmptyGroup = function () {
|
1424 | return false;
|
1425 | };
|
1426 | Column.prototype.isRowGroupDisplayed = function (colId) {
|
1427 | if (missing(this.colDef) || missing(this.colDef.showRowGroup)) {
|
1428 | return false;
|
1429 | }
|
1430 | var showingAllGroups = this.colDef.showRowGroup === true;
|
1431 | var showingThisGroup = this.colDef.showRowGroup === colId;
|
1432 | return showingAllGroups || showingThisGroup;
|
1433 | };
|
1434 |
|
1435 | Column.prototype.isPrimary = function () {
|
1436 | return this.primary;
|
1437 | };
|
1438 |
|
1439 | Column.prototype.isFilterAllowed = function () {
|
1440 |
|
1441 |
|
1442 | var filterDefined = !!this.colDef.filter || !!this.colDef.filterFramework;
|
1443 | return filterDefined;
|
1444 | };
|
1445 | Column.prototype.isFieldContainsDots = function () {
|
1446 | return this.fieldContainsDots;
|
1447 | };
|
1448 | Column.prototype.isTooltipFieldContainsDots = function () {
|
1449 | return this.tooltipFieldContainsDots;
|
1450 | };
|
1451 | Column.prototype.validate = function () {
|
1452 | var colDefAny = this.colDef;
|
1453 | function warnOnce(msg, key, obj) {
|
1454 | doOnce(function () {
|
1455 | if (obj) {
|
1456 | console.warn(msg, obj);
|
1457 | }
|
1458 | else {
|
1459 | doOnce(function () { return console.warn(msg); }, key);
|
1460 | }
|
1461 | }, key);
|
1462 | }
|
1463 | var usingCSRM = this.gridOptionsService.isRowModelType('clientSide');
|
1464 | if (usingCSRM && !ModuleRegistry.isRegistered(ModuleNames.RowGroupingModule)) {
|
1465 | var rowGroupingItems = ['enableRowGroup', 'rowGroup', 'rowGroupIndex', 'enablePivot', 'enableValue', 'pivot', 'pivotIndex', 'aggFunc'];
|
1466 | var itemsUsed = rowGroupingItems.filter(function (x) { return exists(colDefAny[x]); });
|
1467 | if (itemsUsed.length > 0) {
|
1468 | ModuleRegistry.assertRegistered(ModuleNames.RowGroupingModule, itemsUsed.map(function (i) { return 'colDef.' + i; }).join(', '));
|
1469 | }
|
1470 | }
|
1471 | if (this.colDef.cellEditor === 'agRichSelect' || this.colDef.cellEditor === 'agRichSelectCellEditor') {
|
1472 | ModuleRegistry.assertRegistered(ModuleNames.RichSelectModule, this.colDef.cellEditor);
|
1473 | }
|
1474 | if (this.gridOptionsService.isTreeData()) {
|
1475 | var itemsNotAllowedWithTreeData = ['rowGroup', 'rowGroupIndex', 'pivot', 'pivotIndex'];
|
1476 | var itemsUsed = itemsNotAllowedWithTreeData.filter(function (x) { return exists(colDefAny[x]); });
|
1477 | if (itemsUsed.length > 0) {
|
1478 | warnOnce("AG Grid: " + itemsUsed.join() + " is not possible when doing tree data, your column definition should not have " + itemsUsed.join(), 'TreeDataCannotRowGroup');
|
1479 | }
|
1480 | }
|
1481 | if (exists(colDefAny.menuTabs)) {
|
1482 | ModuleRegistry.assertRegistered(ModuleNames.MenuModule, 'menuTabs');
|
1483 | }
|
1484 | if (exists(colDefAny.columnsMenuParams)) {
|
1485 | ModuleRegistry.assertRegistered(ModuleNames.MenuModule, 'columnsMenuParams');
|
1486 | }
|
1487 | if (exists(colDefAny.columnsMenuParams)) {
|
1488 | ModuleRegistry.assertRegistered(ModuleNames.ColumnsToolPanelModule, 'columnsMenuParams');
|
1489 | }
|
1490 | if (exists(this.colDef.width) && typeof this.colDef.width !== 'number') {
|
1491 | warnOnce('AG Grid: colDef.width should be a number, not ' + typeof this.colDef.width, 'ColumnCheck');
|
1492 | }
|
1493 | if (colDefAny.pinnedRowCellRenderer || colDefAny.pinnedRowCellRendererParams || colDefAny.pinnedRowCellRendererFramework) {
|
1494 | warnOnce('AG Grid: pinnedRowCellRenderer[Params,Framework] no longer exist. Use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned.', 'colDef.pinnedRowCellRenderer-deprecated');
|
1495 | }
|
1496 | if (exists(colDefAny.columnGroupShow) && colDefAny.columnGroupShow !== 'closed' && colDefAny.columnGroupShow !== 'open') {
|
1497 | warnOnce("AG Grid: '" + colDefAny.columnGroupShow + "' is not valid for columnGroupShow. Valid values are 'open', 'closed', undefined, null", 'columnGroupShow_invalid');
|
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.gridOptionsService.context,
|
1515 | api: this.gridOptionsService.api,
|
1516 | columnApi: this.gridOptionsService.columnApi
|
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.gridOptionsService.is('enableGroupEdit')) {
|
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.isAutoHeaderHeight = function () {
|
1546 | return !!attrToBoolean(this.colDef.autoHeaderHeight);
|
1547 | };
|
1548 | Column.prototype.isRowDrag = function (rowNode) {
|
1549 | return this.isColumnFunc(rowNode, this.colDef.rowDrag);
|
1550 | };
|
1551 | Column.prototype.isDndSource = function (rowNode) {
|
1552 | return this.isColumnFunc(rowNode, this.colDef.dndSource);
|
1553 | };
|
1554 | Column.prototype.isCellCheckboxSelection = function (rowNode) {
|
1555 | return this.isColumnFunc(rowNode, this.colDef.checkboxSelection);
|
1556 | };
|
1557 | Column.prototype.isSuppressPaste = function (rowNode) {
|
1558 | return this.isColumnFunc(rowNode, this.colDef ? this.colDef.suppressPaste : null);
|
1559 | };
|
1560 | Column.prototype.isResizable = function () {
|
1561 | return !!attrToBoolean(this.colDef.resizable);
|
1562 | };
|
1563 | Column.prototype.isColumnFunc = function (rowNode, value) {
|
1564 |
|
1565 | if (typeof value === 'boolean') {
|
1566 | return value;
|
1567 | }
|
1568 |
|
1569 | if (typeof value === 'function') {
|
1570 | var params = this.createColumnFunctionCallbackParams(rowNode);
|
1571 | var editableFunc = value;
|
1572 | return editableFunc(params);
|
1573 | }
|
1574 | return false;
|
1575 | };
|
1576 | Column.prototype.setMoving = function (moving, source) {
|
1577 | if (source === void 0) { source = "api"; }
|
1578 | this.moving = moving;
|
1579 | this.eventService.dispatchEvent(this.createColumnEvent('movingChanged', source));
|
1580 | };
|
1581 | Column.prototype.createColumnEvent = function (type, source) {
|
1582 | return {
|
1583 | type: type,
|
1584 | column: this,
|
1585 | columns: [this],
|
1586 | source: source,
|
1587 | api: this.gridOptionsService.api,
|
1588 | columnApi: this.gridOptionsService.columnApi,
|
1589 | context: this.gridOptionsService.context
|
1590 | };
|
1591 | };
|
1592 | Column.prototype.isMoving = function () {
|
1593 | return this.moving;
|
1594 | };
|
1595 |
|
1596 | Column.prototype.getSort = function () {
|
1597 | return this.sort;
|
1598 | };
|
1599 | Column.prototype.setSort = function (sort, source) {
|
1600 | if (source === void 0) { source = "api"; }
|
1601 | if (this.sort !== sort) {
|
1602 | this.sort = sort;
|
1603 | this.eventService.dispatchEvent(this.createColumnEvent('sortChanged', source));
|
1604 | }
|
1605 | };
|
1606 | Column.prototype.setMenuVisible = function (visible, source) {
|
1607 | if (source === void 0) { source = "api"; }
|
1608 | if (this.menuVisible !== visible) {
|
1609 | this.menuVisible = visible;
|
1610 | this.eventService.dispatchEvent(this.createColumnEvent('menuVisibleChanged', source));
|
1611 | }
|
1612 | };
|
1613 | Column.prototype.isMenuVisible = function () {
|
1614 | return this.menuVisible;
|
1615 | };
|
1616 | Column.prototype.isSortAscending = function () {
|
1617 | return this.sort === 'asc';
|
1618 | };
|
1619 | Column.prototype.isSortDescending = function () {
|
1620 | return this.sort === 'desc';
|
1621 | };
|
1622 | Column.prototype.isSortNone = function () {
|
1623 | return missing(this.sort);
|
1624 | };
|
1625 | Column.prototype.isSorting = function () {
|
1626 | return exists(this.sort);
|
1627 | };
|
1628 | Column.prototype.getSortIndex = function () {
|
1629 | return this.sortIndex;
|
1630 | };
|
1631 | Column.prototype.setSortIndex = function (sortOrder) {
|
1632 | this.sortIndex = sortOrder;
|
1633 | };
|
1634 | Column.prototype.setAggFunc = function (aggFunc) {
|
1635 | this.aggFunc = aggFunc;
|
1636 | };
|
1637 |
|
1638 | Column.prototype.getAggFunc = function () {
|
1639 | return this.aggFunc;
|
1640 | };
|
1641 | Column.prototype.getLeft = function () {
|
1642 | return this.left;
|
1643 | };
|
1644 | Column.prototype.getOldLeft = function () {
|
1645 | return this.oldLeft;
|
1646 | };
|
1647 | Column.prototype.getRight = function () {
|
1648 | return this.left + this.actualWidth;
|
1649 | };
|
1650 | Column.prototype.setLeft = function (left, source) {
|
1651 | if (source === void 0) { source = "api"; }
|
1652 | this.oldLeft = this.left;
|
1653 | if (this.left !== left) {
|
1654 | this.left = left;
|
1655 | this.eventService.dispatchEvent(this.createColumnEvent('leftChanged', source));
|
1656 | }
|
1657 | };
|
1658 |
|
1659 | Column.prototype.isFilterActive = function () {
|
1660 | return this.filterActive;
|
1661 | };
|
1662 |
|
1663 | Column.prototype.setFilterActive = function (active, source, additionalEventAttributes) {
|
1664 | if (source === void 0) { source = "api"; }
|
1665 | if (this.filterActive !== active) {
|
1666 | this.filterActive = active;
|
1667 | this.eventService.dispatchEvent(this.createColumnEvent('filterActiveChanged', source));
|
1668 | }
|
1669 | var filterChangedEvent = this.createColumnEvent('filterChanged', source);
|
1670 | if (additionalEventAttributes) {
|
1671 | mergeDeep(filterChangedEvent, additionalEventAttributes);
|
1672 | }
|
1673 | this.eventService.dispatchEvent(filterChangedEvent);
|
1674 | };
|
1675 | Column.prototype.setPinned = function (pinned) {
|
1676 | if (pinned === true || pinned === 'left') {
|
1677 | this.pinned = 'left';
|
1678 | }
|
1679 | else if (pinned === 'right') {
|
1680 | this.pinned = 'right';
|
1681 | }
|
1682 | else {
|
1683 | this.pinned = null;
|
1684 | }
|
1685 | };
|
1686 | Column.prototype.setFirstRightPinned = function (firstRightPinned, source) {
|
1687 | if (source === void 0) { source = "api"; }
|
1688 | if (this.firstRightPinned !== firstRightPinned) {
|
1689 | this.firstRightPinned = firstRightPinned;
|
1690 | this.eventService.dispatchEvent(this.createColumnEvent('firstRightPinnedChanged', source));
|
1691 | }
|
1692 | };
|
1693 | Column.prototype.setLastLeftPinned = function (lastLeftPinned, source) {
|
1694 | if (source === void 0) { source = "api"; }
|
1695 | if (this.lastLeftPinned !== lastLeftPinned) {
|
1696 | this.lastLeftPinned = lastLeftPinned;
|
1697 | this.eventService.dispatchEvent(this.createColumnEvent('lastLeftPinnedChanged', source));
|
1698 | }
|
1699 | };
|
1700 | Column.prototype.isFirstRightPinned = function () {
|
1701 | return this.firstRightPinned;
|
1702 | };
|
1703 | Column.prototype.isLastLeftPinned = function () {
|
1704 | return this.lastLeftPinned;
|
1705 | };
|
1706 | Column.prototype.isPinned = function () {
|
1707 | return this.pinned === 'left' || this.pinned === 'right';
|
1708 | };
|
1709 | Column.prototype.isPinnedLeft = function () {
|
1710 | return this.pinned === 'left';
|
1711 | };
|
1712 | Column.prototype.isPinnedRight = function () {
|
1713 | return this.pinned === 'right';
|
1714 | };
|
1715 | Column.prototype.getPinned = function () {
|
1716 | return this.pinned;
|
1717 | };
|
1718 | Column.prototype.setVisible = function (visible, source) {
|
1719 | if (source === void 0) { source = "api"; }
|
1720 | var newValue = visible === true;
|
1721 | if (this.visible !== newValue) {
|
1722 | this.visible = newValue;
|
1723 | this.eventService.dispatchEvent(this.createColumnEvent('visibleChanged', source));
|
1724 | }
|
1725 | };
|
1726 | Column.prototype.isVisible = function () {
|
1727 | return this.visible;
|
1728 | };
|
1729 | Column.prototype.isSpanHeaderHeight = function () {
|
1730 | return !!this.getColDef().spanHeaderHeight;
|
1731 | };
|
1732 | |
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 | Column.prototype.getColDef = function () {
|
1738 | return this.colDef;
|
1739 | };
|
1740 | Column.prototype.getColumnGroupShow = function () {
|
1741 | return this.colDef.columnGroupShow;
|
1742 | };
|
1743 | |
1744 |
|
1745 |
|
1746 |
|
1747 | Column.prototype.getColId = function () {
|
1748 | return this.colId;
|
1749 | };
|
1750 | |
1751 |
|
1752 |
|
1753 |
|
1754 | Column.prototype.getId = function () {
|
1755 | return this.getColId();
|
1756 | };
|
1757 | |
1758 |
|
1759 |
|
1760 |
|
1761 | Column.prototype.getUniqueId = function () {
|
1762 | return this.getId();
|
1763 | };
|
1764 | Column.prototype.getDefinition = function () {
|
1765 | return this.colDef;
|
1766 | };
|
1767 |
|
1768 | Column.prototype.getActualWidth = function () {
|
1769 | return this.actualWidth;
|
1770 | };
|
1771 | Column.prototype.getAutoHeaderHeight = function () {
|
1772 | return this.autoHeaderHeight;
|
1773 | };
|
1774 |
|
1775 | Column.prototype.setAutoHeaderHeight = function (height) {
|
1776 | var changed = height !== this.autoHeaderHeight;
|
1777 | this.autoHeaderHeight = height;
|
1778 | return changed;
|
1779 | };
|
1780 | Column.prototype.createBaseColDefParams = function (rowNode) {
|
1781 | var params = {
|
1782 | node: rowNode,
|
1783 | data: rowNode.data,
|
1784 | colDef: this.colDef,
|
1785 | column: this,
|
1786 | api: this.gridOptionsService.api,
|
1787 | columnApi: this.gridOptionsService.columnApi,
|
1788 | context: this.gridOptionsService.context
|
1789 | };
|
1790 | return params;
|
1791 | };
|
1792 | Column.prototype.getColSpan = function (rowNode) {
|
1793 | if (missing(this.colDef.colSpan)) {
|
1794 | return 1;
|
1795 | }
|
1796 | var params = this.createBaseColDefParams(rowNode);
|
1797 | var colSpan = this.colDef.colSpan(params);
|
1798 |
|
1799 | return Math.max(colSpan, 1);
|
1800 | };
|
1801 | Column.prototype.getRowSpan = function (rowNode) {
|
1802 | if (missing(this.colDef.rowSpan)) {
|
1803 | return 1;
|
1804 | }
|
1805 | var params = this.createBaseColDefParams(rowNode);
|
1806 | var rowSpan = this.colDef.rowSpan(params);
|
1807 |
|
1808 | return Math.max(rowSpan, 1);
|
1809 | };
|
1810 | Column.prototype.setActualWidth = function (actualWidth, source, silent) {
|
1811 | if (source === void 0) { source = "api"; }
|
1812 | if (silent === void 0) { silent = false; }
|
1813 | if (this.minWidth != null) {
|
1814 | actualWidth = Math.max(actualWidth, this.minWidth);
|
1815 | }
|
1816 | if (this.maxWidth != null) {
|
1817 | actualWidth = Math.min(actualWidth, this.maxWidth);
|
1818 | }
|
1819 | if (this.actualWidth !== actualWidth) {
|
1820 |
|
1821 | this.actualWidth = actualWidth;
|
1822 | if (this.flex && source !== 'flex' && source !== 'gridInitializing') {
|
1823 | this.flex = null;
|
1824 | }
|
1825 | if (!silent) {
|
1826 | this.fireColumnWidthChangedEvent(source);
|
1827 | }
|
1828 | }
|
1829 | };
|
1830 | Column.prototype.fireColumnWidthChangedEvent = function (source) {
|
1831 | this.eventService.dispatchEvent(this.createColumnEvent('widthChanged', source));
|
1832 | };
|
1833 | Column.prototype.isGreaterThanMax = function (width) {
|
1834 | if (this.maxWidth != null) {
|
1835 | return width > this.maxWidth;
|
1836 | }
|
1837 | return false;
|
1838 | };
|
1839 | Column.prototype.getMinWidth = function () {
|
1840 | return this.minWidth;
|
1841 | };
|
1842 | Column.prototype.getMaxWidth = function () {
|
1843 | return this.maxWidth;
|
1844 | };
|
1845 | Column.prototype.getFlex = function () {
|
1846 | return this.flex || 0;
|
1847 | };
|
1848 |
|
1849 |
|
1850 | Column.prototype.setFlex = function (flex) {
|
1851 | if (this.flex !== flex) {
|
1852 | this.flex = flex;
|
1853 | }
|
1854 | };
|
1855 | Column.prototype.setMinimum = function (source) {
|
1856 | if (source === void 0) { source = "api"; }
|
1857 | if (exists(this.minWidth)) {
|
1858 | this.setActualWidth(this.minWidth, source);
|
1859 | }
|
1860 | };
|
1861 | Column.prototype.setRowGroupActive = function (rowGroup, source) {
|
1862 | if (source === void 0) { source = "api"; }
|
1863 | if (this.rowGroupActive !== rowGroup) {
|
1864 | this.rowGroupActive = rowGroup;
|
1865 | this.eventService.dispatchEvent(this.createColumnEvent('columnRowGroupChanged', source));
|
1866 | }
|
1867 | };
|
1868 |
|
1869 | Column.prototype.isRowGroupActive = function () {
|
1870 | return this.rowGroupActive;
|
1871 | };
|
1872 | Column.prototype.setPivotActive = function (pivot, source) {
|
1873 | if (source === void 0) { source = "api"; }
|
1874 | if (this.pivotActive !== pivot) {
|
1875 | this.pivotActive = pivot;
|
1876 | this.eventService.dispatchEvent(this.createColumnEvent('columnPivotChanged', source));
|
1877 | }
|
1878 | };
|
1879 |
|
1880 | Column.prototype.isPivotActive = function () {
|
1881 | return this.pivotActive;
|
1882 | };
|
1883 | Column.prototype.isAnyFunctionActive = function () {
|
1884 | return this.isPivotActive() || this.isRowGroupActive() || this.isValueActive();
|
1885 | };
|
1886 | Column.prototype.isAnyFunctionAllowed = function () {
|
1887 | return this.isAllowPivot() || this.isAllowRowGroup() || this.isAllowValue();
|
1888 | };
|
1889 | Column.prototype.setValueActive = function (value, source) {
|
1890 | if (source === void 0) { source = "api"; }
|
1891 | if (this.aggregationActive !== value) {
|
1892 | this.aggregationActive = value;
|
1893 | this.eventService.dispatchEvent(this.createColumnEvent('columnValueChanged', source));
|
1894 | }
|
1895 | };
|
1896 |
|
1897 | Column.prototype.isValueActive = function () {
|
1898 | return this.aggregationActive;
|
1899 | };
|
1900 | Column.prototype.isAllowPivot = function () {
|
1901 | return this.colDef.enablePivot === true;
|
1902 | };
|
1903 | Column.prototype.isAllowValue = function () {
|
1904 | return this.colDef.enableValue === true;
|
1905 | };
|
1906 | Column.prototype.isAllowRowGroup = function () {
|
1907 | return this.colDef.enableRowGroup === true;
|
1908 | };
|
1909 | Column.prototype.getMenuTabs = function (defaultValues) {
|
1910 | var menuTabs = this.getColDef().menuTabs;
|
1911 | if (menuTabs == null) {
|
1912 | menuTabs = defaultValues;
|
1913 | }
|
1914 | return menuTabs;
|
1915 | };
|
1916 |
|
1917 | Column.EVENT_MOVING_CHANGED = 'movingChanged';
|
1918 |
|
1919 | Column.EVENT_LEFT_CHANGED = 'leftChanged';
|
1920 |
|
1921 | Column.EVENT_WIDTH_CHANGED = 'widthChanged';
|
1922 |
|
1923 | Column.EVENT_LAST_LEFT_PINNED_CHANGED = 'lastLeftPinnedChanged';
|
1924 | Column.EVENT_FIRST_RIGHT_PINNED_CHANGED = 'firstRightPinnedChanged';
|
1925 |
|
1926 | Column.EVENT_VISIBLE_CHANGED = 'visibleChanged';
|
1927 |
|
1928 | Column.EVENT_FILTER_CHANGED = 'filterChanged';
|
1929 |
|
1930 | Column.EVENT_FILTER_ACTIVE_CHANGED = 'filterActiveChanged';
|
1931 |
|
1932 | Column.EVENT_SORT_CHANGED = 'sortChanged';
|
1933 |
|
1934 | Column.EVENT_COL_DEF_CHANGED = 'colDefChanged';
|
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$2y([
|
1943 | Autowired('gridOptionsService')
|
1944 | ], Column.prototype, "gridOptionsService", void 0);
|
1945 | __decorate$2y([
|
1946 | Autowired('columnUtils')
|
1947 | ], Column.prototype, "columnUtils", void 0);
|
1948 | __decorate$2y([
|
1949 | PostConstruct
|
1950 | ], Column.prototype, "initialise", null);
|
1951 | return Column;
|
1952 | }());
|
1953 |
|
1954 |
|
1955 |
|
1956 |
|
1957 |
|
1958 |
|
1959 |
|
1960 | var __decorate$2x = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
1961 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
1962 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
1963 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
1964 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
1965 | };
|
1966 | var ProvidedColumnGroup = (function () {
|
1967 | function ProvidedColumnGroup(colGroupDef, groupId, padding, level) {
|
1968 | this.localEventService = new EventService();
|
1969 | this.expandable = false;
|
1970 |
|
1971 |
|
1972 | this.instanceId = getNextColInstanceId();
|
1973 | this.expandableListenerRemoveCallback = null;
|
1974 | this.colGroupDef = colGroupDef;
|
1975 | this.groupId = groupId;
|
1976 | this.expanded = !!colGroupDef && !!colGroupDef.openByDefault;
|
1977 | this.padding = padding;
|
1978 | this.level = level;
|
1979 | }
|
1980 | ProvidedColumnGroup.prototype.destroy = function () {
|
1981 | if (this.expandableListenerRemoveCallback) {
|
1982 | this.reset(null, undefined);
|
1983 | }
|
1984 | };
|
1985 | ProvidedColumnGroup.prototype.reset = function (colGroupDef, level) {
|
1986 | this.colGroupDef = colGroupDef;
|
1987 | this.level = level;
|
1988 | this.originalParent = null;
|
1989 | if (this.expandableListenerRemoveCallback) {
|
1990 | this.expandableListenerRemoveCallback();
|
1991 | }
|
1992 |
|
1993 |
|
1994 | this.children = undefined;
|
1995 | this.expandable = undefined;
|
1996 | };
|
1997 | ProvidedColumnGroup.prototype.getInstanceId = function () {
|
1998 | return this.instanceId;
|
1999 | };
|
2000 | ProvidedColumnGroup.prototype.setOriginalParent = function (originalParent) {
|
2001 | this.originalParent = originalParent;
|
2002 | };
|
2003 | ProvidedColumnGroup.prototype.getOriginalParent = function () {
|
2004 | return this.originalParent;
|
2005 | };
|
2006 | ProvidedColumnGroup.prototype.getLevel = function () {
|
2007 | return this.level;
|
2008 | };
|
2009 | ProvidedColumnGroup.prototype.isVisible = function () {
|
2010 |
|
2011 | if (this.children) {
|
2012 | return this.children.some(function (child) { return child.isVisible(); });
|
2013 | }
|
2014 | return false;
|
2015 | };
|
2016 | ProvidedColumnGroup.prototype.isPadding = function () {
|
2017 | return this.padding;
|
2018 | };
|
2019 | ProvidedColumnGroup.prototype.setExpanded = function (expanded) {
|
2020 | this.expanded = expanded === undefined ? false : expanded;
|
2021 | var event = {
|
2022 | type: ProvidedColumnGroup.EVENT_EXPANDED_CHANGED
|
2023 | };
|
2024 | this.localEventService.dispatchEvent(event);
|
2025 | };
|
2026 | ProvidedColumnGroup.prototype.isExpandable = function () {
|
2027 | return this.expandable;
|
2028 | };
|
2029 | ProvidedColumnGroup.prototype.isExpanded = function () {
|
2030 | return this.expanded;
|
2031 | };
|
2032 | ProvidedColumnGroup.prototype.getGroupId = function () {
|
2033 | return this.groupId;
|
2034 | };
|
2035 | ProvidedColumnGroup.prototype.getId = function () {
|
2036 | return this.getGroupId();
|
2037 | };
|
2038 | ProvidedColumnGroup.prototype.setChildren = function (children) {
|
2039 | this.children = children;
|
2040 | };
|
2041 | ProvidedColumnGroup.prototype.getChildren = function () {
|
2042 | return this.children;
|
2043 | };
|
2044 | ProvidedColumnGroup.prototype.getColGroupDef = function () {
|
2045 | return this.colGroupDef;
|
2046 | };
|
2047 | ProvidedColumnGroup.prototype.getLeafColumns = function () {
|
2048 | var result = [];
|
2049 | this.addLeafColumns(result);
|
2050 | return result;
|
2051 | };
|
2052 | ProvidedColumnGroup.prototype.addLeafColumns = function (leafColumns) {
|
2053 | if (!this.children) {
|
2054 | return;
|
2055 | }
|
2056 | this.children.forEach(function (child) {
|
2057 | if (child instanceof Column) {
|
2058 | leafColumns.push(child);
|
2059 | }
|
2060 | else if (child instanceof ProvidedColumnGroup) {
|
2061 | child.addLeafColumns(leafColumns);
|
2062 | }
|
2063 | });
|
2064 | };
|
2065 | ProvidedColumnGroup.prototype.getColumnGroupShow = function () {
|
2066 | var colGroupDef = this.colGroupDef;
|
2067 | if (!colGroupDef) {
|
2068 | return;
|
2069 | }
|
2070 | return colGroupDef.columnGroupShow;
|
2071 | };
|
2072 |
|
2073 |
|
2074 | ProvidedColumnGroup.prototype.setupExpandable = function () {
|
2075 | var _this = this;
|
2076 | this.setExpandable();
|
2077 | if (this.expandableListenerRemoveCallback) {
|
2078 | this.expandableListenerRemoveCallback();
|
2079 | }
|
2080 | var listener = this.onColumnVisibilityChanged.bind(this);
|
2081 | this.getLeafColumns().forEach(function (col) { return col.addEventListener('visibleChanged', listener); });
|
2082 | this.expandableListenerRemoveCallback = function () {
|
2083 | _this.getLeafColumns().forEach(function (col) { return col.removeEventListener('visibleChanged', listener); });
|
2084 | _this.expandableListenerRemoveCallback = null;
|
2085 | };
|
2086 | };
|
2087 | ProvidedColumnGroup.prototype.setExpandable = function () {
|
2088 | if (this.isPadding()) {
|
2089 | return;
|
2090 | }
|
2091 |
|
2092 | var atLeastOneShowingWhenOpen = false;
|
2093 |
|
2094 | var atLeastOneShowingWhenClosed = false;
|
2095 |
|
2096 | var atLeastOneChangeable = false;
|
2097 | var children = this.findChildrenRemovingPadding();
|
2098 | for (var i = 0, j = children.length; i < j; i++) {
|
2099 | var abstractColumn = children[i];
|
2100 | if (!abstractColumn.isVisible()) {
|
2101 | continue;
|
2102 | }
|
2103 |
|
2104 | var headerGroupShow = abstractColumn.getColumnGroupShow();
|
2105 | if (headerGroupShow === 'open') {
|
2106 | atLeastOneShowingWhenOpen = true;
|
2107 | atLeastOneChangeable = true;
|
2108 | }
|
2109 | else if (headerGroupShow === 'closed') {
|
2110 | atLeastOneShowingWhenClosed = true;
|
2111 | atLeastOneChangeable = true;
|
2112 | }
|
2113 | else {
|
2114 | atLeastOneShowingWhenOpen = true;
|
2115 | atLeastOneShowingWhenClosed = true;
|
2116 | }
|
2117 | }
|
2118 | var expandable = atLeastOneShowingWhenOpen && atLeastOneShowingWhenClosed && atLeastOneChangeable;
|
2119 | if (this.expandable !== expandable) {
|
2120 | this.expandable = expandable;
|
2121 | var event_1 = {
|
2122 | type: ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED
|
2123 | };
|
2124 | this.localEventService.dispatchEvent(event_1);
|
2125 | }
|
2126 | };
|
2127 | ProvidedColumnGroup.prototype.findChildrenRemovingPadding = function () {
|
2128 | var res = [];
|
2129 | var process = function (items) {
|
2130 | items.forEach(function (item) {
|
2131 |
|
2132 | var skipBecausePadding = item instanceof ProvidedColumnGroup && item.isPadding();
|
2133 | if (skipBecausePadding) {
|
2134 | process(item.children);
|
2135 | }
|
2136 | else {
|
2137 | res.push(item);
|
2138 | }
|
2139 | });
|
2140 | };
|
2141 | process(this.children);
|
2142 | return res;
|
2143 | };
|
2144 | ProvidedColumnGroup.prototype.onColumnVisibilityChanged = function () {
|
2145 | this.setExpandable();
|
2146 | };
|
2147 | ProvidedColumnGroup.prototype.addEventListener = function (eventType, listener) {
|
2148 | this.localEventService.addEventListener(eventType, listener);
|
2149 | };
|
2150 | ProvidedColumnGroup.prototype.removeEventListener = function (eventType, listener) {
|
2151 | this.localEventService.removeEventListener(eventType, listener);
|
2152 | };
|
2153 | ProvidedColumnGroup.EVENT_EXPANDED_CHANGED = 'expandedChanged';
|
2154 | ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED = 'expandableChanged';
|
2155 | __decorate$2x([
|
2156 | PreDestroy
|
2157 | ], ProvidedColumnGroup.prototype, "destroy", null);
|
2158 | return ProvidedColumnGroup;
|
2159 | }());
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 | var DefaultColumnTypes = {
|
2168 | numericColumn: {
|
2169 | headerClass: 'ag-right-aligned-header',
|
2170 | cellClass: 'ag-right-aligned-cell'
|
2171 | },
|
2172 | rightAligned: {
|
2173 | headerClass: 'ag-right-aligned-header',
|
2174 | cellClass: 'ag-right-aligned-cell'
|
2175 | }
|
2176 | };
|
2177 |
|
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 |
|
2183 |
|
2184 | function firstExistingValue() {
|
2185 | var values = [];
|
2186 | for (var _i = 0; _i < arguments.length; _i++) {
|
2187 | values[_i] = arguments[_i];
|
2188 | }
|
2189 | for (var i = 0; i < values.length; i++) {
|
2190 | var value = values[i];
|
2191 | if (exists(value)) {
|
2192 | return value;
|
2193 | }
|
2194 | }
|
2195 | return null;
|
2196 | }
|
2197 | function existsAndNotEmpty(value) {
|
2198 | return value != null && value.length > 0;
|
2199 | }
|
2200 | function last(arr) {
|
2201 | if (!arr || !arr.length) {
|
2202 | return;
|
2203 | }
|
2204 | return arr[arr.length - 1];
|
2205 | }
|
2206 | function areEqual(a, b, comparator) {
|
2207 | if (a == null && b == null) {
|
2208 | return true;
|
2209 | }
|
2210 | return a != null &&
|
2211 | b != null &&
|
2212 | a.length === b.length &&
|
2213 | a.every(function (value, index) { return comparator ? comparator(value, b[index]) : b[index] === value; });
|
2214 | }
|
2215 |
|
2216 | function shallowCompare(arr1, arr2) {
|
2217 | return areEqual(arr1, arr2);
|
2218 | }
|
2219 | function sortNumerically(array) {
|
2220 | return array.sort(function (a, b) { return a - b; });
|
2221 | }
|
2222 | function removeRepeatsFromArray(array, object) {
|
2223 | if (!array) {
|
2224 | return;
|
2225 | }
|
2226 | for (var index = array.length - 2; index >= 0; index--) {
|
2227 | var thisOneMatches = array[index] === object;
|
2228 | var nextOneMatches = array[index + 1] === object;
|
2229 | if (thisOneMatches && nextOneMatches) {
|
2230 | array.splice(index + 1, 1);
|
2231 | }
|
2232 | }
|
2233 | }
|
2234 | function removeFromArray(array, object) {
|
2235 | var index = array.indexOf(object);
|
2236 | if (index >= 0) {
|
2237 | array.splice(index, 1);
|
2238 | }
|
2239 | }
|
2240 | function removeAllFromArray(array, toRemove) {
|
2241 | toRemove.forEach(function (item) { return removeFromArray(array, item); });
|
2242 | }
|
2243 | function insertIntoArray(array, object, toIndex) {
|
2244 | array.splice(toIndex, 0, object);
|
2245 | }
|
2246 | function insertArrayIntoArray(dest, src, toIndex) {
|
2247 | if (dest == null || src == null) {
|
2248 | return;
|
2249 | }
|
2250 |
|
2251 | for (var i = src.length - 1; i >= 0; i--) {
|
2252 | var item = src[i];
|
2253 | insertIntoArray(dest, item, toIndex);
|
2254 | }
|
2255 | }
|
2256 | function moveInArray(array, objectsToMove, toIndex) {
|
2257 |
|
2258 | removeAllFromArray(array, objectsToMove);
|
2259 |
|
2260 |
|
2261 | objectsToMove.slice().reverse().forEach(function (obj) { return insertIntoArray(array, obj, toIndex); });
|
2262 | }
|
2263 | function includes(array, value) {
|
2264 | return array.indexOf(value) > -1;
|
2265 | }
|
2266 | function flatten(arrayOfArrays) {
|
2267 | return [].concat.apply([], arrayOfArrays);
|
2268 | }
|
2269 | function pushAll(target, source) {
|
2270 | if (source == null || target == null) {
|
2271 | return;
|
2272 | }
|
2273 | source.forEach(function (value) { return target.push(value); });
|
2274 | }
|
2275 | function toStrings(array) {
|
2276 | return array.map(toStringOrNull);
|
2277 | }
|
2278 | function forEachReverse(list, action) {
|
2279 | if (list == null) {
|
2280 | return;
|
2281 | }
|
2282 | for (var i = list.length - 1; i >= 0; i--) {
|
2283 | action(list[i], i);
|
2284 | }
|
2285 | }
|
2286 |
|
2287 | var ArrayUtils = Object.freeze({
|
2288 | __proto__: null,
|
2289 | firstExistingValue: firstExistingValue,
|
2290 | existsAndNotEmpty: existsAndNotEmpty,
|
2291 | last: last,
|
2292 | areEqual: areEqual,
|
2293 | shallowCompare: shallowCompare,
|
2294 | sortNumerically: sortNumerically,
|
2295 | removeRepeatsFromArray: removeRepeatsFromArray,
|
2296 | removeFromArray: removeFromArray,
|
2297 | removeAllFromArray: removeAllFromArray,
|
2298 | insertIntoArray: insertIntoArray,
|
2299 | insertArrayIntoArray: insertArrayIntoArray,
|
2300 | moveInArray: moveInArray,
|
2301 | includes: includes,
|
2302 | flatten: flatten,
|
2303 | pushAll: pushAll,
|
2304 | toStrings: toStrings,
|
2305 | forEachReverse: forEachReverse
|
2306 | });
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 | var AG_GRID_STOP_PROPAGATION = '__ag_Grid_Stop_Propagation';
|
2315 | var PASSIVE_EVENTS$1 = ['touchstart', 'touchend', 'touchmove', 'touchcancel', 'scroll'];
|
2316 | var supports = {};
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 | function stopPropagationForAgGrid(event) {
|
2327 | event[AG_GRID_STOP_PROPAGATION] = true;
|
2328 | }
|
2329 | function isStopPropagationForAgGrid(event) {
|
2330 | return event[AG_GRID_STOP_PROPAGATION] === true;
|
2331 | }
|
2332 | var isEventSupported = (function () {
|
2333 | var tags = {
|
2334 | select: 'input',
|
2335 | change: 'input',
|
2336 | submit: 'form',
|
2337 | reset: 'form',
|
2338 | error: 'img',
|
2339 | load: 'img',
|
2340 | abort: 'img'
|
2341 | };
|
2342 | var eventChecker = function (eventName) {
|
2343 | if (typeof supports[eventName] === 'boolean') {
|
2344 | return supports[eventName];
|
2345 | }
|
2346 | var el = document.createElement(tags[eventName] || 'div');
|
2347 | eventName = 'on' + eventName;
|
2348 | return supports[eventName] = (eventName in el);
|
2349 | };
|
2350 | return eventChecker;
|
2351 | })();
|
2352 | function getCtrlForEvent(gridOptionsService, event, type) {
|
2353 | var sourceElement = event.target;
|
2354 | while (sourceElement) {
|
2355 | var renderedComp = gridOptionsService.getDomData(sourceElement, type);
|
2356 | if (renderedComp) {
|
2357 | return renderedComp;
|
2358 | }
|
2359 | sourceElement = sourceElement.parentElement;
|
2360 | }
|
2361 | return null;
|
2362 | }
|
2363 | function isElementInEventPath(element, event) {
|
2364 | if (!event || !element) {
|
2365 | return false;
|
2366 | }
|
2367 | return getEventPath(event).indexOf(element) >= 0;
|
2368 | }
|
2369 | function createEventPath(event) {
|
2370 | var res = [];
|
2371 | var pointer = event.target;
|
2372 | while (pointer) {
|
2373 | res.push(pointer);
|
2374 | pointer = pointer.parentElement;
|
2375 | }
|
2376 | return res;
|
2377 | }
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 | function getEventPath(event) {
|
2385 |
|
2386 | var eventNoType = event;
|
2387 | if (eventNoType.path) {
|
2388 | return eventNoType.path;
|
2389 | }
|
2390 | if (eventNoType.composedPath) {
|
2391 | return eventNoType.composedPath();
|
2392 | }
|
2393 |
|
2394 | return createEventPath(eventNoType);
|
2395 | }
|
2396 | function addSafePassiveEventListener(frameworkOverrides, eElement, event, listener) {
|
2397 | var isPassive = includes(PASSIVE_EVENTS$1, event);
|
2398 | var options = isPassive ? { passive: true } : undefined;
|
2399 |
|
2400 |
|
2401 | if (frameworkOverrides && frameworkOverrides.addEventListener) {
|
2402 | frameworkOverrides.addEventListener(eElement, event, listener, options);
|
2403 | }
|
2404 | }
|
2405 |
|
2406 | var EventUtils = Object.freeze({
|
2407 | __proto__: null,
|
2408 | stopPropagationForAgGrid: stopPropagationForAgGrid,
|
2409 | isStopPropagationForAgGrid: isStopPropagationForAgGrid,
|
2410 | isEventSupported: isEventSupported,
|
2411 | getCtrlForEvent: getCtrlForEvent,
|
2412 | isElementInEventPath: isElementInEventPath,
|
2413 | createEventPath: createEventPath,
|
2414 | getEventPath: getEventPath,
|
2415 | addSafePassiveEventListener: addSafePassiveEventListener
|
2416 | });
|
2417 |
|
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 |
|
2424 | var __decorate$2w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2425 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
2426 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
2427 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
2428 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
2429 | };
|
2430 | var BeanStub = (function () {
|
2431 | function BeanStub() {
|
2432 | var _this = this;
|
2433 | this.destroyFunctions = [];
|
2434 | this.destroyed = false;
|
2435 |
|
2436 |
|
2437 | this.__v_skip = true;
|
2438 | this.isAlive = function () { return !_this.destroyed; };
|
2439 | }
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 |
|
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 |
|
2453 |
|
2454 |
|
2455 | BeanStub.prototype.getFrameworkOverrides = function () {
|
2456 | return this.frameworkOverrides;
|
2457 | };
|
2458 | BeanStub.prototype.getContext = function () {
|
2459 | return this.context;
|
2460 | };
|
2461 | BeanStub.prototype.destroy = function () {
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 | this.destroyFunctions.forEach(function (func) { return func(); });
|
2467 | this.destroyFunctions.length = 0;
|
2468 | this.destroyed = true;
|
2469 | this.dispatchEvent({ type: BeanStub.EVENT_DESTROYED });
|
2470 | };
|
2471 | BeanStub.prototype.addEventListener = function (eventType, listener) {
|
2472 | if (!this.localEventService) {
|
2473 | this.localEventService = new EventService();
|
2474 | }
|
2475 | this.localEventService.addEventListener(eventType, listener);
|
2476 | };
|
2477 | BeanStub.prototype.removeEventListener = function (eventType, listener) {
|
2478 | if (this.localEventService) {
|
2479 | this.localEventService.removeEventListener(eventType, listener);
|
2480 | }
|
2481 | };
|
2482 | BeanStub.prototype.dispatchEventAsync = function (event) {
|
2483 | var _this = this;
|
2484 | window.setTimeout(function () { return _this.dispatchEvent(event); }, 0);
|
2485 | };
|
2486 | BeanStub.prototype.dispatchEvent = function (event) {
|
2487 | if (this.localEventService) {
|
2488 | this.localEventService.dispatchEvent(event);
|
2489 | }
|
2490 | };
|
2491 | BeanStub.prototype.addManagedListener = function (object, event, listener) {
|
2492 | var _this = this;
|
2493 | if (this.destroyed) {
|
2494 | return;
|
2495 | }
|
2496 | if (object instanceof HTMLElement) {
|
2497 | addSafePassiveEventListener(this.getFrameworkOverrides(), object, event, listener);
|
2498 | }
|
2499 | else {
|
2500 | object.addEventListener(event, listener);
|
2501 | }
|
2502 | var destroyFunc = function () {
|
2503 | object.removeEventListener(event, listener);
|
2504 | _this.destroyFunctions = _this.destroyFunctions.filter(function (fn) { return fn !== destroyFunc; });
|
2505 | return null;
|
2506 | };
|
2507 | this.destroyFunctions.push(destroyFunc);
|
2508 | return destroyFunc;
|
2509 | };
|
2510 | BeanStub.prototype.addManagedPropertyListener = function (event, listener) {
|
2511 | var _this = this;
|
2512 | if (this.destroyed) {
|
2513 | return;
|
2514 | }
|
2515 | this.gridOptionsService.addEventListener(event, listener);
|
2516 | var destroyFunc = function () {
|
2517 | _this.gridOptionsService.removeEventListener(event, listener);
|
2518 | _this.destroyFunctions = _this.destroyFunctions.filter(function (fn) { return fn !== destroyFunc; });
|
2519 | return null;
|
2520 | };
|
2521 | this.destroyFunctions.push(destroyFunc);
|
2522 | return destroyFunc;
|
2523 | };
|
2524 | BeanStub.prototype.addDestroyFunc = function (func) {
|
2525 |
|
2526 | if (this.isAlive()) {
|
2527 | this.destroyFunctions.push(func);
|
2528 | }
|
2529 | else {
|
2530 | func();
|
2531 | }
|
2532 | };
|
2533 | BeanStub.prototype.createManagedBean = function (bean, context) {
|
2534 | var res = this.createBean(bean, context);
|
2535 | this.addDestroyFunc(this.destroyBean.bind(this, bean, context));
|
2536 | return res;
|
2537 | };
|
2538 | BeanStub.prototype.createBean = function (bean, context, afterPreCreateCallback) {
|
2539 | return (context || this.getContext()).createBean(bean, afterPreCreateCallback);
|
2540 | };
|
2541 | BeanStub.prototype.destroyBean = function (bean, context) {
|
2542 | return (context || this.getContext()).destroyBean(bean);
|
2543 | };
|
2544 | BeanStub.prototype.destroyBeans = function (beans, context) {
|
2545 | var _this = this;
|
2546 | if (beans) {
|
2547 | beans.forEach(function (bean) { return _this.destroyBean(bean, context); });
|
2548 | }
|
2549 | return [];
|
2550 | };
|
2551 | BeanStub.EVENT_DESTROYED = 'destroyed';
|
2552 | __decorate$2w([
|
2553 | Autowired('frameworkOverrides')
|
2554 | ], BeanStub.prototype, "frameworkOverrides", void 0);
|
2555 | __decorate$2w([
|
2556 | Autowired('context')
|
2557 | ], BeanStub.prototype, "context", void 0);
|
2558 | __decorate$2w([
|
2559 | Autowired('eventService')
|
2560 | ], BeanStub.prototype, "eventService", void 0);
|
2561 | __decorate$2w([
|
2562 | Autowired('gridOptionsService')
|
2563 | ], BeanStub.prototype, "gridOptionsService", void 0);
|
2564 | __decorate$2w([
|
2565 | Autowired('localeService')
|
2566 | ], BeanStub.prototype, "localeService", void 0);
|
2567 | __decorate$2w([
|
2568 | Autowired('environment')
|
2569 | ], BeanStub.prototype, "environment", void 0);
|
2570 | __decorate$2w([
|
2571 | PreDestroy
|
2572 | ], BeanStub.prototype, "destroy", null);
|
2573 | return BeanStub;
|
2574 | }());
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 |
|
2580 |
|
2581 |
|
2582 | var __extends$2S = (undefined && undefined.__extends) || (function () {
|
2583 | var extendStatics = function (d, b) {
|
2584 | extendStatics = Object.setPrototypeOf ||
|
2585 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
2586 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
2587 | return extendStatics(d, b);
|
2588 | };
|
2589 | return function (d, b) {
|
2590 | extendStatics(d, b);
|
2591 | function __() { this.constructor = d; }
|
2592 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2593 | };
|
2594 | })();
|
2595 | var __decorate$2v = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2596 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
2597 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
2598 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
2599 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
2600 | };
|
2601 | var __param$9 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
2602 | return function (target, key) { decorator(target, key, paramIndex); }
|
2603 | };
|
2604 |
|
2605 | var ColumnFactory = (function (_super) {
|
2606 | __extends$2S(ColumnFactory, _super);
|
2607 | function ColumnFactory() {
|
2608 | return _super !== null && _super.apply(this, arguments) || this;
|
2609 | }
|
2610 | ColumnFactory.prototype.setBeans = function (loggerFactory) {
|
2611 | this.logger = loggerFactory.create('ColumnFactory');
|
2612 | };
|
2613 | ColumnFactory.prototype.createColumnTree = function (defs, primaryColumns, existingTree) {
|
2614 |
|
2615 |
|
2616 |
|
2617 | var columnKeyCreator = new ColumnKeyCreator();
|
2618 | var _a = this.extractExistingTreeData(existingTree), existingCols = _a.existingCols, existingGroups = _a.existingGroups, existingColKeys = _a.existingColKeys;
|
2619 | columnKeyCreator.addExistingKeys(existingColKeys);
|
2620 |
|
2621 | var unbalancedTree = this.recursivelyCreateColumns(defs, 0, primaryColumns, existingCols, columnKeyCreator, existingGroups);
|
2622 | var treeDept = this.findMaxDept(unbalancedTree, 0);
|
2623 | this.logger.log('Number of levels for grouped columns is ' + treeDept);
|
2624 | var columnTree = this.balanceColumnTree(unbalancedTree, 0, treeDept, columnKeyCreator);
|
2625 | var deptFirstCallback = function (child, parent) {
|
2626 | if (child instanceof ProvidedColumnGroup) {
|
2627 | child.setupExpandable();
|
2628 | }
|
2629 |
|
2630 |
|
2631 | child.setOriginalParent(parent);
|
2632 | };
|
2633 | this.columnUtils.depthFirstOriginalTreeSearch(null, columnTree, deptFirstCallback);
|
2634 | return {
|
2635 | columnTree: columnTree,
|
2636 | treeDept: treeDept
|
2637 | };
|
2638 | };
|
2639 | ColumnFactory.prototype.extractExistingTreeData = function (existingTree) {
|
2640 | var existingCols = [];
|
2641 | var existingGroups = [];
|
2642 | var existingColKeys = [];
|
2643 | if (existingTree) {
|
2644 | this.columnUtils.depthFirstOriginalTreeSearch(null, existingTree, function (item) {
|
2645 | if (item instanceof ProvidedColumnGroup) {
|
2646 | var group = item;
|
2647 | existingGroups.push(group);
|
2648 | }
|
2649 | else {
|
2650 | var col = item;
|
2651 | existingColKeys.push(col.getId());
|
2652 | existingCols.push(col);
|
2653 | }
|
2654 | });
|
2655 | }
|
2656 | return { existingCols: existingCols, existingGroups: existingGroups, existingColKeys: existingColKeys };
|
2657 | };
|
2658 | ColumnFactory.prototype.createForAutoGroups = function (autoGroupCols, gridBalancedTree) {
|
2659 | var _this = this;
|
2660 | return autoGroupCols.map(function (col) { return _this.createAutoGroupTreeItem(gridBalancedTree, col); });
|
2661 | };
|
2662 | ColumnFactory.prototype.createAutoGroupTreeItem = function (balancedColumnTree, column) {
|
2663 | var dept = this.findDepth(balancedColumnTree);
|
2664 |
|
2665 | var nextChild = column;
|
2666 | for (var i = dept - 1; i >= 0; i--) {
|
2667 | var autoGroup = new ProvidedColumnGroup(null, "FAKE_PATH_" + column.getId() + "}_" + i, true, i);
|
2668 | this.createBean(autoGroup);
|
2669 | autoGroup.setChildren([nextChild]);
|
2670 | nextChild.setOriginalParent(autoGroup);
|
2671 | nextChild = autoGroup;
|
2672 | }
|
2673 |
|
2674 | return nextChild;
|
2675 | };
|
2676 | ColumnFactory.prototype.findDepth = function (balancedColumnTree) {
|
2677 | var dept = 0;
|
2678 | var pointer = balancedColumnTree;
|
2679 | while (pointer && pointer[0] && pointer[0] instanceof ProvidedColumnGroup) {
|
2680 | dept++;
|
2681 | pointer = pointer[0].getChildren();
|
2682 | }
|
2683 | return dept;
|
2684 | };
|
2685 | ColumnFactory.prototype.balanceColumnTree = function (unbalancedTree, currentDept, columnDept, columnKeyCreator) {
|
2686 | var result = [];
|
2687 |
|
2688 |
|
2689 | for (var i = 0; i < unbalancedTree.length; i++) {
|
2690 | var child = unbalancedTree[i];
|
2691 | if (child instanceof ProvidedColumnGroup) {
|
2692 |
|
2693 | var originalGroup = child;
|
2694 | var newChildren = this.balanceColumnTree(originalGroup.getChildren(), currentDept + 1, columnDept, columnKeyCreator);
|
2695 | originalGroup.setChildren(newChildren);
|
2696 | result.push(originalGroup);
|
2697 | }
|
2698 | else {
|
2699 |
|
2700 | var firstPaddedGroup = void 0;
|
2701 | var currentPaddedGroup = void 0;
|
2702 |
|
2703 | for (var j = columnDept - 1; j >= currentDept; j--) {
|
2704 | var newColId = columnKeyCreator.getUniqueKey(null, null);
|
2705 | var colGroupDefMerged = this.createMergedColGroupDef(null);
|
2706 | var paddedGroup = new ProvidedColumnGroup(colGroupDefMerged, newColId, true, currentDept);
|
2707 | this.createBean(paddedGroup);
|
2708 | if (currentPaddedGroup) {
|
2709 | currentPaddedGroup.setChildren([paddedGroup]);
|
2710 | }
|
2711 | currentPaddedGroup = paddedGroup;
|
2712 | if (!firstPaddedGroup) {
|
2713 | firstPaddedGroup = currentPaddedGroup;
|
2714 | }
|
2715 | }
|
2716 |
|
2717 | if (firstPaddedGroup && currentPaddedGroup) {
|
2718 | result.push(firstPaddedGroup);
|
2719 | var hasGroups = unbalancedTree.some(function (leaf) { return leaf instanceof ProvidedColumnGroup; });
|
2720 | if (hasGroups) {
|
2721 | currentPaddedGroup.setChildren([child]);
|
2722 | continue;
|
2723 | }
|
2724 | else {
|
2725 | currentPaddedGroup.setChildren(unbalancedTree);
|
2726 | break;
|
2727 | }
|
2728 | }
|
2729 | result.push(child);
|
2730 | }
|
2731 | }
|
2732 | return result;
|
2733 | };
|
2734 | ColumnFactory.prototype.findMaxDept = function (treeChildren, dept) {
|
2735 | var maxDeptThisLevel = dept;
|
2736 | for (var i = 0; i < treeChildren.length; i++) {
|
2737 | var abstractColumn = treeChildren[i];
|
2738 | if (abstractColumn instanceof ProvidedColumnGroup) {
|
2739 | var originalGroup = abstractColumn;
|
2740 | var newDept = this.findMaxDept(originalGroup.getChildren(), dept + 1);
|
2741 | if (maxDeptThisLevel < newDept) {
|
2742 | maxDeptThisLevel = newDept;
|
2743 | }
|
2744 | }
|
2745 | }
|
2746 | return maxDeptThisLevel;
|
2747 | };
|
2748 | ColumnFactory.prototype.recursivelyCreateColumns = function (defs, level, primaryColumns, existingColsCopy, columnKeyCreator, existingGroups) {
|
2749 | var _this = this;
|
2750 | return (defs || []).map(function (def) {
|
2751 | if (_this.isColumnGroup(def)) {
|
2752 | return _this.createColumnGroup(primaryColumns, def, level, existingColsCopy, columnKeyCreator, existingGroups);
|
2753 | }
|
2754 | else {
|
2755 | return _this.createColumn(primaryColumns, def, existingColsCopy, columnKeyCreator);
|
2756 | }
|
2757 | });
|
2758 | };
|
2759 | ColumnFactory.prototype.createColumnGroup = function (primaryColumns, colGroupDef, level, existingColumns, columnKeyCreator, existingGroups) {
|
2760 | var colGroupDefMerged = this.createMergedColGroupDef(colGroupDef);
|
2761 | var groupId = columnKeyCreator.getUniqueKey(colGroupDefMerged.groupId || null, null);
|
2762 | var existingGroup = this.findExistingGroup(colGroupDef, existingGroups);
|
2763 | var providedGroup;
|
2764 | if (existingGroup) {
|
2765 | providedGroup = existingGroup;
|
2766 | providedGroup.reset(colGroupDefMerged, level);
|
2767 | removeFromArray(existingGroups, existingGroup);
|
2768 | }
|
2769 | else {
|
2770 | providedGroup = new ProvidedColumnGroup(colGroupDefMerged, groupId, false, level);
|
2771 | this.createBean(providedGroup);
|
2772 | }
|
2773 | var children = this.recursivelyCreateColumns(colGroupDefMerged.children, level + 1, primaryColumns, existingColumns, columnKeyCreator, existingGroups);
|
2774 | providedGroup.setChildren(children);
|
2775 | return providedGroup;
|
2776 | };
|
2777 | ColumnFactory.prototype.createMergedColGroupDef = function (colGroupDef) {
|
2778 | var colGroupDefMerged = {};
|
2779 | Object.assign(colGroupDefMerged, this.gridOptionsService.get('defaultColGroupDef'));
|
2780 | Object.assign(colGroupDefMerged, colGroupDef);
|
2781 | return colGroupDefMerged;
|
2782 | };
|
2783 | ColumnFactory.prototype.createColumn = function (primaryColumns, colDef, existingColsCopy, columnKeyCreator) {
|
2784 | var colDefMerged = this.mergeColDefs(colDef);
|
2785 |
|
2786 | var column = this.findExistingColumn(colDef, existingColsCopy);
|
2787 |
|
2788 |
|
2789 | if (existingColsCopy && column) {
|
2790 | removeFromArray(existingColsCopy, column);
|
2791 | }
|
2792 | if (!column) {
|
2793 |
|
2794 | var colId = columnKeyCreator.getUniqueKey(colDefMerged.colId, colDefMerged.field);
|
2795 | column = new Column(colDefMerged, colDef, colId, primaryColumns);
|
2796 | this.context.createBean(column);
|
2797 | }
|
2798 | else {
|
2799 | column.setColDef(colDefMerged, colDef);
|
2800 | this.applyColumnState(column, colDefMerged);
|
2801 | }
|
2802 | return column;
|
2803 | };
|
2804 | ColumnFactory.prototype.applyColumnState = function (column, colDef) {
|
2805 |
|
2806 | var flex = attrToNumber(colDef.flex);
|
2807 | if (flex !== undefined) {
|
2808 | column.setFlex(flex);
|
2809 | }
|
2810 |
|
2811 | var noFlexThisCol = column.getFlex() <= 0;
|
2812 | if (noFlexThisCol) {
|
2813 |
|
2814 | var width = attrToNumber(colDef.width);
|
2815 | if (width != null) {
|
2816 | column.setActualWidth(width);
|
2817 | }
|
2818 | else {
|
2819 |
|
2820 |
|
2821 | var widthBeforeUpdate = column.getActualWidth();
|
2822 | column.setActualWidth(widthBeforeUpdate);
|
2823 | }
|
2824 | }
|
2825 |
|
2826 | if (colDef.sort !== undefined) {
|
2827 | if (colDef.sort == 'asc' || colDef.sort == 'desc') {
|
2828 | column.setSort(colDef.sort);
|
2829 | }
|
2830 | else {
|
2831 | column.setSort(undefined);
|
2832 | }
|
2833 | }
|
2834 |
|
2835 | var sortIndex = attrToNumber(colDef.sortIndex);
|
2836 | if (sortIndex !== undefined) {
|
2837 | column.setSortIndex(sortIndex);
|
2838 | }
|
2839 |
|
2840 | var hide = attrToBoolean(colDef.hide);
|
2841 | if (hide !== undefined) {
|
2842 | column.setVisible(!hide);
|
2843 | }
|
2844 |
|
2845 | if (colDef.pinned !== undefined) {
|
2846 | column.setPinned(colDef.pinned);
|
2847 | }
|
2848 | };
|
2849 | ColumnFactory.prototype.findExistingColumn = function (newColDef, existingColsCopy) {
|
2850 | return (existingColsCopy || []).find(function (existingCol) {
|
2851 | var existingColDef = existingCol.getUserProvidedColDef();
|
2852 | if (!existingColDef) {
|
2853 | return false;
|
2854 | }
|
2855 | var newHasId = newColDef.colId != null;
|
2856 | var newHasField = newColDef.field != null;
|
2857 | if (newHasId) {
|
2858 | return existingCol.getId() === newColDef.colId;
|
2859 | }
|
2860 | if (newHasField) {
|
2861 | return existingColDef.field === newColDef.field;
|
2862 | }
|
2863 |
|
2864 | if (existingColDef === newColDef) {
|
2865 | return true;
|
2866 | }
|
2867 | return false;
|
2868 | });
|
2869 | };
|
2870 | ColumnFactory.prototype.findExistingGroup = function (newGroupDef, existingGroups) {
|
2871 | return existingGroups.find(function (existingGroup) {
|
2872 | var existingDef = existingGroup.getColGroupDef();
|
2873 | if (!existingDef) {
|
2874 | return false;
|
2875 | }
|
2876 | var newHasId = newGroupDef.groupId != null;
|
2877 | if (newHasId) {
|
2878 | return existingGroup.getId() === newGroupDef.groupId;
|
2879 | }
|
2880 | return false;
|
2881 | });
|
2882 | };
|
2883 | ColumnFactory.prototype.mergeColDefs = function (colDef) {
|
2884 |
|
2885 | var colDefMerged = {};
|
2886 |
|
2887 | var defaultColDef = this.gridOptionsService.get('defaultColDef');
|
2888 | mergeDeep(colDefMerged, defaultColDef, false, true);
|
2889 |
|
2890 | var columnType = colDef.type;
|
2891 | if (!columnType) {
|
2892 | columnType = defaultColDef && defaultColDef.type;
|
2893 | }
|
2894 |
|
2895 | if (columnType) {
|
2896 | this.assignColumnTypes(columnType, colDefMerged);
|
2897 | }
|
2898 |
|
2899 | mergeDeep(colDefMerged, colDef, false, true);
|
2900 | var autoGroupColDef = this.gridOptionsService.get('autoGroupColumnDef');
|
2901 | var isSortingCoupled = this.gridOptionsService.isColumnsSortingCoupledToGroup();
|
2902 | if (colDef.rowGroup && autoGroupColDef && isSortingCoupled) {
|
2903 |
|
2904 | mergeDeep(colDefMerged, { sort: autoGroupColDef.sort, initialSort: autoGroupColDef.initialSort }, false, true);
|
2905 | }
|
2906 | return colDefMerged;
|
2907 | };
|
2908 | ColumnFactory.prototype.assignColumnTypes = function (type, colDefMerged) {
|
2909 | var typeKeys = [];
|
2910 | if (type instanceof Array) {
|
2911 | var invalidArray = type.some(function (a) { return typeof a !== 'string'; });
|
2912 | if (invalidArray) {
|
2913 | console.warn("AG Grid: if colDef.type is supplied an array it should be of type 'string[]'");
|
2914 | }
|
2915 | else {
|
2916 | typeKeys = type;
|
2917 | }
|
2918 | }
|
2919 | else if (typeof type === 'string') {
|
2920 | typeKeys = type.split(',');
|
2921 | }
|
2922 | else {
|
2923 | console.warn("AG Grid: colDef.type should be of type 'string' | 'string[]'");
|
2924 | return;
|
2925 | }
|
2926 |
|
2927 | var allColumnTypes = Object.assign({}, DefaultColumnTypes);
|
2928 | var userTypes = this.gridOptionsService.get('columnTypes') || {};
|
2929 | iterateObject(userTypes, function (key, value) {
|
2930 | if (key in allColumnTypes) {
|
2931 | console.warn("AG Grid: the column type '" + key + "' is a default column type and cannot be overridden.");
|
2932 | }
|
2933 | else {
|
2934 | allColumnTypes[key] = value;
|
2935 | }
|
2936 | });
|
2937 | typeKeys.forEach(function (t) {
|
2938 | var typeColDef = allColumnTypes[t.trim()];
|
2939 | if (typeColDef) {
|
2940 | mergeDeep(colDefMerged, typeColDef, false, true);
|
2941 | }
|
2942 | else {
|
2943 | console.warn("AG Grid: colDef.type '" + t + "' does not correspond to defined gridOptions.columnTypes");
|
2944 | }
|
2945 | });
|
2946 | };
|
2947 |
|
2948 | ColumnFactory.prototype.isColumnGroup = function (abstractColDef) {
|
2949 | return abstractColDef.children !== undefined;
|
2950 | };
|
2951 | __decorate$2v([
|
2952 | Autowired('columnUtils')
|
2953 | ], ColumnFactory.prototype, "columnUtils", void 0);
|
2954 | __decorate$2v([
|
2955 | __param$9(0, Qualifier('loggerFactory'))
|
2956 | ], ColumnFactory.prototype, "setBeans", null);
|
2957 | ColumnFactory = __decorate$2v([
|
2958 | Bean('columnFactory')
|
2959 | ], ColumnFactory);
|
2960 | return ColumnFactory;
|
2961 | }(BeanStub));
|
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 |
|
2967 |
|
2968 |
|
2969 | var ColDefUtil = (function () {
|
2970 | function ColDefUtil() {
|
2971 | }
|
2972 | ColDefUtil.ColDefPropertyMap = {
|
2973 | headerName: undefined,
|
2974 | columnGroupShow: undefined,
|
2975 | headerClass: undefined,
|
2976 | toolPanelClass: undefined,
|
2977 | headerValueGetter: undefined,
|
2978 | pivotKeys: undefined,
|
2979 | groupId: undefined,
|
2980 | colId: undefined,
|
2981 | sort: undefined,
|
2982 | initialSort: undefined,
|
2983 | field: undefined,
|
2984 | type: undefined,
|
2985 | tooltipComponent: undefined,
|
2986 | tooltipField: undefined,
|
2987 | headerTooltip: undefined,
|
2988 | cellClass: undefined,
|
2989 | showRowGroup: undefined,
|
2990 | filter: undefined,
|
2991 | initialAggFunc: undefined,
|
2992 | defaultAggFunc: undefined,
|
2993 | aggFunc: undefined,
|
2994 | pinned: undefined,
|
2995 | initialPinned: undefined,
|
2996 | chartDataType: undefined,
|
2997 | cellEditorPopupPosition: undefined,
|
2998 | headerGroupComponent: undefined,
|
2999 | headerGroupComponentFramework: undefined,
|
3000 | headerGroupComponentParams: undefined,
|
3001 | cellStyle: undefined,
|
3002 | cellRenderer: undefined,
|
3003 | cellRendererParams: undefined,
|
3004 | cellRendererFramework: undefined,
|
3005 | cellEditor: undefined,
|
3006 | cellEditorFramework: undefined,
|
3007 | cellEditorParams: undefined,
|
3008 | filterFramework: undefined,
|
3009 | filterParams: undefined,
|
3010 | pivotValueColumn: undefined,
|
3011 | headerComponent: undefined,
|
3012 | headerComponentFramework: undefined,
|
3013 | headerComponentParams: undefined,
|
3014 | floatingFilterComponent: undefined,
|
3015 | floatingFilterComponentParams: undefined,
|
3016 | floatingFilterComponentFramework: undefined,
|
3017 | tooltipComponentParams: undefined,
|
3018 | tooltipComponentFramework: undefined,
|
3019 | refData: undefined,
|
3020 | columnsMenuParams: undefined,
|
3021 | children: undefined,
|
3022 | sortingOrder: undefined,
|
3023 | allowedAggFuncs: undefined,
|
3024 | menuTabs: undefined,
|
3025 | pivotTotalColumnIds: undefined,
|
3026 | cellClassRules: undefined,
|
3027 | icons: undefined,
|
3028 | sortIndex: undefined,
|
3029 | initialSortIndex: undefined,
|
3030 | flex: undefined,
|
3031 | initialFlex: undefined,
|
3032 | width: undefined,
|
3033 | initialWidth: undefined,
|
3034 | minWidth: undefined,
|
3035 | maxWidth: undefined,
|
3036 | rowGroupIndex: undefined,
|
3037 | initialRowGroupIndex: undefined,
|
3038 | pivotIndex: undefined,
|
3039 | initialPivotIndex: undefined,
|
3040 | suppressCellFlash: undefined,
|
3041 | suppressColumnsToolPanel: undefined,
|
3042 | suppressFiltersToolPanel: undefined,
|
3043 | openByDefault: undefined,
|
3044 | marryChildren: undefined,
|
3045 | hide: undefined,
|
3046 | initialHide: undefined,
|
3047 | rowGroup: undefined,
|
3048 | initialRowGroup: undefined,
|
3049 | pivot: undefined,
|
3050 | initialPivot: undefined,
|
3051 | checkboxSelection: undefined,
|
3052 | showDisabledCheckboxes: undefined,
|
3053 | headerCheckboxSelection: undefined,
|
3054 | headerCheckboxSelectionFilteredOnly: undefined,
|
3055 | headerCheckboxSelectionCurrentPageOnly: undefined,
|
3056 | suppressMenu: undefined,
|
3057 | suppressMovable: undefined,
|
3058 | lockPosition: undefined,
|
3059 | lockVisible: undefined,
|
3060 | lockPinned: undefined,
|
3061 | unSortIcon: undefined,
|
3062 | suppressSizeToFit: undefined,
|
3063 | suppressAutoSize: undefined,
|
3064 | enableRowGroup: undefined,
|
3065 | enablePivot: undefined,
|
3066 | enableValue: undefined,
|
3067 | editable: undefined,
|
3068 | suppressPaste: undefined,
|
3069 | suppressNavigable: undefined,
|
3070 | enableCellChangeFlash: undefined,
|
3071 | rowDrag: undefined,
|
3072 | dndSource: undefined,
|
3073 | autoHeight: undefined,
|
3074 | wrapText: undefined,
|
3075 | sortable: undefined,
|
3076 | resizable: undefined,
|
3077 | singleClickEdit: undefined,
|
3078 | floatingFilter: undefined,
|
3079 | cellEditorPopup: undefined,
|
3080 | suppressFillHandle: undefined,
|
3081 | wrapHeaderText: undefined,
|
3082 | autoHeaderHeight: undefined,
|
3083 | dndSourceOnRowDrag: undefined,
|
3084 | valueGetter: undefined,
|
3085 | valueSetter: undefined,
|
3086 | filterValueGetter: undefined,
|
3087 | keyCreator: undefined,
|
3088 | valueFormatter: undefined,
|
3089 | valueParser: undefined,
|
3090 | comparator: undefined,
|
3091 | equals: undefined,
|
3092 | pivotComparator: undefined,
|
3093 | suppressKeyboardEvent: undefined,
|
3094 | suppressHeaderKeyboardEvent: undefined,
|
3095 | colSpan: undefined,
|
3096 | rowSpan: undefined,
|
3097 | getQuickFilterText: undefined,
|
3098 | onCellValueChanged: undefined,
|
3099 | onCellClicked: undefined,
|
3100 | onCellDoubleClicked: undefined,
|
3101 | onCellContextMenu: undefined,
|
3102 | rowDragText: undefined,
|
3103 | tooltipValueGetter: undefined,
|
3104 | cellRendererSelector: undefined,
|
3105 | cellEditorSelector: undefined,
|
3106 | spanHeaderHeight: undefined
|
3107 | };
|
3108 | ColDefUtil.ALL_PROPERTIES = Object.keys(ColDefUtil.ColDefPropertyMap);
|
3109 |
|
3110 |
|
3111 | ColDefUtil.FRAMEWORK_PROPERTIES = [
|
3112 | '__ob__',
|
3113 | '__v_skip',
|
3114 | '__metadata__',
|
3115 | 'mappedColumnProperties',
|
3116 | 'hasChildColumns',
|
3117 | 'toColDef',
|
3118 | 'createColDefFromGridColumn'
|
3119 | ];
|
3120 | return ColDefUtil;
|
3121 | }());
|
3122 |
|
3123 |
|
3124 |
|
3125 |
|
3126 |
|
3127 |
|
3128 |
|
3129 | var Events = (function () {
|
3130 | function Events() {
|
3131 | }
|
3132 |
|
3133 |
|
3134 | Events.EVENT_COLUMN_EVERYTHING_CHANGED = 'columnEverythingChanged';
|
3135 |
|
3136 | Events.EVENT_NEW_COLUMNS_LOADED = 'newColumnsLoaded';
|
3137 |
|
3138 | Events.EVENT_COLUMN_PIVOT_MODE_CHANGED = 'columnPivotModeChanged';
|
3139 |
|
3140 | Events.EVENT_COLUMN_ROW_GROUP_CHANGED = 'columnRowGroupChanged';
|
3141 |
|
3142 | Events.EVENT_EXPAND_COLLAPSE_ALL = 'expandOrCollapseAll';
|
3143 |
|
3144 | Events.EVENT_COLUMN_PIVOT_CHANGED = 'columnPivotChanged';
|
3145 |
|
3146 | Events.EVENT_GRID_COLUMNS_CHANGED = 'gridColumnsChanged';
|
3147 |
|
3148 | Events.EVENT_COLUMN_VALUE_CHANGED = 'columnValueChanged';
|
3149 |
|
3150 | Events.EVENT_COLUMN_MOVED = 'columnMoved';
|
3151 |
|
3152 | Events.EVENT_COLUMN_VISIBLE = 'columnVisible';
|
3153 |
|
3154 | Events.EVENT_COLUMN_PINNED = 'columnPinned';
|
3155 |
|
3156 | Events.EVENT_COLUMN_GROUP_OPENED = 'columnGroupOpened';
|
3157 |
|
3158 | Events.EVENT_COLUMN_RESIZED = 'columnResized';
|
3159 |
|
3160 | Events.EVENT_DISPLAYED_COLUMNS_CHANGED = 'displayedColumnsChanged';
|
3161 |
|
3162 | Events.EVENT_VIRTUAL_COLUMNS_CHANGED = 'virtualColumnsChanged';
|
3163 |
|
3164 | Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED = 'asyncTransactionsFlushed';
|
3165 |
|
3166 | Events.EVENT_ROW_GROUP_OPENED = 'rowGroupOpened';
|
3167 |
|
3168 | Events.EVENT_ROW_DATA_CHANGED = 'rowDataChanged';
|
3169 |
|
3170 | Events.EVENT_ROW_DATA_UPDATED = 'rowDataUpdated';
|
3171 |
|
3172 | Events.EVENT_PINNED_ROW_DATA_CHANGED = 'pinnedRowDataChanged';
|
3173 |
|
3174 | Events.EVENT_RANGE_SELECTION_CHANGED = 'rangeSelectionChanged';
|
3175 |
|
3176 | Events.EVENT_CHART_CREATED = 'chartCreated';
|
3177 |
|
3178 | Events.EVENT_CHART_RANGE_SELECTION_CHANGED = 'chartRangeSelectionChanged';
|
3179 |
|
3180 | Events.EVENT_CHART_OPTIONS_CHANGED = 'chartOptionsChanged';
|
3181 |
|
3182 | Events.EVENT_CHART_DESTROYED = 'chartDestroyed';
|
3183 |
|
3184 | Events.EVENT_TOOL_PANEL_VISIBLE_CHANGED = 'toolPanelVisibleChanged';
|
3185 | Events.EVENT_TOOL_PANEL_SIZE_CHANGED = 'toolPanelSizeChanged';
|
3186 | |
3187 |
|
3188 |
|
3189 |
|
3190 | Events.EVENT_INTERNAL_TOOL_PANEL_VISIBLE_CHANGED = 'internalToolPanelVisibleChanged';
|
3191 | Events.EVENT_COLUMN_PANEL_ITEM_DRAG_START = 'columnPanelItemDragStart';
|
3192 | Events.EVENT_COLUMN_PANEL_ITEM_DRAG_END = 'columnPanelItemDragEnd';
|
3193 |
|
3194 | Events.EVENT_MODEL_UPDATED = 'modelUpdated';
|
3195 | Events.EVENT_PASTE_START = 'pasteStart';
|
3196 | Events.EVENT_PASTE_END = 'pasteEnd';
|
3197 | Events.EVENT_FILL_START = 'fillStart';
|
3198 | Events.EVENT_FILL_END = 'fillEnd';
|
3199 |
|
3200 | Events.EVENT_UNDO_STARTED = 'undoStarted';
|
3201 |
|
3202 | Events.EVENT_UNDO_ENDED = 'undoEnded';
|
3203 |
|
3204 | Events.EVENT_REDO_STARTED = 'redoStarted';
|
3205 |
|
3206 | Events.EVENT_REDO_ENDED = 'redoEnded';
|
3207 | Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_START = 'keyShortcutChangedCellStart';
|
3208 | Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_END = 'keyShortcutChangedCellEnd';
|
3209 | Events.EVENT_CELL_CLICKED = 'cellClicked';
|
3210 | Events.EVENT_CELL_DOUBLE_CLICKED = 'cellDoubleClicked';
|
3211 | Events.EVENT_CELL_MOUSE_DOWN = 'cellMouseDown';
|
3212 | Events.EVENT_CELL_CONTEXT_MENU = 'cellContextMenu';
|
3213 | Events.EVENT_CELL_VALUE_CHANGED = 'cellValueChanged';
|
3214 | Events.EVENT_CELL_EDIT_REQUEST = 'cellEditRequest';
|
3215 | Events.EVENT_ROW_VALUE_CHANGED = 'rowValueChanged';
|
3216 | Events.EVENT_CELL_FOCUSED = 'cellFocused';
|
3217 | Events.EVENT_CELL_FOCUS_CLEARED = 'cellFocusCleared';
|
3218 | Events.EVENT_FULL_WIDTH_ROW_FOCUSED = 'fullWidthRowFocused';
|
3219 | Events.EVENT_ROW_SELECTED = 'rowSelected';
|
3220 | Events.EVENT_SELECTION_CHANGED = 'selectionChanged';
|
3221 | Events.EVENT_CELL_KEY_DOWN = 'cellKeyDown';
|
3222 | Events.EVENT_CELL_KEY_PRESS = 'cellKeyPress';
|
3223 | Events.EVENT_CELL_MOUSE_OVER = 'cellMouseOver';
|
3224 | Events.EVENT_CELL_MOUSE_OUT = 'cellMouseOut';
|
3225 |
|
3226 | Events.EVENT_FILTER_CHANGED = 'filterChanged';
|
3227 |
|
3228 | Events.EVENT_FILTER_MODIFIED = 'filterModified';
|
3229 | Events.EVENT_FILTER_OPENED = 'filterOpened';
|
3230 | Events.EVENT_SORT_CHANGED = 'sortChanged';
|
3231 |
|
3232 | Events.EVENT_VIRTUAL_ROW_REMOVED = 'virtualRowRemoved';
|
3233 | Events.EVENT_ROW_CLICKED = 'rowClicked';
|
3234 | Events.EVENT_ROW_DOUBLE_CLICKED = 'rowDoubleClicked';
|
3235 |
|
3236 | Events.EVENT_GRID_READY = 'gridReady';
|
3237 | |
3238 |
|
3239 | Events.EVENT_GRID_SIZE_CHANGED = 'gridSizeChanged';
|
3240 |
|
3241 | Events.EVENT_VIEWPORT_CHANGED = 'viewportChanged';
|
3242 |
|
3243 | Events.EVENT_SCROLLBAR_WIDTH_CHANGED = 'scrollbarWidthChanged';
|
3244 |
|
3245 | Events.EVENT_FIRST_DATA_RENDERED = 'firstDataRendered';
|
3246 |
|
3247 | Events.EVENT_DRAG_STARTED = 'dragStarted';
|
3248 |
|
3249 | Events.EVENT_DRAG_STOPPED = 'dragStopped';
|
3250 | Events.EVENT_CHECKBOX_CHANGED = 'checkboxChanged';
|
3251 | Events.EVENT_ROW_EDITING_STARTED = 'rowEditingStarted';
|
3252 | Events.EVENT_ROW_EDITING_STOPPED = 'rowEditingStopped';
|
3253 | Events.EVENT_CELL_EDITING_STARTED = 'cellEditingStarted';
|
3254 | Events.EVENT_CELL_EDITING_STOPPED = 'cellEditingStopped';
|
3255 |
|
3256 | Events.EVENT_BODY_SCROLL = 'bodyScroll';
|
3257 |
|
3258 | Events.EVENT_BODY_SCROLL_END = 'bodyScrollEnd';
|
3259 | Events.EVENT_HEIGHT_SCALE_CHANGED = 'heightScaleChanged';
|
3260 | |
3261 |
|
3262 | Events.EVENT_PAGINATION_CHANGED = 'paginationChanged';
|
3263 | |
3264 |
|
3265 |
|
3266 | Events.EVENT_COMPONENT_STATE_CHANGED = 'componentStateChanged';
|
3267 |
|
3268 |
|
3269 |
|
3270 |
|
3271 | Events.EVENT_BODY_HEIGHT_CHANGED = 'bodyHeightChanged';
|
3272 | Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED = 'displayedColumnsWidthChanged';
|
3273 | Events.EVENT_SCROLL_VISIBILITY_CHANGED = 'scrollVisibilityChanged';
|
3274 | Events.EVENT_COLUMN_HOVER_CHANGED = 'columnHoverChanged';
|
3275 | Events.EVENT_FLASH_CELLS = 'flashCells';
|
3276 | Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED = 'paginationPixelOffsetChanged';
|
3277 | Events.EVENT_DISPLAYED_ROWS_CHANGED = 'displayedRowsChanged';
|
3278 | Events.EVENT_LEFT_PINNED_WIDTH_CHANGED = 'leftPinnedWidthChanged';
|
3279 | Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED = 'rightPinnedWidthChanged';
|
3280 | Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED = 'rowContainerHeightChanged';
|
3281 | Events.EVENT_HEADER_HEIGHT_CHANGED = 'headerHeightChanged';
|
3282 | Events.EVENT_COLUMN_HEADER_HEIGHT_CHANGED = 'columnHeaderHeightChanged';
|
3283 | Events.EVENT_ROW_DRAG_ENTER = 'rowDragEnter';
|
3284 | Events.EVENT_ROW_DRAG_MOVE = 'rowDragMove';
|
3285 | Events.EVENT_ROW_DRAG_LEAVE = 'rowDragLeave';
|
3286 | Events.EVENT_ROW_DRAG_END = 'rowDragEnd';
|
3287 |
|
3288 | Events.EVENT_GRID_STYLES_CHANGED = 'gridStylesChanged';
|
3289 |
|
3290 | Events.EVENT_POPUP_TO_FRONT = 'popupToFront';
|
3291 |
|
3292 |
|
3293 |
|
3294 | Events.EVENT_COLUMN_ROW_GROUP_CHANGE_REQUEST = 'columnRowGroupChangeRequest';
|
3295 | Events.EVENT_COLUMN_PIVOT_CHANGE_REQUEST = 'columnPivotChangeRequest';
|
3296 | Events.EVENT_COLUMN_VALUE_CHANGE_REQUEST = 'columnValueChangeRequest';
|
3297 | Events.EVENT_COLUMN_AGG_FUNC_CHANGE_REQUEST = 'columnAggFuncChangeRequest';
|
3298 | Events.EVENT_KEYBOARD_FOCUS = 'keyboardFocus';
|
3299 | Events.EVENT_MOUSE_FOCUS = 'mouseFocus';
|
3300 | Events.EVENT_STORE_UPDATED = 'storeUpdated';
|
3301 | Events.EVENT_FILTER_DESTROYED = 'filterDestroyed';
|
3302 | return Events;
|
3303 | }());
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 |
|
3309 |
|
3310 |
|
3311 | var __read$t = (undefined && undefined.__read) || function (o, n) {
|
3312 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
3313 | if (!m) return o;
|
3314 | var i = m.call(o), r, ar = [], e;
|
3315 | try {
|
3316 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
3317 | }
|
3318 | catch (error) { e = { error: error }; }
|
3319 | finally {
|
3320 | try {
|
3321 | if (r && !r.done && (m = i["return"])) m.call(i);
|
3322 | }
|
3323 | finally { if (e) throw e.error; }
|
3324 | }
|
3325 | return ar;
|
3326 | };
|
3327 | var __spread$n = (undefined && undefined.__spread) || function () {
|
3328 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$t(arguments[i]));
|
3329 | return ar;
|
3330 | };
|
3331 |
|
3332 |
|
3333 |
|
3334 |
|
3335 | var PropertyKeys = (function () {
|
3336 | function PropertyKeys() {
|
3337 | }
|
3338 | PropertyKeys.STRING_PROPERTIES = [
|
3339 | 'rowSelection', 'overlayLoadingTemplate', 'overlayNoRowsTemplate',
|
3340 | 'quickFilterText', 'rowModelType', 'editType', 'domLayout', 'clipboardDelimiter', 'rowGroupPanelShow',
|
3341 | 'multiSortKey', 'pivotColumnGroupTotals', 'pivotRowTotals', 'pivotPanelShow', 'fillHandleDirection',
|
3342 | 'serverSideStoreType', 'groupDisplayType', 'treeDataDisplayType', 'colResizeDefault'
|
3343 | ];
|
3344 | PropertyKeys.OBJECT_PROPERTIES = [
|
3345 | 'components', 'frameworkComponents', 'rowStyle', 'context', 'autoGroupColumnDef', 'localeText', 'icons',
|
3346 | 'datasource', 'serverSideDatasource', 'viewportDatasource', 'groupRowRendererParams', 'aggFuncs', 'fullWidthCellRendererParams',
|
3347 | 'defaultColGroupDef', 'defaultColDef', 'defaultCsvExportParams', 'defaultExcelExportParams', 'columnTypes',
|
3348 | 'rowClassRules', 'detailCellRendererParams', 'loadingCellRendererParams', 'loadingOverlayComponentParams',
|
3349 | 'noRowsOverlayComponentParams', 'popupParent', 'statusBar', 'sideBar', 'chartThemeOverrides',
|
3350 | 'customChartThemes', 'chartToolPanelsDef'
|
3351 | ];
|
3352 | PropertyKeys.ARRAY_PROPERTIES = [
|
3353 | 'sortingOrder', 'alignedGrids', 'rowData', 'columnDefs', 'excelStyles', 'pinnedTopRowData', 'pinnedBottomRowData', 'chartThemes', 'rowClass'
|
3354 | ];
|
3355 | PropertyKeys.NUMBER_PROPERTIES = [
|
3356 | 'rowHeight', 'detailRowHeight', 'rowBuffer', 'headerHeight', 'groupHeaderHeight', 'floatingFiltersHeight',
|
3357 | 'pivotHeaderHeight', 'pivotGroupHeaderHeight', 'groupDefaultExpanded', 'viewportRowModelPageSize',
|
3358 | 'viewportRowModelBufferSize', 'autoSizePadding', 'maxBlocksInCache', 'maxConcurrentDatasourceRequests', 'tooltipShowDelay',
|
3359 | 'tooltipHideDelay', 'cacheOverflowSize', 'paginationPageSize', 'cacheBlockSize', 'infiniteInitialRowCount', 'serverSideInitialRowCount', 'scrollbarWidth',
|
3360 | 'asyncTransactionWaitMillis', 'blockLoadDebounceMillis', 'keepDetailRowsCount',
|
3361 | 'undoRedoCellEditingLimit', 'cellFlashDelay', 'cellFadeDelay', 'tabIndex'
|
3362 | ];
|
3363 | PropertyKeys.BOOLEAN_PROPERTIES = [
|
3364 | 'suppressMakeColumnVisibleAfterUnGroup', 'suppressRowClickSelection', 'suppressCellSelection', 'suppressCellFocus', 'suppressHorizontalScroll',
|
3365 | 'alwaysShowHorizontalScroll', 'alwaysShowVerticalScroll', 'debug', 'enableBrowserTooltips', 'enableCellExpressions', 'groupSelectsChildren',
|
3366 | 'groupIncludeFooter', 'groupIncludeTotalFooter', 'groupSuppressBlankHeader', 'suppressMenuHide', 'suppressRowDeselection', 'unSortIcon',
|
3367 | 'suppressMultiSort', 'alwaysMultiSort', 'singleClickEdit', 'suppressLoadingOverlay', 'suppressNoRowsOverlay', 'suppressAutoSize',
|
3368 | 'skipHeaderOnAutoSize', 'suppressParentsInRowNodes', 'suppressColumnMoveAnimation', 'suppressMovableColumns', 'suppressFieldDotNotation',
|
3369 | 'enableRangeSelection', 'enableRangeHandle', 'enableFillHandle', 'suppressClearOnFillReduction', 'deltaSort', 'suppressTouch', 'suppressAsyncEvents',
|
3370 | 'allowContextMenuWithControlKey', 'suppressContextMenu', 'rememberGroupStateWhenNewData', 'enableCellChangeFlash', 'suppressDragLeaveHidesColumns',
|
3371 | 'suppressRowGroupHidesColumns', 'suppressMiddleClickScrolls', 'suppressPreventDefaultOnMouseWheel', 'suppressCopyRowsToClipboard', 'copyHeadersToClipboard',
|
3372 | 'copyGroupHeadersToClipboard', 'pivotMode', 'suppressAggFuncInHeader', 'suppressColumnVirtualisation', 'suppressAggAtRootLevel', 'suppressFocusAfterRefresh',
|
3373 | 'functionsPassive', 'functionsReadOnly', 'animateRows', 'groupSelectsFiltered', 'groupRemoveSingleChildren', 'groupRemoveLowestSingleChildren', 'enableRtl',
|
3374 | 'suppressClickEdit', 'rowDragEntireRow', 'rowDragManaged', 'suppressRowDrag', 'suppressMoveWhenRowDragging', 'rowDragMultiRow', 'enableGroupEdit',
|
3375 | 'embedFullWidthRows', 'suppressPaginationPanel', 'groupHideOpenParents', 'groupAllowUnbalanced', 'pagination', 'paginationAutoPageSize', 'suppressScrollOnNewData',
|
3376 | 'suppressScrollWhenPopupsAreOpen', 'purgeClosedRowNodes', 'cacheQuickFilter', 'excludeHiddenColumnsFromQuickFilter', 'ensureDomOrder', 'accentedSort', 'suppressChangeDetection',
|
3377 | 'valueCache', 'valueCacheNeverExpires', 'aggregateOnlyChangedColumns', 'suppressAnimationFrame', 'suppressExcelExport', 'suppressCsvExport', 'treeData', 'masterDetail',
|
3378 | 'suppressMultiRangeSelection', 'enterMovesDownAfterEdit', 'enterMovesDown', 'suppressPropertyNamesCheck', 'rowMultiSelectWithClick', 'suppressRowHoverHighlight',
|
3379 | 'suppressRowTransform', 'suppressClipboardPaste', 'suppressLastEmptyLineOnPaste', 'enableCharts', 'enableChartToolPanelsButton', 'suppressChartToolPanelsButton',
|
3380 | 'suppressMaintainUnsortedOrder', 'enableCellTextSelection', 'suppressBrowserResizeObserver', 'suppressMaxRenderedRowRestriction', 'excludeChildrenWhenTreeDataFiltering',
|
3381 | 'tooltipMouseTrack', 'keepDetailRows', 'paginateChildRows', 'preventDefaultOnContextMenu', 'undoRedoCellEditing', 'allowDragFromColumnsToolPanel', 'immutableData',
|
3382 | 'pivotSuppressAutoColumn', 'suppressExpandablePivotGroups', 'debounceVerticalScrollbar', 'detailRowAutoHeight', 'serverSideFilteringAlwaysResets',
|
3383 | 'serverSideSortingAlwaysResets', 'serverSideSortAllLevels', 'serverSideFilterAllLevels', 'serverSideSortOnServer', 'serverSideFilterOnServer', 'suppressAggFilteredOnly',
|
3384 | 'showOpenedGroup', 'suppressClipboardApi', 'suppressModelUpdateAfterUpdateTransaction', 'stopEditingWhenCellsLoseFocus', 'maintainColumnOrder', 'groupMaintainOrder',
|
3385 | 'columnHoverHighlight', 'reactUi', 'suppressReactUi', 'readOnlyEdit', 'suppressRowVirtualisation', 'enableCellEditingOnBackspace', 'resetRowDataOnUpdate',
|
3386 | 'removePivotHeaderRowWhenSingleValueColumn', 'suppressCopySingleCellRanges', 'groupRowsSticky', 'suppressServerSideInfiniteScroll', 'rowGroupPanelSuppressSort',
|
3387 | 'allowShowChangeAfterFilter', 'suppressCutToClipboard'
|
3388 | ];
|
3389 |
|
3390 | PropertyKeys.FUNCTIONAL_PROPERTIES = [
|
3391 | 'localeTextFunc', 'doesExternalFilterPass', 'groupRowAggNodes', 'isFullWidthCell', 'processSecondaryColDef', 'processSecondaryColGroupDef', 'processPivotResultColDef',
|
3392 | 'processPivotResultColGroupDef', 'getBusinessKeyForNode', 'isRowSelectable', 'postSort', 'defaultGroupOrderComparator', 'rowDragText',
|
3393 | 'groupRowRenderer', 'groupRowRendererFramework', 'fullWidthCellRenderer', 'fullWidthCellRendererFramework',
|
3394 | 'loadingCellRenderer', 'loadingCellRendererFramework', 'loadingOverlayComponent', 'loadingOverlayComponentFramework', 'noRowsOverlayComponent', 'noRowsOverlayComponentFramework',
|
3395 | 'detailCellRenderer', 'detailCellRendererFramework'
|
3396 | ];
|
3397 | PropertyKeys.CALLBACK_PROPERTIES = [
|
3398 | 'getLocaleText', 'isExternalFilterPresent', 'getRowHeight', 'getRowClass', 'getRowStyle', 'getContextMenuItems', 'getMainMenuItems',
|
3399 | 'processRowPostCreate', 'processCellForClipboard', 'getGroupRowAgg', 'getRowNodeId', 'isFullWidthRow',
|
3400 | 'sendToClipboard', 'navigateToNextHeader', 'tabToNextHeader', 'navigateToNextCell',
|
3401 | 'tabToNextCell', 'processCellFromClipboard', 'getDocument', 'postProcessPopup', 'getChildCount', 'getDataPath', 'isRowMaster', 'postSortRows', 'processHeaderForClipboard',
|
3402 | 'processGroupHeaderForClipboard', 'paginationNumberFormatter', 'processDataFromClipboard', 'getServerSideGroupKey', 'isServerSideGroup',
|
3403 | 'createChartContainer', 'getChartToolbarItems', 'fillOperation', 'isApplyServerSideTransaction', 'getServerSideStoreParams', 'getServerSideGroupLevelParams',
|
3404 | 'isServerSideGroupOpenByDefault', 'isGroupOpenByDefault', 'initialGroupOrderComparator',
|
3405 | 'loadingCellRendererSelector', 'getRowId', 'groupAggFiltering'
|
3406 | ];
|
3407 | PropertyKeys.FUNCTION_PROPERTIES = __spread$n(PropertyKeys.FUNCTIONAL_PROPERTIES, PropertyKeys.CALLBACK_PROPERTIES);
|
3408 | PropertyKeys.ALL_PROPERTIES = __spread$n(PropertyKeys.ARRAY_PROPERTIES, PropertyKeys.OBJECT_PROPERTIES, PropertyKeys.STRING_PROPERTIES, PropertyKeys.NUMBER_PROPERTIES, PropertyKeys.FUNCTION_PROPERTIES, PropertyKeys.BOOLEAN_PROPERTIES);
|
3409 | |
3410 |
|
3411 |
|
3412 |
|
3413 | PropertyKeys.FRAMEWORK_PROPERTIES = [
|
3414 | '__ob__', '__v_skip', '__metadata__', 'mappedColumnProperties', 'hasChildColumns', 'toColDef', 'createColDefFromGridColumn'
|
3415 | ];
|
3416 | return PropertyKeys;
|
3417 | }());
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 | var __assign$l = (undefined && undefined.__assign) || function () {
|
3426 | __assign$l = Object.assign || function(t) {
|
3427 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
3428 | s = arguments[i];
|
3429 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
3430 | t[p] = s[p];
|
3431 | }
|
3432 | return t;
|
3433 | };
|
3434 | return __assign$l.apply(this, arguments);
|
3435 | };
|
3436 | var __read$s = (undefined && undefined.__read) || function (o, n) {
|
3437 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
3438 | if (!m) return o;
|
3439 | var i = m.call(o), r, ar = [], e;
|
3440 | try {
|
3441 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
3442 | }
|
3443 | catch (error) { e = { error: error }; }
|
3444 | finally {
|
3445 | try {
|
3446 | if (r && !r.done && (m = i["return"])) m.call(i);
|
3447 | }
|
3448 | finally { if (e) throw e.error; }
|
3449 | }
|
3450 | return ar;
|
3451 | };
|
3452 | var __spread$m = (undefined && undefined.__spread) || function () {
|
3453 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$s(arguments[i]));
|
3454 | return ar;
|
3455 | };
|
3456 | var ComponentUtil = (function () {
|
3457 | function ComponentUtil() {
|
3458 | }
|
3459 | ComponentUtil.getCallbackForEvent = function (eventName) {
|
3460 | if (!eventName || eventName.length < 2) {
|
3461 | return eventName;
|
3462 | }
|
3463 | return 'on' + eventName[0].toUpperCase() + eventName.substr(1);
|
3464 | };
|
3465 | ComponentUtil.getCoercionLookup = function () {
|
3466 | var coercionLookup = {};
|
3467 | __spread$m(ComponentUtil.ARRAY_PROPERTIES, ComponentUtil.OBJECT_PROPERTIES, ComponentUtil.STRING_PROPERTIES, ComponentUtil.FUNCTION_PROPERTIES, ComponentUtil.EVENT_CALLBACKS).forEach(function (key) { return coercionLookup[key] = 'none'; });
|
3468 | ComponentUtil.BOOLEAN_PROPERTIES
|
3469 | .forEach(function (key) { return coercionLookup[key] = 'boolean'; });
|
3470 | ComponentUtil.NUMBER_PROPERTIES
|
3471 | .forEach(function (key) { return coercionLookup[key] = 'number'; });
|
3472 | return coercionLookup;
|
3473 | };
|
3474 | ComponentUtil.getValue = function (key, rawValue) {
|
3475 | var coercionStep = ComponentUtil.coercionLookup[key];
|
3476 | if (coercionStep) {
|
3477 | var newValue = rawValue;
|
3478 | switch (coercionStep) {
|
3479 | case 'number': {
|
3480 | newValue = ComponentUtil.toNumber(rawValue);
|
3481 | break;
|
3482 | }
|
3483 | case 'boolean': {
|
3484 | newValue = ComponentUtil.toBoolean(rawValue);
|
3485 | break;
|
3486 | }
|
3487 | case 'none': {
|
3488 |
|
3489 | if (key === 'groupAggFiltering' && typeof rawValue !== 'function') {
|
3490 | newValue = ComponentUtil.toBoolean(rawValue);
|
3491 | }
|
3492 | break;
|
3493 | }
|
3494 | }
|
3495 | return newValue;
|
3496 | }
|
3497 | return undefined;
|
3498 | };
|
3499 | ComponentUtil.getGridOptionKeys = function (component, isVue) {
|
3500 |
|
3501 |
|
3502 | return isVue
|
3503 | ? Object.keys(ComponentUtil.coercionLookup)
|
3504 | : Object.keys(component);
|
3505 | };
|
3506 | ComponentUtil.copyAttributesToGridOptions = function (gridOptions, component, isVue) {
|
3507 | if (isVue === void 0) { isVue = false; }
|
3508 |
|
3509 | if (typeof gridOptions !== 'object') {
|
3510 | gridOptions = {};
|
3511 | }
|
3512 |
|
3513 | var pGridOptions = gridOptions;
|
3514 | var keys = ComponentUtil.getGridOptionKeys(component, isVue);
|
3515 |
|
3516 | keys.forEach(function (key) {
|
3517 | var value = component[key];
|
3518 | if (typeof value !== 'undefined') {
|
3519 | var coercedValue = ComponentUtil.getValue(key, value);
|
3520 | if (coercedValue !== undefined) {
|
3521 | pGridOptions[key] = coercedValue;
|
3522 | }
|
3523 | }
|
3524 | });
|
3525 | return gridOptions;
|
3526 | };
|
3527 | ComponentUtil.processOnChange = function (changes, api) {
|
3528 | if (!changes || Object.keys(changes).length === 0) {
|
3529 | return;
|
3530 | }
|
3531 | var changesToApply = __assign$l({}, changes);
|
3532 |
|
3533 |
|
3534 | if (changesToApply.columnTypes) {
|
3535 | api.setColumnTypes(changesToApply.columnTypes.currentValue, "gridOptionsChanged");
|
3536 | delete changesToApply.columnTypes;
|
3537 | }
|
3538 | if (changesToApply.autoGroupColumnDef) {
|
3539 | api.setAutoGroupColumnDef(changesToApply.autoGroupColumnDef.currentValue, "gridOptionsChanged");
|
3540 | delete changesToApply.autoGroupColumnDef;
|
3541 | }
|
3542 | if (changesToApply.defaultColDef) {
|
3543 | api.setDefaultColDef(changesToApply.defaultColDef.currentValue, "gridOptionsChanged");
|
3544 | delete changesToApply.defaultColDef;
|
3545 | }
|
3546 | if (changesToApply.columnDefs) {
|
3547 | api.setColumnDefs(changesToApply.columnDefs.currentValue, "gridOptionsChanged");
|
3548 | delete changesToApply.columnDefs;
|
3549 | }
|
3550 | Object.keys(changesToApply).forEach(function (key) {
|
3551 | var gridKey = key;
|
3552 | var coercedValue = ComponentUtil.getValue(gridKey, changesToApply[gridKey].currentValue);
|
3553 | api.__setProperty(gridKey, coercedValue);
|
3554 | });
|
3555 |
|
3556 | var event = {
|
3557 | type: Events.EVENT_COMPONENT_STATE_CHANGED
|
3558 | };
|
3559 | iterateObject(changes, function (key, value) {
|
3560 | event[key] = value;
|
3561 | });
|
3562 | api.dispatchEvent(event);
|
3563 | };
|
3564 | ComponentUtil.toBoolean = function (value) {
|
3565 | if (typeof value === 'boolean') {
|
3566 | return value;
|
3567 | }
|
3568 | if (typeof value === 'string') {
|
3569 |
|
3570 |
|
3571 | return value.toUpperCase() === 'TRUE' || value == '';
|
3572 | }
|
3573 | return false;
|
3574 | };
|
3575 | ComponentUtil.toNumber = function (value) {
|
3576 | if (typeof value === 'number') {
|
3577 | return value;
|
3578 | }
|
3579 | if (typeof value === 'string') {
|
3580 | return Number(value);
|
3581 | }
|
3582 | };
|
3583 |
|
3584 | ComponentUtil.EVENTS = values(Events);
|
3585 |
|
3586 |
|
3587 | ComponentUtil.EXCLUDED_INTERNAL_EVENTS = [
|
3588 | Events.EVENT_SCROLLBAR_WIDTH_CHANGED,
|
3589 | Events.EVENT_CHECKBOX_CHANGED,
|
3590 | Events.EVENT_HEIGHT_SCALE_CHANGED,
|
3591 | Events.EVENT_BODY_HEIGHT_CHANGED,
|
3592 | Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED,
|
3593 | Events.EVENT_SCROLL_VISIBILITY_CHANGED,
|
3594 | Events.EVENT_COLUMN_HOVER_CHANGED,
|
3595 | Events.EVENT_FLASH_CELLS,
|
3596 | Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED,
|
3597 | Events.EVENT_DISPLAYED_ROWS_CHANGED,
|
3598 | Events.EVENT_LEFT_PINNED_WIDTH_CHANGED,
|
3599 | Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED,
|
3600 | Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED,
|
3601 | Events.EVENT_POPUP_TO_FRONT,
|
3602 | Events.EVENT_KEYBOARD_FOCUS,
|
3603 | Events.EVENT_MOUSE_FOCUS,
|
3604 | Events.EVENT_STORE_UPDATED,
|
3605 | Events.EVENT_COLUMN_PANEL_ITEM_DRAG_START,
|
3606 | Events.EVENT_COLUMN_PANEL_ITEM_DRAG_END,
|
3607 | Events.EVENT_FILL_START,
|
3608 | Events.EVENT_FILL_END,
|
3609 | Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_START,
|
3610 | Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_END,
|
3611 | Events.EVENT_FULL_WIDTH_ROW_FOCUSED,
|
3612 | Events.EVENT_HEADER_HEIGHT_CHANGED,
|
3613 | Events.EVENT_COLUMN_HEADER_HEIGHT_CHANGED,
|
3614 | Events.EVENT_INTERNAL_TOOL_PANEL_VISIBLE_CHANGED,
|
3615 | Events.EVENT_CELL_FOCUS_CLEARED,
|
3616 | Events.EVENT_GRID_STYLES_CHANGED,
|
3617 | Events.EVENT_FILTER_DESTROYED
|
3618 | ];
|
3619 |
|
3620 |
|
3621 | ComponentUtil.PUBLIC_EVENTS = ComponentUtil.EVENTS.filter(function (e) { return !includes(ComponentUtil.EXCLUDED_INTERNAL_EVENTS, e); });
|
3622 |
|
3623 | ComponentUtil.EVENT_CALLBACKS = ComponentUtil.EVENTS.map(function (event) { return ComponentUtil.getCallbackForEvent(event); });
|
3624 | ComponentUtil.STRING_PROPERTIES = PropertyKeys.STRING_PROPERTIES;
|
3625 | ComponentUtil.OBJECT_PROPERTIES = PropertyKeys.OBJECT_PROPERTIES;
|
3626 | ComponentUtil.ARRAY_PROPERTIES = PropertyKeys.ARRAY_PROPERTIES;
|
3627 | ComponentUtil.NUMBER_PROPERTIES = PropertyKeys.NUMBER_PROPERTIES;
|
3628 | ComponentUtil.BOOLEAN_PROPERTIES = PropertyKeys.BOOLEAN_PROPERTIES;
|
3629 | ComponentUtil.FUNCTION_PROPERTIES = PropertyKeys.FUNCTION_PROPERTIES;
|
3630 | ComponentUtil.ALL_PROPERTIES = PropertyKeys.ALL_PROPERTIES;
|
3631 | ComponentUtil.ALL_PROPERTIES_SET = new Set(PropertyKeys.ALL_PROPERTIES);
|
3632 | ComponentUtil.coercionLookup = ComponentUtil.getCoercionLookup();
|
3633 | return ComponentUtil;
|
3634 | }());
|
3635 |
|
3636 |
|
3637 |
|
3638 |
|
3639 |
|
3640 |
|
3641 |
|
3642 | function fuzzyCheckStrings(inputValues, validValues, allSuggestions) {
|
3643 | var fuzzyMatches = {};
|
3644 | var invalidInputs = inputValues.filter(function (inputValue) {
|
3645 | return !validValues.some(function (validValue) { return validValue === inputValue; });
|
3646 | });
|
3647 | if (invalidInputs.length > 0) {
|
3648 | invalidInputs.forEach(function (invalidInput) {
|
3649 | return fuzzyMatches[invalidInput] = fuzzySuggestions(invalidInput, allSuggestions);
|
3650 | });
|
3651 | }
|
3652 | return fuzzyMatches;
|
3653 | }
|
3654 |
|
3655 |
|
3656 |
|
3657 |
|
3658 |
|
3659 | function fuzzySuggestions(inputValue, allSuggestions, hideIrrelevant, filterByPercentageOfBestMatch) {
|
3660 | var thisSuggestions = allSuggestions.map(function (text) { return ({
|
3661 | value: text,
|
3662 | relevance: stringWeightedDistances(inputValue.toLowerCase(), text.toLocaleLowerCase())
|
3663 | }); });
|
3664 | thisSuggestions.sort(function (a, b) { return b.relevance - a.relevance; });
|
3665 | if (hideIrrelevant) {
|
3666 | thisSuggestions = thisSuggestions.filter(function (suggestion) { return suggestion.relevance !== 0; });
|
3667 | }
|
3668 | if (filterByPercentageOfBestMatch && filterByPercentageOfBestMatch > 0) {
|
3669 | var bestMatch = thisSuggestions[0].relevance;
|
3670 | var limit_1 = bestMatch * filterByPercentageOfBestMatch;
|
3671 | thisSuggestions = thisSuggestions.filter(function (suggestion) { return limit_1 - suggestion.relevance < 0; });
|
3672 | }
|
3673 | return thisSuggestions.map(function (suggestion) { return suggestion.value; });
|
3674 | }
|
3675 | function stringWeightedDistances(str1, str2) {
|
3676 | var a = str1.replace(/\s/g, '');
|
3677 | var b = str2.replace(/\s/g, '');
|
3678 | var weight = 0;
|
3679 | var lastIndex = -1;
|
3680 | for (var i = 0; i < a.length; i++) {
|
3681 | var idx = b.indexOf(a[i], lastIndex + 1);
|
3682 | if (idx === -1) {
|
3683 | continue;
|
3684 | }
|
3685 | lastIndex = idx;
|
3686 | weight += (100 - (lastIndex * 100 / 10000) * 100);
|
3687 | }
|
3688 | return weight;
|
3689 | }
|
3690 |
|
3691 | var FuzzyMatchUtils = Object.freeze({
|
3692 | __proto__: null,
|
3693 | fuzzyCheckStrings: fuzzyCheckStrings,
|
3694 | fuzzySuggestions: fuzzySuggestions
|
3695 | });
|
3696 |
|
3697 |
|
3698 |
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 | var __decorate$2u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
3704 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3705 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
3706 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
3707 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
3708 | };
|
3709 | var __read$r = (undefined && undefined.__read) || function (o, n) {
|
3710 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
3711 | if (!m) return o;
|
3712 | var i = m.call(o), r, ar = [], e;
|
3713 | try {
|
3714 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
3715 | }
|
3716 | catch (error) { e = { error: error }; }
|
3717 | finally {
|
3718 | try {
|
3719 | if (r && !r.done && (m = i["return"])) m.call(i);
|
3720 | }
|
3721 | finally { if (e) throw e.error; }
|
3722 | }
|
3723 | return ar;
|
3724 | };
|
3725 | var __spread$l = (undefined && undefined.__spread) || function () {
|
3726 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$r(arguments[i]));
|
3727 | return ar;
|
3728 | };
|
3729 | function logDeprecation(version, oldProp, newProp, message) {
|
3730 | var newPropMsg = newProp ? "Please use '" + newProp + "' instead. " : '';
|
3731 | doOnce(function () { return console.warn("AG Grid: since v" + version + ", '" + oldProp + "' is deprecated. " + newPropMsg + (message !== null && message !== void 0 ? message : '')); }, "Deprecated_" + oldProp);
|
3732 | }
|
3733 | var GridOptionsValidator = (function () {
|
3734 | function GridOptionsValidator() {
|
3735 | this.deprecatedProperties = {
|
3736 | serverSideInfiniteScroll: { version: '29', message: 'Infinite Scrolling is now the default behaviour. This can be suppressed with `suppressServerSideInfiniteScroll`.' },
|
3737 | rememberGroupStateWhenNewData: { version: '24', message: 'Now that transaction updates are possible and they keep group state, this feature is no longer needed.' },
|
3738 | suppressEnterpriseResetOnNewColumns: { version: '25', message: 'Now that it is possible to dynamically change columns in the grid, this is no longer needed.' },
|
3739 | suppressColumnStateEvents: { version: '25', message: 'Events should be ignored based on the `event.source`, which will be "api" if the event was due to setting column state via the API.' },
|
3740 | defaultExportParams: { version: '25.2', message: 'The property `defaultExportParams` has been replaced by `defaultCsvExportParams` and `defaultExcelExportParams`' },
|
3741 | stopEditingWhenGridLosesFocus: { version: '25.2.2', newProp: 'stopEditingWhenCellsLoseFocus', copyToNewProp: true },
|
3742 | applyColumnDefOrder: { version: '26', message: 'The property `applyColumnDefOrder` is no longer needed, as this is the default behaviour. To turn this behaviour off, set maintainColumnOrder=true' },
|
3743 | groupMultiAutoColumn: { version: '26', newProp: 'groupDisplayType', copyToNewProp: true, newPropValue: 'multipleColumns' },
|
3744 | groupUseEntireRow: { version: '26', newProp: 'groupDisplayType', copyToNewProp: true, newPropValue: 'groupRows' },
|
3745 | defaultGroupSortComparator: { version: '26', newProp: 'initialGroupOrderComparator' },
|
3746 | enableMultiRowDragging: { version: '26.1', newProp: 'rowDragMultiRow', copyToNewProp: true },
|
3747 | colWidth: { version: '26.1', newProp: 'defaultColDef.width' },
|
3748 | minColWidth: { version: '26.1', newProp: 'defaultColDef.minWidth' },
|
3749 | maxColWidth: { version: '26.1', newProp: 'defaultColDef.maxWidth' },
|
3750 | reactUi: { version: '26.1', message: 'React UI is on by default, so no need for reactUi=true. To turn it off, set suppressReactUi=true.' },
|
3751 | suppressCellSelection: { version: '27', newProp: 'suppressCellFocus', copyToNewProp: true },
|
3752 | clipboardDeliminator: { version: '27.1', newProp: 'clipboardDelimiter', copyToNewProp: true },
|
3753 | getRowNodeId: { version: '27.1', newProp: 'getRowId', message: 'The difference: if getRowId() is implemented then immutable data is enabled by default.' },
|
3754 | defaultGroupOrderComparator: { version: '27.2', newProp: 'initialGroupOrderComparator' },
|
3755 | groupRowAggNodes: { version: '27.2', newProp: 'getGroupRowAgg' },
|
3756 | postSort: { version: '27.2', newProp: 'postSortRows' },
|
3757 | isFullWidthCell: { version: '27.2', newProp: 'isFullWidthRow' },
|
3758 | localeTextFunc: { version: '27.2', newProp: 'getLocaleText' },
|
3759 | serverSideFilteringAlwaysResets: { version: '28.0', newProp: 'serverSideFilterAllLevels', copyToNewProp: true, },
|
3760 | serverSideSortingAlwaysResets: { version: '28.0', newProp: 'serverSideSortAllLevels', copyToNewProp: true, },
|
3761 | suppressReactUi: { version: '28', message: 'The legacy React rendering engine is deprecated and will be removed in the next major version of the grid.' },
|
3762 | processSecondaryColDef: { version: '28', newProp: 'processPivotResultColDef', copyToNewProp: true },
|
3763 | processSecondaryColGroupDef: { version: '28', newProp: 'processPivotResultColGroupDef', copyToNewProp: true },
|
3764 | getServerSideStoreParams: { version: '28', newProp: 'getServerSideGroupLevelParams', copyToNewProp: true },
|
3765 | enableChartToolPanelsButton: { version: '29', message: 'The Chart Tool Panels button is now enabled by default. To hide the Chart Tool Panels button and display the hamburger button instead, set suppressChartToolPanelsButton=true.' },
|
3766 | functionsPassive: { version: '29.2' },
|
3767 | onColumnRowGroupChangeRequest: { version: '29.2' },
|
3768 | onColumnPivotChangeRequest: { version: '29.2' },
|
3769 | onColumnValueChangeRequest: { version: '29.2' },
|
3770 | onColumnAggFuncChangeRequest: { version: '29.2' },
|
3771 | };
|
3772 | }
|
3773 | GridOptionsValidator.prototype.pickOneWarning = function (prop1, prop2) {
|
3774 | console.warn("AG Grid: " + prop1 + " and " + prop2 + " do not work with each other, you need to pick one.");
|
3775 | };
|
3776 | GridOptionsValidator.prototype.init = function () {
|
3777 | var _this = this;
|
3778 | this.checkForDeprecated();
|
3779 | this.checkForViolations();
|
3780 | if (this.gridOptions.suppressPropertyNamesCheck !== true) {
|
3781 | this.checkGridOptionsProperties();
|
3782 | this.checkColumnDefProperties();
|
3783 | }
|
3784 | this.checkColumnDefViolations();
|
3785 | if (this.gridOptionsService.is('groupSelectsChildren') && this.gridOptionsService.is('suppressParentsInRowNodes')) {
|
3786 | console.warn("AG Grid: 'groupSelectsChildren' does not work with 'suppressParentsInRowNodes', this selection method needs the part in rowNode to work");
|
3787 | }
|
3788 | if (this.gridOptionsService.is('groupSelectsChildren')) {
|
3789 | if (this.gridOptionsService.get('rowSelection') !== 'multiple') {
|
3790 | console.warn("AG Grid: rowSelection must be 'multiple' for groupSelectsChildren to make sense");
|
3791 | }
|
3792 | }
|
3793 | if (this.gridOptionsService.is('groupRemoveSingleChildren') && this.gridOptionsService.is('groupHideOpenParents')) {
|
3794 | this.pickOneWarning('groupRemoveSingleChildren', 'groupHideOpenParents');
|
3795 | }
|
3796 | if (this.gridOptionsService.isRowModelType('serverSide')) {
|
3797 | var msg = function (prop, alt) { return ("AG Grid: '" + prop + "' is not supported on the Server-Side Row Model." + (alt ? " Please use " + alt + " instead." : '')); };
|
3798 | if (this.gridOptionsService.exists('groupDefaultExpanded')) {
|
3799 | console.warn(msg('groupDefaultExpanded', 'isServerSideGroupOpenByDefault callback'));
|
3800 | }
|
3801 | if (this.gridOptionsService.exists('groupIncludeFooter')) {
|
3802 | console.warn(msg('groupIncludeFooter'));
|
3803 | }
|
3804 | if (this.gridOptionsService.exists('groupIncludeTotalFooter')) {
|
3805 | console.warn(msg('groupIncludeTotalFooter'));
|
3806 | }
|
3807 | }
|
3808 | if (this.gridOptionsService.is('enableRangeSelection')) {
|
3809 | ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'enableRangeSelection');
|
3810 | }
|
3811 | else if (this.gridOptionsService.is('enableRangeHandle') || this.gridOptionsService.is('enableFillHandle')) {
|
3812 | console.warn("AG Grid: 'enableRangeHandle' or 'enableFillHandle' will not work unless 'enableRangeSelection' is set to true");
|
3813 | }
|
3814 | var validateRegistered = function (prop, module) { return _this.gridOptionsService.exists(prop) && ModuleRegistry.assertRegistered(module, prop); };
|
3815 |
|
3816 |
|
3817 | validateRegistered('sideBar', ModuleNames.SideBarModule);
|
3818 | validateRegistered('statusBar', ModuleNames.StatusBarModule);
|
3819 | validateRegistered('enableCharts', ModuleNames.GridChartsModule);
|
3820 | validateRegistered('getMainMenuItems', ModuleNames.MenuModule);
|
3821 | validateRegistered('getContextMenuItems', ModuleNames.MenuModule);
|
3822 | validateRegistered('allowContextMenuWithControlKey', ModuleNames.MenuModule);
|
3823 | if (this.gridOptionsService.is('groupRowsSticky')) {
|
3824 | if (this.gridOptionsService.is('groupHideOpenParents')) {
|
3825 | this.pickOneWarning('groupRowsSticky', 'groupHideOpenParents');
|
3826 | }
|
3827 | if (this.gridOptionsService.is('masterDetail')) {
|
3828 | this.pickOneWarning('groupRowsSticky', 'masterDetail');
|
3829 | }
|
3830 | if (this.gridOptionsService.is('pagination')) {
|
3831 | this.pickOneWarning('groupRowsSticky', 'pagination');
|
3832 | }
|
3833 | }
|
3834 | };
|
3835 | GridOptionsValidator.prototype.checkColumnDefProperties = function () {
|
3836 | var _this = this;
|
3837 | if (this.gridOptions.columnDefs == null) {
|
3838 | return;
|
3839 | }
|
3840 | this.gridOptions.columnDefs.forEach(function (colDef) {
|
3841 | var userProperties = Object.getOwnPropertyNames(colDef);
|
3842 | var validProperties = __spread$l(ColDefUtil.ALL_PROPERTIES, ColDefUtil.FRAMEWORK_PROPERTIES);
|
3843 | _this.checkProperties(userProperties, validProperties, validProperties, 'colDef', 'https://www.ag-grid.com/javascript-data-grid/column-properties/');
|
3844 | });
|
3845 | };
|
3846 | GridOptionsValidator.prototype.checkColumnDefViolations = function () {
|
3847 | var _a;
|
3848 | var rowModel = (_a = this.gridOptionsService.get('rowModelType')) !== null && _a !== void 0 ? _a : 'clientSide';
|
3849 | var unsupportedPropertiesMap = {
|
3850 | infinite: ['headerCheckboxSelection', 'headerCheckboxSelectionFilteredOnly', 'headerCheckboxSelectionCurrentPageOnly'],
|
3851 | viewport: ['headerCheckboxSelection', 'headerCheckboxSelectionFilteredOnly', 'headerCheckboxSelectionCurrentPageOnly'],
|
3852 | serverSide: ['headerCheckboxSelectionFilteredOnly', 'headerCheckboxSelectionCurrentPageOnly'],
|
3853 | clientSide: [],
|
3854 | };
|
3855 | var unsupportedProperties = unsupportedPropertiesMap[rowModel];
|
3856 | if (!(unsupportedProperties === null || unsupportedProperties === void 0 ? void 0 : unsupportedProperties.length)) {
|
3857 | return;
|
3858 | }
|
3859 | var validateColDef = function (colDef) {
|
3860 | unsupportedProperties.forEach(function (property) {
|
3861 | if (property in colDef && !!colDef[property]) {
|
3862 | console.warn("AG Grid: Column property " + property + " is not supported with the row model type " + rowModel + ".");
|
3863 | }
|
3864 | });
|
3865 | };
|
3866 | if (this.gridOptions.columnDefs != null) {
|
3867 | this.gridOptions.columnDefs.forEach(function (colDef) { return validateColDef(colDef); });
|
3868 | }
|
3869 | if (this.gridOptions.autoGroupColumnDef != null) {
|
3870 | validateColDef(this.gridOptions.autoGroupColumnDef);
|
3871 | }
|
3872 | if (this.gridOptions.defaultColDef != null) {
|
3873 | validateColDef(this.gridOptions.defaultColDef);
|
3874 | }
|
3875 | };
|
3876 | GridOptionsValidator.prototype.checkGridOptionsProperties = function () {
|
3877 | var userProperties = Object.getOwnPropertyNames(this.gridOptions);
|
3878 | var validProperties = __spread$l(PropertyKeys.ALL_PROPERTIES, PropertyKeys.FRAMEWORK_PROPERTIES, ComponentUtil.EVENT_CALLBACKS);
|
3879 | var validPropertiesAndExceptions = __spread$l(validProperties, ['api', 'columnApi'], Object.keys(this.deprecatedProperties));
|
3880 | this.checkProperties(userProperties, validPropertiesAndExceptions, validProperties, 'gridOptions', 'https://www.ag-grid.com/javascript-data-grid/grid-options/');
|
3881 | };
|
3882 | GridOptionsValidator.prototype.checkProperties = function (userProperties, validPropertiesAndExceptions, validProperties, containerName, docsUrl) {
|
3883 | var invalidProperties = fuzzyCheckStrings(userProperties, validPropertiesAndExceptions, validProperties);
|
3884 | iterateObject(invalidProperties, function (key, value) {
|
3885 | console.warn("AG Grid: invalid " + containerName + " property '" + key + "' did you mean any of these: " + value.slice(0, 8).join(", "));
|
3886 | });
|
3887 | if (Object.keys(invalidProperties).length > 0) {
|
3888 | console.warn("AG Grid: to see all the valid " + containerName + " properties please check: " + docsUrl);
|
3889 | }
|
3890 | };
|
3891 | GridOptionsValidator.prototype.checkForDeprecated = function () {
|
3892 |
|
3893 |
|
3894 | var options = this.gridOptions;
|
3895 | Object.entries(this.deprecatedProperties).forEach(function (_a) {
|
3896 | var _b;
|
3897 | var _c = __read$r(_a, 2), oldProp = _c[0], details = _c[1];
|
3898 | var oldPropValue = options[oldProp];
|
3899 | if (oldPropValue) {
|
3900 | logDeprecation(details.version, oldProp, details.newProp, details.message);
|
3901 | if (details.copyToNewProp && details.newProp && options[details.newProp] == null) {
|
3902 | options[details.newProp] = (_b = details.newPropValue) !== null && _b !== void 0 ? _b : oldPropValue;
|
3903 | }
|
3904 | }
|
3905 | });
|
3906 |
|
3907 | if (options.groupSuppressAutoColumn) {
|
3908 | var propName = options.treeData ? 'treeDataDisplayType' : 'groupDisplayType';
|
3909 | console.warn("AG Grid: since v26.0, the grid property `groupSuppressAutoColumn` has been replaced by `" + propName + " = 'custom'`");
|
3910 | options[propName] = 'custom';
|
3911 | }
|
3912 | if (options.immutableData) {
|
3913 | if (options.getRowId) {
|
3914 | 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`.');
|
3915 | }
|
3916 | else {
|
3917 | console.warn('AG Grid: since v27.1, `immutableData` is deprecated. To enable immutable data you must implement the `getRowId()` callback.');
|
3918 | }
|
3919 | }
|
3920 | if (options.serverSideStoreType) {
|
3921 | console.warn('AG Grid: since v29.0, `serverSideStoreType` has been replaced by `suppressServerSideInfiniteScroll`. Set to false to use Partial Store, and true to use Full Store.');
|
3922 | options.suppressServerSideInfiniteScroll = options.serverSideStoreType !== 'partial';
|
3923 | }
|
3924 | };
|
3925 | GridOptionsValidator.prototype.checkForViolations = function () {
|
3926 | if (this.gridOptionsService.is('treeData')) {
|
3927 | this.treeDataViolations();
|
3928 | }
|
3929 | };
|
3930 | GridOptionsValidator.prototype.treeDataViolations = function () {
|
3931 | if (this.gridOptionsService.isRowModelType('clientSide')) {
|
3932 | if (!this.gridOptionsService.exists('getDataPath')) {
|
3933 | console.warn('AG Grid: property usingTreeData=true with rowModel=clientSide, but you did not ' +
|
3934 | 'provide getDataPath function, please provide getDataPath function if using tree data.');
|
3935 | }
|
3936 | }
|
3937 | if (this.gridOptionsService.isRowModelType('serverSide')) {
|
3938 | if (!this.gridOptionsService.exists('isServerSideGroup')) {
|
3939 | console.warn('AG Grid: property usingTreeData=true with rowModel=serverSide, but you did not ' +
|
3940 | 'provide isServerSideGroup function, please provide isServerSideGroup function if using tree data.');
|
3941 | }
|
3942 | if (!this.gridOptionsService.exists('getServerSideGroupKey')) {
|
3943 | console.warn('AG Grid: property usingTreeData=true with rowModel=serverSide, but you did not ' +
|
3944 | 'provide getServerSideGroupKey function, please provide getServerSideGroupKey function if using tree data.');
|
3945 | }
|
3946 | }
|
3947 | };
|
3948 | __decorate$2u([
|
3949 | Autowired('gridOptions')
|
3950 | ], GridOptionsValidator.prototype, "gridOptions", void 0);
|
3951 | __decorate$2u([
|
3952 | Autowired('gridOptionsService')
|
3953 | ], GridOptionsValidator.prototype, "gridOptionsService", void 0);
|
3954 | __decorate$2u([
|
3955 | PostConstruct
|
3956 | ], GridOptionsValidator.prototype, "init", null);
|
3957 | GridOptionsValidator = __decorate$2u([
|
3958 | Bean('gridOptionsValidator')
|
3959 | ], GridOptionsValidator);
|
3960 | return GridOptionsValidator;
|
3961 | }());
|
3962 | function matchesGroupDisplayType(toMatch, supplied) {
|
3963 | var groupDisplayTypeValues = ['groupRows', 'multipleColumns', 'custom', 'singleColumn'];
|
3964 | if (groupDisplayTypeValues.indexOf(supplied) < 0) {
|
3965 | console.warn("AG Grid: '" + supplied + "' is not a valid groupDisplayType value - possible values are: '" + groupDisplayTypeValues.join("', '") + "'");
|
3966 | return false;
|
3967 | }
|
3968 | return supplied === toMatch;
|
3969 | }
|
3970 | function matchesTreeDataDisplayType(toMatch, supplied) {
|
3971 | var treeDataDisplayTypeValues = ['auto', 'custom'];
|
3972 | if (treeDataDisplayTypeValues.indexOf(supplied) < 0) {
|
3973 | console.warn("AG Grid: '" + supplied + "' is not a valid treeDataDisplayType value - possible values are: '" + treeDataDisplayTypeValues.join("', '") + "'");
|
3974 | return false;
|
3975 | }
|
3976 | return supplied === toMatch;
|
3977 | }
|
3978 |
|
3979 |
|
3980 |
|
3981 |
|
3982 |
|
3983 |
|
3984 |
|
3985 | var __decorate$2t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
3986 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3987 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
3988 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
3989 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
3990 | };
|
3991 | var ColumnGroup = (function () {
|
3992 | function ColumnGroup(providedColumnGroup, groupId, partId, pinned) {
|
3993 |
|
3994 | this.displayedChildren = [];
|
3995 | this.localEventService = new EventService();
|
3996 | this.groupId = groupId;
|
3997 | this.partId = partId;
|
3998 | this.providedColumnGroup = providedColumnGroup;
|
3999 | this.pinned = pinned;
|
4000 | }
|
4001 |
|
4002 | ColumnGroup.createUniqueId = function (groupId, instanceId) {
|
4003 | return groupId + '_' + instanceId;
|
4004 | };
|
4005 |
|
4006 |
|
4007 | ColumnGroup.prototype.reset = function () {
|
4008 | this.parent = null;
|
4009 | this.children = null;
|
4010 | this.displayedChildren = null;
|
4011 | };
|
4012 | ColumnGroup.prototype.getParent = function () {
|
4013 | return this.parent;
|
4014 | };
|
4015 | ColumnGroup.prototype.setParent = function (parent) {
|
4016 | this.parent = parent;
|
4017 | };
|
4018 | ColumnGroup.prototype.getUniqueId = function () {
|
4019 | return ColumnGroup.createUniqueId(this.groupId, this.partId);
|
4020 | };
|
4021 | ColumnGroup.prototype.isEmptyGroup = function () {
|
4022 | return this.displayedChildren.length === 0;
|
4023 | };
|
4024 | ColumnGroup.prototype.isMoving = function () {
|
4025 | var allLeafColumns = this.getProvidedColumnGroup().getLeafColumns();
|
4026 | if (!allLeafColumns || allLeafColumns.length === 0) {
|
4027 | return false;
|
4028 | }
|
4029 | return allLeafColumns.every(function (col) { return col.isMoving(); });
|
4030 | };
|
4031 | ColumnGroup.prototype.checkLeft = function () {
|
4032 |
|
4033 | this.displayedChildren.forEach(function (child) {
|
4034 | if (child instanceof ColumnGroup) {
|
4035 | child.checkLeft();
|
4036 | }
|
4037 | });
|
4038 |
|
4039 | if (this.displayedChildren.length > 0) {
|
4040 | if (this.gridOptionsService.is('enableRtl')) {
|
4041 | var lastChild = last(this.displayedChildren);
|
4042 | var lastChildLeft = lastChild.getLeft();
|
4043 | this.setLeft(lastChildLeft);
|
4044 | }
|
4045 | else {
|
4046 | var firstChildLeft = this.displayedChildren[0].getLeft();
|
4047 | this.setLeft(firstChildLeft);
|
4048 | }
|
4049 | }
|
4050 | else {
|
4051 |
|
4052 |
|
4053 | this.setLeft(null);
|
4054 | }
|
4055 | };
|
4056 | ColumnGroup.prototype.getLeft = function () {
|
4057 | return this.left;
|
4058 | };
|
4059 | ColumnGroup.prototype.getOldLeft = function () {
|
4060 | return this.oldLeft;
|
4061 | };
|
4062 | ColumnGroup.prototype.setLeft = function (left) {
|
4063 | this.oldLeft = left;
|
4064 | if (this.left !== left) {
|
4065 | this.left = left;
|
4066 | this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_LEFT_CHANGED));
|
4067 | }
|
4068 | };
|
4069 | ColumnGroup.prototype.getPinned = function () {
|
4070 | return this.pinned;
|
4071 | };
|
4072 | ColumnGroup.prototype.createAgEvent = function (type) {
|
4073 | return { type: type };
|
4074 | };
|
4075 | ColumnGroup.prototype.addEventListener = function (eventType, listener) {
|
4076 | this.localEventService.addEventListener(eventType, listener);
|
4077 | };
|
4078 | ColumnGroup.prototype.removeEventListener = function (eventType, listener) {
|
4079 | this.localEventService.removeEventListener(eventType, listener);
|
4080 | };
|
4081 | ColumnGroup.prototype.getGroupId = function () {
|
4082 | return this.groupId;
|
4083 | };
|
4084 | ColumnGroup.prototype.getPartId = function () {
|
4085 | return this.partId;
|
4086 | };
|
4087 | ColumnGroup.prototype.isChildInThisGroupDeepSearch = function (wantedChild) {
|
4088 | var result = false;
|
4089 | this.children.forEach(function (foundChild) {
|
4090 | if (wantedChild === foundChild) {
|
4091 | result = true;
|
4092 | }
|
4093 | if (foundChild instanceof ColumnGroup) {
|
4094 | if (foundChild.isChildInThisGroupDeepSearch(wantedChild)) {
|
4095 | result = true;
|
4096 | }
|
4097 | }
|
4098 | });
|
4099 | return result;
|
4100 | };
|
4101 | ColumnGroup.prototype.getActualWidth = function () {
|
4102 | var groupActualWidth = 0;
|
4103 | if (this.displayedChildren) {
|
4104 | this.displayedChildren.forEach(function (child) {
|
4105 | groupActualWidth += child.getActualWidth();
|
4106 | });
|
4107 | }
|
4108 | return groupActualWidth;
|
4109 | };
|
4110 | ColumnGroup.prototype.isResizable = function () {
|
4111 | if (!this.displayedChildren) {
|
4112 | return false;
|
4113 | }
|
4114 |
|
4115 | var result = false;
|
4116 | this.displayedChildren.forEach(function (child) {
|
4117 | if (child.isResizable()) {
|
4118 | result = true;
|
4119 | }
|
4120 | });
|
4121 | return result;
|
4122 | };
|
4123 | ColumnGroup.prototype.getMinWidth = function () {
|
4124 | var result = 0;
|
4125 | this.displayedChildren.forEach(function (groupChild) {
|
4126 | result += groupChild.getMinWidth() || 0;
|
4127 | });
|
4128 | return result;
|
4129 | };
|
4130 | ColumnGroup.prototype.addChild = function (child) {
|
4131 | if (!this.children) {
|
4132 | this.children = [];
|
4133 | }
|
4134 | this.children.push(child);
|
4135 | };
|
4136 | ColumnGroup.prototype.getDisplayedChildren = function () {
|
4137 | return this.displayedChildren;
|
4138 | };
|
4139 | ColumnGroup.prototype.getLeafColumns = function () {
|
4140 | var result = [];
|
4141 | this.addLeafColumns(result);
|
4142 | return result;
|
4143 | };
|
4144 | ColumnGroup.prototype.getDisplayedLeafColumns = function () {
|
4145 | var result = [];
|
4146 | this.addDisplayedLeafColumns(result);
|
4147 | return result;
|
4148 | };
|
4149 | ColumnGroup.prototype.getDefinition = function () {
|
4150 | return this.providedColumnGroup.getColGroupDef();
|
4151 | };
|
4152 | ColumnGroup.prototype.getColGroupDef = function () {
|
4153 | return this.providedColumnGroup.getColGroupDef();
|
4154 | };
|
4155 | ColumnGroup.prototype.isPadding = function () {
|
4156 | return this.providedColumnGroup.isPadding();
|
4157 | };
|
4158 | ColumnGroup.prototype.isExpandable = function () {
|
4159 | return this.providedColumnGroup.isExpandable();
|
4160 | };
|
4161 | ColumnGroup.prototype.isExpanded = function () {
|
4162 | return this.providedColumnGroup.isExpanded();
|
4163 | };
|
4164 | ColumnGroup.prototype.setExpanded = function (expanded) {
|
4165 | this.providedColumnGroup.setExpanded(expanded);
|
4166 | };
|
4167 | ColumnGroup.prototype.addDisplayedLeafColumns = function (leafColumns) {
|
4168 | this.displayedChildren.forEach(function (child) {
|
4169 | if (child instanceof Column) {
|
4170 | leafColumns.push(child);
|
4171 | }
|
4172 | else if (child instanceof ColumnGroup) {
|
4173 | child.addDisplayedLeafColumns(leafColumns);
|
4174 | }
|
4175 | });
|
4176 | };
|
4177 | ColumnGroup.prototype.addLeafColumns = function (leafColumns) {
|
4178 | this.children.forEach(function (child) {
|
4179 | if (child instanceof Column) {
|
4180 | leafColumns.push(child);
|
4181 | }
|
4182 | else if (child instanceof ColumnGroup) {
|
4183 | child.addLeafColumns(leafColumns);
|
4184 | }
|
4185 | });
|
4186 | };
|
4187 | ColumnGroup.prototype.getChildren = function () {
|
4188 | return this.children;
|
4189 | };
|
4190 | ColumnGroup.prototype.getColumnGroupShow = function () {
|
4191 | return this.providedColumnGroup.getColumnGroupShow();
|
4192 | };
|
4193 | ColumnGroup.prototype.getProvidedColumnGroup = function () {
|
4194 | return this.providedColumnGroup;
|
4195 | };
|
4196 |
|
4197 | ColumnGroup.prototype.getOriginalColumnGroup = function () {
|
4198 | logDeprecation('27', 'getOriginalColumnGroup', 'getProvidedColumnGroup');
|
4199 | return this.getProvidedColumnGroup();
|
4200 | };
|
4201 | ColumnGroup.prototype.getPaddingLevel = function () {
|
4202 | var parent = this.getParent();
|
4203 | if (!this.isPadding() || !parent || !parent.isPadding()) {
|
4204 | return 0;
|
4205 | }
|
4206 | return 1 + parent.getPaddingLevel();
|
4207 | };
|
4208 | ColumnGroup.prototype.calculateDisplayedColumns = function () {
|
4209 | var _this = this;
|
4210 |
|
4211 | this.displayedChildren = [];
|
4212 |
|
4213 |
|
4214 | var parentWithExpansion = this;
|
4215 | while (parentWithExpansion != null && parentWithExpansion.isPadding()) {
|
4216 | parentWithExpansion = parentWithExpansion.getParent();
|
4217 | }
|
4218 | var isExpandable = parentWithExpansion ? parentWithExpansion.providedColumnGroup.isExpandable() : false;
|
4219 |
|
4220 | if (!isExpandable) {
|
4221 | this.displayedChildren = this.children;
|
4222 | this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED));
|
4223 | return;
|
4224 | }
|
4225 |
|
4226 |
|
4227 |
|
4228 | this.children.forEach(function (child) {
|
4229 |
|
4230 | var emptyGroup = child instanceof ColumnGroup && (!child.displayedChildren || !child.displayedChildren.length);
|
4231 | if (emptyGroup) {
|
4232 | return;
|
4233 | }
|
4234 | var headerGroupShow = child.getColumnGroupShow();
|
4235 | switch (headerGroupShow) {
|
4236 | case 'open':
|
4237 |
|
4238 | if (parentWithExpansion.providedColumnGroup.isExpanded()) {
|
4239 | _this.displayedChildren.push(child);
|
4240 | }
|
4241 | break;
|
4242 | case 'closed':
|
4243 |
|
4244 | if (!parentWithExpansion.providedColumnGroup.isExpanded()) {
|
4245 | _this.displayedChildren.push(child);
|
4246 | }
|
4247 | break;
|
4248 | default:
|
4249 | _this.displayedChildren.push(child);
|
4250 | break;
|
4251 | }
|
4252 | });
|
4253 | this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED));
|
4254 | };
|
4255 | ColumnGroup.EVENT_LEFT_CHANGED = 'leftChanged';
|
4256 | ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED = 'displayedChildrenChanged';
|
4257 | __decorate$2t([
|
4258 | Autowired('gridOptionsService')
|
4259 | ], ColumnGroup.prototype, "gridOptionsService", void 0);
|
4260 | return ColumnGroup;
|
4261 | }());
|
4262 |
|
4263 |
|
4264 |
|
4265 |
|
4266 |
|
4267 |
|
4268 |
|
4269 |
|
4270 |
|
4271 |
|
4272 |
|
4273 |
|
4274 |
|
4275 |
|
4276 |
|
4277 |
|
4278 |
|
4279 | var GroupInstanceIdCreator = (function () {
|
4280 | function GroupInstanceIdCreator() {
|
4281 |
|
4282 | this.existingIds = {};
|
4283 | }
|
4284 | GroupInstanceIdCreator.prototype.getInstanceIdForKey = function (key) {
|
4285 | var lastResult = this.existingIds[key];
|
4286 | var result;
|
4287 | if (typeof lastResult !== 'number') {
|
4288 |
|
4289 | result = 0;
|
4290 | }
|
4291 | else {
|
4292 | result = lastResult + 1;
|
4293 | }
|
4294 | this.existingIds[key] = result;
|
4295 | return result;
|
4296 | };
|
4297 | return GroupInstanceIdCreator;
|
4298 | }());
|
4299 |
|
4300 |
|
4301 |
|
4302 |
|
4303 |
|
4304 |
|
4305 |
|
4306 | var __extends$2R = (undefined && undefined.__extends) || (function () {
|
4307 | var extendStatics = function (d, b) {
|
4308 | extendStatics = Object.setPrototypeOf ||
|
4309 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
4310 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
4311 | return extendStatics(d, b);
|
4312 | };
|
4313 | return function (d, b) {
|
4314 | extendStatics(d, b);
|
4315 | function __() { this.constructor = d; }
|
4316 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
4317 | };
|
4318 | })();
|
4319 | var __decorate$2s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
4320 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4321 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4322 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
4323 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
4324 | };
|
4325 | var GROUP_AUTO_COLUMN_ID = 'ag-Grid-AutoColumn';
|
4326 | var AutoGroupColService = (function (_super) {
|
4327 | __extends$2R(AutoGroupColService, _super);
|
4328 | function AutoGroupColService() {
|
4329 | return _super !== null && _super.apply(this, arguments) || this;
|
4330 | }
|
4331 | AutoGroupColService.prototype.createAutoGroupColumns = function (existingCols, rowGroupColumns) {
|
4332 | var _this = this;
|
4333 | var groupAutoColumns = [];
|
4334 | var doingTreeData = this.gridOptionsService.isTreeData();
|
4335 | var doingMultiAutoColumn = this.gridOptionsService.isGroupMultiAutoColumn();
|
4336 | if (doingTreeData && doingMultiAutoColumn) {
|
4337 | console.warn('AG Grid: you cannot mix groupDisplayType = "multipleColumns" with treeData, only one column can be used to display groups when doing tree data');
|
4338 | doingMultiAutoColumn = false;
|
4339 | }
|
4340 |
|
4341 |
|
4342 | if (doingMultiAutoColumn) {
|
4343 | rowGroupColumns.forEach(function (rowGroupCol, index) {
|
4344 | groupAutoColumns.push(_this.createOneAutoGroupColumn(existingCols, rowGroupCol, index));
|
4345 | });
|
4346 | }
|
4347 | else {
|
4348 | groupAutoColumns.push(this.createOneAutoGroupColumn(existingCols));
|
4349 | }
|
4350 | return groupAutoColumns;
|
4351 | };
|
4352 |
|
4353 | AutoGroupColService.prototype.createOneAutoGroupColumn = function (existingCols, rowGroupCol, index) {
|
4354 |
|
4355 | var defaultAutoColDef = this.generateDefaultColDef(rowGroupCol);
|
4356 |
|
4357 | var colId;
|
4358 | if (rowGroupCol) {
|
4359 | colId = GROUP_AUTO_COLUMN_ID + "-" + rowGroupCol.getId();
|
4360 | }
|
4361 | else {
|
4362 | colId = GROUP_AUTO_COLUMN_ID;
|
4363 | }
|
4364 | var userAutoColDef = this.gridOptionsService.get('autoGroupColumnDef');
|
4365 | mergeDeep(defaultAutoColDef, userAutoColDef);
|
4366 | defaultAutoColDef = this.columnFactory.mergeColDefs(defaultAutoColDef);
|
4367 | defaultAutoColDef.colId = colId;
|
4368 |
|
4369 | if (!this.gridOptionsService.isTreeData()) {
|
4370 |
|
4371 |
|
4372 | var noFieldOrValueGetter = missing(defaultAutoColDef.field) &&
|
4373 | missing(defaultAutoColDef.valueGetter) &&
|
4374 | missing(defaultAutoColDef.filterValueGetter) &&
|
4375 | defaultAutoColDef.filter !== 'agGroupColumnFilter';
|
4376 | if (noFieldOrValueGetter) {
|
4377 | defaultAutoColDef.filter = false;
|
4378 | }
|
4379 | }
|
4380 |
|
4381 | if (index && index > 0) {
|
4382 | defaultAutoColDef.headerCheckboxSelection = false;
|
4383 | }
|
4384 | var existingCol = existingCols.find(function (col) { return col.getId() == colId; });
|
4385 | if (existingCol) {
|
4386 | existingCol.setColDef(defaultAutoColDef, null);
|
4387 | this.columnFactory.applyColumnState(existingCol, defaultAutoColDef);
|
4388 | return existingCol;
|
4389 | }
|
4390 | var isSortingCoupled = this.gridOptionsService.isColumnsSortingCoupledToGroup();
|
4391 | if (isSortingCoupled && (defaultAutoColDef.sort || defaultAutoColDef.initialSort) && !defaultAutoColDef.field) {
|
4392 |
|
4393 | mergeDeep(defaultAutoColDef, { sort: null, initialSort: null }, true, true);
|
4394 | }
|
4395 | var newCol = new Column(defaultAutoColDef, null, colId, true);
|
4396 | this.context.createBean(newCol);
|
4397 | return newCol;
|
4398 | };
|
4399 | AutoGroupColService.prototype.generateDefaultColDef = function (rowGroupCol) {
|
4400 | var userDef = this.gridOptionsService.get('autoGroupColumnDef');
|
4401 | var localeTextFunc = this.localeService.getLocaleTextFunc();
|
4402 | var res = {
|
4403 | headerName: localeTextFunc('group', 'Group')
|
4404 | };
|
4405 | var userHasProvidedGroupCellRenderer = userDef &&
|
4406 | (userDef.cellRenderer || userDef.cellRendererFramework || userDef.cellRendererSelector);
|
4407 |
|
4408 | if (!userHasProvidedGroupCellRenderer) {
|
4409 | res.cellRenderer = 'agGroupCellRenderer';
|
4410 | }
|
4411 |
|
4412 |
|
4413 | if (rowGroupCol) {
|
4414 | var colDef = rowGroupCol.getColDef();
|
4415 | Object.assign(res, {
|
4416 |
|
4417 | headerName: this.columnModel.getDisplayNameForColumn(rowGroupCol, 'header'),
|
4418 | headerValueGetter: colDef.headerValueGetter
|
4419 | });
|
4420 | if (colDef.cellRenderer || colDef.cellRendererFramework) {
|
4421 | Object.assign(res, {
|
4422 | cellRendererParams: {
|
4423 | innerRenderer: colDef.cellRenderer,
|
4424 | innerRendererFramework: colDef.cellRendererFramework,
|
4425 | innerRendererParams: colDef.cellRendererParams
|
4426 | }
|
4427 | });
|
4428 | }
|
4429 | res.showRowGroup = rowGroupCol.getColId();
|
4430 | }
|
4431 | else {
|
4432 | res.showRowGroup = true;
|
4433 | }
|
4434 | return res;
|
4435 | };
|
4436 | __decorate$2s([
|
4437 | Autowired('columnModel')
|
4438 | ], AutoGroupColService.prototype, "columnModel", void 0);
|
4439 | __decorate$2s([
|
4440 | Autowired('columnFactory')
|
4441 | ], AutoGroupColService.prototype, "columnFactory", void 0);
|
4442 | AutoGroupColService = __decorate$2s([
|
4443 | Bean('autoGroupColService')
|
4444 | ], AutoGroupColService);
|
4445 | return AutoGroupColService;
|
4446 | }(BeanStub));
|
4447 |
|
4448 |
|
4449 |
|
4450 |
|
4451 |
|
4452 |
|
4453 |
|
4454 | var reUnescapedHtml = /[&<>"']/g;
|
4455 |
|
4456 |
|
4457 |
|
4458 | var HTML_ESCAPES = {
|
4459 | '&': '&',
|
4460 | '<': '<',
|
4461 | '>': '>',
|
4462 | '"': '"',
|
4463 | "'": '''
|
4464 | };
|
4465 |
|
4466 |
|
4467 |
|
4468 |
|
4469 |
|
4470 |
|
4471 | function utf8_encode(s) {
|
4472 | var stringFromCharCode = String.fromCharCode;
|
4473 | function ucs2decode(string) {
|
4474 | var output = [];
|
4475 | if (!string) {
|
4476 | return [];
|
4477 | }
|
4478 | var len = string.length;
|
4479 | var counter = 0;
|
4480 | var value;
|
4481 | var extra;
|
4482 | while (counter < len) {
|
4483 | value = string.charCodeAt(counter++);
|
4484 | if (value >= 0xD800 && value <= 0xDBFF && counter < len) {
|
4485 |
|
4486 | extra = string.charCodeAt(counter++);
|
4487 | if ((extra & 0xFC00) == 0xDC00) {
|
4488 | output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
4489 | }
|
4490 | else {
|
4491 |
|
4492 |
|
4493 | output.push(value);
|
4494 | counter--;
|
4495 | }
|
4496 | }
|
4497 | else {
|
4498 | output.push(value);
|
4499 | }
|
4500 | }
|
4501 | return output;
|
4502 | }
|
4503 | function checkScalarValue(point) {
|
4504 | if (point >= 0xD800 && point <= 0xDFFF) {
|
4505 | throw Error('Lone surrogate U+' + point.toString(16).toUpperCase() +
|
4506 | ' is not a scalar value');
|
4507 | }
|
4508 | }
|
4509 | function createByte(point, shift) {
|
4510 | return stringFromCharCode(((point >> shift) & 0x3F) | 0x80);
|
4511 | }
|
4512 | function encodeCodePoint(point) {
|
4513 | if ((point >= 0 && point <= 31 && point !== 10)) {
|
4514 | var convertedCode = point.toString(16).toUpperCase();
|
4515 | var paddedCode = convertedCode.padStart(4, '0');
|
4516 | return "_x" + paddedCode + "_";
|
4517 | }
|
4518 | if ((point & 0xFFFFFF80) == 0) {
|
4519 | return stringFromCharCode(point);
|
4520 | }
|
4521 | var symbol = '';
|
4522 | if ((point & 0xFFFFF800) == 0) {
|
4523 | symbol = stringFromCharCode(((point >> 6) & 0x1F) | 0xC0);
|
4524 | }
|
4525 | else if ((point & 0xFFFF0000) == 0) {
|
4526 | checkScalarValue(point);
|
4527 | symbol = stringFromCharCode(((point >> 12) & 0x0F) | 0xE0);
|
4528 | symbol += createByte(point, 6);
|
4529 | }
|
4530 | else if ((point & 0xFFE00000) == 0) {
|
4531 | symbol = stringFromCharCode(((point >> 18) & 0x07) | 0xF0);
|
4532 | symbol += createByte(point, 12);
|
4533 | symbol += createByte(point, 6);
|
4534 | }
|
4535 | symbol += stringFromCharCode((point & 0x3F) | 0x80);
|
4536 | return symbol;
|
4537 | }
|
4538 | var codePoints = ucs2decode(s);
|
4539 | var length = codePoints.length;
|
4540 | var index = -1;
|
4541 | var codePoint;
|
4542 | var byteString = '';
|
4543 | while (++index < length) {
|
4544 | codePoint = codePoints[index];
|
4545 | byteString += encodeCodePoint(codePoint);
|
4546 | }
|
4547 | return byteString;
|
4548 | }
|
4549 | function capitalise(str) {
|
4550 | return str[0].toUpperCase() + str.substr(1).toLowerCase();
|
4551 | }
|
4552 | function escapeString(toEscape, skipEscapingHtmlChars) {
|
4553 | if (toEscape == null) {
|
4554 | return null;
|
4555 | }
|
4556 |
|
4557 |
|
4558 |
|
4559 | var stringResult = toEscape.toString().toString();
|
4560 | if (skipEscapingHtmlChars) {
|
4561 | return stringResult;
|
4562 | }
|
4563 |
|
4564 | return stringResult.replace(reUnescapedHtml, function (chr) { return HTML_ESCAPES[chr]; });
|
4565 | }
|
4566 |
|
4567 |
|
4568 |
|
4569 |
|
4570 |
|
4571 | function camelCaseToHumanText(camelCase) {
|
4572 | if (!camelCase || camelCase == null) {
|
4573 | return null;
|
4574 | }
|
4575 |
|
4576 | var rex = /([a-z])([A-Z])/g;
|
4577 |
|
4578 | var rexCaps = /([A-Z]+)([A-Z])([a-z])/g;
|
4579 | var words = camelCase
|
4580 | .replace(rex, '$1 $2')
|
4581 | .replace(rexCaps, '$1 $2$3')
|
4582 | .replace(/\./g, ' ')
|
4583 | .split(' ');
|
4584 | return words.map(function (word) { return word.substring(0, 1).toUpperCase() + ((word.length > 1) ? word.substring(1, word.length) : ''); }).join(' ');
|
4585 | }
|
4586 |
|
4587 | var StringUtils = Object.freeze({
|
4588 | __proto__: null,
|
4589 | utf8_encode: utf8_encode,
|
4590 | capitalise: capitalise,
|
4591 | escapeString: escapeString,
|
4592 | camelCaseToHumanText: camelCaseToHumanText
|
4593 | });
|
4594 |
|
4595 |
|
4596 |
|
4597 |
|
4598 |
|
4599 |
|
4600 |
|
4601 | function convertToMap(arr) {
|
4602 | var map = new Map();
|
4603 | arr.forEach(function (pair) { return map.set(pair[0], pair[1]); });
|
4604 | return map;
|
4605 | }
|
4606 |
|
4607 | function mapById(arr, callback) {
|
4608 | var map = new Map();
|
4609 | arr.forEach(function (item) { return map.set(callback(item), item); });
|
4610 | return map;
|
4611 | }
|
4612 | function keys(map) {
|
4613 | var arr = [];
|
4614 | map.forEach(function (_, key) { return arr.push(key); });
|
4615 | return arr;
|
4616 | }
|
4617 |
|
4618 | var MapUtils = Object.freeze({
|
4619 | __proto__: null,
|
4620 | convertToMap: convertToMap,
|
4621 | mapById: mapById,
|
4622 | keys: keys
|
4623 | });
|
4624 |
|
4625 |
|
4626 |
|
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 | var __extends$2Q = (undefined && undefined.__extends) || (function () {
|
4632 | var extendStatics = function (d, b) {
|
4633 | extendStatics = Object.setPrototypeOf ||
|
4634 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
4635 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
4636 | return extendStatics(d, b);
|
4637 | };
|
4638 | return function (d, b) {
|
4639 | extendStatics(d, b);
|
4640 | function __() { this.constructor = d; }
|
4641 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
4642 | };
|
4643 | })();
|
4644 | var __decorate$2r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
4645 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4646 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4647 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
4648 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
4649 | };
|
4650 | var __param$8 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
4651 | return function (target, key) { decorator(target, key, paramIndex); }
|
4652 | };
|
4653 | var __rest = (undefined && undefined.__rest) || function (s, e) {
|
4654 | var t = {};
|
4655 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4656 | t[p] = s[p];
|
4657 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
4658 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
4659 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
4660 | t[p[i]] = s[p[i]];
|
4661 | }
|
4662 | return t;
|
4663 | };
|
4664 | var __values$6 = (undefined && undefined.__values) || function(o) {
|
4665 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
4666 | if (m) return m.call(o);
|
4667 | if (o && typeof o.length === "number") return {
|
4668 | next: function () {
|
4669 | if (o && i >= o.length) o = void 0;
|
4670 | return { value: o && o[i++], done: !o };
|
4671 | }
|
4672 | };
|
4673 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
4674 | };
|
4675 | var __read$q = (undefined && undefined.__read) || function (o, n) {
|
4676 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
4677 | if (!m) return o;
|
4678 | var i = m.call(o), r, ar = [], e;
|
4679 | try {
|
4680 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
4681 | }
|
4682 | catch (error) { e = { error: error }; }
|
4683 | finally {
|
4684 | try {
|
4685 | if (r && !r.done && (m = i["return"])) m.call(i);
|
4686 | }
|
4687 | finally { if (e) throw e.error; }
|
4688 | }
|
4689 | return ar;
|
4690 | };
|
4691 | var __spread$k = (undefined && undefined.__spread) || function () {
|
4692 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$q(arguments[i]));
|
4693 | return ar;
|
4694 | };
|
4695 | var ColumnModel = (function (_super) {
|
4696 | __extends$2Q(ColumnModel, _super);
|
4697 | function ColumnModel() {
|
4698 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
4699 |
|
4700 | _this.primaryHeaderRowCount = 0;
|
4701 | _this.secondaryHeaderRowCount = 0;
|
4702 |
|
4703 | _this.gridHeaderRowCount = 0;
|
4704 |
|
4705 | _this.displayedColumnsLeft = [];
|
4706 | _this.displayedColumnsRight = [];
|
4707 | _this.displayedColumnsCenter = [];
|
4708 |
|
4709 | _this.displayedColumns = [];
|
4710 |
|
4711 | _this.displayedColumnsAndGroupsMap = {};
|
4712 |
|
4713 | _this.viewportColumns = [];
|
4714 |
|
4715 | _this.viewportColumnsHash = '';
|
4716 |
|
4717 | _this.headerViewportColumns = [];
|
4718 |
|
4719 | _this.viewportColumnsCenter = [];
|
4720 |
|
4721 | _this.headerViewportColumnsCenter = [];
|
4722 | _this.autoHeightActiveAtLeastOnce = false;
|
4723 | _this.rowGroupColumns = [];
|
4724 | _this.valueColumns = [];
|
4725 | _this.pivotColumns = [];
|
4726 | _this.ready = false;
|
4727 | _this.autoGroupsNeedBuilding = false;
|
4728 | _this.forceRecreateAutoGroups = false;
|
4729 | _this.pivotMode = false;
|
4730 | _this.bodyWidth = 0;
|
4731 | _this.leftWidth = 0;
|
4732 | _this.rightWidth = 0;
|
4733 | _this.bodyWidthDirty = true;
|
4734 | _this.flexColsCalculatedAtLestOnce = false;
|
4735 | return _this;
|
4736 | }
|
4737 | ColumnModel.prototype.init = function () {
|
4738 | var _this = this;
|
4739 | this.suppressColumnVirtualisation = this.gridOptionsService.is('suppressColumnVirtualisation');
|
4740 | var pivotMode = this.gridOptionsService.is('pivotMode');
|
4741 | if (this.isPivotSettingAllowed(pivotMode)) {
|
4742 | this.pivotMode = pivotMode;
|
4743 | }
|
4744 | this.usingTreeData = this.gridOptionsService.isTreeData();
|
4745 | this.addManagedPropertyListener('groupDisplayType', function () { return _this.onAutoGroupColumnDefChanged(); });
|
4746 | this.addManagedPropertyListener('autoGroupColumnDef', function () { return _this.onAutoGroupColumnDefChanged(); });
|
4747 | this.addManagedPropertyListener('defaultColDef', function (params) { return _this.onSharedColDefChanged(params.source); });
|
4748 | this.addManagedPropertyListener('columnTypes', function (params) { return _this.onSharedColDefChanged(params.source); });
|
4749 | };
|
4750 | ColumnModel.prototype.onAutoGroupColumnDefChanged = function () {
|
4751 | this.autoGroupsNeedBuilding = true;
|
4752 | this.forceRecreateAutoGroups = true;
|
4753 | this.updateGridColumns();
|
4754 | this.updateDisplayedColumns('gridOptionsChanged');
|
4755 | };
|
4756 | ColumnModel.prototype.onSharedColDefChanged = function (source) {
|
4757 | if (source === void 0) { source = 'api'; }
|
4758 |
|
4759 | this.forceRecreateAutoGroups = true;
|
4760 | this.createColumnsFromColumnDefs(true, source);
|
4761 | };
|
4762 | ColumnModel.prototype.setColumnDefs = function (columnDefs, source) {
|
4763 | if (source === void 0) { source = 'api'; }
|
4764 | var colsPreviouslyExisted = !!this.columnDefs;
|
4765 | this.columnDefs = columnDefs;
|
4766 | this.createColumnsFromColumnDefs(colsPreviouslyExisted, source);
|
4767 | };
|
4768 | ColumnModel.prototype.destroyOldColumns = function (oldTree, newTree) {
|
4769 | var oldObjectsById = {};
|
4770 | if (!oldTree) {
|
4771 | return;
|
4772 | }
|
4773 |
|
4774 | this.columnUtils.depthFirstOriginalTreeSearch(null, oldTree, function (child) {
|
4775 | oldObjectsById[child.getInstanceId()] = child;
|
4776 | });
|
4777 |
|
4778 | if (newTree) {
|
4779 | this.columnUtils.depthFirstOriginalTreeSearch(null, newTree, function (child) {
|
4780 | oldObjectsById[child.getInstanceId()] = null;
|
4781 | });
|
4782 | }
|
4783 |
|
4784 | var colsToDestroy = Object.values(oldObjectsById).filter(function (item) { return item != null; });
|
4785 | this.destroyBeans(colsToDestroy);
|
4786 | };
|
4787 | ColumnModel.prototype.destroyColumns = function () {
|
4788 | this.destroyOldColumns(this.primaryColumnTree);
|
4789 | this.destroyOldColumns(this.secondaryBalancedTree);
|
4790 | this.destroyOldColumns(this.groupAutoColsBalancedTree);
|
4791 | };
|
4792 | ColumnModel.prototype.createColumnsFromColumnDefs = function (colsPreviouslyExisted, source) {
|
4793 | var _this = this;
|
4794 | if (source === void 0) { source = 'api'; }
|
4795 |
|
4796 | var dispatchEventsFunc = colsPreviouslyExisted ? this.compareColumnStatesAndDispatchEvents(source) : undefined;
|
4797 |
|
4798 |
|
4799 | this.valueCache.expire();
|
4800 |
|
4801 |
|
4802 |
|
4803 | this.autoGroupsNeedBuilding = true;
|
4804 | var oldPrimaryColumns = this.primaryColumns;
|
4805 | var oldPrimaryTree = this.primaryColumnTree;
|
4806 | var balancedTreeResult = this.columnFactory.createColumnTree(this.columnDefs, true, oldPrimaryTree);
|
4807 | this.destroyOldColumns(this.primaryColumnTree, balancedTreeResult.columnTree);
|
4808 | this.primaryColumnTree = balancedTreeResult.columnTree;
|
4809 | this.primaryHeaderRowCount = balancedTreeResult.treeDept + 1;
|
4810 | this.primaryColumns = this.getColumnsFromTree(this.primaryColumnTree);
|
4811 | this.primaryColumnsMap = {};
|
4812 | this.primaryColumns.forEach(function (col) { return _this.primaryColumnsMap[col.getId()] = col; });
|
4813 | this.extractRowGroupColumns(source, oldPrimaryColumns);
|
4814 | this.extractPivotColumns(source, oldPrimaryColumns);
|
4815 | this.extractValueColumns(source, oldPrimaryColumns);
|
4816 | this.ready = true;
|
4817 |
|
4818 |
|
4819 |
|
4820 |
|
4821 | var gridColsNotProcessed = this.gridColsArePrimary === undefined;
|
4822 | var processGridCols = this.gridColsArePrimary || gridColsNotProcessed;
|
4823 | if (processGridCols) {
|
4824 | this.updateGridColumns();
|
4825 | if (colsPreviouslyExisted && !this.gridOptionsService.is('maintainColumnOrder')) {
|
4826 | this.orderGridColumnsLikePrimary();
|
4827 | }
|
4828 | this.updateDisplayedColumns(source);
|
4829 | this.checkViewportColumns();
|
4830 | }
|
4831 |
|
4832 |
|
4833 | this.dispatchEverythingChanged(source);
|
4834 | if (dispatchEventsFunc) {
|
4835 | dispatchEventsFunc();
|
4836 | }
|
4837 | this.dispatchNewColumnsLoaded();
|
4838 | };
|
4839 | ColumnModel.prototype.dispatchNewColumnsLoaded = function () {
|
4840 | var newColumnsLoadedEvent = {
|
4841 | type: Events.EVENT_NEW_COLUMNS_LOADED
|
4842 | };
|
4843 | this.eventService.dispatchEvent(newColumnsLoadedEvent);
|
4844 | };
|
4845 |
|
4846 | ColumnModel.prototype.dispatchEverythingChanged = function (source) {
|
4847 | if (source === void 0) { source = 'api'; }
|
4848 | var eventEverythingChanged = {
|
4849 | type: Events.EVENT_COLUMN_EVERYTHING_CHANGED,
|
4850 | source: source
|
4851 | };
|
4852 | this.eventService.dispatchEvent(eventEverythingChanged);
|
4853 | };
|
4854 | ColumnModel.prototype.orderGridColumnsLikePrimary = function () {
|
4855 | var _this = this;
|
4856 | var primaryColumns = this.primaryColumns;
|
4857 | if (!primaryColumns) {
|
4858 | return;
|
4859 | }
|
4860 | this.gridColumns.sort(function (colA, colB) {
|
4861 | var primaryIndexA = primaryColumns.indexOf(colA);
|
4862 | var primaryIndexB = primaryColumns.indexOf(colB);
|
4863 |
|
4864 |
|
4865 | var indexAPresent = primaryIndexA >= 0;
|
4866 | var indexBPresent = primaryIndexB >= 0;
|
4867 | if (indexAPresent && indexBPresent) {
|
4868 | return primaryIndexA - primaryIndexB;
|
4869 | }
|
4870 | if (indexAPresent) {
|
4871 |
|
4872 | return 1;
|
4873 | }
|
4874 | if (indexBPresent) {
|
4875 |
|
4876 | return -1;
|
4877 | }
|
4878 |
|
4879 |
|
4880 | var gridIndexA = _this.gridColumns.indexOf(colA);
|
4881 | var gridIndexB = _this.gridColumns.indexOf(colB);
|
4882 | return gridIndexA - gridIndexB;
|
4883 | });
|
4884 | this.gridColumns = this.placeLockedColumns(this.gridColumns);
|
4885 | };
|
4886 | ColumnModel.prototype.getAllDisplayedAutoHeightCols = function () {
|
4887 | return this.displayedAutoHeightCols;
|
4888 | };
|
4889 | ColumnModel.prototype.setViewport = function () {
|
4890 | if (this.gridOptionsService.is('enableRtl')) {
|
4891 | this.viewportLeft = this.bodyWidth - this.scrollPosition - this.scrollWidth;
|
4892 | this.viewportRight = this.bodyWidth - this.scrollPosition;
|
4893 | }
|
4894 | else {
|
4895 | this.viewportLeft = this.scrollPosition;
|
4896 | this.viewportRight = this.scrollWidth + this.scrollPosition;
|
4897 | }
|
4898 | };
|
4899 |
|
4900 | ColumnModel.prototype.getDisplayedColumnsStartingAt = function (column) {
|
4901 | var currentColumn = column;
|
4902 | var columns = [];
|
4903 | while (currentColumn != null) {
|
4904 | columns.push(currentColumn);
|
4905 | currentColumn = this.getDisplayedColAfter(currentColumn);
|
4906 | }
|
4907 | return columns;
|
4908 | };
|
4909 |
|
4910 |
|
4911 |
|
4912 | ColumnModel.prototype.checkViewportColumns = function () {
|
4913 |
|
4914 | if (this.displayedColumnsCenter == null) {
|
4915 | return;
|
4916 | }
|
4917 | var viewportColumnsChanged = this.extractViewport();
|
4918 | if (!viewportColumnsChanged) {
|
4919 | return;
|
4920 | }
|
4921 | var event = {
|
4922 | type: Events.EVENT_VIRTUAL_COLUMNS_CHANGED
|
4923 | };
|
4924 | this.eventService.dispatchEvent(event);
|
4925 | };
|
4926 | ColumnModel.prototype.setViewportPosition = function (scrollWidth, scrollPosition) {
|
4927 | if (scrollWidth !== this.scrollWidth || scrollPosition !== this.scrollPosition || this.bodyWidthDirty) {
|
4928 | this.scrollWidth = scrollWidth;
|
4929 | this.scrollPosition = scrollPosition;
|
4930 |
|
4931 |
|
4932 |
|
4933 | this.bodyWidthDirty = true;
|
4934 | this.setViewport();
|
4935 | if (this.ready) {
|
4936 | this.checkViewportColumns();
|
4937 | }
|
4938 | }
|
4939 | };
|
4940 | ColumnModel.prototype.isPivotMode = function () {
|
4941 | return this.pivotMode;
|
4942 | };
|
4943 | ColumnModel.prototype.isPivotSettingAllowed = function (pivot) {
|
4944 | if (pivot && this.gridOptionsService.isTreeData()) {
|
4945 | console.warn("AG Grid: Pivot mode not available in conjunction Tree Data i.e. 'gridOptions.treeData: true'");
|
4946 | return false;
|
4947 | }
|
4948 | return true;
|
4949 | };
|
4950 | ColumnModel.prototype.setPivotMode = function (pivotMode, source) {
|
4951 | if (source === void 0) { source = 'api'; }
|
4952 | if (pivotMode === this.pivotMode || !this.isPivotSettingAllowed(this.pivotMode)) {
|
4953 | return;
|
4954 | }
|
4955 | this.pivotMode = pivotMode;
|
4956 |
|
4957 |
|
4958 |
|
4959 | this.autoGroupsNeedBuilding = true;
|
4960 | this.updateGridColumns();
|
4961 | this.updateDisplayedColumns(source);
|
4962 | var event = {
|
4963 | type: Events.EVENT_COLUMN_PIVOT_MODE_CHANGED
|
4964 | };
|
4965 | this.eventService.dispatchEvent(event);
|
4966 | };
|
4967 | ColumnModel.prototype.getSecondaryPivotColumn = function (pivotKeys, valueColKey) {
|
4968 | if (missing(this.secondaryColumns)) {
|
4969 | return null;
|
4970 | }
|
4971 | var valueColumnToFind = this.getPrimaryColumn(valueColKey);
|
4972 | var foundColumn = null;
|
4973 | this.secondaryColumns.forEach(function (column) {
|
4974 | var thisPivotKeys = column.getColDef().pivotKeys;
|
4975 | var pivotValueColumn = column.getColDef().pivotValueColumn;
|
4976 | var pivotKeyMatches = areEqual(thisPivotKeys, pivotKeys);
|
4977 | var pivotValueMatches = pivotValueColumn === valueColumnToFind;
|
4978 | if (pivotKeyMatches && pivotValueMatches) {
|
4979 | foundColumn = column;
|
4980 | }
|
4981 | });
|
4982 | return foundColumn;
|
4983 | };
|
4984 | ColumnModel.prototype.setBeans = function (loggerFactory) {
|
4985 | this.logger = loggerFactory.create('columnModel');
|
4986 | };
|
4987 | ColumnModel.prototype.setFirstRightAndLastLeftPinned = function (source) {
|
4988 | var lastLeft;
|
4989 | var firstRight;
|
4990 | if (this.gridOptionsService.is('enableRtl')) {
|
4991 | lastLeft = this.displayedColumnsLeft ? this.displayedColumnsLeft[0] : null;
|
4992 | firstRight = this.displayedColumnsRight ? last(this.displayedColumnsRight) : null;
|
4993 | }
|
4994 | else {
|
4995 | lastLeft = this.displayedColumnsLeft ? last(this.displayedColumnsLeft) : null;
|
4996 | firstRight = this.displayedColumnsRight ? this.displayedColumnsRight[0] : null;
|
4997 | }
|
4998 | this.gridColumns.forEach(function (column) {
|
4999 | column.setLastLeftPinned(column === lastLeft, source);
|
5000 | column.setFirstRightPinned(column === firstRight, source);
|
5001 | });
|
5002 | };
|
5003 | ColumnModel.prototype.autoSizeColumns = function (params) {
|
5004 | var _this = this;
|
5005 | var columns = params.columns, skipHeader = params.skipHeader, skipHeaderGroups = params.skipHeaderGroups, stopAtGroup = params.stopAtGroup, _a = params.source, source = _a === void 0 ? 'api' : _a;
|
5006 |
|
5007 |
|
5008 |
|
5009 |
|
5010 |
|
5011 |
|
5012 |
|
5013 |
|
5014 |
|
5015 |
|
5016 | this.animationFrameService.flushAllFrames();
|
5017 |
|
5018 | var columnsAutosized = [];
|
5019 |
|
5020 | var changesThisTimeAround = -1;
|
5021 | var shouldSkipHeader = skipHeader != null ? skipHeader : this.gridOptionsService.is('skipHeaderOnAutoSize');
|
5022 | var shouldSkipHeaderGroups = skipHeaderGroups != null ? skipHeaderGroups : shouldSkipHeader;
|
5023 | while (changesThisTimeAround !== 0) {
|
5024 | changesThisTimeAround = 0;
|
5025 | this.actionOnGridColumns(columns, function (column) {
|
5026 |
|
5027 | if (columnsAutosized.indexOf(column) >= 0) {
|
5028 | return false;
|
5029 | }
|
5030 |
|
5031 | var preferredWidth = _this.autoWidthCalculator.getPreferredWidthForColumn(column, shouldSkipHeader);
|
5032 |
|
5033 | if (preferredWidth > 0) {
|
5034 | var newWidth = _this.normaliseColumnWidth(column, preferredWidth);
|
5035 | column.setActualWidth(newWidth, source);
|
5036 | columnsAutosized.push(column);
|
5037 | changesThisTimeAround++;
|
5038 | }
|
5039 | return true;
|
5040 | }, source);
|
5041 | }
|
5042 | if (!shouldSkipHeaderGroups) {
|
5043 | this.autoSizeColumnGroupsByColumns(columns, stopAtGroup);
|
5044 | }
|
5045 | this.dispatchColumnResizedEvent(columnsAutosized, true, 'autosizeColumns');
|
5046 | };
|
5047 | ColumnModel.prototype.dispatchColumnResizedEvent = function (columns, finished, source, flexColumns) {
|
5048 | if (flexColumns === void 0) { flexColumns = null; }
|
5049 | if (columns && columns.length) {
|
5050 | var event_1 = {
|
5051 | type: Events.EVENT_COLUMN_RESIZED,
|
5052 | columns: columns,
|
5053 | column: columns.length === 1 ? columns[0] : null,
|
5054 | flexColumns: flexColumns,
|
5055 | finished: finished,
|
5056 | source: source
|
5057 | };
|
5058 | this.eventService.dispatchEvent(event_1);
|
5059 | }
|
5060 | };
|
5061 | ColumnModel.prototype.dispatchColumnChangedEvent = function (type, columns, source) {
|
5062 | var event = {
|
5063 | type: type,
|
5064 | columns: columns,
|
5065 | column: (columns && columns.length == 1) ? columns[0] : null,
|
5066 | source: source
|
5067 | };
|
5068 | this.eventService.dispatchEvent(event);
|
5069 | };
|
5070 | ColumnModel.prototype.dispatchColumnMovedEvent = function (params) {
|
5071 | var movedColumns = params.movedColumns, source = params.source, toIndex = params.toIndex, finished = params.finished;
|
5072 | var event = {
|
5073 | type: Events.EVENT_COLUMN_MOVED,
|
5074 | columns: movedColumns,
|
5075 | column: movedColumns && movedColumns.length === 1 ? movedColumns[0] : null,
|
5076 | toIndex: toIndex,
|
5077 | finished: finished,
|
5078 | source: source
|
5079 | };
|
5080 | this.eventService.dispatchEvent(event);
|
5081 | };
|
5082 | ColumnModel.prototype.dispatchColumnPinnedEvent = function (changedColumns, source) {
|
5083 | if (!changedColumns.length) {
|
5084 | return;
|
5085 | }
|
5086 |
|
5087 | var column = changedColumns.length === 1 ? changedColumns[0] : null;
|
5088 |
|
5089 | var pinned = this.getCommonValue(changedColumns, function (col) { return col.getPinned(); });
|
5090 | var event = {
|
5091 | type: Events.EVENT_COLUMN_PINNED,
|
5092 |
|
5093 | pinned: pinned != null ? pinned : null,
|
5094 | columns: changedColumns,
|
5095 | column: column,
|
5096 | source: source
|
5097 | };
|
5098 | this.eventService.dispatchEvent(event);
|
5099 | };
|
5100 | ColumnModel.prototype.dispatchColumnVisibleEvent = function (changedColumns, source) {
|
5101 | if (!changedColumns.length) {
|
5102 | return;
|
5103 | }
|
5104 |
|
5105 | var column = changedColumns.length === 1 ? changedColumns[0] : null;
|
5106 |
|
5107 | var visible = this.getCommonValue(changedColumns, function (col) { return col.isVisible(); });
|
5108 | var event = {
|
5109 | type: Events.EVENT_COLUMN_VISIBLE,
|
5110 | visible: visible,
|
5111 | columns: changedColumns,
|
5112 | column: column,
|
5113 | source: source
|
5114 | };
|
5115 | this.eventService.dispatchEvent(event);
|
5116 | };
|
5117 | ColumnModel.prototype.autoSizeColumn = function (key, skipHeader, source) {
|
5118 | if (source === void 0) { source = "api"; }
|
5119 | if (key) {
|
5120 | this.autoSizeColumns({ columns: [key], skipHeader: skipHeader, skipHeaderGroups: true, source: source });
|
5121 | }
|
5122 | };
|
5123 | ColumnModel.prototype.autoSizeColumnGroupsByColumns = function (keys, stopAtGroup) {
|
5124 | var e_1, _a, e_2, _b;
|
5125 | var columnGroups = new Set();
|
5126 | var columns = this.getGridColumns(keys);
|
5127 | columns.forEach(function (col) {
|
5128 | var parent = col.getParent();
|
5129 | while (parent && parent != stopAtGroup) {
|
5130 | if (!parent.isPadding()) {
|
5131 | columnGroups.add(parent);
|
5132 | }
|
5133 | parent = parent.getParent();
|
5134 | }
|
5135 | });
|
5136 | var headerGroupCtrl;
|
5137 | var resizedColumns = [];
|
5138 | try {
|
5139 | for (var columnGroups_1 = __values$6(columnGroups), columnGroups_1_1 = columnGroups_1.next(); !columnGroups_1_1.done; columnGroups_1_1 = columnGroups_1.next()) {
|
5140 | var columnGroup = columnGroups_1_1.value;
|
5141 | try {
|
5142 | for (var _c = (e_2 = void 0, __values$6(this.ctrlsService.getHeaderRowContainerCtrls())), _d = _c.next(); !_d.done; _d = _c.next()) {
|
5143 | var headerContainerCtrl = _d.value;
|
5144 | headerGroupCtrl = headerContainerCtrl.getHeaderCtrlForColumn(columnGroup);
|
5145 | if (headerGroupCtrl) {
|
5146 | break;
|
5147 | }
|
5148 | }
|
5149 | }
|
5150 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
5151 | finally {
|
5152 | try {
|
5153 | if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
5154 | }
|
5155 | finally { if (e_2) throw e_2.error; }
|
5156 | }
|
5157 | if (headerGroupCtrl) {
|
5158 | headerGroupCtrl.resizeLeafColumnsToFit();
|
5159 | }
|
5160 | }
|
5161 | }
|
5162 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
5163 | finally {
|
5164 | try {
|
5165 | if (columnGroups_1_1 && !columnGroups_1_1.done && (_a = columnGroups_1.return)) _a.call(columnGroups_1);
|
5166 | }
|
5167 | finally { if (e_1) throw e_1.error; }
|
5168 | }
|
5169 | return resizedColumns;
|
5170 | };
|
5171 | ColumnModel.prototype.autoSizeAllColumns = function (skipHeader, source) {
|
5172 | if (source === void 0) { source = "api"; }
|
5173 | var allDisplayedColumns = this.getAllDisplayedColumns();
|
5174 | this.autoSizeColumns({ columns: allDisplayedColumns, skipHeader: skipHeader, source: source });
|
5175 | };
|
5176 |
|
5177 | ColumnModel.prototype.getColumnsFromTree = function (rootColumns) {
|
5178 | var result = [];
|
5179 | var recursiveFindColumns = function (childColumns) {
|
5180 | for (var i = 0; i < childColumns.length; i++) {
|
5181 | var child = childColumns[i];
|
5182 | if (child instanceof Column) {
|
5183 | result.push(child);
|
5184 | }
|
5185 | else if (child instanceof ProvidedColumnGroup) {
|
5186 | recursiveFindColumns(child.getChildren());
|
5187 | }
|
5188 | }
|
5189 | };
|
5190 | recursiveFindColumns(rootColumns);
|
5191 | return result;
|
5192 | };
|
5193 | ColumnModel.prototype.getAllDisplayedTrees = function () {
|
5194 | if (this.displayedTreeLeft && this.displayedTreeRight && this.displayedTreeCentre) {
|
5195 | return this.displayedTreeLeft
|
5196 | .concat(this.displayedTreeCentre)
|
5197 | .concat(this.displayedTreeRight);
|
5198 | }
|
5199 | return null;
|
5200 | };
|
5201 |
|
5202 | ColumnModel.prototype.getPrimaryColumnTree = function () {
|
5203 | return this.primaryColumnTree;
|
5204 | };
|
5205 |
|
5206 | ColumnModel.prototype.getHeaderRowCount = function () {
|
5207 | return this.gridHeaderRowCount;
|
5208 | };
|
5209 |
|
5210 | ColumnModel.prototype.getDisplayedTreeLeft = function () {
|
5211 | return this.displayedTreeLeft;
|
5212 | };
|
5213 |
|
5214 | ColumnModel.prototype.getDisplayedTreeRight = function () {
|
5215 | return this.displayedTreeRight;
|
5216 | };
|
5217 |
|
5218 | ColumnModel.prototype.getDisplayedTreeCentre = function () {
|
5219 | return this.displayedTreeCentre;
|
5220 | };
|
5221 |
|
5222 | ColumnModel.prototype.isColumnDisplayed = function (column) {
|
5223 | return this.getAllDisplayedColumns().indexOf(column) >= 0;
|
5224 | };
|
5225 |
|
5226 | ColumnModel.prototype.getAllDisplayedColumns = function () {
|
5227 | return this.displayedColumns;
|
5228 | };
|
5229 | ColumnModel.prototype.getViewportColumns = function () {
|
5230 | return this.viewportColumns;
|
5231 | };
|
5232 | ColumnModel.prototype.getDisplayedLeftColumnsForRow = function (rowNode) {
|
5233 | if (!this.colSpanActive) {
|
5234 | return this.displayedColumnsLeft;
|
5235 | }
|
5236 | return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsLeft);
|
5237 | };
|
5238 | ColumnModel.prototype.getDisplayedRightColumnsForRow = function (rowNode) {
|
5239 | if (!this.colSpanActive) {
|
5240 | return this.displayedColumnsRight;
|
5241 | }
|
5242 | return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsRight);
|
5243 | };
|
5244 | ColumnModel.prototype.getDisplayedColumnsForRow = function (rowNode, displayedColumns, filterCallback, emptySpaceBeforeColumn) {
|
5245 | var result = [];
|
5246 | var lastConsideredCol = null;
|
5247 | var _loop_1 = function (i) {
|
5248 | var col = displayedColumns[i];
|
5249 | var maxAllowedColSpan = displayedColumns.length - i;
|
5250 | var colSpan = Math.min(col.getColSpan(rowNode), maxAllowedColSpan);
|
5251 | var columnsToCheckFilter = [col];
|
5252 | if (colSpan > 1) {
|
5253 | var colsToRemove = colSpan - 1;
|
5254 | for (var j = 1; j <= colsToRemove; j++) {
|
5255 | columnsToCheckFilter.push(displayedColumns[i + j]);
|
5256 | }
|
5257 | i += colsToRemove;
|
5258 | }
|
5259 |
|
5260 | var filterPasses;
|
5261 | if (filterCallback) {
|
5262 |
|
5263 |
|
5264 |
|
5265 |
|
5266 |
|
5267 | filterPasses = false;
|
5268 | columnsToCheckFilter.forEach(function (colForFilter) {
|
5269 | if (filterCallback(colForFilter)) {
|
5270 | filterPasses = true;
|
5271 | }
|
5272 | });
|
5273 | }
|
5274 | else {
|
5275 | filterPasses = true;
|
5276 | }
|
5277 | if (filterPasses) {
|
5278 | if (result.length === 0 && lastConsideredCol) {
|
5279 | var gapBeforeColumn = emptySpaceBeforeColumn ? emptySpaceBeforeColumn(col) : false;
|
5280 | if (gapBeforeColumn) {
|
5281 | result.push(lastConsideredCol);
|
5282 | }
|
5283 | }
|
5284 | result.push(col);
|
5285 | }
|
5286 | lastConsideredCol = col;
|
5287 | out_i_1 = i;
|
5288 | };
|
5289 | var out_i_1;
|
5290 | for (var i = 0; i < displayedColumns.length; i++) {
|
5291 | _loop_1(i);
|
5292 | i = out_i_1;
|
5293 | }
|
5294 | return result;
|
5295 | };
|
5296 |
|
5297 |
|
5298 |
|
5299 |
|
5300 | ColumnModel.prototype.getViewportCenterColumnsForRow = function (rowNode) {
|
5301 | var _this = this;
|
5302 | if (!this.colSpanActive) {
|
5303 | return this.viewportColumnsCenter;
|
5304 | }
|
5305 | var emptySpaceBeforeColumn = function (col) {
|
5306 | var left = col.getLeft();
|
5307 | return exists(left) && left > _this.viewportLeft;
|
5308 | };
|
5309 |
|
5310 | var filterCallback = this.suppressColumnVirtualisation ? null : this.isColumnInRowViewport.bind(this);
|
5311 | return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsCenter, filterCallback, emptySpaceBeforeColumn);
|
5312 | };
|
5313 | ColumnModel.prototype.getAriaColumnIndex = function (col) {
|
5314 | return this.getAllGridColumns().indexOf(col) + 1;
|
5315 | };
|
5316 | ColumnModel.prototype.isColumnInHeaderViewport = function (col) {
|
5317 |
|
5318 | if (col.isAutoHeaderHeight()) {
|
5319 | return true;
|
5320 | }
|
5321 | return this.isColumnInRowViewport(col);
|
5322 | };
|
5323 | ColumnModel.prototype.isColumnInRowViewport = function (col) {
|
5324 |
|
5325 | if (col.isAutoHeight()) {
|
5326 | return true;
|
5327 | }
|
5328 | var columnLeft = col.getLeft() || 0;
|
5329 | var columnRight = columnLeft + col.getActualWidth();
|
5330 |
|
5331 |
|
5332 |
|
5333 |
|
5334 | var leftBounds = this.viewportLeft - 200;
|
5335 | var rightBounds = this.viewportRight + 200;
|
5336 | var columnToMuchLeft = columnLeft < leftBounds && columnRight < leftBounds;
|
5337 | var columnToMuchRight = columnLeft > rightBounds && columnRight > rightBounds;
|
5338 | return !columnToMuchLeft && !columnToMuchRight;
|
5339 | };
|
5340 |
|
5341 |
|
5342 |
|
5343 | ColumnModel.prototype.getDisplayedColumnsLeftWidth = function () {
|
5344 | return this.getWidthOfColsInList(this.displayedColumnsLeft);
|
5345 | };
|
5346 |
|
5347 | ColumnModel.prototype.getDisplayedColumnsRightWidth = function () {
|
5348 | return this.getWidthOfColsInList(this.displayedColumnsRight);
|
5349 | };
|
5350 | ColumnModel.prototype.updatePrimaryColumnList = function (keys, masterList, actionIsAdd, columnCallback, eventType, source) {
|
5351 | var _this = this;
|
5352 | if (source === void 0) { source = "api"; }
|
5353 | if (!keys || missingOrEmpty(keys)) {
|
5354 | return;
|
5355 | }
|
5356 | var atLeastOne = false;
|
5357 | keys.forEach(function (key) {
|
5358 | var columnToAdd = _this.getPrimaryColumn(key);
|
5359 | if (!columnToAdd) {
|
5360 | return;
|
5361 | }
|
5362 | if (actionIsAdd) {
|
5363 | if (masterList.indexOf(columnToAdd) >= 0) {
|
5364 | return;
|
5365 | }
|
5366 | masterList.push(columnToAdd);
|
5367 | }
|
5368 | else {
|
5369 | if (masterList.indexOf(columnToAdd) < 0) {
|
5370 | return;
|
5371 | }
|
5372 | removeFromArray(masterList, columnToAdd);
|
5373 | }
|
5374 | columnCallback(columnToAdd);
|
5375 | atLeastOne = true;
|
5376 | });
|
5377 | if (!atLeastOne) {
|
5378 | return;
|
5379 | }
|
5380 | if (this.autoGroupsNeedBuilding) {
|
5381 | this.updateGridColumns();
|
5382 | }
|
5383 | this.updateDisplayedColumns(source);
|
5384 | var event = {
|
5385 | type: eventType,
|
5386 | columns: masterList,
|
5387 | column: masterList.length === 1 ? masterList[0] : null,
|
5388 | source: source
|
5389 | };
|
5390 | this.eventService.dispatchEvent(event);
|
5391 | };
|
5392 | ColumnModel.prototype.setRowGroupColumns = function (colKeys, source) {
|
5393 | if (source === void 0) { source = "api"; }
|
5394 | this.autoGroupsNeedBuilding = true;
|
5395 | this.setPrimaryColumnList(colKeys, this.rowGroupColumns, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.setRowGroupActive.bind(this), source);
|
5396 | };
|
5397 | ColumnModel.prototype.setRowGroupActive = function (active, column, source) {
|
5398 | if (active === column.isRowGroupActive()) {
|
5399 | return;
|
5400 | }
|
5401 | column.setRowGroupActive(active, source);
|
5402 | if (active && !this.gridOptionsService.is('suppressRowGroupHidesColumns')) {
|
5403 | this.setColumnVisible(column, false, source);
|
5404 | }
|
5405 | if (!active && !this.gridOptionsService.is('suppressMakeColumnVisibleAfterUnGroup')) {
|
5406 | this.setColumnVisible(column, true, source);
|
5407 | }
|
5408 | };
|
5409 | ColumnModel.prototype.addRowGroupColumn = function (key, source) {
|
5410 | if (source === void 0) { source = "api"; }
|
5411 | if (key) {
|
5412 | this.addRowGroupColumns([key], source);
|
5413 | }
|
5414 | };
|
5415 | ColumnModel.prototype.addRowGroupColumns = function (keys, source) {
|
5416 | if (source === void 0) { source = "api"; }
|
5417 | this.autoGroupsNeedBuilding = true;
|
5418 | this.updatePrimaryColumnList(keys, this.rowGroupColumns, true, this.setRowGroupActive.bind(this, true), Events.EVENT_COLUMN_ROW_GROUP_CHANGED, source);
|
5419 | };
|
5420 | ColumnModel.prototype.removeRowGroupColumns = function (keys, source) {
|
5421 | if (source === void 0) { source = "api"; }
|
5422 | this.autoGroupsNeedBuilding = true;
|
5423 | this.updatePrimaryColumnList(keys, this.rowGroupColumns, false, this.setRowGroupActive.bind(this, false), Events.EVENT_COLUMN_ROW_GROUP_CHANGED, source);
|
5424 | };
|
5425 | ColumnModel.prototype.removeRowGroupColumn = function (key, source) {
|
5426 | if (source === void 0) { source = "api"; }
|
5427 | if (key) {
|
5428 | this.removeRowGroupColumns([key], source);
|
5429 | }
|
5430 | };
|
5431 | ColumnModel.prototype.addPivotColumns = function (keys, source) {
|
5432 | if (source === void 0) { source = "api"; }
|
5433 | this.updatePrimaryColumnList(keys, this.pivotColumns, true, function (column) { return column.setPivotActive(true, source); }, Events.EVENT_COLUMN_PIVOT_CHANGED, source);
|
5434 | };
|
5435 | ColumnModel.prototype.setPivotColumns = function (colKeys, source) {
|
5436 | if (source === void 0) { source = "api"; }
|
5437 | this.setPrimaryColumnList(colKeys, this.pivotColumns, Events.EVENT_COLUMN_PIVOT_CHANGED, function (added, column) {
|
5438 | column.setPivotActive(added, source);
|
5439 | }, source);
|
5440 | };
|
5441 | ColumnModel.prototype.addPivotColumn = function (key, source) {
|
5442 | if (source === void 0) { source = "api"; }
|
5443 | this.addPivotColumns([key], source);
|
5444 | };
|
5445 | ColumnModel.prototype.removePivotColumns = function (keys, source) {
|
5446 | if (source === void 0) { source = "api"; }
|
5447 | this.updatePrimaryColumnList(keys, this.pivotColumns, false, function (column) { return column.setPivotActive(false, source); }, Events.EVENT_COLUMN_PIVOT_CHANGED, source);
|
5448 | };
|
5449 | ColumnModel.prototype.removePivotColumn = function (key, source) {
|
5450 | if (source === void 0) { source = "api"; }
|
5451 | this.removePivotColumns([key], source);
|
5452 | };
|
5453 | ColumnModel.prototype.setPrimaryColumnList = function (colKeys, masterList, eventName, columnCallback, source) {
|
5454 | var _this = this;
|
5455 | masterList.length = 0;
|
5456 | if (exists(colKeys)) {
|
5457 | colKeys.forEach(function (key) {
|
5458 | var column = _this.getPrimaryColumn(key);
|
5459 | if (column) {
|
5460 | masterList.push(column);
|
5461 | }
|
5462 | });
|
5463 | }
|
5464 | (this.primaryColumns || []).forEach(function (column) {
|
5465 | var added = masterList.indexOf(column) >= 0;
|
5466 | columnCallback(added, column);
|
5467 | });
|
5468 | if (this.autoGroupsNeedBuilding) {
|
5469 | this.updateGridColumns();
|
5470 | }
|
5471 | this.updateDisplayedColumns(source);
|
5472 | this.dispatchColumnChangedEvent(eventName, masterList, source);
|
5473 | };
|
5474 | ColumnModel.prototype.setValueColumns = function (colKeys, source) {
|
5475 | if (source === void 0) { source = "api"; }
|
5476 | this.setPrimaryColumnList(colKeys, this.valueColumns, Events.EVENT_COLUMN_VALUE_CHANGED, this.setValueActive.bind(this), source);
|
5477 | };
|
5478 | ColumnModel.prototype.setValueActive = function (active, column, source) {
|
5479 | if (active === column.isValueActive()) {
|
5480 | return;
|
5481 | }
|
5482 | column.setValueActive(active, source);
|
5483 | if (active && !column.getAggFunc()) {
|
5484 | var initialAggFunc = this.aggFuncService.getDefaultAggFunc(column);
|
5485 | column.setAggFunc(initialAggFunc);
|
5486 | }
|
5487 | };
|
5488 | ColumnModel.prototype.addValueColumns = function (keys, source) {
|
5489 | if (source === void 0) { source = "api"; }
|
5490 | this.updatePrimaryColumnList(keys, this.valueColumns, true, this.setValueActive.bind(this, true), Events.EVENT_COLUMN_VALUE_CHANGED, source);
|
5491 | };
|
5492 | ColumnModel.prototype.addValueColumn = function (colKey, source) {
|
5493 | if (source === void 0) { source = "api"; }
|
5494 | if (colKey) {
|
5495 | this.addValueColumns([colKey], source);
|
5496 | }
|
5497 | };
|
5498 | ColumnModel.prototype.removeValueColumn = function (colKey, source) {
|
5499 | if (source === void 0) { source = "api"; }
|
5500 | this.removeValueColumns([colKey], source);
|
5501 | };
|
5502 | ColumnModel.prototype.removeValueColumns = function (keys, source) {
|
5503 | if (source === void 0) { source = "api"; }
|
5504 | this.updatePrimaryColumnList(keys, this.valueColumns, false, this.setValueActive.bind(this, false), Events.EVENT_COLUMN_VALUE_CHANGED, source);
|
5505 | };
|
5506 |
|
5507 | ColumnModel.prototype.normaliseColumnWidth = function (column, newWidth) {
|
5508 | var minWidth = column.getMinWidth();
|
5509 | if (exists(minWidth) && newWidth < minWidth) {
|
5510 | newWidth = minWidth;
|
5511 | }
|
5512 | var maxWidth = column.getMaxWidth();
|
5513 | if (exists(maxWidth) && column.isGreaterThanMax(newWidth)) {
|
5514 | newWidth = maxWidth;
|
5515 | }
|
5516 | return newWidth;
|
5517 | };
|
5518 | ColumnModel.prototype.getPrimaryOrGridColumn = function (key) {
|
5519 | var column = this.getPrimaryColumn(key);
|
5520 | return column || this.getGridColumn(key);
|
5521 | };
|
5522 | ColumnModel.prototype.setColumnWidths = function (columnWidths, shiftKey, // @takeFromAdjacent - if user has 'shift' pressed, then pixels are taken from adjacent column
|
5523 | finished, // @finished - ends up in the event, tells the user if more events are to come
|
5524 | source) {
|
5525 | var _this = this;
|
5526 | if (source === void 0) { source = "api"; }
|
5527 | var sets = [];
|
5528 | columnWidths.forEach(function (columnWidth) {
|
5529 | var col = _this.getPrimaryOrGridColumn(columnWidth.key);
|
5530 | if (!col) {
|
5531 | return;
|
5532 | }
|
5533 | sets.push({
|
5534 | width: columnWidth.newWidth,
|
5535 | ratios: [1],
|
5536 | columns: [col]
|
5537 | });
|
5538 |
|
5539 | var defaultIsShift = _this.gridOptionsService.get('colResizeDefault') === 'shift';
|
5540 | if (defaultIsShift) {
|
5541 | shiftKey = !shiftKey;
|
5542 | }
|
5543 | if (shiftKey) {
|
5544 | var otherCol = _this.getDisplayedColAfter(col);
|
5545 | if (!otherCol) {
|
5546 | return;
|
5547 | }
|
5548 | var widthDiff = col.getActualWidth() - columnWidth.newWidth;
|
5549 | var otherColWidth = otherCol.getActualWidth() + widthDiff;
|
5550 | sets.push({
|
5551 | width: otherColWidth,
|
5552 | ratios: [1],
|
5553 | columns: [otherCol]
|
5554 | });
|
5555 | }
|
5556 | });
|
5557 | if (sets.length === 0) {
|
5558 | return;
|
5559 | }
|
5560 | this.resizeColumnSets({
|
5561 | resizeSets: sets,
|
5562 | finished: finished,
|
5563 | source: source
|
5564 | });
|
5565 | };
|
5566 | ColumnModel.prototype.checkMinAndMaxWidthsForSet = function (columnResizeSet) {
|
5567 | var columns = columnResizeSet.columns, width = columnResizeSet.width;
|
5568 |
|
5569 |
|
5570 | var minWidthAccumulated = 0;
|
5571 | var maxWidthAccumulated = 0;
|
5572 | var maxWidthActive = true;
|
5573 | columns.forEach(function (col) {
|
5574 | var minWidth = col.getMinWidth();
|
5575 | minWidthAccumulated += minWidth || 0;
|
5576 | var maxWidth = col.getMaxWidth();
|
5577 | if (exists(maxWidth) && maxWidth > 0) {
|
5578 | maxWidthAccumulated += maxWidth;
|
5579 | }
|
5580 | else {
|
5581 |
|
5582 |
|
5583 | maxWidthActive = false;
|
5584 | }
|
5585 | });
|
5586 | var minWidthPasses = width >= minWidthAccumulated;
|
5587 | var maxWidthPasses = !maxWidthActive || (width <= maxWidthAccumulated);
|
5588 | return minWidthPasses && maxWidthPasses;
|
5589 | };
|
5590 |
|
5591 |
|
5592 |
|
5593 |
|
5594 | ColumnModel.prototype.resizeColumnSets = function (params) {
|
5595 | var _this = this;
|
5596 | var resizeSets = params.resizeSets, finished = params.finished, source = params.source;
|
5597 | var passMinMaxCheck = !resizeSets || resizeSets.every(function (columnResizeSet) { return _this.checkMinAndMaxWidthsForSet(columnResizeSet); });
|
5598 | if (!passMinMaxCheck) {
|
5599 |
|
5600 | if (finished) {
|
5601 | var columns = resizeSets && resizeSets.length > 0 ? resizeSets[0].columns : null;
|
5602 | this.dispatchColumnResizedEvent(columns, finished, source);
|
5603 | }
|
5604 | return;
|
5605 | }
|
5606 | var changedCols = [];
|
5607 | var allResizedCols = [];
|
5608 | resizeSets.forEach(function (set) {
|
5609 | var width = set.width, columns = set.columns, ratios = set.ratios;
|
5610 | // keep track of pixels used, and last column gets the remaining,
|
5611 | // to cater for rounding errors, and min width adjustments
|
5612 | var newWidths = {};
|
5613 | var finishedCols = {};
|
5614 | columns.forEach(function (col) { return allResizedCols.push(col); });
|
5615 |
|
5616 |
|
5617 |
|
5618 |
|
5619 |
|
5620 |
|
5621 |
|
5622 |
|
5623 |
|
5624 |
|
5625 | var finishedColsGrew = true;
|
5626 | var loopCount = 0;
|
5627 | var _loop_2 = function () {
|
5628 | loopCount++;
|
5629 | if (loopCount > 1000) {
|
5630 |
|
5631 |
|
5632 | console.error('AG Grid: infinite loop in resizeColumnSets');
|
5633 | return "break";
|
5634 | }
|
5635 | finishedColsGrew = false;
|
5636 | var subsetCols = [];
|
5637 | var subsetRatioTotal = 0;
|
5638 | var pixelsToDistribute = width;
|
5639 | columns.forEach(function (col, index) {
|
5640 | var thisColFinished = finishedCols[col.getId()];
|
5641 | if (thisColFinished) {
|
5642 | pixelsToDistribute -= newWidths[col.getId()];
|
5643 | }
|
5644 | else {
|
5645 | subsetCols.push(col);
|
5646 | var ratioThisCol = ratios[index];
|
5647 | subsetRatioTotal += ratioThisCol;
|
5648 | }
|
5649 | });
|
5650 |
|
5651 |
|
5652 |
|
5653 | var ratioScale = 1 / subsetRatioTotal;
|
5654 | subsetCols.forEach(function (col, index) {
|
5655 | var lastCol = index === (subsetCols.length - 1);
|
5656 | var colNewWidth;
|
5657 | if (lastCol) {
|
5658 | colNewWidth = pixelsToDistribute;
|
5659 | }
|
5660 | else {
|
5661 | colNewWidth = Math.round(ratios[index] * width * ratioScale);
|
5662 | pixelsToDistribute -= colNewWidth;
|
5663 | }
|
5664 | var minWidth = col.getMinWidth();
|
5665 | var maxWidth = col.getMaxWidth();
|
5666 | if (exists(minWidth) && colNewWidth < minWidth) {
|
5667 | colNewWidth = minWidth;
|
5668 | finishedCols[col.getId()] = true;
|
5669 | finishedColsGrew = true;
|
5670 | }
|
5671 | else if (exists(maxWidth) && maxWidth > 0 && colNewWidth > maxWidth) {
|
5672 | colNewWidth = maxWidth;
|
5673 | finishedCols[col.getId()] = true;
|
5674 | finishedColsGrew = true;
|
5675 | }
|
5676 | newWidths[col.getId()] = colNewWidth;
|
5677 | });
|
5678 | };
|
5679 | while (finishedColsGrew) {
|
5680 | var state_1 = _loop_2();
|
5681 | if (state_1 === "break")
|
5682 | break;
|
5683 | }
|
5684 | columns.forEach(function (col) {
|
5685 | var newWidth = newWidths[col.getId()];
|
5686 | var actualWidth = col.getActualWidth();
|
5687 | if (actualWidth !== newWidth) {
|
5688 | col.setActualWidth(newWidth, source);
|
5689 | changedCols.push(col);
|
5690 | }
|
5691 | });
|
5692 | });
|
5693 |
|
5694 | var atLeastOneColChanged = changedCols.length > 0;
|
5695 | var flexedCols = [];
|
5696 | if (atLeastOneColChanged) {
|
5697 | flexedCols = this.refreshFlexedColumns({ resizingCols: allResizedCols, skipSetLeft: true });
|
5698 | this.setLeftValues(source);
|
5699 | this.updateBodyWidths();
|
5700 | this.checkViewportColumns();
|
5701 | }
|
5702 |
|
5703 |
|
5704 |
|
5705 |
|
5706 |
|
5707 | var colsForEvent = allResizedCols.concat(flexedCols);
|
5708 | if (atLeastOneColChanged || finished) {
|
5709 | this.dispatchColumnResizedEvent(colsForEvent, finished, source, flexedCols);
|
5710 | }
|
5711 | };
|
5712 | ColumnModel.prototype.setColumnAggFunc = function (key, aggFunc, source) {
|
5713 | if (source === void 0) { source = "api"; }
|
5714 | if (!key) {
|
5715 | return;
|
5716 | }
|
5717 | var column = this.getPrimaryColumn(key);
|
5718 | if (!column) {
|
5719 | return;
|
5720 | }
|
5721 | column.setAggFunc(aggFunc);
|
5722 | this.dispatchColumnChangedEvent(Events.EVENT_COLUMN_VALUE_CHANGED, [column], source);
|
5723 | };
|
5724 | ColumnModel.prototype.moveRowGroupColumn = function (fromIndex, toIndex, source) {
|
5725 | if (source === void 0) { source = "api"; }
|
5726 | var column = this.rowGroupColumns[fromIndex];
|
5727 | this.rowGroupColumns.splice(fromIndex, 1);
|
5728 | this.rowGroupColumns.splice(toIndex, 0, column);
|
5729 | var event = {
|
5730 | type: Events.EVENT_COLUMN_ROW_GROUP_CHANGED,
|
5731 | columns: this.rowGroupColumns,
|
5732 | column: this.rowGroupColumns.length === 1 ? this.rowGroupColumns[0] : null,
|
5733 | source: source
|
5734 | };
|
5735 | this.eventService.dispatchEvent(event);
|
5736 | };
|
5737 | ColumnModel.prototype.moveColumns = function (columnsToMoveKeys, toIndex, source, finished) {
|
5738 | if (source === void 0) { source = "api"; }
|
5739 | if (finished === void 0) { finished = true; }
|
5740 | this.columnAnimationService.start();
|
5741 | if (toIndex > this.gridColumns.length - columnsToMoveKeys.length) {
|
5742 | console.warn('AG Grid: tried to insert columns in invalid location, toIndex = ' + toIndex);
|
5743 | console.warn('AG Grid: remember that you should not count the moving columns when calculating the new index');
|
5744 | return;
|
5745 | }
|
5746 |
|
5747 | var movedColumns = this.getGridColumns(columnsToMoveKeys);
|
5748 | var failedRules = !this.doesMovePassRules(movedColumns, toIndex);
|
5749 | if (failedRules) {
|
5750 | return;
|
5751 | }
|
5752 | moveInArray(this.gridColumns, movedColumns, toIndex);
|
5753 | this.updateDisplayedColumns(source);
|
5754 | this.dispatchColumnMovedEvent({ movedColumns: movedColumns, source: source, toIndex: toIndex, finished: finished });
|
5755 | this.columnAnimationService.finish();
|
5756 | };
|
5757 | ColumnModel.prototype.doesMovePassRules = function (columnsToMove, toIndex) {
|
5758 |
|
5759 | var proposedColumnOrder = this.getProposedColumnOrder(columnsToMove, toIndex);
|
5760 | return this.doesOrderPassRules(proposedColumnOrder);
|
5761 | };
|
5762 | ColumnModel.prototype.doesOrderPassRules = function (gridOrder) {
|
5763 | if (!this.doesMovePassMarryChildren(gridOrder)) {
|
5764 | return false;
|
5765 | }
|
5766 | if (!this.doesMovePassLockedPositions(gridOrder)) {
|
5767 | return false;
|
5768 | }
|
5769 | return true;
|
5770 | };
|
5771 | ColumnModel.prototype.getProposedColumnOrder = function (columnsToMove, toIndex) {
|
5772 | var proposedColumnOrder = this.gridColumns.slice();
|
5773 | moveInArray(proposedColumnOrder, columnsToMove, toIndex);
|
5774 | return proposedColumnOrder;
|
5775 | };
|
5776 |
|
5777 |
|
5778 | ColumnModel.prototype.sortColumnsLikeGridColumns = function (cols) {
|
5779 | var _this = this;
|
5780 | if (!cols || cols.length <= 1) {
|
5781 | return;
|
5782 | }
|
5783 | var notAllColsInGridColumns = cols.filter(function (c) { return _this.gridColumns.indexOf(c) < 0; }).length > 0;
|
5784 | if (notAllColsInGridColumns) {
|
5785 | return;
|
5786 | }
|
5787 | cols.sort(function (a, b) {
|
5788 | var indexA = _this.gridColumns.indexOf(a);
|
5789 | var indexB = _this.gridColumns.indexOf(b);
|
5790 | return indexA - indexB;
|
5791 | });
|
5792 | };
|
5793 | ColumnModel.prototype.doesMovePassLockedPositions = function (proposedColumnOrder) {
|
5794 |
|
5795 | var lastPlacement = 0;
|
5796 | var rulePassed = true;
|
5797 | var lockPositionToPlacement = function (position) {
|
5798 | if (!position) {
|
5799 | return 1;
|
5800 | }
|
5801 | if (position === true) {
|
5802 | return 0;
|
5803 | }
|
5804 | return position === 'left' ? 0 : 2;
|
5805 | };
|
5806 | proposedColumnOrder.forEach(function (col) {
|
5807 | var placement = lockPositionToPlacement(col.getColDef().lockPosition);
|
5808 | if (placement < lastPlacement) {
|
5809 | rulePassed = false;
|
5810 | }
|
5811 | lastPlacement = placement;
|
5812 | });
|
5813 | return rulePassed;
|
5814 | };
|
5815 | ColumnModel.prototype.doesMovePassMarryChildren = function (allColumnsCopy) {
|
5816 | var rulePassed = true;
|
5817 | this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (child) {
|
5818 | if (!(child instanceof ProvidedColumnGroup)) {
|
5819 | return;
|
5820 | }
|
5821 | var columnGroup = child;
|
5822 | var colGroupDef = columnGroup.getColGroupDef();
|
5823 | var marryChildren = colGroupDef && colGroupDef.marryChildren;
|
5824 | if (!marryChildren) {
|
5825 | return;
|
5826 | }
|
5827 | var newIndexes = [];
|
5828 | columnGroup.getLeafColumns().forEach(function (col) {
|
5829 | var newColIndex = allColumnsCopy.indexOf(col);
|
5830 | newIndexes.push(newColIndex);
|
5831 | });
|
5832 | var maxIndex = Math.max.apply(Math, newIndexes);
|
5833 | var minIndex = Math.min.apply(Math, newIndexes);
|
5834 |
|
5835 | var spread = maxIndex - minIndex;
|
5836 | var maxSpread = columnGroup.getLeafColumns().length - 1;
|
5837 |
|
5838 | if (spread > maxSpread) {
|
5839 | rulePassed = false;
|
5840 | }
|
5841 |
|
5842 |
|
5843 | });
|
5844 | return rulePassed;
|
5845 | };
|
5846 | ColumnModel.prototype.moveColumn = function (key, toIndex, source) {
|
5847 | if (source === void 0) { source = "api"; }
|
5848 | this.moveColumns([key], toIndex, source);
|
5849 | };
|
5850 | ColumnModel.prototype.moveColumnByIndex = function (fromIndex, toIndex, source) {
|
5851 | if (source === void 0) { source = "api"; }
|
5852 | var column = this.gridColumns[fromIndex];
|
5853 | this.moveColumn(column, toIndex, source);
|
5854 | };
|
5855 | ColumnModel.prototype.getColumnDefs = function () {
|
5856 | var _this = this;
|
5857 | if (!this.primaryColumns) {
|
5858 | return;
|
5859 | }
|
5860 | var cols = this.primaryColumns.slice();
|
5861 | if (this.gridColsArePrimary) {
|
5862 | cols.sort(function (a, b) { return _this.gridColumns.indexOf(a) - _this.gridColumns.indexOf(b); });
|
5863 | }
|
5864 | else if (this.lastPrimaryOrder) {
|
5865 | cols.sort(function (a, b) { return _this.lastPrimaryOrder.indexOf(a) - _this.lastPrimaryOrder.indexOf(b); });
|
5866 | }
|
5867 | return this.columnDefFactory.buildColumnDefs(cols, this.rowGroupColumns, this.pivotColumns);
|
5868 | };
|
5869 |
|
5870 |
|
5871 |
|
5872 |
|
5873 | ColumnModel.prototype.getBodyContainerWidth = function () {
|
5874 | return this.bodyWidth;
|
5875 | };
|
5876 | ColumnModel.prototype.getContainerWidth = function (pinned) {
|
5877 | switch (pinned) {
|
5878 | case 'left':
|
5879 | return this.leftWidth;
|
5880 | case 'right':
|
5881 | return this.rightWidth;
|
5882 | default:
|
5883 | return this.bodyWidth;
|
5884 | }
|
5885 | };
|
5886 |
|
5887 | ColumnModel.prototype.updateBodyWidths = function () {
|
5888 | var newBodyWidth = this.getWidthOfColsInList(this.displayedColumnsCenter);
|
5889 | var newLeftWidth = this.getWidthOfColsInList(this.displayedColumnsLeft);
|
5890 | var newRightWidth = this.getWidthOfColsInList(this.displayedColumnsRight);
|
5891 |
|
5892 |
|
5893 | this.bodyWidthDirty = this.bodyWidth !== newBodyWidth;
|
5894 | var atLeastOneChanged = this.bodyWidth !== newBodyWidth || this.leftWidth !== newLeftWidth || this.rightWidth !== newRightWidth;
|
5895 | if (atLeastOneChanged) {
|
5896 | this.bodyWidth = newBodyWidth;
|
5897 | this.leftWidth = newLeftWidth;
|
5898 | this.rightWidth = newRightWidth;
|
5899 |
|
5900 |
|
5901 | var event_2 = {
|
5902 | type: Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED,
|
5903 | };
|
5904 | this.eventService.dispatchEvent(event_2);
|
5905 | }
|
5906 | };
|
5907 |
|
5908 | ColumnModel.prototype.getValueColumns = function () {
|
5909 | return this.valueColumns ? this.valueColumns : [];
|
5910 | };
|
5911 |
|
5912 | ColumnModel.prototype.getPivotColumns = function () {
|
5913 | return this.pivotColumns ? this.pivotColumns : [];
|
5914 | };
|
5915 |
|
5916 | ColumnModel.prototype.isPivotActive = function () {
|
5917 | return this.pivotColumns && this.pivotColumns.length > 0 && this.pivotMode;
|
5918 | };
|
5919 |
|
5920 | ColumnModel.prototype.getRowGroupColumns = function () {
|
5921 | return this.rowGroupColumns ? this.rowGroupColumns : [];
|
5922 | };
|
5923 |
|
5924 | ColumnModel.prototype.getDisplayedCenterColumns = function () {
|
5925 | return this.displayedColumnsCenter;
|
5926 | };
|
5927 |
|
5928 | ColumnModel.prototype.getDisplayedLeftColumns = function () {
|
5929 | return this.displayedColumnsLeft;
|
5930 | };
|
5931 | ColumnModel.prototype.getDisplayedRightColumns = function () {
|
5932 | return this.displayedColumnsRight;
|
5933 | };
|
5934 | ColumnModel.prototype.getDisplayedColumns = function (type) {
|
5935 | switch (type) {
|
5936 | case 'left':
|
5937 | return this.getDisplayedLeftColumns();
|
5938 | case 'right':
|
5939 | return this.getDisplayedRightColumns();
|
5940 | default:
|
5941 | return this.getDisplayedCenterColumns();
|
5942 | }
|
5943 | };
|
5944 |
|
5945 |
|
5946 |
|
5947 | ColumnModel.prototype.getAllPrimaryColumns = function () {
|
5948 | return this.primaryColumns ? this.primaryColumns.slice() : null;
|
5949 | };
|
5950 | ColumnModel.prototype.getSecondaryColumns = function () {
|
5951 | return this.secondaryColumns ? this.secondaryColumns.slice() : null;
|
5952 | };
|
5953 | ColumnModel.prototype.getAllColumnsForQuickFilter = function () {
|
5954 | return this.columnsForQuickFilter;
|
5955 | };
|
5956 |
|
5957 | ColumnModel.prototype.getAllGridColumns = function () {
|
5958 | return this.gridColumns;
|
5959 | };
|
5960 | ColumnModel.prototype.isEmpty = function () {
|
5961 | return missingOrEmpty(this.gridColumns);
|
5962 | };
|
5963 | ColumnModel.prototype.isRowGroupEmpty = function () {
|
5964 | return missingOrEmpty(this.rowGroupColumns);
|
5965 | };
|
5966 | ColumnModel.prototype.setColumnVisible = function (key, visible, source) {
|
5967 | if (source === void 0) { source = "api"; }
|
5968 | this.setColumnsVisible([key], visible, source);
|
5969 | };
|
5970 | ColumnModel.prototype.setColumnsVisible = function (keys, visible, source) {
|
5971 | if (visible === void 0) { visible = false; }
|
5972 | if (source === void 0) { source = "api"; }
|
5973 | this.applyColumnState({
|
5974 | state: keys.map(function (key) { return ({
|
5975 | colId: typeof key === 'string' ? key : key.getColId(),
|
5976 | hide: !visible,
|
5977 | }); }),
|
5978 | }, source);
|
5979 | };
|
5980 | ColumnModel.prototype.setColumnPinned = function (key, pinned, source) {
|
5981 | if (source === void 0) { source = "api"; }
|
5982 | if (key) {
|
5983 | this.setColumnsPinned([key], pinned, source);
|
5984 | }
|
5985 | };
|
5986 | ColumnModel.prototype.setColumnsPinned = function (keys, pinned, source) {
|
5987 | if (source === void 0) { source = "api"; }
|
5988 | if (this.gridOptionsService.isDomLayout('print')) {
|
5989 | console.warn("AG Grid: Changing the column pinning status is not allowed with domLayout='print'");
|
5990 | return;
|
5991 | }
|
5992 | this.columnAnimationService.start();
|
5993 | var actualPinned;
|
5994 | if (pinned === true || pinned === 'left') {
|
5995 | actualPinned = 'left';
|
5996 | }
|
5997 | else if (pinned === 'right') {
|
5998 | actualPinned = 'right';
|
5999 | }
|
6000 | else {
|
6001 | actualPinned = null;
|
6002 | }
|
6003 | this.actionOnGridColumns(keys, function (col) {
|
6004 | if (col.getPinned() !== actualPinned) {
|
6005 | col.setPinned(actualPinned);
|
6006 | return true;
|
6007 | }
|
6008 | return false;
|
6009 | }, source, function () {
|
6010 | var event = {
|
6011 | type: Events.EVENT_COLUMN_PINNED,
|
6012 | pinned: actualPinned,
|
6013 | column: null,
|
6014 | columns: null,
|
6015 | source: source
|
6016 | };
|
6017 | return event;
|
6018 | });
|
6019 | this.columnAnimationService.finish();
|
6020 | };
|
6021 |
|
6022 |
|
6023 |
|
6024 |
|
6025 | ColumnModel.prototype.actionOnGridColumns = function (// the column keys this action will be on
|
6026 | keys,
|
6027 | // the action to do - if this returns false, the column was skipped
|
6028 | // and won't be included in the event
|
6029 | action,
|
6030 |
|
6031 | source, createEvent) {
|
6032 | var _this = this;
|
6033 | if (missingOrEmpty(keys)) {
|
6034 | return;
|
6035 | }
|
6036 | var updatedColumns = [];
|
6037 | keys.forEach(function (key) {
|
6038 | var column = _this.getGridColumn(key);
|
6039 | if (!column) {
|
6040 | return;
|
6041 | }
|
6042 |
|
6043 |
|
6044 | var resultOfAction = action(column);
|
6045 | if (resultOfAction !== false) {
|
6046 | updatedColumns.push(column);
|
6047 | }
|
6048 | });
|
6049 | if (!updatedColumns.length) {
|
6050 | return;
|
6051 | }
|
6052 | this.updateDisplayedColumns(source);
|
6053 | if (exists(createEvent) && createEvent) {
|
6054 | var event_3 = createEvent();
|
6055 | event_3.columns = updatedColumns;
|
6056 | event_3.column = updatedColumns.length === 1 ? updatedColumns[0] : null;
|
6057 | this.eventService.dispatchEvent(event_3);
|
6058 | }
|
6059 | };
|
6060 | ColumnModel.prototype.getDisplayedColBefore = function (col) {
|
6061 | var allDisplayedColumns = this.getAllDisplayedColumns();
|
6062 | var oldIndex = allDisplayedColumns.indexOf(col);
|
6063 | if (oldIndex > 0) {
|
6064 | return allDisplayedColumns[oldIndex - 1];
|
6065 | }
|
6066 | return null;
|
6067 | };
|
6068 |
|
6069 |
|
6070 | ColumnModel.prototype.getDisplayedColAfter = function (col) {
|
6071 | var allDisplayedColumns = this.getAllDisplayedColumns();
|
6072 | var oldIndex = allDisplayedColumns.indexOf(col);
|
6073 | if (oldIndex < (allDisplayedColumns.length - 1)) {
|
6074 | return allDisplayedColumns[oldIndex + 1];
|
6075 | }
|
6076 | return null;
|
6077 | };
|
6078 | ColumnModel.prototype.getDisplayedGroupAfter = function (columnGroup) {
|
6079 | return this.getDisplayedGroupAtDirection(columnGroup, 'After');
|
6080 | };
|
6081 | ColumnModel.prototype.getDisplayedGroupBefore = function (columnGroup) {
|
6082 | return this.getDisplayedGroupAtDirection(columnGroup, 'Before');
|
6083 | };
|
6084 | ColumnModel.prototype.getDisplayedGroupAtDirection = function (columnGroup, direction) {
|
6085 |
|
6086 | var requiredLevel = columnGroup.getProvidedColumnGroup().getLevel() + columnGroup.getPaddingLevel();
|
6087 | var colGroupLeafColumns = columnGroup.getDisplayedLeafColumns();
|
6088 | var col = direction === 'After' ? last(colGroupLeafColumns) : colGroupLeafColumns[0];
|
6089 | var getDisplayColMethod = "getDisplayedCol" + direction;
|
6090 | while (true) {
|
6091 |
|
6092 | var column = this[getDisplayColMethod](col);
|
6093 | if (!column) {
|
6094 | return null;
|
6095 | }
|
6096 | var groupPointer = this.getColumnGroupAtLevel(column, requiredLevel);
|
6097 | if (groupPointer !== columnGroup) {
|
6098 | return groupPointer;
|
6099 | }
|
6100 | }
|
6101 | };
|
6102 | ColumnModel.prototype.getColumnGroupAtLevel = function (column, level) {
|
6103 |
|
6104 | var groupPointer = column.getParent();
|
6105 | var originalGroupLevel;
|
6106 | var groupPointerLevel;
|
6107 | while (true) {
|
6108 | var groupPointerProvidedColumnGroup = groupPointer.getProvidedColumnGroup();
|
6109 | originalGroupLevel = groupPointerProvidedColumnGroup.getLevel();
|
6110 | groupPointerLevel = groupPointer.getPaddingLevel();
|
6111 | if (originalGroupLevel + groupPointerLevel <= level) {
|
6112 | break;
|
6113 | }
|
6114 | groupPointer = groupPointer.getParent();
|
6115 | }
|
6116 | return groupPointer;
|
6117 | };
|
6118 | ColumnModel.prototype.isPinningLeft = function () {
|
6119 | return this.displayedColumnsLeft.length > 0;
|
6120 | };
|
6121 | ColumnModel.prototype.isPinningRight = function () {
|
6122 | return this.displayedColumnsRight.length > 0;
|
6123 | };
|
6124 | ColumnModel.prototype.getPrimaryAndSecondaryAndAutoColumns = function () {
|
6125 | var _a;
|
6126 | return (_a = []).concat.apply(_a, __spread$k([
|
6127 | this.primaryColumns || [],
|
6128 | this.groupAutoColumns || [],
|
6129 | this.secondaryColumns || [],
|
6130 | ]));
|
6131 | };
|
6132 | ColumnModel.prototype.createStateItemFromColumn = function (column) {
|
6133 | var rowGroupIndex = column.isRowGroupActive() ? this.rowGroupColumns.indexOf(column) : null;
|
6134 | var pivotIndex = column.isPivotActive() ? this.pivotColumns.indexOf(column) : null;
|
6135 | var aggFunc = column.isValueActive() ? column.getAggFunc() : null;
|
6136 | var sort = column.getSort() != null ? column.getSort() : null;
|
6137 | var sortIndex = column.getSortIndex() != null ? column.getSortIndex() : null;
|
6138 | var flex = column.getFlex() != null && column.getFlex() > 0 ? column.getFlex() : null;
|
6139 | var res = {
|
6140 | colId: column.getColId(),
|
6141 | width: column.getActualWidth(),
|
6142 | hide: !column.isVisible(),
|
6143 | pinned: column.getPinned(),
|
6144 | sort: sort,
|
6145 | sortIndex: sortIndex,
|
6146 | aggFunc: aggFunc,
|
6147 | rowGroup: column.isRowGroupActive(),
|
6148 | rowGroupIndex: rowGroupIndex,
|
6149 | pivot: column.isPivotActive(),
|
6150 | pivotIndex: pivotIndex,
|
6151 | flex: flex
|
6152 | };
|
6153 | return res;
|
6154 | };
|
6155 | ColumnModel.prototype.getColumnState = function () {
|
6156 | if (missing(this.primaryColumns) || !this.isAlive()) {
|
6157 | return [];
|
6158 | }
|
6159 | var colsForState = this.getPrimaryAndSecondaryAndAutoColumns();
|
6160 | var res = colsForState.map(this.createStateItemFromColumn.bind(this));
|
6161 | this.orderColumnStateList(res);
|
6162 | return res;
|
6163 | };
|
6164 | ColumnModel.prototype.orderColumnStateList = function (columnStateList) {
|
6165 |
|
6166 | var colIdToGridIndexMap = convertToMap(this.gridColumns.map(function (col, index) { return [col.getColId(), index]; }));
|
6167 | columnStateList.sort(function (itemA, itemB) {
|
6168 | var posA = colIdToGridIndexMap.has(itemA.colId) ? colIdToGridIndexMap.get(itemA.colId) : -1;
|
6169 | var posB = colIdToGridIndexMap.has(itemB.colId) ? colIdToGridIndexMap.get(itemB.colId) : -1;
|
6170 | return posA - posB;
|
6171 | });
|
6172 | };
|
6173 | ColumnModel.prototype.resetColumnState = function (source) {
|
6174 |
|
6175 |
|
6176 |
|
6177 | if (source === void 0) { source = "api"; }
|
6178 |
|
6179 | var primaryColumns = this.getColumnsFromTree(this.primaryColumnTree);
|
6180 | var columnStates = [];
|
6181 |
|
6182 |
|
6183 |
|
6184 | var letRowGroupIndex = 1000;
|
6185 | var letPivotIndex = 1000;
|
6186 | var colsToProcess = [];
|
6187 | if (this.groupAutoColumns) {
|
6188 | colsToProcess = colsToProcess.concat(this.groupAutoColumns);
|
6189 | }
|
6190 | if (primaryColumns) {
|
6191 | colsToProcess = colsToProcess.concat(primaryColumns);
|
6192 | }
|
6193 | colsToProcess.forEach(function (column) {
|
6194 | var getValueOrNull = function (a, b) { return a != null ? a : b != null ? b : null; };
|
6195 | var colDef = column.getColDef();
|
6196 | var sort = getValueOrNull(colDef.sort, colDef.initialSort);
|
6197 | var sortIndex = getValueOrNull(colDef.sortIndex, colDef.initialSortIndex);
|
6198 | var hide = getValueOrNull(colDef.hide, colDef.initialHide);
|
6199 | var pinned = getValueOrNull(colDef.pinned, colDef.initialPinned);
|
6200 | var width = getValueOrNull(colDef.width, colDef.initialWidth);
|
6201 | var flex = getValueOrNull(colDef.flex, colDef.initialFlex);
|
6202 | var rowGroupIndex = getValueOrNull(colDef.rowGroupIndex, colDef.initialRowGroupIndex);
|
6203 | var rowGroup = getValueOrNull(colDef.rowGroup, colDef.initialRowGroup);
|
6204 | if (rowGroupIndex == null && (rowGroup == null || rowGroup == false)) {
|
6205 | rowGroupIndex = null;
|
6206 | rowGroup = null;
|
6207 | }
|
6208 | var pivotIndex = getValueOrNull(colDef.pivotIndex, colDef.initialPivotIndex);
|
6209 | var pivot = getValueOrNull(colDef.pivot, colDef.initialPivot);
|
6210 | if (pivotIndex == null && (pivot == null || pivot == false)) {
|
6211 | pivotIndex = null;
|
6212 | pivot = null;
|
6213 | }
|
6214 | var aggFunc = getValueOrNull(colDef.aggFunc, colDef.initialAggFunc);
|
6215 | var stateItem = {
|
6216 | colId: column.getColId(),
|
6217 | sort: sort,
|
6218 | sortIndex: sortIndex,
|
6219 | hide: hide,
|
6220 | pinned: pinned,
|
6221 | width: width,
|
6222 | flex: flex,
|
6223 | rowGroup: rowGroup,
|
6224 | rowGroupIndex: rowGroupIndex,
|
6225 | pivot: pivot,
|
6226 | pivotIndex: pivotIndex,
|
6227 | aggFunc: aggFunc,
|
6228 | };
|
6229 | if (missing(rowGroupIndex) && rowGroup) {
|
6230 | stateItem.rowGroupIndex = letRowGroupIndex++;
|
6231 | }
|
6232 | if (missing(pivotIndex) && pivot) {
|
6233 | stateItem.pivotIndex = letPivotIndex++;
|
6234 | }
|
6235 | columnStates.push(stateItem);
|
6236 | });
|
6237 | this.applyColumnState({ state: columnStates, applyOrder: true }, source);
|
6238 | };
|
6239 | ColumnModel.prototype.applyColumnState = function (params, source) {
|
6240 | var _this = this;
|
6241 | if (missingOrEmpty(this.primaryColumns)) {
|
6242 | return false;
|
6243 | }
|
6244 | if (params && params.state && !params.state.forEach) {
|
6245 | 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.');
|
6246 | return false;
|
6247 | }
|
6248 | var applyStates = function (states, existingColumns, getById) {
|
6249 | var dispatchEventsFunc = _this.compareColumnStatesAndDispatchEvents(source);
|
6250 | _this.autoGroupsNeedBuilding = true;
|
6251 |
|
6252 | var columnsWithNoState = existingColumns.slice();
|
6253 | var rowGroupIndexes = {};
|
6254 | var pivotIndexes = {};
|
6255 | var autoGroupColumnStates = [];
|
6256 |
|
6257 |
|
6258 | var unmatchedAndAutoStates = [];
|
6259 | var unmatchedCount = 0;
|
6260 | var previousRowGroupCols = _this.rowGroupColumns.slice();
|
6261 | var previousPivotCols = _this.pivotColumns.slice();
|
6262 | states.forEach(function (state) {
|
6263 | var colId = state.colId || '';
|
6264 |
|
6265 | var isAutoGroupColumn = colId.startsWith(GROUP_AUTO_COLUMN_ID);
|
6266 | if (isAutoGroupColumn) {
|
6267 | autoGroupColumnStates.push(state);
|
6268 | unmatchedAndAutoStates.push(state);
|
6269 | return;
|
6270 | }
|
6271 | var column = getById(colId);
|
6272 | if (!column) {
|
6273 | unmatchedAndAutoStates.push(state);
|
6274 | unmatchedCount += 1;
|
6275 | }
|
6276 | else {
|
6277 | _this.syncColumnWithStateItem(column, state, params.defaultState, rowGroupIndexes, pivotIndexes, false, source);
|
6278 | removeFromArray(columnsWithNoState, column);
|
6279 | }
|
6280 | });
|
6281 |
|
6282 | var applyDefaultsFunc = function (col) {
|
6283 | return _this.syncColumnWithStateItem(col, null, params.defaultState, rowGroupIndexes, pivotIndexes, false, source);
|
6284 | };
|
6285 | columnsWithNoState.forEach(applyDefaultsFunc);
|
6286 |
|
6287 | var comparator = function (indexes, oldList, colA, colB) {
|
6288 | var indexA = indexes[colA.getId()];
|
6289 | var indexB = indexes[colB.getId()];
|
6290 | var aHasIndex = indexA != null;
|
6291 | var bHasIndex = indexB != null;
|
6292 | if (aHasIndex && bHasIndex) {
|
6293 |
|
6294 | return indexA - indexB;
|
6295 | }
|
6296 | if (aHasIndex) {
|
6297 |
|
6298 | return -1;
|
6299 | }
|
6300 | if (bHasIndex) {
|
6301 |
|
6302 | return 1;
|
6303 | }
|
6304 | var oldIndexA = oldList.indexOf(colA);
|
6305 | var oldIndexB = oldList.indexOf(colB);
|
6306 | var aHasOldIndex = oldIndexA >= 0;
|
6307 | var bHasOldIndex = oldIndexB >= 0;
|
6308 | if (aHasOldIndex && bHasOldIndex) {
|
6309 |
|
6310 | return oldIndexA - oldIndexB;
|
6311 | }
|
6312 | if (aHasOldIndex) {
|
6313 |
|
6314 | return -1;
|
6315 | }
|
6316 |
|
6317 |
|
6318 | return 1;
|
6319 | };
|
6320 | _this.rowGroupColumns.sort(comparator.bind(_this, rowGroupIndexes, previousRowGroupCols));
|
6321 | _this.pivotColumns.sort(comparator.bind(_this, pivotIndexes, previousPivotCols));
|
6322 | _this.updateGridColumns();
|
6323 |
|
6324 | var autoGroupColsCopy = _this.groupAutoColumns ? _this.groupAutoColumns.slice() : [];
|
6325 | autoGroupColumnStates.forEach(function (stateItem) {
|
6326 | var autoCol = _this.getAutoColumn(stateItem.colId);
|
6327 | removeFromArray(autoGroupColsCopy, autoCol);
|
6328 | _this.syncColumnWithStateItem(autoCol, stateItem, params.defaultState, null, null, true, source);
|
6329 | });
|
6330 |
|
6331 | autoGroupColsCopy.forEach(applyDefaultsFunc);
|
6332 | _this.applyOrderAfterApplyState(params);
|
6333 | _this.updateDisplayedColumns(source);
|
6334 | _this.dispatchEverythingChanged(source);
|
6335 | dispatchEventsFunc();
|
6336 | return { unmatchedAndAutoStates: unmatchedAndAutoStates, unmatchedCount: unmatchedCount };
|
6337 | };
|
6338 | this.columnAnimationService.start();
|
6339 | var _a = applyStates(params.state || [], this.primaryColumns || [], function (id) { return _this.getPrimaryColumn(id); }), unmatchedAndAutoStates = _a.unmatchedAndAutoStates, unmatchedCount = _a.unmatchedCount;
|
6340 |
|
6341 |
|
6342 | if (unmatchedAndAutoStates.length > 0 || exists(params.defaultState)) {
|
6343 | unmatchedCount = applyStates(unmatchedAndAutoStates, this.secondaryColumns || [], function (id) { return _this.getSecondaryColumn(id); }).unmatchedCount;
|
6344 | }
|
6345 | this.columnAnimationService.finish();
|
6346 | return unmatchedCount === 0;
|
6347 | };
|
6348 | ColumnModel.prototype.applyOrderAfterApplyState = function (params) {
|
6349 | var _this = this;
|
6350 | if (!params.applyOrder || !params.state) {
|
6351 | return;
|
6352 | }
|
6353 | var newOrder = [];
|
6354 | var processedColIds = {};
|
6355 | params.state.forEach(function (item) {
|
6356 | if (!item.colId || processedColIds[item.colId]) {
|
6357 | return;
|
6358 | }
|
6359 | var col = _this.gridColumnsMap[item.colId];
|
6360 | if (col) {
|
6361 | newOrder.push(col);
|
6362 | processedColIds[item.colId] = true;
|
6363 | }
|
6364 | });
|
6365 |
|
6366 | var autoGroupInsertIndex = 0;
|
6367 | this.gridColumns.forEach(function (col) {
|
6368 | var colId = col.getColId();
|
6369 | var alreadyProcessed = processedColIds[colId] != null;
|
6370 | if (alreadyProcessed) {
|
6371 | return;
|
6372 | }
|
6373 | var isAutoGroupCol = colId.startsWith(GROUP_AUTO_COLUMN_ID);
|
6374 | if (isAutoGroupCol) {
|
6375 |
|
6376 |
|
6377 |
|
6378 |
|
6379 | insertIntoArray(newOrder, col, autoGroupInsertIndex++);
|
6380 | }
|
6381 | else {
|
6382 |
|
6383 | newOrder.push(col);
|
6384 | }
|
6385 | });
|
6386 |
|
6387 |
|
6388 |
|
6389 |
|
6390 | newOrder = this.placeLockedColumns(newOrder);
|
6391 | if (!this.doesMovePassMarryChildren(newOrder)) {
|
6392 | console.warn('AG Grid: Applying column order broke a group where columns should be married together. Applying new order has been discarded.');
|
6393 | return;
|
6394 | }
|
6395 | this.gridColumns = newOrder;
|
6396 | };
|
6397 | ColumnModel.prototype.compareColumnStatesAndDispatchEvents = function (source) {
|
6398 | var _this = this;
|
6399 | var startState = {
|
6400 | rowGroupColumns: this.rowGroupColumns.slice(),
|
6401 | pivotColumns: this.pivotColumns.slice(),
|
6402 | valueColumns: this.valueColumns.slice()
|
6403 | };
|
6404 | var columnStateBefore = this.getColumnState();
|
6405 | var columnStateBeforeMap = {};
|
6406 | columnStateBefore.forEach(function (col) {
|
6407 | columnStateBeforeMap[col.colId] = col;
|
6408 | });
|
6409 | return function () {
|
6410 | var colsForState = _this.getPrimaryAndSecondaryAndAutoColumns();
|
6411 |
|
6412 | var dispatchWhenListsDifferent = function (eventType, colsBefore, colsAfter, idMapper) {
|
6413 | var beforeList = colsBefore.map(idMapper);
|
6414 | var afterList = colsAfter.map(idMapper);
|
6415 | var unchanged = areEqual(beforeList, afterList);
|
6416 | if (unchanged) {
|
6417 | return;
|
6418 | }
|
6419 |
|
6420 | var event = {
|
6421 | type: eventType,
|
6422 | columns: colsAfter,
|
6423 | column: colsAfter.length === 1 ? colsAfter[0] : null,
|
6424 | source: source
|
6425 | };
|
6426 | _this.eventService.dispatchEvent(event);
|
6427 | };
|
6428 |
|
6429 | var getChangedColumns = function (changedPredicate) {
|
6430 | var changedColumns = [];
|
6431 | colsForState.forEach(function (column) {
|
6432 | var colStateBefore = columnStateBeforeMap[column.getColId()];
|
6433 | if (colStateBefore && changedPredicate(colStateBefore, column)) {
|
6434 | changedColumns.push(column);
|
6435 | }
|
6436 | });
|
6437 | return changedColumns;
|
6438 | };
|
6439 | var columnIdMapper = function (c) { return c.getColId(); };
|
6440 | dispatchWhenListsDifferent(Events.EVENT_COLUMN_ROW_GROUP_CHANGED, startState.rowGroupColumns, _this.rowGroupColumns, columnIdMapper);
|
6441 | dispatchWhenListsDifferent(Events.EVENT_COLUMN_PIVOT_CHANGED, startState.pivotColumns, _this.pivotColumns, columnIdMapper);
|
6442 | var valueChangePredicate = function (cs, c) {
|
6443 | var oldActive = cs.aggFunc != null;
|
6444 | var activeChanged = oldActive != c.isValueActive();
|
6445 |
|
6446 | var aggFuncChanged = oldActive && cs.aggFunc != c.getAggFunc();
|
6447 | return activeChanged || aggFuncChanged;
|
6448 | };
|
6449 | var changedValues = getChangedColumns(valueChangePredicate);
|
6450 | if (changedValues.length > 0) {
|
6451 |
|
6452 |
|
6453 |
|
6454 |
|
6455 |
|
6456 | _this.dispatchColumnChangedEvent(Events.EVENT_COLUMN_VALUE_CHANGED, _this.valueColumns, source);
|
6457 | }
|
6458 | var resizeChangePredicate = function (cs, c) { return cs.width != c.getActualWidth(); };
|
6459 | _this.dispatchColumnResizedEvent(getChangedColumns(resizeChangePredicate), true, source);
|
6460 | var pinnedChangePredicate = function (cs, c) { return cs.pinned != c.getPinned(); };
|
6461 | _this.dispatchColumnPinnedEvent(getChangedColumns(pinnedChangePredicate), source);
|
6462 | var visibilityChangePredicate = function (cs, c) { return cs.hide == c.isVisible(); };
|
6463 | _this.dispatchColumnVisibleEvent(getChangedColumns(visibilityChangePredicate), source);
|
6464 | var sortChangePredicate = function (cs, c) { return cs.sort != c.getSort() || cs.sortIndex != c.getSortIndex(); };
|
6465 | if (getChangedColumns(sortChangePredicate).length > 0) {
|
6466 | _this.sortController.dispatchSortChangedEvents(source);
|
6467 | }
|
6468 |
|
6469 | _this.normaliseColumnMovedEventForColumnState(columnStateBefore, source);
|
6470 | };
|
6471 | };
|
6472 | ColumnModel.prototype.getCommonValue = function (cols, valueGetter) {
|
6473 | if (!cols || cols.length == 0) {
|
6474 | return undefined;
|
6475 | }
|
6476 |
|
6477 | var firstValue = valueGetter(cols[0]);
|
6478 | for (var i = 1; i < cols.length; i++) {
|
6479 | if (firstValue !== valueGetter(cols[i])) {
|
6480 |
|
6481 | return undefined;
|
6482 | }
|
6483 | }
|
6484 | return firstValue;
|
6485 | };
|
6486 | ColumnModel.prototype.normaliseColumnMovedEventForColumnState = function (colStateBefore, source) {
|
6487 |
|
6488 | var _this = this;
|
6489 | var colStateAfter = this.getColumnState();
|
6490 | var colStateAfterMapped = {};
|
6491 | colStateAfter.forEach(function (s) { return colStateAfterMapped[s.colId] = s; });
|
6492 |
|
6493 | var colsIntersectIds = {};
|
6494 | colStateBefore.forEach(function (s) {
|
6495 | if (colStateAfterMapped[s.colId]) {
|
6496 | colsIntersectIds[s.colId] = true;
|
6497 | }
|
6498 | });
|
6499 |
|
6500 | var beforeFiltered = colStateBefore.filter(function (c) { return colsIntersectIds[c.colId]; });
|
6501 | var afterFiltered = colStateAfter.filter(function (c) { return colsIntersectIds[c.colId]; });
|
6502 |
|
6503 | var movedColumns = [];
|
6504 | afterFiltered.forEach(function (csAfter, index) {
|
6505 | var csBefore = beforeFiltered && beforeFiltered[index];
|
6506 | if (csBefore && csBefore.colId !== csAfter.colId) {
|
6507 | var gridCol = _this.getGridColumn(csBefore.colId);
|
6508 | if (gridCol) {
|
6509 | movedColumns.push(gridCol);
|
6510 | }
|
6511 | }
|
6512 | });
|
6513 | if (!movedColumns.length) {
|
6514 | return;
|
6515 | }
|
6516 | this.dispatchColumnMovedEvent({ movedColumns: movedColumns, source: source, finished: true });
|
6517 | };
|
6518 | ColumnModel.prototype.syncColumnWithStateItem = function (column, stateItem, defaultState, rowGroupIndexes, pivotIndexes, autoCol, source) {
|
6519 | if (!column) {
|
6520 | return;
|
6521 | }
|
6522 | var getValue = function (key1, key2) {
|
6523 | var obj = { value1: undefined, value2: undefined };
|
6524 | var calculated = false;
|
6525 | if (stateItem) {
|
6526 | if (stateItem[key1] !== undefined) {
|
6527 | obj.value1 = stateItem[key1];
|
6528 | calculated = true;
|
6529 | }
|
6530 | if (exists(key2) && stateItem[key2] !== undefined) {
|
6531 | obj.value2 = stateItem[key2];
|
6532 | calculated = true;
|
6533 | }
|
6534 | }
|
6535 | if (!calculated && defaultState) {
|
6536 | if (defaultState[key1] !== undefined) {
|
6537 | obj.value1 = defaultState[key1];
|
6538 | }
|
6539 | if (exists(key2) && defaultState[key2] !== undefined) {
|
6540 | obj.value2 = defaultState[key2];
|
6541 | }
|
6542 | }
|
6543 | return obj;
|
6544 | };
|
6545 |
|
6546 | var hide = getValue('hide').value1;
|
6547 | if (hide !== undefined) {
|
6548 | column.setVisible(!hide, source);
|
6549 | }
|
6550 |
|
6551 | var pinned = getValue('pinned').value1;
|
6552 | if (pinned !== undefined) {
|
6553 | column.setPinned(pinned);
|
6554 | }
|
6555 |
|
6556 | var minColWidth = this.columnUtils.calculateColMinWidth(column.getColDef());
|
6557 |
|
6558 | var flex = getValue('flex').value1;
|
6559 | if (flex !== undefined) {
|
6560 | column.setFlex(flex);
|
6561 | }
|
6562 |
|
6563 | var noFlexThisCol = column.getFlex() <= 0;
|
6564 | if (noFlexThisCol) {
|
6565 |
|
6566 | var width = getValue('width').value1;
|
6567 | if (width != null) {
|
6568 | if (minColWidth != null && width >= minColWidth) {
|
6569 | column.setActualWidth(width, source);
|
6570 | }
|
6571 | }
|
6572 | }
|
6573 | var sort = getValue('sort').value1;
|
6574 | if (sort !== undefined) {
|
6575 | if (sort === 'desc' || sort === 'asc') {
|
6576 | column.setSort(sort, source);
|
6577 | }
|
6578 | else {
|
6579 | column.setSort(undefined, source);
|
6580 | }
|
6581 | }
|
6582 | var sortIndex = getValue('sortIndex').value1;
|
6583 | if (sortIndex !== undefined) {
|
6584 | column.setSortIndex(sortIndex);
|
6585 | }
|
6586 |
|
6587 | if (autoCol || !column.isPrimary()) {
|
6588 | return;
|
6589 | }
|
6590 | var aggFunc = getValue('aggFunc').value1;
|
6591 | if (aggFunc !== undefined) {
|
6592 | if (typeof aggFunc === 'string') {
|
6593 | column.setAggFunc(aggFunc);
|
6594 | if (!column.isValueActive()) {
|
6595 | column.setValueActive(true, source);
|
6596 | this.valueColumns.push(column);
|
6597 | }
|
6598 | }
|
6599 | else {
|
6600 | if (exists(aggFunc)) {
|
6601 | console.warn('AG Grid: stateItem.aggFunc must be a string. if using your own aggregation ' +
|
6602 | 'functions, register the functions first before using them in get/set state. This is because it is ' +
|
6603 | 'intended for the column state to be stored and retrieved as simple JSON.');
|
6604 | }
|
6605 |
|
6606 |
|
6607 |
|
6608 | if (column.isValueActive()) {
|
6609 | column.setValueActive(false, source);
|
6610 | removeFromArray(this.valueColumns, column);
|
6611 | }
|
6612 | }
|
6613 | }
|
6614 | var _a = getValue('rowGroup', 'rowGroupIndex'), rowGroup = _a.value1, rowGroupIndex = _a.value2;
|
6615 | if (rowGroup !== undefined || rowGroupIndex !== undefined) {
|
6616 | if (typeof rowGroupIndex === 'number' || rowGroup) {
|
6617 | if (!column.isRowGroupActive()) {
|
6618 | column.setRowGroupActive(true, source);
|
6619 | this.rowGroupColumns.push(column);
|
6620 | }
|
6621 | if (rowGroupIndexes && typeof rowGroupIndex === 'number') {
|
6622 | rowGroupIndexes[column.getId()] = rowGroupIndex;
|
6623 | }
|
6624 | }
|
6625 | else {
|
6626 | if (column.isRowGroupActive()) {
|
6627 | column.setRowGroupActive(false, source);
|
6628 | removeFromArray(this.rowGroupColumns, column);
|
6629 | }
|
6630 | }
|
6631 | }
|
6632 | var _b = getValue('pivot', 'pivotIndex'), pivot = _b.value1, pivotIndex = _b.value2;
|
6633 | if (pivot !== undefined || pivotIndex !== undefined) {
|
6634 | if (typeof pivotIndex === 'number' || pivot) {
|
6635 | if (!column.isPivotActive()) {
|
6636 | column.setPivotActive(true, source);
|
6637 | this.pivotColumns.push(column);
|
6638 | }
|
6639 | if (pivotIndexes && typeof pivotIndex === 'number') {
|
6640 | pivotIndexes[column.getId()] = pivotIndex;
|
6641 | }
|
6642 | }
|
6643 | else {
|
6644 | if (column.isPivotActive()) {
|
6645 | column.setPivotActive(false, source);
|
6646 | removeFromArray(this.pivotColumns, column);
|
6647 | }
|
6648 | }
|
6649 | }
|
6650 | };
|
6651 | ColumnModel.prototype.getGridColumns = function (keys) {
|
6652 | return this.getColumns(keys, this.getGridColumn.bind(this));
|
6653 | };
|
6654 | ColumnModel.prototype.getColumns = function (keys, columnLookupCallback) {
|
6655 | var foundColumns = [];
|
6656 | if (keys) {
|
6657 | keys.forEach(function (key) {
|
6658 | var column = columnLookupCallback(key);
|
6659 | if (column) {
|
6660 | foundColumns.push(column);
|
6661 | }
|
6662 | });
|
6663 | }
|
6664 | return foundColumns;
|
6665 | };
|
6666 |
|
6667 | ColumnModel.prototype.getColumnWithValidation = function (key) {
|
6668 | if (key == null) {
|
6669 | return null;
|
6670 | }
|
6671 | var column = this.getGridColumn(key);
|
6672 | if (!column) {
|
6673 | console.warn('AG Grid: could not find column ' + key);
|
6674 | }
|
6675 | return column;
|
6676 | };
|
6677 | ColumnModel.prototype.getPrimaryColumn = function (key) {
|
6678 | if (!this.primaryColumns) {
|
6679 | return null;
|
6680 | }
|
6681 | return this.getColumn(key, this.primaryColumns, this.primaryColumnsMap);
|
6682 | };
|
6683 | ColumnModel.prototype.getGridColumn = function (key) {
|
6684 | return this.getColumn(key, this.gridColumns, this.gridColumnsMap);
|
6685 | };
|
6686 | ColumnModel.prototype.getSecondaryColumn = function (key) {
|
6687 | if (!this.secondaryColumns) {
|
6688 | return null;
|
6689 | }
|
6690 | return this.getColumn(key, this.secondaryColumns, this.secondaryColumnsMap);
|
6691 | };
|
6692 | ColumnModel.prototype.getColumn = function (key, columnList, columnMap) {
|
6693 | if (!key) {
|
6694 | return null;
|
6695 | }
|
6696 |
|
6697 |
|
6698 | if (typeof key == 'string' && columnMap[key]) {
|
6699 | return columnMap[key];
|
6700 | }
|
6701 | for (var i = 0; i < columnList.length; i++) {
|
6702 | if (this.columnsMatch(columnList[i], key)) {
|
6703 | return columnList[i];
|
6704 | }
|
6705 | }
|
6706 | return this.getAutoColumn(key);
|
6707 | };
|
6708 | ColumnModel.prototype.getSourceColumnsForGroupColumn = function (groupCol) {
|
6709 | var sourceColumnId = groupCol.getColDef().showRowGroup;
|
6710 | if (!sourceColumnId) {
|
6711 | return null;
|
6712 | }
|
6713 | if (sourceColumnId === true) {
|
6714 | return this.rowGroupColumns.slice(0);
|
6715 | }
|
6716 | var column = this.getPrimaryColumn(sourceColumnId);
|
6717 | return column ? [column] : null;
|
6718 | };
|
6719 | ColumnModel.prototype.getAutoColumn = function (key) {
|
6720 | var _this = this;
|
6721 | if (!this.groupAutoColumns ||
|
6722 | !exists(this.groupAutoColumns) ||
|
6723 | missing(this.groupAutoColumns)) {
|
6724 | return null;
|
6725 | }
|
6726 | return this.groupAutoColumns.find(function (groupCol) { return _this.columnsMatch(groupCol, key); }) || null;
|
6727 | };
|
6728 | ColumnModel.prototype.columnsMatch = function (column, key) {
|
6729 | var columnMatches = column === key;
|
6730 | var colDefMatches = column.getColDef() === key;
|
6731 | var idMatches = column.getColId() == key;
|
6732 | return columnMatches || colDefMatches || idMatches;
|
6733 | };
|
6734 | ColumnModel.prototype.getDisplayNameForColumn = function (column, location, includeAggFunc) {
|
6735 | if (includeAggFunc === void 0) { includeAggFunc = false; }
|
6736 | if (!column) {
|
6737 | return null;
|
6738 | }
|
6739 | var headerName = this.getHeaderName(column.getColDef(), column, null, null, location);
|
6740 | if (includeAggFunc) {
|
6741 | return this.wrapHeaderNameWithAggFunc(column, headerName);
|
6742 | }
|
6743 | return headerName;
|
6744 | };
|
6745 | ColumnModel.prototype.getDisplayNameForProvidedColumnGroup = function (columnGroup, providedColumnGroup, location) {
|
6746 | var colGroupDef = providedColumnGroup ? providedColumnGroup.getColGroupDef() : null;
|
6747 | if (colGroupDef) {
|
6748 | return this.getHeaderName(colGroupDef, null, columnGroup, providedColumnGroup, location);
|
6749 | }
|
6750 | return null;
|
6751 | };
|
6752 | ColumnModel.prototype.getDisplayNameForColumnGroup = function (columnGroup, location) {
|
6753 | return this.getDisplayNameForProvidedColumnGroup(columnGroup, columnGroup.getProvidedColumnGroup(), location);
|
6754 | };
|
6755 |
|
6756 | ColumnModel.prototype.getHeaderName = function (colDef, column, columnGroup, providedColumnGroup, location) {
|
6757 | var headerValueGetter = colDef.headerValueGetter;
|
6758 | if (headerValueGetter) {
|
6759 | var params = {
|
6760 | colDef: colDef,
|
6761 | column: column,
|
6762 | columnGroup: columnGroup,
|
6763 | providedColumnGroup: providedColumnGroup,
|
6764 | location: location,
|
6765 | api: this.gridOptionsService.api,
|
6766 | columnApi: this.gridOptionsService.columnApi,
|
6767 | context: this.gridOptionsService.context
|
6768 | };
|
6769 | if (typeof headerValueGetter === 'function') {
|
6770 |
|
6771 | return headerValueGetter(params);
|
6772 | }
|
6773 | else if (typeof headerValueGetter === 'string') {
|
6774 |
|
6775 | return this.expressionService.evaluate(headerValueGetter, params);
|
6776 | }
|
6777 | console.warn('AG Grid: headerValueGetter must be a function or a string');
|
6778 | return '';
|
6779 | }
|
6780 | else if (colDef.headerName != null) {
|
6781 | return colDef.headerName;
|
6782 | }
|
6783 | else if (colDef.field) {
|
6784 | return camelCaseToHumanText(colDef.field);
|
6785 | }
|
6786 | return '';
|
6787 | };
|
6788 | ColumnModel.prototype.wrapHeaderNameWithAggFunc = function (column, headerName) {
|
6789 | if (this.gridOptionsService.is('suppressAggFuncInHeader')) {
|
6790 | return headerName;
|
6791 | }
|
6792 |
|
6793 | var pivotValueColumn = column.getColDef().pivotValueColumn;
|
6794 | var pivotActiveOnThisColumn = exists(pivotValueColumn);
|
6795 | var aggFunc = null;
|
6796 | var aggFuncFound;
|
6797 |
|
6798 | if (pivotActiveOnThisColumn) {
|
6799 | var isCollapsedHeaderEnabled = this.gridOptionsService.is('removePivotHeaderRowWhenSingleValueColumn') && this.valueColumns.length === 1;
|
6800 | var isTotalColumn = column.getColDef().pivotTotalColumnIds !== undefined;
|
6801 | if (isCollapsedHeaderEnabled && !isTotalColumn) {
|
6802 | return headerName;
|
6803 | }
|
6804 | aggFunc = pivotValueColumn ? pivotValueColumn.getAggFunc() : null;
|
6805 | aggFuncFound = true;
|
6806 | }
|
6807 | else {
|
6808 | var measureActive = column.isValueActive();
|
6809 | var aggregationPresent = this.pivotMode || !this.isRowGroupEmpty();
|
6810 | if (measureActive && aggregationPresent) {
|
6811 | aggFunc = column.getAggFunc();
|
6812 | aggFuncFound = true;
|
6813 | }
|
6814 | else {
|
6815 | aggFuncFound = false;
|
6816 | }
|
6817 | }
|
6818 | if (aggFuncFound) {
|
6819 | var aggFuncString = (typeof aggFunc === 'string') ? aggFunc : 'func';
|
6820 | var localeTextFunc = this.localeService.getLocaleTextFunc();
|
6821 | var aggFuncStringTranslated = localeTextFunc(aggFuncString, aggFuncString);
|
6822 | return aggFuncStringTranslated + "(" + headerName + ")";
|
6823 | }
|
6824 | return headerName;
|
6825 | };
|
6826 |
|
6827 |
|
6828 | ColumnModel.prototype.getColumnGroup = function (colId, partId) {
|
6829 | if (!colId) {
|
6830 | return null;
|
6831 | }
|
6832 | if (colId instanceof ColumnGroup) {
|
6833 | return colId;
|
6834 | }
|
6835 | var allColumnGroups = this.getAllDisplayedTrees();
|
6836 | var checkPartId = typeof partId === 'number';
|
6837 | var result = null;
|
6838 | this.columnUtils.depthFirstAllColumnTreeSearch(allColumnGroups, function (child) {
|
6839 | if (child instanceof ColumnGroup) {
|
6840 | var columnGroup = child;
|
6841 | var matched = void 0;
|
6842 | if (checkPartId) {
|
6843 | matched = colId === columnGroup.getGroupId() && partId === columnGroup.getPartId();
|
6844 | }
|
6845 | else {
|
6846 | matched = colId === columnGroup.getGroupId();
|
6847 | }
|
6848 | if (matched) {
|
6849 | result = columnGroup;
|
6850 | }
|
6851 | }
|
6852 | });
|
6853 | return result;
|
6854 | };
|
6855 | ColumnModel.prototype.isReady = function () {
|
6856 | return this.ready;
|
6857 | };
|
6858 | ColumnModel.prototype.extractValueColumns = function (source, oldPrimaryColumns) {
|
6859 | this.valueColumns = this.extractColumns(oldPrimaryColumns, this.valueColumns, function (col, flag) { return col.setValueActive(flag, source); },
|
6860 |
|
6861 | function () { return undefined; }, function () { return undefined; },
|
6862 |
|
6863 | function (colDef) {
|
6864 | var aggFunc = colDef.aggFunc;
|
6865 |
|
6866 | if (aggFunc === null || aggFunc === '') {
|
6867 | return null;
|
6868 | }
|
6869 | if (aggFunc === undefined) {
|
6870 | return;
|
6871 | }
|
6872 | return !!aggFunc;
|
6873 | }, function (colDef) {
|
6874 |
|
6875 | return colDef.initialAggFunc != null && colDef.initialAggFunc != '';
|
6876 | });
|
6877 |
|
6878 | this.valueColumns.forEach(function (col) {
|
6879 | var colDef = col.getColDef();
|
6880 |
|
6881 | if (colDef.aggFunc != null && colDef.aggFunc != '') {
|
6882 | col.setAggFunc(colDef.aggFunc);
|
6883 | }
|
6884 | else {
|
6885 |
|
6886 | if (!col.getAggFunc()) {
|
6887 | col.setAggFunc(colDef.initialAggFunc);
|
6888 | }
|
6889 | }
|
6890 | });
|
6891 | };
|
6892 | ColumnModel.prototype.extractRowGroupColumns = function (source, oldPrimaryColumns) {
|
6893 | 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; });
|
6894 | };
|
6895 | ColumnModel.prototype.extractColumns = function (oldPrimaryColumns, previousCols, setFlagFunc, getIndexFunc, getInitialIndexFunc, getValueFunc, getInitialValueFunc) {
|
6896 | if (oldPrimaryColumns === void 0) { oldPrimaryColumns = []; }
|
6897 | if (previousCols === void 0) { previousCols = []; }
|
6898 | var colsWithIndex = [];
|
6899 | var colsWithValue = [];
|
6900 |
|
6901 |
|
6902 |
|
6903 | (this.primaryColumns || []).forEach(function (col) {
|
6904 | var colIsNew = oldPrimaryColumns.indexOf(col) < 0;
|
6905 | var colDef = col.getColDef();
|
6906 | var value = attrToBoolean(getValueFunc(colDef));
|
6907 | var initialValue = attrToBoolean(getInitialValueFunc(colDef));
|
6908 | var index = attrToNumber(getIndexFunc(colDef));
|
6909 | var initialIndex = attrToNumber(getInitialIndexFunc(colDef));
|
6910 | var include;
|
6911 | var valuePresent = value !== undefined;
|
6912 | var indexPresent = index !== undefined;
|
6913 | var initialValuePresent = initialValue !== undefined;
|
6914 | var initialIndexPresent = initialIndex !== undefined;
|
6915 | if (valuePresent) {
|
6916 | include = value;
|
6917 | }
|
6918 | else if (indexPresent) {
|
6919 | if (index === null) {
|
6920 |
|
6921 |
|
6922 | include = false;
|
6923 | }
|
6924 | else {
|
6925 |
|
6926 |
|
6927 | include = index >= 0;
|
6928 | }
|
6929 | }
|
6930 | else {
|
6931 | if (colIsNew) {
|
6932 |
|
6933 | if (initialValuePresent) {
|
6934 | include = initialValue;
|
6935 | }
|
6936 | else if (initialIndexPresent) {
|
6937 | include = initialIndex != null && initialIndex >= 0;
|
6938 | }
|
6939 | else {
|
6940 | include = false;
|
6941 | }
|
6942 | }
|
6943 | else {
|
6944 |
|
6945 |
|
6946 | include = previousCols.indexOf(col) >= 0;
|
6947 | }
|
6948 | }
|
6949 | if (include) {
|
6950 | var useIndex = colIsNew ? (index != null || initialIndex != null) : index != null;
|
6951 | useIndex ? colsWithIndex.push(col) : colsWithValue.push(col);
|
6952 | }
|
6953 | });
|
6954 | var getIndexForCol = function (col) {
|
6955 | var index = getIndexFunc(col.getColDef());
|
6956 | var defaultIndex = getInitialIndexFunc(col.getColDef());
|
6957 | return index != null ? index : defaultIndex;
|
6958 | };
|
6959 |
|
6960 | colsWithIndex.sort(function (colA, colB) {
|
6961 | var indexA = getIndexForCol(colA);
|
6962 | var indexB = getIndexForCol(colB);
|
6963 | if (indexA === indexB) {
|
6964 | return 0;
|
6965 | }
|
6966 | if (indexA < indexB) {
|
6967 | return -1;
|
6968 | }
|
6969 | return 1;
|
6970 | });
|
6971 | var res = [].concat(colsWithIndex);
|
6972 |
|
6973 |
|
6974 | previousCols.forEach(function (col) {
|
6975 | if (colsWithValue.indexOf(col) >= 0) {
|
6976 | res.push(col);
|
6977 | }
|
6978 | });
|
6979 |
|
6980 | colsWithValue.forEach(function (col) {
|
6981 | if (res.indexOf(col) < 0) {
|
6982 | res.push(col);
|
6983 | }
|
6984 | });
|
6985 |
|
6986 | previousCols.forEach(function (col) {
|
6987 | if (res.indexOf(col) < 0) {
|
6988 | setFlagFunc(col, false);
|
6989 | }
|
6990 | });
|
6991 |
|
6992 | res.forEach(function (col) {
|
6993 | if (previousCols.indexOf(col) < 0) {
|
6994 | setFlagFunc(col, true);
|
6995 | }
|
6996 | });
|
6997 | return res;
|
6998 | };
|
6999 | ColumnModel.prototype.extractPivotColumns = function (source, oldPrimaryColumns) {
|
7000 | 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; });
|
7001 | };
|
7002 | ColumnModel.prototype.resetColumnGroupState = function (source) {
|
7003 | if (source === void 0) { source = "api"; }
|
7004 | var stateItems = [];
|
7005 | this.columnUtils.depthFirstOriginalTreeSearch(null, this.primaryColumnTree, function (child) {
|
7006 | if (child instanceof ProvidedColumnGroup) {
|
7007 | var colGroupDef = child.getColGroupDef();
|
7008 | var groupState = {
|
7009 | groupId: child.getGroupId(),
|
7010 | open: !colGroupDef ? undefined : colGroupDef.openByDefault
|
7011 | };
|
7012 | stateItems.push(groupState);
|
7013 | }
|
7014 | });
|
7015 | this.setColumnGroupState(stateItems, source);
|
7016 | };
|
7017 | ColumnModel.prototype.getColumnGroupState = function () {
|
7018 | var columnGroupState = [];
|
7019 | this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (node) {
|
7020 | if (node instanceof ProvidedColumnGroup) {
|
7021 | columnGroupState.push({
|
7022 | groupId: node.getGroupId(),
|
7023 | open: node.isExpanded()
|
7024 | });
|
7025 | }
|
7026 | });
|
7027 | return columnGroupState;
|
7028 | };
|
7029 | ColumnModel.prototype.setColumnGroupState = function (stateItems, source) {
|
7030 | var _this = this;
|
7031 | if (source === void 0) { source = "api"; }
|
7032 | this.columnAnimationService.start();
|
7033 | var impactedGroups = [];
|
7034 | stateItems.forEach(function (stateItem) {
|
7035 | var groupKey = stateItem.groupId;
|
7036 | var newValue = stateItem.open;
|
7037 | var providedColumnGroup = _this.getProvidedColumnGroup(groupKey);
|
7038 | if (!providedColumnGroup) {
|
7039 | return;
|
7040 | }
|
7041 | if (providedColumnGroup.isExpanded() === newValue) {
|
7042 | return;
|
7043 | }
|
7044 | _this.logger.log('columnGroupOpened(' + providedColumnGroup.getGroupId() + ',' + newValue + ')');
|
7045 | providedColumnGroup.setExpanded(newValue);
|
7046 | impactedGroups.push(providedColumnGroup);
|
7047 | });
|
7048 | this.updateGroupsAndDisplayedColumns(source);
|
7049 | this.setFirstRightAndLastLeftPinned(source);
|
7050 | impactedGroups.forEach(function (providedColumnGroup) {
|
7051 | var event = {
|
7052 | type: Events.EVENT_COLUMN_GROUP_OPENED,
|
7053 | columnGroup: providedColumnGroup
|
7054 | };
|
7055 | _this.eventService.dispatchEvent(event);
|
7056 | });
|
7057 | this.columnAnimationService.finish();
|
7058 | };
|
7059 |
|
7060 | ColumnModel.prototype.setColumnGroupOpened = function (key, newValue, source) {
|
7061 | if (source === void 0) { source = "api"; }
|
7062 | var keyAsString;
|
7063 | if (key instanceof ProvidedColumnGroup) {
|
7064 | keyAsString = key.getId();
|
7065 | }
|
7066 | else {
|
7067 | keyAsString = key || '';
|
7068 | }
|
7069 | this.setColumnGroupState([{ groupId: keyAsString, open: newValue }], source);
|
7070 | };
|
7071 | ColumnModel.prototype.getProvidedColumnGroup = function (key) {
|
7072 |
|
7073 | if (typeof key !== 'string') {
|
7074 | console.error('AG Grid: group key must be a string');
|
7075 | }
|
7076 |
|
7077 | var res = null;
|
7078 | this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (node) {
|
7079 | if (node instanceof ProvidedColumnGroup) {
|
7080 | if (node.getId() === key) {
|
7081 | res = node;
|
7082 | }
|
7083 | }
|
7084 | });
|
7085 | return res;
|
7086 | };
|
7087 | ColumnModel.prototype.calculateColumnsForDisplay = function () {
|
7088 | var _this = this;
|
7089 | var columnsForDisplay;
|
7090 | if (this.pivotMode && missing(this.secondaryColumns)) {
|
7091 |
|
7092 |
|
7093 | columnsForDisplay = this.gridColumns.filter(function (column) {
|
7094 | var isAutoGroupCol = _this.groupAutoColumns && includes(_this.groupAutoColumns, column);
|
7095 | var isValueCol = _this.valueColumns && includes(_this.valueColumns, column);
|
7096 | return isAutoGroupCol || isValueCol;
|
7097 | });
|
7098 | }
|
7099 | else {
|
7100 |
|
7101 |
|
7102 | columnsForDisplay = this.gridColumns.filter(function (column) {
|
7103 |
|
7104 | var isAutoGroupCol = _this.groupAutoColumns && includes(_this.groupAutoColumns, column);
|
7105 | return isAutoGroupCol || column.isVisible();
|
7106 | });
|
7107 | }
|
7108 | return columnsForDisplay;
|
7109 | };
|
7110 | ColumnModel.prototype.checkColSpanActiveInCols = function (columns) {
|
7111 | var result = false;
|
7112 | columns.forEach(function (col) {
|
7113 | if (exists(col.getColDef().colSpan)) {
|
7114 | result = true;
|
7115 | }
|
7116 | });
|
7117 | return result;
|
7118 | };
|
7119 | ColumnModel.prototype.calculateColumnsForGroupDisplay = function () {
|
7120 | var _this = this;
|
7121 | this.groupDisplayColumns = [];
|
7122 | this.groupDisplayColumnsMap = {};
|
7123 | var checkFunc = function (col) {
|
7124 | var colDef = col.getColDef();
|
7125 | var underlyingColumn = colDef.showRowGroup;
|
7126 | if (colDef && exists(underlyingColumn)) {
|
7127 | _this.groupDisplayColumns.push(col);
|
7128 | if (typeof underlyingColumn === 'string') {
|
7129 | _this.groupDisplayColumnsMap[underlyingColumn] = col;
|
7130 | }
|
7131 | else if (underlyingColumn === true) {
|
7132 | _this.getRowGroupColumns().forEach(function (rowGroupCol) {
|
7133 | _this.groupDisplayColumnsMap[rowGroupCol.getId()] = col;
|
7134 | });
|
7135 | }
|
7136 | }
|
7137 | };
|
7138 | this.gridColumns.forEach(checkFunc);
|
7139 | if (this.groupAutoColumns) {
|
7140 | this.groupAutoColumns.forEach(checkFunc);
|
7141 | }
|
7142 | };
|
7143 | ColumnModel.prototype.getGroupDisplayColumns = function () {
|
7144 | return this.groupDisplayColumns;
|
7145 | };
|
7146 | ColumnModel.prototype.getGroupDisplayColumnForGroup = function (rowGroupColumnId) {
|
7147 | return this.groupDisplayColumnsMap[rowGroupColumnId];
|
7148 | };
|
7149 | ColumnModel.prototype.updateDisplayedColumns = function (source) {
|
7150 | var columnsForDisplay = this.calculateColumnsForDisplay();
|
7151 | this.buildDisplayedTrees(columnsForDisplay);
|
7152 | this.calculateColumnsForGroupDisplay();
|
7153 |
|
7154 | this.updateGroupsAndDisplayedColumns(source);
|
7155 |
|
7156 | this.setFirstRightAndLastLeftPinned(source);
|
7157 | };
|
7158 | ColumnModel.prototype.isSecondaryColumnsPresent = function () {
|
7159 | return exists(this.secondaryColumns);
|
7160 | };
|
7161 | ColumnModel.prototype.setSecondaryColumns = function (colDefs, source) {
|
7162 | var _this = this;
|
7163 | if (source === void 0) { source = "api"; }
|
7164 | var newColsPresent = colDefs && colDefs.length > 0;
|
7165 |
|
7166 | if (!newColsPresent && missing(this.secondaryColumns)) {
|
7167 | return;
|
7168 | }
|
7169 | if (newColsPresent) {
|
7170 | this.processSecondaryColumnDefinitions(colDefs);
|
7171 | var balancedTreeResult = this.columnFactory.createColumnTree(colDefs, false, this.secondaryBalancedTree || this.previousSecondaryColumns || undefined);
|
7172 | this.destroyOldColumns(this.secondaryBalancedTree, balancedTreeResult.columnTree);
|
7173 | this.secondaryBalancedTree = balancedTreeResult.columnTree;
|
7174 | this.secondaryHeaderRowCount = balancedTreeResult.treeDept + 1;
|
7175 | this.secondaryColumns = this.getColumnsFromTree(this.secondaryBalancedTree);
|
7176 | this.secondaryColumnsMap = {};
|
7177 | this.secondaryColumns.forEach(function (col) { return _this.secondaryColumnsMap[col.getId()] = col; });
|
7178 | this.previousSecondaryColumns = null;
|
7179 | }
|
7180 | else {
|
7181 | this.previousSecondaryColumns = this.secondaryBalancedTree;
|
7182 | this.secondaryBalancedTree = null;
|
7183 | this.secondaryHeaderRowCount = -1;
|
7184 | this.secondaryColumns = null;
|
7185 | this.secondaryColumnsMap = {};
|
7186 | }
|
7187 | this.updateGridColumns();
|
7188 | this.updateDisplayedColumns(source);
|
7189 | };
|
7190 | ColumnModel.prototype.processSecondaryColumnDefinitions = function (colDefs) {
|
7191 | var columnCallback = this.gridOptionsService.get('processPivotResultColDef') || this.gridOptionsService.get('processSecondaryColDef');
|
7192 | var groupCallback = this.gridOptionsService.get('processPivotResultColGroupDef') || this.gridOptionsService.get('processSecondaryColGroupDef');
|
7193 | if (!columnCallback && !groupCallback) {
|
7194 | return undefined;
|
7195 | }
|
7196 | var searchForColDefs = function (colDefs2) {
|
7197 | colDefs2.forEach(function (abstractColDef) {
|
7198 | var isGroup = exists(abstractColDef.children);
|
7199 | if (isGroup) {
|
7200 | var colGroupDef = abstractColDef;
|
7201 | if (groupCallback) {
|
7202 | groupCallback(colGroupDef);
|
7203 | }
|
7204 | searchForColDefs(colGroupDef.children);
|
7205 | }
|
7206 | else {
|
7207 | var colDef = abstractColDef;
|
7208 | if (columnCallback) {
|
7209 | columnCallback(colDef);
|
7210 | }
|
7211 | }
|
7212 | });
|
7213 | };
|
7214 | if (colDefs) {
|
7215 | searchForColDefs(colDefs);
|
7216 | }
|
7217 | };
|
7218 |
|
7219 | ColumnModel.prototype.updateGridColumns = function () {
|
7220 | var _this = this;
|
7221 | var prevGridCols = this.gridBalancedTree;
|
7222 | if (this.gridColsArePrimary) {
|
7223 | this.lastPrimaryOrder = this.gridColumns;
|
7224 | }
|
7225 | else {
|
7226 | this.lastSecondaryOrder = this.gridColumns;
|
7227 | }
|
7228 | var sortOrderToRecover;
|
7229 | if (this.secondaryColumns && this.secondaryBalancedTree) {
|
7230 | var hasSameColumns = this.secondaryColumns.every(function (col) {
|
7231 | return _this.gridColumnsMap[col.getColId()] !== undefined;
|
7232 | });
|
7233 | this.gridBalancedTree = this.secondaryBalancedTree.slice();
|
7234 | this.gridHeaderRowCount = this.secondaryHeaderRowCount;
|
7235 | this.gridColumns = this.secondaryColumns.slice();
|
7236 | this.gridColsArePrimary = false;
|
7237 |
|
7238 |
|
7239 |
|
7240 | if (hasSameColumns) {
|
7241 | sortOrderToRecover = this.lastSecondaryOrder;
|
7242 | }
|
7243 | }
|
7244 | else if (this.primaryColumns) {
|
7245 | this.gridBalancedTree = this.primaryColumnTree.slice();
|
7246 | this.gridHeaderRowCount = this.primaryHeaderRowCount;
|
7247 | this.gridColumns = this.primaryColumns.slice();
|
7248 | this.gridColsArePrimary = true;
|
7249 |
|
7250 |
|
7251 |
|
7252 | sortOrderToRecover = this.lastPrimaryOrder;
|
7253 | }
|
7254 |
|
7255 | var areAutoColsChanged = this.createGroupAutoColumnsIfNeeded();
|
7256 |
|
7257 | if (areAutoColsChanged && sortOrderToRecover) {
|
7258 | var groupAutoColsMap_1 = convertToMap(this.groupAutoColumns.map(function (col) { return [col, true]; }));
|
7259 |
|
7260 | sortOrderToRecover = sortOrderToRecover.filter(function (col) { return !groupAutoColsMap_1.has(col); });
|
7261 |
|
7262 | sortOrderToRecover = __spread$k(this.groupAutoColumns, sortOrderToRecover);
|
7263 | }
|
7264 | this.addAutoGroupToGridColumns();
|
7265 | this.orderGridColsLike(sortOrderToRecover);
|
7266 | this.gridColumns = this.placeLockedColumns(this.gridColumns);
|
7267 | this.refreshQuickFilterColumns();
|
7268 | this.clearDisplayedAndViewportColumns();
|
7269 | this.colSpanActive = this.checkColSpanActiveInCols(this.gridColumns);
|
7270 | this.gridColumnsMap = {};
|
7271 | this.gridColumns.forEach(function (col) { return _this.gridColumnsMap[col.getId()] = col; });
|
7272 | this.setAutoHeightActive();
|
7273 | if (!areEqual(prevGridCols, this.gridBalancedTree)) {
|
7274 | var event_4 = {
|
7275 | type: Events.EVENT_GRID_COLUMNS_CHANGED
|
7276 | };
|
7277 | this.eventService.dispatchEvent(event_4);
|
7278 | }
|
7279 | };
|
7280 | ColumnModel.prototype.setAutoHeightActive = function () {
|
7281 | this.autoHeightActive = this.gridColumns.filter(function (col) { return col.isAutoHeight(); }).length > 0;
|
7282 | if (this.autoHeightActive) {
|
7283 | this.autoHeightActiveAtLeastOnce = true;
|
7284 | var rowModelType = this.rowModel.getType();
|
7285 | var supportedRowModel = rowModelType === 'clientSide' || rowModelType === 'serverSide';
|
7286 | if (!supportedRowModel) {
|
7287 | var message_1 = 'AG Grid - autoHeight columns only work with Client Side Row Model and Server Side Row Model.';
|
7288 | doOnce(function () { return console.warn(message_1); }, 'autoHeightActive.wrongRowModel');
|
7289 | }
|
7290 | }
|
7291 | };
|
7292 | ColumnModel.prototype.orderGridColsLike = function (colsOrder) {
|
7293 | if (missing(colsOrder)) {
|
7294 | return;
|
7295 | }
|
7296 | var lastOrderMapped = convertToMap(colsOrder.map(function (col, index) { return [col, index]; }));
|
7297 |
|
7298 |
|
7299 | var noColsFound = true;
|
7300 | this.gridColumns.forEach(function (col) {
|
7301 | if (lastOrderMapped.has(col)) {
|
7302 | noColsFound = false;
|
7303 | }
|
7304 | });
|
7305 | if (noColsFound) {
|
7306 | return;
|
7307 | }
|
7308 |
|
7309 |
|
7310 | var gridColsMap = convertToMap(this.gridColumns.map(function (col) { return [col, true]; }));
|
7311 | var oldColsOrdered = colsOrder.filter(function (col) { return gridColsMap.has(col); });
|
7312 | var oldColsMap = convertToMap(oldColsOrdered.map(function (col) { return [col, true]; }));
|
7313 | var newColsOrdered = this.gridColumns.filter(function (col) { return !oldColsMap.has(col); });
|
7314 |
|
7315 | var newGridColumns = oldColsOrdered.slice();
|
7316 | newColsOrdered.forEach(function (newCol) {
|
7317 | var parent = newCol.getOriginalParent();
|
7318 |
|
7319 | if (!parent) {
|
7320 | newGridColumns.push(newCol);
|
7321 | return;
|
7322 | }
|
7323 |
|
7324 |
|
7325 | var siblings = [];
|
7326 | while (!siblings.length && parent) {
|
7327 | var leafCols = parent.getLeafColumns();
|
7328 | leafCols.forEach(function (leafCol) {
|
7329 | var presentInNewGriColumns = newGridColumns.indexOf(leafCol) >= 0;
|
7330 | var noYetInSiblings = siblings.indexOf(leafCol) < 0;
|
7331 | if (presentInNewGriColumns && noYetInSiblings) {
|
7332 | siblings.push(leafCol);
|
7333 | }
|
7334 | });
|
7335 | parent = parent.getOriginalParent();
|
7336 | }
|
7337 |
|
7338 | if (!siblings.length) {
|
7339 | newGridColumns.push(newCol);
|
7340 | return;
|
7341 | }
|
7342 |
|
7343 | var indexes = siblings.map(function (col) { return newGridColumns.indexOf(col); });
|
7344 | var lastIndex = Math.max.apply(Math, __spread$k(indexes));
|
7345 | insertIntoArray(newGridColumns, newCol, lastIndex + 1);
|
7346 | });
|
7347 | this.gridColumns = newGridColumns;
|
7348 | };
|
7349 | ColumnModel.prototype.isPrimaryColumnGroupsPresent = function () {
|
7350 | return this.primaryHeaderRowCount > 1;
|
7351 | };
|
7352 |
|
7353 |
|
7354 |
|
7355 |
|
7356 |
|
7357 | ColumnModel.prototype.refreshQuickFilterColumns = function () {
|
7358 | var _a;
|
7359 | var columnsForQuickFilter;
|
7360 | if (this.groupAutoColumns) {
|
7361 | columnsForQuickFilter = ((_a = this.primaryColumns) !== null && _a !== void 0 ? _a : []).concat(this.groupAutoColumns);
|
7362 | }
|
7363 | else if (this.primaryColumns) {
|
7364 | columnsForQuickFilter = this.primaryColumns;
|
7365 | }
|
7366 | columnsForQuickFilter = columnsForQuickFilter !== null && columnsForQuickFilter !== void 0 ? columnsForQuickFilter : [];
|
7367 | this.columnsForQuickFilter = this.gridOptionsService.is('excludeHiddenColumnsFromQuickFilter')
|
7368 | ? columnsForQuickFilter.filter(function (col) { return col.isVisible(); })
|
7369 | : columnsForQuickFilter;
|
7370 | };
|
7371 | ColumnModel.prototype.placeLockedColumns = function (cols) {
|
7372 | var left = [];
|
7373 | var normal = [];
|
7374 | var right = [];
|
7375 | cols.forEach(function (col) {
|
7376 | var position = col.getColDef().lockPosition;
|
7377 | if (position === 'right') {
|
7378 | right.push(col);
|
7379 | }
|
7380 | else if (position === 'left' || position === true) {
|
7381 | left.push(col);
|
7382 | }
|
7383 | else {
|
7384 | normal.push(col);
|
7385 | }
|
7386 | });
|
7387 | return __spread$k(left, normal, right);
|
7388 | };
|
7389 | ColumnModel.prototype.addAutoGroupToGridColumns = function () {
|
7390 | if (missing(this.groupAutoColumns)) {
|
7391 | this.destroyOldColumns(this.groupAutoColsBalancedTree);
|
7392 | this.groupAutoColsBalancedTree = null;
|
7393 | return;
|
7394 | }
|
7395 | this.gridColumns = this.groupAutoColumns ? this.groupAutoColumns.concat(this.gridColumns) : this.gridColumns;
|
7396 | var newAutoColsTree = this.columnFactory.createForAutoGroups(this.groupAutoColumns, this.gridBalancedTree);
|
7397 | this.destroyOldColumns(this.groupAutoColsBalancedTree, newAutoColsTree);
|
7398 | this.groupAutoColsBalancedTree = newAutoColsTree;
|
7399 | this.gridBalancedTree = newAutoColsTree.concat(this.gridBalancedTree);
|
7400 | };
|
7401 |
|
7402 |
|
7403 |
|
7404 |
|
7405 |
|
7406 | ColumnModel.prototype.clearDisplayedAndViewportColumns = function () {
|
7407 | this.viewportRowLeft = {};
|
7408 | this.viewportRowRight = {};
|
7409 | this.viewportRowCenter = {};
|
7410 | this.displayedColumnsLeft = [];
|
7411 | this.displayedColumnsRight = [];
|
7412 | this.displayedColumnsCenter = [];
|
7413 | this.displayedColumns = [];
|
7414 | this.viewportColumns = [];
|
7415 | this.headerViewportColumns = [];
|
7416 | this.viewportColumnsHash = '';
|
7417 | };
|
7418 | ColumnModel.prototype.updateGroupsAndDisplayedColumns = function (source) {
|
7419 | this.updateOpenClosedVisibilityInColumnGroups();
|
7420 | this.deriveDisplayedColumns(source);
|
7421 | this.refreshFlexedColumns();
|
7422 | this.extractViewport();
|
7423 | this.updateBodyWidths();
|
7424 |
|
7425 | var event = {
|
7426 | type: Events.EVENT_DISPLAYED_COLUMNS_CHANGED
|
7427 | };
|
7428 | this.eventService.dispatchEvent(event);
|
7429 | };
|
7430 | ColumnModel.prototype.deriveDisplayedColumns = function (source) {
|
7431 | this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeLeft, this.displayedColumnsLeft);
|
7432 | this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeCentre, this.displayedColumnsCenter);
|
7433 | this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeRight, this.displayedColumnsRight);
|
7434 | this.joinDisplayedColumns();
|
7435 | this.setLeftValues(source);
|
7436 | this.displayedAutoHeightCols = this.displayedColumns.filter(function (col) { return col.isAutoHeight(); });
|
7437 | };
|
7438 | ColumnModel.prototype.isAutoRowHeightActive = function () {
|
7439 | return this.autoHeightActive;
|
7440 | };
|
7441 | ColumnModel.prototype.wasAutoRowHeightEverActive = function () {
|
7442 | return this.autoHeightActiveAtLeastOnce;
|
7443 | };
|
7444 | ColumnModel.prototype.joinDisplayedColumns = function () {
|
7445 | if (this.gridOptionsService.is('enableRtl')) {
|
7446 | this.displayedColumns = this.displayedColumnsRight
|
7447 | .concat(this.displayedColumnsCenter)
|
7448 | .concat(this.displayedColumnsLeft);
|
7449 | }
|
7450 | else {
|
7451 | this.displayedColumns = this.displayedColumnsLeft
|
7452 | .concat(this.displayedColumnsCenter)
|
7453 | .concat(this.displayedColumnsRight);
|
7454 | }
|
7455 | };
|
7456 |
|
7457 | ColumnModel.prototype.setLeftValues = function (source) {
|
7458 | this.setLeftValuesOfColumns(source);
|
7459 | this.setLeftValuesOfGroups();
|
7460 | };
|
7461 | ColumnModel.prototype.setLeftValuesOfColumns = function (source) {
|
7462 | var _this = this;
|
7463 | if (!this.primaryColumns) {
|
7464 | return;
|
7465 | }
|
7466 |
|
7467 | var allColumns = this.primaryColumns.slice(0);
|
7468 |
|
7469 | var doingRtl = this.gridOptionsService.is('enableRtl');
|
7470 | [
|
7471 | this.displayedColumnsLeft,
|
7472 | this.displayedColumnsRight,
|
7473 | this.displayedColumnsCenter
|
7474 | ].forEach(function (columns) {
|
7475 | if (doingRtl) {
|
7476 |
|
7477 | var left_1 = _this.getWidthOfColsInList(columns);
|
7478 | columns.forEach(function (column) {
|
7479 | left_1 -= column.getActualWidth();
|
7480 | column.setLeft(left_1, source);
|
7481 | });
|
7482 | }
|
7483 | else {
|
7484 |
|
7485 | var left_2 = 0;
|
7486 | columns.forEach(function (column) {
|
7487 | column.setLeft(left_2, source);
|
7488 | left_2 += column.getActualWidth();
|
7489 | });
|
7490 | }
|
7491 | removeAllFromArray(allColumns, columns);
|
7492 | });
|
7493 |
|
7494 |
|
7495 |
|
7496 | allColumns.forEach(function (column) {
|
7497 | column.setLeft(null, source);
|
7498 | });
|
7499 | };
|
7500 | ColumnModel.prototype.setLeftValuesOfGroups = function () {
|
7501 |
|
7502 | [
|
7503 | this.displayedTreeLeft,
|
7504 | this.displayedTreeRight,
|
7505 | this.displayedTreeCentre
|
7506 | ].forEach(function (columns) {
|
7507 | columns.forEach(function (column) {
|
7508 | if (column instanceof ColumnGroup) {
|
7509 | var columnGroup = column;
|
7510 | columnGroup.checkLeft();
|
7511 | }
|
7512 | });
|
7513 | });
|
7514 | };
|
7515 | ColumnModel.prototype.derivedDisplayedColumnsFromDisplayedTree = function (tree, columns) {
|
7516 | columns.length = 0;
|
7517 | this.columnUtils.depthFirstDisplayedColumnTreeSearch(tree, function (child) {
|
7518 | if (child instanceof Column) {
|
7519 | columns.push(child);
|
7520 | }
|
7521 | });
|
7522 | };
|
7523 | ColumnModel.prototype.extractViewportColumns = function () {
|
7524 | if (this.suppressColumnVirtualisation) {
|
7525 |
|
7526 | this.viewportColumnsCenter = this.displayedColumnsCenter;
|
7527 | this.headerViewportColumnsCenter = this.displayedColumnsCenter;
|
7528 | }
|
7529 | else {
|
7530 |
|
7531 | this.viewportColumnsCenter = this.displayedColumnsCenter.filter(this.isColumnInRowViewport.bind(this));
|
7532 | this.headerViewportColumnsCenter = this.displayedColumnsCenter.filter(this.isColumnInHeaderViewport.bind(this));
|
7533 | }
|
7534 | this.viewportColumns = this.viewportColumnsCenter
|
7535 | .concat(this.displayedColumnsLeft)
|
7536 | .concat(this.displayedColumnsRight);
|
7537 | this.headerViewportColumns = this.headerViewportColumnsCenter
|
7538 | .concat(this.displayedColumnsLeft)
|
7539 | .concat(this.displayedColumnsRight);
|
7540 | };
|
7541 | ColumnModel.prototype.getVirtualHeaderGroupRow = function (type, dept) {
|
7542 | var result;
|
7543 | switch (type) {
|
7544 | case 'left':
|
7545 | result = this.viewportRowLeft[dept];
|
7546 | break;
|
7547 | case 'right':
|
7548 | result = this.viewportRowRight[dept];
|
7549 | break;
|
7550 | default:
|
7551 | result = this.viewportRowCenter[dept];
|
7552 | break;
|
7553 | }
|
7554 | if (missing(result)) {
|
7555 | result = [];
|
7556 | }
|
7557 | return result;
|
7558 | };
|
7559 | ColumnModel.prototype.calculateHeaderRows = function () {
|
7560 |
|
7561 |
|
7562 | this.viewportRowLeft = {};
|
7563 | this.viewportRowRight = {};
|
7564 | this.viewportRowCenter = {};
|
7565 |
|
7566 | var virtualColIds = {};
|
7567 | this.headerViewportColumns.forEach(function (col) { return virtualColIds[col.getId()] = true; });
|
7568 | var testGroup = function (children, result, dept) {
|
7569 | var returnValue = false;
|
7570 | for (var i = 0; i < children.length; i++) {
|
7571 |
|
7572 | var child = children[i];
|
7573 | var addThisItem = false;
|
7574 | if (child instanceof Column) {
|
7575 |
|
7576 | addThisItem = virtualColIds[child.getId()] === true;
|
7577 | }
|
7578 | else {
|
7579 |
|
7580 | var columnGroup = child;
|
7581 | var displayedChildren = columnGroup.getDisplayedChildren();
|
7582 | if (displayedChildren) {
|
7583 | addThisItem = testGroup(displayedChildren, result, dept + 1);
|
7584 | }
|
7585 | }
|
7586 | if (addThisItem) {
|
7587 | returnValue = true;
|
7588 | if (!result[dept]) {
|
7589 | result[dept] = [];
|
7590 | }
|
7591 | result[dept].push(child);
|
7592 | }
|
7593 | }
|
7594 | return returnValue;
|
7595 | };
|
7596 | testGroup(this.displayedTreeLeft, this.viewportRowLeft, 0);
|
7597 | testGroup(this.displayedTreeRight, this.viewportRowRight, 0);
|
7598 | testGroup(this.displayedTreeCentre, this.viewportRowCenter, 0);
|
7599 | };
|
7600 | ColumnModel.prototype.extractViewport = function () {
|
7601 | var hashColumn = function (c) { return c.getId() + "-" + (c.getPinned() || 'normal'); };
|
7602 | this.extractViewportColumns();
|
7603 | var newHash = this.viewportColumns.map(hashColumn).join('#');
|
7604 | var changed = this.viewportColumnsHash !== newHash;
|
7605 | if (changed) {
|
7606 | this.viewportColumnsHash = newHash;
|
7607 | this.calculateHeaderRows();
|
7608 | }
|
7609 | return changed;
|
7610 | };
|
7611 | ColumnModel.prototype.refreshFlexedColumns = function (params) {
|
7612 | var _this = this;
|
7613 | if (params === void 0) { params = {}; }
|
7614 | var source = params.source ? params.source : 'flex';
|
7615 | if (params.viewportWidth != null) {
|
7616 | this.flexViewportWidth = params.viewportWidth;
|
7617 | }
|
7618 | if (!this.flexViewportWidth) {
|
7619 | return [];
|
7620 | }
|
7621 |
|
7622 |
|
7623 |
|
7624 | var flexAfterDisplayIndex = -1;
|
7625 | if (params.resizingCols) {
|
7626 | params.resizingCols.forEach(function (col) {
|
7627 | var indexOfCol = _this.displayedColumnsCenter.indexOf(col);
|
7628 | if (flexAfterDisplayIndex < indexOfCol) {
|
7629 | flexAfterDisplayIndex = indexOfCol;
|
7630 | }
|
7631 | });
|
7632 | }
|
7633 | var isColFlex = function (col) {
|
7634 | var afterResizingCols = _this.displayedColumnsCenter.indexOf(col) > flexAfterDisplayIndex;
|
7635 | return col.getFlex() && afterResizingCols;
|
7636 | };
|
7637 | var knownWidthColumns = this.displayedColumnsCenter.filter(function (col) { return !isColFlex(col); });
|
7638 | var flexingColumns = this.displayedColumnsCenter.filter(function (col) { return isColFlex(col); });
|
7639 | var changedColumns = [];
|
7640 | if (!flexingColumns.length) {
|
7641 | return [];
|
7642 | }
|
7643 | var flexingColumnSizes = [];
|
7644 | var spaceForFlexingColumns;
|
7645 | outer: while (true) {
|
7646 | var totalFlex = flexingColumns.reduce(function (count, col) { return count + col.getFlex(); }, 0);
|
7647 | spaceForFlexingColumns = this.flexViewportWidth - this.getWidthOfColsInList(knownWidthColumns);
|
7648 | for (var i = 0; i < flexingColumns.length; i++) {
|
7649 | var col = flexingColumns[i];
|
7650 | var widthByFlexRule = spaceForFlexingColumns * col.getFlex() / totalFlex;
|
7651 | var constrainedWidth = 0;
|
7652 | var minWidth = col.getMinWidth();
|
7653 | var maxWidth = col.getMaxWidth();
|
7654 | if (exists(minWidth) && widthByFlexRule < minWidth) {
|
7655 | constrainedWidth = minWidth;
|
7656 | }
|
7657 | else if (exists(maxWidth) && widthByFlexRule > maxWidth) {
|
7658 | constrainedWidth = maxWidth;
|
7659 | }
|
7660 | if (constrainedWidth) {
|
7661 |
|
7662 |
|
7663 | col.setActualWidth(constrainedWidth, source);
|
7664 | removeFromArray(flexingColumns, col);
|
7665 | changedColumns.push(col);
|
7666 | knownWidthColumns.push(col);
|
7667 | continue outer;
|
7668 | }
|
7669 | flexingColumnSizes[i] = Math.round(widthByFlexRule);
|
7670 | }
|
7671 | break;
|
7672 | }
|
7673 | var remainingSpace = spaceForFlexingColumns;
|
7674 | flexingColumns.forEach(function (col, i) {
|
7675 | col.setActualWidth(Math.min(flexingColumnSizes[i], remainingSpace), source);
|
7676 | changedColumns.push(col);
|
7677 | remainingSpace -= flexingColumnSizes[i];
|
7678 | });
|
7679 | if (!params.skipSetLeft) {
|
7680 | this.setLeftValues(source);
|
7681 | }
|
7682 | if (params.updateBodyWidths) {
|
7683 | this.updateBodyWidths();
|
7684 | }
|
7685 | if (params.fireResizedEvent) {
|
7686 | this.dispatchColumnResizedEvent(changedColumns, true, source, flexingColumns);
|
7687 | }
|
7688 |
|
7689 |
|
7690 |
|
7691 |
|
7692 |
|
7693 |
|
7694 | if (!this.flexColsCalculatedAtLestOnce) {
|
7695 | if (this.gridOptionsService.isRowModelType('clientSide')) {
|
7696 | this.rowModel.resetRowHeights();
|
7697 | }
|
7698 | this.flexColsCalculatedAtLestOnce = true;
|
7699 | }
|
7700 | return flexingColumns;
|
7701 | };
|
7702 |
|
7703 | ColumnModel.prototype.sizeColumnsToFit = function (gridWidth, source, silent, params) {
|
7704 | var _a, _b, _c, _d, _e;
|
7705 | if (source === void 0) { source = "sizeColumnsToFit"; }
|
7706 | var limitsMap = {};
|
7707 | if (params) {
|
7708 | (_a = params === null || params === void 0 ? void 0 : params.columnLimits) === null || _a === void 0 ? void 0 : _a.forEach(function (_a) {
|
7709 | var key = _a.key, dimensions = __rest(_a, ["key"]);
|
7710 | limitsMap[typeof key === 'string' ? key : key.getColId()] = dimensions;
|
7711 | });
|
7712 | }
|
7713 |
|
7714 | var allDisplayedColumns = this.getAllDisplayedColumns();
|
7715 | var doColumnsAlreadyFit = gridWidth === this.getWidthOfColsInList(allDisplayedColumns);
|
7716 | if (gridWidth <= 0 || !allDisplayedColumns.length || doColumnsAlreadyFit) {
|
7717 | return;
|
7718 | }
|
7719 | var colsToSpread = [];
|
7720 | var colsToNotSpread = [];
|
7721 | allDisplayedColumns.forEach(function (column) {
|
7722 | if (column.getColDef().suppressSizeToFit === true) {
|
7723 | colsToNotSpread.push(column);
|
7724 | }
|
7725 | else {
|
7726 | colsToSpread.push(column);
|
7727 | }
|
7728 | });
|
7729 |
|
7730 | var colsToDispatchEventFor = colsToSpread.slice(0);
|
7731 | var finishedResizing = false;
|
7732 | var moveToNotSpread = function (column) {
|
7733 | removeFromArray(colsToSpread, column);
|
7734 | colsToNotSpread.push(column);
|
7735 | };
|
7736 |
|
7737 |
|
7738 |
|
7739 |
|
7740 |
|
7741 |
|
7742 |
|
7743 |
|
7744 | colsToSpread.forEach(function (column) { return column.resetActualWidth(source); });
|
7745 | while (!finishedResizing) {
|
7746 | finishedResizing = true;
|
7747 | var availablePixels = gridWidth - this.getWidthOfColsInList(colsToNotSpread);
|
7748 | if (availablePixels <= 0) {
|
7749 |
|
7750 | colsToSpread.forEach(function (column) {
|
7751 | var _a, _b;
|
7752 | var widthOverride = (_b = (_a = limitsMap === null || limitsMap === void 0 ? void 0 : limitsMap[column.getId()]) === null || _a === void 0 ? void 0 : _a.minWidth) !== null && _b !== void 0 ? _b : params === null || params === void 0 ? void 0 : params.defaultMinWidth;
|
7753 | if (typeof widthOverride === 'number') {
|
7754 | column.setActualWidth(widthOverride);
|
7755 | return;
|
7756 | }
|
7757 | column.setMinimum(source);
|
7758 | });
|
7759 | }
|
7760 | else {
|
7761 | var scale = availablePixels / this.getWidthOfColsInList(colsToSpread);
|
7762 |
|
7763 |
|
7764 | var pixelsForLastCol = availablePixels;
|
7765 |
|
7766 | for (var i = colsToSpread.length - 1; i >= 0; i--) {
|
7767 | var column = colsToSpread[i];
|
7768 | var widthOverride = limitsMap === null || limitsMap === void 0 ? void 0 : limitsMap[column.getId()];
|
7769 | var minOverride = ((_b = widthOverride === null || widthOverride === void 0 ? void 0 : widthOverride.minWidth) !== null && _b !== void 0 ? _b : params === null || params === void 0 ? void 0 : params.defaultMinWidth);
|
7770 | var maxOverride = ((_c = widthOverride === null || widthOverride === void 0 ? void 0 : widthOverride.maxWidth) !== null && _c !== void 0 ? _c : params === null || params === void 0 ? void 0 : params.defaultMaxWidth);
|
7771 | var colMinWidth = (_d = column.getMinWidth()) !== null && _d !== void 0 ? _d : 0;
|
7772 | var colMaxWidth = (_e = column.getMaxWidth()) !== null && _e !== void 0 ? _e : Number.MAX_VALUE;
|
7773 | var minWidth = typeof minOverride === 'number' && minOverride > colMinWidth ? minOverride : column.getMinWidth();
|
7774 | var maxWidth = typeof maxOverride === 'number' && maxOverride < colMaxWidth ? maxOverride : column.getMaxWidth();
|
7775 | var newWidth = Math.round(column.getActualWidth() * scale);
|
7776 | if (exists(minWidth) && newWidth < minWidth) {
|
7777 | newWidth = minWidth;
|
7778 | moveToNotSpread(column);
|
7779 | finishedResizing = false;
|
7780 | }
|
7781 | else if (exists(maxWidth) && newWidth > maxWidth) {
|
7782 | newWidth = maxWidth;
|
7783 | moveToNotSpread(column);
|
7784 | finishedResizing = false;
|
7785 | }
|
7786 | else if (i === 0) {
|
7787 | newWidth = pixelsForLastCol;
|
7788 | }
|
7789 | column.setActualWidth(newWidth, source, true);
|
7790 | pixelsForLastCol -= newWidth;
|
7791 | }
|
7792 | }
|
7793 | }
|
7794 |
|
7795 | colsToDispatchEventFor.forEach(function (col) {
|
7796 | col.fireColumnWidthChangedEvent(source);
|
7797 | });
|
7798 | this.setLeftValues(source);
|
7799 | this.updateBodyWidths();
|
7800 | if (silent) {
|
7801 | return;
|
7802 | }
|
7803 | this.dispatchColumnResizedEvent(colsToDispatchEventFor, true, source);
|
7804 | };
|
7805 | ColumnModel.prototype.buildDisplayedTrees = function (visibleColumns) {
|
7806 | var leftVisibleColumns = [];
|
7807 | var rightVisibleColumns = [];
|
7808 | var centerVisibleColumns = [];
|
7809 | visibleColumns.forEach(function (column) {
|
7810 | switch (column.getPinned()) {
|
7811 | case "left":
|
7812 | leftVisibleColumns.push(column);
|
7813 | break;
|
7814 | case "right":
|
7815 | rightVisibleColumns.push(column);
|
7816 | break;
|
7817 | default:
|
7818 | centerVisibleColumns.push(column);
|
7819 | break;
|
7820 | }
|
7821 | });
|
7822 | var groupInstanceIdCreator = new GroupInstanceIdCreator();
|
7823 | this.displayedTreeLeft = this.displayedGroupCreator.createDisplayedGroups(leftVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, 'left', this.displayedTreeLeft);
|
7824 | this.displayedTreeRight = this.displayedGroupCreator.createDisplayedGroups(rightVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, 'right', this.displayedTreeRight);
|
7825 | this.displayedTreeCentre = this.displayedGroupCreator.createDisplayedGroups(centerVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, null, this.displayedTreeCentre);
|
7826 | this.updateDisplayedMap();
|
7827 | };
|
7828 | ColumnModel.prototype.updateDisplayedMap = function () {
|
7829 | var _this = this;
|
7830 | this.displayedColumnsAndGroupsMap = {};
|
7831 | var func = function (child) {
|
7832 | _this.displayedColumnsAndGroupsMap[child.getUniqueId()] = child;
|
7833 | };
|
7834 | this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeCentre, func);
|
7835 | this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeLeft, func);
|
7836 | this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeRight, func);
|
7837 | };
|
7838 | ColumnModel.prototype.isDisplayed = function (item) {
|
7839 | var fromMap = this.displayedColumnsAndGroupsMap[item.getUniqueId()];
|
7840 |
|
7841 | return fromMap === item;
|
7842 | };
|
7843 | ColumnModel.prototype.updateOpenClosedVisibilityInColumnGroups = function () {
|
7844 | var allColumnGroups = this.getAllDisplayedTrees();
|
7845 | this.columnUtils.depthFirstAllColumnTreeSearch(allColumnGroups, function (child) {
|
7846 | if (child instanceof ColumnGroup) {
|
7847 | var columnGroup = child;
|
7848 | columnGroup.calculateDisplayedColumns();
|
7849 | }
|
7850 | });
|
7851 | };
|
7852 | ColumnModel.prototype.getGroupAutoColumns = function () {
|
7853 | return this.groupAutoColumns;
|
7854 | };
|
7855 | |
7856 |
|
7857 |
|
7858 |
|
7859 | ColumnModel.prototype.createGroupAutoColumnsIfNeeded = function () {
|
7860 | if (!this.autoGroupsNeedBuilding) {
|
7861 | return false;
|
7862 | }
|
7863 | this.autoGroupsNeedBuilding = false;
|
7864 | var groupFullWidthRow = this.gridOptionsService.isGroupUseEntireRow(this.pivotMode);
|
7865 |
|
7866 |
|
7867 |
|
7868 |
|
7869 |
|
7870 |
|
7871 | var suppressAutoColumn = this.pivotMode ?
|
7872 | this.gridOptionsService.is('pivotSuppressAutoColumn') : this.isGroupSuppressAutoColumn();
|
7873 | var groupingActive = this.rowGroupColumns.length > 0 || this.usingTreeData;
|
7874 | var needAutoColumns = groupingActive && !suppressAutoColumn && !groupFullWidthRow;
|
7875 | if (needAutoColumns) {
|
7876 | var existingCols = this.groupAutoColumns || [];
|
7877 | var newAutoGroupCols = this.autoGroupColService.createAutoGroupColumns(existingCols, this.rowGroupColumns);
|
7878 | var autoColsDifferent = !this.autoColsEqual(newAutoGroupCols, this.groupAutoColumns);
|
7879 |
|
7880 |
|
7881 | if (autoColsDifferent || this.forceRecreateAutoGroups) {
|
7882 | this.groupAutoColumns = newAutoGroupCols;
|
7883 | return true;
|
7884 | }
|
7885 | }
|
7886 | else {
|
7887 | this.groupAutoColumns = null;
|
7888 | }
|
7889 | return false;
|
7890 | };
|
7891 | ColumnModel.prototype.isGroupSuppressAutoColumn = function () {
|
7892 | var groupDisplayType = this.gridOptionsService.get('groupDisplayType');
|
7893 | var isCustomRowGroups = groupDisplayType ? matchesGroupDisplayType('custom', groupDisplayType) : false;
|
7894 | if (isCustomRowGroups) {
|
7895 | return true;
|
7896 | }
|
7897 | var treeDataDisplayType = this.gridOptionsService.get('treeDataDisplayType');
|
7898 | return treeDataDisplayType ? matchesTreeDataDisplayType('custom', treeDataDisplayType) : false;
|
7899 | };
|
7900 | ColumnModel.prototype.autoColsEqual = function (colsA, colsB) {
|
7901 | return areEqual(colsA, colsB, function (a, b) { return a.getColId() === b.getColId(); });
|
7902 | };
|
7903 | ColumnModel.prototype.getWidthOfColsInList = function (columnList) {
|
7904 | return columnList.reduce(function (width, col) { return width + col.getActualWidth(); }, 0);
|
7905 | };
|
7906 | ColumnModel.prototype.getGridBalancedTree = function () {
|
7907 | return this.gridBalancedTree;
|
7908 | };
|
7909 | ColumnModel.prototype.hasFloatingFilters = function () {
|
7910 | if (!this.gridColumns) {
|
7911 | return false;
|
7912 | }
|
7913 | var res = this.gridColumns.some(function (col) { return col.getColDef().floatingFilter; });
|
7914 | return res;
|
7915 | };
|
7916 | ColumnModel.prototype.getFirstDisplayedColumn = function () {
|
7917 | var isRtl = this.gridOptionsService.is('enableRtl');
|
7918 | var queryOrder = [
|
7919 | 'getDisplayedLeftColumns',
|
7920 | 'getDisplayedCenterColumns',
|
7921 | 'getDisplayedRightColumns'
|
7922 | ];
|
7923 | if (isRtl) {
|
7924 | queryOrder.reverse();
|
7925 | }
|
7926 | for (var i = 0; i < queryOrder.length; i++) {
|
7927 | var container = this[queryOrder[i]]();
|
7928 | if (container.length) {
|
7929 | return isRtl ? last(container) : container[0];
|
7930 | }
|
7931 | }
|
7932 | return null;
|
7933 | };
|
7934 | ColumnModel.prototype.setColumnHeaderHeight = function (col, height) {
|
7935 | var changed = col.setAutoHeaderHeight(height);
|
7936 | if (changed) {
|
7937 | var event_5 = {
|
7938 | type: Events.EVENT_COLUMN_HEADER_HEIGHT_CHANGED,
|
7939 | column: col,
|
7940 | columns: [col],
|
7941 | source: 'autosizeColumnHeaderHeight',
|
7942 | };
|
7943 | this.eventService.dispatchEvent(event_5);
|
7944 | }
|
7945 | };
|
7946 | ColumnModel.prototype.getColumnGroupHeaderRowHeight = function () {
|
7947 | if (this.isPivotMode()) {
|
7948 | return this.getPivotGroupHeaderHeight();
|
7949 | }
|
7950 | return this.getGroupHeaderHeight();
|
7951 | };
|
7952 | ColumnModel.prototype.getColumnHeaderRowHeight = function () {
|
7953 | var defaultHeight = (this.isPivotMode() ?
|
7954 | this.getPivotHeaderHeight() :
|
7955 | this.getHeaderHeight());
|
7956 | var displayedHeights = this.getAllDisplayedColumns()
|
7957 | .filter(function (col) { return col.isAutoHeaderHeight(); })
|
7958 | .map(function (col) { return col.getAutoHeaderHeight() || 0; });
|
7959 | return Math.max.apply(Math, __spread$k([defaultHeight], displayedHeights));
|
7960 | };
|
7961 | ColumnModel.prototype.getHeaderHeight = function () {
|
7962 | var _a;
|
7963 | return (_a = this.gridOptionsService.getNum('headerHeight')) !== null && _a !== void 0 ? _a : this.environment.getFromTheme(25, 'headerHeight');
|
7964 | };
|
7965 | ColumnModel.prototype.getFloatingFiltersHeight = function () {
|
7966 | var _a;
|
7967 | return (_a = this.gridOptionsService.getNum('floatingFiltersHeight')) !== null && _a !== void 0 ? _a : this.getHeaderHeight();
|
7968 | };
|
7969 | ColumnModel.prototype.getGroupHeaderHeight = function () {
|
7970 | var _a;
|
7971 | return (_a = this.gridOptionsService.getNum('groupHeaderHeight')) !== null && _a !== void 0 ? _a : this.getHeaderHeight();
|
7972 | };
|
7973 | ColumnModel.prototype.getPivotHeaderHeight = function () {
|
7974 | var _a;
|
7975 | return (_a = this.gridOptionsService.getNum('pivotHeaderHeight')) !== null && _a !== void 0 ? _a : this.getHeaderHeight();
|
7976 | };
|
7977 | ColumnModel.prototype.getPivotGroupHeaderHeight = function () {
|
7978 | var _a;
|
7979 | return (_a = this.gridOptionsService.getNum('pivotGroupHeaderHeight')) !== null && _a !== void 0 ? _a : this.getGroupHeaderHeight();
|
7980 | };
|
7981 | __decorate$2r([
|
7982 | Autowired('expressionService')
|
7983 | ], ColumnModel.prototype, "expressionService", void 0);
|
7984 | __decorate$2r([
|
7985 | Autowired('columnFactory')
|
7986 | ], ColumnModel.prototype, "columnFactory", void 0);
|
7987 | __decorate$2r([
|
7988 | Autowired('displayedGroupCreator')
|
7989 | ], ColumnModel.prototype, "displayedGroupCreator", void 0);
|
7990 | __decorate$2r([
|
7991 | Autowired('ctrlsService')
|
7992 | ], ColumnModel.prototype, "ctrlsService", void 0);
|
7993 | __decorate$2r([
|
7994 | Autowired('autoWidthCalculator')
|
7995 | ], ColumnModel.prototype, "autoWidthCalculator", void 0);
|
7996 | __decorate$2r([
|
7997 | Autowired('columnUtils')
|
7998 | ], ColumnModel.prototype, "columnUtils", void 0);
|
7999 | __decorate$2r([
|
8000 | Autowired('columnAnimationService')
|
8001 | ], ColumnModel.prototype, "columnAnimationService", void 0);
|
8002 | __decorate$2r([
|
8003 | Autowired('autoGroupColService')
|
8004 | ], ColumnModel.prototype, "autoGroupColService", void 0);
|
8005 | __decorate$2r([
|
8006 | Optional('aggFuncService')
|
8007 | ], ColumnModel.prototype, "aggFuncService", void 0);
|
8008 | __decorate$2r([
|
8009 | Optional('valueCache')
|
8010 | ], ColumnModel.prototype, "valueCache", void 0);
|
8011 | __decorate$2r([
|
8012 | Optional('animationFrameService')
|
8013 | ], ColumnModel.prototype, "animationFrameService", void 0);
|
8014 | __decorate$2r([
|
8015 | Autowired('rowModel')
|
8016 | ], ColumnModel.prototype, "rowModel", void 0);
|
8017 | __decorate$2r([
|
8018 | Autowired('sortController')
|
8019 | ], ColumnModel.prototype, "sortController", void 0);
|
8020 | __decorate$2r([
|
8021 | Autowired('columnDefFactory')
|
8022 | ], ColumnModel.prototype, "columnDefFactory", void 0);
|
8023 | __decorate$2r([
|
8024 | PostConstruct
|
8025 | ], ColumnModel.prototype, "init", null);
|
8026 | __decorate$2r([
|
8027 | PreDestroy
|
8028 | ], ColumnModel.prototype, "destroyColumns", null);
|
8029 | __decorate$2r([
|
8030 | __param$8(0, Qualifier('loggerFactory'))
|
8031 | ], ColumnModel.prototype, "setBeans", null);
|
8032 | ColumnModel = __decorate$2r([
|
8033 | Bean('columnModel')
|
8034 | ], ColumnModel);
|
8035 | return ColumnModel;
|
8036 | }(BeanStub));
|
8037 |
|
8038 |
|
8039 |
|
8040 |
|
8041 |
|
8042 |
|
8043 |
|
8044 | var __extends$2P = (undefined && undefined.__extends) || (function () {
|
8045 | var extendStatics = function (d, b) {
|
8046 | extendStatics = Object.setPrototypeOf ||
|
8047 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
8048 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
8049 | return extendStatics(d, b);
|
8050 | };
|
8051 | return function (d, b) {
|
8052 | extendStatics(d, b);
|
8053 | function __() { this.constructor = d; }
|
8054 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
8055 | };
|
8056 | })();
|
8057 | var __decorate$2q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
8058 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
8059 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
8060 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
8061 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
8062 | };
|
8063 |
|
8064 | var ColumnUtils = (function (_super) {
|
8065 | __extends$2P(ColumnUtils, _super);
|
8066 | function ColumnUtils() {
|
8067 | return _super !== null && _super.apply(this, arguments) || this;
|
8068 | }
|
8069 | ColumnUtils.prototype.calculateColMinWidth = function (colDef) {
|
8070 | return colDef.minWidth != null ? colDef.minWidth : this.environment.getMinColWidth();
|
8071 | };
|
8072 | ColumnUtils.prototype.calculateColMaxWidth = function (colDef) {
|
8073 | return colDef.maxWidth != null ? colDef.maxWidth : Number.MAX_SAFE_INTEGER;
|
8074 | };
|
8075 | ColumnUtils.prototype.calculateColInitialWidth = function (colDef) {
|
8076 | var minColWidth = this.calculateColMinWidth(colDef);
|
8077 | var maxColWidth = this.calculateColMaxWidth(colDef);
|
8078 | var width;
|
8079 | var colDefWidth = attrToNumber(colDef.width);
|
8080 | var colDefInitialWidth = attrToNumber(colDef.initialWidth);
|
8081 | if (colDefWidth != null) {
|
8082 | width = colDefWidth;
|
8083 | }
|
8084 | else if (colDefInitialWidth != null) {
|
8085 | width = colDefInitialWidth;
|
8086 | }
|
8087 | else {
|
8088 | width = 200;
|
8089 | }
|
8090 | return Math.max(Math.min(width, maxColWidth), minColWidth);
|
8091 | };
|
8092 | ColumnUtils.prototype.getOriginalPathForColumn = function (column, originalBalancedTree) {
|
8093 | var result = [];
|
8094 | var found = false;
|
8095 | var recursePath = function (balancedColumnTree, dept) {
|
8096 | for (var i = 0; i < balancedColumnTree.length; i++) {
|
8097 | if (found) {
|
8098 | return;
|
8099 | }
|
8100 |
|
8101 | var node = balancedColumnTree[i];
|
8102 | if (node instanceof ProvidedColumnGroup) {
|
8103 | var nextNode = node;
|
8104 | recursePath(nextNode.getChildren(), dept + 1);
|
8105 | result[dept] = node;
|
8106 | }
|
8107 | else if (node === column) {
|
8108 | found = true;
|
8109 | }
|
8110 | }
|
8111 | };
|
8112 | recursePath(originalBalancedTree, 0);
|
8113 |
|
8114 |
|
8115 | return found ? result : null;
|
8116 | };
|
8117 | ColumnUtils.prototype.depthFirstOriginalTreeSearch = function (parent, tree, callback) {
|
8118 | var _this = this;
|
8119 | if (!tree) {
|
8120 | return;
|
8121 | }
|
8122 | tree.forEach(function (child) {
|
8123 | if (child instanceof ProvidedColumnGroup) {
|
8124 | _this.depthFirstOriginalTreeSearch(child, child.getChildren(), callback);
|
8125 | }
|
8126 | callback(child, parent);
|
8127 | });
|
8128 | };
|
8129 | ColumnUtils.prototype.depthFirstAllColumnTreeSearch = function (tree, callback) {
|
8130 | var _this = this;
|
8131 | if (!tree) {
|
8132 | return;
|
8133 | }
|
8134 | tree.forEach(function (child) {
|
8135 | if (child instanceof ColumnGroup) {
|
8136 | _this.depthFirstAllColumnTreeSearch(child.getChildren(), callback);
|
8137 | }
|
8138 | callback(child);
|
8139 | });
|
8140 | };
|
8141 | ColumnUtils.prototype.depthFirstDisplayedColumnTreeSearch = function (tree, callback) {
|
8142 | var _this = this;
|
8143 | if (!tree) {
|
8144 | return;
|
8145 | }
|
8146 | tree.forEach(function (child) {
|
8147 | if (child instanceof ColumnGroup) {
|
8148 | _this.depthFirstDisplayedColumnTreeSearch(child.getDisplayedChildren(), callback);
|
8149 | }
|
8150 | callback(child);
|
8151 | });
|
8152 | };
|
8153 | ColumnUtils = __decorate$2q([
|
8154 | Bean('columnUtils')
|
8155 | ], ColumnUtils);
|
8156 | return ColumnUtils;
|
8157 | }(BeanStub));
|
8158 |
|
8159 |
|
8160 |
|
8161 |
|
8162 |
|
8163 |
|
8164 |
|
8165 | var __extends$2O = (undefined && undefined.__extends) || (function () {
|
8166 | var extendStatics = function (d, b) {
|
8167 | extendStatics = Object.setPrototypeOf ||
|
8168 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
8169 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
8170 | return extendStatics(d, b);
|
8171 | };
|
8172 | return function (d, b) {
|
8173 | extendStatics(d, b);
|
8174 | function __() { this.constructor = d; }
|
8175 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
8176 | };
|
8177 | })();
|
8178 | var __decorate$2p = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
8179 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
8180 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
8181 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
8182 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
8183 | };
|
8184 |
|
8185 | var DisplayedGroupCreator = (function (_super) {
|
8186 | __extends$2O(DisplayedGroupCreator, _super);
|
8187 | function DisplayedGroupCreator() {
|
8188 | return _super !== null && _super.apply(this, arguments) || this;
|
8189 | }
|
8190 | DisplayedGroupCreator.prototype.createDisplayedGroups = function (
|
8191 | // all displayed columns sorted - this is the columns the grid should show
|
8192 | sortedVisibleColumns,
|
8193 | // the tree of columns, as provided by the users, used to know what groups columns roll up into
|
8194 | balancedColumnTree,
|
8195 | // creates unique id's for the group
|
8196 | groupInstanceIdCreator,
|
8197 |
|
8198 | pinned,
|
8199 |
|
8200 | oldDisplayedGroups) {
|
8201 | var _this = this;
|
8202 | var result = [];
|
8203 | var previousRealPath;
|
8204 | var previousOriginalPath;
|
8205 | var oldColumnsMapped = this.mapOldGroupsById(oldDisplayedGroups);
|
8206 |
|
8207 |
|
8208 | sortedVisibleColumns.forEach(function (currentColumn) {
|
8209 | var currentOriginalPath = _this.getOriginalPathForColumn(balancedColumnTree, currentColumn);
|
8210 | var currentRealPath = [];
|
8211 | var firstColumn = !previousOriginalPath;
|
8212 | for (var i = 0; i < currentOriginalPath.length; i++) {
|
8213 | if (firstColumn || currentOriginalPath[i] !== previousOriginalPath[i]) {
|
8214 |
|
8215 | var newGroup = _this.createColumnGroup(currentOriginalPath[i], groupInstanceIdCreator, oldColumnsMapped, pinned);
|
8216 | currentRealPath[i] = newGroup;
|
8217 |
|
8218 | if (i == 0) {
|
8219 | result.push(newGroup);
|
8220 | }
|
8221 | else {
|
8222 | currentRealPath[i - 1].addChild(newGroup);
|
8223 | }
|
8224 | }
|
8225 | else {
|
8226 |
|
8227 | currentRealPath[i] = previousRealPath[i];
|
8228 | }
|
8229 | }
|
8230 | var noColumnGroups = currentRealPath.length === 0;
|
8231 | if (noColumnGroups) {
|
8232 |
|
8233 |
|
8234 | result.push(currentColumn);
|
8235 | }
|
8236 | else {
|
8237 | var leafGroup = last(currentRealPath);
|
8238 | leafGroup.addChild(currentColumn);
|
8239 | }
|
8240 | previousRealPath = currentRealPath;
|
8241 | previousOriginalPath = currentOriginalPath;
|
8242 | });
|
8243 | this.setupParentsIntoColumns(result, null);
|
8244 | return result;
|
8245 | };
|
8246 | DisplayedGroupCreator.prototype.createColumnGroup = function (providedGroup, groupInstanceIdCreator, oldColumnsMapped, pinned) {
|
8247 | var groupId = providedGroup.getGroupId();
|
8248 | var instanceId = groupInstanceIdCreator.getInstanceIdForKey(groupId);
|
8249 | var uniqueId = ColumnGroup.createUniqueId(groupId, instanceId);
|
8250 | var columnGroup = oldColumnsMapped[uniqueId];
|
8251 |
|
8252 |
|
8253 |
|
8254 | if (columnGroup && columnGroup.getProvidedColumnGroup() !== providedGroup) {
|
8255 | columnGroup = null;
|
8256 | }
|
8257 | if (exists(columnGroup)) {
|
8258 |
|
8259 | columnGroup.reset();
|
8260 | }
|
8261 | else {
|
8262 | columnGroup = new ColumnGroup(providedGroup, groupId, instanceId, pinned);
|
8263 | this.context.createBean(columnGroup);
|
8264 | }
|
8265 | return columnGroup;
|
8266 | };
|
8267 |
|
8268 | DisplayedGroupCreator.prototype.mapOldGroupsById = function (displayedGroups) {
|
8269 | var result = {};
|
8270 | var recursive = function (columnsOrGroups) {
|
8271 | columnsOrGroups.forEach(function (columnOrGroup) {
|
8272 | if (columnOrGroup instanceof ColumnGroup) {
|
8273 | var columnGroup = columnOrGroup;
|
8274 | result[columnOrGroup.getUniqueId()] = columnGroup;
|
8275 | recursive(columnGroup.getChildren());
|
8276 | }
|
8277 | });
|
8278 | };
|
8279 | if (displayedGroups) {
|
8280 | recursive(displayedGroups);
|
8281 | }
|
8282 | return result;
|
8283 | };
|
8284 | DisplayedGroupCreator.prototype.setupParentsIntoColumns = function (columnsOrGroups, parent) {
|
8285 | var _this = this;
|
8286 | columnsOrGroups.forEach(function (columnsOrGroup) {
|
8287 | columnsOrGroup.setParent(parent);
|
8288 | if (columnsOrGroup instanceof ColumnGroup) {
|
8289 | var columnGroup = columnsOrGroup;
|
8290 | _this.setupParentsIntoColumns(columnGroup.getChildren(), columnGroup);
|
8291 | }
|
8292 | });
|
8293 | };
|
8294 | DisplayedGroupCreator.prototype.getOriginalPathForColumn = function (balancedColumnTree, column) {
|
8295 | var result = [];
|
8296 | var found = false;
|
8297 | var recursePath = function (columnTree, dept) {
|
8298 | for (var i = 0; i < columnTree.length; i++) {
|
8299 |
|
8300 | if (found) {
|
8301 | return;
|
8302 | }
|
8303 | var node = columnTree[i];
|
8304 | if (node instanceof ProvidedColumnGroup) {
|
8305 | recursePath(node.getChildren(), dept + 1);
|
8306 | result[dept] = node;
|
8307 | }
|
8308 | else if (node === column) {
|
8309 | found = true;
|
8310 | }
|
8311 | }
|
8312 | };
|
8313 | recursePath(balancedColumnTree, 0);
|
8314 |
|
8315 |
|
8316 |
|
8317 | if (found) {
|
8318 | return result;
|
8319 | }
|
8320 | console.warn('AG Grid: could not get path');
|
8321 | return null;
|
8322 | };
|
8323 | DisplayedGroupCreator = __decorate$2p([
|
8324 | Bean('displayedGroupCreator')
|
8325 | ], DisplayedGroupCreator);
|
8326 | return DisplayedGroupCreator;
|
8327 | }(BeanStub));
|
8328 |
|
8329 |
|
8330 |
|
8331 |
|
8332 |
|
8333 |
|
8334 |
|
8335 | var __extends$2N = (undefined && undefined.__extends) || (function () {
|
8336 | var extendStatics = function (d, b) {
|
8337 | extendStatics = Object.setPrototypeOf ||
|
8338 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
8339 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
8340 | return extendStatics(d, b);
|
8341 | };
|
8342 | return function (d, b) {
|
8343 | extendStatics(d, b);
|
8344 | function __() { this.constructor = d; }
|
8345 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
8346 | };
|
8347 | })();
|
8348 | var __decorate$2o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
8349 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
8350 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
8351 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
8352 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
8353 | };
|
8354 | var AgStackComponentsRegistry = (function (_super) {
|
8355 | __extends$2N(AgStackComponentsRegistry, _super);
|
8356 | function AgStackComponentsRegistry() {
|
8357 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
8358 | _this.componentsMappedByName = {};
|
8359 | return _this;
|
8360 | }
|
8361 | AgStackComponentsRegistry.prototype.setupComponents = function (components) {
|
8362 | var _this = this;
|
8363 | if (components) {
|
8364 | components.forEach(function (componentMeta) { return _this.addComponent(componentMeta); });
|
8365 | }
|
8366 | };
|
8367 | AgStackComponentsRegistry.prototype.addComponent = function (componentMeta) {
|
8368 |
|
8369 |
|
8370 |
|
8371 | var classEscaped = componentMeta.componentName.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
8372 |
|
8373 | var classUpperCase = classEscaped.toUpperCase();
|
8374 |
|
8375 | this.componentsMappedByName[classUpperCase] = componentMeta.componentClass;
|
8376 | };
|
8377 | AgStackComponentsRegistry.prototype.getComponentClass = function (htmlTag) {
|
8378 | return this.componentsMappedByName[htmlTag];
|
8379 | };
|
8380 | AgStackComponentsRegistry = __decorate$2o([
|
8381 | Bean('agStackComponentsRegistry')
|
8382 | ], AgStackComponentsRegistry);
|
8383 | return AgStackComponentsRegistry;
|
8384 | }(BeanStub));
|
8385 |
|
8386 |
|
8387 |
|
8388 |
|
8389 |
|
8390 |
|
8391 |
|
8392 |
|
8393 | function toggleAriaAttribute(element, attribute, value) {
|
8394 | if (value == null || value == '') {
|
8395 | removeAriaAttribute(element, attribute);
|
8396 | }
|
8397 | else {
|
8398 | setAriaAttribute(element, attribute, value);
|
8399 | }
|
8400 | }
|
8401 | function setAriaAttribute(element, attribute, value) {
|
8402 | element.setAttribute(ariaAttributeName(attribute), value.toString());
|
8403 | }
|
8404 | function removeAriaAttribute(element, attribute) {
|
8405 | element.removeAttribute(ariaAttributeName(attribute));
|
8406 | }
|
8407 | function ariaAttributeName(attribute) {
|
8408 | return "aria-" + attribute;
|
8409 | }
|
8410 | function setAriaRole(element, role) {
|
8411 | if (role) {
|
8412 | element.setAttribute('role', role);
|
8413 | }
|
8414 | else {
|
8415 | element.removeAttribute('role');
|
8416 | }
|
8417 | }
|
8418 | function getAriaSortState(sortDirection) {
|
8419 | var sort;
|
8420 | if (sortDirection === 'asc') {
|
8421 | sort = 'ascending';
|
8422 | }
|
8423 | else if (sortDirection === 'desc') {
|
8424 | sort = 'descending';
|
8425 | }
|
8426 | else if (sortDirection === 'mixed') {
|
8427 | sort = 'other';
|
8428 | }
|
8429 | else {
|
8430 | sort = 'none';
|
8431 | }
|
8432 | return sort;
|
8433 | }
|
8434 |
|
8435 | function getAriaLevel(element) {
|
8436 | return parseInt(element.getAttribute('aria-level'), 10);
|
8437 | }
|
8438 | function getAriaPosInSet(element) {
|
8439 | return parseInt(element.getAttribute('aria-posinset'), 10);
|
8440 | }
|
8441 | function getAriaDescribedBy(element) {
|
8442 | return element.getAttribute('aria-describedby') || '';
|
8443 | }
|
8444 |
|
8445 | function setAriaLabel(element, label) {
|
8446 | toggleAriaAttribute(element, 'label', label);
|
8447 | }
|
8448 | function setAriaLabelledBy(element, labelledBy) {
|
8449 | toggleAriaAttribute(element, 'labelledby', labelledBy);
|
8450 | }
|
8451 | function setAriaDescription(element, description) {
|
8452 | toggleAriaAttribute(element, 'description', description);
|
8453 | }
|
8454 | function setAriaDescribedBy(element, describedby) {
|
8455 | toggleAriaAttribute(element, 'describedby', describedby);
|
8456 | }
|
8457 | function setAriaLive(element, live) {
|
8458 | toggleAriaAttribute(element, 'live', live);
|
8459 | }
|
8460 | function setAriaLevel(element, level) {
|
8461 | toggleAriaAttribute(element, 'level', level);
|
8462 | }
|
8463 | function setAriaDisabled(element, disabled) {
|
8464 | toggleAriaAttribute(element, 'disabled', disabled);
|
8465 | }
|
8466 | function setAriaHidden(element, hidden) {
|
8467 | toggleAriaAttribute(element, 'hidden', hidden);
|
8468 | }
|
8469 | function setAriaExpanded(element, expanded) {
|
8470 | setAriaAttribute(element, 'expanded', expanded);
|
8471 | }
|
8472 | function removeAriaExpanded(element) {
|
8473 | removeAriaAttribute(element, 'expanded');
|
8474 | }
|
8475 | function setAriaSetSize(element, setsize) {
|
8476 | setAriaAttribute(element, 'setsize', setsize);
|
8477 | }
|
8478 | function setAriaPosInSet(element, position) {
|
8479 | setAriaAttribute(element, 'posinset', position);
|
8480 | }
|
8481 | function setAriaMultiSelectable(element, multiSelectable) {
|
8482 | setAriaAttribute(element, 'multiselectable', multiSelectable);
|
8483 | }
|
8484 | function setAriaRowCount(element, rowCount) {
|
8485 | setAriaAttribute(element, 'rowcount', rowCount);
|
8486 | }
|
8487 | function setAriaRowIndex(element, rowIndex) {
|
8488 | setAriaAttribute(element, 'rowindex', rowIndex);
|
8489 | }
|
8490 | function setAriaColCount(element, colCount) {
|
8491 | setAriaAttribute(element, 'colcount', colCount);
|
8492 | }
|
8493 | function setAriaColIndex(element, colIndex) {
|
8494 | setAriaAttribute(element, 'colindex', colIndex);
|
8495 | }
|
8496 | function setAriaColSpan(element, colSpan) {
|
8497 | setAriaAttribute(element, 'colspan', colSpan);
|
8498 | }
|
8499 | function setAriaSort(element, sort) {
|
8500 | setAriaAttribute(element, 'sort', sort);
|
8501 | }
|
8502 | function removeAriaSort(element) {
|
8503 | removeAriaAttribute(element, 'sort');
|
8504 | }
|
8505 | function setAriaSelected(element, selected) {
|
8506 | toggleAriaAttribute(element, 'selected', selected);
|
8507 | }
|
8508 | function setAriaChecked(element, checked) {
|
8509 | setAriaAttribute(element, 'checked', checked === undefined ? 'mixed' : checked);
|
8510 | }
|
8511 |
|
8512 | var AriaUtils = Object.freeze({
|
8513 | __proto__: null,
|
8514 | setAriaRole: setAriaRole,
|
8515 | getAriaSortState: getAriaSortState,
|
8516 | getAriaLevel: getAriaLevel,
|
8517 | getAriaPosInSet: getAriaPosInSet,
|
8518 | getAriaDescribedBy: getAriaDescribedBy,
|
8519 | setAriaLabel: setAriaLabel,
|
8520 | setAriaLabelledBy: setAriaLabelledBy,
|
8521 | setAriaDescription: setAriaDescription,
|
8522 | setAriaDescribedBy: setAriaDescribedBy,
|
8523 | setAriaLive: setAriaLive,
|
8524 | setAriaLevel: setAriaLevel,
|
8525 | setAriaDisabled: setAriaDisabled,
|
8526 | setAriaHidden: setAriaHidden,
|
8527 | setAriaExpanded: setAriaExpanded,
|
8528 | removeAriaExpanded: removeAriaExpanded,
|
8529 | setAriaSetSize: setAriaSetSize,
|
8530 | setAriaPosInSet: setAriaPosInSet,
|
8531 | setAriaMultiSelectable: setAriaMultiSelectable,
|
8532 | setAriaRowCount: setAriaRowCount,
|
8533 | setAriaRowIndex: setAriaRowIndex,
|
8534 | setAriaColCount: setAriaColCount,
|
8535 | setAriaColIndex: setAriaColIndex,
|
8536 | setAriaColSpan: setAriaColSpan,
|
8537 | setAriaSort: setAriaSort,
|
8538 | removeAriaSort: removeAriaSort,
|
8539 | setAriaSelected: setAriaSelected,
|
8540 | setAriaChecked: setAriaChecked
|
8541 | });
|
8542 |
|
8543 |
|
8544 |
|
8545 |
|
8546 |
|
8547 |
|
8548 |
|
8549 |
|
8550 |
|
8551 |
|
8552 |
|
8553 | var isSafari;
|
8554 | var safariVersion;
|
8555 | var isChrome;
|
8556 | var isFirefox;
|
8557 | var isMacOs;
|
8558 | var isIOS;
|
8559 | var invisibleScrollbar;
|
8560 | var browserScrollbarWidth;
|
8561 | function isBrowserSafari() {
|
8562 | if (isSafari === undefined) {
|
8563 | isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
8564 | }
|
8565 | return isSafari;
|
8566 | }
|
8567 | function getSafariVersion() {
|
8568 | if (safariVersion === undefined) {
|
8569 | if (isBrowserSafari()) {
|
8570 | var versionMatch = navigator.userAgent.match(/version\/(\d+)/i);
|
8571 | if (versionMatch) {
|
8572 | safariVersion = versionMatch[1] != null ? parseFloat(versionMatch[1]) : 0;
|
8573 | }
|
8574 | }
|
8575 | else {
|
8576 | safariVersion = 0;
|
8577 | }
|
8578 | }
|
8579 | return safariVersion;
|
8580 | }
|
8581 |
|
8582 |
|
8583 |
|
8584 | function isBrowserChrome() {
|
8585 | if (isChrome === undefined) {
|
8586 | var win = window;
|
8587 | isChrome = (!!win.chrome && (!!win.chrome.webstore || !!win.chrome.runtime)) ||
|
8588 | (/Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor));
|
8589 | }
|
8590 | return isChrome;
|
8591 | }
|
8592 | function isBrowserFirefox() {
|
8593 | if (isFirefox === undefined) {
|
8594 | isFirefox = /(firefox)/i.test(navigator.userAgent);
|
8595 | }
|
8596 | return isFirefox;
|
8597 | }
|
8598 | function isMacOsUserAgent() {
|
8599 | if (isMacOs === undefined) {
|
8600 | isMacOs = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
|
8601 | }
|
8602 | return isMacOs;
|
8603 | }
|
8604 | function isIOSUserAgent() {
|
8605 | if (isIOS === undefined) {
|
8606 | isIOS = (/iPad|iPhone|iPod/.test(navigator.platform) ||
|
8607 |
|
8608 | (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1));
|
8609 | }
|
8610 | return isIOS;
|
8611 | }
|
8612 | function browserSupportsPreventScroll() {
|
8613 |
|
8614 |
|
8615 | return !isBrowserSafari() || getSafariVersion() >= 15;
|
8616 | }
|
8617 | function getTabIndex(el) {
|
8618 | if (!el) {
|
8619 | return null;
|
8620 | }
|
8621 | var numberTabIndex = el.tabIndex;
|
8622 | var tabIndex = el.getAttribute('tabIndex');
|
8623 | if (numberTabIndex === -1 && (tabIndex === null || (tabIndex === '' && !isBrowserFirefox()))) {
|
8624 | return null;
|
8625 | }
|
8626 | return numberTabIndex.toString();
|
8627 | }
|
8628 | function getMaxDivHeight() {
|
8629 | if (!document.body) {
|
8630 | return -1;
|
8631 | }
|
8632 | var res = 1000000;
|
8633 |
|
8634 | var testUpTo = navigator.userAgent.toLowerCase().match(/firefox/) ? 6000000 : 1000000000;
|
8635 | var div = document.createElement('div');
|
8636 | document.body.appendChild(div);
|
8637 | while (true) {
|
8638 | var test = res * 2;
|
8639 | div.style.height = test + 'px';
|
8640 | if (test > testUpTo || div.clientHeight !== test) {
|
8641 | break;
|
8642 | }
|
8643 | else {
|
8644 | res = test;
|
8645 | }
|
8646 | }
|
8647 | document.body.removeChild(div);
|
8648 | return res;
|
8649 | }
|
8650 | function getBodyWidth() {
|
8651 | var _a, _b, _c;
|
8652 | return (_b = (_a = document.body) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : (window.innerHeight || ((_c = document.documentElement) === null || _c === void 0 ? void 0 : _c.clientWidth) || -1);
|
8653 | }
|
8654 | function getBodyHeight() {
|
8655 | var _a, _b, _c;
|
8656 | return (_b = (_a = document.body) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : (window.innerHeight || ((_c = document.documentElement) === null || _c === void 0 ? void 0 : _c.clientHeight) || -1);
|
8657 | }
|
8658 | function getScrollbarWidth() {
|
8659 | if (browserScrollbarWidth == null) {
|
8660 | initScrollbarWidthAndVisibility();
|
8661 | }
|
8662 | return browserScrollbarWidth;
|
8663 | }
|
8664 | function initScrollbarWidthAndVisibility() {
|
8665 | var body = document.body;
|
8666 | var div = document.createElement('div');
|
8667 | div.style.width = div.style.height = '100px';
|
8668 | div.style.opacity = '0';
|
8669 | div.style.overflow = 'scroll';
|
8670 | div.style.msOverflowStyle = 'scrollbar';
|
8671 | div.style.position = 'absolute';
|
8672 | body.appendChild(div);
|
8673 | var width = div.offsetWidth - div.clientWidth;
|
8674 |
|
8675 | if (width === 0 && div.clientWidth === 0) {
|
8676 | width = null;
|
8677 | }
|
8678 |
|
8679 | if (div.parentNode) {
|
8680 | div.parentNode.removeChild(div);
|
8681 | }
|
8682 | if (width != null) {
|
8683 | browserScrollbarWidth = width;
|
8684 | invisibleScrollbar = width === 0;
|
8685 | }
|
8686 | }
|
8687 | function isInvisibleScrollbar() {
|
8688 | if (invisibleScrollbar == null) {
|
8689 | initScrollbarWidthAndVisibility();
|
8690 | }
|
8691 | return invisibleScrollbar;
|
8692 | }
|
8693 |
|
8694 | var BrowserUtils = Object.freeze({
|
8695 | __proto__: null,
|
8696 | isBrowserSafari: isBrowserSafari,
|
8697 | getSafariVersion: getSafariVersion,
|
8698 | isBrowserChrome: isBrowserChrome,
|
8699 | isBrowserFirefox: isBrowserFirefox,
|
8700 | isMacOsUserAgent: isMacOsUserAgent,
|
8701 | isIOSUserAgent: isIOSUserAgent,
|
8702 | browserSupportsPreventScroll: browserSupportsPreventScroll,
|
8703 | getTabIndex: getTabIndex,
|
8704 | getMaxDivHeight: getMaxDivHeight,
|
8705 | getBodyWidth: getBodyWidth,
|
8706 | getBodyHeight: getBodyHeight,
|
8707 | getScrollbarWidth: getScrollbarWidth,
|
8708 | isInvisibleScrollbar: isInvisibleScrollbar
|
8709 | });
|
8710 |
|
8711 |
|
8712 |
|
8713 |
|
8714 |
|
8715 |
|
8716 |
|
8717 | function padStartWidthZeros(value, totalStringSize) {
|
8718 | return value.toString().padStart(totalStringSize, '0');
|
8719 | }
|
8720 | function createArrayOfNumbers(first, last) {
|
8721 | var result = [];
|
8722 | for (var i = first; i <= last; i++) {
|
8723 | result.push(i);
|
8724 | }
|
8725 | return result;
|
8726 | }
|
8727 | function cleanNumber(value) {
|
8728 | if (typeof value === 'string') {
|
8729 | value = parseInt(value, 10);
|
8730 | }
|
8731 | if (typeof value === 'number') {
|
8732 | return Math.floor(value);
|
8733 | }
|
8734 | return null;
|
8735 | }
|
8736 | function decToHex(number, bytes) {
|
8737 | var hex = '';
|
8738 | for (var i = 0; i < bytes; i++) {
|
8739 | hex += String.fromCharCode(number & 0xff);
|
8740 | number >>>= 8;
|
8741 | }
|
8742 | return hex;
|
8743 | }
|
8744 | function formatNumberTwoDecimalPlacesAndCommas(value, thousandSeparator, decimalSeparator) {
|
8745 | if (typeof value !== 'number') {
|
8746 | return '';
|
8747 | }
|
8748 | return formatNumberCommas(Math.round(value * 100) / 100, thousandSeparator, decimalSeparator);
|
8749 | }
|
8750 |
|
8751 |
|
8752 |
|
8753 |
|
8754 |
|
8755 |
|
8756 |
|
8757 | function formatNumberCommas(value, thousandSeparator, decimalSeparator) {
|
8758 | if (typeof value !== 'number') {
|
8759 | return '';
|
8760 | }
|
8761 | return value.toString().replace('.', decimalSeparator).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1" + thousandSeparator);
|
8762 | }
|
8763 | function sum(values) {
|
8764 | return values == null ? null : values.reduce(function (total, value) { return total + value; }, 0);
|
8765 | }
|
8766 | function zeroOrGreater(value, defaultValue) {
|
8767 | if (value >= 0) {
|
8768 | return value;
|
8769 | }
|
8770 |
|
8771 | return defaultValue;
|
8772 | }
|
8773 | function oneOrGreater(value, defaultValue) {
|
8774 | var valueNumber = parseInt(value, 10);
|
8775 | if (!isNaN(valueNumber) && isFinite(valueNumber) && valueNumber > 0) {
|
8776 | return valueNumber;
|
8777 | }
|
8778 | return defaultValue;
|
8779 | }
|
8780 |
|
8781 | var NumberUtils = Object.freeze({
|
8782 | __proto__: null,
|
8783 | padStartWidthZeros: padStartWidthZeros,
|
8784 | createArrayOfNumbers: createArrayOfNumbers,
|
8785 | cleanNumber: cleanNumber,
|
8786 | decToHex: decToHex,
|
8787 | formatNumberTwoDecimalPlacesAndCommas: formatNumberTwoDecimalPlacesAndCommas,
|
8788 | formatNumberCommas: formatNumberCommas,
|
8789 | sum: sum,
|
8790 | zeroOrGreater: zeroOrGreater,
|
8791 | oneOrGreater: oneOrGreater
|
8792 | });
|
8793 |
|
8794 |
|
8795 |
|
8796 |
|
8797 |
|
8798 |
|
8799 |
|
8800 | var __read$p = (undefined && undefined.__read) || function (o, n) {
|
8801 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
8802 | if (!m) return o;
|
8803 | var i = m.call(o), r, ar = [], e;
|
8804 | try {
|
8805 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
8806 | }
|
8807 | catch (error) { e = { error: error }; }
|
8808 | finally {
|
8809 | try {
|
8810 | if (r && !r.done && (m = i["return"])) m.call(i);
|
8811 | }
|
8812 | finally { if (e) throw e.error; }
|
8813 | }
|
8814 | return ar;
|
8815 | };
|
8816 |
|
8817 |
|
8818 |
|
8819 |
|
8820 |
|
8821 |
|
8822 |
|
8823 | function serialiseDate(date, includeTime, separator) {
|
8824 | if (includeTime === void 0) { includeTime = true; }
|
8825 | if (separator === void 0) { separator = '-'; }
|
8826 | if (!date) {
|
8827 | return null;
|
8828 | }
|
8829 | var serialised = [date.getFullYear(), date.getMonth() + 1, date.getDate()].map(function (part) { return padStartWidthZeros(part, 2); }).join(separator);
|
8830 | if (includeTime) {
|
8831 | serialised += ' ' + [date.getHours(), date.getMinutes(), date.getSeconds()].map(function (part) { return padStartWidthZeros(part, 2); }).join(':');
|
8832 | }
|
8833 | return serialised;
|
8834 | }
|
8835 | var calculateOrdinal = function (value) {
|
8836 | if (value > 3 && value < 21) {
|
8837 | return 'th';
|
8838 | }
|
8839 | var remainder = value % 10;
|
8840 | switch (remainder) {
|
8841 | case 1: return "st";
|
8842 | case 2: return "nd";
|
8843 | case 3: return "rd";
|
8844 | }
|
8845 | return 'th';
|
8846 | };
|
8847 |
|
8848 |
|
8849 |
|
8850 |
|
8851 |
|
8852 | function dateToFormattedString(date, format) {
|
8853 | if (format === void 0) { format = 'YYYY-MM-DD'; }
|
8854 | var fullYear = padStartWidthZeros(date.getFullYear(), 4);
|
8855 | var months = [
|
8856 | 'January', 'February', 'March', 'April', 'May', 'June',
|
8857 | 'July', 'August', 'September', 'October', 'November', 'December',
|
8858 | ];
|
8859 | var days = [
|
8860 | 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',
|
8861 | ];
|
8862 | var replace = {
|
8863 | YYYY: function () { return fullYear.slice(fullYear.length - 4, fullYear.length); },
|
8864 | YY: function () { return fullYear.slice(fullYear.length - 2, fullYear.length); },
|
8865 | Y: function () { return "" + date.getFullYear(); },
|
8866 | MMMM: function () { return months[date.getMonth()]; },
|
8867 | MMM: function () { return months[date.getMonth()].slice(0, 3); },
|
8868 | MM: function () { return padStartWidthZeros(date.getMonth() + 1, 2); },
|
8869 | Mo: function () { return "" + (date.getMonth() + 1) + calculateOrdinal(date.getMonth() + 1); },
|
8870 | M: function () { return "" + (date.getMonth() + 1); },
|
8871 | Do: function () { return "" + date.getDate() + calculateOrdinal(date.getDate()); },
|
8872 | DD: function () { return padStartWidthZeros(date.getDate(), 2); },
|
8873 | D: function () { return "" + date.getDate(); },
|
8874 | dddd: function () { return days[date.getDay()]; },
|
8875 | ddd: function () { return days[date.getDay()].slice(0, 3); },
|
8876 | dd: function () { return days[date.getDay()].slice(0, 2); },
|
8877 | do: function () { return "" + date.getDay() + calculateOrdinal(date.getDay()); },
|
8878 | d: function () { return "" + date.getDay(); },
|
8879 | };
|
8880 | var regexp = new RegExp(Object.keys(replace).join('|'), 'g');
|
8881 | return format.replace(regexp, function (match) {
|
8882 | if (match in replace) {
|
8883 | return replace[match]();
|
8884 | }
|
8885 | return match;
|
8886 | });
|
8887 | }
|
8888 |
|
8889 |
|
8890 |
|
8891 | function parseDateTimeFromString(value) {
|
8892 | if (!value) {
|
8893 | return null;
|
8894 | }
|
8895 | var _a = __read$p(value.split(' '), 2), dateStr = _a[0], timeStr = _a[1];
|
8896 | if (!dateStr) {
|
8897 | return null;
|
8898 | }
|
8899 | var fields = dateStr.split('-').map(function (f) { return parseInt(f, 10); });
|
8900 | if (fields.filter(function (f) { return !isNaN(f); }).length !== 3) {
|
8901 | return null;
|
8902 | }
|
8903 | var _b = __read$p(fields, 3), year = _b[0], month = _b[1], day = _b[2];
|
8904 | var date = new Date(year, month - 1, day);
|
8905 | if (date.getFullYear() !== year ||
|
8906 | date.getMonth() !== month - 1 ||
|
8907 | date.getDate() !== day) {
|
8908 |
|
8909 | return null;
|
8910 | }
|
8911 | if (!timeStr || timeStr === '00:00:00') {
|
8912 | return date;
|
8913 | }
|
8914 | var _c = __read$p(timeStr.split(':').map(function (part) { return parseInt(part, 10); }), 3), hours = _c[0], minutes = _c[1], seconds = _c[2];
|
8915 | if (hours >= 0 && hours < 24) {
|
8916 | date.setHours(hours);
|
8917 | }
|
8918 | if (minutes >= 0 && minutes < 60) {
|
8919 | date.setMinutes(minutes);
|
8920 | }
|
8921 | if (seconds >= 0 && seconds < 60) {
|
8922 | date.setSeconds(seconds);
|
8923 | }
|
8924 | return date;
|
8925 | }
|
8926 |
|
8927 | var DateUtils = Object.freeze({
|
8928 | __proto__: null,
|
8929 | serialiseDate: serialiseDate,
|
8930 | dateToFormattedString: dateToFormattedString,
|
8931 | parseDateTimeFromString: parseDateTimeFromString
|
8932 | });
|
8933 |
|
8934 |
|
8935 |
|
8936 |
|
8937 |
|
8938 |
|
8939 |
|
8940 | var __values$5 = (undefined && undefined.__values) || function(o) {
|
8941 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
8942 | if (m) return m.call(o);
|
8943 | if (o && typeof o.length === "number") return {
|
8944 | next: function () {
|
8945 | if (o && i >= o.length) o = void 0;
|
8946 | return { value: o && o[i++], done: !o };
|
8947 | }
|
8948 | };
|
8949 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
8950 | };
|
8951 | var __read$o = (undefined && undefined.__read) || function (o, n) {
|
8952 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
8953 | if (!m) return o;
|
8954 | var i = m.call(o), r, ar = [], e;
|
8955 | try {
|
8956 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
8957 | }
|
8958 | catch (error) { e = { error: error }; }
|
8959 | finally {
|
8960 | try {
|
8961 | if (r && !r.done && (m = i["return"])) m.call(i);
|
8962 | }
|
8963 | finally { if (e) throw e.error; }
|
8964 | }
|
8965 | return ar;
|
8966 | };
|
8967 | var rtlNegativeScroll;
|
8968 |
|
8969 |
|
8970 |
|
8971 |
|
8972 |
|
8973 |
|
8974 |
|
8975 | function radioCssClass(element, elementClass, otherElementClass) {
|
8976 | var parent = element.parentElement;
|
8977 | var sibling = parent && parent.firstChild;
|
8978 | while (sibling) {
|
8979 | if (elementClass) {
|
8980 | sibling.classList.toggle(elementClass, sibling === element);
|
8981 | }
|
8982 | if (otherElementClass) {
|
8983 | sibling.classList.toggle(otherElementClass, sibling !== element);
|
8984 | }
|
8985 | sibling = sibling.nextSibling;
|
8986 | }
|
8987 | }
|
8988 | var FOCUSABLE_SELECTOR = '[tabindex], input, select, button, textarea, [href]';
|
8989 | var FOCUSABLE_EXCLUDE = '.ag-hidden, .ag-hidden *, [disabled], .ag-disabled, .ag-disabled *';
|
8990 | function isFocusableFormField(element) {
|
8991 | var matches = Element.prototype.matches || Element.prototype.msMatchesSelector;
|
8992 | var inputSelector = 'input, select, button, textarea';
|
8993 | var isFocusable = matches.call(element, inputSelector);
|
8994 | var isNotFocusable = matches.call(element, FOCUSABLE_EXCLUDE);
|
8995 | var isElementVisible = isVisible(element);
|
8996 | var focusable = isFocusable && !isNotFocusable && isElementVisible;
|
8997 | return focusable;
|
8998 | }
|
8999 | function setDisplayed(element, displayed, options) {
|
9000 | if (options === void 0) { options = {}; }
|
9001 | var skipAriaHidden = options.skipAriaHidden;
|
9002 | element.classList.toggle('ag-hidden', !displayed);
|
9003 | if (!skipAriaHidden) {
|
9004 | setAriaHidden(element, !displayed);
|
9005 | }
|
9006 | }
|
9007 | function setVisible(element, visible, options) {
|
9008 | if (options === void 0) { options = {}; }
|
9009 | var skipAriaHidden = options.skipAriaHidden;
|
9010 | element.classList.toggle('ag-invisible', !visible);
|
9011 | if (!skipAriaHidden) {
|
9012 | setAriaHidden(element, !visible);
|
9013 | }
|
9014 | }
|
9015 | function setDisabled(element, disabled) {
|
9016 | var attributeName = 'disabled';
|
9017 | var addOrRemoveDisabledAttribute = disabled ?
|
9018 | function (e) { return e.setAttribute(attributeName, ''); } :
|
9019 | function (e) { return e.removeAttribute(attributeName); };
|
9020 | addOrRemoveDisabledAttribute(element);
|
9021 | nodeListForEach(element.querySelectorAll('input'), function (input) { return addOrRemoveDisabledAttribute(input); });
|
9022 | }
|
9023 | function isElementChildOfClass(element, cls, maxNest) {
|
9024 | var counter = 0;
|
9025 | while (element) {
|
9026 | if (element.classList.contains(cls)) {
|
9027 | return true;
|
9028 | }
|
9029 | element = element.parentElement;
|
9030 | if (typeof maxNest == 'number') {
|
9031 | if (++counter > maxNest) {
|
9032 | break;
|
9033 | }
|
9034 | }
|
9035 | else if (element === maxNest) {
|
9036 | break;
|
9037 | }
|
9038 | }
|
9039 | return false;
|
9040 | }
|
9041 |
|
9042 |
|
9043 |
|
9044 |
|
9045 | function getElementSize(el) {
|
9046 | var _a = window.getComputedStyle(el), height = _a.height, width = _a.width, borderTopWidth = _a.borderTopWidth, borderRightWidth = _a.borderRightWidth, borderBottomWidth = _a.borderBottomWidth, borderLeftWidth = _a.borderLeftWidth, 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;
|
9047 | return {
|
9048 | height: parseFloat(height),
|
9049 | width: parseFloat(width),
|
9050 | borderTopWidth: parseFloat(borderTopWidth),
|
9051 | borderRightWidth: parseFloat(borderRightWidth),
|
9052 | borderBottomWidth: parseFloat(borderBottomWidth),
|
9053 | borderLeftWidth: parseFloat(borderLeftWidth),
|
9054 | paddingTop: parseFloat(paddingTop),
|
9055 | paddingRight: parseFloat(paddingRight),
|
9056 | paddingBottom: parseFloat(paddingBottom),
|
9057 | paddingLeft: parseFloat(paddingLeft),
|
9058 | marginTop: parseFloat(marginTop),
|
9059 | marginRight: parseFloat(marginRight),
|
9060 | marginBottom: parseFloat(marginBottom),
|
9061 | marginLeft: parseFloat(marginLeft),
|
9062 | boxSizing: boxSizing
|
9063 | };
|
9064 | }
|
9065 | function getInnerHeight(el) {
|
9066 | var size = getElementSize(el);
|
9067 | if (size.boxSizing === 'border-box') {
|
9068 | return size.height - size.paddingTop - size.paddingBottom;
|
9069 | }
|
9070 | return size.height;
|
9071 | }
|
9072 | function getInnerWidth(el) {
|
9073 | var size = getElementSize(el);
|
9074 | if (size.boxSizing === 'border-box') {
|
9075 | return size.width - size.paddingLeft - size.paddingRight;
|
9076 | }
|
9077 | return size.width;
|
9078 | }
|
9079 | function getAbsoluteHeight(el) {
|
9080 | var size = getElementSize(el);
|
9081 | var marginRight = size.marginBottom + size.marginTop;
|
9082 | return Math.ceil(el.offsetHeight + marginRight);
|
9083 | }
|
9084 | function getAbsoluteWidth(el) {
|
9085 | var size = getElementSize(el);
|
9086 | var marginWidth = size.marginLeft + size.marginRight;
|
9087 | return Math.ceil(el.offsetWidth + marginWidth);
|
9088 | }
|
9089 | function isRtlNegativeScroll() {
|
9090 | if (typeof rtlNegativeScroll === "boolean") {
|
9091 | return rtlNegativeScroll;
|
9092 | }
|
9093 | var template = document.createElement('div');
|
9094 | template.style.direction = 'rtl';
|
9095 | template.style.width = '1px';
|
9096 | template.style.height = '1px';
|
9097 | template.style.position = 'fixed';
|
9098 | template.style.top = '0px';
|
9099 | template.style.overflow = 'hidden';
|
9100 | template.dir = 'rtl';
|
9101 | template.innerHTML =
|
9102 | "<div style=\"width: 2px\">\n <span style=\"display: inline-block; width: 1px\"></span>\n <span style=\"display: inline-block; width: 1px\"></span>\n </div>";
|
9103 | document.body.appendChild(template);
|
9104 | template.scrollLeft = 1;
|
9105 | rtlNegativeScroll = Math.floor(template.scrollLeft) === 0;
|
9106 | document.body.removeChild(template);
|
9107 | return rtlNegativeScroll;
|
9108 | }
|
9109 | function getScrollLeft(element, rtl) {
|
9110 | var scrollLeft = element.scrollLeft;
|
9111 | if (rtl) {
|
9112 |
|
9113 | scrollLeft = Math.abs(scrollLeft);
|
9114 | if (isBrowserChrome() && !isRtlNegativeScroll()) {
|
9115 | scrollLeft = element.scrollWidth - element.clientWidth - scrollLeft;
|
9116 | }
|
9117 | }
|
9118 | return scrollLeft;
|
9119 | }
|
9120 | function setScrollLeft(element, value, rtl) {
|
9121 | if (rtl) {
|
9122 |
|
9123 | if (isRtlNegativeScroll()) {
|
9124 | value *= -1;
|
9125 | }
|
9126 | else if (isBrowserSafari() || isBrowserChrome()) {
|
9127 | value = element.scrollWidth - element.clientWidth - value;
|
9128 | }
|
9129 | }
|
9130 | element.scrollLeft = value;
|
9131 | }
|
9132 | function clearElement(el) {
|
9133 | while (el && el.firstChild) {
|
9134 | el.removeChild(el.firstChild);
|
9135 | }
|
9136 | }
|
9137 |
|
9138 | function removeElement(parent, cssSelector) {
|
9139 | removeFromParent(parent.querySelector(cssSelector));
|
9140 | }
|
9141 | function removeFromParent(node) {
|
9142 | if (node && node.parentNode) {
|
9143 | node.parentNode.removeChild(node);
|
9144 | }
|
9145 | }
|
9146 | function isVisible(element) {
|
9147 | return element.offsetParent !== null;
|
9148 | }
|
9149 |
|
9150 |
|
9151 |
|
9152 |
|
9153 |
|
9154 |
|
9155 | function loadTemplate(template) {
|
9156 | var tempDiv = document.createElement('div');
|
9157 | tempDiv.innerHTML = (template || '').trim();
|
9158 | return tempDiv.firstChild;
|
9159 | }
|
9160 | function appendHtml(eContainer, htmlTemplate) {
|
9161 | if (eContainer.lastChild) {
|
9162 |
|
9163 |
|
9164 |
|
9165 |
|
9166 | eContainer.insertAdjacentHTML('afterbegin', htmlTemplate);
|
9167 | }
|
9168 | else {
|
9169 | eContainer.innerHTML = htmlTemplate;
|
9170 | }
|
9171 | }
|
9172 |
|
9173 | function getElementAttribute(element, attributeName) {
|
9174 | if (element.attributes && element.attributes[attributeName]) {
|
9175 | var attribute = element.attributes[attributeName];
|
9176 | return attribute.value;
|
9177 | }
|
9178 | return null;
|
9179 | }
|
9180 | function offsetHeight(element) {
|
9181 | return element && element.clientHeight ? element.clientHeight : 0;
|
9182 | }
|
9183 | function offsetWidth(element) {
|
9184 | return element && element.clientWidth ? element.clientWidth : 0;
|
9185 | }
|
9186 | function ensureDomOrder(eContainer, eChild, eChildBefore) {
|
9187 |
|
9188 | if (eChildBefore && eChildBefore.nextSibling === eChild) {
|
9189 | return;
|
9190 | }
|
9191 | var focusedEl = document.activeElement;
|
9192 | var eChildHasFocus = eChild.contains(focusedEl);
|
9193 | if (eChildBefore) {
|
9194 | if (eChildBefore.nextSibling) {
|
9195 |
|
9196 | eContainer.insertBefore(eChild, eChildBefore.nextSibling);
|
9197 | }
|
9198 | else {
|
9199 |
|
9200 | eContainer.appendChild(eChild);
|
9201 | }
|
9202 | }
|
9203 | else {
|
9204 |
|
9205 | if (eContainer.firstChild && eContainer.firstChild !== eChild) {
|
9206 |
|
9207 | eContainer.insertAdjacentElement('afterbegin', eChild);
|
9208 | }
|
9209 | }
|
9210 | if (eChildHasFocus && focusedEl && browserSupportsPreventScroll()) {
|
9211 | focusedEl.focus({ preventScroll: true });
|
9212 | }
|
9213 | }
|
9214 | function setDomChildOrder(eContainer, orderedChildren) {
|
9215 | for (var i = 0; i < orderedChildren.length; i++) {
|
9216 | var correctCellAtIndex = orderedChildren[i];
|
9217 | var actualCellAtIndex = eContainer.children[i];
|
9218 | if (actualCellAtIndex !== correctCellAtIndex) {
|
9219 | eContainer.insertBefore(correctCellAtIndex, actualCellAtIndex);
|
9220 | }
|
9221 | }
|
9222 | }
|
9223 | function insertWithDomOrder(eContainer, eToInsert, eChildBefore) {
|
9224 | if (eChildBefore) {
|
9225 |
|
9226 | eChildBefore.insertAdjacentElement('afterend', eToInsert);
|
9227 | }
|
9228 | else {
|
9229 | if (eContainer.firstChild) {
|
9230 |
|
9231 | eContainer.insertAdjacentElement('afterbegin', eToInsert);
|
9232 | }
|
9233 | else {
|
9234 |
|
9235 | eContainer.appendChild(eToInsert);
|
9236 | }
|
9237 | }
|
9238 | }
|
9239 |
|
9240 | function prependDC(parent, documentFragment) {
|
9241 | if (exists(parent.firstChild)) {
|
9242 | parent.insertBefore(documentFragment, parent.firstChild);
|
9243 | }
|
9244 | else {
|
9245 | parent.appendChild(documentFragment);
|
9246 | }
|
9247 | }
|
9248 | function addStylesToElement(eElement, styles) {
|
9249 | var e_1, _a;
|
9250 | if (!styles) {
|
9251 | return;
|
9252 | }
|
9253 | try {
|
9254 | for (var _b = __values$5(Object.entries(styles)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
9255 | var _d = __read$o(_c.value, 2), key = _d[0], value = _d[1];
|
9256 | if (!key || !key.length || value == null) {
|
9257 | continue;
|
9258 | }
|
9259 |
|
9260 | var parsedKey = key.replace(/[A-Z]/g, function (s) { return "-" + s.toLocaleLowerCase(); });
|
9261 | var valueAsString = value.toString();
|
9262 | var parsedValue = valueAsString.replace(/\s*!important/g, '');
|
9263 | var priority = parsedValue.length != valueAsString.length ? 'important' : undefined;
|
9264 | eElement.style.setProperty(parsedKey, value, priority);
|
9265 | }
|
9266 | }
|
9267 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
9268 | finally {
|
9269 | try {
|
9270 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
9271 | }
|
9272 | finally { if (e_1) throw e_1.error; }
|
9273 | }
|
9274 | }
|
9275 | function isHorizontalScrollShowing(element) {
|
9276 | return element.clientWidth < element.scrollWidth;
|
9277 | }
|
9278 | function isVerticalScrollShowing(element) {
|
9279 | return element.clientHeight < element.scrollHeight;
|
9280 | }
|
9281 | function setElementWidth(element, width) {
|
9282 | if (width === 'flex') {
|
9283 | element.style.removeProperty('width');
|
9284 | element.style.removeProperty('minWidth');
|
9285 | element.style.removeProperty('maxWidth');
|
9286 | element.style.flex = '1 1 auto';
|
9287 | }
|
9288 | else {
|
9289 | setFixedWidth(element, width);
|
9290 | }
|
9291 | }
|
9292 | function setFixedWidth(element, width) {
|
9293 | width = formatSize(width);
|
9294 | element.style.width = width.toString();
|
9295 | element.style.maxWidth = width.toString();
|
9296 | element.style.minWidth = width.toString();
|
9297 | }
|
9298 | function setElementHeight(element, height) {
|
9299 | if (height === 'flex') {
|
9300 | element.style.removeProperty('height');
|
9301 | element.style.removeProperty('minHeight');
|
9302 | element.style.removeProperty('maxHeight');
|
9303 | element.style.flex = '1 1 auto';
|
9304 | }
|
9305 | else {
|
9306 | setFixedHeight(element, height);
|
9307 | }
|
9308 | }
|
9309 | function setFixedHeight(element, height) {
|
9310 | height = formatSize(height);
|
9311 | element.style.height = height.toString();
|
9312 | element.style.maxHeight = height.toString();
|
9313 | element.style.minHeight = height.toString();
|
9314 | }
|
9315 | function formatSize(size) {
|
9316 | if (typeof size === 'number') {
|
9317 | return size + "px";
|
9318 | }
|
9319 | return size;
|
9320 | }
|
9321 | function isNodeOrElement(o) {
|
9322 | return o instanceof Node || o instanceof HTMLElement;
|
9323 | }
|
9324 |
|
9325 |
|
9326 |
|
9327 |
|
9328 |
|
9329 | function copyNodeList(nodeList) {
|
9330 | if (nodeList == null) {
|
9331 | return [];
|
9332 | }
|
9333 | var result = [];
|
9334 | nodeListForEach(nodeList, function (node) { return result.push(node); });
|
9335 | return result;
|
9336 | }
|
9337 | function iterateNamedNodeMap(map, callback) {
|
9338 | if (!map) {
|
9339 | return;
|
9340 | }
|
9341 | for (var i = 0; i < map.length; i++) {
|
9342 | var attr = map[i];
|
9343 | callback(attr.name, attr.value);
|
9344 | }
|
9345 | }
|
9346 | function addOrRemoveAttribute(element, name, value) {
|
9347 | if (value == null) {
|
9348 | element.removeAttribute(name);
|
9349 | }
|
9350 | else {
|
9351 | element.setAttribute(name, value.toString());
|
9352 | }
|
9353 | }
|
9354 | function nodeListForEach(nodeList, action) {
|
9355 | if (nodeList == null) {
|
9356 | return;
|
9357 | }
|
9358 | for (var i = 0; i < nodeList.length; i++) {
|
9359 | action(nodeList[i]);
|
9360 | }
|
9361 | }
|
9362 |
|
9363 | var DomUtils = Object.freeze({
|
9364 | __proto__: null,
|
9365 | radioCssClass: radioCssClass,
|
9366 | FOCUSABLE_SELECTOR: FOCUSABLE_SELECTOR,
|
9367 | FOCUSABLE_EXCLUDE: FOCUSABLE_EXCLUDE,
|
9368 | isFocusableFormField: isFocusableFormField,
|
9369 | setDisplayed: setDisplayed,
|
9370 | setVisible: setVisible,
|
9371 | setDisabled: setDisabled,
|
9372 | isElementChildOfClass: isElementChildOfClass,
|
9373 | getElementSize: getElementSize,
|
9374 | getInnerHeight: getInnerHeight,
|
9375 | getInnerWidth: getInnerWidth,
|
9376 | getAbsoluteHeight: getAbsoluteHeight,
|
9377 | getAbsoluteWidth: getAbsoluteWidth,
|
9378 | isRtlNegativeScroll: isRtlNegativeScroll,
|
9379 | getScrollLeft: getScrollLeft,
|
9380 | setScrollLeft: setScrollLeft,
|
9381 | clearElement: clearElement,
|
9382 | removeElement: removeElement,
|
9383 | removeFromParent: removeFromParent,
|
9384 | isVisible: isVisible,
|
9385 | loadTemplate: loadTemplate,
|
9386 | appendHtml: appendHtml,
|
9387 | getElementAttribute: getElementAttribute,
|
9388 | offsetHeight: offsetHeight,
|
9389 | offsetWidth: offsetWidth,
|
9390 | ensureDomOrder: ensureDomOrder,
|
9391 | setDomChildOrder: setDomChildOrder,
|
9392 | insertWithDomOrder: insertWithDomOrder,
|
9393 | prependDC: prependDC,
|
9394 | addStylesToElement: addStylesToElement,
|
9395 | isHorizontalScrollShowing: isHorizontalScrollShowing,
|
9396 | isVerticalScrollShowing: isVerticalScrollShowing,
|
9397 | setElementWidth: setElementWidth,
|
9398 | setFixedWidth: setFixedWidth,
|
9399 | setElementHeight: setElementHeight,
|
9400 | setFixedHeight: setFixedHeight,
|
9401 | formatSize: formatSize,
|
9402 | isNodeOrElement: isNodeOrElement,
|
9403 | copyNodeList: copyNodeList,
|
9404 | iterateNamedNodeMap: iterateNamedNodeMap,
|
9405 | addOrRemoveAttribute: addOrRemoveAttribute,
|
9406 | nodeListForEach: nodeListForEach
|
9407 | });
|
9408 |
|
9409 |
|
9410 |
|
9411 |
|
9412 |
|
9413 |
|
9414 |
|
9415 |
|
9416 |
|
9417 |
|
9418 |
|
9419 |
|
9420 | var iconNameClassMap = {
|
9421 |
|
9422 | columnGroupOpened: 'expanded',
|
9423 |
|
9424 | columnGroupClosed: 'contracted',
|
9425 |
|
9426 | columnSelectClosed: 'tree-closed',
|
9427 |
|
9428 | columnSelectOpen: 'tree-open',
|
9429 |
|
9430 |
|
9431 | columnSelectIndeterminate: 'tree-indeterminate',
|
9432 |
|
9433 | columnMovePin: 'pin',
|
9434 |
|
9435 | columnMoveHide: 'eye-slash',
|
9436 |
|
9437 | columnMoveMove: 'arrows',
|
9438 |
|
9439 | columnMoveLeft: 'left',
|
9440 |
|
9441 | columnMoveRight: 'right',
|
9442 |
|
9443 | columnMoveGroup: 'group',
|
9444 |
|
9445 | columnMoveValue: 'aggregation',
|
9446 |
|
9447 | columnMovePivot: 'pivot',
|
9448 |
|
9449 |
|
9450 | dropNotAllowed: 'not-allowed',
|
9451 |
|
9452 | groupContracted: 'tree-closed',
|
9453 |
|
9454 | groupExpanded: 'tree-open',
|
9455 |
|
9456 | setFilterGroupClosed: 'tree-closed',
|
9457 |
|
9458 | setFilterGroupOpen: 'tree-open',
|
9459 |
|
9460 |
|
9461 | setFilterGroupIndeterminate: 'tree-indeterminate',
|
9462 |
|
9463 | chart: 'chart',
|
9464 |
|
9465 | close: 'cross',
|
9466 |
|
9467 | cancel: 'cancel',
|
9468 |
|
9469 | check: 'tick',
|
9470 |
|
9471 | first: 'first',
|
9472 |
|
9473 | previous: 'previous',
|
9474 |
|
9475 | next: 'next',
|
9476 |
|
9477 | last: 'last',
|
9478 |
|
9479 | linked: 'linked',
|
9480 |
|
9481 | unlinked: 'unlinked',
|
9482 |
|
9483 | colorPicker: 'color-picker',
|
9484 |
|
9485 | groupLoading: 'loading',
|
9486 |
|
9487 | menu: 'menu',
|
9488 |
|
9489 | filter: 'filter',
|
9490 |
|
9491 | columns: 'columns',
|
9492 |
|
9493 | maximize: 'maximize',
|
9494 |
|
9495 | minimize: 'minimize',
|
9496 |
|
9497 | menuPin: 'pin',
|
9498 |
|
9499 | menuValue: 'aggregation',
|
9500 |
|
9501 | menuAddRowGroup: 'group',
|
9502 |
|
9503 | menuRemoveRowGroup: 'group',
|
9504 |
|
9505 | clipboardCopy: 'copy',
|
9506 |
|
9507 | clipboardCut: 'cut',
|
9508 |
|
9509 | clipboardPaste: 'paste',
|
9510 |
|
9511 | pivotPanel: 'pivot',
|
9512 |
|
9513 | rowGroupPanel: 'group',
|
9514 |
|
9515 | valuePanel: 'aggregation',
|
9516 |
|
9517 | columnDrag: 'grip',
|
9518 |
|
9519 | rowDrag: 'grip',
|
9520 |
|
9521 | save: 'save',
|
9522 |
|
9523 | csvExport: 'csv',
|
9524 |
|
9525 | excelExport: 'excel',
|
9526 |
|
9527 | smallDown: 'small-down',
|
9528 |
|
9529 | smallLeft: 'small-left',
|
9530 |
|
9531 | smallRight: 'small-right',
|
9532 | smallUp: 'small-up',
|
9533 |
|
9534 | sortAscending: 'asc',
|
9535 |
|
9536 | sortDescending: 'desc',
|
9537 |
|
9538 | sortUnSort: 'none'
|
9539 | };
|
9540 |
|
9541 |
|
9542 |
|
9543 |
|
9544 |
|
9545 |
|
9546 |
|
9547 |
|
9548 | function createIcon(iconName, gridOptionsService, column) {
|
9549 | var iconContents = createIconNoSpan(iconName, gridOptionsService, column);
|
9550 | if (iconContents && iconContents.className.indexOf('ag-icon') > -1) {
|
9551 | return iconContents;
|
9552 | }
|
9553 | var eResult = document.createElement('span');
|
9554 | eResult.appendChild(iconContents);
|
9555 | return eResult;
|
9556 | }
|
9557 | function createIconNoSpan(iconName, gridOptionsService, column, forceCreate) {
|
9558 | var userProvidedIcon = null;
|
9559 |
|
9560 | var icons = column && column.getColDef().icons;
|
9561 | if (icons) {
|
9562 | userProvidedIcon = icons[iconName];
|
9563 | }
|
9564 |
|
9565 | if (gridOptionsService && !userProvidedIcon) {
|
9566 | var optionsIcons = gridOptionsService.get('icons');
|
9567 | if (optionsIcons) {
|
9568 | userProvidedIcon = optionsIcons[iconName];
|
9569 | }
|
9570 | }
|
9571 |
|
9572 | if (userProvidedIcon) {
|
9573 | var rendererResult = void 0;
|
9574 | if (typeof userProvidedIcon === 'function') {
|
9575 | rendererResult = userProvidedIcon();
|
9576 | }
|
9577 | else if (typeof userProvidedIcon === 'string') {
|
9578 | rendererResult = userProvidedIcon;
|
9579 | }
|
9580 | else {
|
9581 | throw new Error('icon from grid options needs to be a string or a function');
|
9582 | }
|
9583 | if (typeof rendererResult === 'string') {
|
9584 | return loadTemplate(rendererResult);
|
9585 | }
|
9586 | if (isNodeOrElement(rendererResult)) {
|
9587 | return rendererResult;
|
9588 | }
|
9589 | console.warn('AG Grid: iconRenderer should return back a string or a dom object');
|
9590 | }
|
9591 | else {
|
9592 | var span = document.createElement('span');
|
9593 | var cssClass = iconNameClassMap[iconName];
|
9594 | if (!cssClass) {
|
9595 | if (!forceCreate) {
|
9596 | console.warn("AG Grid: Did not find icon " + iconName);
|
9597 | cssClass = '';
|
9598 | }
|
9599 | else {
|
9600 | cssClass = iconName;
|
9601 | }
|
9602 | }
|
9603 | span.setAttribute('class', "ag-icon ag-icon-" + cssClass);
|
9604 | span.setAttribute('unselectable', 'on');
|
9605 | setAriaRole(span, 'presentation');
|
9606 | return span;
|
9607 | }
|
9608 | }
|
9609 |
|
9610 | var IconUtils = Object.freeze({
|
9611 | __proto__: null,
|
9612 | iconNameClassMap: iconNameClassMap,
|
9613 | createIcon: createIcon,
|
9614 | createIconNoSpan: createIconNoSpan
|
9615 | });
|
9616 |
|
9617 |
|
9618 |
|
9619 |
|
9620 |
|
9621 |
|
9622 |
|
9623 | var KeyCode = (function () {
|
9624 | function KeyCode() {
|
9625 | }
|
9626 | KeyCode.BACKSPACE = 'Backspace';
|
9627 | KeyCode.TAB = 'Tab';
|
9628 | KeyCode.ENTER = 'Enter';
|
9629 | KeyCode.ESCAPE = 'Escape';
|
9630 | KeyCode.SPACE = ' ';
|
9631 | KeyCode.LEFT = 'ArrowLeft';
|
9632 | KeyCode.UP = 'ArrowUp';
|
9633 | KeyCode.RIGHT = 'ArrowRight';
|
9634 | KeyCode.DOWN = 'ArrowDown';
|
9635 | KeyCode.DELETE = 'Delete';
|
9636 | KeyCode.F2 = 'F2';
|
9637 | KeyCode.PAGE_UP = 'PageUp';
|
9638 | KeyCode.PAGE_DOWN = 'PageDown';
|
9639 | KeyCode.PAGE_HOME = 'Home';
|
9640 | KeyCode.PAGE_END = 'End';
|
9641 |
|
9642 |
|
9643 | KeyCode.A = 'KeyA';
|
9644 | KeyCode.C = 'KeyC';
|
9645 | KeyCode.D = 'KeyD';
|
9646 | KeyCode.V = 'KeyV';
|
9647 | KeyCode.X = 'KeyX';
|
9648 | KeyCode.Y = 'KeyY';
|
9649 | KeyCode.Z = 'KeyZ';
|
9650 | return KeyCode;
|
9651 | }());
|
9652 |
|
9653 |
|
9654 |
|
9655 |
|
9656 |
|
9657 |
|
9658 |
|
9659 | var A_KEYCODE = 65;
|
9660 | var C_KEYCODE = 67;
|
9661 | var V_KEYCODE = 86;
|
9662 | var D_KEYCODE = 68;
|
9663 | var Z_KEYCODE = 90;
|
9664 | var Y_KEYCODE = 89;
|
9665 | function isEventFromPrintableCharacter(event) {
|
9666 |
|
9667 | if (event.altKey || event.ctrlKey || event.metaKey) {
|
9668 | return false;
|
9669 | }
|
9670 |
|
9671 |
|
9672 | var printableCharacter = event.key.length === 1;
|
9673 | return printableCharacter;
|
9674 | }
|
9675 |
|
9676 |
|
9677 |
|
9678 |
|
9679 |
|
9680 |
|
9681 |
|
9682 |
|
9683 |
|
9684 | function isUserSuppressingKeyboardEvent(gridOptionsService, keyboardEvent, rowNode, column, editing) {
|
9685 | var colDefFunc = column ? column.getColDef().suppressKeyboardEvent : undefined;
|
9686 |
|
9687 | if (!colDefFunc) {
|
9688 | return false;
|
9689 | }
|
9690 | var params = {
|
9691 | event: keyboardEvent,
|
9692 | editing: editing,
|
9693 | column: column,
|
9694 | api: gridOptionsService.api,
|
9695 | node: rowNode,
|
9696 | data: rowNode.data,
|
9697 | colDef: column.getColDef(),
|
9698 | context: gridOptionsService.context,
|
9699 | columnApi: gridOptionsService.columnApi
|
9700 | };
|
9701 |
|
9702 | if (colDefFunc) {
|
9703 | var colDefFuncResult = colDefFunc(params);
|
9704 |
|
9705 | if (colDefFuncResult) {
|
9706 | return true;
|
9707 | }
|
9708 | }
|
9709 |
|
9710 | return false;
|
9711 | }
|
9712 | function isUserSuppressingHeaderKeyboardEvent(gridOptionsService, keyboardEvent, headerRowIndex, column) {
|
9713 | var colDef = column.getDefinition();
|
9714 | var colDefFunc = colDef && colDef.suppressHeaderKeyboardEvent;
|
9715 | if (!exists(colDefFunc)) {
|
9716 | return false;
|
9717 | }
|
9718 | var params = {
|
9719 | api: gridOptionsService.api,
|
9720 | columnApi: gridOptionsService.columnApi,
|
9721 | context: gridOptionsService.context,
|
9722 | colDef: colDef,
|
9723 | column: column,
|
9724 | headerRowIndex: headerRowIndex,
|
9725 | event: keyboardEvent
|
9726 | };
|
9727 | return !!colDefFunc(params);
|
9728 | }
|
9729 | function normaliseQwertyAzerty(keyboardEvent) {
|
9730 | var keyCode = keyboardEvent.keyCode;
|
9731 | var code;
|
9732 | switch (keyCode) {
|
9733 | case A_KEYCODE:
|
9734 | code = KeyCode.A;
|
9735 | break;
|
9736 | case C_KEYCODE:
|
9737 | code = KeyCode.C;
|
9738 | break;
|
9739 | case V_KEYCODE:
|
9740 | code = KeyCode.V;
|
9741 | break;
|
9742 | case D_KEYCODE:
|
9743 | code = KeyCode.D;
|
9744 | break;
|
9745 | case Z_KEYCODE:
|
9746 | code = KeyCode.Z;
|
9747 | break;
|
9748 | case Y_KEYCODE:
|
9749 | code = KeyCode.Y;
|
9750 | break;
|
9751 | default:
|
9752 | code = keyboardEvent.code;
|
9753 | }
|
9754 | return code;
|
9755 | }
|
9756 | function isDeleteKey(key, alwaysReturnFalseOnBackspace) {
|
9757 | if (alwaysReturnFalseOnBackspace === void 0) { alwaysReturnFalseOnBackspace = false; }
|
9758 | if (key === KeyCode.DELETE) {
|
9759 | return true;
|
9760 | }
|
9761 | if (!alwaysReturnFalseOnBackspace && key === KeyCode.BACKSPACE) {
|
9762 | return isMacOsUserAgent();
|
9763 | }
|
9764 | return false;
|
9765 | }
|
9766 |
|
9767 | var KeyboardUtils = Object.freeze({
|
9768 | __proto__: null,
|
9769 | isEventFromPrintableCharacter: isEventFromPrintableCharacter,
|
9770 | isUserSuppressingKeyboardEvent: isUserSuppressingKeyboardEvent,
|
9771 | isUserSuppressingHeaderKeyboardEvent: isUserSuppressingHeaderKeyboardEvent,
|
9772 | normaliseQwertyAzerty: normaliseQwertyAzerty,
|
9773 | isDeleteKey: isDeleteKey
|
9774 | });
|
9775 |
|
9776 |
|
9777 |
|
9778 |
|
9779 |
|
9780 |
|
9781 |
|
9782 |
|
9783 |
|
9784 |
|
9785 |
|
9786 |
|
9787 |
|
9788 |
|
9789 |
|
9790 | function areEventsNear(e1, e2, pixelCount) {
|
9791 |
|
9792 | if (pixelCount === 0) {
|
9793 | return false;
|
9794 | }
|
9795 | var diffX = Math.abs(e1.clientX - e2.clientX);
|
9796 | var diffY = Math.abs(e1.clientY - e2.clientY);
|
9797 | return Math.max(diffX, diffY) <= pixelCount;
|
9798 | }
|
9799 |
|
9800 | var MouseUtils = Object.freeze({
|
9801 | __proto__: null,
|
9802 | areEventsNear: areEventsNear
|
9803 | });
|
9804 |
|
9805 |
|
9806 |
|
9807 |
|
9808 |
|
9809 |
|
9810 |
|
9811 |
|
9812 |
|
9813 |
|
9814 |
|
9815 |
|
9816 |
|
9817 |
|
9818 |
|
9819 |
|
9820 |
|
9821 | function sortRowNodesByOrder(rowNodes, rowNodeOrder) {
|
9822 | if (!rowNodes) {
|
9823 | return false;
|
9824 | }
|
9825 | var comparator = function (nodeA, nodeB) {
|
9826 | var positionA = rowNodeOrder[nodeA.id];
|
9827 | var positionB = rowNodeOrder[nodeB.id];
|
9828 | var aHasIndex = positionA !== undefined;
|
9829 | var bHasIndex = positionB !== undefined;
|
9830 | var bothNodesAreUserNodes = aHasIndex && bHasIndex;
|
9831 | var bothNodesAreFillerNodes = !aHasIndex && !bHasIndex;
|
9832 | if (bothNodesAreUserNodes) {
|
9833 |
|
9834 |
|
9835 | return positionA - positionB;
|
9836 | }
|
9837 | if (bothNodesAreFillerNodes) {
|
9838 |
|
9839 |
|
9840 |
|
9841 |
|
9842 |
|
9843 |
|
9844 |
|
9845 |
|
9846 |
|
9847 | return nodeA.__objectId - nodeB.__objectId;
|
9848 | }
|
9849 | if (aHasIndex) {
|
9850 | return 1;
|
9851 | }
|
9852 | return -1;
|
9853 | };
|
9854 |
|
9855 | var rowNodeA;
|
9856 | var rowNodeB;
|
9857 | var atLeastOneOutOfOrder = false;
|
9858 | for (var i = 0; i < rowNodes.length - 1; i++) {
|
9859 | rowNodeA = rowNodes[i];
|
9860 | rowNodeB = rowNodes[i + 1];
|
9861 | if (comparator(rowNodeA, rowNodeB) > 0) {
|
9862 | atLeastOneOutOfOrder = true;
|
9863 | break;
|
9864 | }
|
9865 | }
|
9866 | if (atLeastOneOutOfOrder) {
|
9867 | rowNodes.sort(comparator);
|
9868 | return true;
|
9869 | }
|
9870 | return false;
|
9871 | }
|
9872 | function traverseNodesWithKey(nodes, callback) {
|
9873 | var keyParts = [];
|
9874 | recursiveSearchNodes(nodes);
|
9875 | function recursiveSearchNodes(currentNodes) {
|
9876 | if (!currentNodes) {
|
9877 | return;
|
9878 | }
|
9879 | currentNodes.forEach(function (node) {
|
9880 |
|
9881 | if (node.group || node.hasChildren()) {
|
9882 | keyParts.push(node.key);
|
9883 | var key = keyParts.join('|');
|
9884 | callback(node, key);
|
9885 | recursiveSearchNodes(node.childrenAfterGroup);
|
9886 | keyParts.pop();
|
9887 | }
|
9888 | });
|
9889 | }
|
9890 | }
|
9891 |
|
9892 | var RowNodeUtils = Object.freeze({
|
9893 | __proto__: null,
|
9894 | sortRowNodesByOrder: sortRowNodesByOrder,
|
9895 | traverseNodesWithKey: traverseNodesWithKey
|
9896 | });
|
9897 |
|
9898 |
|
9899 |
|
9900 |
|
9901 |
|
9902 |
|
9903 |
|
9904 | function convertToSet(list) {
|
9905 | var set = new Set();
|
9906 | list.forEach(function (x) { return set.add(x); });
|
9907 | return set;
|
9908 | }
|
9909 |
|
9910 | var SetUtils = /*#__PURE__*/Object.freeze({
|
9911 | __proto__: null,
|
9912 | convertToSet: convertToSet
|
9913 | });
|
9914 |
|
9915 |
|
9916 |
|
9917 |
|
9918 |
|
9919 |
|
9920 |
|
9921 | var __assign$k = (undefined && undefined.__assign) || function () {
|
9922 | __assign$k = Object.assign || function(t) {
|
9923 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
9924 | s = arguments[i];
|
9925 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
9926 | t[p] = s[p];
|
9927 | }
|
9928 | return t;
|
9929 | };
|
9930 | return __assign$k.apply(this, arguments);
|
9931 | };
|
9932 | var utils = __assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k(__assign$k({}, AriaUtils), ArrayUtils), BrowserUtils), DateUtils), DomUtils), EventUtils), FunctionUtils), FuzzyMatchUtils), GenericUtils), IconUtils), KeyboardUtils), MapUtils), MouseUtils), NumberUtils), ObjectUtils), RowNodeUtils), SetUtils), StringUtils);
|
9933 | var _ = utils;
|
9934 |
|
9935 |
|
9936 |
|
9937 |
|
9938 |
|
9939 |
|
9940 |
|
9941 | var NumberSequence = (function () {
|
9942 | function NumberSequence(initValue, step) {
|
9943 | if (initValue === void 0) { initValue = 0; }
|
9944 | if (step === void 0) { step = 1; }
|
9945 | this.nextValue = initValue;
|
9946 | this.step = step;
|
9947 | }
|
9948 | NumberSequence.prototype.next = function () {
|
9949 | var valToReturn = this.nextValue;
|
9950 | this.nextValue += this.step;
|
9951 | return valToReturn;
|
9952 | };
|
9953 | NumberSequence.prototype.peek = function () {
|
9954 | return this.nextValue;
|
9955 | };
|
9956 | NumberSequence.prototype.skip = function (count) {
|
9957 | this.nextValue += count;
|
9958 | };
|
9959 | return NumberSequence;
|
9960 | }());
|
9961 |
|
9962 |
|
9963 |
|
9964 |
|
9965 |
|
9966 |
|
9967 |
|
9968 | var AgPromiseStatus;
|
9969 | (function (AgPromiseStatus) {
|
9970 | AgPromiseStatus[AgPromiseStatus["IN_PROGRESS"] = 0] = "IN_PROGRESS";
|
9971 | AgPromiseStatus[AgPromiseStatus["RESOLVED"] = 1] = "RESOLVED";
|
9972 | })(AgPromiseStatus || (AgPromiseStatus = {}));
|
9973 | var AgPromise = (function () {
|
9974 | function AgPromise(callback) {
|
9975 | var _this = this;
|
9976 | this.status = AgPromiseStatus.IN_PROGRESS;
|
9977 | this.resolution = null;
|
9978 | this.waiters = [];
|
9979 | callback(function (value) { return _this.onDone(value); }, function (params) { return _this.onReject(params); });
|
9980 | }
|
9981 | AgPromise.all = function (promises) {
|
9982 | return new AgPromise(function (resolve) {
|
9983 | var remainingToResolve = promises.length;
|
9984 | var combinedValues = new Array(remainingToResolve);
|
9985 | promises.forEach(function (promise, index) {
|
9986 | promise.then(function (value) {
|
9987 | combinedValues[index] = value;
|
9988 | remainingToResolve--;
|
9989 | if (remainingToResolve === 0) {
|
9990 | resolve(combinedValues);
|
9991 | }
|
9992 | });
|
9993 | });
|
9994 | });
|
9995 | };
|
9996 | AgPromise.resolve = function (value) {
|
9997 | if (value === void 0) { value = null; }
|
9998 | return new AgPromise(function (resolve) { return resolve(value); });
|
9999 | };
|
10000 | AgPromise.prototype.then = function (func) {
|
10001 | var _this = this;
|
10002 | return new AgPromise(function (resolve) {
|
10003 | if (_this.status === AgPromiseStatus.RESOLVED) {
|
10004 | resolve(func(_this.resolution));
|
10005 | }
|
10006 | else {
|
10007 | _this.waiters.push(function (value) { return resolve(func(value)); });
|
10008 | }
|
10009 | });
|
10010 | };
|
10011 | AgPromise.prototype.resolveNow = function (ifNotResolvedValue, ifResolved) {
|
10012 | return this.status === AgPromiseStatus.RESOLVED ? ifResolved(this.resolution) : ifNotResolvedValue;
|
10013 | };
|
10014 | AgPromise.prototype.onDone = function (value) {
|
10015 | this.status = AgPromiseStatus.RESOLVED;
|
10016 | this.resolution = value;
|
10017 | this.waiters.forEach(function (waiter) { return waiter(value); });
|
10018 | };
|
10019 | AgPromise.prototype.onReject = function (params) {
|
10020 | console.warn('TBI');
|
10021 | };
|
10022 | return AgPromise;
|
10023 | }());
|
10024 |
|
10025 |
|
10026 |
|
10027 |
|
10028 |
|
10029 |
|
10030 |
|
10031 |
|
10032 |
|
10033 |
|
10034 | var Timer = (function () {
|
10035 | function Timer() {
|
10036 | this.timestamp = new Date().getTime();
|
10037 | }
|
10038 | Timer.prototype.print = function (msg) {
|
10039 | var duration = (new Date().getTime()) - this.timestamp;
|
10040 | console.info(msg + " = " + duration);
|
10041 | this.timestamp = new Date().getTime();
|
10042 | };
|
10043 | return Timer;
|
10044 | }());
|
10045 |
|
10046 |
|
10047 |
|
10048 |
|
10049 |
|
10050 |
|
10051 |
|
10052 | var __extends$2M = (undefined && undefined.__extends) || (function () {
|
10053 | var extendStatics = function (d, b) {
|
10054 | extendStatics = Object.setPrototypeOf ||
|
10055 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
10056 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
10057 | return extendStatics(d, b);
|
10058 | };
|
10059 | return function (d, b) {
|
10060 | extendStatics(d, b);
|
10061 | function __() { this.constructor = d; }
|
10062 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10063 | };
|
10064 | })();
|
10065 | var __assign$j = (undefined && undefined.__assign) || function () {
|
10066 | __assign$j = Object.assign || function(t) {
|
10067 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
10068 | s = arguments[i];
|
10069 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
10070 | t[p] = s[p];
|
10071 | }
|
10072 | return t;
|
10073 | };
|
10074 | return __assign$j.apply(this, arguments);
|
10075 | };
|
10076 | var __decorate$2n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
10077 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
10078 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
10079 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
10080 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
10081 | };
|
10082 | var TooltipStates;
|
10083 | (function (TooltipStates) {
|
10084 | TooltipStates[TooltipStates["NOTHING"] = 0] = "NOTHING";
|
10085 | TooltipStates[TooltipStates["WAITING_TO_SHOW"] = 1] = "WAITING_TO_SHOW";
|
10086 | TooltipStates[TooltipStates["SHOWING"] = 2] = "SHOWING";
|
10087 | })(TooltipStates || (TooltipStates = {}));
|
10088 | var CustomTooltipFeature = (function (_super) {
|
10089 | __extends$2M(CustomTooltipFeature, _super);
|
10090 | function CustomTooltipFeature(parentComp) {
|
10091 | var _this = _super.call(this) || this;
|
10092 | _this.DEFAULT_SHOW_TOOLTIP_DELAY = 2000;
|
10093 | _this.DEFAULT_HIDE_TOOLTIP_DELAY = 10000;
|
10094 | _this.SHOW_QUICK_TOOLTIP_DIFF = 1000;
|
10095 | _this.FADE_OUT_TOOLTIP_TIMEOUT = 1000;
|
10096 | _this.state = TooltipStates.NOTHING;
|
10097 |
|
10098 |
|
10099 |
|
10100 | _this.tooltipInstanceCount = 0;
|
10101 | _this.tooltipMouseTrack = false;
|
10102 | _this.parentComp = parentComp;
|
10103 | return _this;
|
10104 | }
|
10105 | CustomTooltipFeature.prototype.postConstruct = function () {
|
10106 | this.tooltipShowDelay = this.getTooltipDelay('show') || this.DEFAULT_SHOW_TOOLTIP_DELAY;
|
10107 | this.tooltipHideDelay = this.getTooltipDelay('hide') || this.DEFAULT_HIDE_TOOLTIP_DELAY;
|
10108 | this.tooltipMouseTrack = this.gridOptionsService.is('tooltipMouseTrack');
|
10109 | var el = this.parentComp.getGui();
|
10110 | this.addManagedListener(el, 'mouseenter', this.onMouseEnter.bind(this));
|
10111 | this.addManagedListener(el, 'mouseleave', this.onMouseLeave.bind(this));
|
10112 | this.addManagedListener(el, 'mousemove', this.onMouseMove.bind(this));
|
10113 | this.addManagedListener(el, 'mousedown', this.onMouseDown.bind(this));
|
10114 | this.addManagedListener(el, 'keydown', this.onKeyDown.bind(this));
|
10115 | };
|
10116 | CustomTooltipFeature.prototype.destroy = function () {
|
10117 |
|
10118 |
|
10119 | this.setToDoNothing();
|
10120 | _super.prototype.destroy.call(this);
|
10121 | };
|
10122 | CustomTooltipFeature.prototype.onMouseEnter = function (e) {
|
10123 | if (isIOSUserAgent()) {
|
10124 | return;
|
10125 | }
|
10126 |
|
10127 |
|
10128 |
|
10129 |
|
10130 | if (this.state != TooltipStates.NOTHING) {
|
10131 | return;
|
10132 | }
|
10133 |
|
10134 | var delay = this.isLastTooltipHiddenRecently() ? 200 : this.tooltipShowDelay;
|
10135 | this.showTooltipTimeoutId = window.setTimeout(this.showTooltip.bind(this), delay);
|
10136 | this.lastMouseEvent = e;
|
10137 | this.state = TooltipStates.WAITING_TO_SHOW;
|
10138 | };
|
10139 | CustomTooltipFeature.prototype.onMouseLeave = function () {
|
10140 | this.setToDoNothing();
|
10141 | };
|
10142 | CustomTooltipFeature.prototype.onKeyDown = function () {
|
10143 | this.setToDoNothing();
|
10144 | };
|
10145 | CustomTooltipFeature.prototype.setToDoNothing = function () {
|
10146 | if (this.state === TooltipStates.SHOWING) {
|
10147 | this.hideTooltip();
|
10148 | }
|
10149 | this.clearTimeouts();
|
10150 | this.state = TooltipStates.NOTHING;
|
10151 | };
|
10152 | CustomTooltipFeature.prototype.onMouseMove = function (e) {
|
10153 |
|
10154 |
|
10155 |
|
10156 | this.lastMouseEvent = e;
|
10157 | if (this.tooltipMouseTrack &&
|
10158 | this.state === TooltipStates.SHOWING &&
|
10159 | this.tooltipComp) {
|
10160 | this.positionTooltipUnderLastMouseEvent();
|
10161 | }
|
10162 | };
|
10163 | CustomTooltipFeature.prototype.onMouseDown = function () {
|
10164 | this.setToDoNothing();
|
10165 | };
|
10166 | CustomTooltipFeature.prototype.getTooltipDelay = function (type) {
|
10167 | var tooltipShowDelay = this.gridOptionsService.getNum('tooltipShowDelay');
|
10168 | var tooltipHideDelay = this.gridOptionsService.getNum('tooltipHideDelay');
|
10169 | var delay = type === 'show' ? tooltipShowDelay : tooltipHideDelay;
|
10170 | var capitalisedType = capitalise(type);
|
10171 | if (exists(delay)) {
|
10172 | if (delay < 0) {
|
10173 | doOnce(function () { return console.warn("AG Grid: tooltip" + capitalisedType + "Delay should not be lower than 0"); }, "tooltip" + capitalisedType + "DelayWarn");
|
10174 | }
|
10175 | return Math.max(200, delay);
|
10176 | }
|
10177 | return null;
|
10178 | };
|
10179 | CustomTooltipFeature.prototype.hideTooltip = function () {
|
10180 |
|
10181 |
|
10182 | if (this.tooltipComp) {
|
10183 | this.destroyTooltipComp();
|
10184 | CustomTooltipFeature.lastTooltipHideTime = new Date().getTime();
|
10185 | }
|
10186 | this.state = TooltipStates.NOTHING;
|
10187 | };
|
10188 | CustomTooltipFeature.prototype.destroyTooltipComp = function () {
|
10189 | var _this = this;
|
10190 |
|
10191 | this.tooltipComp.getGui().classList.add('ag-tooltip-hiding');
|
10192 |
|
10193 |
|
10194 | var tooltipPopupDestroyFunc = this.tooltipPopupDestroyFunc;
|
10195 | var tooltipComp = this.tooltipComp;
|
10196 | window.setTimeout(function () {
|
10197 | tooltipPopupDestroyFunc();
|
10198 | _this.getContext().destroyBean(tooltipComp);
|
10199 | }, this.FADE_OUT_TOOLTIP_TIMEOUT);
|
10200 | this.tooltipPopupDestroyFunc = undefined;
|
10201 | this.tooltipComp = undefined;
|
10202 | };
|
10203 | CustomTooltipFeature.prototype.isLastTooltipHiddenRecently = function () {
|
10204 |
|
10205 | var now = new Date().getTime();
|
10206 | var then = CustomTooltipFeature.lastTooltipHideTime;
|
10207 | return (now - then) < this.SHOW_QUICK_TOOLTIP_DIFF;
|
10208 | };
|
10209 | CustomTooltipFeature.prototype.showTooltip = function () {
|
10210 | var params = __assign$j({}, this.parentComp.getTooltipParams());
|
10211 | if (!exists(params.value)) {
|
10212 | this.setToDoNothing();
|
10213 | return;
|
10214 | }
|
10215 | this.state = TooltipStates.SHOWING;
|
10216 | this.tooltipInstanceCount++;
|
10217 |
|
10218 |
|
10219 |
|
10220 | var callback = this.newTooltipComponentCallback.bind(this, this.tooltipInstanceCount);
|
10221 | var userDetails = this.userComponentFactory.getTooltipCompDetails(params);
|
10222 | userDetails.newAgStackInstance().then(callback);
|
10223 | };
|
10224 | CustomTooltipFeature.prototype.newTooltipComponentCallback = function (tooltipInstanceCopy, tooltipComp) {
|
10225 | var compNoLongerNeeded = this.state !== TooltipStates.SHOWING || this.tooltipInstanceCount !== tooltipInstanceCopy;
|
10226 | if (compNoLongerNeeded) {
|
10227 | this.getContext().destroyBean(tooltipComp);
|
10228 | return;
|
10229 | }
|
10230 | var eGui = tooltipComp.getGui();
|
10231 | this.tooltipComp = tooltipComp;
|
10232 | if (!eGui.classList.contains('ag-tooltip')) {
|
10233 | eGui.classList.add('ag-tooltip-custom');
|
10234 | }
|
10235 | var translate = this.localeService.getLocaleTextFunc();
|
10236 | var addPopupRes = this.popupService.addPopup({
|
10237 | eChild: eGui,
|
10238 | ariaLabel: translate('ariaLabelTooltip', 'Tooltip')
|
10239 | });
|
10240 | if (addPopupRes) {
|
10241 | this.tooltipPopupDestroyFunc = addPopupRes.hideFunc;
|
10242 | }
|
10243 |
|
10244 | this.positionTooltipUnderLastMouseEvent();
|
10245 | this.hideTooltipTimeoutId = window.setTimeout(this.hideTooltip.bind(this), this.tooltipHideDelay);
|
10246 | };
|
10247 | CustomTooltipFeature.prototype.positionTooltipUnderLastMouseEvent = function () {
|
10248 | this.popupService.positionPopupUnderMouseEvent({
|
10249 | type: 'tooltip',
|
10250 | mouseEvent: this.lastMouseEvent,
|
10251 | ePopup: this.tooltipComp.getGui(),
|
10252 | nudgeY: 18,
|
10253 | skipObserver: this.tooltipMouseTrack
|
10254 | });
|
10255 | };
|
10256 | CustomTooltipFeature.prototype.clearTimeouts = function () {
|
10257 | if (this.showTooltipTimeoutId) {
|
10258 | window.clearTimeout(this.showTooltipTimeoutId);
|
10259 | this.showTooltipTimeoutId = undefined;
|
10260 | }
|
10261 | if (this.hideTooltipTimeoutId) {
|
10262 | window.clearTimeout(this.hideTooltipTimeoutId);
|
10263 | this.hideTooltipTimeoutId = undefined;
|
10264 | }
|
10265 | };
|
10266 | __decorate$2n([
|
10267 | Autowired('popupService')
|
10268 | ], CustomTooltipFeature.prototype, "popupService", void 0);
|
10269 | __decorate$2n([
|
10270 | Autowired('userComponentFactory')
|
10271 | ], CustomTooltipFeature.prototype, "userComponentFactory", void 0);
|
10272 | __decorate$2n([
|
10273 | Autowired('columnApi')
|
10274 | ], CustomTooltipFeature.prototype, "columnApi", void 0);
|
10275 | __decorate$2n([
|
10276 | Autowired('gridApi')
|
10277 | ], CustomTooltipFeature.prototype, "gridApi", void 0);
|
10278 | __decorate$2n([
|
10279 | PostConstruct
|
10280 | ], CustomTooltipFeature.prototype, "postConstruct", null);
|
10281 | return CustomTooltipFeature;
|
10282 | }(BeanStub));
|
10283 |
|
10284 |
|
10285 |
|
10286 |
|
10287 |
|
10288 |
|
10289 |
|
10290 | var CssClassManager = (function () {
|
10291 | function CssClassManager(getGui) {
|
10292 |
|
10293 |
|
10294 | this.cssClassStates = {};
|
10295 | this.getGui = getGui;
|
10296 | }
|
10297 | CssClassManager.prototype.addCssClass = function (className) {
|
10298 | var _this = this;
|
10299 | var list = (className || '').split(' ');
|
10300 | if (list.length > 1) {
|
10301 | list.forEach(function (cls) { return _this.addCssClass(cls); });
|
10302 | return;
|
10303 | }
|
10304 | var updateNeeded = this.cssClassStates[className] !== true;
|
10305 | if (updateNeeded && className.length) {
|
10306 | var eGui = this.getGui();
|
10307 | if (eGui) {
|
10308 | eGui.classList.add(className);
|
10309 | }
|
10310 | this.cssClassStates[className] = true;
|
10311 | }
|
10312 | };
|
10313 | CssClassManager.prototype.removeCssClass = function (className) {
|
10314 | var _this = this;
|
10315 | var list = (className || '').split(' ');
|
10316 | if (list.length > 1) {
|
10317 | list.forEach(function (cls) { return _this.removeCssClass(cls); });
|
10318 | return;
|
10319 | }
|
10320 | var updateNeeded = this.cssClassStates[className] !== false;
|
10321 | if (updateNeeded && className.length) {
|
10322 | var eGui = this.getGui();
|
10323 | if (eGui) {
|
10324 | eGui.classList.remove(className);
|
10325 | }
|
10326 | this.cssClassStates[className] = false;
|
10327 | }
|
10328 | };
|
10329 | CssClassManager.prototype.containsCssClass = function (className) {
|
10330 | var eGui = this.getGui();
|
10331 | if (!eGui) {
|
10332 | return false;
|
10333 | }
|
10334 | return eGui.classList.contains(className);
|
10335 | };
|
10336 | CssClassManager.prototype.addOrRemoveCssClass = function (className, addOrRemove) {
|
10337 | var _this = this;
|
10338 | if (!className) {
|
10339 | return;
|
10340 | }
|
10341 |
|
10342 |
|
10343 | if (className.indexOf(' ') >= 0) {
|
10344 | var list = (className || '').split(' ');
|
10345 | if (list.length > 1) {
|
10346 | list.forEach(function (cls) { return _this.addOrRemoveCssClass(cls, addOrRemove); });
|
10347 | return;
|
10348 | }
|
10349 | }
|
10350 | var updateNeeded = this.cssClassStates[className] !== addOrRemove;
|
10351 | if (updateNeeded && className.length) {
|
10352 | var eGui = this.getGui();
|
10353 | if (eGui) {
|
10354 | eGui.classList.toggle(className, addOrRemove);
|
10355 | }
|
10356 | this.cssClassStates[className] = addOrRemove;
|
10357 | }
|
10358 | };
|
10359 | return CssClassManager;
|
10360 | }());
|
10361 |
|
10362 |
|
10363 |
|
10364 |
|
10365 |
|
10366 |
|
10367 |
|
10368 | var __extends$2L = (undefined && undefined.__extends) || (function () {
|
10369 | var extendStatics = function (d, b) {
|
10370 | extendStatics = Object.setPrototypeOf ||
|
10371 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
10372 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
10373 | return extendStatics(d, b);
|
10374 | };
|
10375 | return function (d, b) {
|
10376 | extendStatics(d, b);
|
10377 | function __() { this.constructor = d; }
|
10378 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10379 | };
|
10380 | })();
|
10381 | var __decorate$2m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
10382 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
10383 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
10384 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
10385 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
10386 | };
|
10387 | var compIdSequence = new NumberSequence();
|
10388 | var Component = (function (_super) {
|
10389 | __extends$2L(Component, _super);
|
10390 | function Component(template) {
|
10391 | var _this = _super.call(this) || this;
|
10392 |
|
10393 | _this.displayed = true;
|
10394 |
|
10395 | _this.visible = true;
|
10396 |
|
10397 |
|
10398 |
|
10399 | _this.compId = compIdSequence.next();
|
10400 | _this.cssClassManager = new CssClassManager(function () { return _this.eGui; });
|
10401 | if (template) {
|
10402 | _this.setTemplate(template);
|
10403 | }
|
10404 | return _this;
|
10405 | }
|
10406 | Component.prototype.preConstructOnComponent = function () {
|
10407 | this.usingBrowserTooltips = this.gridOptionsService.is('enableBrowserTooltips');
|
10408 | };
|
10409 | Component.prototype.getCompId = function () {
|
10410 | return this.compId;
|
10411 | };
|
10412 | Component.prototype.getTooltipParams = function () {
|
10413 | return {
|
10414 | value: this.tooltipText,
|
10415 | location: 'UNKNOWN'
|
10416 | };
|
10417 | };
|
10418 | Component.prototype.setTooltip = function (newTooltipText) {
|
10419 | var _this = this;
|
10420 | var removeTooltip = function () {
|
10421 | if (_this.usingBrowserTooltips) {
|
10422 | _this.getGui().removeAttribute('title');
|
10423 | }
|
10424 | else {
|
10425 | _this.tooltipFeature = _this.destroyBean(_this.tooltipFeature);
|
10426 | }
|
10427 | };
|
10428 | var addTooltip = function () {
|
10429 | if (_this.usingBrowserTooltips) {
|
10430 | _this.getGui().setAttribute('title', _this.tooltipText);
|
10431 | }
|
10432 | else {
|
10433 | _this.tooltipFeature = _this.createBean(new CustomTooltipFeature(_this));
|
10434 | }
|
10435 | };
|
10436 | if (this.tooltipText != newTooltipText) {
|
10437 | if (this.tooltipText) {
|
10438 | removeTooltip();
|
10439 | }
|
10440 | if (newTooltipText != null) {
|
10441 | this.tooltipText = newTooltipText;
|
10442 | if (this.tooltipText) {
|
10443 | addTooltip();
|
10444 | }
|
10445 | }
|
10446 | }
|
10447 | };
|
10448 |
|
10449 | Component.prototype.createChildComponentsFromTags = function (parentNode, paramsMap) {
|
10450 | var _this = this;
|
10451 |
|
10452 |
|
10453 | var childNodeList = copyNodeList(parentNode.childNodes);
|
10454 | childNodeList.forEach(function (childNode) {
|
10455 | if (!(childNode instanceof HTMLElement)) {
|
10456 | return;
|
10457 | }
|
10458 | var childComp = _this.createComponentFromElement(childNode, function (childComp) {
|
10459 |
|
10460 |
|
10461 | var childGui = childComp.getGui();
|
10462 | if (childGui) {
|
10463 | _this.copyAttributesFromNode(childNode, childComp.getGui());
|
10464 | }
|
10465 | }, paramsMap);
|
10466 | if (childComp) {
|
10467 | if (childComp.addItems && childNode.children.length) {
|
10468 | _this.createChildComponentsFromTags(childNode, paramsMap);
|
10469 |
|
10470 | var items = Array.prototype.slice.call(childNode.children);
|
10471 | childComp.addItems(items);
|
10472 | }
|
10473 |
|
10474 | _this.swapComponentForNode(childComp, parentNode, childNode);
|
10475 | }
|
10476 | else if (childNode.childNodes) {
|
10477 | _this.createChildComponentsFromTags(childNode, paramsMap);
|
10478 | }
|
10479 | });
|
10480 | };
|
10481 | Component.prototype.createComponentFromElement = function (element, afterPreCreateCallback, paramsMap) {
|
10482 | var key = element.nodeName;
|
10483 | var componentParams = paramsMap ? paramsMap[element.getAttribute('ref')] : undefined;
|
10484 | var ComponentClass = this.agStackComponentsRegistry.getComponentClass(key);
|
10485 | if (ComponentClass) {
|
10486 | Component.elementGettingCreated = element;
|
10487 | var newComponent = new ComponentClass(componentParams);
|
10488 | newComponent.setParentComponent(this);
|
10489 | this.createBean(newComponent, null, afterPreCreateCallback);
|
10490 | return newComponent;
|
10491 | }
|
10492 | return null;
|
10493 | };
|
10494 | Component.prototype.copyAttributesFromNode = function (source, dest) {
|
10495 | iterateNamedNodeMap(source.attributes, function (name, value) { return dest.setAttribute(name, value); });
|
10496 | };
|
10497 | Component.prototype.swapComponentForNode = function (newComponent, parentNode, childNode) {
|
10498 | var eComponent = newComponent.getGui();
|
10499 | parentNode.replaceChild(eComponent, childNode);
|
10500 | parentNode.insertBefore(document.createComment(childNode.nodeName), eComponent);
|
10501 | this.addDestroyFunc(this.destroyBean.bind(this, newComponent));
|
10502 | this.swapInComponentForQuerySelectors(newComponent, childNode);
|
10503 | };
|
10504 | Component.prototype.swapInComponentForQuerySelectors = function (newComponent, childNode) {
|
10505 | var thisNoType = this;
|
10506 | this.iterateOverQuerySelectors(function (querySelector) {
|
10507 | if (thisNoType[querySelector.attributeName] === childNode) {
|
10508 | thisNoType[querySelector.attributeName] = newComponent;
|
10509 | }
|
10510 | });
|
10511 | };
|
10512 | Component.prototype.iterateOverQuerySelectors = function (action) {
|
10513 | var thisPrototype = Object.getPrototypeOf(this);
|
10514 | while (thisPrototype != null) {
|
10515 | var metaData = thisPrototype.__agComponentMetaData;
|
10516 | var currentProtoName = getFunctionName(thisPrototype.constructor);
|
10517 | if (metaData && metaData[currentProtoName] && metaData[currentProtoName].querySelectors) {
|
10518 | metaData[currentProtoName].querySelectors.forEach(function (querySelector) { return action(querySelector); });
|
10519 | }
|
10520 | thisPrototype = Object.getPrototypeOf(thisPrototype);
|
10521 | }
|
10522 | };
|
10523 | Component.prototype.setTemplate = function (template, paramsMap) {
|
10524 | var eGui = loadTemplate(template);
|
10525 | this.setTemplateFromElement(eGui, paramsMap);
|
10526 | };
|
10527 | Component.prototype.setTemplateFromElement = function (element, paramsMap) {
|
10528 | this.eGui = element;
|
10529 | this.eGui.__agComponent = this;
|
10530 | this.wireQuerySelectors();
|
10531 |
|
10532 | if (!!this.getContext()) {
|
10533 | this.createChildComponentsFromTags(this.getGui(), paramsMap);
|
10534 | }
|
10535 | };
|
10536 | Component.prototype.createChildComponentsPreConstruct = function () {
|
10537 |
|
10538 |
|
10539 | if (!!this.getGui()) {
|
10540 | this.createChildComponentsFromTags(this.getGui());
|
10541 | }
|
10542 | };
|
10543 | Component.prototype.wireQuerySelectors = function () {
|
10544 | var _this = this;
|
10545 | if (!this.eGui) {
|
10546 | return;
|
10547 | }
|
10548 | var thisNoType = this;
|
10549 | this.iterateOverQuerySelectors(function (querySelector) {
|
10550 | var setResult = function (result) { return thisNoType[querySelector.attributeName] = result; };
|
10551 |
|
10552 |
|
10553 |
|
10554 | var topLevelRefMatch = querySelector.refSelector
|
10555 | && _this.eGui.getAttribute('ref') === querySelector.refSelector;
|
10556 | if (topLevelRefMatch) {
|
10557 | setResult(_this.eGui);
|
10558 | }
|
10559 | else {
|
10560 |
|
10561 | var resultOfQuery = _this.eGui.querySelector(querySelector.querySelector);
|
10562 | if (resultOfQuery) {
|
10563 | setResult(resultOfQuery.__agComponent || resultOfQuery);
|
10564 | }
|
10565 | }
|
10566 | });
|
10567 | };
|
10568 | Component.prototype.getGui = function () {
|
10569 | return this.eGui;
|
10570 | };
|
10571 | Component.prototype.getFocusableElement = function () {
|
10572 | return this.eGui;
|
10573 | };
|
10574 | Component.prototype.setParentComponent = function (component) {
|
10575 | this.parentComponent = component;
|
10576 | };
|
10577 | Component.prototype.getParentComponent = function () {
|
10578 | return this.parentComponent;
|
10579 | };
|
10580 |
|
10581 |
|
10582 | Component.prototype.setGui = function (eGui) {
|
10583 | this.eGui = eGui;
|
10584 | };
|
10585 | Component.prototype.queryForHtmlElement = function (cssSelector) {
|
10586 | return this.eGui.querySelector(cssSelector);
|
10587 | };
|
10588 | Component.prototype.queryForHtmlInputElement = function (cssSelector) {
|
10589 | return this.eGui.querySelector(cssSelector);
|
10590 | };
|
10591 | Component.prototype.appendChild = function (newChild, container) {
|
10592 | if (newChild == null) {
|
10593 | return;
|
10594 | }
|
10595 | if (!container) {
|
10596 | container = this.eGui;
|
10597 | }
|
10598 | if (isNodeOrElement(newChild)) {
|
10599 | container.appendChild(newChild);
|
10600 | }
|
10601 | else {
|
10602 | var childComponent = newChild;
|
10603 | container.appendChild(childComponent.getGui());
|
10604 | }
|
10605 | };
|
10606 | Component.prototype.isDisplayed = function () {
|
10607 | return this.displayed;
|
10608 | };
|
10609 | Component.prototype.setVisible = function (visible, options) {
|
10610 | if (options === void 0) { options = {}; }
|
10611 | if (visible !== this.visible) {
|
10612 | this.visible = visible;
|
10613 | var skipAriaHidden = options.skipAriaHidden;
|
10614 | setVisible(this.eGui, visible, { skipAriaHidden: skipAriaHidden });
|
10615 | }
|
10616 | };
|
10617 | Component.prototype.setDisplayed = function (displayed, options) {
|
10618 | if (options === void 0) { options = {}; }
|
10619 | if (displayed !== this.displayed) {
|
10620 | this.displayed = displayed;
|
10621 | var skipAriaHidden = options.skipAriaHidden;
|
10622 | setDisplayed(this.eGui, displayed, { skipAriaHidden: skipAriaHidden });
|
10623 | var event_1 = {
|
10624 | type: Component.EVENT_DISPLAYED_CHANGED,
|
10625 | visible: this.displayed
|
10626 | };
|
10627 | this.dispatchEvent(event_1);
|
10628 | }
|
10629 | };
|
10630 | Component.prototype.destroy = function () {
|
10631 | if (this.tooltipFeature) {
|
10632 | this.tooltipFeature = this.destroyBean(this.tooltipFeature);
|
10633 | }
|
10634 | if (this.parentComponent) {
|
10635 | this.parentComponent = undefined;
|
10636 | }
|
10637 | var eGui = this.eGui;
|
10638 | if (eGui && eGui.__agComponent) {
|
10639 | eGui.__agComponent = undefined;
|
10640 | }
|
10641 | _super.prototype.destroy.call(this);
|
10642 | };
|
10643 | Component.prototype.addGuiEventListener = function (event, listener, options) {
|
10644 | var _this = this;
|
10645 | this.eGui.addEventListener(event, listener, options);
|
10646 | this.addDestroyFunc(function () { return _this.eGui.removeEventListener(event, listener); });
|
10647 | };
|
10648 | Component.prototype.addCssClass = function (className) {
|
10649 | this.cssClassManager.addCssClass(className);
|
10650 | };
|
10651 | Component.prototype.removeCssClass = function (className) {
|
10652 | this.cssClassManager.removeCssClass(className);
|
10653 | };
|
10654 | Component.prototype.containsCssClass = function (className) {
|
10655 | return this.cssClassManager.containsCssClass(className);
|
10656 | };
|
10657 | Component.prototype.addOrRemoveCssClass = function (className, addOrRemove) {
|
10658 | this.cssClassManager.addOrRemoveCssClass(className, addOrRemove);
|
10659 | };
|
10660 | Component.prototype.getAttribute = function (key) {
|
10661 | var eGui = this.eGui;
|
10662 | return eGui ? eGui.getAttribute(key) : null;
|
10663 | };
|
10664 | Component.prototype.getRefElement = function (refName) {
|
10665 | return this.queryForHtmlElement("[ref=\"" + refName + "\"]");
|
10666 | };
|
10667 | Component.EVENT_DISPLAYED_CHANGED = 'displayedChanged';
|
10668 | __decorate$2m([
|
10669 | Autowired('agStackComponentsRegistry')
|
10670 | ], Component.prototype, "agStackComponentsRegistry", void 0);
|
10671 | __decorate$2m([
|
10672 | PreConstruct
|
10673 | ], Component.prototype, "preConstructOnComponent", null);
|
10674 | __decorate$2m([
|
10675 | PreConstruct
|
10676 | ], Component.prototype, "createChildComponentsPreConstruct", null);
|
10677 | return Component;
|
10678 | }(BeanStub));
|
10679 |
|
10680 |
|
10681 |
|
10682 |
|
10683 |
|
10684 |
|
10685 |
|
10686 | function QuerySelector(selector) {
|
10687 | return querySelectorFunc.bind(this, selector, undefined);
|
10688 | }
|
10689 | function RefSelector(ref) {
|
10690 | return querySelectorFunc.bind(this, "[ref=" + ref + "]", ref);
|
10691 | }
|
10692 | function querySelectorFunc(selector, refSelector, classPrototype, methodOrAttributeName, index) {
|
10693 | if (selector === null) {
|
10694 | console.error('AG Grid: QuerySelector selector should not be null');
|
10695 | return;
|
10696 | }
|
10697 | if (typeof index === 'number') {
|
10698 | console.error('AG Grid: QuerySelector should be on an attribute');
|
10699 | return;
|
10700 | }
|
10701 | addToObjectProps(classPrototype, 'querySelectors', {
|
10702 | attributeName: methodOrAttributeName,
|
10703 | querySelector: selector,
|
10704 | refSelector: refSelector
|
10705 | });
|
10706 | }
|
10707 |
|
10708 |
|
10709 |
|
10710 |
|
10711 |
|
10712 |
|
10713 |
|
10714 |
|
10715 |
|
10716 |
|
10717 |
|
10718 |
|
10719 |
|
10720 |
|
10721 |
|
10722 |
|
10723 | function addToObjectProps(target, key, value) {
|
10724 |
|
10725 | var props = getOrCreateProps(target, getFunctionName(target.constructor));
|
10726 | if (!props[key]) {
|
10727 | props[key] = [];
|
10728 | }
|
10729 | props[key].push(value);
|
10730 | }
|
10731 | function getOrCreateProps(target, instanceName) {
|
10732 | if (!target.__agComponentMetaData) {
|
10733 | target.__agComponentMetaData = {};
|
10734 | }
|
10735 | if (!target.__agComponentMetaData[instanceName]) {
|
10736 | target.__agComponentMetaData[instanceName] = {};
|
10737 | }
|
10738 | return target.__agComponentMetaData[instanceName];
|
10739 | }
|
10740 |
|
10741 |
|
10742 |
|
10743 |
|
10744 |
|
10745 |
|
10746 |
|
10747 | var __extends$2K = (undefined && undefined.__extends) || (function () {
|
10748 | var extendStatics = function (d, b) {
|
10749 | extendStatics = Object.setPrototypeOf ||
|
10750 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
10751 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
10752 | return extendStatics(d, b);
|
10753 | };
|
10754 | return function (d, b) {
|
10755 | extendStatics(d, b);
|
10756 | function __() { this.constructor = d; }
|
10757 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10758 | };
|
10759 | })();
|
10760 | var __decorate$2l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
10761 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
10762 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
10763 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
10764 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
10765 | };
|
10766 |
|
10767 |
|
10768 |
|
10769 | var ReadOnlyFloatingFilter = (function (_super) {
|
10770 | __extends$2K(ReadOnlyFloatingFilter, _super);
|
10771 | function ReadOnlyFloatingFilter() {
|
10772 | 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;
|
10773 | }
|
10774 |
|
10775 |
|
10776 | ReadOnlyFloatingFilter.prototype.destroy = function () {
|
10777 | _super.prototype.destroy.call(this);
|
10778 | };
|
10779 | ReadOnlyFloatingFilter.prototype.init = function (params) {
|
10780 | this.params = params;
|
10781 | var displayName = this.columnModel.getDisplayNameForColumn(params.column, 'header', true);
|
10782 | var translate = this.localeService.getLocaleTextFunc();
|
10783 | this.eFloatingFilterText
|
10784 | .setDisabled(true)
|
10785 | .setInputAriaLabel(displayName + " " + translate('ariaFilterInput', 'Filter Input'));
|
10786 | };
|
10787 | ReadOnlyFloatingFilter.prototype.onParentModelChanged = function (parentModel) {
|
10788 | var _this = this;
|
10789 | if (!parentModel) {
|
10790 | this.eFloatingFilterText.setValue('');
|
10791 | return;
|
10792 | }
|
10793 | this.params.parentFilterInstance(function (filterInstance) {
|
10794 |
|
10795 |
|
10796 |
|
10797 |
|
10798 | if (filterInstance.getModelAsString) {
|
10799 | var modelAsString = filterInstance.getModelAsString(parentModel);
|
10800 | _this.eFloatingFilterText.setValue(modelAsString);
|
10801 | }
|
10802 | });
|
10803 | };
|
10804 | __decorate$2l([
|
10805 | RefSelector('eFloatingFilterText')
|
10806 | ], ReadOnlyFloatingFilter.prototype, "eFloatingFilterText", void 0);
|
10807 | __decorate$2l([
|
10808 | Autowired('columnModel')
|
10809 | ], ReadOnlyFloatingFilter.prototype, "columnModel", void 0);
|
10810 | return ReadOnlyFloatingFilter;
|
10811 | }(Component));
|
10812 |
|
10813 |
|
10814 |
|
10815 |
|
10816 |
|
10817 |
|
10818 |
|
10819 |
|
10820 |
|
10821 | var DateCompWrapper = (function () {
|
10822 | function DateCompWrapper(context, userComponentFactory, dateComponentParams, eParent) {
|
10823 | var _this = this;
|
10824 | this.alive = true;
|
10825 | this.context = context;
|
10826 | this.eParent = eParent;
|
10827 | var compDetails = userComponentFactory.getDateCompDetails(dateComponentParams);
|
10828 | var promise = compDetails.newAgStackInstance();
|
10829 | promise.then(function (dateComp) {
|
10830 |
|
10831 | if (!_this.alive) {
|
10832 | context.destroyBean(dateComp);
|
10833 | return;
|
10834 | }
|
10835 | _this.dateComp = dateComp;
|
10836 | if (!dateComp) {
|
10837 | return;
|
10838 | }
|
10839 | eParent.appendChild(dateComp.getGui());
|
10840 | if (dateComp.afterGuiAttached) {
|
10841 | dateComp.afterGuiAttached();
|
10842 | }
|
10843 | if (_this.tempValue) {
|
10844 | dateComp.setDate(_this.tempValue);
|
10845 | }
|
10846 | if (_this.disabled != null) {
|
10847 | _this.setDateCompDisabled(_this.disabled);
|
10848 | }
|
10849 | });
|
10850 | }
|
10851 | DateCompWrapper.prototype.destroy = function () {
|
10852 | this.alive = false;
|
10853 | this.dateComp = this.context.destroyBean(this.dateComp);
|
10854 | };
|
10855 | DateCompWrapper.prototype.getDate = function () {
|
10856 | return this.dateComp ? this.dateComp.getDate() : this.tempValue;
|
10857 | };
|
10858 | DateCompWrapper.prototype.setDate = function (value) {
|
10859 | if (this.dateComp) {
|
10860 | this.dateComp.setDate(value);
|
10861 | }
|
10862 | else {
|
10863 | this.tempValue = value;
|
10864 | }
|
10865 | };
|
10866 | DateCompWrapper.prototype.setDisabled = function (disabled) {
|
10867 | if (this.dateComp) {
|
10868 | this.setDateCompDisabled(disabled);
|
10869 | }
|
10870 | else {
|
10871 | this.disabled = disabled;
|
10872 | }
|
10873 | };
|
10874 | DateCompWrapper.prototype.setDisplayed = function (displayed) {
|
10875 | setDisplayed(this.eParent, displayed);
|
10876 | };
|
10877 | DateCompWrapper.prototype.setInputPlaceholder = function (placeholder) {
|
10878 | if (this.dateComp && this.dateComp.setInputPlaceholder) {
|
10879 | this.dateComp.setInputPlaceholder(placeholder);
|
10880 | }
|
10881 | };
|
10882 | DateCompWrapper.prototype.setInputAriaLabel = function (label) {
|
10883 | if (this.dateComp && this.dateComp.setInputAriaLabel) {
|
10884 | this.dateComp.setInputAriaLabel(label);
|
10885 | }
|
10886 | };
|
10887 | DateCompWrapper.prototype.afterGuiAttached = function (params) {
|
10888 | if (this.dateComp && typeof this.dateComp.afterGuiAttached === 'function') {
|
10889 | this.dateComp.afterGuiAttached(params);
|
10890 | }
|
10891 | };
|
10892 | DateCompWrapper.prototype.setDateCompDisabled = function (disabled) {
|
10893 | if (this.dateComp == null) {
|
10894 | return;
|
10895 | }
|
10896 | if (this.dateComp.setDisabled == null) {
|
10897 | return;
|
10898 | }
|
10899 | this.dateComp.setDisabled(disabled);
|
10900 | };
|
10901 | return DateCompWrapper;
|
10902 | }());
|
10903 |
|
10904 |
|
10905 |
|
10906 |
|
10907 |
|
10908 |
|
10909 |
|
10910 | var __assign$i = (undefined && undefined.__assign) || function () {
|
10911 | __assign$i = Object.assign || function(t) {
|
10912 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
10913 | s = arguments[i];
|
10914 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
10915 | t[p] = s[p];
|
10916 | }
|
10917 | return t;
|
10918 | };
|
10919 | return __assign$i.apply(this, arguments);
|
10920 | };
|
10921 |
|
10922 | var OptionsFactory = (function () {
|
10923 | function OptionsFactory() {
|
10924 | this.customFilterOptions = {};
|
10925 | }
|
10926 | OptionsFactory.prototype.init = function (params, defaultOptions) {
|
10927 | this.filterOptions = params.filterOptions || defaultOptions;
|
10928 | this.mapCustomOptions();
|
10929 | this.selectDefaultItem(params);
|
10930 | this.checkForDeprecatedParams();
|
10931 | };
|
10932 | OptionsFactory.prototype.checkForDeprecatedParams = function () {
|
10933 | if (this.filterOptions.some(function (opt) { return typeof opt != 'string' && opt.test != null; })) {
|
10934 | console.warn("AG Grid: [IFilterOptionDef] since v26.2.0, test() has been replaced with predicate().");
|
10935 | }
|
10936 | if (this.filterOptions.some(function (opt) { return typeof opt != 'string' && opt.hideFilterInput != null; })) {
|
10937 | console.warn("AG Grid: [IFilterOptionDef] since v26.2.0, useOfHideFilterInput has been replaced with numberOfInputs.");
|
10938 | }
|
10939 | };
|
10940 | OptionsFactory.prototype.getFilterOptions = function () {
|
10941 | return this.filterOptions;
|
10942 | };
|
10943 | OptionsFactory.prototype.mapCustomOptions = function () {
|
10944 | var _this = this;
|
10945 | if (!this.filterOptions) {
|
10946 | return;
|
10947 | }
|
10948 | this.filterOptions.forEach(function (filterOption) {
|
10949 | if (typeof filterOption === 'string') {
|
10950 | return;
|
10951 | }
|
10952 | var requiredProperties = [['displayKey'], ['displayName'], ['predicate', 'test']];
|
10953 | var propertyCheck = function (keys) {
|
10954 | if (!keys.some(function (key) { return filterOption[key] != null; })) {
|
10955 | console.warn("AG Grid: ignoring FilterOptionDef as it doesn't contain one of '" + keys + "'");
|
10956 | return false;
|
10957 | }
|
10958 | return true;
|
10959 | };
|
10960 | if (!requiredProperties.every(propertyCheck)) {
|
10961 | _this.filterOptions = _this.filterOptions.filter(function (v) { return v === filterOption; }) || [];
|
10962 | return;
|
10963 | }
|
10964 | var test = filterOption.test;
|
10965 | var mutatedFilterOptions = __assign$i({}, filterOption);
|
10966 | if (test != null && filterOption.predicate == null) {
|
10967 | mutatedFilterOptions.predicate = function (v, cv) { return test(v[0], cv); };
|
10968 | delete mutatedFilterOptions.test;
|
10969 | }
|
10970 | if (mutatedFilterOptions.hideFilterInput && mutatedFilterOptions.numberOfInputs == null) {
|
10971 | mutatedFilterOptions.numberOfInputs = 0;
|
10972 | delete mutatedFilterOptions.hideFilterInput;
|
10973 | }
|
10974 | _this.customFilterOptions[filterOption.displayKey] = mutatedFilterOptions;
|
10975 | });
|
10976 | };
|
10977 | OptionsFactory.prototype.selectDefaultItem = function (params) {
|
10978 | if (params.defaultOption) {
|
10979 | this.defaultOption = params.defaultOption;
|
10980 | }
|
10981 | else if (this.filterOptions.length >= 1) {
|
10982 | var firstFilterOption = this.filterOptions[0];
|
10983 | if (typeof firstFilterOption === 'string') {
|
10984 | this.defaultOption = firstFilterOption;
|
10985 | }
|
10986 | else if (firstFilterOption.displayKey) {
|
10987 | this.defaultOption = firstFilterOption.displayKey;
|
10988 | }
|
10989 | else {
|
10990 | console.warn("AG Grid: invalid FilterOptionDef supplied as it doesn't contain a 'displayKey'");
|
10991 | }
|
10992 | }
|
10993 | else {
|
10994 | console.warn('AG Grid: no filter options for filter');
|
10995 | }
|
10996 | };
|
10997 | OptionsFactory.prototype.getDefaultOption = function () {
|
10998 | return this.defaultOption;
|
10999 | };
|
11000 | OptionsFactory.prototype.getCustomOption = function (name) {
|
11001 | return this.customFilterOptions[name];
|
11002 | };
|
11003 | return OptionsFactory;
|
11004 | }());
|
11005 |
|
11006 |
|
11007 |
|
11008 |
|
11009 |
|
11010 |
|
11011 |
|
11012 | var DEFAULT_FILTER_LOCALE_TEXT = {
|
11013 | applyFilter: 'Apply',
|
11014 | clearFilter: 'Clear',
|
11015 | resetFilter: 'Reset',
|
11016 | cancelFilter: 'Cancel',
|
11017 | textFilter: 'Text Filter',
|
11018 | numberFilter: 'Number Filter',
|
11019 | dateFilter: 'Date Filter',
|
11020 | setFilter: 'Set Filter',
|
11021 | filterOoo: 'Filter...',
|
11022 | empty: 'Choose One',
|
11023 | equals: 'Equals',
|
11024 | notEqual: 'Not equal',
|
11025 | lessThan: 'Less than',
|
11026 | greaterThan: 'Greater than',
|
11027 | inRange: 'In range',
|
11028 | inRangeStart: 'From',
|
11029 | inRangeEnd: 'To',
|
11030 | lessThanOrEqual: 'Less than or equals',
|
11031 | greaterThanOrEqual: 'Greater than or equals',
|
11032 | contains: 'Contains',
|
11033 | notContains: 'Not contains',
|
11034 | startsWith: 'Starts with',
|
11035 | endsWith: 'Ends with',
|
11036 | blank: 'Blank',
|
11037 | notBlank: 'Not blank',
|
11038 | andCondition: 'AND',
|
11039 | orCondition: 'OR',
|
11040 | dateFormatOoo: 'yyyy-mm-dd',
|
11041 | };
|
11042 |
|
11043 |
|
11044 |
|
11045 |
|
11046 |
|
11047 |
|
11048 |
|
11049 | var __extends$2J = (undefined && undefined.__extends) || (function () {
|
11050 | var extendStatics = function (d, b) {
|
11051 | extendStatics = Object.setPrototypeOf ||
|
11052 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11053 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
11054 | return extendStatics(d, b);
|
11055 | };
|
11056 | return function (d, b) {
|
11057 | extendStatics(d, b);
|
11058 | function __() { this.constructor = d; }
|
11059 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11060 | };
|
11061 | })();
|
11062 | var __assign$h = (undefined && undefined.__assign) || function () {
|
11063 | __assign$h = Object.assign || function(t) {
|
11064 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
11065 | s = arguments[i];
|
11066 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
11067 | t[p] = s[p];
|
11068 | }
|
11069 | return t;
|
11070 | };
|
11071 | return __assign$h.apply(this, arguments);
|
11072 | };
|
11073 | var __decorate$2k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
11074 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
11075 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
11076 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
11077 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
11078 | };
|
11079 | var ManagedFocusFeature = (function (_super) {
|
11080 | __extends$2J(ManagedFocusFeature, _super);
|
11081 | function ManagedFocusFeature(eFocusableElement, callbacks) {
|
11082 | if (callbacks === void 0) { callbacks = {}; }
|
11083 | var _this = _super.call(this) || this;
|
11084 | _this.eFocusableElement = eFocusableElement;
|
11085 | _this.callbacks = callbacks;
|
11086 | _this.callbacks = __assign$h({ shouldStopEventPropagation: function () { return false; }, onTabKeyDown: function (e) {
|
11087 | if (e.defaultPrevented) {
|
11088 | return;
|
11089 | }
|
11090 | var nextRoot = _this.focusService.findNextFocusableElement(_this.eFocusableElement, false, e.shiftKey);
|
11091 | if (!nextRoot) {
|
11092 | return;
|
11093 | }
|
11094 | nextRoot.focus();
|
11095 | e.preventDefault();
|
11096 | } }, callbacks);
|
11097 | return _this;
|
11098 | }
|
11099 | ManagedFocusFeature.prototype.postConstruct = function () {
|
11100 | this.eFocusableElement.classList.add(ManagedFocusFeature.FOCUS_MANAGED_CLASS);
|
11101 | this.addKeyDownListeners(this.eFocusableElement);
|
11102 | if (this.callbacks.onFocusIn) {
|
11103 | this.addManagedListener(this.eFocusableElement, 'focusin', this.callbacks.onFocusIn);
|
11104 | }
|
11105 | if (this.callbacks.onFocusOut) {
|
11106 | this.addManagedListener(this.eFocusableElement, 'focusout', this.callbacks.onFocusOut);
|
11107 | }
|
11108 | };
|
11109 | ManagedFocusFeature.prototype.addKeyDownListeners = function (eGui) {
|
11110 | var _this = this;
|
11111 | this.addManagedListener(eGui, 'keydown', function (e) {
|
11112 | if (e.defaultPrevented || isStopPropagationForAgGrid(e)) {
|
11113 | return;
|
11114 | }
|
11115 | if (_this.callbacks.shouldStopEventPropagation(e)) {
|
11116 | stopPropagationForAgGrid(e);
|
11117 | return;
|
11118 | }
|
11119 | if (e.key === KeyCode.TAB) {
|
11120 | _this.callbacks.onTabKeyDown(e);
|
11121 | }
|
11122 | else if (_this.callbacks.handleKeyDown) {
|
11123 | _this.callbacks.handleKeyDown(e);
|
11124 | }
|
11125 | });
|
11126 | };
|
11127 | ManagedFocusFeature.FOCUS_MANAGED_CLASS = 'ag-focus-managed';
|
11128 | __decorate$2k([
|
11129 | Autowired('focusService')
|
11130 | ], ManagedFocusFeature.prototype, "focusService", void 0);
|
11131 | __decorate$2k([
|
11132 | PostConstruct
|
11133 | ], ManagedFocusFeature.prototype, "postConstruct", null);
|
11134 | return ManagedFocusFeature;
|
11135 | }(BeanStub));
|
11136 |
|
11137 |
|
11138 |
|
11139 |
|
11140 |
|
11141 |
|
11142 |
|
11143 | var __extends$2I = (undefined && undefined.__extends) || (function () {
|
11144 | var extendStatics = function (d, b) {
|
11145 | extendStatics = Object.setPrototypeOf ||
|
11146 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11147 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
11148 | return extendStatics(d, b);
|
11149 | };
|
11150 | return function (d, b) {
|
11151 | extendStatics(d, b);
|
11152 | function __() { this.constructor = d; }
|
11153 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11154 | };
|
11155 | })();
|
11156 | var __decorate$2j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
11157 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
11158 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
11159 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
11160 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
11161 | };
|
11162 | var RESIZE_CONTAINER_STYLE = 'ag-resizer-wrapper';
|
11163 | 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>";
|
11164 | var PositionableFeature = (function (_super) {
|
11165 | __extends$2I(PositionableFeature, _super);
|
11166 | function PositionableFeature(element, config) {
|
11167 | var _this = _super.call(this) || this;
|
11168 | _this.element = element;
|
11169 | _this.dragStartPosition = {
|
11170 | x: 0,
|
11171 | y: 0
|
11172 | };
|
11173 | _this.position = {
|
11174 | x: 0,
|
11175 | y: 0
|
11176 | };
|
11177 | _this.lastSize = {
|
11178 | width: -1,
|
11179 | height: -1
|
11180 | };
|
11181 | _this.positioned = false;
|
11182 | _this.resizersAdded = false;
|
11183 | _this.resizeListeners = [];
|
11184 | _this.boundaryEl = null;
|
11185 | _this.isResizing = false;
|
11186 | _this.isMoving = false;
|
11187 | _this.resizable = {};
|
11188 | _this.movable = false;
|
11189 | _this.currentResizer = null;
|
11190 | _this.config = Object.assign({}, { popup: false }, config);
|
11191 | return _this;
|
11192 | }
|
11193 | PositionableFeature.prototype.center = function () {
|
11194 | var _a = this.offsetParent, clientHeight = _a.clientHeight, clientWidth = _a.clientWidth;
|
11195 | var x = (clientWidth / 2) - (this.getWidth() / 2);
|
11196 | var y = (clientHeight / 2) - (this.getHeight() / 2);
|
11197 | this.offsetElement(x, y);
|
11198 | };
|
11199 | PositionableFeature.prototype.initialisePosition = function () {
|
11200 | 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;
|
11201 | if (!this.offsetParent) {
|
11202 | this.setOffsetParent();
|
11203 | }
|
11204 | var computedMinHeight = 0;
|
11205 | var computedMinWidth = 0;
|
11206 |
|
11207 |
|
11208 | var isVisible = !!this.element.offsetParent;
|
11209 | if (isVisible) {
|
11210 | var boundaryEl = this.findBoundaryElement();
|
11211 | var offsetParentComputedStyles = window.getComputedStyle(boundaryEl);
|
11212 | if (offsetParentComputedStyles.minWidth != null) {
|
11213 | var paddingWidth = boundaryEl.offsetWidth - this.element.offsetWidth;
|
11214 | computedMinWidth = parseInt(offsetParentComputedStyles.minWidth, 10) - paddingWidth;
|
11215 | }
|
11216 | if (offsetParentComputedStyles.minHeight != null) {
|
11217 | var paddingHeight = boundaryEl.offsetHeight - this.element.offsetHeight;
|
11218 | computedMinHeight = parseInt(offsetParentComputedStyles.minHeight, 10) - paddingHeight;
|
11219 | }
|
11220 | }
|
11221 | this.minHeight = minHeight || computedMinHeight;
|
11222 | this.minWidth = minWidth || computedMinWidth;
|
11223 | if (width) {
|
11224 | this.setWidth(width);
|
11225 | }
|
11226 | if (height) {
|
11227 | this.setHeight(height);
|
11228 | }
|
11229 | if (!width || !height) {
|
11230 | this.refreshSize();
|
11231 | }
|
11232 | if (centered) {
|
11233 | this.center();
|
11234 | }
|
11235 | else if (x || y) {
|
11236 | this.offsetElement(x, y);
|
11237 | }
|
11238 | else if (isVisible && forcePopupParentAsOffsetParent && this.boundaryEl) {
|
11239 | var top_1 = parseFloat(this.boundaryEl.style.top);
|
11240 | var left = parseFloat(this.boundaryEl.style.left);
|
11241 | this.offsetElement(isNaN(left) ? 0 : left, isNaN(top_1) ? 0 : top_1);
|
11242 | }
|
11243 | this.positioned = !!this.offsetParent;
|
11244 | };
|
11245 | PositionableFeature.prototype.isPositioned = function () {
|
11246 | return this.positioned;
|
11247 | };
|
11248 | PositionableFeature.prototype.getPosition = function () {
|
11249 | return this.position;
|
11250 | };
|
11251 | PositionableFeature.prototype.setMovable = function (movable, moveElement) {
|
11252 | if (!this.config.popup || movable === this.movable) {
|
11253 | return;
|
11254 | }
|
11255 | this.movable = movable;
|
11256 | var params = this.moveElementDragListener || {
|
11257 | eElement: moveElement,
|
11258 | onDragStart: this.onMoveStart.bind(this),
|
11259 | onDragging: this.onMove.bind(this),
|
11260 | onDragStop: this.onMoveEnd.bind(this)
|
11261 | };
|
11262 | if (movable) {
|
11263 | this.dragService.addDragSource(params);
|
11264 | this.moveElementDragListener = params;
|
11265 | }
|
11266 | else {
|
11267 | this.dragService.removeDragSource(params);
|
11268 | this.moveElementDragListener = undefined;
|
11269 | }
|
11270 | };
|
11271 | PositionableFeature.prototype.setResizable = function (resizable) {
|
11272 | var _this = this;
|
11273 | this.clearResizeListeners();
|
11274 | if (resizable) {
|
11275 | this.addResizers();
|
11276 | }
|
11277 | else {
|
11278 | this.removeResizers();
|
11279 | }
|
11280 | if (typeof resizable === 'boolean') {
|
11281 | if (resizable === false) {
|
11282 | return;
|
11283 | }
|
11284 | resizable = {
|
11285 | topLeft: resizable,
|
11286 | top: resizable,
|
11287 | topRight: resizable,
|
11288 | right: resizable,
|
11289 | bottomRight: resizable,
|
11290 | bottom: resizable,
|
11291 | bottomLeft: resizable,
|
11292 | left: resizable
|
11293 | };
|
11294 | }
|
11295 | Object.keys(resizable).forEach(function (side) {
|
11296 | var resizableStructure = resizable;
|
11297 | var isSideResizable = !!resizableStructure[side];
|
11298 | var resizerEl = _this.getResizerElement(side);
|
11299 | var params = {
|
11300 | dragStartPixels: 0,
|
11301 | eElement: resizerEl,
|
11302 | onDragStart: function (e) { return _this.onResizeStart(e, side); },
|
11303 | onDragging: _this.onResize.bind(_this),
|
11304 | onDragStop: function (e) { return _this.onResizeEnd(e, side); },
|
11305 | };
|
11306 | if (isSideResizable || (!_this.isAlive() && !isSideResizable)) {
|
11307 | if (isSideResizable) {
|
11308 | _this.dragService.addDragSource(params);
|
11309 | _this.resizeListeners.push(params);
|
11310 | resizerEl.style.pointerEvents = 'all';
|
11311 | }
|
11312 | else {
|
11313 | resizerEl.style.pointerEvents = 'none';
|
11314 | }
|
11315 | _this.resizable[side] = isSideResizable;
|
11316 | }
|
11317 | });
|
11318 | };
|
11319 | PositionableFeature.prototype.removeSizeFromEl = function () {
|
11320 | this.element.style.removeProperty('height');
|
11321 | this.element.style.removeProperty('width');
|
11322 | this.element.style.removeProperty('flex');
|
11323 | };
|
11324 | PositionableFeature.prototype.restoreLastSize = function () {
|
11325 | this.element.style.flex = '0 0 auto';
|
11326 | var _a = this.lastSize, height = _a.height, width = _a.width;
|
11327 | if (width !== -1) {
|
11328 | this.element.style.width = width + "px";
|
11329 | }
|
11330 | if (height !== -1) {
|
11331 | this.element.style.height = height + "px";
|
11332 | }
|
11333 | };
|
11334 | PositionableFeature.prototype.getHeight = function () {
|
11335 | return this.element.offsetHeight;
|
11336 | };
|
11337 | PositionableFeature.prototype.setHeight = function (height) {
|
11338 | var _a = this.config, popup = _a.popup, forcePopupParentAsOffsetParent = _a.forcePopupParentAsOffsetParent;
|
11339 | var eGui = this.element;
|
11340 | var isPercent = false;
|
11341 | if (typeof height === 'string' && height.indexOf('%') !== -1) {
|
11342 | setFixedHeight(eGui, height);
|
11343 | height = getAbsoluteHeight(eGui);
|
11344 | isPercent = true;
|
11345 | }
|
11346 | else if (this.positioned) {
|
11347 | var elRect = this.element.getBoundingClientRect();
|
11348 | var parentRect = this.offsetParent.getBoundingClientRect();
|
11349 | height = Math.max(this.minHeight, height);
|
11350 | var clientHeight = this.offsetParent.clientHeight;
|
11351 | if (clientHeight) {
|
11352 | var yPosition = popup ? this.position.y : elRect.top;
|
11353 | var parentTop = popup ? 0 : parentRect.top;
|
11354 |
|
11355 |
|
11356 | var additionalHeight = 0;
|
11357 | if (forcePopupParentAsOffsetParent && this.boundaryEl) {
|
11358 | var bottom = this.boundaryEl.getBoundingClientRect().bottom;
|
11359 | additionalHeight = bottom - elRect.bottom;
|
11360 | }
|
11361 | var availableHeight = clientHeight + parentTop - yPosition - additionalHeight;
|
11362 | if (height > availableHeight) {
|
11363 | height = availableHeight;
|
11364 | }
|
11365 | }
|
11366 | }
|
11367 | if (this.getHeight() === height) {
|
11368 | return;
|
11369 | }
|
11370 | if (!isPercent) {
|
11371 | if (popup) {
|
11372 | setFixedHeight(eGui, height);
|
11373 | }
|
11374 | else {
|
11375 | eGui.style.height = height + "px";
|
11376 | eGui.style.flex = '0 0 auto';
|
11377 | this.lastSize.height = typeof height === 'number' ? height : parseFloat(height);
|
11378 | }
|
11379 | }
|
11380 | else {
|
11381 | eGui.style.maxHeight = 'unset';
|
11382 | eGui.style.minHeight = 'unset';
|
11383 | }
|
11384 | };
|
11385 | PositionableFeature.prototype.getWidth = function () {
|
11386 | return this.element.offsetWidth;
|
11387 | };
|
11388 | PositionableFeature.prototype.setWidth = function (width) {
|
11389 | var eGui = this.element;
|
11390 | var popup = this.config.popup;
|
11391 | var isPercent = false;
|
11392 | if (typeof width === 'string' && width.indexOf('%') !== -1) {
|
11393 | setFixedWidth(eGui, width);
|
11394 | width = getAbsoluteWidth(eGui);
|
11395 | isPercent = true;
|
11396 | }
|
11397 | else if (this.positioned) {
|
11398 | width = Math.max(this.minWidth, width);
|
11399 | var clientWidth = this.offsetParent.clientWidth;
|
11400 | var xPosition = popup ? this.position.x : this.element.getBoundingClientRect().left;
|
11401 | if (clientWidth && (width + xPosition > clientWidth)) {
|
11402 | width = clientWidth - xPosition;
|
11403 | }
|
11404 | }
|
11405 | if (this.getWidth() === width) {
|
11406 | return;
|
11407 | }
|
11408 | if (!isPercent) {
|
11409 | if (this.config.popup) {
|
11410 | setFixedWidth(eGui, width);
|
11411 | }
|
11412 | else {
|
11413 | eGui.style.width = width + "px";
|
11414 | eGui.style.flex = ' unset';
|
11415 | this.lastSize.width = typeof width === 'number' ? width : parseFloat(width);
|
11416 | }
|
11417 | }
|
11418 | else {
|
11419 | eGui.style.maxWidth = 'unset';
|
11420 | eGui.style.minWidth = 'unset';
|
11421 | }
|
11422 | };
|
11423 | PositionableFeature.prototype.offsetElement = function (x, y) {
|
11424 | if (x === void 0) { x = 0; }
|
11425 | if (y === void 0) { y = 0; }
|
11426 | var ePopup = this.config.forcePopupParentAsOffsetParent ? this.boundaryEl : this.element;
|
11427 | this.popupService.positionPopup({
|
11428 | ePopup: ePopup,
|
11429 | keepWithinBounds: true,
|
11430 | skipObserver: this.movable || this.isResizable(),
|
11431 | updatePosition: function () { return ({ x: x, y: y }); }
|
11432 | });
|
11433 | this.setPosition(parseFloat(ePopup.style.left), parseFloat(ePopup.style.top));
|
11434 | };
|
11435 | PositionableFeature.prototype.setPosition = function (x, y) {
|
11436 | this.position.x = x;
|
11437 | this.position.y = y;
|
11438 | };
|
11439 | PositionableFeature.prototype.updateDragStartPosition = function (x, y) {
|
11440 | this.dragStartPosition = { x: x, y: y };
|
11441 | };
|
11442 | PositionableFeature.prototype.calculateMouseMovement = function (params) {
|
11443 | var e = params.e, isLeft = params.isLeft, isTop = params.isTop, anywhereWithin = params.anywhereWithin, topBuffer = params.topBuffer;
|
11444 | var xDiff = e.clientX - this.dragStartPosition.x;
|
11445 | var yDiff = e.clientY - this.dragStartPosition.y;
|
11446 | var movementX = this.shouldSkipX(e, !!isLeft, !!anywhereWithin, xDiff) ? 0 : xDiff;
|
11447 | var movementY = this.shouldSkipY(e, !!isTop, topBuffer, yDiff) ? 0 : yDiff;
|
11448 | return { movementX: movementX, movementY: movementY };
|
11449 | };
|
11450 | PositionableFeature.prototype.shouldSkipX = function (e, isLeft, anywhereWithin, diff) {
|
11451 | var elRect = this.element.getBoundingClientRect();
|
11452 | var parentRect = this.offsetParent.getBoundingClientRect();
|
11453 | var boundaryElRect = this.boundaryEl.getBoundingClientRect();
|
11454 | var xPosition = this.config.popup ? this.position.x : elRect.left;
|
11455 |
|
11456 | var skipX = ((xPosition <= 0 && parentRect.left >= e.clientX) ||
|
11457 | (parentRect.right <= e.clientX && parentRect.right <= boundaryElRect.right));
|
11458 | if (skipX) {
|
11459 | return true;
|
11460 | }
|
11461 | if (isLeft) {
|
11462 | skipX = (
|
11463 |
|
11464 |
|
11465 | (diff < 0 && e.clientX > xPosition + parentRect.left) ||
|
11466 |
|
11467 |
|
11468 | (diff > 0 && e.clientX < xPosition + parentRect.left));
|
11469 | }
|
11470 | else {
|
11471 | if (anywhereWithin) {
|
11472 |
|
11473 |
|
11474 | skipX = ((diff < 0 && e.clientX > boundaryElRect.right) ||
|
11475 | (diff > 0 && e.clientX < xPosition + parentRect.left));
|
11476 | }
|
11477 | else {
|
11478 | skipX = (
|
11479 |
|
11480 |
|
11481 |
|
11482 | (diff < 0 && e.clientX > boundaryElRect.right) ||
|
11483 |
|
11484 |
|
11485 | (diff > 0 && e.clientX < boundaryElRect.right));
|
11486 | }
|
11487 | }
|
11488 | return skipX;
|
11489 | };
|
11490 | PositionableFeature.prototype.shouldSkipY = function (e, isTop, topBuffer, diff) {
|
11491 | if (topBuffer === void 0) { topBuffer = 0; }
|
11492 | var elRect = this.element.getBoundingClientRect();
|
11493 | var parentRect = this.offsetParent.getBoundingClientRect();
|
11494 | var boundaryElRect = this.boundaryEl.getBoundingClientRect();
|
11495 | var yPosition = this.config.popup ? this.position.y : elRect.top;
|
11496 |
|
11497 | var skipY = ((yPosition <= 0 && parentRect.top >= e.clientY) ||
|
11498 | (parentRect.bottom <= e.clientY && parentRect.bottom <= boundaryElRect.bottom));
|
11499 | if (skipY) {
|
11500 | return true;
|
11501 | }
|
11502 | if (isTop) {
|
11503 | skipY = (
|
11504 |
|
11505 |
|
11506 |
|
11507 | (diff < 0 && e.clientY > yPosition + parentRect.top + topBuffer) ||
|
11508 |
|
11509 |
|
11510 | (diff > 0 && e.clientY < yPosition + parentRect.top));
|
11511 | }
|
11512 | else {
|
11513 | skipY = (
|
11514 |
|
11515 |
|
11516 | (diff < 0 && e.clientY > boundaryElRect.bottom) ||
|
11517 |
|
11518 |
|
11519 | (diff > 0 && e.clientY < boundaryElRect.bottom));
|
11520 | }
|
11521 | return skipY;
|
11522 | };
|
11523 | PositionableFeature.prototype.createResizeMap = function () {
|
11524 | var eGui = this.element;
|
11525 | this.resizerMap = {
|
11526 | topLeft: { element: eGui.querySelector('[ref=eTopLeftResizer]') },
|
11527 | top: { element: eGui.querySelector('[ref=eTopResizer]') },
|
11528 | topRight: { element: eGui.querySelector('[ref=eTopRightResizer]') },
|
11529 | right: { element: eGui.querySelector('[ref=eRightResizer]') },
|
11530 | bottomRight: { element: eGui.querySelector('[ref=eBottomRightResizer]') },
|
11531 | bottom: { element: eGui.querySelector('[ref=eBottomResizer]') },
|
11532 | bottomLeft: { element: eGui.querySelector('[ref=eBottomLeftResizer]') },
|
11533 | left: { element: eGui.querySelector('[ref=eLeftResizer]') }
|
11534 | };
|
11535 | };
|
11536 | PositionableFeature.prototype.addResizers = function () {
|
11537 | if (this.resizersAdded) {
|
11538 | return;
|
11539 | }
|
11540 | var eGui = this.element;
|
11541 | if (!eGui) {
|
11542 | return;
|
11543 | }
|
11544 | var parser = new DOMParser();
|
11545 | var resizers = parser.parseFromString(RESIZE_TEMPLATE, 'text/html').body;
|
11546 | eGui.appendChild(resizers.firstChild);
|
11547 | this.createResizeMap();
|
11548 | this.resizersAdded = true;
|
11549 | };
|
11550 | PositionableFeature.prototype.removeResizers = function () {
|
11551 | this.resizerMap = undefined;
|
11552 | var resizerEl = this.element.querySelector("." + RESIZE_CONTAINER_STYLE);
|
11553 | if (resizerEl) {
|
11554 | this.element.removeChild(resizerEl);
|
11555 | }
|
11556 | this.resizersAdded = false;
|
11557 | };
|
11558 | PositionableFeature.prototype.getResizerElement = function (side) {
|
11559 | return this.resizerMap[side].element;
|
11560 | };
|
11561 | PositionableFeature.prototype.onResizeStart = function (e, side) {
|
11562 | this.boundaryEl = this.findBoundaryElement();
|
11563 | if (!this.positioned) {
|
11564 | this.initialisePosition();
|
11565 | }
|
11566 | this.currentResizer = {
|
11567 | isTop: !!side.match(/top/i),
|
11568 | isRight: !!side.match(/right/i),
|
11569 | isBottom: !!side.match(/bottom/i),
|
11570 | isLeft: !!side.match(/left/i),
|
11571 | };
|
11572 | this.element.classList.add('ag-resizing');
|
11573 | this.resizerMap[side].element.classList.add('ag-active');
|
11574 | var _a = this.config, popup = _a.popup, forcePopupParentAsOffsetParent = _a.forcePopupParentAsOffsetParent;
|
11575 | if (!popup && !forcePopupParentAsOffsetParent) {
|
11576 | this.applySizeToSiblings(this.currentResizer.isBottom || this.currentResizer.isTop);
|
11577 | }
|
11578 | this.isResizing = true;
|
11579 | this.updateDragStartPosition(e.clientX, e.clientY);
|
11580 | };
|
11581 | PositionableFeature.prototype.getSiblings = function () {
|
11582 | var element = this.element;
|
11583 | var parent = element.parentElement;
|
11584 | if (!parent) {
|
11585 | return null;
|
11586 | }
|
11587 | return Array.prototype.slice.call(parent.children).filter(function (el) { return !el.classList.contains('ag-hidden'); });
|
11588 | };
|
11589 | PositionableFeature.prototype.getMinSizeOfSiblings = function () {
|
11590 | var siblings = this.getSiblings() || [];
|
11591 | var height = 0;
|
11592 | var width = 0;
|
11593 | for (var i = 0; i < siblings.length; i++) {
|
11594 | var currentEl = siblings[i];
|
11595 | var isFlex = !!currentEl.style.flex && currentEl.style.flex !== '0 0 auto';
|
11596 | if (currentEl === this.element) {
|
11597 | continue;
|
11598 | }
|
11599 | var nextHeight = this.minHeight || 0;
|
11600 | var nextWidth = this.minWidth || 0;
|
11601 | if (isFlex) {
|
11602 | var computedStyle = window.getComputedStyle(currentEl);
|
11603 | if (computedStyle.minHeight) {
|
11604 | nextHeight = parseInt(computedStyle.minHeight, 10);
|
11605 | }
|
11606 | if (computedStyle.minWidth) {
|
11607 | nextWidth = parseInt(computedStyle.minWidth, 10);
|
11608 | }
|
11609 | }
|
11610 | else {
|
11611 | nextHeight = currentEl.offsetHeight;
|
11612 | nextWidth = currentEl.offsetWidth;
|
11613 | }
|
11614 | height += nextHeight;
|
11615 | width += nextWidth;
|
11616 | }
|
11617 | return { height: height, width: width };
|
11618 | };
|
11619 | PositionableFeature.prototype.applySizeToSiblings = function (vertical) {
|
11620 | var containerToFlex = null;
|
11621 | var siblings = this.getSiblings();
|
11622 | if (!siblings) {
|
11623 | return;
|
11624 | }
|
11625 | for (var i = 0; i < siblings.length; i++) {
|
11626 | var el = siblings[i];
|
11627 | if (el === containerToFlex) {
|
11628 | continue;
|
11629 | }
|
11630 | if (vertical) {
|
11631 | el.style.height = el.offsetHeight + "px";
|
11632 | }
|
11633 | else {
|
11634 | el.style.width = el.offsetWidth + "px";
|
11635 | }
|
11636 | el.style.flex = '0 0 auto';
|
11637 | if (el === this.element) {
|
11638 | containerToFlex = siblings[i + 1];
|
11639 | }
|
11640 | }
|
11641 | if (containerToFlex) {
|
11642 | containerToFlex.style.removeProperty('height');
|
11643 | containerToFlex.style.removeProperty('min-height');
|
11644 | containerToFlex.style.removeProperty('max-height');
|
11645 | containerToFlex.style.flex = '1 1 auto';
|
11646 | }
|
11647 | };
|
11648 | PositionableFeature.prototype.isResizable = function () {
|
11649 | return Object.values(this.resizable).some(function (value) { return value; });
|
11650 | };
|
11651 | PositionableFeature.prototype.onResize = function (e) {
|
11652 | if (!this.isResizing || !this.currentResizer) {
|
11653 | return;
|
11654 | }
|
11655 | var _a = this.config, popup = _a.popup, forcePopupParentAsOffsetParent = _a.forcePopupParentAsOffsetParent;
|
11656 | var _b = this.currentResizer, isTop = _b.isTop, isRight = _b.isRight, isBottom = _b.isBottom, isLeft = _b.isLeft;
|
11657 | var isHorizontal = isRight || isLeft;
|
11658 | var isVertical = isBottom || isTop;
|
11659 | var _c = this.calculateMouseMovement({ e: e, isLeft: isLeft, isTop: isTop }), movementX = _c.movementX, movementY = _c.movementY;
|
11660 | var xPosition = this.position.x;
|
11661 | var yPosition = this.position.y;
|
11662 | var offsetLeft = 0;
|
11663 | var offsetTop = 0;
|
11664 | if (isHorizontal && movementX) {
|
11665 | var direction = isLeft ? -1 : 1;
|
11666 | var oldWidth = this.getWidth();
|
11667 | var newWidth = oldWidth + (movementX * direction);
|
11668 | var skipWidth = false;
|
11669 | if (isLeft) {
|
11670 | offsetLeft = oldWidth - newWidth;
|
11671 | if (xPosition + offsetLeft <= 0 || newWidth <= this.minWidth) {
|
11672 | skipWidth = true;
|
11673 | offsetLeft = 0;
|
11674 | }
|
11675 | }
|
11676 | if (!skipWidth) {
|
11677 | this.setWidth(newWidth);
|
11678 | }
|
11679 | }
|
11680 | if (isVertical && movementY) {
|
11681 | var direction = isTop ? -1 : 1;
|
11682 | var oldHeight = this.getHeight();
|
11683 | var newHeight = oldHeight + (movementY * direction);
|
11684 | var skipHeight = false;
|
11685 | if (isTop) {
|
11686 | offsetTop = oldHeight - newHeight;
|
11687 | if (yPosition + offsetTop <= 0 || newHeight <= this.minHeight) {
|
11688 | skipHeight = true;
|
11689 | offsetTop = 0;
|
11690 | }
|
11691 | }
|
11692 | else {
|
11693 |
|
11694 | if (!this.config.popup &&
|
11695 | !this.config.forcePopupParentAsOffsetParent &&
|
11696 | oldHeight < newHeight &&
|
11697 | (this.getMinSizeOfSiblings().height + newHeight) > this.element.parentElement.offsetHeight) {
|
11698 | skipHeight = true;
|
11699 | }
|
11700 | }
|
11701 | if (!skipHeight) {
|
11702 | this.setHeight(newHeight);
|
11703 | }
|
11704 | }
|
11705 | this.updateDragStartPosition(e.clientX, e.clientY);
|
11706 | if ((popup || forcePopupParentAsOffsetParent) && offsetLeft || offsetTop) {
|
11707 | this.offsetElement(xPosition + offsetLeft, yPosition + offsetTop);
|
11708 | }
|
11709 | };
|
11710 | PositionableFeature.prototype.onResizeEnd = function (e, side) {
|
11711 | this.isResizing = false;
|
11712 | this.currentResizer = null;
|
11713 | this.boundaryEl = null;
|
11714 | var params = {
|
11715 | type: 'resize',
|
11716 | api: this.gridOptionsService.api,
|
11717 | columnApi: this.gridOptionsService.columnApi
|
11718 | };
|
11719 | this.element.classList.remove('ag-resizing');
|
11720 | this.resizerMap[side].element.classList.remove('ag-active');
|
11721 | this.dispatchEvent(params);
|
11722 | };
|
11723 | PositionableFeature.prototype.refreshSize = function () {
|
11724 | var eGui = this.element;
|
11725 | if (this.config.popup) {
|
11726 | if (!this.config.width) {
|
11727 | this.setWidth(eGui.offsetWidth);
|
11728 | }
|
11729 | if (!this.config.height) {
|
11730 | this.setHeight(eGui.offsetHeight);
|
11731 | }
|
11732 | }
|
11733 | };
|
11734 | PositionableFeature.prototype.onMoveStart = function (e) {
|
11735 | this.boundaryEl = this.findBoundaryElement();
|
11736 | if (!this.positioned) {
|
11737 | this.initialisePosition();
|
11738 | }
|
11739 | this.isMoving = true;
|
11740 | this.element.classList.add('ag-moving');
|
11741 | this.updateDragStartPosition(e.clientX, e.clientY);
|
11742 | };
|
11743 | PositionableFeature.prototype.onMove = function (e) {
|
11744 | if (!this.isMoving) {
|
11745 | return;
|
11746 | }
|
11747 | var _a = this.position, x = _a.x, y = _a.y;
|
11748 | var topBuffer;
|
11749 | if (this.config.calculateTopBuffer) {
|
11750 | topBuffer = this.config.calculateTopBuffer();
|
11751 | }
|
11752 | var _b = this.calculateMouseMovement({
|
11753 | e: e,
|
11754 | isTop: true,
|
11755 | anywhereWithin: true,
|
11756 | topBuffer: topBuffer
|
11757 | }), movementX = _b.movementX, movementY = _b.movementY;
|
11758 | this.offsetElement(x + movementX, y + movementY);
|
11759 | this.updateDragStartPosition(e.clientX, e.clientY);
|
11760 | };
|
11761 | PositionableFeature.prototype.onMoveEnd = function () {
|
11762 | this.isMoving = false;
|
11763 | this.boundaryEl = null;
|
11764 | this.element.classList.remove('ag-moving');
|
11765 | };
|
11766 | PositionableFeature.prototype.setOffsetParent = function () {
|
11767 | if (this.config.forcePopupParentAsOffsetParent) {
|
11768 | this.offsetParent = this.popupService.getPopupParent();
|
11769 | }
|
11770 | else {
|
11771 | this.offsetParent = this.element.offsetParent;
|
11772 | }
|
11773 | };
|
11774 | PositionableFeature.prototype.findBoundaryElement = function () {
|
11775 | var el = this.element;
|
11776 | while (el) {
|
11777 | if (window.getComputedStyle(el).position !== 'static') {
|
11778 | return el;
|
11779 | }
|
11780 | el = el.parentElement;
|
11781 | }
|
11782 | return this.element;
|
11783 | };
|
11784 | PositionableFeature.prototype.clearResizeListeners = function () {
|
11785 | while (this.resizeListeners.length) {
|
11786 | var params = this.resizeListeners.pop();
|
11787 | this.dragService.removeDragSource(params);
|
11788 | }
|
11789 | };
|
11790 | PositionableFeature.prototype.destroy = function () {
|
11791 | _super.prototype.destroy.call(this);
|
11792 | if (this.moveElementDragListener) {
|
11793 | this.dragService.removeDragSource(this.moveElementDragListener);
|
11794 | }
|
11795 | this.clearResizeListeners();
|
11796 | this.removeResizers();
|
11797 | };
|
11798 | __decorate$2j([
|
11799 | Autowired('popupService')
|
11800 | ], PositionableFeature.prototype, "popupService", void 0);
|
11801 | __decorate$2j([
|
11802 | Autowired('dragService')
|
11803 | ], PositionableFeature.prototype, "dragService", void 0);
|
11804 | return PositionableFeature;
|
11805 | }(BeanStub));
|
11806 |
|
11807 |
|
11808 |
|
11809 |
|
11810 |
|
11811 |
|
11812 |
|
11813 | var __extends$2H = (undefined && undefined.__extends) || (function () {
|
11814 | var extendStatics = function (d, b) {
|
11815 | extendStatics = Object.setPrototypeOf ||
|
11816 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11817 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
11818 | return extendStatics(d, b);
|
11819 | };
|
11820 | return function (d, b) {
|
11821 | extendStatics(d, b);
|
11822 | function __() { this.constructor = d; }
|
11823 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11824 | };
|
11825 | })();
|
11826 | var __decorate$2i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
11827 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
11828 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
11829 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
11830 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
11831 | };
|
11832 |
|
11833 |
|
11834 |
|
11835 |
|
11836 |
|
11837 |
|
11838 |
|
11839 |
|
11840 | var ProvidedFilter = (function (_super) {
|
11841 | __extends$2H(ProvidedFilter, _super);
|
11842 | function ProvidedFilter(filterNameKey) {
|
11843 | var _this = _super.call(this) || this;
|
11844 | _this.filterNameKey = filterNameKey;
|
11845 | _this.applyActive = false;
|
11846 | _this.hidePopup = null;
|
11847 | _this.debouncePending = false;
|
11848 |
|
11849 |
|
11850 |
|
11851 |
|
11852 |
|
11853 |
|
11854 | _this.appliedModel = null;
|
11855 | return _this;
|
11856 | }
|
11857 | ProvidedFilter.prototype.postConstruct = function () {
|
11858 | this.resetTemplate();
|
11859 | this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), {
|
11860 | handleKeyDown: this.handleKeyDown.bind(this)
|
11861 | }));
|
11862 | this.positionableFeature = new PositionableFeature(this.getPositionableElement(), { forcePopupParentAsOffsetParent: true });
|
11863 | this.createBean(this.positionableFeature);
|
11864 | };
|
11865 |
|
11866 | ProvidedFilter.prototype.handleKeyDown = function (e) { };
|
11867 | ProvidedFilter.prototype.getFilterTitle = function () {
|
11868 | return this.translate(this.filterNameKey);
|
11869 | };
|
11870 | ProvidedFilter.prototype.isFilterActive = function () {
|
11871 |
|
11872 | return !!this.appliedModel;
|
11873 | };
|
11874 | ProvidedFilter.prototype.resetTemplate = function (paramsMap) {
|
11875 | var eGui = this.getGui();
|
11876 | if (eGui) {
|
11877 | eGui.removeEventListener('submit', this.onFormSubmit);
|
11878 | }
|
11879 | var templateString = "\n <form class=\"ag-filter-wrapper\">\n <div class=\"ag-filter-body-wrapper ag-" + this.getCssIdentifier() + "-body-wrapper\" ref=\"eFilterBody\">\n " + this.createBodyTemplate() + "\n </div>\n </form>";
|
11880 | this.setTemplate(templateString, paramsMap);
|
11881 | eGui = this.getGui();
|
11882 | if (eGui) {
|
11883 | eGui.addEventListener('submit', this.onFormSubmit);
|
11884 | }
|
11885 | };
|
11886 | ProvidedFilter.prototype.isReadOnly = function () {
|
11887 | return !!this.providedFilterParams.readOnly;
|
11888 | };
|
11889 | ProvidedFilter.prototype.init = function (params) {
|
11890 | var _this = this;
|
11891 | this.setParams(params);
|
11892 | this.resetUiToDefaults(true).then(function () {
|
11893 | _this.updateUiVisibility();
|
11894 | _this.setupOnBtApplyDebounce();
|
11895 | });
|
11896 | };
|
11897 | ProvidedFilter.prototype.setParams = function (params) {
|
11898 | this.providedFilterParams = params;
|
11899 | this.applyActive = ProvidedFilter.isUseApplyButton(params);
|
11900 | this.createButtonPanel();
|
11901 | };
|
11902 | ProvidedFilter.prototype.createButtonPanel = function () {
|
11903 | var _this = this;
|
11904 | var buttons = this.providedFilterParams.buttons;
|
11905 | if (!buttons || buttons.length < 1 || this.isReadOnly()) {
|
11906 | return;
|
11907 | }
|
11908 | var eButtonsPanel = document.createElement('div');
|
11909 | eButtonsPanel.classList.add('ag-filter-apply-panel');
|
11910 | var addButton = function (type) {
|
11911 | var text;
|
11912 | var clickListener;
|
11913 | switch (type) {
|
11914 | case 'apply':
|
11915 | text = _this.translate('applyFilter');
|
11916 | clickListener = function (e) { return _this.onBtApply(false, false, e); };
|
11917 | break;
|
11918 | case 'clear':
|
11919 | text = _this.translate('clearFilter');
|
11920 | clickListener = function () { return _this.onBtClear(); };
|
11921 | break;
|
11922 | case 'reset':
|
11923 | text = _this.translate('resetFilter');
|
11924 | clickListener = function () { return _this.onBtReset(); };
|
11925 | break;
|
11926 | case 'cancel':
|
11927 | text = _this.translate('cancelFilter');
|
11928 | clickListener = function (e) { _this.onBtCancel(e); };
|
11929 | break;
|
11930 | default:
|
11931 | console.warn('AG Grid: Unknown button type specified');
|
11932 | return;
|
11933 | }
|
11934 | var buttonType = type === 'apply' ? 'submit' : 'button';
|
11935 | var button = loadTemplate(
|
11936 |
|
11937 | "<button\n type=\"" + buttonType + "\"\n ref=\"" + type + "FilterButton\"\n class=\"ag-standard-button ag-filter-apply-panel-button\"\n >" + text + "\n </button>");
|
11938 | eButtonsPanel.appendChild(button);
|
11939 | _this.addManagedListener(button, 'click', clickListener);
|
11940 | };
|
11941 | convertToSet(buttons).forEach(function (type) { return addButton(type); });
|
11942 | this.getGui().appendChild(eButtonsPanel);
|
11943 | };
|
11944 |
|
11945 | ProvidedFilter.prototype.getDefaultDebounceMs = function () {
|
11946 | return 0;
|
11947 | };
|
11948 | ProvidedFilter.prototype.setupOnBtApplyDebounce = function () {
|
11949 | var _this = this;
|
11950 | var debounceMs = ProvidedFilter.getDebounceMs(this.providedFilterParams, this.getDefaultDebounceMs());
|
11951 | var debounceFunc = debounce(this.checkApplyDebounce.bind(this), debounceMs);
|
11952 | this.onBtApplyDebounce = function () {
|
11953 | _this.debouncePending = true;
|
11954 | debounceFunc();
|
11955 | };
|
11956 | };
|
11957 | ProvidedFilter.prototype.checkApplyDebounce = function () {
|
11958 | if (this.debouncePending) {
|
11959 |
|
11960 | this.debouncePending = false;
|
11961 | this.onBtApply();
|
11962 | }
|
11963 | };
|
11964 | ProvidedFilter.prototype.getModel = function () {
|
11965 | return this.appliedModel ? this.appliedModel : null;
|
11966 | };
|
11967 | ProvidedFilter.prototype.setModel = function (model) {
|
11968 | var _this = this;
|
11969 | var promise = model != null ? this.setModelIntoUi(model) : this.resetUiToDefaults();
|
11970 | return promise.then(function () {
|
11971 | _this.updateUiVisibility();
|
11972 |
|
11973 |
|
11974 |
|
11975 | _this.applyModel('api');
|
11976 | });
|
11977 | };
|
11978 | ProvidedFilter.prototype.onBtCancel = function (e) {
|
11979 | var _this = this;
|
11980 | this.resetUiToActiveModel(this.getModel(), function () {
|
11981 | if (_this.providedFilterParams.closeOnApply) {
|
11982 | _this.close(e);
|
11983 | }
|
11984 | });
|
11985 | };
|
11986 | ProvidedFilter.prototype.resetUiToActiveModel = function (currentModel, afterUiUpdatedFunc) {
|
11987 | var _this = this;
|
11988 | var afterAppliedFunc = function () {
|
11989 | _this.onUiChanged(false, 'prevent');
|
11990 | afterUiUpdatedFunc === null || afterUiUpdatedFunc === void 0 ? void 0 : afterUiUpdatedFunc();
|
11991 | };
|
11992 | if (currentModel != null) {
|
11993 | this.setModelIntoUi(currentModel).then(afterAppliedFunc);
|
11994 | }
|
11995 | else {
|
11996 | this.resetUiToDefaults().then(afterAppliedFunc);
|
11997 | }
|
11998 | };
|
11999 | ProvidedFilter.prototype.onBtClear = function () {
|
12000 | var _this = this;
|
12001 | this.resetUiToDefaults().then(function () { return _this.onUiChanged(); });
|
12002 | };
|
12003 | ProvidedFilter.prototype.onBtReset = function () {
|
12004 | this.onBtClear();
|
12005 | this.onBtApply();
|
12006 | };
|
12007 | |
12008 |
|
12009 |
|
12010 | ProvidedFilter.prototype.applyModel = function (source) {
|
12011 | var newModel = this.getModelFromUi();
|
12012 | if (!this.isModelValid(newModel)) {
|
12013 | return false;
|
12014 | }
|
12015 | var previousModel = this.appliedModel;
|
12016 | this.appliedModel = newModel;
|
12017 |
|
12018 |
|
12019 | return !this.areModelsEqual(previousModel, newModel);
|
12020 | };
|
12021 | ProvidedFilter.prototype.isModelValid = function (model) {
|
12022 | return true;
|
12023 | };
|
12024 | ProvidedFilter.prototype.onFormSubmit = function (e) {
|
12025 | e.preventDefault();
|
12026 | };
|
12027 | ProvidedFilter.prototype.onBtApply = function (afterFloatingFilter, afterDataChange, e) {
|
12028 | if (afterFloatingFilter === void 0) { afterFloatingFilter = false; }
|
12029 | if (afterDataChange === void 0) { afterDataChange = false; }
|
12030 |
|
12031 | if (e) {
|
12032 | e.preventDefault();
|
12033 | }
|
12034 | if (this.applyModel(afterDataChange ? 'rowDataUpdated' : 'ui')) {
|
12035 |
|
12036 |
|
12037 | this.providedFilterParams.filterChangedCallback({ afterFloatingFilter: afterFloatingFilter, afterDataChange: afterDataChange });
|
12038 | }
|
12039 | var closeOnApply = this.providedFilterParams.closeOnApply;
|
12040 |
|
12041 | if (closeOnApply && this.applyActive && !afterFloatingFilter && !afterDataChange) {
|
12042 | this.close(e);
|
12043 | }
|
12044 | };
|
12045 | ProvidedFilter.prototype.onNewRowsLoaded = function () {
|
12046 | };
|
12047 | ProvidedFilter.prototype.close = function (e) {
|
12048 | if (!this.hidePopup) {
|
12049 | return;
|
12050 | }
|
12051 | var keyboardEvent = e;
|
12052 | var key = keyboardEvent && keyboardEvent.key;
|
12053 | var params;
|
12054 | if (key === 'Enter' || key === 'Space') {
|
12055 | params = { keyboardEvent: keyboardEvent };
|
12056 | }
|
12057 | this.hidePopup(params);
|
12058 | this.hidePopup = null;
|
12059 | };
|
12060 | |
12061 |
|
12062 |
|
12063 |
|
12064 |
|
12065 | ProvidedFilter.prototype.onUiChanged = function (fromFloatingFilter, apply) {
|
12066 | if (fromFloatingFilter === void 0) { fromFloatingFilter = false; }
|
12067 | this.updateUiVisibility();
|
12068 | this.providedFilterParams.filterModifiedCallback();
|
12069 | if (this.applyActive && !this.isReadOnly()) {
|
12070 | var isValid = this.isModelValid(this.getModelFromUi());
|
12071 | setDisabled(this.getRefElement('applyFilterButton'), !isValid);
|
12072 | }
|
12073 | if ((fromFloatingFilter && !apply) || apply === 'immediately') {
|
12074 | this.onBtApply(fromFloatingFilter);
|
12075 | }
|
12076 | else if ((!this.applyActive && !apply) || apply === 'debounce') {
|
12077 | this.onBtApplyDebounce();
|
12078 | }
|
12079 | };
|
12080 | ProvidedFilter.prototype.afterGuiAttached = function (params) {
|
12081 | if ((params === null || params === void 0 ? void 0 : params.container) === 'floatingFilter') {
|
12082 | this.positionableFeature.restoreLastSize();
|
12083 | this.positionableFeature.setResizable(this.gridOptionsService.is('enableRtl')
|
12084 | ? { bottom: true, bottomLeft: true, left: true }
|
12085 | : { bottom: true, bottomRight: true, right: true });
|
12086 | }
|
12087 | else {
|
12088 | this.positionableFeature.removeSizeFromEl();
|
12089 | this.positionableFeature.setResizable(false);
|
12090 | }
|
12091 | if (params == null) {
|
12092 | return;
|
12093 | }
|
12094 | this.hidePopup = params.hidePopup;
|
12095 | };
|
12096 | ProvidedFilter.prototype.afterGuiDetached = function () {
|
12097 | this.checkApplyDebounce();
|
12098 | };
|
12099 |
|
12100 | ProvidedFilter.getDebounceMs = function (params, debounceDefault) {
|
12101 | if (ProvidedFilter.isUseApplyButton(params)) {
|
12102 | if (params.debounceMs != null) {
|
12103 | console.warn('AG Grid: debounceMs is ignored when apply button is present');
|
12104 | }
|
12105 | return 0;
|
12106 | }
|
12107 | return params.debounceMs != null ? params.debounceMs : debounceDefault;
|
12108 | };
|
12109 |
|
12110 | ProvidedFilter.isUseApplyButton = function (params) {
|
12111 | return !!params.buttons && params.buttons.indexOf('apply') >= 0;
|
12112 | };
|
12113 | ProvidedFilter.prototype.destroy = function () {
|
12114 | var eGui = this.getGui();
|
12115 | if (eGui) {
|
12116 | eGui.removeEventListener('submit', this.onFormSubmit);
|
12117 | }
|
12118 | this.hidePopup = null;
|
12119 | _super.prototype.destroy.call(this);
|
12120 | };
|
12121 | ProvidedFilter.prototype.translate = function (key) {
|
12122 | var translate = this.localeService.getLocaleTextFunc();
|
12123 | return translate(key, DEFAULT_FILTER_LOCALE_TEXT[key]);
|
12124 | };
|
12125 | ProvidedFilter.prototype.getCellValue = function (rowNode) {
|
12126 | var _a = this.providedFilterParams, api = _a.api, colDef = _a.colDef, column = _a.column, columnApi = _a.columnApi, context = _a.context;
|
12127 | return this.providedFilterParams.valueGetter({
|
12128 | api: api,
|
12129 | colDef: colDef,
|
12130 | column: column,
|
12131 | columnApi: columnApi,
|
12132 | context: context,
|
12133 | data: rowNode.data,
|
12134 | getValue: function (field) { return rowNode.data[field]; },
|
12135 | node: rowNode,
|
12136 | });
|
12137 | };
|
12138 |
|
12139 | ProvidedFilter.prototype.getPositionableElement = function () {
|
12140 | return this.eFilterBody;
|
12141 | };
|
12142 | __decorate$2i([
|
12143 | Autowired('rowModel')
|
12144 | ], ProvidedFilter.prototype, "rowModel", void 0);
|
12145 | __decorate$2i([
|
12146 | RefSelector('eFilterBody')
|
12147 | ], ProvidedFilter.prototype, "eFilterBody", void 0);
|
12148 | __decorate$2i([
|
12149 | PostConstruct
|
12150 | ], ProvidedFilter.prototype, "postConstruct", null);
|
12151 | return ProvidedFilter;
|
12152 | }(Component));
|
12153 |
|
12154 |
|
12155 |
|
12156 |
|
12157 |
|
12158 |
|
12159 |
|
12160 | var __extends$2G = (undefined && undefined.__extends) || (function () {
|
12161 | var extendStatics = function (d, b) {
|
12162 | extendStatics = Object.setPrototypeOf ||
|
12163 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12164 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
12165 | return extendStatics(d, b);
|
12166 | };
|
12167 | return function (d, b) {
|
12168 | extendStatics(d, b);
|
12169 | function __() { this.constructor = d; }
|
12170 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12171 | };
|
12172 | })();
|
12173 | var __decorate$2h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
12174 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
12175 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
12176 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12177 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
12178 | };
|
12179 | var AgAbstractLabel = (function (_super) {
|
12180 | __extends$2G(AgAbstractLabel, _super);
|
12181 | function AgAbstractLabel(config, template) {
|
12182 | var _this = _super.call(this, template) || this;
|
12183 | _this.labelSeparator = '';
|
12184 | _this.labelAlignment = 'left';
|
12185 | _this.disabled = false;
|
12186 | _this.label = '';
|
12187 | _this.config = config || {};
|
12188 | return _this;
|
12189 | }
|
12190 | AgAbstractLabel.prototype.postConstruct = function () {
|
12191 | this.addCssClass('ag-labeled');
|
12192 | this.eLabel.classList.add('ag-label');
|
12193 | var _a = this.config, labelSeparator = _a.labelSeparator, label = _a.label, labelWidth = _a.labelWidth, labelAlignment = _a.labelAlignment;
|
12194 | if (labelSeparator != null) {
|
12195 | this.setLabelSeparator(labelSeparator);
|
12196 | }
|
12197 | if (label != null) {
|
12198 | this.setLabel(label);
|
12199 | }
|
12200 | if (labelWidth != null) {
|
12201 | this.setLabelWidth(labelWidth);
|
12202 | }
|
12203 | this.setLabelAlignment(labelAlignment || this.labelAlignment);
|
12204 | this.refreshLabel();
|
12205 | };
|
12206 | AgAbstractLabel.prototype.refreshLabel = function () {
|
12207 | clearElement(this.eLabel);
|
12208 | if (typeof this.label === 'string') {
|
12209 | this.eLabel.innerText = this.label + this.labelSeparator;
|
12210 | }
|
12211 | else if (this.label) {
|
12212 | this.eLabel.appendChild(this.label);
|
12213 | }
|
12214 | if (this.label === '') {
|
12215 | setDisplayed(this.eLabel, false);
|
12216 | setAriaRole(this.eLabel, 'presentation');
|
12217 | }
|
12218 | else {
|
12219 | setDisplayed(this.eLabel, true);
|
12220 | setAriaRole(this.eLabel, null);
|
12221 | }
|
12222 | };
|
12223 | AgAbstractLabel.prototype.setLabelSeparator = function (labelSeparator) {
|
12224 | if (this.labelSeparator === labelSeparator) {
|
12225 | return this;
|
12226 | }
|
12227 | this.labelSeparator = labelSeparator;
|
12228 | if (this.label != null) {
|
12229 | this.refreshLabel();
|
12230 | }
|
12231 | return this;
|
12232 | };
|
12233 | AgAbstractLabel.prototype.getLabelId = function () {
|
12234 | this.eLabel.id = this.eLabel.id || "ag-" + this.getCompId() + "-label";
|
12235 | return this.eLabel.id;
|
12236 | };
|
12237 | AgAbstractLabel.prototype.getLabel = function () {
|
12238 | return this.label;
|
12239 | };
|
12240 | AgAbstractLabel.prototype.setLabel = function (label) {
|
12241 | if (this.label === label) {
|
12242 | return this;
|
12243 | }
|
12244 | this.label = label;
|
12245 | this.refreshLabel();
|
12246 | return this;
|
12247 | };
|
12248 | AgAbstractLabel.prototype.setLabelAlignment = function (alignment) {
|
12249 | var eGui = this.getGui();
|
12250 | var eGuiClassList = eGui.classList;
|
12251 | eGuiClassList.toggle('ag-label-align-left', alignment === 'left');
|
12252 | eGuiClassList.toggle('ag-label-align-right', alignment === 'right');
|
12253 | eGuiClassList.toggle('ag-label-align-top', alignment === 'top');
|
12254 | return this;
|
12255 | };
|
12256 | AgAbstractLabel.prototype.setLabelEllipsis = function (hasEllipsis) {
|
12257 | this.eLabel.classList.toggle('ag-label-ellipsis', hasEllipsis);
|
12258 | return this;
|
12259 | };
|
12260 | AgAbstractLabel.prototype.setLabelWidth = function (width) {
|
12261 | if (this.label == null) {
|
12262 | return this;
|
12263 | }
|
12264 | setElementWidth(this.eLabel, width);
|
12265 | return this;
|
12266 | };
|
12267 | AgAbstractLabel.prototype.setDisabled = function (disabled) {
|
12268 | disabled = !!disabled;
|
12269 | var element = this.getGui();
|
12270 | setDisabled(element, disabled);
|
12271 | element.classList.toggle('ag-disabled', disabled);
|
12272 | this.disabled = disabled;
|
12273 | return this;
|
12274 | };
|
12275 | AgAbstractLabel.prototype.isDisabled = function () {
|
12276 | return !!this.disabled;
|
12277 | };
|
12278 | __decorate$2h([
|
12279 | PostConstruct
|
12280 | ], AgAbstractLabel.prototype, "postConstruct", null);
|
12281 | return AgAbstractLabel;
|
12282 | }(Component));
|
12283 |
|
12284 |
|
12285 |
|
12286 |
|
12287 |
|
12288 |
|
12289 |
|
12290 | var __extends$2F = (undefined && undefined.__extends) || (function () {
|
12291 | var extendStatics = function (d, b) {
|
12292 | extendStatics = Object.setPrototypeOf ||
|
12293 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12294 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
12295 | return extendStatics(d, b);
|
12296 | };
|
12297 | return function (d, b) {
|
12298 | extendStatics(d, b);
|
12299 | function __() { this.constructor = d; }
|
12300 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12301 | };
|
12302 | })();
|
12303 | var AgAbstractField = (function (_super) {
|
12304 | __extends$2F(AgAbstractField, _super);
|
12305 | function AgAbstractField(config, template, className) {
|
12306 | var _this = _super.call(this, config, template) || this;
|
12307 | _this.className = className;
|
12308 | return _this;
|
12309 | }
|
12310 | AgAbstractField.prototype.postConstruct = function () {
|
12311 | _super.prototype.postConstruct.call(this);
|
12312 | if (this.className) {
|
12313 | this.addCssClass(this.className);
|
12314 | }
|
12315 | };
|
12316 | AgAbstractField.prototype.onValueChange = function (callbackFn) {
|
12317 | var _this = this;
|
12318 | this.addManagedListener(this, AgAbstractField.EVENT_CHANGED, function () { return callbackFn(_this.getValue()); });
|
12319 | return this;
|
12320 | };
|
12321 | AgAbstractField.prototype.getWidth = function () {
|
12322 | return this.getGui().clientWidth;
|
12323 | };
|
12324 | AgAbstractField.prototype.setWidth = function (width) {
|
12325 | setFixedWidth(this.getGui(), width);
|
12326 | return this;
|
12327 | };
|
12328 | AgAbstractField.prototype.getPreviousValue = function () {
|
12329 | return this.previousValue;
|
12330 | };
|
12331 | AgAbstractField.prototype.getValue = function () {
|
12332 | return this.value;
|
12333 | };
|
12334 | AgAbstractField.prototype.setValue = function (value, silent) {
|
12335 | if (this.value === value) {
|
12336 | return this;
|
12337 | }
|
12338 | this.previousValue = this.value;
|
12339 | this.value = value;
|
12340 | if (!silent) {
|
12341 | this.dispatchEvent({ type: AgAbstractField.EVENT_CHANGED });
|
12342 | }
|
12343 | return this;
|
12344 | };
|
12345 | AgAbstractField.EVENT_CHANGED = 'valueChange';
|
12346 | return AgAbstractField;
|
12347 | }(AgAbstractLabel));
|
12348 |
|
12349 |
|
12350 |
|
12351 |
|
12352 |
|
12353 |
|
12354 |
|
12355 | var __extends$2E = (undefined && undefined.__extends) || (function () {
|
12356 | var extendStatics = function (d, b) {
|
12357 | extendStatics = Object.setPrototypeOf ||
|
12358 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12359 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
12360 | return extendStatics(d, b);
|
12361 | };
|
12362 | return function (d, b) {
|
12363 | extendStatics(d, b);
|
12364 | function __() { this.constructor = d; }
|
12365 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12366 | };
|
12367 | })();
|
12368 | var __decorate$2g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
12369 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
12370 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
12371 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12372 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
12373 | };
|
12374 | var AgPickerField = (function (_super) {
|
12375 | __extends$2E(AgPickerField, _super);
|
12376 | function AgPickerField(config, className, pickerIcon, ariaRole) {
|
12377 | var _this = _super.call(this, config,
|
12378 | "<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;
|
12379 | _this.pickerIcon = pickerIcon;
|
12380 | _this.isPickerDisplayed = false;
|
12381 | _this.isDestroyingPicker = false;
|
12382 | _this.skipClick = false;
|
12383 | return _this;
|
12384 | }
|
12385 | AgPickerField.prototype.postConstruct = function () {
|
12386 | var _this = this;
|
12387 | _super.prototype.postConstruct.call(this);
|
12388 | var displayId = this.getCompId() + "-display";
|
12389 | this.eDisplayField.setAttribute('id', displayId);
|
12390 | setAriaDescribedBy(this.eWrapper, displayId);
|
12391 | var clickHandler = function () {
|
12392 | if (_this.skipClick) {
|
12393 | _this.skipClick = false;
|
12394 | return;
|
12395 | }
|
12396 | if (_this.isDisabled()) {
|
12397 | return;
|
12398 | }
|
12399 | _this.pickerComponent = _this.showPicker();
|
12400 | };
|
12401 | var eGui = this.getGui();
|
12402 | this.addManagedListener(eGui, 'mousedown', function (e) {
|
12403 | if (!_this.skipClick &&
|
12404 | _this.pickerComponent &&
|
12405 | _this.pickerComponent.isAlive() &&
|
12406 | isVisible(_this.pickerComponent.getGui()) &&
|
12407 | eGui.contains(e.target)) {
|
12408 | _this.skipClick = true;
|
12409 | }
|
12410 | });
|
12411 | this.addManagedListener(eGui, 'keydown', function (e) {
|
12412 | switch (e.key) {
|
12413 | case KeyCode.UP:
|
12414 | case KeyCode.DOWN:
|
12415 | case KeyCode.ENTER:
|
12416 | case KeyCode.SPACE:
|
12417 | clickHandler();
|
12418 | case KeyCode.ESCAPE:
|
12419 | if (_this.isPickerDisplayed) {
|
12420 | e.preventDefault();
|
12421 | }
|
12422 | break;
|
12423 | }
|
12424 | });
|
12425 | this.addManagedListener(this.eWrapper, 'click', clickHandler);
|
12426 | this.addManagedListener(this.eLabel, 'click', clickHandler);
|
12427 | if (this.pickerIcon) {
|
12428 | var icon = createIconNoSpan(this.pickerIcon, this.gridOptionsService);
|
12429 | if (icon) {
|
12430 | this.eIcon.appendChild(icon);
|
12431 | }
|
12432 | }
|
12433 | };
|
12434 | AgPickerField.prototype.refreshLabel = function () {
|
12435 | if (exists(this.getLabel())) {
|
12436 | setAriaLabelledBy(this.eWrapper, this.getLabelId());
|
12437 | }
|
12438 | else {
|
12439 | this.eWrapper.removeAttribute('aria-labelledby');
|
12440 | }
|
12441 | _super.prototype.refreshLabel.call(this);
|
12442 | };
|
12443 | AgPickerField.prototype.setAriaLabel = function (label) {
|
12444 | setAriaLabel(this.eWrapper, label);
|
12445 | return this;
|
12446 | };
|
12447 | AgPickerField.prototype.setInputWidth = function (width) {
|
12448 | setElementWidth(this.eWrapper, width);
|
12449 | return this;
|
12450 | };
|
12451 | AgPickerField.prototype.getFocusableElement = function () {
|
12452 | return this.eWrapper;
|
12453 | };
|
12454 | __decorate$2g([
|
12455 | RefSelector('eLabel')
|
12456 | ], AgPickerField.prototype, "eLabel", void 0);
|
12457 | __decorate$2g([
|
12458 | RefSelector('eWrapper')
|
12459 | ], AgPickerField.prototype, "eWrapper", void 0);
|
12460 | __decorate$2g([
|
12461 | RefSelector('eDisplayField')
|
12462 | ], AgPickerField.prototype, "eDisplayField", void 0);
|
12463 | __decorate$2g([
|
12464 | RefSelector('eIcon')
|
12465 | ], AgPickerField.prototype, "eIcon", void 0);
|
12466 | return AgPickerField;
|
12467 | }(AgAbstractField));
|
12468 |
|
12469 |
|
12470 |
|
12471 |
|
12472 |
|
12473 |
|
12474 |
|
12475 | var __extends$2D = (undefined && undefined.__extends) || (function () {
|
12476 | var extendStatics = function (d, b) {
|
12477 | extendStatics = Object.setPrototypeOf ||
|
12478 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12479 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
12480 | return extendStatics(d, b);
|
12481 | };
|
12482 | return function (d, b) {
|
12483 | extendStatics(d, b);
|
12484 | function __() { this.constructor = d; }
|
12485 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12486 | };
|
12487 | })();
|
12488 | var __decorate$2f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
12489 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
12490 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
12491 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12492 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
12493 | };
|
12494 | var AgList = (function (_super) {
|
12495 | __extends$2D(AgList, _super);
|
12496 | function AgList(cssIdentifier) {
|
12497 | if (cssIdentifier === void 0) { cssIdentifier = 'default'; }
|
12498 | var _this = _super.call(this, "<div class=\"ag-list ag-" + cssIdentifier + "-list\" role=\"listbox\"></div>") || this;
|
12499 | _this.cssIdentifier = cssIdentifier;
|
12500 | _this.options = [];
|
12501 | _this.itemEls = [];
|
12502 | return _this;
|
12503 | }
|
12504 | AgList.prototype.init = function () {
|
12505 | this.addManagedListener(this.getGui(), 'keydown', this.handleKeyDown.bind(this));
|
12506 | };
|
12507 | AgList.prototype.handleKeyDown = function (e) {
|
12508 | var key = e.key;
|
12509 | switch (key) {
|
12510 | case KeyCode.ENTER:
|
12511 | if (!this.highlightedEl) {
|
12512 | this.setValue(this.getValue());
|
12513 | }
|
12514 | else {
|
12515 | var pos = this.itemEls.indexOf(this.highlightedEl);
|
12516 | this.setValueByIndex(pos);
|
12517 | }
|
12518 | break;
|
12519 | case KeyCode.DOWN:
|
12520 | case KeyCode.UP:
|
12521 | var isDown = key === KeyCode.DOWN;
|
12522 | var itemToHighlight = void 0;
|
12523 | e.preventDefault();
|
12524 | if (!this.highlightedEl) {
|
12525 | itemToHighlight = this.itemEls[isDown ? 0 : this.itemEls.length - 1];
|
12526 | }
|
12527 | else {
|
12528 | var currentIdx = this.itemEls.indexOf(this.highlightedEl);
|
12529 | var nextPos = currentIdx + (isDown ? 1 : -1);
|
12530 | nextPos = Math.min(Math.max(nextPos, 0), this.itemEls.length - 1);
|
12531 | itemToHighlight = this.itemEls[nextPos];
|
12532 | }
|
12533 | this.highlightItem(itemToHighlight);
|
12534 | break;
|
12535 | }
|
12536 | };
|
12537 | AgList.prototype.addOptions = function (listOptions) {
|
12538 | var _this = this;
|
12539 | listOptions.forEach(function (listOption) { return _this.addOption(listOption); });
|
12540 | return this;
|
12541 | };
|
12542 | AgList.prototype.addOption = function (listOption) {
|
12543 | var value = listOption.value, text = listOption.text;
|
12544 | var sanitisedText = escapeString(text || value);
|
12545 | this.options.push({ value: value, text: sanitisedText });
|
12546 | this.renderOption(value, sanitisedText);
|
12547 | this.updateIndices();
|
12548 | return this;
|
12549 | };
|
12550 | AgList.prototype.updateIndices = function () {
|
12551 | var options = this.getGui().querySelectorAll('.ag-list-item');
|
12552 | options.forEach(function (option, idx) {
|
12553 | setAriaPosInSet(option, idx + 1);
|
12554 | setAriaSetSize(option, options.length);
|
12555 | });
|
12556 | };
|
12557 | AgList.prototype.renderOption = function (value, text) {
|
12558 | var _this = this;
|
12559 | var itemEl = document.createElement('div');
|
12560 | setAriaRole(itemEl, 'option');
|
12561 | itemEl.classList.add('ag-list-item', "ag-" + this.cssIdentifier + "-list-item");
|
12562 | itemEl.innerHTML = "<span>" + text + "</span>";
|
12563 | itemEl.tabIndex = -1;
|
12564 | this.itemEls.push(itemEl);
|
12565 | this.addManagedListener(itemEl, 'mouseover', function () { return _this.highlightItem(itemEl); });
|
12566 | this.addManagedListener(itemEl, 'mouseleave', function () { return _this.clearHighlighted(); });
|
12567 | this.addManagedListener(itemEl, 'click', function () { return _this.setValue(value); });
|
12568 | this.getGui().appendChild(itemEl);
|
12569 | };
|
12570 | AgList.prototype.setValue = function (value, silent) {
|
12571 | if (this.value === value) {
|
12572 | this.fireItemSelected();
|
12573 | return this;
|
12574 | }
|
12575 | if (value == null) {
|
12576 | this.reset();
|
12577 | return this;
|
12578 | }
|
12579 | var idx = this.options.findIndex(function (option) { return option.value === value; });
|
12580 | if (idx !== -1) {
|
12581 | var option = this.options[idx];
|
12582 | this.value = option.value;
|
12583 | this.displayValue = option.text != null ? option.text : option.value;
|
12584 | this.highlightItem(this.itemEls[idx]);
|
12585 | if (!silent) {
|
12586 | this.fireChangeEvent();
|
12587 | }
|
12588 | }
|
12589 | return this;
|
12590 | };
|
12591 | AgList.prototype.setValueByIndex = function (idx) {
|
12592 | return this.setValue(this.options[idx].value);
|
12593 | };
|
12594 | AgList.prototype.getValue = function () {
|
12595 | return this.value;
|
12596 | };
|
12597 | AgList.prototype.getDisplayValue = function () {
|
12598 | return this.displayValue;
|
12599 | };
|
12600 | AgList.prototype.refreshHighlighted = function () {
|
12601 | var _this = this;
|
12602 | this.clearHighlighted();
|
12603 | var idx = this.options.findIndex(function (option) { return option.value === _this.value; });
|
12604 | if (idx !== -1) {
|
12605 | this.highlightItem(this.itemEls[idx]);
|
12606 | }
|
12607 | };
|
12608 | AgList.prototype.reset = function () {
|
12609 | this.value = null;
|
12610 | this.displayValue = null;
|
12611 | this.clearHighlighted();
|
12612 | this.fireChangeEvent();
|
12613 | };
|
12614 | AgList.prototype.highlightItem = function (el) {
|
12615 | if (!el.offsetParent) {
|
12616 | return;
|
12617 | }
|
12618 | this.clearHighlighted();
|
12619 | this.highlightedEl = el;
|
12620 | this.highlightedEl.classList.add(AgList.ACTIVE_CLASS);
|
12621 | setAriaSelected(this.highlightedEl, true);
|
12622 | this.highlightedEl.focus();
|
12623 | };
|
12624 | AgList.prototype.clearHighlighted = function () {
|
12625 | if (!this.highlightedEl || !this.highlightedEl.offsetParent) {
|
12626 | return;
|
12627 | }
|
12628 | this.highlightedEl.classList.remove(AgList.ACTIVE_CLASS);
|
12629 | setAriaSelected(this.highlightedEl, false);
|
12630 | this.highlightedEl = null;
|
12631 | };
|
12632 | AgList.prototype.fireChangeEvent = function () {
|
12633 | this.dispatchEvent({ type: AgAbstractField.EVENT_CHANGED });
|
12634 | this.fireItemSelected();
|
12635 | };
|
12636 | AgList.prototype.fireItemSelected = function () {
|
12637 | this.dispatchEvent({ type: AgList.EVENT_ITEM_SELECTED });
|
12638 | };
|
12639 | AgList.EVENT_ITEM_SELECTED = 'selectedItem';
|
12640 | AgList.ACTIVE_CLASS = 'ag-active-item';
|
12641 | __decorate$2f([
|
12642 | PostConstruct
|
12643 | ], AgList.prototype, "init", null);
|
12644 | return AgList;
|
12645 | }(Component));
|
12646 |
|
12647 |
|
12648 |
|
12649 |
|
12650 |
|
12651 |
|
12652 |
|
12653 | var __extends$2C = (undefined && undefined.__extends) || (function () {
|
12654 | var extendStatics = function (d, b) {
|
12655 | extendStatics = Object.setPrototypeOf ||
|
12656 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12657 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
12658 | return extendStatics(d, b);
|
12659 | };
|
12660 | return function (d, b) {
|
12661 | extendStatics(d, b);
|
12662 | function __() { this.constructor = d; }
|
12663 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12664 | };
|
12665 | })();
|
12666 | var __decorate$2e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
12667 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
12668 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
12669 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12670 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
12671 | };
|
12672 | var AgSelect = (function (_super) {
|
12673 | __extends$2C(AgSelect, _super);
|
12674 | function AgSelect(config) {
|
12675 | return _super.call(this, config, 'ag-select', 'smallDown', 'listbox') || this;
|
12676 | }
|
12677 | AgSelect.prototype.init = function () {
|
12678 | var _this = this;
|
12679 | this.listComponent = this.createBean(new AgList('select'));
|
12680 | this.listComponent.setParentComponent(this);
|
12681 | this.eWrapper.tabIndex = 0;
|
12682 | this.listComponent.addManagedListener(this.listComponent, AgList.EVENT_ITEM_SELECTED, function () {
|
12683 | if (_this.hideList) {
|
12684 | _this.hideList();
|
12685 | }
|
12686 | _this.dispatchEvent({ type: AgSelect.EVENT_ITEM_SELECTED });
|
12687 | });
|
12688 | this.listComponent.addManagedListener(this.listComponent, AgAbstractField.EVENT_CHANGED, function () {
|
12689 | _this.setValue(_this.listComponent.getValue(), false, true);
|
12690 | if (_this.hideList) {
|
12691 | _this.hideList();
|
12692 | }
|
12693 | });
|
12694 | };
|
12695 | AgSelect.prototype.showPicker = function () {
|
12696 | var _this = this;
|
12697 | var listGui = this.listComponent.getGui();
|
12698 | var eDocument = this.gridOptionsService.getDocument();
|
12699 | var destroyMouseWheelFunc = this.addManagedListener(eDocument.body, 'wheel', function (e) {
|
12700 | if (!listGui.contains(e.target) && _this.hideList) {
|
12701 | _this.hideList();
|
12702 | }
|
12703 | });
|
12704 | var destroyFocusOutFunc = this.addManagedListener(listGui, 'focusout', function (e) {
|
12705 | if (!listGui.contains(e.relatedTarget) && _this.hideList) {
|
12706 | _this.hideList();
|
12707 | }
|
12708 | });
|
12709 | var translate = this.localeService.getLocaleTextFunc();
|
12710 | var addPopupRes = this.popupService.addPopup({
|
12711 | modal: true,
|
12712 | eChild: listGui,
|
12713 | closeOnEsc: true,
|
12714 | closedCallback: function () {
|
12715 | _this.hideList = null;
|
12716 | _this.isPickerDisplayed = false;
|
12717 | destroyFocusOutFunc();
|
12718 | destroyMouseWheelFunc();
|
12719 | if (_this.isAlive()) {
|
12720 | setAriaExpanded(_this.eWrapper, false);
|
12721 | _this.getFocusableElement().focus();
|
12722 | }
|
12723 | },
|
12724 | ariaLabel: translate('ariaLabelSelectField', 'Select Field')
|
12725 | });
|
12726 | if (addPopupRes) {
|
12727 | this.hideList = addPopupRes.hideFunc;
|
12728 | }
|
12729 | this.isPickerDisplayed = true;
|
12730 | setElementWidth(listGui, getAbsoluteWidth(this.eWrapper));
|
12731 | setAriaExpanded(this.eWrapper, true);
|
12732 | listGui.style.maxHeight = getInnerHeight(this.popupService.getPopupParent()) + 'px';
|
12733 | listGui.style.position = 'absolute';
|
12734 | this.popupService.positionPopupByComponent({
|
12735 | type: 'ag-list',
|
12736 | eventSource: this.eWrapper,
|
12737 | ePopup: listGui,
|
12738 | position: 'under',
|
12739 | keepWithinBounds: true
|
12740 | });
|
12741 | this.listComponent.refreshHighlighted();
|
12742 | return this.listComponent;
|
12743 | };
|
12744 | AgSelect.prototype.addOptions = function (options) {
|
12745 | var _this = this;
|
12746 | options.forEach(function (option) { return _this.addOption(option); });
|
12747 | return this;
|
12748 | };
|
12749 | AgSelect.prototype.addOption = function (option) {
|
12750 | this.listComponent.addOption(option);
|
12751 | return this;
|
12752 | };
|
12753 | AgSelect.prototype.setValue = function (value, silent, fromPicker) {
|
12754 | if (this.value === value) {
|
12755 | return this;
|
12756 | }
|
12757 | if (!fromPicker) {
|
12758 | this.listComponent.setValue(value, true);
|
12759 | }
|
12760 | var newValue = this.listComponent.getValue();
|
12761 | if (newValue === this.getValue()) {
|
12762 | return this;
|
12763 | }
|
12764 | this.eDisplayField.innerHTML = this.listComponent.getDisplayValue();
|
12765 | return _super.prototype.setValue.call(this, value, silent);
|
12766 | };
|
12767 | AgSelect.prototype.destroy = function () {
|
12768 | if (this.hideList) {
|
12769 | this.hideList();
|
12770 | }
|
12771 | this.destroyBean(this.listComponent);
|
12772 | _super.prototype.destroy.call(this);
|
12773 | };
|
12774 | AgSelect.EVENT_ITEM_SELECTED = 'selectedItem';
|
12775 | __decorate$2e([
|
12776 | Autowired('popupService')
|
12777 | ], AgSelect.prototype, "popupService", void 0);
|
12778 | __decorate$2e([
|
12779 | PostConstruct
|
12780 | ], AgSelect.prototype, "init", null);
|
12781 | return AgSelect;
|
12782 | }(AgPickerField));
|
12783 |
|
12784 |
|
12785 |
|
12786 |
|
12787 |
|
12788 |
|
12789 |
|
12790 | var __extends$2B = (undefined && undefined.__extends) || (function () {
|
12791 | var extendStatics = function (d, b) {
|
12792 | extendStatics = Object.setPrototypeOf ||
|
12793 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12794 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
12795 | return extendStatics(d, b);
|
12796 | };
|
12797 | return function (d, b) {
|
12798 | extendStatics(d, b);
|
12799 | function __() { this.constructor = d; }
|
12800 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12801 | };
|
12802 | })();
|
12803 | var __decorate$2d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
12804 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
12805 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
12806 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12807 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
12808 | };
|
12809 | var AgAbstractInputField = (function (_super) {
|
12810 | __extends$2B(AgAbstractInputField, _super);
|
12811 | function AgAbstractInputField(config, className, inputType, displayFieldTag) {
|
12812 | if (inputType === void 0) { inputType = 'text'; }
|
12813 | if (displayFieldTag === void 0) { displayFieldTag = 'input'; }
|
12814 | 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;
|
12815 | _this.inputType = inputType;
|
12816 | _this.displayFieldTag = displayFieldTag;
|
12817 | return _this;
|
12818 | }
|
12819 | AgAbstractInputField.prototype.postConstruct = function () {
|
12820 | _super.prototype.postConstruct.call(this);
|
12821 | this.setInputType();
|
12822 | this.eLabel.classList.add(this.className + "-label");
|
12823 | this.eWrapper.classList.add(this.className + "-input-wrapper");
|
12824 | this.eInput.classList.add(this.className + "-input");
|
12825 | this.addCssClass('ag-input-field');
|
12826 | this.eInput.id = this.eInput.id || "ag-" + this.getCompId() + "-input";
|
12827 | var _a = this.config, width = _a.width, value = _a.value;
|
12828 | if (width != null) {
|
12829 | this.setWidth(width);
|
12830 | }
|
12831 | if (value != null) {
|
12832 | this.setValue(value);
|
12833 | }
|
12834 | this.addInputListeners();
|
12835 | };
|
12836 | AgAbstractInputField.prototype.refreshLabel = function () {
|
12837 | if (exists(this.getLabel())) {
|
12838 | setAriaLabelledBy(this.eInput, this.getLabelId());
|
12839 | }
|
12840 | else {
|
12841 | this.eInput.removeAttribute('aria-labelledby');
|
12842 | }
|
12843 | _super.prototype.refreshLabel.call(this);
|
12844 | };
|
12845 | AgAbstractInputField.prototype.addInputListeners = function () {
|
12846 | var _this = this;
|
12847 | this.addManagedListener(this.eInput, 'input', function (e) { return _this.setValue(e.target.value); });
|
12848 | };
|
12849 | AgAbstractInputField.prototype.setInputType = function () {
|
12850 | if (this.displayFieldTag === 'input') {
|
12851 | this.eInput.setAttribute('type', this.inputType);
|
12852 | }
|
12853 | };
|
12854 | AgAbstractInputField.prototype.getInputElement = function () {
|
12855 | return this.eInput;
|
12856 | };
|
12857 | AgAbstractInputField.prototype.setInputWidth = function (width) {
|
12858 | setElementWidth(this.eWrapper, width);
|
12859 | return this;
|
12860 | };
|
12861 | AgAbstractInputField.prototype.setInputName = function (name) {
|
12862 | this.getInputElement().setAttribute('name', name);
|
12863 | return this;
|
12864 | };
|
12865 | AgAbstractInputField.prototype.getFocusableElement = function () {
|
12866 | return this.eInput;
|
12867 | };
|
12868 | AgAbstractInputField.prototype.setMaxLength = function (length) {
|
12869 | var eInput = this.eInput;
|
12870 | eInput.maxLength = length;
|
12871 | return this;
|
12872 | };
|
12873 | AgAbstractInputField.prototype.setInputPlaceholder = function (placeholder) {
|
12874 | addOrRemoveAttribute(this.eInput, 'placeholder', placeholder);
|
12875 | return this;
|
12876 | };
|
12877 | AgAbstractInputField.prototype.setInputAriaLabel = function (label) {
|
12878 | setAriaLabel(this.eInput, label);
|
12879 | return this;
|
12880 | };
|
12881 | AgAbstractInputField.prototype.setDisabled = function (disabled) {
|
12882 | setDisabled(this.eInput, disabled);
|
12883 | return _super.prototype.setDisabled.call(this, disabled);
|
12884 | };
|
12885 | __decorate$2d([
|
12886 | RefSelector('eLabel')
|
12887 | ], AgAbstractInputField.prototype, "eLabel", void 0);
|
12888 | __decorate$2d([
|
12889 | RefSelector('eWrapper')
|
12890 | ], AgAbstractInputField.prototype, "eWrapper", void 0);
|
12891 | __decorate$2d([
|
12892 | RefSelector('eInput')
|
12893 | ], AgAbstractInputField.prototype, "eInput", void 0);
|
12894 | return AgAbstractInputField;
|
12895 | }(AgAbstractField));
|
12896 |
|
12897 |
|
12898 |
|
12899 |
|
12900 |
|
12901 |
|
12902 |
|
12903 | var __extends$2A = (undefined && undefined.__extends) || (function () {
|
12904 | var extendStatics = function (d, b) {
|
12905 | extendStatics = Object.setPrototypeOf ||
|
12906 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
12907 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
12908 | return extendStatics(d, b);
|
12909 | };
|
12910 | return function (d, b) {
|
12911 | extendStatics(d, b);
|
12912 | function __() { this.constructor = d; }
|
12913 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12914 | };
|
12915 | })();
|
12916 | var AgCheckbox = (function (_super) {
|
12917 | __extends$2A(AgCheckbox, _super);
|
12918 | function AgCheckbox(config, className, inputType) {
|
12919 | if (className === void 0) { className = 'ag-checkbox'; }
|
12920 | if (inputType === void 0) { inputType = 'checkbox'; }
|
12921 | var _this = _super.call(this, config, className, inputType) || this;
|
12922 | _this.labelAlignment = 'right';
|
12923 | _this.selected = false;
|
12924 | _this.readOnly = false;
|
12925 | _this.passive = false;
|
12926 | return _this;
|
12927 | }
|
12928 | AgCheckbox.prototype.addInputListeners = function () {
|
12929 | this.addManagedListener(this.eInput, 'click', this.onCheckboxClick.bind(this));
|
12930 | this.addManagedListener(this.eLabel, 'click', this.toggle.bind(this));
|
12931 | };
|
12932 | AgCheckbox.prototype.getNextValue = function () {
|
12933 | return this.selected === undefined ? true : !this.selected;
|
12934 | };
|
12935 | AgCheckbox.prototype.setPassive = function (passive) {
|
12936 | this.passive = passive;
|
12937 | };
|
12938 | AgCheckbox.prototype.isReadOnly = function () {
|
12939 | return this.readOnly;
|
12940 | };
|
12941 | AgCheckbox.prototype.setReadOnly = function (readOnly) {
|
12942 | this.eWrapper.classList.toggle('ag-disabled', readOnly);
|
12943 | this.eInput.disabled = readOnly;
|
12944 | this.readOnly = readOnly;
|
12945 | };
|
12946 | AgCheckbox.prototype.setDisabled = function (disabled) {
|
12947 | this.eWrapper.classList.toggle('ag-disabled', disabled);
|
12948 | return _super.prototype.setDisabled.call(this, disabled);
|
12949 | };
|
12950 | AgCheckbox.prototype.toggle = function () {
|
12951 | if (this.eInput.disabled) {
|
12952 | return;
|
12953 | }
|
12954 | var previousValue = this.isSelected();
|
12955 | var nextValue = this.getNextValue();
|
12956 | if (this.passive) {
|
12957 | this.dispatchChange(nextValue, previousValue);
|
12958 | }
|
12959 | else {
|
12960 | this.setValue(nextValue);
|
12961 | }
|
12962 | };
|
12963 | AgCheckbox.prototype.getValue = function () {
|
12964 | return this.isSelected();
|
12965 | };
|
12966 | AgCheckbox.prototype.setValue = function (value, silent) {
|
12967 | this.refreshSelectedClass(value);
|
12968 | this.setSelected(value, silent);
|
12969 | return this;
|
12970 | };
|
12971 | AgCheckbox.prototype.setName = function (name) {
|
12972 | var input = this.getInputElement();
|
12973 | input.name = name;
|
12974 | return this;
|
12975 | };
|
12976 | AgCheckbox.prototype.isSelected = function () {
|
12977 | return this.selected;
|
12978 | };
|
12979 | AgCheckbox.prototype.setSelected = function (selected, silent) {
|
12980 | if (this.isSelected() === selected) {
|
12981 | return;
|
12982 | }
|
12983 | this.previousValue = this.isSelected();
|
12984 | selected = this.selected = typeof selected === 'boolean' ? selected : undefined;
|
12985 | this.eInput.checked = selected;
|
12986 | this.eInput.indeterminate = selected === undefined;
|
12987 | if (!silent) {
|
12988 | this.dispatchChange(this.selected, this.previousValue);
|
12989 | }
|
12990 | };
|
12991 | AgCheckbox.prototype.dispatchChange = function (selected, previousValue, event) {
|
12992 | this.dispatchEvent({ type: AgCheckbox.EVENT_CHANGED, selected: selected, previousValue: previousValue, event: event });
|
12993 | var input = this.getInputElement();
|
12994 | var checkboxChangedEvent = {
|
12995 | type: Events.EVENT_CHECKBOX_CHANGED,
|
12996 | id: input.id,
|
12997 | name: input.name,
|
12998 | selected: selected,
|
12999 | previousValue: previousValue
|
13000 | };
|
13001 | this.eventService.dispatchEvent(checkboxChangedEvent);
|
13002 | };
|
13003 | AgCheckbox.prototype.onCheckboxClick = function (e) {
|
13004 | if (this.passive || this.eInput.disabled) {
|
13005 | return;
|
13006 | }
|
13007 | var previousValue = this.isSelected();
|
13008 | var selected = this.selected = e.target.checked;
|
13009 | this.refreshSelectedClass(selected);
|
13010 | this.dispatchChange(selected, previousValue, e);
|
13011 | };
|
13012 | AgCheckbox.prototype.refreshSelectedClass = function (value) {
|
13013 | this.eWrapper.classList.toggle('ag-checked', value === true);
|
13014 | this.eWrapper.classList.toggle('ag-indeterminate', value == null);
|
13015 | };
|
13016 | return AgCheckbox;
|
13017 | }(AgAbstractInputField));
|
13018 |
|
13019 |
|
13020 |
|
13021 |
|
13022 |
|
13023 |
|
13024 |
|
13025 | var __extends$2z = (undefined && undefined.__extends) || (function () {
|
13026 | var extendStatics = function (d, b) {
|
13027 | extendStatics = Object.setPrototypeOf ||
|
13028 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13029 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
13030 | return extendStatics(d, b);
|
13031 | };
|
13032 | return function (d, b) {
|
13033 | extendStatics(d, b);
|
13034 | function __() { this.constructor = d; }
|
13035 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13036 | };
|
13037 | })();
|
13038 | var AgRadioButton = (function (_super) {
|
13039 | __extends$2z(AgRadioButton, _super);
|
13040 | function AgRadioButton(config) {
|
13041 | return _super.call(this, config, 'ag-radio-button', 'radio') || this;
|
13042 | }
|
13043 | AgRadioButton.prototype.isSelected = function () {
|
13044 | return this.eInput.checked;
|
13045 | };
|
13046 | AgRadioButton.prototype.toggle = function () {
|
13047 | if (this.eInput.disabled) {
|
13048 | return;
|
13049 | }
|
13050 |
|
13051 | if (!this.isSelected()) {
|
13052 | this.setValue(true);
|
13053 | }
|
13054 | };
|
13055 | AgRadioButton.prototype.addInputListeners = function () {
|
13056 | _super.prototype.addInputListeners.call(this);
|
13057 | this.addManagedListener(this.eventService, Events.EVENT_CHECKBOX_CHANGED, this.onChange.bind(this));
|
13058 | };
|
13059 | |
13060 |
|
13061 |
|
13062 |
|
13063 |
|
13064 |
|
13065 | AgRadioButton.prototype.onChange = function (event) {
|
13066 | if (event.selected &&
|
13067 | event.name &&
|
13068 | this.eInput.name &&
|
13069 | this.eInput.name === event.name &&
|
13070 | event.id &&
|
13071 | this.eInput.id !== event.id) {
|
13072 | this.setValue(false, true);
|
13073 | }
|
13074 | };
|
13075 | return AgRadioButton;
|
13076 | }(AgCheckbox));
|
13077 |
|
13078 |
|
13079 |
|
13080 |
|
13081 |
|
13082 |
|
13083 |
|
13084 | var __extends$2y = (undefined && undefined.__extends) || (function () {
|
13085 | var extendStatics = function (d, b) {
|
13086 | extendStatics = Object.setPrototypeOf ||
|
13087 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13088 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
13089 | return extendStatics(d, b);
|
13090 | };
|
13091 | return function (d, b) {
|
13092 | extendStatics(d, b);
|
13093 | function __() { this.constructor = d; }
|
13094 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13095 | };
|
13096 | })();
|
13097 | var __read$n = (undefined && undefined.__read) || function (o, n) {
|
13098 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
13099 | if (!m) return o;
|
13100 | var i = m.call(o), r, ar = [], e;
|
13101 | try {
|
13102 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
13103 | }
|
13104 | catch (error) { e = { error: error }; }
|
13105 | finally {
|
13106 | try {
|
13107 | if (r && !r.done && (m = i["return"])) m.call(i);
|
13108 | }
|
13109 | finally { if (e) throw e.error; }
|
13110 | }
|
13111 | return ar;
|
13112 | };
|
13113 | var __spread$j = (undefined && undefined.__spread) || function () {
|
13114 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$n(arguments[i]));
|
13115 | return ar;
|
13116 | };
|
13117 | var SimpleFilterModelFormatter = (function () {
|
13118 | function SimpleFilterModelFormatter(localeService, optionsFactory) {
|
13119 | this.localeService = localeService;
|
13120 | this.optionsFactory = optionsFactory;
|
13121 | }
|
13122 |
|
13123 |
|
13124 |
|
13125 | SimpleFilterModelFormatter.prototype.getModelAsString = function (model) {
|
13126 | var _this = this;
|
13127 | if (!model) {
|
13128 | return null;
|
13129 | }
|
13130 | var isCombined = model.operator != null;
|
13131 | var translate = this.localeService.getLocaleTextFunc();
|
13132 | if (isCombined) {
|
13133 | var combinedModel = model;
|
13134 | var conditions = combinedModel.conditions;
|
13135 | if (!conditions) {
|
13136 | var condition1 = combinedModel.condition1, condition2 = combinedModel.condition2;
|
13137 | conditions = [condition1, condition2];
|
13138 | }
|
13139 | var customOptions = conditions.map(function (condition) { return _this.getModelAsString(condition); });
|
13140 | var joinOperatorTranslateKey = combinedModel.operator === 'AND' ? 'andCondition' : 'orCondition';
|
13141 | return customOptions.join(" " + translate(joinOperatorTranslateKey, DEFAULT_FILTER_LOCALE_TEXT[joinOperatorTranslateKey]) + " ");
|
13142 | }
|
13143 | else if (model.type === SimpleFilter.BLANK || model.type === SimpleFilter.NOT_BLANK) {
|
13144 | return translate(model.type, model.type);
|
13145 | }
|
13146 | else {
|
13147 | var condition = model;
|
13148 | var customOption = this.optionsFactory.getCustomOption(condition.type);
|
13149 |
|
13150 |
|
13151 | var _a = customOption || {}, displayKey = _a.displayKey, displayName = _a.displayName, numberOfInputs = _a.numberOfInputs;
|
13152 | if (displayKey && displayName && numberOfInputs === 0) {
|
13153 | translate(displayKey, displayName);
|
13154 | return displayName;
|
13155 | }
|
13156 | return this.conditionToString(condition, customOption);
|
13157 | }
|
13158 | };
|
13159 | return SimpleFilterModelFormatter;
|
13160 | }());
|
13161 |
|
13162 |
|
13163 |
|
13164 |
|
13165 |
|
13166 |
|
13167 |
|
13168 | var SimpleFilter = (function (_super) {
|
13169 | __extends$2y(SimpleFilter, _super);
|
13170 | function SimpleFilter() {
|
13171 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
13172 | _this.eTypes = [];
|
13173 | _this.eJoinOperatorPanels = [];
|
13174 | _this.eJoinOperatorsAnd = [];
|
13175 | _this.eJoinOperatorsOr = [];
|
13176 | _this.eConditionBodies = [];
|
13177 | _this.listener = function () { return _this.onUiChanged(); };
|
13178 | _this.lastUiCompletePosition = null;
|
13179 | _this.joinOperatorId = 0;
|
13180 | return _this;
|
13181 | }
|
13182 | SimpleFilter.prototype.getNumberOfInputs = function (type) {
|
13183 | var customOpts = this.optionsFactory.getCustomOption(type);
|
13184 | if (customOpts) {
|
13185 | var numberOfInputs = customOpts.numberOfInputs;
|
13186 | return numberOfInputs != null ? numberOfInputs : 1;
|
13187 | }
|
13188 | var zeroInputTypes = [
|
13189 | SimpleFilter.EMPTY, SimpleFilter.NOT_BLANK, SimpleFilter.BLANK,
|
13190 | ];
|
13191 | if (type && zeroInputTypes.indexOf(type) >= 0) {
|
13192 | return 0;
|
13193 | }
|
13194 | else if (type === SimpleFilter.IN_RANGE) {
|
13195 | return 2;
|
13196 | }
|
13197 | return 1;
|
13198 | };
|
13199 |
|
13200 | SimpleFilter.prototype.onFloatingFilterChanged = function (type, value) {
|
13201 | this.setTypeFromFloatingFilter(type);
|
13202 | this.setValueFromFloatingFilter(value);
|
13203 | this.onUiChanged(true);
|
13204 | };
|
13205 | SimpleFilter.prototype.setTypeFromFloatingFilter = function (type) {
|
13206 | var _this = this;
|
13207 | this.eTypes.forEach(function (eType, position) {
|
13208 | if (position === 0) {
|
13209 | eType.setValue(type, true);
|
13210 | }
|
13211 | else {
|
13212 | eType.setValue(_this.optionsFactory.getDefaultOption(), true);
|
13213 | }
|
13214 | });
|
13215 | };
|
13216 | SimpleFilter.prototype.getModelFromUi = function () {
|
13217 | var conditions = this.getUiCompleteConditions();
|
13218 | if (conditions.length === 0) {
|
13219 | return null;
|
13220 | }
|
13221 | if (this.maxNumConditions > 1 && conditions.length > 1) {
|
13222 | return {
|
13223 | filterType: this.getFilterType(),
|
13224 | operator: this.getJoinOperator(),
|
13225 | condition1: conditions[0],
|
13226 | condition2: conditions[1],
|
13227 | conditions: conditions
|
13228 | };
|
13229 | }
|
13230 | return conditions[0];
|
13231 | };
|
13232 | SimpleFilter.prototype.getConditionTypes = function () {
|
13233 | return this.eTypes.map(function (eType) { return eType.getValue(); });
|
13234 | };
|
13235 | SimpleFilter.prototype.getConditionType = function (position) {
|
13236 | return this.eTypes[position].getValue();
|
13237 | };
|
13238 | SimpleFilter.prototype.getJoinOperator = function () {
|
13239 | if (this.eJoinOperatorsOr.length === 0) {
|
13240 | return this.defaultJoinOperator;
|
13241 | }
|
13242 | return this.eJoinOperatorsOr[0].getValue() === true ? 'OR' : 'AND';
|
13243 | };
|
13244 | SimpleFilter.prototype.areModelsEqual = function (a, b) {
|
13245 | var _this = this;
|
13246 |
|
13247 | if (!a && !b) {
|
13248 | return true;
|
13249 | }
|
13250 |
|
13251 | if ((!a && b) || (a && !b)) {
|
13252 | return false;
|
13253 | }
|
13254 |
|
13255 | var aIsSimple = !a.operator;
|
13256 | var bIsSimple = !b.operator;
|
13257 | var oneSimpleOneCombined = (!aIsSimple && bIsSimple) || (aIsSimple && !bIsSimple);
|
13258 | if (oneSimpleOneCombined) {
|
13259 | return false;
|
13260 | }
|
13261 | var res;
|
13262 |
|
13263 | if (aIsSimple) {
|
13264 | var aSimple = a;
|
13265 | var bSimple = b;
|
13266 | res = this.areSimpleModelsEqual(aSimple, bSimple);
|
13267 | }
|
13268 | else {
|
13269 | var aCombined = a;
|
13270 | var bCombined = b;
|
13271 | res = aCombined.operator === bCombined.operator
|
13272 | && areEqual(aCombined.conditions, bCombined.conditions, function (aModel, bModel) { return _this.areSimpleModelsEqual(aModel, bModel); });
|
13273 | }
|
13274 | return res;
|
13275 | };
|
13276 | SimpleFilter.prototype.setModelIntoUi = function (model) {
|
13277 | var _this = this;
|
13278 | var isCombined = model.operator;
|
13279 | if (isCombined) {
|
13280 | var combinedModel = model;
|
13281 | if (!combinedModel.conditions) {
|
13282 | combinedModel.conditions = [
|
13283 | combinedModel.condition1,
|
13284 | combinedModel.condition2
|
13285 | ];
|
13286 | }
|
13287 | var numConditions = this.validateAndUpdateConditions(combinedModel.conditions);
|
13288 | var numPrevConditions = this.getNumConditions();
|
13289 | if (numConditions < numPrevConditions) {
|
13290 | this.removeConditionsAndOperators(numConditions);
|
13291 | }
|
13292 | else if (numConditions > numPrevConditions) {
|
13293 | for (var i = numPrevConditions; i < numConditions; i++) {
|
13294 | this.createJoinOperatorPanel();
|
13295 | this.createOption();
|
13296 | }
|
13297 | }
|
13298 | var orChecked_1 = combinedModel.operator === 'OR';
|
13299 | this.eJoinOperatorsAnd.forEach(function (eJoinOperatorAnd) { return eJoinOperatorAnd.setValue(!orChecked_1, true); });
|
13300 | this.eJoinOperatorsOr.forEach(function (eJoinOperatorOr) { return eJoinOperatorOr.setValue(orChecked_1, true); });
|
13301 | combinedModel.conditions.forEach(function (condition, position) {
|
13302 | _this.eTypes[position].setValue(condition.type, true);
|
13303 | _this.setConditionIntoUi(condition, position);
|
13304 | });
|
13305 | }
|
13306 | else {
|
13307 | var simpleModel = model;
|
13308 | if (this.getNumConditions() > 1) {
|
13309 | this.removeConditionsAndOperators(1);
|
13310 | }
|
13311 | this.eTypes[0].setValue(simpleModel.type, true);
|
13312 | this.setConditionIntoUi(simpleModel, 0);
|
13313 | }
|
13314 | this.lastUiCompletePosition = this.getNumConditions() - 1;
|
13315 | this.createMissingConditionsAndOperators();
|
13316 | this.onUiChanged();
|
13317 | return AgPromise.resolve();
|
13318 | };
|
13319 | SimpleFilter.prototype.validateAndUpdateConditions = function (conditions) {
|
13320 | var numConditions = conditions.length;
|
13321 | if (numConditions > this.maxNumConditions) {
|
13322 | conditions.splice(this.maxNumConditions);
|
13323 | doOnce(function () { return console.warn('AG Grid: Filter Model contains more conditions than "filterParams.maxNumConditions". Additional conditions have been ignored.'); }, 'simpleFilterSetModelMaxNumConditions');
|
13324 | numConditions = this.maxNumConditions;
|
13325 | }
|
13326 | return numConditions;
|
13327 | };
|
13328 | SimpleFilter.prototype.doesFilterPass = function (params) {
|
13329 | var _this = this;
|
13330 | var _a;
|
13331 | var model = this.getModel();
|
13332 | if (model == null) {
|
13333 | return true;
|
13334 | }
|
13335 | var operator = model.operator;
|
13336 | var models = [];
|
13337 | if (operator) {
|
13338 | var combinedModel = model;
|
13339 | models.push.apply(models, __spread$j(((_a = combinedModel.conditions) !== null && _a !== void 0 ? _a : [])));
|
13340 | }
|
13341 | else {
|
13342 | models.push(model);
|
13343 | }
|
13344 | var combineFunction = operator && operator === 'OR' ? 'some' : 'every';
|
13345 | return models[combineFunction](function (m) { return _this.individualConditionPasses(params, m); });
|
13346 | };
|
13347 | SimpleFilter.prototype.setParams = function (params) {
|
13348 | _super.prototype.setParams.call(this, params);
|
13349 | this.setNumConditions(params);
|
13350 | this.defaultJoinOperator = this.getDefaultJoinOperator(params.defaultJoinOperator);
|
13351 | this.filterPlaceholder = params.filterPlaceholder;
|
13352 | this.optionsFactory = new OptionsFactory();
|
13353 | this.optionsFactory.init(params, this.getDefaultFilterOptions());
|
13354 | this.createOption();
|
13355 | this.createMissingConditionsAndOperators();
|
13356 | };
|
13357 | SimpleFilter.prototype.setNumConditions = function (params) {
|
13358 | var _a, _b;
|
13359 | if (params.suppressAndOrCondition != null) {
|
13360 | doOnce(function () { return console.warn('AG Grid: Since v29.2 "filterParams.suppressAndOrCondition" is deprecated. Use "filterParams.maxNumConditions = 1" instead.'); }, 'simpleFilterSuppressAndOrCondition');
|
13361 | }
|
13362 | if (params.alwaysShowBothConditions != null) {
|
13363 | doOnce(function () { return console.warn('AG Grid: Since v29.2 "filterParams.alwaysShowBothConditions" is deprecated. Use "filterParams.numAlwaysVisibleConditions = 2" instead.'); }, 'simpleFilterAlwaysShowBothConditions');
|
13364 | }
|
13365 | this.maxNumConditions = (_a = params.maxNumConditions) !== null && _a !== void 0 ? _a : (params.suppressAndOrCondition ? 1 : 2);
|
13366 | if (this.maxNumConditions < 1) {
|
13367 | doOnce(function () { return console.warn('AG Grid: "filterParams.maxNumConditions" must be greater than or equal to zero.'); }, 'simpleFilterMaxNumConditions');
|
13368 | this.maxNumConditions = 1;
|
13369 | }
|
13370 | this.numAlwaysVisibleConditions = (_b = params.numAlwaysVisibleConditions) !== null && _b !== void 0 ? _b : (params.alwaysShowBothConditions ? 2 : 1);
|
13371 | if (this.numAlwaysVisibleConditions < 1) {
|
13372 | doOnce(function () { return console.warn('AG Grid: "filterParams.numAlwaysVisibleConditions" must be greater than or equal to zero.'); }, 'simpleFilterNumAlwaysVisibleConditions');
|
13373 | this.numAlwaysVisibleConditions = 1;
|
13374 | }
|
13375 | if (this.numAlwaysVisibleConditions > this.maxNumConditions) {
|
13376 | doOnce(function () { return console.warn('AG Grid: "filterParams.numAlwaysVisibleConditions" cannot be greater than "filterParams.maxNumConditions".'); }, 'simpleFilterNumAlwaysVisibleGreaterThanMaxNumConditions');
|
13377 | this.numAlwaysVisibleConditions = this.maxNumConditions;
|
13378 | }
|
13379 | };
|
13380 | SimpleFilter.prototype.createOption = function () {
|
13381 | var _this = this;
|
13382 | var eType = this.createManagedBean(new AgSelect());
|
13383 | this.eTypes.push(eType);
|
13384 | eType.addCssClass('ag-filter-select');
|
13385 | this.eFilterBody.appendChild(eType.getGui());
|
13386 | var eConditionBody = this.createValueElement();
|
13387 | this.eConditionBodies.push(eConditionBody);
|
13388 | this.eFilterBody.appendChild(eConditionBody);
|
13389 | this.putOptionsIntoDropdown(eType);
|
13390 | this.resetType(eType);
|
13391 | var position = this.getNumConditions() - 1;
|
13392 | this.forEachPositionInput(position, function (element) { return _this.resetInput(element); });
|
13393 | this.addChangedListeners(eType, position);
|
13394 | };
|
13395 | SimpleFilter.prototype.createJoinOperatorPanel = function () {
|
13396 | var eJoinOperatorPanel = document.createElement('div');
|
13397 | this.eJoinOperatorPanels.push(eJoinOperatorPanel);
|
13398 | eJoinOperatorPanel.classList.add('ag-filter-condition');
|
13399 | var eJoinOperatorAnd = this.createJoinOperator(this.eJoinOperatorsAnd, eJoinOperatorPanel, 'and');
|
13400 | var eJoinOperatorOr = this.createJoinOperator(this.eJoinOperatorsOr, eJoinOperatorPanel, 'or');
|
13401 | this.eFilterBody.appendChild(eJoinOperatorPanel);
|
13402 | var index = this.eJoinOperatorPanels.length - 1;
|
13403 | var uniqueGroupId = this.joinOperatorId++;
|
13404 | this.resetJoinOperatorAnd(eJoinOperatorAnd, index, uniqueGroupId);
|
13405 | this.resetJoinOperatorOr(eJoinOperatorOr, index, uniqueGroupId);
|
13406 | if (!this.isReadOnly()) {
|
13407 | eJoinOperatorAnd.onValueChange(this.listener);
|
13408 | eJoinOperatorOr.onValueChange(this.listener);
|
13409 | }
|
13410 | };
|
13411 | SimpleFilter.prototype.createJoinOperator = function (eJoinOperators, eJoinOperatorPanel, andOr) {
|
13412 | var eJoinOperator = this.createManagedBean(new AgRadioButton());
|
13413 | eJoinOperators.push(eJoinOperator);
|
13414 | eJoinOperator.addCssClass('ag-filter-condition-operator');
|
13415 | eJoinOperator.addCssClass("ag-filter-condition-operator-" + andOr);
|
13416 | eJoinOperatorPanel.appendChild(eJoinOperator.getGui());
|
13417 | return eJoinOperator;
|
13418 | };
|
13419 | SimpleFilter.prototype.getDefaultJoinOperator = function (defaultJoinOperator) {
|
13420 | return defaultJoinOperator === 'AND' || defaultJoinOperator === 'OR' ? defaultJoinOperator : 'AND';
|
13421 | };
|
13422 | SimpleFilter.prototype.putOptionsIntoDropdown = function (eType) {
|
13423 | var _this = this;
|
13424 | var filterOptions = this.optionsFactory.getFilterOptions();
|
13425 |
|
13426 | filterOptions.forEach(function (option) {
|
13427 | var listOption = typeof option === 'string' ?
|
13428 | _this.createBoilerplateListOption(option) :
|
13429 | _this.createCustomListOption(option);
|
13430 | eType.addOption(listOption);
|
13431 | });
|
13432 |
|
13433 | eType.setDisabled(filterOptions.length <= 1);
|
13434 | };
|
13435 | SimpleFilter.prototype.createBoilerplateListOption = function (option) {
|
13436 | return { value: option, text: this.translate(option) };
|
13437 | };
|
13438 | SimpleFilter.prototype.createCustomListOption = function (option) {
|
13439 | var displayKey = option.displayKey;
|
13440 | var customOption = this.optionsFactory.getCustomOption(option.displayKey);
|
13441 | return {
|
13442 | value: displayKey,
|
13443 | text: customOption ?
|
13444 | this.localeService.getLocaleTextFunc()(customOption.displayKey, customOption.displayName) :
|
13445 | this.translate(displayKey),
|
13446 | };
|
13447 | };
|
13448 | |
13449 |
|
13450 |
|
13451 | SimpleFilter.prototype.isAllowTwoConditions = function () {
|
13452 | return this.maxNumConditions >= 2;
|
13453 | };
|
13454 | SimpleFilter.prototype.createBodyTemplate = function () {
|
13455 |
|
13456 | return '';
|
13457 | };
|
13458 | SimpleFilter.prototype.getCssIdentifier = function () {
|
13459 | return 'simple-filter';
|
13460 | };
|
13461 | SimpleFilter.prototype.updateUiVisibility = function () {
|
13462 | var joinOperator = this.getJoinOperator();
|
13463 | this.updateNumConditions();
|
13464 |
|
13465 | this.updateConditionStatusesAndValues(this.lastUiCompletePosition, joinOperator);
|
13466 | };
|
13467 | SimpleFilter.prototype.updateNumConditions = function () {
|
13468 | var _a;
|
13469 |
|
13470 | var lastUiCompletePosition = -1;
|
13471 | var areAllConditionsUiComplete = true;
|
13472 | for (var position = 0; position < this.getNumConditions(); position++) {
|
13473 | if (this.isConditionUiComplete(position)) {
|
13474 | lastUiCompletePosition = position;
|
13475 | }
|
13476 | else {
|
13477 | areAllConditionsUiComplete = false;
|
13478 | }
|
13479 | }
|
13480 | if (this.shouldAddNewConditionAtEnd(areAllConditionsUiComplete)) {
|
13481 | this.createJoinOperatorPanel();
|
13482 | this.createOption();
|
13483 | }
|
13484 | else {
|
13485 | var activePosition = (_a = this.lastUiCompletePosition) !== null && _a !== void 0 ? _a : this.getNumConditions() - 2;
|
13486 | if (lastUiCompletePosition < activePosition) {
|
13487 |
|
13488 | this.removeConditionsAndOperators(activePosition + 1);
|
13489 | var removeStartPosition = lastUiCompletePosition + 1;
|
13490 | var numConditionsToRemove = activePosition - removeStartPosition;
|
13491 | if (numConditionsToRemove > 0) {
|
13492 | this.removeConditionsAndOperators(removeStartPosition, numConditionsToRemove);
|
13493 | }
|
13494 | this.createMissingConditionsAndOperators();
|
13495 | }
|
13496 | }
|
13497 | this.lastUiCompletePosition = lastUiCompletePosition;
|
13498 | };
|
13499 | SimpleFilter.prototype.updateConditionStatusesAndValues = function (lastUiCompletePosition, joinOperator) {
|
13500 | var _this = this;
|
13501 | this.eTypes.forEach(function (eType, position) {
|
13502 | var disabled = _this.isConditionDisabled(position, lastUiCompletePosition);
|
13503 | var group = position === 1 ? [eType, _this.eJoinOperatorPanels[0], _this.eJoinOperatorsAnd[0], _this.eJoinOperatorsOr[0]] : [eType];
|
13504 | group.forEach(function (element) {
|
13505 | if (element instanceof AgAbstractInputField || element instanceof AgSelect) {
|
13506 | element.setDisabled(disabled);
|
13507 | }
|
13508 | else {
|
13509 | setDisabled(element, disabled);
|
13510 | }
|
13511 | });
|
13512 | });
|
13513 | this.eConditionBodies.forEach(function (element, index) {
|
13514 | setDisplayed(element, _this.isConditionBodyVisible(index));
|
13515 | });
|
13516 | var orChecked = (joinOperator !== null && joinOperator !== void 0 ? joinOperator : this.getJoinOperator()) === 'OR';
|
13517 | this.eJoinOperatorsAnd.forEach(function (eJoinOperatorAnd, index) {
|
13518 | eJoinOperatorAnd.setValue(!orChecked, true);
|
13519 | });
|
13520 | this.eJoinOperatorsOr.forEach(function (eJoinOperatorOr, index) {
|
13521 | eJoinOperatorOr.setValue(orChecked, true);
|
13522 | });
|
13523 | this.forEachInput(function (element, index, position, numberOfInputs) {
|
13524 | _this.setElementDisplayed(element, index < numberOfInputs);
|
13525 | _this.setElementDisabled(element, _this.isConditionDisabled(position, lastUiCompletePosition));
|
13526 | });
|
13527 | this.resetPlaceholder();
|
13528 | };
|
13529 | SimpleFilter.prototype.shouldAddNewConditionAtEnd = function (areAllConditionsUiComplete) {
|
13530 | return areAllConditionsUiComplete && this.getNumConditions() < this.maxNumConditions && !this.isReadOnly();
|
13531 | };
|
13532 | SimpleFilter.prototype.removeConditionsAndOperators = function (startPosition, deleteCount) {
|
13533 | if (startPosition >= this.getNumConditions()) {
|
13534 | return;
|
13535 | }
|
13536 | this.removeComponents(this.eTypes, startPosition, deleteCount);
|
13537 | this.removeElements(this.eConditionBodies, startPosition, deleteCount);
|
13538 | this.removeValueElements(startPosition, deleteCount);
|
13539 | var joinOperatorIndex = Math.max(startPosition - 1, 0);
|
13540 | this.removeElements(this.eJoinOperatorPanels, joinOperatorIndex, deleteCount);
|
13541 | this.removeComponents(this.eJoinOperatorsAnd, joinOperatorIndex, deleteCount);
|
13542 | this.removeComponents(this.eJoinOperatorsOr, joinOperatorIndex, deleteCount);
|
13543 | };
|
13544 | SimpleFilter.prototype.removeElements = function (elements, startPosition, deleteCount) {
|
13545 | var removedElements = this.removeItems(elements, startPosition, deleteCount);
|
13546 | removedElements.forEach(function (element) { return removeFromParent(element); });
|
13547 | };
|
13548 | SimpleFilter.prototype.removeComponents = function (components, startPosition, deleteCount) {
|
13549 | var _this = this;
|
13550 | var removedComponents = this.removeItems(components, startPosition, deleteCount);
|
13551 | removedComponents.forEach(function (comp) {
|
13552 | removeFromParent(comp.getGui());
|
13553 | _this.destroyBean(comp);
|
13554 | });
|
13555 | };
|
13556 | SimpleFilter.prototype.removeItems = function (items, startPosition, deleteCount) {
|
13557 | return deleteCount == null ? items.splice(startPosition) : items.splice(startPosition, deleteCount);
|
13558 | };
|
13559 | SimpleFilter.prototype.afterGuiAttached = function (params) {
|
13560 | _super.prototype.afterGuiAttached.call(this, params);
|
13561 | this.resetPlaceholder();
|
13562 | if (!params || (!params.suppressFocus && !this.isReadOnly())) {
|
13563 | var firstInput = this.getInputs(0)[0];
|
13564 | if (!firstInput) {
|
13565 | return;
|
13566 | }
|
13567 | if (firstInput instanceof AgAbstractInputField) {
|
13568 | firstInput.getInputElement().focus();
|
13569 | }
|
13570 | }
|
13571 | };
|
13572 | SimpleFilter.prototype.afterGuiDetached = function () {
|
13573 | _super.prototype.afterGuiDetached.call(this);
|
13574 | var appliedModel = this.getModel();
|
13575 | if (!this.areModelsEqual(appliedModel, this.getModelFromUi())) {
|
13576 | this.resetUiToActiveModel(appliedModel);
|
13577 | }
|
13578 |
|
13579 | var lastUiCompletePosition = -1;
|
13580 |
|
13581 | var updatedLastUiCompletePosition = -1;
|
13582 | var conditionsRemoved = false;
|
13583 | var joinOperator = this.getJoinOperator();
|
13584 | for (var position = this.getNumConditions() - 1; position >= 0; position--) {
|
13585 | if (this.isConditionUiComplete(position)) {
|
13586 | if (lastUiCompletePosition === -1) {
|
13587 | lastUiCompletePosition = position;
|
13588 | updatedLastUiCompletePosition = position;
|
13589 | }
|
13590 | }
|
13591 | else {
|
13592 | var shouldRemovePositionAtEnd = position >= this.numAlwaysVisibleConditions && !this.isConditionUiComplete(position - 1);
|
13593 | var positionBeforeLastUiCompletePosition = position < lastUiCompletePosition;
|
13594 | if (shouldRemovePositionAtEnd || positionBeforeLastUiCompletePosition) {
|
13595 | this.removeConditionsAndOperators(position, 1);
|
13596 | conditionsRemoved = true;
|
13597 | if (positionBeforeLastUiCompletePosition) {
|
13598 | updatedLastUiCompletePosition--;
|
13599 | }
|
13600 | }
|
13601 | }
|
13602 | }
|
13603 | var shouldUpdateConditionStatusesAndValues = false;
|
13604 | if (this.getNumConditions() < this.numAlwaysVisibleConditions) {
|
13605 |
|
13606 | this.createMissingConditionsAndOperators();
|
13607 | shouldUpdateConditionStatusesAndValues = true;
|
13608 | }
|
13609 | if (this.shouldAddNewConditionAtEnd(updatedLastUiCompletePosition === this.getNumConditions() - 1)) {
|
13610 | this.createJoinOperatorPanel();
|
13611 | this.createOption();
|
13612 | shouldUpdateConditionStatusesAndValues = true;
|
13613 | }
|
13614 | if (shouldUpdateConditionStatusesAndValues) {
|
13615 | this.updateConditionStatusesAndValues(updatedLastUiCompletePosition, joinOperator);
|
13616 | }
|
13617 | if (conditionsRemoved) {
|
13618 | this.updateJoinOperatorsDisabled();
|
13619 | }
|
13620 | this.lastUiCompletePosition = updatedLastUiCompletePosition;
|
13621 | };
|
13622 | SimpleFilter.prototype.getPlaceholderText = function (defaultPlaceholder, position) {
|
13623 | var placeholder = this.translate(defaultPlaceholder);
|
13624 | if (isFunction(this.filterPlaceholder)) {
|
13625 | var filterPlaceholderFn = this.filterPlaceholder;
|
13626 | var filterOptionKey = this.eTypes[position].getValue();
|
13627 | var filterOption = this.translate(filterOptionKey);
|
13628 | placeholder = filterPlaceholderFn({
|
13629 | filterOptionKey: filterOptionKey,
|
13630 | filterOption: filterOption,
|
13631 | placeholder: placeholder
|
13632 | });
|
13633 | }
|
13634 | else if (typeof this.filterPlaceholder === 'string') {
|
13635 | placeholder = this.filterPlaceholder;
|
13636 | }
|
13637 | return placeholder;
|
13638 | };
|
13639 |
|
13640 | SimpleFilter.prototype.resetPlaceholder = function () {
|
13641 | var _this = this;
|
13642 | var globalTranslate = this.localeService.getLocaleTextFunc();
|
13643 | this.forEachInput(function (element, index, position, numberOfInputs) {
|
13644 | if (!(element instanceof AgAbstractInputField)) {
|
13645 | return;
|
13646 | }
|
13647 | var placeholder = index === 0 && numberOfInputs > 1 ? 'inRangeStart' :
|
13648 | index === 0 ? 'filterOoo' :
|
13649 | 'inRangeEnd';
|
13650 | var ariaLabel = index === 0 && numberOfInputs > 1 ? globalTranslate('ariaFilterFromValue', 'Filter from value') :
|
13651 | index === 0 ? globalTranslate('ariaFilterValue', 'Filter Value') :
|
13652 | globalTranslate('ariaFilterToValue', 'Filter to Value');
|
13653 | element.setInputPlaceholder(_this.getPlaceholderText(placeholder, position));
|
13654 | element.setInputAriaLabel(ariaLabel);
|
13655 | });
|
13656 | };
|
13657 | SimpleFilter.prototype.setElementValue = function (element, value) {
|
13658 | if (element instanceof AgAbstractInputField) {
|
13659 | element.setValue(value != null ? String(value) : null, true);
|
13660 | }
|
13661 | };
|
13662 | SimpleFilter.prototype.setElementDisplayed = function (element, displayed) {
|
13663 | if (element instanceof Component) {
|
13664 | setDisplayed(element.getGui(), displayed);
|
13665 | }
|
13666 | };
|
13667 | SimpleFilter.prototype.setElementDisabled = function (element, disabled) {
|
13668 | if (element instanceof Component) {
|
13669 | setDisabled(element.getGui(), disabled);
|
13670 | }
|
13671 | };
|
13672 | SimpleFilter.prototype.attachElementOnChange = function (element, listener) {
|
13673 | if (element instanceof AgAbstractInputField) {
|
13674 | element.onValueChange(listener);
|
13675 | }
|
13676 | };
|
13677 | SimpleFilter.prototype.forEachInput = function (cb) {
|
13678 | var _this = this;
|
13679 | this.getConditionTypes().forEach(function (type, position) {
|
13680 | _this.forEachPositionTypeInput(position, type, cb);
|
13681 | });
|
13682 | };
|
13683 | SimpleFilter.prototype.forEachPositionInput = function (position, cb) {
|
13684 | var type = this.getConditionType(position);
|
13685 | this.forEachPositionTypeInput(position, type, cb);
|
13686 | };
|
13687 | SimpleFilter.prototype.forEachPositionTypeInput = function (position, type, cb) {
|
13688 | var numberOfInputs = this.getNumberOfInputs(type);
|
13689 | var inputs = this.getInputs(position);
|
13690 | for (var index = 0; index < inputs.length; index++) {
|
13691 | var input = inputs[index];
|
13692 | if (input != null) {
|
13693 | cb(input, index, position, numberOfInputs);
|
13694 | }
|
13695 | }
|
13696 | };
|
13697 | SimpleFilter.prototype.isConditionDisabled = function (position, lastUiCompletePosition) {
|
13698 | if (this.isReadOnly()) {
|
13699 | return true;
|
13700 | }
|
13701 | if (position === 0) {
|
13702 | return false;
|
13703 | }
|
13704 |
|
13705 | return position > lastUiCompletePosition + 1;
|
13706 | };
|
13707 | SimpleFilter.prototype.isConditionBodyVisible = function (position) {
|
13708 |
|
13709 | var type = this.getConditionType(position);
|
13710 | var numberOfInputs = this.getNumberOfInputs(type);
|
13711 | return numberOfInputs > 0;
|
13712 | };
|
13713 |
|
13714 |
|
13715 | SimpleFilter.prototype.isConditionUiComplete = function (position) {
|
13716 | if (position >= this.getNumConditions()) {
|
13717 | return false;
|
13718 | }
|
13719 | var type = this.getConditionType(position);
|
13720 | if (type === SimpleFilter.EMPTY) {
|
13721 | return false;
|
13722 | }
|
13723 | if (this.getValues(position).some(function (v) { return v == null; })) {
|
13724 | return false;
|
13725 | }
|
13726 | return true;
|
13727 | };
|
13728 | SimpleFilter.prototype.getNumConditions = function () {
|
13729 | return this.eTypes.length;
|
13730 | };
|
13731 | SimpleFilter.prototype.getUiCompleteConditions = function () {
|
13732 | var conditions = [];
|
13733 | for (var position = 0; position < this.getNumConditions(); position++) {
|
13734 | if (this.isConditionUiComplete(position)) {
|
13735 | conditions.push(this.createCondition(position));
|
13736 | }
|
13737 | }
|
13738 | return conditions;
|
13739 | };
|
13740 | SimpleFilter.prototype.createMissingConditionsAndOperators = function () {
|
13741 | if (this.isReadOnly()) {
|
13742 | return;
|
13743 | }
|
13744 | for (var i = this.getNumConditions(); i < this.numAlwaysVisibleConditions; i++) {
|
13745 | this.createJoinOperatorPanel();
|
13746 | this.createOption();
|
13747 | }
|
13748 | };
|
13749 | SimpleFilter.prototype.resetUiToDefaults = function (silent) {
|
13750 | var _this = this;
|
13751 | this.removeConditionsAndOperators(this.isReadOnly() ? 1 : this.numAlwaysVisibleConditions);
|
13752 | this.eTypes.forEach(function (eType) { return _this.resetType(eType); });
|
13753 | this.eJoinOperatorsAnd.forEach(function (eJoinOperatorAnd, index) { return _this.resetJoinOperatorAnd(eJoinOperatorAnd, index, _this.joinOperatorId + index); });
|
13754 | this.eJoinOperatorsOr.forEach(function (eJoinOperatorOr, index) { return _this.resetJoinOperatorOr(eJoinOperatorOr, index, _this.joinOperatorId + index); });
|
13755 | this.joinOperatorId++;
|
13756 | this.forEachInput(function (element) { return _this.resetInput(element); });
|
13757 | this.resetPlaceholder();
|
13758 | this.createMissingConditionsAndOperators();
|
13759 | this.lastUiCompletePosition = null;
|
13760 | if (!silent) {
|
13761 | this.onUiChanged();
|
13762 | }
|
13763 | return AgPromise.resolve();
|
13764 | };
|
13765 | SimpleFilter.prototype.resetType = function (eType) {
|
13766 | var translate = this.localeService.getLocaleTextFunc();
|
13767 | var filteringLabel = translate('ariaFilteringOperator', 'Filtering operator');
|
13768 | eType
|
13769 | .setValue(this.optionsFactory.getDefaultOption(), true)
|
13770 | .setAriaLabel(filteringLabel)
|
13771 | .setDisabled(this.isReadOnly());
|
13772 | };
|
13773 | SimpleFilter.prototype.resetJoinOperatorAnd = function (eJoinOperatorAnd, index, uniqueGroupId) {
|
13774 | this.resetJoinOperator(eJoinOperatorAnd, index, this.isDefaultOperator('AND'), this.translate('andCondition'), uniqueGroupId);
|
13775 | };
|
13776 | SimpleFilter.prototype.resetJoinOperatorOr = function (eJoinOperatorOr, index, uniqueGroupId) {
|
13777 | this.resetJoinOperator(eJoinOperatorOr, index, this.isDefaultOperator('OR'), this.translate('orCondition'), uniqueGroupId);
|
13778 | };
|
13779 | SimpleFilter.prototype.resetJoinOperator = function (eJoinOperator, index, value, label, uniqueGroupId) {
|
13780 | this.updateJoinOperatorDisabled(eJoinOperator
|
13781 | .setValue(value, true)
|
13782 | .setName("ag-simple-filter-and-or-" + this.getCompId() + "-" + uniqueGroupId)
|
13783 | .setLabel(label), index);
|
13784 | };
|
13785 | SimpleFilter.prototype.updateJoinOperatorsDisabled = function () {
|
13786 | var _this = this;
|
13787 | this.eJoinOperatorsAnd.forEach(function (eJoinOperator, index) { return _this.updateJoinOperatorDisabled(eJoinOperator, index); });
|
13788 | this.eJoinOperatorsOr.forEach(function (eJoinOperator, index) { return _this.updateJoinOperatorDisabled(eJoinOperator, index); });
|
13789 | };
|
13790 | SimpleFilter.prototype.updateJoinOperatorDisabled = function (eJoinOperator, index) {
|
13791 | eJoinOperator.setDisabled(this.isReadOnly() || index > 0);
|
13792 | };
|
13793 | SimpleFilter.prototype.resetInput = function (element) {
|
13794 | this.setElementValue(element, null);
|
13795 | this.setElementDisabled(element, this.isReadOnly());
|
13796 | };
|
13797 |
|
13798 | SimpleFilter.prototype.setConditionIntoUi = function (model, position) {
|
13799 | var _this = this;
|
13800 | var values = this.mapValuesFromModel(model);
|
13801 | this.forEachInput(function (element, index, elPosition, _) {
|
13802 | if (elPosition !== position) {
|
13803 | return;
|
13804 | }
|
13805 | _this.setElementValue(element, values[index] != null ? values[index] : null);
|
13806 | });
|
13807 | };
|
13808 |
|
13809 |
|
13810 | SimpleFilter.prototype.setValueFromFloatingFilter = function (value) {
|
13811 | var _this = this;
|
13812 | this.forEachInput(function (element, index, position, _) {
|
13813 | _this.setElementValue(element, index === 0 && position === 0 ? value : null);
|
13814 | });
|
13815 | };
|
13816 | SimpleFilter.prototype.isDefaultOperator = function (operator) {
|
13817 | return operator === this.defaultJoinOperator;
|
13818 | };
|
13819 | SimpleFilter.prototype.addChangedListeners = function (eType, position) {
|
13820 | var _this = this;
|
13821 | if (this.isReadOnly()) {
|
13822 | return;
|
13823 | }
|
13824 | eType.onValueChange(this.listener);
|
13825 | this.forEachPositionInput(position, function (element) {
|
13826 | _this.attachElementOnChange(element, _this.listener);
|
13827 | });
|
13828 | };
|
13829 |
|
13830 | SimpleFilter.prototype.individualConditionPasses = function (params, filterModel) {
|
13831 | var cellValue = this.getCellValue(params.node);
|
13832 | var values = this.mapValuesFromModel(filterModel);
|
13833 | var customFilterOption = this.optionsFactory.getCustomOption(filterModel.type);
|
13834 | var customFilterResult = this.evaluateCustomFilter(customFilterOption, values, cellValue);
|
13835 | if (customFilterResult != null) {
|
13836 | return customFilterResult;
|
13837 | }
|
13838 | if (cellValue == null) {
|
13839 | return this.evaluateNullValue(filterModel.type);
|
13840 | }
|
13841 | return this.evaluateNonNullValue(values, cellValue, filterModel, params);
|
13842 | };
|
13843 | SimpleFilter.prototype.evaluateCustomFilter = function (customFilterOption, values, cellValue) {
|
13844 | if (customFilterOption == null) {
|
13845 | return;
|
13846 | }
|
13847 | var predicate = customFilterOption.predicate;
|
13848 |
|
13849 | if (predicate != null && !values.some(function (v) { return v == null; })) {
|
13850 | return predicate(values, cellValue);
|
13851 | }
|
13852 |
|
13853 | return;
|
13854 | };
|
13855 | SimpleFilter.prototype.isBlank = function (cellValue) {
|
13856 | return cellValue == null ||
|
13857 | (typeof cellValue === 'string' && cellValue.trim().length === 0);
|
13858 | };
|
13859 | SimpleFilter.EMPTY = 'empty';
|
13860 | SimpleFilter.BLANK = 'blank';
|
13861 | SimpleFilter.NOT_BLANK = 'notBlank';
|
13862 | SimpleFilter.EQUALS = 'equals';
|
13863 | SimpleFilter.NOT_EQUAL = 'notEqual';
|
13864 | SimpleFilter.LESS_THAN = 'lessThan';
|
13865 | SimpleFilter.LESS_THAN_OR_EQUAL = 'lessThanOrEqual';
|
13866 | SimpleFilter.GREATER_THAN = 'greaterThan';
|
13867 | SimpleFilter.GREATER_THAN_OR_EQUAL = 'greaterThanOrEqual';
|
13868 | SimpleFilter.IN_RANGE = 'inRange';
|
13869 | SimpleFilter.CONTAINS = 'contains';
|
13870 | SimpleFilter.NOT_CONTAINS = 'notContains';
|
13871 | SimpleFilter.STARTS_WITH = 'startsWith';
|
13872 | SimpleFilter.ENDS_WITH = 'endsWith';
|
13873 | return SimpleFilter;
|
13874 | }(ProvidedFilter));
|
13875 |
|
13876 |
|
13877 |
|
13878 |
|
13879 |
|
13880 |
|
13881 |
|
13882 | var __extends$2x = (undefined && undefined.__extends) || (function () {
|
13883 | var extendStatics = function (d, b) {
|
13884 | extendStatics = Object.setPrototypeOf ||
|
13885 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13886 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
13887 | return extendStatics(d, b);
|
13888 | };
|
13889 | return function (d, b) {
|
13890 | extendStatics(d, b);
|
13891 | function __() { this.constructor = d; }
|
13892 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13893 | };
|
13894 | })();
|
13895 | var ScalarFilter = (function (_super) {
|
13896 | __extends$2x(ScalarFilter, _super);
|
13897 | function ScalarFilter() {
|
13898 | return _super !== null && _super.apply(this, arguments) || this;
|
13899 | }
|
13900 | ScalarFilter.prototype.setParams = function (params) {
|
13901 | _super.prototype.setParams.call(this, params);
|
13902 | this.scalarFilterParams = params;
|
13903 | };
|
13904 | ScalarFilter.prototype.evaluateNullValue = function (filterType) {
|
13905 | switch (filterType) {
|
13906 | case ScalarFilter.EQUALS:
|
13907 | case ScalarFilter.NOT_EQUAL:
|
13908 | if (this.scalarFilterParams.includeBlanksInEquals) {
|
13909 | return true;
|
13910 | }
|
13911 | break;
|
13912 | case ScalarFilter.GREATER_THAN:
|
13913 | case ScalarFilter.GREATER_THAN_OR_EQUAL:
|
13914 | if (this.scalarFilterParams.includeBlanksInGreaterThan) {
|
13915 | return true;
|
13916 | }
|
13917 | break;
|
13918 | case ScalarFilter.LESS_THAN:
|
13919 | case ScalarFilter.LESS_THAN_OR_EQUAL:
|
13920 | if (this.scalarFilterParams.includeBlanksInLessThan) {
|
13921 | return true;
|
13922 | }
|
13923 | break;
|
13924 | case ScalarFilter.IN_RANGE:
|
13925 | if (this.scalarFilterParams.includeBlanksInRange) {
|
13926 | return true;
|
13927 | }
|
13928 | break;
|
13929 | case ScalarFilter.BLANK:
|
13930 | return true;
|
13931 | case ScalarFilter.NOT_BLANK:
|
13932 | return false;
|
13933 | }
|
13934 | return false;
|
13935 | };
|
13936 | ScalarFilter.prototype.evaluateNonNullValue = function (values, cellValue, filterModel) {
|
13937 | var comparator = this.comparator();
|
13938 | var compareResult = values[0] != null ? comparator(values[0], cellValue) : 0;
|
13939 | switch (filterModel.type) {
|
13940 | case ScalarFilter.EQUALS:
|
13941 | return compareResult === 0;
|
13942 | case ScalarFilter.NOT_EQUAL:
|
13943 | return compareResult !== 0;
|
13944 | case ScalarFilter.GREATER_THAN:
|
13945 | return compareResult > 0;
|
13946 | case ScalarFilter.GREATER_THAN_OR_EQUAL:
|
13947 | return compareResult >= 0;
|
13948 | case ScalarFilter.LESS_THAN:
|
13949 | return compareResult < 0;
|
13950 | case ScalarFilter.LESS_THAN_OR_EQUAL:
|
13951 | return compareResult <= 0;
|
13952 | case ScalarFilter.IN_RANGE: {
|
13953 | var compareToResult = comparator(values[1], cellValue);
|
13954 | return this.scalarFilterParams.inRangeInclusive ?
|
13955 | compareResult >= 0 && compareToResult <= 0 :
|
13956 | compareResult > 0 && compareToResult < 0;
|
13957 | }
|
13958 | case ScalarFilter.BLANK:
|
13959 | return this.isBlank(cellValue);
|
13960 | case ScalarFilter.NOT_BLANK:
|
13961 | return !this.isBlank(cellValue);
|
13962 | default:
|
13963 | console.warn('AG Grid: Unexpected type of filter "' + filterModel.type + '", it looks like the filter was configured with incorrect Filter Options');
|
13964 | return true;
|
13965 | }
|
13966 | };
|
13967 | return ScalarFilter;
|
13968 | }(SimpleFilter));
|
13969 |
|
13970 |
|
13971 |
|
13972 |
|
13973 |
|
13974 |
|
13975 |
|
13976 | var __extends$2w = (undefined && undefined.__extends) || (function () {
|
13977 | var extendStatics = function (d, b) {
|
13978 | extendStatics = Object.setPrototypeOf ||
|
13979 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
13980 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
13981 | return extendStatics(d, b);
|
13982 | };
|
13983 | return function (d, b) {
|
13984 | extendStatics(d, b);
|
13985 | function __() { this.constructor = d; }
|
13986 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13987 | };
|
13988 | })();
|
13989 | var __assign$g = (undefined && undefined.__assign) || function () {
|
13990 | __assign$g = Object.assign || function(t) {
|
13991 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
13992 | s = arguments[i];
|
13993 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
13994 | t[p] = s[p];
|
13995 | }
|
13996 | return t;
|
13997 | };
|
13998 | return __assign$g.apply(this, arguments);
|
13999 | };
|
14000 | var __decorate$2c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
14001 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
14002 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
14003 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
14004 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
14005 | };
|
14006 | var DEFAULT_MIN_YEAR = 1000;
|
14007 | var DEFAULT_MAX_YEAR = Infinity;
|
14008 | var DateFilterModelFormatter = (function (_super) {
|
14009 | __extends$2w(DateFilterModelFormatter, _super);
|
14010 | function DateFilterModelFormatter(dateFilterParams, localeService, optionsFactory) {
|
14011 | var _this = _super.call(this, localeService, optionsFactory) || this;
|
14012 | _this.dateFilterParams = dateFilterParams;
|
14013 | return _this;
|
14014 | }
|
14015 | DateFilterModelFormatter.prototype.conditionToString = function (condition, options) {
|
14016 | var type = condition.type;
|
14017 | var numberOfInputs = (options || {}).numberOfInputs;
|
14018 | var isRange = type == SimpleFilter.IN_RANGE || numberOfInputs === 2;
|
14019 | var dateFrom = parseDateTimeFromString(condition.dateFrom);
|
14020 | var dateTo = parseDateTimeFromString(condition.dateTo);
|
14021 | var format = this.dateFilterParams.inRangeFloatingFilterDateFormat;
|
14022 | if (isRange) {
|
14023 | var formattedFrom = dateFrom !== null ? dateToFormattedString(dateFrom, format) : 'null';
|
14024 | var formattedTo = dateTo !== null ? dateToFormattedString(dateTo, format) : 'null';
|
14025 | return formattedFrom + "-" + formattedTo;
|
14026 | }
|
14027 | if (dateFrom != null) {
|
14028 | return dateToFormattedString(dateFrom, format);
|
14029 | }
|
14030 |
|
14031 | return "" + type;
|
14032 | };
|
14033 | return DateFilterModelFormatter;
|
14034 | }(SimpleFilterModelFormatter));
|
14035 | var DateFilter = (function (_super) {
|
14036 | __extends$2w(DateFilter, _super);
|
14037 | function DateFilter() {
|
14038 | var _this = _super.call(this, 'dateFilter') || this;
|
14039 | _this.eConditionPanelsFrom = [];
|
14040 | _this.eConditionPanelsTo = [];
|
14041 | _this.dateConditionFromComps = [];
|
14042 | _this.dateConditionToComps = [];
|
14043 | _this.minValidYear = DEFAULT_MIN_YEAR;
|
14044 | _this.maxValidYear = DEFAULT_MAX_YEAR;
|
14045 | return _this;
|
14046 | }
|
14047 | DateFilter.prototype.afterGuiAttached = function (params) {
|
14048 | _super.prototype.afterGuiAttached.call(this, params);
|
14049 | this.dateConditionFromComps[0].afterGuiAttached(params);
|
14050 | };
|
14051 | DateFilter.prototype.mapValuesFromModel = function (filterModel) {
|
14052 |
|
14053 |
|
14054 |
|
14055 |
|
14056 |
|
14057 |
|
14058 |
|
14059 |
|
14060 | var _a = filterModel || {}, dateFrom = _a.dateFrom, dateTo = _a.dateTo, type = _a.type;
|
14061 | return [
|
14062 | dateFrom && parseDateTimeFromString(dateFrom) || null,
|
14063 | dateTo && parseDateTimeFromString(dateTo) || null,
|
14064 | ].slice(0, this.getNumberOfInputs(type));
|
14065 | };
|
14066 | DateFilter.prototype.comparator = function () {
|
14067 | return this.dateFilterParams.comparator ? this.dateFilterParams.comparator : this.defaultComparator.bind(this);
|
14068 | };
|
14069 | DateFilter.prototype.defaultComparator = function (filterDate, cellValue) {
|
14070 |
|
14071 | var cellAsDate = cellValue;
|
14072 | if (cellValue == null || cellAsDate < filterDate) {
|
14073 | return -1;
|
14074 | }
|
14075 | if (cellAsDate > filterDate) {
|
14076 | return 1;
|
14077 | }
|
14078 | return 0;
|
14079 | };
|
14080 | DateFilter.prototype.setParams = function (params) {
|
14081 | this.dateFilterParams = params;
|
14082 | _super.prototype.setParams.call(this, params);
|
14083 | var yearParser = function (param, fallback) {
|
14084 | if (params[param] != null) {
|
14085 | if (!isNaN(params[param])) {
|
14086 | return params[param] == null ? fallback : Number(params[param]);
|
14087 | }
|
14088 | else {
|
14089 | console.warn("AG Grid: DateFilter " + param + " is not a number");
|
14090 | }
|
14091 | }
|
14092 | return fallback;
|
14093 | };
|
14094 | this.minValidYear = yearParser('minValidYear', DEFAULT_MIN_YEAR);
|
14095 | this.maxValidYear = yearParser('maxValidYear', DEFAULT_MAX_YEAR);
|
14096 | if (this.minValidYear > this.maxValidYear) {
|
14097 | console.warn("AG Grid: DateFilter minValidYear should be <= maxValidYear");
|
14098 | }
|
14099 | this.filterModelFormatter = new DateFilterModelFormatter(this.dateFilterParams, this.localeService, this.optionsFactory);
|
14100 | };
|
14101 | DateFilter.prototype.createDateCompWrapper = function (element) {
|
14102 | var _this = this;
|
14103 | var dateCompWrapper = new DateCompWrapper(this.getContext(), this.userComponentFactory, {
|
14104 | onDateChanged: function () { return _this.onUiChanged(); },
|
14105 | filterParams: this.dateFilterParams
|
14106 | }, element);
|
14107 | this.addDestroyFunc(function () { return dateCompWrapper.destroy(); });
|
14108 | return dateCompWrapper;
|
14109 | };
|
14110 | DateFilter.prototype.setElementValue = function (element, value) {
|
14111 | element.setDate(value);
|
14112 | };
|
14113 | DateFilter.prototype.setElementDisplayed = function (element, displayed) {
|
14114 | element.setDisplayed(displayed);
|
14115 | };
|
14116 | DateFilter.prototype.setElementDisabled = function (element, disabled) {
|
14117 | element.setDisabled(disabled);
|
14118 | };
|
14119 | DateFilter.prototype.getDefaultFilterOptions = function () {
|
14120 | return DateFilter.DEFAULT_FILTER_OPTIONS;
|
14121 | };
|
14122 | DateFilter.prototype.createValueElement = function () {
|
14123 | var eCondition = document.createElement('div');
|
14124 | eCondition.classList.add('ag-filter-body');
|
14125 | this.createFromToElement(eCondition, this.eConditionPanelsFrom, this.dateConditionFromComps, 'from');
|
14126 | this.createFromToElement(eCondition, this.eConditionPanelsTo, this.dateConditionToComps, 'to');
|
14127 | return eCondition;
|
14128 | };
|
14129 | DateFilter.prototype.createFromToElement = function (eCondition, eConditionPanels, dateConditionComps, fromTo) {
|
14130 | var eConditionPanel = document.createElement('div');
|
14131 | eConditionPanel.classList.add("ag-filter-" + fromTo);
|
14132 | eConditionPanel.classList.add("ag-filter-date-" + fromTo);
|
14133 | eConditionPanels.push(eConditionPanel);
|
14134 | eCondition.appendChild(eConditionPanel);
|
14135 | dateConditionComps.push(this.createDateCompWrapper(eConditionPanel));
|
14136 | };
|
14137 | DateFilter.prototype.removeValueElements = function (startPosition, deleteCount) {
|
14138 | this.removeDateComps(this.dateConditionFromComps, startPosition, deleteCount);
|
14139 | this.removeDateComps(this.dateConditionToComps, startPosition, deleteCount);
|
14140 | this.removeItems(this.eConditionPanelsFrom, startPosition, deleteCount);
|
14141 | this.removeItems(this.eConditionPanelsTo, startPosition, deleteCount);
|
14142 | };
|
14143 | DateFilter.prototype.removeDateComps = function (components, startPosition, deleteCount) {
|
14144 | var removedComponents = this.removeItems(components, startPosition, deleteCount);
|
14145 | removedComponents.forEach(function (comp) { return comp.destroy(); });
|
14146 | };
|
14147 | DateFilter.prototype.isConditionUiComplete = function (position) {
|
14148 | var _this = this;
|
14149 | if (!_super.prototype.isConditionUiComplete.call(this, position)) {
|
14150 | return false;
|
14151 | }
|
14152 | var isValidDate = function (value) { return value != null
|
14153 | && value.getUTCFullYear() >= _this.minValidYear
|
14154 | && value.getUTCFullYear() <= _this.maxValidYear; };
|
14155 | var valid = true;
|
14156 | this.forEachInput(function (element, index, elPosition, numberOfInputs) {
|
14157 | if (elPosition !== position || !valid || index >= numberOfInputs) {
|
14158 | return;
|
14159 | }
|
14160 | valid = valid && isValidDate(element.getDate());
|
14161 | });
|
14162 | return valid;
|
14163 | };
|
14164 | DateFilter.prototype.areSimpleModelsEqual = function (aSimple, bSimple) {
|
14165 | return aSimple.dateFrom === bSimple.dateFrom
|
14166 | && aSimple.dateTo === bSimple.dateTo
|
14167 | && aSimple.type === bSimple.type;
|
14168 | };
|
14169 | DateFilter.prototype.getFilterType = function () {
|
14170 | return 'date';
|
14171 | };
|
14172 | DateFilter.prototype.createCondition = function (position) {
|
14173 | var type = this.getConditionType(position);
|
14174 | var model = {};
|
14175 | var values = this.getValues(position);
|
14176 | if (values.length > 0) {
|
14177 | model.dateFrom = serialiseDate(values[0]);
|
14178 | }
|
14179 | if (values.length > 1) {
|
14180 | model.dateTo = serialiseDate(values[1]);
|
14181 | }
|
14182 | return __assign$g({ dateFrom: null, dateTo: null, filterType: this.getFilterType(), type: type }, model);
|
14183 | };
|
14184 | DateFilter.prototype.resetPlaceholder = function () {
|
14185 | var globalTranslate = this.localeService.getLocaleTextFunc();
|
14186 | var placeholder = this.translate('dateFormatOoo');
|
14187 | var ariaLabel = globalTranslate('ariaFilterValue', 'Filter Value');
|
14188 | this.forEachInput(function (element) {
|
14189 | element.setInputPlaceholder(placeholder);
|
14190 | element.setInputAriaLabel(ariaLabel);
|
14191 | });
|
14192 | };
|
14193 | DateFilter.prototype.getInputs = function (position) {
|
14194 | if (position >= this.dateConditionFromComps.length) {
|
14195 | return [null, null];
|
14196 | }
|
14197 | return [this.dateConditionFromComps[position], this.dateConditionToComps[position]];
|
14198 | };
|
14199 | DateFilter.prototype.getValues = function (position) {
|
14200 | var result = [];
|
14201 | this.forEachPositionInput(position, function (element, index, _elPosition, numberOfInputs) {
|
14202 | if (index < numberOfInputs) {
|
14203 | result.push(element.getDate());
|
14204 | }
|
14205 | });
|
14206 | return result;
|
14207 | };
|
14208 | DateFilter.prototype.getModelAsString = function (model) {
|
14209 | var _a;
|
14210 | return (_a = this.filterModelFormatter.getModelAsString(model)) !== null && _a !== void 0 ? _a : '';
|
14211 | };
|
14212 | DateFilter.DEFAULT_FILTER_OPTIONS = [
|
14213 | ScalarFilter.EQUALS,
|
14214 | ScalarFilter.GREATER_THAN,
|
14215 | ScalarFilter.LESS_THAN,
|
14216 | ScalarFilter.NOT_EQUAL,
|
14217 | ScalarFilter.IN_RANGE,
|
14218 | ScalarFilter.BLANK,
|
14219 | ScalarFilter.NOT_BLANK,
|
14220 | ];
|
14221 | __decorate$2c([
|
14222 | Autowired('userComponentFactory')
|
14223 | ], DateFilter.prototype, "userComponentFactory", void 0);
|
14224 | return DateFilter;
|
14225 | }(ScalarFilter));
|
14226 |
|
14227 |
|
14228 |
|
14229 |
|
14230 |
|
14231 |
|
14232 |
|
14233 | var __extends$2v = (undefined && undefined.__extends) || (function () {
|
14234 | var extendStatics = function (d, b) {
|
14235 | extendStatics = Object.setPrototypeOf ||
|
14236 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14237 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
14238 | return extendStatics(d, b);
|
14239 | };
|
14240 | return function (d, b) {
|
14241 | extendStatics(d, b);
|
14242 | function __() { this.constructor = d; }
|
14243 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14244 | };
|
14245 | })();
|
14246 | var SimpleFloatingFilter = (function (_super) {
|
14247 | __extends$2v(SimpleFloatingFilter, _super);
|
14248 | function SimpleFloatingFilter() {
|
14249 | return _super !== null && _super.apply(this, arguments) || this;
|
14250 | }
|
14251 | SimpleFloatingFilter.prototype.getDefaultDebounceMs = function () {
|
14252 | return 0;
|
14253 | };
|
14254 |
|
14255 |
|
14256 | SimpleFloatingFilter.prototype.destroy = function () {
|
14257 | _super.prototype.destroy.call(this);
|
14258 | };
|
14259 | SimpleFloatingFilter.prototype.isEventFromFloatingFilter = function (event) {
|
14260 | return event && event.afterFloatingFilter;
|
14261 | };
|
14262 | SimpleFloatingFilter.prototype.isEventFromDataChange = function (event) {
|
14263 | return event === null || event === void 0 ? void 0 : event.afterDataChange;
|
14264 | };
|
14265 | SimpleFloatingFilter.prototype.getLastType = function () {
|
14266 | return this.lastType;
|
14267 | };
|
14268 | SimpleFloatingFilter.prototype.isReadOnly = function () {
|
14269 | return this.readOnly;
|
14270 | };
|
14271 | SimpleFloatingFilter.prototype.setLastTypeFromModel = function (model) {
|
14272 |
|
14273 | if (!model) {
|
14274 | this.lastType = this.optionsFactory.getDefaultOption();
|
14275 | return;
|
14276 | }
|
14277 | var isCombined = model.operator;
|
14278 | var condition;
|
14279 | if (isCombined) {
|
14280 | var combinedModel = model;
|
14281 | condition = combinedModel.conditions[0];
|
14282 | }
|
14283 | else {
|
14284 | condition = model;
|
14285 | }
|
14286 | this.lastType = condition.type;
|
14287 | };
|
14288 | SimpleFloatingFilter.prototype.canWeEditAfterModelFromParentFilter = function (model) {
|
14289 | if (!model) {
|
14290 |
|
14291 |
|
14292 | return this.isTypeEditable(this.lastType);
|
14293 | }
|
14294 |
|
14295 | var isCombined = model.operator;
|
14296 | if (isCombined) {
|
14297 | return false;
|
14298 | }
|
14299 | var simpleModel = model;
|
14300 | return this.isTypeEditable(simpleModel.type);
|
14301 | };
|
14302 | SimpleFloatingFilter.prototype.init = function (params) {
|
14303 | this.optionsFactory = new OptionsFactory();
|
14304 | this.optionsFactory.init(params.filterParams, this.getDefaultFilterOptions());
|
14305 | this.lastType = this.optionsFactory.getDefaultOption();
|
14306 |
|
14307 |
|
14308 | this.readOnly = !!params.filterParams.readOnly;
|
14309 |
|
14310 |
|
14311 |
|
14312 |
|
14313 | var editable = this.isTypeEditable(this.lastType);
|
14314 | this.setEditable(editable);
|
14315 | };
|
14316 | SimpleFloatingFilter.prototype.doesFilterHaveSingleInput = function (filterType) {
|
14317 | var customFilterOption = this.optionsFactory.getCustomOption(filterType);
|
14318 | var numberOfInputs = (customFilterOption || {}).numberOfInputs;
|
14319 | return numberOfInputs == null || numberOfInputs == 1;
|
14320 | };
|
14321 | SimpleFloatingFilter.prototype.isTypeEditable = function (type) {
|
14322 | var uneditableTypes = [
|
14323 | SimpleFilter.IN_RANGE, SimpleFilter.EMPTY, SimpleFilter.BLANK, SimpleFilter.NOT_BLANK,
|
14324 | ];
|
14325 | return !!type &&
|
14326 | !this.isReadOnly() &&
|
14327 | this.doesFilterHaveSingleInput(type) &&
|
14328 | uneditableTypes.indexOf(type) < 0;
|
14329 | };
|
14330 | return SimpleFloatingFilter;
|
14331 | }(Component));
|
14332 |
|
14333 |
|
14334 |
|
14335 |
|
14336 |
|
14337 |
|
14338 |
|
14339 | var __extends$2u = (undefined && undefined.__extends) || (function () {
|
14340 | var extendStatics = function (d, b) {
|
14341 | extendStatics = Object.setPrototypeOf ||
|
14342 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14343 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
14344 | return extendStatics(d, b);
|
14345 | };
|
14346 | return function (d, b) {
|
14347 | extendStatics(d, b);
|
14348 | function __() { this.constructor = d; }
|
14349 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14350 | };
|
14351 | })();
|
14352 | var __decorate$2b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
14353 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
14354 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
14355 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
14356 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
14357 | };
|
14358 | var DateFloatingFilter = (function (_super) {
|
14359 | __extends$2u(DateFloatingFilter, _super);
|
14360 | function DateFloatingFilter() {
|
14361 | 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;
|
14362 | }
|
14363 | DateFloatingFilter.prototype.getDefaultFilterOptions = function () {
|
14364 | return DateFilter.DEFAULT_FILTER_OPTIONS;
|
14365 | };
|
14366 | DateFloatingFilter.prototype.init = function (params) {
|
14367 | _super.prototype.init.call(this, params);
|
14368 | this.params = params;
|
14369 | this.filterParams = params.filterParams;
|
14370 | this.createDateComponent();
|
14371 | var translate = this.localeService.getLocaleTextFunc();
|
14372 | this.eReadOnlyText
|
14373 | .setDisabled(true)
|
14374 | .setInputAriaLabel(translate('ariaDateFilterInput', 'Date Filter Input'));
|
14375 | this.filterModelFormatter = new DateFilterModelFormatter(this.filterParams, this.localeService, this.optionsFactory);
|
14376 | };
|
14377 | DateFloatingFilter.prototype.setEditable = function (editable) {
|
14378 | setDisplayed(this.eDateWrapper, editable);
|
14379 | setDisplayed(this.eReadOnlyText.getGui(), !editable);
|
14380 | };
|
14381 | DateFloatingFilter.prototype.onParentModelChanged = function (model, event) {
|
14382 |
|
14383 |
|
14384 |
|
14385 |
|
14386 | if (this.isEventFromFloatingFilter(event) || this.isEventFromDataChange(event)) {
|
14387 | return;
|
14388 | }
|
14389 | _super.prototype.setLastTypeFromModel.call(this, model);
|
14390 | var allowEditing = !this.isReadOnly() &&
|
14391 | this.canWeEditAfterModelFromParentFilter(model);
|
14392 | this.setEditable(allowEditing);
|
14393 | if (allowEditing) {
|
14394 | if (model) {
|
14395 | var dateModel = model;
|
14396 | this.dateComp.setDate(parseDateTimeFromString(dateModel.dateFrom));
|
14397 | }
|
14398 | else {
|
14399 | this.dateComp.setDate(null);
|
14400 | }
|
14401 | this.eReadOnlyText.setValue('');
|
14402 | }
|
14403 | else {
|
14404 | this.eReadOnlyText.setValue(this.filterModelFormatter.getModelAsString(model));
|
14405 | this.dateComp.setDate(null);
|
14406 | }
|
14407 | };
|
14408 | DateFloatingFilter.prototype.onDateChanged = function () {
|
14409 | var _this = this;
|
14410 | var filterValueDate = this.dateComp.getDate();
|
14411 | var filterValueText = serialiseDate(filterValueDate);
|
14412 | this.params.parentFilterInstance(function (filterInstance) {
|
14413 | if (filterInstance) {
|
14414 | var date = parseDateTimeFromString(filterValueText);
|
14415 | filterInstance.onFloatingFilterChanged(_this.getLastType() || null, date);
|
14416 | }
|
14417 | });
|
14418 | };
|
14419 | DateFloatingFilter.prototype.createDateComponent = function () {
|
14420 | var _this = this;
|
14421 | var debounceMs = ProvidedFilter.getDebounceMs(this.params.filterParams, this.getDefaultDebounceMs());
|
14422 | var dateComponentParams = {
|
14423 | onDateChanged: debounce(this.onDateChanged.bind(this), debounceMs),
|
14424 | filterParams: this.params.column.getColDef().filterParams
|
14425 | };
|
14426 | this.dateComp = new DateCompWrapper(this.getContext(), this.userComponentFactory, dateComponentParams, this.eDateWrapper);
|
14427 | this.addDestroyFunc(function () { return _this.dateComp.destroy(); });
|
14428 | };
|
14429 | DateFloatingFilter.prototype.getFilterModelFormatter = function () {
|
14430 | return this.filterModelFormatter;
|
14431 | };
|
14432 | __decorate$2b([
|
14433 | Autowired('userComponentFactory')
|
14434 | ], DateFloatingFilter.prototype, "userComponentFactory", void 0);
|
14435 | __decorate$2b([
|
14436 | RefSelector('eReadOnlyText')
|
14437 | ], DateFloatingFilter.prototype, "eReadOnlyText", void 0);
|
14438 | __decorate$2b([
|
14439 | RefSelector('eDateWrapper')
|
14440 | ], DateFloatingFilter.prototype, "eDateWrapper", void 0);
|
14441 | return DateFloatingFilter;
|
14442 | }(SimpleFloatingFilter));
|
14443 |
|
14444 |
|
14445 |
|
14446 |
|
14447 |
|
14448 |
|
14449 |
|
14450 | var __extends$2t = (undefined && undefined.__extends) || (function () {
|
14451 | var extendStatics = function (d, b) {
|
14452 | extendStatics = Object.setPrototypeOf ||
|
14453 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14454 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
14455 | return extendStatics(d, b);
|
14456 | };
|
14457 | return function (d, b) {
|
14458 | extendStatics(d, b);
|
14459 | function __() { this.constructor = d; }
|
14460 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14461 | };
|
14462 | })();
|
14463 | var __decorate$2a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
14464 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
14465 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
14466 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
14467 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
14468 | };
|
14469 | var DefaultDateComponent = (function (_super) {
|
14470 | __extends$2t(DefaultDateComponent, _super);
|
14471 | function DefaultDateComponent() {
|
14472 | 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;
|
14473 | }
|
14474 |
|
14475 |
|
14476 | DefaultDateComponent.prototype.destroy = function () {
|
14477 | _super.prototype.destroy.call(this);
|
14478 | };
|
14479 | DefaultDateComponent.prototype.init = function (params) {
|
14480 | var _this = this;
|
14481 | var eDocument = this.gridOptionsService.getDocument();
|
14482 | var inputElement = this.eDateInput.getInputElement();
|
14483 | var shouldUseBrowserDatePicker = this.shouldUseBrowserDatePicker(params);
|
14484 | if (shouldUseBrowserDatePicker) {
|
14485 | inputElement.type = 'date';
|
14486 | }
|
14487 |
|
14488 |
|
14489 | var usingSafariDatePicker = shouldUseBrowserDatePicker && isBrowserSafari();
|
14490 | this.addManagedListener(inputElement, 'mousedown', function () {
|
14491 | if (_this.eDateInput.isDisabled() || usingSafariDatePicker) {
|
14492 | return;
|
14493 | }
|
14494 | inputElement.focus();
|
14495 | });
|
14496 | this.addManagedListener(inputElement, 'input', function (e) {
|
14497 | if (e.target !== eDocument.activeElement) {
|
14498 | return;
|
14499 | }
|
14500 | if (_this.eDateInput.isDisabled()) {
|
14501 | return;
|
14502 | }
|
14503 | params.onDateChanged();
|
14504 | });
|
14505 | var _a = params.filterParams || {}, minValidYear = _a.minValidYear, maxValidYear = _a.maxValidYear;
|
14506 | if (minValidYear) {
|
14507 | inputElement.min = minValidYear + "-01-01";
|
14508 | }
|
14509 | if (maxValidYear) {
|
14510 | inputElement.max = maxValidYear + "-12-31";
|
14511 | }
|
14512 | };
|
14513 | DefaultDateComponent.prototype.getDate = function () {
|
14514 | return parseDateTimeFromString(this.eDateInput.getValue());
|
14515 | };
|
14516 | DefaultDateComponent.prototype.setDate = function (date) {
|
14517 | this.eDateInput.setValue(serialiseDate(date, false));
|
14518 | };
|
14519 | DefaultDateComponent.prototype.setInputPlaceholder = function (placeholder) {
|
14520 | this.eDateInput.setInputPlaceholder(placeholder);
|
14521 | };
|
14522 | DefaultDateComponent.prototype.setDisabled = function (disabled) {
|
14523 | this.eDateInput.setDisabled(disabled);
|
14524 | };
|
14525 | DefaultDateComponent.prototype.afterGuiAttached = function (params) {
|
14526 | if (!params || !params.suppressFocus) {
|
14527 | this.eDateInput.getInputElement().focus();
|
14528 | }
|
14529 | };
|
14530 | DefaultDateComponent.prototype.shouldUseBrowserDatePicker = function (params) {
|
14531 | if (params.filterParams && params.filterParams.browserDatePicker != null) {
|
14532 | return params.filterParams.browserDatePicker;
|
14533 | }
|
14534 | return isBrowserChrome() || isBrowserFirefox() || (isBrowserSafari() && getSafariVersion() >= 14.1);
|
14535 | };
|
14536 | __decorate$2a([
|
14537 | RefSelector('eDateInput')
|
14538 | ], DefaultDateComponent.prototype, "eDateInput", void 0);
|
14539 | return DefaultDateComponent;
|
14540 | }(Component));
|
14541 |
|
14542 |
|
14543 |
|
14544 |
|
14545 |
|
14546 |
|
14547 |
|
14548 | var __extends$2s = (undefined && undefined.__extends) || (function () {
|
14549 | var extendStatics = function (d, b) {
|
14550 | extendStatics = Object.setPrototypeOf ||
|
14551 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14552 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
14553 | return extendStatics(d, b);
|
14554 | };
|
14555 | return function (d, b) {
|
14556 | extendStatics(d, b);
|
14557 | function __() { this.constructor = d; }
|
14558 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14559 | };
|
14560 | })();
|
14561 | var AgInputTextField = (function (_super) {
|
14562 | __extends$2s(AgInputTextField, _super);
|
14563 | function AgInputTextField(config, className, inputType) {
|
14564 | if (className === void 0) { className = 'ag-text-field'; }
|
14565 | if (inputType === void 0) { inputType = 'text'; }
|
14566 | return _super.call(this, config, className, inputType) || this;
|
14567 | }
|
14568 | AgInputTextField.prototype.postConstruct = function () {
|
14569 | _super.prototype.postConstruct.call(this);
|
14570 | if (this.config.allowedCharPattern) {
|
14571 | this.preventDisallowedCharacters();
|
14572 | }
|
14573 | };
|
14574 | AgInputTextField.prototype.setValue = function (value, silent) {
|
14575 | var ret = _super.prototype.setValue.call(this, value, silent);
|
14576 | if (this.eInput.value !== value) {
|
14577 | this.eInput.value = exists(value) ? value : '';
|
14578 | }
|
14579 | return ret;
|
14580 | };
|
14581 | AgInputTextField.prototype.preventDisallowedCharacters = function () {
|
14582 | var pattern = new RegExp("[" + this.config.allowedCharPattern + "]");
|
14583 | var preventDisallowedCharacters = function (event) {
|
14584 | if (event.ctrlKey || event.metaKey) {
|
14585 |
|
14586 | return;
|
14587 | }
|
14588 | if (event.key && !pattern.test(event.key)) {
|
14589 | event.preventDefault();
|
14590 | }
|
14591 | };
|
14592 | this.addManagedListener(this.eInput, 'keypress', preventDisallowedCharacters);
|
14593 | this.addManagedListener(this.eInput, 'paste', function (e) {
|
14594 | var _a;
|
14595 | var text = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text');
|
14596 | if (text && text.split('').some(function (c) { return !pattern.test(c); })) {
|
14597 | e.preventDefault();
|
14598 | }
|
14599 | });
|
14600 | };
|
14601 | return AgInputTextField;
|
14602 | }(AgAbstractInputField));
|
14603 |
|
14604 |
|
14605 |
|
14606 |
|
14607 |
|
14608 |
|
14609 |
|
14610 | var __extends$2r = (undefined && undefined.__extends) || (function () {
|
14611 | var extendStatics = function (d, b) {
|
14612 | extendStatics = Object.setPrototypeOf ||
|
14613 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14614 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
14615 | return extendStatics(d, b);
|
14616 | };
|
14617 | return function (d, b) {
|
14618 | extendStatics(d, b);
|
14619 | function __() { this.constructor = d; }
|
14620 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14621 | };
|
14622 | })();
|
14623 | var AgInputNumberField = (function (_super) {
|
14624 | __extends$2r(AgInputNumberField, _super);
|
14625 | function AgInputNumberField(config) {
|
14626 | return _super.call(this, config, 'ag-number-field', 'number') || this;
|
14627 | }
|
14628 | AgInputNumberField.prototype.postConstruct = function () {
|
14629 | var _this = this;
|
14630 | _super.prototype.postConstruct.call(this);
|
14631 | this.addManagedListener(this.eInput, 'blur', function () {
|
14632 | var floatedValue = parseFloat(_this.eInput.value);
|
14633 | var value = isNaN(floatedValue) ? '' : _this.normalizeValue(floatedValue.toString());
|
14634 | if (_this.value !== value) {
|
14635 | _this.setValue(value);
|
14636 | }
|
14637 | });
|
14638 | this.addManagedListener(this.eInput, 'wheel', this.onWheel.bind(this));
|
14639 | this.eInput.step = 'any';
|
14640 | };
|
14641 | AgInputNumberField.prototype.onWheel = function (e) {
|
14642 |
|
14643 | if (document.activeElement === this.eInput) {
|
14644 | e.preventDefault();
|
14645 | }
|
14646 | };
|
14647 | AgInputNumberField.prototype.normalizeValue = function (value) {
|
14648 | if (value === '') {
|
14649 | return '';
|
14650 | }
|
14651 | if (this.precision) {
|
14652 | value = this.adjustPrecision(value);
|
14653 | }
|
14654 | var val = parseFloat(value);
|
14655 | if (this.min != null && val < this.min) {
|
14656 | value = this.min.toString();
|
14657 | }
|
14658 | else if (this.max != null && val > this.max) {
|
14659 | value = this.max.toString();
|
14660 | }
|
14661 | return value;
|
14662 | };
|
14663 | AgInputNumberField.prototype.adjustPrecision = function (value) {
|
14664 | if (this.precision) {
|
14665 | var floatString = parseFloat(value).toFixed(this.precision);
|
14666 | value = parseFloat(floatString).toString();
|
14667 | }
|
14668 | return value;
|
14669 | };
|
14670 | AgInputNumberField.prototype.setMin = function (min) {
|
14671 | if (this.min === min) {
|
14672 | return this;
|
14673 | }
|
14674 | this.min = min;
|
14675 | addOrRemoveAttribute(this.eInput, 'min', min);
|
14676 | return this;
|
14677 | };
|
14678 | AgInputNumberField.prototype.setMax = function (max) {
|
14679 | if (this.max === max) {
|
14680 | return this;
|
14681 | }
|
14682 | this.max = max;
|
14683 | addOrRemoveAttribute(this.eInput, 'max', max);
|
14684 | return this;
|
14685 | };
|
14686 | AgInputNumberField.prototype.setPrecision = function (precision) {
|
14687 | this.precision = precision;
|
14688 | return this;
|
14689 | };
|
14690 | AgInputNumberField.prototype.setStep = function (step) {
|
14691 | if (this.step === step) {
|
14692 | return this;
|
14693 | }
|
14694 | this.step = step;
|
14695 | addOrRemoveAttribute(this.eInput, 'step', step);
|
14696 | return this;
|
14697 | };
|
14698 | AgInputNumberField.prototype.setValue = function (value, silent) {
|
14699 | if (value != null) {
|
14700 | value = this.adjustPrecision(value);
|
14701 | var normalizedValue = this.normalizeValue(value);
|
14702 | if (value != normalizedValue) {
|
14703 | return this;
|
14704 | }
|
14705 | }
|
14706 | return _super.prototype.setValue.call(this, value, silent);
|
14707 | };
|
14708 | return AgInputNumberField;
|
14709 | }(AgInputTextField));
|
14710 |
|
14711 |
|
14712 |
|
14713 |
|
14714 |
|
14715 |
|
14716 |
|
14717 | var __extends$2q = (undefined && undefined.__extends) || (function () {
|
14718 | var extendStatics = function (d, b) {
|
14719 | extendStatics = Object.setPrototypeOf ||
|
14720 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14721 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
14722 | return extendStatics(d, b);
|
14723 | };
|
14724 | return function (d, b) {
|
14725 | extendStatics(d, b);
|
14726 | function __() { this.constructor = d; }
|
14727 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14728 | };
|
14729 | })();
|
14730 | var NumberFilterModelFormatter = (function (_super) {
|
14731 | __extends$2q(NumberFilterModelFormatter, _super);
|
14732 | function NumberFilterModelFormatter() {
|
14733 | return _super !== null && _super.apply(this, arguments) || this;
|
14734 | }
|
14735 | NumberFilterModelFormatter.prototype.conditionToString = function (condition, options) {
|
14736 | var numberOfInputs = (options || {}).numberOfInputs;
|
14737 | var isRange = condition.type == SimpleFilter.IN_RANGE || numberOfInputs === 2;
|
14738 | if (isRange) {
|
14739 | return condition.filter + "-" + condition.filterTo;
|
14740 | }
|
14741 |
|
14742 | if (condition.filter != null) {
|
14743 | return "" + condition.filter;
|
14744 | }
|
14745 | return "" + condition.type;
|
14746 | };
|
14747 | return NumberFilterModelFormatter;
|
14748 | }(SimpleFilterModelFormatter));
|
14749 | function getAllowedCharPattern(filterParams) {
|
14750 | var allowedCharPattern = (filterParams !== null && filterParams !== void 0 ? filterParams : {}).allowedCharPattern;
|
14751 | if (allowedCharPattern) {
|
14752 | return allowedCharPattern;
|
14753 | }
|
14754 | if (!isBrowserChrome()) {
|
14755 |
|
14756 |
|
14757 | return '\\d\\-\\.';
|
14758 | }
|
14759 | return null;
|
14760 | }
|
14761 | var NumberFilter = (function (_super) {
|
14762 | __extends$2q(NumberFilter, _super);
|
14763 | function NumberFilter() {
|
14764 | var _this = _super.call(this, 'numberFilter') || this;
|
14765 | _this.eValuesFrom = [];
|
14766 | _this.eValuesTo = [];
|
14767 | return _this;
|
14768 | }
|
14769 | NumberFilter.prototype.mapValuesFromModel = function (filterModel) {
|
14770 | var _a = filterModel || {}, filter = _a.filter, filterTo = _a.filterTo, type = _a.type;
|
14771 | return [
|
14772 | this.processValue(filter),
|
14773 | this.processValue(filterTo),
|
14774 | ].slice(0, this.getNumberOfInputs(type));
|
14775 | };
|
14776 | NumberFilter.prototype.getDefaultDebounceMs = function () {
|
14777 | return 500;
|
14778 | };
|
14779 | NumberFilter.prototype.comparator = function () {
|
14780 | return function (left, right) {
|
14781 | if (left === right) {
|
14782 | return 0;
|
14783 | }
|
14784 | return left < right ? 1 : -1;
|
14785 | };
|
14786 | };
|
14787 | NumberFilter.prototype.setParams = function (params) {
|
14788 | this.numberFilterParams = params;
|
14789 | _super.prototype.setParams.call(this, params);
|
14790 | this.filterModelFormatter = new NumberFilterModelFormatter(this.localeService, this.optionsFactory);
|
14791 | };
|
14792 | NumberFilter.prototype.getDefaultFilterOptions = function () {
|
14793 | return NumberFilter.DEFAULT_FILTER_OPTIONS;
|
14794 | };
|
14795 | NumberFilter.prototype.createValueElement = function () {
|
14796 | var allowedCharPattern = getAllowedCharPattern(this.numberFilterParams);
|
14797 | var eCondition = document.createElement('div');
|
14798 | eCondition.classList.add('ag-filter-body');
|
14799 | setAriaRole(eCondition, 'presentation');
|
14800 | this.createFromToElement(eCondition, this.eValuesFrom, 'from', allowedCharPattern);
|
14801 | this.createFromToElement(eCondition, this.eValuesTo, 'to', allowedCharPattern);
|
14802 | return eCondition;
|
14803 | };
|
14804 | NumberFilter.prototype.createFromToElement = function (eCondition, eValues, fromTo, allowedCharPattern) {
|
14805 | var eValue = this.createManagedBean(allowedCharPattern ? new AgInputTextField({ allowedCharPattern: allowedCharPattern }) : new AgInputNumberField());
|
14806 | eValue.addCssClass("ag-filter-" + fromTo);
|
14807 | eValue.addCssClass('ag-filter-filter');
|
14808 | eValues.push(eValue);
|
14809 | eCondition.appendChild(eValue.getGui());
|
14810 | };
|
14811 | NumberFilter.prototype.removeValueElements = function (startPosition, deleteCount) {
|
14812 | this.removeComponents(this.eValuesFrom, startPosition, deleteCount);
|
14813 | this.removeComponents(this.eValuesTo, startPosition, deleteCount);
|
14814 | };
|
14815 | NumberFilter.prototype.getValues = function (position) {
|
14816 | var _this = this;
|
14817 | var result = [];
|
14818 | this.forEachPositionInput(position, function (element, index, _elPosition, numberOfInputs) {
|
14819 | if (index < numberOfInputs) {
|
14820 | result.push(_this.processValue(_this.stringToFloat(element.getValue())));
|
14821 | }
|
14822 | });
|
14823 | return result;
|
14824 | };
|
14825 | NumberFilter.prototype.areSimpleModelsEqual = function (aSimple, bSimple) {
|
14826 | return aSimple.filter === bSimple.filter
|
14827 | && aSimple.filterTo === bSimple.filterTo
|
14828 | && aSimple.type === bSimple.type;
|
14829 | };
|
14830 | NumberFilter.prototype.getFilterType = function () {
|
14831 | return 'number';
|
14832 | };
|
14833 | NumberFilter.prototype.processValue = function (value) {
|
14834 | if (value == null) {
|
14835 | return null;
|
14836 | }
|
14837 | return isNaN(value) ? null : value;
|
14838 | };
|
14839 | NumberFilter.prototype.stringToFloat = function (value) {
|
14840 | if (typeof value === 'number') {
|
14841 | return value;
|
14842 | }
|
14843 | var filterText = makeNull(value);
|
14844 | if (filterText != null && filterText.trim() === '') {
|
14845 | filterText = null;
|
14846 | }
|
14847 | if (this.numberFilterParams.numberParser) {
|
14848 | return this.numberFilterParams.numberParser(filterText);
|
14849 | }
|
14850 | return filterText == null || filterText.trim() === '-' ? null : parseFloat(filterText);
|
14851 | };
|
14852 | NumberFilter.prototype.createCondition = function (position) {
|
14853 | var type = this.getConditionType(position);
|
14854 | var model = {
|
14855 | filterType: this.getFilterType(),
|
14856 | type: type
|
14857 | };
|
14858 | var values = this.getValues(position);
|
14859 | if (values.length > 0) {
|
14860 | model.filter = values[0];
|
14861 | }
|
14862 | if (values.length > 1) {
|
14863 | model.filterTo = values[1];
|
14864 | }
|
14865 | return model;
|
14866 | };
|
14867 | NumberFilter.prototype.getInputs = function (position) {
|
14868 | if (position >= this.eValuesFrom.length) {
|
14869 | return [null, null];
|
14870 | }
|
14871 | return [this.eValuesFrom[position], this.eValuesTo[position]];
|
14872 | };
|
14873 | NumberFilter.prototype.getModelAsString = function (model) {
|
14874 | var _a;
|
14875 | return (_a = this.filterModelFormatter.getModelAsString(model)) !== null && _a !== void 0 ? _a : '';
|
14876 | };
|
14877 | NumberFilter.DEFAULT_FILTER_OPTIONS = [
|
14878 | ScalarFilter.EQUALS,
|
14879 | ScalarFilter.NOT_EQUAL,
|
14880 | ScalarFilter.LESS_THAN,
|
14881 | ScalarFilter.LESS_THAN_OR_EQUAL,
|
14882 | ScalarFilter.GREATER_THAN,
|
14883 | ScalarFilter.GREATER_THAN_OR_EQUAL,
|
14884 | ScalarFilter.IN_RANGE,
|
14885 | ScalarFilter.BLANK,
|
14886 | ScalarFilter.NOT_BLANK,
|
14887 | ];
|
14888 | return NumberFilter;
|
14889 | }(ScalarFilter));
|
14890 |
|
14891 |
|
14892 |
|
14893 |
|
14894 |
|
14895 |
|
14896 |
|
14897 | var __extends$2p = (undefined && undefined.__extends) || (function () {
|
14898 | var extendStatics = function (d, b) {
|
14899 | extendStatics = Object.setPrototypeOf ||
|
14900 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14901 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
14902 | return extendStatics(d, b);
|
14903 | };
|
14904 | return function (d, b) {
|
14905 | extendStatics(d, b);
|
14906 | function __() { this.constructor = d; }
|
14907 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14908 | };
|
14909 | })();
|
14910 | var __assign$f = (undefined && undefined.__assign) || function () {
|
14911 | __assign$f = Object.assign || function(t) {
|
14912 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
14913 | s = arguments[i];
|
14914 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
14915 | t[p] = s[p];
|
14916 | }
|
14917 | return t;
|
14918 | };
|
14919 | return __assign$f.apply(this, arguments);
|
14920 | };
|
14921 | var TextFilterModelFormatter = (function (_super) {
|
14922 | __extends$2p(TextFilterModelFormatter, _super);
|
14923 | function TextFilterModelFormatter() {
|
14924 | return _super !== null && _super.apply(this, arguments) || this;
|
14925 | }
|
14926 | TextFilterModelFormatter.prototype.conditionToString = function (condition, options) {
|
14927 | var numberOfInputs = (options || {}).numberOfInputs;
|
14928 | var isRange = condition.type == SimpleFilter.IN_RANGE || numberOfInputs === 2;
|
14929 | if (isRange) {
|
14930 | return condition.filter + "-" + condition.filterTo;
|
14931 | }
|
14932 |
|
14933 | if (condition.filter != null) {
|
14934 | return "" + condition.filter;
|
14935 | }
|
14936 | return "" + condition.type;
|
14937 | };
|
14938 | return TextFilterModelFormatter;
|
14939 | }(SimpleFilterModelFormatter));
|
14940 | var TextFilter = (function (_super) {
|
14941 | __extends$2p(TextFilter, _super);
|
14942 | function TextFilter() {
|
14943 | var _this = _super.call(this, 'textFilter') || this;
|
14944 | _this.eValuesFrom = [];
|
14945 | _this.eValuesTo = [];
|
14946 | return _this;
|
14947 | }
|
14948 | TextFilter.trimInput = function (value) {
|
14949 | var trimmedInput = value && value.trim();
|
14950 |
|
14951 | return trimmedInput === '' ? value : trimmedInput;
|
14952 | };
|
14953 | TextFilter.prototype.getDefaultDebounceMs = function () {
|
14954 | return 500;
|
14955 | };
|
14956 | TextFilter.prototype.setParams = function (params) {
|
14957 | this.textFilterParams = params;
|
14958 | _super.prototype.setParams.call(this, params);
|
14959 | this.matcher = this.getTextMatcher();
|
14960 | this.formatter = this.textFilterParams.textFormatter ||
|
14961 | (this.textFilterParams.caseSensitive ? TextFilter.DEFAULT_FORMATTER : TextFilter.DEFAULT_LOWERCASE_FORMATTER);
|
14962 | this.filterModelFormatter = new TextFilterModelFormatter(this.localeService, this.optionsFactory);
|
14963 | };
|
14964 | TextFilter.prototype.getTextMatcher = function () {
|
14965 | var legacyComparator = this.textFilterParams.textCustomComparator;
|
14966 | if (legacyComparator) {
|
14967 | _.doOnce(function () { return console.warn('AG Grid - textCustomComparator is deprecated, use textMatcher instead.'); }, 'textCustomComparator.deprecated');
|
14968 | return function (_a) {
|
14969 | var filterOption = _a.filterOption, value = _a.value, filterText = _a.filterText;
|
14970 | return legacyComparator(filterOption, value, filterText);
|
14971 | };
|
14972 | }
|
14973 | return this.textFilterParams.textMatcher || TextFilter.DEFAULT_MATCHER;
|
14974 | };
|
14975 | TextFilter.prototype.createCondition = function (position) {
|
14976 | var type = this.getConditionType(position);
|
14977 | var model = {
|
14978 | filterType: this.getFilterType(),
|
14979 | type: type,
|
14980 | };
|
14981 | var values = this.getValues(position);
|
14982 | if (values.length > 0) {
|
14983 | model.filter = values[0];
|
14984 | }
|
14985 | if (values.length > 1) {
|
14986 | model.filterTo = values[1];
|
14987 | }
|
14988 | return model;
|
14989 | };
|
14990 | TextFilter.prototype.getFilterType = function () {
|
14991 | return 'text';
|
14992 | };
|
14993 | TextFilter.prototype.areSimpleModelsEqual = function (aSimple, bSimple) {
|
14994 | return aSimple.filter === bSimple.filter &&
|
14995 | aSimple.filterTo === bSimple.filterTo &&
|
14996 | aSimple.type === bSimple.type;
|
14997 | };
|
14998 | TextFilter.prototype.getInputs = function (position) {
|
14999 | if (position >= this.eValuesFrom.length) {
|
15000 | return [null, null];
|
15001 | }
|
15002 | return [this.eValuesFrom[position], this.eValuesTo[position]];
|
15003 | };
|
15004 | TextFilter.prototype.getValues = function (position) {
|
15005 | var _this = this;
|
15006 | var result = [];
|
15007 | this.forEachPositionInput(position, function (element, index, _elPosition, numberOfInputs) {
|
15008 | if (index < numberOfInputs) {
|
15009 | var value = makeNull(element.getValue());
|
15010 | var cleanValue = (_this.textFilterParams.trimInput ? TextFilter.trimInput(value) : value) || null;
|
15011 | result.push(cleanValue);
|
15012 | element.setValue(cleanValue, true);
|
15013 | }
|
15014 | });
|
15015 | return result;
|
15016 | };
|
15017 | TextFilter.prototype.getDefaultFilterOptions = function () {
|
15018 | return TextFilter.DEFAULT_FILTER_OPTIONS;
|
15019 | };
|
15020 | TextFilter.prototype.createValueElement = function () {
|
15021 | var eCondition = document.createElement('div');
|
15022 | eCondition.classList.add('ag-filter-body');
|
15023 | setAriaRole(eCondition, 'presentation');
|
15024 | this.createFromToElement(eCondition, this.eValuesFrom, 'from');
|
15025 | this.createFromToElement(eCondition, this.eValuesTo, 'to');
|
15026 | return eCondition;
|
15027 | };
|
15028 | TextFilter.prototype.createFromToElement = function (eCondition, eValues, fromTo) {
|
15029 | var eValue = this.createManagedBean(new AgInputTextField());
|
15030 | eValue.addCssClass("ag-filter-" + fromTo);
|
15031 | eValue.addCssClass('ag-filter-filter');
|
15032 | eValues.push(eValue);
|
15033 | eCondition.appendChild(eValue.getGui());
|
15034 | };
|
15035 | TextFilter.prototype.removeValueElements = function (startPosition, deleteCount) {
|
15036 | this.removeComponents(this.eValuesFrom, startPosition, deleteCount);
|
15037 | this.removeComponents(this.eValuesTo, startPosition, deleteCount);
|
15038 | };
|
15039 | TextFilter.prototype.mapValuesFromModel = function (filterModel) {
|
15040 | var _a = filterModel || {}, filter = _a.filter, filterTo = _a.filterTo, type = _a.type;
|
15041 | return [
|
15042 | filter || null,
|
15043 | filterTo || null,
|
15044 | ].slice(0, this.getNumberOfInputs(type));
|
15045 | };
|
15046 | TextFilter.prototype.evaluateNullValue = function (filterType) {
|
15047 | var filterTypesAllowNulls = [
|
15048 | SimpleFilter.NOT_EQUAL, SimpleFilter.NOT_CONTAINS, SimpleFilter.BLANK,
|
15049 | ];
|
15050 | return filterType ? filterTypesAllowNulls.indexOf(filterType) >= 0 : false;
|
15051 | };
|
15052 | TextFilter.prototype.evaluateNonNullValue = function (values, cellValue, filterModel, params) {
|
15053 | var _this = this;
|
15054 | var formattedValues = values.map(function (v) { return _this.formatter(v); }) || [];
|
15055 | var cellValueFormatted = this.formatter(cellValue);
|
15056 | var _a = this.textFilterParams, api = _a.api, colDef = _a.colDef, column = _a.column, columnApi = _a.columnApi, context = _a.context, textFormatter = _a.textFormatter;
|
15057 | if (filterModel.type === SimpleFilter.BLANK) {
|
15058 | return this.isBlank(cellValue);
|
15059 | }
|
15060 | else if (filterModel.type === SimpleFilter.NOT_BLANK) {
|
15061 | return !this.isBlank(cellValue);
|
15062 | }
|
15063 | var matcherParams = {
|
15064 | api: api,
|
15065 | colDef: colDef,
|
15066 | column: column,
|
15067 | columnApi: columnApi,
|
15068 | context: context,
|
15069 | node: params.node,
|
15070 | data: params.data,
|
15071 | filterOption: filterModel.type,
|
15072 | value: cellValueFormatted,
|
15073 | textFormatter: textFormatter,
|
15074 | };
|
15075 | return formattedValues.some(function (v) { return _this.matcher(__assign$f(__assign$f({}, matcherParams), { filterText: v })); });
|
15076 | };
|
15077 | TextFilter.prototype.getModelAsString = function (model) {
|
15078 | var _a;
|
15079 | return (_a = this.filterModelFormatter.getModelAsString(model)) !== null && _a !== void 0 ? _a : '';
|
15080 | };
|
15081 | TextFilter.DEFAULT_FILTER_OPTIONS = [
|
15082 | SimpleFilter.CONTAINS,
|
15083 | SimpleFilter.NOT_CONTAINS,
|
15084 | SimpleFilter.EQUALS,
|
15085 | SimpleFilter.NOT_EQUAL,
|
15086 | SimpleFilter.STARTS_WITH,
|
15087 | SimpleFilter.ENDS_WITH,
|
15088 | SimpleFilter.BLANK,
|
15089 | SimpleFilter.NOT_BLANK,
|
15090 | ];
|
15091 | TextFilter.DEFAULT_FORMATTER = function (from) { return from; };
|
15092 | TextFilter.DEFAULT_LOWERCASE_FORMATTER = function (from) { return from == null ? null : from.toString().toLowerCase(); };
|
15093 | TextFilter.DEFAULT_MATCHER = function (_a) {
|
15094 | var filterOption = _a.filterOption, value = _a.value, filterText = _a.filterText;
|
15095 | if (filterText == null) {
|
15096 | return false;
|
15097 | }
|
15098 | switch (filterOption) {
|
15099 | case TextFilter.CONTAINS:
|
15100 | return value.indexOf(filterText) >= 0;
|
15101 | case TextFilter.NOT_CONTAINS:
|
15102 | return value.indexOf(filterText) < 0;
|
15103 | case TextFilter.EQUALS:
|
15104 | return value === filterText;
|
15105 | case TextFilter.NOT_EQUAL:
|
15106 | return value != filterText;
|
15107 | case TextFilter.STARTS_WITH:
|
15108 | return value.indexOf(filterText) === 0;
|
15109 | case TextFilter.ENDS_WITH:
|
15110 | var index = value.lastIndexOf(filterText);
|
15111 | return index >= 0 && index === (value.length - filterText.length);
|
15112 | default:
|
15113 | return false;
|
15114 | }
|
15115 | };
|
15116 | return TextFilter;
|
15117 | }(SimpleFilter));
|
15118 |
|
15119 |
|
15120 |
|
15121 |
|
15122 |
|
15123 |
|
15124 |
|
15125 | var __extends$2o = (undefined && undefined.__extends) || (function () {
|
15126 | var extendStatics = function (d, b) {
|
15127 | extendStatics = Object.setPrototypeOf ||
|
15128 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
15129 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
15130 | return extendStatics(d, b);
|
15131 | };
|
15132 | return function (d, b) {
|
15133 | extendStatics(d, b);
|
15134 | function __() { this.constructor = d; }
|
15135 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15136 | };
|
15137 | })();
|
15138 | var __decorate$29 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
15139 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
15140 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
15141 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
15142 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
15143 | };
|
15144 | var FloatingFilterTextInputService = (function (_super) {
|
15145 | __extends$2o(FloatingFilterTextInputService, _super);
|
15146 | function FloatingFilterTextInputService(params) {
|
15147 | var _this = _super.call(this) || this;
|
15148 | _this.params = params;
|
15149 | return _this;
|
15150 | }
|
15151 | FloatingFilterTextInputService.prototype.setupGui = function (parentElement) {
|
15152 | this.eFloatingFilterTextInput = this.createManagedBean(new AgInputTextField(this.params.config));
|
15153 | this.eFloatingFilterTextInput.setInputAriaLabel(this.params.ariaLabel);
|
15154 | parentElement.appendChild(this.eFloatingFilterTextInput.getGui());
|
15155 | };
|
15156 | FloatingFilterTextInputService.prototype.setEditable = function (editable) {
|
15157 | this.eFloatingFilterTextInput.setDisabled(!editable);
|
15158 | };
|
15159 | FloatingFilterTextInputService.prototype.getValue = function () {
|
15160 | return this.eFloatingFilterTextInput.getValue();
|
15161 | };
|
15162 | FloatingFilterTextInputService.prototype.setValue = function (value, silent) {
|
15163 | this.eFloatingFilterTextInput.setValue(value, silent);
|
15164 | };
|
15165 | FloatingFilterTextInputService.prototype.addValueChangedListener = function (listener) {
|
15166 | var inputGui = this.eFloatingFilterTextInput.getGui();
|
15167 | this.addManagedListener(inputGui, 'input', listener);
|
15168 | this.addManagedListener(inputGui, 'keypress', listener);
|
15169 | this.addManagedListener(inputGui, 'keydown', listener);
|
15170 | };
|
15171 | return FloatingFilterTextInputService;
|
15172 | }(BeanStub));
|
15173 | var TextInputFloatingFilter = (function (_super) {
|
15174 | __extends$2o(TextInputFloatingFilter, _super);
|
15175 | function TextInputFloatingFilter() {
|
15176 | return _super !== null && _super.apply(this, arguments) || this;
|
15177 | }
|
15178 | TextInputFloatingFilter.prototype.postConstruct = function () {
|
15179 | this.setTemplate( "\n <div class=\"ag-floating-filter-input\" role=\"presentation\" ref=\"eFloatingFilterInputContainer\"></div>\n ");
|
15180 | };
|
15181 | TextInputFloatingFilter.prototype.getDefaultDebounceMs = function () {
|
15182 | return 500;
|
15183 | };
|
15184 | TextInputFloatingFilter.prototype.onParentModelChanged = function (model, event) {
|
15185 | if (this.isEventFromFloatingFilter(event) || this.isEventFromDataChange(event)) {
|
15186 |
|
15187 |
|
15188 | return;
|
15189 | }
|
15190 | this.setLastTypeFromModel(model);
|
15191 | this.setEditable(this.canWeEditAfterModelFromParentFilter(model));
|
15192 | this.floatingFilterInputService.setValue(this.getFilterModelFormatter().getModelAsString(model));
|
15193 | };
|
15194 | TextInputFloatingFilter.prototype.init = function (params) {
|
15195 | this.params = params;
|
15196 | var displayName = this.columnModel.getDisplayNameForColumn(params.column, 'header', true);
|
15197 | var translate = this.localeService.getLocaleTextFunc();
|
15198 | var ariaLabel = displayName + " " + translate('ariaFilterInput', 'Filter Input');
|
15199 | this.floatingFilterInputService = this.createFloatingFilterInputService(ariaLabel);
|
15200 | this.floatingFilterInputService.setupGui(this.eFloatingFilterInputContainer);
|
15201 | _super.prototype.init.call(this, params);
|
15202 | this.applyActive = ProvidedFilter.isUseApplyButton(this.params.filterParams);
|
15203 | if (!this.isReadOnly()) {
|
15204 | var debounceMs = ProvidedFilter.getDebounceMs(this.params.filterParams, this.getDefaultDebounceMs());
|
15205 | var toDebounce = debounce(this.syncUpWithParentFilter.bind(this), debounceMs);
|
15206 | this.floatingFilterInputService.addValueChangedListener(toDebounce);
|
15207 | }
|
15208 | };
|
15209 | TextInputFloatingFilter.prototype.syncUpWithParentFilter = function (e) {
|
15210 | var _this = this;
|
15211 | var enterKeyPressed = e.key === KeyCode.ENTER;
|
15212 | if (this.applyActive && !enterKeyPressed) {
|
15213 | return;
|
15214 | }
|
15215 | var value = this.floatingFilterInputService.getValue();
|
15216 | if (this.params.filterParams.trimInput) {
|
15217 | value = TextFilter.trimInput(value);
|
15218 | this.floatingFilterInputService.setValue(value, true);
|
15219 | }
|
15220 | this.params.parentFilterInstance(function (filterInstance) {
|
15221 | if (filterInstance) {
|
15222 |
|
15223 | filterInstance.onFloatingFilterChanged(_this.getLastType() || null, value || null);
|
15224 | }
|
15225 | });
|
15226 | };
|
15227 | TextInputFloatingFilter.prototype.setEditable = function (editable) {
|
15228 | this.floatingFilterInputService.setEditable(editable);
|
15229 | };
|
15230 | __decorate$29([
|
15231 | Autowired('columnModel')
|
15232 | ], TextInputFloatingFilter.prototype, "columnModel", void 0);
|
15233 | __decorate$29([
|
15234 | RefSelector('eFloatingFilterInputContainer')
|
15235 | ], TextInputFloatingFilter.prototype, "eFloatingFilterInputContainer", void 0);
|
15236 | __decorate$29([
|
15237 | PostConstruct
|
15238 | ], TextInputFloatingFilter.prototype, "postConstruct", null);
|
15239 | return TextInputFloatingFilter;
|
15240 | }(SimpleFloatingFilter));
|
15241 |
|
15242 |
|
15243 |
|
15244 |
|
15245 |
|
15246 |
|
15247 |
|
15248 | var __extends$2n = (undefined && undefined.__extends) || (function () {
|
15249 | var extendStatics = function (d, b) {
|
15250 | extendStatics = Object.setPrototypeOf ||
|
15251 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
15252 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
15253 | return extendStatics(d, b);
|
15254 | };
|
15255 | return function (d, b) {
|
15256 | extendStatics(d, b);
|
15257 | function __() { this.constructor = d; }
|
15258 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15259 | };
|
15260 | })();
|
15261 | var FloatingFilterNumberInputService = (function (_super) {
|
15262 | __extends$2n(FloatingFilterNumberInputService, _super);
|
15263 | function FloatingFilterNumberInputService(params) {
|
15264 | var _this = _super.call(this) || this;
|
15265 | _this.params = params;
|
15266 | _this.numberInputActive = true;
|
15267 | return _this;
|
15268 | }
|
15269 | FloatingFilterNumberInputService.prototype.setupGui = function (parentElement) {
|
15270 | this.eFloatingFilterNumberInput = this.createManagedBean(new AgInputNumberField());
|
15271 | this.eFloatingFilterTextInput = this.createManagedBean(new AgInputTextField());
|
15272 | this.eFloatingFilterTextInput.setDisabled(true);
|
15273 | this.eFloatingFilterNumberInput.setInputAriaLabel(this.params.ariaLabel);
|
15274 | this.eFloatingFilterTextInput.setInputAriaLabel(this.params.ariaLabel);
|
15275 | parentElement.appendChild(this.eFloatingFilterNumberInput.getGui());
|
15276 | parentElement.appendChild(this.eFloatingFilterTextInput.getGui());
|
15277 | };
|
15278 | FloatingFilterNumberInputService.prototype.setEditable = function (editable) {
|
15279 | this.numberInputActive = editable;
|
15280 | this.eFloatingFilterNumberInput.setDisplayed(this.numberInputActive);
|
15281 | this.eFloatingFilterTextInput.setDisplayed(!this.numberInputActive);
|
15282 | };
|
15283 | FloatingFilterNumberInputService.prototype.getValue = function () {
|
15284 | return this.getActiveInputElement().getValue();
|
15285 | };
|
15286 | FloatingFilterNumberInputService.prototype.setValue = function (value, silent) {
|
15287 | this.getActiveInputElement().setValue(value, silent);
|
15288 | };
|
15289 | FloatingFilterNumberInputService.prototype.getActiveInputElement = function () {
|
15290 | return this.numberInputActive ? this.eFloatingFilterNumberInput : this.eFloatingFilterTextInput;
|
15291 | };
|
15292 | FloatingFilterNumberInputService.prototype.addValueChangedListener = function (listener) {
|
15293 | this.setupListeners(this.eFloatingFilterNumberInput.getGui(), listener);
|
15294 | this.setupListeners(this.eFloatingFilterTextInput.getGui(), listener);
|
15295 | };
|
15296 | FloatingFilterNumberInputService.prototype.setupListeners = function (element, listener) {
|
15297 | this.addManagedListener(element, 'input', listener);
|
15298 | this.addManagedListener(element, 'keypress', listener);
|
15299 | this.addManagedListener(element, 'keydown', listener);
|
15300 | };
|
15301 | return FloatingFilterNumberInputService;
|
15302 | }(BeanStub));
|
15303 | var NumberFloatingFilter = (function (_super) {
|
15304 | __extends$2n(NumberFloatingFilter, _super);
|
15305 | function NumberFloatingFilter() {
|
15306 | return _super !== null && _super.apply(this, arguments) || this;
|
15307 | }
|
15308 | NumberFloatingFilter.prototype.init = function (params) {
|
15309 | _super.prototype.init.call(this, params);
|
15310 | this.filterModelFormatter = new NumberFilterModelFormatter(this.localeService, this.optionsFactory);
|
15311 | };
|
15312 | NumberFloatingFilter.prototype.getDefaultFilterOptions = function () {
|
15313 | return NumberFilter.DEFAULT_FILTER_OPTIONS;
|
15314 | };
|
15315 | NumberFloatingFilter.prototype.getFilterModelFormatter = function () {
|
15316 | return this.filterModelFormatter;
|
15317 | };
|
15318 | NumberFloatingFilter.prototype.createFloatingFilterInputService = function (ariaLabel) {
|
15319 | var allowedCharPattern = getAllowedCharPattern(this.params.filterParams);
|
15320 | if (allowedCharPattern) {
|
15321 |
|
15322 | return this.createManagedBean(new FloatingFilterTextInputService({
|
15323 | config: { allowedCharPattern: allowedCharPattern },
|
15324 | ariaLabel: ariaLabel
|
15325 | }));
|
15326 | }
|
15327 | return this.createManagedBean(new FloatingFilterNumberInputService({ ariaLabel: ariaLabel }));
|
15328 | };
|
15329 | return NumberFloatingFilter;
|
15330 | }(TextInputFloatingFilter));
|
15331 |
|
15332 |
|
15333 |
|
15334 |
|
15335 |
|
15336 |
|
15337 |
|
15338 | var __extends$2m = (undefined && undefined.__extends) || (function () {
|
15339 | var extendStatics = function (d, b) {
|
15340 | extendStatics = Object.setPrototypeOf ||
|
15341 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
15342 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
15343 | return extendStatics(d, b);
|
15344 | };
|
15345 | return function (d, b) {
|
15346 | extendStatics(d, b);
|
15347 | function __() { this.constructor = d; }
|
15348 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15349 | };
|
15350 | })();
|
15351 | var TextFloatingFilter = (function (_super) {
|
15352 | __extends$2m(TextFloatingFilter, _super);
|
15353 | function TextFloatingFilter() {
|
15354 | return _super !== null && _super.apply(this, arguments) || this;
|
15355 | }
|
15356 | TextFloatingFilter.prototype.init = function (params) {
|
15357 | _super.prototype.init.call(this, params);
|
15358 | this.filterModelFormatter = new TextFilterModelFormatter(this.localeService, this.optionsFactory);
|
15359 | };
|
15360 | TextFloatingFilter.prototype.getDefaultFilterOptions = function () {
|
15361 | return TextFilter.DEFAULT_FILTER_OPTIONS;
|
15362 | };
|
15363 | TextFloatingFilter.prototype.getFilterModelFormatter = function () {
|
15364 | return this.filterModelFormatter;
|
15365 | };
|
15366 | TextFloatingFilter.prototype.createFloatingFilterInputService = function (ariaLabel) {
|
15367 | return this.createManagedBean(new FloatingFilterTextInputService({
|
15368 | ariaLabel: ariaLabel
|
15369 | }));
|
15370 | };
|
15371 | return TextFloatingFilter;
|
15372 | }(TextInputFloatingFilter));
|
15373 |
|
15374 |
|
15375 |
|
15376 |
|
15377 |
|
15378 |
|
15379 |
|
15380 | var TouchListener = (function () {
|
15381 | function TouchListener(eElement, preventMouseClick) {
|
15382 | var _this = this;
|
15383 | if (preventMouseClick === void 0) { preventMouseClick = false; }
|
15384 | this.destroyFuncs = [];
|
15385 | this.touching = false;
|
15386 | this.eventService = new EventService();
|
15387 | this.eElement = eElement;
|
15388 | this.preventMouseClick = preventMouseClick;
|
15389 | var startListener = this.onTouchStart.bind(this);
|
15390 | var moveListener = this.onTouchMove.bind(this);
|
15391 | var endListener = this.onTouchEnd.bind(this);
|
15392 | this.eElement.addEventListener("touchstart", startListener, { passive: true });
|
15393 | this.eElement.addEventListener("touchmove", moveListener, { passive: true });
|
15394 |
|
15395 | this.eElement.addEventListener("touchend", endListener, { passive: false });
|
15396 | this.destroyFuncs.push(function () {
|
15397 | _this.eElement.removeEventListener("touchstart", startListener, { passive: true });
|
15398 | _this.eElement.removeEventListener("touchmove", moveListener, { passive: true });
|
15399 | _this.eElement.removeEventListener("touchend", endListener, { passive: false });
|
15400 | });
|
15401 | }
|
15402 | TouchListener.prototype.getActiveTouch = function (touchList) {
|
15403 | for (var i = 0; i < touchList.length; i++) {
|
15404 | var matches = touchList[i].identifier === this.touchStart.identifier;
|
15405 | if (matches) {
|
15406 | return touchList[i];
|
15407 | }
|
15408 | }
|
15409 | return null;
|
15410 | };
|
15411 | TouchListener.prototype.addEventListener = function (eventType, listener) {
|
15412 | this.eventService.addEventListener(eventType, listener);
|
15413 | };
|
15414 | TouchListener.prototype.removeEventListener = function (eventType, listener) {
|
15415 | this.eventService.removeEventListener(eventType, listener);
|
15416 | };
|
15417 | TouchListener.prototype.onTouchStart = function (touchEvent) {
|
15418 | var _this = this;
|
15419 |
|
15420 | if (this.touching) {
|
15421 | return;
|
15422 | }
|
15423 | this.touchStart = touchEvent.touches[0];
|
15424 | this.touching = true;
|
15425 | this.moved = false;
|
15426 | var touchStartCopy = this.touchStart;
|
15427 | window.setTimeout(function () {
|
15428 | var touchesMatch = _this.touchStart === touchStartCopy;
|
15429 | if (_this.touching && touchesMatch && !_this.moved) {
|
15430 | _this.moved = true;
|
15431 | var event_1 = {
|
15432 | type: TouchListener.EVENT_LONG_TAP,
|
15433 | touchStart: _this.touchStart,
|
15434 | touchEvent: touchEvent
|
15435 | };
|
15436 | _this.eventService.dispatchEvent(event_1);
|
15437 | }
|
15438 | }, 500);
|
15439 | };
|
15440 | TouchListener.prototype.onTouchMove = function (touchEvent) {
|
15441 | if (!this.touching) {
|
15442 | return;
|
15443 | }
|
15444 | var touch = this.getActiveTouch(touchEvent.touches);
|
15445 | if (!touch) {
|
15446 | return;
|
15447 | }
|
15448 | var eventIsFarAway = !areEventsNear(touch, this.touchStart, 4);
|
15449 | if (eventIsFarAway) {
|
15450 | this.moved = true;
|
15451 | }
|
15452 | };
|
15453 | TouchListener.prototype.onTouchEnd = function (touchEvent) {
|
15454 | if (!this.touching) {
|
15455 | return;
|
15456 | }
|
15457 | if (!this.moved) {
|
15458 | var event_2 = {
|
15459 | type: TouchListener.EVENT_TAP,
|
15460 | touchStart: this.touchStart
|
15461 | };
|
15462 | this.eventService.dispatchEvent(event_2);
|
15463 | this.checkForDoubleTap();
|
15464 | }
|
15465 |
|
15466 | if (this.preventMouseClick && touchEvent.cancelable) {
|
15467 | touchEvent.preventDefault();
|
15468 | }
|
15469 | this.touching = false;
|
15470 | };
|
15471 | TouchListener.prototype.checkForDoubleTap = function () {
|
15472 | var now = new Date().getTime();
|
15473 | if (this.lastTapTime && this.lastTapTime > 0) {
|
15474 |
|
15475 | var interval = now - this.lastTapTime;
|
15476 | if (interval > TouchListener.DOUBLE_TAP_MILLIS) {
|
15477 |
|
15478 | var event_3 = {
|
15479 | type: TouchListener.EVENT_DOUBLE_TAP,
|
15480 | touchStart: this.touchStart
|
15481 | };
|
15482 | this.eventService.dispatchEvent(event_3);
|
15483 |
|
15484 | this.lastTapTime = null;
|
15485 | }
|
15486 | else {
|
15487 | this.lastTapTime = now;
|
15488 | }
|
15489 | }
|
15490 | else {
|
15491 | this.lastTapTime = now;
|
15492 | }
|
15493 | };
|
15494 | TouchListener.prototype.destroy = function () {
|
15495 | this.destroyFuncs.forEach(function (func) { return func(); });
|
15496 | };
|
15497 | TouchListener.EVENT_TAP = "tap";
|
15498 | TouchListener.EVENT_DOUBLE_TAP = "doubleTap";
|
15499 | TouchListener.EVENT_LONG_TAP = "longTap";
|
15500 | TouchListener.DOUBLE_TAP_MILLIS = 500;
|
15501 | return TouchListener;
|
15502 | }());
|
15503 |
|
15504 |
|
15505 |
|
15506 |
|
15507 |
|
15508 |
|
15509 |
|
15510 | var __extends$2l = (undefined && undefined.__extends) || (function () {
|
15511 | var extendStatics = function (d, b) {
|
15512 | extendStatics = Object.setPrototypeOf ||
|
15513 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
15514 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
15515 | return extendStatics(d, b);
|
15516 | };
|
15517 | return function (d, b) {
|
15518 | extendStatics(d, b);
|
15519 | function __() { this.constructor = d; }
|
15520 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15521 | };
|
15522 | })();
|
15523 | var __decorate$28 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
15524 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
15525 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
15526 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
15527 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
15528 | };
|
15529 | var SortIndicatorComp = (function (_super) {
|
15530 | __extends$2l(SortIndicatorComp, _super);
|
15531 | function SortIndicatorComp(skipTemplate) {
|
15532 | var _this = _super.call(this) || this;
|
15533 | if (!skipTemplate) {
|
15534 | _this.setTemplate(SortIndicatorComp.TEMPLATE);
|
15535 | }
|
15536 | return _this;
|
15537 | }
|
15538 | SortIndicatorComp.prototype.attachCustomElements = function (eSortOrder, eSortAsc, eSortDesc, eSortMixed, eSortNone) {
|
15539 | this.eSortOrder = eSortOrder;
|
15540 | this.eSortAsc = eSortAsc;
|
15541 | this.eSortDesc = eSortDesc;
|
15542 | this.eSortMixed = eSortMixed;
|
15543 | this.eSortNone = eSortNone;
|
15544 | };
|
15545 | SortIndicatorComp.prototype.setupSort = function (column, suppressOrder) {
|
15546 | var _this = this;
|
15547 | if (suppressOrder === void 0) { suppressOrder = false; }
|
15548 | this.column = column;
|
15549 | this.suppressOrder = suppressOrder;
|
15550 | this.setupMultiSortIndicator();
|
15551 | var canSort = !!this.column.getColDef().sortable;
|
15552 | if (!canSort) {
|
15553 | return;
|
15554 | }
|
15555 | this.addInIcon('sortAscending', this.eSortAsc, column);
|
15556 | this.addInIcon('sortDescending', this.eSortDesc, column);
|
15557 | this.addInIcon('sortUnSort', this.eSortNone, column);
|
15558 |
|
15559 | this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, function () { return _this.onSortChanged(); });
|
15560 |
|
15561 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, function () { return _this.onSortChanged(); });
|
15562 | this.onSortChanged();
|
15563 | };
|
15564 | SortIndicatorComp.prototype.addInIcon = function (iconName, eParent, column) {
|
15565 | if (eParent == null) {
|
15566 | return;
|
15567 | }
|
15568 | var eIcon = createIconNoSpan(iconName, this.gridOptionsService, column);
|
15569 | if (eIcon) {
|
15570 | eParent.appendChild(eIcon);
|
15571 | }
|
15572 | };
|
15573 | SortIndicatorComp.prototype.onSortChanged = function () {
|
15574 | this.updateIcons();
|
15575 | if (!this.suppressOrder) {
|
15576 | this.updateSortOrder();
|
15577 | }
|
15578 | };
|
15579 | SortIndicatorComp.prototype.updateIcons = function () {
|
15580 | var sortDirection = this.sortController.getDisplaySortForColumn(this.column);
|
15581 | if (this.eSortAsc) {
|
15582 | var isAscending = sortDirection === 'asc';
|
15583 | setDisplayed(this.eSortAsc, isAscending, { skipAriaHidden: true });
|
15584 | }
|
15585 | if (this.eSortDesc) {
|
15586 | var isDescending = sortDirection === 'desc';
|
15587 | setDisplayed(this.eSortDesc, isDescending, { skipAriaHidden: true });
|
15588 | }
|
15589 | if (this.eSortNone) {
|
15590 | var alwaysHideNoSort = !this.column.getColDef().unSortIcon && !this.gridOptionsService.is('unSortIcon');
|
15591 | var isNone = sortDirection === null || sortDirection === undefined;
|
15592 | setDisplayed(this.eSortNone, !alwaysHideNoSort && isNone, { skipAriaHidden: true });
|
15593 | }
|
15594 | };
|
15595 | SortIndicatorComp.prototype.setupMultiSortIndicator = function () {
|
15596 | var _this = this;
|
15597 | this.addInIcon('sortUnSort', this.eSortMixed, this.column);
|
15598 | var isColumnShowingRowGroup = this.column.getColDef().showRowGroup;
|
15599 | var areGroupsCoupled = this.gridOptionsService.isColumnsSortingCoupledToGroup();
|
15600 | if (areGroupsCoupled && isColumnShowingRowGroup) {
|
15601 |
|
15602 | this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, function () { return _this.updateMultiSortIndicator(); });
|
15603 |
|
15604 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, function () { return _this.updateMultiSortIndicator(); });
|
15605 | this.updateMultiSortIndicator();
|
15606 | }
|
15607 | };
|
15608 | SortIndicatorComp.prototype.updateMultiSortIndicator = function () {
|
15609 | if (this.eSortMixed) {
|
15610 | var isMixedSort = this.sortController.getDisplaySortForColumn(this.column) === 'mixed';
|
15611 | setDisplayed(this.eSortMixed, isMixedSort, { skipAriaHidden: true });
|
15612 | }
|
15613 | };
|
15614 |
|
15615 |
|
15616 |
|
15617 | SortIndicatorComp.prototype.updateSortOrder = function () {
|
15618 | var _this = this;
|
15619 | var _a;
|
15620 | if (!this.eSortOrder) {
|
15621 | return;
|
15622 | }
|
15623 | var allColumnsWithSorting = this.sortController.getColumnsWithSortingOrdered();
|
15624 | var indexThisCol = (_a = this.sortController.getDisplaySortIndexForColumn(this.column)) !== null && _a !== void 0 ? _a : -1;
|
15625 | var moreThanOneColSorting = allColumnsWithSorting.some(function (col) { var _a; return (_a = _this.sortController.getDisplaySortIndexForColumn(col)) !== null && _a !== void 0 ? _a : -1 >= 1; });
|
15626 | var showIndex = indexThisCol >= 0 && moreThanOneColSorting;
|
15627 | setDisplayed(this.eSortOrder, showIndex, { skipAriaHidden: true });
|
15628 | if (indexThisCol >= 0) {
|
15629 | this.eSortOrder.innerHTML = (indexThisCol + 1).toString();
|
15630 | }
|
15631 | else {
|
15632 | clearElement(this.eSortOrder);
|
15633 | }
|
15634 | };
|
15635 | SortIndicatorComp.TEMPLATE = "<span class=\"ag-sort-indicator-container\">\n <span ref=\"eSortOrder\" class=\"ag-sort-indicator-icon ag-sort-order ag-hidden\" aria-hidden=\"true\"></span>\n <span ref=\"eSortAsc\" class=\"ag-sort-indicator-icon ag-sort-ascending-icon ag-hidden\" aria-hidden=\"true\"></span>\n <span ref=\"eSortDesc\" class=\"ag-sort-indicator-icon ag-sort-descending-icon ag-hidden\" aria-hidden=\"true\"></span>\n <span ref=\"eSortMixed\" class=\"ag-sort-indicator-icon ag-sort-mixed-icon ag-hidden\" aria-hidden=\"true\"></span>\n <span ref=\"eSortNone\" class=\"ag-sort-indicator-icon ag-sort-none-icon ag-hidden\" aria-hidden=\"true\"></span>\n </span>";
|
15636 | __decorate$28([
|
15637 | RefSelector('eSortOrder')
|
15638 | ], SortIndicatorComp.prototype, "eSortOrder", void 0);
|
15639 | __decorate$28([
|
15640 | RefSelector('eSortAsc')
|
15641 | ], SortIndicatorComp.prototype, "eSortAsc", void 0);
|
15642 | __decorate$28([
|
15643 | RefSelector('eSortDesc')
|
15644 | ], SortIndicatorComp.prototype, "eSortDesc", void 0);
|
15645 | __decorate$28([
|
15646 | RefSelector('eSortMixed')
|
15647 | ], SortIndicatorComp.prototype, "eSortMixed", void 0);
|
15648 | __decorate$28([
|
15649 | RefSelector('eSortNone')
|
15650 | ], SortIndicatorComp.prototype, "eSortNone", void 0);
|
15651 | __decorate$28([
|
15652 | Autowired('columnModel')
|
15653 | ], SortIndicatorComp.prototype, "columnModel", void 0);
|
15654 | __decorate$28([
|
15655 | Autowired('sortController')
|
15656 | ], SortIndicatorComp.prototype, "sortController", void 0);
|
15657 | return SortIndicatorComp;
|
15658 | }(Component));
|
15659 |
|
15660 |
|
15661 |
|
15662 |
|
15663 |
|
15664 |
|
15665 |
|
15666 | var __extends$2k = (undefined && undefined.__extends) || (function () {
|
15667 | var extendStatics = function (d, b) {
|
15668 | extendStatics = Object.setPrototypeOf ||
|
15669 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
15670 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
15671 | return extendStatics(d, b);
|
15672 | };
|
15673 | return function (d, b) {
|
15674 | extendStatics(d, b);
|
15675 | function __() { this.constructor = d; }
|
15676 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15677 | };
|
15678 | })();
|
15679 | var __decorate$27 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
15680 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
15681 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
15682 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
15683 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
15684 | };
|
15685 | var HeaderComp = (function (_super) {
|
15686 | __extends$2k(HeaderComp, _super);
|
15687 | function HeaderComp() {
|
15688 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
15689 | _this.lastMovingChanged = 0;
|
15690 | return _this;
|
15691 | }
|
15692 |
|
15693 |
|
15694 | HeaderComp.prototype.destroy = function () {
|
15695 | _super.prototype.destroy.call(this);
|
15696 | };
|
15697 | HeaderComp.prototype.refresh = function (params) {
|
15698 | this.params = params;
|
15699 |
|
15700 |
|
15701 | if (this.workOutTemplate() != this.currentTemplate) {
|
15702 | return false;
|
15703 | }
|
15704 | if (this.workOutShowMenu() != this.currentShowMenu) {
|
15705 | return false;
|
15706 | }
|
15707 | if (this.workOutSort() != this.currentSort) {
|
15708 | return false;
|
15709 | }
|
15710 | this.setDisplayName(params);
|
15711 | return true;
|
15712 | };
|
15713 | HeaderComp.prototype.workOutTemplate = function () {
|
15714 | var template = firstExistingValue(this.params.template, HeaderComp.TEMPLATE);
|
15715 |
|
15716 | template = template && template.trim ? template.trim() : template;
|
15717 | return template;
|
15718 | };
|
15719 | HeaderComp.prototype.init = function (params) {
|
15720 | this.params = params;
|
15721 | this.currentTemplate = this.workOutTemplate();
|
15722 | this.setTemplate(this.currentTemplate);
|
15723 | this.setupTap();
|
15724 | this.setupIcons(params.column);
|
15725 | this.setMenu();
|
15726 | this.setupSort();
|
15727 | this.setupFilterIcon();
|
15728 | this.setDisplayName(params);
|
15729 | };
|
15730 | HeaderComp.prototype.setDisplayName = function (params) {
|
15731 | if (this.currentDisplayName != params.displayName) {
|
15732 | this.currentDisplayName = params.displayName;
|
15733 | var displayNameSanitised = escapeString(this.currentDisplayName);
|
15734 | if (this.eText) {
|
15735 | this.eText.innerHTML = displayNameSanitised;
|
15736 | }
|
15737 | }
|
15738 | };
|
15739 | HeaderComp.prototype.setupIcons = function (column) {
|
15740 | this.addInIcon('menu', this.eMenu, column);
|
15741 | this.addInIcon('filter', this.eFilter, column);
|
15742 | };
|
15743 | HeaderComp.prototype.addInIcon = function (iconName, eParent, column) {
|
15744 | if (eParent == null) {
|
15745 | return;
|
15746 | }
|
15747 | var eIcon = createIconNoSpan(iconName, this.gridOptionsService, column);
|
15748 | if (eIcon) {
|
15749 | eParent.appendChild(eIcon);
|
15750 | }
|
15751 | };
|
15752 | HeaderComp.prototype.setupTap = function () {
|
15753 | var _this = this;
|
15754 | var gridOptionsService = this.gridOptionsService;
|
15755 | if (gridOptionsService.is('suppressTouch')) {
|
15756 | return;
|
15757 | }
|
15758 | var touchListener = new TouchListener(this.getGui(), true);
|
15759 | var suppressMenuHide = gridOptionsService.is('suppressMenuHide');
|
15760 | var tapMenuButton = suppressMenuHide && exists(this.eMenu);
|
15761 | var menuTouchListener = tapMenuButton ? new TouchListener(this.eMenu, true) : touchListener;
|
15762 | if (this.params.enableMenu) {
|
15763 | var eventType = tapMenuButton ? 'EVENT_TAP' : 'EVENT_LONG_TAP';
|
15764 | var showMenuFn = function (event) {
|
15765 | gridOptionsService.api.showColumnMenuAfterMouseClick(_this.params.column, event.touchStart);
|
15766 | };
|
15767 | this.addManagedListener(menuTouchListener, TouchListener[eventType], showMenuFn);
|
15768 | }
|
15769 | if (this.params.enableSorting) {
|
15770 | var tapListener = function (event) {
|
15771 | var target = event.touchStart.target;
|
15772 |
|
15773 |
|
15774 | if (suppressMenuHide && _this.eMenu.contains(target)) {
|
15775 | return;
|
15776 | }
|
15777 | _this.sortController.progressSort(_this.params.column, false, "uiColumnSorted");
|
15778 | };
|
15779 | this.addManagedListener(touchListener, TouchListener.EVENT_TAP, tapListener);
|
15780 | }
|
15781 |
|
15782 |
|
15783 | this.addDestroyFunc(function () { return touchListener.destroy(); });
|
15784 | if (tapMenuButton) {
|
15785 | this.addDestroyFunc(function () { return menuTouchListener.destroy(); });
|
15786 | }
|
15787 | };
|
15788 | HeaderComp.prototype.workOutShowMenu = function () {
|
15789 |
|
15790 |
|
15791 |
|
15792 |
|
15793 | var menuHides = !this.gridOptionsService.is('suppressMenuHide');
|
15794 | var onIpadAndMenuHides = isIOSUserAgent() && menuHides;
|
15795 | var showMenu = this.params.enableMenu && !onIpadAndMenuHides;
|
15796 | return showMenu;
|
15797 | };
|
15798 | HeaderComp.prototype.setMenu = function () {
|
15799 | var _this = this;
|
15800 |
|
15801 | if (!this.eMenu) {
|
15802 | return;
|
15803 | }
|
15804 | this.currentShowMenu = this.workOutShowMenu();
|
15805 | if (!this.currentShowMenu) {
|
15806 | removeFromParent(this.eMenu);
|
15807 | return;
|
15808 | }
|
15809 | var suppressMenuHide = this.gridOptionsService.is('suppressMenuHide');
|
15810 | this.addManagedListener(this.eMenu, 'click', function () { return _this.showMenu(_this.eMenu); });
|
15811 | this.eMenu.classList.toggle('ag-header-menu-always-show', suppressMenuHide);
|
15812 | };
|
15813 | HeaderComp.prototype.showMenu = function (eventSource) {
|
15814 | if (!eventSource) {
|
15815 | eventSource = this.eMenu;
|
15816 | }
|
15817 | this.menuFactory.showMenuAfterButtonClick(this.params.column, eventSource, 'columnMenu');
|
15818 | };
|
15819 | HeaderComp.prototype.workOutSort = function () {
|
15820 | return this.params.enableSorting;
|
15821 | };
|
15822 | HeaderComp.prototype.setupSort = function () {
|
15823 | var _this = this;
|
15824 | this.currentSort = this.params.enableSorting;
|
15825 |
|
15826 |
|
15827 |
|
15828 | if (!this.eSortIndicator) {
|
15829 | this.eSortIndicator = this.context.createBean(new SortIndicatorComp(true));
|
15830 | this.eSortIndicator.attachCustomElements(this.eSortOrder, this.eSortAsc, this.eSortDesc, this.eSortMixed, this.eSortNone);
|
15831 | }
|
15832 | this.eSortIndicator.setupSort(this.params.column);
|
15833 |
|
15834 |
|
15835 |
|
15836 | if (!this.currentSort) {
|
15837 | return;
|
15838 | }
|
15839 | var sortUsingCtrl = this.gridOptionsService.get('multiSortKey') === 'ctrl';
|
15840 |
|
15841 | this.addManagedListener(this.params.column, Column.EVENT_MOVING_CHANGED, function () {
|
15842 | _this.lastMovingChanged = new Date().getTime();
|
15843 | });
|
15844 |
|
15845 | if (this.eLabel) {
|
15846 | this.addManagedListener(this.eLabel, 'click', function (event) {
|
15847 |
|
15848 |
|
15849 |
|
15850 | var moving = _this.params.column.isMoving();
|
15851 | var nowTime = new Date().getTime();
|
15852 |
|
15853 | var movedRecently = (nowTime - _this.lastMovingChanged) < 50;
|
15854 | var columnMoving = moving || movedRecently;
|
15855 | if (!columnMoving) {
|
15856 | var multiSort = sortUsingCtrl ? (event.ctrlKey || event.metaKey) : event.shiftKey;
|
15857 | _this.params.progressSort(multiSort);
|
15858 | }
|
15859 | });
|
15860 | }
|
15861 | var onSortingChanged = function () {
|
15862 | _this.addOrRemoveCssClass('ag-header-cell-sorted-asc', _this.params.column.isSortAscending());
|
15863 | _this.addOrRemoveCssClass('ag-header-cell-sorted-desc', _this.params.column.isSortDescending());
|
15864 | _this.addOrRemoveCssClass('ag-header-cell-sorted-none', _this.params.column.isSortNone());
|
15865 | if (_this.params.column.getColDef().showRowGroup) {
|
15866 | var sourceColumns = _this.columnModel.getSourceColumnsForGroupColumn(_this.params.column);
|
15867 |
|
15868 | var sortDirectionsMatch = sourceColumns === null || sourceColumns === void 0 ? void 0 : sourceColumns.every(function (sourceCol) { return _this.params.column.getSort() == sourceCol.getSort(); });
|
15869 | var isMultiSorting = !sortDirectionsMatch;
|
15870 | _this.addOrRemoveCssClass('ag-header-cell-sorted-mixed', isMultiSorting);
|
15871 | }
|
15872 | };
|
15873 | this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, onSortingChanged);
|
15874 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, onSortingChanged);
|
15875 | };
|
15876 | HeaderComp.prototype.setupFilterIcon = function () {
|
15877 | if (!this.eFilter) {
|
15878 | return;
|
15879 | }
|
15880 | this.addManagedListener(this.params.column, Column.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
|
15881 | this.onFilterChanged();
|
15882 | };
|
15883 | HeaderComp.prototype.onFilterChanged = function () {
|
15884 | var filterPresent = this.params.column.isFilterActive();
|
15885 | setDisplayed(this.eFilter, filterPresent, { skipAriaHidden: true });
|
15886 | };
|
15887 | 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 <ag-sort-indicator ref=\"eSortIndicator\"></ag-sort-indicator>\n </div>\n </div>";
|
15888 | __decorate$27([
|
15889 | Autowired('sortController')
|
15890 | ], HeaderComp.prototype, "sortController", void 0);
|
15891 | __decorate$27([
|
15892 | Autowired('menuFactory')
|
15893 | ], HeaderComp.prototype, "menuFactory", void 0);
|
15894 | __decorate$27([
|
15895 | Autowired('columnModel')
|
15896 | ], HeaderComp.prototype, "columnModel", void 0);
|
15897 | __decorate$27([
|
15898 | RefSelector('eFilter')
|
15899 | ], HeaderComp.prototype, "eFilter", void 0);
|
15900 | __decorate$27([
|
15901 | RefSelector('eSortIndicator')
|
15902 | ], HeaderComp.prototype, "eSortIndicator", void 0);
|
15903 | __decorate$27([
|
15904 | RefSelector('eMenu')
|
15905 | ], HeaderComp.prototype, "eMenu", void 0);
|
15906 | __decorate$27([
|
15907 | RefSelector('eLabel')
|
15908 | ], HeaderComp.prototype, "eLabel", void 0);
|
15909 | __decorate$27([
|
15910 | RefSelector('eText')
|
15911 | ], HeaderComp.prototype, "eText", void 0);
|
15912 | __decorate$27([
|
15913 | RefSelector('eSortOrder')
|
15914 | ], HeaderComp.prototype, "eSortOrder", void 0);
|
15915 | __decorate$27([
|
15916 | RefSelector('eSortAsc')
|
15917 | ], HeaderComp.prototype, "eSortAsc", void 0);
|
15918 | __decorate$27([
|
15919 | RefSelector('eSortDesc')
|
15920 | ], HeaderComp.prototype, "eSortDesc", void 0);
|
15921 | __decorate$27([
|
15922 | RefSelector('eSortMixed')
|
15923 | ], HeaderComp.prototype, "eSortMixed", void 0);
|
15924 | __decorate$27([
|
15925 | RefSelector('eSortNone')
|
15926 | ], HeaderComp.prototype, "eSortNone", void 0);
|
15927 | return HeaderComp;
|
15928 | }(Component));
|
15929 |
|
15930 |
|
15931 |
|
15932 |
|
15933 |
|
15934 |
|
15935 |
|
15936 | var __extends$2j = (undefined && undefined.__extends) || (function () {
|
15937 | var extendStatics = function (d, b) {
|
15938 | extendStatics = Object.setPrototypeOf ||
|
15939 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
15940 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
15941 | return extendStatics(d, b);
|
15942 | };
|
15943 | return function (d, b) {
|
15944 | extendStatics(d, b);
|
15945 | function __() { this.constructor = d; }
|
15946 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15947 | };
|
15948 | })();
|
15949 | var __decorate$26 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
15950 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
15951 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
15952 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
15953 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
15954 | };
|
15955 | var HeaderGroupComp = (function (_super) {
|
15956 | __extends$2j(HeaderGroupComp, _super);
|
15957 | function HeaderGroupComp() {
|
15958 | return _super.call(this, HeaderGroupComp.TEMPLATE) || this;
|
15959 | }
|
15960 |
|
15961 |
|
15962 | HeaderGroupComp.prototype.destroy = function () {
|
15963 | _super.prototype.destroy.call(this);
|
15964 | };
|
15965 | HeaderGroupComp.prototype.init = function (params) {
|
15966 | this.params = params;
|
15967 | this.checkWarnings();
|
15968 | this.setupLabel();
|
15969 | this.addGroupExpandIcon();
|
15970 | this.setupExpandIcons();
|
15971 | };
|
15972 | HeaderGroupComp.prototype.checkWarnings = function () {
|
15973 | var paramsAny = this.params;
|
15974 | if (paramsAny.template) {
|
15975 | var message_1 = "AG Grid: A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)";
|
15976 | doOnce(function () { return console.warn(message_1); }, 'HeaderGroupComp.templateNotSupported');
|
15977 | }
|
15978 | };
|
15979 | HeaderGroupComp.prototype.setupExpandIcons = function () {
|
15980 | var _this = this;
|
15981 | this.addInIcon("columnGroupOpened", "agOpened");
|
15982 | this.addInIcon("columnGroupClosed", "agClosed");
|
15983 | var expandAction = function (event) {
|
15984 | if (isStopPropagationForAgGrid(event)) {
|
15985 | return;
|
15986 | }
|
15987 | var newExpandedValue = !_this.params.columnGroup.isExpanded();
|
15988 | _this.columnModel.setColumnGroupOpened(_this.params.columnGroup.getProvidedColumnGroup(), newExpandedValue, "uiColumnExpanded");
|
15989 | };
|
15990 | this.addTouchAndClickListeners(this.eCloseIcon, expandAction);
|
15991 | this.addTouchAndClickListeners(this.eOpenIcon, expandAction);
|
15992 | var stopPropagationAction = function (event) {
|
15993 | stopPropagationForAgGrid(event);
|
15994 | };
|
15995 |
|
15996 |
|
15997 |
|
15998 |
|
15999 |
|
16000 | this.addManagedListener(this.eCloseIcon, "dblclick", stopPropagationAction);
|
16001 | this.addManagedListener(this.eOpenIcon, "dblclick", stopPropagationAction);
|
16002 | this.addManagedListener(this.getGui(), "dblclick", expandAction);
|
16003 | this.updateIconVisibility();
|
16004 | var providedColumnGroup = this.params.columnGroup.getProvidedColumnGroup();
|
16005 | this.addManagedListener(providedColumnGroup, ProvidedColumnGroup.EVENT_EXPANDED_CHANGED, this.updateIconVisibility.bind(this));
|
16006 | this.addManagedListener(providedColumnGroup, ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED, this.updateIconVisibility.bind(this));
|
16007 | };
|
16008 | HeaderGroupComp.prototype.addTouchAndClickListeners = function (eElement, action) {
|
16009 | var touchListener = new TouchListener(eElement, true);
|
16010 | this.addManagedListener(touchListener, TouchListener.EVENT_TAP, action);
|
16011 | this.addDestroyFunc(function () { return touchListener.destroy(); });
|
16012 | this.addManagedListener(eElement, "click", action);
|
16013 | };
|
16014 | HeaderGroupComp.prototype.updateIconVisibility = function () {
|
16015 | var columnGroup = this.params.columnGroup;
|
16016 | if (columnGroup.isExpandable()) {
|
16017 | var expanded = this.params.columnGroup.isExpanded();
|
16018 | setDisplayed(this.eOpenIcon, expanded);
|
16019 | setDisplayed(this.eCloseIcon, !expanded);
|
16020 | }
|
16021 | else {
|
16022 | setDisplayed(this.eOpenIcon, false);
|
16023 | setDisplayed(this.eCloseIcon, false);
|
16024 | }
|
16025 | };
|
16026 | HeaderGroupComp.prototype.addInIcon = function (iconName, refName) {
|
16027 | var eIcon = createIconNoSpan(iconName, this.gridOptionsService, null);
|
16028 | if (eIcon) {
|
16029 | this.getRefElement(refName).appendChild(eIcon);
|
16030 | }
|
16031 | };
|
16032 | HeaderGroupComp.prototype.addGroupExpandIcon = function () {
|
16033 | if (!this.params.columnGroup.isExpandable()) {
|
16034 | setDisplayed(this.eOpenIcon, false);
|
16035 | setDisplayed(this.eCloseIcon, false);
|
16036 | return;
|
16037 | }
|
16038 | };
|
16039 | HeaderGroupComp.prototype.setupLabel = function () {
|
16040 |
|
16041 | var displayName = this.params.displayName;
|
16042 | if (exists(displayName)) {
|
16043 | var displayNameSanitised = escapeString(displayName);
|
16044 | this.getRefElement('agLabel').innerHTML = displayNameSanitised;
|
16045 | }
|
16046 | };
|
16047 | 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>";
|
16048 | __decorate$26([
|
16049 | Autowired("columnModel")
|
16050 | ], HeaderGroupComp.prototype, "columnModel", void 0);
|
16051 | __decorate$26([
|
16052 | RefSelector("agOpened")
|
16053 | ], HeaderGroupComp.prototype, "eOpenIcon", void 0);
|
16054 | __decorate$26([
|
16055 | RefSelector("agClosed")
|
16056 | ], HeaderGroupComp.prototype, "eCloseIcon", void 0);
|
16057 | return HeaderGroupComp;
|
16058 | }(Component));
|
16059 |
|
16060 |
|
16061 |
|
16062 |
|
16063 |
|
16064 |
|
16065 |
|
16066 | var __extends$2i = (undefined && undefined.__extends) || (function () {
|
16067 | var extendStatics = function (d, b) {
|
16068 | extendStatics = Object.setPrototypeOf ||
|
16069 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
16070 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
16071 | return extendStatics(d, b);
|
16072 | };
|
16073 | return function (d, b) {
|
16074 | extendStatics(d, b);
|
16075 | function __() { this.constructor = d; }
|
16076 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16077 | };
|
16078 | })();
|
16079 | var PopupComponent = (function (_super) {
|
16080 | __extends$2i(PopupComponent, _super);
|
16081 | function PopupComponent() {
|
16082 | return _super !== null && _super.apply(this, arguments) || this;
|
16083 | }
|
16084 | PopupComponent.prototype.isPopup = function () {
|
16085 | return true;
|
16086 | };
|
16087 | PopupComponent.prototype.setParentComponent = function (container) {
|
16088 | container.addCssClass('ag-has-popup');
|
16089 | _super.prototype.setParentComponent.call(this, container);
|
16090 | };
|
16091 | PopupComponent.prototype.destroy = function () {
|
16092 | var parentComp = this.parentComponent;
|
16093 | var hasParent = parentComp && parentComp.isAlive();
|
16094 | if (hasParent) {
|
16095 | parentComp.getGui().classList.remove('ag-has-popup');
|
16096 | }
|
16097 | _super.prototype.destroy.call(this);
|
16098 | };
|
16099 | return PopupComponent;
|
16100 | }(Component));
|
16101 |
|
16102 |
|
16103 |
|
16104 |
|
16105 |
|
16106 |
|
16107 |
|
16108 | var __extends$2h = (undefined && undefined.__extends) || (function () {
|
16109 | var extendStatics = function (d, b) {
|
16110 | extendStatics = Object.setPrototypeOf ||
|
16111 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
16112 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
16113 | return extendStatics(d, b);
|
16114 | };
|
16115 | return function (d, b) {
|
16116 | extendStatics(d, b);
|
16117 | function __() { this.constructor = d; }
|
16118 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16119 | };
|
16120 | })();
|
16121 | var __decorate$25 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
16122 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
16123 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
16124 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
16125 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
16126 | };
|
16127 | var LargeTextCellEditor = (function (_super) {
|
16128 | __extends$2h(LargeTextCellEditor, _super);
|
16129 | function LargeTextCellEditor() {
|
16130 | return _super.call(this, LargeTextCellEditor.TEMPLATE) || this;
|
16131 | }
|
16132 | LargeTextCellEditor.prototype.init = function (params) {
|
16133 | this.params = params;
|
16134 | this.focusAfterAttached = params.cellStartedEdit;
|
16135 | this.eTextArea
|
16136 | .setMaxLength(params.maxLength || 200)
|
16137 | .setCols(params.cols || 60)
|
16138 | .setRows(params.rows || 10);
|
16139 | if (exists(params.value, true)) {
|
16140 | this.eTextArea.setValue(params.value.toString(), true);
|
16141 | }
|
16142 | this.addGuiEventListener('keydown', this.onKeyDown.bind(this));
|
16143 | };
|
16144 | LargeTextCellEditor.prototype.onKeyDown = function (event) {
|
16145 | var key = event.key;
|
16146 | if (key === KeyCode.LEFT ||
|
16147 | key === KeyCode.UP ||
|
16148 | key === KeyCode.RIGHT ||
|
16149 | key === KeyCode.DOWN ||
|
16150 | (event.shiftKey && key === KeyCode.ENTER)) {
|
16151 | event.stopPropagation();
|
16152 | }
|
16153 | };
|
16154 | LargeTextCellEditor.prototype.afterGuiAttached = function () {
|
16155 | var translate = this.localeService.getLocaleTextFunc();
|
16156 | this.eTextArea.setInputAriaLabel(translate('ariaInputEditor', 'Input Editor'));
|
16157 | if (this.focusAfterAttached) {
|
16158 | this.eTextArea.getFocusableElement().focus();
|
16159 | }
|
16160 | };
|
16161 | LargeTextCellEditor.prototype.getValue = function () {
|
16162 | return this.params.parseValue(this.eTextArea.getValue());
|
16163 | };
|
16164 | 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>";
|
16165 | __decorate$25([
|
16166 | RefSelector("eTextArea")
|
16167 | ], LargeTextCellEditor.prototype, "eTextArea", void 0);
|
16168 | return LargeTextCellEditor;
|
16169 | }(PopupComponent));
|
16170 |
|
16171 |
|
16172 |
|
16173 |
|
16174 |
|
16175 |
|
16176 |
|
16177 | var __extends$2g = (undefined && undefined.__extends) || (function () {
|
16178 | var extendStatics = function (d, b) {
|
16179 | extendStatics = Object.setPrototypeOf ||
|
16180 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
16181 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
16182 | return extendStatics(d, b);
|
16183 | };
|
16184 | return function (d, b) {
|
16185 | extendStatics(d, b);
|
16186 | function __() { this.constructor = d; }
|
16187 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16188 | };
|
16189 | })();
|
16190 | var __decorate$24 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
16191 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
16192 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
16193 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
16194 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
16195 | };
|
16196 | var SelectCellEditor = (function (_super) {
|
16197 | __extends$2g(SelectCellEditor, _super);
|
16198 | function SelectCellEditor() {
|
16199 | var _this = _super.call(this, '<div class="ag-cell-edit-wrapper"><ag-select class="ag-cell-editor" ref="eSelect"></ag-select></div>') || this;
|
16200 | _this.startedByEnter = false;
|
16201 | return _this;
|
16202 | }
|
16203 | SelectCellEditor.prototype.init = function (params) {
|
16204 | var _this = this;
|
16205 | this.focusAfterAttached = params.cellStartedEdit;
|
16206 | if (missing(params.values)) {
|
16207 | console.warn('AG Grid: no values found for select cellEditor');
|
16208 | return;
|
16209 | }
|
16210 | this.startedByEnter = params.eventKey != null ? params.eventKey === KeyCode.ENTER : false;
|
16211 | var hasValue = false;
|
16212 | params.values.forEach(function (value) {
|
16213 | var option = { value: value };
|
16214 | var valueFormatted = _this.valueFormatterService.formatValue(params.column, null, value);
|
16215 | var valueFormattedExits = valueFormatted !== null && valueFormatted !== undefined;
|
16216 | option.text = valueFormattedExits ? valueFormatted : value;
|
16217 | _this.eSelect.addOption(option);
|
16218 | hasValue = hasValue || params.value === value;
|
16219 | });
|
16220 | if (hasValue) {
|
16221 | this.eSelect.setValue(params.value, true);
|
16222 | }
|
16223 | else if (params.values.length) {
|
16224 | this.eSelect.setValue(params.values[0], true);
|
16225 | }
|
16226 |
|
16227 |
|
16228 | if (this.gridOptionsService.get('editType') !== 'fullRow') {
|
16229 | this.addManagedListener(this.eSelect, AgSelect.EVENT_ITEM_SELECTED, function () { return params.stopEditing(); });
|
16230 | }
|
16231 | };
|
16232 | SelectCellEditor.prototype.afterGuiAttached = function () {
|
16233 | if (this.focusAfterAttached) {
|
16234 | this.eSelect.getFocusableElement().focus();
|
16235 | }
|
16236 | if (this.startedByEnter) {
|
16237 | this.eSelect.showPicker();
|
16238 | }
|
16239 | };
|
16240 | SelectCellEditor.prototype.focusIn = function () {
|
16241 | this.eSelect.getFocusableElement().focus();
|
16242 | };
|
16243 | SelectCellEditor.prototype.getValue = function () {
|
16244 | return this.eSelect.getValue();
|
16245 | };
|
16246 | SelectCellEditor.prototype.isPopup = function () {
|
16247 | return false;
|
16248 | };
|
16249 | __decorate$24([
|
16250 | Autowired('valueFormatterService')
|
16251 | ], SelectCellEditor.prototype, "valueFormatterService", void 0);
|
16252 | __decorate$24([
|
16253 | RefSelector('eSelect')
|
16254 | ], SelectCellEditor.prototype, "eSelect", void 0);
|
16255 | return SelectCellEditor;
|
16256 | }(PopupComponent));
|
16257 |
|
16258 |
|
16259 |
|
16260 |
|
16261 |
|
16262 |
|
16263 |
|
16264 | var __extends$2f = (undefined && undefined.__extends) || (function () {
|
16265 | var extendStatics = function (d, b) {
|
16266 | extendStatics = Object.setPrototypeOf ||
|
16267 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
16268 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
16269 | return extendStatics(d, b);
|
16270 | };
|
16271 | return function (d, b) {
|
16272 | extendStatics(d, b);
|
16273 | function __() { this.constructor = d; }
|
16274 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16275 | };
|
16276 | })();
|
16277 | var __decorate$23 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
16278 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
16279 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
16280 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
16281 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
16282 | };
|
16283 | var TextCellEditor = (function (_super) {
|
16284 | __extends$2f(TextCellEditor, _super);
|
16285 | function TextCellEditor() {
|
16286 | return _super.call(this, TextCellEditor.TEMPLATE) || this;
|
16287 | }
|
16288 | TextCellEditor.prototype.init = function (params) {
|
16289 | this.params = params;
|
16290 | var eInput = this.eInput;
|
16291 | var startValue;
|
16292 |
|
16293 | if (params.cellStartedEdit) {
|
16294 | this.focusAfterAttached = true;
|
16295 | if (params.eventKey === KeyCode.BACKSPACE || params.eventKey === KeyCode.DELETE) {
|
16296 | startValue = '';
|
16297 | }
|
16298 | else if (params.charPress) {
|
16299 | startValue = params.charPress;
|
16300 | }
|
16301 | else {
|
16302 | startValue = this.getStartValue(params);
|
16303 | if (params.eventKey !== KeyCode.F2) {
|
16304 | this.highlightAllOnFocus = true;
|
16305 | }
|
16306 | }
|
16307 | }
|
16308 | else {
|
16309 | this.focusAfterAttached = false;
|
16310 | startValue = this.getStartValue(params);
|
16311 | }
|
16312 | if (startValue != null) {
|
16313 | eInput.setValue(startValue, true);
|
16314 | }
|
16315 | if (params.maxLength != null) {
|
16316 | eInput.setMaxLength(params.maxLength);
|
16317 | }
|
16318 | this.addManagedListener(eInput.getGui(), 'keydown', function (event) {
|
16319 | var key = event.key;
|
16320 | if (key === KeyCode.PAGE_UP || key === KeyCode.PAGE_DOWN) {
|
16321 | event.preventDefault();
|
16322 | }
|
16323 | });
|
16324 | };
|
16325 | TextCellEditor.prototype.afterGuiAttached = function () {
|
16326 | var translate = this.localeService.getLocaleTextFunc();
|
16327 | var eInput = this.eInput;
|
16328 | eInput.setInputAriaLabel(translate('ariaInputEditor', 'Input Editor'));
|
16329 | if (!this.focusAfterAttached) {
|
16330 | return;
|
16331 | }
|
16332 |
|
16333 |
|
16334 |
|
16335 | if (!isBrowserSafari()) {
|
16336 | eInput.getFocusableElement().focus();
|
16337 | }
|
16338 | var inputEl = eInput.getInputElement();
|
16339 | if (this.highlightAllOnFocus) {
|
16340 | inputEl.select();
|
16341 | }
|
16342 | else {
|
16343 |
|
16344 |
|
16345 |
|
16346 |
|
16347 | var value = eInput.getValue();
|
16348 | var len = (exists(value) && value.length) || 0;
|
16349 | if (len) {
|
16350 | inputEl.setSelectionRange(len, len);
|
16351 | }
|
16352 | }
|
16353 | };
|
16354 |
|
16355 | TextCellEditor.prototype.focusIn = function () {
|
16356 | var eInput = this.eInput;
|
16357 | var focusEl = eInput.getFocusableElement();
|
16358 | var inputEl = eInput.getInputElement();
|
16359 | focusEl.focus();
|
16360 | inputEl.select();
|
16361 | };
|
16362 | TextCellEditor.prototype.getValue = function () {
|
16363 | var eInput = this.eInput;
|
16364 | return this.params.parseValue(eInput.getValue());
|
16365 | };
|
16366 | TextCellEditor.prototype.getStartValue = function (params) {
|
16367 | var formatValue = params.useFormatter || params.column.getColDef().refData;
|
16368 | return formatValue ? params.formatValue(params.value) : params.value;
|
16369 | };
|
16370 | TextCellEditor.prototype.isPopup = function () {
|
16371 | return false;
|
16372 | };
|
16373 | TextCellEditor.TEMPLATE = "<div class=\"ag-cell-edit-wrapper\">\n <ag-input-text-field class=\"ag-cell-editor\" ref=\"eInput\"></ag-input-text-field>\n </div>";
|
16374 | __decorate$23([
|
16375 | RefSelector('eInput')
|
16376 | ], TextCellEditor.prototype, "eInput", void 0);
|
16377 | return TextCellEditor;
|
16378 | }(PopupComponent));
|
16379 |
|
16380 |
|
16381 |
|
16382 |
|
16383 |
|
16384 |
|
16385 |
|
16386 | var __extends$2e = (undefined && undefined.__extends) || (function () {
|
16387 | var extendStatics = function (d, b) {
|
16388 | extendStatics = Object.setPrototypeOf ||
|
16389 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
16390 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
16391 | return extendStatics(d, b);
|
16392 | };
|
16393 | return function (d, b) {
|
16394 | extendStatics(d, b);
|
16395 | function __() { this.constructor = d; }
|
16396 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16397 | };
|
16398 | })();
|
16399 | var __decorate$22 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
16400 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
16401 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
16402 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
16403 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
16404 | };
|
16405 | var ARROW_UP = '\u2191';
|
16406 | var ARROW_DOWN = '\u2193';
|
16407 | var AnimateShowChangeCellRenderer = (function (_super) {
|
16408 | __extends$2e(AnimateShowChangeCellRenderer, _super);
|
16409 | function AnimateShowChangeCellRenderer() {
|
16410 | var _this = _super.call(this, AnimateShowChangeCellRenderer.TEMPLATE) || this;
|
16411 | _this.refreshCount = 0;
|
16412 | return _this;
|
16413 | }
|
16414 | AnimateShowChangeCellRenderer.prototype.init = function (params) {
|
16415 |
|
16416 | this.eValue = this.queryForHtmlElement('.ag-value-change-value');
|
16417 | this.eDelta = this.queryForHtmlElement('.ag-value-change-delta');
|
16418 | this.refresh(params);
|
16419 | };
|
16420 | AnimateShowChangeCellRenderer.prototype.showDelta = function (params, delta) {
|
16421 | var absDelta = Math.abs(delta);
|
16422 | var valueFormatted = params.formatValue(absDelta);
|
16423 | var valueToUse = exists(valueFormatted) ? valueFormatted : absDelta;
|
16424 | var deltaUp = (delta >= 0);
|
16425 | if (deltaUp) {
|
16426 | this.eDelta.innerHTML = ARROW_UP + valueToUse;
|
16427 | }
|
16428 | else {
|
16429 |
|
16430 | this.eDelta.innerHTML = ARROW_DOWN + valueToUse;
|
16431 | }
|
16432 | this.eDelta.classList.toggle('ag-value-change-delta-up', deltaUp);
|
16433 | this.eDelta.classList.toggle('ag-value-change-delta-down', !deltaUp);
|
16434 | };
|
16435 | AnimateShowChangeCellRenderer.prototype.setTimerToRemoveDelta = function () {
|
16436 | var _this = this;
|
16437 |
|
16438 |
|
16439 |
|
16440 | this.refreshCount++;
|
16441 | var refreshCountCopy = this.refreshCount;
|
16442 | window.setTimeout(function () {
|
16443 | if (refreshCountCopy === _this.refreshCount) {
|
16444 | _this.hideDeltaValue();
|
16445 | }
|
16446 | }, 2000);
|
16447 | };
|
16448 | AnimateShowChangeCellRenderer.prototype.hideDeltaValue = function () {
|
16449 | this.eValue.classList.remove('ag-value-change-value-highlight');
|
16450 | clearElement(this.eDelta);
|
16451 | };
|
16452 | AnimateShowChangeCellRenderer.prototype.refresh = function (params) {
|
16453 | var value = params.value;
|
16454 | if (value === this.lastValue) {
|
16455 | return false;
|
16456 | }
|
16457 | if (exists(params.valueFormatted)) {
|
16458 | this.eValue.innerHTML = params.valueFormatted;
|
16459 | }
|
16460 | else if (exists(params.value)) {
|
16461 | this.eValue.innerHTML = value;
|
16462 | }
|
16463 | else {
|
16464 | clearElement(this.eValue);
|
16465 | }
|
16466 |
|
16467 |
|
16468 | if (this.filterManager.isSuppressFlashingCellsBecauseFiltering()) {
|
16469 | return false;
|
16470 | }
|
16471 | if (typeof value === 'number' && typeof this.lastValue === 'number') {
|
16472 | var delta = value - this.lastValue;
|
16473 | this.showDelta(params, delta);
|
16474 | }
|
16475 |
|
16476 |
|
16477 | if (this.lastValue) {
|
16478 | this.eValue.classList.add('ag-value-change-value-highlight');
|
16479 | }
|
16480 | this.setTimerToRemoveDelta();
|
16481 | this.lastValue = value;
|
16482 | return true;
|
16483 | };
|
16484 | AnimateShowChangeCellRenderer.TEMPLATE = '<span>' +
|
16485 | '<span class="ag-value-change-delta"></span>' +
|
16486 | '<span class="ag-value-change-value"></span>' +
|
16487 | '</span>';
|
16488 | __decorate$22([
|
16489 | Autowired('filterManager')
|
16490 | ], AnimateShowChangeCellRenderer.prototype, "filterManager", void 0);
|
16491 | return AnimateShowChangeCellRenderer;
|
16492 | }(Component));
|
16493 |
|
16494 |
|
16495 |
|
16496 |
|
16497 |
|
16498 |
|
16499 |
|
16500 | var __extends$2d = (undefined && undefined.__extends) || (function () {
|
16501 | var extendStatics = function (d, b) {
|
16502 | extendStatics = Object.setPrototypeOf ||
|
16503 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
16504 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
16505 | return extendStatics(d, b);
|
16506 | };
|
16507 | return function (d, b) {
|
16508 | extendStatics(d, b);
|
16509 | function __() { this.constructor = d; }
|
16510 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16511 | };
|
16512 | })();
|
16513 | var __decorate$21 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
16514 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
16515 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
16516 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
16517 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
16518 | };
|
16519 | var AnimateSlideCellRenderer = (function (_super) {
|
16520 | __extends$2d(AnimateSlideCellRenderer, _super);
|
16521 | function AnimateSlideCellRenderer() {
|
16522 | var _this = _super.call(this, AnimateSlideCellRenderer.TEMPLATE) || this;
|
16523 | _this.refreshCount = 0;
|
16524 | _this.eCurrent = _this.queryForHtmlElement('.ag-value-slide-current');
|
16525 | return _this;
|
16526 | }
|
16527 | AnimateSlideCellRenderer.prototype.init = function (params) {
|
16528 | this.refresh(params);
|
16529 | };
|
16530 | AnimateSlideCellRenderer.prototype.addSlideAnimation = function () {
|
16531 | var _this = this;
|
16532 | this.refreshCount++;
|
16533 |
|
16534 |
|
16535 |
|
16536 | var refreshCountCopy = this.refreshCount;
|
16537 |
|
16538 | if (this.ePrevious) {
|
16539 | this.getGui().removeChild(this.ePrevious);
|
16540 | }
|
16541 | this.ePrevious = loadTemplate('<span class="ag-value-slide-previous ag-value-slide-out"></span>');
|
16542 | this.ePrevious.innerHTML = this.eCurrent.innerHTML;
|
16543 | this.getGui().insertBefore(this.ePrevious, this.eCurrent);
|
16544 |
|
16545 |
|
16546 |
|
16547 | window.setTimeout(function () {
|
16548 | if (refreshCountCopy !== _this.refreshCount) {
|
16549 | return;
|
16550 | }
|
16551 | _this.ePrevious.classList.add('ag-value-slide-out-end');
|
16552 | }, 50);
|
16553 | window.setTimeout(function () {
|
16554 | if (refreshCountCopy !== _this.refreshCount) {
|
16555 | return;
|
16556 | }
|
16557 | _this.getGui().removeChild(_this.ePrevious);
|
16558 | _this.ePrevious = null;
|
16559 | }, 3000);
|
16560 | };
|
16561 | AnimateSlideCellRenderer.prototype.refresh = function (params) {
|
16562 | var value = params.value;
|
16563 | if (missing(value)) {
|
16564 | value = '';
|
16565 | }
|
16566 | if (value === this.lastValue) {
|
16567 | return false;
|
16568 | }
|
16569 |
|
16570 |
|
16571 | if (this.filterManager.isSuppressFlashingCellsBecauseFiltering()) {
|
16572 | return false;
|
16573 | }
|
16574 | this.addSlideAnimation();
|
16575 | this.lastValue = value;
|
16576 | if (exists(params.valueFormatted)) {
|
16577 | this.eCurrent.innerHTML = params.valueFormatted;
|
16578 | }
|
16579 | else if (exists(params.value)) {
|
16580 | this.eCurrent.innerHTML = value;
|
16581 | }
|
16582 | else {
|
16583 | clearElement(this.eCurrent);
|
16584 | }
|
16585 | return true;
|
16586 | };
|
16587 | AnimateSlideCellRenderer.TEMPLATE = "<span>\n <span class=\"ag-value-slide-current\"></span>\n </span>";
|
16588 | __decorate$21([
|
16589 | Autowired('filterManager')
|
16590 | ], AnimateSlideCellRenderer.prototype, "filterManager", void 0);
|
16591 | return AnimateSlideCellRenderer;
|
16592 | }(Component));
|
16593 |
|
16594 |
|
16595 |
|
16596 |
|
16597 |
|
16598 |
|
16599 |
|
16600 | var __assign$e = (undefined && undefined.__assign) || function () {
|
16601 | __assign$e = Object.assign || function(t) {
|
16602 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
16603 | s = arguments[i];
|
16604 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
16605 | t[p] = s[p];
|
16606 | }
|
16607 | return t;
|
16608 | };
|
16609 | return __assign$e.apply(this, arguments);
|
16610 | };
|
16611 | var RowNode = (function () {
|
16612 | function RowNode(beans) {
|
16613 |
|
16614 | this.rowIndex = null;
|
16615 |
|
16616 | this.key = null;
|
16617 |
|
16618 | this.childrenMapped = {};
|
16619 | |
16620 |
|
16621 |
|
16622 | this.displayed = false;
|
16623 |
|
16624 | this.rowTop = null;
|
16625 | |
16626 |
|
16627 | this.oldRowTop = null;
|
16628 |
|
16629 | this.selectable = true;
|
16630 | |
16631 |
|
16632 | this.__objectId = RowNode.OBJECT_ID_SEQUENCE++;
|
16633 | |
16634 |
|
16635 | this.__autoHeights = {};
|
16636 |
|
16637 | this.alreadyRendered = false;
|
16638 | this.highlighted = null;
|
16639 | this.selected = false;
|
16640 | this.beans = beans;
|
16641 | }
|
16642 | |
16643 |
|
16644 |
|
16645 | RowNode.prototype.setData = function (data) {
|
16646 | this.setDataCommon(data, false);
|
16647 | };
|
16648 |
|
16649 |
|
16650 |
|
16651 |
|
16652 |
|
16653 | |
16654 |
|
16655 |
|
16656 | RowNode.prototype.updateData = function (data) {
|
16657 | this.setDataCommon(data, true);
|
16658 | };
|
16659 | RowNode.prototype.setDataCommon = function (data, update) {
|
16660 | var oldData = this.data;
|
16661 | this.data = data;
|
16662 | this.beans.valueCache.onDataChanged();
|
16663 | this.updateDataOnDetailNode();
|
16664 | this.checkRowSelectable();
|
16665 | this.resetQuickFilterAggregateText();
|
16666 | var event = this.createDataChangedEvent(data, oldData, update);
|
16667 | this.dispatchLocalEvent(event);
|
16668 | };
|
16669 |
|
16670 |
|
16671 |
|
16672 | RowNode.prototype.updateDataOnDetailNode = function () {
|
16673 | if (this.detailNode) {
|
16674 | this.detailNode.data = this.data;
|
16675 | }
|
16676 | };
|
16677 | RowNode.prototype.createDataChangedEvent = function (newData, oldData, update) {
|
16678 | return {
|
16679 | type: RowNode.EVENT_DATA_CHANGED,
|
16680 | node: this,
|
16681 | oldData: oldData,
|
16682 | newData: newData,
|
16683 | update: update
|
16684 | };
|
16685 | };
|
16686 | RowNode.prototype.createLocalRowEvent = function (type) {
|
16687 | return {
|
16688 | type: type,
|
16689 | node: this
|
16690 | };
|
16691 | };
|
16692 | RowNode.prototype.getRowIndexString = function () {
|
16693 | if (this.rowPinned === 'top') {
|
16694 | return 't-' + this.rowIndex;
|
16695 | }
|
16696 | if (this.rowPinned === 'bottom') {
|
16697 | return 'b-' + this.rowIndex;
|
16698 | }
|
16699 | return this.rowIndex.toString();
|
16700 | };
|
16701 | RowNode.prototype.createDaemonNode = function () {
|
16702 | var oldNode = new RowNode(this.beans);
|
16703 |
|
16704 |
|
16705 |
|
16706 | oldNode.id = this.id;
|
16707 | oldNode.data = this.data;
|
16708 | oldNode.__daemon = true;
|
16709 | oldNode.selected = this.selected;
|
16710 | oldNode.level = this.level;
|
16711 | return oldNode;
|
16712 | };
|
16713 | RowNode.prototype.setDataAndId = function (data, id) {
|
16714 | var oldNode = exists(this.id) ? this.createDaemonNode() : null;
|
16715 | var oldData = this.data;
|
16716 | this.data = data;
|
16717 | this.updateDataOnDetailNode();
|
16718 | this.setId(id);
|
16719 | this.beans.selectionService.syncInRowNode(this, oldNode);
|
16720 | this.checkRowSelectable();
|
16721 | var event = this.createDataChangedEvent(data, oldData, false);
|
16722 | this.dispatchLocalEvent(event);
|
16723 | };
|
16724 | RowNode.prototype.checkRowSelectable = function () {
|
16725 | var isRowSelectableFunc = this.beans.gridOptionsService.get('isRowSelectable');
|
16726 | this.setRowSelectable(isRowSelectableFunc ? isRowSelectableFunc(this) : true);
|
16727 | };
|
16728 | RowNode.prototype.setRowSelectable = function (newVal) {
|
16729 | if (this.selectable !== newVal) {
|
16730 | this.selectable = newVal;
|
16731 | if (this.eventService) {
|
16732 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_SELECTABLE_CHANGED));
|
16733 | }
|
16734 | var isGroupSelectsChildren = this.beans.gridOptionsService.is('groupSelectsChildren');
|
16735 | if (isGroupSelectsChildren) {
|
16736 | var selected = this.calculateSelectedFromChildren();
|
16737 | this.setSelectedParams({ newValue: selected !== null && selected !== void 0 ? selected : false, source: 'selectableChanged' });
|
16738 | }
|
16739 | }
|
16740 | };
|
16741 | RowNode.prototype.setId = function (id) {
|
16742 |
|
16743 | var getRowIdFunc = this.beans.gridOptionsService.getRowIdFunc();
|
16744 | if (getRowIdFunc) {
|
16745 |
|
16746 |
|
16747 | if (this.data) {
|
16748 |
|
16749 |
|
16750 |
|
16751 |
|
16752 | var parentKeys = this.getGroupKeys(true);
|
16753 | this.id = getRowIdFunc({
|
16754 | data: this.data,
|
16755 | parentKeys: parentKeys.length > 0 ? parentKeys : undefined,
|
16756 | level: this.level
|
16757 | });
|
16758 |
|
16759 |
|
16760 | if (this.id !== null && typeof this.id === 'string' && this.id.startsWith(RowNode.ID_PREFIX_ROW_GROUP)) {
|
16761 | 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.");
|
16762 | }
|
16763 |
|
16764 | if (this.id !== null && typeof this.id !== 'string') {
|
16765 | this.id = '' + this.id;
|
16766 | }
|
16767 | }
|
16768 | else {
|
16769 |
|
16770 |
|
16771 |
|
16772 | this.id = undefined;
|
16773 | }
|
16774 | }
|
16775 | else {
|
16776 | this.id = id;
|
16777 | }
|
16778 | };
|
16779 | RowNode.prototype.getGroupKeys = function (excludeSelf) {
|
16780 | if (excludeSelf === void 0) { excludeSelf = false; }
|
16781 | var keys = [];
|
16782 | var pointer = this;
|
16783 | if (excludeSelf) {
|
16784 | pointer = pointer.parent;
|
16785 | }
|
16786 | while (pointer && pointer.level >= 0) {
|
16787 | keys.push(pointer.key);
|
16788 | pointer = pointer.parent;
|
16789 | }
|
16790 | keys.reverse();
|
16791 | return keys;
|
16792 | };
|
16793 | RowNode.prototype.isPixelInRange = function (pixel) {
|
16794 | if (!exists(this.rowTop) || !exists(this.rowHeight)) {
|
16795 | return false;
|
16796 | }
|
16797 | return pixel >= this.rowTop && pixel < (this.rowTop + this.rowHeight);
|
16798 | };
|
16799 | RowNode.prototype.setFirstChild = function (firstChild) {
|
16800 | if (this.firstChild === firstChild) {
|
16801 | return;
|
16802 | }
|
16803 | this.firstChild = firstChild;
|
16804 | if (this.eventService) {
|
16805 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_FIRST_CHILD_CHANGED));
|
16806 | }
|
16807 | };
|
16808 | RowNode.prototype.setLastChild = function (lastChild) {
|
16809 | if (this.lastChild === lastChild) {
|
16810 | return;
|
16811 | }
|
16812 | this.lastChild = lastChild;
|
16813 | if (this.eventService) {
|
16814 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_LAST_CHILD_CHANGED));
|
16815 | }
|
16816 | };
|
16817 | RowNode.prototype.setChildIndex = function (childIndex) {
|
16818 | if (this.childIndex === childIndex) {
|
16819 | return;
|
16820 | }
|
16821 | this.childIndex = childIndex;
|
16822 | if (this.eventService) {
|
16823 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_CHILD_INDEX_CHANGED));
|
16824 | }
|
16825 | };
|
16826 | RowNode.prototype.setRowTop = function (rowTop) {
|
16827 | this.oldRowTop = this.rowTop;
|
16828 | if (this.rowTop === rowTop) {
|
16829 | return;
|
16830 | }
|
16831 | this.rowTop = rowTop;
|
16832 | if (this.eventService) {
|
16833 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_TOP_CHANGED));
|
16834 | }
|
16835 | this.setDisplayed(rowTop !== null);
|
16836 | };
|
16837 | RowNode.prototype.clearRowTopAndRowIndex = function () {
|
16838 | this.oldRowTop = null;
|
16839 | this.setRowTop(null);
|
16840 | this.setRowIndex(null);
|
16841 | };
|
16842 | RowNode.prototype.setDisplayed = function (displayed) {
|
16843 | if (this.displayed === displayed) {
|
16844 | return;
|
16845 | }
|
16846 | this.displayed = displayed;
|
16847 | if (this.eventService) {
|
16848 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_DISPLAYED_CHANGED));
|
16849 | }
|
16850 | };
|
16851 | RowNode.prototype.setDragging = function (dragging) {
|
16852 | if (this.dragging === dragging) {
|
16853 | return;
|
16854 | }
|
16855 | this.dragging = dragging;
|
16856 | if (this.eventService) {
|
16857 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_DRAGGING_CHANGED));
|
16858 | }
|
16859 | };
|
16860 | RowNode.prototype.setHighlighted = function (highlighted) {
|
16861 | if (highlighted === this.highlighted) {
|
16862 | return;
|
16863 | }
|
16864 | this.highlighted = highlighted;
|
16865 | if (this.eventService) {
|
16866 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HIGHLIGHT_CHANGED));
|
16867 | }
|
16868 | };
|
16869 | RowNode.prototype.setAllChildrenCount = function (allChildrenCount) {
|
16870 | if (this.allChildrenCount === allChildrenCount) {
|
16871 | return;
|
16872 | }
|
16873 | this.allChildrenCount = allChildrenCount;
|
16874 | if (this.eventService) {
|
16875 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED));
|
16876 | }
|
16877 | };
|
16878 | RowNode.prototype.setMaster = function (master) {
|
16879 | if (this.master === master) {
|
16880 | return;
|
16881 | }
|
16882 |
|
16883 |
|
16884 | if (this.master && !master) {
|
16885 | this.expanded = false;
|
16886 | }
|
16887 | this.master = master;
|
16888 | if (this.eventService) {
|
16889 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_MASTER_CHANGED));
|
16890 | }
|
16891 | };
|
16892 | RowNode.prototype.setGroup = function (group) {
|
16893 | if (this.group === group) {
|
16894 | return;
|
16895 | }
|
16896 |
|
16897 | if (this.group && !group) {
|
16898 | this.expanded = false;
|
16899 | }
|
16900 | this.group = group;
|
16901 | this.updateHasChildren();
|
16902 | if (this.eventService) {
|
16903 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_GROUP_CHANGED));
|
16904 | }
|
16905 | };
|
16906 | |
16907 |
|
16908 |
|
16909 |
|
16910 | RowNode.prototype.setRowHeight = function (rowHeight, estimated) {
|
16911 | if (estimated === void 0) { estimated = false; }
|
16912 | this.rowHeight = rowHeight;
|
16913 | this.rowHeightEstimated = estimated;
|
16914 | if (this.eventService) {
|
16915 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HEIGHT_CHANGED));
|
16916 | }
|
16917 | };
|
16918 | RowNode.prototype.setRowAutoHeight = function (cellHeight, column) {
|
16919 | if (!this.__autoHeights) {
|
16920 | this.__autoHeights = {};
|
16921 | }
|
16922 | var autoHeights = this.__autoHeights;
|
16923 | autoHeights[column.getId()] = cellHeight;
|
16924 | if (cellHeight != null) {
|
16925 | if (this.checkAutoHeightsDebounced == null) {
|
16926 | this.checkAutoHeightsDebounced = debounce(this.checkAutoHeights.bind(this), 1);
|
16927 | }
|
16928 | this.checkAutoHeightsDebounced();
|
16929 | }
|
16930 | };
|
16931 | RowNode.prototype.checkAutoHeights = function () {
|
16932 | var notAllPresent = false;
|
16933 | var nonePresent = true;
|
16934 | var newRowHeight = 0;
|
16935 | var autoHeights = this.__autoHeights;
|
16936 | if (autoHeights == null) {
|
16937 | return;
|
16938 | }
|
16939 | var displayedAutoHeightCols = this.beans.columnModel.getAllDisplayedAutoHeightCols();
|
16940 | displayedAutoHeightCols.forEach(function (col) {
|
16941 | var cellHeight = autoHeights[col.getId()];
|
16942 | if (cellHeight == null) {
|
16943 | notAllPresent = true;
|
16944 | return;
|
16945 | }
|
16946 | nonePresent = false;
|
16947 | if (cellHeight > newRowHeight) {
|
16948 | newRowHeight = cellHeight;
|
16949 | }
|
16950 | });
|
16951 | if (notAllPresent) {
|
16952 | return;
|
16953 | }
|
16954 |
|
16955 |
|
16956 |
|
16957 |
|
16958 |
|
16959 | if (nonePresent || newRowHeight < 10) {
|
16960 | newRowHeight = this.beans.gridOptionsService.getRowHeightForNode(this).height;
|
16961 | }
|
16962 | if (newRowHeight == this.rowHeight) {
|
16963 | return;
|
16964 | }
|
16965 | this.setRowHeight(newRowHeight);
|
16966 | var rowModel = this.beans.rowModel;
|
16967 | if (rowModel.onRowHeightChangedDebounced) {
|
16968 | rowModel.onRowHeightChangedDebounced();
|
16969 | }
|
16970 | };
|
16971 | RowNode.prototype.setRowIndex = function (rowIndex) {
|
16972 | if (this.rowIndex === rowIndex) {
|
16973 | return;
|
16974 | }
|
16975 | this.rowIndex = rowIndex;
|
16976 | if (this.eventService) {
|
16977 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_ROW_INDEX_CHANGED));
|
16978 | }
|
16979 | };
|
16980 | RowNode.prototype.setUiLevel = function (uiLevel) {
|
16981 | if (this.uiLevel === uiLevel) {
|
16982 | return;
|
16983 | }
|
16984 | this.uiLevel = uiLevel;
|
16985 | if (this.eventService) {
|
16986 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_UI_LEVEL_CHANGED));
|
16987 | }
|
16988 | };
|
16989 | |
16990 |
|
16991 |
|
16992 | RowNode.prototype.setExpanded = function (expanded, e) {
|
16993 | if (this.expanded === expanded) {
|
16994 | return;
|
16995 | }
|
16996 | this.expanded = expanded;
|
16997 | if (this.eventService) {
|
16998 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_EXPANDED_CHANGED));
|
16999 | }
|
17000 | var event = Object.assign({}, this.createGlobalRowEvent(Events.EVENT_ROW_GROUP_OPENED), {
|
17001 | expanded: expanded,
|
17002 | event: e || null
|
17003 | });
|
17004 | this.beans.rowNodeEventThrottle.dispatchExpanded(event);
|
17005 |
|
17006 |
|
17007 | if (this.beans.gridOptionsService.is('groupIncludeFooter')) {
|
17008 | this.beans.rowRenderer.refreshCells({ rowNodes: [this] });
|
17009 | }
|
17010 | };
|
17011 | RowNode.prototype.createGlobalRowEvent = function (type) {
|
17012 | return {
|
17013 | type: type,
|
17014 | node: this,
|
17015 | data: this.data,
|
17016 | rowIndex: this.rowIndex,
|
17017 | rowPinned: this.rowPinned,
|
17018 | context: this.beans.gridOptionsService.context,
|
17019 | api: this.beans.gridOptionsService.api,
|
17020 | columnApi: this.beans.gridOptionsService.columnApi
|
17021 | };
|
17022 | };
|
17023 | RowNode.prototype.dispatchLocalEvent = function (event) {
|
17024 | if (this.eventService) {
|
17025 | this.eventService.dispatchEvent(event);
|
17026 | }
|
17027 | };
|
17028 | |
17029 |
|
17030 |
|
17031 |
|
17032 |
|
17033 |
|
17034 |
|
17035 |
|
17036 |
|
17037 |
|
17038 | RowNode.prototype.setDataValue = function (colKey, newValue, eventSource) {
|
17039 |
|
17040 |
|
17041 |
|
17042 |
|
17043 | var column = this.beans.columnModel.getPrimaryColumn(colKey);
|
17044 | var oldValue = this.beans.valueService.getValue(column, this);
|
17045 | if (this.beans.gridOptionsService.is('readOnlyEdit')) {
|
17046 | this.dispatchEventForSaveValueReadOnly(column, oldValue, newValue, eventSource);
|
17047 | return false;
|
17048 | }
|
17049 | var valueChanged = this.beans.valueService.setValue(this, column, newValue, eventSource);
|
17050 | this.dispatchCellChangedEvent(column, newValue, oldValue);
|
17051 | this.checkRowSelectable();
|
17052 | return valueChanged;
|
17053 | };
|
17054 | RowNode.prototype.dispatchEventForSaveValueReadOnly = function (column, oldValue, newValue, eventSource) {
|
17055 | var event = {
|
17056 | type: Events.EVENT_CELL_EDIT_REQUEST,
|
17057 | event: null,
|
17058 | rowIndex: this.rowIndex,
|
17059 | rowPinned: this.rowPinned,
|
17060 | column: column,
|
17061 | colDef: column.getColDef(),
|
17062 | context: this.beans.gridOptionsService.context,
|
17063 | api: this.beans.gridOptionsService.api,
|
17064 | columnApi: this.beans.gridOptionsService.columnApi,
|
17065 | data: this.data,
|
17066 | node: this,
|
17067 | oldValue: oldValue,
|
17068 | newValue: newValue,
|
17069 | value: newValue,
|
17070 | source: eventSource
|
17071 | };
|
17072 | this.beans.eventService.dispatchEvent(event);
|
17073 | };
|
17074 | RowNode.prototype.setGroupValue = function (colKey, newValue) {
|
17075 | var column = this.beans.columnModel.getGridColumn(colKey);
|
17076 | if (missing(this.groupData)) {
|
17077 | this.groupData = {};
|
17078 | }
|
17079 | var columnId = column.getColId();
|
17080 | var oldValue = this.groupData[columnId];
|
17081 | if (oldValue === newValue) {
|
17082 | return;
|
17083 | }
|
17084 | this.groupData[columnId] = newValue;
|
17085 | this.dispatchCellChangedEvent(column, newValue, oldValue);
|
17086 | };
|
17087 |
|
17088 | RowNode.prototype.setAggData = function (newAggData) {
|
17089 | var _this = this;
|
17090 |
|
17091 | var colIds = getAllKeysInObjects([this.aggData, newAggData]);
|
17092 | var oldAggData = this.aggData;
|
17093 | this.aggData = newAggData;
|
17094 |
|
17095 | if (this.eventService) {
|
17096 | colIds.forEach(function (colId) {
|
17097 | var column = _this.beans.columnModel.getGridColumn(colId);
|
17098 | var value = _this.aggData ? _this.aggData[colId] : undefined;
|
17099 | var oldValue = oldAggData ? oldAggData[colId] : undefined;
|
17100 | _this.dispatchCellChangedEvent(column, value, oldValue);
|
17101 | });
|
17102 | }
|
17103 | };
|
17104 | RowNode.prototype.updateHasChildren = function () {
|
17105 |
|
17106 | var newValue = (this.group && !this.footer) || (this.childrenAfterGroup && this.childrenAfterGroup.length > 0);
|
17107 | var isSsrm = this.beans.gridOptionsService.isRowModelType('serverSide');
|
17108 | if (isSsrm) {
|
17109 | var isTreeData = this.beans.gridOptionsService.isTreeData();
|
17110 | var isGroupFunc = this.beans.gridOptionsService.get('isServerSideGroup');
|
17111 |
|
17112 |
|
17113 | newValue = !this.stub && !this.footer && (isTreeData ? !!isGroupFunc && isGroupFunc(this.data) : !!this.group);
|
17114 | }
|
17115 | if (newValue !== this.__hasChildren) {
|
17116 | this.__hasChildren = !!newValue;
|
17117 | if (this.eventService) {
|
17118 | this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HAS_CHILDREN_CHANGED));
|
17119 | }
|
17120 | }
|
17121 | };
|
17122 | RowNode.prototype.hasChildren = function () {
|
17123 | if (this.__hasChildren == null) {
|
17124 | this.updateHasChildren();
|
17125 | }
|
17126 | return this.__hasChildren;
|
17127 | };
|
17128 | RowNode.prototype.isEmptyRowGroupNode = function () {
|
17129 | return this.group && missingOrEmpty(this.childrenAfterGroup);
|
17130 | };
|
17131 | RowNode.prototype.dispatchCellChangedEvent = function (column, newValue, oldValue) {
|
17132 | var cellChangedEvent = {
|
17133 | type: RowNode.EVENT_CELL_CHANGED,
|
17134 | node: this,
|
17135 | column: column,
|
17136 | newValue: newValue,
|
17137 | oldValue: oldValue
|
17138 | };
|
17139 | this.dispatchLocalEvent(cellChangedEvent);
|
17140 | };
|
17141 | |
17142 |
|
17143 |
|
17144 |
|
17145 |
|
17146 |
|
17147 | RowNode.prototype.resetQuickFilterAggregateText = function () {
|
17148 | this.quickFilterAggregateText = null;
|
17149 | };
|
17150 | |
17151 |
|
17152 |
|
17153 |
|
17154 | RowNode.prototype.isExpandable = function () {
|
17155 | return (this.hasChildren() && !this.footer) || this.master ? true : false;
|
17156 | };
|
17157 | |
17158 |
|
17159 |
|
17160 |
|
17161 | RowNode.prototype.isSelected = function () {
|
17162 |
|
17163 | if (this.footer) {
|
17164 | return this.sibling.isSelected();
|
17165 | }
|
17166 | return this.selected;
|
17167 | };
|
17168 |
|
17169 | RowNode.prototype.depthFirstSearch = function (callback) {
|
17170 | if (this.childrenAfterGroup) {
|
17171 | this.childrenAfterGroup.forEach(function (child) { return child.depthFirstSearch(callback); });
|
17172 | }
|
17173 | callback(this);
|
17174 | };
|
17175 |
|
17176 | RowNode.prototype.calculateSelectedFromChildren = function () {
|
17177 | var _a;
|
17178 | var atLeastOneSelected = false;
|
17179 | var atLeastOneDeSelected = false;
|
17180 | var atLeastOneMixed = false;
|
17181 | if (!((_a = this.childrenAfterGroup) === null || _a === void 0 ? void 0 : _a.length)) {
|
17182 | return this.selectable ? this.selected : null;
|
17183 | }
|
17184 | for (var i = 0; i < this.childrenAfterGroup.length; i++) {
|
17185 | var child = this.childrenAfterGroup[i];
|
17186 | var childState = child.isSelected();
|
17187 |
|
17188 | if (!child.selectable) {
|
17189 | var selectable = child.calculateSelectedFromChildren();
|
17190 | if (selectable === null) {
|
17191 | continue;
|
17192 | }
|
17193 | childState = selectable;
|
17194 | }
|
17195 | switch (childState) {
|
17196 | case true:
|
17197 | atLeastOneSelected = true;
|
17198 | break;
|
17199 | case false:
|
17200 | atLeastOneDeSelected = true;
|
17201 | break;
|
17202 | default:
|
17203 | atLeastOneMixed = true;
|
17204 | break;
|
17205 | }
|
17206 | }
|
17207 | if (atLeastOneMixed || (atLeastOneSelected && atLeastOneDeSelected)) {
|
17208 | return undefined;
|
17209 | }
|
17210 | else if (atLeastOneSelected) {
|
17211 | return true;
|
17212 | }
|
17213 | else if (atLeastOneDeSelected) {
|
17214 | return false;
|
17215 | }
|
17216 | else if (!this.selectable) {
|
17217 | return null;
|
17218 | }
|
17219 | else {
|
17220 | return this.selected;
|
17221 | }
|
17222 | };
|
17223 | RowNode.prototype.setSelectedInitialValue = function (selected) {
|
17224 | this.selected = selected;
|
17225 | };
|
17226 | RowNode.prototype.selectThisNode = function (newValue, e, source) {
|
17227 | if (source === void 0) { source = 'api'; }
|
17228 |
|
17229 |
|
17230 | var selectionNotAllowed = !this.selectable && newValue;
|
17231 | var selectionNotChanged = this.selected === newValue;
|
17232 | if (selectionNotAllowed || selectionNotChanged) {
|
17233 | return false;
|
17234 | }
|
17235 | this.selected = newValue;
|
17236 | if (this.eventService) {
|
17237 | this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_ROW_SELECTED));
|
17238 | }
|
17239 | var event = __assign$e(__assign$e({}, this.createGlobalRowEvent(Events.EVENT_ROW_SELECTED)), { event: e || null, source: source });
|
17240 | this.beans.eventService.dispatchEvent(event);
|
17241 | return true;
|
17242 | };
|
17243 | |
17244 |
|
17245 |
|
17246 |
|
17247 |
|
17248 |
|
17249 |
|
17250 | RowNode.prototype.setSelected = function (newValue, clearSelection, suppressFinishActions, source) {
|
17251 | if (clearSelection === void 0) { clearSelection = false; }
|
17252 | if (suppressFinishActions === void 0) { suppressFinishActions = false; }
|
17253 | if (source === void 0) { source = 'api'; }
|
17254 | this.setSelectedParams({
|
17255 | newValue: newValue,
|
17256 | clearSelection: clearSelection,
|
17257 | suppressFinishActions: suppressFinishActions,
|
17258 | rangeSelect: false,
|
17259 | source: source
|
17260 | });
|
17261 | };
|
17262 |
|
17263 | RowNode.prototype.setSelectedParams = function (params) {
|
17264 | if (this.rowPinned) {
|
17265 | console.warn('AG Grid: cannot select pinned rows');
|
17266 | return 0;
|
17267 | }
|
17268 | if (this.id === undefined) {
|
17269 | console.warn('AG Grid: cannot select node until id for node is known');
|
17270 | return 0;
|
17271 | }
|
17272 | return this.beans.selectionService.setNodeSelected(__assign$e(__assign$e({}, params), { node: this.footer ? this.sibling : this }));
|
17273 | };
|
17274 | |
17275 |
|
17276 |
|
17277 |
|
17278 |
|
17279 | RowNode.prototype.isRowPinned = function () {
|
17280 | return this.rowPinned === 'top' || this.rowPinned === 'bottom';
|
17281 | };
|
17282 | RowNode.prototype.isParentOfNode = function (potentialParent) {
|
17283 | var parentNode = this.parent;
|
17284 | while (parentNode) {
|
17285 | if (parentNode === potentialParent) {
|
17286 | return true;
|
17287 | }
|
17288 | parentNode = parentNode.parent;
|
17289 | }
|
17290 | return false;
|
17291 | };
|
17292 |
|
17293 | RowNode.prototype.addEventListener = function (eventType, listener) {
|
17294 | if (!this.eventService) {
|
17295 | this.eventService = new EventService();
|
17296 | }
|
17297 | this.eventService.addEventListener(eventType, listener);
|
17298 | };
|
17299 |
|
17300 | RowNode.prototype.removeEventListener = function (eventType, listener) {
|
17301 | if (!this.eventService) {
|
17302 | return;
|
17303 | }
|
17304 | this.eventService.removeEventListener(eventType, listener);
|
17305 | if (this.eventService.noRegisteredListenersExist()) {
|
17306 | this.eventService = null;
|
17307 | }
|
17308 | };
|
17309 | RowNode.prototype.onMouseEnter = function () {
|
17310 | this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_MOUSE_ENTER));
|
17311 | };
|
17312 | RowNode.prototype.onMouseLeave = function () {
|
17313 | this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_MOUSE_LEAVE));
|
17314 | };
|
17315 | RowNode.prototype.getFirstChildOfFirstChild = function (rowGroupColumn) {
|
17316 | var currentRowNode = this;
|
17317 | var isCandidate = true;
|
17318 | var foundFirstChildPath = false;
|
17319 | var nodeToSwapIn = null;
|
17320 |
|
17321 |
|
17322 | while (isCandidate && !foundFirstChildPath) {
|
17323 | var parentRowNode = currentRowNode.parent;
|
17324 | var firstChild = exists(parentRowNode) && currentRowNode.firstChild;
|
17325 | if (firstChild) {
|
17326 | if (parentRowNode.rowGroupColumn === rowGroupColumn) {
|
17327 | foundFirstChildPath = true;
|
17328 | nodeToSwapIn = parentRowNode;
|
17329 | }
|
17330 | }
|
17331 | else {
|
17332 | isCandidate = false;
|
17333 | }
|
17334 | currentRowNode = parentRowNode;
|
17335 | }
|
17336 | return foundFirstChildPath ? nodeToSwapIn : null;
|
17337 | };
|
17338 | |
17339 |
|
17340 |
|
17341 |
|
17342 |
|
17343 | RowNode.prototype.isFullWidthCell = function () {
|
17344 | var isFullWidthCellFunc = this.getIsFullWidthCellFunc();
|
17345 | return isFullWidthCellFunc ? isFullWidthCellFunc({ rowNode: this }) : false;
|
17346 | };
|
17347 | RowNode.prototype.getIsFullWidthCellFunc = function () {
|
17348 | var isFullWidthRow = this.beans.gridOptionsService.getCallback('isFullWidthRow');
|
17349 | if (isFullWidthRow) {
|
17350 | return isFullWidthRow;
|
17351 | }
|
17352 |
|
17353 | var isFullWidthCell = this.beans.gridOptionsService.get('isFullWidthCell');
|
17354 | if (isFullWidthCell) {
|
17355 | return function (params) { return isFullWidthCell(params.rowNode); };
|
17356 | }
|
17357 | };
|
17358 | |
17359 |
|
17360 |
|
17361 |
|
17362 | RowNode.prototype.getRoute = function () {
|
17363 | if (this.key == null) {
|
17364 | return;
|
17365 | }
|
17366 | var res = [];
|
17367 | var pointer = this;
|
17368 | while (pointer.key != null) {
|
17369 | res.push(pointer.key);
|
17370 | pointer = pointer.parent;
|
17371 | }
|
17372 | return res.reverse();
|
17373 | };
|
17374 | RowNode.prototype.createFooter = function () {
|
17375 | var _this = this;
|
17376 |
|
17377 |
|
17378 | if (this.sibling) {
|
17379 | return;
|
17380 | }
|
17381 | var footerNode = new RowNode(this.beans);
|
17382 | Object.keys(this).forEach(function (key) {
|
17383 | footerNode[key] = _this[key];
|
17384 | });
|
17385 | footerNode.footer = true;
|
17386 | footerNode.setRowTop(null);
|
17387 | footerNode.setRowIndex(null);
|
17388 |
|
17389 |
|
17390 | footerNode.oldRowTop = null;
|
17391 | footerNode.id = 'rowGroupFooter_' + this.id;
|
17392 |
|
17393 |
|
17394 |
|
17395 | footerNode.sibling = this;
|
17396 | this.sibling = footerNode;
|
17397 | };
|
17398 | RowNode.ID_PREFIX_ROW_GROUP = 'row-group-';
|
17399 | RowNode.ID_PREFIX_TOP_PINNED = 't-';
|
17400 | RowNode.ID_PREFIX_BOTTOM_PINNED = 'b-';
|
17401 | RowNode.OBJECT_ID_SEQUENCE = 0;
|
17402 | RowNode.EVENT_ROW_SELECTED = 'rowSelected';
|
17403 | RowNode.EVENT_DATA_CHANGED = 'dataChanged';
|
17404 | RowNode.EVENT_CELL_CHANGED = 'cellChanged';
|
17405 | RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED = 'allChildrenCountChanged';
|
17406 | RowNode.EVENT_MASTER_CHANGED = 'masterChanged';
|
17407 | RowNode.EVENT_GROUP_CHANGED = 'groupChanged';
|
17408 | RowNode.EVENT_MOUSE_ENTER = 'mouseEnter';
|
17409 | RowNode.EVENT_MOUSE_LEAVE = 'mouseLeave';
|
17410 | RowNode.EVENT_HEIGHT_CHANGED = 'heightChanged';
|
17411 | RowNode.EVENT_TOP_CHANGED = 'topChanged';
|
17412 | RowNode.EVENT_DISPLAYED_CHANGED = 'displayedChanged';
|
17413 | RowNode.EVENT_FIRST_CHILD_CHANGED = 'firstChildChanged';
|
17414 | RowNode.EVENT_LAST_CHILD_CHANGED = 'lastChildChanged';
|
17415 | RowNode.EVENT_CHILD_INDEX_CHANGED = 'childIndexChanged';
|
17416 | RowNode.EVENT_ROW_INDEX_CHANGED = 'rowIndexChanged';
|
17417 | RowNode.EVENT_EXPANDED_CHANGED = 'expandedChanged';
|
17418 | RowNode.EVENT_HAS_CHILDREN_CHANGED = 'hasChildrenChanged';
|
17419 | RowNode.EVENT_SELECTABLE_CHANGED = 'selectableChanged';
|
17420 | RowNode.EVENT_UI_LEVEL_CHANGED = 'uiLevelChanged';
|
17421 | RowNode.EVENT_HIGHLIGHT_CHANGED = 'rowHighlightChanged';
|
17422 | RowNode.EVENT_DRAGGING_CHANGED = 'draggingChanged';
|
17423 | return RowNode;
|
17424 | }());
|
17425 |
|
17426 |
|
17427 |
|
17428 |
|
17429 |
|
17430 |
|
17431 |
|
17432 | var __extends$2c = (undefined && undefined.__extends) || (function () {
|
17433 | var extendStatics = function (d, b) {
|
17434 | extendStatics = Object.setPrototypeOf ||
|
17435 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
17436 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
17437 | return extendStatics(d, b);
|
17438 | };
|
17439 | return function (d, b) {
|
17440 | extendStatics(d, b);
|
17441 | function __() { this.constructor = d; }
|
17442 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17443 | };
|
17444 | })();
|
17445 | var __assign$d = (undefined && undefined.__assign) || function () {
|
17446 | __assign$d = Object.assign || function(t) {
|
17447 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
17448 | s = arguments[i];
|
17449 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
17450 | t[p] = s[p];
|
17451 | }
|
17452 | return t;
|
17453 | };
|
17454 | return __assign$d.apply(this, arguments);
|
17455 | };
|
17456 | var __decorate$20 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
17457 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
17458 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
17459 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
17460 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
17461 | };
|
17462 | var CheckboxSelectionComponent = (function (_super) {
|
17463 | __extends$2c(CheckboxSelectionComponent, _super);
|
17464 | function CheckboxSelectionComponent() {
|
17465 | return _super.call(this, "\n <div class=\"ag-selection-checkbox\" role=\"presentation\">\n <ag-checkbox role=\"presentation\" ref=\"eCheckbox\"></ag-checkbox>\n </div>") || this;
|
17466 | }
|
17467 | CheckboxSelectionComponent.prototype.postConstruct = function () {
|
17468 | this.eCheckbox.setPassive(true);
|
17469 | setAriaLive(this.eCheckbox.getInputElement(), 'polite');
|
17470 | };
|
17471 | CheckboxSelectionComponent.prototype.getCheckboxId = function () {
|
17472 | return this.eCheckbox.getInputElement().id;
|
17473 | };
|
17474 | CheckboxSelectionComponent.prototype.onDataChanged = function () {
|
17475 |
|
17476 |
|
17477 | this.onSelectionChanged();
|
17478 | };
|
17479 | CheckboxSelectionComponent.prototype.onSelectableChanged = function () {
|
17480 | this.showOrHideSelect();
|
17481 | };
|
17482 | CheckboxSelectionComponent.prototype.onSelectionChanged = function () {
|
17483 | var translate = this.localeService.getLocaleTextFunc();
|
17484 | var state = this.rowNode.isSelected();
|
17485 | var stateName = state === undefined
|
17486 | ? translate('ariaIndeterminate', 'indeterminate')
|
17487 | : (state === true
|
17488 | ? translate('ariaChecked', 'checked')
|
17489 | : translate('ariaUnchecked', 'unchecked'));
|
17490 | var ariaLabel = translate('ariaRowToggleSelection', 'Press Space to toggle row selection');
|
17491 | this.eCheckbox.setValue(state, true);
|
17492 | this.eCheckbox.setInputAriaLabel(ariaLabel + " (" + stateName + ")");
|
17493 | };
|
17494 | CheckboxSelectionComponent.prototype.onCheckedClicked = function (event) {
|
17495 | var groupSelectsFiltered = this.gridOptionsService.is('groupSelectsFiltered');
|
17496 | var updatedCount = this.rowNode.setSelectedParams({ newValue: false, rangeSelect: event.shiftKey, groupSelectsFiltered: groupSelectsFiltered, event: event, source: 'checkboxSelected' });
|
17497 | return updatedCount;
|
17498 | };
|
17499 | CheckboxSelectionComponent.prototype.onUncheckedClicked = function (event) {
|
17500 | var groupSelectsFiltered = this.gridOptionsService.is('groupSelectsFiltered');
|
17501 | var updatedCount = this.rowNode.setSelectedParams({ newValue: true, rangeSelect: event.shiftKey, groupSelectsFiltered: groupSelectsFiltered, event: event, source: 'checkboxSelected' });
|
17502 | return updatedCount;
|
17503 | };
|
17504 | CheckboxSelectionComponent.prototype.init = function (params) {
|
17505 | var _this = this;
|
17506 | this.rowNode = params.rowNode;
|
17507 | this.column = params.column;
|
17508 | this.overrides = params.overrides;
|
17509 | this.onSelectionChanged();
|
17510 |
|
17511 | this.addManagedListener(this.eCheckbox.getInputElement(), 'dblclick', function (event) {
|
17512 | stopPropagationForAgGrid(event);
|
17513 | });
|
17514 | this.addManagedListener(this.eCheckbox.getInputElement(), 'click', function (event) {
|
17515 |
|
17516 |
|
17517 | stopPropagationForAgGrid(event);
|
17518 | var isSelected = _this.eCheckbox.getValue();
|
17519 | if (isSelected) {
|
17520 | _this.onCheckedClicked(event);
|
17521 | }
|
17522 | else {
|
17523 | _this.onUncheckedClicked(event || {});
|
17524 | }
|
17525 | });
|
17526 | this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_SELECTED, this.onSelectionChanged.bind(this));
|
17527 | this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.onDataChanged.bind(this));
|
17528 | this.addManagedListener(this.rowNode, RowNode.EVENT_SELECTABLE_CHANGED, this.onSelectableChanged.bind(this));
|
17529 | var isRowSelectableFunc = this.gridOptionsService.get('isRowSelectable');
|
17530 | var checkboxVisibleIsDynamic = isRowSelectableFunc || typeof this.getIsVisible() === 'function';
|
17531 | if (checkboxVisibleIsDynamic) {
|
17532 | var showOrHideSelectListener = this.showOrHideSelect.bind(this);
|
17533 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, showOrHideSelectListener);
|
17534 | this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, showOrHideSelectListener);
|
17535 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, showOrHideSelectListener);
|
17536 | this.showOrHideSelect();
|
17537 | }
|
17538 | this.eCheckbox.getInputElement().setAttribute('tabindex', '-1');
|
17539 | };
|
17540 | CheckboxSelectionComponent.prototype.showOrHideSelect = function () {
|
17541 | var _a, _b, _c, _d;
|
17542 |
|
17543 | var selectable = this.rowNode.selectable;
|
17544 |
|
17545 |
|
17546 |
|
17547 | var isVisible = this.getIsVisible();
|
17548 | if (selectable) {
|
17549 | if (typeof isVisible === 'function') {
|
17550 | var extraParams = (_a = this.overrides) === null || _a === void 0 ? void 0 : _a.callbackParams;
|
17551 | var params = (_b = this.column) === null || _b === void 0 ? void 0 : _b.createColumnFunctionCallbackParams(this.rowNode);
|
17552 | selectable = params ? isVisible(__assign$d(__assign$d({}, extraParams), params)) : false;
|
17553 | }
|
17554 | else {
|
17555 | selectable = isVisible !== null && isVisible !== void 0 ? isVisible : false;
|
17556 | }
|
17557 | }
|
17558 | var disableInsteadOfHide = (_c = this.column) === null || _c === void 0 ? void 0 : _c.getColDef().showDisabledCheckboxes;
|
17559 | if (disableInsteadOfHide) {
|
17560 | this.eCheckbox.setDisabled(!selectable);
|
17561 | this.setVisible(true);
|
17562 | this.setDisplayed(true);
|
17563 | return;
|
17564 | }
|
17565 | if ((_d = this.overrides) === null || _d === void 0 ? void 0 : _d.removeHidden) {
|
17566 | this.setDisplayed(selectable);
|
17567 | return;
|
17568 | }
|
17569 | this.setVisible(selectable);
|
17570 | };
|
17571 | CheckboxSelectionComponent.prototype.getIsVisible = function () {
|
17572 | var _a, _b;
|
17573 | if (this.overrides) {
|
17574 | return this.overrides.isVisible;
|
17575 | }
|
17576 |
|
17577 | return (_b = (_a = this.column) === null || _a === void 0 ? void 0 : _a.getColDef()) === null || _b === void 0 ? void 0 : _b.checkboxSelection;
|
17578 | };
|
17579 | __decorate$20([
|
17580 | RefSelector('eCheckbox')
|
17581 | ], CheckboxSelectionComponent.prototype, "eCheckbox", void 0);
|
17582 | __decorate$20([
|
17583 | PostConstruct
|
17584 | ], CheckboxSelectionComponent.prototype, "postConstruct", null);
|
17585 | return CheckboxSelectionComponent;
|
17586 | }(Component));
|
17587 |
|
17588 |
|
17589 |
|
17590 |
|
17591 |
|
17592 |
|
17593 |
|
17594 | var __extends$2b = (undefined && undefined.__extends) || (function () {
|
17595 | var extendStatics = function (d, b) {
|
17596 | extendStatics = Object.setPrototypeOf ||
|
17597 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
17598 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
17599 | return extendStatics(d, b);
|
17600 | };
|
17601 | return function (d, b) {
|
17602 | extendStatics(d, b);
|
17603 | function __() { this.constructor = d; }
|
17604 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17605 | };
|
17606 | })();
|
17607 | var __decorate$1$ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
17608 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
17609 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
17610 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
17611 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
17612 | };
|
17613 | var __values$4 = (undefined && undefined.__values) || function(o) {
|
17614 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
17615 | if (m) return m.call(o);
|
17616 | if (o && typeof o.length === "number") return {
|
17617 | next: function () {
|
17618 | if (o && i >= o.length) o = void 0;
|
17619 | return { value: o && o[i++], done: !o };
|
17620 | }
|
17621 | };
|
17622 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
17623 | };
|
17624 | var DragSourceType;
|
17625 | (function (DragSourceType) {
|
17626 | DragSourceType[DragSourceType["ToolPanel"] = 0] = "ToolPanel";
|
17627 | DragSourceType[DragSourceType["HeaderCell"] = 1] = "HeaderCell";
|
17628 | DragSourceType[DragSourceType["RowDrag"] = 2] = "RowDrag";
|
17629 | DragSourceType[DragSourceType["ChartPanel"] = 3] = "ChartPanel";
|
17630 | })(DragSourceType || (DragSourceType = {}));
|
17631 | var VerticalDirection;
|
17632 | (function (VerticalDirection) {
|
17633 | VerticalDirection[VerticalDirection["Up"] = 0] = "Up";
|
17634 | VerticalDirection[VerticalDirection["Down"] = 1] = "Down";
|
17635 | })(VerticalDirection || (VerticalDirection = {}));
|
17636 | var HorizontalDirection;
|
17637 | (function (HorizontalDirection) {
|
17638 | HorizontalDirection[HorizontalDirection["Left"] = 0] = "Left";
|
17639 | HorizontalDirection[HorizontalDirection["Right"] = 1] = "Right";
|
17640 | })(HorizontalDirection || (HorizontalDirection = {}));
|
17641 | var DragAndDropService = (function (_super) {
|
17642 | __extends$2b(DragAndDropService, _super);
|
17643 | function DragAndDropService() {
|
17644 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
17645 | _this.dragSourceAndParamsList = [];
|
17646 | _this.dropTargets = [];
|
17647 | return _this;
|
17648 | }
|
17649 | DragAndDropService_1 = DragAndDropService;
|
17650 | DragAndDropService.prototype.init = function () {
|
17651 | this.ePinnedIcon = createIcon('columnMovePin', this.gridOptionsService, null);
|
17652 | this.eHideIcon = createIcon('columnMoveHide', this.gridOptionsService, null);
|
17653 | this.eMoveIcon = createIcon('columnMoveMove', this.gridOptionsService, null);
|
17654 | this.eLeftIcon = createIcon('columnMoveLeft', this.gridOptionsService, null);
|
17655 | this.eRightIcon = createIcon('columnMoveRight', this.gridOptionsService, null);
|
17656 | this.eGroupIcon = createIcon('columnMoveGroup', this.gridOptionsService, null);
|
17657 | this.eAggregateIcon = createIcon('columnMoveValue', this.gridOptionsService, null);
|
17658 | this.ePivotIcon = createIcon('columnMovePivot', this.gridOptionsService, null);
|
17659 | this.eDropNotAllowedIcon = createIcon('dropNotAllowed', this.gridOptionsService, null);
|
17660 | };
|
17661 | DragAndDropService.prototype.addDragSource = function (dragSource, allowTouch) {
|
17662 | if (allowTouch === void 0) { allowTouch = false; }
|
17663 | var params = {
|
17664 | eElement: dragSource.eElement,
|
17665 | dragStartPixels: dragSource.dragStartPixels,
|
17666 | onDragStart: this.onDragStart.bind(this, dragSource),
|
17667 | onDragStop: this.onDragStop.bind(this),
|
17668 | onDragging: this.onDragging.bind(this)
|
17669 | };
|
17670 | this.dragSourceAndParamsList.push({ params: params, dragSource: dragSource });
|
17671 | this.dragService.addDragSource(params, allowTouch);
|
17672 | };
|
17673 | DragAndDropService.prototype.removeDragSource = function (dragSource) {
|
17674 | var sourceAndParams = this.dragSourceAndParamsList.find(function (item) { return item.dragSource === dragSource; });
|
17675 | if (sourceAndParams) {
|
17676 | this.dragService.removeDragSource(sourceAndParams.params);
|
17677 | removeFromArray(this.dragSourceAndParamsList, sourceAndParams);
|
17678 | }
|
17679 | };
|
17680 | DragAndDropService.prototype.clearDragSourceParamsList = function () {
|
17681 | var _this = this;
|
17682 | this.dragSourceAndParamsList.forEach(function (sourceAndParams) { return _this.dragService.removeDragSource(sourceAndParams.params); });
|
17683 | this.dragSourceAndParamsList.length = 0;
|
17684 | this.dropTargets.length = 0;
|
17685 | };
|
17686 | DragAndDropService.prototype.nudge = function () {
|
17687 | if (this.dragging) {
|
17688 | this.onDragging(this.eventLastTime, true);
|
17689 | }
|
17690 | };
|
17691 | DragAndDropService.prototype.onDragStart = function (dragSource, mouseEvent) {
|
17692 | this.dragging = true;
|
17693 | this.dragSource = dragSource;
|
17694 | this.eventLastTime = mouseEvent;
|
17695 | this.dragItem = this.dragSource.getDragItem();
|
17696 | this.lastDropTarget = this.dragSource.dragSourceDropTarget;
|
17697 | if (this.dragSource.onDragStarted) {
|
17698 | this.dragSource.onDragStarted();
|
17699 | }
|
17700 | this.createGhost();
|
17701 | };
|
17702 | DragAndDropService.prototype.onDragStop = function (mouseEvent) {
|
17703 | this.eventLastTime = null;
|
17704 | this.dragging = false;
|
17705 | if (this.dragSource.onDragStopped) {
|
17706 | this.dragSource.onDragStopped();
|
17707 | }
|
17708 | if (this.lastDropTarget && this.lastDropTarget.onDragStop) {
|
17709 | var draggingEvent = this.createDropTargetEvent(this.lastDropTarget, mouseEvent, null, null, false);
|
17710 | this.lastDropTarget.onDragStop(draggingEvent);
|
17711 | }
|
17712 | this.lastDropTarget = null;
|
17713 | this.dragItem = null;
|
17714 | this.removeGhost();
|
17715 | };
|
17716 | DragAndDropService.prototype.onDragging = function (mouseEvent, fromNudge) {
|
17717 | var _this = this;
|
17718 | var _a, _b, _c, _d;
|
17719 | var hDirection = this.getHorizontalDirection(mouseEvent);
|
17720 | var vDirection = this.getVerticalDirection(mouseEvent);
|
17721 | this.eventLastTime = mouseEvent;
|
17722 | this.positionGhost(mouseEvent);
|
17723 |
|
17724 | var validDropTargets = this.dropTargets.filter(function (target) { return _this.isMouseOnDropTarget(mouseEvent, target); });
|
17725 | var dropTarget = this.findCurrentDropTarget(mouseEvent, validDropTargets);
|
17726 | if (dropTarget !== this.lastDropTarget) {
|
17727 | this.leaveLastTargetIfExists(mouseEvent, hDirection, vDirection, fromNudge);
|
17728 | if (this.lastDropTarget !== null && dropTarget === null) {
|
17729 | (_b = (_a = this.dragSource).onGridExit) === null || _b === void 0 ? void 0 : _b.call(_a, this.dragItem);
|
17730 | }
|
17731 | if (this.lastDropTarget === null && dropTarget !== null) {
|
17732 | (_d = (_c = this.dragSource).onGridEnter) === null || _d === void 0 ? void 0 : _d.call(_c, this.dragItem);
|
17733 | }
|
17734 | this.enterDragTargetIfExists(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
|
17735 | this.lastDropTarget = dropTarget;
|
17736 | }
|
17737 | else if (dropTarget && dropTarget.onDragging) {
|
17738 | var draggingEvent = this.createDropTargetEvent(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
|
17739 | dropTarget.onDragging(draggingEvent);
|
17740 | }
|
17741 | };
|
17742 | DragAndDropService.prototype.getAllContainersFromDropTarget = function (dropTarget) {
|
17743 | var secondaryContainers = dropTarget.getSecondaryContainers ? dropTarget.getSecondaryContainers() : null;
|
17744 | var containers = [[dropTarget.getContainer()]];
|
17745 | return secondaryContainers ? containers.concat(secondaryContainers) : containers;
|
17746 | };
|
17747 | DragAndDropService.prototype.allContainersIntersect = function (mouseEvent, containers) {
|
17748 | var e_1, _a;
|
17749 | try {
|
17750 | for (var containers_1 = __values$4(containers), containers_1_1 = containers_1.next(); !containers_1_1.done; containers_1_1 = containers_1.next()) {
|
17751 | var container = containers_1_1.value;
|
17752 | var rect = container.getBoundingClientRect();
|
17753 |
|
17754 | if (rect.width === 0 || rect.height === 0) {
|
17755 | return false;
|
17756 | }
|
17757 | var horizontalFit = mouseEvent.clientX >= rect.left && mouseEvent.clientX < rect.right;
|
17758 | var verticalFit = mouseEvent.clientY >= rect.top && mouseEvent.clientY < rect.bottom;
|
17759 | if (!horizontalFit || !verticalFit) {
|
17760 | return false;
|
17761 | }
|
17762 | }
|
17763 | }
|
17764 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
17765 | finally {
|
17766 | try {
|
17767 | if (containers_1_1 && !containers_1_1.done && (_a = containers_1.return)) _a.call(containers_1);
|
17768 | }
|
17769 | finally { if (e_1) throw e_1.error; }
|
17770 | }
|
17771 | return true;
|
17772 | };
|
17773 |
|
17774 | DragAndDropService.prototype.isMouseOnDropTarget = function (mouseEvent, dropTarget) {
|
17775 | var e_2, _a;
|
17776 | var allContainersFromDropTarget = this.getAllContainersFromDropTarget(dropTarget);
|
17777 | var mouseOverTarget = false;
|
17778 | try {
|
17779 | for (var allContainersFromDropTarget_1 = __values$4(allContainersFromDropTarget), allContainersFromDropTarget_1_1 = allContainersFromDropTarget_1.next(); !allContainersFromDropTarget_1_1.done; allContainersFromDropTarget_1_1 = allContainersFromDropTarget_1.next()) {
|
17780 | var currentContainers = allContainersFromDropTarget_1_1.value;
|
17781 | if (this.allContainersIntersect(mouseEvent, currentContainers)) {
|
17782 | mouseOverTarget = true;
|
17783 | break;
|
17784 | }
|
17785 | }
|
17786 | }
|
17787 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
17788 | finally {
|
17789 | try {
|
17790 | if (allContainersFromDropTarget_1_1 && !allContainersFromDropTarget_1_1.done && (_a = allContainersFromDropTarget_1.return)) _a.call(allContainersFromDropTarget_1);
|
17791 | }
|
17792 | finally { if (e_2) throw e_2.error; }
|
17793 | }
|
17794 | if (dropTarget.targetContainsSource && !dropTarget.getContainer().contains(this.dragSource.eElement)) {
|
17795 | return false;
|
17796 | }
|
17797 | return mouseOverTarget && dropTarget.isInterestedIn(this.dragSource.type, this.dragSource.eElement);
|
17798 | };
|
17799 | DragAndDropService.prototype.findCurrentDropTarget = function (mouseEvent, validDropTargets) {
|
17800 | var e_3, _a, e_4, _b;
|
17801 | var len = validDropTargets.length;
|
17802 | if (len === 0) {
|
17803 | return null;
|
17804 | }
|
17805 | if (len === 1) {
|
17806 | return validDropTargets[0];
|
17807 | }
|
17808 | var rootNode = this.gridOptionsService.getRootNode();
|
17809 |
|
17810 |
|
17811 | var elementStack = rootNode.elementsFromPoint(mouseEvent.clientX, mouseEvent.clientY);
|
17812 | try {
|
17813 |
|
17814 | for (var elementStack_1 = __values$4(elementStack), elementStack_1_1 = elementStack_1.next(); !elementStack_1_1.done; elementStack_1_1 = elementStack_1.next()) {
|
17815 | var el = elementStack_1_1.value;
|
17816 | try {
|
17817 | for (var validDropTargets_1 = (e_4 = void 0, __values$4(validDropTargets)), validDropTargets_1_1 = validDropTargets_1.next(); !validDropTargets_1_1.done; validDropTargets_1_1 = validDropTargets_1.next()) {
|
17818 | var dropTarget = validDropTargets_1_1.value;
|
17819 | var containers = flatten(this.getAllContainersFromDropTarget(dropTarget));
|
17820 | if (containers.indexOf(el) !== -1) {
|
17821 | return dropTarget;
|
17822 | }
|
17823 | }
|
17824 | }
|
17825 | catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
17826 | finally {
|
17827 | try {
|
17828 | if (validDropTargets_1_1 && !validDropTargets_1_1.done && (_b = validDropTargets_1.return)) _b.call(validDropTargets_1);
|
17829 | }
|
17830 | finally { if (e_4) throw e_4.error; }
|
17831 | }
|
17832 | }
|
17833 | }
|
17834 | catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
17835 | finally {
|
17836 | try {
|
17837 | if (elementStack_1_1 && !elementStack_1_1.done && (_a = elementStack_1.return)) _a.call(elementStack_1);
|
17838 | }
|
17839 | finally { if (e_3) throw e_3.error; }
|
17840 | }
|
17841 |
|
17842 |
|
17843 | return null;
|
17844 | };
|
17845 | DragAndDropService.prototype.enterDragTargetIfExists = function (dropTarget, mouseEvent, hDirection, vDirection, fromNudge) {
|
17846 | if (!dropTarget) {
|
17847 | return;
|
17848 | }
|
17849 | if (dropTarget.onDragEnter) {
|
17850 | var dragEnterEvent = this.createDropTargetEvent(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
|
17851 | dropTarget.onDragEnter(dragEnterEvent);
|
17852 | }
|
17853 | this.setGhostIcon(dropTarget.getIconName ? dropTarget.getIconName() : null);
|
17854 | };
|
17855 | DragAndDropService.prototype.leaveLastTargetIfExists = function (mouseEvent, hDirection, vDirection, fromNudge) {
|
17856 | if (!this.lastDropTarget) {
|
17857 | return;
|
17858 | }
|
17859 | if (this.lastDropTarget.onDragLeave) {
|
17860 | var dragLeaveEvent = this.createDropTargetEvent(this.lastDropTarget, mouseEvent, hDirection, vDirection, fromNudge);
|
17861 | this.lastDropTarget.onDragLeave(dragLeaveEvent);
|
17862 | }
|
17863 | this.setGhostIcon(null);
|
17864 | };
|
17865 | DragAndDropService.prototype.addDropTarget = function (dropTarget) {
|
17866 | this.dropTargets.push(dropTarget);
|
17867 | };
|
17868 | DragAndDropService.prototype.removeDropTarget = function (dropTarget) {
|
17869 | this.dropTargets = this.dropTargets.filter(function (target) { return target.getContainer() !== dropTarget.getContainer(); });
|
17870 | };
|
17871 | DragAndDropService.prototype.hasExternalDropZones = function () {
|
17872 | return this.dropTargets.some(function (zones) { return zones.external; });
|
17873 | };
|
17874 | DragAndDropService.prototype.findExternalZone = function (params) {
|
17875 | var externalTargets = this.dropTargets.filter(function (target) { return target.external; });
|
17876 | return externalTargets.find(function (zone) { return zone.getContainer() === params.getContainer(); }) || null;
|
17877 | };
|
17878 | DragAndDropService.prototype.getHorizontalDirection = function (event) {
|
17879 | var clientX = this.eventLastTime && this.eventLastTime.clientX;
|
17880 | var eClientX = event.clientX;
|
17881 | if (clientX === eClientX) {
|
17882 | return null;
|
17883 | }
|
17884 | return clientX > eClientX ? HorizontalDirection.Left : HorizontalDirection.Right;
|
17885 | };
|
17886 | DragAndDropService.prototype.getVerticalDirection = function (event) {
|
17887 | var clientY = this.eventLastTime && this.eventLastTime.clientY;
|
17888 | var eClientY = event.clientY;
|
17889 | if (clientY === eClientY) {
|
17890 | return null;
|
17891 | }
|
17892 | return clientY > eClientY ? VerticalDirection.Up : VerticalDirection.Down;
|
17893 | };
|
17894 | DragAndDropService.prototype.createDropTargetEvent = function (dropTarget, event, hDirection, vDirection, fromNudge) {
|
17895 |
|
17896 | var dropZoneTarget = dropTarget.getContainer();
|
17897 | var rect = dropZoneTarget.getBoundingClientRect();
|
17898 | var _a = this, api = _a.gridApi, columnApi = _a.columnApi, dragItem = _a.dragItem, dragSource = _a.dragSource;
|
17899 | var x = event.clientX - rect.left;
|
17900 | var y = event.clientY - rect.top;
|
17901 | return { event: event, x: x, y: y, vDirection: vDirection, hDirection: hDirection, dragSource: dragSource, fromNudge: fromNudge, dragItem: dragItem, api: api, columnApi: columnApi, dropZoneTarget: dropZoneTarget };
|
17902 | };
|
17903 | DragAndDropService.prototype.positionGhost = function (event) {
|
17904 | var ghost = this.eGhost;
|
17905 | if (!ghost) {
|
17906 | return;
|
17907 | }
|
17908 | var ghostRect = ghost.getBoundingClientRect();
|
17909 | var ghostHeight = ghostRect.height;
|
17910 |
|
17911 |
|
17912 |
|
17913 | var browserWidth = getBodyWidth() - 2;
|
17914 | var browserHeight = getBodyHeight() - 2;
|
17915 | var top = event.pageY - (ghostHeight / 2);
|
17916 | var left = event.pageX - 10;
|
17917 | var eDocument = this.gridOptionsService.getDocument();
|
17918 | var win = (eDocument.defaultView || window);
|
17919 | var windowScrollY = win.pageYOffset || eDocument.documentElement.scrollTop;
|
17920 | var windowScrollX = win.pageXOffset || eDocument.documentElement.scrollLeft;
|
17921 |
|
17922 | if (browserWidth > 0 && ((left + ghost.clientWidth) > (browserWidth + windowScrollX))) {
|
17923 | left = browserWidth + windowScrollX - ghost.clientWidth;
|
17924 | }
|
17925 | if (left < 0) {
|
17926 | left = 0;
|
17927 | }
|
17928 | if (browserHeight > 0 && ((top + ghost.clientHeight) > (browserHeight + windowScrollY))) {
|
17929 | top = browserHeight + windowScrollY - ghost.clientHeight;
|
17930 | }
|
17931 | if (top < 0) {
|
17932 | top = 0;
|
17933 | }
|
17934 | ghost.style.left = left + "px";
|
17935 | ghost.style.top = top + "px";
|
17936 | };
|
17937 | DragAndDropService.prototype.removeGhost = function () {
|
17938 | if (this.eGhost && this.eGhostParent) {
|
17939 | this.eGhostParent.removeChild(this.eGhost);
|
17940 | }
|
17941 | this.eGhost = null;
|
17942 | };
|
17943 | DragAndDropService.prototype.createGhost = function () {
|
17944 | this.eGhost = loadTemplate(DragAndDropService_1.GHOST_TEMPLATE);
|
17945 | this.mouseEventService.stampTopLevelGridCompWithGridInstance(this.eGhost);
|
17946 | var theme = this.environment.getTheme().theme;
|
17947 | if (theme) {
|
17948 | this.eGhost.classList.add(theme);
|
17949 | }
|
17950 | this.eGhostIcon = this.eGhost.querySelector('.ag-dnd-ghost-icon');
|
17951 | this.setGhostIcon(null);
|
17952 | var eText = this.eGhost.querySelector('.ag-dnd-ghost-label');
|
17953 | var dragItemName = this.dragSource.dragItemName;
|
17954 | if (isFunction(dragItemName)) {
|
17955 | dragItemName = dragItemName();
|
17956 | }
|
17957 | eText.innerHTML = escapeString(dragItemName) || '';
|
17958 | this.eGhost.style.height = '25px';
|
17959 | this.eGhost.style.top = '20px';
|
17960 | this.eGhost.style.left = '20px';
|
17961 | var eDocument = this.gridOptionsService.getDocument();
|
17962 | var targetEl = null;
|
17963 | try {
|
17964 | targetEl = eDocument.fullscreenElement;
|
17965 | }
|
17966 | catch (e) {
|
17967 |
|
17968 |
|
17969 | }
|
17970 | finally {
|
17971 | if (!targetEl) {
|
17972 | var rootNode = this.gridOptionsService.getRootNode();
|
17973 | var body = rootNode.querySelector('body');
|
17974 | if (body) {
|
17975 | targetEl = body;
|
17976 | }
|
17977 | else if (rootNode instanceof ShadowRoot) {
|
17978 | targetEl = rootNode;
|
17979 | }
|
17980 | else {
|
17981 | targetEl = rootNode === null || rootNode === void 0 ? void 0 : rootNode.documentElement;
|
17982 | }
|
17983 | }
|
17984 | }
|
17985 | this.eGhostParent = targetEl;
|
17986 | if (!this.eGhostParent) {
|
17987 | console.warn('AG Grid: could not find document body, it is needed for dragging columns');
|
17988 | }
|
17989 | else {
|
17990 | this.eGhostParent.appendChild(this.eGhost);
|
17991 | }
|
17992 | };
|
17993 | DragAndDropService.prototype.setGhostIcon = function (iconName, shake) {
|
17994 | if (shake === void 0) { shake = false; }
|
17995 | clearElement(this.eGhostIcon);
|
17996 | var eIcon = null;
|
17997 | if (!iconName) {
|
17998 | iconName = this.dragSource.defaultIconName || DragAndDropService_1.ICON_NOT_ALLOWED;
|
17999 | }
|
18000 | switch (iconName) {
|
18001 | case DragAndDropService_1.ICON_PINNED:
|
18002 | eIcon = this.ePinnedIcon;
|
18003 | break;
|
18004 | case DragAndDropService_1.ICON_MOVE:
|
18005 | eIcon = this.eMoveIcon;
|
18006 | break;
|
18007 | case DragAndDropService_1.ICON_LEFT:
|
18008 | eIcon = this.eLeftIcon;
|
18009 | break;
|
18010 | case DragAndDropService_1.ICON_RIGHT:
|
18011 | eIcon = this.eRightIcon;
|
18012 | break;
|
18013 | case DragAndDropService_1.ICON_GROUP:
|
18014 | eIcon = this.eGroupIcon;
|
18015 | break;
|
18016 | case DragAndDropService_1.ICON_AGGREGATE:
|
18017 | eIcon = this.eAggregateIcon;
|
18018 | break;
|
18019 | case DragAndDropService_1.ICON_PIVOT:
|
18020 | eIcon = this.ePivotIcon;
|
18021 | break;
|
18022 | case DragAndDropService_1.ICON_NOT_ALLOWED:
|
18023 | eIcon = this.eDropNotAllowedIcon;
|
18024 | break;
|
18025 | case DragAndDropService_1.ICON_HIDE:
|
18026 | eIcon = this.eHideIcon;
|
18027 | break;
|
18028 | }
|
18029 | this.eGhostIcon.classList.toggle('ag-shake-left-to-right', shake);
|
18030 | if (eIcon === this.eHideIcon && this.gridOptionsService.is('suppressDragLeaveHidesColumns')) {
|
18031 | return;
|
18032 | }
|
18033 | if (eIcon) {
|
18034 | this.eGhostIcon.appendChild(eIcon);
|
18035 | }
|
18036 | };
|
18037 | var DragAndDropService_1;
|
18038 | DragAndDropService.ICON_PINNED = 'pinned';
|
18039 | DragAndDropService.ICON_MOVE = 'move';
|
18040 | DragAndDropService.ICON_LEFT = 'left';
|
18041 | DragAndDropService.ICON_RIGHT = 'right';
|
18042 | DragAndDropService.ICON_GROUP = 'group';
|
18043 | DragAndDropService.ICON_AGGREGATE = 'aggregate';
|
18044 | DragAndDropService.ICON_PIVOT = 'pivot';
|
18045 | DragAndDropService.ICON_NOT_ALLOWED = 'notAllowed';
|
18046 | DragAndDropService.ICON_HIDE = 'hide';
|
18047 | 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>";
|
18048 | __decorate$1$([
|
18049 | Autowired('dragService')
|
18050 | ], DragAndDropService.prototype, "dragService", void 0);
|
18051 | __decorate$1$([
|
18052 | Autowired('mouseEventService')
|
18053 | ], DragAndDropService.prototype, "mouseEventService", void 0);
|
18054 | __decorate$1$([
|
18055 | Autowired('columnApi')
|
18056 | ], DragAndDropService.prototype, "columnApi", void 0);
|
18057 | __decorate$1$([
|
18058 | Autowired('gridApi')
|
18059 | ], DragAndDropService.prototype, "gridApi", void 0);
|
18060 | __decorate$1$([
|
18061 | PostConstruct
|
18062 | ], DragAndDropService.prototype, "init", null);
|
18063 | __decorate$1$([
|
18064 | PreDestroy
|
18065 | ], DragAndDropService.prototype, "clearDragSourceParamsList", null);
|
18066 | DragAndDropService = DragAndDropService_1 = __decorate$1$([
|
18067 | Bean('dragAndDropService')
|
18068 | ], DragAndDropService);
|
18069 | return DragAndDropService;
|
18070 | }(BeanStub));
|
18071 |
|
18072 |
|
18073 |
|
18074 |
|
18075 |
|
18076 |
|
18077 |
|
18078 | var __extends$2a = (undefined && undefined.__extends) || (function () {
|
18079 | var extendStatics = function (d, b) {
|
18080 | extendStatics = Object.setPrototypeOf ||
|
18081 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
18082 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
18083 | return extendStatics(d, b);
|
18084 | };
|
18085 | return function (d, b) {
|
18086 | extendStatics(d, b);
|
18087 | function __() { this.constructor = d; }
|
18088 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
18089 | };
|
18090 | })();
|
18091 | var __decorate$1_ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
18092 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
18093 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
18094 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
18095 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
18096 | };
|
18097 | var RowDragComp = (function (_super) {
|
18098 | __extends$2a(RowDragComp, _super);
|
18099 | function RowDragComp(cellValueFn, rowNode, column, customGui, dragStartPixels, suppressVisibilityChange) {
|
18100 | var _this = _super.call(this) || this;
|
18101 | _this.cellValueFn = cellValueFn;
|
18102 | _this.rowNode = rowNode;
|
18103 | _this.column = column;
|
18104 | _this.customGui = customGui;
|
18105 | _this.dragStartPixels = dragStartPixels;
|
18106 | _this.suppressVisibilityChange = suppressVisibilityChange;
|
18107 | _this.dragSource = null;
|
18108 | return _this;
|
18109 | }
|
18110 | RowDragComp.prototype.isCustomGui = function () {
|
18111 | return this.customGui != null;
|
18112 | };
|
18113 | RowDragComp.prototype.postConstruct = function () {
|
18114 | if (!this.customGui) {
|
18115 | this.setTemplate( "<div class=\"ag-drag-handle ag-row-drag\" aria-hidden=\"true\"></div>");
|
18116 | this.getGui().appendChild(createIconNoSpan('rowDrag', this.beans.gridOptionsService, null));
|
18117 | this.addDragSource();
|
18118 | }
|
18119 | else {
|
18120 | this.setDragElement(this.customGui, this.dragStartPixels);
|
18121 | }
|
18122 | this.checkCompatibility();
|
18123 | if (!this.suppressVisibilityChange) {
|
18124 | var strategy = this.beans.gridOptionsService.is('rowDragManaged') ?
|
18125 | new ManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column) :
|
18126 | new NonManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column);
|
18127 | this.createManagedBean(strategy, this.beans.context);
|
18128 | }
|
18129 | };
|
18130 | RowDragComp.prototype.setDragElement = function (dragElement, dragStartPixels) {
|
18131 | this.setTemplateFromElement(dragElement);
|
18132 | this.addDragSource(dragStartPixels);
|
18133 | };
|
18134 | RowDragComp.prototype.getSelectedNodes = function () {
|
18135 | var isRowDragMultiRow = this.beans.gridOptionsService.is('rowDragMultiRow');
|
18136 | if (!isRowDragMultiRow) {
|
18137 | return [this.rowNode];
|
18138 | }
|
18139 | var selection = this.beans.selectionService.getSelectedNodes();
|
18140 | return selection.indexOf(this.rowNode) !== -1 ? selection : [this.rowNode];
|
18141 | };
|
18142 |
|
18143 | RowDragComp.prototype.checkCompatibility = function () {
|
18144 | var managed = this.beans.gridOptionsService.is('rowDragManaged');
|
18145 | var treeData = this.beans.gridOptionsService.isTreeData();
|
18146 | if (treeData && managed) {
|
18147 | doOnce(function () {
|
18148 | return console.warn('AG Grid: If using row drag with tree data, you cannot have rowDragManaged=true');
|
18149 | }, 'RowDragComp.managedAndTreeData');
|
18150 | }
|
18151 | };
|
18152 | RowDragComp.prototype.getDragItem = function () {
|
18153 | return {
|
18154 | rowNode: this.rowNode,
|
18155 | rowNodes: this.getSelectedNodes(),
|
18156 | columns: this.column ? [this.column] : undefined,
|
18157 | defaultTextValue: this.cellValueFn(),
|
18158 | };
|
18159 | };
|
18160 | RowDragComp.prototype.getRowDragText = function (column) {
|
18161 | if (column) {
|
18162 | var colDef = column.getColDef();
|
18163 | if (colDef.rowDragText) {
|
18164 | return colDef.rowDragText;
|
18165 | }
|
18166 | }
|
18167 | return this.gridOptionsService.get('rowDragText');
|
18168 | };
|
18169 | RowDragComp.prototype.addDragSource = function (dragStartPixels) {
|
18170 | var _this = this;
|
18171 | if (dragStartPixels === void 0) { dragStartPixels = 4; }
|
18172 |
|
18173 | if (this.dragSource) {
|
18174 | this.removeDragSource();
|
18175 | }
|
18176 | var rowDragText = this.getRowDragText(this.column);
|
18177 | var translate = this.localeService.getLocaleTextFunc();
|
18178 | this.dragSource = {
|
18179 | type: DragSourceType.RowDrag,
|
18180 | eElement: this.getGui(),
|
18181 | dragItemName: function () {
|
18182 | var _a;
|
18183 | var dragItem = _this.getDragItem();
|
18184 | var dragItemCount = ((_a = dragItem.rowNodes) === null || _a === void 0 ? void 0 : _a.length) || 1;
|
18185 | if (rowDragText) {
|
18186 | return rowDragText(dragItem, dragItemCount);
|
18187 | }
|
18188 | return dragItemCount === 1 ? _this.cellValueFn() : dragItemCount + " " + translate('rowDragRows', 'rows');
|
18189 | },
|
18190 | getDragItem: function () { return _this.getDragItem(); },
|
18191 | dragStartPixels: dragStartPixels,
|
18192 | dragSourceDomDataKey: this.beans.gridOptionsService.getDomDataKey()
|
18193 | };
|
18194 | this.beans.dragAndDropService.addDragSource(this.dragSource, true);
|
18195 | };
|
18196 | RowDragComp.prototype.removeDragSource = function () {
|
18197 | if (this.dragSource) {
|
18198 | this.beans.dragAndDropService.removeDragSource(this.dragSource);
|
18199 | }
|
18200 | this.dragSource = null;
|
18201 | };
|
18202 | __decorate$1_([
|
18203 | Autowired('beans')
|
18204 | ], RowDragComp.prototype, "beans", void 0);
|
18205 | __decorate$1_([
|
18206 | PostConstruct
|
18207 | ], RowDragComp.prototype, "postConstruct", null);
|
18208 | __decorate$1_([
|
18209 | PreDestroy
|
18210 | ], RowDragComp.prototype, "removeDragSource", null);
|
18211 | return RowDragComp;
|
18212 | }(Component));
|
18213 | var VisibilityStrategy = (function (_super) {
|
18214 | __extends$2a(VisibilityStrategy, _super);
|
18215 | function VisibilityStrategy(parent, rowNode, column) {
|
18216 | var _this = _super.call(this) || this;
|
18217 | _this.parent = parent;
|
18218 | _this.rowNode = rowNode;
|
18219 | _this.column = column;
|
18220 | return _this;
|
18221 | }
|
18222 | VisibilityStrategy.prototype.setDisplayedOrVisible = function (neverDisplayed) {
|
18223 | var displayedOptions = { skipAriaHidden: true };
|
18224 | if (neverDisplayed) {
|
18225 | this.parent.setDisplayed(false, displayedOptions);
|
18226 | }
|
18227 | else {
|
18228 | var shown = true;
|
18229 | var isShownSometimes = false;
|
18230 | if (this.column) {
|
18231 | shown = this.column.isRowDrag(this.rowNode) || this.parent.isCustomGui();
|
18232 | isShownSometimes = isFunction(this.column.getColDef().rowDrag);
|
18233 | }
|
18234 |
|
18235 |
|
18236 |
|
18237 | if (isShownSometimes) {
|
18238 | this.parent.setDisplayed(true, displayedOptions);
|
18239 | this.parent.setVisible(shown, displayedOptions);
|
18240 | }
|
18241 | else {
|
18242 | this.parent.setDisplayed(shown, displayedOptions);
|
18243 | this.parent.setVisible(true, displayedOptions);
|
18244 | }
|
18245 | }
|
18246 | };
|
18247 | return VisibilityStrategy;
|
18248 | }(BeanStub));
|
18249 |
|
18250 | var NonManagedVisibilityStrategy = (function (_super) {
|
18251 | __extends$2a(NonManagedVisibilityStrategy, _super);
|
18252 | function NonManagedVisibilityStrategy(parent, beans, rowNode, column) {
|
18253 | var _this = _super.call(this, parent, rowNode, column) || this;
|
18254 | _this.beans = beans;
|
18255 | return _this;
|
18256 | }
|
18257 | NonManagedVisibilityStrategy.prototype.postConstruct = function () {
|
18258 | this.addManagedPropertyListener('suppressRowDrag', this.onSuppressRowDrag.bind(this));
|
18259 |
|
18260 | this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));
|
18261 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
|
18262 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
|
18263 | this.addManagedListener(this.beans.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.workOutVisibility.bind(this));
|
18264 | this.workOutVisibility();
|
18265 | };
|
18266 | NonManagedVisibilityStrategy.prototype.onSuppressRowDrag = function () {
|
18267 | this.workOutVisibility();
|
18268 | };
|
18269 | NonManagedVisibilityStrategy.prototype.workOutVisibility = function () {
|
18270 |
|
18271 | var neverDisplayed = this.beans.gridOptionsService.is('suppressRowDrag');
|
18272 | this.setDisplayedOrVisible(neverDisplayed);
|
18273 | };
|
18274 | __decorate$1_([
|
18275 | PostConstruct
|
18276 | ], NonManagedVisibilityStrategy.prototype, "postConstruct", null);
|
18277 | return NonManagedVisibilityStrategy;
|
18278 | }(VisibilityStrategy));
|
18279 |
|
18280 | var ManagedVisibilityStrategy = (function (_super) {
|
18281 | __extends$2a(ManagedVisibilityStrategy, _super);
|
18282 | function ManagedVisibilityStrategy(parent, beans, rowNode, column) {
|
18283 | var _this = _super.call(this, parent, rowNode, column) || this;
|
18284 | _this.beans = beans;
|
18285 | return _this;
|
18286 | }
|
18287 | ManagedVisibilityStrategy.prototype.postConstruct = function () {
|
18288 |
|
18289 | this.addManagedListener(this.beans.eventService, Events.EVENT_SORT_CHANGED, this.workOutVisibility.bind(this));
|
18290 | this.addManagedListener(this.beans.eventService, Events.EVENT_FILTER_CHANGED, this.workOutVisibility.bind(this));
|
18291 | this.addManagedListener(this.beans.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.workOutVisibility.bind(this));
|
18292 | this.addManagedListener(this.beans.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.workOutVisibility.bind(this));
|
18293 |
|
18294 | this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));
|
18295 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
|
18296 | this.addManagedPropertyListener('suppressRowDrag', this.onSuppressRowDrag.bind(this));
|
18297 | this.workOutVisibility();
|
18298 | };
|
18299 | ManagedVisibilityStrategy.prototype.onSuppressRowDrag = function () {
|
18300 | this.workOutVisibility();
|
18301 | };
|
18302 | ManagedVisibilityStrategy.prototype.workOutVisibility = function () {
|
18303 |
|
18304 | var gridBodyCon = this.beans.ctrlsService.getGridBodyCtrl();
|
18305 | var rowDragFeature = gridBodyCon.getRowDragFeature();
|
18306 | var shouldPreventRowMove = rowDragFeature && rowDragFeature.shouldPreventRowMove();
|
18307 | var suppressRowDrag = this.beans.gridOptionsService.is('suppressRowDrag');
|
18308 | var hasExternalDropZones = this.beans.dragAndDropService.hasExternalDropZones();
|
18309 | var neverDisplayed = (shouldPreventRowMove && !hasExternalDropZones) || suppressRowDrag;
|
18310 | this.setDisplayedOrVisible(neverDisplayed);
|
18311 | };
|
18312 | __decorate$1_([
|
18313 | PostConstruct
|
18314 | ], ManagedVisibilityStrategy.prototype, "postConstruct", null);
|
18315 | return ManagedVisibilityStrategy;
|
18316 | }(VisibilityStrategy));
|
18317 |
|
18318 |
|
18319 |
|
18320 |
|
18321 |
|
18322 |
|
18323 |
|
18324 | var __extends$29 = (undefined && undefined.__extends) || (function () {
|
18325 | var extendStatics = function (d, b) {
|
18326 | extendStatics = Object.setPrototypeOf ||
|
18327 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
18328 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
18329 | return extendStatics(d, b);
|
18330 | };
|
18331 | return function (d, b) {
|
18332 | extendStatics(d, b);
|
18333 | function __() { this.constructor = d; }
|
18334 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
18335 | };
|
18336 | })();
|
18337 | var __assign$c = (undefined && undefined.__assign) || function () {
|
18338 | __assign$c = Object.assign || function(t) {
|
18339 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
18340 | s = arguments[i];
|
18341 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
18342 | t[p] = s[p];
|
18343 | }
|
18344 | return t;
|
18345 | };
|
18346 | return __assign$c.apply(this, arguments);
|
18347 | };
|
18348 | var __decorate$1Z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
18349 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
18350 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
18351 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
18352 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
18353 | };
|
18354 | var GroupCellRendererCtrl = (function (_super) {
|
18355 | __extends$29(GroupCellRendererCtrl, _super);
|
18356 | function GroupCellRendererCtrl() {
|
18357 | return _super !== null && _super.apply(this, arguments) || this;
|
18358 | }
|
18359 | GroupCellRendererCtrl.prototype.init = function (comp, eGui, eCheckbox, eExpanded, eContracted, compClass, params) {
|
18360 | this.params = params;
|
18361 | this.eGui = eGui;
|
18362 | this.eCheckbox = eCheckbox;
|
18363 | this.eExpanded = eExpanded;
|
18364 | this.eContracted = eContracted;
|
18365 | this.comp = comp;
|
18366 | this.compClass = compClass;
|
18367 | var topLevelFooter = this.isTopLevelFooter();
|
18368 | var embeddedRowMismatch = this.isEmbeddedRowMismatch();
|
18369 |
|
18370 |
|
18371 | var isNullValueAndNotMaster = params.value == null && !params.node.master;
|
18372 | var skipCell = false;
|
18373 |
|
18374 |
|
18375 | if (this.gridOptionsService.is('groupIncludeFooter') && this.gridOptionsService.is('groupHideOpenParents')) {
|
18376 | var node = params.node;
|
18377 | if (node.footer) {
|
18378 | var showRowGroup = params.colDef && params.colDef.showRowGroup;
|
18379 | var rowGroupColumnId = node.rowGroupColumn && node.rowGroupColumn.getColId();
|
18380 | skipCell = showRowGroup !== rowGroupColumnId;
|
18381 | }
|
18382 | }
|
18383 | this.cellIsBlank = topLevelFooter ? false : (embeddedRowMismatch || (isNullValueAndNotMaster && !params.node.master) || skipCell);
|
18384 | if (this.cellIsBlank) {
|
18385 | return;
|
18386 | }
|
18387 | this.setupShowingValueForOpenedParent();
|
18388 | this.findDisplayedGroupNode();
|
18389 | this.addFullWidthRowDraggerIfNeeded();
|
18390 | this.addExpandAndContract();
|
18391 | this.addCheckboxIfNeeded();
|
18392 | this.addValueElement();
|
18393 | this.setupIndent();
|
18394 | this.refreshAriaExpanded();
|
18395 | };
|
18396 | GroupCellRendererCtrl.prototype.destroy = function () {
|
18397 | _super.prototype.destroy.call(this);
|
18398 |
|
18399 | this.expandListener = null;
|
18400 | };
|
18401 | GroupCellRendererCtrl.prototype.refreshAriaExpanded = function () {
|
18402 | var _a = this.params, node = _a.node, eParentOfValue = _a.eParentOfValue;
|
18403 | if (this.expandListener) {
|
18404 | this.expandListener = this.expandListener();
|
18405 | }
|
18406 | if (!this.isExpandable()) {
|
18407 | removeAriaExpanded(eParentOfValue);
|
18408 | return;
|
18409 | }
|
18410 | var listener = function () {
|
18411 |
|
18412 | setAriaExpanded(eParentOfValue, !!node.expanded);
|
18413 | };
|
18414 | this.expandListener = this.addManagedListener(node, RowNode.EVENT_EXPANDED_CHANGED, listener) || null;
|
18415 | listener();
|
18416 | };
|
18417 | GroupCellRendererCtrl.prototype.isTopLevelFooter = function () {
|
18418 | if (!this.gridOptionsService.is('groupIncludeTotalFooter')) {
|
18419 | return false;
|
18420 | }
|
18421 | if (this.params.value != null || this.params.node.level != -1) {
|
18422 | return false;
|
18423 | }
|
18424 |
|
18425 |
|
18426 |
|
18427 | var colDef = this.params.colDef;
|
18428 | var doingFullWidth = colDef == null;
|
18429 | if (doingFullWidth) {
|
18430 | return true;
|
18431 | }
|
18432 | if (colDef.showRowGroup === true) {
|
18433 | return true;
|
18434 | }
|
18435 | var rowGroupCols = this.columnModel.getRowGroupColumns();
|
18436 |
|
18437 | if (!rowGroupCols || rowGroupCols.length === 0) {
|
18438 | return true;
|
18439 | }
|
18440 | var firstRowGroupCol = rowGroupCols[0];
|
18441 | return firstRowGroupCol.getId() === colDef.showRowGroup;
|
18442 | };
|
18443 |
|
18444 |
|
18445 |
|
18446 | GroupCellRendererCtrl.prototype.isEmbeddedRowMismatch = function () {
|
18447 | if (!this.params.fullWidth || !this.gridOptionsService.is('embedFullWidthRows')) {
|
18448 | return false;
|
18449 | }
|
18450 | var pinnedLeftCell = this.params.pinned === 'left';
|
18451 | var pinnedRightCell = this.params.pinned === 'right';
|
18452 | var bodyCell = !pinnedLeftCell && !pinnedRightCell;
|
18453 | if (this.gridOptionsService.is('enableRtl')) {
|
18454 | if (this.columnModel.isPinningLeft()) {
|
18455 | return !pinnedRightCell;
|
18456 | }
|
18457 | return !bodyCell;
|
18458 | }
|
18459 | if (this.columnModel.isPinningLeft()) {
|
18460 | return !pinnedLeftCell;
|
18461 | }
|
18462 | return !bodyCell;
|
18463 | };
|
18464 | GroupCellRendererCtrl.prototype.findDisplayedGroupNode = function () {
|
18465 | var column = this.params.column;
|
18466 | var rowNode = this.params.node;
|
18467 | if (this.showingValueForOpenedParent) {
|
18468 | var pointer = rowNode.parent;
|
18469 | while (pointer != null) {
|
18470 | if (pointer.rowGroupColumn && column.isRowGroupDisplayed(pointer.rowGroupColumn.getId())) {
|
18471 | this.displayedGroupNode = pointer;
|
18472 | break;
|
18473 | }
|
18474 | pointer = pointer.parent;
|
18475 | }
|
18476 | }
|
18477 |
|
18478 | if (missing(this.displayedGroupNode)) {
|
18479 | this.displayedGroupNode = rowNode;
|
18480 | }
|
18481 | };
|
18482 | GroupCellRendererCtrl.prototype.setupShowingValueForOpenedParent = function () {
|
18483 |
|
18484 |
|
18485 | var rowNode = this.params.node;
|
18486 | var column = this.params.column;
|
18487 | if (!this.gridOptionsService.is('groupHideOpenParents')) {
|
18488 | this.showingValueForOpenedParent = false;
|
18489 | return;
|
18490 | }
|
18491 |
|
18492 |
|
18493 |
|
18494 | if (!rowNode.groupData) {
|
18495 | this.showingValueForOpenedParent = false;
|
18496 | return;
|
18497 | }
|
18498 |
|
18499 |
|
18500 | var showingGroupNode = rowNode.rowGroupColumn != null;
|
18501 | if (showingGroupNode) {
|
18502 | var keyOfGroupingColumn = rowNode.rowGroupColumn.getId();
|
18503 | var configuredToShowThisGroupLevel = column.isRowGroupDisplayed(keyOfGroupingColumn);
|
18504 |
|
18505 | if (configuredToShowThisGroupLevel) {
|
18506 | this.showingValueForOpenedParent = false;
|
18507 | return;
|
18508 | }
|
18509 | }
|
18510 |
|
18511 |
|
18512 | var valPresent = rowNode.groupData[column.getId()] != null;
|
18513 | this.showingValueForOpenedParent = valPresent;
|
18514 | };
|
18515 | GroupCellRendererCtrl.prototype.addValueElement = function () {
|
18516 | if (this.displayedGroupNode.footer) {
|
18517 | this.addFooterValue();
|
18518 | }
|
18519 | else {
|
18520 | this.addGroupValue();
|
18521 | this.addChildCount();
|
18522 | }
|
18523 | };
|
18524 | GroupCellRendererCtrl.prototype.addGroupValue = function () {
|
18525 |
|
18526 | var paramsAdjusted = this.adjustParamsWithDetailsFromRelatedColumn();
|
18527 | var innerCompDetails = this.getInnerCompDetails(paramsAdjusted);
|
18528 | var valueFormatted = paramsAdjusted.valueFormatted, value = paramsAdjusted.value;
|
18529 | var valueWhenNoRenderer = valueFormatted;
|
18530 | if (valueWhenNoRenderer == null) {
|
18531 | if (value === '' && this.params.node.group) {
|
18532 | var localeTextFunc = this.localeService.getLocaleTextFunc();
|
18533 | valueWhenNoRenderer = localeTextFunc('blanks', '(Blanks)');
|
18534 | }
|
18535 | else {
|
18536 | valueWhenNoRenderer = value !== null && value !== void 0 ? value : null;
|
18537 | }
|
18538 | }
|
18539 | this.comp.setInnerRenderer(innerCompDetails, valueWhenNoRenderer);
|
18540 | };
|
18541 | GroupCellRendererCtrl.prototype.adjustParamsWithDetailsFromRelatedColumn = function () {
|
18542 | var relatedColumn = this.displayedGroupNode.rowGroupColumn;
|
18543 | var column = this.params.column;
|
18544 | if (!relatedColumn) {
|
18545 | return this.params;
|
18546 | }
|
18547 | var notFullWidth = column != null;
|
18548 | if (notFullWidth) {
|
18549 | var showingThisRowGroup = column.isRowGroupDisplayed(relatedColumn.getId());
|
18550 | if (!showingThisRowGroup) {
|
18551 | return this.params;
|
18552 | }
|
18553 | }
|
18554 | var params = this.params;
|
18555 | var _a = this.params, value = _a.value, node = _a.node;
|
18556 | var valueFormatted = this.valueFormatterService.formatValue(relatedColumn, node, value);
|
18557 |
|
18558 |
|
18559 |
|
18560 | var paramsAdjusted = __assign$c(__assign$c({}, params), { valueFormatted: valueFormatted });
|
18561 | return paramsAdjusted;
|
18562 | };
|
18563 | GroupCellRendererCtrl.prototype.addFooterValue = function () {
|
18564 | var footerValueGetter = this.params.footerValueGetter;
|
18565 | var footerValue = '';
|
18566 | if (footerValueGetter) {
|
18567 |
|
18568 | var paramsClone = cloneObject(this.params);
|
18569 | paramsClone.value = this.params.value;
|
18570 | if (typeof footerValueGetter === 'function') {
|
18571 | footerValue = footerValueGetter(paramsClone);
|
18572 | }
|
18573 | else if (typeof footerValueGetter === 'string') {
|
18574 | footerValue = this.expressionService.evaluate(footerValueGetter, paramsClone);
|
18575 | }
|
18576 | else {
|
18577 | console.warn('AG Grid: footerValueGetter should be either a function or a string (expression)');
|
18578 | }
|
18579 | }
|
18580 | else {
|
18581 | footerValue = 'Total ' + (this.params.value != null ? this.params.value : '');
|
18582 | }
|
18583 | var innerCompDetails = this.getInnerCompDetails(this.params);
|
18584 | this.comp.setInnerRenderer(innerCompDetails, footerValue);
|
18585 | };
|
18586 | GroupCellRendererCtrl.prototype.getInnerCompDetails = function (params) {
|
18587 | var _this = this;
|
18588 |
|
18589 | if (params.fullWidth) {
|
18590 | return this.userComponentFactory.getFullWidthGroupRowInnerCellRenderer(this.gridOptionsService.get('groupRowRendererParams'), params);
|
18591 | }
|
18592 |
|
18593 |
|
18594 |
|
18595 |
|
18596 |
|
18597 |
|
18598 |
|
18599 |
|
18600 |
|
18601 |
|
18602 |
|
18603 |
|
18604 |
|
18605 | var innerCompDetails = this.userComponentFactory
|
18606 | .getInnerRendererDetails(params, params);
|
18607 |
|
18608 |
|
18609 | var isGroupRowRenderer = function (details) { return details && details.componentClass == _this.compClass; };
|
18610 | if (innerCompDetails && !isGroupRowRenderer(innerCompDetails)) {
|
18611 |
|
18612 | return innerCompDetails;
|
18613 | }
|
18614 | var relatedColumn = this.displayedGroupNode.rowGroupColumn;
|
18615 | var relatedColDef = relatedColumn ? relatedColumn.getColDef() : undefined;
|
18616 | if (!relatedColDef) {
|
18617 | return;
|
18618 | }
|
18619 |
|
18620 | var relatedCompDetails = this.userComponentFactory
|
18621 | .getCellRendererDetails(relatedColDef, params);
|
18622 | if (relatedCompDetails && !isGroupRowRenderer(relatedCompDetails)) {
|
18623 |
|
18624 | return relatedCompDetails;
|
18625 | }
|
18626 | if (isGroupRowRenderer(relatedCompDetails) &&
|
18627 | relatedColDef.cellRendererParams &&
|
18628 | relatedColDef.cellRendererParams.innerRenderer) {
|
18629 |
|
18630 |
|
18631 | var res = this.userComponentFactory.getInnerRendererDetails(relatedColDef.cellRendererParams, params);
|
18632 | return res;
|
18633 | }
|
18634 | };
|
18635 | GroupCellRendererCtrl.prototype.addChildCount = function () {
|
18636 |
|
18637 |
|
18638 | if (this.params.suppressCount) {
|
18639 | return;
|
18640 | }
|
18641 | this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED, this.updateChildCount.bind(this));
|
18642 |
|
18643 | this.updateChildCount();
|
18644 | };
|
18645 | GroupCellRendererCtrl.prototype.updateChildCount = function () {
|
18646 | var allChildrenCount = this.displayedGroupNode.allChildrenCount;
|
18647 | var showingGroupForThisNode = this.isShowRowGroupForThisRow();
|
18648 | var showCount = showingGroupForThisNode && allChildrenCount != null && allChildrenCount >= 0;
|
18649 | var countString = showCount ? "(" + allChildrenCount + ")" : "";
|
18650 | this.comp.setChildCount(countString);
|
18651 | };
|
18652 | GroupCellRendererCtrl.prototype.isShowRowGroupForThisRow = function () {
|
18653 | if (this.gridOptionsService.isTreeData()) {
|
18654 | return true;
|
18655 | }
|
18656 | var rowGroupColumn = this.displayedGroupNode.rowGroupColumn;
|
18657 | if (!rowGroupColumn) {
|
18658 | return false;
|
18659 | }
|
18660 |
|
18661 | var column = this.params.column;
|
18662 | var thisColumnIsInterested = column == null || column.isRowGroupDisplayed(rowGroupColumn.getId());
|
18663 | return thisColumnIsInterested;
|
18664 | };
|
18665 | GroupCellRendererCtrl.prototype.addExpandAndContract = function () {
|
18666 | var params = this.params;
|
18667 | var eExpandedIcon = createIconNoSpan('groupExpanded', this.gridOptionsService, null);
|
18668 | var eContractedIcon = createIconNoSpan('groupContracted', this.gridOptionsService, null);
|
18669 | if (eExpandedIcon) {
|
18670 | this.eExpanded.appendChild(eExpandedIcon);
|
18671 | }
|
18672 | if (eContractedIcon) {
|
18673 | this.eContracted.appendChild(eContractedIcon);
|
18674 | }
|
18675 | var eGroupCell = params.eGridCell;
|
18676 |
|
18677 | if (!this.gridOptionsService.is('enableGroupEdit') && this.isExpandable() && !params.suppressDoubleClickExpand) {
|
18678 | this.addManagedListener(eGroupCell, 'dblclick', this.onCellDblClicked.bind(this));
|
18679 | }
|
18680 | this.addManagedListener(this.eExpanded, 'click', this.onExpandClicked.bind(this));
|
18681 | this.addManagedListener(this.eContracted, 'click', this.onExpandClicked.bind(this));
|
18682 |
|
18683 | this.addManagedListener(eGroupCell, 'keydown', this.onKeyDown.bind(this));
|
18684 | this.addManagedListener(params.node, RowNode.EVENT_EXPANDED_CHANGED, this.showExpandAndContractIcons.bind(this));
|
18685 | this.showExpandAndContractIcons();
|
18686 |
|
18687 |
|
18688 | var expandableChangedListener = this.onRowNodeIsExpandableChanged.bind(this);
|
18689 | this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED, expandableChangedListener);
|
18690 | this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_MASTER_CHANGED, expandableChangedListener);
|
18691 | this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_GROUP_CHANGED, expandableChangedListener);
|
18692 | this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_HAS_CHILDREN_CHANGED, expandableChangedListener);
|
18693 | };
|
18694 | GroupCellRendererCtrl.prototype.onExpandClicked = function (mouseEvent) {
|
18695 | if (isStopPropagationForAgGrid(mouseEvent)) {
|
18696 | return;
|
18697 | }
|
18698 |
|
18699 | stopPropagationForAgGrid(mouseEvent);
|
18700 | this.onExpandOrContract(mouseEvent);
|
18701 | };
|
18702 | GroupCellRendererCtrl.prototype.onExpandOrContract = function (e) {
|
18703 |
|
18704 | var rowNode = this.displayedGroupNode;
|
18705 | var nextExpandState = !rowNode.expanded;
|
18706 | if (!nextExpandState && rowNode.sticky) {
|
18707 | this.scrollToStickyNode(rowNode);
|
18708 | }
|
18709 | rowNode.setExpanded(nextExpandState, e);
|
18710 | };
|
18711 | GroupCellRendererCtrl.prototype.scrollToStickyNode = function (rowNode) {
|
18712 | var gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();
|
18713 | var scrollFeature = gridBodyCtrl.getScrollFeature();
|
18714 | scrollFeature.setVerticalScrollPosition(rowNode.rowTop - rowNode.stickyRowTop);
|
18715 | };
|
18716 | GroupCellRendererCtrl.prototype.isExpandable = function () {
|
18717 | if (this.showingValueForOpenedParent) {
|
18718 | return true;
|
18719 | }
|
18720 | var rowNode = this.displayedGroupNode;
|
18721 | var reducedLeafNode = this.columnModel.isPivotMode() && rowNode.leafGroup;
|
18722 | var expandableGroup = rowNode.isExpandable() && !rowNode.footer && !reducedLeafNode;
|
18723 | if (!expandableGroup) {
|
18724 | return false;
|
18725 | }
|
18726 |
|
18727 | var column = this.params.column;
|
18728 | var displayingForOneColumnOnly = column != null && typeof column.getColDef().showRowGroup === 'string';
|
18729 | if (displayingForOneColumnOnly) {
|
18730 | var showing = this.isShowRowGroupForThisRow();
|
18731 | return showing;
|
18732 | }
|
18733 | return true;
|
18734 | };
|
18735 | GroupCellRendererCtrl.prototype.showExpandAndContractIcons = function () {
|
18736 | var _a = this, params = _a.params, displayedGroup = _a.displayedGroupNode, columnModel = _a.columnModel;
|
18737 | var node = params.node;
|
18738 | var isExpandable = this.isExpandable();
|
18739 | if (isExpandable) {
|
18740 |
|
18741 |
|
18742 | var expanded = this.showingValueForOpenedParent ? true : node.expanded;
|
18743 | this.comp.setExpandedDisplayed(expanded);
|
18744 | this.comp.setContractedDisplayed(!expanded);
|
18745 | }
|
18746 | else {
|
18747 |
|
18748 | this.comp.setExpandedDisplayed(false);
|
18749 | this.comp.setContractedDisplayed(false);
|
18750 | }
|
18751 |
|
18752 | var pivotMode = columnModel.isPivotMode();
|
18753 | var pivotModeAndLeafGroup = pivotMode && displayedGroup.leafGroup;
|
18754 | var addExpandableCss = isExpandable && !pivotModeAndLeafGroup;
|
18755 | var isTotalFooterNode = node.footer && node.level === -1;
|
18756 | this.comp.addOrRemoveCssClass('ag-cell-expandable', addExpandableCss);
|
18757 | this.comp.addOrRemoveCssClass('ag-row-group', addExpandableCss);
|
18758 | if (pivotMode) {
|
18759 | this.comp.addOrRemoveCssClass('ag-pivot-leaf-group', pivotModeAndLeafGroup);
|
18760 | }
|
18761 | else if (!isTotalFooterNode) {
|
18762 | this.comp.addOrRemoveCssClass('ag-row-group-leaf-indent', !addExpandableCss);
|
18763 | }
|
18764 | };
|
18765 | GroupCellRendererCtrl.prototype.onRowNodeIsExpandableChanged = function () {
|
18766 |
|
18767 | this.showExpandAndContractIcons();
|
18768 |
|
18769 | this.setIndent();
|
18770 | this.refreshAriaExpanded();
|
18771 | };
|
18772 | GroupCellRendererCtrl.prototype.setupIndent = function () {
|
18773 |
|
18774 |
|
18775 |
|
18776 | var node = this.params.node;
|
18777 | var suppressPadding = this.params.suppressPadding;
|
18778 | if (!suppressPadding) {
|
18779 | this.addManagedListener(node, RowNode.EVENT_UI_LEVEL_CHANGED, this.setIndent.bind(this));
|
18780 | this.setIndent();
|
18781 | }
|
18782 | };
|
18783 | GroupCellRendererCtrl.prototype.setIndent = function () {
|
18784 | if (this.gridOptionsService.is('groupHideOpenParents')) {
|
18785 | return;
|
18786 | }
|
18787 | var params = this.params;
|
18788 | var rowNode = params.node;
|
18789 |
|
18790 | var fullWithRow = !!params.colDef;
|
18791 | var treeData = this.gridOptionsService.isTreeData();
|
18792 | var manyDimensionThisColumn = !fullWithRow || treeData || params.colDef.showRowGroup === true;
|
18793 | var paddingCount = manyDimensionThisColumn ? rowNode.uiLevel : 0;
|
18794 | if (this.indentClass) {
|
18795 | this.comp.addOrRemoveCssClass(this.indentClass, false);
|
18796 | }
|
18797 | this.indentClass = 'ag-row-group-indent-' + paddingCount;
|
18798 | this.comp.addOrRemoveCssClass(this.indentClass, true);
|
18799 | };
|
18800 | GroupCellRendererCtrl.prototype.addFullWidthRowDraggerIfNeeded = function () {
|
18801 | var _this = this;
|
18802 | if (!this.params.fullWidth || !this.params.rowDrag) {
|
18803 | return;
|
18804 | }
|
18805 | var rowDragComp = new RowDragComp(function () { return _this.params.value; }, this.params.node);
|
18806 | this.createManagedBean(rowDragComp, this.context);
|
18807 | this.eGui.insertAdjacentElement('afterbegin', rowDragComp.getGui());
|
18808 | };
|
18809 | GroupCellRendererCtrl.prototype.isUserWantsSelected = function () {
|
18810 | var paramsCheckbox = this.params.checkbox;
|
18811 |
|
18812 | return typeof paramsCheckbox === 'function' || paramsCheckbox === true;
|
18813 | };
|
18814 | GroupCellRendererCtrl.prototype.addCheckboxIfNeeded = function () {
|
18815 | var _this = this;
|
18816 | var rowNode = this.displayedGroupNode;
|
18817 | var checkboxNeeded = this.isUserWantsSelected() &&
|
18818 |
|
18819 | !rowNode.footer &&
|
18820 |
|
18821 | !rowNode.rowPinned &&
|
18822 |
|
18823 | !rowNode.detail;
|
18824 | if (checkboxNeeded) {
|
18825 | var cbSelectionComponent_1 = new CheckboxSelectionComponent();
|
18826 | this.getContext().createBean(cbSelectionComponent_1);
|
18827 | cbSelectionComponent_1.init({
|
18828 | rowNode: rowNode,
|
18829 | column: this.params.column,
|
18830 | overrides: {
|
18831 | isVisible: this.params.checkbox,
|
18832 | callbackParams: this.params,
|
18833 | removeHidden: true,
|
18834 | },
|
18835 | });
|
18836 | this.eCheckbox.appendChild(cbSelectionComponent_1.getGui());
|
18837 | this.addDestroyFunc(function () { return _this.getContext().destroyBean(cbSelectionComponent_1); });
|
18838 | }
|
18839 | this.comp.setCheckboxVisible(checkboxNeeded);
|
18840 | };
|
18841 | GroupCellRendererCtrl.prototype.onKeyDown = function (event) {
|
18842 | var enterKeyPressed = event.key === KeyCode.ENTER;
|
18843 | if (!enterKeyPressed || this.params.suppressEnterExpand) {
|
18844 | return;
|
18845 | }
|
18846 | var cellEditable = this.params.column && this.params.column.isCellEditable(this.params.node);
|
18847 | if (cellEditable) {
|
18848 | return;
|
18849 | }
|
18850 | this.onExpandOrContract(event);
|
18851 | };
|
18852 | GroupCellRendererCtrl.prototype.onCellDblClicked = function (mouseEvent) {
|
18853 | if (isStopPropagationForAgGrid(mouseEvent)) {
|
18854 | return;
|
18855 | }
|
18856 |
|
18857 |
|
18858 |
|
18859 |
|
18860 | var targetIsExpandIcon = isElementInEventPath(this.eExpanded, mouseEvent)
|
18861 | || isElementInEventPath(this.eContracted, mouseEvent);
|
18862 | if (!targetIsExpandIcon) {
|
18863 | this.onExpandOrContract(mouseEvent);
|
18864 | }
|
18865 | };
|
18866 | __decorate$1Z([
|
18867 | Autowired('expressionService')
|
18868 | ], GroupCellRendererCtrl.prototype, "expressionService", void 0);
|
18869 | __decorate$1Z([
|
18870 | Autowired('valueFormatterService')
|
18871 | ], GroupCellRendererCtrl.prototype, "valueFormatterService", void 0);
|
18872 | __decorate$1Z([
|
18873 | Autowired('columnModel')
|
18874 | ], GroupCellRendererCtrl.prototype, "columnModel", void 0);
|
18875 | __decorate$1Z([
|
18876 | Autowired('userComponentFactory')
|
18877 | ], GroupCellRendererCtrl.prototype, "userComponentFactory", void 0);
|
18878 | __decorate$1Z([
|
18879 | Autowired("ctrlsService")
|
18880 | ], GroupCellRendererCtrl.prototype, "ctrlsService", void 0);
|
18881 | return GroupCellRendererCtrl;
|
18882 | }(BeanStub));
|
18883 |
|
18884 |
|
18885 |
|
18886 |
|
18887 |
|
18888 |
|
18889 |
|
18890 | var __extends$28 = (undefined && undefined.__extends) || (function () {
|
18891 | var extendStatics = function (d, b) {
|
18892 | extendStatics = Object.setPrototypeOf ||
|
18893 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
18894 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
18895 | return extendStatics(d, b);
|
18896 | };
|
18897 | return function (d, b) {
|
18898 | extendStatics(d, b);
|
18899 | function __() { this.constructor = d; }
|
18900 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
18901 | };
|
18902 | })();
|
18903 | var __decorate$1Y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
18904 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
18905 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
18906 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
18907 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
18908 | };
|
18909 | var GroupCellRenderer = (function (_super) {
|
18910 | __extends$28(GroupCellRenderer, _super);
|
18911 | function GroupCellRenderer() {
|
18912 | return _super.call(this, GroupCellRenderer.TEMPLATE) || this;
|
18913 | }
|
18914 | GroupCellRenderer.prototype.init = function (params) {
|
18915 | var _this = this;
|
18916 | var compProxy = {
|
18917 | setInnerRenderer: function (compDetails, valueToDisplay) { return _this.setRenderDetails(compDetails, valueToDisplay); },
|
18918 | setChildCount: function (count) { return _this.eChildCount.innerHTML = count; },
|
18919 | addOrRemoveCssClass: function (cssClass, value) { return _this.addOrRemoveCssClass(cssClass, value); },
|
18920 | setContractedDisplayed: function (expanded) { return setDisplayed(_this.eContracted, expanded); },
|
18921 | setExpandedDisplayed: function (expanded) { return setDisplayed(_this.eExpanded, expanded); },
|
18922 | setCheckboxVisible: function (visible) { return _this.eCheckbox.classList.toggle('ag-invisible', !visible); }
|
18923 | };
|
18924 | var ctrl = this.createManagedBean(new GroupCellRendererCtrl());
|
18925 | var fullWidth = !params.colDef;
|
18926 | var eGui = this.getGui();
|
18927 | ctrl.init(compProxy, eGui, this.eCheckbox, this.eExpanded, this.eContracted, this.constructor, params);
|
18928 | if (fullWidth) {
|
18929 | setAriaRole(eGui, 'gridcell');
|
18930 | }
|
18931 | };
|
18932 | GroupCellRenderer.prototype.setRenderDetails = function (compDetails, valueToDisplay) {
|
18933 | var _this = this;
|
18934 | if (compDetails) {
|
18935 | var componentPromise = compDetails.newAgStackInstance();
|
18936 | if (!componentPromise) {
|
18937 | return;
|
18938 | }
|
18939 | componentPromise.then(function (comp) {
|
18940 | if (!comp) {
|
18941 | return;
|
18942 | }
|
18943 | var destroyComp = function () { return _this.context.destroyBean(comp); };
|
18944 | if (_this.isAlive()) {
|
18945 | _this.eValue.appendChild(comp.getGui());
|
18946 | _this.addDestroyFunc(destroyComp);
|
18947 | }
|
18948 | else {
|
18949 | destroyComp();
|
18950 | }
|
18951 | });
|
18952 | }
|
18953 | else {
|
18954 | this.eValue.innerText = valueToDisplay;
|
18955 | }
|
18956 | };
|
18957 |
|
18958 |
|
18959 | GroupCellRenderer.prototype.destroy = function () {
|
18960 | this.getContext().destroyBean(this.innerCellRenderer);
|
18961 | _super.prototype.destroy.call(this);
|
18962 | };
|
18963 | GroupCellRenderer.prototype.refresh = function () {
|
18964 | return false;
|
18965 | };
|
18966 | 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>";
|
18967 | __decorate$1Y([
|
18968 | RefSelector('eExpanded')
|
18969 | ], GroupCellRenderer.prototype, "eExpanded", void 0);
|
18970 | __decorate$1Y([
|
18971 | RefSelector('eContracted')
|
18972 | ], GroupCellRenderer.prototype, "eContracted", void 0);
|
18973 | __decorate$1Y([
|
18974 | RefSelector('eCheckbox')
|
18975 | ], GroupCellRenderer.prototype, "eCheckbox", void 0);
|
18976 | __decorate$1Y([
|
18977 | RefSelector('eValue')
|
18978 | ], GroupCellRenderer.prototype, "eValue", void 0);
|
18979 | __decorate$1Y([
|
18980 | RefSelector('eChildCount')
|
18981 | ], GroupCellRenderer.prototype, "eChildCount", void 0);
|
18982 | return GroupCellRenderer;
|
18983 | }(Component));
|
18984 |
|
18985 |
|
18986 |
|
18987 |
|
18988 |
|
18989 |
|
18990 |
|
18991 | var __extends$27 = (undefined && undefined.__extends) || (function () {
|
18992 | var extendStatics = function (d, b) {
|
18993 | extendStatics = Object.setPrototypeOf ||
|
18994 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
18995 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
18996 | return extendStatics(d, b);
|
18997 | };
|
18998 | return function (d, b) {
|
18999 | extendStatics(d, b);
|
19000 | function __() { this.constructor = d; }
|
19001 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
19002 | };
|
19003 | })();
|
19004 | var __decorate$1X = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
19005 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
19006 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
19007 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
19008 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
19009 | };
|
19010 | var LoadingCellRenderer = (function (_super) {
|
19011 | __extends$27(LoadingCellRenderer, _super);
|
19012 | function LoadingCellRenderer() {
|
19013 | return _super.call(this, LoadingCellRenderer.TEMPLATE) || this;
|
19014 | }
|
19015 | LoadingCellRenderer.prototype.init = function (params) {
|
19016 | params.node.failedLoad ? this.setupFailed() : this.setupLoading();
|
19017 | };
|
19018 | LoadingCellRenderer.prototype.setupFailed = function () {
|
19019 | var localeTextFunc = this.localeService.getLocaleTextFunc();
|
19020 | this.eLoadingText.innerText = localeTextFunc('loadingError', 'ERR');
|
19021 | };
|
19022 | LoadingCellRenderer.prototype.setupLoading = function () {
|
19023 | var eLoadingIcon = createIconNoSpan('groupLoading', this.gridOptionsService, null);
|
19024 | if (eLoadingIcon) {
|
19025 | this.eLoadingIcon.appendChild(eLoadingIcon);
|
19026 | }
|
19027 | var localeTextFunc = this.localeService.getLocaleTextFunc();
|
19028 | this.eLoadingText.innerText = localeTextFunc('loadingOoo', 'Loading');
|
19029 | };
|
19030 | LoadingCellRenderer.prototype.refresh = function (params) {
|
19031 | return false;
|
19032 | };
|
19033 |
|
19034 |
|
19035 | LoadingCellRenderer.prototype.destroy = function () {
|
19036 | _super.prototype.destroy.call(this);
|
19037 | };
|
19038 | 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>";
|
19039 | __decorate$1X([
|
19040 | RefSelector('eLoadingIcon')
|
19041 | ], LoadingCellRenderer.prototype, "eLoadingIcon", void 0);
|
19042 | __decorate$1X([
|
19043 | RefSelector('eLoadingText')
|
19044 | ], LoadingCellRenderer.prototype, "eLoadingText", void 0);
|
19045 | return LoadingCellRenderer;
|
19046 | }(Component));
|
19047 |
|
19048 |
|
19049 |
|
19050 |
|
19051 |
|
19052 |
|
19053 |
|
19054 | var __extends$26 = (undefined && undefined.__extends) || (function () {
|
19055 | var extendStatics = function (d, b) {
|
19056 | extendStatics = Object.setPrototypeOf ||
|
19057 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
19058 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
19059 | return extendStatics(d, b);
|
19060 | };
|
19061 | return function (d, b) {
|
19062 | extendStatics(d, b);
|
19063 | function __() { this.constructor = d; }
|
19064 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
19065 | };
|
19066 | })();
|
19067 | var LoadingOverlayComponent$1 = (function (_super) {
|
19068 | __extends$26(LoadingOverlayComponent, _super);
|
19069 | function LoadingOverlayComponent() {
|
19070 | return _super.call(this) || this;
|
19071 | }
|
19072 |
|
19073 |
|
19074 | LoadingOverlayComponent.prototype.destroy = function () {
|
19075 | _super.prototype.destroy.call(this);
|
19076 | };
|
19077 | LoadingOverlayComponent.prototype.init = function (params) {
|
19078 | var _a;
|
19079 | var template = (_a = this.gridOptionsService.get('overlayLoadingTemplate')) !== null && _a !== void 0 ? _a : LoadingOverlayComponent.DEFAULT_LOADING_OVERLAY_TEMPLATE;
|
19080 | var localeTextFunc = this.localeService.getLocaleTextFunc();
|
19081 | var localisedTemplate = template.replace('[LOADING...]', localeTextFunc('loadingOoo', 'Loading...'));
|
19082 | this.setTemplate(localisedTemplate);
|
19083 | };
|
19084 | LoadingOverlayComponent.DEFAULT_LOADING_OVERLAY_TEMPLATE = '<span class="ag-overlay-loading-center">[LOADING...]</span>';
|
19085 | return LoadingOverlayComponent;
|
19086 | }(Component));
|
19087 |
|
19088 |
|
19089 |
|
19090 |
|
19091 |
|
19092 |
|
19093 |
|
19094 | var __extends$25 = (undefined && undefined.__extends) || (function () {
|
19095 | var extendStatics = function (d, b) {
|
19096 | extendStatics = Object.setPrototypeOf ||
|
19097 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
19098 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
19099 | return extendStatics(d, b);
|
19100 | };
|
19101 | return function (d, b) {
|
19102 | extendStatics(d, b);
|
19103 | function __() { this.constructor = d; }
|
19104 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
19105 | };
|
19106 | })();
|
19107 | var NoRowsOverlayComponent$1 = (function (_super) {
|
19108 | __extends$25(NoRowsOverlayComponent, _super);
|
19109 | function NoRowsOverlayComponent() {
|
19110 | return _super.call(this) || this;
|
19111 | }
|
19112 |
|
19113 |
|
19114 | NoRowsOverlayComponent.prototype.destroy = function () {
|
19115 | _super.prototype.destroy.call(this);
|
19116 | };
|
19117 | NoRowsOverlayComponent.prototype.init = function (params) {
|
19118 | var _a;
|
19119 | var template = (_a = this.gridOptionsService.get('overlayNoRowsTemplate')) !== null && _a !== void 0 ? _a : NoRowsOverlayComponent.DEFAULT_NO_ROWS_TEMPLATE;
|
19120 | var localeTextFunc = this.localeService.getLocaleTextFunc();
|
19121 | var localisedTemplate = template.replace('[NO_ROWS_TO_SHOW]', localeTextFunc('noRowsToShow', 'No Rows To Show'));
|
19122 | this.setTemplate(localisedTemplate);
|
19123 | };
|
19124 | NoRowsOverlayComponent.DEFAULT_NO_ROWS_TEMPLATE = '<span class="ag-overlay-no-rows-center">[NO_ROWS_TO_SHOW]</span>';
|
19125 | return NoRowsOverlayComponent;
|
19126 | }(Component));
|
19127 |
|
19128 |
|
19129 |
|
19130 |
|
19131 |
|
19132 |
|
19133 |
|
19134 | var __extends$24 = (undefined && undefined.__extends) || (function () {
|
19135 | var extendStatics = function (d, b) {
|
19136 | extendStatics = Object.setPrototypeOf ||
|
19137 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
19138 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
19139 | return extendStatics(d, b);
|
19140 | };
|
19141 | return function (d, b) {
|
19142 | extendStatics(d, b);
|
19143 | function __() { this.constructor = d; }
|
19144 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
19145 | };
|
19146 | })();
|
19147 | var TooltipComponent$1 = (function (_super) {
|
19148 | __extends$24(TooltipComponent, _super);
|
19149 | function TooltipComponent() {
|
19150 | return _super.call(this, "<div class=\"ag-tooltip\"></div>") || this;
|
19151 | }
|
19152 |
|
19153 | TooltipComponent.prototype.init = function (params) {
|
19154 | var value = params.value;
|
19155 | this.getGui().innerHTML = escapeString(value);
|
19156 | };
|
19157 | return TooltipComponent;
|
19158 | }(PopupComponent));
|
19159 |
|
19160 |
|
19161 |
|
19162 |
|
19163 |
|
19164 |
|
19165 |
|
19166 | var __extends$23 = (undefined && undefined.__extends) || (function () {
|
19167 | var extendStatics = function (d, b) {
|
19168 | extendStatics = Object.setPrototypeOf ||
|
19169 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
19170 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
19171 | return extendStatics(d, b);
|
19172 | };
|
19173 | return function (d, b) {
|
19174 | extendStatics(d, b);
|
19175 | function __() { this.constructor = d; }
|
19176 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
19177 | };
|
19178 | })();
|
19179 | var __decorate$1W = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
19180 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
19181 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
19182 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
19183 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
19184 | };
|
19185 | var __read$m = (undefined && undefined.__read) || function (o, n) {
|
19186 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
19187 | if (!m) return o;
|
19188 | var i = m.call(o), r, ar = [], e;
|
19189 | try {
|
19190 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
19191 | }
|
19192 | catch (error) { e = { error: error }; }
|
19193 | finally {
|
19194 | try {
|
19195 | if (r && !r.done && (m = i["return"])) m.call(i);
|
19196 | }
|
19197 | finally { if (e) throw e.error; }
|
19198 | }
|
19199 | return ar;
|
19200 | };
|
19201 | var __spread$i = (undefined && undefined.__spread) || function () {
|
19202 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$m(arguments[i]));
|
19203 | return ar;
|
19204 | };
|
19205 | var UserComponentRegistry = (function (_super) {
|
19206 | __extends$23(UserComponentRegistry, _super);
|
19207 | function UserComponentRegistry() {
|
19208 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
19209 | _this.agGridDefaults = {
|
19210 |
|
19211 | agDateInput: DefaultDateComponent,
|
19212 |
|
19213 | agColumnHeader: HeaderComp,
|
19214 | agColumnGroupHeader: HeaderGroupComp,
|
19215 | agSortIndicator: SortIndicatorComp,
|
19216 |
|
19217 | agTextColumnFloatingFilter: TextFloatingFilter,
|
19218 | agNumberColumnFloatingFilter: NumberFloatingFilter,
|
19219 | agDateColumnFloatingFilter: DateFloatingFilter,
|
19220 | agReadOnlyFloatingFilter: ReadOnlyFloatingFilter,
|
19221 |
|
19222 | agAnimateShowChangeCellRenderer: AnimateShowChangeCellRenderer,
|
19223 | agAnimateSlideCellRenderer: AnimateSlideCellRenderer,
|
19224 | agGroupCellRenderer: GroupCellRenderer,
|
19225 | agGroupRowRenderer: GroupCellRenderer,
|
19226 | agLoadingCellRenderer: LoadingCellRenderer,
|
19227 |
|
19228 | agCellEditor: TextCellEditor,
|
19229 | agTextCellEditor: TextCellEditor,
|
19230 | agSelectCellEditor: SelectCellEditor,
|
19231 | agLargeTextCellEditor: LargeTextCellEditor,
|
19232 |
|
19233 | agTextColumnFilter: TextFilter,
|
19234 | agNumberColumnFilter: NumberFilter,
|
19235 | agDateColumnFilter: DateFilter,
|
19236 |
|
19237 | agLoadingOverlay: LoadingOverlayComponent$1,
|
19238 | agNoRowsOverlay: NoRowsOverlayComponent$1,
|
19239 |
|
19240 | agTooltipComponent: TooltipComponent$1
|
19241 | };
|
19242 |
|
19243 | _this.enterpriseAgDefaultCompsModule = {
|
19244 | agSetColumnFilter: ModuleNames.SetFilterModule,
|
19245 | agSetColumnFloatingFilter: ModuleNames.SetFilterModule,
|
19246 | agMultiColumnFilter: ModuleNames.MultiFilterModule,
|
19247 | agMultiColumnFloatingFilter: ModuleNames.MultiFilterModule,
|
19248 | agGroupColumnFilter: ModuleNames.RowGroupingModule,
|
19249 | agGroupColumnFloatingFilter: ModuleNames.RowGroupingModule,
|
19250 | agRichSelect: ModuleNames.RichSelectModule,
|
19251 | agRichSelectCellEditor: ModuleNames.RichSelectModule,
|
19252 | agDetailCellRenderer: ModuleNames.MasterDetailModule,
|
19253 | agSparklineCellRenderer: ModuleNames.SparklinesModule
|
19254 | };
|
19255 | _this.deprecatedAgGridDefaults = {
|
19256 | agPopupTextCellEditor: 'AG Grid: Since v27.1 The agPopupTextCellEditor is deprecated. Instead use { cellEditor: "agTextCellEditor", cellEditorPopup: true }',
|
19257 | agPopupSelectCellEditor: 'AG Grid: Since v27.1 the agPopupSelectCellEditor is deprecated. Instead use { cellEditor: "agSelectCellEditor", cellEditorPopup: true }',
|
19258 | };
|
19259 | _this.jsComps = {};
|
19260 | _this.fwComps = {};
|
19261 | return _this;
|
19262 | }
|
19263 | UserComponentRegistry.prototype.init = function () {
|
19264 | var _this = this;
|
19265 | if (this.gridOptions.components != null) {
|
19266 | iterateObject(this.gridOptions.components, function (key, component) { return _this.registerJsComponent(key, component); });
|
19267 | }
|
19268 | if (this.gridOptions.frameworkComponents != null) {
|
19269 | iterateObject(this.gridOptions.frameworkComponents, function (key, component) { return _this.registerFwComponent(key, component); });
|
19270 | }
|
19271 | };
|
19272 | UserComponentRegistry.prototype.registerDefaultComponent = function (name, component) {
|
19273 | if (this.agGridDefaults[name]) {
|
19274 | console.error("Trying to overwrite a default component. You should call registerComponent");
|
19275 | return;
|
19276 | }
|
19277 | this.agGridDefaults[name] = component;
|
19278 | };
|
19279 | UserComponentRegistry.prototype.registerJsComponent = function (name, component) {
|
19280 | if (this.fwComps[name]) {
|
19281 | console.error("Trying to register a component that you have already registered for frameworks: " + name);
|
19282 | return;
|
19283 | }
|
19284 | this.jsComps[name] = component;
|
19285 | };
|
19286 | |
19287 |
|
19288 |
|
19289 |
|
19290 | UserComponentRegistry.prototype.registerFwComponent = function (name, component) {
|
19291 | 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.";
|
19292 | doOnce(function () { return console.warn(warningMessage); }, "UserComponentRegistry.frameworkComponentsDeprecated");
|
19293 | this.fwComps[name] = component;
|
19294 | };
|
19295 | UserComponentRegistry.prototype.retrieve = function (propertyName, name) {
|
19296 | var _this = this;
|
19297 | var createResult = function (component, componentFromFramework) { return ({ componentFromFramework: componentFromFramework, component: component }); };
|
19298 |
|
19299 |
|
19300 |
|
19301 | var registeredViaFrameworkComp = this.getFrameworkOverrides().frameworkComponent(name, this.gridOptions.components);
|
19302 | if (registeredViaFrameworkComp != null) {
|
19303 | return createResult(registeredViaFrameworkComp, true);
|
19304 | }
|
19305 | var frameworkComponent = this.fwComps[name];
|
19306 | if (frameworkComponent) {
|
19307 | return createResult(frameworkComponent, true);
|
19308 | }
|
19309 | var jsComponent = this.jsComps[name];
|
19310 | if (jsComponent) {
|
19311 | var isFwkComp = this.getFrameworkOverrides().isFrameworkComponent(jsComponent);
|
19312 | return createResult(jsComponent, isFwkComp);
|
19313 | }
|
19314 | var defaultComponent = this.agGridDefaults[name];
|
19315 | if (defaultComponent) {
|
19316 | return createResult(defaultComponent, false);
|
19317 | }
|
19318 | var moduleForComponent = this.enterpriseAgDefaultCompsModule[name];
|
19319 | if (moduleForComponent) {
|
19320 | ModuleRegistry.assertRegistered(moduleForComponent, "AG Grid '" + propertyName + "' component: " + name);
|
19321 | }
|
19322 | else if (this.deprecatedAgGridDefaults[name]) {
|
19323 | doOnce(function () { return console.warn(_this.deprecatedAgGridDefaults[name]); }, name);
|
19324 | }
|
19325 | else {
|
19326 | doOnce(function () { _this.warnAboutMissingComponent(propertyName, name); }, "MissingComp" + name);
|
19327 | }
|
19328 | return null;
|
19329 | };
|
19330 | UserComponentRegistry.prototype.warnAboutMissingComponent = function (propertyName, componentName) {
|
19331 | var validComponents = __spread$i(Object.keys(this.agGridDefaults).filter(function (k) { return !['agCellEditor', 'agGroupRowRenderer', 'agSortIndicator'].includes(k); }), Object.keys(this.jsComps), Object.keys(this.fwComps));
|
19332 | var suggestions = fuzzySuggestions(componentName, validComponents, true, 0.8);
|
19333 | console.warn("AG Grid: Could not find '" + componentName + "' component. It was configured as \"" + propertyName + ": '" + componentName + "'\" but it wasn't found in the list of registered components.");
|
19334 | if (suggestions.length > 0) {
|
19335 | console.warn(" Did you mean: [" + suggestions.slice(0, 3) + "]?");
|
19336 | }
|
19337 | console.warn("If using a custom component check it has been registered as described in: https://ag-grid.com/javascript-data-grid/components/");
|
19338 | };
|
19339 | __decorate$1W([
|
19340 | Autowired('gridOptions')
|
19341 | ], UserComponentRegistry.prototype, "gridOptions", void 0);
|
19342 | __decorate$1W([
|
19343 | PostConstruct
|
19344 | ], UserComponentRegistry.prototype, "init", null);
|
19345 | UserComponentRegistry = __decorate$1W([
|
19346 | Bean('userComponentRegistry')
|
19347 | ], UserComponentRegistry);
|
19348 | return UserComponentRegistry;
|
19349 | }(BeanStub));
|
19350 |
|
19351 |
|
19352 |
|
19353 |
|
19354 |
|
19355 |
|
19356 |
|
19357 | var DateComponent = {
|
19358 | propertyName: 'dateComponent',
|
19359 | cellRenderer: false
|
19360 | };
|
19361 | var HeaderComponent = {
|
19362 | propertyName: 'headerComponent',
|
19363 | cellRenderer: false
|
19364 | };
|
19365 | var HeaderGroupComponent = {
|
19366 | propertyName: 'headerGroupComponent',
|
19367 | cellRenderer: false
|
19368 | };
|
19369 | var CellRendererComponent = {
|
19370 | propertyName: 'cellRenderer',
|
19371 | cellRenderer: true
|
19372 | };
|
19373 | var CellEditorComponent = {
|
19374 | propertyName: 'cellEditor',
|
19375 | cellRenderer: false
|
19376 | };
|
19377 | var InnerRendererComponent = {
|
19378 | propertyName: 'innerRenderer',
|
19379 | cellRenderer: true
|
19380 | };
|
19381 | var LoadingOverlayComponent = {
|
19382 | propertyName: 'loadingOverlayComponent',
|
19383 | cellRenderer: false
|
19384 | };
|
19385 | var NoRowsOverlayComponent = {
|
19386 | propertyName: 'noRowsOverlayComponent',
|
19387 | cellRenderer: false
|
19388 | };
|
19389 | var TooltipComponent = {
|
19390 | propertyName: 'tooltipComponent',
|
19391 | cellRenderer: false
|
19392 | };
|
19393 | var FilterComponent = {
|
19394 | propertyName: 'filter',
|
19395 | cellRenderer: false
|
19396 | };
|
19397 | var FloatingFilterComponent = {
|
19398 | propertyName: 'floatingFilterComponent',
|
19399 | cellRenderer: false
|
19400 | };
|
19401 | var ToolPanelComponent = {
|
19402 | propertyName: 'toolPanel',
|
19403 | cellRenderer: false
|
19404 | };
|
19405 | var StatusPanelComponent = {
|
19406 | propertyName: 'statusPanel',
|
19407 | cellRenderer: false
|
19408 | };
|
19409 | var FullWidth = {
|
19410 | propertyName: 'fullWidthCellRenderer',
|
19411 | cellRenderer: true
|
19412 | };
|
19413 | var FullWidthLoading = {
|
19414 | propertyName: 'loadingCellRenderer',
|
19415 | cellRenderer: true
|
19416 | };
|
19417 | var FullWidthGroup = {
|
19418 | propertyName: 'groupRowRenderer',
|
19419 | cellRenderer: true
|
19420 | };
|
19421 | var FullWidthDetail = {
|
19422 | propertyName: 'detailCellRenderer',
|
19423 | cellRenderer: true
|
19424 | };
|
19425 |
|
19426 |
|
19427 |
|
19428 |
|
19429 |
|
19430 |
|
19431 |
|
19432 | var FloatingFilterMapper = (function () {
|
19433 | function FloatingFilterMapper() {
|
19434 | }
|
19435 | FloatingFilterMapper.getFloatingFilterType = function (filterType) {
|
19436 | return this.filterToFloatingFilterMapping[filterType];
|
19437 | };
|
19438 | FloatingFilterMapper.filterToFloatingFilterMapping = {
|
19439 | set: 'agSetColumnFloatingFilter',
|
19440 | agSetColumnFilter: 'agSetColumnFloatingFilter',
|
19441 | multi: 'agMultiColumnFloatingFilter',
|
19442 | agMultiColumnFilter: 'agMultiColumnFloatingFilter',
|
19443 | group: 'agGroupColumnFloatingFilter',
|
19444 | agGroupColumnFilter: 'agGroupColumnFloatingFilter',
|
19445 | number: 'agNumberColumnFloatingFilter',
|
19446 | agNumberColumnFilter: 'agNumberColumnFloatingFilter',
|
19447 | date: 'agDateColumnFloatingFilter',
|
19448 | agDateColumnFilter: 'agDateColumnFloatingFilter',
|
19449 | text: 'agTextColumnFloatingFilter',
|
19450 | agTextColumnFilter: 'agTextColumnFloatingFilter'
|
19451 | };
|
19452 | return FloatingFilterMapper;
|
19453 | }());
|
19454 |
|
19455 | /**
|
19456 | * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
|
19457 | * @version v29.2.0
|
19458 | * @link https://www.ag-grid.com/
|
19459 | * @license MIT
|
19460 | */
|
19461 | var __extends$22 = (undefined && undefined.__extends) || (function () {
|
19462 | var extendStatics = function (d, b) {
|
19463 | extendStatics = Object.setPrototypeOf ||
|
19464 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
19465 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
19466 | return extendStatics(d, b);
|
19467 | };
|
19468 | return function (d, b) {
|
19469 | extendStatics(d, b);
|
19470 | function __() { this.constructor = d; }
|
19471 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
19472 | };
|
19473 | })();
|
19474 | var __decorate$1V = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
19475 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
19476 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
19477 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
19478 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
19479 | };
|
19480 | var UserComponentFactory = (function (_super) {
|
19481 | __extends$22(UserComponentFactory, _super);
|
19482 | function UserComponentFactory() {
|
19483 | return _super !== null && _super.apply(this, arguments) || this;
|
19484 | }
|
19485 | UserComponentFactory.prototype.getHeaderCompDetails = function (colDef, params) {
|
19486 | return this.getCompDetails(colDef, HeaderComponent, 'agColumnHeader', params);
|
19487 | };
|
19488 | UserComponentFactory.prototype.getHeaderGroupCompDetails = function (params) {
|
19489 | var colGroupDef = params.columnGroup.getColGroupDef();
|
19490 | return this.getCompDetails(colGroupDef, HeaderGroupComponent, 'agColumnGroupHeader', params);
|
19491 | };
|
19492 |
|
19493 |
|
19494 | UserComponentFactory.prototype.getFullWidthCellRendererDetails = function (params) {
|
19495 | return this.getCompDetails(this.gridOptions, FullWidth, null, params, true);
|
19496 | };
|
19497 | UserComponentFactory.prototype.getFullWidthLoadingCellRendererDetails = function (params) {
|
19498 | return this.getCompDetails(this.gridOptions, FullWidthLoading, 'agLoadingCellRenderer', params, true);
|
19499 | };
|
19500 | UserComponentFactory.prototype.getFullWidthGroupCellRendererDetails = function (params) {
|
19501 | return this.getCompDetails(this.gridOptions, FullWidthGroup, 'agGroupRowRenderer', params, true);
|
19502 | };
|
19503 | UserComponentFactory.prototype.getFullWidthDetailCellRendererDetails = function (params) {
|
19504 | return this.getCompDetails(this.gridOptions, FullWidthDetail, 'agDetailCellRenderer', params, true);
|
19505 | };
|
19506 |
|
19507 | UserComponentFactory.prototype.getInnerRendererDetails = function (def, params) {
|
19508 | return this.getCompDetails(def, InnerRendererComponent, null, params);
|
19509 | };
|
19510 | UserComponentFactory.prototype.getFullWidthGroupRowInnerCellRenderer = function (def, params) {
|
19511 | return this.getCompDetails(def, InnerRendererComponent, null, params);
|
19512 | };
|
19513 | UserComponentFactory.prototype.getCellRendererDetails = function (def, params) {
|
19514 | return this.getCompDetails(def, CellRendererComponent, null, params);
|
19515 | };
|
19516 |
|
19517 | UserComponentFactory.prototype.getCellEditorDetails = function (def, params) {
|
19518 | return this.getCompDetails(def, CellEditorComponent, 'agCellEditor', params, true);
|
19519 | };
|
19520 |
|
19521 | UserComponentFactory.prototype.getFilterDetails = function (def, params, defaultFilter) {
|
19522 | return this.getCompDetails(def, FilterComponent, defaultFilter, params, true);
|
19523 | };
|
19524 | UserComponentFactory.prototype.getDateCompDetails = function (params) {
|
19525 | return this.getCompDetails(this.gridOptions, DateComponent, 'agDateInput', params, true);
|
19526 | };
|
19527 | UserComponentFactory.prototype.getLoadingOverlayCompDetails = function (params) {
|
19528 | return this.getCompDetails(this.gridOptions, LoadingOverlayComponent, 'agLoadingOverlay', params, true);
|
19529 | };
|
19530 | UserComponentFactory.prototype.getNoRowsOverlayCompDetails = function (params) {
|
19531 | return this.getCompDetails(this.gridOptions, NoRowsOverlayComponent, 'agNoRowsOverlay', params, true);
|
19532 | };
|
19533 | UserComponentFactory.prototype.getTooltipCompDetails = function (params) {
|
19534 | return this.getCompDetails(params.colDef, TooltipComponent, 'agTooltipComponent', params, true);
|
19535 | };
|
19536 | UserComponentFactory.prototype.getSetFilterCellRendererDetails = function (def, params) {
|
19537 | return this.getCompDetails(def, CellRendererComponent, null, params);
|
19538 | };
|
19539 | UserComponentFactory.prototype.getFloatingFilterCompDetails = function (def, params, defaultFloatingFilter) {
|
19540 | return this.getCompDetails(def, FloatingFilterComponent, defaultFloatingFilter, params);
|
19541 | };
|
19542 | UserComponentFactory.prototype.getToolPanelCompDetails = function (toolPanelDef, params) {
|
19543 | return this.getCompDetails(toolPanelDef, ToolPanelComponent, null, params, true);
|
19544 | };
|
19545 | UserComponentFactory.prototype.getStatusPanelCompDetails = function (def, params) {
|
19546 | return this.getCompDetails(def, StatusPanelComponent, null, params, true);
|
19547 | };
|
19548 | UserComponentFactory.prototype.getCompDetails = function (defObject, type, defaultName, params, mandatory) {
|
19549 | var _this = this;
|
19550 | if (mandatory === void 0) { mandatory = false; }
|
19551 | var propertyName = type.propertyName, cellRenderer = type.cellRenderer;
|
19552 | 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;
|
19553 | var lookupFromRegistry = function (key) {
|
19554 | var item = _this.userComponentRegistry.retrieve(propertyName, key);
|
19555 | if (item) {
|
19556 | jsComp = !item.componentFromFramework ? item.component : undefined;
|
19557 | fwComp = item.componentFromFramework ? item.component : undefined;
|
19558 | }
|
19559 | };
|
19560 |
|
19561 | if (compName != null) {
|
19562 | lookupFromRegistry(compName);
|
19563 | }
|
19564 |
|
19565 | if (jsComp == null && fwComp == null && defaultName != null) {
|
19566 | lookupFromRegistry(defaultName);
|
19567 | }
|
19568 |
|
19569 | if (jsComp && cellRenderer && !this.agComponentUtils.doesImplementIComponent(jsComp)) {
|
19570 | jsComp = this.agComponentUtils.adaptFunction(propertyName, jsComp);
|
19571 | }
|
19572 | if (!jsComp && !fwComp) {
|
19573 | if (mandatory) {
|
19574 | console.error("AG Grid: Could not find component " + compName + ", did you forget to configure this component?");
|
19575 | }
|
19576 | return;
|
19577 | }
|
19578 | var paramsMerged = this.mergeParamsWithApplicationProvidedParams(defObject, type, params, paramsFromSelector);
|
19579 | var componentFromFramework = jsComp == null;
|
19580 | var componentClass = jsComp ? jsComp : fwComp;
|
19581 | return {
|
19582 | componentFromFramework: componentFromFramework,
|
19583 | componentClass: componentClass,
|
19584 | params: paramsMerged,
|
19585 | type: type,
|
19586 | popupFromSelector: popupFromSelector,
|
19587 | popupPositionFromSelector: popupPositionFromSelector,
|
19588 | newAgStackInstance: function () { return _this.newAgStackInstance(componentClass, componentFromFramework, paramsMerged, type); }
|
19589 | };
|
19590 | };
|
19591 | UserComponentFactory.prototype.getCompKeys = function (defObject, type, params) {
|
19592 | var _this = this;
|
19593 | var propertyName = type.propertyName;
|
19594 | var compName;
|
19595 | var jsComp;
|
19596 | var fwComp;
|
19597 | var paramsFromSelector;
|
19598 | var popupFromSelector;
|
19599 | var popupPositionFromSelector;
|
19600 |
|
19601 |
|
19602 |
|
19603 |
|
19604 |
|
19605 | if (defObject) {
|
19606 | var defObjectAny = defObject;
|
19607 |
|
19608 | var selectorFunc = defObjectAny[propertyName + 'Selector'];
|
19609 | var selectorRes = selectorFunc ? selectorFunc(params) : null;
|
19610 | var assignComp = function (providedJsComp, providedFwComp) {
|
19611 | var xxxFrameworkDeprecatedWarn = function () {
|
19612 | 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.";
|
19613 | doOnce(function () { return console.warn(warningMessage); }, "UserComponentFactory." + propertyName + "FrameworkDeprecated");
|
19614 | };
|
19615 | if (typeof providedJsComp === 'string') {
|
19616 | compName = providedJsComp;
|
19617 | }
|
19618 | else if (typeof providedFwComp === 'string') {
|
19619 | xxxFrameworkDeprecatedWarn();
|
19620 | compName = providedFwComp;
|
19621 |
|
19622 | }
|
19623 | else if (providedJsComp != null && providedJsComp !== true) {
|
19624 | var isFwkComp = _this.getFrameworkOverrides().isFrameworkComponent(providedJsComp);
|
19625 | if (isFwkComp) {
|
19626 | fwComp = providedJsComp;
|
19627 | }
|
19628 | else {
|
19629 | jsComp = providedJsComp;
|
19630 | }
|
19631 | }
|
19632 | else if (providedFwComp != null) {
|
19633 | xxxFrameworkDeprecatedWarn();
|
19634 | fwComp = providedFwComp;
|
19635 | }
|
19636 | };
|
19637 | if (selectorRes) {
|
19638 | if (selectorRes.frameworkComponent != null) {
|
19639 | 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.";
|
19640 | doOnce(function () { return console.warn(warningMessage_1); }, "UserComponentFactory." + propertyName + "FrameworkSelectorDeprecated");
|
19641 | assignComp(selectorRes.frameworkComponent, undefined);
|
19642 | }
|
19643 | else {
|
19644 | assignComp(selectorRes.component, undefined);
|
19645 | }
|
19646 | paramsFromSelector = selectorRes.params;
|
19647 | popupFromSelector = selectorRes.popup;
|
19648 | popupPositionFromSelector = selectorRes.popupPosition;
|
19649 | }
|
19650 | else {
|
19651 |
|
19652 | assignComp(defObjectAny[propertyName], defObjectAny[propertyName + 'Framework']);
|
19653 | }
|
19654 | }
|
19655 | return { compName: compName, jsComp: jsComp, fwComp: fwComp, paramsFromSelector: paramsFromSelector, popupFromSelector: popupFromSelector, popupPositionFromSelector: popupPositionFromSelector };
|
19656 | };
|
19657 | UserComponentFactory.prototype.newAgStackInstance = function (ComponentClass, componentFromFramework, params, type) {
|
19658 | var propertyName = type.propertyName;
|
19659 | var jsComponent = !componentFromFramework;
|
19660 |
|
19661 | var instance;
|
19662 | if (jsComponent) {
|
19663 | instance = new ComponentClass();
|
19664 | }
|
19665 | else {
|
19666 |
|
19667 | var thisComponentConfig = this.componentMetadataProvider.retrieve(propertyName);
|
19668 | instance = this.frameworkComponentWrapper.wrap(ComponentClass, thisComponentConfig.mandatoryMethodList, thisComponentConfig.optionalMethodList, type);
|
19669 | }
|
19670 | var deferredInit = this.initComponent(instance, params);
|
19671 | if (deferredInit == null) {
|
19672 | return AgPromise.resolve(instance);
|
19673 | }
|
19674 | return deferredInit.then(function () { return instance; });
|
19675 | };
|
19676 |
|
19677 | UserComponentFactory.prototype.mergeParamsWithApplicationProvidedParams = function (defObject, type, paramsFromGrid, paramsFromSelector) {
|
19678 | if (paramsFromSelector === void 0) { paramsFromSelector = null; }
|
19679 | var params = {
|
19680 | context: this.gridOptionsService.context,
|
19681 | columnApi: this.gridOptionsService.columnApi,
|
19682 | api: this.gridOptionsService.api
|
19683 | };
|
19684 | mergeDeep(params, paramsFromGrid);
|
19685 |
|
19686 |
|
19687 | var defObjectAny = defObject;
|
19688 | var userParams = defObjectAny && defObjectAny[type.propertyName + 'Params'];
|
19689 | if (typeof userParams === 'function') {
|
19690 | var userParamsFromFunc = userParams(paramsFromGrid);
|
19691 | mergeDeep(params, userParamsFromFunc);
|
19692 | }
|
19693 | else if (typeof userParams === 'object') {
|
19694 | mergeDeep(params, userParams);
|
19695 | }
|
19696 | mergeDeep(params, paramsFromSelector);
|
19697 | return params;
|
19698 | };
|
19699 | UserComponentFactory.prototype.initComponent = function (component, params) {
|
19700 | this.context.createBean(component);
|
19701 | if (component.init == null) {
|
19702 | return;
|
19703 | }
|
19704 | return component.init(params);
|
19705 | };
|
19706 | UserComponentFactory.prototype.getDefaultFloatingFilterType = function (def) {
|
19707 | if (def == null) {
|
19708 | return null;
|
19709 | }
|
19710 | var defaultFloatingFilterType = null;
|
19711 | var _a = this.getCompKeys(def, FilterComponent), compName = _a.compName, jsComp = _a.jsComp, fwComp = _a.fwComp;
|
19712 | if (compName) {
|
19713 |
|
19714 | defaultFloatingFilterType = FloatingFilterMapper.getFloatingFilterType(compName);
|
19715 | }
|
19716 | else {
|
19717 | var usingDefaultFilter = (jsComp == null && fwComp == null) && (def.filter === true);
|
19718 | if (usingDefaultFilter) {
|
19719 | var setFilterModuleLoaded = ModuleRegistry.isRegistered(ModuleNames.SetFilterModule);
|
19720 | defaultFloatingFilterType = setFilterModuleLoaded ? 'agSetColumnFloatingFilter' : 'agTextColumnFloatingFilter';
|
19721 | }
|
19722 | }
|
19723 | return defaultFloatingFilterType;
|
19724 | };
|
19725 | __decorate$1V([
|
19726 | Autowired('gridOptions')
|
19727 | ], UserComponentFactory.prototype, "gridOptions", void 0);
|
19728 | __decorate$1V([
|
19729 | Autowired('agComponentUtils')
|
19730 | ], UserComponentFactory.prototype, "agComponentUtils", void 0);
|
19731 | __decorate$1V([
|
19732 | Autowired('componentMetadataProvider')
|
19733 | ], UserComponentFactory.prototype, "componentMetadataProvider", void 0);
|
19734 | __decorate$1V([
|
19735 | Autowired('userComponentRegistry')
|
19736 | ], UserComponentFactory.prototype, "userComponentRegistry", void 0);
|
19737 | __decorate$1V([
|
19738 | Optional('frameworkComponentWrapper')
|
19739 | ], UserComponentFactory.prototype, "frameworkComponentWrapper", void 0);
|
19740 | UserComponentFactory = __decorate$1V([
|
19741 | Bean('userComponentFactory')
|
19742 | ], UserComponentFactory);
|
19743 | return UserComponentFactory;
|
19744 | }(BeanStub));
|
19745 |
|
19746 |
|
19747 |
|
19748 |
|
19749 |
|
19750 |
|
19751 |
|
19752 |
|
19753 | var ExcelFactoryMode;
|
19754 | (function (ExcelFactoryMode) {
|
19755 | ExcelFactoryMode[ExcelFactoryMode["SINGLE_SHEET"] = 0] = "SINGLE_SHEET";
|
19756 | ExcelFactoryMode[ExcelFactoryMode["MULTI_SHEET"] = 1] = "MULTI_SHEET";
|
19757 | })(ExcelFactoryMode || (ExcelFactoryMode = {}));
|
19758 |
|
19759 |
|
19760 |
|
19761 |
|
19762 |
|
19763 |
|
19764 |
|
19765 | var __extends$21 = (undefined && undefined.__extends) || (function () {
|
19766 | var extendStatics = function (d, b) {
|
19767 | extendStatics = Object.setPrototypeOf ||
|
19768 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
19769 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
19770 | return extendStatics(d, b);
|
19771 | };
|
19772 | return function (d, b) {
|
19773 | extendStatics(d, b);
|
19774 | function __() { this.constructor = d; }
|
19775 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
19776 | };
|
19777 | })();
|
19778 | var __decorate$1U = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
19779 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
19780 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
19781 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
19782 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
19783 | };
|
19784 |
|
19785 |
|
19786 | var DragService = (function (_super) {
|
19787 | __extends$21(DragService, _super);
|
19788 | function DragService() {
|
19789 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
19790 | _this.dragEndFunctions = [];
|
19791 | _this.dragSources = [];
|
19792 | return _this;
|
19793 | }
|
19794 | DragService.prototype.init = function () {
|
19795 | this.logger = this.loggerFactory.create('DragService');
|
19796 | };
|
19797 | DragService.prototype.removeAllListeners = function () {
|
19798 | this.dragSources.forEach(this.removeListener.bind(this));
|
19799 | this.dragSources.length = 0;
|
19800 | };
|
19801 | DragService.prototype.removeListener = function (dragSourceAndListener) {
|
19802 | var element = dragSourceAndListener.dragSource.eElement;
|
19803 | var mouseDownListener = dragSourceAndListener.mouseDownListener;
|
19804 | element.removeEventListener('mousedown', mouseDownListener);
|
19805 |
|
19806 | if (dragSourceAndListener.touchEnabled) {
|
19807 | var touchStartListener = dragSourceAndListener.touchStartListener;
|
19808 | element.removeEventListener('touchstart', touchStartListener, { passive: true });
|
19809 | }
|
19810 | };
|
19811 | DragService.prototype.removeDragSource = function (params) {
|
19812 | var dragSourceAndListener = this.dragSources.find(function (item) { return item.dragSource === params; });
|
19813 | if (!dragSourceAndListener) {
|
19814 | return;
|
19815 | }
|
19816 | this.removeListener(dragSourceAndListener);
|
19817 | removeFromArray(this.dragSources, dragSourceAndListener);
|
19818 | };
|
19819 | DragService.prototype.isDragging = function () {
|
19820 | return this.dragging;
|
19821 | };
|
19822 | DragService.prototype.addDragSource = function (params, includeTouch) {
|
19823 | var _this = this;
|
19824 | if (includeTouch === void 0) { includeTouch = false; }
|
19825 | var mouseListener = this.onMouseDown.bind(this, params);
|
19826 | params.eElement.addEventListener('mousedown', mouseListener);
|
19827 | var touchListener = null;
|
19828 | var suppressTouch = this.gridOptionsService.is('suppressTouch');
|
19829 | if (includeTouch && !suppressTouch) {
|
19830 | touchListener = function (touchEvent) {
|
19831 | if (isFocusableFormField(touchEvent.target)) {
|
19832 | return;
|
19833 | }
|
19834 | if (touchEvent.cancelable) {
|
19835 | touchEvent.preventDefault();
|
19836 | touchEvent.stopPropagation();
|
19837 | }
|
19838 | _this.onTouchStart(params, touchEvent);
|
19839 | };
|
19840 |
|
19841 | params.eElement.addEventListener('touchstart', touchListener, { passive: false });
|
19842 | }
|
19843 | this.dragSources.push({
|
19844 | dragSource: params,
|
19845 | mouseDownListener: mouseListener,
|
19846 | touchStartListener: touchListener,
|
19847 | touchEnabled: includeTouch
|
19848 | });
|
19849 | };
|
19850 |
|
19851 | DragService.prototype.onTouchStart = function (params, touchEvent) {
|
19852 | var _this = this;
|
19853 | this.currentDragParams = params;
|
19854 | this.dragging = false;
|
19855 | var touch = touchEvent.touches[0];
|
19856 | this.touchLastTime = touch;
|
19857 | this.touchStart = touch;
|
19858 | var touchMoveEvent = function (e) { return _this.onTouchMove(e, params.eElement); };
|
19859 | var touchEndEvent = function (e) { return _this.onTouchUp(e, params.eElement); };
|
19860 | var documentTouchMove = function (e) { if (e.cancelable) {
|
19861 | e.preventDefault();
|
19862 | } };
|
19863 | var target = touchEvent.target;
|
19864 | var events = [
|
19865 |
|
19866 |
|
19867 |
|
19868 | { target: document, type: 'touchmove', listener: documentTouchMove, options: { passive: false } },
|
19869 | { target: target, type: 'touchmove', listener: touchMoveEvent, options: { passive: true } },
|
19870 | { target: target, type: 'touchend', listener: touchEndEvent, options: { passive: true } },
|
19871 | { target: target, type: 'touchcancel', listener: touchEndEvent, options: { passive: true } }
|
19872 | ];
|
19873 |
|
19874 | this.addTemporaryEvents(events);
|
19875 |
|
19876 | if (params.dragStartPixels === 0) {
|
19877 | this.onCommonMove(touch, this.touchStart, params.eElement);
|
19878 | }
|
19879 | };
|
19880 |
|
19881 | DragService.prototype.onMouseDown = function (params, mouseEvent) {
|
19882 | var _this = this;
|
19883 | var e = mouseEvent;
|
19884 | if (params.skipMouseEvent && params.skipMouseEvent(mouseEvent)) {
|
19885 | return;
|
19886 | }
|
19887 |
|
19888 |
|
19889 |
|
19890 | if (e._alreadyProcessedByDragService) {
|
19891 | return;
|
19892 | }
|
19893 | e._alreadyProcessedByDragService = true;
|
19894 |
|
19895 | if (mouseEvent.button !== 0) {
|
19896 | return;
|
19897 | }
|
19898 | this.currentDragParams = params;
|
19899 | this.dragging = false;
|
19900 | this.mouseStartEvent = mouseEvent;
|
19901 | var eDocument = this.gridOptionsService.getDocument();
|
19902 | var mouseMoveEvent = function (event) { return _this.onMouseMove(event, params.eElement); };
|
19903 | var mouseUpEvent = function (event) { return _this.onMouseUp(event, params.eElement); };
|
19904 | var contextEvent = function (event) { return event.preventDefault(); };
|
19905 | var target = eDocument;
|
19906 | var events = [
|
19907 | { target: target, type: 'mousemove', listener: mouseMoveEvent },
|
19908 | { target: target, type: 'mouseup', listener: mouseUpEvent },
|
19909 | { target: target, type: 'contextmenu', listener: contextEvent }
|
19910 | ];
|
19911 |
|
19912 | this.addTemporaryEvents(events);
|
19913 |
|
19914 | if (params.dragStartPixels === 0) {
|
19915 | this.onMouseMove(mouseEvent, params.eElement);
|
19916 | }
|
19917 | };
|
19918 | DragService.prototype.addTemporaryEvents = function (events) {
|
19919 | events.forEach(function (currentEvent) {
|
19920 | var target = currentEvent.target, type = currentEvent.type, listener = currentEvent.listener, options = currentEvent.options;
|
19921 | target.addEventListener(type, listener, options);
|
19922 | });
|
19923 | this.dragEndFunctions.push(function () {
|
19924 | events.forEach(function (currentEvent) {
|
19925 | var target = currentEvent.target, type = currentEvent.type, listener = currentEvent.listener, options = currentEvent.options;
|
19926 | target.removeEventListener(type, listener, options);
|
19927 | });
|
19928 | });
|
19929 | };
|
19930 |
|
19931 |
|
19932 | DragService.prototype.isEventNearStartEvent = function (currentEvent, startEvent) {
|
19933 |
|
19934 | var dragStartPixels = this.currentDragParams.dragStartPixels;
|
19935 | var requiredPixelDiff = exists(dragStartPixels) ? dragStartPixels : 4;
|
19936 | return areEventsNear(currentEvent, startEvent, requiredPixelDiff);
|
19937 | };
|
19938 | DragService.prototype.getFirstActiveTouch = function (touchList) {
|
19939 | for (var i = 0; i < touchList.length; i++) {
|
19940 | if (touchList[i].identifier === this.touchStart.identifier) {
|
19941 | return touchList[i];
|
19942 | }
|
19943 | }
|
19944 | return null;
|
19945 | };
|
19946 | DragService.prototype.onCommonMove = function (currentEvent, startEvent, el) {
|
19947 | if (!this.dragging) {
|
19948 |
|
19949 | if (!this.dragging && this.isEventNearStartEvent(currentEvent, startEvent)) {
|
19950 | return;
|
19951 | }
|
19952 | this.dragging = true;
|
19953 | var event_1 = {
|
19954 | type: Events.EVENT_DRAG_STARTED,
|
19955 | target: el
|
19956 | };
|
19957 | this.eventService.dispatchEvent(event_1);
|
19958 | this.currentDragParams.onDragStart(startEvent);
|
19959 |
|
19960 |
|
19961 |
|
19962 |
|
19963 |
|
19964 |
|
19965 |
|
19966 | this.currentDragParams.onDragging(startEvent);
|
19967 | }
|
19968 | this.currentDragParams.onDragging(currentEvent);
|
19969 | };
|
19970 | DragService.prototype.onTouchMove = function (touchEvent, el) {
|
19971 | var touch = this.getFirstActiveTouch(touchEvent.touches);
|
19972 | if (!touch) {
|
19973 | return;
|
19974 | }
|
19975 |
|
19976 | this.onCommonMove(touch, this.touchStart, el);
|
19977 | };
|
19978 |
|
19979 |
|
19980 | DragService.prototype.onMouseMove = function (mouseEvent, el) {
|
19981 |
|
19982 |
|
19983 |
|
19984 | if ((this.gridOptionsService.is('enableCellTextSelection') || isBrowserSafari()) &&
|
19985 |
|
19986 |
|
19987 | mouseEvent.type === 'mousemove' &&
|
19988 | mouseEvent.cancelable &&
|
19989 | this.mouseEventService.isEventFromThisGrid(mouseEvent) &&
|
19990 |
|
19991 |
|
19992 | !this.isOverFormFieldElement(mouseEvent)) {
|
19993 | mouseEvent.preventDefault();
|
19994 | }
|
19995 | this.onCommonMove(mouseEvent, this.mouseStartEvent, el);
|
19996 | };
|
19997 | DragService.prototype.isOverFormFieldElement = function (mouseEvent) {
|
19998 | var el = mouseEvent.target;
|
19999 | var tagName = el === null || el === void 0 ? void 0 : el.tagName.toLocaleLowerCase();
|
20000 | return !!(tagName === null || tagName === void 0 ? void 0 : tagName.match('^a$|textarea|input|select|button'));
|
20001 | };
|
20002 | DragService.prototype.onTouchUp = function (touchEvent, el) {
|
20003 | var touch = this.getFirstActiveTouch(touchEvent.changedTouches);
|
20004 |
|
20005 |
|
20006 |
|
20007 |
|
20008 |
|
20009 | if (!touch) {
|
20010 | touch = this.touchLastTime;
|
20011 | }
|
20012 |
|
20013 |
|
20014 |
|
20015 |
|
20016 | this.onUpCommon(touch, el);
|
20017 |
|
20018 |
|
20019 |
|
20020 |
|
20021 |
|
20022 | };
|
20023 | DragService.prototype.onMouseUp = function (mouseEvent, el) {
|
20024 | this.onUpCommon(mouseEvent, el);
|
20025 | };
|
20026 | DragService.prototype.onUpCommon = function (eventOrTouch, el) {
|
20027 | if (this.dragging) {
|
20028 | this.dragging = false;
|
20029 | this.currentDragParams.onDragStop(eventOrTouch);
|
20030 | var event_2 = {
|
20031 | type: Events.EVENT_DRAG_STOPPED,
|
20032 | target: el
|
20033 | };
|
20034 | this.eventService.dispatchEvent(event_2);
|
20035 | }
|
20036 | this.mouseStartEvent = null;
|
20037 | this.touchStart = null;
|
20038 | this.touchLastTime = null;
|
20039 | this.currentDragParams = null;
|
20040 | this.dragEndFunctions.forEach(function (func) { return func(); });
|
20041 | this.dragEndFunctions.length = 0;
|
20042 | };
|
20043 | __decorate$1U([
|
20044 | Autowired('loggerFactory')
|
20045 | ], DragService.prototype, "loggerFactory", void 0);
|
20046 | __decorate$1U([
|
20047 | Autowired('mouseEventService')
|
20048 | ], DragService.prototype, "mouseEventService", void 0);
|
20049 | __decorate$1U([
|
20050 | PostConstruct
|
20051 | ], DragService.prototype, "init", null);
|
20052 | __decorate$1U([
|
20053 | PreDestroy
|
20054 | ], DragService.prototype, "removeAllListeners", null);
|
20055 | DragService = __decorate$1U([
|
20056 | Bean('dragService')
|
20057 | ], DragService);
|
20058 | return DragService;
|
20059 | }(BeanStub));
|
20060 |
|
20061 |
|
20062 |
|
20063 |
|
20064 |
|
20065 |
|
20066 |
|
20067 | var RowHighlightPosition;
|
20068 | (function (RowHighlightPosition) {
|
20069 | RowHighlightPosition[RowHighlightPosition["Above"] = 0] = "Above";
|
20070 | RowHighlightPosition[RowHighlightPosition["Below"] = 1] = "Below";
|
20071 | })(RowHighlightPosition || (RowHighlightPosition = {}));
|
20072 |
|
20073 |
|
20074 |
|
20075 |
|
20076 |
|
20077 |
|
20078 |
|
20079 | var ClientSideRowModelSteps;
|
20080 | (function (ClientSideRowModelSteps) {
|
20081 | ClientSideRowModelSteps["EVERYTHING"] = "group";
|
20082 | ClientSideRowModelSteps["FILTER"] = "filter";
|
20083 | ClientSideRowModelSteps["SORT"] = "sort";
|
20084 | ClientSideRowModelSteps["MAP"] = "map";
|
20085 | ClientSideRowModelSteps["AGGREGATE"] = "aggregate";
|
20086 | ClientSideRowModelSteps["FILTER_AGGREGATES"] = "filter_aggregates";
|
20087 | ClientSideRowModelSteps["PIVOT"] = "pivot";
|
20088 | ClientSideRowModelSteps["NOTHING"] = "nothing";
|
20089 | })(ClientSideRowModelSteps || (ClientSideRowModelSteps = {}));
|
20090 |
|
20091 |
|
20092 |
|
20093 |
|
20094 |
|
20095 |
|
20096 |
|
20097 | var __decorate$1T = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
20098 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
20099 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
20100 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
20101 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
20102 | };
|
20103 | function unwrapUserComp(comp) {
|
20104 | var compAsAny = comp;
|
20105 | var isProxy = compAsAny != null && compAsAny.getFrameworkComponentInstance != null;
|
20106 | return isProxy ? compAsAny.getFrameworkComponentInstance() : comp;
|
20107 | }
|
20108 | var GridApi = (function () {
|
20109 | function GridApi() {
|
20110 | this.detailGridInfoMap = {};
|
20111 | this.destroyCalled = false;
|
20112 | }
|
20113 | GridApi.prototype.registerOverlayWrapperComp = function (overlayWrapperComp) {
|
20114 | this.overlayWrapperComp = overlayWrapperComp;
|
20115 | };
|
20116 | GridApi.prototype.registerSideBarComp = function (sideBarComp) {
|
20117 | this.sideBarComp = sideBarComp;
|
20118 | };
|
20119 | GridApi.prototype.init = function () {
|
20120 | var _this = this;
|
20121 | switch (this.rowModel.getType()) {
|
20122 | case 'clientSide':
|
20123 | this.clientSideRowModel = this.rowModel;
|
20124 | break;
|
20125 | case 'infinite':
|
20126 | this.infiniteRowModel = this.rowModel;
|
20127 | break;
|
20128 | case 'serverSide':
|
20129 | this.serverSideRowModel = this.rowModel;
|
20130 | break;
|
20131 | }
|
20132 | this.ctrlsService.whenReady(function () {
|
20133 | _this.gridBodyCtrl = _this.ctrlsService.getGridBodyCtrl();
|
20134 | });
|
20135 | };
|
20136 |
|
20137 | GridApi.prototype.__getAlignedGridService = function () {
|
20138 | return this.alignedGridsService;
|
20139 | };
|
20140 |
|
20141 | GridApi.prototype.__getContext = function () {
|
20142 | return this.context;
|
20143 | };
|
20144 | GridApi.prototype.getSetterMethod = function (key) {
|
20145 | return "set" + key.charAt(0).toUpperCase() + key.substring(1);
|
20146 | };
|
20147 |
|
20148 | GridApi.prototype.__setProperty = function (propertyName, value) {
|
20149 |
|
20150 |
|
20151 | this.gridOptionsService.set(propertyName, value);
|
20152 |
|
20153 |
|
20154 | var setterName = this.getSetterMethod(propertyName);
|
20155 | var dynamicApi = this;
|
20156 | if (dynamicApi[setterName]) {
|
20157 | dynamicApi[setterName](value);
|
20158 | }
|
20159 | };
|
20160 |
|
20161 | GridApi.prototype.addDetailGridInfo = function (id, gridInfo) {
|
20162 | this.detailGridInfoMap[id] = gridInfo;
|
20163 | };
|
20164 |
|
20165 | GridApi.prototype.removeDetailGridInfo = function (id) {
|
20166 | this.detailGridInfoMap[id] = undefined;
|
20167 | };
|
20168 |
|
20169 | GridApi.prototype.getDetailGridInfo = function (id) {
|
20170 | return this.detailGridInfoMap[id];
|
20171 | };
|
20172 |
|
20173 | GridApi.prototype.forEachDetailGridInfo = function (callback) {
|
20174 | var index = 0;
|
20175 | iterateObject(this.detailGridInfoMap, function (id, gridInfo) {
|
20176 |
|
20177 | if (exists(gridInfo)) {
|
20178 | callback(gridInfo, index);
|
20179 | index++;
|
20180 | }
|
20181 | });
|
20182 | };
|
20183 |
|
20184 | GridApi.prototype.getDataAsCsv = function (params) {
|
20185 | if (ModuleRegistry.assertRegistered(ModuleNames.CsvExportModule, 'api.getDataAsCsv')) {
|
20186 | return this.csvCreator.getDataAsCsv(params);
|
20187 | }
|
20188 | };
|
20189 |
|
20190 | GridApi.prototype.exportDataAsCsv = function (params) {
|
20191 | if (ModuleRegistry.assertRegistered(ModuleNames.CsvExportModule, 'api.exportDataAsCSv')) {
|
20192 | this.csvCreator.exportDataAsCsv(params);
|
20193 | }
|
20194 | };
|
20195 | GridApi.prototype.getExcelExportMode = function (params) {
|
20196 | var baseParams = this.gridOptionsService.get('defaultExcelExportParams');
|
20197 | var mergedParams = Object.assign({ exportMode: 'xlsx' }, baseParams, params);
|
20198 | return mergedParams.exportMode;
|
20199 | };
|
20200 | GridApi.prototype.assertNotExcelMultiSheet = function (method, params) {
|
20201 | if (!ModuleRegistry.assertRegistered(ModuleNames.ExcelExportModule, 'api.' + method)) {
|
20202 | return false;
|
20203 | }
|
20204 | var exportMode = this.getExcelExportMode(params);
|
20205 | if (this.excelCreator.getFactoryMode(exportMode) === ExcelFactoryMode.MULTI_SHEET) {
|
20206 | console.warn("AG Grid: The Excel Exporter is currently on Multi Sheet mode. End that operation by calling 'api.getMultipleSheetAsExcel()' or 'api.exportMultipleSheetsAsExcel()'");
|
20207 | return false;
|
20208 | }
|
20209 | return true;
|
20210 | };
|
20211 |
|
20212 | GridApi.prototype.getDataAsExcel = function (params) {
|
20213 | if (this.assertNotExcelMultiSheet('getDataAsExcel', params)) {
|
20214 | return this.excelCreator.getDataAsExcel(params);
|
20215 | }
|
20216 | };
|
20217 |
|
20218 | GridApi.prototype.exportDataAsExcel = function (params) {
|
20219 | if (this.assertNotExcelMultiSheet('exportDataAsExcel', params)) {
|
20220 | this.excelCreator.exportDataAsExcel(params);
|
20221 | }
|
20222 | };
|
20223 |
|
20224 | GridApi.prototype.getSheetDataForExcel = function (params) {
|
20225 | if (!ModuleRegistry.assertRegistered(ModuleNames.ExcelExportModule, 'api.getSheetDataForExcel')) {
|
20226 | return;
|
20227 | }
|
20228 | var exportMode = this.getExcelExportMode(params);
|
20229 | this.excelCreator.setFactoryMode(ExcelFactoryMode.MULTI_SHEET, exportMode);
|
20230 | return this.excelCreator.getSheetDataForExcel(params);
|
20231 | };
|
20232 |
|
20233 | GridApi.prototype.getMultipleSheetsAsExcel = function (params) {
|
20234 | if (ModuleRegistry.assertRegistered(ModuleNames.ExcelExportModule, 'api.getMultipleSheetsAsExcel')) {
|
20235 | return this.excelCreator.getMultipleSheetsAsExcel(params);
|
20236 | }
|
20237 | };
|
20238 |
|
20239 | GridApi.prototype.exportMultipleSheetsAsExcel = function (params) {
|
20240 | if (ModuleRegistry.assertRegistered(ModuleNames.ExcelExportModule, 'api.exportMultipleSheetsAsExcel')) {
|
20241 | return this.excelCreator.exportMultipleSheetsAsExcel(params);
|
20242 | }
|
20243 | };
|
20244 | |
20245 |
|
20246 |
|
20247 |
|
20248 |
|
20249 |
|
20250 |
|
20251 | GridApi.prototype.setGridAriaProperty = function (property, value) {
|
20252 | if (!property) {
|
20253 | return;
|
20254 | }
|
20255 | var eGrid = this.ctrlsService.getGridBodyCtrl().getGui();
|
20256 | var ariaProperty = "aria-" + property;
|
20257 | if (value === null) {
|
20258 | eGrid.removeAttribute(ariaProperty);
|
20259 | }
|
20260 | else {
|
20261 | eGrid.setAttribute(ariaProperty, value);
|
20262 | }
|
20263 | };
|
20264 | GridApi.prototype.logMissingRowModel = function (apiMethod) {
|
20265 | var requiredRowModels = [];
|
20266 | for (var _i = 1; _i < arguments.length; _i++) {
|
20267 | requiredRowModels[_i - 1] = arguments[_i];
|
20268 | }
|
20269 | console.error("AG Grid: api." + apiMethod + " can only be called when gridOptions.rowModelType is " + requiredRowModels.join(' or '));
|
20270 | };
|
20271 |
|
20272 | GridApi.prototype.setServerSideDatasource = function (datasource) {
|
20273 | if (this.serverSideRowModel) {
|
20274 | this.serverSideRowModel.setDatasource(datasource);
|
20275 | }
|
20276 | else {
|
20277 | this.logMissingRowModel('setServerSideDatasource', 'serverSide');
|
20278 | }
|
20279 | };
|
20280 | |
20281 |
|
20282 |
|
20283 |
|
20284 |
|
20285 | GridApi.prototype.setCacheBlockSize = function (blockSize) {
|
20286 | if (this.serverSideRowModel) {
|
20287 | this.gridOptionsService.set('cacheBlockSize', blockSize);
|
20288 | this.serverSideRowModel.resetRootStore();
|
20289 | }
|
20290 | else {
|
20291 | this.logMissingRowModel('setCacheBlockSize', 'serverSide');
|
20292 | }
|
20293 | };
|
20294 |
|
20295 | GridApi.prototype.setDatasource = function (datasource) {
|
20296 | if (this.gridOptionsService.isRowModelType('infinite')) {
|
20297 | this.rowModel.setDatasource(datasource);
|
20298 | }
|
20299 | else {
|
20300 | this.logMissingRowModel('setDatasource', 'infinite');
|
20301 | }
|
20302 | };
|
20303 |
|
20304 | GridApi.prototype.setViewportDatasource = function (viewportDatasource) {
|
20305 | if (this.gridOptionsService.isRowModelType('viewport')) {
|
20306 |
|
20307 |
|
20308 |
|
20309 | this.rowModel.setViewportDatasource(viewportDatasource);
|
20310 | }
|
20311 | else {
|
20312 | this.logMissingRowModel('setViewportDatasource', 'viewport');
|
20313 | }
|
20314 | };
|
20315 |
|
20316 | GridApi.prototype.setRowData = function (rowData) {
|
20317 |
|
20318 | var missingImmutableService = this.immutableService == null;
|
20319 | if (missingImmutableService) {
|
20320 | this.logMissingRowModel('setRowData', 'clientSide');
|
20321 | return;
|
20322 | }
|
20323 |
|
20324 | if (this.immutableService.isActive()) {
|
20325 | this.immutableService.setRowData(rowData);
|
20326 | }
|
20327 | else {
|
20328 | this.selectionService.reset();
|
20329 | this.clientSideRowModel.setRowData(rowData);
|
20330 | }
|
20331 | };
|
20332 |
|
20333 | GridApi.prototype.setPinnedTopRowData = function (rows) {
|
20334 | this.pinnedRowModel.setPinnedTopRowData(rows);
|
20335 | };
|
20336 |
|
20337 | GridApi.prototype.setPinnedBottomRowData = function (rows) {
|
20338 | this.pinnedRowModel.setPinnedBottomRowData(rows);
|
20339 | };
|
20340 |
|
20341 | GridApi.prototype.getPinnedTopRowCount = function () {
|
20342 | return this.pinnedRowModel.getPinnedTopRowCount();
|
20343 | };
|
20344 |
|
20345 | GridApi.prototype.getPinnedBottomRowCount = function () {
|
20346 | return this.pinnedRowModel.getPinnedBottomRowCount();
|
20347 | };
|
20348 |
|
20349 | GridApi.prototype.getPinnedTopRow = function (index) {
|
20350 | return this.pinnedRowModel.getPinnedTopRow(index);
|
20351 | };
|
20352 |
|
20353 | GridApi.prototype.getPinnedBottomRow = function (index) {
|
20354 | return this.pinnedRowModel.getPinnedBottomRow(index);
|
20355 | };
|
20356 | |
20357 |
|
20358 |
|
20359 | GridApi.prototype.setColumnDefs = function (colDefs, source) {
|
20360 | if (source === void 0) { source = "api"; }
|
20361 | this.columnModel.setColumnDefs(colDefs, source);
|
20362 |
|
20363 | this.gridOptionsService.set('columnDefs', colDefs, true, { source: source });
|
20364 | };
|
20365 |
|
20366 | GridApi.prototype.setAutoGroupColumnDef = function (colDef, source) {
|
20367 | if (source === void 0) { source = "api"; }
|
20368 | this.gridOptionsService.set('autoGroupColumnDef', colDef, true, { source: source });
|
20369 | };
|
20370 |
|
20371 | GridApi.prototype.setDefaultColDef = function (colDef, source) {
|
20372 | if (source === void 0) { source = "api"; }
|
20373 | this.gridOptionsService.set('defaultColDef', colDef, true, { source: source });
|
20374 | };
|
20375 |
|
20376 | GridApi.prototype.setColumnTypes = function (columnTypes, source) {
|
20377 | if (source === void 0) { source = "api"; }
|
20378 | this.gridOptionsService.set('columnTypes', columnTypes, true, { source: source });
|
20379 | };
|
20380 | GridApi.prototype.expireValueCache = function () {
|
20381 | this.valueCache.expire();
|
20382 | };
|
20383 | |
20384 |
|
20385 |
|
20386 |
|
20387 |
|
20388 | GridApi.prototype.getVerticalPixelRange = function () {
|
20389 | return this.gridBodyCtrl.getScrollFeature().getVScrollPosition();
|
20390 | };
|
20391 | |
20392 |
|
20393 |
|
20394 |
|
20395 |
|
20396 | GridApi.prototype.getHorizontalPixelRange = function () {
|
20397 | return this.gridBodyCtrl.getScrollFeature().getHScrollPosition();
|
20398 | };
|
20399 |
|
20400 | GridApi.prototype.setAlwaysShowHorizontalScroll = function (show) {
|
20401 | this.gridOptionsService.set('alwaysShowHorizontalScroll', show);
|
20402 | };
|
20403 |
|
20404 | GridApi.prototype.setAlwaysShowVerticalScroll = function (show) {
|
20405 | this.gridOptionsService.set('alwaysShowVerticalScroll', show);
|
20406 | };
|
20407 |
|
20408 | GridApi.prototype.refreshCells = function (params) {
|
20409 | if (params === void 0) { params = {}; }
|
20410 | this.rowRenderer.refreshCells(params);
|
20411 | };
|
20412 |
|
20413 | GridApi.prototype.flashCells = function (params) {
|
20414 | if (params === void 0) { params = {}; }
|
20415 | this.rowRenderer.flashCells(params);
|
20416 | };
|
20417 |
|
20418 | GridApi.prototype.redrawRows = function (params) {
|
20419 | if (params === void 0) { params = {}; }
|
20420 | var rowNodes = params ? params.rowNodes : undefined;
|
20421 | this.rowRenderer.redrawRows(rowNodes);
|
20422 | };
|
20423 | GridApi.prototype.setFunctionsReadOnly = function (readOnly) {
|
20424 | this.gridOptionsService.set('functionsReadOnly', readOnly);
|
20425 | };
|
20426 |
|
20427 | GridApi.prototype.refreshHeader = function () {
|
20428 | this.ctrlsService.getHeaderRowContainerCtrls().forEach(function (c) { return c.refresh(); });
|
20429 | };
|
20430 |
|
20431 | GridApi.prototype.isAnyFilterPresent = function () {
|
20432 | return this.filterManager.isAnyFilterPresent();
|
20433 | };
|
20434 |
|
20435 | GridApi.prototype.isColumnFilterPresent = function () {
|
20436 | return this.filterManager.isColumnFilterPresent() || this.filterManager.isAggregateFilterPresent();
|
20437 | };
|
20438 |
|
20439 | GridApi.prototype.isQuickFilterPresent = function () {
|
20440 | return this.filterManager.isQuickFilterPresent();
|
20441 | };
|
20442 | |
20443 |
|
20444 |
|
20445 |
|
20446 |
|
20447 | GridApi.prototype.getModel = function () {
|
20448 | return this.rowModel;
|
20449 | };
|
20450 |
|
20451 | GridApi.prototype.setRowNodeExpanded = function (rowNode, expanded, expandParents) {
|
20452 | if (rowNode) {
|
20453 |
|
20454 | if (expandParents && rowNode.parent && rowNode.parent.level !== -1) {
|
20455 | this.setRowNodeExpanded(rowNode.parent, expanded, expandParents);
|
20456 | }
|
20457 | rowNode.setExpanded(expanded);
|
20458 | }
|
20459 | };
|
20460 | |
20461 |
|
20462 |
|
20463 |
|
20464 |
|
20465 | GridApi.prototype.onGroupExpandedOrCollapsed = function () {
|
20466 | if (missing(this.clientSideRowModel)) {
|
20467 | this.logMissingRowModel('onGroupExpandedOrCollapsed', 'clientSide');
|
20468 | return;
|
20469 | }
|
20470 |
|
20471 |
|
20472 |
|
20473 |
|
20474 | this.clientSideRowModel.refreshModel({ step: ClientSideRowModelSteps.MAP });
|
20475 | };
|
20476 | |
20477 |
|
20478 |
|
20479 |
|
20480 | GridApi.prototype.refreshClientSideRowModel = function (step) {
|
20481 | if (missing(this.clientSideRowModel)) {
|
20482 | this.logMissingRowModel('refreshClientSideRowModel', 'clientSide');
|
20483 | return;
|
20484 | }
|
20485 | this.clientSideRowModel.refreshModel(step);
|
20486 | };
|
20487 |
|
20488 | GridApi.prototype.isAnimationFrameQueueEmpty = function () {
|
20489 | return this.animationFrameService.isQueueEmpty();
|
20490 | };
|
20491 | GridApi.prototype.flushAllAnimationFrames = function () {
|
20492 | this.animationFrameService.flushAllFrames();
|
20493 | };
|
20494 | |
20495 |
|
20496 |
|
20497 |
|
20498 |
|
20499 |
|
20500 | GridApi.prototype.getRowNode = function (id) {
|
20501 | return this.rowModel.getRowNode(id);
|
20502 | };
|
20503 | |
20504 |
|
20505 |
|
20506 |
|
20507 | GridApi.prototype.getSizesForCurrentTheme = function () {
|
20508 | return {
|
20509 | rowHeight: this.gridOptionsService.getRowHeightAsNumber(),
|
20510 | headerHeight: this.columnModel.getHeaderHeight()
|
20511 | };
|
20512 | };
|
20513 |
|
20514 | GridApi.prototype.expandAll = function () {
|
20515 | if (this.clientSideRowModel) {
|
20516 | this.clientSideRowModel.expandOrCollapseAll(true);
|
20517 | }
|
20518 | else if (this.serverSideRowModel) {
|
20519 | this.serverSideRowModel.expandAll(true);
|
20520 | }
|
20521 | else {
|
20522 | this.logMissingRowModel('expandAll', 'clientSide', 'serverSide');
|
20523 | }
|
20524 | };
|
20525 |
|
20526 | GridApi.prototype.collapseAll = function () {
|
20527 | if (this.clientSideRowModel) {
|
20528 | this.clientSideRowModel.expandOrCollapseAll(false);
|
20529 | }
|
20530 | else if (this.serverSideRowModel) {
|
20531 | this.serverSideRowModel.expandAll(false);
|
20532 | }
|
20533 | else {
|
20534 | this.logMissingRowModel('expandAll', 'clientSide', 'serverSide');
|
20535 | }
|
20536 | };
|
20537 | |
20538 |
|
20539 |
|
20540 |
|
20541 |
|
20542 |
|
20543 |
|
20544 | GridApi.prototype.addRenderedRowListener = function (eventName, rowIndex, callback) {
|
20545 | this.rowRenderer.addRenderedRowListener(eventName, rowIndex, callback);
|
20546 | };
|
20547 |
|
20548 | GridApi.prototype.getQuickFilter = function () {
|
20549 | return this.gridOptionsService.get('quickFilterText');
|
20550 | };
|
20551 |
|
20552 | GridApi.prototype.setQuickFilter = function (newFilter) {
|
20553 | this.gridOptionsService.set('quickFilterText', newFilter);
|
20554 | };
|
20555 | |
20556 |
|
20557 |
|
20558 |
|
20559 |
|
20560 |
|
20561 | GridApi.prototype.setExcludeHiddenColumnsFromQuickFilter = function (value) {
|
20562 | this.gridOptionsService.set('excludeHiddenColumnsFromQuickFilter', value);
|
20563 | };
|
20564 | |
20565 |
|
20566 |
|
20567 |
|
20568 | GridApi.prototype.selectAll = function (source) {
|
20569 | if (source === void 0) { source = 'apiSelectAll'; }
|
20570 | this.selectionService.selectAllRowNodes({ source: source });
|
20571 | };
|
20572 | |
20573 |
|
20574 |
|
20575 |
|
20576 | GridApi.prototype.deselectAll = function (source) {
|
20577 | if (source === void 0) { source = 'apiSelectAll'; }
|
20578 | this.selectionService.deselectAllRowNodes({ source: source });
|
20579 | };
|
20580 | |
20581 |
|
20582 |
|
20583 |
|
20584 | GridApi.prototype.selectAllFiltered = function (source) {
|
20585 | if (source === void 0) { source = 'apiSelectAllFiltered'; }
|
20586 | this.selectionService.selectAllRowNodes({ source: source, justFiltered: true });
|
20587 | };
|
20588 | |
20589 |
|
20590 |
|
20591 |
|
20592 | GridApi.prototype.deselectAllFiltered = function (source) {
|
20593 | if (source === void 0) { source = 'apiSelectAllFiltered'; }
|
20594 | this.selectionService.deselectAllRowNodes({ source: source, justFiltered: true });
|
20595 | };
|
20596 | |
20597 |
|
20598 |
|
20599 |
|
20600 |
|
20601 |
|
20602 | GridApi.prototype.getServerSideSelectionState = function () {
|
20603 | if (missing(this.serverSideRowModel)) {
|
20604 | this.logMissingRowModel('getServerSideSelectionState', 'serverSide');
|
20605 | return null;
|
20606 | }
|
20607 | return this.selectionService.getServerSideSelectionState();
|
20608 | };
|
20609 | |
20610 |
|
20611 |
|
20612 |
|
20613 |
|
20614 |
|
20615 | GridApi.prototype.setServerSideSelectionState = function (state) {
|
20616 | if (missing(this.serverSideRowModel)) {
|
20617 | this.logMissingRowModel('setServerSideSelectionState', 'serverSide');
|
20618 | return;
|
20619 | }
|
20620 | this.selectionService.setServerSideSelectionState(state);
|
20621 | };
|
20622 | |
20623 |
|
20624 |
|
20625 |
|
20626 | GridApi.prototype.selectAllOnCurrentPage = function (source) {
|
20627 | if (source === void 0) { source = 'apiSelectAllCurrentPage'; }
|
20628 | this.selectionService.selectAllRowNodes({ source: source, justCurrentPage: true });
|
20629 | };
|
20630 | |
20631 |
|
20632 |
|
20633 |
|
20634 | GridApi.prototype.deselectAllOnCurrentPage = function (source) {
|
20635 | if (source === void 0) { source = 'apiSelectAllCurrentPage'; }
|
20636 | this.selectionService.deselectAllRowNodes({ source: source, justCurrentPage: true });
|
20637 | };
|
20638 | |
20639 |
|
20640 |
|
20641 | GridApi.prototype.sizeColumnsToFit = function (params) {
|
20642 | this.gridBodyCtrl.sizeColumnsToFit(params);
|
20643 | };
|
20644 |
|
20645 | GridApi.prototype.showLoadingOverlay = function () {
|
20646 | this.overlayWrapperComp.showLoadingOverlay();
|
20647 | };
|
20648 |
|
20649 | GridApi.prototype.showNoRowsOverlay = function () {
|
20650 | this.overlayWrapperComp.showNoRowsOverlay();
|
20651 | };
|
20652 |
|
20653 | GridApi.prototype.hideOverlay = function () {
|
20654 | this.overlayWrapperComp.hideOverlay();
|
20655 | };
|
20656 | |
20657 |
|
20658 |
|
20659 |
|
20660 |
|
20661 | GridApi.prototype.getSelectedNodes = function () {
|
20662 | return this.selectionService.getSelectedNodes();
|
20663 | };
|
20664 |
|
20665 | GridApi.prototype.getSelectedRows = function () {
|
20666 | return this.selectionService.getSelectedRows();
|
20667 | };
|
20668 | |
20669 |
|
20670 |
|
20671 |
|
20672 |
|
20673 | GridApi.prototype.getBestCostNodeSelection = function () {
|
20674 | if (missing(this.clientSideRowModel)) {
|
20675 | this.logMissingRowModel('getBestCostNodeSelection', 'clientSide');
|
20676 | return;
|
20677 | }
|
20678 | return this.selectionService.getBestCostNodeSelection();
|
20679 | };
|
20680 |
|
20681 | GridApi.prototype.getRenderedNodes = function () {
|
20682 | return this.rowRenderer.getRenderedNodes();
|
20683 | };
|
20684 | |
20685 |
|
20686 |
|
20687 |
|
20688 |
|
20689 |
|
20690 |
|
20691 |
|
20692 |
|
20693 |
|
20694 |
|
20695 |
|
20696 | GridApi.prototype.ensureColumnVisible = function (key, position) {
|
20697 | if (position === void 0) { position = 'auto'; }
|
20698 | this.gridBodyCtrl.getScrollFeature().ensureColumnVisible(key, position);
|
20699 | };
|
20700 | |
20701 |
|
20702 |
|
20703 |
|
20704 |
|
20705 | GridApi.prototype.ensureIndexVisible = function (index, position) {
|
20706 | this.gridBodyCtrl.getScrollFeature().ensureIndexVisible(index, position);
|
20707 | };
|
20708 | |
20709 |
|
20710 |
|
20711 |
|
20712 |
|
20713 | GridApi.prototype.ensureNodeVisible = function (nodeSelector, position) {
|
20714 | if (position === void 0) { position = null; }
|
20715 | this.gridBodyCtrl.getScrollFeature().ensureNodeVisible(nodeSelector, position);
|
20716 | };
|
20717 | |
20718 |
|
20719 |
|
20720 |
|
20721 |
|
20722 |
|
20723 | GridApi.prototype.forEachLeafNode = function (callback) {
|
20724 | if (missing(this.clientSideRowModel)) {
|
20725 | this.logMissingRowModel('forEachLeafNode', 'clientSide');
|
20726 | return;
|
20727 | }
|
20728 | this.clientSideRowModel.forEachLeafNode(callback);
|
20729 | };
|
20730 | |
20731 |
|
20732 |
|
20733 |
|
20734 |
|
20735 |
|
20736 | GridApi.prototype.forEachNode = function (callback, includeFooterNodes) {
|
20737 | this.rowModel.forEachNode(callback, includeFooterNodes);
|
20738 | };
|
20739 |
|
20740 | GridApi.prototype.forEachNodeAfterFilter = function (callback) {
|
20741 | if (missing(this.clientSideRowModel)) {
|
20742 | this.logMissingRowModel('forEachNodeAfterFilter', 'clientSide');
|
20743 | return;
|
20744 | }
|
20745 | this.clientSideRowModel.forEachNodeAfterFilter(callback);
|
20746 | };
|
20747 |
|
20748 | GridApi.prototype.forEachNodeAfterFilterAndSort = function (callback) {
|
20749 | if (missing(this.clientSideRowModel)) {
|
20750 | this.logMissingRowModel('forEachNodeAfterFilterAndSort', 'clientSide');
|
20751 | return;
|
20752 | }
|
20753 | this.clientSideRowModel.forEachNodeAfterFilterAndSort(callback);
|
20754 | };
|
20755 | |
20756 |
|
20757 |
|
20758 |
|
20759 |
|
20760 | GridApi.prototype.getFilterInstance = function (key, callback) {
|
20761 | var res = this.getFilterInstanceImpl(key, function (instance) {
|
20762 | if (!callback) {
|
20763 | return;
|
20764 | }
|
20765 | var unwrapped = unwrapUserComp(instance);
|
20766 | callback(unwrapped);
|
20767 | });
|
20768 | var unwrapped = unwrapUserComp(res);
|
20769 | return unwrapped;
|
20770 | };
|
20771 | GridApi.prototype.getFilterInstanceImpl = function (key, callback) {
|
20772 | var column = this.columnModel.getPrimaryColumn(key);
|
20773 | if (!column) {
|
20774 | return undefined;
|
20775 | }
|
20776 | var filterPromise = this.filterManager.getFilterComponent(column, 'NO_UI');
|
20777 | var currentValue = filterPromise && filterPromise.resolveNow(null, function (filterComp) { return filterComp; });
|
20778 | if (currentValue) {
|
20779 | setTimeout(callback, 0, currentValue);
|
20780 | }
|
20781 | else if (filterPromise) {
|
20782 | filterPromise.then(function (comp) {
|
20783 | callback(comp);
|
20784 | });
|
20785 | }
|
20786 | return currentValue;
|
20787 | };
|
20788 |
|
20789 | GridApi.prototype.destroyFilter = function (key) {
|
20790 | var column = this.columnModel.getPrimaryColumn(key);
|
20791 | if (column) {
|
20792 | return this.filterManager.destroyFilter(column, 'api');
|
20793 | }
|
20794 | };
|
20795 |
|
20796 | GridApi.prototype.getStatusPanel = function (key) {
|
20797 | if (!ModuleRegistry.assertRegistered(ModuleNames.StatusBarModule, 'api.getStatusPanel')) {
|
20798 | return;
|
20799 | }
|
20800 | var comp = this.statusBarService.getStatusPanel(key);
|
20801 | return unwrapUserComp(comp);
|
20802 | };
|
20803 | GridApi.prototype.getColumnDef = function (key) {
|
20804 | var column = this.columnModel.getPrimaryColumn(key);
|
20805 | if (column) {
|
20806 | return column.getColDef();
|
20807 | }
|
20808 | return null;
|
20809 | };
|
20810 | |
20811 |
|
20812 |
|
20813 | GridApi.prototype.getColumnDefs = function () { return this.columnModel.getColumnDefs(); };
|
20814 |
|
20815 | GridApi.prototype.onFilterChanged = function () {
|
20816 | this.filterManager.onFilterChanged();
|
20817 | };
|
20818 | |
20819 |
|
20820 |
|
20821 |
|
20822 | GridApi.prototype.onSortChanged = function () {
|
20823 | this.sortController.onSortChanged('api');
|
20824 | };
|
20825 |
|
20826 | GridApi.prototype.setFilterModel = function (model) {
|
20827 | this.filterManager.setFilterModel(model);
|
20828 | };
|
20829 |
|
20830 | GridApi.prototype.getFilterModel = function () {
|
20831 | return this.filterManager.getFilterModel();
|
20832 | };
|
20833 |
|
20834 | GridApi.prototype.getFocusedCell = function () {
|
20835 | return this.focusService.getFocusedCell();
|
20836 | };
|
20837 |
|
20838 | GridApi.prototype.clearFocusedCell = function () {
|
20839 | return this.focusService.clearFocusedCell();
|
20840 | };
|
20841 |
|
20842 | GridApi.prototype.setFocusedCell = function (rowIndex, colKey, rowPinned) {
|
20843 | this.focusService.setFocusedCell({ rowIndex: rowIndex, column: colKey, rowPinned: rowPinned, forceBrowserFocus: true });
|
20844 | };
|
20845 |
|
20846 | GridApi.prototype.setSuppressRowDrag = function (value) {
|
20847 | this.gridOptionsService.set('suppressRowDrag', value);
|
20848 | };
|
20849 |
|
20850 | GridApi.prototype.setSuppressMoveWhenRowDragging = function (value) {
|
20851 | this.gridOptionsService.set('suppressMoveWhenRowDragging', value);
|
20852 | };
|
20853 |
|
20854 | GridApi.prototype.setSuppressRowClickSelection = function (value) {
|
20855 | this.gridOptionsService.set('suppressRowClickSelection', value);
|
20856 | };
|
20857 |
|
20858 | GridApi.prototype.addRowDropZone = function (params) {
|
20859 | this.gridBodyCtrl.getRowDragFeature().addRowDropZone(params);
|
20860 | };
|
20861 |
|
20862 | GridApi.prototype.removeRowDropZone = function (params) {
|
20863 | var activeDropTarget = this.dragAndDropService.findExternalZone(params);
|
20864 | if (activeDropTarget) {
|
20865 | this.dragAndDropService.removeDropTarget(activeDropTarget);
|
20866 | }
|
20867 | };
|
20868 |
|
20869 | GridApi.prototype.getRowDropZoneParams = function (events) {
|
20870 | return this.gridBodyCtrl.getRowDragFeature().getRowDropZone(events);
|
20871 | };
|
20872 |
|
20873 | GridApi.prototype.setHeaderHeight = function (headerHeight) {
|
20874 | this.gridOptionsService.set('headerHeight', headerHeight);
|
20875 | };
|
20876 | |
20877 |
|
20878 |
|
20879 |
|
20880 | GridApi.prototype.setDomLayout = function (domLayout) {
|
20881 | this.gridOptionsService.set('domLayout', domLayout);
|
20882 | };
|
20883 |
|
20884 | GridApi.prototype.setEnableCellTextSelection = function (selectable) {
|
20885 | this.gridBodyCtrl.setCellTextSelection(selectable);
|
20886 | };
|
20887 |
|
20888 | GridApi.prototype.setFillHandleDirection = function (direction) {
|
20889 | this.gridOptionsService.set('fillHandleDirection', direction);
|
20890 | };
|
20891 |
|
20892 | GridApi.prototype.setGroupHeaderHeight = function (headerHeight) {
|
20893 | this.gridOptionsService.set('groupHeaderHeight', headerHeight);
|
20894 | };
|
20895 |
|
20896 | GridApi.prototype.setFloatingFiltersHeight = function (headerHeight) {
|
20897 | this.gridOptionsService.set('floatingFiltersHeight', headerHeight);
|
20898 | };
|
20899 |
|
20900 | GridApi.prototype.setPivotHeaderHeight = function (headerHeight) {
|
20901 | this.gridOptionsService.set('pivotHeaderHeight', headerHeight);
|
20902 | };
|
20903 |
|
20904 | GridApi.prototype.setPivotGroupHeaderHeight = function (headerHeight) {
|
20905 | this.gridOptionsService.set('pivotGroupHeaderHeight', headerHeight);
|
20906 | };
|
20907 | GridApi.prototype.setPivotMode = function (pivotMode) {
|
20908 | this.columnModel.setPivotMode(pivotMode);
|
20909 | };
|
20910 | GridApi.prototype.setAnimateRows = function (animateRows) {
|
20911 | this.gridOptionsService.set('animateRows', animateRows);
|
20912 | };
|
20913 | GridApi.prototype.setIsExternalFilterPresent = function (isExternalFilterPresentFunc) {
|
20914 | this.gridOptionsService.set('isExternalFilterPresent', isExternalFilterPresentFunc);
|
20915 | };
|
20916 | GridApi.prototype.setDoesExternalFilterPass = function (doesExternalFilterPassFunc) {
|
20917 | this.gridOptionsService.set('doesExternalFilterPass', doesExternalFilterPassFunc);
|
20918 | };
|
20919 | GridApi.prototype.setNavigateToNextCell = function (navigateToNextCellFunc) {
|
20920 | this.gridOptionsService.set('navigateToNextCell', navigateToNextCellFunc);
|
20921 | };
|
20922 | GridApi.prototype.setTabToNextCell = function (tabToNextCellFunc) {
|
20923 | this.gridOptionsService.set('tabToNextCell', tabToNextCellFunc);
|
20924 | };
|
20925 | GridApi.prototype.setTabToNextHeader = function (tabToNextHeaderFunc) {
|
20926 | this.gridOptionsService.set('tabToNextHeader', tabToNextHeaderFunc);
|
20927 | };
|
20928 | GridApi.prototype.setNavigateToNextHeader = function (navigateToNextHeaderFunc) {
|
20929 | this.gridOptionsService.set('navigateToNextHeader', navigateToNextHeaderFunc);
|
20930 | };
|
20931 | GridApi.prototype.setRowGroupPanelShow = function (rowGroupPanelShow) {
|
20932 | this.gridOptionsService.set('rowGroupPanelShow', rowGroupPanelShow);
|
20933 | };
|
20934 |
|
20935 | GridApi.prototype.setGroupRowAggNodes = function (groupRowAggNodesFunc) {
|
20936 | logDeprecation('27.2', 'setGroupRowAggNodes', 'setGetGroupRowAgg');
|
20937 | this.gridOptionsService.set('groupRowAggNodes', groupRowAggNodesFunc);
|
20938 | };
|
20939 | GridApi.prototype.setGetGroupRowAgg = function (getGroupRowAggFunc) {
|
20940 | this.gridOptionsService.set('getGroupRowAgg', getGroupRowAggFunc);
|
20941 | };
|
20942 | GridApi.prototype.setGetBusinessKeyForNode = function (getBusinessKeyForNodeFunc) {
|
20943 | this.gridOptionsService.set('getBusinessKeyForNode', getBusinessKeyForNodeFunc);
|
20944 | };
|
20945 | GridApi.prototype.setGetChildCount = function (getChildCountFunc) {
|
20946 | this.gridOptionsService.set('getChildCount', getChildCountFunc);
|
20947 | };
|
20948 | GridApi.prototype.setProcessRowPostCreate = function (processRowPostCreateFunc) {
|
20949 | this.gridOptionsService.set('processRowPostCreate', processRowPostCreateFunc);
|
20950 | };
|
20951 |
|
20952 | GridApi.prototype.setGetRowNodeId = function (getRowNodeIdFunc) {
|
20953 | logDeprecation('27.1', 'setGetRowNodeId', 'setGetRowId');
|
20954 | this.gridOptionsService.set('getRowNodeId', getRowNodeIdFunc);
|
20955 | };
|
20956 | GridApi.prototype.setGetRowId = function (getRowIdFunc) {
|
20957 | this.gridOptionsService.set('getRowId', getRowIdFunc);
|
20958 | };
|
20959 | GridApi.prototype.setGetRowClass = function (rowClassFunc) {
|
20960 | this.gridOptionsService.set('getRowClass', rowClassFunc);
|
20961 | };
|
20962 |
|
20963 | GridApi.prototype.setIsFullWidthCell = function (isFullWidthCellFunc) {
|
20964 | logDeprecation('27.2', 'setIsFullWidthCell', 'setIsFullWidthRow');
|
20965 | this.gridOptionsService.set('isFullWidthCell', isFullWidthCellFunc);
|
20966 | };
|
20967 | GridApi.prototype.setIsFullWidthRow = function (isFullWidthRowFunc) {
|
20968 | this.gridOptionsService.set('isFullWidthRow', isFullWidthRowFunc);
|
20969 | };
|
20970 | GridApi.prototype.setIsRowSelectable = function (isRowSelectableFunc) {
|
20971 | this.gridOptionsService.set('isRowSelectable', isRowSelectableFunc);
|
20972 | };
|
20973 | GridApi.prototype.setIsRowMaster = function (isRowMasterFunc) {
|
20974 | this.gridOptionsService.set('isRowMaster', isRowMasterFunc);
|
20975 | };
|
20976 |
|
20977 | GridApi.prototype.setPostSort = function (postSortFunc) {
|
20978 | logDeprecation('27.2', 'setPostSort', 'setPostSortRows');
|
20979 | this.gridOptionsService.set('postSort', postSortFunc);
|
20980 | };
|
20981 | GridApi.prototype.setPostSortRows = function (postSortRowsFunc) {
|
20982 | this.gridOptionsService.set('postSortRows', postSortRowsFunc);
|
20983 | };
|
20984 | GridApi.prototype.setGetDocument = function (getDocumentFunc) {
|
20985 | this.gridOptionsService.set('getDocument', getDocumentFunc);
|
20986 | };
|
20987 | GridApi.prototype.setGetContextMenuItems = function (getContextMenuItemsFunc) {
|
20988 | this.gridOptionsService.set('getContextMenuItems', getContextMenuItemsFunc);
|
20989 | };
|
20990 | GridApi.prototype.setGetMainMenuItems = function (getMainMenuItemsFunc) {
|
20991 | this.gridOptionsService.set('getMainMenuItems', getMainMenuItemsFunc);
|
20992 | };
|
20993 | GridApi.prototype.setProcessCellForClipboard = function (processCellForClipboardFunc) {
|
20994 | this.gridOptionsService.set('processCellForClipboard', processCellForClipboardFunc);
|
20995 | };
|
20996 | GridApi.prototype.setSendToClipboard = function (sendToClipboardFunc) {
|
20997 | this.gridOptionsService.set('sendToClipboard', sendToClipboardFunc);
|
20998 | };
|
20999 | GridApi.prototype.setProcessCellFromClipboard = function (processCellFromClipboardFunc) {
|
21000 | this.gridOptionsService.set('processCellFromClipboard', processCellFromClipboardFunc);
|
21001 | };
|
21002 |
|
21003 | GridApi.prototype.setProcessSecondaryColDef = function (processSecondaryColDefFunc) {
|
21004 | logDeprecation('28.0', 'setProcessSecondaryColDef', 'setProcessPivotResultColDef');
|
21005 | this.setProcessPivotResultColDef(processSecondaryColDefFunc);
|
21006 | };
|
21007 |
|
21008 | GridApi.prototype.setProcessSecondaryColGroupDef = function (processSecondaryColGroupDefFunc) {
|
21009 | logDeprecation('28.0', 'setProcessSecondaryColGroupDef', 'setProcessPivotResultColGroupDef');
|
21010 | this.setProcessPivotResultColGroupDef(processSecondaryColGroupDefFunc);
|
21011 | };
|
21012 | GridApi.prototype.setProcessPivotResultColDef = function (processPivotResultColDefFunc) {
|
21013 | this.gridOptionsService.set('processPivotResultColDef', processPivotResultColDefFunc);
|
21014 | };
|
21015 | GridApi.prototype.setProcessPivotResultColGroupDef = function (processPivotResultColGroupDefFunc) {
|
21016 | this.gridOptionsService.set('processPivotResultColGroupDef', processPivotResultColGroupDefFunc);
|
21017 | };
|
21018 | GridApi.prototype.setPostProcessPopup = function (postProcessPopupFunc) {
|
21019 | this.gridOptionsService.set('postProcessPopup', postProcessPopupFunc);
|
21020 | };
|
21021 |
|
21022 | GridApi.prototype.setDefaultGroupOrderComparator = function (defaultGroupOrderComparatorFunc) {
|
21023 | logDeprecation('27.2', 'setDefaultGroupOrderComparator', 'setInitialGroupOrderComparator');
|
21024 | this.gridOptionsService.set('defaultGroupOrderComparator', defaultGroupOrderComparatorFunc);
|
21025 | };
|
21026 | GridApi.prototype.setInitialGroupOrderComparator = function (initialGroupOrderComparatorFunc) {
|
21027 | this.gridOptionsService.set('initialGroupOrderComparator', initialGroupOrderComparatorFunc);
|
21028 | };
|
21029 | GridApi.prototype.setGetChartToolbarItems = function (getChartToolbarItemsFunc) {
|
21030 | this.gridOptionsService.set('getChartToolbarItems', getChartToolbarItemsFunc);
|
21031 | };
|
21032 | GridApi.prototype.setPaginationNumberFormatter = function (paginationNumberFormatterFunc) {
|
21033 | this.gridOptionsService.set('paginationNumberFormatter', paginationNumberFormatterFunc);
|
21034 | };
|
21035 |
|
21036 | GridApi.prototype.setGetServerSideStoreParams = function (getServerSideStoreParamsFunc) {
|
21037 | logDeprecation('28.0', 'setGetServerSideStoreParams', 'setGetServerSideGroupLevelParams');
|
21038 | this.setGetServerSideGroupLevelParams(getServerSideStoreParamsFunc);
|
21039 | };
|
21040 | GridApi.prototype.setGetServerSideGroupLevelParams = function (getServerSideGroupLevelParamsFunc) {
|
21041 | this.gridOptionsService.set('getServerSideGroupLevelParams', getServerSideGroupLevelParamsFunc);
|
21042 | };
|
21043 | GridApi.prototype.setIsServerSideGroupOpenByDefault = function (isServerSideGroupOpenByDefaultFunc) {
|
21044 | this.gridOptionsService.set('isServerSideGroupOpenByDefault', isServerSideGroupOpenByDefaultFunc);
|
21045 | };
|
21046 | GridApi.prototype.setIsApplyServerSideTransaction = function (isApplyServerSideTransactionFunc) {
|
21047 | this.gridOptionsService.set('isApplyServerSideTransaction', isApplyServerSideTransactionFunc);
|
21048 | };
|
21049 | GridApi.prototype.setIsServerSideGroup = function (isServerSideGroupFunc) {
|
21050 | this.gridOptionsService.set('isServerSideGroup', isServerSideGroupFunc);
|
21051 | };
|
21052 | GridApi.prototype.setGetServerSideGroupKey = function (getServerSideGroupKeyFunc) {
|
21053 | this.gridOptionsService.set('getServerSideGroupKey', getServerSideGroupKeyFunc);
|
21054 | };
|
21055 | GridApi.prototype.setGetRowStyle = function (rowStyleFunc) {
|
21056 | this.gridOptionsService.set('getRowStyle', rowStyleFunc);
|
21057 | };
|
21058 | GridApi.prototype.setGetRowHeight = function (rowHeightFunc) {
|
21059 | this.gridOptionsService.set('getRowHeight', rowHeightFunc);
|
21060 | };
|
21061 | GridApi.prototype.assertSideBarLoaded = function (apiMethod) {
|
21062 | return ModuleRegistry.assertRegistered(ModuleNames.SideBarModule, 'api.' + apiMethod);
|
21063 | };
|
21064 |
|
21065 | GridApi.prototype.isSideBarVisible = function () {
|
21066 | return this.assertSideBarLoaded('isSideBarVisible') && this.sideBarComp.isDisplayed();
|
21067 | };
|
21068 |
|
21069 | GridApi.prototype.setSideBarVisible = function (show) {
|
21070 | if (this.assertSideBarLoaded('setSideBarVisible')) {
|
21071 | this.sideBarComp.setDisplayed(show);
|
21072 | }
|
21073 | };
|
21074 |
|
21075 | GridApi.prototype.setSideBarPosition = function (position) {
|
21076 | if (this.assertSideBarLoaded('setSideBarPosition')) {
|
21077 | this.sideBarComp.setSideBarPosition(position);
|
21078 | }
|
21079 | };
|
21080 |
|
21081 | GridApi.prototype.openToolPanel = function (key) {
|
21082 | if (this.assertSideBarLoaded('openToolPanel')) {
|
21083 | this.sideBarComp.openToolPanel(key, 'api');
|
21084 | }
|
21085 | };
|
21086 |
|
21087 | GridApi.prototype.closeToolPanel = function () {
|
21088 | if (this.assertSideBarLoaded('closeToolPanel')) {
|
21089 | this.sideBarComp.close('api');
|
21090 | }
|
21091 | };
|
21092 |
|
21093 | GridApi.prototype.getOpenedToolPanel = function () {
|
21094 | if (this.assertSideBarLoaded('getOpenedToolPanel')) {
|
21095 | return this.sideBarComp.openedItem();
|
21096 | }
|
21097 | return null;
|
21098 | };
|
21099 |
|
21100 | GridApi.prototype.refreshToolPanel = function () {
|
21101 | if (this.assertSideBarLoaded('refreshToolPanel')) {
|
21102 | this.sideBarComp.refresh();
|
21103 | }
|
21104 | };
|
21105 |
|
21106 | GridApi.prototype.isToolPanelShowing = function () {
|
21107 | return this.assertSideBarLoaded('isToolPanelShowing') && this.sideBarComp.isToolPanelShowing();
|
21108 | };
|
21109 |
|
21110 | GridApi.prototype.getToolPanelInstance = function (id) {
|
21111 | if (this.assertSideBarLoaded('getToolPanelInstance')) {
|
21112 | var comp = this.sideBarComp.getToolPanelInstance(id);
|
21113 | return unwrapUserComp(comp);
|
21114 | }
|
21115 | };
|
21116 |
|
21117 | GridApi.prototype.getSideBar = function () {
|
21118 | if (this.assertSideBarLoaded('getSideBar')) {
|
21119 | return this.sideBarComp.getDef();
|
21120 | }
|
21121 | return undefined;
|
21122 | };
|
21123 |
|
21124 | GridApi.prototype.setSideBar = function (def) {
|
21125 | this.gridOptionsService.set('sideBar', def);
|
21126 | };
|
21127 | GridApi.prototype.setSuppressClipboardPaste = function (value) {
|
21128 | this.gridOptionsService.set('suppressClipboardPaste', value);
|
21129 | };
|
21130 |
|
21131 | GridApi.prototype.resetRowHeights = function () {
|
21132 | if (exists(this.clientSideRowModel)) {
|
21133 | if (this.columnModel.isAutoRowHeightActive()) {
|
21134 | console.warn('AG Grid: calling gridApi.resetRowHeights() makes no sense when using Auto Row Height.');
|
21135 | return;
|
21136 | }
|
21137 | this.clientSideRowModel.resetRowHeights();
|
21138 | }
|
21139 | };
|
21140 | GridApi.prototype.setGroupRemoveSingleChildren = function (value) {
|
21141 | this.gridOptionsService.set('groupRemoveSingleChildren', value);
|
21142 | };
|
21143 | GridApi.prototype.setGroupRemoveLowestSingleChildren = function (value) {
|
21144 | this.gridOptionsService.set('groupRemoveLowestSingleChildren', value);
|
21145 | };
|
21146 | GridApi.prototype.setGroupDisplayType = function (value) {
|
21147 | this.gridOptionsService.set('groupDisplayType', value);
|
21148 | };
|
21149 | GridApi.prototype.setRowClass = function (className) {
|
21150 | this.gridOptionsService.set('rowClass', className);
|
21151 | };
|
21152 |
|
21153 | GridApi.prototype.setDeltaSort = function (enable) {
|
21154 | this.gridOptionsService.set('deltaSort', enable);
|
21155 | };
|
21156 | |
21157 |
|
21158 |
|
21159 |
|
21160 |
|
21161 |
|
21162 |
|
21163 | GridApi.prototype.setRowCount = function (rowCount, maxRowFound) {
|
21164 | if (this.serverSideRowModel) {
|
21165 | if (this.columnModel.isRowGroupEmpty()) {
|
21166 | this.serverSideRowModel.setRowCount(rowCount, maxRowFound);
|
21167 | return;
|
21168 | }
|
21169 | console.error('AG Grid: setRowCount cannot be used while using row grouping.');
|
21170 | return;
|
21171 | }
|
21172 | if (this.infiniteRowModel) {
|
21173 | this.infiniteRowModel.setRowCount(rowCount, maxRowFound);
|
21174 | return;
|
21175 | }
|
21176 | this.logMissingRowModel('setRowCount', 'infinite', 'serverSide');
|
21177 | };
|
21178 |
|
21179 | GridApi.prototype.onRowHeightChanged = function () {
|
21180 | if (this.clientSideRowModel) {
|
21181 | this.clientSideRowModel.onRowHeightChanged();
|
21182 | }
|
21183 | else if (this.serverSideRowModel) {
|
21184 | this.serverSideRowModel.onRowHeightChanged();
|
21185 | }
|
21186 | };
|
21187 | |
21188 |
|
21189 |
|
21190 |
|
21191 | GridApi.prototype.getValue = function (colKey, rowNode) {
|
21192 | var column = this.columnModel.getPrimaryColumn(colKey);
|
21193 | if (missing(column)) {
|
21194 | column = this.columnModel.getGridColumn(colKey);
|
21195 | }
|
21196 | if (missing(column)) {
|
21197 | return null;
|
21198 | }
|
21199 | return this.valueService.getValue(column, rowNode);
|
21200 | };
|
21201 |
|
21202 | GridApi.prototype.addEventListener = function (eventType, listener) {
|
21203 | var async = this.gridOptionsService.useAsyncEvents();
|
21204 | this.eventService.addEventListener(eventType, listener, async);
|
21205 | };
|
21206 |
|
21207 | GridApi.prototype.addGlobalListener = function (listener) {
|
21208 | var async = this.gridOptionsService.useAsyncEvents();
|
21209 | this.eventService.addGlobalListener(listener, async);
|
21210 | };
|
21211 |
|
21212 | GridApi.prototype.removeEventListener = function (eventType, listener) {
|
21213 | var async = this.gridOptionsService.useAsyncEvents();
|
21214 | this.eventService.removeEventListener(eventType, listener, async);
|
21215 | };
|
21216 |
|
21217 | GridApi.prototype.removeGlobalListener = function (listener) {
|
21218 | var async = this.gridOptionsService.useAsyncEvents();
|
21219 | this.eventService.removeGlobalListener(listener, async);
|
21220 | };
|
21221 | GridApi.prototype.dispatchEvent = function (event) {
|
21222 | this.eventService.dispatchEvent(event);
|
21223 | };
|
21224 |
|
21225 | GridApi.prototype.destroy = function () {
|
21226 |
|
21227 |
|
21228 | if (this.destroyCalled) {
|
21229 | return;
|
21230 | }
|
21231 | this.destroyCalled = true;
|
21232 |
|
21233 | var gridCtrl = this.ctrlsService.getGridCtrl();
|
21234 | if (gridCtrl) {
|
21235 | gridCtrl.destroyGridUi();
|
21236 | }
|
21237 |
|
21238 | this.context.destroy();
|
21239 | };
|
21240 | GridApi.prototype.cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid = function () {
|
21241 |
|
21242 |
|
21243 |
|
21244 |
|
21245 |
|
21246 |
|
21247 | setTimeout(removeAllReferences.bind(window, this, 'Grid API'), 100);
|
21248 | };
|
21249 | GridApi.prototype.warnIfDestroyed = function (methodName) {
|
21250 | if (this.destroyCalled) {
|
21251 | console.warn("AG Grid: Grid API method " + methodName + " was called on a grid that was destroyed.");
|
21252 | }
|
21253 | return this.destroyCalled;
|
21254 | };
|
21255 |
|
21256 | GridApi.prototype.resetQuickFilter = function () {
|
21257 | if (this.warnIfDestroyed('resetQuickFilter')) {
|
21258 | return;
|
21259 | }
|
21260 | this.filterManager.resetQuickFilterCache();
|
21261 | };
|
21262 |
|
21263 | GridApi.prototype.getCellRanges = function () {
|
21264 | if (this.rangeService) {
|
21265 | return this.rangeService.getCellRanges();
|
21266 | }
|
21267 | ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'api.getCellRanges');
|
21268 | return null;
|
21269 | };
|
21270 |
|
21271 | GridApi.prototype.addCellRange = function (params) {
|
21272 | if (this.rangeService) {
|
21273 | this.rangeService.addCellRange(params);
|
21274 | return;
|
21275 | }
|
21276 | ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'api.addCellRange');
|
21277 | };
|
21278 |
|
21279 | GridApi.prototype.clearRangeSelection = function () {
|
21280 | if (this.rangeService) {
|
21281 | this.rangeService.removeAllCellRanges();
|
21282 | }
|
21283 | ModuleRegistry.assertRegistered(ModuleNames.RangeSelectionModule, 'gridApi.clearRangeSelection');
|
21284 | };
|
21285 |
|
21286 | GridApi.prototype.undoCellEditing = function () {
|
21287 | this.undoRedoService.undo('api');
|
21288 | };
|
21289 |
|
21290 | GridApi.prototype.redoCellEditing = function () {
|
21291 | this.undoRedoService.redo('api');
|
21292 | };
|
21293 |
|
21294 | GridApi.prototype.getCurrentUndoSize = function () {
|
21295 | return this.undoRedoService.getCurrentUndoStackSize();
|
21296 | };
|
21297 |
|
21298 | GridApi.prototype.getCurrentRedoSize = function () {
|
21299 | return this.undoRedoService.getCurrentRedoStackSize();
|
21300 | };
|
21301 |
|
21302 | GridApi.prototype.getChartModels = function () {
|
21303 | if (ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.getChartModels')) {
|
21304 | return this.chartService.getChartModels();
|
21305 | }
|
21306 | };
|
21307 |
|
21308 | GridApi.prototype.getChartRef = function (chartId) {
|
21309 | if (ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.getChartRef')) {
|
21310 | return this.chartService.getChartRef(chartId);
|
21311 | }
|
21312 | };
|
21313 |
|
21314 | GridApi.prototype.getChartImageDataURL = function (params) {
|
21315 | if (ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.getChartImageDataURL')) {
|
21316 | return this.chartService.getChartImageDataURL(params);
|
21317 | }
|
21318 | };
|
21319 |
|
21320 | GridApi.prototype.downloadChart = function (params) {
|
21321 | if (ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.downloadChart')) {
|
21322 | return this.chartService.downloadChart(params);
|
21323 | }
|
21324 | };
|
21325 |
|
21326 | GridApi.prototype.openChartToolPanel = function (params) {
|
21327 | if (ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.openChartToolPanel')) {
|
21328 | return this.chartService.openChartToolPanel(params);
|
21329 | }
|
21330 | };
|
21331 |
|
21332 | GridApi.prototype.closeChartToolPanel = function (params) {
|
21333 | if (ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.closeChartToolPanel')) {
|
21334 | return this.chartService.closeChartToolPanel(params.chartId);
|
21335 | }
|
21336 | };
|
21337 |
|
21338 | GridApi.prototype.createRangeChart = function (params) {
|
21339 | if (ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.createRangeChart')) {
|
21340 | return this.chartService.createRangeChart(params);
|
21341 | }
|
21342 | };
|
21343 |
|
21344 | GridApi.prototype.createCrossFilterChart = function (params) {
|
21345 | if (ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.createCrossFilterChart')) {
|
21346 | return this.chartService.createCrossFilterChart(params);
|
21347 | }
|
21348 | };
|
21349 |
|
21350 | GridApi.prototype.restoreChart = function (chartModel, chartContainer) {
|
21351 | if (ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.restoreChart')) {
|
21352 | return this.chartService.restoreChart(chartModel, chartContainer);
|
21353 | }
|
21354 | };
|
21355 |
|
21356 | GridApi.prototype.createPivotChart = function (params) {
|
21357 | if (ModuleRegistry.assertRegistered(ModuleNames.GridChartsModule, 'api.createPivotChart')) {
|
21358 | return this.chartService.createPivotChart(params);
|
21359 | }
|
21360 | };
|
21361 |
|
21362 | GridApi.prototype.copyToClipboard = function (params) {
|
21363 | if (ModuleRegistry.assertRegistered(ModuleNames.ClipboardModule, 'api.copyToClipboard')) {
|
21364 | this.clipboardService.copyToClipboard(params);
|
21365 | }
|
21366 | };
|
21367 |
|
21368 | GridApi.prototype.cutToClipboard = function (params) {
|
21369 | if (ModuleRegistry.assertRegistered(ModuleNames.ClipboardModule, 'api.cutToClipboard')) {
|
21370 | this.clipboardService.cutToClipboard(params);
|
21371 | }
|
21372 | };
|
21373 |
|
21374 | GridApi.prototype.copySelectedRowsToClipboard = function (params) {
|
21375 | if (ModuleRegistry.assertRegistered(ModuleNames.ClipboardModule, 'api.copySelectedRowsToClipboard')) {
|
21376 | this.clipboardService.copySelectedRowsToClipboard(params);
|
21377 | }
|
21378 | };
|
21379 |
|
21380 | GridApi.prototype.copySelectedRangeToClipboard = function (params) {
|
21381 | if (ModuleRegistry.assertRegistered(ModuleNames.ClipboardModule, 'api.copySelectedRangeToClipboard')) {
|
21382 | this.clipboardService.copySelectedRangeToClipboard(params);
|
21383 | }
|
21384 | };
|
21385 |
|
21386 | GridApi.prototype.copySelectedRangeDown = function () {
|
21387 | if (ModuleRegistry.assertRegistered(ModuleNames.ClipboardModule, 'api.copySelectedRangeDown')) {
|
21388 | this.clipboardService.copyRangeDown();
|
21389 | }
|
21390 | };
|
21391 |
|
21392 | GridApi.prototype.showColumnMenuAfterButtonClick = function (colKey, buttonElement) {
|
21393 |
|
21394 | var column = this.columnModel.getGridColumn(colKey);
|
21395 | this.menuFactory.showMenuAfterButtonClick(column, buttonElement, 'columnMenu');
|
21396 | };
|
21397 |
|
21398 | GridApi.prototype.showColumnMenuAfterMouseClick = function (colKey, mouseEvent) {
|
21399 |
|
21400 | var column = this.columnModel.getGridColumn(colKey);
|
21401 | if (!column) {
|
21402 | column = this.columnModel.getPrimaryColumn(colKey);
|
21403 | }
|
21404 | if (!column) {
|
21405 | console.error("AG Grid: column '" + colKey + "' not found");
|
21406 | return;
|
21407 | }
|
21408 | this.menuFactory.showMenuAfterMouseEvent(column, mouseEvent);
|
21409 | };
|
21410 |
|
21411 | GridApi.prototype.hidePopupMenu = function () {
|
21412 |
|
21413 | if (this.contextMenuFactory) {
|
21414 | this.contextMenuFactory.hideActiveMenu();
|
21415 | }
|
21416 |
|
21417 | this.menuFactory.hideActiveMenu();
|
21418 | };
|
21419 |
|
21420 | GridApi.prototype.setPopupParent = function (ePopupParent) {
|
21421 | this.gridOptionsService.set('popupParent', ePopupParent);
|
21422 | };
|
21423 |
|
21424 | GridApi.prototype.tabToNextCell = function (event) {
|
21425 | return this.navigationService.tabToNextCell(false, event);
|
21426 | };
|
21427 |
|
21428 | GridApi.prototype.tabToPreviousCell = function (event) {
|
21429 | return this.navigationService.tabToNextCell(true, event);
|
21430 | };
|
21431 |
|
21432 | GridApi.prototype.getCellRendererInstances = function (params) {
|
21433 | if (params === void 0) { params = {}; }
|
21434 | var res = this.rowRenderer.getCellRendererInstances(params);
|
21435 | var unwrapped = res.map(unwrapUserComp);
|
21436 | return unwrapped;
|
21437 | };
|
21438 |
|
21439 | GridApi.prototype.getCellEditorInstances = function (params) {
|
21440 | if (params === void 0) { params = {}; }
|
21441 | var res = this.rowRenderer.getCellEditorInstances(params);
|
21442 | var unwrapped = res.map(unwrapUserComp);
|
21443 | return unwrapped;
|
21444 | };
|
21445 |
|
21446 | GridApi.prototype.getEditingCells = function () {
|
21447 | return this.rowRenderer.getEditingCells();
|
21448 | };
|
21449 |
|
21450 | GridApi.prototype.stopEditing = function (cancel) {
|
21451 | if (cancel === void 0) { cancel = false; }
|
21452 | this.rowRenderer.stopEditing(cancel);
|
21453 | };
|
21454 |
|
21455 | GridApi.prototype.startEditingCell = function (params) {
|
21456 | var column = this.columnModel.getGridColumn(params.colKey);
|
21457 | if (!column) {
|
21458 | console.warn("AG Grid: no column found for " + params.colKey);
|
21459 | return;
|
21460 | }
|
21461 | var cellPosition = {
|
21462 | rowIndex: params.rowIndex,
|
21463 | rowPinned: params.rowPinned || null,
|
21464 | column: column
|
21465 | };
|
21466 | var notPinned = params.rowPinned == null;
|
21467 | if (notPinned) {
|
21468 | this.gridBodyCtrl.getScrollFeature().ensureIndexVisible(params.rowIndex);
|
21469 | }
|
21470 | var cell = this.navigationService.getCellByPosition(cellPosition);
|
21471 | if (!cell) {
|
21472 | return;
|
21473 | }
|
21474 | cell.startRowOrCellEdit(params.key, params.charPress);
|
21475 | };
|
21476 |
|
21477 | GridApi.prototype.addAggFunc = function (key, aggFunc) {
|
21478 | if (this.aggFuncService) {
|
21479 | this.aggFuncService.addAggFunc(key, aggFunc);
|
21480 | }
|
21481 | };
|
21482 |
|
21483 | GridApi.prototype.addAggFuncs = function (aggFuncs) {
|
21484 | if (this.aggFuncService) {
|
21485 | this.aggFuncService.addAggFuncs(aggFuncs);
|
21486 | }
|
21487 | };
|
21488 |
|
21489 | GridApi.prototype.clearAggFuncs = function () {
|
21490 | if (this.aggFuncService) {
|
21491 | this.aggFuncService.clear();
|
21492 | }
|
21493 | };
|
21494 |
|
21495 | GridApi.prototype.applyServerSideTransaction = function (transaction) {
|
21496 | if (!this.serverSideTransactionManager) {
|
21497 | this.logMissingRowModel('applyServerSideTransaction', 'serverSide');
|
21498 | return;
|
21499 | }
|
21500 | return this.serverSideTransactionManager.applyTransaction(transaction);
|
21501 | };
|
21502 |
|
21503 | GridApi.prototype.applyServerSideTransactionAsync = function (transaction, callback) {
|
21504 | if (!this.serverSideTransactionManager) {
|
21505 | this.logMissingRowModel('applyServerSideTransactionAsync', 'serverSide');
|
21506 | return;
|
21507 | }
|
21508 | return this.serverSideTransactionManager.applyTransactionAsync(transaction, callback);
|
21509 | };
|
21510 |
|
21511 | GridApi.prototype.retryServerSideLoads = function () {
|
21512 | if (!this.serverSideRowModel) {
|
21513 | this.logMissingRowModel('retryServerSideLoads', 'serverSide');
|
21514 | return;
|
21515 | }
|
21516 | this.serverSideRowModel.retryLoads();
|
21517 | };
|
21518 | GridApi.prototype.flushServerSideAsyncTransactions = function () {
|
21519 | if (!this.serverSideTransactionManager) {
|
21520 | this.logMissingRowModel('flushServerSideAsyncTransactions', 'serverSide');
|
21521 | return;
|
21522 | }
|
21523 | return this.serverSideTransactionManager.flushAsyncTransactions();
|
21524 | };
|
21525 |
|
21526 | GridApi.prototype.applyTransaction = function (rowDataTransaction) {
|
21527 | if (!this.clientSideRowModel) {
|
21528 | this.logMissingRowModel('applyTransaction', 'clientSide');
|
21529 | return;
|
21530 | }
|
21531 | var res = this.clientSideRowModel.updateRowData(rowDataTransaction);
|
21532 |
|
21533 | this.rowRenderer.refreshFullWidthRows(res.update);
|
21534 |
|
21535 | if (!this.gridOptionsService.is('suppressChangeDetection')) {
|
21536 | this.rowRenderer.refreshCells();
|
21537 | }
|
21538 | return res;
|
21539 | };
|
21540 |
|
21541 | GridApi.prototype.applyTransactionAsync = function (rowDataTransaction, callback) {
|
21542 | if (!this.clientSideRowModel) {
|
21543 | this.logMissingRowModel('applyTransactionAsync', 'clientSide');
|
21544 | return;
|
21545 | }
|
21546 | this.clientSideRowModel.batchUpdateRowData(rowDataTransaction, callback);
|
21547 | };
|
21548 |
|
21549 | GridApi.prototype.flushAsyncTransactions = function () {
|
21550 | if (!this.clientSideRowModel) {
|
21551 | this.logMissingRowModel('flushAsyncTransactions', 'clientSide');
|
21552 | return;
|
21553 | }
|
21554 | this.clientSideRowModel.flushAsyncTransactions();
|
21555 | };
|
21556 | GridApi.prototype.setSuppressModelUpdateAfterUpdateTransaction = function (value) {
|
21557 | this.gridOptionsService.set('suppressModelUpdateAfterUpdateTransaction', value);
|
21558 | };
|
21559 | |
21560 |
|
21561 |
|
21562 |
|
21563 |
|
21564 | GridApi.prototype.refreshInfiniteCache = function () {
|
21565 | if (this.infiniteRowModel) {
|
21566 | this.infiniteRowModel.refreshCache();
|
21567 | }
|
21568 | else {
|
21569 | this.logMissingRowModel('refreshInfiniteCache', 'infinite');
|
21570 | }
|
21571 | };
|
21572 | |
21573 |
|
21574 |
|
21575 |
|
21576 |
|
21577 |
|
21578 | GridApi.prototype.purgeInfiniteCache = function () {
|
21579 | if (this.infiniteRowModel) {
|
21580 | this.infiniteRowModel.purgeCache();
|
21581 | }
|
21582 | else {
|
21583 | this.logMissingRowModel('purgeInfiniteCache', 'infinite');
|
21584 | }
|
21585 | };
|
21586 | |
21587 |
|
21588 |
|
21589 |
|
21590 |
|
21591 | GridApi.prototype.refreshServerSide = function (params) {
|
21592 | if (!this.serverSideRowModel) {
|
21593 | this.logMissingRowModel('refreshServerSide', 'serverSide');
|
21594 | return;
|
21595 | }
|
21596 | this.serverSideRowModel.refreshStore(params);
|
21597 | };
|
21598 |
|
21599 | GridApi.prototype.refreshServerSideStore = function (params) {
|
21600 | logDeprecation('28.0', 'refreshServerSideStore', 'refreshServerSide');
|
21601 | return this.refreshServerSide(params);
|
21602 | };
|
21603 |
|
21604 | GridApi.prototype.getServerSideStoreState = function () {
|
21605 | logDeprecation('28.0', 'getServerSideStoreState', 'getServerSideGroupLevelState');
|
21606 | return this.getServerSideGroupLevelState();
|
21607 | };
|
21608 |
|
21609 | GridApi.prototype.getServerSideGroupLevelState = function () {
|
21610 | if (!this.serverSideRowModel) {
|
21611 | this.logMissingRowModel('getServerSideGroupLevelState', 'serverSide');
|
21612 | return [];
|
21613 | }
|
21614 | return this.serverSideRowModel.getStoreState();
|
21615 | };
|
21616 |
|
21617 | GridApi.prototype.getInfiniteRowCount = function () {
|
21618 | if (this.infiniteRowModel) {
|
21619 | return this.infiniteRowModel.getRowCount();
|
21620 | }
|
21621 | else {
|
21622 | this.logMissingRowModel('getInfiniteRowCount', 'infinite');
|
21623 | }
|
21624 | };
|
21625 |
|
21626 | GridApi.prototype.isLastRowIndexKnown = function () {
|
21627 | if (this.infiniteRowModel) {
|
21628 | return this.infiniteRowModel.isLastRowIndexKnown();
|
21629 | }
|
21630 | else {
|
21631 | this.logMissingRowModel('isLastRowIndexKnown', 'infinite');
|
21632 | }
|
21633 | };
|
21634 | |
21635 |
|
21636 |
|
21637 | GridApi.prototype.getCacheBlockState = function () {
|
21638 | return this.rowNodeBlockLoader.getBlockState();
|
21639 | };
|
21640 |
|
21641 | GridApi.prototype.getFirstDisplayedRow = function () {
|
21642 | return this.rowRenderer.getFirstVirtualRenderedRow();
|
21643 | };
|
21644 |
|
21645 | GridApi.prototype.getLastDisplayedRow = function () {
|
21646 | return this.rowRenderer.getLastVirtualRenderedRow();
|
21647 | };
|
21648 |
|
21649 | GridApi.prototype.getDisplayedRowAtIndex = function (index) {
|
21650 | return this.rowModel.getRow(index);
|
21651 | };
|
21652 |
|
21653 | GridApi.prototype.getDisplayedRowCount = function () {
|
21654 | return this.rowModel.getRowCount();
|
21655 | };
|
21656 | |
21657 |
|
21658 |
|
21659 |
|
21660 |
|
21661 | GridApi.prototype.setPagination = function (value) {
|
21662 | this.gridOptionsService.set('pagination', value);
|
21663 | };
|
21664 | |
21665 |
|
21666 |
|
21667 |
|
21668 |
|
21669 | GridApi.prototype.paginationIsLastPageFound = function () {
|
21670 | return this.paginationProxy.isLastPageFound();
|
21671 | };
|
21672 |
|
21673 | GridApi.prototype.paginationGetPageSize = function () {
|
21674 | return this.paginationProxy.getPageSize();
|
21675 | };
|
21676 |
|
21677 | GridApi.prototype.paginationSetPageSize = function (size) {
|
21678 | this.gridOptionsService.set('paginationPageSize', size);
|
21679 | };
|
21680 |
|
21681 | GridApi.prototype.paginationGetCurrentPage = function () {
|
21682 | return this.paginationProxy.getCurrentPage();
|
21683 | };
|
21684 |
|
21685 | GridApi.prototype.paginationGetTotalPages = function () {
|
21686 | return this.paginationProxy.getTotalPages();
|
21687 | };
|
21688 |
|
21689 | GridApi.prototype.paginationGetRowCount = function () {
|
21690 | return this.paginationProxy.getMasterRowCount();
|
21691 | };
|
21692 |
|
21693 | GridApi.prototype.paginationGoToNextPage = function () {
|
21694 | this.paginationProxy.goToNextPage();
|
21695 | };
|
21696 |
|
21697 | GridApi.prototype.paginationGoToPreviousPage = function () {
|
21698 | this.paginationProxy.goToPreviousPage();
|
21699 | };
|
21700 |
|
21701 | GridApi.prototype.paginationGoToFirstPage = function () {
|
21702 | this.paginationProxy.goToFirstPage();
|
21703 | };
|
21704 |
|
21705 | GridApi.prototype.paginationGoToLastPage = function () {
|
21706 | this.paginationProxy.goToLastPage();
|
21707 | };
|
21708 |
|
21709 | GridApi.prototype.paginationGoToPage = function (page) {
|
21710 | this.paginationProxy.goToPage(page);
|
21711 | };
|
21712 | __decorate$1T([
|
21713 | Optional('immutableService')
|
21714 | ], GridApi.prototype, "immutableService", void 0);
|
21715 | __decorate$1T([
|
21716 | Optional('csvCreator')
|
21717 | ], GridApi.prototype, "csvCreator", void 0);
|
21718 | __decorate$1T([
|
21719 | Optional('excelCreator')
|
21720 | ], GridApi.prototype, "excelCreator", void 0);
|
21721 | __decorate$1T([
|
21722 | Autowired('rowRenderer')
|
21723 | ], GridApi.prototype, "rowRenderer", void 0);
|
21724 | __decorate$1T([
|
21725 | Autowired('navigationService')
|
21726 | ], GridApi.prototype, "navigationService", void 0);
|
21727 | __decorate$1T([
|
21728 | Autowired('filterManager')
|
21729 | ], GridApi.prototype, "filterManager", void 0);
|
21730 | __decorate$1T([
|
21731 | Autowired('columnModel')
|
21732 | ], GridApi.prototype, "columnModel", void 0);
|
21733 | __decorate$1T([
|
21734 | Autowired('selectionService')
|
21735 | ], GridApi.prototype, "selectionService", void 0);
|
21736 | __decorate$1T([
|
21737 | Autowired('gridOptionsService')
|
21738 | ], GridApi.prototype, "gridOptionsService", void 0);
|
21739 | __decorate$1T([
|
21740 | Autowired('valueService')
|
21741 | ], GridApi.prototype, "valueService", void 0);
|
21742 | __decorate$1T([
|
21743 | Autowired('alignedGridsService')
|
21744 | ], GridApi.prototype, "alignedGridsService", void 0);
|
21745 | __decorate$1T([
|
21746 | Autowired('eventService')
|
21747 | ], GridApi.prototype, "eventService", void 0);
|
21748 | __decorate$1T([
|
21749 | Autowired('pinnedRowModel')
|
21750 | ], GridApi.prototype, "pinnedRowModel", void 0);
|
21751 | __decorate$1T([
|
21752 | Autowired('context')
|
21753 | ], GridApi.prototype, "context", void 0);
|
21754 | __decorate$1T([
|
21755 | Autowired('rowModel')
|
21756 | ], GridApi.prototype, "rowModel", void 0);
|
21757 | __decorate$1T([
|
21758 | Autowired('sortController')
|
21759 | ], GridApi.prototype, "sortController", void 0);
|
21760 | __decorate$1T([
|
21761 | Autowired('paginationProxy')
|
21762 | ], GridApi.prototype, "paginationProxy", void 0);
|
21763 | __decorate$1T([
|
21764 | Autowired('focusService')
|
21765 | ], GridApi.prototype, "focusService", void 0);
|
21766 | __decorate$1T([
|
21767 | Autowired('dragAndDropService')
|
21768 | ], GridApi.prototype, "dragAndDropService", void 0);
|
21769 | __decorate$1T([
|
21770 | Optional('rangeService')
|
21771 | ], GridApi.prototype, "rangeService", void 0);
|
21772 | __decorate$1T([
|
21773 | Optional('clipboardService')
|
21774 | ], GridApi.prototype, "clipboardService", void 0);
|
21775 | __decorate$1T([
|
21776 | Optional('aggFuncService')
|
21777 | ], GridApi.prototype, "aggFuncService", void 0);
|
21778 | __decorate$1T([
|
21779 | Autowired('menuFactory')
|
21780 | ], GridApi.prototype, "menuFactory", void 0);
|
21781 | __decorate$1T([
|
21782 | Optional('contextMenuFactory')
|
21783 | ], GridApi.prototype, "contextMenuFactory", void 0);
|
21784 | __decorate$1T([
|
21785 | Autowired('valueCache')
|
21786 | ], GridApi.prototype, "valueCache", void 0);
|
21787 | __decorate$1T([
|
21788 | Autowired('animationFrameService')
|
21789 | ], GridApi.prototype, "animationFrameService", void 0);
|
21790 | __decorate$1T([
|
21791 | Optional('statusBarService')
|
21792 | ], GridApi.prototype, "statusBarService", void 0);
|
21793 | __decorate$1T([
|
21794 | Optional('chartService')
|
21795 | ], GridApi.prototype, "chartService", void 0);
|
21796 | __decorate$1T([
|
21797 | Optional('undoRedoService')
|
21798 | ], GridApi.prototype, "undoRedoService", void 0);
|
21799 | __decorate$1T([
|
21800 | Optional('rowNodeBlockLoader')
|
21801 | ], GridApi.prototype, "rowNodeBlockLoader", void 0);
|
21802 | __decorate$1T([
|
21803 | Optional('ssrmTransactionManager')
|
21804 | ], GridApi.prototype, "serverSideTransactionManager", void 0);
|
21805 | __decorate$1T([
|
21806 | Autowired('ctrlsService')
|
21807 | ], GridApi.prototype, "ctrlsService", void 0);
|
21808 | __decorate$1T([
|
21809 | PostConstruct
|
21810 | ], GridApi.prototype, "init", null);
|
21811 | __decorate$1T([
|
21812 | PreDestroy
|
21813 | ], GridApi.prototype, "cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid", null);
|
21814 | GridApi = __decorate$1T([
|
21815 | Bean('gridApi')
|
21816 | ], GridApi);
|
21817 | return GridApi;
|
21818 | }());
|
21819 |
|
21820 |
|
21821 |
|
21822 |
|
21823 |
|
21824 |
|
21825 |
|
21826 | var __extends$20 = (undefined && undefined.__extends) || (function () {
|
21827 | var extendStatics = function (d, b) {
|
21828 | extendStatics = Object.setPrototypeOf ||
|
21829 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
21830 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
21831 | return extendStatics(d, b);
|
21832 | };
|
21833 | return function (d, b) {
|
21834 | extendStatics(d, b);
|
21835 | function __() { this.constructor = d; }
|
21836 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
21837 | };
|
21838 | })();
|
21839 | var __assign$b = (undefined && undefined.__assign) || function () {
|
21840 | __assign$b = Object.assign || function(t) {
|
21841 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
21842 | s = arguments[i];
|
21843 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
21844 | t[p] = s[p];
|
21845 | }
|
21846 | return t;
|
21847 | };
|
21848 | return __assign$b.apply(this, arguments);
|
21849 | };
|
21850 | var __decorate$1S = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
21851 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
21852 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
21853 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
21854 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
21855 | };
|
21856 | var FilterManager = (function (_super) {
|
21857 | __extends$20(FilterManager, _super);
|
21858 | function FilterManager() {
|
21859 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
21860 | _this.allColumnFilters = new Map();
|
21861 | _this.activeAggregateFilters = [];
|
21862 | _this.activeColumnFilters = [];
|
21863 | _this.quickFilter = null;
|
21864 | _this.quickFilterParts = null;
|
21865 |
|
21866 |
|
21867 |
|
21868 |
|
21869 |
|
21870 | _this.processingFilterChange = false;
|
21871 | return _this;
|
21872 | }
|
21873 | FilterManager_1 = FilterManager;
|
21874 | FilterManager.prototype.init = function () {
|
21875 | var _this = this;
|
21876 | this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, function () { return _this.onColumnsChanged(); });
|
21877 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, function () { return _this.refreshFiltersForAggregations(); });
|
21878 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_CHANGED, function () { return _this.refreshFiltersForAggregations(); });
|
21879 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, function () {
|
21880 | _this.refreshFiltersForAggregations();
|
21881 | _this.resetQuickFilterCache();
|
21882 | });
|
21883 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, function () { return _this.resetQuickFilterCache(); });
|
21884 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, function () { return _this.resetQuickFilterCache(); });
|
21885 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, function () {
|
21886 | if (_this.gridOptionsService.is('excludeHiddenColumnsFromQuickFilter')) {
|
21887 | _this.resetQuickFilterCache();
|
21888 | }
|
21889 | });
|
21890 | this.addManagedPropertyListener('quickFilterText', function (e) { return _this.setQuickFilter(e.currentValue); });
|
21891 | this.addManagedPropertyListener('excludeHiddenColumnsFromQuickFilter', function () { return _this.onExcludeHiddenColumnsFromQuickFilterChanged(); });
|
21892 | this.quickFilter = this.parseQuickFilter(this.gridOptionsService.get('quickFilterText'));
|
21893 | this.setQuickFilterParts();
|
21894 | this.allowShowChangeAfterFilter = this.gridOptionsService.is('allowShowChangeAfterFilter');
|
21895 | this.externalFilterPresent = this.isExternalFilterPresentCallback();
|
21896 | };
|
21897 | FilterManager.prototype.isExternalFilterPresentCallback = function () {
|
21898 | var isFilterPresent = this.gridOptionsService.getCallback('isExternalFilterPresent');
|
21899 | if (typeof isFilterPresent === 'function') {
|
21900 | return isFilterPresent({});
|
21901 | }
|
21902 | return false;
|
21903 | };
|
21904 | FilterManager.prototype.doesExternalFilterPass = function (node) {
|
21905 | var doesFilterPass = this.gridOptionsService.get('doesExternalFilterPass');
|
21906 | if (typeof doesFilterPass === 'function') {
|
21907 | return doesFilterPass(node);
|
21908 | }
|
21909 | return false;
|
21910 | };
|
21911 | FilterManager.prototype.setQuickFilterParts = function () {
|
21912 | this.quickFilterParts = this.quickFilter ? this.quickFilter.split(' ') : null;
|
21913 | };
|
21914 | FilterManager.prototype.setFilterModel = function (model) {
|
21915 | var _this = this;
|
21916 | var allPromises = [];
|
21917 | var previousModel = this.getFilterModel();
|
21918 | if (model) {
|
21919 |
|
21920 | var modelKeys_1 = convertToSet(Object.keys(model));
|
21921 | this.allColumnFilters.forEach(function (filterWrapper, colId) {
|
21922 | var newModel = model[colId];
|
21923 | allPromises.push(_this.setModelOnFilterWrapper(filterWrapper.filterPromise, newModel));
|
21924 | modelKeys_1.delete(colId);
|
21925 | });
|
21926 |
|
21927 | modelKeys_1.forEach(function (colId) {
|
21928 | var column = _this.columnModel.getPrimaryColumn(colId) || _this.columnModel.getGridColumn(colId);
|
21929 | if (!column) {
|
21930 | console.warn('AG Grid: setFilterModel() - no column found for colId: ' + colId);
|
21931 | return;
|
21932 | }
|
21933 | if (!column.isFilterAllowed()) {
|
21934 | console.warn('AG Grid: setFilterModel() - unable to fully apply model, filtering disabled for colId: ' + colId);
|
21935 | return;
|
21936 | }
|
21937 | var filterWrapper = _this.getOrCreateFilterWrapper(column, 'NO_UI');
|
21938 | if (!filterWrapper) {
|
21939 | console.warn('AG-Grid: setFilterModel() - unable to fully apply model, unable to create filter for colId: ' + colId);
|
21940 | return;
|
21941 | }
|
21942 | allPromises.push(_this.setModelOnFilterWrapper(filterWrapper.filterPromise, model[colId]));
|
21943 | });
|
21944 | }
|
21945 | else {
|
21946 | this.allColumnFilters.forEach(function (filterWrapper) {
|
21947 | allPromises.push(_this.setModelOnFilterWrapper(filterWrapper.filterPromise, null));
|
21948 | });
|
21949 | }
|
21950 | AgPromise.all(allPromises).then(function () {
|
21951 | var currentModel = _this.getFilterModel();
|
21952 | var columns = [];
|
21953 | _this.allColumnFilters.forEach(function (filterWrapper, colId) {
|
21954 | var before = previousModel ? previousModel[colId] : null;
|
21955 | var after = currentModel ? currentModel[colId] : null;
|
21956 | if (!_.jsonEquals(before, after)) {
|
21957 | columns.push(filterWrapper.column);
|
21958 | }
|
21959 | });
|
21960 | if (columns.length > 0) {
|
21961 | _this.onFilterChanged({ columns: columns });
|
21962 | }
|
21963 | });
|
21964 | };
|
21965 | FilterManager.prototype.setModelOnFilterWrapper = function (filterPromise, newModel) {
|
21966 | return new AgPromise(function (resolve) {
|
21967 | filterPromise.then(function (filter) {
|
21968 | if (typeof filter.setModel !== 'function') {
|
21969 | console.warn('AG Grid: filter missing setModel method, which is needed for setFilterModel');
|
21970 | resolve();
|
21971 | }
|
21972 | (filter.setModel(newModel) || AgPromise.resolve()).then(function () { return resolve(); });
|
21973 | });
|
21974 | });
|
21975 | };
|
21976 | FilterManager.prototype.getFilterModel = function () {
|
21977 | var result = {};
|
21978 | this.allColumnFilters.forEach(function (filterWrapper, key) {
|
21979 |
|
21980 | var filterPromise = filterWrapper.filterPromise;
|
21981 | var filter = filterPromise.resolveNow(null, function (promiseFilter) { return promiseFilter; });
|
21982 | if (filter == null) {
|
21983 | return null;
|
21984 | }
|
21985 | if (typeof filter.getModel !== 'function') {
|
21986 | console.warn('AG Grid: filter API missing getModel method, which is needed for getFilterModel');
|
21987 | return;
|
21988 | }
|
21989 | var model = filter.getModel();
|
21990 | if (exists(model)) {
|
21991 | result[key] = model;
|
21992 | }
|
21993 | });
|
21994 | return result;
|
21995 | };
|
21996 | FilterManager.prototype.isColumnFilterPresent = function () {
|
21997 | return this.activeColumnFilters.length > 0;
|
21998 | };
|
21999 | FilterManager.prototype.isAggregateFilterPresent = function () {
|
22000 | return !!this.activeAggregateFilters.length;
|
22001 | };
|
22002 | FilterManager.prototype.isExternalFilterPresent = function () {
|
22003 | return this.externalFilterPresent;
|
22004 | };
|
22005 | FilterManager.prototype.doAggregateFiltersPass = function (node, filterToSkip) {
|
22006 | return this.doColumnFiltersPass(node, filterToSkip, true);
|
22007 | };
|
22008 |
|
22009 |
|
22010 |
|
22011 | FilterManager.prototype.updateActiveFilters = function () {
|
22012 | var _this = this;
|
22013 | this.activeColumnFilters.length = 0;
|
22014 | this.activeAggregateFilters.length = 0;
|
22015 | var isFilterActive = function (filter) {
|
22016 | if (!filter) {
|
22017 | return false;
|
22018 | }
|
22019 | if (!filter.isFilterActive) {
|
22020 | console.warn('AG Grid: Filter is missing isFilterActive() method');
|
22021 | return false;
|
22022 | }
|
22023 | return filter.isFilterActive();
|
22024 | };
|
22025 | var groupFilterEnabled = !!this.gridOptionsService.getGroupAggFiltering();
|
22026 | var isAggFilter = function (column) {
|
22027 | var isSecondary = !column.isPrimary();
|
22028 |
|
22029 | if (isSecondary) {
|
22030 | return true;
|
22031 | }
|
22032 | var isShowingPrimaryColumns = !_this.columnModel.isPivotActive();
|
22033 | var isValueActive = column.isValueActive();
|
22034 |
|
22035 | if (!isValueActive || !isShowingPrimaryColumns) {
|
22036 | return false;
|
22037 | }
|
22038 |
|
22039 | if (_this.columnModel.isPivotMode()) {
|
22040 |
|
22041 |
|
22042 | return true;
|
22043 | }
|
22044 |
|
22045 | return groupFilterEnabled;
|
22046 | };
|
22047 | this.allColumnFilters.forEach(function (filterWrapper) {
|
22048 | if (filterWrapper.filterPromise.resolveNow(false, isFilterActive)) {
|
22049 | var filterComp = filterWrapper.filterPromise.resolveNow(null, function (filter) { return filter; });
|
22050 | if (isAggFilter(filterWrapper.column)) {
|
22051 | _this.activeAggregateFilters.push(filterComp);
|
22052 | }
|
22053 | else {
|
22054 | _this.activeColumnFilters.push(filterComp);
|
22055 | }
|
22056 | }
|
22057 | });
|
22058 | };
|
22059 | FilterManager.prototype.updateFilterFlagInColumns = function (source, additionalEventAttributes) {
|
22060 | this.allColumnFilters.forEach(function (filterWrapper) {
|
22061 | var isFilterActive = filterWrapper.filterPromise.resolveNow(false, function (filter) { return filter.isFilterActive(); });
|
22062 | filterWrapper.column.setFilterActive(isFilterActive, source, additionalEventAttributes);
|
22063 | });
|
22064 | };
|
22065 | FilterManager.prototype.isAnyFilterPresent = function () {
|
22066 | return this.isQuickFilterPresent() || this.isColumnFilterPresent() || this.isAggregateFilterPresent() || this.isExternalFilterPresent();
|
22067 | };
|
22068 | FilterManager.prototype.doColumnFiltersPass = function (node, filterToSkip, targetAggregates) {
|
22069 | var data = node.data, aggData = node.aggData;
|
22070 | var targetedFilters = targetAggregates ? this.activeAggregateFilters : this.activeColumnFilters;
|
22071 | var targetedData = targetAggregates ? aggData : data;
|
22072 | for (var i = 0; i < targetedFilters.length; i++) {
|
22073 | var filter = targetedFilters[i];
|
22074 | if (filter == null || filter === filterToSkip) {
|
22075 | continue;
|
22076 | }
|
22077 | if (typeof filter.doesFilterPass !== 'function') {
|
22078 |
|
22079 | throw new Error('Filter is missing method doesFilterPass');
|
22080 | }
|
22081 | if (!filter.doesFilterPass({ node: node, data: targetedData })) {
|
22082 | return false;
|
22083 | }
|
22084 | }
|
22085 | return true;
|
22086 | };
|
22087 | FilterManager.prototype.parseQuickFilter = function (newFilter) {
|
22088 | if (!exists(newFilter)) {
|
22089 | return null;
|
22090 | }
|
22091 | if (!this.gridOptionsService.isRowModelType('clientSide')) {
|
22092 | console.warn('AG Grid - Quick filtering only works with the Client-Side Row Model');
|
22093 | return null;
|
22094 | }
|
22095 | return newFilter.toUpperCase();
|
22096 | };
|
22097 | FilterManager.prototype.setQuickFilter = function (newFilter) {
|
22098 | if (newFilter != null && typeof newFilter !== 'string') {
|
22099 | console.warn("AG Grid - setQuickFilter() only supports string inputs, received: " + typeof newFilter);
|
22100 | return;
|
22101 | }
|
22102 | var parsedFilter = this.parseQuickFilter(newFilter);
|
22103 | if (this.quickFilter !== parsedFilter) {
|
22104 | this.quickFilter = parsedFilter;
|
22105 | this.setQuickFilterParts();
|
22106 | this.onFilterChanged();
|
22107 | }
|
22108 | };
|
22109 | FilterManager.prototype.resetQuickFilterCache = function () {
|
22110 | this.rowModel.forEachNode(function (node) { return node.quickFilterAggregateText = null; });
|
22111 | };
|
22112 | FilterManager.prototype.onExcludeHiddenColumnsFromQuickFilterChanged = function () {
|
22113 | this.columnModel.refreshQuickFilterColumns();
|
22114 | this.resetQuickFilterCache();
|
22115 | if (this.isQuickFilterPresent()) {
|
22116 | this.onFilterChanged();
|
22117 | }
|
22118 | };
|
22119 | FilterManager.prototype.refreshFiltersForAggregations = function () {
|
22120 | var isAggFiltering = this.gridOptionsService.getGroupAggFiltering();
|
22121 | if (isAggFiltering) {
|
22122 | this.onFilterChanged();
|
22123 | }
|
22124 | };
|
22125 |
|
22126 |
|
22127 |
|
22128 |
|
22129 |
|
22130 |
|
22131 | FilterManager.prototype.callOnFilterChangedOutsideRenderCycle = function (params) {
|
22132 | var _this = this;
|
22133 | if (params === void 0) { params = {}; }
|
22134 | var action = function () { return _this.onFilterChanged(params); };
|
22135 | if (this.rowRenderer.isRefreshInProgress()) {
|
22136 | setTimeout(action, 0);
|
22137 | }
|
22138 | else {
|
22139 | action();
|
22140 | }
|
22141 | };
|
22142 | FilterManager.prototype.onFilterChanged = function (params) {
|
22143 | if (params === void 0) { params = {}; }
|
22144 | var filterInstance = params.filterInstance, additionalEventAttributes = params.additionalEventAttributes, columns = params.columns;
|
22145 | this.updateDependantFilters();
|
22146 | this.updateActiveFilters();
|
22147 | this.updateFilterFlagInColumns('filterChanged', additionalEventAttributes);
|
22148 | this.externalFilterPresent = this.isExternalFilterPresentCallback();
|
22149 | this.allColumnFilters.forEach(function (filterWrapper) {
|
22150 | if (!filterWrapper.filterPromise) {
|
22151 | return;
|
22152 | }
|
22153 | filterWrapper.filterPromise.then(function (filter) {
|
22154 | if (filter && filter !== filterInstance && filter.onAnyFilterChanged) {
|
22155 | filter.onAnyFilterChanged();
|
22156 | }
|
22157 | });
|
22158 | });
|
22159 | var filterChangedEvent = {
|
22160 | type: Events.EVENT_FILTER_CHANGED,
|
22161 | columns: columns || [],
|
22162 | };
|
22163 | if (additionalEventAttributes) {
|
22164 | mergeDeep(filterChangedEvent, additionalEventAttributes);
|
22165 | }
|
22166 |
|
22167 |
|
22168 | this.processingFilterChange = true;
|
22169 | this.eventService.dispatchEvent(filterChangedEvent);
|
22170 | this.processingFilterChange = false;
|
22171 | };
|
22172 | FilterManager.prototype.isSuppressFlashingCellsBecauseFiltering = function () {
|
22173 |
|
22174 |
|
22175 | return !this.allowShowChangeAfterFilter && this.processingFilterChange;
|
22176 | };
|
22177 | FilterManager.prototype.isQuickFilterPresent = function () {
|
22178 | return this.quickFilter !== null;
|
22179 | };
|
22180 | FilterManager.prototype.doesRowPassOtherFilters = function (filterToSkip, node) {
|
22181 | return this.doesRowPassFilter({ rowNode: node, filterInstanceToSkip: filterToSkip });
|
22182 | };
|
22183 | FilterManager.prototype.doesRowPassQuickFilterNoCache = function (node, filterPart) {
|
22184 | var _this = this;
|
22185 | var columns = this.columnModel.getAllColumnsForQuickFilter();
|
22186 | return columns.some(function (column) {
|
22187 | var part = _this.getQuickFilterTextForColumn(column, node);
|
22188 | return exists(part) && part.indexOf(filterPart) >= 0;
|
22189 | });
|
22190 | };
|
22191 | FilterManager.prototype.doesRowPassQuickFilterCache = function (node, filterPart) {
|
22192 | if (!node.quickFilterAggregateText) {
|
22193 | this.aggregateRowForQuickFilter(node);
|
22194 | }
|
22195 | return node.quickFilterAggregateText.indexOf(filterPart) >= 0;
|
22196 | };
|
22197 | FilterManager.prototype.doesRowPassQuickFilter = function (node) {
|
22198 | var _this = this;
|
22199 | var usingCache = this.gridOptionsService.is('cacheQuickFilter');
|
22200 |
|
22201 | return this.quickFilterParts.every(function (part) {
|
22202 | return usingCache ? _this.doesRowPassQuickFilterCache(node, part) : _this.doesRowPassQuickFilterNoCache(node, part);
|
22203 | });
|
22204 | };
|
22205 | FilterManager.prototype.doesRowPassAggregateFilters = function (params) {
|
22206 | if (this.isAggregateFilterPresent() && !this.doAggregateFiltersPass(params.rowNode, params.filterInstanceToSkip)) {
|
22207 | return false;
|
22208 | }
|
22209 |
|
22210 | return true;
|
22211 | };
|
22212 | FilterManager.prototype.doesRowPassFilter = function (params) {
|
22213 |
|
22214 |
|
22215 |
|
22216 |
|
22217 | if (this.isQuickFilterPresent() && !this.doesRowPassQuickFilter(params.rowNode)) {
|
22218 | return false;
|
22219 | }
|
22220 |
|
22221 | if (this.isExternalFilterPresent() && !this.doesExternalFilterPass(params.rowNode)) {
|
22222 | return false;
|
22223 | }
|
22224 |
|
22225 | if (this.isColumnFilterPresent() && !this.doColumnFiltersPass(params.rowNode, params.filterInstanceToSkip)) {
|
22226 | return false;
|
22227 | }
|
22228 |
|
22229 | return true;
|
22230 | };
|
22231 | FilterManager.prototype.getQuickFilterTextForColumn = function (column, node) {
|
22232 | var value = this.valueService.getValue(column, node, true);
|
22233 | var colDef = column.getColDef();
|
22234 | if (colDef.getQuickFilterText) {
|
22235 | var params = {
|
22236 | value: value,
|
22237 | node: node,
|
22238 | data: node.data,
|
22239 | column: column,
|
22240 | colDef: colDef,
|
22241 | api: this.gridOptionsService.api,
|
22242 | columnApi: this.gridOptionsService.columnApi,
|
22243 | context: this.gridOptionsService.context
|
22244 | };
|
22245 | value = colDef.getQuickFilterText(params);
|
22246 | }
|
22247 | return exists(value) ? value.toString().toUpperCase() : null;
|
22248 | };
|
22249 | FilterManager.prototype.aggregateRowForQuickFilter = function (node) {
|
22250 | var _this = this;
|
22251 | var stringParts = [];
|
22252 | var columns = this.columnModel.getAllColumnsForQuickFilter();
|
22253 | columns.forEach(function (column) {
|
22254 | var part = _this.getQuickFilterTextForColumn(column, node);
|
22255 | if (exists(part)) {
|
22256 | stringParts.push(part);
|
22257 | }
|
22258 | });
|
22259 | node.quickFilterAggregateText = stringParts.join(FilterManager_1.QUICK_FILTER_SEPARATOR);
|
22260 | };
|
22261 | FilterManager.prototype.onNewRowsLoaded = function (source) {
|
22262 | this.allColumnFilters.forEach(function (filterWrapper) {
|
22263 | filterWrapper.filterPromise.then(function (filter) {
|
22264 | if (filter.onNewRowsLoaded) {
|
22265 | filter.onNewRowsLoaded();
|
22266 | }
|
22267 | });
|
22268 | });
|
22269 | this.updateFilterFlagInColumns(source, { afterDataChange: true });
|
22270 | this.updateActiveFilters();
|
22271 | };
|
22272 | FilterManager.prototype.createValueGetter = function (column) {
|
22273 | var _this = this;
|
22274 | return function (_a) {
|
22275 | var node = _a.node;
|
22276 | return _this.valueService.getValue(column, node, true);
|
22277 | };
|
22278 | };
|
22279 | FilterManager.prototype.getFilterComponent = function (column, source, createIfDoesNotExist) {
|
22280 | var _a;
|
22281 | if (createIfDoesNotExist === void 0) { createIfDoesNotExist = true; }
|
22282 | if (createIfDoesNotExist) {
|
22283 | return ((_a = this.getOrCreateFilterWrapper(column, source)) === null || _a === void 0 ? void 0 : _a.filterPromise) || null;
|
22284 | }
|
22285 | var filterWrapper = this.cachedFilter(column);
|
22286 | return filterWrapper ? filterWrapper.filterPromise : null;
|
22287 | };
|
22288 | FilterManager.prototype.isFilterActive = function (column) {
|
22289 | var filterWrapper = this.cachedFilter(column);
|
22290 | return !!filterWrapper && filterWrapper.filterPromise.resolveNow(false, function (filter) { return filter.isFilterActive(); });
|
22291 | };
|
22292 | FilterManager.prototype.getOrCreateFilterWrapper = function (column, source) {
|
22293 | if (!column.isFilterAllowed()) {
|
22294 | return null;
|
22295 | }
|
22296 | var filterWrapper = this.cachedFilter(column);
|
22297 | if (!filterWrapper) {
|
22298 | filterWrapper = this.createFilterWrapper(column, source);
|
22299 | this.allColumnFilters.set(column.getColId(), filterWrapper);
|
22300 | }
|
22301 | else if (source !== 'NO_UI') {
|
22302 | this.putIntoGui(filterWrapper, source);
|
22303 | }
|
22304 | return filterWrapper;
|
22305 | };
|
22306 | FilterManager.prototype.cachedFilter = function (column) {
|
22307 | return this.allColumnFilters.get(column.getColId());
|
22308 | };
|
22309 | FilterManager.prototype.createFilterInstance = function (column) {
|
22310 | var _this = this;
|
22311 | var defaultFilter = ModuleRegistry.isRegistered(ModuleNames.SetFilterModule) ? 'agSetColumnFilter' : 'agTextColumnFilter';
|
22312 | var colDef = column.getColDef();
|
22313 | var filterInstance;
|
22314 | var params = __assign$b(__assign$b({}, this.createFilterParams(column, colDef)), { filterModifiedCallback: function () {
|
22315 | var event = {
|
22316 | type: Events.EVENT_FILTER_MODIFIED,
|
22317 | column: column,
|
22318 | filterInstance: filterInstance
|
22319 | };
|
22320 | _this.eventService.dispatchEvent(event);
|
22321 | }, filterChangedCallback: function (additionalEventAttributes) {
|
22322 | var params = { filterInstance: filterInstance, additionalEventAttributes: additionalEventAttributes, columns: [column] };
|
22323 | _this.callOnFilterChangedOutsideRenderCycle(params);
|
22324 | }, doesRowPassOtherFilter: function (node) { return _this.doesRowPassOtherFilters(filterInstance, node); } });
|
22325 | var compDetails = this.userComponentFactory.getFilterDetails(colDef, params, defaultFilter);
|
22326 | if (!compDetails) {
|
22327 | return null;
|
22328 | }
|
22329 | var componentPromise = compDetails.newAgStackInstance();
|
22330 | if (componentPromise) {
|
22331 | componentPromise.then(function (r) { return filterInstance = r; });
|
22332 | }
|
22333 | return componentPromise;
|
22334 | };
|
22335 | FilterManager.prototype.createFilterParams = function (column, colDef) {
|
22336 | var params = {
|
22337 | column: column,
|
22338 | colDef: cloneObject(colDef),
|
22339 | rowModel: this.rowModel,
|
22340 | filterChangedCallback: function () { },
|
22341 | filterModifiedCallback: function () { },
|
22342 | valueGetter: this.createValueGetter(column),
|
22343 | doesRowPassOtherFilter: function () { return true; },
|
22344 | api: this.gridOptionsService.api,
|
22345 | columnApi: this.gridOptionsService.columnApi,
|
22346 | context: this.gridOptionsService.context,
|
22347 | };
|
22348 | return params;
|
22349 | };
|
22350 | FilterManager.prototype.createFilterWrapper = function (column, source) {
|
22351 | var filterWrapper = {
|
22352 | column: column,
|
22353 | filterPromise: null,
|
22354 | compiledElement: null,
|
22355 | guiPromise: AgPromise.resolve(null)
|
22356 | };
|
22357 | filterWrapper.filterPromise = this.createFilterInstance(column);
|
22358 | if (filterWrapper.filterPromise) {
|
22359 | this.putIntoGui(filterWrapper, source);
|
22360 | }
|
22361 | return filterWrapper;
|
22362 | };
|
22363 | FilterManager.prototype.putIntoGui = function (filterWrapper, source) {
|
22364 | var _this = this;
|
22365 | var eFilterGui = document.createElement('div');
|
22366 | eFilterGui.className = 'ag-filter';
|
22367 | filterWrapper.guiPromise = new AgPromise(function (resolve) {
|
22368 | filterWrapper.filterPromise.then(function (filter) {
|
22369 | var guiFromFilter = filter.getGui();
|
22370 | if (!exists(guiFromFilter)) {
|
22371 | console.warn("AG Grid: getGui method from filter returned " + guiFromFilter + ", it should be a DOM element or an HTML template string.");
|
22372 | }
|
22373 |
|
22374 |
|
22375 |
|
22376 |
|
22377 | if (typeof guiFromFilter === 'string') {
|
22378 | guiFromFilter = loadTemplate(guiFromFilter);
|
22379 | }
|
22380 | eFilterGui.appendChild(guiFromFilter);
|
22381 | resolve(eFilterGui);
|
22382 | var event = {
|
22383 | type: Events.EVENT_FILTER_OPENED,
|
22384 | column: filterWrapper.column,
|
22385 | source: source,
|
22386 | eGui: eFilterGui
|
22387 | };
|
22388 | _this.eventService.dispatchEvent(event);
|
22389 | });
|
22390 | });
|
22391 | };
|
22392 | FilterManager.prototype.onColumnsChanged = function () {
|
22393 | var _this = this;
|
22394 | var columns = [];
|
22395 | this.allColumnFilters.forEach(function (wrapper, colId) {
|
22396 | var currentColumn;
|
22397 | if (wrapper.column.isPrimary()) {
|
22398 | currentColumn = _this.columnModel.getPrimaryColumn(colId);
|
22399 | }
|
22400 | else {
|
22401 | currentColumn = _this.columnModel.getGridColumn(colId);
|
22402 | }
|
22403 | if (currentColumn) {
|
22404 | return;
|
22405 | }
|
22406 | columns.push(wrapper.column);
|
22407 | _this.disposeFilterWrapper(wrapper, 'columnChanged');
|
22408 | });
|
22409 | if (columns.length > 0) {
|
22410 | this.onFilterChanged({ columns: columns });
|
22411 | }
|
22412 | else {
|
22413 |
|
22414 | this.updateDependantFilters();
|
22415 | }
|
22416 | };
|
22417 | FilterManager.prototype.updateDependantFilters = function () {
|
22418 | var _this = this;
|
22419 |
|
22420 |
|
22421 | var groupColumns = this.columnModel.getGroupAutoColumns();
|
22422 | groupColumns === null || groupColumns === void 0 ? void 0 : groupColumns.forEach(function (groupColumn) {
|
22423 | if (groupColumn.getColDef().filter === 'agGroupColumnFilter') {
|
22424 | _this.getOrCreateFilterWrapper(groupColumn, 'NO_UI');
|
22425 | }
|
22426 | });
|
22427 | };
|
22428 |
|
22429 | FilterManager.prototype.isFilterAllowed = function (column) {
|
22430 | var _a, _b;
|
22431 | var isFilterAllowed = column.isFilterAllowed();
|
22432 | if (!isFilterAllowed) {
|
22433 | return false;
|
22434 | }
|
22435 | var filterWrapper = this.allColumnFilters.get(column.getColId());
|
22436 | return (_b = (_a = filterWrapper === null || filterWrapper === void 0 ? void 0 : filterWrapper.filterPromise) === null || _a === void 0 ? void 0 : _a.resolveNow(true,
|
22437 |
|
22438 | function (filter) {
|
22439 | var _a, _b;
|
22440 | return (typeof ((_a = filter) === null || _a === void 0 ? void 0 : _a.isFilterAllowed) === 'function')
|
22441 | ? (_b = filter) === null || _b === void 0 ? void 0 : _b.isFilterAllowed() : true;
|
22442 | })) !== null && _b !== void 0 ? _b : true;
|
22443 | };
|
22444 | FilterManager.prototype.getFloatingFilterCompDetails = function (column, showParentFilter) {
|
22445 | var _this = this;
|
22446 | var colDef = column.getColDef();
|
22447 | var filterParams = this.createFilterParams(column, colDef);
|
22448 | var finalFilterParams = this.userComponentFactory.mergeParamsWithApplicationProvidedParams(colDef, FilterComponent, filterParams);
|
22449 | var defaultFloatingFilterType = this.userComponentFactory.getDefaultFloatingFilterType(colDef);
|
22450 | if (defaultFloatingFilterType == null) {
|
22451 | defaultFloatingFilterType = 'agReadOnlyFloatingFilter';
|
22452 | }
|
22453 | var parentFilterInstance = function (callback) {
|
22454 | var filterComponent = _this.getFilterComponent(column, 'NO_UI');
|
22455 | if (filterComponent == null) {
|
22456 | return;
|
22457 | }
|
22458 | filterComponent.then(function (instance) {
|
22459 | callback(unwrapUserComp(instance));
|
22460 | });
|
22461 | };
|
22462 | var params = {
|
22463 | column: column,
|
22464 | filterParams: finalFilterParams,
|
22465 | currentParentModel: function () { return _this.getCurrentFloatingFilterParentModel(column); },
|
22466 | parentFilterInstance: parentFilterInstance,
|
22467 | showParentFilter: showParentFilter,
|
22468 | suppressFilterButton: false
|
22469 | };
|
22470 | return this.userComponentFactory.getFloatingFilterCompDetails(colDef, params, defaultFloatingFilterType);
|
22471 | };
|
22472 | FilterManager.prototype.getCurrentFloatingFilterParentModel = function (column) {
|
22473 | var filterComponent = this.getFilterComponent(column, 'NO_UI', false);
|
22474 | return filterComponent ? filterComponent.resolveNow(null, function (filter) { return filter && filter.getModel(); }) : null;
|
22475 | };
|
22476 |
|
22477 | |
22478 |
|
22479 |
|
22480 | FilterManager.prototype.destroyFilter = function (column, source) {
|
22481 | if (source === void 0) { source = 'api'; }
|
22482 | var filterWrapper = this.allColumnFilters.get(column.getColId());
|
22483 | if (filterWrapper) {
|
22484 | this.disposeFilterWrapper(filterWrapper, source);
|
22485 | this.onFilterChanged({ columns: [column] });
|
22486 | }
|
22487 | };
|
22488 | FilterManager.prototype.disposeFilterWrapper = function (filterWrapper, source) {
|
22489 | var _this = this;
|
22490 | filterWrapper.filterPromise.then(function (filter) {
|
22491 | (filter.setModel(null) || AgPromise.resolve()).then(function () {
|
22492 | _this.getContext().destroyBean(filter);
|
22493 | filterWrapper.column.setFilterActive(false, 'filterDestroyed');
|
22494 | _this.allColumnFilters.delete(filterWrapper.column.getColId());
|
22495 | var event = {
|
22496 | type: Events.EVENT_FILTER_DESTROYED,
|
22497 | source: source,
|
22498 | column: filterWrapper.column,
|
22499 | };
|
22500 | _this.eventService.dispatchEvent(event);
|
22501 | });
|
22502 | });
|
22503 | };
|
22504 | FilterManager.prototype.destroy = function () {
|
22505 | var _this = this;
|
22506 | _super.prototype.destroy.call(this);
|
22507 | this.allColumnFilters.forEach(function (filterWrapper) { return _this.disposeFilterWrapper(filterWrapper, 'gridDestroyed'); });
|
22508 | };
|
22509 | var FilterManager_1;
|
22510 | FilterManager.QUICK_FILTER_SEPARATOR = '\n';
|
22511 | __decorate$1S([
|
22512 | Autowired('valueService')
|
22513 | ], FilterManager.prototype, "valueService", void 0);
|
22514 | __decorate$1S([
|
22515 | Autowired('columnModel')
|
22516 | ], FilterManager.prototype, "columnModel", void 0);
|
22517 | __decorate$1S([
|
22518 | Autowired('rowModel')
|
22519 | ], FilterManager.prototype, "rowModel", void 0);
|
22520 | __decorate$1S([
|
22521 | Autowired('userComponentFactory')
|
22522 | ], FilterManager.prototype, "userComponentFactory", void 0);
|
22523 | __decorate$1S([
|
22524 | Autowired('rowRenderer')
|
22525 | ], FilterManager.prototype, "rowRenderer", void 0);
|
22526 | __decorate$1S([
|
22527 | PostConstruct
|
22528 | ], FilterManager.prototype, "init", null);
|
22529 | FilterManager = FilterManager_1 = __decorate$1S([
|
22530 | Bean('filterManager')
|
22531 | ], FilterManager);
|
22532 | return FilterManager;
|
22533 | }(BeanStub));
|
22534 |
|
22535 |
|
22536 |
|
22537 |
|
22538 |
|
22539 |
|
22540 |
|
22541 | var __extends$1$ = (undefined && undefined.__extends) || (function () {
|
22542 | var extendStatics = function (d, b) {
|
22543 | extendStatics = Object.setPrototypeOf ||
|
22544 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
22545 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
22546 | return extendStatics(d, b);
|
22547 | };
|
22548 | return function (d, b) {
|
22549 | extendStatics(d, b);
|
22550 | function __() { this.constructor = d; }
|
22551 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
22552 | };
|
22553 | })();
|
22554 | var AbstractHeaderCellComp = (function (_super) {
|
22555 | __extends$1$(AbstractHeaderCellComp, _super);
|
22556 | function AbstractHeaderCellComp(template, ctrl) {
|
22557 | var _this = _super.call(this, template) || this;
|
22558 | _this.ctrl = ctrl;
|
22559 | return _this;
|
22560 | }
|
22561 | AbstractHeaderCellComp.prototype.getCtrl = function () {
|
22562 | return this.ctrl;
|
22563 | };
|
22564 | return AbstractHeaderCellComp;
|
22565 | }(Component));
|
22566 |
|
22567 |
|
22568 |
|
22569 |
|
22570 |
|
22571 |
|
22572 |
|
22573 | var __extends$1_ = (undefined && undefined.__extends) || (function () {
|
22574 | var extendStatics = function (d, b) {
|
22575 | extendStatics = Object.setPrototypeOf ||
|
22576 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
22577 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
22578 | return extendStatics(d, b);
|
22579 | };
|
22580 | return function (d, b) {
|
22581 | extendStatics(d, b);
|
22582 | function __() { this.constructor = d; }
|
22583 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
22584 | };
|
22585 | })();
|
22586 | var __decorate$1R = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
22587 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
22588 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
22589 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
22590 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
22591 | };
|
22592 | var HeaderFilterCellComp = (function (_super) {
|
22593 | __extends$1_(HeaderFilterCellComp, _super);
|
22594 | function HeaderFilterCellComp(ctrl) {
|
22595 | return _super.call(this, HeaderFilterCellComp.TEMPLATE, ctrl) || this;
|
22596 | }
|
22597 | HeaderFilterCellComp.prototype.postConstruct = function () {
|
22598 | var _this = this;
|
22599 | var eGui = this.getGui();
|
22600 | var compProxy = {
|
22601 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
22602 | addOrRemoveBodyCssClass: function (cssClassName, on) { return _this.eFloatingFilterBody.classList.toggle(cssClassName, on); },
|
22603 | setButtonWrapperDisplayed: function (displayed) { return setDisplayed(_this.eButtonWrapper, displayed); },
|
22604 | setCompDetails: function (compDetails) { return _this.setCompDetails(compDetails); },
|
22605 | getFloatingFilterComp: function () { return _this.compPromise; },
|
22606 | setWidth: function (width) { return eGui.style.width = width; },
|
22607 | setMenuIcon: function (eIcon) { return _this.eButtonShowMainFilter.appendChild(eIcon); }
|
22608 | };
|
22609 | this.ctrl.setComp(compProxy, eGui, this.eButtonShowMainFilter, this.eFloatingFilterBody);
|
22610 | };
|
22611 | HeaderFilterCellComp.prototype.setCompDetails = function (compDetails) {
|
22612 | var _this = this;
|
22613 |
|
22614 | this.compPromise = compDetails.newAgStackInstance();
|
22615 | this.compPromise.then(function (comp) { return _this.afterCompCreated(comp); });
|
22616 | };
|
22617 | HeaderFilterCellComp.prototype.afterCompCreated = function (comp) {
|
22618 | var _this = this;
|
22619 | if (!comp) {
|
22620 | return;
|
22621 | }
|
22622 | this.addDestroyFunc(function () { return _this.context.destroyBean(comp); });
|
22623 | if (!this.isAlive()) {
|
22624 | return;
|
22625 | }
|
22626 | this.eFloatingFilterBody.appendChild(comp.getGui());
|
22627 | if (comp.afterGuiAttached) {
|
22628 | comp.afterGuiAttached();
|
22629 | }
|
22630 | };
|
22631 | 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>";
|
22632 | __decorate$1R([
|
22633 | RefSelector('eFloatingFilterBody')
|
22634 | ], HeaderFilterCellComp.prototype, "eFloatingFilterBody", void 0);
|
22635 | __decorate$1R([
|
22636 | RefSelector('eButtonWrapper')
|
22637 | ], HeaderFilterCellComp.prototype, "eButtonWrapper", void 0);
|
22638 | __decorate$1R([
|
22639 | RefSelector('eButtonShowMainFilter')
|
22640 | ], HeaderFilterCellComp.prototype, "eButtonShowMainFilter", void 0);
|
22641 | __decorate$1R([
|
22642 | PostConstruct
|
22643 | ], HeaderFilterCellComp.prototype, "postConstruct", null);
|
22644 | return HeaderFilterCellComp;
|
22645 | }(AbstractHeaderCellComp));
|
22646 |
|
22647 |
|
22648 |
|
22649 |
|
22650 |
|
22651 |
|
22652 |
|
22653 | var __extends$1Z = (undefined && undefined.__extends) || (function () {
|
22654 | var extendStatics = function (d, b) {
|
22655 | extendStatics = Object.setPrototypeOf ||
|
22656 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
22657 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
22658 | return extendStatics(d, b);
|
22659 | };
|
22660 | return function (d, b) {
|
22661 | extendStatics(d, b);
|
22662 | function __() { this.constructor = d; }
|
22663 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
22664 | };
|
22665 | })();
|
22666 | var __decorate$1Q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
22667 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
22668 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
22669 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
22670 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
22671 | };
|
22672 | var LayoutCssClasses;
|
22673 | (function (LayoutCssClasses) {
|
22674 | LayoutCssClasses["AUTO_HEIGHT"] = "ag-layout-auto-height";
|
22675 | LayoutCssClasses["NORMAL"] = "ag-layout-normal";
|
22676 | LayoutCssClasses["PRINT"] = "ag-layout-print";
|
22677 | })(LayoutCssClasses || (LayoutCssClasses = {}));
|
22678 | var LayoutFeature = (function (_super) {
|
22679 | __extends$1Z(LayoutFeature, _super);
|
22680 | function LayoutFeature(view) {
|
22681 | var _this = _super.call(this) || this;
|
22682 | _this.view = view;
|
22683 | return _this;
|
22684 | }
|
22685 | LayoutFeature.prototype.postConstruct = function () {
|
22686 | this.addManagedPropertyListener('domLayout', this.updateLayoutClasses.bind(this));
|
22687 | this.updateLayoutClasses();
|
22688 | };
|
22689 | LayoutFeature.prototype.updateLayoutClasses = function () {
|
22690 | var domLayout = this.getDomLayout();
|
22691 | var params = {
|
22692 | autoHeight: domLayout === 'autoHeight',
|
22693 | normal: domLayout === 'normal',
|
22694 | print: domLayout === 'print'
|
22695 | };
|
22696 | var cssClass = params.autoHeight ? LayoutCssClasses.AUTO_HEIGHT :
|
22697 | params.print ? LayoutCssClasses.PRINT : LayoutCssClasses.NORMAL;
|
22698 | this.view.updateLayoutClasses(cssClass, params);
|
22699 | };
|
22700 |
|
22701 | LayoutFeature.prototype.getDomLayout = function () {
|
22702 | var _a;
|
22703 | var domLayout = (_a = this.gridOptionsService.get('domLayout')) !== null && _a !== void 0 ? _a : 'normal';
|
22704 | var validLayouts = ['normal', 'print', 'autoHeight'];
|
22705 | if (validLayouts.indexOf(domLayout) === -1) {
|
22706 | doOnce(function () {
|
22707 | return console.warn("AG Grid: " + domLayout + " is not valid for DOM Layout, valid values are 'normal', 'autoHeight', 'print'.");
|
22708 | }, 'warn about dom layout values');
|
22709 | return 'normal';
|
22710 | }
|
22711 | return domLayout;
|
22712 | };
|
22713 | __decorate$1Q([
|
22714 | PostConstruct
|
22715 | ], LayoutFeature.prototype, "postConstruct", null);
|
22716 | return LayoutFeature;
|
22717 | }(BeanStub));
|
22718 |
|
22719 |
|
22720 |
|
22721 |
|
22722 |
|
22723 |
|
22724 |
|
22725 | var __extends$1Y = (undefined && undefined.__extends) || (function () {
|
22726 | var extendStatics = function (d, b) {
|
22727 | extendStatics = Object.setPrototypeOf ||
|
22728 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
22729 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
22730 | return extendStatics(d, b);
|
22731 | };
|
22732 | return function (d, b) {
|
22733 | extendStatics(d, b);
|
22734 | function __() { this.constructor = d; }
|
22735 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
22736 | };
|
22737 | })();
|
22738 | var __assign$a = (undefined && undefined.__assign) || function () {
|
22739 | __assign$a = Object.assign || function(t) {
|
22740 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
22741 | s = arguments[i];
|
22742 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22743 | t[p] = s[p];
|
22744 | }
|
22745 | return t;
|
22746 | };
|
22747 | return __assign$a.apply(this, arguments);
|
22748 | };
|
22749 | var __decorate$1P = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
22750 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
22751 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
22752 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
22753 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
22754 | };
|
22755 | var GridBodyScrollFeature = (function (_super) {
|
22756 | __extends$1Y(GridBodyScrollFeature, _super);
|
22757 | function GridBodyScrollFeature(eBodyViewport) {
|
22758 | var _this = _super.call(this) || this;
|
22759 | _this.scrollLeft = -1;
|
22760 | _this.nextScrollTop = -1;
|
22761 | _this.scrollTop = -1;
|
22762 | _this.eBodyViewport = eBodyViewport;
|
22763 | _this.resetLastHScrollDebounced = debounce(function () { return _this.eLastHScroll = null; }, 500);
|
22764 | _this.resetLastVScrollDebounced = debounce(function () { return _this.eLastVScroll = null; }, 500);
|
22765 | return _this;
|
22766 | }
|
22767 | GridBodyScrollFeature.prototype.postConstruct = function () {
|
22768 | var _this = this;
|
22769 | this.enableRtl = this.gridOptionsService.is('enableRtl');
|
22770 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onDisplayedColumnsWidthChanged.bind(this));
|
22771 | this.ctrlsService.whenReady(function (p) {
|
22772 | _this.centerRowContainerCtrl = p.centerRowContainerCtrl;
|
22773 | _this.onDisplayedColumnsWidthChanged();
|
22774 | _this.addScrollListener();
|
22775 | });
|
22776 | };
|
22777 | GridBodyScrollFeature.prototype.addScrollListener = function () {
|
22778 | var fakeHScroll = this.ctrlsService.getFakeHScrollComp();
|
22779 | var fakeVScroll = this.ctrlsService.getFakeVScrollComp();
|
22780 | this.addManagedListener(this.centerRowContainerCtrl.getViewportElement(), 'scroll', this.onHScroll.bind(this));
|
22781 | this.addManagedListener(fakeHScroll.getViewport(), 'scroll', this.onFakeHScroll.bind(this));
|
22782 | var isDebounce = this.gridOptionsService.is('debounceVerticalScrollbar');
|
22783 | var onVScroll = isDebounce ?
|
22784 | debounce(this.onVScroll.bind(this), 100) : this.onVScroll.bind(this);
|
22785 | var onFakeVScroll = isDebounce ?
|
22786 | debounce(this.onFakeVScroll.bind(this), 100) : this.onFakeVScroll.bind(this);
|
22787 | this.addManagedListener(this.eBodyViewport, 'scroll', onVScroll);
|
22788 | this.addManagedListener(fakeVScroll.getViewport(), 'scroll', onFakeVScroll);
|
22789 | };
|
22790 | GridBodyScrollFeature.prototype.onDisplayedColumnsWidthChanged = function () {
|
22791 | if (this.enableRtl) {
|
22792 |
|
22793 |
|
22794 |
|
22795 |
|
22796 |
|
22797 | this.horizontallyScrollHeaderCenterAndFloatingCenter();
|
22798 | }
|
22799 | };
|
22800 | GridBodyScrollFeature.prototype.horizontallyScrollHeaderCenterAndFloatingCenter = function (scrollLeft) {
|
22801 |
|
22802 | var notYetInitialised = this.centerRowContainerCtrl == null;
|
22803 | if (notYetInitialised) {
|
22804 | return;
|
22805 | }
|
22806 | if (scrollLeft === undefined) {
|
22807 | scrollLeft = this.centerRowContainerCtrl.getCenterViewportScrollLeft();
|
22808 | }
|
22809 | var offset = this.enableRtl ? scrollLeft : -scrollLeft;
|
22810 | var topCenterContainer = this.ctrlsService.getTopCenterRowContainerCtrl();
|
22811 | var stickyTopCenterContainer = this.ctrlsService.getStickyTopCenterRowContainerCtrl();
|
22812 | var bottomCenterContainer = this.ctrlsService.getBottomCenterRowContainerCtrl();
|
22813 | var fakeHScroll = this.ctrlsService.getFakeHScrollComp();
|
22814 | var centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();
|
22815 | centerHeaderContainer.setHorizontalScroll(offset);
|
22816 | bottomCenterContainer.setContainerTranslateX(offset);
|
22817 | topCenterContainer.setContainerTranslateX(offset);
|
22818 | stickyTopCenterContainer.setContainerTranslateX(offset);
|
22819 | var centerViewport = this.centerRowContainerCtrl.getViewportElement();
|
22820 | var isCenterViewportLastHorizontal = this.eLastHScroll === centerViewport;
|
22821 | var partner = isCenterViewportLastHorizontal ?
|
22822 | fakeHScroll.getViewport() :
|
22823 | this.centerRowContainerCtrl.getViewportElement();
|
22824 | setScrollLeft(partner, Math.abs(scrollLeft), this.enableRtl);
|
22825 | };
|
22826 | GridBodyScrollFeature.prototype.isControllingHScroll = function (eDiv) {
|
22827 | if (!this.eLastHScroll) {
|
22828 | this.eLastHScroll = eDiv;
|
22829 | return true;
|
22830 | }
|
22831 | return eDiv === this.eLastHScroll;
|
22832 | };
|
22833 | GridBodyScrollFeature.prototype.isControllingVScroll = function (eDiv) {
|
22834 | if (!this.eLastVScroll) {
|
22835 | this.eLastVScroll = eDiv;
|
22836 | return true;
|
22837 | }
|
22838 | return eDiv === this.eLastVScroll;
|
22839 | };
|
22840 | GridBodyScrollFeature.prototype.onFakeHScroll = function () {
|
22841 | var fakeHScrollViewport = this.ctrlsService.getFakeHScrollComp().getViewport();
|
22842 | if (!this.isControllingHScroll(fakeHScrollViewport)) {
|
22843 | return;
|
22844 | }
|
22845 | this.onHScrollCommon(fakeHScrollViewport);
|
22846 | };
|
22847 | GridBodyScrollFeature.prototype.onHScroll = function () {
|
22848 | var centerContainerViewport = this.centerRowContainerCtrl.getViewportElement();
|
22849 | if (!this.isControllingHScroll(centerContainerViewport)) {
|
22850 | return;
|
22851 | }
|
22852 | this.onHScrollCommon(centerContainerViewport);
|
22853 | };
|
22854 | GridBodyScrollFeature.prototype.onHScrollCommon = function (eSource) {
|
22855 | var centerContainerViewport = this.centerRowContainerCtrl.getViewportElement();
|
22856 | var scrollLeft = centerContainerViewport.scrollLeft;
|
22857 | if (this.shouldBlockScrollUpdate('horizontal', scrollLeft, true)) {
|
22858 | return;
|
22859 | }
|
22860 |
|
22861 |
|
22862 |
|
22863 |
|
22864 |
|
22865 |
|
22866 | this.doHorizontalScroll(Math.round(getScrollLeft(eSource, this.enableRtl)));
|
22867 | this.resetLastHScrollDebounced();
|
22868 | };
|
22869 | GridBodyScrollFeature.prototype.onFakeVScroll = function () {
|
22870 | var fakeVScrollViewport = this.ctrlsService.getFakeVScrollComp().getViewport();
|
22871 | if (!this.isControllingVScroll(fakeVScrollViewport)) {
|
22872 | return;
|
22873 | }
|
22874 | this.onVScrollCommon(fakeVScrollViewport);
|
22875 | };
|
22876 | GridBodyScrollFeature.prototype.onVScroll = function () {
|
22877 | if (!this.isControllingVScroll(this.eBodyViewport)) {
|
22878 | return;
|
22879 | }
|
22880 | this.onVScrollCommon(this.eBodyViewport);
|
22881 | };
|
22882 | GridBodyScrollFeature.prototype.onVScrollCommon = function (eSource) {
|
22883 | var scrollTop = eSource.scrollTop;
|
22884 | if (this.shouldBlockScrollUpdate('vertical', scrollTop, true)) {
|
22885 | return;
|
22886 | }
|
22887 | this.animationFrameService.setScrollTop(scrollTop);
|
22888 | this.nextScrollTop = scrollTop;
|
22889 | if (eSource === this.eBodyViewport) {
|
22890 | var fakeVScrollViewport = this.ctrlsService.getFakeVScrollComp().getViewport();
|
22891 | fakeVScrollViewport.scrollTop = scrollTop;
|
22892 | }
|
22893 | else {
|
22894 | this.eBodyViewport.scrollTop = scrollTop;
|
22895 | }
|
22896 |
|
22897 |
|
22898 |
|
22899 | if (this.gridOptionsService.is('suppressAnimationFrame')) {
|
22900 | this.scrollGridIfNeeded();
|
22901 | }
|
22902 | else {
|
22903 | this.animationFrameService.schedule();
|
22904 | }
|
22905 | this.resetLastVScrollDebounced();
|
22906 | };
|
22907 | GridBodyScrollFeature.prototype.doHorizontalScroll = function (scrollLeft) {
|
22908 | var fakeHScrollViewport = this.ctrlsService.getFakeHScrollComp().getViewport();
|
22909 | var fakeScrollLeft = getScrollLeft(fakeHScrollViewport, this.enableRtl);
|
22910 | if (this.scrollLeft === scrollLeft && scrollLeft === fakeScrollLeft) {
|
22911 | return;
|
22912 | }
|
22913 | this.scrollLeft = scrollLeft;
|
22914 | this.fireScrollEvent('horizontal');
|
22915 | this.horizontallyScrollHeaderCenterAndFloatingCenter(scrollLeft);
|
22916 | this.onHorizontalViewportChanged();
|
22917 | };
|
22918 | GridBodyScrollFeature.prototype.fireScrollEvent = function (direction) {
|
22919 | var _this = this;
|
22920 | var bodyScrollEvent = {
|
22921 | type: Events.EVENT_BODY_SCROLL,
|
22922 | direction: direction,
|
22923 | left: this.scrollLeft,
|
22924 | top: this.scrollTop
|
22925 | };
|
22926 | this.eventService.dispatchEvent(bodyScrollEvent);
|
22927 | window.clearTimeout(this.scrollTimer);
|
22928 | this.scrollTimer = undefined;
|
22929 | this.scrollTimer = window.setTimeout(function () {
|
22930 | var bodyScrollEndEvent = __assign$a(__assign$a({}, bodyScrollEvent), { type: Events.EVENT_BODY_SCROLL_END });
|
22931 | _this.eventService.dispatchEvent(bodyScrollEndEvent);
|
22932 | }, 100);
|
22933 | };
|
22934 | GridBodyScrollFeature.prototype.shouldBlockScrollUpdate = function (direction, scrollTo, touchOnly) {
|
22935 |
|
22936 |
|
22937 |
|
22938 |
|
22939 | if (touchOnly === void 0) { touchOnly = false; }
|
22940 |
|
22941 |
|
22942 |
|
22943 |
|
22944 |
|
22945 | if (touchOnly && !isIOSUserAgent()) {
|
22946 | return false;
|
22947 | }
|
22948 | if (direction === 'vertical') {
|
22949 | return this.shouldBlockVerticalScroll(scrollTo);
|
22950 | }
|
22951 | return this.shouldBlockHorizontalScroll(scrollTo);
|
22952 | };
|
22953 | GridBodyScrollFeature.prototype.shouldBlockVerticalScroll = function (scrollTo) {
|
22954 | var clientHeight = getInnerHeight(this.eBodyViewport);
|
22955 | var scrollHeight = this.eBodyViewport.scrollHeight;
|
22956 | if (scrollTo < 0 || (scrollTo + clientHeight > scrollHeight)) {
|
22957 | return true;
|
22958 | }
|
22959 | return false;
|
22960 | };
|
22961 | GridBodyScrollFeature.prototype.shouldBlockHorizontalScroll = function (scrollTo) {
|
22962 | var clientWidth = this.centerRowContainerCtrl.getCenterWidth();
|
22963 | var scrollWidth = this.centerRowContainerCtrl.getViewportElement().scrollWidth;
|
22964 | if (this.enableRtl && isRtlNegativeScroll()) {
|
22965 | if (scrollTo > 0) {
|
22966 | return true;
|
22967 | }
|
22968 | }
|
22969 | else if (scrollTo < 0) {
|
22970 | return true;
|
22971 | }
|
22972 | if (Math.abs(scrollTo) + clientWidth > scrollWidth) {
|
22973 | return true;
|
22974 | }
|
22975 | return false;
|
22976 | };
|
22977 | GridBodyScrollFeature.prototype.redrawRowsAfterScroll = function () {
|
22978 | this.fireScrollEvent('vertical');
|
22979 | };
|
22980 | GridBodyScrollFeature.prototype.onHorizontalViewportChanged = function () {
|
22981 | this.centerRowContainerCtrl.onHorizontalViewportChanged();
|
22982 | };
|
22983 |
|
22984 |
|
22985 |
|
22986 |
|
22987 |
|
22988 |
|
22989 | GridBodyScrollFeature.prototype.checkScrollLeft = function () {
|
22990 | if (this.scrollLeft !== this.centerRowContainerCtrl.getCenterViewportScrollLeft()) {
|
22991 | this.onHScrollCommon(this.centerRowContainerCtrl.getViewportElement());
|
22992 | }
|
22993 | };
|
22994 | GridBodyScrollFeature.prototype.scrollGridIfNeeded = function () {
|
22995 | var frameNeeded = this.scrollTop != this.nextScrollTop;
|
22996 | if (frameNeeded) {
|
22997 | this.scrollTop = this.nextScrollTop;
|
22998 | this.redrawRowsAfterScroll();
|
22999 | }
|
23000 | return frameNeeded;
|
23001 | };
|
23002 |
|
23003 | GridBodyScrollFeature.prototype.setHorizontalScrollPosition = function (hScrollPosition) {
|
23004 | var minScrollLeft = 0;
|
23005 | var maxScrollLeft = this.centerRowContainerCtrl.getViewportElement().scrollWidth - this.centerRowContainerCtrl.getCenterWidth();
|
23006 | if (this.shouldBlockScrollUpdate('horizontal', hScrollPosition)) {
|
23007 | if (this.enableRtl && isRtlNegativeScroll()) {
|
23008 | hScrollPosition = hScrollPosition > 0 ? 0 : maxScrollLeft;
|
23009 | }
|
23010 | else {
|
23011 | hScrollPosition = Math.min(Math.max(hScrollPosition, minScrollLeft), maxScrollLeft);
|
23012 | }
|
23013 | }
|
23014 | setScrollLeft(this.centerRowContainerCtrl.getViewportElement(), Math.abs(hScrollPosition), this.enableRtl);
|
23015 |
|
23016 |
|
23017 |
|
23018 |
|
23019 | this.doHorizontalScroll(hScrollPosition);
|
23020 | };
|
23021 | GridBodyScrollFeature.prototype.setVerticalScrollPosition = function (vScrollPosition) {
|
23022 | this.eBodyViewport.scrollTop = vScrollPosition;
|
23023 | };
|
23024 | GridBodyScrollFeature.prototype.getVScrollPosition = function () {
|
23025 | var result = {
|
23026 | top: this.eBodyViewport.scrollTop,
|
23027 | bottom: this.eBodyViewport.scrollTop + this.eBodyViewport.offsetHeight
|
23028 | };
|
23029 | return result;
|
23030 | };
|
23031 | GridBodyScrollFeature.prototype.getHScrollPosition = function () {
|
23032 | return this.centerRowContainerCtrl.getHScrollPosition();
|
23033 | };
|
23034 | GridBodyScrollFeature.prototype.isHorizontalScrollShowing = function () {
|
23035 | return this.centerRowContainerCtrl.isHorizontalScrollShowing();
|
23036 | };
|
23037 |
|
23038 | GridBodyScrollFeature.prototype.scrollHorizontally = function (pixels) {
|
23039 | var oldScrollPosition = this.centerRowContainerCtrl.getViewportElement().scrollLeft;
|
23040 | this.setHorizontalScrollPosition(oldScrollPosition + pixels);
|
23041 | return this.centerRowContainerCtrl.getViewportElement().scrollLeft - oldScrollPosition;
|
23042 | };
|
23043 |
|
23044 | GridBodyScrollFeature.prototype.scrollToTop = function () {
|
23045 | this.eBodyViewport.scrollTop = 0;
|
23046 | };
|
23047 |
|
23048 | GridBodyScrollFeature.prototype.ensureNodeVisible = function (comparator, position) {
|
23049 | if (position === void 0) { position = null; }
|
23050 |
|
23051 | var rowCount = this.rowModel.getRowCount();
|
23052 | var indexToSelect = -1;
|
23053 |
|
23054 | for (var i = 0; i < rowCount; i++) {
|
23055 | var node = this.rowModel.getRow(i);
|
23056 | if (typeof comparator === 'function') {
|
23057 |
|
23058 | var predicate = comparator;
|
23059 | if (node && predicate(node)) {
|
23060 | indexToSelect = i;
|
23061 | break;
|
23062 | }
|
23063 | }
|
23064 | else {
|
23065 |
|
23066 | if (comparator === node || comparator === node.data) {
|
23067 | indexToSelect = i;
|
23068 | break;
|
23069 | }
|
23070 | }
|
23071 | }
|
23072 | if (indexToSelect >= 0) {
|
23073 | this.ensureIndexVisible(indexToSelect, position);
|
23074 | }
|
23075 | };
|
23076 |
|
23077 |
|
23078 |
|
23079 |
|
23080 |
|
23081 |
|
23082 | GridBodyScrollFeature.prototype.ensureIndexVisible = function (index, position) {
|
23083 |
|
23084 | if (this.gridOptionsService.isDomLayout('print')) {
|
23085 | return;
|
23086 | }
|
23087 | var rowCount = this.paginationProxy.getRowCount();
|
23088 | if (typeof index !== 'number' || index < 0 || index >= rowCount) {
|
23089 | console.warn('AG Grid: Invalid row index for ensureIndexVisible: ' + index);
|
23090 | return;
|
23091 | }
|
23092 | var isPaging = this.gridOptionsService.is('pagination');
|
23093 | var paginationPanelEnabled = isPaging && !this.gridOptionsService.is('suppressPaginationPanel');
|
23094 | if (!paginationPanelEnabled) {
|
23095 | this.paginationProxy.goToPageWithIndex(index);
|
23096 | }
|
23097 | var gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();
|
23098 | var stickyTopHeight = gridBodyCtrl.getStickyTopHeight();
|
23099 | var rowNode = this.paginationProxy.getRow(index);
|
23100 | var rowGotShiftedDuringOperation;
|
23101 | do {
|
23102 | var startingRowTop = rowNode.rowTop;
|
23103 | var startingRowHeight = rowNode.rowHeight;
|
23104 | var paginationOffset = this.paginationProxy.getPixelOffset();
|
23105 | var rowTopPixel = rowNode.rowTop - paginationOffset;
|
23106 | var rowBottomPixel = rowTopPixel + rowNode.rowHeight;
|
23107 | var scrollPosition = this.getVScrollPosition();
|
23108 | var heightOffset = this.heightScaler.getDivStretchOffset();
|
23109 | var vScrollTop = scrollPosition.top + heightOffset;
|
23110 | var vScrollBottom = scrollPosition.bottom + heightOffset;
|
23111 | var viewportHeight = vScrollBottom - vScrollTop;
|
23112 |
|
23113 |
|
23114 | var pxTop = this.heightScaler.getScrollPositionForPixel(rowTopPixel);
|
23115 | var pxBottom = this.heightScaler.getScrollPositionForPixel(rowBottomPixel - viewportHeight);
|
23116 |
|
23117 | var pxMiddle = Math.min((pxTop + pxBottom) / 2, rowTopPixel);
|
23118 | var rowAboveViewport = (vScrollTop + stickyTopHeight) > rowTopPixel;
|
23119 | var rowBelowViewport = vScrollBottom < rowBottomPixel;
|
23120 | var newScrollPosition = null;
|
23121 | if (position === 'top') {
|
23122 | newScrollPosition = pxTop;
|
23123 | }
|
23124 | else if (position === 'bottom') {
|
23125 | newScrollPosition = pxBottom;
|
23126 | }
|
23127 | else if (position === 'middle') {
|
23128 | newScrollPosition = pxMiddle;
|
23129 | }
|
23130 | else if (rowAboveViewport) {
|
23131 |
|
23132 | newScrollPosition = pxTop - stickyTopHeight;
|
23133 | }
|
23134 | else if (rowBelowViewport) {
|
23135 |
|
23136 | newScrollPosition = pxBottom;
|
23137 | }
|
23138 | if (newScrollPosition !== null) {
|
23139 | this.eBodyViewport.scrollTop = newScrollPosition;
|
23140 | this.rowRenderer.redrawAfterScroll();
|
23141 | }
|
23142 |
|
23143 |
|
23144 |
|
23145 |
|
23146 | rowGotShiftedDuringOperation = (startingRowTop !== rowNode.rowTop)
|
23147 | || (startingRowHeight !== rowNode.rowHeight);
|
23148 | } while (rowGotShiftedDuringOperation);
|
23149 |
|
23150 | this.animationFrameService.flushAllFrames();
|
23151 | };
|
23152 | GridBodyScrollFeature.prototype.ensureColumnVisible = function (key, position) {
|
23153 | if (position === void 0) { position = 'auto'; }
|
23154 | var column = this.columnModel.getGridColumn(key);
|
23155 | if (!column) {
|
23156 | return;
|
23157 | }
|
23158 |
|
23159 | if (column.isPinned()) {
|
23160 | return;
|
23161 | }
|
23162 |
|
23163 | if (!this.columnModel.isColumnDisplayed(column)) {
|
23164 | return;
|
23165 | }
|
23166 | var newHorizontalScroll = this.getPositionedHorizontalScroll(column, position);
|
23167 | if (newHorizontalScroll !== null) {
|
23168 | this.centerRowContainerCtrl.setCenterViewportScrollLeft(newHorizontalScroll);
|
23169 | }
|
23170 |
|
23171 |
|
23172 |
|
23173 |
|
23174 | this.centerRowContainerCtrl.onHorizontalViewportChanged();
|
23175 |
|
23176 | this.animationFrameService.flushAllFrames();
|
23177 | };
|
23178 | GridBodyScrollFeature.prototype.getPositionedHorizontalScroll = function (column, position) {
|
23179 | var _a = this.isColumnOutsideViewport(column), columnBeforeStart = _a.columnBeforeStart, columnAfterEnd = _a.columnAfterEnd;
|
23180 | var viewportTooSmallForColumn = this.centerRowContainerCtrl.getCenterWidth() < column.getActualWidth();
|
23181 | var viewportWidth = this.centerRowContainerCtrl.getCenterWidth();
|
23182 | var isRtl = this.enableRtl;
|
23183 | var alignColToStart = (isRtl ? columnBeforeStart : columnAfterEnd) || viewportTooSmallForColumn;
|
23184 | var alignColToEnd = isRtl ? columnAfterEnd : columnBeforeStart;
|
23185 | if (position !== 'auto') {
|
23186 | alignColToStart = position === 'start';
|
23187 | alignColToEnd = position === 'end';
|
23188 | }
|
23189 | var isMiddle = position === 'middle';
|
23190 | if (alignColToStart || alignColToEnd || isMiddle) {
|
23191 | var _b = this.getColumnBounds(column), colLeft = _b.colLeft, colMiddle = _b.colMiddle, colRight = _b.colRight;
|
23192 | if (isMiddle) {
|
23193 | return colMiddle - viewportWidth / 2;
|
23194 | }
|
23195 | if (alignColToStart) {
|
23196 | return isRtl ? colRight : colLeft;
|
23197 | }
|
23198 | return isRtl ? (colLeft - viewportWidth) : (colRight - viewportWidth);
|
23199 | }
|
23200 | return null;
|
23201 | };
|
23202 | GridBodyScrollFeature.prototype.isColumnOutsideViewport = function (column) {
|
23203 | var _a = this.getViewportBounds(), viewportStart = _a.start, viewportEnd = _a.end;
|
23204 | var _b = this.getColumnBounds(column), colLeft = _b.colLeft, colRight = _b.colRight;
|
23205 | var isRtl = this.enableRtl;
|
23206 | var columnBeforeStart = isRtl ? (viewportStart > colRight) : (viewportEnd < colRight);
|
23207 | var columnAfterEnd = isRtl ? (viewportEnd < colLeft) : (viewportStart > colLeft);
|
23208 | return { columnBeforeStart: columnBeforeStart, columnAfterEnd: columnAfterEnd };
|
23209 | };
|
23210 | GridBodyScrollFeature.prototype.getColumnBounds = function (column) {
|
23211 | var isRtl = this.enableRtl;
|
23212 | var bodyWidth = this.columnModel.getBodyContainerWidth();
|
23213 | var colWidth = column.getActualWidth();
|
23214 | var colLeft = column.getLeft();
|
23215 | var multiplier = isRtl ? -1 : 1;
|
23216 | var colLeftPixel = isRtl ? (bodyWidth - colLeft) : colLeft;
|
23217 | var colRightPixel = colLeftPixel + colWidth * multiplier;
|
23218 | var colMidPixel = colLeftPixel + colWidth / 2 * multiplier;
|
23219 | return { colLeft: colLeftPixel, colMiddle: colMidPixel, colRight: colRightPixel };
|
23220 | };
|
23221 | GridBodyScrollFeature.prototype.getViewportBounds = function () {
|
23222 | var viewportWidth = this.centerRowContainerCtrl.getCenterWidth();
|
23223 | var scrollPosition = this.centerRowContainerCtrl.getCenterViewportScrollLeft();
|
23224 | var viewportStartPixel = scrollPosition;
|
23225 | var viewportEndPixel = viewportWidth + scrollPosition;
|
23226 | return { start: viewportStartPixel, end: viewportEndPixel, width: viewportWidth };
|
23227 | };
|
23228 | __decorate$1P([
|
23229 | Autowired('ctrlsService')
|
23230 | ], GridBodyScrollFeature.prototype, "ctrlsService", void 0);
|
23231 | __decorate$1P([
|
23232 | Autowired('animationFrameService')
|
23233 | ], GridBodyScrollFeature.prototype, "animationFrameService", void 0);
|
23234 | __decorate$1P([
|
23235 | Autowired('paginationProxy')
|
23236 | ], GridBodyScrollFeature.prototype, "paginationProxy", void 0);
|
23237 | __decorate$1P([
|
23238 | Autowired('rowModel')
|
23239 | ], GridBodyScrollFeature.prototype, "rowModel", void 0);
|
23240 | __decorate$1P([
|
23241 | Autowired('rowContainerHeightService')
|
23242 | ], GridBodyScrollFeature.prototype, "heightScaler", void 0);
|
23243 | __decorate$1P([
|
23244 | Autowired('rowRenderer')
|
23245 | ], GridBodyScrollFeature.prototype, "rowRenderer", void 0);
|
23246 | __decorate$1P([
|
23247 | Autowired('columnModel')
|
23248 | ], GridBodyScrollFeature.prototype, "columnModel", void 0);
|
23249 | __decorate$1P([
|
23250 | PostConstruct
|
23251 | ], GridBodyScrollFeature.prototype, "postConstruct", null);
|
23252 | return GridBodyScrollFeature;
|
23253 | }(BeanStub));
|
23254 |
|
23255 |
|
23256 |
|
23257 |
|
23258 |
|
23259 |
|
23260 |
|
23261 | var AutoScrollService = (function () {
|
23262 | function AutoScrollService(params) {
|
23263 | this.tickingInterval = null;
|
23264 | this.onScrollCallback = null;
|
23265 | this.scrollContainer = params.scrollContainer;
|
23266 | this.scrollHorizontally = params.scrollAxis.indexOf('x') !== -1;
|
23267 | this.scrollVertically = params.scrollAxis.indexOf('y') !== -1;
|
23268 | this.scrollByTick = params.scrollByTick != null ? params.scrollByTick : 20;
|
23269 | if (params.onScrollCallback) {
|
23270 | this.onScrollCallback = params.onScrollCallback;
|
23271 | }
|
23272 | if (this.scrollVertically) {
|
23273 | this.getVerticalPosition = params.getVerticalPosition;
|
23274 | this.setVerticalPosition = params.setVerticalPosition;
|
23275 | }
|
23276 | if (this.scrollHorizontally) {
|
23277 | this.getHorizontalPosition = params.getHorizontalPosition;
|
23278 | this.setHorizontalPosition = params.setHorizontalPosition;
|
23279 | }
|
23280 | this.shouldSkipVerticalScroll = params.shouldSkipVerticalScroll || (function () { return false; });
|
23281 | this.shouldSkipHorizontalScroll = params.shouldSkipHorizontalScroll || (function () { return false; });
|
23282 | }
|
23283 | AutoScrollService.prototype.check = function (mouseEvent, forceSkipVerticalScroll) {
|
23284 | if (forceSkipVerticalScroll === void 0) { forceSkipVerticalScroll = false; }
|
23285 | var skipVerticalScroll = forceSkipVerticalScroll || this.shouldSkipVerticalScroll();
|
23286 | if (skipVerticalScroll && this.shouldSkipHorizontalScroll()) {
|
23287 | return;
|
23288 | }
|
23289 | var rect = this.scrollContainer.getBoundingClientRect();
|
23290 | var scrollTick = this.scrollByTick;
|
23291 | this.tickLeft = mouseEvent.clientX < (rect.left + scrollTick);
|
23292 | this.tickRight = mouseEvent.clientX > (rect.right - scrollTick);
|
23293 | this.tickUp = mouseEvent.clientY < (rect.top + scrollTick) && !skipVerticalScroll;
|
23294 | this.tickDown = mouseEvent.clientY > (rect.bottom - scrollTick) && !skipVerticalScroll;
|
23295 | if (this.tickLeft || this.tickRight || this.tickUp || this.tickDown) {
|
23296 | this.ensureTickingStarted();
|
23297 | }
|
23298 | else {
|
23299 | this.ensureCleared();
|
23300 | }
|
23301 | };
|
23302 | AutoScrollService.prototype.ensureTickingStarted = function () {
|
23303 | if (this.tickingInterval === null) {
|
23304 | this.tickingInterval = window.setInterval(this.doTick.bind(this), 100);
|
23305 | this.tickCount = 0;
|
23306 | }
|
23307 | };
|
23308 | AutoScrollService.prototype.doTick = function () {
|
23309 | this.tickCount++;
|
23310 | var tickAmount;
|
23311 | tickAmount = this.tickCount > 20 ? 200 : (this.tickCount > 10 ? 80 : 40);
|
23312 | if (this.scrollVertically) {
|
23313 | var vScrollPosition = this.getVerticalPosition();
|
23314 | if (this.tickUp) {
|
23315 | this.setVerticalPosition(vScrollPosition - tickAmount);
|
23316 | }
|
23317 | if (this.tickDown) {
|
23318 | this.setVerticalPosition(vScrollPosition + tickAmount);
|
23319 | }
|
23320 | }
|
23321 | if (this.scrollHorizontally) {
|
23322 | var hScrollPosition = this.getHorizontalPosition();
|
23323 | if (this.tickLeft) {
|
23324 | this.setHorizontalPosition(hScrollPosition - tickAmount);
|
23325 | }
|
23326 | if (this.tickRight) {
|
23327 | this.setHorizontalPosition(hScrollPosition + tickAmount);
|
23328 | }
|
23329 | }
|
23330 | if (this.onScrollCallback) {
|
23331 | this.onScrollCallback();
|
23332 | }
|
23333 | };
|
23334 | AutoScrollService.prototype.ensureCleared = function () {
|
23335 | if (this.tickingInterval) {
|
23336 | window.clearInterval(this.tickingInterval);
|
23337 | this.tickingInterval = null;
|
23338 | }
|
23339 | };
|
23340 | return AutoScrollService;
|
23341 | }());
|
23342 |
|
23343 |
|
23344 |
|
23345 |
|
23346 |
|
23347 |
|
23348 |
|
23349 | var __extends$1X = (undefined && undefined.__extends) || (function () {
|
23350 | var extendStatics = function (d, b) {
|
23351 | extendStatics = Object.setPrototypeOf ||
|
23352 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
23353 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
23354 | return extendStatics(d, b);
|
23355 | };
|
23356 | return function (d, b) {
|
23357 | extendStatics(d, b);
|
23358 | function __() { this.constructor = d; }
|
23359 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
23360 | };
|
23361 | })();
|
23362 | var __assign$9 = (undefined && undefined.__assign) || function () {
|
23363 | __assign$9 = Object.assign || function(t) {
|
23364 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
23365 | s = arguments[i];
|
23366 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
23367 | t[p] = s[p];
|
23368 | }
|
23369 | return t;
|
23370 | };
|
23371 | return __assign$9.apply(this, arguments);
|
23372 | };
|
23373 | var __decorate$1O = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
23374 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
23375 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
23376 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
23377 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
23378 | };
|
23379 | var __read$l = (undefined && undefined.__read) || function (o, n) {
|
23380 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
23381 | if (!m) return o;
|
23382 | var i = m.call(o), r, ar = [], e;
|
23383 | try {
|
23384 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
23385 | }
|
23386 | catch (error) { e = { error: error }; }
|
23387 | finally {
|
23388 | try {
|
23389 | if (r && !r.done && (m = i["return"])) m.call(i);
|
23390 | }
|
23391 | finally { if (e) throw e.error; }
|
23392 | }
|
23393 | return ar;
|
23394 | };
|
23395 | var __spread$h = (undefined && undefined.__spread) || function () {
|
23396 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$l(arguments[i]));
|
23397 | return ar;
|
23398 | };
|
23399 | var RowDragFeature = (function (_super) {
|
23400 | __extends$1X(RowDragFeature, _super);
|
23401 | function RowDragFeature(eContainer) {
|
23402 | var _this = _super.call(this) || this;
|
23403 | _this.isMultiRowDrag = false;
|
23404 | _this.isGridSorted = false;
|
23405 | _this.isGridFiltered = false;
|
23406 | _this.isRowGroupActive = false;
|
23407 | _this.eContainer = eContainer;
|
23408 | return _this;
|
23409 | }
|
23410 | RowDragFeature.prototype.postConstruct = function () {
|
23411 | var _this = this;
|
23412 | if (this.gridOptionsService.isRowModelType('clientSide')) {
|
23413 | this.clientSideRowModel = this.rowModel;
|
23414 | }
|
23415 | var refreshStatus = function () {
|
23416 | _this.onSortChanged();
|
23417 | _this.onFilterChanged();
|
23418 | _this.onRowGroupChanged();
|
23419 | };
|
23420 | this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
|
23421 | this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
|
23422 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.onRowGroupChanged.bind(this));
|
23423 | this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, function () {
|
23424 | refreshStatus();
|
23425 | });
|
23426 | refreshStatus();
|
23427 | this.ctrlsService.whenReady(function () {
|
23428 | var gridBodyCon = _this.ctrlsService.getGridBodyCtrl();
|
23429 | _this.autoScrollService = new AutoScrollService({
|
23430 | scrollContainer: gridBodyCon.getBodyViewportElement(),
|
23431 | scrollAxis: 'y',
|
23432 | getVerticalPosition: function () { return gridBodyCon.getScrollFeature().getVScrollPosition().top; },
|
23433 | setVerticalPosition: function (position) { return gridBodyCon.getScrollFeature().setVerticalScrollPosition(position); },
|
23434 | onScrollCallback: function () { _this.onDragging(_this.lastDraggingEvent); }
|
23435 | });
|
23436 | });
|
23437 | };
|
23438 | RowDragFeature.prototype.onSortChanged = function () {
|
23439 | this.isGridSorted = this.sortController.isSortActive();
|
23440 | };
|
23441 | RowDragFeature.prototype.onFilterChanged = function () {
|
23442 | this.isGridFiltered = this.filterManager.isAnyFilterPresent();
|
23443 | };
|
23444 | RowDragFeature.prototype.onRowGroupChanged = function () {
|
23445 | var rowGroups = this.columnModel.getRowGroupColumns();
|
23446 | this.isRowGroupActive = !missingOrEmpty(rowGroups);
|
23447 | };
|
23448 | RowDragFeature.prototype.getContainer = function () {
|
23449 | return this.eContainer;
|
23450 | };
|
23451 | RowDragFeature.prototype.isInterestedIn = function (type) {
|
23452 | return type === DragSourceType.RowDrag;
|
23453 | };
|
23454 | RowDragFeature.prototype.getIconName = function () {
|
23455 | var managedDrag = this.gridOptionsService.is('rowDragManaged');
|
23456 | if (managedDrag && this.shouldPreventRowMove()) {
|
23457 | return DragAndDropService.ICON_NOT_ALLOWED;
|
23458 | }
|
23459 | return DragAndDropService.ICON_MOVE;
|
23460 | };
|
23461 | RowDragFeature.prototype.shouldPreventRowMove = function () {
|
23462 | return this.isGridSorted || this.isGridFiltered || this.isRowGroupActive;
|
23463 | };
|
23464 | RowDragFeature.prototype.getRowNodes = function (draggingEvent) {
|
23465 | var _this = this;
|
23466 | if (!this.isFromThisGrid(draggingEvent)) {
|
23467 | return (draggingEvent.dragItem.rowNodes || []);
|
23468 | }
|
23469 | var isRowDragMultiRow = this.gridOptionsService.is('rowDragMultiRow');
|
23470 | var selectedNodes = __spread$h(this.selectionService.getSelectedNodes()).sort(function (a, b) {
|
23471 | if (a.rowIndex == null || b.rowIndex == null) {
|
23472 | return 0;
|
23473 | }
|
23474 | return _this.getRowIndexNumber(a) - _this.getRowIndexNumber(b);
|
23475 | });
|
23476 | var currentNode = draggingEvent.dragItem.rowNode;
|
23477 | if (isRowDragMultiRow && selectedNodes.indexOf(currentNode) !== -1) {
|
23478 | this.isMultiRowDrag = true;
|
23479 | return selectedNodes;
|
23480 | }
|
23481 | this.isMultiRowDrag = false;
|
23482 | return [currentNode];
|
23483 | };
|
23484 | RowDragFeature.prototype.onDragEnter = function (draggingEvent) {
|
23485 |
|
23486 | draggingEvent.dragItem.rowNodes = this.getRowNodes(draggingEvent);
|
23487 |
|
23488 |
|
23489 | this.dispatchGridEvent(Events.EVENT_ROW_DRAG_ENTER, draggingEvent);
|
23490 | this.getRowNodes(draggingEvent).forEach(function (rowNode) {
|
23491 | rowNode.setDragging(true);
|
23492 | });
|
23493 | this.onEnterOrDragging(draggingEvent);
|
23494 | };
|
23495 | RowDragFeature.prototype.onDragging = function (draggingEvent) {
|
23496 | this.onEnterOrDragging(draggingEvent);
|
23497 | };
|
23498 | RowDragFeature.prototype.isFromThisGrid = function (draggingEvent) {
|
23499 | var dragSourceDomDataKey = draggingEvent.dragSource.dragSourceDomDataKey;
|
23500 | return dragSourceDomDataKey === this.gridOptionsService.getDomDataKey();
|
23501 | };
|
23502 | RowDragFeature.prototype.isDropZoneWithinThisGrid = function (draggingEvent) {
|
23503 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
23504 | var gridGui = gridBodyCon.getGui();
|
23505 | var dropZoneTarget = draggingEvent.dropZoneTarget;
|
23506 | return !gridGui.contains(dropZoneTarget);
|
23507 | };
|
23508 | RowDragFeature.prototype.onEnterOrDragging = function (draggingEvent) {
|
23509 |
|
23510 | this.dispatchGridEvent(Events.EVENT_ROW_DRAG_MOVE, draggingEvent);
|
23511 | this.lastDraggingEvent = draggingEvent;
|
23512 | var pixel = this.mouseEventService.getNormalisedPosition(draggingEvent).y;
|
23513 | var managedDrag = this.gridOptionsService.is('rowDragManaged');
|
23514 | if (managedDrag) {
|
23515 | this.doManagedDrag(draggingEvent, pixel);
|
23516 | }
|
23517 | this.autoScrollService.check(draggingEvent.event);
|
23518 | };
|
23519 | RowDragFeature.prototype.doManagedDrag = function (draggingEvent, pixel) {
|
23520 | var isFromThisGrid = this.isFromThisGrid(draggingEvent);
|
23521 | var managedDrag = this.gridOptionsService.is('rowDragManaged');
|
23522 | var rowNodes = draggingEvent.dragItem.rowNodes;
|
23523 | if (managedDrag && this.shouldPreventRowMove()) {
|
23524 | return;
|
23525 | }
|
23526 | if (this.gridOptionsService.is('suppressMoveWhenRowDragging') || !isFromThisGrid) {
|
23527 | if (!this.isDropZoneWithinThisGrid(draggingEvent)) {
|
23528 | this.clientSideRowModel.highlightRowAtPixel(rowNodes[0], pixel);
|
23529 | }
|
23530 | }
|
23531 | else {
|
23532 | this.moveRows(rowNodes, pixel);
|
23533 | }
|
23534 | };
|
23535 | RowDragFeature.prototype.getRowIndexNumber = function (rowNode) {
|
23536 | return parseInt(last(rowNode.getRowIndexString().split('-')), 10);
|
23537 | };
|
23538 | RowDragFeature.prototype.moveRowAndClearHighlight = function (draggingEvent) {
|
23539 | var _this = this;
|
23540 | var lastHighlightedRowNode = this.clientSideRowModel.getLastHighlightedRowNode();
|
23541 | var isBelow = lastHighlightedRowNode && lastHighlightedRowNode.highlighted === RowHighlightPosition.Below;
|
23542 | var pixel = this.mouseEventService.getNormalisedPosition(draggingEvent).y;
|
23543 | var rowNodes = draggingEvent.dragItem.rowNodes;
|
23544 | var increment = isBelow ? 1 : 0;
|
23545 | if (this.isFromThisGrid(draggingEvent)) {
|
23546 | rowNodes.forEach(function (rowNode) {
|
23547 | if (rowNode.rowTop < pixel) {
|
23548 | increment -= 1;
|
23549 | }
|
23550 | });
|
23551 | this.moveRows(rowNodes, pixel, increment);
|
23552 | }
|
23553 | else {
|
23554 | var getRowIdFunc_1 = this.gridOptionsService.getRowIdFunc();
|
23555 | var addIndex = this.clientSideRowModel.getRowIndexAtPixel(pixel) + 1;
|
23556 | if (this.clientSideRowModel.getHighlightPosition(pixel) === RowHighlightPosition.Above) {
|
23557 | addIndex--;
|
23558 | }
|
23559 | this.clientSideRowModel.updateRowData({
|
23560 | add: rowNodes
|
23561 | .map(function (node) { return node.data; })
|
23562 | .filter(function (data) { return !_this.clientSideRowModel.getRowNode(getRowIdFunc_1 ? getRowIdFunc_1({ data: data, level: 0 }) : data.id); }),
|
23563 | addIndex: addIndex
|
23564 | });
|
23565 | }
|
23566 | this.clearRowHighlight();
|
23567 | };
|
23568 | RowDragFeature.prototype.clearRowHighlight = function () {
|
23569 | this.clientSideRowModel.highlightRowAtPixel(null);
|
23570 | };
|
23571 | RowDragFeature.prototype.moveRows = function (rowNodes, pixel, increment) {
|
23572 | if (increment === void 0) { increment = 0; }
|
23573 | var rowWasMoved = this.clientSideRowModel.ensureRowsAtPixel(rowNodes, pixel, increment);
|
23574 | if (rowWasMoved) {
|
23575 | this.focusService.clearFocusedCell();
|
23576 | if (this.rangeService) {
|
23577 | this.rangeService.removeAllCellRanges();
|
23578 | }
|
23579 | }
|
23580 | };
|
23581 | RowDragFeature.prototype.addRowDropZone = function (params) {
|
23582 | var _this = this;
|
23583 | if (!params.getContainer()) {
|
23584 | doOnce(function () { return console.warn('AG Grid: addRowDropZone - A container target needs to be provided'); }, 'add-drop-zone-empty-target');
|
23585 | return;
|
23586 | }
|
23587 | if (this.dragAndDropService.findExternalZone(params)) {
|
23588 | console.warn('AG Grid: addRowDropZone - target already exists in the list of DropZones. Use `removeRowDropZone` before adding it again.');
|
23589 | return;
|
23590 | }
|
23591 | var processedParams = {
|
23592 | getContainer: params.getContainer
|
23593 | };
|
23594 | if (params.fromGrid) {
|
23595 | params.fromGrid = undefined;
|
23596 | processedParams = params;
|
23597 | }
|
23598 | else {
|
23599 | if (params.onDragEnter) {
|
23600 | processedParams.onDragEnter = function (e) {
|
23601 | params.onDragEnter(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_ENTER, e));
|
23602 | };
|
23603 | }
|
23604 | if (params.onDragLeave) {
|
23605 | processedParams.onDragLeave = function (e) {
|
23606 | params.onDragLeave(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_LEAVE, e));
|
23607 | };
|
23608 | }
|
23609 | if (params.onDragging) {
|
23610 | processedParams.onDragging = function (e) {
|
23611 | params.onDragging(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_MOVE, e));
|
23612 | };
|
23613 | }
|
23614 | if (params.onDragStop) {
|
23615 | processedParams.onDragStop = function (e) {
|
23616 | params.onDragStop(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_END, e));
|
23617 | };
|
23618 | }
|
23619 | }
|
23620 | this.dragAndDropService.addDropTarget(__assign$9({ isInterestedIn: function (type) { return type === DragSourceType.RowDrag; }, getIconName: function () { return DragAndDropService.ICON_MOVE; }, external: true }, processedParams));
|
23621 | };
|
23622 | RowDragFeature.prototype.getRowDropZone = function (events) {
|
23623 | var _this = this;
|
23624 | var getContainer = this.getContainer.bind(this);
|
23625 | var onDragEnter = this.onDragEnter.bind(this);
|
23626 | var onDragLeave = this.onDragLeave.bind(this);
|
23627 | var onDragging = this.onDragging.bind(this);
|
23628 | var onDragStop = this.onDragStop.bind(this);
|
23629 | if (!events) {
|
23630 | return { getContainer: getContainer, onDragEnter: onDragEnter, onDragLeave: onDragLeave, onDragging: onDragging, onDragStop: onDragStop, fromGrid: true };
|
23631 | }
|
23632 | return {
|
23633 | getContainer: getContainer,
|
23634 | onDragEnter: events.onDragEnter
|
23635 | ? (function (e) {
|
23636 | onDragEnter(e);
|
23637 | events.onDragEnter(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_ENTER, e));
|
23638 | })
|
23639 | : onDragEnter,
|
23640 | onDragLeave: events.onDragLeave
|
23641 | ? (function (e) {
|
23642 | onDragLeave(e);
|
23643 | events.onDragLeave(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_LEAVE, e));
|
23644 | })
|
23645 | : onDragLeave,
|
23646 | onDragging: events.onDragging
|
23647 | ? (function (e) {
|
23648 | onDragging(e);
|
23649 | events.onDragging(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_MOVE, e));
|
23650 | })
|
23651 | : onDragging,
|
23652 | onDragStop: events.onDragStop
|
23653 | ? (function (e) {
|
23654 | onDragStop(e);
|
23655 | events.onDragStop(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_END, e));
|
23656 | })
|
23657 | : onDragStop,
|
23658 | fromGrid: true
|
23659 | };
|
23660 | };
|
23661 | RowDragFeature.prototype.draggingToRowDragEvent = function (type, draggingEvent) {
|
23662 | var yNormalised = this.mouseEventService.getNormalisedPosition(draggingEvent).y;
|
23663 | var mouseIsPastLastRow = yNormalised > this.paginationProxy.getCurrentPageHeight();
|
23664 | var overIndex = -1;
|
23665 | var overNode;
|
23666 | if (!mouseIsPastLastRow) {
|
23667 | overIndex = this.rowModel.getRowIndexAtPixel(yNormalised);
|
23668 | overNode = this.rowModel.getRow(overIndex);
|
23669 | }
|
23670 | var vDirectionString;
|
23671 | switch (draggingEvent.vDirection) {
|
23672 | case VerticalDirection.Down:
|
23673 | vDirectionString = 'down';
|
23674 | break;
|
23675 | case VerticalDirection.Up:
|
23676 | vDirectionString = 'up';
|
23677 | break;
|
23678 | default:
|
23679 | vDirectionString = null;
|
23680 | break;
|
23681 | }
|
23682 | var event = {
|
23683 | type: type,
|
23684 | api: this.gridOptionsService.api,
|
23685 | columnApi: this.gridOptionsService.columnApi,
|
23686 | context: this.gridOptionsService.context,
|
23687 | event: draggingEvent.event,
|
23688 | node: draggingEvent.dragItem.rowNode,
|
23689 | nodes: draggingEvent.dragItem.rowNodes,
|
23690 | overIndex: overIndex,
|
23691 | overNode: overNode,
|
23692 | y: yNormalised,
|
23693 | vDirection: vDirectionString
|
23694 | };
|
23695 | return event;
|
23696 | };
|
23697 | RowDragFeature.prototype.dispatchGridEvent = function (type, draggingEvent) {
|
23698 | var event = this.draggingToRowDragEvent(type, draggingEvent);
|
23699 | this.eventService.dispatchEvent(event);
|
23700 | };
|
23701 | RowDragFeature.prototype.onDragLeave = function (draggingEvent) {
|
23702 | this.dispatchGridEvent(Events.EVENT_ROW_DRAG_LEAVE, draggingEvent);
|
23703 | this.stopDragging(draggingEvent);
|
23704 | if (this.gridOptionsService.is('rowDragManaged')) {
|
23705 | this.clearRowHighlight();
|
23706 | }
|
23707 | if (this.isFromThisGrid(draggingEvent)) {
|
23708 | this.isMultiRowDrag = false;
|
23709 | }
|
23710 | };
|
23711 | RowDragFeature.prototype.onDragStop = function (draggingEvent) {
|
23712 | this.dispatchGridEvent(Events.EVENT_ROW_DRAG_END, draggingEvent);
|
23713 | this.stopDragging(draggingEvent);
|
23714 | if (this.gridOptionsService.is('rowDragManaged') &&
|
23715 | (this.gridOptionsService.is('suppressMoveWhenRowDragging') || !this.isFromThisGrid(draggingEvent)) &&
|
23716 | !this.isDropZoneWithinThisGrid(draggingEvent)) {
|
23717 | this.moveRowAndClearHighlight(draggingEvent);
|
23718 | }
|
23719 | };
|
23720 | RowDragFeature.prototype.stopDragging = function (draggingEvent) {
|
23721 | this.autoScrollService.ensureCleared();
|
23722 | this.getRowNodes(draggingEvent).forEach(function (rowNode) {
|
23723 | rowNode.setDragging(false);
|
23724 | });
|
23725 | };
|
23726 | __decorate$1O([
|
23727 | Autowired('dragAndDropService')
|
23728 | ], RowDragFeature.prototype, "dragAndDropService", void 0);
|
23729 | __decorate$1O([
|
23730 | Autowired('rowModel')
|
23731 | ], RowDragFeature.prototype, "rowModel", void 0);
|
23732 | __decorate$1O([
|
23733 | Autowired('paginationProxy')
|
23734 | ], RowDragFeature.prototype, "paginationProxy", void 0);
|
23735 | __decorate$1O([
|
23736 | Autowired('columnModel')
|
23737 | ], RowDragFeature.prototype, "columnModel", void 0);
|
23738 | __decorate$1O([
|
23739 | Autowired('focusService')
|
23740 | ], RowDragFeature.prototype, "focusService", void 0);
|
23741 | __decorate$1O([
|
23742 | Autowired('sortController')
|
23743 | ], RowDragFeature.prototype, "sortController", void 0);
|
23744 | __decorate$1O([
|
23745 | Autowired('filterManager')
|
23746 | ], RowDragFeature.prototype, "filterManager", void 0);
|
23747 | __decorate$1O([
|
23748 | Autowired('selectionService')
|
23749 | ], RowDragFeature.prototype, "selectionService", void 0);
|
23750 | __decorate$1O([
|
23751 | Autowired('mouseEventService')
|
23752 | ], RowDragFeature.prototype, "mouseEventService", void 0);
|
23753 | __decorate$1O([
|
23754 | Autowired('ctrlsService')
|
23755 | ], RowDragFeature.prototype, "ctrlsService", void 0);
|
23756 | __decorate$1O([
|
23757 | Optional('rangeService')
|
23758 | ], RowDragFeature.prototype, "rangeService", void 0);
|
23759 | __decorate$1O([
|
23760 | PostConstruct
|
23761 | ], RowDragFeature.prototype, "postConstruct", null);
|
23762 | return RowDragFeature;
|
23763 | }(BeanStub));
|
23764 |
|
23765 |
|
23766 |
|
23767 |
|
23768 |
|
23769 |
|
23770 |
|
23771 | var __extends$1W = (undefined && undefined.__extends) || (function () {
|
23772 | var extendStatics = function (d, b) {
|
23773 | extendStatics = Object.setPrototypeOf ||
|
23774 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
23775 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
23776 | return extendStatics(d, b);
|
23777 | };
|
23778 | return function (d, b) {
|
23779 | extendStatics(d, b);
|
23780 | function __() { this.constructor = d; }
|
23781 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
23782 | };
|
23783 | })();
|
23784 | var __decorate$1N = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
23785 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
23786 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
23787 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
23788 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
23789 | };
|
23790 | var RowAnimationCssClasses;
|
23791 | (function (RowAnimationCssClasses) {
|
23792 | RowAnimationCssClasses["ANIMATION_ON"] = "ag-row-animation";
|
23793 | RowAnimationCssClasses["ANIMATION_OFF"] = "ag-row-no-animation";
|
23794 | })(RowAnimationCssClasses || (RowAnimationCssClasses = {}));
|
23795 | var CSS_CLASS_CELL_SELECTABLE = 'ag-selectable';
|
23796 | var CSS_CLASS_FORCE_VERTICAL_SCROLL = 'ag-force-vertical-scroll';
|
23797 | var CSS_CLASS_COLUMN_MOVING = 'ag-column-moving';
|
23798 | var GridBodyCtrl = (function (_super) {
|
23799 | __extends$1W(GridBodyCtrl, _super);
|
23800 | function GridBodyCtrl() {
|
23801 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
23802 | _this.stickyTopHeight = 0;
|
23803 | return _this;
|
23804 | }
|
23805 | GridBodyCtrl.prototype.getScrollFeature = function () {
|
23806 | return this.bodyScrollFeature;
|
23807 | };
|
23808 | GridBodyCtrl.prototype.getBodyViewportElement = function () {
|
23809 | return this.eBodyViewport;
|
23810 | };
|
23811 | GridBodyCtrl.prototype.setComp = function (comp, eGridBody, eBodyViewport, eTop, eBottom, eStickyTop) {
|
23812 | this.comp = comp;
|
23813 | this.eGridBody = eGridBody;
|
23814 | this.eBodyViewport = eBodyViewport;
|
23815 | this.eTop = eTop;
|
23816 | this.eBottom = eBottom;
|
23817 | this.eStickyTop = eStickyTop;
|
23818 | this.setCellTextSelection(this.gridOptionsService.is('enableCellTextSelection'));
|
23819 | this.createManagedBean(new LayoutFeature(this.comp));
|
23820 | this.bodyScrollFeature = this.createManagedBean(new GridBodyScrollFeature(this.eBodyViewport));
|
23821 | this.addRowDragListener();
|
23822 | this.setupRowAnimationCssClass();
|
23823 | this.addEventListeners();
|
23824 | this.addFocusListeners([eTop, eBodyViewport, eBottom, eStickyTop]);
|
23825 | this.onGridColumnsChanged();
|
23826 | this.addBodyViewportListener();
|
23827 | this.setFloatingHeights();
|
23828 | this.disableBrowserDragging();
|
23829 | this.addStopEditingWhenGridLosesFocus();
|
23830 | this.ctrlsService.registerGridBodyCtrl(this);
|
23831 | };
|
23832 | GridBodyCtrl.prototype.getComp = function () {
|
23833 | return this.comp;
|
23834 | };
|
23835 | GridBodyCtrl.prototype.addEventListeners = function () {
|
23836 | this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.onGridColumnsChanged.bind(this));
|
23837 | this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, this.onScrollVisibilityChanged.bind(this));
|
23838 | this.addManagedListener(this.eventService, Events.EVENT_PINNED_ROW_DATA_CHANGED, this.onPinnedRowDataChanged.bind(this));
|
23839 | this.addManagedListener(this.eventService, Events.EVENT_HEADER_HEIGHT_CHANGED, this.onHeaderHeightChanged.bind(this));
|
23840 | };
|
23841 | GridBodyCtrl.prototype.addFocusListeners = function (elements) {
|
23842 | var _this = this;
|
23843 | elements.forEach(function (element) {
|
23844 | _this.addManagedListener(element, 'focusin', function (e) {
|
23845 | var target = e.target;
|
23846 |
|
23847 | var isFocusedElementNested = isElementChildOfClass(target, 'ag-root', element);
|
23848 | element.classList.toggle('ag-has-focus', !isFocusedElementNested);
|
23849 | });
|
23850 | _this.addManagedListener(element, 'focusout', function (e) {
|
23851 | var target = e.target, relatedTarget = e.relatedTarget;
|
23852 | var gridContainRelatedTarget = element.contains(relatedTarget);
|
23853 | var isNestedRelatedTarget = isElementChildOfClass(relatedTarget, 'ag-root', element);
|
23854 | var isNestedTarget = isElementChildOfClass(target, 'ag-root', element);
|
23855 |
|
23856 |
|
23857 | if (isNestedTarget) {
|
23858 | return;
|
23859 | }
|
23860 |
|
23861 |
|
23862 | if (!gridContainRelatedTarget || isNestedRelatedTarget) {
|
23863 | element.classList.remove('ag-has-focus');
|
23864 | }
|
23865 | });
|
23866 | });
|
23867 | };
|
23868 |
|
23869 | GridBodyCtrl.prototype.setColumnMovingCss = function (moving) {
|
23870 | this.comp.setColumnMovingCss(CSS_CLASS_COLUMN_MOVING, moving);
|
23871 | };
|
23872 | GridBodyCtrl.prototype.setCellTextSelection = function (selectable) {
|
23873 | if (selectable === void 0) { selectable = false; }
|
23874 | var cssClass = selectable ? CSS_CLASS_CELL_SELECTABLE : null;
|
23875 | this.comp.setCellSelectableCss(cssClass, selectable);
|
23876 | };
|
23877 | GridBodyCtrl.prototype.onScrollVisibilityChanged = function () {
|
23878 | var visible = this.scrollVisibleService.isVerticalScrollShowing();
|
23879 | this.setVerticalScrollPaddingVisible(visible);
|
23880 | this.setStickyTopWidth(visible);
|
23881 | var scrollbarWidth = visible ? (this.gridOptionsService.getScrollbarWidth() || 0) : 0;
|
23882 | var pad = isInvisibleScrollbar() ? 16 : 0;
|
23883 | var width = "calc(100% + " + (scrollbarWidth + pad) + "px)";
|
23884 | this.comp.setBodyViewportWidth(width);
|
23885 | };
|
23886 | GridBodyCtrl.prototype.onGridColumnsChanged = function () {
|
23887 | var columns = this.columnModel.getAllGridColumns();
|
23888 | this.comp.setColumnCount(columns ? columns.length : 0);
|
23889 | };
|
23890 |
|
23891 |
|
23892 | GridBodyCtrl.prototype.disableBrowserDragging = function () {
|
23893 | this.addManagedListener(this.eGridBody, 'dragstart', function (event) {
|
23894 | if (event.target instanceof HTMLImageElement) {
|
23895 | event.preventDefault();
|
23896 | return false;
|
23897 | }
|
23898 | });
|
23899 | };
|
23900 | GridBodyCtrl.prototype.addStopEditingWhenGridLosesFocus = function () {
|
23901 | var _this = this;
|
23902 | if (!this.gridOptionsService.is('stopEditingWhenCellsLoseFocus')) {
|
23903 | return;
|
23904 | }
|
23905 | var focusOutListener = function (event) {
|
23906 |
|
23907 | var elementWithFocus = event.relatedTarget;
|
23908 | if (getTabIndex(elementWithFocus) === null) {
|
23909 | _this.rowRenderer.stopEditing();
|
23910 | return;
|
23911 | }
|
23912 | var clickInsideGrid =
|
23913 |
|
23914 | viewports.some(function (viewport) { return viewport.contains(elementWithFocus); })
|
23915 |
|
23916 | && _this.mouseEventService.isElementInThisGrid(elementWithFocus);
|
23917 | if (!clickInsideGrid) {
|
23918 | var popupService = _this.popupService;
|
23919 | clickInsideGrid =
|
23920 | popupService.getActivePopups().some(function (popup) { return popup.contains(elementWithFocus); }) ||
|
23921 | popupService.isElementWithinCustomPopup(elementWithFocus);
|
23922 | }
|
23923 | if (!clickInsideGrid) {
|
23924 | _this.rowRenderer.stopEditing();
|
23925 | }
|
23926 | };
|
23927 | var viewports = [this.eBodyViewport, this.eBottom, this.eTop, this.eStickyTop];
|
23928 | viewports.forEach(function (viewport) { return _this.addManagedListener(viewport, 'focusout', focusOutListener); });
|
23929 | };
|
23930 | GridBodyCtrl.prototype.updateRowCount = function () {
|
23931 | var headerCount = this.headerNavigationService.getHeaderRowCount();
|
23932 | var rowCount = this.rowModel.isLastRowIndexKnown() ? this.rowModel.getRowCount() : -1;
|
23933 | var total = rowCount === -1 ? -1 : (headerCount + rowCount);
|
23934 | this.comp.setRowCount(total);
|
23935 | };
|
23936 | GridBodyCtrl.prototype.registerBodyViewportResizeListener = function (listener) {
|
23937 | this.comp.registerBodyViewportResizeListener(listener);
|
23938 | };
|
23939 | GridBodyCtrl.prototype.setVerticalScrollPaddingVisible = function (visible) {
|
23940 | var overflowY = visible ? 'scroll' : 'hidden';
|
23941 | this.comp.setPinnedTopBottomOverflowY(overflowY);
|
23942 | };
|
23943 | GridBodyCtrl.prototype.isVerticalScrollShowing = function () {
|
23944 | var show = this.gridOptionsService.is('alwaysShowVerticalScroll');
|
23945 | var cssClass = show ? CSS_CLASS_FORCE_VERTICAL_SCROLL : null;
|
23946 | var allowVerticalScroll = this.gridOptionsService.isDomLayout('normal');
|
23947 | this.comp.setAlwaysVerticalScrollClass(cssClass, show);
|
23948 | return show || (allowVerticalScroll && isVerticalScrollShowing(this.eBodyViewport));
|
23949 | };
|
23950 | GridBodyCtrl.prototype.setupRowAnimationCssClass = function () {
|
23951 | var _this = this;
|
23952 | var listener = function () {
|
23953 |
|
23954 |
|
23955 | var animateRows = _this.gridOptionsService.isAnimateRows() && !_this.rowContainerHeightService.isStretching();
|
23956 | var animateRowsCssClass = animateRows ? RowAnimationCssClasses.ANIMATION_ON : RowAnimationCssClasses.ANIMATION_OFF;
|
23957 | _this.comp.setRowAnimationCssOnBodyViewport(animateRowsCssClass, animateRows);
|
23958 | };
|
23959 | listener();
|
23960 | this.addManagedListener(this.eventService, Events.EVENT_HEIGHT_SCALE_CHANGED, listener);
|
23961 | this.addManagedPropertyListener('animateRows', listener);
|
23962 | };
|
23963 | GridBodyCtrl.prototype.getGridBodyElement = function () {
|
23964 | return this.eGridBody;
|
23965 | };
|
23966 | GridBodyCtrl.prototype.addBodyViewportListener = function () {
|
23967 | var _this = this;
|
23968 |
|
23969 |
|
23970 | var listener = function (mouseEvent, touch, touchEvent) {
|
23971 | if (!mouseEvent && !touchEvent) {
|
23972 | return;
|
23973 | }
|
23974 | if (_this.gridOptionsService.is('preventDefaultOnContextMenu')) {
|
23975 | var event_1 = (mouseEvent || touchEvent);
|
23976 | event_1.preventDefault();
|
23977 | }
|
23978 | var target = (mouseEvent || touch).target;
|
23979 | if (target === _this.eBodyViewport || target === _this.ctrlsService.getCenterRowContainerCtrl().getViewportElement()) {
|
23980 |
|
23981 | if (_this.contextMenuFactory) {
|
23982 | if (mouseEvent) {
|
23983 | _this.contextMenuFactory.onContextMenu(mouseEvent, null, null, null, null, _this.eGridBody);
|
23984 | }
|
23985 | else if (touchEvent) {
|
23986 | _this.contextMenuFactory.onContextMenu(null, touchEvent, null, null, null, _this.eGridBody);
|
23987 | }
|
23988 | }
|
23989 | }
|
23990 | };
|
23991 | this.addManagedListener(this.eBodyViewport, 'contextmenu', listener);
|
23992 | this.mockContextMenuForIPad(listener);
|
23993 | this.addManagedListener(this.eBodyViewport, 'wheel', this.onBodyViewportWheel.bind(this));
|
23994 | this.addManagedListener(this.eStickyTop, 'wheel', this.onStickyTopWheel.bind(this));
|
23995 | };
|
23996 | GridBodyCtrl.prototype.mockContextMenuForIPad = function (listener) {
|
23997 |
|
23998 | if (!isIOSUserAgent()) {
|
23999 | return;
|
24000 | }
|
24001 | var touchListener = new TouchListener(this.eBodyViewport);
|
24002 | var longTapListener = function (event) {
|
24003 | listener(undefined, event.touchStart, event.touchEvent);
|
24004 | };
|
24005 | this.addManagedListener(touchListener, TouchListener.EVENT_LONG_TAP, longTapListener);
|
24006 | this.addDestroyFunc(function () { return touchListener.destroy(); });
|
24007 | };
|
24008 | GridBodyCtrl.prototype.onBodyViewportWheel = function (e) {
|
24009 | if (!this.gridOptionsService.is('suppressScrollWhenPopupsAreOpen')) {
|
24010 | return;
|
24011 | }
|
24012 | if (this.popupService.hasAnchoredPopup()) {
|
24013 | e.preventDefault();
|
24014 | }
|
24015 | };
|
24016 | GridBodyCtrl.prototype.onStickyTopWheel = function (e) {
|
24017 | e.preventDefault();
|
24018 | if (e.offsetY) {
|
24019 | this.scrollVertically(e.deltaY);
|
24020 | }
|
24021 | };
|
24022 | GridBodyCtrl.prototype.getGui = function () {
|
24023 | return this.eGridBody;
|
24024 | };
|
24025 |
|
24026 | GridBodyCtrl.prototype.scrollVertically = function (pixels) {
|
24027 | var oldScrollPosition = this.eBodyViewport.scrollTop;
|
24028 | this.bodyScrollFeature.setVerticalScrollPosition(oldScrollPosition + pixels);
|
24029 | return this.eBodyViewport.scrollTop - oldScrollPosition;
|
24030 | };
|
24031 | GridBodyCtrl.prototype.addRowDragListener = function () {
|
24032 | this.rowDragFeature = this.createManagedBean(new RowDragFeature(this.eBodyViewport));
|
24033 | this.dragAndDropService.addDropTarget(this.rowDragFeature);
|
24034 | };
|
24035 | GridBodyCtrl.prototype.getRowDragFeature = function () {
|
24036 | return this.rowDragFeature;
|
24037 | };
|
24038 | GridBodyCtrl.prototype.onPinnedRowDataChanged = function () {
|
24039 | this.setFloatingHeights();
|
24040 | };
|
24041 | GridBodyCtrl.prototype.setFloatingHeights = function () {
|
24042 | var pinnedRowModel = this.pinnedRowModel;
|
24043 | var floatingTopHeight = pinnedRowModel.getPinnedTopTotalHeight();
|
24044 | if (floatingTopHeight) {
|
24045 |
|
24046 | floatingTopHeight += 1;
|
24047 | }
|
24048 | var floatingBottomHeight = pinnedRowModel.getPinnedBottomTotalHeight();
|
24049 | if (floatingBottomHeight) {
|
24050 |
|
24051 | floatingBottomHeight += 1;
|
24052 | }
|
24053 | this.comp.setTopHeight(floatingTopHeight);
|
24054 | this.comp.setBottomHeight(floatingBottomHeight);
|
24055 | this.comp.setTopDisplay(floatingTopHeight ? 'inherit' : 'none');
|
24056 | this.comp.setBottomDisplay(floatingBottomHeight ? 'inherit' : 'none');
|
24057 | this.setStickyTopOffsetTop();
|
24058 | };
|
24059 | GridBodyCtrl.prototype.setStickyTopHeight = function (height) {
|
24060 | if (height === void 0) { height = 0; }
|
24061 |
|
24062 | this.comp.setStickyTopHeight(height + "px");
|
24063 | this.stickyTopHeight = height;
|
24064 | };
|
24065 | GridBodyCtrl.prototype.getStickyTopHeight = function () {
|
24066 | return this.stickyTopHeight;
|
24067 | };
|
24068 | GridBodyCtrl.prototype.setStickyTopWidth = function (vScrollVisible) {
|
24069 | if (!vScrollVisible) {
|
24070 | this.comp.setStickyTopWidth('100%');
|
24071 | }
|
24072 | else {
|
24073 | var scrollbarWidth = this.gridOptionsService.getScrollbarWidth();
|
24074 | this.comp.setStickyTopWidth("calc(100% - " + scrollbarWidth + "px)");
|
24075 | }
|
24076 | };
|
24077 | GridBodyCtrl.prototype.onHeaderHeightChanged = function () {
|
24078 | this.setStickyTopOffsetTop();
|
24079 | };
|
24080 | GridBodyCtrl.prototype.setStickyTopOffsetTop = function () {
|
24081 | var headerCtrl = this.ctrlsService.getGridHeaderCtrl();
|
24082 | var headerHeight = headerCtrl.getHeaderHeight();
|
24083 | var pinnedTopHeight = this.pinnedRowModel.getPinnedTopTotalHeight();
|
24084 | var height = 0;
|
24085 | if (headerHeight > 0) {
|
24086 | height += headerHeight + 1;
|
24087 | }
|
24088 | if (pinnedTopHeight > 0) {
|
24089 | height += pinnedTopHeight + 1;
|
24090 | }
|
24091 | this.comp.setStickyTopTop(height + "px");
|
24092 | };
|
24093 |
|
24094 |
|
24095 | GridBodyCtrl.prototype.sizeColumnsToFit = function (params, nextTimeout) {
|
24096 | var _this = this;
|
24097 | var removeScrollWidth = this.isVerticalScrollShowing();
|
24098 | var scrollWidthToRemove = removeScrollWidth ? this.gridOptionsService.getScrollbarWidth() : 0;
|
24099 |
|
24100 |
|
24101 | var bodyViewportWidth = getInnerWidth(this.eGridBody);
|
24102 | var availableWidth = bodyViewportWidth - scrollWidthToRemove;
|
24103 | if (availableWidth > 0) {
|
24104 | this.columnModel.sizeColumnsToFit(availableWidth, "sizeColumnsToFit", false, params);
|
24105 | return;
|
24106 | }
|
24107 | if (nextTimeout === undefined) {
|
24108 | window.setTimeout(function () {
|
24109 | _this.sizeColumnsToFit(params, 100);
|
24110 | }, 0);
|
24111 | }
|
24112 | else if (nextTimeout === 100) {
|
24113 | window.setTimeout(function () {
|
24114 | _this.sizeColumnsToFit(params, 500);
|
24115 | }, 100);
|
24116 | }
|
24117 | else if (nextTimeout === 500) {
|
24118 | window.setTimeout(function () {
|
24119 | _this.sizeColumnsToFit(params, -1);
|
24120 | }, 500);
|
24121 | }
|
24122 | else {
|
24123 | console.warn('AG Grid: tried to call sizeColumnsToFit() but the grid is coming back with ' +
|
24124 | 'zero width, maybe the grid is not visible yet on the screen?');
|
24125 | }
|
24126 | };
|
24127 |
|
24128 | GridBodyCtrl.prototype.addScrollEventListener = function (listener) {
|
24129 | this.eBodyViewport.addEventListener('scroll', listener, { passive: true });
|
24130 | };
|
24131 |
|
24132 | GridBodyCtrl.prototype.removeScrollEventListener = function (listener) {
|
24133 | this.eBodyViewport.removeEventListener('scroll', listener);
|
24134 | };
|
24135 | __decorate$1N([
|
24136 | Autowired('rowContainerHeightService')
|
24137 | ], GridBodyCtrl.prototype, "rowContainerHeightService", void 0);
|
24138 | __decorate$1N([
|
24139 | Autowired('ctrlsService')
|
24140 | ], GridBodyCtrl.prototype, "ctrlsService", void 0);
|
24141 | __decorate$1N([
|
24142 | Autowired('columnModel')
|
24143 | ], GridBodyCtrl.prototype, "columnModel", void 0);
|
24144 | __decorate$1N([
|
24145 | Autowired('scrollVisibleService')
|
24146 | ], GridBodyCtrl.prototype, "scrollVisibleService", void 0);
|
24147 | __decorate$1N([
|
24148 | Optional('contextMenuFactory')
|
24149 | ], GridBodyCtrl.prototype, "contextMenuFactory", void 0);
|
24150 | __decorate$1N([
|
24151 | Autowired('headerNavigationService')
|
24152 | ], GridBodyCtrl.prototype, "headerNavigationService", void 0);
|
24153 | __decorate$1N([
|
24154 | Autowired('dragAndDropService')
|
24155 | ], GridBodyCtrl.prototype, "dragAndDropService", void 0);
|
24156 | __decorate$1N([
|
24157 | Autowired('pinnedRowModel')
|
24158 | ], GridBodyCtrl.prototype, "pinnedRowModel", void 0);
|
24159 | __decorate$1N([
|
24160 | Autowired('rowRenderer')
|
24161 | ], GridBodyCtrl.prototype, "rowRenderer", void 0);
|
24162 | __decorate$1N([
|
24163 | Autowired('popupService')
|
24164 | ], GridBodyCtrl.prototype, "popupService", void 0);
|
24165 | __decorate$1N([
|
24166 | Autowired('mouseEventService')
|
24167 | ], GridBodyCtrl.prototype, "mouseEventService", void 0);
|
24168 | __decorate$1N([
|
24169 | Autowired('rowModel')
|
24170 | ], GridBodyCtrl.prototype, "rowModel", void 0);
|
24171 | return GridBodyCtrl;
|
24172 | }(BeanStub));
|
24173 |
|
24174 |
|
24175 |
|
24176 |
|
24177 |
|
24178 |
|
24179 |
|
24180 | var SelectionHandleType;
|
24181 | (function (SelectionHandleType) {
|
24182 | SelectionHandleType[SelectionHandleType["FILL"] = 0] = "FILL";
|
24183 | SelectionHandleType[SelectionHandleType["RANGE"] = 1] = "RANGE";
|
24184 | })(SelectionHandleType || (SelectionHandleType = {}));
|
24185 | var CellRangeType;
|
24186 | (function (CellRangeType) {
|
24187 | CellRangeType[CellRangeType["VALUE"] = 0] = "VALUE";
|
24188 | CellRangeType[CellRangeType["DIMENSION"] = 1] = "DIMENSION";
|
24189 | })(CellRangeType || (CellRangeType = {}));
|
24190 |
|
24191 |
|
24192 |
|
24193 |
|
24194 |
|
24195 |
|
24196 |
|
24197 | var CSS_CELL_RANGE_SELECTED = 'ag-cell-range-selected';
|
24198 | var CSS_CELL_RANGE_CHART = 'ag-cell-range-chart';
|
24199 | var CSS_CELL_RANGE_SINGLE_CELL = 'ag-cell-range-single-cell';
|
24200 | var CSS_CELL_RANGE_CHART_CATEGORY = 'ag-cell-range-chart-category';
|
24201 | var CSS_CELL_RANGE_HANDLE = 'ag-cell-range-handle';
|
24202 | var CSS_CELL_RANGE_TOP = 'ag-cell-range-top';
|
24203 | var CSS_CELL_RANGE_RIGHT = 'ag-cell-range-right';
|
24204 | var CSS_CELL_RANGE_BOTTOM = 'ag-cell-range-bottom';
|
24205 | var CSS_CELL_RANGE_LEFT = 'ag-cell-range-left';
|
24206 | var CellRangeFeature = (function () {
|
24207 | function CellRangeFeature(beans, ctrl) {
|
24208 | this.beans = beans;
|
24209 | this.cellCtrl = ctrl;
|
24210 | }
|
24211 | CellRangeFeature.prototype.setComp = function (cellComp, eGui) {
|
24212 | this.cellComp = cellComp;
|
24213 | this.eGui = eGui;
|
24214 | this.onRangeSelectionChanged();
|
24215 | };
|
24216 | CellRangeFeature.prototype.onRangeSelectionChanged = function () {
|
24217 |
|
24218 | if (!this.cellComp) {
|
24219 | return;
|
24220 | }
|
24221 | this.rangeCount = this.beans.rangeService.getCellRangeCount(this.cellCtrl.getCellPosition());
|
24222 | this.hasChartRange = this.getHasChartRange();
|
24223 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED, this.rangeCount !== 0);
|
24224 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-1", this.rangeCount === 1);
|
24225 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-2", this.rangeCount === 2);
|
24226 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-3", this.rangeCount === 3);
|
24227 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-4", this.rangeCount >= 4);
|
24228 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_CHART, this.hasChartRange);
|
24229 | setAriaSelected(this.eGui, this.rangeCount > 0 ? true : undefined);
|
24230 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SINGLE_CELL, this.isSingleCell());
|
24231 | this.updateRangeBorders();
|
24232 | this.refreshHandle();
|
24233 | };
|
24234 | CellRangeFeature.prototype.updateRangeBorders = function () {
|
24235 | var rangeBorders = this.getRangeBorders();
|
24236 | var isSingleCell = this.isSingleCell();
|
24237 | var isTop = !isSingleCell && rangeBorders.top;
|
24238 | var isRight = !isSingleCell && rangeBorders.right;
|
24239 | var isBottom = !isSingleCell && rangeBorders.bottom;
|
24240 | var isLeft = !isSingleCell && rangeBorders.left;
|
24241 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_TOP, isTop);
|
24242 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_RIGHT, isRight);
|
24243 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_BOTTOM, isBottom);
|
24244 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_LEFT, isLeft);
|
24245 | };
|
24246 | CellRangeFeature.prototype.isSingleCell = function () {
|
24247 | var rangeService = this.beans.rangeService;
|
24248 | return this.rangeCount === 1 && rangeService && !rangeService.isMoreThanOneCell();
|
24249 | };
|
24250 | CellRangeFeature.prototype.getHasChartRange = function () {
|
24251 | var rangeService = this.beans.rangeService;
|
24252 | if (!this.rangeCount || !rangeService) {
|
24253 | return false;
|
24254 | }
|
24255 | var cellRanges = rangeService.getCellRanges();
|
24256 | return cellRanges.length > 0 && cellRanges.every(function (range) { return includes([CellRangeType.DIMENSION, CellRangeType.VALUE], range.type); });
|
24257 | };
|
24258 | CellRangeFeature.prototype.updateRangeBordersIfRangeCount = function () {
|
24259 |
|
24260 | if (this.rangeCount > 0) {
|
24261 | this.updateRangeBorders();
|
24262 | this.refreshHandle();
|
24263 | }
|
24264 | };
|
24265 | CellRangeFeature.prototype.getRangeBorders = function () {
|
24266 | var _this = this;
|
24267 | var isRtl = this.beans.gridOptionsService.is('enableRtl');
|
24268 | var top = false;
|
24269 | var right = false;
|
24270 | var bottom = false;
|
24271 | var left = false;
|
24272 | var thisCol = this.cellCtrl.getCellPosition().column;
|
24273 | var _a = this.beans, rangeService = _a.rangeService, columnModel = _a.columnModel;
|
24274 | var leftCol;
|
24275 | var rightCol;
|
24276 | if (isRtl) {
|
24277 | leftCol = columnModel.getDisplayedColAfter(thisCol);
|
24278 | rightCol = columnModel.getDisplayedColBefore(thisCol);
|
24279 | }
|
24280 | else {
|
24281 | leftCol = columnModel.getDisplayedColBefore(thisCol);
|
24282 | rightCol = columnModel.getDisplayedColAfter(thisCol);
|
24283 | }
|
24284 | var ranges = rangeService.getCellRanges().filter(function (range) { return rangeService.isCellInSpecificRange(_this.cellCtrl.getCellPosition(), range); });
|
24285 |
|
24286 | if (!leftCol) {
|
24287 | left = true;
|
24288 | }
|
24289 |
|
24290 | if (!rightCol) {
|
24291 | right = true;
|
24292 | }
|
24293 | for (var i = 0; i < ranges.length; i++) {
|
24294 | if (top && right && bottom && left) {
|
24295 | break;
|
24296 | }
|
24297 | var range = ranges[i];
|
24298 | var startRow = rangeService.getRangeStartRow(range);
|
24299 | var endRow = rangeService.getRangeEndRow(range);
|
24300 | if (!top && this.beans.rowPositionUtils.sameRow(startRow, this.cellCtrl.getCellPosition())) {
|
24301 | top = true;
|
24302 | }
|
24303 | if (!bottom && this.beans.rowPositionUtils.sameRow(endRow, this.cellCtrl.getCellPosition())) {
|
24304 | bottom = true;
|
24305 | }
|
24306 | if (!left && leftCol && range.columns.indexOf(leftCol) < 0) {
|
24307 | left = true;
|
24308 | }
|
24309 | if (!right && rightCol && range.columns.indexOf(rightCol) < 0) {
|
24310 | right = true;
|
24311 | }
|
24312 | }
|
24313 | return { top: top, right: right, bottom: bottom, left: left };
|
24314 | };
|
24315 | CellRangeFeature.prototype.refreshHandle = function () {
|
24316 | if (!this.beans.rangeService) {
|
24317 | return;
|
24318 | }
|
24319 | var shouldHaveSelectionHandle = this.shouldHaveSelectionHandle();
|
24320 | if (this.selectionHandle && !shouldHaveSelectionHandle) {
|
24321 | this.selectionHandle = this.beans.context.destroyBean(this.selectionHandle);
|
24322 | }
|
24323 | if (shouldHaveSelectionHandle) {
|
24324 | this.addSelectionHandle();
|
24325 | }
|
24326 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_HANDLE, !!this.selectionHandle);
|
24327 | };
|
24328 | CellRangeFeature.prototype.shouldHaveSelectionHandle = function () {
|
24329 | var _a = this.beans, gridOptionsService = _a.gridOptionsService, rangeService = _a.rangeService;
|
24330 | var cellRanges = rangeService.getCellRanges();
|
24331 | var rangesLen = cellRanges.length;
|
24332 | if (this.rangeCount < 1 || rangesLen < 1) {
|
24333 | return false;
|
24334 | }
|
24335 | var cellRange = last(cellRanges);
|
24336 | var cellPosition = this.cellCtrl.getCellPosition();
|
24337 | var isFillHandleAvailable = gridOptionsService.is('enableFillHandle') && !this.cellCtrl.isSuppressFillHandle();
|
24338 | var isRangeHandleAvailable = gridOptionsService.is('enableRangeHandle');
|
24339 | var handleIsAvailable = rangesLen === 1 && !this.cellCtrl.isEditing() && (isFillHandleAvailable || isRangeHandleAvailable);
|
24340 | if (this.hasChartRange) {
|
24341 | var hasCategoryRange = cellRanges[0].type === CellRangeType.DIMENSION;
|
24342 | var isCategoryCell = hasCategoryRange && rangeService.isCellInSpecificRange(cellPosition, cellRanges[0]);
|
24343 | this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_CHART_CATEGORY, isCategoryCell);
|
24344 | handleIsAvailable = cellRange.type === CellRangeType.VALUE;
|
24345 | }
|
24346 | return handleIsAvailable &&
|
24347 | cellRange.endRow != null &&
|
24348 | rangeService.isContiguousRange(cellRange) &&
|
24349 | rangeService.isBottomRightCell(cellRange, cellPosition);
|
24350 | };
|
24351 | CellRangeFeature.prototype.addSelectionHandle = function () {
|
24352 | var _a = this.beans, gridOptionsService = _a.gridOptionsService, rangeService = _a.rangeService;
|
24353 | var cellRangeType = last(rangeService.getCellRanges()).type;
|
24354 | var selectionHandleFill = gridOptionsService.is('enableFillHandle') && missing(cellRangeType);
|
24355 | var type = selectionHandleFill ? SelectionHandleType.FILL : SelectionHandleType.RANGE;
|
24356 | if (this.selectionHandle && this.selectionHandle.getType() !== type) {
|
24357 | this.selectionHandle = this.beans.context.destroyBean(this.selectionHandle);
|
24358 | }
|
24359 | if (!this.selectionHandle) {
|
24360 | this.selectionHandle = this.beans.selectionHandleFactory.createSelectionHandle(type);
|
24361 | }
|
24362 | this.selectionHandle.refresh(this.cellCtrl);
|
24363 | };
|
24364 | CellRangeFeature.prototype.destroy = function () {
|
24365 | this.beans.context.destroyBean(this.selectionHandle);
|
24366 | };
|
24367 | return CellRangeFeature;
|
24368 | }());
|
24369 |
|
24370 |
|
24371 |
|
24372 |
|
24373 |
|
24374 |
|
24375 |
|
24376 | var __extends$1V = (undefined && undefined.__extends) || (function () {
|
24377 | var extendStatics = function (d, b) {
|
24378 | extendStatics = Object.setPrototypeOf ||
|
24379 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
24380 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
24381 | return extendStatics(d, b);
|
24382 | };
|
24383 | return function (d, b) {
|
24384 | extendStatics(d, b);
|
24385 | function __() { this.constructor = d; }
|
24386 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
24387 | };
|
24388 | })();
|
24389 |
|
24390 |
|
24391 |
|
24392 |
|
24393 |
|
24394 |
|
24395 | var CellPositionFeature = (function (_super) {
|
24396 | __extends$1V(CellPositionFeature, _super);
|
24397 | function CellPositionFeature(ctrl, beans) {
|
24398 | var _this = _super.call(this) || this;
|
24399 | _this.cellCtrl = ctrl;
|
24400 | _this.beans = beans;
|
24401 | _this.column = ctrl.getColumn();
|
24402 | _this.rowNode = ctrl.getRowNode();
|
24403 | _this.setupColSpan();
|
24404 | _this.setupRowSpan();
|
24405 | return _this;
|
24406 | }
|
24407 | CellPositionFeature.prototype.setupRowSpan = function () {
|
24408 | this.rowSpan = this.column.getRowSpan(this.rowNode);
|
24409 | };
|
24410 | CellPositionFeature.prototype.setComp = function (eGui) {
|
24411 | this.eGui = eGui;
|
24412 | this.onLeftChanged();
|
24413 | this.onWidthChanged();
|
24414 | this.applyRowSpan();
|
24415 | };
|
24416 | CellPositionFeature.prototype.onDisplayColumnsChanged = function () {
|
24417 | var colsSpanning = this.getColSpanningList();
|
24418 | if (!areEqual(this.colsSpanning, colsSpanning)) {
|
24419 | this.colsSpanning = colsSpanning;
|
24420 | this.onWidthChanged();
|
24421 | this.onLeftChanged();
|
24422 | }
|
24423 | };
|
24424 | CellPositionFeature.prototype.setupColSpan = function () {
|
24425 |
|
24426 | if (this.column.getColDef().colSpan == null) {
|
24427 | return;
|
24428 | }
|
24429 | this.colsSpanning = this.getColSpanningList();
|
24430 |
|
24431 | this.addManagedListener(this.beans.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayColumnsChanged.bind(this));
|
24432 |
|
24433 |
|
24434 |
|
24435 |
|
24436 | this.addManagedListener(this.beans.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onWidthChanged.bind(this));
|
24437 | };
|
24438 | CellPositionFeature.prototype.onWidthChanged = function () {
|
24439 | if (!this.eGui) {
|
24440 | return;
|
24441 | }
|
24442 | var width = this.getCellWidth();
|
24443 | this.eGui.style.width = width + "px";
|
24444 | };
|
24445 | CellPositionFeature.prototype.getCellWidth = function () {
|
24446 | if (!this.colsSpanning) {
|
24447 | return this.column.getActualWidth();
|
24448 | }
|
24449 | return this.colsSpanning.reduce(function (width, col) { return width + col.getActualWidth(); }, 0);
|
24450 | };
|
24451 | CellPositionFeature.prototype.getColSpanningList = function () {
|
24452 | var colSpan = this.column.getColSpan(this.rowNode);
|
24453 | var colsSpanning = [];
|
24454 |
|
24455 | if (colSpan === 1) {
|
24456 | colsSpanning.push(this.column);
|
24457 | }
|
24458 | else {
|
24459 | var pointer = this.column;
|
24460 | var pinned = this.column.getPinned();
|
24461 | for (var i = 0; pointer && i < colSpan; i++) {
|
24462 | colsSpanning.push(pointer);
|
24463 | pointer = this.beans.columnModel.getDisplayedColAfter(pointer);
|
24464 | if (!pointer || missing(pointer)) {
|
24465 | break;
|
24466 | }
|
24467 |
|
24468 | if (pinned !== pointer.getPinned()) {
|
24469 | break;
|
24470 | }
|
24471 | }
|
24472 | }
|
24473 | return colsSpanning;
|
24474 | };
|
24475 | CellPositionFeature.prototype.onLeftChanged = function () {
|
24476 | if (!this.eGui) {
|
24477 | return;
|
24478 | }
|
24479 | var left = this.modifyLeftForPrintLayout(this.getCellLeft());
|
24480 | this.eGui.style.left = left + 'px';
|
24481 | };
|
24482 | CellPositionFeature.prototype.getCellLeft = function () {
|
24483 | var mostLeftCol;
|
24484 | if (this.beans.gridOptionsService.is('enableRtl') && this.colsSpanning) {
|
24485 | mostLeftCol = last(this.colsSpanning);
|
24486 | }
|
24487 | else {
|
24488 | mostLeftCol = this.column;
|
24489 | }
|
24490 | return mostLeftCol.getLeft();
|
24491 | };
|
24492 | CellPositionFeature.prototype.modifyLeftForPrintLayout = function (leftPosition) {
|
24493 | if (!this.cellCtrl.isPrintLayout() || this.column.getPinned() === 'left') {
|
24494 | return leftPosition;
|
24495 | }
|
24496 | var leftWidth = this.beans.columnModel.getDisplayedColumnsLeftWidth();
|
24497 | if (this.column.getPinned() === 'right') {
|
24498 | var bodyWidth = this.beans.columnModel.getBodyContainerWidth();
|
24499 | return leftWidth + bodyWidth + (leftPosition || 0);
|
24500 | }
|
24501 |
|
24502 | return leftWidth + (leftPosition || 0);
|
24503 | };
|
24504 | CellPositionFeature.prototype.applyRowSpan = function () {
|
24505 | if (this.rowSpan === 1) {
|
24506 | return;
|
24507 | }
|
24508 | var singleRowHeight = this.beans.gridOptionsService.getRowHeightAsNumber();
|
24509 | var totalRowHeight = singleRowHeight * this.rowSpan;
|
24510 | this.eGui.style.height = totalRowHeight + "px";
|
24511 | this.eGui.style.zIndex = '1';
|
24512 | };
|
24513 |
|
24514 | CellPositionFeature.prototype.destroy = function () {
|
24515 | _super.prototype.destroy.call(this);
|
24516 | };
|
24517 | return CellPositionFeature;
|
24518 | }(BeanStub));
|
24519 |
|
24520 |
|
24521 |
|
24522 |
|
24523 |
|
24524 |
|
24525 |
|
24526 | var __extends$1U = (undefined && undefined.__extends) || (function () {
|
24527 | var extendStatics = function (d, b) {
|
24528 | extendStatics = Object.setPrototypeOf ||
|
24529 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
24530 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
24531 | return extendStatics(d, b);
|
24532 | };
|
24533 | return function (d, b) {
|
24534 | extendStatics(d, b);
|
24535 | function __() { this.constructor = d; }
|
24536 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
24537 | };
|
24538 | })();
|
24539 | var CellCustomStyleFeature = (function (_super) {
|
24540 | __extends$1U(CellCustomStyleFeature, _super);
|
24541 | function CellCustomStyleFeature(ctrl, beans) {
|
24542 | var _this = _super.call(this) || this;
|
24543 | _this.staticClasses = [];
|
24544 | _this.cellCtrl = ctrl;
|
24545 | _this.beans = beans;
|
24546 | _this.column = ctrl.getColumn();
|
24547 | _this.rowNode = ctrl.getRowNode();
|
24548 | return _this;
|
24549 | }
|
24550 | CellCustomStyleFeature.prototype.setComp = function (comp) {
|
24551 | this.cellComp = comp;
|
24552 | this.applyUserStyles();
|
24553 | this.applyCellClassRules();
|
24554 | this.applyClassesFromColDef();
|
24555 | };
|
24556 | CellCustomStyleFeature.prototype.applyCellClassRules = function () {
|
24557 | var _this = this;
|
24558 | var colDef = this.column.getColDef();
|
24559 | var cellClassParams = {
|
24560 | value: this.cellCtrl.getValue(),
|
24561 | data: this.rowNode.data,
|
24562 | node: this.rowNode,
|
24563 | colDef: colDef,
|
24564 | column: this.column,
|
24565 | rowIndex: this.rowNode.rowIndex,
|
24566 | api: this.beans.gridOptionsService.api,
|
24567 | columnApi: this.beans.gridOptionsService.columnApi,
|
24568 | context: this.beans.gridOptionsService.context
|
24569 | };
|
24570 | this.beans.stylingService.processClassRules(colDef.cellClassRules, cellClassParams, function (className) { return _this.cellComp.addOrRemoveCssClass(className, true); }, function (className) { return _this.cellComp.addOrRemoveCssClass(className, false); });
|
24571 | };
|
24572 | CellCustomStyleFeature.prototype.applyUserStyles = function () {
|
24573 | var colDef = this.column.getColDef();
|
24574 | if (!colDef.cellStyle) {
|
24575 | return;
|
24576 | }
|
24577 | var styles;
|
24578 | if (typeof colDef.cellStyle === 'function') {
|
24579 | var cellStyleParams = {
|
24580 | column: this.column,
|
24581 | value: this.cellCtrl.getValue(),
|
24582 | colDef: colDef,
|
24583 | data: this.rowNode.data,
|
24584 | node: this.rowNode,
|
24585 | rowIndex: this.rowNode.rowIndex,
|
24586 | api: this.beans.gridOptionsService.api,
|
24587 | columnApi: this.beans.gridOptionsService.columnApi,
|
24588 | context: this.beans.gridOptionsService.context,
|
24589 | };
|
24590 | var cellStyleFunc = colDef.cellStyle;
|
24591 | styles = cellStyleFunc(cellStyleParams);
|
24592 | }
|
24593 | else {
|
24594 | styles = colDef.cellStyle;
|
24595 | }
|
24596 | if (styles) {
|
24597 | this.cellComp.setUserStyles(styles);
|
24598 | }
|
24599 | };
|
24600 | CellCustomStyleFeature.prototype.applyClassesFromColDef = function () {
|
24601 | var _this = this;
|
24602 | var colDef = this.column.getColDef();
|
24603 | var cellClassParams = {
|
24604 | value: this.cellCtrl.getValue(),
|
24605 | data: this.rowNode.data,
|
24606 | node: this.rowNode,
|
24607 | column: this.column,
|
24608 | colDef: colDef,
|
24609 | rowIndex: this.rowNode.rowIndex,
|
24610 | api: this.beans.gridOptionsService.api,
|
24611 | columnApi: this.beans.gridOptionsService.columnApi,
|
24612 | context: this.beans.gridOptionsService.context
|
24613 | };
|
24614 | if (this.staticClasses.length) {
|
24615 | this.staticClasses.forEach(function (className) { return _this.cellComp.addOrRemoveCssClass(className, false); });
|
24616 | }
|
24617 | this.staticClasses = this.beans.stylingService.getStaticCellClasses(colDef, cellClassParams);
|
24618 | if (this.staticClasses.length) {
|
24619 | this.staticClasses.forEach(function (className) { return _this.cellComp.addOrRemoveCssClass(className, true); });
|
24620 | }
|
24621 | };
|
24622 |
|
24623 | CellCustomStyleFeature.prototype.destroy = function () {
|
24624 | _super.prototype.destroy.call(this);
|
24625 | };
|
24626 | return CellCustomStyleFeature;
|
24627 | }(BeanStub));
|
24628 |
|
24629 |
|
24630 |
|
24631 |
|
24632 |
|
24633 |
|
24634 |
|
24635 | var __extends$1T = (undefined && undefined.__extends) || (function () {
|
24636 | var extendStatics = function (d, b) {
|
24637 | extendStatics = Object.setPrototypeOf ||
|
24638 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
24639 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
24640 | return extendStatics(d, b);
|
24641 | };
|
24642 | return function (d, b) {
|
24643 | extendStatics(d, b);
|
24644 | function __() { this.constructor = d; }
|
24645 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
24646 | };
|
24647 | })();
|
24648 | var TooltipFeature = (function (_super) {
|
24649 | __extends$1T(TooltipFeature, _super);
|
24650 | function TooltipFeature(ctrl, beans) {
|
24651 | var _this = _super.call(this) || this;
|
24652 | _this.ctrl = ctrl;
|
24653 | _this.beans = beans;
|
24654 | return _this;
|
24655 | }
|
24656 | TooltipFeature.prototype.setComp = function (comp) {
|
24657 | this.comp = comp;
|
24658 | this.setupTooltip();
|
24659 | };
|
24660 | TooltipFeature.prototype.setupTooltip = function () {
|
24661 | this.browserTooltips = this.beans.gridOptionsService.is('enableBrowserTooltips');
|
24662 | this.updateTooltipText();
|
24663 | if (this.browserTooltips) {
|
24664 | this.comp.setTitle(this.tooltip != null ? this.tooltip : undefined);
|
24665 | }
|
24666 | else {
|
24667 | this.createTooltipFeatureIfNeeded();
|
24668 | }
|
24669 | };
|
24670 | TooltipFeature.prototype.updateTooltipText = function () {
|
24671 | this.tooltip = this.ctrl.getTooltipValue();
|
24672 | };
|
24673 | TooltipFeature.prototype.createTooltipFeatureIfNeeded = function () {
|
24674 | var _this = this;
|
24675 | if (this.genericTooltipFeature != null) {
|
24676 | return;
|
24677 | }
|
24678 | var parent = {
|
24679 | getTooltipParams: function () { return _this.getTooltipParams(); },
|
24680 | getGui: function () { return _this.ctrl.getGui(); }
|
24681 | };
|
24682 | this.genericTooltipFeature = this.createManagedBean(new CustomTooltipFeature(parent), this.beans.context);
|
24683 | };
|
24684 | TooltipFeature.prototype.refreshToolTip = function () {
|
24685 | this.updateTooltipText();
|
24686 | if (this.browserTooltips) {
|
24687 | this.comp.setTitle(this.tooltip != null ? this.tooltip : undefined);
|
24688 | }
|
24689 | };
|
24690 | TooltipFeature.prototype.getTooltipParams = function () {
|
24691 | var ctrl = this.ctrl;
|
24692 | var column = ctrl.getColumn ? ctrl.getColumn() : undefined;
|
24693 | var colDef = ctrl.getColDef ? ctrl.getColDef() : undefined;
|
24694 | var rowNode = ctrl.getRowNode ? ctrl.getRowNode() : undefined;
|
24695 | return {
|
24696 | location: ctrl.getLocation(),
|
24697 | colDef: colDef,
|
24698 | column: column,
|
24699 | rowIndex: ctrl.getRowIndex ? ctrl.getRowIndex() : undefined,
|
24700 | node: rowNode,
|
24701 | data: rowNode ? rowNode.data : undefined,
|
24702 | value: this.getTooltipText(),
|
24703 | valueFormatted: ctrl.getValueFormatted ? ctrl.getValueFormatted() : undefined,
|
24704 | };
|
24705 | };
|
24706 | TooltipFeature.prototype.getTooltipText = function () {
|
24707 | return this.tooltip;
|
24708 | };
|
24709 |
|
24710 | TooltipFeature.prototype.destroy = function () {
|
24711 | _super.prototype.destroy.call(this);
|
24712 | };
|
24713 | return TooltipFeature;
|
24714 | }(BeanStub));
|
24715 |
|
24716 |
|
24717 |
|
24718 |
|
24719 |
|
24720 |
|
24721 |
|
24722 | var __decorate$1M = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
24723 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
24724 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
24725 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
24726 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
24727 | };
|
24728 |
|
24729 |
|
24730 |
|
24731 |
|
24732 |
|
24733 | var Beans = (function () {
|
24734 | function Beans() {
|
24735 | }
|
24736 | Beans.prototype.postConstruct = function () {
|
24737 | this.doingMasterDetail = this.gridOptionsService.isMasterDetail();
|
24738 | if (this.gridOptionsService.isRowModelType('clientSide')) {
|
24739 | this.clientSideRowModel = this.rowModel;
|
24740 | }
|
24741 | if (this.gridOptionsService.isRowModelType('serverSide')) {
|
24742 | this.serverSideRowModel = this.rowModel;
|
24743 | }
|
24744 | };
|
24745 | __decorate$1M([
|
24746 | Autowired('resizeObserverService')
|
24747 | ], Beans.prototype, "resizeObserverService", void 0);
|
24748 | __decorate$1M([
|
24749 | Autowired('paginationProxy')
|
24750 | ], Beans.prototype, "paginationProxy", void 0);
|
24751 | __decorate$1M([
|
24752 | Autowired('context')
|
24753 | ], Beans.prototype, "context", void 0);
|
24754 | __decorate$1M([
|
24755 | Autowired('columnApi')
|
24756 | ], Beans.prototype, "columnApi", void 0);
|
24757 | __decorate$1M([
|
24758 | Autowired('gridApi')
|
24759 | ], Beans.prototype, "gridApi", void 0);
|
24760 | __decorate$1M([
|
24761 | Autowired('gridOptionsService')
|
24762 | ], Beans.prototype, "gridOptionsService", void 0);
|
24763 | __decorate$1M([
|
24764 | Autowired('expressionService')
|
24765 | ], Beans.prototype, "expressionService", void 0);
|
24766 | __decorate$1M([
|
24767 | Autowired('environment')
|
24768 | ], Beans.prototype, "environment", void 0);
|
24769 | __decorate$1M([
|
24770 | Autowired('rowRenderer')
|
24771 | ], Beans.prototype, "rowRenderer", void 0);
|
24772 | __decorate$1M([
|
24773 | Autowired('templateService')
|
24774 | ], Beans.prototype, "templateService", void 0);
|
24775 | __decorate$1M([
|
24776 | Autowired('valueService')
|
24777 | ], Beans.prototype, "valueService", void 0);
|
24778 | __decorate$1M([
|
24779 | Autowired('eventService')
|
24780 | ], Beans.prototype, "eventService", void 0);
|
24781 | __decorate$1M([
|
24782 | Autowired('columnModel')
|
24783 | ], Beans.prototype, "columnModel", void 0);
|
24784 | __decorate$1M([
|
24785 | Autowired('headerNavigationService')
|
24786 | ], Beans.prototype, "headerNavigationService", void 0);
|
24787 | __decorate$1M([
|
24788 | Autowired('navigationService')
|
24789 | ], Beans.prototype, "navigationService", void 0);
|
24790 | __decorate$1M([
|
24791 | Autowired('columnAnimationService')
|
24792 | ], Beans.prototype, "columnAnimationService", void 0);
|
24793 | __decorate$1M([
|
24794 | Optional('rangeService')
|
24795 | ], Beans.prototype, "rangeService", void 0);
|
24796 | __decorate$1M([
|
24797 | Autowired('focusService')
|
24798 | ], Beans.prototype, "focusService", void 0);
|
24799 | __decorate$1M([
|
24800 | Optional('contextMenuFactory')
|
24801 | ], Beans.prototype, "contextMenuFactory", void 0);
|
24802 | __decorate$1M([
|
24803 | Autowired('popupService')
|
24804 | ], Beans.prototype, "popupService", void 0);
|
24805 | __decorate$1M([
|
24806 | Autowired('valueFormatterService')
|
24807 | ], Beans.prototype, "valueFormatterService", void 0);
|
24808 | __decorate$1M([
|
24809 | Autowired('stylingService')
|
24810 | ], Beans.prototype, "stylingService", void 0);
|
24811 | __decorate$1M([
|
24812 | Autowired('columnHoverService')
|
24813 | ], Beans.prototype, "columnHoverService", void 0);
|
24814 | __decorate$1M([
|
24815 | Autowired('userComponentFactory')
|
24816 | ], Beans.prototype, "userComponentFactory", void 0);
|
24817 | __decorate$1M([
|
24818 | Autowired('userComponentRegistry')
|
24819 | ], Beans.prototype, "userComponentRegistry", void 0);
|
24820 | __decorate$1M([
|
24821 | Autowired('animationFrameService')
|
24822 | ], Beans.prototype, "animationFrameService", void 0);
|
24823 | __decorate$1M([
|
24824 | Autowired('dragService')
|
24825 | ], Beans.prototype, "dragService", void 0);
|
24826 | __decorate$1M([
|
24827 | Autowired('dragAndDropService')
|
24828 | ], Beans.prototype, "dragAndDropService", void 0);
|
24829 | __decorate$1M([
|
24830 | Autowired('sortController')
|
24831 | ], Beans.prototype, "sortController", void 0);
|
24832 | __decorate$1M([
|
24833 | Autowired('filterManager')
|
24834 | ], Beans.prototype, "filterManager", void 0);
|
24835 | __decorate$1M([
|
24836 | Autowired('rowContainerHeightService')
|
24837 | ], Beans.prototype, "rowContainerHeightService", void 0);
|
24838 | __decorate$1M([
|
24839 | Autowired('frameworkOverrides')
|
24840 | ], Beans.prototype, "frameworkOverrides", void 0);
|
24841 | __decorate$1M([
|
24842 | Autowired('cellPositionUtils')
|
24843 | ], Beans.prototype, "cellPositionUtils", void 0);
|
24844 | __decorate$1M([
|
24845 | Autowired('rowPositionUtils')
|
24846 | ], Beans.prototype, "rowPositionUtils", void 0);
|
24847 | __decorate$1M([
|
24848 | Autowired('selectionService')
|
24849 | ], Beans.prototype, "selectionService", void 0);
|
24850 | __decorate$1M([
|
24851 | Optional('selectionHandleFactory')
|
24852 | ], Beans.prototype, "selectionHandleFactory", void 0);
|
24853 | __decorate$1M([
|
24854 | Autowired('rowCssClassCalculator')
|
24855 | ], Beans.prototype, "rowCssClassCalculator", void 0);
|
24856 | __decorate$1M([
|
24857 | Autowired('rowModel')
|
24858 | ], Beans.prototype, "rowModel", void 0);
|
24859 | __decorate$1M([
|
24860 | Autowired('ctrlsService')
|
24861 | ], Beans.prototype, "ctrlsService", void 0);
|
24862 | __decorate$1M([
|
24863 | Autowired('ctrlsFactory')
|
24864 | ], Beans.prototype, "ctrlsFactory", void 0);
|
24865 | __decorate$1M([
|
24866 | Autowired('agStackComponentsRegistry')
|
24867 | ], Beans.prototype, "agStackComponentsRegistry", void 0);
|
24868 | __decorate$1M([
|
24869 | Autowired('valueCache')
|
24870 | ], Beans.prototype, "valueCache", void 0);
|
24871 | __decorate$1M([
|
24872 | Autowired('rowNodeEventThrottle')
|
24873 | ], Beans.prototype, "rowNodeEventThrottle", void 0);
|
24874 | __decorate$1M([
|
24875 | Autowired('localeService')
|
24876 | ], Beans.prototype, "localeService", void 0);
|
24877 | __decorate$1M([
|
24878 | PostConstruct
|
24879 | ], Beans.prototype, "postConstruct", null);
|
24880 | Beans = __decorate$1M([
|
24881 | Bean('beans')
|
24882 | ], Beans);
|
24883 | return Beans;
|
24884 | }());
|
24885 |
|
24886 |
|
24887 |
|
24888 |
|
24889 |
|
24890 |
|
24891 |
|
24892 | var __extends$1S = (undefined && undefined.__extends) || (function () {
|
24893 | var extendStatics = function (d, b) {
|
24894 | extendStatics = Object.setPrototypeOf ||
|
24895 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
24896 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
24897 | return extendStatics(d, b);
|
24898 | };
|
24899 | return function (d, b) {
|
24900 | extendStatics(d, b);
|
24901 | function __() { this.constructor = d; }
|
24902 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
24903 | };
|
24904 | })();
|
24905 | var CellMouseListenerFeature = (function (_super) {
|
24906 | __extends$1S(CellMouseListenerFeature, _super);
|
24907 | function CellMouseListenerFeature(ctrl, beans, column) {
|
24908 | var _this = _super.call(this) || this;
|
24909 | _this.cellCtrl = ctrl;
|
24910 | _this.beans = beans;
|
24911 | _this.column = column;
|
24912 | return _this;
|
24913 | }
|
24914 | CellMouseListenerFeature.prototype.onMouseEvent = function (eventName, mouseEvent) {
|
24915 | if (isStopPropagationForAgGrid(mouseEvent)) {
|
24916 | return;
|
24917 | }
|
24918 | switch (eventName) {
|
24919 | case 'click':
|
24920 | this.onCellClicked(mouseEvent);
|
24921 | break;
|
24922 | case 'mousedown':
|
24923 | case 'touchstart':
|
24924 | this.onMouseDown(mouseEvent);
|
24925 | break;
|
24926 | case 'dblclick':
|
24927 | this.onCellDoubleClicked(mouseEvent);
|
24928 | break;
|
24929 | case 'mouseout':
|
24930 | this.onMouseOut(mouseEvent);
|
24931 | break;
|
24932 | case 'mouseover':
|
24933 | this.onMouseOver(mouseEvent);
|
24934 | break;
|
24935 | }
|
24936 | };
|
24937 | CellMouseListenerFeature.prototype.onCellClicked = function (mouseEvent) {
|
24938 |
|
24939 | if (this.isDoubleClickOnIPad()) {
|
24940 | this.onCellDoubleClicked(mouseEvent);
|
24941 | mouseEvent.preventDefault();
|
24942 | return;
|
24943 | }
|
24944 | var _a = this.beans, eventService = _a.eventService, rangeService = _a.rangeService, gridOptionsService = _a.gridOptionsService;
|
24945 | var multiKeyPressed = mouseEvent.ctrlKey || mouseEvent.metaKey;
|
24946 | if (rangeService && multiKeyPressed) {
|
24947 |
|
24948 |
|
24949 | if (rangeService.getCellRangeCount(this.cellCtrl.getCellPosition()) > 1) {
|
24950 | rangeService.intersectLastRange(true);
|
24951 | }
|
24952 | }
|
24953 | var cellClickedEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_CLICKED);
|
24954 | eventService.dispatchEvent(cellClickedEvent);
|
24955 | var colDef = this.column.getColDef();
|
24956 | if (colDef.onCellClicked) {
|
24957 |
|
24958 | window.setTimeout(function () { return colDef.onCellClicked(cellClickedEvent); }, 0);
|
24959 | }
|
24960 | var editOnSingleClick = (gridOptionsService.is('singleClickEdit') || colDef.singleClickEdit)
|
24961 | && !gridOptionsService.is('suppressClickEdit');
|
24962 | if (editOnSingleClick) {
|
24963 | this.cellCtrl.startRowOrCellEdit();
|
24964 | }
|
24965 | };
|
24966 |
|
24967 | CellMouseListenerFeature.prototype.isDoubleClickOnIPad = function () {
|
24968 | if (!isIOSUserAgent() || isEventSupported('dblclick')) {
|
24969 | return false;
|
24970 | }
|
24971 | var nowMillis = new Date().getTime();
|
24972 | var res = nowMillis - this.lastIPadMouseClickEvent < 200;
|
24973 | this.lastIPadMouseClickEvent = nowMillis;
|
24974 | return res;
|
24975 | };
|
24976 | CellMouseListenerFeature.prototype.onCellDoubleClicked = function (mouseEvent) {
|
24977 | var colDef = this.column.getColDef();
|
24978 |
|
24979 | var cellDoubleClickedEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_DOUBLE_CLICKED);
|
24980 | this.beans.eventService.dispatchEvent(cellDoubleClickedEvent);
|
24981 |
|
24982 | if (typeof colDef.onCellDoubleClicked === 'function') {
|
24983 |
|
24984 | window.setTimeout(function () { return colDef.onCellDoubleClicked(cellDoubleClickedEvent); }, 0);
|
24985 | }
|
24986 | var editOnDoubleClick = !this.beans.gridOptionsService.is('singleClickEdit')
|
24987 | && !this.beans.gridOptionsService.is('suppressClickEdit');
|
24988 | if (editOnDoubleClick) {
|
24989 | this.cellCtrl.startRowOrCellEdit(null, null, mouseEvent);
|
24990 | }
|
24991 | };
|
24992 | CellMouseListenerFeature.prototype.onMouseDown = function (mouseEvent) {
|
24993 | var ctrlKey = mouseEvent.ctrlKey, metaKey = mouseEvent.metaKey, shiftKey = mouseEvent.shiftKey;
|
24994 | var target = mouseEvent.target;
|
24995 | var _a = this.beans, eventService = _a.eventService, rangeService = _a.rangeService;
|
24996 |
|
24997 | if (this.isRightClickInExistingRange(mouseEvent)) {
|
24998 | return;
|
24999 | }
|
25000 | var ranges = rangeService && rangeService.getCellRanges().length != 0;
|
25001 | if (!shiftKey || !ranges) {
|
25002 |
|
25003 |
|
25004 |
|
25005 | var forceBrowserFocus = (isBrowserSafari()) && !this.cellCtrl.isEditing() && !isFocusableFormField(target);
|
25006 | this.cellCtrl.focusCell(forceBrowserFocus);
|
25007 | }
|
25008 |
|
25009 |
|
25010 | if (shiftKey && ranges) {
|
25011 |
|
25012 | mouseEvent.preventDefault();
|
25013 | }
|
25014 |
|
25015 |
|
25016 | if (this.containsWidget(target)) {
|
25017 | return;
|
25018 | }
|
25019 | if (rangeService) {
|
25020 | var thisCell = this.cellCtrl.getCellPosition();
|
25021 | if (shiftKey) {
|
25022 | rangeService.extendLatestRangeToCell(thisCell);
|
25023 | }
|
25024 | else {
|
25025 | var ctrlKeyPressed = ctrlKey || metaKey;
|
25026 | rangeService.setRangeToCell(thisCell, ctrlKeyPressed);
|
25027 | }
|
25028 | }
|
25029 | eventService.dispatchEvent(this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_DOWN));
|
25030 | };
|
25031 | CellMouseListenerFeature.prototype.isRightClickInExistingRange = function (mouseEvent) {
|
25032 | var rangeService = this.beans.rangeService;
|
25033 | if (rangeService) {
|
25034 | var cellInRange = rangeService.isCellInAnyRange(this.cellCtrl.getCellPosition());
|
25035 | if (cellInRange && mouseEvent.button === 2) {
|
25036 | return true;
|
25037 | }
|
25038 | }
|
25039 | return false;
|
25040 | };
|
25041 | CellMouseListenerFeature.prototype.containsWidget = function (target) {
|
25042 | return isElementChildOfClass(target, 'ag-selection-checkbox', 3);
|
25043 | };
|
25044 | CellMouseListenerFeature.prototype.onMouseOut = function (mouseEvent) {
|
25045 | if (this.mouseStayingInsideCell(mouseEvent)) {
|
25046 | return;
|
25047 | }
|
25048 | var cellMouseOutEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_OUT);
|
25049 | this.beans.eventService.dispatchEvent(cellMouseOutEvent);
|
25050 | this.beans.columnHoverService.clearMouseOver();
|
25051 | };
|
25052 | CellMouseListenerFeature.prototype.onMouseOver = function (mouseEvent) {
|
25053 | if (this.mouseStayingInsideCell(mouseEvent)) {
|
25054 | return;
|
25055 | }
|
25056 | var cellMouseOverEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_OVER);
|
25057 | this.beans.eventService.dispatchEvent(cellMouseOverEvent);
|
25058 | this.beans.columnHoverService.setMouseOver([this.column]);
|
25059 | };
|
25060 | CellMouseListenerFeature.prototype.mouseStayingInsideCell = function (e) {
|
25061 | if (!e.target || !e.relatedTarget) {
|
25062 | return false;
|
25063 | }
|
25064 | var eGui = this.cellCtrl.getGui();
|
25065 | var cellContainsTarget = eGui.contains(e.target);
|
25066 | var cellContainsRelatedTarget = eGui.contains(e.relatedTarget);
|
25067 | return cellContainsTarget && cellContainsRelatedTarget;
|
25068 | };
|
25069 | CellMouseListenerFeature.prototype.destroy = function () {
|
25070 | };
|
25071 | return CellMouseListenerFeature;
|
25072 | }(Beans));
|
25073 |
|
25074 |
|
25075 |
|
25076 |
|
25077 |
|
25078 |
|
25079 |
|
25080 | var __extends$1R = (undefined && undefined.__extends) || (function () {
|
25081 | var extendStatics = function (d, b) {
|
25082 | extendStatics = Object.setPrototypeOf ||
|
25083 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
25084 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
25085 | return extendStatics(d, b);
|
25086 | };
|
25087 | return function (d, b) {
|
25088 | extendStatics(d, b);
|
25089 | function __() { this.constructor = d; }
|
25090 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
25091 | };
|
25092 | })();
|
25093 | var CellKeyboardListenerFeature = (function (_super) {
|
25094 | __extends$1R(CellKeyboardListenerFeature, _super);
|
25095 | function CellKeyboardListenerFeature(ctrl, beans, column, rowNode, rowCtrl) {
|
25096 | var _this = _super.call(this) || this;
|
25097 | _this.cellCtrl = ctrl;
|
25098 | _this.beans = beans;
|
25099 | _this.rowNode = rowNode;
|
25100 | _this.rowCtrl = rowCtrl;
|
25101 | return _this;
|
25102 | }
|
25103 | CellKeyboardListenerFeature.prototype.setComp = function (eGui) {
|
25104 | this.eGui = eGui;
|
25105 | };
|
25106 | CellKeyboardListenerFeature.prototype.onKeyDown = function (event) {
|
25107 | var key = event.key;
|
25108 | switch (key) {
|
25109 | case KeyCode.ENTER:
|
25110 | this.onEnterKeyDown(event);
|
25111 | break;
|
25112 | case KeyCode.F2:
|
25113 | this.onF2KeyDown(event);
|
25114 | break;
|
25115 | case KeyCode.ESCAPE:
|
25116 | this.onEscapeKeyDown(event);
|
25117 | break;
|
25118 | case KeyCode.TAB:
|
25119 | this.onTabKeyDown(event);
|
25120 | break;
|
25121 | case KeyCode.BACKSPACE:
|
25122 | case KeyCode.DELETE:
|
25123 | this.onBackspaceOrDeleteKeyPressed(key, event);
|
25124 | break;
|
25125 | case KeyCode.DOWN:
|
25126 | case KeyCode.UP:
|
25127 | case KeyCode.RIGHT:
|
25128 | case KeyCode.LEFT:
|
25129 | this.onNavigationKeyPressed(event, key);
|
25130 | break;
|
25131 | }
|
25132 | };
|
25133 | CellKeyboardListenerFeature.prototype.onNavigationKeyPressed = function (event, key) {
|
25134 | if (this.cellCtrl.isEditing()) {
|
25135 | return;
|
25136 | }
|
25137 | if (event.shiftKey && this.cellCtrl.isRangeSelectionEnabled()) {
|
25138 | this.onShiftRangeSelect(event);
|
25139 | }
|
25140 | else {
|
25141 | this.beans.navigationService.navigateToNextCell(event, key, this.cellCtrl.getCellPosition(), true);
|
25142 | }
|
25143 |
|
25144 | event.preventDefault();
|
25145 | };
|
25146 | CellKeyboardListenerFeature.prototype.onShiftRangeSelect = function (event) {
|
25147 | if (!this.beans.rangeService) {
|
25148 | return;
|
25149 | }
|
25150 | var endCell = this.beans.rangeService.extendLatestRangeInDirection(event);
|
25151 | if (endCell) {
|
25152 | this.beans.navigationService.ensureCellVisible(endCell);
|
25153 | }
|
25154 | };
|
25155 | CellKeyboardListenerFeature.prototype.onTabKeyDown = function (event) {
|
25156 | this.beans.navigationService.onTabKeyDown(this.cellCtrl, event);
|
25157 | };
|
25158 | CellKeyboardListenerFeature.prototype.onBackspaceOrDeleteKeyPressed = function (key, event) {
|
25159 | var _a = this, cellCtrl = _a.cellCtrl, beans = _a.beans, rowNode = _a.rowNode;
|
25160 | var gridOptionsService = beans.gridOptionsService, rangeService = beans.rangeService, eventService = beans.eventService;
|
25161 | if (cellCtrl.isEditing()) {
|
25162 | return;
|
25163 | }
|
25164 | eventService.dispatchEvent({ type: Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_START });
|
25165 | if (isDeleteKey(key, gridOptionsService.is('enableCellEditingOnBackspace'))) {
|
25166 | if (rangeService && gridOptionsService.isEnableRangeSelection()) {
|
25167 | rangeService.clearCellRangeCellValues();
|
25168 | }
|
25169 | else if (cellCtrl.isCellEditable()) {
|
25170 | rowNode.setDataValue(cellCtrl.getColumn(), null, 'cellClear');
|
25171 | }
|
25172 | }
|
25173 | else {
|
25174 | cellCtrl.startRowOrCellEdit(key, undefined, event);
|
25175 | }
|
25176 | eventService.dispatchEvent({ type: Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_END });
|
25177 | };
|
25178 | CellKeyboardListenerFeature.prototype.onEnterKeyDown = function (e) {
|
25179 | if (this.cellCtrl.isEditing() || this.rowCtrl.isEditing()) {
|
25180 | this.cellCtrl.stopEditingAndFocus();
|
25181 | }
|
25182 | else {
|
25183 | if (this.beans.gridOptionsService.is('enterMovesDown')) {
|
25184 | this.beans.navigationService.navigateToNextCell(null, KeyCode.DOWN, this.cellCtrl.getCellPosition(), false);
|
25185 | }
|
25186 | else {
|
25187 | this.cellCtrl.startRowOrCellEdit(KeyCode.ENTER, undefined, e);
|
25188 | if (this.cellCtrl.isEditing()) {
|
25189 |
|
25190 |
|
25191 |
|
25192 |
|
25193 | e.preventDefault();
|
25194 | }
|
25195 | }
|
25196 | }
|
25197 | };
|
25198 | CellKeyboardListenerFeature.prototype.onF2KeyDown = function (event) {
|
25199 | if (!this.cellCtrl.isEditing()) {
|
25200 | this.cellCtrl.startRowOrCellEdit(KeyCode.F2, undefined, event);
|
25201 | }
|
25202 | };
|
25203 | CellKeyboardListenerFeature.prototype.onEscapeKeyDown = function (event) {
|
25204 | if (this.cellCtrl.isEditing()) {
|
25205 | this.cellCtrl.stopRowOrCellEdit(true);
|
25206 | this.cellCtrl.focusCell(true);
|
25207 | }
|
25208 | };
|
25209 | CellKeyboardListenerFeature.prototype.onKeyPress = function (event) {
|
25210 |
|
25211 |
|
25212 | var eventTarget = event.target;
|
25213 | var eventOnChildComponent = eventTarget !== this.eGui;
|
25214 | if (eventOnChildComponent || this.cellCtrl.isEditing()) {
|
25215 | return;
|
25216 | }
|
25217 | var pressedChar = String.fromCharCode(event.charCode);
|
25218 | if (pressedChar === ' ') {
|
25219 | this.onSpaceKeyPressed(event);
|
25220 | }
|
25221 | else if (isEventFromPrintableCharacter(event)) {
|
25222 | this.cellCtrl.startRowOrCellEdit(null, pressedChar, event);
|
25223 |
|
25224 |
|
25225 |
|
25226 |
|
25227 |
|
25228 | event.preventDefault();
|
25229 | }
|
25230 | };
|
25231 | CellKeyboardListenerFeature.prototype.onSpaceKeyPressed = function (event) {
|
25232 | var gridOptionsService = this.beans.gridOptionsService;
|
25233 | if (!this.cellCtrl.isEditing() && gridOptionsService.isRowSelection()) {
|
25234 | var currentSelection = this.rowNode.isSelected();
|
25235 | var newSelection = !currentSelection;
|
25236 | if (newSelection || !gridOptionsService.is('suppressRowDeselection')) {
|
25237 | var groupSelectsFiltered = this.beans.gridOptionsService.is('groupSelectsFiltered');
|
25238 | var updatedCount = this.rowNode.setSelectedParams({
|
25239 | newValue: newSelection,
|
25240 | rangeSelect: event.shiftKey,
|
25241 | groupSelectsFiltered: groupSelectsFiltered,
|
25242 | event: event,
|
25243 | source: 'spacePressed'
|
25244 | });
|
25245 | if (currentSelection === undefined && updatedCount === 0) {
|
25246 | this.rowNode.setSelectedParams({
|
25247 | newValue: false,
|
25248 | rangeSelect: event.shiftKey,
|
25249 | groupSelectsFiltered: groupSelectsFiltered,
|
25250 | event: event,
|
25251 | source: 'spacePressed'
|
25252 | });
|
25253 | }
|
25254 | }
|
25255 | }
|
25256 |
|
25257 | event.preventDefault();
|
25258 | };
|
25259 | CellKeyboardListenerFeature.prototype.destroy = function () {
|
25260 | _super.prototype.destroy.call(this);
|
25261 | };
|
25262 | return CellKeyboardListenerFeature;
|
25263 | }(BeanStub));
|
25264 |
|
25265 |
|
25266 |
|
25267 |
|
25268 |
|
25269 |
|
25270 |
|
25271 | var __extends$1Q = (undefined && undefined.__extends) || (function () {
|
25272 | var extendStatics = function (d, b) {
|
25273 | extendStatics = Object.setPrototypeOf ||
|
25274 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
25275 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
25276 | return extendStatics(d, b);
|
25277 | };
|
25278 | return function (d, b) {
|
25279 | extendStatics(d, b);
|
25280 | function __() { this.constructor = d; }
|
25281 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
25282 | };
|
25283 | })();
|
25284 | var __decorate$1L = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
25285 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
25286 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
25287 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
25288 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
25289 | };
|
25290 | var DndSourceComp = (function (_super) {
|
25291 | __extends$1Q(DndSourceComp, _super);
|
25292 | function DndSourceComp(rowNode, column, beans, eCell) {
|
25293 | var _this = _super.call(this, "<div class=\"ag-drag-handle ag-row-drag\" draggable=\"true\"></div>") || this;
|
25294 | _this.rowNode = rowNode;
|
25295 | _this.column = column;
|
25296 | _this.beans = beans;
|
25297 | _this.eCell = eCell;
|
25298 | return _this;
|
25299 | }
|
25300 | DndSourceComp.prototype.postConstruct = function () {
|
25301 | var eGui = this.getGui();
|
25302 | eGui.appendChild(createIconNoSpan('rowDrag', this.beans.gridOptionsService, null));
|
25303 |
|
25304 | this.addGuiEventListener('mousedown', function (e) {
|
25305 | e.stopPropagation();
|
25306 | });
|
25307 | this.addDragSource();
|
25308 | this.checkVisibility();
|
25309 | };
|
25310 | DndSourceComp.prototype.addDragSource = function () {
|
25311 | this.addGuiEventListener('dragstart', this.onDragStart.bind(this));
|
25312 | };
|
25313 | DndSourceComp.prototype.onDragStart = function (dragEvent) {
|
25314 | var _this = this;
|
25315 | var providedOnRowDrag = this.column.getColDef().dndSourceOnRowDrag;
|
25316 | dragEvent.dataTransfer.setDragImage(this.eCell, 0, 0);
|
25317 |
|
25318 | var defaultOnRowDrag = function () {
|
25319 | try {
|
25320 | var jsonData = JSON.stringify(_this.rowNode.data);
|
25321 | dragEvent.dataTransfer.setData('application/json', jsonData);
|
25322 | dragEvent.dataTransfer.setData('text/plain', jsonData);
|
25323 | }
|
25324 | catch (e) {
|
25325 |
|
25326 | }
|
25327 | };
|
25328 | if (providedOnRowDrag) {
|
25329 | var params = {
|
25330 | rowNode: this.rowNode, dragEvent: dragEvent,
|
25331 | api: this.gridOptionsService.api,
|
25332 | columnApi: this.gridOptionsService.columnApi,
|
25333 | context: this.gridOptionsService.context
|
25334 | };
|
25335 | providedOnRowDrag(params);
|
25336 | }
|
25337 | else {
|
25338 | defaultOnRowDrag();
|
25339 | }
|
25340 | };
|
25341 | DndSourceComp.prototype.checkVisibility = function () {
|
25342 | var visible = this.column.isDndSource(this.rowNode);
|
25343 | this.setDisplayed(visible);
|
25344 | };
|
25345 | __decorate$1L([
|
25346 | PostConstruct
|
25347 | ], DndSourceComp.prototype, "postConstruct", null);
|
25348 | return DndSourceComp;
|
25349 | }(Component));
|
25350 |
|
25351 |
|
25352 |
|
25353 |
|
25354 |
|
25355 |
|
25356 |
|
25357 | var __extends$1P = (undefined && undefined.__extends) || (function () {
|
25358 | var extendStatics = function (d, b) {
|
25359 | extendStatics = Object.setPrototypeOf ||
|
25360 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
25361 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
25362 | return extendStatics(d, b);
|
25363 | };
|
25364 | return function (d, b) {
|
25365 | extendStatics(d, b);
|
25366 | function __() { this.constructor = d; }
|
25367 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
25368 | };
|
25369 | })();
|
25370 | var __assign$8 = (undefined && undefined.__assign) || function () {
|
25371 | __assign$8 = Object.assign || function(t) {
|
25372 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
25373 | s = arguments[i];
|
25374 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
25375 | t[p] = s[p];
|
25376 | }
|
25377 | return t;
|
25378 | };
|
25379 | return __assign$8.apply(this, arguments);
|
25380 | };
|
25381 | var CSS_CELL = 'ag-cell';
|
25382 | var CSS_AUTO_HEIGHT = 'ag-cell-auto-height';
|
25383 | var CSS_NORMAL_HEIGHT = 'ag-cell-normal-height';
|
25384 | var CSS_CELL_FOCUS = 'ag-cell-focus';
|
25385 | var CSS_CELL_FIRST_RIGHT_PINNED = 'ag-cell-first-right-pinned';
|
25386 | var CSS_CELL_LAST_LEFT_PINNED = 'ag-cell-last-left-pinned';
|
25387 | var CSS_CELL_NOT_INLINE_EDITING = 'ag-cell-not-inline-editing';
|
25388 | var CSS_COLUMN_HOVER = 'ag-column-hover';
|
25389 | var CSS_CELL_WRAP_TEXT = 'ag-cell-wrap-text';
|
25390 | var instanceIdSequence$3 = 0;
|
25391 | var CellCtrl = (function (_super) {
|
25392 | __extends$1P(CellCtrl, _super);
|
25393 | function CellCtrl(column, rowNode, beans, rowCtrl) {
|
25394 | var _this = _super.call(this) || this;
|
25395 | _this.cellRangeFeature = null;
|
25396 | _this.cellPositionFeature = null;
|
25397 | _this.cellCustomStyleFeature = null;
|
25398 | _this.tooltipFeature = null;
|
25399 | _this.cellMouseListenerFeature = null;
|
25400 | _this.cellKeyboardListenerFeature = null;
|
25401 | _this.suppressRefreshCell = false;
|
25402 | _this.onCellCompAttachedFuncs = [];
|
25403 | _this.column = column;
|
25404 | _this.rowNode = rowNode;
|
25405 | _this.beans = beans;
|
25406 | _this.rowCtrl = rowCtrl;
|
25407 |
|
25408 | _this.instanceId = column.getId() + '-' + instanceIdSequence$3++;
|
25409 | _this.createCellPosition();
|
25410 | _this.addFeatures();
|
25411 | return _this;
|
25412 | }
|
25413 | CellCtrl.prototype.addFeatures = function () {
|
25414 | var _this = this;
|
25415 | this.cellPositionFeature = new CellPositionFeature(this, this.beans);
|
25416 | this.addDestroyFunc(function () { var _a; (_a = _this.cellPositionFeature) === null || _a === void 0 ? void 0 : _a.destroy(); _this.cellPositionFeature = null; });
|
25417 | this.cellCustomStyleFeature = new CellCustomStyleFeature(this, this.beans);
|
25418 | this.addDestroyFunc(function () { var _a; (_a = _this.cellCustomStyleFeature) === null || _a === void 0 ? void 0 : _a.destroy(); _this.cellCustomStyleFeature = null; });
|
25419 | this.cellMouseListenerFeature = new CellMouseListenerFeature(this, this.beans, this.column);
|
25420 | this.addDestroyFunc(function () { var _a; (_a = _this.cellMouseListenerFeature) === null || _a === void 0 ? void 0 : _a.destroy(); _this.cellMouseListenerFeature = null; });
|
25421 | this.cellKeyboardListenerFeature = new CellKeyboardListenerFeature(this, this.beans, this.column, this.rowNode, this.rowCtrl);
|
25422 | this.addDestroyFunc(function () { var _a; (_a = _this.cellKeyboardListenerFeature) === null || _a === void 0 ? void 0 : _a.destroy(); _this.cellKeyboardListenerFeature = null; });
|
25423 | var rangeSelectionEnabled = this.beans.rangeService && this.beans.gridOptionsService.isEnableRangeSelection();
|
25424 | if (rangeSelectionEnabled) {
|
25425 | this.cellRangeFeature = new CellRangeFeature(this.beans, this);
|
25426 | this.addDestroyFunc(function () { var _a; (_a = _this.cellRangeFeature) === null || _a === void 0 ? void 0 : _a.destroy(); _this.cellRangeFeature = null; });
|
25427 | }
|
25428 | this.addTooltipFeature();
|
25429 | };
|
25430 | CellCtrl.prototype.addTooltipFeature = function () {
|
25431 | var _this = this;
|
25432 | var getTooltipValue = function () {
|
25433 | var colDef = _this.column.getColDef();
|
25434 | var data = _this.rowNode.data;
|
25435 | if (colDef.tooltipField && exists(data)) {
|
25436 | return getValueUsingField(data, colDef.tooltipField, _this.column.isTooltipFieldContainsDots());
|
25437 | }
|
25438 | var valueGetter = colDef.tooltipValueGetter;
|
25439 | if (valueGetter) {
|
25440 | return valueGetter({
|
25441 | location: 'cell',
|
25442 | api: _this.beans.gridOptionsService.api,
|
25443 | columnApi: _this.beans.gridOptionsService.columnApi,
|
25444 | context: _this.beans.gridOptionsService.context,
|
25445 | colDef: _this.column.getColDef(),
|
25446 | column: _this.column,
|
25447 | rowIndex: _this.cellPosition.rowIndex,
|
25448 | node: _this.rowNode,
|
25449 | data: _this.rowNode.data,
|
25450 | value: _this.value,
|
25451 | valueFormatted: _this.valueFormatted,
|
25452 | });
|
25453 | }
|
25454 | return null;
|
25455 | };
|
25456 | var tooltipCtrl = {
|
25457 | getColumn: function () { return _this.column; },
|
25458 | getColDef: function () { return _this.column.getColDef(); },
|
25459 | getRowIndex: function () { return _this.cellPosition.rowIndex; },
|
25460 | getRowNode: function () { return _this.rowNode; },
|
25461 | getGui: function () { return _this.getGui(); },
|
25462 | getLocation: function () { return 'cell'; },
|
25463 | getTooltipValue: getTooltipValue,
|
25464 |
|
25465 | getValueFormatted: function () { return _this.valueFormatted; }
|
25466 | };
|
25467 | this.tooltipFeature = new TooltipFeature(tooltipCtrl, this.beans);
|
25468 | this.addDestroyFunc(function () { var _a; (_a = _this.tooltipFeature) === null || _a === void 0 ? void 0 : _a.destroy(); _this.tooltipFeature = null; });
|
25469 | };
|
25470 | CellCtrl.prototype.setComp = function (comp, eGui, eCellWrapper, printLayout, startEditing) {
|
25471 | var _a, _b, _c, _d;
|
25472 | this.cellComp = comp;
|
25473 | this.eGui = eGui;
|
25474 | this.printLayout = printLayout;
|
25475 |
|
25476 |
|
25477 | this.updateAndFormatValue(true);
|
25478 | this.addDomData();
|
25479 | this.onCellFocused();
|
25480 | this.applyStaticCssClasses();
|
25481 | this.setWrapText();
|
25482 | this.onFirstRightPinnedChanged();
|
25483 | this.onLastLeftPinnedChanged();
|
25484 | this.onColumnHover();
|
25485 | this.setupControlComps();
|
25486 | if (eCellWrapper) {
|
25487 | this.setupAutoHeight(eCellWrapper);
|
25488 | }
|
25489 | this.setAriaColIndex();
|
25490 | if (!this.beans.gridOptionsService.is('suppressCellFocus')) {
|
25491 | this.cellComp.setTabIndex(-1);
|
25492 | }
|
25493 | var colIdSanitised = escapeString(this.column.getId());
|
25494 | this.cellComp.setColId(colIdSanitised);
|
25495 | this.cellComp.setRole('gridcell');
|
25496 | (_a = this.cellPositionFeature) === null || _a === void 0 ? void 0 : _a.setComp(eGui);
|
25497 | (_b = this.cellCustomStyleFeature) === null || _b === void 0 ? void 0 : _b.setComp(comp);
|
25498 | (_c = this.tooltipFeature) === null || _c === void 0 ? void 0 : _c.setComp(comp);
|
25499 | (_d = this.cellKeyboardListenerFeature) === null || _d === void 0 ? void 0 : _d.setComp(this.eGui);
|
25500 | if (this.cellRangeFeature) {
|
25501 | this.cellRangeFeature.setComp(comp, eGui);
|
25502 | }
|
25503 | if (startEditing && this.isCellEditable()) {
|
25504 | this.startEditing();
|
25505 | }
|
25506 | else {
|
25507 | this.showValue();
|
25508 | }
|
25509 | if (this.onCellCompAttachedFuncs.length) {
|
25510 | this.onCellCompAttachedFuncs.forEach(function (func) { return func(); });
|
25511 | this.onCellCompAttachedFuncs = [];
|
25512 | }
|
25513 | };
|
25514 | CellCtrl.prototype.setupAutoHeight = function (eCellWrapper) {
|
25515 | var _this = this;
|
25516 | if (!this.column.isAutoHeight()) {
|
25517 | return;
|
25518 | }
|
25519 | var eParentCell = eCellWrapper.parentElement;
|
25520 |
|
25521 |
|
25522 | var minRowHeight = this.beans.gridOptionsService.getRowHeightForNode(this.rowNode).height;
|
25523 | var measureHeight = function (timesCalled) {
|
25524 | if (_this.editing) {
|
25525 | return;
|
25526 | }
|
25527 |
|
25528 |
|
25529 | if (!_this.isAlive()) {
|
25530 | return;
|
25531 | }
|
25532 | var _a = getElementSize(eParentCell), paddingTop = _a.paddingTop, paddingBottom = _a.paddingBottom, borderBottomWidth = _a.borderBottomWidth, borderTopWidth = _a.borderTopWidth;
|
25533 | var extraHeight = paddingTop + paddingBottom + borderBottomWidth + borderTopWidth;
|
25534 | var wrapperHeight = eCellWrapper.offsetHeight;
|
25535 | var autoHeight = wrapperHeight + extraHeight;
|
25536 | if (timesCalled < 5) {
|
25537 |
|
25538 |
|
25539 | var doc = _this.beans.gridOptionsService.getDocument();
|
25540 | var notYetInDom = !doc || !doc.contains(eCellWrapper);
|
25541 |
|
25542 |
|
25543 | var possiblyNoContentYet = autoHeight == 0;
|
25544 | if (notYetInDom || possiblyNoContentYet) {
|
25545 | _this.beans.frameworkOverrides.setTimeout(function () { return measureHeight(timesCalled + 1); }, 0);
|
25546 | return;
|
25547 | }
|
25548 | }
|
25549 | var newHeight = Math.max(autoHeight, minRowHeight);
|
25550 | _this.rowNode.setRowAutoHeight(newHeight, _this.column);
|
25551 | };
|
25552 | var listener = function () { return measureHeight(0); };
|
25553 |
|
25554 | listener();
|
25555 | var destroyResizeObserver = this.beans.resizeObserverService.observeResize(eCellWrapper, listener);
|
25556 | this.addDestroyFunc(function () {
|
25557 | destroyResizeObserver();
|
25558 | _this.rowNode.setRowAutoHeight(undefined, _this.column);
|
25559 | });
|
25560 | };
|
25561 | CellCtrl.prototype.getInstanceId = function () {
|
25562 | return this.instanceId;
|
25563 | };
|
25564 | CellCtrl.prototype.showValue = function (forceNewCellRendererInstance) {
|
25565 | if (forceNewCellRendererInstance === void 0) { forceNewCellRendererInstance = false; }
|
25566 | var valueToDisplay = this.valueFormatted != null ? this.valueFormatted : this.value;
|
25567 | var params = this.createCellRendererParams();
|
25568 | var compDetails = this.beans.userComponentFactory.getCellRendererDetails(this.column.getColDef(), params);
|
25569 | this.cellComp.setRenderDetails(compDetails, valueToDisplay, forceNewCellRendererInstance);
|
25570 | this.refreshHandle();
|
25571 | };
|
25572 | CellCtrl.prototype.setupControlComps = function () {
|
25573 | var colDef = this.column.getColDef();
|
25574 | this.includeSelection = this.isIncludeControl(colDef.checkboxSelection);
|
25575 | this.includeRowDrag = this.isIncludeControl(colDef.rowDrag);
|
25576 | this.includeDndSource = this.isIncludeControl(colDef.dndSource);
|
25577 | this.cellComp.setIncludeSelection(this.includeSelection);
|
25578 | this.cellComp.setIncludeDndSource(this.includeDndSource);
|
25579 | this.cellComp.setIncludeRowDrag(this.includeRowDrag);
|
25580 | };
|
25581 | CellCtrl.prototype.isForceWrapper = function () {
|
25582 |
|
25583 | var forceWrapper = this.beans.gridOptionsService.is('enableCellTextSelection') || this.column.isAutoHeight();
|
25584 | return forceWrapper;
|
25585 | };
|
25586 | CellCtrl.prototype.isIncludeControl = function (value) {
|
25587 | var rowNodePinned = this.rowNode.rowPinned != null;
|
25588 | var isFunc = typeof value === 'function';
|
25589 | var res = rowNodePinned ? false : isFunc || value === true;
|
25590 | return res;
|
25591 | };
|
25592 | CellCtrl.prototype.refreshShouldDestroy = function () {
|
25593 | var colDef = this.column.getColDef();
|
25594 | var selectionChanged = this.includeSelection != this.isIncludeControl(colDef.checkboxSelection);
|
25595 | var rowDragChanged = this.includeRowDrag != this.isIncludeControl(colDef.rowDrag);
|
25596 | var dndSourceChanged = this.includeDndSource != this.isIncludeControl(colDef.dndSource);
|
25597 | return selectionChanged || rowDragChanged || dndSourceChanged;
|
25598 | };
|
25599 |
|
25600 | CellCtrl.prototype.startEditing = function (key, charPress, cellStartedEdit, event) {
|
25601 | var _this = this;
|
25602 | if (key === void 0) { key = null; }
|
25603 | if (charPress === void 0) { charPress = null; }
|
25604 | if (cellStartedEdit === void 0) { cellStartedEdit = false; }
|
25605 | if (event === void 0) { event = null; }
|
25606 | if (!this.isCellEditable() || this.editing) {
|
25607 | return;
|
25608 | }
|
25609 |
|
25610 |
|
25611 | if (!this.cellComp) {
|
25612 | this.onCellCompAttachedFuncs.push(function () { _this.startEditing(key, charPress, cellStartedEdit, event); });
|
25613 | return;
|
25614 | }
|
25615 | var editorParams = this.createCellEditorParams(key, charPress, cellStartedEdit);
|
25616 | var colDef = this.column.getColDef();
|
25617 | var compDetails = this.beans.userComponentFactory.getCellEditorDetails(colDef, editorParams);
|
25618 |
|
25619 | var popup = (compDetails === null || compDetails === void 0 ? void 0 : compDetails.popupFromSelector) != null ? compDetails.popupFromSelector : !!colDef.cellEditorPopup;
|
25620 | var position = (compDetails === null || compDetails === void 0 ? void 0 : compDetails.popupPositionFromSelector) != null ? compDetails.popupPositionFromSelector : colDef.cellEditorPopupPosition;
|
25621 | this.setEditing(true);
|
25622 | this.cellComp.setEditDetails(compDetails, popup, position);
|
25623 | var e = this.createEvent(event, Events.EVENT_CELL_EDITING_STARTED);
|
25624 | this.beans.eventService.dispatchEvent(e);
|
25625 | };
|
25626 | CellCtrl.prototype.setEditing = function (editing) {
|
25627 | if (this.editing === editing) {
|
25628 | return;
|
25629 | }
|
25630 | this.editing = editing;
|
25631 | this.refreshHandle();
|
25632 | };
|
25633 |
|
25634 | CellCtrl.prototype.stopRowOrCellEdit = function (cancel) {
|
25635 | if (cancel === void 0) { cancel = false; }
|
25636 | if (this.beans.gridOptionsService.get('editType') === 'fullRow') {
|
25637 | this.rowCtrl.stopRowEditing(cancel);
|
25638 | }
|
25639 | else {
|
25640 | this.stopEditing(cancel);
|
25641 | }
|
25642 | };
|
25643 | CellCtrl.prototype.onPopupEditorClosed = function () {
|
25644 | if (!this.isEditing()) {
|
25645 | return;
|
25646 | }
|
25647 |
|
25648 |
|
25649 |
|
25650 | this.stopEditingAndFocus();
|
25651 | };
|
25652 | CellCtrl.prototype.takeValueFromCellEditor = function (cancel) {
|
25653 | var noValueResult = { newValueExists: false };
|
25654 | if (cancel) {
|
25655 | return noValueResult;
|
25656 | }
|
25657 | var cellEditor = this.cellComp.getCellEditor();
|
25658 | if (!cellEditor) {
|
25659 | return noValueResult;
|
25660 | }
|
25661 | var userWantsToCancel = cellEditor.isCancelAfterEnd && cellEditor.isCancelAfterEnd();
|
25662 | if (userWantsToCancel) {
|
25663 | return noValueResult;
|
25664 | }
|
25665 | var newValue = cellEditor.getValue();
|
25666 | return {
|
25667 | newValue: newValue,
|
25668 | newValueExists: true
|
25669 | };
|
25670 | };
|
25671 | |
25672 |
|
25673 |
|
25674 | CellCtrl.prototype.saveNewValue = function (oldValue, newValue) {
|
25675 | if (newValue === oldValue) {
|
25676 | return false;
|
25677 | }
|
25678 |
|
25679 |
|
25680 |
|
25681 |
|
25682 | this.suppressRefreshCell = true;
|
25683 | var valueChanged = this.rowNode.setDataValue(this.column, newValue, 'edit');
|
25684 | this.suppressRefreshCell = false;
|
25685 | return valueChanged;
|
25686 | };
|
25687 | |
25688 |
|
25689 |
|
25690 |
|
25691 |
|
25692 | CellCtrl.prototype.stopEditing = function (cancel) {
|
25693 | if (cancel === void 0) { cancel = false; }
|
25694 | if (!this.editing) {
|
25695 | return false;
|
25696 | }
|
25697 | var _a = this.takeValueFromCellEditor(cancel), newValue = _a.newValue, newValueExists = _a.newValueExists;
|
25698 | var oldValue = this.getValueFromValueService();
|
25699 | var valueChanged = false;
|
25700 | if (newValueExists) {
|
25701 | valueChanged = this.saveNewValue(oldValue, newValue);
|
25702 | }
|
25703 | this.setEditing(false);
|
25704 | this.cellComp.setEditDetails();
|
25705 | this.updateAndFormatValue();
|
25706 | this.refreshCell({ forceRefresh: true, suppressFlash: true });
|
25707 | this.dispatchEditingStoppedEvent(oldValue, newValue, !cancel && !!valueChanged);
|
25708 | return valueChanged;
|
25709 | };
|
25710 | CellCtrl.prototype.dispatchEditingStoppedEvent = function (oldValue, newValue, valueChanged) {
|
25711 | var editingStoppedEvent = __assign$8(__assign$8({}, this.createEvent(null, Events.EVENT_CELL_EDITING_STOPPED)), { oldValue: oldValue,
|
25712 | newValue: newValue,
|
25713 | valueChanged: valueChanged });
|
25714 | this.beans.eventService.dispatchEvent(editingStoppedEvent);
|
25715 | };
|
25716 | CellCtrl.prototype.createCellEditorParams = function (key, charPress, cellStartedEdit) {
|
25717 | return {
|
25718 | value: this.getValueFromValueService(),
|
25719 | eventKey: key,
|
25720 | charPress: charPress,
|
25721 | column: this.column,
|
25722 | colDef: this.column.getColDef(),
|
25723 | rowIndex: this.getCellPosition().rowIndex,
|
25724 | node: this.rowNode,
|
25725 | data: this.rowNode.data,
|
25726 | api: this.beans.gridOptionsService.api,
|
25727 | cellStartedEdit: cellStartedEdit,
|
25728 | columnApi: this.beans.gridOptionsService.columnApi,
|
25729 | context: this.beans.gridOptionsService.context,
|
25730 | onKeyDown: this.onKeyDown.bind(this),
|
25731 | stopEditing: this.stopEditingAndFocus.bind(this),
|
25732 | eGridCell: this.getGui(),
|
25733 | parseValue: this.parseValue.bind(this),
|
25734 | formatValue: this.formatValue.bind(this)
|
25735 | };
|
25736 | };
|
25737 | CellCtrl.prototype.createCellRendererParams = function () {
|
25738 | var _this = this;
|
25739 | var res = {
|
25740 | value: this.value,
|
25741 | valueFormatted: this.valueFormatted,
|
25742 | getValue: this.getValueFromValueService.bind(this),
|
25743 | setValue: function (value) { return _this.beans.valueService.setValue(_this.rowNode, _this.column, value); },
|
25744 | formatValue: this.formatValue.bind(this),
|
25745 | data: this.rowNode.data,
|
25746 | node: this.rowNode,
|
25747 | pinned: this.column.getPinned(),
|
25748 | colDef: this.column.getColDef(),
|
25749 | column: this.column,
|
25750 | rowIndex: this.getCellPosition().rowIndex,
|
25751 | api: this.beans.gridOptionsService.api,
|
25752 | columnApi: this.beans.gridOptionsService.columnApi,
|
25753 | context: this.beans.gridOptionsService.context,
|
25754 | refreshCell: this.refreshCell.bind(this),
|
25755 | eGridCell: this.getGui(),
|
25756 | eParentOfValue: this.cellComp.getParentOfValue(),
|
25757 | registerRowDragger: function (rowDraggerElement, dragStartPixels, value, suppressVisibilityChange) { return _this.registerRowDragger(rowDraggerElement, dragStartPixels, suppressVisibilityChange); },
|
25758 | };
|
25759 | return res;
|
25760 | };
|
25761 | CellCtrl.prototype.parseValue = function (newValue) {
|
25762 | var colDef = this.column.getColDef();
|
25763 | var params = {
|
25764 | node: this.rowNode,
|
25765 | data: this.rowNode.data,
|
25766 | oldValue: this.getValue(),
|
25767 | newValue: newValue,
|
25768 | colDef: colDef,
|
25769 | column: this.column,
|
25770 | api: this.beans.gridOptionsService.api,
|
25771 | columnApi: this.beans.gridOptionsService.columnApi,
|
25772 | context: this.beans.gridOptionsService.context
|
25773 | };
|
25774 | var valueParser = colDef.valueParser;
|
25775 | if (exists(valueParser)) {
|
25776 | if (typeof valueParser === 'function') {
|
25777 | return valueParser(params);
|
25778 | }
|
25779 | return this.beans.expressionService.evaluate(valueParser, params);
|
25780 | }
|
25781 | return newValue;
|
25782 | };
|
25783 | CellCtrl.prototype.setFocusOutOnEditor = function () {
|
25784 | if (!this.editing) {
|
25785 | return;
|
25786 | }
|
25787 | var cellEditor = this.cellComp.getCellEditor();
|
25788 | if (cellEditor && cellEditor.focusOut) {
|
25789 | cellEditor.focusOut();
|
25790 | }
|
25791 | };
|
25792 | CellCtrl.prototype.setFocusInOnEditor = function () {
|
25793 | if (!this.editing) {
|
25794 | return;
|
25795 | }
|
25796 | var cellEditor = this.cellComp.getCellEditor();
|
25797 | if (cellEditor && cellEditor.focusIn) {
|
25798 |
|
25799 | cellEditor.focusIn();
|
25800 | }
|
25801 | else {
|
25802 |
|
25803 |
|
25804 |
|
25805 | this.focusCell(true);
|
25806 | }
|
25807 | };
|
25808 | CellCtrl.prototype.onCellChanged = function (event) {
|
25809 |
|
25810 |
|
25811 | if (!this.cellComp) {
|
25812 | return;
|
25813 | }
|
25814 | var eventImpactsThisCell = event.column === this.column;
|
25815 | if (eventImpactsThisCell) {
|
25816 | this.refreshCell({});
|
25817 | }
|
25818 | };
|
25819 |
|
25820 |
|
25821 |
|
25822 |
|
25823 |
|
25824 |
|
25825 | CellCtrl.prototype.refreshCell = function (params) {
|
25826 | var _a, _b, _c;
|
25827 |
|
25828 | if (this.suppressRefreshCell || this.editing) {
|
25829 | return;
|
25830 | }
|
25831 |
|
25832 |
|
25833 |
|
25834 | if (!this.cellComp) {
|
25835 | return;
|
25836 | }
|
25837 | var colDef = this.column.getColDef();
|
25838 | var newData = params != null && !!params.newData;
|
25839 | var suppressFlash = (params != null && !!params.suppressFlash) || !!colDef.suppressCellFlash;
|
25840 |
|
25841 |
|
25842 |
|
25843 |
|
25844 |
|
25845 |
|
25846 | var noValueProvided = colDef.field == null && colDef.valueGetter == null && colDef.showRowGroup == null;
|
25847 | var forceRefresh = (params && params.forceRefresh) || noValueProvided || newData;
|
25848 | var valuesDifferent = this.updateAndFormatValue();
|
25849 | var dataNeedsUpdating = forceRefresh || valuesDifferent;
|
25850 | if (dataNeedsUpdating) {
|
25851 |
|
25852 |
|
25853 |
|
25854 | this.showValue(newData);
|
25855 |
|
25856 |
|
25857 | var processingFilterChange = this.beans.filterManager.isSuppressFlashingCellsBecauseFiltering();
|
25858 | var flashCell = !suppressFlash && !processingFilterChange &&
|
25859 | (this.beans.gridOptionsService.is('enableCellChangeFlash') || colDef.enableCellChangeFlash);
|
25860 | if (flashCell) {
|
25861 | this.flashCell();
|
25862 | }
|
25863 | (_a = this.cellCustomStyleFeature) === null || _a === void 0 ? void 0 : _a.applyUserStyles();
|
25864 | (_b = this.cellCustomStyleFeature) === null || _b === void 0 ? void 0 : _b.applyClassesFromColDef();
|
25865 | }
|
25866 | this.refreshToolTip();
|
25867 |
|
25868 |
|
25869 | (_c = this.cellCustomStyleFeature) === null || _c === void 0 ? void 0 : _c.applyCellClassRules();
|
25870 | };
|
25871 |
|
25872 |
|
25873 | CellCtrl.prototype.stopEditingAndFocus = function (suppressNavigateAfterEdit) {
|
25874 | if (suppressNavigateAfterEdit === void 0) { suppressNavigateAfterEdit = false; }
|
25875 | this.stopRowOrCellEdit();
|
25876 | this.focusCell(true);
|
25877 | if (!suppressNavigateAfterEdit) {
|
25878 | this.navigateAfterEdit();
|
25879 | }
|
25880 | };
|
25881 | CellCtrl.prototype.navigateAfterEdit = function () {
|
25882 | var fullRowEdit = this.beans.gridOptionsService.get('editType') === 'fullRow';
|
25883 | if (fullRowEdit) {
|
25884 | return;
|
25885 | }
|
25886 | var enterMovesDownAfterEdit = this.beans.gridOptionsService.is('enterMovesDownAfterEdit');
|
25887 | if (enterMovesDownAfterEdit) {
|
25888 | this.beans.navigationService.navigateToNextCell(null, KeyCode.DOWN, this.getCellPosition(), false);
|
25889 | }
|
25890 | };
|
25891 |
|
25892 | CellCtrl.prototype.flashCell = function (delays) {
|
25893 | var flashDelay = delays && delays.flashDelay;
|
25894 | var fadeDelay = delays && delays.fadeDelay;
|
25895 | this.animateCell('data-changed', flashDelay, fadeDelay);
|
25896 | };
|
25897 | CellCtrl.prototype.animateCell = function (cssName, flashDelay, fadeDelay) {
|
25898 | var _this = this;
|
25899 | var _a, _b;
|
25900 | var fullName = "ag-cell-" + cssName;
|
25901 | var animationFullName = "ag-cell-" + cssName + "-animation";
|
25902 | var gridOptionsService = this.beans.gridOptionsService;
|
25903 | if (!flashDelay) {
|
25904 | flashDelay = (_a = gridOptionsService.getNum('cellFlashDelay')) !== null && _a !== void 0 ? _a : 500;
|
25905 | }
|
25906 | if (!exists(fadeDelay)) {
|
25907 | fadeDelay = (_b = gridOptionsService.getNum('cellFadeDelay')) !== null && _b !== void 0 ? _b : 1000;
|
25908 | }
|
25909 |
|
25910 | this.cellComp.addOrRemoveCssClass(fullName, true);
|
25911 | this.cellComp.addOrRemoveCssClass(animationFullName, false);
|
25912 |
|
25913 | window.setTimeout(function () {
|
25914 | if (!_this.isAlive()) {
|
25915 | return;
|
25916 | }
|
25917 | _this.cellComp.addOrRemoveCssClass(fullName, false);
|
25918 | _this.cellComp.addOrRemoveCssClass(animationFullName, true);
|
25919 | _this.eGui.style.transition = "background-color " + fadeDelay + "ms";
|
25920 | window.setTimeout(function () {
|
25921 | if (!_this.isAlive()) {
|
25922 | return;
|
25923 | }
|
25924 |
|
25925 | _this.cellComp.addOrRemoveCssClass(animationFullName, false);
|
25926 | _this.eGui.style.transition = '';
|
25927 | }, fadeDelay);
|
25928 | }, flashDelay);
|
25929 | };
|
25930 | CellCtrl.prototype.onFlashCells = function (event) {
|
25931 | if (!this.cellComp) {
|
25932 | return;
|
25933 | }
|
25934 | var cellId = this.beans.cellPositionUtils.createId(this.getCellPosition());
|
25935 | var shouldFlash = event.cells[cellId];
|
25936 | if (shouldFlash) {
|
25937 | this.animateCell('highlight');
|
25938 | }
|
25939 | };
|
25940 | CellCtrl.prototype.isCellEditable = function () {
|
25941 | return this.column.isCellEditable(this.rowNode);
|
25942 | };
|
25943 | CellCtrl.prototype.isSuppressFillHandle = function () {
|
25944 | return this.column.isSuppressFillHandle();
|
25945 | };
|
25946 | CellCtrl.prototype.formatValue = function (value) {
|
25947 | var res = this.callValueFormatter(value);
|
25948 | return res != null ? res : value;
|
25949 | };
|
25950 | CellCtrl.prototype.callValueFormatter = function (value) {
|
25951 | return this.beans.valueFormatterService.formatValue(this.column, this.rowNode, value);
|
25952 | };
|
25953 | CellCtrl.prototype.updateAndFormatValue = function (force) {
|
25954 | if (force === void 0) { force = false; }
|
25955 | var oldValue = this.value;
|
25956 | var oldValueFormatted = this.valueFormatted;
|
25957 | this.value = this.getValueFromValueService();
|
25958 | this.valueFormatted = this.callValueFormatter(this.value);
|
25959 | var valuesDifferent = force ? true :
|
25960 | !this.valuesAreEqual(oldValue, this.value) || this.valueFormatted != oldValueFormatted;
|
25961 | return valuesDifferent;
|
25962 | };
|
25963 | CellCtrl.prototype.valuesAreEqual = function (val1, val2) {
|
25964 |
|
25965 | var colDef = this.column.getColDef();
|
25966 | return colDef.equals ? colDef.equals(val1, val2) : val1 === val2;
|
25967 | };
|
25968 | CellCtrl.prototype.getComp = function () {
|
25969 | return this.cellComp;
|
25970 | };
|
25971 | CellCtrl.prototype.getValueFromValueService = function () {
|
25972 |
|
25973 |
|
25974 |
|
25975 |
|
25976 | var lockedClosedGroup = this.rowNode.leafGroup && this.beans.columnModel.isPivotMode();
|
25977 | var isOpenGroup = this.rowNode.group && this.rowNode.expanded && !this.rowNode.footer && !lockedClosedGroup;
|
25978 |
|
25979 | var groupFootersEnabled = this.beans.gridOptionsService.is('groupIncludeFooter');
|
25980 |
|
25981 | var groupAlwaysShowAggData = this.beans.gridOptionsService.is('groupSuppressBlankHeader');
|
25982 |
|
25983 |
|
25984 | var ignoreAggData = (isOpenGroup && groupFootersEnabled) && !groupAlwaysShowAggData;
|
25985 | var value = this.beans.valueService.getValue(this.column, this.rowNode, false, ignoreAggData);
|
25986 | return value;
|
25987 | };
|
25988 | CellCtrl.prototype.getValue = function () {
|
25989 | return this.value;
|
25990 | };
|
25991 | CellCtrl.prototype.getValueFormatted = function () {
|
25992 | return this.valueFormatted;
|
25993 | };
|
25994 | CellCtrl.prototype.addDomData = function () {
|
25995 | var _this = this;
|
25996 | var element = this.getGui();
|
25997 | this.beans.gridOptionsService.setDomData(element, CellCtrl.DOM_DATA_KEY_CELL_CTRL, this);
|
25998 | this.addDestroyFunc(function () { return _this.beans.gridOptionsService.setDomData(element, CellCtrl.DOM_DATA_KEY_CELL_CTRL, null); });
|
25999 | };
|
26000 | CellCtrl.prototype.createEvent = function (domEvent, eventType) {
|
26001 | var event = {
|
26002 | type: eventType,
|
26003 | node: this.rowNode,
|
26004 | data: this.rowNode.data,
|
26005 | value: this.value,
|
26006 | column: this.column,
|
26007 | colDef: this.column.getColDef(),
|
26008 | context: this.beans.gridOptionsService.context,
|
26009 | api: this.beans.gridApi,
|
26010 | columnApi: this.beans.columnApi,
|
26011 | rowPinned: this.rowNode.rowPinned,
|
26012 | event: domEvent,
|
26013 | rowIndex: this.rowNode.rowIndex
|
26014 | };
|
26015 | return event;
|
26016 | };
|
26017 | CellCtrl.prototype.onKeyPress = function (event) {
|
26018 | var _a;
|
26019 | (_a = this.cellKeyboardListenerFeature) === null || _a === void 0 ? void 0 : _a.onKeyPress(event);
|
26020 | };
|
26021 | CellCtrl.prototype.onKeyDown = function (event) {
|
26022 | var _a;
|
26023 | (_a = this.cellKeyboardListenerFeature) === null || _a === void 0 ? void 0 : _a.onKeyDown(event);
|
26024 | };
|
26025 | CellCtrl.prototype.onMouseEvent = function (eventName, mouseEvent) {
|
26026 | var _a;
|
26027 | (_a = this.cellMouseListenerFeature) === null || _a === void 0 ? void 0 : _a.onMouseEvent(eventName, mouseEvent);
|
26028 | };
|
26029 | CellCtrl.prototype.getGui = function () {
|
26030 | return this.eGui;
|
26031 | };
|
26032 | CellCtrl.prototype.refreshToolTip = function () {
|
26033 | var _a;
|
26034 | (_a = this.tooltipFeature) === null || _a === void 0 ? void 0 : _a.refreshToolTip();
|
26035 | };
|
26036 | CellCtrl.prototype.getColSpanningList = function () {
|
26037 | return this.cellPositionFeature.getColSpanningList();
|
26038 | };
|
26039 | CellCtrl.prototype.onLeftChanged = function () {
|
26040 | var _a;
|
26041 | if (!this.cellComp) {
|
26042 | return;
|
26043 | }
|
26044 | (_a = this.cellPositionFeature) === null || _a === void 0 ? void 0 : _a.onLeftChanged();
|
26045 | };
|
26046 | CellCtrl.prototype.onDisplayedColumnsChanged = function () {
|
26047 | if (!this.eGui) {
|
26048 | return;
|
26049 | }
|
26050 | this.setAriaColIndex();
|
26051 | };
|
26052 | CellCtrl.prototype.setAriaColIndex = function () {
|
26053 | var colIdx = this.beans.columnModel.getAriaColumnIndex(this.column);
|
26054 | setAriaColIndex(this.getGui(), colIdx);
|
26055 | };
|
26056 | CellCtrl.prototype.isSuppressNavigable = function () {
|
26057 | return this.column.isSuppressNavigable(this.rowNode);
|
26058 | };
|
26059 | CellCtrl.prototype.onWidthChanged = function () {
|
26060 | var _a;
|
26061 | return (_a = this.cellPositionFeature) === null || _a === void 0 ? void 0 : _a.onWidthChanged();
|
26062 | };
|
26063 | CellCtrl.prototype.getColumn = function () {
|
26064 | return this.column;
|
26065 | };
|
26066 | CellCtrl.prototype.getRowNode = function () {
|
26067 | return this.rowNode;
|
26068 | };
|
26069 | CellCtrl.prototype.getBeans = function () {
|
26070 | return this.beans;
|
26071 | };
|
26072 | CellCtrl.prototype.isPrintLayout = function () {
|
26073 | return this.printLayout;
|
26074 | };
|
26075 | CellCtrl.prototype.appendChild = function (htmlElement) {
|
26076 | this.eGui.appendChild(htmlElement);
|
26077 | };
|
26078 | CellCtrl.prototype.refreshHandle = function () {
|
26079 | if (this.cellRangeFeature) {
|
26080 | this.cellRangeFeature.refreshHandle();
|
26081 | }
|
26082 | };
|
26083 | CellCtrl.prototype.getCellPosition = function () {
|
26084 | return this.cellPosition;
|
26085 | };
|
26086 | CellCtrl.prototype.isEditing = function () {
|
26087 | return this.editing;
|
26088 | };
|
26089 |
|
26090 | CellCtrl.prototype.startRowOrCellEdit = function (key, charPress, event) {
|
26091 | if (event === void 0) { event = null; }
|
26092 | if (!this.cellComp) {
|
26093 | return;
|
26094 | }
|
26095 | if (this.beans.gridOptionsService.get('editType') === 'fullRow') {
|
26096 | this.rowCtrl.startRowEditing(key, charPress, this);
|
26097 | }
|
26098 | else {
|
26099 | this.startEditing(key, charPress, true, event);
|
26100 | }
|
26101 | };
|
26102 | CellCtrl.prototype.getRowCtrl = function () {
|
26103 | return this.rowCtrl;
|
26104 | };
|
26105 | CellCtrl.prototype.getRowPosition = function () {
|
26106 | return {
|
26107 | rowIndex: this.cellPosition.rowIndex,
|
26108 | rowPinned: this.cellPosition.rowPinned
|
26109 | };
|
26110 | };
|
26111 | CellCtrl.prototype.updateRangeBordersIfRangeCount = function () {
|
26112 | if (!this.cellComp) {
|
26113 | return;
|
26114 | }
|
26115 | if (this.cellRangeFeature) {
|
26116 | this.cellRangeFeature.updateRangeBordersIfRangeCount();
|
26117 | }
|
26118 | };
|
26119 | CellCtrl.prototype.onRangeSelectionChanged = function () {
|
26120 | if (!this.cellComp) {
|
26121 | return;
|
26122 | }
|
26123 | if (this.cellRangeFeature) {
|
26124 | this.cellRangeFeature.onRangeSelectionChanged();
|
26125 | }
|
26126 | };
|
26127 | CellCtrl.prototype.isRangeSelectionEnabled = function () {
|
26128 | return this.cellRangeFeature != null;
|
26129 | };
|
26130 | CellCtrl.prototype.focusCell = function (forceBrowserFocus) {
|
26131 | if (forceBrowserFocus === void 0) { forceBrowserFocus = false; }
|
26132 | this.beans.focusService.setFocusedCell({
|
26133 | rowIndex: this.getCellPosition().rowIndex,
|
26134 | column: this.column,
|
26135 | rowPinned: this.rowNode.rowPinned,
|
26136 | forceBrowserFocus: forceBrowserFocus
|
26137 | });
|
26138 | };
|
26139 | CellCtrl.prototype.onRowIndexChanged = function () {
|
26140 |
|
26141 |
|
26142 | this.createCellPosition();
|
26143 |
|
26144 | this.onCellFocused();
|
26145 |
|
26146 | if (this.cellRangeFeature) {
|
26147 | this.cellRangeFeature.onRangeSelectionChanged();
|
26148 | }
|
26149 | };
|
26150 | CellCtrl.prototype.onFirstRightPinnedChanged = function () {
|
26151 | if (!this.cellComp) {
|
26152 | return;
|
26153 | }
|
26154 | var firstRightPinned = this.column.isFirstRightPinned();
|
26155 | this.cellComp.addOrRemoveCssClass(CSS_CELL_FIRST_RIGHT_PINNED, firstRightPinned);
|
26156 | };
|
26157 | CellCtrl.prototype.onLastLeftPinnedChanged = function () {
|
26158 | if (!this.cellComp) {
|
26159 | return;
|
26160 | }
|
26161 | var lastLeftPinned = this.column.isLastLeftPinned();
|
26162 | this.cellComp.addOrRemoveCssClass(CSS_CELL_LAST_LEFT_PINNED, lastLeftPinned);
|
26163 | };
|
26164 | CellCtrl.prototype.onCellFocused = function (event) {
|
26165 | if (!this.cellComp || this.beans.gridOptionsService.is('suppressCellFocus')) {
|
26166 | return;
|
26167 | }
|
26168 | var cellFocused = this.beans.focusService.isCellFocused(this.cellPosition);
|
26169 | this.cellComp.addOrRemoveCssClass(CSS_CELL_FOCUS, cellFocused);
|
26170 |
|
26171 | if (cellFocused && event && event.forceBrowserFocus) {
|
26172 | var focusEl = this.cellComp.getFocusableElement();
|
26173 | focusEl.focus({ preventScroll: !!event.preventScrollOnBrowserFocus });
|
26174 | }
|
26175 |
|
26176 | var fullRowEdit = this.beans.gridOptionsService.get('editType') === 'fullRow';
|
26177 | if (!cellFocused && !fullRowEdit && this.editing) {
|
26178 | this.stopRowOrCellEdit();
|
26179 | }
|
26180 | };
|
26181 | CellCtrl.prototype.createCellPosition = function () {
|
26182 | this.cellPosition = {
|
26183 | rowIndex: this.rowNode.rowIndex,
|
26184 | rowPinned: makeNull(this.rowNode.rowPinned),
|
26185 | column: this.column
|
26186 | };
|
26187 | };
|
26188 |
|
26189 | CellCtrl.prototype.applyStaticCssClasses = function () {
|
26190 | this.cellComp.addOrRemoveCssClass(CSS_CELL, true);
|
26191 | this.cellComp.addOrRemoveCssClass(CSS_CELL_NOT_INLINE_EDITING, true);
|
26192 |
|
26193 |
|
26194 | var autoHeight = this.column.isAutoHeight() == true;
|
26195 | this.cellComp.addOrRemoveCssClass(CSS_AUTO_HEIGHT, autoHeight);
|
26196 | this.cellComp.addOrRemoveCssClass(CSS_NORMAL_HEIGHT, !autoHeight);
|
26197 | };
|
26198 | CellCtrl.prototype.onColumnHover = function () {
|
26199 | if (!this.cellComp) {
|
26200 | return;
|
26201 | }
|
26202 | if (!this.beans.gridOptionsService.is('columnHoverHighlight')) {
|
26203 | return;
|
26204 | }
|
26205 | var isHovered = this.beans.columnHoverService.isHovered(this.column);
|
26206 | this.cellComp.addOrRemoveCssClass(CSS_COLUMN_HOVER, isHovered);
|
26207 | };
|
26208 | CellCtrl.prototype.onColDefChanged = function () {
|
26209 | if (!this.cellComp) {
|
26210 | return;
|
26211 | }
|
26212 | this.setWrapText();
|
26213 | if (!this.editing) {
|
26214 | this.refreshCell({ forceRefresh: true, suppressFlash: true });
|
26215 | }
|
26216 | };
|
26217 | CellCtrl.prototype.setWrapText = function () {
|
26218 | var value = this.column.getColDef().wrapText == true;
|
26219 | this.cellComp.addOrRemoveCssClass(CSS_CELL_WRAP_TEXT, value);
|
26220 | };
|
26221 | CellCtrl.prototype.dispatchCellContextMenuEvent = function (event) {
|
26222 | var colDef = this.column.getColDef();
|
26223 | var cellContextMenuEvent = this.createEvent(event, Events.EVENT_CELL_CONTEXT_MENU);
|
26224 | this.beans.eventService.dispatchEvent(cellContextMenuEvent);
|
26225 | if (colDef.onCellContextMenu) {
|
26226 |
|
26227 | window.setTimeout(function () { return colDef.onCellContextMenu(cellContextMenuEvent); }, 0);
|
26228 | }
|
26229 | };
|
26230 | CellCtrl.prototype.getCellRenderer = function () {
|
26231 | return this.cellComp ? this.cellComp.getCellRenderer() : null;
|
26232 | };
|
26233 | CellCtrl.prototype.getCellEditor = function () {
|
26234 | return this.cellComp ? this.cellComp.getCellEditor() : null;
|
26235 | };
|
26236 | CellCtrl.prototype.destroy = function () {
|
26237 | this.onCellCompAttachedFuncs = [];
|
26238 | _super.prototype.destroy.call(this);
|
26239 | };
|
26240 | CellCtrl.prototype.createSelectionCheckbox = function () {
|
26241 | var cbSelectionComponent = new CheckboxSelectionComponent();
|
26242 | this.beans.context.createBean(cbSelectionComponent);
|
26243 | cbSelectionComponent.init({ rowNode: this.rowNode, column: this.column });
|
26244 |
|
26245 | return cbSelectionComponent;
|
26246 | };
|
26247 | CellCtrl.prototype.createDndSource = function () {
|
26248 | var dndSourceComp = new DndSourceComp(this.rowNode, this.column, this.beans, this.eGui);
|
26249 | this.beans.context.createBean(dndSourceComp);
|
26250 | return dndSourceComp;
|
26251 | };
|
26252 | CellCtrl.prototype.registerRowDragger = function (customElement, dragStartPixels, suppressVisibilityChange) {
|
26253 | var _this = this;
|
26254 |
|
26255 | if (this.customRowDragComp) {
|
26256 | this.customRowDragComp.setDragElement(customElement, dragStartPixels);
|
26257 | return;
|
26258 | }
|
26259 | var newComp = this.createRowDragComp(customElement, dragStartPixels, suppressVisibilityChange);
|
26260 | if (newComp) {
|
26261 | this.customRowDragComp = newComp;
|
26262 | this.addDestroyFunc(function () { _this.beans.context.destroyBean(newComp); _this.customRowDragComp = null; });
|
26263 | }
|
26264 | };
|
26265 | CellCtrl.prototype.createRowDragComp = function (customElement, dragStartPixels, suppressVisibilityChange) {
|
26266 | var _this = this;
|
26267 | var pagination = this.beans.gridOptionsService.is('pagination');
|
26268 | var rowDragManaged = this.beans.gridOptionsService.is('rowDragManaged');
|
26269 | var clientSideRowModelActive = this.beans.gridOptionsService.isRowModelType('clientSide');
|
26270 | if (rowDragManaged) {
|
26271 |
|
26272 | if (!clientSideRowModelActive) {
|
26273 | doOnce(function () { return console.warn('AG Grid: managed row dragging is only allowed in the Client Side Row Model'); }, 'CellComp.addRowDragging');
|
26274 | return;
|
26275 | }
|
26276 | if (pagination) {
|
26277 | doOnce(function () { return console.warn('AG Grid: managed row dragging is not possible when doing pagination'); }, 'CellComp.addRowDragging');
|
26278 | return;
|
26279 | }
|
26280 | }
|
26281 |
|
26282 | var rowDragComp = new RowDragComp(function () { return _this.value; }, this.rowNode, this.column, customElement, dragStartPixels, suppressVisibilityChange);
|
26283 | this.beans.context.createBean(rowDragComp);
|
26284 | return rowDragComp;
|
26285 | };
|
26286 | CellCtrl.DOM_DATA_KEY_CELL_CTRL = 'cellCtrl';
|
26287 | return CellCtrl;
|
26288 | }(BeanStub));
|
26289 |
|
26290 |
|
26291 |
|
26292 |
|
26293 |
|
26294 |
|
26295 |
|
26296 | var __extends$1O = (undefined && undefined.__extends) || (function () {
|
26297 | var extendStatics = function (d, b) {
|
26298 | extendStatics = Object.setPrototypeOf ||
|
26299 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
26300 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
26301 | return extendStatics(d, b);
|
26302 | };
|
26303 | return function (d, b) {
|
26304 | extendStatics(d, b);
|
26305 | function __() { this.constructor = d; }
|
26306 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26307 | };
|
26308 | })();
|
26309 | var __values$3 = (undefined && undefined.__values) || function(o) {
|
26310 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
26311 | if (m) return m.call(o);
|
26312 | if (o && typeof o.length === "number") return {
|
26313 | next: function () {
|
26314 | if (o && i >= o.length) o = void 0;
|
26315 | return { value: o && o[i++], done: !o };
|
26316 | }
|
26317 | };
|
26318 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
26319 | };
|
26320 | var __read$k = (undefined && undefined.__read) || function (o, n) {
|
26321 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
26322 | if (!m) return o;
|
26323 | var i = m.call(o), r, ar = [], e;
|
26324 | try {
|
26325 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
26326 | }
|
26327 | catch (error) { e = { error: error }; }
|
26328 | finally {
|
26329 | try {
|
26330 | if (r && !r.done && (m = i["return"])) m.call(i);
|
26331 | }
|
26332 | finally { if (e) throw e.error; }
|
26333 | }
|
26334 | return ar;
|
26335 | };
|
26336 | var __spread$g = (undefined && undefined.__spread) || function () {
|
26337 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$k(arguments[i]));
|
26338 | return ar;
|
26339 | };
|
26340 | var RowType$1;
|
26341 | (function (RowType) {
|
26342 | RowType["Normal"] = "Normal";
|
26343 | RowType["FullWidth"] = "FullWidth";
|
26344 | RowType["FullWidthLoading"] = "FullWidthLoading";
|
26345 | RowType["FullWidthGroup"] = "FullWidthGroup";
|
26346 | RowType["FullWidthDetail"] = "FullWidthDetail";
|
26347 | })(RowType$1 || (RowType$1 = {}));
|
26348 | var instanceIdSequence$2 = 0;
|
26349 | var RowCtrl = (function (_super) {
|
26350 | __extends$1O(RowCtrl, _super);
|
26351 | function RowCtrl(rowNode, beans, animateIn, useAnimationFrameForCreate, printLayout) {
|
26352 | var _this = _super.call(this) || this;
|
26353 | _this.allRowGuis = [];
|
26354 | _this.active = true;
|
26355 | _this.centerCellCtrls = { list: [], map: {} };
|
26356 | _this.leftCellCtrls = { list: [], map: {} };
|
26357 | _this.rightCellCtrls = { list: [], map: {} };
|
26358 | _this.slideInAnimation = {
|
26359 | left: false,
|
26360 | center: false,
|
26361 | right: false,
|
26362 | fullWidth: false
|
26363 | };
|
26364 | _this.fadeInAnimation = {
|
26365 | left: false,
|
26366 | center: false,
|
26367 | right: false,
|
26368 | fullWidth: false
|
26369 | };
|
26370 | _this.lastMouseDownOnDragger = false;
|
26371 | _this.updateColumnListsPending = false;
|
26372 | _this.businessKeySanitised = null;
|
26373 | _this.beans = beans;
|
26374 | _this.rowNode = rowNode;
|
26375 | _this.paginationPage = _this.beans.paginationProxy.getCurrentPage();
|
26376 | _this.useAnimationFrameForCreate = useAnimationFrameForCreate;
|
26377 | _this.printLayout = printLayout;
|
26378 | _this.instanceId = rowNode.id + '-' + instanceIdSequence$2++;
|
26379 | _this.setAnimateFlags(animateIn);
|
26380 | _this.initRowBusinessKey();
|
26381 | _this.rowFocused = _this.beans.focusService.isRowFocused(_this.rowNode.rowIndex, _this.rowNode.rowPinned);
|
26382 | _this.rowLevel = _this.beans.rowCssClassCalculator.calculateRowLevel(_this.rowNode);
|
26383 | _this.setRowType();
|
26384 | _this.addListeners();
|
26385 | return _this;
|
26386 | }
|
26387 | RowCtrl.prototype.initRowBusinessKey = function () {
|
26388 | var businessKeyForNodeFunc = this.beans.gridOptionsService.get('getBusinessKeyForNode');
|
26389 | if (typeof businessKeyForNodeFunc !== 'function') {
|
26390 | return;
|
26391 | }
|
26392 | var businessKey = businessKeyForNodeFunc(this.rowNode);
|
26393 | this.businessKeySanitised = escapeString(businessKey);
|
26394 | };
|
26395 | RowCtrl.prototype.isSticky = function () {
|
26396 | return this.rowNode.sticky;
|
26397 | };
|
26398 | RowCtrl.prototype.getBeans = function () {
|
26399 | return this.beans;
|
26400 | };
|
26401 | RowCtrl.prototype.getInstanceId = function () {
|
26402 | return this.instanceId;
|
26403 | };
|
26404 | RowCtrl.prototype.setComp = function (rowComp, element, containerType) {
|
26405 | var gui = { rowComp: rowComp, element: element, containerType: containerType };
|
26406 | this.allRowGuis.push(gui);
|
26407 | if (containerType === RowContainerType.LEFT) {
|
26408 | this.leftGui = gui;
|
26409 | }
|
26410 | else if (containerType === RowContainerType.RIGHT) {
|
26411 | this.rightGui = gui;
|
26412 | }
|
26413 | else if (containerType === RowContainerType.FULL_WIDTH) {
|
26414 | this.fullWidthGui = gui;
|
26415 | }
|
26416 | else {
|
26417 | this.centerGui = gui;
|
26418 | }
|
26419 | this.initialiseRowComp(gui);
|
26420 |
|
26421 | if (this.rowType !== 'FullWidthLoading' && !this.rowNode.rowPinned) {
|
26422 |
|
26423 |
|
26424 |
|
26425 | this.beans.rowRenderer.dispatchFirstDataRenderedEvent();
|
26426 | }
|
26427 | };
|
26428 | RowCtrl.prototype.unsetComp = function (containerType) {
|
26429 | this.allRowGuis = this.allRowGuis
|
26430 | .filter(function (rowGui) { return rowGui.containerType !== containerType; });
|
26431 | if (containerType === RowContainerType.LEFT) {
|
26432 | this.leftGui = undefined;
|
26433 | }
|
26434 | else if (containerType === RowContainerType.RIGHT) {
|
26435 | this.rightGui = undefined;
|
26436 | }
|
26437 | else if (containerType === RowContainerType.FULL_WIDTH) {
|
26438 | this.fullWidthGui = undefined;
|
26439 | }
|
26440 | };
|
26441 | RowCtrl.prototype.isCacheable = function () {
|
26442 | return this.rowType === RowType$1.FullWidthDetail
|
26443 | && this.beans.gridOptionsService.is('keepDetailRows');
|
26444 | };
|
26445 | RowCtrl.prototype.setCached = function (cached) {
|
26446 | var displayValue = cached ? 'none' : '';
|
26447 | this.allRowGuis.forEach(function (rg) { return rg.element.style.display = displayValue; });
|
26448 | };
|
26449 | RowCtrl.prototype.initialiseRowComp = function (gui) {
|
26450 | var _this = this;
|
26451 | var gos = this.beans.gridOptionsService;
|
26452 | this.onRowHeightChanged(gui);
|
26453 | this.updateRowIndexes(gui);
|
26454 | this.setFocusedClasses(gui);
|
26455 | this.setStylesFromGridOptions(gui);
|
26456 | if (gos.isRowSelection() && this.rowNode.selectable) {
|
26457 | this.onRowSelected(gui);
|
26458 | }
|
26459 | this.updateColumnLists(!this.useAnimationFrameForCreate);
|
26460 | var comp = gui.rowComp;
|
26461 | comp.setRole('row');
|
26462 | var initialRowClasses = this.getInitialRowClasses(gui.containerType);
|
26463 | initialRowClasses.forEach(function (name) { return comp.addOrRemoveCssClass(name, true); });
|
26464 | this.executeSlideAndFadeAnimations(gui);
|
26465 | if (this.rowNode.group) {
|
26466 | setAriaExpanded(gui.element, this.rowNode.expanded == true);
|
26467 | }
|
26468 | var rowIdSanitised = escapeString(this.rowNode.id);
|
26469 | if (rowIdSanitised != null) {
|
26470 | comp.setRowId(rowIdSanitised);
|
26471 | }
|
26472 | if (this.businessKeySanitised != null) {
|
26473 | comp.setRowBusinessKey(this.businessKeySanitised);
|
26474 | }
|
26475 | if (this.isFullWidth() && !this.beans.gridOptionsService.is('suppressCellFocus')) {
|
26476 | comp.setTabIndex(-1);
|
26477 | }
|
26478 |
|
26479 | gos.setDomData(gui.element, RowCtrl.DOM_DATA_KEY_ROW_CTRL, this);
|
26480 | this.addDestroyFunc(function () { return gos.setDomData(gui.element, RowCtrl.DOM_DATA_KEY_ROW_CTRL, null); });
|
26481 |
|
26482 |
|
26483 | if (this.useAnimationFrameForCreate) {
|
26484 | this.beans.animationFrameService.createTask(this.addHoverFunctionality.bind(this, gui.element), this.rowNode.rowIndex, 'createTasksP2');
|
26485 | }
|
26486 | else {
|
26487 | this.addHoverFunctionality(gui.element);
|
26488 | }
|
26489 | if (this.isFullWidth()) {
|
26490 | this.setupFullWidth(gui);
|
26491 | }
|
26492 | if (gos.is('rowDragEntireRow')) {
|
26493 | this.addRowDraggerToRow(gui);
|
26494 | }
|
26495 | if (this.useAnimationFrameForCreate) {
|
26496 |
|
26497 |
|
26498 |
|
26499 |
|
26500 |
|
26501 |
|
26502 | this.beans.animationFrameService.addDestroyTask(function () {
|
26503 | if (!_this.isAlive()) {
|
26504 | return;
|
26505 | }
|
26506 | gui.rowComp.addOrRemoveCssClass('ag-after-created', true);
|
26507 | });
|
26508 | }
|
26509 | this.executeProcessRowPostCreateFunc();
|
26510 | };
|
26511 | RowCtrl.prototype.executeSlideAndFadeAnimations = function (gui) {
|
26512 | var _this = this;
|
26513 | var containerType = gui.containerType;
|
26514 | var shouldSlide = this.slideInAnimation[containerType];
|
26515 | if (shouldSlide) {
|
26516 | executeNextVMTurn(function () {
|
26517 | _this.onTopChanged();
|
26518 | });
|
26519 | this.slideInAnimation[containerType] = false;
|
26520 | }
|
26521 | var shouldFade = this.fadeInAnimation[containerType];
|
26522 | if (shouldFade) {
|
26523 | executeNextVMTurn(function () {
|
26524 | gui.rowComp.addOrRemoveCssClass('ag-opacity-zero', false);
|
26525 | });
|
26526 | this.fadeInAnimation[containerType] = false;
|
26527 | }
|
26528 | };
|
26529 | RowCtrl.prototype.addRowDraggerToRow = function (gui) {
|
26530 | if (this.beans.gridOptionsService.isEnableRangeSelection()) {
|
26531 | doOnce(function () {
|
26532 | console.warn('AG Grid: Setting `rowDragEntireRow: true` in the gridOptions doesn\'t work with `enableRangeSelection: true`');
|
26533 | }, 'rowDragAndRangeSelectionEnabled');
|
26534 | return;
|
26535 | }
|
26536 | var translate = this.beans.localeService.getLocaleTextFunc();
|
26537 | var rowDragComp = new RowDragComp(function () { return "1 " + translate('rowDragRow', 'row'); }, this.rowNode, undefined, gui.element, undefined, true);
|
26538 | this.createManagedBean(rowDragComp, this.beans.context);
|
26539 | };
|
26540 | RowCtrl.prototype.setupFullWidth = function (gui) {
|
26541 | var pinned = this.getPinnedForContainer(gui.containerType);
|
26542 | var params = this.createFullWidthParams(gui.element, pinned);
|
26543 | if (this.rowType == RowType$1.FullWidthDetail) {
|
26544 | if (!ModuleRegistry.assertRegistered(ModuleNames.MasterDetailModule, "cell renderer 'agDetailCellRenderer' (for master detail)")) {
|
26545 | return;
|
26546 | }
|
26547 | }
|
26548 | var compDetails;
|
26549 | switch (this.rowType) {
|
26550 | case RowType$1.FullWidthDetail:
|
26551 | compDetails = this.beans.userComponentFactory.getFullWidthDetailCellRendererDetails(params);
|
26552 | break;
|
26553 | case RowType$1.FullWidthGroup:
|
26554 | compDetails = this.beans.userComponentFactory.getFullWidthGroupCellRendererDetails(params);
|
26555 | break;
|
26556 | case RowType$1.FullWidthLoading:
|
26557 | compDetails = this.beans.userComponentFactory.getFullWidthLoadingCellRendererDetails(params);
|
26558 | break;
|
26559 | default:
|
26560 | compDetails = this.beans.userComponentFactory.getFullWidthCellRendererDetails(params);
|
26561 | break;
|
26562 | }
|
26563 | gui.rowComp.showFullWidth(compDetails);
|
26564 | };
|
26565 | RowCtrl.prototype.isPrintLayout = function () {
|
26566 | return this.printLayout;
|
26567 | };
|
26568 | RowCtrl.prototype.getFullWidthCellRenderer = function () {
|
26569 | var _a, _b;
|
26570 | return (_b = (_a = this.fullWidthGui) === null || _a === void 0 ? void 0 : _a.rowComp) === null || _b === void 0 ? void 0 : _b.getFullWidthCellRenderer();
|
26571 | };
|
26572 |
|
26573 | RowCtrl.prototype.getCellElement = function (column) {
|
26574 | var cellCtrl = this.getCellCtrl(column);
|
26575 | return cellCtrl ? cellCtrl.getGui() : null;
|
26576 | };
|
26577 | RowCtrl.prototype.executeProcessRowPostCreateFunc = function () {
|
26578 | var _a;
|
26579 | var func = this.beans.gridOptionsService.getCallback('processRowPostCreate');
|
26580 | if (!func || !this.areAllContainersReady()) {
|
26581 | return;
|
26582 | }
|
26583 | var params = {
|
26584 | eRow: (_a = this.centerGui) === null || _a === void 0 ? void 0 : _a.element,
|
26585 | ePinnedLeftRow: this.leftGui ? this.leftGui.element : undefined,
|
26586 | ePinnedRightRow: this.rightGui ? this.rightGui.element : undefined,
|
26587 | node: this.rowNode,
|
26588 | rowIndex: this.rowNode.rowIndex,
|
26589 | addRenderedRowListener: this.addEventListener.bind(this),
|
26590 | };
|
26591 | func(params);
|
26592 | };
|
26593 | RowCtrl.prototype.areAllContainersReady = function () {
|
26594 | var isLeftReady = !!this.leftGui || !this.beans.columnModel.isPinningLeft();
|
26595 | var isCenterReady = !!this.centerGui;
|
26596 | var isRightReady = !!this.rightGui || !this.beans.columnModel.isPinningRight();
|
26597 | return isLeftReady && isCenterReady && isRightReady;
|
26598 | };
|
26599 | RowCtrl.prototype.setRowType = function () {
|
26600 | var isStub = this.rowNode.stub;
|
26601 | var isFullWidthCell = this.rowNode.isFullWidthCell();
|
26602 | var isDetailCell = this.beans.doingMasterDetail && this.rowNode.detail;
|
26603 | var pivotMode = this.beans.columnModel.isPivotMode();
|
26604 |
|
26605 |
|
26606 |
|
26607 |
|
26608 | var isGroupRow = !!this.rowNode.group && !this.rowNode.footer;
|
26609 | var isFullWidthGroup = isGroupRow && this.beans.gridOptionsService.isGroupUseEntireRow(pivotMode);
|
26610 | if (isStub) {
|
26611 | this.rowType = RowType$1.FullWidthLoading;
|
26612 | }
|
26613 | else if (isDetailCell) {
|
26614 | this.rowType = RowType$1.FullWidthDetail;
|
26615 | }
|
26616 | else if (isFullWidthCell) {
|
26617 | this.rowType = RowType$1.FullWidth;
|
26618 | }
|
26619 | else if (isFullWidthGroup) {
|
26620 | this.rowType = RowType$1.FullWidthGroup;
|
26621 | }
|
26622 | else {
|
26623 | this.rowType = RowType$1.Normal;
|
26624 | }
|
26625 | };
|
26626 | RowCtrl.prototype.updateColumnLists = function (suppressAnimationFrame) {
|
26627 | var _this = this;
|
26628 | if (suppressAnimationFrame === void 0) { suppressAnimationFrame = false; }
|
26629 | if (this.isFullWidth()) {
|
26630 | return;
|
26631 | }
|
26632 | var noAnimation = suppressAnimationFrame
|
26633 | || this.beans.gridOptionsService.is('suppressAnimationFrame')
|
26634 | || this.printLayout;
|
26635 | if (noAnimation) {
|
26636 | this.updateColumnListsImpl();
|
26637 | return;
|
26638 | }
|
26639 | if (this.updateColumnListsPending) {
|
26640 | return;
|
26641 | }
|
26642 | this.beans.animationFrameService.createTask(function () {
|
26643 | if (!_this.active) {
|
26644 | return;
|
26645 | }
|
26646 | _this.updateColumnListsImpl();
|
26647 | }, this.rowNode.rowIndex, 'createTasksP1');
|
26648 | this.updateColumnListsPending = true;
|
26649 | };
|
26650 | RowCtrl.prototype.createCellCtrls = function (prev, cols, pinned) {
|
26651 | var _this = this;
|
26652 | if (pinned === void 0) { pinned = null; }
|
26653 | var res = {
|
26654 | list: [],
|
26655 | map: {}
|
26656 | };
|
26657 | var addCell = function (colInstanceId, cellCtrl) {
|
26658 | res.list.push(cellCtrl);
|
26659 | res.map[colInstanceId] = cellCtrl;
|
26660 | };
|
26661 | cols.forEach(function (col) {
|
26662 |
|
26663 |
|
26664 |
|
26665 | var colInstanceId = col.getInstanceId();
|
26666 | var cellCtrl = prev.map[colInstanceId];
|
26667 | if (!cellCtrl) {
|
26668 | cellCtrl = new CellCtrl(col, _this.rowNode, _this.beans, _this);
|
26669 | }
|
26670 | addCell(colInstanceId, cellCtrl);
|
26671 | });
|
26672 | prev.list.forEach(function (prevCellCtrl) {
|
26673 | var cellInResult = res.map[prevCellCtrl.getColumn().getInstanceId()] != null;
|
26674 | if (cellInResult) {
|
26675 | return;
|
26676 | }
|
26677 | var keepCell = !_this.isCellEligibleToBeRemoved(prevCellCtrl, pinned);
|
26678 | if (keepCell) {
|
26679 | addCell(prevCellCtrl.getColumn().getInstanceId(), prevCellCtrl);
|
26680 | return;
|
26681 | }
|
26682 | prevCellCtrl.destroy();
|
26683 | });
|
26684 | return res;
|
26685 | };
|
26686 | RowCtrl.prototype.updateColumnListsImpl = function () {
|
26687 | var _this = this;
|
26688 | this.updateColumnListsPending = false;
|
26689 | var columnModel = this.beans.columnModel;
|
26690 | if (this.printLayout) {
|
26691 | this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, columnModel.getAllDisplayedColumns());
|
26692 | this.leftCellCtrls = { list: [], map: {} };
|
26693 | this.rightCellCtrls = { list: [], map: {} };
|
26694 | }
|
26695 | else {
|
26696 | var centerCols = columnModel.getViewportCenterColumnsForRow(this.rowNode);
|
26697 | this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, centerCols);
|
26698 | var leftCols = columnModel.getDisplayedLeftColumnsForRow(this.rowNode);
|
26699 | this.leftCellCtrls = this.createCellCtrls(this.leftCellCtrls, leftCols, 'left');
|
26700 | var rightCols = columnModel.getDisplayedRightColumnsForRow(this.rowNode);
|
26701 | this.rightCellCtrls = this.createCellCtrls(this.rightCellCtrls, rightCols, 'right');
|
26702 | }
|
26703 | this.allRowGuis.forEach(function (item) {
|
26704 | var cellControls = item.containerType === RowContainerType.LEFT ? _this.leftCellCtrls :
|
26705 | item.containerType === RowContainerType.RIGHT ? _this.rightCellCtrls : _this.centerCellCtrls;
|
26706 | item.rowComp.setCellCtrls(cellControls.list);
|
26707 | });
|
26708 | };
|
26709 | RowCtrl.prototype.isCellEligibleToBeRemoved = function (cellCtrl, nextContainerPinned) {
|
26710 | var REMOVE_CELL = true;
|
26711 | var KEEP_CELL = false;
|
26712 |
|
26713 | var column = cellCtrl.getColumn();
|
26714 | if (column.getPinned() != nextContainerPinned) {
|
26715 | return REMOVE_CELL;
|
26716 | }
|
26717 |
|
26718 | var editing = cellCtrl.isEditing();
|
26719 | var focused = this.beans.focusService.isCellFocused(cellCtrl.getCellPosition());
|
26720 | var mightWantToKeepCell = editing || focused;
|
26721 | if (mightWantToKeepCell) {
|
26722 | var column_1 = cellCtrl.getColumn();
|
26723 | var displayedColumns = this.beans.columnModel.getAllDisplayedColumns();
|
26724 | var cellStillDisplayed = displayedColumns.indexOf(column_1) >= 0;
|
26725 | return cellStillDisplayed ? KEEP_CELL : REMOVE_CELL;
|
26726 | }
|
26727 | return REMOVE_CELL;
|
26728 | };
|
26729 | RowCtrl.prototype.setAnimateFlags = function (animateIn) {
|
26730 | if (this.isSticky() || !animateIn) {
|
26731 | return;
|
26732 | }
|
26733 | var oldRowTopExists = exists(this.rowNode.oldRowTop);
|
26734 | var pinningLeft = this.beans.columnModel.isPinningLeft();
|
26735 | var pinningRight = this.beans.columnModel.isPinningRight();
|
26736 | if (oldRowTopExists) {
|
26737 |
|
26738 | this.slideInAnimation.center = true;
|
26739 | this.slideInAnimation.left = pinningLeft;
|
26740 | this.slideInAnimation.right = pinningRight;
|
26741 | }
|
26742 | else {
|
26743 |
|
26744 | this.fadeInAnimation.center = true;
|
26745 | this.fadeInAnimation.left = pinningLeft;
|
26746 | this.fadeInAnimation.right = pinningRight;
|
26747 | }
|
26748 | };
|
26749 | RowCtrl.prototype.isEditing = function () {
|
26750 | return this.editingRow;
|
26751 | };
|
26752 | RowCtrl.prototype.stopRowEditing = function (cancel) {
|
26753 | this.stopEditing(cancel);
|
26754 | };
|
26755 | RowCtrl.prototype.isFullWidth = function () {
|
26756 | return this.rowType !== RowType$1.Normal;
|
26757 | };
|
26758 | RowCtrl.prototype.getRowType = function () {
|
26759 | return this.rowType;
|
26760 | };
|
26761 | RowCtrl.prototype.refreshFullWidth = function () {
|
26762 | var _this = this;
|
26763 |
|
26764 | var tryRefresh = function (gui, pinned) {
|
26765 | if (!gui) {
|
26766 | return true;
|
26767 | }
|
26768 | var cellRenderer = gui.rowComp.getFullWidthCellRenderer();
|
26769 |
|
26770 |
|
26771 |
|
26772 |
|
26773 | if (!cellRenderer) {
|
26774 | return false;
|
26775 | }
|
26776 |
|
26777 | if (!cellRenderer.refresh) {
|
26778 | return false;
|
26779 | }
|
26780 | var params = _this.createFullWidthParams(gui.element, pinned);
|
26781 | var refreshSucceeded = cellRenderer.refresh(params);
|
26782 | return refreshSucceeded;
|
26783 | };
|
26784 | var fullWidthSuccess = tryRefresh(this.fullWidthGui, null);
|
26785 | var centerSuccess = tryRefresh(this.centerGui, null);
|
26786 | var leftSuccess = tryRefresh(this.leftGui, 'left');
|
26787 | var rightSuccess = tryRefresh(this.rightGui, 'right');
|
26788 | var allFullWidthRowsRefreshed = fullWidthSuccess && centerSuccess && leftSuccess && rightSuccess;
|
26789 | return allFullWidthRowsRefreshed;
|
26790 | };
|
26791 | RowCtrl.prototype.addListeners = function () {
|
26792 | var _this = this;
|
26793 | this.addManagedListener(this.rowNode, RowNode.EVENT_HEIGHT_CHANGED, function () { return _this.onRowHeightChanged(); });
|
26794 | this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_SELECTED, function () { return _this.onRowSelected(); });
|
26795 | this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_INDEX_CHANGED, this.onRowIndexChanged.bind(this));
|
26796 | this.addManagedListener(this.rowNode, RowNode.EVENT_TOP_CHANGED, this.onTopChanged.bind(this));
|
26797 | this.addManagedListener(this.rowNode, RowNode.EVENT_EXPANDED_CHANGED, this.updateExpandedCss.bind(this));
|
26798 | this.addManagedListener(this.rowNode, RowNode.EVENT_HAS_CHILDREN_CHANGED, this.updateExpandedCss.bind(this));
|
26799 | this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.onRowNodeDataChanged.bind(this));
|
26800 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.onRowNodeCellChanged.bind(this));
|
26801 | this.addManagedListener(this.rowNode, RowNode.EVENT_HIGHLIGHT_CHANGED, this.onRowNodeHighlightChanged.bind(this));
|
26802 | this.addManagedListener(this.rowNode, RowNode.EVENT_DRAGGING_CHANGED, this.onRowNodeDraggingChanged.bind(this));
|
26803 | this.addManagedListener(this.rowNode, RowNode.EVENT_UI_LEVEL_CHANGED, this.onUiLevelChanged.bind(this));
|
26804 | var eventService = this.beans.eventService;
|
26805 | this.addManagedListener(eventService, Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED, this.onPaginationPixelOffsetChanged.bind(this));
|
26806 | this.addManagedListener(eventService, Events.EVENT_HEIGHT_SCALE_CHANGED, this.onTopChanged.bind(this));
|
26807 | this.addManagedListener(eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
|
26808 | this.addManagedListener(eventService, Events.EVENT_VIRTUAL_COLUMNS_CHANGED, this.onVirtualColumnsChanged.bind(this));
|
26809 | this.addManagedListener(eventService, Events.EVENT_CELL_FOCUSED, this.onCellFocused.bind(this));
|
26810 | this.addManagedListener(eventService, Events.EVENT_CELL_FOCUS_CLEARED, this.onCellFocusCleared.bind(this));
|
26811 | this.addManagedListener(eventService, Events.EVENT_PAGINATION_CHANGED, this.onPaginationChanged.bind(this));
|
26812 | this.addManagedListener(eventService, Events.EVENT_MODEL_UPDATED, this.onModelUpdated.bind(this));
|
26813 | this.addManagedListener(eventService, Events.EVENT_COLUMN_MOVED, this.onColumnMoved.bind(this));
|
26814 | this.addListenersForCellComps();
|
26815 | };
|
26816 | RowCtrl.prototype.onColumnMoved = function () {
|
26817 | this.updateColumnLists();
|
26818 | };
|
26819 | RowCtrl.prototype.addListenersForCellComps = function () {
|
26820 | var _this = this;
|
26821 | this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_INDEX_CHANGED, function () {
|
26822 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onRowIndexChanged(); });
|
26823 | });
|
26824 | this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, function (event) {
|
26825 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onCellChanged(event); });
|
26826 | });
|
26827 | };
|
26828 | RowCtrl.prototype.onRowNodeDataChanged = function (event) {
|
26829 |
|
26830 |
|
26831 |
|
26832 | this.getAllCellCtrls().forEach(function (cellCtrl) {
|
26833 | return cellCtrl.refreshCell({
|
26834 | suppressFlash: !event.update,
|
26835 | newData: !event.update
|
26836 | });
|
26837 | });
|
26838 |
|
26839 |
|
26840 |
|
26841 |
|
26842 |
|
26843 | this.onRowSelected();
|
26844 |
|
26845 | this.postProcessCss();
|
26846 | };
|
26847 | RowCtrl.prototype.onRowNodeCellChanged = function () {
|
26848 |
|
26849 | this.postProcessCss();
|
26850 | };
|
26851 | RowCtrl.prototype.postProcessCss = function () {
|
26852 | this.setStylesFromGridOptions();
|
26853 | this.postProcessClassesFromGridOptions();
|
26854 | this.postProcessRowClassRules();
|
26855 | this.postProcessRowDragging();
|
26856 | };
|
26857 | RowCtrl.prototype.onRowNodeHighlightChanged = function () {
|
26858 | var highlighted = this.rowNode.highlighted;
|
26859 | this.allRowGuis.forEach(function (gui) {
|
26860 | var aboveOn = highlighted === RowHighlightPosition.Above;
|
26861 | var belowOn = highlighted === RowHighlightPosition.Below;
|
26862 | gui.rowComp.addOrRemoveCssClass('ag-row-highlight-above', aboveOn);
|
26863 | gui.rowComp.addOrRemoveCssClass('ag-row-highlight-below', belowOn);
|
26864 | });
|
26865 | };
|
26866 | RowCtrl.prototype.onRowNodeDraggingChanged = function () {
|
26867 | this.postProcessRowDragging();
|
26868 | };
|
26869 | RowCtrl.prototype.postProcessRowDragging = function () {
|
26870 | var dragging = this.rowNode.dragging;
|
26871 | this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-dragging', dragging); });
|
26872 | };
|
26873 | RowCtrl.prototype.updateExpandedCss = function () {
|
26874 | var expandable = this.rowNode.isExpandable();
|
26875 | var expanded = this.rowNode.expanded == true;
|
26876 | this.allRowGuis.forEach(function (gui) {
|
26877 | gui.rowComp.addOrRemoveCssClass('ag-row-group', expandable);
|
26878 | gui.rowComp.addOrRemoveCssClass('ag-row-group-expanded', expandable && expanded);
|
26879 | gui.rowComp.addOrRemoveCssClass('ag-row-group-contracted', expandable && !expanded);
|
26880 | setAriaExpanded(gui.element, expandable && expanded);
|
26881 | });
|
26882 | };
|
26883 | RowCtrl.prototype.onDisplayedColumnsChanged = function () {
|
26884 |
|
26885 |
|
26886 | this.updateColumnLists(true);
|
26887 | if (this.beans.columnModel.wasAutoRowHeightEverActive()) {
|
26888 | this.rowNode.checkAutoHeights();
|
26889 | }
|
26890 | };
|
26891 | RowCtrl.prototype.onVirtualColumnsChanged = function () {
|
26892 | this.updateColumnLists();
|
26893 | };
|
26894 | RowCtrl.prototype.getRowPosition = function () {
|
26895 | return {
|
26896 | rowPinned: makeNull(this.rowNode.rowPinned),
|
26897 | rowIndex: this.rowNode.rowIndex
|
26898 | };
|
26899 | };
|
26900 | RowCtrl.prototype.onKeyboardNavigate = function (keyboardEvent) {
|
26901 | var currentFullWidthComp = this.allRowGuis.find(function (c) { return c.element.contains(keyboardEvent.target); });
|
26902 | var currentFullWidthContainer = currentFullWidthComp ? currentFullWidthComp.element : null;
|
26903 | var isFullWidthContainerFocused = currentFullWidthContainer === keyboardEvent.target;
|
26904 | if (!isFullWidthContainerFocused) {
|
26905 | return;
|
26906 | }
|
26907 | var node = this.rowNode;
|
26908 | var lastFocusedCell = this.beans.focusService.getFocusedCell();
|
26909 | var cellPosition = {
|
26910 | rowIndex: node.rowIndex,
|
26911 | rowPinned: node.rowPinned,
|
26912 | column: (lastFocusedCell && lastFocusedCell.column)
|
26913 | };
|
26914 | this.beans.navigationService.navigateToNextCell(keyboardEvent, keyboardEvent.key, cellPosition, true);
|
26915 | keyboardEvent.preventDefault();
|
26916 | };
|
26917 | RowCtrl.prototype.onTabKeyDown = function (keyboardEvent) {
|
26918 | if (keyboardEvent.defaultPrevented || isStopPropagationForAgGrid(keyboardEvent)) {
|
26919 | return;
|
26920 | }
|
26921 | var currentFullWidthComp = this.allRowGuis.find(function (c) { return c.element.contains(keyboardEvent.target); });
|
26922 | var currentFullWidthContainer = currentFullWidthComp ? currentFullWidthComp.element : null;
|
26923 | var isFullWidthContainerFocused = currentFullWidthContainer === keyboardEvent.target;
|
26924 | var nextEl = null;
|
26925 | if (!isFullWidthContainerFocused) {
|
26926 | nextEl = this.beans.focusService.findNextFocusableElement(currentFullWidthContainer, false, keyboardEvent.shiftKey);
|
26927 | }
|
26928 | if ((this.isFullWidth() && isFullWidthContainerFocused) || !nextEl) {
|
26929 | this.beans.navigationService.onTabKeyDown(this, keyboardEvent);
|
26930 | }
|
26931 | };
|
26932 | RowCtrl.prototype.onFullWidthRowFocused = function (event) {
|
26933 | var _a;
|
26934 | var node = this.rowNode;
|
26935 | var isFocused = !event ? false : this.isFullWidth() && event.rowIndex === node.rowIndex && event.rowPinned == node.rowPinned;
|
26936 | var element = this.fullWidthGui ? this.fullWidthGui.element : (_a = this.centerGui) === null || _a === void 0 ? void 0 : _a.element;
|
26937 | if (!element) {
|
26938 | return;
|
26939 | }
|
26940 | element.classList.toggle('ag-full-width-focus', isFocused);
|
26941 | if (isFocused) {
|
26942 |
|
26943 |
|
26944 | element.focus({ preventScroll: true });
|
26945 | }
|
26946 | };
|
26947 | RowCtrl.prototype.refreshCell = function (cellCtrl) {
|
26948 | this.centerCellCtrls = this.removeCellCtrl(this.centerCellCtrls, cellCtrl);
|
26949 | this.leftCellCtrls = this.removeCellCtrl(this.leftCellCtrls, cellCtrl);
|
26950 | this.rightCellCtrls = this.removeCellCtrl(this.rightCellCtrls, cellCtrl);
|
26951 | this.updateColumnLists();
|
26952 | };
|
26953 | RowCtrl.prototype.removeCellCtrl = function (prev, cellCtrlToRemove) {
|
26954 | var res = {
|
26955 | list: [],
|
26956 | map: {}
|
26957 | };
|
26958 | prev.list.forEach(function (cellCtrl) {
|
26959 | if (cellCtrl === cellCtrlToRemove) {
|
26960 | return;
|
26961 | }
|
26962 | res.list.push(cellCtrl);
|
26963 | res.map[cellCtrl.getInstanceId()] = cellCtrl;
|
26964 | });
|
26965 | return res;
|
26966 | };
|
26967 | RowCtrl.prototype.onMouseEvent = function (eventName, mouseEvent) {
|
26968 | switch (eventName) {
|
26969 | case 'dblclick':
|
26970 | this.onRowDblClick(mouseEvent);
|
26971 | break;
|
26972 | case 'click':
|
26973 | this.onRowClick(mouseEvent);
|
26974 | break;
|
26975 | case 'touchstart':
|
26976 | case 'mousedown':
|
26977 | this.onRowMouseDown(mouseEvent);
|
26978 | break;
|
26979 | }
|
26980 | };
|
26981 | RowCtrl.prototype.createRowEvent = function (type, domEvent) {
|
26982 | return {
|
26983 | type: type,
|
26984 | node: this.rowNode,
|
26985 | data: this.rowNode.data,
|
26986 | rowIndex: this.rowNode.rowIndex,
|
26987 | rowPinned: this.rowNode.rowPinned,
|
26988 | context: this.beans.gridOptionsService.context,
|
26989 | api: this.beans.gridOptionsService.api,
|
26990 | columnApi: this.beans.gridOptionsService.columnApi,
|
26991 | event: domEvent
|
26992 | };
|
26993 | };
|
26994 | RowCtrl.prototype.createRowEventWithSource = function (type, domEvent) {
|
26995 | var event = this.createRowEvent(type, domEvent);
|
26996 |
|
26997 |
|
26998 |
|
26999 |
|
27000 |
|
27001 |
|
27002 | event.source = this;
|
27003 | return event;
|
27004 | };
|
27005 | RowCtrl.prototype.onRowDblClick = function (mouseEvent) {
|
27006 | if (isStopPropagationForAgGrid(mouseEvent)) {
|
27007 | return;
|
27008 | }
|
27009 | var agEvent = this.createRowEventWithSource(Events.EVENT_ROW_DOUBLE_CLICKED, mouseEvent);
|
27010 | this.beans.eventService.dispatchEvent(agEvent);
|
27011 | };
|
27012 | RowCtrl.prototype.onRowMouseDown = function (mouseEvent) {
|
27013 | this.lastMouseDownOnDragger = isElementChildOfClass(mouseEvent.target, 'ag-row-drag', 3);
|
27014 | if (!this.isFullWidth()) {
|
27015 | return;
|
27016 | }
|
27017 | var node = this.rowNode;
|
27018 | var columnModel = this.beans.columnModel;
|
27019 | if (this.beans.rangeService) {
|
27020 | this.beans.rangeService.removeAllCellRanges();
|
27021 | }
|
27022 | this.beans.focusService.setFocusedCell({
|
27023 | rowIndex: node.rowIndex,
|
27024 | column: columnModel.getAllDisplayedColumns()[0],
|
27025 | rowPinned: node.rowPinned,
|
27026 | forceBrowserFocus: true
|
27027 | });
|
27028 | };
|
27029 | RowCtrl.prototype.onRowClick = function (mouseEvent) {
|
27030 | var stop = isStopPropagationForAgGrid(mouseEvent) || this.lastMouseDownOnDragger;
|
27031 | if (stop) {
|
27032 | return;
|
27033 | }
|
27034 | var agEvent = this.createRowEventWithSource(Events.EVENT_ROW_CLICKED, mouseEvent);
|
27035 | this.beans.eventService.dispatchEvent(agEvent);
|
27036 |
|
27037 | var multiSelectKeyPressed = mouseEvent.ctrlKey || mouseEvent.metaKey;
|
27038 | var shiftKeyPressed = mouseEvent.shiftKey;
|
27039 |
|
27040 |
|
27041 |
|
27042 |
|
27043 |
|
27044 |
|
27045 | var groupSelectsChildren = this.beans.gridOptionsService.is('groupSelectsChildren');
|
27046 | if (
|
27047 |
|
27048 |
|
27049 | (groupSelectsChildren && this.rowNode.group) ||
|
27050 |
|
27051 |
|
27052 | !this.rowNode.selectable ||
|
27053 |
|
27054 | this.rowNode.rowPinned ||
|
27055 |
|
27056 | !this.beans.gridOptionsService.isRowSelection() ||
|
27057 |
|
27058 | this.beans.gridOptionsService.is('suppressRowClickSelection')) {
|
27059 | return;
|
27060 | }
|
27061 | var multiSelectOnClick = this.beans.gridOptionsService.is('rowMultiSelectWithClick');
|
27062 | var rowDeselectionWithCtrl = !this.beans.gridOptionsService.is('suppressRowDeselection');
|
27063 | var source = 'rowClicked';
|
27064 | if (this.rowNode.isSelected()) {
|
27065 | if (multiSelectOnClick) {
|
27066 | this.rowNode.setSelectedParams({ newValue: false, event: mouseEvent, source: source });
|
27067 | }
|
27068 | else if (multiSelectKeyPressed) {
|
27069 | if (rowDeselectionWithCtrl) {
|
27070 | this.rowNode.setSelectedParams({ newValue: false, event: mouseEvent, source: source });
|
27071 | }
|
27072 | }
|
27073 | else {
|
27074 |
|
27075 | this.rowNode.setSelectedParams({ newValue: true, clearSelection: !shiftKeyPressed, rangeSelect: shiftKeyPressed, event: mouseEvent, source: source });
|
27076 | }
|
27077 | }
|
27078 | else {
|
27079 | var clearSelection = multiSelectOnClick ? false : !multiSelectKeyPressed;
|
27080 | this.rowNode.setSelectedParams({ newValue: true, clearSelection: clearSelection, rangeSelect: shiftKeyPressed, event: mouseEvent, source: source });
|
27081 | }
|
27082 | };
|
27083 | RowCtrl.prototype.setupDetailRowAutoHeight = function (eDetailGui) {
|
27084 | var _this = this;
|
27085 | if (this.rowType !== RowType$1.FullWidthDetail) {
|
27086 | return;
|
27087 | }
|
27088 | if (!this.beans.gridOptionsService.is('detailRowAutoHeight')) {
|
27089 | return;
|
27090 | }
|
27091 | var checkRowSizeFunc = function () {
|
27092 | var clientHeight = eDetailGui.clientHeight;
|
27093 |
|
27094 |
|
27095 |
|
27096 |
|
27097 | if (clientHeight != null && clientHeight > 0) {
|
27098 |
|
27099 |
|
27100 | var updateRowHeightFunc = function () {
|
27101 | _this.rowNode.setRowHeight(clientHeight);
|
27102 | if (_this.beans.clientSideRowModel) {
|
27103 | _this.beans.clientSideRowModel.onRowHeightChanged();
|
27104 | }
|
27105 | else if (_this.beans.serverSideRowModel) {
|
27106 | _this.beans.serverSideRowModel.onRowHeightChanged();
|
27107 | }
|
27108 | };
|
27109 | _this.beans.frameworkOverrides.setTimeout(updateRowHeightFunc, 0);
|
27110 | }
|
27111 | };
|
27112 | var resizeObserverDestroyFunc = this.beans.resizeObserverService.observeResize(eDetailGui, checkRowSizeFunc);
|
27113 | this.addDestroyFunc(resizeObserverDestroyFunc);
|
27114 | checkRowSizeFunc();
|
27115 | };
|
27116 | RowCtrl.prototype.createFullWidthParams = function (eRow, pinned) {
|
27117 | var _this = this;
|
27118 | var params = {
|
27119 | fullWidth: true,
|
27120 | data: this.rowNode.data,
|
27121 | node: this.rowNode,
|
27122 | value: this.rowNode.key,
|
27123 | valueFormatted: this.rowNode.key,
|
27124 | rowIndex: this.rowNode.rowIndex,
|
27125 | api: this.beans.gridOptionsService.api,
|
27126 | columnApi: this.beans.gridOptionsService.columnApi,
|
27127 | context: this.beans.gridOptionsService.context,
|
27128 |
|
27129 | eGridCell: eRow,
|
27130 | eParentOfValue: eRow,
|
27131 | pinned: pinned,
|
27132 | addRenderedRowListener: this.addEventListener.bind(this),
|
27133 | registerRowDragger: function (rowDraggerElement, dragStartPixels, value, suppressVisibilityChange) { return _this.addFullWidthRowDragging(rowDraggerElement, dragStartPixels, value, suppressVisibilityChange); }
|
27134 | };
|
27135 | return params;
|
27136 | };
|
27137 | RowCtrl.prototype.addFullWidthRowDragging = function (rowDraggerElement, dragStartPixels, value, suppressVisibilityChange) {
|
27138 | if (value === void 0) { value = ''; }
|
27139 | if (!this.isFullWidth()) {
|
27140 | return;
|
27141 | }
|
27142 | var rowDragComp = new RowDragComp(function () { return value; }, this.rowNode, undefined, rowDraggerElement, dragStartPixels, suppressVisibilityChange);
|
27143 | this.createManagedBean(rowDragComp, this.beans.context);
|
27144 | };
|
27145 | RowCtrl.prototype.onUiLevelChanged = function () {
|
27146 | var newLevel = this.beans.rowCssClassCalculator.calculateRowLevel(this.rowNode);
|
27147 | if (this.rowLevel != newLevel) {
|
27148 | var classToAdd_1 = 'ag-row-level-' + newLevel;
|
27149 | var classToRemove_1 = 'ag-row-level-' + this.rowLevel;
|
27150 | this.allRowGuis.forEach(function (gui) {
|
27151 | gui.rowComp.addOrRemoveCssClass(classToAdd_1, true);
|
27152 | gui.rowComp.addOrRemoveCssClass(classToRemove_1, false);
|
27153 | });
|
27154 | }
|
27155 | this.rowLevel = newLevel;
|
27156 | };
|
27157 | RowCtrl.prototype.isFirstRowOnPage = function () {
|
27158 | return this.rowNode.rowIndex === this.beans.paginationProxy.getPageFirstRow();
|
27159 | };
|
27160 | RowCtrl.prototype.isLastRowOnPage = function () {
|
27161 | return this.rowNode.rowIndex === this.beans.paginationProxy.getPageLastRow();
|
27162 | };
|
27163 | RowCtrl.prototype.onModelUpdated = function () {
|
27164 | this.refreshFirstAndLastRowStyles();
|
27165 | };
|
27166 | RowCtrl.prototype.refreshFirstAndLastRowStyles = function () {
|
27167 | var newFirst = this.isFirstRowOnPage();
|
27168 | var newLast = this.isLastRowOnPage();
|
27169 | if (this.firstRowOnPage !== newFirst) {
|
27170 | this.firstRowOnPage = newFirst;
|
27171 | this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-first', newFirst); });
|
27172 | }
|
27173 | if (this.lastRowOnPage !== newLast) {
|
27174 | this.lastRowOnPage = newLast;
|
27175 | this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-last', newLast); });
|
27176 | }
|
27177 | };
|
27178 | RowCtrl.prototype.stopEditing = function (cancel) {
|
27179 | var e_1, _a;
|
27180 | if (cancel === void 0) { cancel = false; }
|
27181 |
|
27182 |
|
27183 | if (this.stoppingRowEdit) {
|
27184 | return;
|
27185 | }
|
27186 | var cellControls = this.getAllCellCtrls();
|
27187 | var isRowEdit = this.editingRow;
|
27188 | this.stoppingRowEdit = true;
|
27189 | var fireRowEditEvent = false;
|
27190 | try {
|
27191 | for (var cellControls_1 = __values$3(cellControls), cellControls_1_1 = cellControls_1.next(); !cellControls_1_1.done; cellControls_1_1 = cellControls_1.next()) {
|
27192 | var ctrl = cellControls_1_1.value;
|
27193 | var valueChanged = ctrl.stopEditing(cancel);
|
27194 | if (isRowEdit && !cancel && !fireRowEditEvent && valueChanged) {
|
27195 | fireRowEditEvent = true;
|
27196 | }
|
27197 | }
|
27198 | }
|
27199 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
27200 | finally {
|
27201 | try {
|
27202 | if (cellControls_1_1 && !cellControls_1_1.done && (_a = cellControls_1.return)) _a.call(cellControls_1);
|
27203 | }
|
27204 | finally { if (e_1) throw e_1.error; }
|
27205 | }
|
27206 | if (fireRowEditEvent) {
|
27207 | var event_1 = this.createRowEvent(Events.EVENT_ROW_VALUE_CHANGED);
|
27208 | this.beans.eventService.dispatchEvent(event_1);
|
27209 | }
|
27210 | if (isRowEdit) {
|
27211 | this.setEditingRow(false);
|
27212 | }
|
27213 | this.stoppingRowEdit = false;
|
27214 | };
|
27215 | RowCtrl.prototype.setInlineEditingCss = function (editing) {
|
27216 | this.allRowGuis.forEach(function (gui) {
|
27217 | gui.rowComp.addOrRemoveCssClass("ag-row-inline-editing", editing);
|
27218 | gui.rowComp.addOrRemoveCssClass("ag-row-not-inline-editing", !editing);
|
27219 | });
|
27220 | };
|
27221 | RowCtrl.prototype.setEditingRow = function (value) {
|
27222 | this.editingRow = value;
|
27223 | this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-editing', value); });
|
27224 | var event = value ?
|
27225 | this.createRowEvent(Events.EVENT_ROW_EDITING_STARTED)
|
27226 | : this.createRowEvent(Events.EVENT_ROW_EDITING_STOPPED);
|
27227 | this.beans.eventService.dispatchEvent(event);
|
27228 | };
|
27229 | RowCtrl.prototype.startRowEditing = function (key, charPress, sourceRenderedCell, event) {
|
27230 | if (key === void 0) { key = null; }
|
27231 | if (charPress === void 0) { charPress = null; }
|
27232 | if (sourceRenderedCell === void 0) { sourceRenderedCell = null; }
|
27233 | if (event === void 0) { event = null; }
|
27234 |
|
27235 | if (this.editingRow) {
|
27236 | return;
|
27237 | }
|
27238 | var atLeastOneEditing = this.getAllCellCtrls().reduce(function (prev, cellCtrl) {
|
27239 | var cellStartedEdit = cellCtrl === sourceRenderedCell;
|
27240 | if (cellStartedEdit) {
|
27241 | cellCtrl.startEditing(key, charPress, cellStartedEdit, event);
|
27242 | }
|
27243 | else {
|
27244 | cellCtrl.startEditing(null, null, cellStartedEdit, event);
|
27245 | }
|
27246 | if (prev) {
|
27247 | return true;
|
27248 | }
|
27249 | return cellCtrl.isEditing();
|
27250 | }, false);
|
27251 | if (atLeastOneEditing) {
|
27252 | this.setEditingRow(true);
|
27253 | }
|
27254 | };
|
27255 | RowCtrl.prototype.getAllCellCtrls = function () {
|
27256 | if (this.leftCellCtrls.list.length === 0 && this.rightCellCtrls.list.length === 0) {
|
27257 | return this.centerCellCtrls.list;
|
27258 | }
|
27259 | var res = __spread$g(this.centerCellCtrls.list, this.leftCellCtrls.list, this.rightCellCtrls.list);
|
27260 | return res;
|
27261 | };
|
27262 | RowCtrl.prototype.postProcessClassesFromGridOptions = function () {
|
27263 | var _this = this;
|
27264 | var cssClasses = this.beans.rowCssClassCalculator.processClassesFromGridOptions(this.rowNode);
|
27265 | if (!cssClasses || !cssClasses.length) {
|
27266 | return;
|
27267 | }
|
27268 | cssClasses.forEach(function (classStr) {
|
27269 | _this.allRowGuis.forEach(function (c) { return c.rowComp.addOrRemoveCssClass(classStr, true); });
|
27270 | });
|
27271 | };
|
27272 | RowCtrl.prototype.postProcessRowClassRules = function () {
|
27273 | var _this = this;
|
27274 | this.beans.rowCssClassCalculator.processRowClassRules(this.rowNode, function (className) {
|
27275 | _this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass(className, true); });
|
27276 | }, function (className) {
|
27277 | _this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass(className, false); });
|
27278 | });
|
27279 | };
|
27280 | RowCtrl.prototype.setStylesFromGridOptions = function (gui) {
|
27281 | var rowStyles = this.processStylesFromGridOptions();
|
27282 | this.forEachGui(gui, function (gui) { return gui.rowComp.setUserStyles(rowStyles); });
|
27283 | };
|
27284 | RowCtrl.prototype.getPinnedForContainer = function (rowContainerType) {
|
27285 | var pinned = rowContainerType === RowContainerType.LEFT
|
27286 | ? 'left'
|
27287 | : rowContainerType === RowContainerType.RIGHT
|
27288 | ? 'right'
|
27289 | : null;
|
27290 | return pinned;
|
27291 | };
|
27292 | RowCtrl.prototype.getInitialRowClasses = function (rowContainerType) {
|
27293 | var pinned = this.getPinnedForContainer(rowContainerType);
|
27294 | var params = {
|
27295 | rowNode: this.rowNode,
|
27296 | rowFocused: this.rowFocused,
|
27297 | fadeRowIn: this.fadeInAnimation[rowContainerType],
|
27298 | rowIsEven: this.rowNode.rowIndex % 2 === 0,
|
27299 | rowLevel: this.rowLevel,
|
27300 | fullWidthRow: this.isFullWidth(),
|
27301 | firstRowOnPage: this.isFirstRowOnPage(),
|
27302 | lastRowOnPage: this.isLastRowOnPage(),
|
27303 | printLayout: this.printLayout,
|
27304 | expandable: this.rowNode.isExpandable(),
|
27305 | pinned: pinned
|
27306 | };
|
27307 | return this.beans.rowCssClassCalculator.getInitialRowClasses(params);
|
27308 | };
|
27309 | RowCtrl.prototype.processStylesFromGridOptions = function () {
|
27310 |
|
27311 | var rowStyle = this.beans.gridOptionsService.get('rowStyle');
|
27312 | if (rowStyle && typeof rowStyle === 'function') {
|
27313 | console.warn('AG Grid: rowStyle should be an object of key/value styles, not be a function, use getRowStyle() instead');
|
27314 | return;
|
27315 | }
|
27316 |
|
27317 | var rowStyleFunc = this.beans.gridOptionsService.getCallback('getRowStyle');
|
27318 | var rowStyleFuncResult;
|
27319 | if (rowStyleFunc) {
|
27320 | var params = {
|
27321 | data: this.rowNode.data,
|
27322 | node: this.rowNode,
|
27323 | rowIndex: this.rowNode.rowIndex
|
27324 | };
|
27325 | rowStyleFuncResult = rowStyleFunc(params);
|
27326 | }
|
27327 | return Object.assign({}, rowStyle, rowStyleFuncResult);
|
27328 | };
|
27329 | RowCtrl.prototype.onRowSelected = function (gui) {
|
27330 | var _this = this;
|
27331 |
|
27332 |
|
27333 | var selected = !!this.rowNode.isSelected();
|
27334 | this.forEachGui(gui, function (gui) {
|
27335 | gui.rowComp.addOrRemoveCssClass('ag-row-selected', selected);
|
27336 | setAriaSelected(gui.element, selected ? true : undefined);
|
27337 | var ariaLabel = _this.createAriaLabel();
|
27338 | setAriaLabel(gui.element, ariaLabel == null ? '' : ariaLabel);
|
27339 | });
|
27340 | };
|
27341 | RowCtrl.prototype.createAriaLabel = function () {
|
27342 | var selected = this.rowNode.isSelected();
|
27343 | if (selected && this.beans.gridOptionsService.is('suppressRowDeselection')) {
|
27344 | return undefined;
|
27345 | }
|
27346 | var translate = this.beans.localeService.getLocaleTextFunc();
|
27347 | var label = translate(selected ? 'ariaRowDeselect' : 'ariaRowSelect', "Press SPACE to " + (selected ? 'deselect' : 'select') + " this row.");
|
27348 | return label;
|
27349 | };
|
27350 | RowCtrl.prototype.isUseAnimationFrameForCreate = function () {
|
27351 | return this.useAnimationFrameForCreate;
|
27352 | };
|
27353 | RowCtrl.prototype.addHoverFunctionality = function (eRow) {
|
27354 | var _this = this;
|
27355 |
|
27356 |
|
27357 | if (!this.active) {
|
27358 | return;
|
27359 | }
|
27360 |
|
27361 |
|
27362 |
|
27363 |
|
27364 |
|
27365 |
|
27366 |
|
27367 | this.addManagedListener(eRow, 'mouseenter', function () { return _this.rowNode.onMouseEnter(); });
|
27368 | this.addManagedListener(eRow, 'mouseleave', function () { return _this.rowNode.onMouseLeave(); });
|
27369 |
|
27370 | this.addManagedListener(this.rowNode, RowNode.EVENT_MOUSE_ENTER, function () {
|
27371 |
|
27372 |
|
27373 |
|
27374 | if (!_this.beans.dragService.isDragging() &&
|
27375 | !_this.beans.gridOptionsService.is('suppressRowHoverHighlight')) {
|
27376 | eRow.classList.add('ag-row-hover');
|
27377 | }
|
27378 | });
|
27379 | this.addManagedListener(this.rowNode, RowNode.EVENT_MOUSE_LEAVE, function () {
|
27380 | eRow.classList.remove('ag-row-hover');
|
27381 | });
|
27382 | };
|
27383 |
|
27384 |
|
27385 |
|
27386 |
|
27387 | RowCtrl.prototype.roundRowTopToBounds = function (rowTop) {
|
27388 | var gridBodyCon = this.beans.ctrlsService.getGridBodyCtrl();
|
27389 | var range = gridBodyCon.getScrollFeature().getVScrollPosition();
|
27390 | var minPixel = this.applyPaginationOffset(range.top, true) - 100;
|
27391 | var maxPixel = this.applyPaginationOffset(range.bottom, true) + 100;
|
27392 | return Math.min(Math.max(minPixel, rowTop), maxPixel);
|
27393 | };
|
27394 | RowCtrl.prototype.getFrameworkOverrides = function () {
|
27395 | return this.beans.frameworkOverrides;
|
27396 | };
|
27397 | RowCtrl.prototype.forEachGui = function (gui, callback) {
|
27398 | var list = gui ? [gui] : this.allRowGuis;
|
27399 | list.forEach(callback);
|
27400 | };
|
27401 | RowCtrl.prototype.onRowHeightChanged = function (gui) {
|
27402 |
|
27403 |
|
27404 |
|
27405 | if (this.rowNode.rowHeight == null) {
|
27406 | return;
|
27407 | }
|
27408 | var rowHeight = this.rowNode.rowHeight;
|
27409 | var defaultRowHeight = this.beans.environment.getDefaultRowHeight();
|
27410 | var isHeightFromFunc = this.beans.gridOptionsService.isGetRowHeightFunction();
|
27411 | var heightFromFunc = isHeightFromFunc ? this.beans.gridOptionsService.getRowHeightForNode(this.rowNode).height : undefined;
|
27412 | var lineHeight = heightFromFunc ? Math.min(defaultRowHeight, heightFromFunc) - 2 + "px" : undefined;
|
27413 | this.forEachGui(gui, function (gui) {
|
27414 | gui.element.style.height = rowHeight + "px";
|
27415 |
|
27416 |
|
27417 |
|
27418 |
|
27419 |
|
27420 |
|
27421 |
|
27422 |
|
27423 |
|
27424 |
|
27425 | if (lineHeight) {
|
27426 | gui.element.style.setProperty('--ag-line-height', lineHeight);
|
27427 | }
|
27428 | });
|
27429 | };
|
27430 | RowCtrl.prototype.addEventListener = function (eventType, listener) {
|
27431 | _super.prototype.addEventListener.call(this, eventType, listener);
|
27432 | };
|
27433 | RowCtrl.prototype.removeEventListener = function (eventType, listener) {
|
27434 | _super.prototype.removeEventListener.call(this, eventType, listener);
|
27435 | };
|
27436 |
|
27437 | RowCtrl.prototype.destroyFirstPass = function () {
|
27438 | this.active = false;
|
27439 |
|
27440 |
|
27441 | this.setupRemoveAnimation();
|
27442 | var event = this.createRowEvent(Events.EVENT_VIRTUAL_ROW_REMOVED);
|
27443 | this.dispatchEvent(event);
|
27444 | this.beans.eventService.dispatchEvent(event);
|
27445 | _super.prototype.destroy.call(this);
|
27446 | };
|
27447 | RowCtrl.prototype.setupRemoveAnimation = function () {
|
27448 |
|
27449 | if (this.isSticky()) {
|
27450 | return;
|
27451 | }
|
27452 | var rowStillVisibleJustNotInViewport = this.rowNode.rowTop != null;
|
27453 | if (rowStillVisibleJustNotInViewport) {
|
27454 |
|
27455 |
|
27456 |
|
27457 |
|
27458 | var rowTop = this.roundRowTopToBounds(this.rowNode.rowTop);
|
27459 | this.setRowTop(rowTop);
|
27460 | }
|
27461 | else {
|
27462 | this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-opacity-zero', true); });
|
27463 | }
|
27464 | };
|
27465 | RowCtrl.prototype.destroySecondPass = function () {
|
27466 | this.allRowGuis.length = 0;
|
27467 | var destroyCellCtrls = function (ctrls) {
|
27468 | ctrls.list.forEach(function (c) { return c.destroy(); });
|
27469 | return { list: [], map: {} };
|
27470 | };
|
27471 | this.centerCellCtrls = destroyCellCtrls(this.centerCellCtrls);
|
27472 | this.leftCellCtrls = destroyCellCtrls(this.leftCellCtrls);
|
27473 | this.rightCellCtrls = destroyCellCtrls(this.rightCellCtrls);
|
27474 | };
|
27475 | RowCtrl.prototype.setFocusedClasses = function (gui) {
|
27476 | var _this = this;
|
27477 | this.forEachGui(gui, function (gui) {
|
27478 | gui.rowComp.addOrRemoveCssClass('ag-row-focus', _this.rowFocused);
|
27479 | gui.rowComp.addOrRemoveCssClass('ag-row-no-focus', !_this.rowFocused);
|
27480 | });
|
27481 | };
|
27482 | RowCtrl.prototype.onCellFocused = function () {
|
27483 | this.onCellFocusChanged();
|
27484 | };
|
27485 | RowCtrl.prototype.onCellFocusCleared = function () {
|
27486 | this.onCellFocusChanged();
|
27487 | };
|
27488 | RowCtrl.prototype.onCellFocusChanged = function () {
|
27489 | var rowFocused = this.beans.focusService.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned);
|
27490 | if (rowFocused !== this.rowFocused) {
|
27491 | this.rowFocused = rowFocused;
|
27492 | this.setFocusedClasses();
|
27493 | }
|
27494 |
|
27495 | if (!rowFocused && this.editingRow) {
|
27496 | this.stopEditing(false);
|
27497 | }
|
27498 | };
|
27499 | RowCtrl.prototype.onPaginationChanged = function () {
|
27500 | var currentPage = this.beans.paginationProxy.getCurrentPage();
|
27501 |
|
27502 |
|
27503 | if (this.paginationPage !== currentPage) {
|
27504 | this.paginationPage = currentPage;
|
27505 | this.onTopChanged();
|
27506 | }
|
27507 | this.refreshFirstAndLastRowStyles();
|
27508 | };
|
27509 | RowCtrl.prototype.onTopChanged = function () {
|
27510 | this.setRowTop(this.rowNode.rowTop);
|
27511 | };
|
27512 | RowCtrl.prototype.onPaginationPixelOffsetChanged = function () {
|
27513 |
|
27514 | this.onTopChanged();
|
27515 | };
|
27516 |
|
27517 |
|
27518 |
|
27519 | RowCtrl.prototype.applyPaginationOffset = function (topPx, reverse) {
|
27520 | if (reverse === void 0) { reverse = false; }
|
27521 | if (this.rowNode.isRowPinned()) {
|
27522 | return topPx;
|
27523 | }
|
27524 | var pixelOffset = this.beans.paginationProxy.getPixelOffset();
|
27525 | var multiplier = reverse ? 1 : -1;
|
27526 | return topPx + (pixelOffset * multiplier);
|
27527 | };
|
27528 | RowCtrl.prototype.setRowTop = function (pixels) {
|
27529 |
|
27530 | if (this.printLayout) {
|
27531 | return;
|
27532 | }
|
27533 |
|
27534 |
|
27535 | if (exists(pixels)) {
|
27536 | var afterPaginationPixels = this.applyPaginationOffset(pixels);
|
27537 | var afterScalingPixels = this.rowNode.isRowPinned() ? afterPaginationPixels : this.beans.rowContainerHeightService.getRealPixelPosition(afterPaginationPixels);
|
27538 | var topPx = afterScalingPixels + "px";
|
27539 | this.setRowTopStyle(topPx);
|
27540 | }
|
27541 | };
|
27542 |
|
27543 |
|
27544 |
|
27545 |
|
27546 |
|
27547 |
|
27548 |
|
27549 | RowCtrl.prototype.getInitialRowTop = function (rowContainerType) {
|
27550 | var suppressRowTransform = this.beans.gridOptionsService.is('suppressRowTransform');
|
27551 | return suppressRowTransform ? this.getInitialRowTopShared(rowContainerType) : undefined;
|
27552 | };
|
27553 | RowCtrl.prototype.getInitialTransform = function (rowContainerType) {
|
27554 | var suppressRowTransform = this.beans.gridOptionsService.is('suppressRowTransform');
|
27555 | return suppressRowTransform ? undefined : "translateY(" + this.getInitialRowTopShared(rowContainerType) + ")";
|
27556 | };
|
27557 | RowCtrl.prototype.getInitialRowTopShared = function (rowContainerType) {
|
27558 |
|
27559 | if (this.printLayout) {
|
27560 | return '';
|
27561 | }
|
27562 | var rowTop;
|
27563 | if (this.isSticky()) {
|
27564 | rowTop = this.rowNode.stickyRowTop;
|
27565 | }
|
27566 | else {
|
27567 |
|
27568 | var pixels = this.slideInAnimation[rowContainerType] ? this.roundRowTopToBounds(this.rowNode.oldRowTop) : this.rowNode.rowTop;
|
27569 | var afterPaginationPixels = this.applyPaginationOffset(pixels);
|
27570 |
|
27571 | rowTop = this.rowNode.isRowPinned() ? afterPaginationPixels : this.beans.rowContainerHeightService.getRealPixelPosition(afterPaginationPixels);
|
27572 | }
|
27573 | return rowTop + 'px';
|
27574 | };
|
27575 | RowCtrl.prototype.setRowTopStyle = function (topPx) {
|
27576 | var suppressRowTransform = this.beans.gridOptionsService.is('suppressRowTransform');
|
27577 | this.allRowGuis.forEach(function (gui) { return suppressRowTransform ?
|
27578 | gui.rowComp.setTop(topPx) :
|
27579 | gui.rowComp.setTransform("translateY(" + topPx + ")"); });
|
27580 | };
|
27581 | RowCtrl.prototype.getRowNode = function () {
|
27582 | return this.rowNode;
|
27583 | };
|
27584 | RowCtrl.prototype.getCellCtrl = function (column) {
|
27585 |
|
27586 | var res = null;
|
27587 | this.getAllCellCtrls().forEach(function (cellCtrl) {
|
27588 | if (cellCtrl.getColumn() == column) {
|
27589 | res = cellCtrl;
|
27590 | }
|
27591 | });
|
27592 | if (res != null) {
|
27593 | return res;
|
27594 | }
|
27595 |
|
27596 |
|
27597 |
|
27598 |
|
27599 |
|
27600 | this.getAllCellCtrls().forEach(function (cellCtrl) {
|
27601 | if (cellCtrl.getColSpanningList().indexOf(column) >= 0) {
|
27602 | res = cellCtrl;
|
27603 | }
|
27604 | });
|
27605 | return res;
|
27606 | };
|
27607 | RowCtrl.prototype.onRowIndexChanged = function () {
|
27608 |
|
27609 |
|
27610 |
|
27611 | if (this.rowNode.rowIndex != null) {
|
27612 | this.onCellFocusChanged();
|
27613 | this.updateRowIndexes();
|
27614 | this.postProcessCss();
|
27615 | }
|
27616 | };
|
27617 | RowCtrl.prototype.updateRowIndexes = function (gui) {
|
27618 | var rowIndexStr = this.rowNode.getRowIndexString();
|
27619 | var headerRowCount = this.beans.headerNavigationService.getHeaderRowCount();
|
27620 | var rowIsEven = this.rowNode.rowIndex % 2 === 0;
|
27621 | var ariaRowIndex = headerRowCount + this.rowNode.rowIndex + 1;
|
27622 | this.forEachGui(gui, function (c) {
|
27623 | c.rowComp.setRowIndex(rowIndexStr);
|
27624 | c.rowComp.addOrRemoveCssClass('ag-row-even', rowIsEven);
|
27625 | c.rowComp.addOrRemoveCssClass('ag-row-odd', !rowIsEven);
|
27626 | setAriaRowIndex(c.element, ariaRowIndex);
|
27627 | });
|
27628 | };
|
27629 |
|
27630 | RowCtrl.prototype.getPinnedLeftRowElement = function () {
|
27631 | return this.leftGui ? this.leftGui.element : undefined;
|
27632 | };
|
27633 |
|
27634 | RowCtrl.prototype.getPinnedRightRowElement = function () {
|
27635 | return this.rightGui ? this.rightGui.element : undefined;
|
27636 | };
|
27637 |
|
27638 | RowCtrl.prototype.getBodyRowElement = function () {
|
27639 | return this.centerGui ? this.centerGui.element : undefined;
|
27640 | };
|
27641 |
|
27642 | RowCtrl.prototype.getFullWidthRowElement = function () {
|
27643 | return this.fullWidthGui ? this.fullWidthGui.element : undefined;
|
27644 | };
|
27645 | RowCtrl.DOM_DATA_KEY_ROW_CTRL = 'renderedRow';
|
27646 | return RowCtrl;
|
27647 | }(BeanStub));
|
27648 |
|
27649 |
|
27650 |
|
27651 |
|
27652 |
|
27653 |
|
27654 |
|
27655 | var __extends$1N = (undefined && undefined.__extends) || (function () {
|
27656 | var extendStatics = function (d, b) {
|
27657 | extendStatics = Object.setPrototypeOf ||
|
27658 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
27659 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
27660 | return extendStatics(d, b);
|
27661 | };
|
27662 | return function (d, b) {
|
27663 | extendStatics(d, b);
|
27664 | function __() { this.constructor = d; }
|
27665 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
27666 | };
|
27667 | })();
|
27668 | var __decorate$1K = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
27669 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
27670 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
27671 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
27672 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
27673 | };
|
27674 | var __read$j = (undefined && undefined.__read) || function (o, n) {
|
27675 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
27676 | if (!m) return o;
|
27677 | var i = m.call(o), r, ar = [], e;
|
27678 | try {
|
27679 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
27680 | }
|
27681 | catch (error) { e = { error: error }; }
|
27682 | finally {
|
27683 | try {
|
27684 | if (r && !r.done && (m = i["return"])) m.call(i);
|
27685 | }
|
27686 | finally { if (e) throw e.error; }
|
27687 | }
|
27688 | return ar;
|
27689 | };
|
27690 | var RowContainerEventsFeature = (function (_super) {
|
27691 | __extends$1N(RowContainerEventsFeature, _super);
|
27692 | function RowContainerEventsFeature(element) {
|
27693 | var _this = _super.call(this) || this;
|
27694 | _this.element = element;
|
27695 | return _this;
|
27696 | }
|
27697 | RowContainerEventsFeature.prototype.postConstruct = function () {
|
27698 | this.addMouseListeners();
|
27699 | this.mockContextMenuForIPad();
|
27700 | this.addKeyboardEvents();
|
27701 | };
|
27702 | RowContainerEventsFeature.prototype.addKeyboardEvents = function () {
|
27703 | var _this = this;
|
27704 | var eventNames = ['keydown', 'keypress'];
|
27705 | eventNames.forEach(function (eventName) {
|
27706 | var listener = _this.processKeyboardEvent.bind(_this, eventName);
|
27707 | _this.addManagedListener(_this.element, eventName, listener);
|
27708 | });
|
27709 | };
|
27710 | RowContainerEventsFeature.prototype.addMouseListeners = function () {
|
27711 | var _this = this;
|
27712 | var mouseDownEvent = isEventSupported('touchstart') ? 'touchstart' : 'mousedown';
|
27713 | var eventNames = ['dblclick', 'contextmenu', 'mouseover', 'mouseout', 'click', mouseDownEvent];
|
27714 | eventNames.forEach(function (eventName) {
|
27715 | var listener = _this.processMouseEvent.bind(_this, eventName);
|
27716 | _this.addManagedListener(_this.element, eventName, listener);
|
27717 | });
|
27718 | };
|
27719 | RowContainerEventsFeature.prototype.processMouseEvent = function (eventName, mouseEvent) {
|
27720 | if (!this.mouseEventService.isEventFromThisGrid(mouseEvent) ||
|
27721 | isStopPropagationForAgGrid(mouseEvent)) {
|
27722 | return;
|
27723 | }
|
27724 | var rowComp = this.getRowForEvent(mouseEvent);
|
27725 | var cellCtrl = this.mouseEventService.getRenderedCellForEvent(mouseEvent);
|
27726 | if (eventName === "contextmenu") {
|
27727 | this.handleContextMenuMouseEvent(mouseEvent, null, rowComp, cellCtrl);
|
27728 | }
|
27729 | else {
|
27730 | if (cellCtrl) {
|
27731 | cellCtrl.onMouseEvent(eventName, mouseEvent);
|
27732 | }
|
27733 | if (rowComp) {
|
27734 | rowComp.onMouseEvent(eventName, mouseEvent);
|
27735 | }
|
27736 | }
|
27737 | };
|
27738 | RowContainerEventsFeature.prototype.mockContextMenuForIPad = function () {
|
27739 | var _this = this;
|
27740 |
|
27741 | if (!isIOSUserAgent()) {
|
27742 | return;
|
27743 | }
|
27744 | var touchListener = new TouchListener(this.element);
|
27745 | var longTapListener = function (event) {
|
27746 | var rowComp = _this.getRowForEvent(event.touchEvent);
|
27747 | var cellComp = _this.mouseEventService.getRenderedCellForEvent(event.touchEvent);
|
27748 | _this.handleContextMenuMouseEvent(null, event.touchEvent, rowComp, cellComp);
|
27749 | };
|
27750 | this.addManagedListener(touchListener, TouchListener.EVENT_LONG_TAP, longTapListener);
|
27751 | this.addDestroyFunc(function () { return touchListener.destroy(); });
|
27752 | };
|
27753 | RowContainerEventsFeature.prototype.getRowForEvent = function (event) {
|
27754 | var sourceElement = event.target;
|
27755 | while (sourceElement) {
|
27756 | var rowCon = this.gridOptionsService.getDomData(sourceElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL);
|
27757 | if (rowCon) {
|
27758 | return rowCon;
|
27759 | }
|
27760 | sourceElement = sourceElement.parentElement;
|
27761 | }
|
27762 | return null;
|
27763 | };
|
27764 | RowContainerEventsFeature.prototype.handleContextMenuMouseEvent = function (mouseEvent, touchEvent, rowComp, cellCtrl) {
|
27765 | var rowNode = rowComp ? rowComp.getRowNode() : null;
|
27766 | var column = cellCtrl ? cellCtrl.getColumn() : null;
|
27767 | var value = null;
|
27768 | if (column) {
|
27769 | var event_1 = mouseEvent ? mouseEvent : touchEvent;
|
27770 | cellCtrl.dispatchCellContextMenuEvent(event_1);
|
27771 | value = this.valueService.getValue(column, rowNode);
|
27772 | }
|
27773 |
|
27774 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
27775 | var anchorToElement = cellCtrl ? cellCtrl.getGui() : gridBodyCon.getGridBodyElement();
|
27776 | if (this.contextMenuFactory) {
|
27777 | this.contextMenuFactory.onContextMenu(mouseEvent, touchEvent, rowNode, column, value, anchorToElement);
|
27778 | }
|
27779 | };
|
27780 | RowContainerEventsFeature.prototype.processKeyboardEvent = function (eventName, keyboardEvent) {
|
27781 | var cellComp = getCtrlForEvent(this.gridOptionsService, keyboardEvent, CellCtrl.DOM_DATA_KEY_CELL_CTRL);
|
27782 | var rowComp = getCtrlForEvent(this.gridOptionsService, keyboardEvent, RowCtrl.DOM_DATA_KEY_ROW_CTRL);
|
27783 | if (keyboardEvent.defaultPrevented) {
|
27784 | return;
|
27785 | }
|
27786 | if (cellComp) {
|
27787 | this.processCellKeyboardEvent(cellComp, eventName, keyboardEvent);
|
27788 | }
|
27789 | else if (rowComp && rowComp.isFullWidth()) {
|
27790 | this.processFullWidthRowKeyboardEvent(rowComp, eventName, keyboardEvent);
|
27791 | }
|
27792 | };
|
27793 | RowContainerEventsFeature.prototype.processCellKeyboardEvent = function (cellCtrl, eventName, keyboardEvent) {
|
27794 | var rowNode = cellCtrl.getRowNode();
|
27795 | var column = cellCtrl.getColumn();
|
27796 | var editing = cellCtrl.isEditing();
|
27797 | var gridProcessingAllowed = !isUserSuppressingKeyboardEvent(this.gridOptionsService, keyboardEvent, rowNode, column, editing);
|
27798 | if (gridProcessingAllowed) {
|
27799 | switch (eventName) {
|
27800 | case 'keydown':
|
27801 |
|
27802 | var wasScrollKey = !editing && this.navigationService.handlePageScrollingKey(keyboardEvent);
|
27803 |
|
27804 | if (!wasScrollKey) {
|
27805 | cellCtrl.onKeyDown(keyboardEvent);
|
27806 | }
|
27807 |
|
27808 | this.doGridOperations(keyboardEvent, cellCtrl.isEditing());
|
27809 | break;
|
27810 | case 'keypress':
|
27811 | cellCtrl.onKeyPress(keyboardEvent);
|
27812 | break;
|
27813 | }
|
27814 | }
|
27815 | if (eventName === 'keydown') {
|
27816 | var cellKeyDownEvent = cellCtrl.createEvent(keyboardEvent, Events.EVENT_CELL_KEY_DOWN);
|
27817 | this.eventService.dispatchEvent(cellKeyDownEvent);
|
27818 | }
|
27819 | if (eventName === 'keypress') {
|
27820 | var cellKeyPressEvent = cellCtrl.createEvent(keyboardEvent, Events.EVENT_CELL_KEY_PRESS);
|
27821 | this.eventService.dispatchEvent(cellKeyPressEvent);
|
27822 | }
|
27823 | };
|
27824 | RowContainerEventsFeature.prototype.processFullWidthRowKeyboardEvent = function (rowComp, eventName, keyboardEvent) {
|
27825 | var rowNode = rowComp.getRowNode();
|
27826 | var focusedCell = this.focusService.getFocusedCell();
|
27827 | var column = (focusedCell && focusedCell.column);
|
27828 | var gridProcessingAllowed = !isUserSuppressingKeyboardEvent(this.gridOptionsService, keyboardEvent, rowNode, column, false);
|
27829 | if (gridProcessingAllowed) {
|
27830 | var key = keyboardEvent.key;
|
27831 | if (eventName === 'keydown') {
|
27832 | switch (key) {
|
27833 | case KeyCode.PAGE_HOME:
|
27834 | case KeyCode.PAGE_END:
|
27835 | this.navigationService.handlePageScrollingKey(keyboardEvent);
|
27836 | break;
|
27837 | case KeyCode.UP:
|
27838 | case KeyCode.DOWN:
|
27839 | rowComp.onKeyboardNavigate(keyboardEvent);
|
27840 | break;
|
27841 | case KeyCode.TAB:
|
27842 | rowComp.onTabKeyDown(keyboardEvent);
|
27843 | break;
|
27844 | }
|
27845 | }
|
27846 | }
|
27847 | if (eventName === 'keydown') {
|
27848 | var cellKeyDownEvent = rowComp.createRowEvent(Events.EVENT_CELL_KEY_DOWN, keyboardEvent);
|
27849 | this.eventService.dispatchEvent(cellKeyDownEvent);
|
27850 | }
|
27851 | if (eventName === 'keypress') {
|
27852 | var cellKeyPressEvent = rowComp.createRowEvent(Events.EVENT_CELL_KEY_PRESS, keyboardEvent);
|
27853 | this.eventService.dispatchEvent(cellKeyPressEvent);
|
27854 | }
|
27855 | };
|
27856 | RowContainerEventsFeature.prototype.doGridOperations = function (keyboardEvent, editing) {
|
27857 |
|
27858 | if (!keyboardEvent.ctrlKey && !keyboardEvent.metaKey) {
|
27859 | return;
|
27860 | }
|
27861 |
|
27862 |
|
27863 |
|
27864 | if (editing) {
|
27865 | return;
|
27866 | }
|
27867 |
|
27868 |
|
27869 | if (!this.mouseEventService.isEventFromThisGrid(keyboardEvent)) {
|
27870 | return;
|
27871 | }
|
27872 | var keyCode = normaliseQwertyAzerty(keyboardEvent);
|
27873 | if (keyCode === KeyCode.A) {
|
27874 | return this.onCtrlAndA(keyboardEvent);
|
27875 | }
|
27876 | if (keyCode === KeyCode.C) {
|
27877 | return this.onCtrlAndC(keyboardEvent);
|
27878 | }
|
27879 | if (keyCode === KeyCode.X) {
|
27880 | return this.onCtrlAndX(keyboardEvent);
|
27881 | }
|
27882 | if (keyCode === KeyCode.V) {
|
27883 | return this.onCtrlAndV();
|
27884 | }
|
27885 | if (keyCode === KeyCode.D) {
|
27886 | return this.onCtrlAndD(keyboardEvent);
|
27887 | }
|
27888 | if (keyCode === KeyCode.Z) {
|
27889 | return this.onCtrlAndZ(keyboardEvent);
|
27890 | }
|
27891 | if (keyCode === KeyCode.Y) {
|
27892 | return this.onCtrlAndY();
|
27893 | }
|
27894 | };
|
27895 | RowContainerEventsFeature.prototype.onCtrlAndA = function (event) {
|
27896 | var _a = this, pinnedRowModel = _a.pinnedRowModel, paginationProxy = _a.paginationProxy, rangeService = _a.rangeService;
|
27897 | if (rangeService && paginationProxy.isRowsToRender()) {
|
27898 | var _b = __read$j([
|
27899 | pinnedRowModel.isEmpty('top'),
|
27900 | pinnedRowModel.isEmpty('bottom')
|
27901 | ], 2), isEmptyPinnedTop = _b[0], isEmptyPinnedBottom = _b[1];
|
27902 | var floatingStart = isEmptyPinnedTop ? null : 'top';
|
27903 | var floatingEnd = void 0;
|
27904 | var rowEnd = void 0;
|
27905 | if (isEmptyPinnedBottom) {
|
27906 | floatingEnd = null;
|
27907 | rowEnd = this.paginationProxy.getRowCount() - 1;
|
27908 | }
|
27909 | else {
|
27910 | floatingEnd = 'bottom';
|
27911 | rowEnd = pinnedRowModel.getPinnedBottomRowData().length - 1;
|
27912 | }
|
27913 | var allDisplayedColumns = this.columnModel.getAllDisplayedColumns();
|
27914 | if (missingOrEmpty(allDisplayedColumns)) {
|
27915 | return;
|
27916 | }
|
27917 | rangeService.setCellRange({
|
27918 | rowStartIndex: 0,
|
27919 | rowStartPinned: floatingStart,
|
27920 | rowEndIndex: rowEnd,
|
27921 | rowEndPinned: floatingEnd,
|
27922 | columnStart: allDisplayedColumns[0],
|
27923 | columnEnd: last(allDisplayedColumns)
|
27924 | });
|
27925 | }
|
27926 | event.preventDefault();
|
27927 | };
|
27928 | RowContainerEventsFeature.prototype.onCtrlAndC = function (event) {
|
27929 | if (!this.clipboardService || this.gridOptionsService.is('enableCellTextSelection')) {
|
27930 | return;
|
27931 | }
|
27932 | this.clipboardService.copyToClipboard();
|
27933 | event.preventDefault();
|
27934 | };
|
27935 | RowContainerEventsFeature.prototype.onCtrlAndX = function (event) {
|
27936 | if (!this.clipboardService ||
|
27937 | this.gridOptionsService.is('enableCellTextSelection') ||
|
27938 | this.gridOptionsService.is('suppressCutToClipboard')) {
|
27939 | return;
|
27940 | }
|
27941 | this.clipboardService.cutToClipboard();
|
27942 | event.preventDefault();
|
27943 | };
|
27944 | RowContainerEventsFeature.prototype.onCtrlAndV = function () {
|
27945 | if (ModuleRegistry.isRegistered(ModuleNames.ClipboardModule) && !this.gridOptionsService.is('suppressClipboardPaste')) {
|
27946 | this.clipboardService.pasteFromClipboard();
|
27947 | }
|
27948 | };
|
27949 | RowContainerEventsFeature.prototype.onCtrlAndD = function (event) {
|
27950 | if (ModuleRegistry.isRegistered(ModuleNames.ClipboardModule) && !this.gridOptionsService.is('suppressClipboardPaste')) {
|
27951 | this.clipboardService.copyRangeDown();
|
27952 | }
|
27953 | event.preventDefault();
|
27954 | };
|
27955 | RowContainerEventsFeature.prototype.onCtrlAndZ = function (event) {
|
27956 | if (!this.gridOptionsService.is('undoRedoCellEditing')) {
|
27957 | return;
|
27958 | }
|
27959 | event.preventDefault();
|
27960 | if (event.shiftKey) {
|
27961 | this.undoRedoService.redo('ui');
|
27962 | }
|
27963 | else {
|
27964 | this.undoRedoService.undo('ui');
|
27965 | }
|
27966 | };
|
27967 | RowContainerEventsFeature.prototype.onCtrlAndY = function () {
|
27968 | this.undoRedoService.redo('ui');
|
27969 | };
|
27970 | __decorate$1K([
|
27971 | Autowired('mouseEventService')
|
27972 | ], RowContainerEventsFeature.prototype, "mouseEventService", void 0);
|
27973 | __decorate$1K([
|
27974 | Autowired('valueService')
|
27975 | ], RowContainerEventsFeature.prototype, "valueService", void 0);
|
27976 | __decorate$1K([
|
27977 | Optional('contextMenuFactory')
|
27978 | ], RowContainerEventsFeature.prototype, "contextMenuFactory", void 0);
|
27979 | __decorate$1K([
|
27980 | Autowired('ctrlsService')
|
27981 | ], RowContainerEventsFeature.prototype, "ctrlsService", void 0);
|
27982 | __decorate$1K([
|
27983 | Autowired('navigationService')
|
27984 | ], RowContainerEventsFeature.prototype, "navigationService", void 0);
|
27985 | __decorate$1K([
|
27986 | Autowired('focusService')
|
27987 | ], RowContainerEventsFeature.prototype, "focusService", void 0);
|
27988 | __decorate$1K([
|
27989 | Autowired('undoRedoService')
|
27990 | ], RowContainerEventsFeature.prototype, "undoRedoService", void 0);
|
27991 | __decorate$1K([
|
27992 | Autowired('columnModel')
|
27993 | ], RowContainerEventsFeature.prototype, "columnModel", void 0);
|
27994 | __decorate$1K([
|
27995 | Autowired('paginationProxy')
|
27996 | ], RowContainerEventsFeature.prototype, "paginationProxy", void 0);
|
27997 | __decorate$1K([
|
27998 | Autowired('pinnedRowModel')
|
27999 | ], RowContainerEventsFeature.prototype, "pinnedRowModel", void 0);
|
28000 | __decorate$1K([
|
28001 | Optional('rangeService')
|
28002 | ], RowContainerEventsFeature.prototype, "rangeService", void 0);
|
28003 | __decorate$1K([
|
28004 | Optional('clipboardService')
|
28005 | ], RowContainerEventsFeature.prototype, "clipboardService", void 0);
|
28006 | __decorate$1K([
|
28007 | PostConstruct
|
28008 | ], RowContainerEventsFeature.prototype, "postConstruct", null);
|
28009 | return RowContainerEventsFeature;
|
28010 | }(BeanStub));
|
28011 |
|
28012 |
|
28013 |
|
28014 |
|
28015 |
|
28016 |
|
28017 |
|
28018 | var __extends$1M = (undefined && undefined.__extends) || (function () {
|
28019 | var extendStatics = function (d, b) {
|
28020 | extendStatics = Object.setPrototypeOf ||
|
28021 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
28022 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
28023 | return extendStatics(d, b);
|
28024 | };
|
28025 | return function (d, b) {
|
28026 | extendStatics(d, b);
|
28027 | function __() { this.constructor = d; }
|
28028 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
28029 | };
|
28030 | })();
|
28031 | var __decorate$1J = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
28032 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28033 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
28034 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
28035 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
28036 | };
|
28037 |
|
28038 |
|
28039 |
|
28040 | var ViewportSizeFeature = (function (_super) {
|
28041 | __extends$1M(ViewportSizeFeature, _super);
|
28042 | function ViewportSizeFeature(centerContainerCtrl) {
|
28043 | var _this = _super.call(this) || this;
|
28044 | _this.centerContainerCtrl = centerContainerCtrl;
|
28045 | return _this;
|
28046 | }
|
28047 | ViewportSizeFeature.prototype.postConstruct = function () {
|
28048 | var _this = this;
|
28049 | this.ctrlsService.whenReady(function () {
|
28050 | _this.gridBodyCtrl = _this.ctrlsService.getGridBodyCtrl();
|
28051 | _this.listenForResize();
|
28052 | });
|
28053 | this.addManagedListener(this.eventService, Events.EVENT_SCROLLBAR_WIDTH_CHANGED, this.onScrollbarWidthChanged.bind(this));
|
28054 | };
|
28055 | ViewportSizeFeature.prototype.listenForResize = function () {
|
28056 | var _this = this;
|
28057 | var listener = function () { return _this.onCenterViewportResized(); };
|
28058 |
|
28059 | this.centerContainerCtrl.registerViewportResizeListener(listener);
|
28060 |
|
28061 | this.gridBodyCtrl.registerBodyViewportResizeListener(listener);
|
28062 | };
|
28063 | ViewportSizeFeature.prototype.onScrollbarWidthChanged = function () {
|
28064 | this.checkViewportAndScrolls();
|
28065 | };
|
28066 | ViewportSizeFeature.prototype.onCenterViewportResized = function () {
|
28067 | if (this.centerContainerCtrl.isViewportVisible()) {
|
28068 | this.checkViewportAndScrolls();
|
28069 | var newWidth = this.centerContainerCtrl.getCenterWidth();
|
28070 | if (newWidth !== this.centerWidth) {
|
28071 | this.centerWidth = newWidth;
|
28072 | this.columnModel.refreshFlexedColumns({ viewportWidth: this.centerWidth, updateBodyWidths: true, fireResizedEvent: true });
|
28073 | }
|
28074 | }
|
28075 | else {
|
28076 | this.bodyHeight = 0;
|
28077 | }
|
28078 | };
|
28079 |
|
28080 |
|
28081 | ViewportSizeFeature.prototype.checkViewportAndScrolls = function () {
|
28082 |
|
28083 | this.updateScrollVisibleService();
|
28084 |
|
28085 | this.checkBodyHeight();
|
28086 |
|
28087 | this.onHorizontalViewportChanged();
|
28088 | this.gridBodyCtrl.getScrollFeature().checkScrollLeft();
|
28089 | };
|
28090 | ViewportSizeFeature.prototype.getBodyHeight = function () {
|
28091 | return this.bodyHeight;
|
28092 | };
|
28093 | ViewportSizeFeature.prototype.checkBodyHeight = function () {
|
28094 | var eBodyViewport = this.gridBodyCtrl.getBodyViewportElement();
|
28095 | var bodyHeight = getInnerHeight(eBodyViewport);
|
28096 | if (this.bodyHeight !== bodyHeight) {
|
28097 | this.bodyHeight = bodyHeight;
|
28098 | var event_1 = {
|
28099 | type: Events.EVENT_BODY_HEIGHT_CHANGED
|
28100 | };
|
28101 | this.eventService.dispatchEvent(event_1);
|
28102 | }
|
28103 | };
|
28104 | ViewportSizeFeature.prototype.updateScrollVisibleService = function () {
|
28105 |
|
28106 |
|
28107 |
|
28108 |
|
28109 |
|
28110 |
|
28111 | this.updateScrollVisibleServiceImpl();
|
28112 | setTimeout(this.updateScrollVisibleServiceImpl.bind(this), 500);
|
28113 | };
|
28114 | ViewportSizeFeature.prototype.updateScrollVisibleServiceImpl = function () {
|
28115 | var params = {
|
28116 | horizontalScrollShowing: this.isHorizontalScrollShowing(),
|
28117 | verticalScrollShowing: this.gridBodyCtrl.isVerticalScrollShowing()
|
28118 | };
|
28119 | this.scrollVisibleService.setScrollsVisible(params);
|
28120 |
|
28121 | this.gridBodyCtrl.setVerticalScrollPaddingVisible(params.verticalScrollShowing);
|
28122 | };
|
28123 | ViewportSizeFeature.prototype.isHorizontalScrollShowing = function () {
|
28124 | var isAlwaysShowHorizontalScroll = this.gridOptionsService.is('alwaysShowHorizontalScroll');
|
28125 | return isAlwaysShowHorizontalScroll || this.centerContainerCtrl.isViewportHScrollShowing();
|
28126 | };
|
28127 |
|
28128 |
|
28129 |
|
28130 | ViewportSizeFeature.prototype.onHorizontalViewportChanged = function () {
|
28131 | var scrollWidth = this.centerContainerCtrl.getCenterWidth();
|
28132 | var scrollPosition = this.centerContainerCtrl.getViewportScrollLeft();
|
28133 | this.columnModel.setViewportPosition(scrollWidth, scrollPosition);
|
28134 | };
|
28135 | __decorate$1J([
|
28136 | Autowired('ctrlsService')
|
28137 | ], ViewportSizeFeature.prototype, "ctrlsService", void 0);
|
28138 | __decorate$1J([
|
28139 | Autowired('columnModel')
|
28140 | ], ViewportSizeFeature.prototype, "columnModel", void 0);
|
28141 | __decorate$1J([
|
28142 | Autowired('scrollVisibleService')
|
28143 | ], ViewportSizeFeature.prototype, "scrollVisibleService", void 0);
|
28144 | __decorate$1J([
|
28145 | PostConstruct
|
28146 | ], ViewportSizeFeature.prototype, "postConstruct", null);
|
28147 | return ViewportSizeFeature;
|
28148 | }(BeanStub));
|
28149 |
|
28150 |
|
28151 |
|
28152 |
|
28153 |
|
28154 |
|
28155 |
|
28156 | var __extends$1L = (undefined && undefined.__extends) || (function () {
|
28157 | var extendStatics = function (d, b) {
|
28158 | extendStatics = Object.setPrototypeOf ||
|
28159 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
28160 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
28161 | return extendStatics(d, b);
|
28162 | };
|
28163 | return function (d, b) {
|
28164 | extendStatics(d, b);
|
28165 | function __() { this.constructor = d; }
|
28166 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
28167 | };
|
28168 | })();
|
28169 | var __decorate$1I = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
28170 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28171 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
28172 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
28173 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
28174 | };
|
28175 | var SetPinnedLeftWidthFeature = (function (_super) {
|
28176 | __extends$1L(SetPinnedLeftWidthFeature, _super);
|
28177 | function SetPinnedLeftWidthFeature(element) {
|
28178 | var _this = _super.call(this) || this;
|
28179 | _this.element = element;
|
28180 | return _this;
|
28181 | }
|
28182 | SetPinnedLeftWidthFeature.prototype.postConstruct = function () {
|
28183 | this.addManagedListener(this.eventService, Events.EVENT_LEFT_PINNED_WIDTH_CHANGED, this.onPinnedLeftWidthChanged.bind(this));
|
28184 | };
|
28185 | SetPinnedLeftWidthFeature.prototype.onPinnedLeftWidthChanged = function () {
|
28186 | var leftWidth = this.pinnedWidthService.getPinnedLeftWidth();
|
28187 | var displayed = leftWidth > 0;
|
28188 | setDisplayed(this.element, displayed);
|
28189 | setFixedWidth(this.element, leftWidth);
|
28190 | };
|
28191 | SetPinnedLeftWidthFeature.prototype.getWidth = function () {
|
28192 | return this.pinnedWidthService.getPinnedLeftWidth();
|
28193 | };
|
28194 | __decorate$1I([
|
28195 | Autowired('pinnedWidthService')
|
28196 | ], SetPinnedLeftWidthFeature.prototype, "pinnedWidthService", void 0);
|
28197 | __decorate$1I([
|
28198 | PostConstruct
|
28199 | ], SetPinnedLeftWidthFeature.prototype, "postConstruct", null);
|
28200 | return SetPinnedLeftWidthFeature;
|
28201 | }(BeanStub));
|
28202 |
|
28203 |
|
28204 |
|
28205 |
|
28206 |
|
28207 |
|
28208 |
|
28209 | var __extends$1K = (undefined && undefined.__extends) || (function () {
|
28210 | var extendStatics = function (d, b) {
|
28211 | extendStatics = Object.setPrototypeOf ||
|
28212 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
28213 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
28214 | return extendStatics(d, b);
|
28215 | };
|
28216 | return function (d, b) {
|
28217 | extendStatics(d, b);
|
28218 | function __() { this.constructor = d; }
|
28219 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
28220 | };
|
28221 | })();
|
28222 | var __decorate$1H = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
28223 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28224 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
28225 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
28226 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
28227 | };
|
28228 | var SetPinnedRightWidthFeature = (function (_super) {
|
28229 | __extends$1K(SetPinnedRightWidthFeature, _super);
|
28230 | function SetPinnedRightWidthFeature(element) {
|
28231 | var _this = _super.call(this) || this;
|
28232 | _this.element = element;
|
28233 | return _this;
|
28234 | }
|
28235 | SetPinnedRightWidthFeature.prototype.postConstruct = function () {
|
28236 | this.addManagedListener(this.eventService, Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED, this.onPinnedRightWidthChanged.bind(this));
|
28237 | };
|
28238 | SetPinnedRightWidthFeature.prototype.onPinnedRightWidthChanged = function () {
|
28239 | var rightWidth = this.pinnedWidthService.getPinnedRightWidth();
|
28240 | var displayed = rightWidth > 0;
|
28241 | setDisplayed(this.element, displayed);
|
28242 | setFixedWidth(this.element, rightWidth);
|
28243 | };
|
28244 | SetPinnedRightWidthFeature.prototype.getWidth = function () {
|
28245 | return this.pinnedWidthService.getPinnedRightWidth();
|
28246 | };
|
28247 | __decorate$1H([
|
28248 | Autowired('pinnedWidthService')
|
28249 | ], SetPinnedRightWidthFeature.prototype, "pinnedWidthService", void 0);
|
28250 | __decorate$1H([
|
28251 | PostConstruct
|
28252 | ], SetPinnedRightWidthFeature.prototype, "postConstruct", null);
|
28253 | return SetPinnedRightWidthFeature;
|
28254 | }(BeanStub));
|
28255 |
|
28256 |
|
28257 |
|
28258 |
|
28259 |
|
28260 |
|
28261 |
|
28262 | var __extends$1J = (undefined && undefined.__extends) || (function () {
|
28263 | var extendStatics = function (d, b) {
|
28264 | extendStatics = Object.setPrototypeOf ||
|
28265 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
28266 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
28267 | return extendStatics(d, b);
|
28268 | };
|
28269 | return function (d, b) {
|
28270 | extendStatics(d, b);
|
28271 | function __() { this.constructor = d; }
|
28272 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
28273 | };
|
28274 | })();
|
28275 | var __decorate$1G = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
28276 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28277 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
28278 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
28279 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
28280 | };
|
28281 | var SetHeightFeature = (function (_super) {
|
28282 | __extends$1J(SetHeightFeature, _super);
|
28283 | function SetHeightFeature(eContainer, eWrapper) {
|
28284 | var _this = _super.call(this) || this;
|
28285 | _this.eContainer = eContainer;
|
28286 | _this.eWrapper = eWrapper;
|
28287 | return _this;
|
28288 | }
|
28289 | SetHeightFeature.prototype.postConstruct = function () {
|
28290 | this.addManagedListener(this.eventService, Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED, this.onHeightChanged.bind(this));
|
28291 | };
|
28292 | SetHeightFeature.prototype.onHeightChanged = function () {
|
28293 | var height = this.maxDivHeightScaler.getUiContainerHeight();
|
28294 | var heightString = height != null ? height + "px" : "";
|
28295 | this.eContainer.style.height = heightString;
|
28296 | if (this.eWrapper) {
|
28297 | this.eWrapper.style.height = heightString;
|
28298 | }
|
28299 | };
|
28300 | __decorate$1G([
|
28301 | Autowired("rowContainerHeightService")
|
28302 | ], SetHeightFeature.prototype, "maxDivHeightScaler", void 0);
|
28303 | __decorate$1G([
|
28304 | PostConstruct
|
28305 | ], SetHeightFeature.prototype, "postConstruct", null);
|
28306 | return SetHeightFeature;
|
28307 | }(BeanStub));
|
28308 |
|
28309 |
|
28310 |
|
28311 |
|
28312 |
|
28313 |
|
28314 |
|
28315 | var __extends$1I = (undefined && undefined.__extends) || (function () {
|
28316 | var extendStatics = function (d, b) {
|
28317 | extendStatics = Object.setPrototypeOf ||
|
28318 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
28319 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
28320 | return extendStatics(d, b);
|
28321 | };
|
28322 | return function (d, b) {
|
28323 | extendStatics(d, b);
|
28324 | function __() { this.constructor = d; }
|
28325 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
28326 | };
|
28327 | })();
|
28328 | var __decorate$1F = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
28329 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28330 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
28331 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
28332 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
28333 | };
|
28334 | var DragListenerFeature = (function (_super) {
|
28335 | __extends$1I(DragListenerFeature, _super);
|
28336 | function DragListenerFeature(eContainer) {
|
28337 | var _this = _super.call(this) || this;
|
28338 | _this.eContainer = eContainer;
|
28339 | return _this;
|
28340 | }
|
28341 | DragListenerFeature.prototype.postConstruct = function () {
|
28342 | var _this = this;
|
28343 | if (!this.gridOptionsService.isEnableRangeSelection() ||
|
28344 | missing(this.rangeService)
|
28345 | ) {
|
28346 | return;
|
28347 | }
|
28348 | var params = {
|
28349 | eElement: this.eContainer,
|
28350 | onDragStart: this.rangeService.onDragStart.bind(this.rangeService),
|
28351 | onDragStop: this.rangeService.onDragStop.bind(this.rangeService),
|
28352 | onDragging: this.rangeService.onDragging.bind(this.rangeService)
|
28353 | };
|
28354 | this.dragService.addDragSource(params);
|
28355 | this.addDestroyFunc(function () { return _this.dragService.removeDragSource(params); });
|
28356 | };
|
28357 | __decorate$1F([
|
28358 | Optional('rangeService')
|
28359 | ], DragListenerFeature.prototype, "rangeService", void 0);
|
28360 | __decorate$1F([
|
28361 | Autowired('dragService')
|
28362 | ], DragListenerFeature.prototype, "dragService", void 0);
|
28363 | __decorate$1F([
|
28364 | PostConstruct
|
28365 | ], DragListenerFeature.prototype, "postConstruct", null);
|
28366 | return DragListenerFeature;
|
28367 | }(BeanStub));
|
28368 |
|
28369 |
|
28370 |
|
28371 |
|
28372 |
|
28373 |
|
28374 |
|
28375 | var __extends$1H = (undefined && undefined.__extends) || (function () {
|
28376 | var extendStatics = function (d, b) {
|
28377 | extendStatics = Object.setPrototypeOf ||
|
28378 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
28379 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
28380 | return extendStatics(d, b);
|
28381 | };
|
28382 | return function (d, b) {
|
28383 | extendStatics(d, b);
|
28384 | function __() { this.constructor = d; }
|
28385 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
28386 | };
|
28387 | })();
|
28388 | var __decorate$1E = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
28389 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28390 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
28391 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
28392 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
28393 | };
|
28394 | var CenterWidthFeature = (function (_super) {
|
28395 | __extends$1H(CenterWidthFeature, _super);
|
28396 | function CenterWidthFeature(callback) {
|
28397 | var _this = _super.call(this) || this;
|
28398 | _this.callback = callback;
|
28399 | return _this;
|
28400 | }
|
28401 | CenterWidthFeature.prototype.postConstruct = function () {
|
28402 | var listener = this.setWidth.bind(this);
|
28403 | this.addManagedPropertyListener('domLayout', listener);
|
28404 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);
|
28405 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, listener);
|
28406 | this.setWidth();
|
28407 | };
|
28408 | CenterWidthFeature.prototype.setWidth = function () {
|
28409 | var columnModel = this.columnModel;
|
28410 | var printLayout = this.gridOptionsService.isDomLayout('print');
|
28411 | var centerWidth = columnModel.getBodyContainerWidth();
|
28412 | var leftWidth = columnModel.getDisplayedColumnsLeftWidth();
|
28413 | var rightWidth = columnModel.getDisplayedColumnsRightWidth();
|
28414 | var totalWidth = printLayout ? centerWidth + leftWidth + rightWidth : centerWidth;
|
28415 | this.callback(totalWidth);
|
28416 | };
|
28417 | __decorate$1E([
|
28418 | Autowired('columnModel')
|
28419 | ], CenterWidthFeature.prototype, "columnModel", void 0);
|
28420 | __decorate$1E([
|
28421 | PostConstruct
|
28422 | ], CenterWidthFeature.prototype, "postConstruct", null);
|
28423 | return CenterWidthFeature;
|
28424 | }(BeanStub));
|
28425 |
|
28426 |
|
28427 |
|
28428 |
|
28429 |
|
28430 |
|
28431 |
|
28432 | var __extends$1G = (undefined && undefined.__extends) || (function () {
|
28433 | var extendStatics = function (d, b) {
|
28434 | extendStatics = Object.setPrototypeOf ||
|
28435 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
28436 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
28437 | return extendStatics(d, b);
|
28438 | };
|
28439 | return function (d, b) {
|
28440 | extendStatics(d, b);
|
28441 | function __() { this.constructor = d; }
|
28442 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
28443 | };
|
28444 | })();
|
28445 | var __decorate$1D = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
28446 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28447 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
28448 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
28449 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
28450 | };
|
28451 | var __read$i = (undefined && undefined.__read) || function (o, n) {
|
28452 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
28453 | if (!m) return o;
|
28454 | var i = m.call(o), r, ar = [], e;
|
28455 | try {
|
28456 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
28457 | }
|
28458 | catch (error) { e = { error: error }; }
|
28459 | finally {
|
28460 | try {
|
28461 | if (r && !r.done && (m = i["return"])) m.call(i);
|
28462 | }
|
28463 | finally { if (e) throw e.error; }
|
28464 | }
|
28465 | return ar;
|
28466 | };
|
28467 | var __spread$f = (undefined && undefined.__spread) || function () {
|
28468 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$i(arguments[i]));
|
28469 | return ar;
|
28470 | };
|
28471 | var RowContainerName;
|
28472 | (function (RowContainerName) {
|
28473 | RowContainerName["LEFT"] = "left";
|
28474 | RowContainerName["RIGHT"] = "right";
|
28475 | RowContainerName["CENTER"] = "center";
|
28476 | RowContainerName["FULL_WIDTH"] = "fullWidth";
|
28477 | RowContainerName["TOP_LEFT"] = "topLeft";
|
28478 | RowContainerName["TOP_RIGHT"] = "topRight";
|
28479 | RowContainerName["TOP_CENTER"] = "topCenter";
|
28480 | RowContainerName["TOP_FULL_WIDTH"] = "topFullWidth";
|
28481 | RowContainerName["STICKY_TOP_LEFT"] = "stickyTopLeft";
|
28482 | RowContainerName["STICKY_TOP_RIGHT"] = "stickyTopRight";
|
28483 | RowContainerName["STICKY_TOP_CENTER"] = "stickyTopCenter";
|
28484 | RowContainerName["STICKY_TOP_FULL_WIDTH"] = "stickyTopFullWidth";
|
28485 | RowContainerName["BOTTOM_LEFT"] = "bottomLeft";
|
28486 | RowContainerName["BOTTOM_RIGHT"] = "bottomRight";
|
28487 | RowContainerName["BOTTOM_CENTER"] = "bottomCenter";
|
28488 | RowContainerName["BOTTOM_FULL_WIDTH"] = "bottomFullWidth";
|
28489 | })(RowContainerName || (RowContainerName = {}));
|
28490 | var RowContainerType;
|
28491 | (function (RowContainerType) {
|
28492 | RowContainerType["LEFT"] = "left";
|
28493 | RowContainerType["RIGHT"] = "right";
|
28494 | RowContainerType["CENTER"] = "center";
|
28495 | RowContainerType["FULL_WIDTH"] = "fullWidth";
|
28496 | })(RowContainerType || (RowContainerType = {}));
|
28497 | function getRowContainerTypeForName(name) {
|
28498 | switch (name) {
|
28499 | case RowContainerName.CENTER:
|
28500 | case RowContainerName.TOP_CENTER:
|
28501 | case RowContainerName.STICKY_TOP_CENTER:
|
28502 | case RowContainerName.BOTTOM_CENTER:
|
28503 | return RowContainerType.CENTER;
|
28504 | case RowContainerName.LEFT:
|
28505 | case RowContainerName.TOP_LEFT:
|
28506 | case RowContainerName.STICKY_TOP_LEFT:
|
28507 | case RowContainerName.BOTTOM_LEFT:
|
28508 | return RowContainerType.LEFT;
|
28509 | case RowContainerName.RIGHT:
|
28510 | case RowContainerName.TOP_RIGHT:
|
28511 | case RowContainerName.STICKY_TOP_RIGHT:
|
28512 | case RowContainerName.BOTTOM_RIGHT:
|
28513 | return RowContainerType.RIGHT;
|
28514 | case RowContainerName.FULL_WIDTH:
|
28515 | case RowContainerName.TOP_FULL_WIDTH:
|
28516 | case RowContainerName.STICKY_TOP_FULL_WIDTH:
|
28517 | case RowContainerName.BOTTOM_FULL_WIDTH:
|
28518 | return RowContainerType.FULL_WIDTH;
|
28519 | default:
|
28520 | throw Error('Invalid Row Container Type');
|
28521 | }
|
28522 | }
|
28523 | var ContainerCssClasses = convertToMap([
|
28524 | [RowContainerName.CENTER, 'ag-center-cols-container'],
|
28525 | [RowContainerName.LEFT, 'ag-pinned-left-cols-container'],
|
28526 | [RowContainerName.RIGHT, 'ag-pinned-right-cols-container'],
|
28527 | [RowContainerName.FULL_WIDTH, 'ag-full-width-container'],
|
28528 | [RowContainerName.TOP_CENTER, 'ag-floating-top-container'],
|
28529 | [RowContainerName.TOP_LEFT, 'ag-pinned-left-floating-top'],
|
28530 | [RowContainerName.TOP_RIGHT, 'ag-pinned-right-floating-top'],
|
28531 | [RowContainerName.TOP_FULL_WIDTH, 'ag-floating-top-full-width-container'],
|
28532 | [RowContainerName.STICKY_TOP_CENTER, 'ag-sticky-top-container'],
|
28533 | [RowContainerName.STICKY_TOP_LEFT, 'ag-pinned-left-sticky-top'],
|
28534 | [RowContainerName.STICKY_TOP_RIGHT, 'ag-pinned-right-sticky-top'],
|
28535 | [RowContainerName.STICKY_TOP_FULL_WIDTH, 'ag-sticky-top-full-width-container'],
|
28536 | [RowContainerName.BOTTOM_CENTER, 'ag-floating-bottom-container'],
|
28537 | [RowContainerName.BOTTOM_LEFT, 'ag-pinned-left-floating-bottom'],
|
28538 | [RowContainerName.BOTTOM_RIGHT, 'ag-pinned-right-floating-bottom'],
|
28539 | [RowContainerName.BOTTOM_FULL_WIDTH, 'ag-floating-bottom-full-width-container'],
|
28540 | ]);
|
28541 | var ViewportCssClasses = convertToMap([
|
28542 | [RowContainerName.CENTER, 'ag-center-cols-viewport'],
|
28543 | [RowContainerName.TOP_CENTER, 'ag-floating-top-viewport'],
|
28544 | [RowContainerName.STICKY_TOP_CENTER, 'ag-sticky-top-viewport'],
|
28545 | [RowContainerName.BOTTOM_CENTER, 'ag-floating-bottom-viewport'],
|
28546 | ]);
|
28547 | var WrapperCssClasses = convertToMap([
|
28548 | [RowContainerName.CENTER, 'ag-center-cols-clipper'],
|
28549 | ]);
|
28550 | var RowContainerCtrl = (function (_super) {
|
28551 | __extends$1G(RowContainerCtrl, _super);
|
28552 | function RowContainerCtrl(name) {
|
28553 | var _this = _super.call(this) || this;
|
28554 | _this.visible = true;
|
28555 |
|
28556 | _this.EMPTY_CTRLS = [];
|
28557 | _this.name = name;
|
28558 | _this.isFullWithContainer =
|
28559 | _this.name === RowContainerName.TOP_FULL_WIDTH
|
28560 | || _this.name === RowContainerName.STICKY_TOP_FULL_WIDTH
|
28561 | || _this.name === RowContainerName.BOTTOM_FULL_WIDTH
|
28562 | || _this.name === RowContainerName.FULL_WIDTH;
|
28563 | return _this;
|
28564 | }
|
28565 | RowContainerCtrl.getRowContainerCssClasses = function (name) {
|
28566 | var containerClass = ContainerCssClasses.get(name);
|
28567 | var viewportClass = ViewportCssClasses.get(name);
|
28568 | var wrapperClass = WrapperCssClasses.get(name);
|
28569 | return { container: containerClass, viewport: viewportClass, wrapper: wrapperClass };
|
28570 | };
|
28571 | RowContainerCtrl.getPinned = function (name) {
|
28572 | switch (name) {
|
28573 | case RowContainerName.BOTTOM_LEFT:
|
28574 | case RowContainerName.TOP_LEFT:
|
28575 | case RowContainerName.STICKY_TOP_LEFT:
|
28576 | case RowContainerName.LEFT:
|
28577 | return 'left';
|
28578 | case RowContainerName.BOTTOM_RIGHT:
|
28579 | case RowContainerName.TOP_RIGHT:
|
28580 | case RowContainerName.STICKY_TOP_RIGHT:
|
28581 | case RowContainerName.RIGHT:
|
28582 | return 'right';
|
28583 | default:
|
28584 | return null;
|
28585 | }
|
28586 | };
|
28587 | RowContainerCtrl.prototype.postConstruct = function () {
|
28588 | var _this = this;
|
28589 | this.enableRtl = this.gridOptionsService.is('enableRtl');
|
28590 | this.embedFullWidthRows = this.gridOptionsService.is('embedFullWidthRows');
|
28591 | this.forContainers([RowContainerName.CENTER], function () { return _this.viewportSizeFeature = _this.createManagedBean(new ViewportSizeFeature(_this)); });
|
28592 | };
|
28593 | RowContainerCtrl.prototype.registerWithCtrlsService = function () {
|
28594 | switch (this.name) {
|
28595 | case RowContainerName.CENTER:
|
28596 | this.ctrlsService.registerCenterRowContainerCtrl(this);
|
28597 | break;
|
28598 | case RowContainerName.LEFT:
|
28599 | this.ctrlsService.registerLeftRowContainerCtrl(this);
|
28600 | break;
|
28601 | case RowContainerName.RIGHT:
|
28602 | this.ctrlsService.registerRightRowContainerCtrl(this);
|
28603 | break;
|
28604 | case RowContainerName.TOP_CENTER:
|
28605 | this.ctrlsService.registerTopCenterRowContainerCtrl(this);
|
28606 | break;
|
28607 | case RowContainerName.TOP_LEFT:
|
28608 | this.ctrlsService.registerTopLeftRowContainerCon(this);
|
28609 | break;
|
28610 | case RowContainerName.TOP_RIGHT:
|
28611 | this.ctrlsService.registerTopRightRowContainerCtrl(this);
|
28612 | break;
|
28613 | case RowContainerName.STICKY_TOP_CENTER:
|
28614 | this.ctrlsService.registerStickyTopCenterRowContainerCtrl(this);
|
28615 | break;
|
28616 | case RowContainerName.STICKY_TOP_LEFT:
|
28617 | this.ctrlsService.registerStickyTopLeftRowContainerCon(this);
|
28618 | break;
|
28619 | case RowContainerName.STICKY_TOP_RIGHT:
|
28620 | this.ctrlsService.registerStickyTopRightRowContainerCtrl(this);
|
28621 | break;
|
28622 | case RowContainerName.BOTTOM_CENTER:
|
28623 | this.ctrlsService.registerBottomCenterRowContainerCtrl(this);
|
28624 | break;
|
28625 | case RowContainerName.BOTTOM_LEFT:
|
28626 | this.ctrlsService.registerBottomLeftRowContainerCtrl(this);
|
28627 | break;
|
28628 | case RowContainerName.BOTTOM_RIGHT:
|
28629 | this.ctrlsService.registerBottomRightRowContainerCtrl(this);
|
28630 | break;
|
28631 | }
|
28632 | };
|
28633 | RowContainerCtrl.prototype.forContainers = function (names, callback) {
|
28634 | if (names.indexOf(this.name) >= 0) {
|
28635 | callback();
|
28636 | }
|
28637 | };
|
28638 | RowContainerCtrl.prototype.getContainerElement = function () {
|
28639 | return this.eContainer;
|
28640 | };
|
28641 | RowContainerCtrl.prototype.getViewportSizeFeature = function () {
|
28642 | return this.viewportSizeFeature;
|
28643 | };
|
28644 | RowContainerCtrl.prototype.setComp = function (view, eContainer, eViewport, eWrapper) {
|
28645 | var _this = this;
|
28646 | this.comp = view;
|
28647 | this.eContainer = eContainer;
|
28648 | this.eViewport = eViewport;
|
28649 | this.eWrapper = eWrapper;
|
28650 | this.createManagedBean(new RowContainerEventsFeature(this.eContainer));
|
28651 | this.addPreventScrollWhileDragging();
|
28652 | this.listenOnDomOrder();
|
28653 | this.stopHScrollOnPinnedRows();
|
28654 | var allTopNoFW = [RowContainerName.TOP_CENTER, RowContainerName.TOP_LEFT, RowContainerName.TOP_RIGHT];
|
28655 | var allStickyTopNoFW = [RowContainerName.STICKY_TOP_CENTER, RowContainerName.STICKY_TOP_LEFT, RowContainerName.STICKY_TOP_RIGHT];
|
28656 | var allBottomNoFW = [RowContainerName.BOTTOM_CENTER, RowContainerName.BOTTOM_LEFT, RowContainerName.BOTTOM_RIGHT];
|
28657 | var allMiddleNoFW = [RowContainerName.CENTER, RowContainerName.LEFT, RowContainerName.RIGHT];
|
28658 | var allNoFW = __spread$f(allTopNoFW, allBottomNoFW, allMiddleNoFW, allStickyTopNoFW);
|
28659 | var allMiddle = [RowContainerName.CENTER, RowContainerName.LEFT, RowContainerName.RIGHT, RowContainerName.FULL_WIDTH];
|
28660 | var allCenter = [RowContainerName.CENTER, RowContainerName.TOP_CENTER, RowContainerName.STICKY_TOP_CENTER, RowContainerName.BOTTOM_CENTER];
|
28661 | var allLeft = [RowContainerName.LEFT, RowContainerName.BOTTOM_LEFT, RowContainerName.TOP_LEFT, RowContainerName.STICKY_TOP_LEFT];
|
28662 | var allRight = [RowContainerName.RIGHT, RowContainerName.BOTTOM_RIGHT, RowContainerName.TOP_RIGHT, RowContainerName.STICKY_TOP_RIGHT];
|
28663 | this.forContainers(allLeft, function () {
|
28664 | _this.pinnedWidthFeature = _this.createManagedBean(new SetPinnedLeftWidthFeature(_this.eContainer));
|
28665 | _this.addManagedListener(_this.eventService, Events.EVENT_LEFT_PINNED_WIDTH_CHANGED, function () { return _this.onPinnedWidthChanged(); });
|
28666 | });
|
28667 | this.forContainers(allRight, function () {
|
28668 | _this.pinnedWidthFeature = _this.createManagedBean(new SetPinnedRightWidthFeature(_this.eContainer));
|
28669 | _this.addManagedListener(_this.eventService, Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED, function () { return _this.onPinnedWidthChanged(); });
|
28670 | });
|
28671 | this.forContainers(allMiddle, function () { return _this.createManagedBean(new SetHeightFeature(_this.eContainer, _this.eWrapper)); });
|
28672 | this.forContainers(allNoFW, function () { return _this.createManagedBean(new DragListenerFeature(_this.eContainer)); });
|
28673 | this.forContainers(allCenter, function () { return _this.createManagedBean(new CenterWidthFeature(function (width) { return _this.comp.setContainerWidth(width + "px"); })); });
|
28674 | if (isInvisibleScrollbar()) {
|
28675 | this.forContainers([RowContainerName.CENTER], function () {
|
28676 | var pinnedWidthChangedEvent = _this.enableRtl ? Events.EVENT_LEFT_PINNED_WIDTH_CHANGED : Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED;
|
28677 | _this.addManagedListener(_this.eventService, pinnedWidthChangedEvent, function () { return _this.refreshPaddingForFakeScrollbar(); });
|
28678 | });
|
28679 | this.refreshPaddingForFakeScrollbar();
|
28680 | }
|
28681 | this.addListeners();
|
28682 | this.registerWithCtrlsService();
|
28683 | };
|
28684 | RowContainerCtrl.prototype.refreshPaddingForFakeScrollbar = function () {
|
28685 | var _a = this, enableRtl = _a.enableRtl, columnModel = _a.columnModel, name = _a.name, eWrapper = _a.eWrapper, eContainer = _a.eContainer;
|
28686 | var sideToCheck = enableRtl ? RowContainerName.LEFT : RowContainerName.RIGHT;
|
28687 | this.forContainers([RowContainerName.CENTER, sideToCheck], function () {
|
28688 | var pinnedWidth = columnModel.getContainerWidth(sideToCheck);
|
28689 | var marginSide = enableRtl ? 'marginLeft' : 'marginRight';
|
28690 | if (name === RowContainerName.CENTER) {
|
28691 | eWrapper.style[marginSide] = pinnedWidth ? '0px' : '16px';
|
28692 | }
|
28693 | else {
|
28694 | eContainer.style[marginSide] = pinnedWidth ? '16px' : '0px';
|
28695 | }
|
28696 | });
|
28697 | };
|
28698 | RowContainerCtrl.prototype.addListeners = function () {
|
28699 | var _this = this;
|
28700 | this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, function () { return _this.onScrollVisibilityChanged(); });
|
28701 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, function () { return _this.onDisplayedColumnsChanged(); });
|
28702 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, function () { return _this.onDisplayedColumnsWidthChanged(); });
|
28703 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_ROWS_CHANGED, function () { return _this.onDisplayedRowsChanged(); });
|
28704 | this.onScrollVisibilityChanged();
|
28705 | this.onDisplayedColumnsChanged();
|
28706 | this.onDisplayedColumnsWidthChanged();
|
28707 | this.onDisplayedRowsChanged();
|
28708 | };
|
28709 | RowContainerCtrl.prototype.listenOnDomOrder = function () {
|
28710 | var _this = this;
|
28711 |
|
28712 | var allStickyContainers = [RowContainerName.STICKY_TOP_CENTER, RowContainerName.STICKY_TOP_LEFT, RowContainerName.STICKY_TOP_RIGHT, RowContainerName.STICKY_TOP_FULL_WIDTH];
|
28713 | var isStickContainer = allStickyContainers.indexOf(this.name) >= 0;
|
28714 | if (isStickContainer) {
|
28715 | this.comp.setDomOrder(true);
|
28716 | return;
|
28717 | }
|
28718 | var listener = function () {
|
28719 | var isEnsureDomOrder = _this.gridOptionsService.is('ensureDomOrder');
|
28720 | var isPrintLayout = _this.gridOptionsService.isDomLayout('print');
|
28721 | _this.comp.setDomOrder(isEnsureDomOrder || isPrintLayout);
|
28722 | };
|
28723 | this.addManagedPropertyListener('domLayout', listener);
|
28724 | listener();
|
28725 | };
|
28726 |
|
28727 |
|
28728 |
|
28729 | RowContainerCtrl.prototype.stopHScrollOnPinnedRows = function () {
|
28730 | var _this = this;
|
28731 | this.forContainers([RowContainerName.TOP_CENTER, RowContainerName.STICKY_TOP_CENTER, RowContainerName.BOTTOM_CENTER], function () {
|
28732 | var resetScrollLeft = function () { return _this.eViewport.scrollLeft = 0; };
|
28733 | _this.addManagedListener(_this.eViewport, 'scroll', resetScrollLeft);
|
28734 | });
|
28735 | };
|
28736 | RowContainerCtrl.prototype.onDisplayedColumnsChanged = function () {
|
28737 | var _this = this;
|
28738 | this.forContainers([RowContainerName.CENTER], function () { return _this.onHorizontalViewportChanged(); });
|
28739 | };
|
28740 | RowContainerCtrl.prototype.onDisplayedColumnsWidthChanged = function () {
|
28741 | var _this = this;
|
28742 | this.forContainers([RowContainerName.CENTER], function () { return _this.onHorizontalViewportChanged(); });
|
28743 | };
|
28744 | RowContainerCtrl.prototype.onScrollVisibilityChanged = function () {
|
28745 | if (this.name !== RowContainerName.CENTER) {
|
28746 | return;
|
28747 | }
|
28748 | var visible = this.scrollVisibleService.isHorizontalScrollShowing();
|
28749 | var scrollbarWidth = visible ? (this.gridOptionsService.getScrollbarWidth() || 0) : 0;
|
28750 | var height = scrollbarWidth == 0 ? '100%' : "calc(100% + " + scrollbarWidth + "px)";
|
28751 | this.comp.setViewportHeight(height);
|
28752 | };
|
28753 |
|
28754 |
|
28755 | RowContainerCtrl.prototype.addPreventScrollWhileDragging = function () {
|
28756 | var _this = this;
|
28757 | var preventScroll = function (e) {
|
28758 | if (_this.dragService.isDragging()) {
|
28759 | if (e.cancelable) {
|
28760 | e.preventDefault();
|
28761 | }
|
28762 | }
|
28763 | };
|
28764 | this.eContainer.addEventListener('touchmove', preventScroll, { passive: false });
|
28765 | this.addDestroyFunc(function () { return _this.eContainer.removeEventListener('touchmove', preventScroll); });
|
28766 | };
|
28767 |
|
28768 |
|
28769 |
|
28770 | RowContainerCtrl.prototype.onHorizontalViewportChanged = function () {
|
28771 | var scrollWidth = this.getCenterWidth();
|
28772 | var scrollPosition = this.getCenterViewportScrollLeft();
|
28773 | this.columnModel.setViewportPosition(scrollWidth, scrollPosition);
|
28774 | };
|
28775 | RowContainerCtrl.prototype.getCenterWidth = function () {
|
28776 | return getInnerWidth(this.eViewport);
|
28777 | };
|
28778 | RowContainerCtrl.prototype.getCenterViewportScrollLeft = function () {
|
28779 |
|
28780 | return getScrollLeft(this.eViewport, this.enableRtl);
|
28781 | };
|
28782 | RowContainerCtrl.prototype.registerViewportResizeListener = function (listener) {
|
28783 | var unsubscribeFromResize = this.resizeObserverService.observeResize(this.eViewport, listener);
|
28784 | this.addDestroyFunc(function () { return unsubscribeFromResize(); });
|
28785 | };
|
28786 | RowContainerCtrl.prototype.isViewportVisible = function () {
|
28787 | return isVisible(this.eViewport);
|
28788 | };
|
28789 | RowContainerCtrl.prototype.isViewportHScrollShowing = function () {
|
28790 | return isHorizontalScrollShowing(this.eViewport);
|
28791 | };
|
28792 | RowContainerCtrl.prototype.getViewportScrollLeft = function () {
|
28793 | return getScrollLeft(this.eViewport, this.enableRtl);
|
28794 | };
|
28795 | RowContainerCtrl.prototype.isHorizontalScrollShowing = function () {
|
28796 | var isAlwaysShowHorizontalScroll = this.gridOptionsService.is('alwaysShowHorizontalScroll');
|
28797 | return isAlwaysShowHorizontalScroll || isHorizontalScrollShowing(this.eViewport);
|
28798 | };
|
28799 | RowContainerCtrl.prototype.getViewportElement = function () {
|
28800 | return this.eViewport;
|
28801 | };
|
28802 | RowContainerCtrl.prototype.setContainerTranslateX = function (amount) {
|
28803 | this.eContainer.style.transform = "translateX(" + amount + "px)";
|
28804 | };
|
28805 | RowContainerCtrl.prototype.getHScrollPosition = function () {
|
28806 | var res = {
|
28807 | left: this.eViewport.scrollLeft,
|
28808 | right: this.eViewport.scrollLeft + this.eViewport.offsetWidth
|
28809 | };
|
28810 | return res;
|
28811 | };
|
28812 | RowContainerCtrl.prototype.setCenterViewportScrollLeft = function (value) {
|
28813 |
|
28814 | setScrollLeft(this.eViewport, value, this.enableRtl);
|
28815 | };
|
28816 | RowContainerCtrl.prototype.isContainerVisible = function () {
|
28817 | var pinned = RowContainerCtrl.getPinned(this.name);
|
28818 | return !pinned || (!!this.pinnedWidthFeature && this.pinnedWidthFeature.getWidth() > 0);
|
28819 | };
|
28820 | RowContainerCtrl.prototype.onPinnedWidthChanged = function () {
|
28821 | var visible = this.isContainerVisible();
|
28822 | if (this.visible != visible) {
|
28823 | this.visible = visible;
|
28824 | this.onDisplayedRowsChanged();
|
28825 | }
|
28826 | if (isInvisibleScrollbar()) {
|
28827 | this.refreshPaddingForFakeScrollbar();
|
28828 | }
|
28829 | };
|
28830 | RowContainerCtrl.prototype.onDisplayedRowsChanged = function () {
|
28831 | var _this = this;
|
28832 | if (this.visible) {
|
28833 | var printLayout_1 = this.gridOptionsService.isDomLayout('print');
|
28834 | var doesRowMatch = function (rowCtrl) {
|
28835 | var fullWidthRow = rowCtrl.isFullWidth();
|
28836 | var embedFW = _this.embedFullWidthRows || printLayout_1;
|
28837 | var match = _this.isFullWithContainer ?
|
28838 | !embedFW && fullWidthRow
|
28839 | : embedFW || !fullWidthRow;
|
28840 | return match;
|
28841 | };
|
28842 |
|
28843 |
|
28844 | var rowsThisContainer = this.getRowCtrls().filter(doesRowMatch);
|
28845 | this.comp.setRowCtrls(rowsThisContainer);
|
28846 | }
|
28847 | else {
|
28848 | this.comp.setRowCtrls(this.EMPTY_CTRLS);
|
28849 | }
|
28850 | };
|
28851 | RowContainerCtrl.prototype.getRowCtrls = function () {
|
28852 | switch (this.name) {
|
28853 | case RowContainerName.TOP_CENTER:
|
28854 | case RowContainerName.TOP_LEFT:
|
28855 | case RowContainerName.TOP_RIGHT:
|
28856 | case RowContainerName.TOP_FULL_WIDTH:
|
28857 | return this.rowRenderer.getTopRowCtrls();
|
28858 | case RowContainerName.STICKY_TOP_CENTER:
|
28859 | case RowContainerName.STICKY_TOP_LEFT:
|
28860 | case RowContainerName.STICKY_TOP_RIGHT:
|
28861 | case RowContainerName.STICKY_TOP_FULL_WIDTH:
|
28862 | return this.rowRenderer.getStickyTopRowCtrls();
|
28863 | case RowContainerName.BOTTOM_CENTER:
|
28864 | case RowContainerName.BOTTOM_LEFT:
|
28865 | case RowContainerName.BOTTOM_RIGHT:
|
28866 | case RowContainerName.BOTTOM_FULL_WIDTH:
|
28867 | return this.rowRenderer.getBottomRowCtrls();
|
28868 | default:
|
28869 | return this.rowRenderer.getRowCtrls();
|
28870 | }
|
28871 | };
|
28872 | __decorate$1D([
|
28873 | Autowired('scrollVisibleService')
|
28874 | ], RowContainerCtrl.prototype, "scrollVisibleService", void 0);
|
28875 | __decorate$1D([
|
28876 | Autowired('dragService')
|
28877 | ], RowContainerCtrl.prototype, "dragService", void 0);
|
28878 | __decorate$1D([
|
28879 | Autowired('ctrlsService')
|
28880 | ], RowContainerCtrl.prototype, "ctrlsService", void 0);
|
28881 | __decorate$1D([
|
28882 | Autowired('columnModel')
|
28883 | ], RowContainerCtrl.prototype, "columnModel", void 0);
|
28884 | __decorate$1D([
|
28885 | Autowired('resizeObserverService')
|
28886 | ], RowContainerCtrl.prototype, "resizeObserverService", void 0);
|
28887 | __decorate$1D([
|
28888 | Autowired('rowRenderer')
|
28889 | ], RowContainerCtrl.prototype, "rowRenderer", void 0);
|
28890 | __decorate$1D([
|
28891 | PostConstruct
|
28892 | ], RowContainerCtrl.prototype, "postConstruct", null);
|
28893 | return RowContainerCtrl;
|
28894 | }(BeanStub));
|
28895 |
|
28896 |
|
28897 |
|
28898 |
|
28899 |
|
28900 |
|
28901 |
|
28902 | var __extends$1F = (undefined && undefined.__extends) || (function () {
|
28903 | var extendStatics = function (d, b) {
|
28904 | extendStatics = Object.setPrototypeOf ||
|
28905 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
28906 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
28907 | return extendStatics(d, b);
|
28908 | };
|
28909 | return function (d, b) {
|
28910 | extendStatics(d, b);
|
28911 | function __() { this.constructor = d; }
|
28912 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
28913 | };
|
28914 | })();
|
28915 | var __decorate$1C = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
28916 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28917 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
28918 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
28919 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
28920 | };
|
28921 | var GRID_BODY_TEMPLATE = "<div class=\"ag-root ag-unselectable\" role=\"treegrid\">\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\" ref=\"eBody\" role=\"presentation\">\n <div class=\"ag-body-clipper\" ref=\"eBodyClipper\" role=\"presentation\">\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>\n <ag-fake-vertical-scroll></ag-fake-vertical-scroll>\n </div>\n <div class=\"ag-sticky-top\" ref=\"eStickyTop\" role=\"presentation\">\n <ag-row-container ref=\"stickyTopLeftContainer\" name=\"" + RowContainerName.STICKY_TOP_LEFT + "\"></ag-row-container>\n <ag-row-container ref=\"stickyTopCenterContainer\" name=\"" + RowContainerName.STICKY_TOP_CENTER + "\"></ag-row-container>\n <ag-row-container ref=\"stickyTopRightContainer\" name=\"" + RowContainerName.STICKY_TOP_RIGHT + "\"></ag-row-container>\n <ag-row-container ref=\"stickyTopFullWidthContainer\" name=\"" + RowContainerName.STICKY_TOP_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>";
|
28922 | var GridBodyComp = (function (_super) {
|
28923 | __extends$1F(GridBodyComp, _super);
|
28924 | function GridBodyComp() {
|
28925 | return _super.call(this, GRID_BODY_TEMPLATE) || this;
|
28926 | }
|
28927 | GridBodyComp.prototype.init = function () {
|
28928 | var _this = this;
|
28929 | var setHeight = function (height, element) {
|
28930 | var heightString = height + "px";
|
28931 | element.style.minHeight = heightString;
|
28932 | element.style.height = heightString;
|
28933 | };
|
28934 | var compProxy = {
|
28935 | setRowAnimationCssOnBodyViewport: function (cssClass, animate) { return _this.setRowAnimationCssOnBodyViewport(cssClass, animate); },
|
28936 | setColumnCount: function (count) { return setAriaColCount(_this.getGui(), count); },
|
28937 | setRowCount: function (count) { return setAriaRowCount(_this.getGui(), count); },
|
28938 | setTopHeight: function (height) { return setHeight(height, _this.eTop); },
|
28939 | setBottomHeight: function (height) { return setHeight(height, _this.eBottom); },
|
28940 | setTopDisplay: function (display) { return _this.eTop.style.display = display; },
|
28941 | setBottomDisplay: function (display) { return _this.eBottom.style.display = display; },
|
28942 | setStickyTopHeight: function (height) { return _this.eStickyTop.style.height = height; },
|
28943 | setStickyTopTop: function (top) { return _this.eStickyTop.style.top = top; },
|
28944 | setStickyTopWidth: function (width) { return _this.eStickyTop.style.width = width; },
|
28945 | setColumnMovingCss: function (cssClass, flag) { return _this.addOrRemoveCssClass(cssClass, flag); },
|
28946 | updateLayoutClasses: function (cssClass, params) {
|
28947 | var classLists = [
|
28948 | _this.eBodyViewport.classList,
|
28949 | _this.eBodyClipper.classList,
|
28950 | _this.eBody.classList
|
28951 | ];
|
28952 | classLists.forEach(function (classList) {
|
28953 | classList.toggle(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
|
28954 | classList.toggle(LayoutCssClasses.NORMAL, params.normal);
|
28955 | classList.toggle(LayoutCssClasses.PRINT, params.print);
|
28956 | });
|
28957 | _this.addOrRemoveCssClass(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
|
28958 | _this.addOrRemoveCssClass(LayoutCssClasses.NORMAL, params.normal);
|
28959 | _this.addOrRemoveCssClass(LayoutCssClasses.PRINT, params.print);
|
28960 | },
|
28961 | setAlwaysVerticalScrollClass: function (cssClass, on) {
|
28962 | return _this.eBodyViewport.classList.toggle(CSS_CLASS_FORCE_VERTICAL_SCROLL, on);
|
28963 | },
|
28964 | registerBodyViewportResizeListener: function (listener) {
|
28965 | var unsubscribeFromResize = _this.resizeObserverService.observeResize(_this.eBodyViewport, listener);
|
28966 | _this.addDestroyFunc(function () { return unsubscribeFromResize(); });
|
28967 | },
|
28968 | setPinnedTopBottomOverflowY: function (overflow) { return _this.eTop.style.overflowY = _this.eBottom.style.overflowY = overflow; },
|
28969 | setCellSelectableCss: function (cssClass, selectable) {
|
28970 | [_this.eTop, _this.eBodyViewport, _this.eBottom]
|
28971 | .forEach(function (ct) { return ct.classList.toggle(CSS_CLASS_CELL_SELECTABLE, selectable); });
|
28972 | },
|
28973 | setBodyViewportWidth: function (width) { return _this.eBodyViewport.style.width = width; }
|
28974 | };
|
28975 | this.ctrl = this.createManagedBean(new GridBodyCtrl());
|
28976 | this.ctrl.setComp(compProxy, this.getGui(), this.eBodyViewport, this.eTop, this.eBottom, this.eStickyTop);
|
28977 | if (this.rangeService || this.gridOptionsService.get('rowSelection') === 'multiple') {
|
28978 | setAriaMultiSelectable(this.getGui(), true);
|
28979 | }
|
28980 | };
|
28981 | GridBodyComp.prototype.setRowAnimationCssOnBodyViewport = function (cssClass, animateRows) {
|
28982 | var bodyViewportClassList = this.eBodyViewport.classList;
|
28983 | bodyViewportClassList.toggle(RowAnimationCssClasses.ANIMATION_ON, animateRows);
|
28984 | bodyViewportClassList.toggle(RowAnimationCssClasses.ANIMATION_OFF, !animateRows);
|
28985 | };
|
28986 | GridBodyComp.prototype.getFloatingTopBottom = function () {
|
28987 | return [this.eTop, this.eBottom];
|
28988 | };
|
28989 | __decorate$1C([
|
28990 | Autowired('resizeObserverService')
|
28991 | ], GridBodyComp.prototype, "resizeObserverService", void 0);
|
28992 | __decorate$1C([
|
28993 | Optional('rangeService')
|
28994 | ], GridBodyComp.prototype, "rangeService", void 0);
|
28995 | __decorate$1C([
|
28996 | RefSelector('eBodyViewport')
|
28997 | ], GridBodyComp.prototype, "eBodyViewport", void 0);
|
28998 | __decorate$1C([
|
28999 | RefSelector('eStickyTop')
|
29000 | ], GridBodyComp.prototype, "eStickyTop", void 0);
|
29001 | __decorate$1C([
|
29002 | RefSelector('eTop')
|
29003 | ], GridBodyComp.prototype, "eTop", void 0);
|
29004 | __decorate$1C([
|
29005 | RefSelector('eBottom')
|
29006 | ], GridBodyComp.prototype, "eBottom", void 0);
|
29007 | __decorate$1C([
|
29008 | RefSelector('gridHeader')
|
29009 | ], GridBodyComp.prototype, "headerRootComp", void 0);
|
29010 | __decorate$1C([
|
29011 | RefSelector('eBodyClipper')
|
29012 | ], GridBodyComp.prototype, "eBodyClipper", void 0);
|
29013 | __decorate$1C([
|
29014 | RefSelector('eBody')
|
29015 | ], GridBodyComp.prototype, "eBody", void 0);
|
29016 | __decorate$1C([
|
29017 | PostConstruct
|
29018 | ], GridBodyComp.prototype, "init", null);
|
29019 | return GridBodyComp;
|
29020 | }(Component));
|
29021 |
|
29022 |
|
29023 |
|
29024 |
|
29025 |
|
29026 |
|
29027 |
|
29028 | var __extends$1E = (undefined && undefined.__extends) || (function () {
|
29029 | var extendStatics = function (d, b) {
|
29030 | extendStatics = Object.setPrototypeOf ||
|
29031 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
29032 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
29033 | return extendStatics(d, b);
|
29034 | };
|
29035 | return function (d, b) {
|
29036 | extendStatics(d, b);
|
29037 | function __() { this.constructor = d; }
|
29038 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29039 | };
|
29040 | })();
|
29041 | var __decorate$1B = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
29042 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
29043 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
29044 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
29045 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
29046 | };
|
29047 | var ScrollVisibleService = (function (_super) {
|
29048 | __extends$1E(ScrollVisibleService, _super);
|
29049 | function ScrollVisibleService() {
|
29050 | return _super !== null && _super.apply(this, arguments) || this;
|
29051 | }
|
29052 | ScrollVisibleService.prototype.postConstruct = function () {
|
29053 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
|
29054 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onDisplayedColumnsWidthChanged.bind(this));
|
29055 | };
|
29056 | ScrollVisibleService.prototype.onDisplayedColumnsChanged = function () {
|
29057 | this.update();
|
29058 | };
|
29059 | ScrollVisibleService.prototype.onDisplayedColumnsWidthChanged = function () {
|
29060 | this.update();
|
29061 | };
|
29062 | ScrollVisibleService.prototype.update = function () {
|
29063 |
|
29064 |
|
29065 |
|
29066 |
|
29067 |
|
29068 |
|
29069 | this.updateImpl();
|
29070 | setTimeout(this.updateImpl.bind(this), 500);
|
29071 | };
|
29072 | ScrollVisibleService.prototype.updateImpl = function () {
|
29073 | var centerRowCtrl = this.ctrlsService.getCenterRowContainerCtrl();
|
29074 | if (!centerRowCtrl) {
|
29075 | return;
|
29076 | }
|
29077 | var params = {
|
29078 | horizontalScrollShowing: centerRowCtrl.isHorizontalScrollShowing(),
|
29079 | verticalScrollShowing: this.isVerticalScrollShowing()
|
29080 | };
|
29081 | this.setScrollsVisible(params);
|
29082 | };
|
29083 | ScrollVisibleService.prototype.setScrollsVisible = function (params) {
|
29084 | var atLeastOneDifferent = this.horizontalScrollShowing !== params.horizontalScrollShowing ||
|
29085 | this.verticalScrollShowing !== params.verticalScrollShowing;
|
29086 | if (atLeastOneDifferent) {
|
29087 | this.horizontalScrollShowing = params.horizontalScrollShowing;
|
29088 | this.verticalScrollShowing = params.verticalScrollShowing;
|
29089 | var event_1 = {
|
29090 | type: Events.EVENT_SCROLL_VISIBILITY_CHANGED
|
29091 | };
|
29092 | this.eventService.dispatchEvent(event_1);
|
29093 | }
|
29094 | };
|
29095 |
|
29096 | ScrollVisibleService.prototype.isHorizontalScrollShowing = function () {
|
29097 | return this.horizontalScrollShowing;
|
29098 | };
|
29099 |
|
29100 | ScrollVisibleService.prototype.isVerticalScrollShowing = function () {
|
29101 | return this.verticalScrollShowing;
|
29102 | };
|
29103 | __decorate$1B([
|
29104 | Autowired('ctrlsService')
|
29105 | ], ScrollVisibleService.prototype, "ctrlsService", void 0);
|
29106 | __decorate$1B([
|
29107 | PostConstruct
|
29108 | ], ScrollVisibleService.prototype, "postConstruct", null);
|
29109 | ScrollVisibleService = __decorate$1B([
|
29110 | Bean('scrollVisibleService')
|
29111 | ], ScrollVisibleService);
|
29112 | return ScrollVisibleService;
|
29113 | }(BeanStub));
|
29114 |
|
29115 |
|
29116 |
|
29117 |
|
29118 |
|
29119 |
|
29120 |
|
29121 | var __extends$1D = (undefined && undefined.__extends) || (function () {
|
29122 | var extendStatics = function (d, b) {
|
29123 | extendStatics = Object.setPrototypeOf ||
|
29124 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
29125 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
29126 | return extendStatics(d, b);
|
29127 | };
|
29128 | return function (d, b) {
|
29129 | extendStatics(d, b);
|
29130 | function __() { this.constructor = d; }
|
29131 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29132 | };
|
29133 | })();
|
29134 | var __decorate$1A = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
29135 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
29136 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
29137 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
29138 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
29139 | };
|
29140 | var MouseEventService = (function (_super) {
|
29141 | __extends$1D(MouseEventService, _super);
|
29142 | function MouseEventService() {
|
29143 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
29144 | _this.gridInstanceId = MouseEventService_1.gridInstanceSequence.next();
|
29145 | return _this;
|
29146 | }
|
29147 | MouseEventService_1 = MouseEventService;
|
29148 |
|
29149 |
|
29150 |
|
29151 | MouseEventService.prototype.stampTopLevelGridCompWithGridInstance = function (eGridDiv) {
|
29152 | eGridDiv[MouseEventService_1.GRID_DOM_KEY] = this.gridInstanceId;
|
29153 | };
|
29154 | MouseEventService.prototype.getRenderedCellForEvent = function (event) {
|
29155 | return getCtrlForEvent(this.gridOptionsService, event, CellCtrl.DOM_DATA_KEY_CELL_CTRL);
|
29156 | };
|
29157 |
|
29158 |
|
29159 |
|
29160 | MouseEventService.prototype.isEventFromThisGrid = function (event) {
|
29161 | var res = this.isElementInThisGrid(event.target);
|
29162 | return res;
|
29163 | };
|
29164 | MouseEventService.prototype.isElementInThisGrid = function (element) {
|
29165 | var pointer = element;
|
29166 | while (pointer) {
|
29167 | var instanceId = pointer[MouseEventService_1.GRID_DOM_KEY];
|
29168 | if (exists(instanceId)) {
|
29169 | var eventFromThisGrid = instanceId === this.gridInstanceId;
|
29170 | return eventFromThisGrid;
|
29171 | }
|
29172 | pointer = pointer.parentElement;
|
29173 | }
|
29174 | return false;
|
29175 | };
|
29176 | MouseEventService.prototype.getCellPositionForEvent = function (event) {
|
29177 | var cellComp = this.getRenderedCellForEvent(event);
|
29178 | return cellComp ? cellComp.getCellPosition() : null;
|
29179 | };
|
29180 | MouseEventService.prototype.getNormalisedPosition = function (event) {
|
29181 | var gridPanelHasScrolls = this.gridOptionsService.isDomLayout('normal');
|
29182 | var e = event;
|
29183 | var x;
|
29184 | var y;
|
29185 | if (e.clientX != null || e.clientY != null) {
|
29186 | x = e.clientX;
|
29187 | y = e.clientY;
|
29188 | }
|
29189 | else {
|
29190 | x = e.x;
|
29191 | y = e.y;
|
29192 | }
|
29193 | if (gridPanelHasScrolls) {
|
29194 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
29195 | var vRange = gridBodyCon.getScrollFeature().getVScrollPosition();
|
29196 | var hRange = gridBodyCon.getScrollFeature().getHScrollPosition();
|
29197 | x += hRange.left;
|
29198 | y += vRange.top;
|
29199 | }
|
29200 | return { x: x, y: y };
|
29201 | };
|
29202 | var MouseEventService_1;
|
29203 | MouseEventService.gridInstanceSequence = new NumberSequence();
|
29204 | MouseEventService.GRID_DOM_KEY = '__ag_grid_instance';
|
29205 | __decorate$1A([
|
29206 | Autowired('ctrlsService')
|
29207 | ], MouseEventService.prototype, "ctrlsService", void 0);
|
29208 | MouseEventService = MouseEventService_1 = __decorate$1A([
|
29209 | Bean('mouseEventService')
|
29210 | ], MouseEventService);
|
29211 | return MouseEventService;
|
29212 | }(BeanStub));
|
29213 |
|
29214 |
|
29215 |
|
29216 |
|
29217 |
|
29218 |
|
29219 |
|
29220 | var __extends$1C = (undefined && undefined.__extends) || (function () {
|
29221 | var extendStatics = function (d, b) {
|
29222 | extendStatics = Object.setPrototypeOf ||
|
29223 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
29224 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
29225 | return extendStatics(d, b);
|
29226 | };
|
29227 | return function (d, b) {
|
29228 | extendStatics(d, b);
|
29229 | function __() { this.constructor = d; }
|
29230 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29231 | };
|
29232 | })();
|
29233 | var __assign$7 = (undefined && undefined.__assign) || function () {
|
29234 | __assign$7 = Object.assign || function(t) {
|
29235 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
29236 | s = arguments[i];
|
29237 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
29238 | t[p] = s[p];
|
29239 | }
|
29240 | return t;
|
29241 | };
|
29242 | return __assign$7.apply(this, arguments);
|
29243 | };
|
29244 | var __decorate$1z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
29245 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
29246 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
29247 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
29248 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
29249 | };
|
29250 | var NavigationService = (function (_super) {
|
29251 | __extends$1C(NavigationService, _super);
|
29252 | function NavigationService() {
|
29253 | var _this = _super.call(this) || this;
|
29254 | _this.onPageDown = throttle(_this.onPageDown, 100);
|
29255 | _this.onPageUp = throttle(_this.onPageUp, 100);
|
29256 | return _this;
|
29257 | }
|
29258 | NavigationService.prototype.postConstruct = function () {
|
29259 | var _this = this;
|
29260 | this.ctrlsService.whenReady(function (p) {
|
29261 | _this.gridBodyCon = p.gridBodyCtrl;
|
29262 | });
|
29263 | };
|
29264 | NavigationService.prototype.handlePageScrollingKey = function (event) {
|
29265 | var key = event.key;
|
29266 | var alt = event.altKey;
|
29267 | var ctrl = event.ctrlKey || event.metaKey;
|
29268 | var rangeServiceShouldHandleShift = !!this.rangeService && event.shiftKey;
|
29269 |
|
29270 | var currentCell = this.mouseEventService.getCellPositionForEvent(event);
|
29271 | var processed = false;
|
29272 | switch (key) {
|
29273 | case KeyCode.PAGE_HOME:
|
29274 | case KeyCode.PAGE_END:
|
29275 |
|
29276 | if (!ctrl && !alt) {
|
29277 | this.onHomeOrEndKey(key);
|
29278 | processed = true;
|
29279 | }
|
29280 | break;
|
29281 | case KeyCode.LEFT:
|
29282 | case KeyCode.RIGHT:
|
29283 | case KeyCode.UP:
|
29284 | case KeyCode.DOWN:
|
29285 | if (!currentCell) {
|
29286 | return false;
|
29287 | }
|
29288 |
|
29289 |
|
29290 | if (ctrl && !alt && !rangeServiceShouldHandleShift) {
|
29291 | this.onCtrlUpDownLeftRight(key, currentCell);
|
29292 | processed = true;
|
29293 | }
|
29294 | break;
|
29295 | case KeyCode.PAGE_DOWN:
|
29296 | if (!currentCell) {
|
29297 | return false;
|
29298 | }
|
29299 |
|
29300 | if (!ctrl && !alt) {
|
29301 | this.onPageDown(currentCell);
|
29302 | processed = true;
|
29303 | }
|
29304 | break;
|
29305 | case KeyCode.PAGE_UP:
|
29306 | if (!currentCell) {
|
29307 | return false;
|
29308 | }
|
29309 |
|
29310 | if (!ctrl && !alt) {
|
29311 | this.onPageUp(currentCell);
|
29312 | processed = true;
|
29313 | }
|
29314 | break;
|
29315 | }
|
29316 | if (processed) {
|
29317 | event.preventDefault();
|
29318 | }
|
29319 | return processed;
|
29320 | };
|
29321 | NavigationService.prototype.navigateTo = function (navigateParams) {
|
29322 | var scrollIndex = navigateParams.scrollIndex, scrollType = navigateParams.scrollType, scrollColumn = navigateParams.scrollColumn, focusIndex = navigateParams.focusIndex, focusColumn = navigateParams.focusColumn;
|
29323 | if (exists(scrollColumn) && !scrollColumn.isPinned()) {
|
29324 | this.gridBodyCon.getScrollFeature().ensureColumnVisible(scrollColumn);
|
29325 | }
|
29326 | if (exists(scrollIndex)) {
|
29327 | this.gridBodyCon.getScrollFeature().ensureIndexVisible(scrollIndex, scrollType);
|
29328 | }
|
29329 |
|
29330 |
|
29331 |
|
29332 |
|
29333 | if (!navigateParams.isAsync) {
|
29334 | this.gridBodyCon.getScrollFeature().ensureIndexVisible(focusIndex);
|
29335 | }
|
29336 |
|
29337 |
|
29338 | this.focusService.setFocusedCell({ rowIndex: focusIndex, column: focusColumn, rowPinned: null, forceBrowserFocus: true });
|
29339 | if (this.rangeService) {
|
29340 | var cellPosition = { rowIndex: focusIndex, rowPinned: null, column: focusColumn };
|
29341 | this.rangeService.setRangeToCell(cellPosition);
|
29342 | }
|
29343 | };
|
29344 | NavigationService.prototype.onPageDown = function (gridCell) {
|
29345 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
29346 | var scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();
|
29347 | var pixelsInOnePage = this.getViewportHeight();
|
29348 | var pagingPixelOffset = this.paginationProxy.getPixelOffset();
|
29349 | var currentPageBottomPixel = scrollPosition.top + pixelsInOnePage;
|
29350 | var currentPageBottomRow = this.paginationProxy.getRowIndexAtPixel(currentPageBottomPixel + pagingPixelOffset);
|
29351 | if (this.columnModel.isAutoRowHeightActive()) {
|
29352 | this.navigateToNextPageWithAutoHeight(gridCell, currentPageBottomRow);
|
29353 | }
|
29354 | else {
|
29355 | this.navigateToNextPage(gridCell, currentPageBottomRow);
|
29356 | }
|
29357 | };
|
29358 | NavigationService.prototype.onPageUp = function (gridCell) {
|
29359 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
29360 | var scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();
|
29361 | var pagingPixelOffset = this.paginationProxy.getPixelOffset();
|
29362 | var currentPageTopPixel = scrollPosition.top;
|
29363 | var currentPageTopRow = this.paginationProxy.getRowIndexAtPixel(currentPageTopPixel + pagingPixelOffset);
|
29364 | if (this.columnModel.isAutoRowHeightActive()) {
|
29365 | this.navigateToNextPageWithAutoHeight(gridCell, currentPageTopRow, true);
|
29366 | }
|
29367 | else {
|
29368 | this.navigateToNextPage(gridCell, currentPageTopRow, true);
|
29369 | }
|
29370 | };
|
29371 | NavigationService.prototype.navigateToNextPage = function (gridCell, scrollIndex, up) {
|
29372 | if (up === void 0) { up = false; }
|
29373 | var pixelsInOnePage = this.getViewportHeight();
|
29374 | var firstRow = this.paginationProxy.getPageFirstRow();
|
29375 | var lastRow = this.paginationProxy.getPageLastRow();
|
29376 | var pagingPixelOffset = this.paginationProxy.getPixelOffset();
|
29377 | var currentRowNode = this.paginationProxy.getRow(gridCell.rowIndex);
|
29378 | var rowPixelDiff = up
|
29379 | ? ((currentRowNode === null || currentRowNode === void 0 ? void 0 : currentRowNode.rowHeight) - pixelsInOnePage - pagingPixelOffset)
|
29380 | : (pixelsInOnePage - pagingPixelOffset);
|
29381 | var nextCellPixel = (currentRowNode === null || currentRowNode === void 0 ? void 0 : currentRowNode.rowTop) + rowPixelDiff;
|
29382 | var focusIndex = this.paginationProxy.getRowIndexAtPixel(nextCellPixel + pagingPixelOffset);
|
29383 | if (focusIndex === gridCell.rowIndex) {
|
29384 | var diff = up ? -1 : 1;
|
29385 | scrollIndex = focusIndex = gridCell.rowIndex + diff;
|
29386 | }
|
29387 | var scrollType;
|
29388 | if (up) {
|
29389 | scrollType = 'bottom';
|
29390 | if (focusIndex < firstRow) {
|
29391 | focusIndex = firstRow;
|
29392 | }
|
29393 | if (scrollIndex < firstRow) {
|
29394 | scrollIndex = firstRow;
|
29395 | }
|
29396 | }
|
29397 | else {
|
29398 | scrollType = 'top';
|
29399 | if (focusIndex > lastRow) {
|
29400 | focusIndex = lastRow;
|
29401 | }
|
29402 | if (scrollIndex > lastRow) {
|
29403 | scrollIndex = lastRow;
|
29404 | }
|
29405 | }
|
29406 | if (this.isRowTallerThanView(focusIndex)) {
|
29407 | scrollIndex = focusIndex;
|
29408 | scrollType = 'top';
|
29409 | }
|
29410 | this.navigateTo({
|
29411 | scrollIndex: scrollIndex,
|
29412 | scrollType: scrollType,
|
29413 | scrollColumn: null,
|
29414 | focusIndex: focusIndex,
|
29415 | focusColumn: gridCell.column
|
29416 | });
|
29417 | };
|
29418 | NavigationService.prototype.navigateToNextPageWithAutoHeight = function (gridCell, scrollIndex, up) {
|
29419 | var _this = this;
|
29420 | if (up === void 0) { up = false; }
|
29421 |
|
29422 |
|
29423 |
|
29424 |
|
29425 |
|
29426 |
|
29427 |
|
29428 | this.navigateTo({
|
29429 | scrollIndex: scrollIndex,
|
29430 | scrollType: up ? 'bottom' : 'top',
|
29431 | scrollColumn: null,
|
29432 | focusIndex: scrollIndex,
|
29433 | focusColumn: gridCell.column
|
29434 | });
|
29435 | setTimeout(function () {
|
29436 | var focusIndex = _this.getNextFocusIndexForAutoHeight(gridCell, up);
|
29437 | _this.navigateTo({
|
29438 | scrollIndex: scrollIndex,
|
29439 | scrollType: up ? 'bottom' : 'top',
|
29440 | scrollColumn: null,
|
29441 | focusIndex: focusIndex,
|
29442 | focusColumn: gridCell.column,
|
29443 | isAsync: true
|
29444 | });
|
29445 | }, 50);
|
29446 | };
|
29447 | NavigationService.prototype.getNextFocusIndexForAutoHeight = function (gridCell, up) {
|
29448 | var _a;
|
29449 | if (up === void 0) { up = false; }
|
29450 | var step = up ? -1 : 1;
|
29451 | var pixelsInOnePage = this.getViewportHeight();
|
29452 | var lastRowIndex = this.paginationProxy.getPageLastRow();
|
29453 | var pixelSum = 0;
|
29454 | var currentIndex = gridCell.rowIndex;
|
29455 | while (currentIndex >= 0 && currentIndex <= lastRowIndex) {
|
29456 | var currentCell = this.paginationProxy.getRow(currentIndex);
|
29457 | if (currentCell) {
|
29458 | var currentCellHeight = (_a = currentCell.rowHeight) !== null && _a !== void 0 ? _a : 0;
|
29459 | if (pixelSum + currentCellHeight > pixelsInOnePage) {
|
29460 | break;
|
29461 | }
|
29462 | pixelSum += currentCellHeight;
|
29463 | }
|
29464 | currentIndex += step;
|
29465 | }
|
29466 | return Math.max(0, Math.min(currentIndex, lastRowIndex));
|
29467 | };
|
29468 | NavigationService.prototype.getViewportHeight = function () {
|
29469 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
29470 | var scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();
|
29471 | var scrollbarWidth = this.gridOptionsService.getScrollbarWidth();
|
29472 | var pixelsInOnePage = scrollPosition.bottom - scrollPosition.top;
|
29473 | if (this.ctrlsService.getCenterRowContainerCtrl().isHorizontalScrollShowing()) {
|
29474 | pixelsInOnePage -= scrollbarWidth;
|
29475 | }
|
29476 | return pixelsInOnePage;
|
29477 | };
|
29478 | NavigationService.prototype.isRowTallerThanView = function (rowIndex) {
|
29479 | var rowNode = this.paginationProxy.getRow(rowIndex);
|
29480 | if (!rowNode) {
|
29481 | return false;
|
29482 | }
|
29483 | var rowHeight = rowNode.rowHeight;
|
29484 | if (typeof rowHeight !== 'number') {
|
29485 | return false;
|
29486 | }
|
29487 | return rowHeight > this.getViewportHeight();
|
29488 | };
|
29489 | NavigationService.prototype.onCtrlUpDownLeftRight = function (key, gridCell) {
|
29490 | var cellToFocus = this.cellNavigationService.getNextCellToFocus(key, gridCell, true);
|
29491 | var rowIndex = cellToFocus.rowIndex, column = cellToFocus.column;
|
29492 | this.navigateTo({
|
29493 | scrollIndex: rowIndex,
|
29494 | scrollType: null,
|
29495 | scrollColumn: column,
|
29496 | focusIndex: rowIndex,
|
29497 | focusColumn: column
|
29498 | });
|
29499 | };
|
29500 |
|
29501 |
|
29502 | NavigationService.prototype.onHomeOrEndKey = function (key) {
|
29503 | var homeKey = key === KeyCode.PAGE_HOME;
|
29504 | var allColumns = this.columnModel.getAllDisplayedColumns();
|
29505 | var columnToSelect = homeKey ? allColumns[0] : last(allColumns);
|
29506 | var scrollIndex = homeKey ? this.paginationProxy.getPageFirstRow() : this.paginationProxy.getPageLastRow();
|
29507 | this.navigateTo({
|
29508 | scrollIndex: scrollIndex,
|
29509 | scrollType: null,
|
29510 | scrollColumn: columnToSelect,
|
29511 | focusIndex: scrollIndex,
|
29512 | focusColumn: columnToSelect
|
29513 | });
|
29514 | };
|
29515 |
|
29516 | NavigationService.prototype.onTabKeyDown = function (previous, keyboardEvent) {
|
29517 | var backwards = keyboardEvent.shiftKey;
|
29518 | var movedToNextCell = this.tabToNextCellCommon(previous, backwards, keyboardEvent);
|
29519 | if (movedToNextCell) {
|
29520 |
|
29521 |
|
29522 | keyboardEvent.preventDefault();
|
29523 | return;
|
29524 | }
|
29525 |
|
29526 |
|
29527 | if (backwards) {
|
29528 | var _a = previous.getRowPosition(), rowIndex = _a.rowIndex, rowPinned = _a.rowPinned;
|
29529 | var firstRow = rowPinned ? rowIndex === 0 : rowIndex === this.paginationProxy.getPageFirstRow();
|
29530 | if (firstRow) {
|
29531 | keyboardEvent.preventDefault();
|
29532 | this.focusService.focusLastHeader(keyboardEvent);
|
29533 | }
|
29534 | }
|
29535 | else {
|
29536 |
|
29537 |
|
29538 |
|
29539 | if (previous instanceof CellCtrl) {
|
29540 | previous.focusCell(true);
|
29541 | }
|
29542 | if (this.focusService.focusNextGridCoreContainer(backwards)) {
|
29543 | keyboardEvent.preventDefault();
|
29544 | }
|
29545 | }
|
29546 | };
|
29547 |
|
29548 | NavigationService.prototype.tabToNextCell = function (backwards, event) {
|
29549 | var focusedCell = this.focusService.getFocusedCell();
|
29550 |
|
29551 | if (!focusedCell) {
|
29552 | return false;
|
29553 | }
|
29554 | var cellOrRow = this.getCellByPosition(focusedCell);
|
29555 |
|
29556 |
|
29557 | if (!cellOrRow) {
|
29558 | cellOrRow = this.rowRenderer.getRowByPosition(focusedCell);
|
29559 | if (!cellOrRow || !cellOrRow.isFullWidth()) {
|
29560 | return false;
|
29561 | }
|
29562 | }
|
29563 | return this.tabToNextCellCommon(cellOrRow, backwards, event);
|
29564 | };
|
29565 | NavigationService.prototype.tabToNextCellCommon = function (previous, backwards, event) {
|
29566 | var editing = previous.isEditing();
|
29567 |
|
29568 | if (!editing && previous instanceof CellCtrl) {
|
29569 | var cell = previous;
|
29570 | var row = cell.getRowCtrl();
|
29571 | if (row) {
|
29572 | editing = row.isEditing();
|
29573 | }
|
29574 | }
|
29575 | var res;
|
29576 | if (editing) {
|
29577 |
|
29578 | if (this.gridOptionsService.get('editType') === 'fullRow') {
|
29579 | res = this.moveToNextEditingRow(previous, backwards, event);
|
29580 | }
|
29581 | else {
|
29582 | res = this.moveToNextEditingCell(previous, backwards, event);
|
29583 | }
|
29584 | }
|
29585 | else {
|
29586 | res = this.moveToNextCellNotEditing(previous, backwards);
|
29587 | }
|
29588 |
|
29589 | return res || !!this.focusService.getFocusedHeader();
|
29590 | };
|
29591 | NavigationService.prototype.moveToNextEditingCell = function (previousCell, backwards, event) {
|
29592 | if (event === void 0) { event = null; }
|
29593 | var previousPos = previousCell.getCellPosition();
|
29594 |
|
29595 |
|
29596 | previousCell.getGui().focus();
|
29597 |
|
29598 |
|
29599 |
|
29600 |
|
29601 | previousCell.stopEditing();
|
29602 |
|
29603 | var nextCell = this.findNextCellToFocusOn(previousPos, backwards, true);
|
29604 | if (nextCell == null) {
|
29605 | return false;
|
29606 | }
|
29607 |
|
29608 |
|
29609 | nextCell.startEditing(null, null, true, event);
|
29610 | nextCell.focusCell(false);
|
29611 | return true;
|
29612 | };
|
29613 | NavigationService.prototype.moveToNextEditingRow = function (previousCell, backwards, event) {
|
29614 | if (event === void 0) { event = null; }
|
29615 | var previousPos = previousCell.getCellPosition();
|
29616 |
|
29617 | var nextCell = this.findNextCellToFocusOn(previousPos, backwards, true);
|
29618 | if (nextCell == null) {
|
29619 | return false;
|
29620 | }
|
29621 | var nextPos = nextCell.getCellPosition();
|
29622 | var previousEditable = this.isCellEditable(previousPos);
|
29623 | var nextEditable = this.isCellEditable(nextPos);
|
29624 | var rowsMatch = nextPos && previousPos.rowIndex === nextPos.rowIndex && previousPos.rowPinned === nextPos.rowPinned;
|
29625 | if (previousEditable) {
|
29626 | previousCell.setFocusOutOnEditor();
|
29627 | }
|
29628 | if (!rowsMatch) {
|
29629 | var pRow = previousCell.getRowCtrl();
|
29630 | pRow.stopEditing();
|
29631 | var nRow = nextCell.getRowCtrl();
|
29632 | nRow.startRowEditing(undefined, undefined, undefined, event);
|
29633 | }
|
29634 | if (nextEditable) {
|
29635 | nextCell.setFocusInOnEditor();
|
29636 | nextCell.focusCell();
|
29637 | }
|
29638 | else {
|
29639 | nextCell.focusCell(true);
|
29640 | }
|
29641 | return true;
|
29642 | };
|
29643 | NavigationService.prototype.moveToNextCellNotEditing = function (previousCell, backwards) {
|
29644 | var displayedColumns = this.columnModel.getAllDisplayedColumns();
|
29645 | var cellPos;
|
29646 | if (previousCell instanceof RowCtrl) {
|
29647 | cellPos = __assign$7(__assign$7({}, previousCell.getRowPosition()), { column: backwards ? displayedColumns[0] : last(displayedColumns) });
|
29648 | }
|
29649 | else {
|
29650 | cellPos = previousCell.getCellPosition();
|
29651 | }
|
29652 |
|
29653 | var nextCell = this.findNextCellToFocusOn(cellPos, backwards, false);
|
29654 |
|
29655 |
|
29656 | if (nextCell instanceof CellCtrl) {
|
29657 | nextCell.focusCell(true);
|
29658 | }
|
29659 | else if (nextCell) {
|
29660 | return this.tryToFocusFullWidthRow(nextCell.getRowPosition(), backwards);
|
29661 | }
|
29662 | return exists(nextCell);
|
29663 | };
|
29664 |
|
29665 |
|
29666 | NavigationService.prototype.findNextCellToFocusOn = function (previousPosition, backwards, startEditing) {
|
29667 | var nextPosition = previousPosition;
|
29668 | while (true) {
|
29669 | if (previousPosition !== nextPosition) {
|
29670 | previousPosition = nextPosition;
|
29671 | }
|
29672 | if (!backwards) {
|
29673 | nextPosition = this.getLastCellOfColSpan(nextPosition);
|
29674 | }
|
29675 | nextPosition = this.cellNavigationService.getNextTabbedCell(nextPosition, backwards);
|
29676 |
|
29677 | var userFunc = this.gridOptionsService.getCallback('tabToNextCell');
|
29678 | if (exists(userFunc)) {
|
29679 | var params = {
|
29680 | backwards: backwards,
|
29681 | editing: startEditing,
|
29682 | previousCellPosition: previousPosition,
|
29683 | nextCellPosition: nextPosition ? nextPosition : null
|
29684 | };
|
29685 | var userCell = userFunc(params);
|
29686 | if (exists(userCell)) {
|
29687 | if (userCell.floating) {
|
29688 | 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');
|
29689 | userCell.rowPinned = userCell.floating;
|
29690 | }
|
29691 | nextPosition = {
|
29692 | rowIndex: userCell.rowIndex,
|
29693 | column: userCell.column,
|
29694 | rowPinned: userCell.rowPinned
|
29695 | };
|
29696 | }
|
29697 | else {
|
29698 | nextPosition = null;
|
29699 | }
|
29700 | }
|
29701 |
|
29702 |
|
29703 | if (!nextPosition) {
|
29704 | return null;
|
29705 | }
|
29706 | if (nextPosition.rowIndex < 0) {
|
29707 | var headerLen = this.headerNavigationService.getHeaderRowCount();
|
29708 | this.focusService.focusHeaderPosition({
|
29709 | headerPosition: {
|
29710 | headerRowIndex: headerLen + (nextPosition.rowIndex),
|
29711 | column: nextPosition.column
|
29712 | }
|
29713 | });
|
29714 | return null;
|
29715 | }
|
29716 |
|
29717 |
|
29718 |
|
29719 |
|
29720 |
|
29721 | var fullRowEdit = this.gridOptionsService.get('editType') === 'fullRow';
|
29722 | if (startEditing && !fullRowEdit) {
|
29723 | var cellIsEditable = this.isCellEditable(nextPosition);
|
29724 | if (!cellIsEditable) {
|
29725 | continue;
|
29726 | }
|
29727 | }
|
29728 | this.ensureCellVisible(nextPosition);
|
29729 |
|
29730 |
|
29731 | var nextCell = this.getCellByPosition(nextPosition);
|
29732 |
|
29733 |
|
29734 | if (!nextCell) {
|
29735 | var row = this.rowRenderer.getRowByPosition(nextPosition);
|
29736 | if (!row || !row.isFullWidth() || startEditing) {
|
29737 | continue;
|
29738 | }
|
29739 | return row;
|
29740 | }
|
29741 | if (nextCell.isSuppressNavigable()) {
|
29742 | continue;
|
29743 | }
|
29744 |
|
29745 |
|
29746 | if (this.rangeService) {
|
29747 | this.rangeService.setRangeToCell(nextPosition);
|
29748 | }
|
29749 |
|
29750 | return nextCell;
|
29751 | }
|
29752 | };
|
29753 | NavigationService.prototype.isCellEditable = function (cell) {
|
29754 | var rowNode = this.lookupRowNodeForCell(cell);
|
29755 | if (rowNode) {
|
29756 | return cell.column.isCellEditable(rowNode);
|
29757 | }
|
29758 | return false;
|
29759 | };
|
29760 | NavigationService.prototype.getCellByPosition = function (cellPosition) {
|
29761 | var rowCtrl = this.rowRenderer.getRowByPosition(cellPosition);
|
29762 | if (!rowCtrl) {
|
29763 | return null;
|
29764 | }
|
29765 | return rowCtrl.getCellCtrl(cellPosition.column);
|
29766 | };
|
29767 | NavigationService.prototype.lookupRowNodeForCell = function (cell) {
|
29768 | if (cell.rowPinned === 'top') {
|
29769 | return this.pinnedRowModel.getPinnedTopRow(cell.rowIndex);
|
29770 | }
|
29771 | if (cell.rowPinned === 'bottom') {
|
29772 | return this.pinnedRowModel.getPinnedBottomRow(cell.rowIndex);
|
29773 | }
|
29774 | return this.paginationProxy.getRow(cell.rowIndex);
|
29775 | };
|
29776 |
|
29777 |
|
29778 | NavigationService.prototype.navigateToNextCell = function (event, key, currentCell, allowUserOverride) {
|
29779 |
|
29780 | var nextCell = currentCell;
|
29781 | var hitEdgeOfGrid = false;
|
29782 | while (nextCell && (nextCell === currentCell || !this.isValidNavigateCell(nextCell))) {
|
29783 |
|
29784 |
|
29785 |
|
29786 | if (this.gridOptionsService.is('enableRtl')) {
|
29787 | if (key === KeyCode.LEFT) {
|
29788 | nextCell = this.getLastCellOfColSpan(nextCell);
|
29789 | }
|
29790 | }
|
29791 | else if (key === KeyCode.RIGHT) {
|
29792 | nextCell = this.getLastCellOfColSpan(nextCell);
|
29793 | }
|
29794 | nextCell = this.cellNavigationService.getNextCellToFocus(key, nextCell);
|
29795 |
|
29796 | hitEdgeOfGrid = missing(nextCell);
|
29797 | }
|
29798 | if (hitEdgeOfGrid && event && event.key === KeyCode.UP) {
|
29799 | nextCell = {
|
29800 | rowIndex: -1,
|
29801 | rowPinned: null,
|
29802 | column: currentCell.column
|
29803 | };
|
29804 | }
|
29805 |
|
29806 |
|
29807 | if (allowUserOverride) {
|
29808 | var userFunc = this.gridOptionsService.getCallback('navigateToNextCell');
|
29809 | if (exists(userFunc)) {
|
29810 | var params = {
|
29811 | key: key,
|
29812 | previousCellPosition: currentCell,
|
29813 | nextCellPosition: nextCell ? nextCell : null,
|
29814 | event: event
|
29815 | };
|
29816 | var userCell = userFunc(params);
|
29817 | if (exists(userCell)) {
|
29818 | if (userCell.floating) {
|
29819 | 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');
|
29820 | userCell.rowPinned = userCell.floating;
|
29821 | }
|
29822 | nextCell = {
|
29823 | rowPinned: userCell.rowPinned,
|
29824 | rowIndex: userCell.rowIndex,
|
29825 | column: userCell.column
|
29826 | };
|
29827 | }
|
29828 | else {
|
29829 | nextCell = null;
|
29830 | }
|
29831 | }
|
29832 | }
|
29833 |
|
29834 | if (!nextCell) {
|
29835 | return;
|
29836 | }
|
29837 | if (nextCell.rowIndex < 0) {
|
29838 | var headerLen = this.headerNavigationService.getHeaderRowCount();
|
29839 | this.focusService.focusHeaderPosition({
|
29840 | headerPosition: { headerRowIndex: headerLen + (nextCell.rowIndex), column: currentCell.column },
|
29841 | event: event || undefined
|
29842 | });
|
29843 | return;
|
29844 | }
|
29845 |
|
29846 |
|
29847 | var normalisedPosition = this.getNormalisedPosition(nextCell);
|
29848 | if (normalisedPosition) {
|
29849 | this.focusPosition(normalisedPosition);
|
29850 | }
|
29851 | else {
|
29852 | this.tryToFocusFullWidthRow(nextCell);
|
29853 | }
|
29854 | };
|
29855 | NavigationService.prototype.getNormalisedPosition = function (cellPosition) {
|
29856 |
|
29857 | this.ensureCellVisible(cellPosition);
|
29858 | var cellCtrl = this.getCellByPosition(cellPosition);
|
29859 |
|
29860 | if (!cellCtrl) {
|
29861 | return null;
|
29862 | }
|
29863 | cellPosition = cellCtrl.getCellPosition();
|
29864 |
|
29865 |
|
29866 |
|
29867 |
|
29868 |
|
29869 | this.ensureCellVisible(cellPosition);
|
29870 | return cellPosition;
|
29871 | };
|
29872 | NavigationService.prototype.tryToFocusFullWidthRow = function (position, backwards) {
|
29873 | if (backwards === void 0) { backwards = false; }
|
29874 | var displayedColumns = this.columnModel.getAllDisplayedColumns();
|
29875 | var rowComp = this.rowRenderer.getRowByPosition(position);
|
29876 | if (!rowComp || !rowComp.isFullWidth()) {
|
29877 | return false;
|
29878 | }
|
29879 | var currentCellFocused = this.focusService.getFocusedCell();
|
29880 | var cellPosition = {
|
29881 | rowIndex: position.rowIndex,
|
29882 | rowPinned: position.rowPinned,
|
29883 | column: position.column || (backwards ? last(displayedColumns) : displayedColumns[0])
|
29884 | };
|
29885 | this.focusPosition(cellPosition);
|
29886 | var fromBelow = currentCellFocused != null ? this.rowPositionUtils.before(cellPosition, currentCellFocused) : false;
|
29887 | var focusEvent = {
|
29888 | type: Events.EVENT_FULL_WIDTH_ROW_FOCUSED,
|
29889 | rowIndex: cellPosition.rowIndex,
|
29890 | rowPinned: cellPosition.rowPinned,
|
29891 | column: cellPosition.column,
|
29892 | isFullWidthCell: true,
|
29893 | floating: cellPosition.rowPinned,
|
29894 | fromBelow: fromBelow
|
29895 | };
|
29896 | this.eventService.dispatchEvent(focusEvent);
|
29897 | return true;
|
29898 | };
|
29899 | NavigationService.prototype.focusPosition = function (cellPosition) {
|
29900 | this.focusService.setFocusedCell({
|
29901 | rowIndex: cellPosition.rowIndex,
|
29902 | column: cellPosition.column,
|
29903 | rowPinned: cellPosition.rowPinned,
|
29904 | forceBrowserFocus: true
|
29905 | });
|
29906 | if (this.rangeService) {
|
29907 | this.rangeService.setRangeToCell(cellPosition);
|
29908 | }
|
29909 | };
|
29910 | NavigationService.prototype.isValidNavigateCell = function (cell) {
|
29911 | var rowNode = this.rowPositionUtils.getRowNode(cell);
|
29912 |
|
29913 | return !!rowNode;
|
29914 | };
|
29915 | NavigationService.prototype.getLastCellOfColSpan = function (cell) {
|
29916 | var cellCtrl = this.getCellByPosition(cell);
|
29917 | if (!cellCtrl) {
|
29918 | return cell;
|
29919 | }
|
29920 | var colSpanningList = cellCtrl.getColSpanningList();
|
29921 | if (colSpanningList.length === 1) {
|
29922 | return cell;
|
29923 | }
|
29924 | return {
|
29925 | rowIndex: cell.rowIndex,
|
29926 | column: last(colSpanningList),
|
29927 | rowPinned: cell.rowPinned
|
29928 | };
|
29929 | };
|
29930 | NavigationService.prototype.ensureCellVisible = function (gridCell) {
|
29931 | var isGroupStickyEnabled = this.gridOptionsService.is('groupRowsSticky');
|
29932 | var rowNode = this.rowModel.getRow(gridCell.rowIndex);
|
29933 |
|
29934 | var skipScrollToRow = isGroupStickyEnabled && (rowNode === null || rowNode === void 0 ? void 0 : rowNode.sticky);
|
29935 |
|
29936 | if (!skipScrollToRow && missing(gridCell.rowPinned)) {
|
29937 | this.gridBodyCon.getScrollFeature().ensureIndexVisible(gridCell.rowIndex);
|
29938 | }
|
29939 | if (!gridCell.column.isPinned()) {
|
29940 | this.gridBodyCon.getScrollFeature().ensureColumnVisible(gridCell.column);
|
29941 | }
|
29942 | };
|
29943 | __decorate$1z([
|
29944 | Autowired('mouseEventService')
|
29945 | ], NavigationService.prototype, "mouseEventService", void 0);
|
29946 | __decorate$1z([
|
29947 | Autowired('paginationProxy')
|
29948 | ], NavigationService.prototype, "paginationProxy", void 0);
|
29949 | __decorate$1z([
|
29950 | Autowired('focusService')
|
29951 | ], NavigationService.prototype, "focusService", void 0);
|
29952 | __decorate$1z([
|
29953 | Optional('rangeService')
|
29954 | ], NavigationService.prototype, "rangeService", void 0);
|
29955 | __decorate$1z([
|
29956 | Autowired('columnModel')
|
29957 | ], NavigationService.prototype, "columnModel", void 0);
|
29958 | __decorate$1z([
|
29959 | Autowired('rowModel')
|
29960 | ], NavigationService.prototype, "rowModel", void 0);
|
29961 | __decorate$1z([
|
29962 | Autowired('ctrlsService')
|
29963 | ], NavigationService.prototype, "ctrlsService", void 0);
|
29964 | __decorate$1z([
|
29965 | Autowired('rowRenderer')
|
29966 | ], NavigationService.prototype, "rowRenderer", void 0);
|
29967 | __decorate$1z([
|
29968 | Autowired('headerNavigationService')
|
29969 | ], NavigationService.prototype, "headerNavigationService", void 0);
|
29970 | __decorate$1z([
|
29971 | Autowired("rowPositionUtils")
|
29972 | ], NavigationService.prototype, "rowPositionUtils", void 0);
|
29973 | __decorate$1z([
|
29974 | Autowired("cellNavigationService")
|
29975 | ], NavigationService.prototype, "cellNavigationService", void 0);
|
29976 | __decorate$1z([
|
29977 | Autowired("pinnedRowModel")
|
29978 | ], NavigationService.prototype, "pinnedRowModel", void 0);
|
29979 | __decorate$1z([
|
29980 | PostConstruct
|
29981 | ], NavigationService.prototype, "postConstruct", null);
|
29982 | NavigationService = __decorate$1z([
|
29983 | Bean('navigationService')
|
29984 | ], NavigationService);
|
29985 | return NavigationService;
|
29986 | }(BeanStub));
|
29987 |
|
29988 |
|
29989 |
|
29990 |
|
29991 |
|
29992 |
|
29993 |
|
29994 | var __extends$1B = (undefined && undefined.__extends) || (function () {
|
29995 | var extendStatics = function (d, b) {
|
29996 | extendStatics = Object.setPrototypeOf ||
|
29997 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
29998 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
29999 | return extendStatics(d, b);
|
30000 | };
|
30001 | return function (d, b) {
|
30002 | extendStatics(d, b);
|
30003 | function __() { this.constructor = d; }
|
30004 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
30005 | };
|
30006 | })();
|
30007 | var __decorate$1y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
30008 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
30009 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
30010 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
30011 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
30012 | };
|
30013 | var PopupEditorWrapper = (function (_super) {
|
30014 | __extends$1B(PopupEditorWrapper, _super);
|
30015 | function PopupEditorWrapper(params) {
|
30016 | var _this = _super.call(this, "<div class=\"ag-popup-editor\" tabindex=\"-1\"/>") || this;
|
30017 | _this.params = params;
|
30018 | return _this;
|
30019 | }
|
30020 | PopupEditorWrapper.prototype.postConstruct = function () {
|
30021 | this.gridOptionsService.setDomData(this.getGui(), PopupEditorWrapper.DOM_KEY_POPUP_EDITOR_WRAPPER, true);
|
30022 | this.addKeyDownListener();
|
30023 | };
|
30024 | PopupEditorWrapper.prototype.addKeyDownListener = function () {
|
30025 | var _this = this;
|
30026 | var eGui = this.getGui();
|
30027 | var params = this.params;
|
30028 | var listener = function (event) {
|
30029 | if (!isUserSuppressingKeyboardEvent(_this.gridOptionsService, event, params.node, params.column, true)) {
|
30030 | params.onKeyDown(event);
|
30031 | }
|
30032 | };
|
30033 | this.addManagedListener(eGui, 'keydown', listener);
|
30034 | };
|
30035 | PopupEditorWrapper.DOM_KEY_POPUP_EDITOR_WRAPPER = 'popupEditorWrapper';
|
30036 | __decorate$1y([
|
30037 | PostConstruct
|
30038 | ], PopupEditorWrapper.prototype, "postConstruct", null);
|
30039 | return PopupEditorWrapper;
|
30040 | }(PopupComponent));
|
30041 |
|
30042 |
|
30043 |
|
30044 |
|
30045 |
|
30046 |
|
30047 |
|
30048 | var __extends$1A = (undefined && undefined.__extends) || (function () {
|
30049 | var extendStatics = function (d, b) {
|
30050 | extendStatics = Object.setPrototypeOf ||
|
30051 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
30052 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
30053 | return extendStatics(d, b);
|
30054 | };
|
30055 | return function (d, b) {
|
30056 | extendStatics(d, b);
|
30057 | function __() { this.constructor = d; }
|
30058 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
30059 | };
|
30060 | })();
|
30061 | var CellComp = (function (_super) {
|
30062 | __extends$1A(CellComp, _super);
|
30063 | function CellComp(beans, cellCtrl, printLayout, eRow, editingRow) {
|
30064 | var _this = _super.call(this) || this;
|
30065 |
|
30066 |
|
30067 |
|
30068 |
|
30069 |
|
30070 |
|
30071 | _this.rendererVersion = 0;
|
30072 | _this.editorVersion = 0;
|
30073 | _this.beans = beans;
|
30074 | _this.column = cellCtrl.getColumn();
|
30075 | _this.rowNode = cellCtrl.getRowNode();
|
30076 | _this.rowCtrl = cellCtrl.getRowCtrl();
|
30077 | _this.eRow = eRow;
|
30078 | _this.setTemplate( "<div comp-id=\"" + _this.getCompId() + "\"/>");
|
30079 | var eGui = _this.getGui();
|
30080 | _this.forceWrapper = cellCtrl.isForceWrapper();
|
30081 | _this.refreshWrapper(false);
|
30082 | var setAttribute = function (name, value, element) {
|
30083 | var actualElement = element ? element : eGui;
|
30084 | if (value != null && value != '') {
|
30085 | actualElement.setAttribute(name, value);
|
30086 | }
|
30087 | else {
|
30088 | actualElement.removeAttribute(name);
|
30089 | }
|
30090 | };
|
30091 | var compProxy = {
|
30092 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
30093 | setUserStyles: function (styles) { return addStylesToElement(eGui, styles); },
|
30094 | getFocusableElement: function () { return _this.getFocusableElement(); },
|
30095 | setTabIndex: function (tabIndex) { return setAttribute('tabindex', tabIndex.toString()); },
|
30096 | setRole: function (role) { return setAriaRole(eGui, role); },
|
30097 | setColId: function (colId) { return setAttribute('col-id', colId); },
|
30098 | setTitle: function (title) { return setAttribute('title', title); },
|
30099 | setIncludeSelection: function (include) { return _this.includeSelection = include; },
|
30100 | setIncludeRowDrag: function (include) { return _this.includeRowDrag = include; },
|
30101 | setIncludeDndSource: function (include) { return _this.includeDndSource = include; },
|
30102 | setRenderDetails: function (compDetails, valueToDisplay, force) {
|
30103 | return _this.setRenderDetails(compDetails, valueToDisplay, force);
|
30104 | },
|
30105 | setEditDetails: function (compDetails, popup, position) {
|
30106 | return _this.setEditDetails(compDetails, popup, position);
|
30107 | },
|
30108 | getCellEditor: function () { return _this.cellEditor || null; },
|
30109 | getCellRenderer: function () { return _this.cellRenderer || null; },
|
30110 | getParentOfValue: function () { return _this.getParentOfValue(); }
|
30111 | };
|
30112 | _this.cellCtrl = cellCtrl;
|
30113 | cellCtrl.setComp(compProxy, _this.getGui(), _this.eCellWrapper, printLayout, editingRow);
|
30114 | return _this;
|
30115 | }
|
30116 | CellComp.prototype.getParentOfValue = function () {
|
30117 | if (this.eCellValue) {
|
30118 |
|
30119 | return this.eCellValue;
|
30120 | }
|
30121 | if (this.eCellWrapper) {
|
30122 |
|
30123 | return this.eCellWrapper;
|
30124 | }
|
30125 |
|
30126 | return this.getGui();
|
30127 | };
|
30128 | CellComp.prototype.setRenderDetails = function (compDetails, valueToDisplay, forceNewCellRendererInstance) {
|
30129 |
|
30130 | var isInlineEditing = this.cellEditor && !this.cellEditorPopupWrapper;
|
30131 | if (isInlineEditing) {
|
30132 | return;
|
30133 | }
|
30134 |
|
30135 | this.firstRender = this.firstRender == null;
|
30136 |
|
30137 | var controlWrapperChanged = this.refreshWrapper(false);
|
30138 | this.refreshEditStyles(false);
|
30139 |
|
30140 | if (compDetails) {
|
30141 | var neverRefresh = forceNewCellRendererInstance || controlWrapperChanged;
|
30142 | var cellRendererRefreshSuccessful = neverRefresh ? false : this.refreshCellRenderer(compDetails);
|
30143 | if (!cellRendererRefreshSuccessful) {
|
30144 | this.destroyRenderer();
|
30145 | this.createCellRendererInstance(compDetails);
|
30146 | }
|
30147 | }
|
30148 | else {
|
30149 | this.destroyRenderer();
|
30150 | this.insertValueWithoutCellRenderer(valueToDisplay);
|
30151 | }
|
30152 | };
|
30153 | CellComp.prototype.setEditDetails = function (compDetails, popup, position) {
|
30154 | if (compDetails) {
|
30155 | this.createCellEditorInstance(compDetails, popup, position);
|
30156 | }
|
30157 | else {
|
30158 | this.destroyEditor();
|
30159 | }
|
30160 | };
|
30161 | CellComp.prototype.removeControls = function () {
|
30162 | this.checkboxSelectionComp = this.beans.context.destroyBean(this.checkboxSelectionComp);
|
30163 | this.dndSourceComp = this.beans.context.destroyBean(this.dndSourceComp);
|
30164 | this.rowDraggingComp = this.beans.context.destroyBean(this.rowDraggingComp);
|
30165 | };
|
30166 |
|
30167 | CellComp.prototype.refreshWrapper = function (editing) {
|
30168 | var providingControls = this.includeRowDrag || this.includeDndSource || this.includeSelection;
|
30169 | var usingWrapper = providingControls || this.forceWrapper;
|
30170 | var putWrapperIn = usingWrapper && this.eCellWrapper == null;
|
30171 | if (putWrapperIn) {
|
30172 | this.eCellWrapper = loadTemplate( "<div class=\"ag-cell-wrapper\" role=\"presentation\"></div>");
|
30173 | this.getGui().appendChild(this.eCellWrapper);
|
30174 | }
|
30175 | var takeWrapperOut = !usingWrapper && this.eCellWrapper != null;
|
30176 | if (takeWrapperOut) {
|
30177 | removeFromParent(this.eCellWrapper);
|
30178 | this.eCellWrapper = undefined;
|
30179 | }
|
30180 | this.addOrRemoveCssClass('ag-cell-value', !usingWrapper);
|
30181 | var usingCellValue = !editing && usingWrapper;
|
30182 | var putCellValueIn = usingCellValue && this.eCellValue == null;
|
30183 | if (putCellValueIn) {
|
30184 | this.eCellValue = loadTemplate( "<span class=\"ag-cell-value\" role=\"presentation\"></span>");
|
30185 | this.eCellWrapper.appendChild(this.eCellValue);
|
30186 | }
|
30187 | var takeCellValueOut = !usingCellValue && this.eCellValue != null;
|
30188 | if (takeCellValueOut) {
|
30189 | removeFromParent(this.eCellValue);
|
30190 | this.eCellValue = undefined;
|
30191 | }
|
30192 | var templateChanged = putWrapperIn || takeWrapperOut || putCellValueIn || takeCellValueOut;
|
30193 | if (templateChanged) {
|
30194 | this.removeControls();
|
30195 | }
|
30196 | if (!editing) {
|
30197 | if (providingControls) {
|
30198 | this.addControls();
|
30199 | }
|
30200 | }
|
30201 | return templateChanged;
|
30202 | };
|
30203 | CellComp.prototype.addControls = function () {
|
30204 | if (this.includeRowDrag) {
|
30205 | if (this.rowDraggingComp == null) {
|
30206 | this.rowDraggingComp = this.cellCtrl.createRowDragComp();
|
30207 | if (this.rowDraggingComp) {
|
30208 |
|
30209 | this.eCellWrapper.insertBefore(this.rowDraggingComp.getGui(), this.eCellValue);
|
30210 | }
|
30211 | }
|
30212 | }
|
30213 | if (this.includeDndSource) {
|
30214 | if (this.dndSourceComp == null) {
|
30215 | this.dndSourceComp = this.cellCtrl.createDndSource();
|
30216 |
|
30217 | this.eCellWrapper.insertBefore(this.dndSourceComp.getGui(), this.eCellValue);
|
30218 | }
|
30219 | }
|
30220 | if (this.includeSelection) {
|
30221 | if (this.checkboxSelectionComp == null) {
|
30222 | this.checkboxSelectionComp = this.cellCtrl.createSelectionCheckbox();
|
30223 | this.eCellWrapper.insertBefore(this.checkboxSelectionComp.getGui(), this.eCellValue);
|
30224 | }
|
30225 | }
|
30226 | };
|
30227 | CellComp.prototype.createCellEditorInstance = function (compDetails, popup, position) {
|
30228 | var _this = this;
|
30229 | var versionCopy = this.editorVersion;
|
30230 | var cellEditorPromise = compDetails.newAgStackInstance();
|
30231 | if (!cellEditorPromise) {
|
30232 | return;
|
30233 | }
|
30234 | var params = compDetails.params;
|
30235 | cellEditorPromise.then(function (c) { return _this.afterCellEditorCreated(versionCopy, c, params, popup, position); });
|
30236 |
|
30237 |
|
30238 |
|
30239 | var cellEditorAsync = missing(this.cellEditor);
|
30240 | if (cellEditorAsync && params.cellStartedEdit) {
|
30241 | this.cellCtrl.focusCell(true);
|
30242 | }
|
30243 | };
|
30244 | CellComp.prototype.insertValueWithoutCellRenderer = function (valueToDisplay) {
|
30245 | var eParent = this.getParentOfValue();
|
30246 | clearElement(eParent);
|
30247 | var escapedValue = valueToDisplay != null ? escapeString(valueToDisplay) : null;
|
30248 | if (escapedValue != null) {
|
30249 | eParent.innerHTML = escapedValue;
|
30250 | }
|
30251 | };
|
30252 | CellComp.prototype.destroyEditorAndRenderer = function () {
|
30253 | this.destroyRenderer();
|
30254 | this.destroyEditor();
|
30255 | };
|
30256 | CellComp.prototype.destroyRenderer = function () {
|
30257 | var context = this.beans.context;
|
30258 | this.cellRenderer = context.destroyBean(this.cellRenderer);
|
30259 | removeFromParent(this.cellRendererGui);
|
30260 | this.cellRendererGui = null;
|
30261 | this.rendererVersion++;
|
30262 | };
|
30263 | CellComp.prototype.destroyEditor = function () {
|
30264 | var context = this.beans.context;
|
30265 | if (this.hideEditorPopup) {
|
30266 | this.hideEditorPopup();
|
30267 | }
|
30268 | this.hideEditorPopup = undefined;
|
30269 | this.cellEditor = context.destroyBean(this.cellEditor);
|
30270 | this.cellEditorPopupWrapper = context.destroyBean(this.cellEditorPopupWrapper);
|
30271 | removeFromParent(this.cellEditorGui);
|
30272 | this.cellEditorGui = null;
|
30273 | this.editorVersion++;
|
30274 | };
|
30275 | CellComp.prototype.refreshCellRenderer = function (compClassAndParams) {
|
30276 | if (this.cellRenderer == null || this.cellRenderer.refresh == null) {
|
30277 | return false;
|
30278 | }
|
30279 |
|
30280 |
|
30281 | if (this.cellRendererClass !== compClassAndParams.componentClass) {
|
30282 | return false;
|
30283 | }
|
30284 |
|
30285 | var result = this.cellRenderer.refresh(compClassAndParams.params);
|
30286 |
|
30287 |
|
30288 |
|
30289 |
|
30290 | return result === true || result === undefined;
|
30291 | };
|
30292 | CellComp.prototype.createCellRendererInstance = function (compDetails) {
|
30293 | var _this = this;
|
30294 |
|
30295 |
|
30296 |
|
30297 | var suppressAnimationFrame = this.beans.gridOptionsService.is('suppressAnimationFrame');
|
30298 | var useTaskService = !suppressAnimationFrame;
|
30299 | var displayComponentVersionCopy = this.rendererVersion;
|
30300 | var componentClass = compDetails.componentClass;
|
30301 | var createCellRendererFunc = function () {
|
30302 | var staleTask = _this.rendererVersion !== displayComponentVersionCopy || !_this.isAlive();
|
30303 | if (staleTask) {
|
30304 | return;
|
30305 | }
|
30306 |
|
30307 |
|
30308 | var componentPromise = compDetails.newAgStackInstance();
|
30309 | var callback = _this.afterCellRendererCreated.bind(_this, displayComponentVersionCopy, componentClass);
|
30310 | if (componentPromise) {
|
30311 | componentPromise.then(callback);
|
30312 | }
|
30313 | };
|
30314 |
|
30315 |
|
30316 |
|
30317 | if (useTaskService && this.firstRender) {
|
30318 | this.beans.animationFrameService.createTask(createCellRendererFunc, this.rowNode.rowIndex, 'createTasksP2');
|
30319 | }
|
30320 | else {
|
30321 | createCellRendererFunc();
|
30322 | }
|
30323 | };
|
30324 | CellComp.prototype.getCtrl = function () {
|
30325 | return this.cellCtrl;
|
30326 | };
|
30327 | CellComp.prototype.getRowCtrl = function () {
|
30328 | return this.rowCtrl;
|
30329 | };
|
30330 | CellComp.prototype.getCellRenderer = function () {
|
30331 | return this.cellRenderer;
|
30332 | };
|
30333 | CellComp.prototype.getCellEditor = function () {
|
30334 | return this.cellEditor;
|
30335 | };
|
30336 | CellComp.prototype.afterCellRendererCreated = function (cellRendererVersion, cellRendererClass, cellRenderer) {
|
30337 | var staleTask = !this.isAlive() || cellRendererVersion !== this.rendererVersion;
|
30338 | if (staleTask) {
|
30339 | this.beans.context.destroyBean(cellRenderer);
|
30340 | return;
|
30341 | }
|
30342 | this.cellRenderer = cellRenderer;
|
30343 | this.cellRendererClass = cellRendererClass;
|
30344 | this.cellRendererGui = this.cellRenderer.getGui();
|
30345 | if (this.cellRendererGui != null) {
|
30346 | var eParent = this.getParentOfValue();
|
30347 | clearElement(eParent);
|
30348 | eParent.appendChild(this.cellRendererGui);
|
30349 | }
|
30350 | };
|
30351 | CellComp.prototype.afterCellEditorCreated = function (requestVersion, cellEditor, params, popup, position) {
|
30352 |
|
30353 |
|
30354 |
|
30355 | var staleComp = requestVersion !== this.editorVersion;
|
30356 | if (staleComp) {
|
30357 | this.beans.context.destroyBean(cellEditor);
|
30358 | return;
|
30359 | }
|
30360 | var editingCancelledByUserComp = cellEditor.isCancelBeforeStart && cellEditor.isCancelBeforeStart();
|
30361 | if (editingCancelledByUserComp) {
|
30362 | this.beans.context.destroyBean(cellEditor);
|
30363 | this.cellCtrl.stopEditing(true);
|
30364 | return;
|
30365 | }
|
30366 | if (!cellEditor.getGui) {
|
30367 | console.warn("AG Grid: cellEditor for column " + this.column.getId() + " is missing getGui() method");
|
30368 | this.beans.context.destroyBean(cellEditor);
|
30369 | return;
|
30370 | }
|
30371 | this.cellEditor = cellEditor;
|
30372 | this.cellEditorGui = cellEditor.getGui();
|
30373 | var cellEditorInPopup = popup || (cellEditor.isPopup !== undefined && cellEditor.isPopup());
|
30374 | if (cellEditorInPopup) {
|
30375 | this.addPopupCellEditor(params, position);
|
30376 | }
|
30377 | else {
|
30378 | this.addInCellEditor();
|
30379 | }
|
30380 | this.refreshEditStyles(true, cellEditorInPopup);
|
30381 | if (cellEditor.afterGuiAttached) {
|
30382 | cellEditor.afterGuiAttached();
|
30383 | }
|
30384 | };
|
30385 | CellComp.prototype.refreshEditStyles = function (editing, isPopup) {
|
30386 | var _a;
|
30387 | this.addOrRemoveCssClass('ag-cell-inline-editing', editing && !isPopup);
|
30388 | this.addOrRemoveCssClass('ag-cell-popup-editing', editing && !!isPopup);
|
30389 | this.addOrRemoveCssClass('ag-cell-not-inline-editing', !editing || !!isPopup);
|
30390 | (_a = this.rowCtrl) === null || _a === void 0 ? void 0 : _a.setInlineEditingCss(editing);
|
30391 | };
|
30392 | CellComp.prototype.addInCellEditor = function () {
|
30393 | var eGui = this.getGui();
|
30394 |
|
30395 |
|
30396 | var eDocument = this.beans.gridOptionsService.getDocument();
|
30397 | if (eGui.contains(eDocument.activeElement)) {
|
30398 | eGui.focus();
|
30399 | }
|
30400 | this.destroyRenderer();
|
30401 | this.refreshWrapper(true);
|
30402 | this.clearParentOfValue();
|
30403 | if (this.cellEditorGui) {
|
30404 | var eParent = this.getParentOfValue();
|
30405 | eParent.appendChild(this.cellEditorGui);
|
30406 | }
|
30407 | };
|
30408 | CellComp.prototype.addPopupCellEditor = function (params, position) {
|
30409 | var _this = this;
|
30410 | if (this.beans.gridOptionsService.get('editType') === 'fullRow') {
|
30411 | console.warn('AG Grid: popup cellEditor does not work with fullRowEdit - you cannot use them both ' +
|
30412 | '- either turn off fullRowEdit, or stop using popup editors.');
|
30413 | }
|
30414 | var cellEditor = this.cellEditor;
|
30415 |
|
30416 | this.cellEditorPopupWrapper = this.beans.context.createBean(new PopupEditorWrapper(params));
|
30417 | var ePopupGui = this.cellEditorPopupWrapper.getGui();
|
30418 | if (this.cellEditorGui) {
|
30419 | ePopupGui.appendChild(this.cellEditorGui);
|
30420 | }
|
30421 | var popupService = this.beans.popupService;
|
30422 | var useModelPopup = this.beans.gridOptionsService.is('stopEditingWhenCellsLoseFocus');
|
30423 |
|
30424 | var positionToUse = position != null
|
30425 | ? position
|
30426 | : cellEditor.getPopupPosition
|
30427 | ? cellEditor.getPopupPosition()
|
30428 | : 'over';
|
30429 | var isRtl = this.beans.gridOptionsService.is('enableRtl');
|
30430 | var positionParams = {
|
30431 | ePopup: ePopupGui,
|
30432 | column: this.column,
|
30433 | rowNode: this.rowNode,
|
30434 | type: 'popupCellEditor',
|
30435 | eventSource: this.getGui(),
|
30436 | position: positionToUse,
|
30437 | alignSide: isRtl ? 'right' : 'left',
|
30438 | keepWithinBounds: true
|
30439 | };
|
30440 | var positionCallback = popupService.positionPopupByComponent.bind(popupService, positionParams);
|
30441 | var translate = this.beans.localeService.getLocaleTextFunc();
|
30442 | var addPopupRes = popupService.addPopup({
|
30443 | modal: useModelPopup,
|
30444 | eChild: ePopupGui,
|
30445 | closeOnEsc: true,
|
30446 | closedCallback: function () { _this.cellCtrl.onPopupEditorClosed(); },
|
30447 | anchorToElement: this.getGui(),
|
30448 | positionCallback: positionCallback,
|
30449 | ariaLabel: translate('ariaLabelCellEditor', 'Cell Editor')
|
30450 | });
|
30451 | if (addPopupRes) {
|
30452 | this.hideEditorPopup = addPopupRes.hideFunc;
|
30453 | }
|
30454 | };
|
30455 | CellComp.prototype.detach = function () {
|
30456 | this.eRow.removeChild(this.getGui());
|
30457 | };
|
30458 |
|
30459 |
|
30460 |
|
30461 |
|
30462 |
|
30463 |
|
30464 | CellComp.prototype.destroy = function () {
|
30465 | this.cellCtrl.stopEditing();
|
30466 | this.destroyEditorAndRenderer();
|
30467 | this.removeControls();
|
30468 | _super.prototype.destroy.call(this);
|
30469 | };
|
30470 | CellComp.prototype.clearParentOfValue = function () {
|
30471 | var eGui = this.getGui();
|
30472 |
|
30473 |
|
30474 | var eDocument = this.beans.gridOptionsService.getDocument();
|
30475 | if (eGui.contains(eDocument.activeElement) && browserSupportsPreventScroll()) {
|
30476 | eGui.focus({ preventScroll: true });
|
30477 | }
|
30478 | clearElement(this.getParentOfValue());
|
30479 | };
|
30480 | return CellComp;
|
30481 | }(Component));
|
30482 |
|
30483 |
|
30484 |
|
30485 |
|
30486 |
|
30487 |
|
30488 |
|
30489 | var __extends$1z = (undefined && undefined.__extends) || (function () {
|
30490 | var extendStatics = function (d, b) {
|
30491 | extendStatics = Object.setPrototypeOf ||
|
30492 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
30493 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
30494 | return extendStatics(d, b);
|
30495 | };
|
30496 | return function (d, b) {
|
30497 | extendStatics(d, b);
|
30498 | function __() { this.constructor = d; }
|
30499 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
30500 | };
|
30501 | })();
|
30502 | var RowComp = (function (_super) {
|
30503 | __extends$1z(RowComp, _super);
|
30504 | function RowComp(ctrl, beans, containerType) {
|
30505 | var _this = _super.call(this) || this;
|
30506 | _this.cellComps = {};
|
30507 | _this.beans = beans;
|
30508 | _this.rowCtrl = ctrl;
|
30509 | _this.setTemplate( "<div comp-id=\"" + _this.getCompId() + "\" style=\"" + _this.getInitialStyle(containerType) + "\"/>");
|
30510 | var eGui = _this.getGui();
|
30511 | var style = eGui.style;
|
30512 | var compProxy = {
|
30513 | setDomOrder: function (domOrder) { return _this.domOrder = domOrder; },
|
30514 | setCellCtrls: function (cellCtrls) { return _this.setCellCtrls(cellCtrls); },
|
30515 | showFullWidth: function (compDetails) { return _this.showFullWidth(compDetails); },
|
30516 | getFullWidthCellRenderer: function () { return _this.getFullWidthCellRenderer(); },
|
30517 | addOrRemoveCssClass: function (name, on) { return _this.addOrRemoveCssClass(name, on); },
|
30518 | setUserStyles: function (styles) { return addStylesToElement(eGui, styles); },
|
30519 | setTop: function (top) { return style.top = top; },
|
30520 | setTransform: function (transform) { return style.transform = transform; },
|
30521 | setRowIndex: function (rowIndex) { return eGui.setAttribute('row-index', rowIndex); },
|
30522 | setRole: function (role) { return setAriaRole(eGui, role); },
|
30523 | setRowId: function (rowId) { return eGui.setAttribute('row-id', rowId); },
|
30524 | setRowBusinessKey: function (businessKey) { return eGui.setAttribute('row-business-key', businessKey); },
|
30525 | setTabIndex: function (tabIndex) { return eGui.setAttribute('tabindex', tabIndex.toString()); }
|
30526 | };
|
30527 | ctrl.setComp(compProxy, _this.getGui(), containerType);
|
30528 | _this.addDestroyFunc(function () {
|
30529 | ctrl.unsetComp(containerType);
|
30530 | });
|
30531 | return _this;
|
30532 | }
|
30533 | RowComp.prototype.getInitialStyle = function (containerType) {
|
30534 | var transform = this.rowCtrl.getInitialTransform(containerType);
|
30535 | var top = this.rowCtrl.getInitialRowTop(containerType);
|
30536 | return transform ? "transform: " + transform : "top: " + top;
|
30537 | };
|
30538 | RowComp.prototype.showFullWidth = function (compDetails) {
|
30539 | var _this = this;
|
30540 | var callback = function (cellRenderer) {
|
30541 | if (_this.isAlive()) {
|
30542 | var eGui = cellRenderer.getGui();
|
30543 | _this.getGui().appendChild(eGui);
|
30544 | _this.rowCtrl.setupDetailRowAutoHeight(eGui);
|
30545 | _this.setFullWidthRowComp(cellRenderer);
|
30546 | }
|
30547 | else {
|
30548 | _this.beans.context.destroyBean(cellRenderer);
|
30549 | }
|
30550 | };
|
30551 |
|
30552 | var res = compDetails.newAgStackInstance();
|
30553 | if (!res) {
|
30554 | return;
|
30555 | }
|
30556 | res.then(callback);
|
30557 | };
|
30558 | RowComp.prototype.setCellCtrls = function (cellCtrls) {
|
30559 | var _this = this;
|
30560 | var cellsToRemove = Object.assign({}, this.cellComps);
|
30561 | cellCtrls.forEach(function (cellCtrl) {
|
30562 | var key = cellCtrl.getInstanceId();
|
30563 | var existingCellComp = _this.cellComps[key];
|
30564 | if (existingCellComp == null) {
|
30565 | _this.newCellComp(cellCtrl);
|
30566 | }
|
30567 | else {
|
30568 | cellsToRemove[key] = null;
|
30569 | }
|
30570 | });
|
30571 | var cellCompsToRemove = getAllValuesInObject(cellsToRemove)
|
30572 | .filter(function (cellComp) { return cellComp != null; });
|
30573 | this.destroyCells(cellCompsToRemove);
|
30574 | this.ensureDomOrder(cellCtrls);
|
30575 | };
|
30576 | RowComp.prototype.ensureDomOrder = function (cellCtrls) {
|
30577 | var _this = this;
|
30578 | if (!this.domOrder) {
|
30579 | return;
|
30580 | }
|
30581 | var elementsInOrder = [];
|
30582 | cellCtrls.forEach(function (cellCtrl) {
|
30583 | var cellComp = _this.cellComps[cellCtrl.getInstanceId()];
|
30584 | if (cellComp) {
|
30585 | elementsInOrder.push(cellComp.getGui());
|
30586 | }
|
30587 | });
|
30588 | setDomChildOrder(this.getGui(), elementsInOrder);
|
30589 | };
|
30590 | RowComp.prototype.newCellComp = function (cellCtrl) {
|
30591 | var cellComp = new CellComp(this.beans, cellCtrl, this.rowCtrl.isPrintLayout(), this.getGui(), this.rowCtrl.isEditing());
|
30592 | this.cellComps[cellCtrl.getInstanceId()] = cellComp;
|
30593 | this.getGui().appendChild(cellComp.getGui());
|
30594 | };
|
30595 | RowComp.prototype.destroy = function () {
|
30596 | _super.prototype.destroy.call(this);
|
30597 | this.destroyAllCells();
|
30598 | };
|
30599 | RowComp.prototype.destroyAllCells = function () {
|
30600 | var cellsToDestroy = getAllValuesInObject(this.cellComps).filter(function (cp) { return cp != null; });
|
30601 | this.destroyCells(cellsToDestroy);
|
30602 | };
|
30603 | RowComp.prototype.setFullWidthRowComp = function (fullWidthRowComponent) {
|
30604 | var _this = this;
|
30605 | if (this.fullWidthCellRenderer) {
|
30606 | console.error('AG Grid - should not be setting fullWidthRowComponent twice');
|
30607 | }
|
30608 | this.fullWidthCellRenderer = fullWidthRowComponent;
|
30609 | this.addDestroyFunc(function () {
|
30610 | _this.fullWidthCellRenderer = _this.beans.context.destroyBean(_this.fullWidthCellRenderer);
|
30611 | });
|
30612 | };
|
30613 | RowComp.prototype.getFullWidthCellRenderer = function () {
|
30614 | return this.fullWidthCellRenderer;
|
30615 | };
|
30616 | RowComp.prototype.destroyCells = function (cellComps) {
|
30617 | var _this = this;
|
30618 | cellComps.forEach(function (cellComp) {
|
30619 |
|
30620 | if (!cellComp) {
|
30621 | return;
|
30622 | }
|
30623 |
|
30624 | var instanceId = cellComp.getCtrl().getInstanceId();
|
30625 | if (_this.cellComps[instanceId] !== cellComp) {
|
30626 | return;
|
30627 | }
|
30628 | cellComp.detach();
|
30629 | cellComp.destroy();
|
30630 | _this.cellComps[instanceId] = null;
|
30631 | });
|
30632 | };
|
30633 | return RowComp;
|
30634 | }(Component));
|
30635 |
|
30636 |
|
30637 |
|
30638 |
|
30639 |
|
30640 |
|
30641 |
|
30642 | var __extends$1y = (undefined && undefined.__extends) || (function () {
|
30643 | var extendStatics = function (d, b) {
|
30644 | extendStatics = Object.setPrototypeOf ||
|
30645 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
30646 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
30647 | return extendStatics(d, b);
|
30648 | };
|
30649 | return function (d, b) {
|
30650 | extendStatics(d, b);
|
30651 | function __() { this.constructor = d; }
|
30652 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
30653 | };
|
30654 | })();
|
30655 | var __assign$6 = (undefined && undefined.__assign) || function () {
|
30656 | __assign$6 = Object.assign || function(t) {
|
30657 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
30658 | s = arguments[i];
|
30659 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
30660 | t[p] = s[p];
|
30661 | }
|
30662 | return t;
|
30663 | };
|
30664 | return __assign$6.apply(this, arguments);
|
30665 | };
|
30666 | var __decorate$1x = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
30667 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
30668 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
30669 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
30670 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
30671 | };
|
30672 | function templateFactory() {
|
30673 | var name = Component.elementGettingCreated.getAttribute('name');
|
30674 | var cssClasses = RowContainerCtrl.getRowContainerCssClasses(name);
|
30675 | var res;
|
30676 | var template1 = name === RowContainerName.CENTER;
|
30677 | var template2 = name === RowContainerName.TOP_CENTER
|
30678 | || name === RowContainerName.STICKY_TOP_CENTER
|
30679 | || name === RowContainerName.BOTTOM_CENTER;
|
30680 | if (template1) {
|
30681 | res =
|
30682 | "<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>";
|
30683 | }
|
30684 | else if (template2) {
|
30685 | res =
|
30686 | "<div class=\"" + cssClasses.viewport + "\" ref=\"eViewport\" role=\"presentation\">\n <div class=\"" + cssClasses.container + "\" ref=\"eContainer\"></div>\n </div>";
|
30687 | }
|
30688 | else {
|
30689 | res =
|
30690 | "<div class=\"" + cssClasses.container + "\" ref=\"eContainer\"></div>";
|
30691 | }
|
30692 | return res;
|
30693 | }
|
30694 | var RowContainerComp = (function (_super) {
|
30695 | __extends$1y(RowContainerComp, _super);
|
30696 | function RowContainerComp() {
|
30697 | var _this = _super.call(this, templateFactory()) || this;
|
30698 | _this.rowComps = {};
|
30699 | _this.name = Component.elementGettingCreated.getAttribute('name');
|
30700 | _this.type = getRowContainerTypeForName(_this.name);
|
30701 | return _this;
|
30702 | }
|
30703 | RowContainerComp.prototype.postConstruct = function () {
|
30704 | var _this = this;
|
30705 | var compProxy = {
|
30706 | setViewportHeight: function (height) { return _this.eViewport.style.height = height; },
|
30707 | setRowCtrls: function (rowCtrls) { return _this.setRowCtrls(rowCtrls); },
|
30708 | setDomOrder: function (domOrder) {
|
30709 | _this.domOrder = domOrder;
|
30710 | },
|
30711 | setContainerWidth: function (width) { return _this.eContainer.style.width = width; }
|
30712 | };
|
30713 | var ctrl = this.createManagedBean(new RowContainerCtrl(this.name));
|
30714 | ctrl.setComp(compProxy, this.eContainer, this.eViewport, this.eWrapper);
|
30715 | };
|
30716 | RowContainerComp.prototype.preDestroy = function () {
|
30717 |
|
30718 | this.setRowCtrls([]);
|
30719 | };
|
30720 | RowContainerComp.prototype.setRowCtrls = function (rowCtrls) {
|
30721 | var _this = this;
|
30722 | var oldRows = __assign$6({}, this.rowComps);
|
30723 | this.rowComps = {};
|
30724 | this.lastPlacedElement = null;
|
30725 | var processRow = function (rowCon) {
|
30726 | var instanceId = rowCon.getInstanceId();
|
30727 | var existingRowComp = oldRows[instanceId];
|
30728 | if (existingRowComp) {
|
30729 | _this.rowComps[instanceId] = existingRowComp;
|
30730 | delete oldRows[instanceId];
|
30731 | _this.ensureDomOrder(existingRowComp.getGui());
|
30732 | }
|
30733 | else {
|
30734 | var rowComp = new RowComp(rowCon, _this.beans, _this.type);
|
30735 | _this.rowComps[instanceId] = rowComp;
|
30736 | _this.appendRow(rowComp.getGui());
|
30737 | }
|
30738 | };
|
30739 | rowCtrls.forEach(processRow);
|
30740 | getAllValuesInObject(oldRows).forEach(function (oldRowComp) {
|
30741 | _this.eContainer.removeChild(oldRowComp.getGui());
|
30742 | oldRowComp.destroy();
|
30743 | });
|
30744 | setAriaRole(this.eContainer, rowCtrls.length ? "rowgroup" : "presentation");
|
30745 | };
|
30746 | RowContainerComp.prototype.appendRow = function (element) {
|
30747 | if (this.domOrder) {
|
30748 | insertWithDomOrder(this.eContainer, element, this.lastPlacedElement);
|
30749 | }
|
30750 | else {
|
30751 | this.eContainer.appendChild(element);
|
30752 | }
|
30753 | this.lastPlacedElement = element;
|
30754 | };
|
30755 | RowContainerComp.prototype.ensureDomOrder = function (eRow) {
|
30756 | if (this.domOrder) {
|
30757 | ensureDomOrder(this.eContainer, eRow, this.lastPlacedElement);
|
30758 | this.lastPlacedElement = eRow;
|
30759 | }
|
30760 | };
|
30761 | __decorate$1x([
|
30762 | Autowired('beans')
|
30763 | ], RowContainerComp.prototype, "beans", void 0);
|
30764 | __decorate$1x([
|
30765 | RefSelector('eViewport')
|
30766 | ], RowContainerComp.prototype, "eViewport", void 0);
|
30767 | __decorate$1x([
|
30768 | RefSelector('eContainer')
|
30769 | ], RowContainerComp.prototype, "eContainer", void 0);
|
30770 | __decorate$1x([
|
30771 | RefSelector('eWrapper')
|
30772 | ], RowContainerComp.prototype, "eWrapper", void 0);
|
30773 | __decorate$1x([
|
30774 | PostConstruct
|
30775 | ], RowContainerComp.prototype, "postConstruct", null);
|
30776 | __decorate$1x([
|
30777 | PreDestroy
|
30778 | ], RowContainerComp.prototype, "preDestroy", null);
|
30779 | return RowContainerComp;
|
30780 | }(Component));
|
30781 |
|
30782 |
|
30783 |
|
30784 |
|
30785 |
|
30786 |
|
30787 |
|
30788 | var __decorate$1w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
30789 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
30790 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
30791 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
30792 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
30793 | };
|
30794 | var BodyDropPivotTarget = (function () {
|
30795 | function BodyDropPivotTarget(pinned) {
|
30796 | this.columnsToAggregate = [];
|
30797 | this.columnsToGroup = [];
|
30798 | this.columnsToPivot = [];
|
30799 | this.pinned = pinned;
|
30800 | }
|
30801 |
|
30802 | BodyDropPivotTarget.prototype.onDragEnter = function (draggingEvent) {
|
30803 | var _this = this;
|
30804 | this.clearColumnsList();
|
30805 |
|
30806 | if (this.gridOptionsService.is('functionsReadOnly')) {
|
30807 | return;
|
30808 | }
|
30809 | var dragColumns = draggingEvent.dragItem.columns;
|
30810 | if (!dragColumns) {
|
30811 | return;
|
30812 | }
|
30813 | dragColumns.forEach(function (column) {
|
30814 |
|
30815 | if (!column.isPrimary()) {
|
30816 | return;
|
30817 | }
|
30818 | if (column.isAnyFunctionActive()) {
|
30819 | return;
|
30820 | }
|
30821 | if (column.isAllowValue()) {
|
30822 | _this.columnsToAggregate.push(column);
|
30823 | }
|
30824 | else if (column.isAllowRowGroup()) {
|
30825 | _this.columnsToGroup.push(column);
|
30826 | }
|
30827 | else if (column.isAllowPivot()) {
|
30828 | _this.columnsToPivot.push(column);
|
30829 | }
|
30830 | });
|
30831 | };
|
30832 | BodyDropPivotTarget.prototype.getIconName = function () {
|
30833 | var totalColumns = this.columnsToAggregate.length + this.columnsToGroup.length + this.columnsToPivot.length;
|
30834 | if (totalColumns > 0) {
|
30835 | return this.pinned ? DragAndDropService.ICON_PINNED : DragAndDropService.ICON_MOVE;
|
30836 | }
|
30837 | return null;
|
30838 | };
|
30839 |
|
30840 | BodyDropPivotTarget.prototype.onDragLeave = function (draggingEvent) {
|
30841 |
|
30842 | this.clearColumnsList();
|
30843 | };
|
30844 | BodyDropPivotTarget.prototype.clearColumnsList = function () {
|
30845 | this.columnsToAggregate.length = 0;
|
30846 | this.columnsToGroup.length = 0;
|
30847 | this.columnsToPivot.length = 0;
|
30848 | };
|
30849 |
|
30850 | BodyDropPivotTarget.prototype.onDragging = function (draggingEvent) {
|
30851 | };
|
30852 |
|
30853 | BodyDropPivotTarget.prototype.onDragStop = function (draggingEvent) {
|
30854 | if (this.columnsToAggregate.length > 0) {
|
30855 | this.columnModel.addValueColumns(this.columnsToAggregate, "toolPanelDragAndDrop");
|
30856 | }
|
30857 | if (this.columnsToGroup.length > 0) {
|
30858 | this.columnModel.addRowGroupColumns(this.columnsToGroup, "toolPanelDragAndDrop");
|
30859 | }
|
30860 | if (this.columnsToPivot.length > 0) {
|
30861 | this.columnModel.addPivotColumns(this.columnsToPivot, "toolPanelDragAndDrop");
|
30862 | }
|
30863 | };
|
30864 | __decorate$1w([
|
30865 | Autowired('columnModel')
|
30866 | ], BodyDropPivotTarget.prototype, "columnModel", void 0);
|
30867 | __decorate$1w([
|
30868 | Autowired('gridOptionsService')
|
30869 | ], BodyDropPivotTarget.prototype, "gridOptionsService", void 0);
|
30870 | return BodyDropPivotTarget;
|
30871 | }());
|
30872 |
|
30873 |
|
30874 |
|
30875 |
|
30876 |
|
30877 |
|
30878 |
|
30879 | var __decorate$1v = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
30880 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
30881 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
30882 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
30883 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
30884 | };
|
30885 | var __read$h = (undefined && undefined.__read) || function (o, n) {
|
30886 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
30887 | if (!m) return o;
|
30888 | var i = m.call(o), r, ar = [], e;
|
30889 | try {
|
30890 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
30891 | }
|
30892 | catch (error) { e = { error: error }; }
|
30893 | finally {
|
30894 | try {
|
30895 | if (r && !r.done && (m = i["return"])) m.call(i);
|
30896 | }
|
30897 | finally { if (e) throw e.error; }
|
30898 | }
|
30899 | return ar;
|
30900 | };
|
30901 | var MoveColumnFeature = (function () {
|
30902 | function MoveColumnFeature(pinned, eContainer) {
|
30903 | this.needToMoveLeft = false;
|
30904 | this.needToMoveRight = false;
|
30905 | this.lastMovedInfo = null;
|
30906 | this.pinned = pinned;
|
30907 | this.eContainer = eContainer;
|
30908 | this.centerContainer = !exists(pinned);
|
30909 | }
|
30910 | MoveColumnFeature.prototype.init = function () {
|
30911 | var _this = this;
|
30912 | this.ctrlsService.whenReady(function () {
|
30913 | _this.gridBodyCon = _this.ctrlsService.getGridBodyCtrl();
|
30914 | });
|
30915 | };
|
30916 | MoveColumnFeature.prototype.getIconName = function () {
|
30917 | return this.pinned ? DragAndDropService.ICON_PINNED : DragAndDropService.ICON_MOVE;
|
30918 | };
|
30919 | MoveColumnFeature.prototype.onDragEnter = function (draggingEvent) {
|
30920 |
|
30921 | var columns = draggingEvent.dragItem.columns;
|
30922 | var dragCameFromToolPanel = draggingEvent.dragSource.type === DragSourceType.ToolPanel;
|
30923 | if (dragCameFromToolPanel) {
|
30924 |
|
30925 | this.setColumnsVisible(columns, true, "uiColumnDragged");
|
30926 | }
|
30927 | else {
|
30928 |
|
30929 |
|
30930 |
|
30931 |
|
30932 | var visibleState_1 = draggingEvent.dragItem.visibleState;
|
30933 | var visibleColumns = (columns || []).filter(function (column) { return visibleState_1[column.getId()]; });
|
30934 | this.setColumnsVisible(visibleColumns, true, "uiColumnDragged");
|
30935 | }
|
30936 | this.setColumnsPinned(columns, this.pinned, "uiColumnDragged");
|
30937 | this.onDragging(draggingEvent, true, true);
|
30938 | };
|
30939 | MoveColumnFeature.prototype.onDragLeave = function () {
|
30940 | this.ensureIntervalCleared();
|
30941 | this.lastMovedInfo = null;
|
30942 | };
|
30943 | MoveColumnFeature.prototype.setColumnsVisible = function (columns, visible, source) {
|
30944 | if (source === void 0) { source = "api"; }
|
30945 | if (columns) {
|
30946 | var allowedCols = columns.filter(function (c) { return !c.getColDef().lockVisible; });
|
30947 | this.columnModel.setColumnsVisible(allowedCols, visible, source);
|
30948 | }
|
30949 | };
|
30950 | MoveColumnFeature.prototype.setColumnsPinned = function (columns, pinned, source) {
|
30951 | if (source === void 0) { source = "api"; }
|
30952 | if (columns) {
|
30953 | var allowedCols = columns.filter(function (c) { return !c.getColDef().lockPinned; });
|
30954 | this.columnModel.setColumnsPinned(allowedCols, pinned, source);
|
30955 | }
|
30956 | };
|
30957 | MoveColumnFeature.prototype.onDragStop = function () {
|
30958 | this.onDragging(this.lastDraggingEvent, false, true, true);
|
30959 | this.ensureIntervalCleared();
|
30960 | this.lastMovedInfo = null;
|
30961 | };
|
30962 | MoveColumnFeature.prototype.normaliseX = function (x) {
|
30963 |
|
30964 | if (this.gridOptionsService.is('enableRtl')) {
|
30965 | var clientWidth = this.eContainer.clientWidth;
|
30966 | x = clientWidth - x;
|
30967 | }
|
30968 |
|
30969 | if (this.centerContainer) {
|
30970 | x += this.ctrlsService.getCenterRowContainerCtrl().getCenterViewportScrollLeft();
|
30971 | }
|
30972 | return x;
|
30973 | };
|
30974 | MoveColumnFeature.prototype.checkCenterForScrolling = function (xAdjustedForScroll) {
|
30975 | if (this.centerContainer) {
|
30976 |
|
30977 |
|
30978 | var firstVisiblePixel = this.ctrlsService.getCenterRowContainerCtrl().getCenterViewportScrollLeft();
|
30979 | var lastVisiblePixel = firstVisiblePixel + this.ctrlsService.getCenterRowContainerCtrl().getCenterWidth();
|
30980 | if (this.gridOptionsService.is('enableRtl')) {
|
30981 | this.needToMoveRight = xAdjustedForScroll < (firstVisiblePixel + 50);
|
30982 | this.needToMoveLeft = xAdjustedForScroll > (lastVisiblePixel - 50);
|
30983 | }
|
30984 | else {
|
30985 | this.needToMoveLeft = xAdjustedForScroll < (firstVisiblePixel + 50);
|
30986 | this.needToMoveRight = xAdjustedForScroll > (lastVisiblePixel - 50);
|
30987 | }
|
30988 | if (this.needToMoveLeft || this.needToMoveRight) {
|
30989 | this.ensureIntervalStarted();
|
30990 | }
|
30991 | else {
|
30992 | this.ensureIntervalCleared();
|
30993 | }
|
30994 | }
|
30995 | };
|
30996 | MoveColumnFeature.prototype.onDragging = function (draggingEvent, fromEnter, fakeEvent, finished) {
|
30997 | var _this = this;
|
30998 | var _a;
|
30999 | if (draggingEvent === void 0) { draggingEvent = this.lastDraggingEvent; }
|
31000 | if (fromEnter === void 0) { fromEnter = false; }
|
31001 | if (fakeEvent === void 0) { fakeEvent = false; }
|
31002 | if (finished === void 0) { finished = false; }
|
31003 | if (finished) {
|
31004 | if (this.lastMovedInfo) {
|
31005 | var _b = this.lastMovedInfo, columns = _b.columns, toIndex = _b.toIndex;
|
31006 | this.moveColumns(columns, toIndex, 'uiColumnMoved', true);
|
31007 | }
|
31008 | return;
|
31009 | }
|
31010 | this.lastDraggingEvent = draggingEvent;
|
31011 |
|
31012 | if (missing(draggingEvent.hDirection)) {
|
31013 | return;
|
31014 | }
|
31015 | var mouseX = this.normaliseX(draggingEvent.x);
|
31016 |
|
31017 |
|
31018 |
|
31019 | if (!fromEnter) {
|
31020 | this.checkCenterForScrolling(mouseX);
|
31021 | }
|
31022 | var hDirection = this.normaliseDirection(draggingEvent.hDirection);
|
31023 | var dragSourceType = draggingEvent.dragSource.type;
|
31024 | var allMovingColumns = ((_a = draggingEvent.dragSource.getDragItem().columns) === null || _a === void 0 ? void 0 : _a.filter(function (col) {
|
31025 | if (col.getColDef().lockPinned) {
|
31026 |
|
31027 |
|
31028 | return col.getPinned() == _this.pinned;
|
31029 | }
|
31030 |
|
31031 | return true;
|
31032 | })) || [];
|
31033 | this.attemptMoveColumns({ dragSourceType: dragSourceType, allMovingColumns: allMovingColumns, hDirection: hDirection, mouseX: mouseX, fromEnter: fromEnter, fakeEvent: fakeEvent });
|
31034 | };
|
31035 | MoveColumnFeature.prototype.normaliseDirection = function (hDirection) {
|
31036 | if (this.gridOptionsService.is('enableRtl')) {
|
31037 | switch (hDirection) {
|
31038 | case HorizontalDirection.Left: return HorizontalDirection.Right;
|
31039 | case HorizontalDirection.Right: return HorizontalDirection.Left;
|
31040 | default: console.error("AG Grid: Unknown direction " + hDirection);
|
31041 | }
|
31042 | }
|
31043 | else {
|
31044 | return hDirection;
|
31045 | }
|
31046 | };
|
31047 | MoveColumnFeature.prototype.attemptMoveColumns = function (params) {
|
31048 | var dragSourceType = params.dragSourceType, hDirection = params.hDirection, mouseX = params.mouseX, fromEnter = params.fromEnter, fakeEvent = params.fakeEvent;
|
31049 | var draggingLeft = hDirection === HorizontalDirection.Left;
|
31050 | var draggingRight = hDirection === HorizontalDirection.Right;
|
31051 | var allMovingColumns = params.allMovingColumns;
|
31052 | if (dragSourceType === DragSourceType.HeaderCell) {
|
31053 |
|
31054 | var newCols_1 = [];
|
31055 | allMovingColumns.forEach(function (col) {
|
31056 | var movingGroup = null;
|
31057 | var parent = col.getParent();
|
31058 | while (parent != null && parent.getDisplayedLeafColumns().length === 1) {
|
31059 | movingGroup = parent;
|
31060 | parent = parent.getParent();
|
31061 | }
|
31062 | if (movingGroup != null) {
|
31063 | movingGroup.getLeafColumns().forEach(function (newCol) {
|
31064 | if (!newCols_1.includes(newCol)) {
|
31065 | newCols_1.push(newCol);
|
31066 | }
|
31067 | });
|
31068 | }
|
31069 | else if (!newCols_1.includes(col)) {
|
31070 | newCols_1.push(col);
|
31071 | }
|
31072 | });
|
31073 | allMovingColumns = newCols_1;
|
31074 | }
|
31075 |
|
31076 |
|
31077 |
|
31078 | var allMovingColumnsOrdered = allMovingColumns.slice();
|
31079 | this.columnModel.sortColumnsLikeGridColumns(allMovingColumnsOrdered);
|
31080 | var validMoves = this.calculateValidMoves(allMovingColumnsOrdered, draggingRight, mouseX);
|
31081 |
|
31082 |
|
31083 | var oldIndex = this.calculateOldIndex(allMovingColumnsOrdered);
|
31084 | if (validMoves.length === 0) {
|
31085 | return;
|
31086 | }
|
31087 | var firstValidMove = validMoves[0];
|
31088 |
|
31089 |
|
31090 |
|
31091 |
|
31092 |
|
31093 |
|
31094 |
|
31095 |
|
31096 | var constrainDirection = oldIndex !== null && !fromEnter;
|
31097 |
|
31098 | if (dragSourceType == DragSourceType.HeaderCell) {
|
31099 | constrainDirection = oldIndex !== null;
|
31100 | }
|
31101 |
|
31102 |
|
31103 | if (constrainDirection && !fakeEvent) {
|
31104 |
|
31105 | if (draggingLeft && firstValidMove >= oldIndex) {
|
31106 | return;
|
31107 | }
|
31108 |
|
31109 | if (draggingRight && firstValidMove <= oldIndex) {
|
31110 | return;
|
31111 | }
|
31112 | }
|
31113 |
|
31114 |
|
31115 |
|
31116 |
|
31117 | var displayedCols = this.columnModel.getAllDisplayedColumns();
|
31118 | var potentialMoves = [];
|
31119 | var targetOrder = null;
|
31120 | for (var i = 0; i < validMoves.length; i++) {
|
31121 | var move = validMoves[i];
|
31122 | var order = this.columnModel.getProposedColumnOrder(allMovingColumnsOrdered, move);
|
31123 | if (!this.columnModel.doesOrderPassRules(order)) {
|
31124 | continue;
|
31125 | }
|
31126 | var displayedOrder = order.filter(function (col) { return displayedCols.includes(col); });
|
31127 | if (targetOrder === null) {
|
31128 | targetOrder = displayedOrder;
|
31129 | }
|
31130 | else if (!_.areEqual(displayedOrder, targetOrder)) {
|
31131 | break;
|
31132 | }
|
31133 | var fragCount = this.groupFragCount(order);
|
31134 | potentialMoves.push({ move: move, fragCount: fragCount });
|
31135 | }
|
31136 | if (potentialMoves.length === 0) {
|
31137 | return;
|
31138 | }
|
31139 |
|
31140 | potentialMoves.sort(function (a, b) { return a.fragCount - b.fragCount; });
|
31141 | this.moveColumns(allMovingColumns, potentialMoves[0].move, 'uiColumnMoved', false);
|
31142 | };
|
31143 |
|
31144 |
|
31145 | MoveColumnFeature.prototype.calculateOldIndex = function (movingCols) {
|
31146 | var gridCols = this.columnModel.getAllGridColumns();
|
31147 | var indexes = sortNumerically(movingCols.map(function (col) { return gridCols.indexOf(col); }));
|
31148 | var firstIndex = indexes[0];
|
31149 | var lastIndex = last(indexes);
|
31150 | var spread = lastIndex - firstIndex;
|
31151 | var gapsExist = spread !== indexes.length - 1;
|
31152 | return gapsExist ? null : firstIndex;
|
31153 | };
|
31154 | MoveColumnFeature.prototype.moveColumns = function (columns, toIndex, source, finished) {
|
31155 | this.columnModel.moveColumns(columns, toIndex, source, finished);
|
31156 | this.lastMovedInfo = finished ? null : { columns: columns, toIndex: toIndex };
|
31157 | };
|
31158 |
|
31159 | MoveColumnFeature.prototype.groupFragCount = function (columns) {
|
31160 | function parents(col) {
|
31161 | var result = [];
|
31162 | var parent = col.getOriginalParent();
|
31163 | while (parent != null) {
|
31164 | result.push(parent);
|
31165 | parent = parent.getOriginalParent();
|
31166 | }
|
31167 | return result;
|
31168 | }
|
31169 | var count = 0;
|
31170 | var _loop_1 = function (i) {
|
31171 | var _a;
|
31172 | var a = parents(columns[i]);
|
31173 | var b = parents(columns[i + 1]);
|
31174 |
|
31175 | _a = __read$h(a.length > b.length ? [a, b] : [b, a], 2), a = _a[0], b = _a[1];
|
31176 | a.forEach(function (parent) {
|
31177 | if (b.indexOf(parent) === -1) {
|
31178 | count++;
|
31179 | }
|
31180 | });
|
31181 | };
|
31182 | for (var i = 0; i < columns.length - 1; i++) {
|
31183 | _loop_1(i);
|
31184 | }
|
31185 | return count;
|
31186 | };
|
31187 | MoveColumnFeature.prototype.calculateValidMoves = function (movingCols, draggingRight, mouseX) {
|
31188 | var isMoveBlocked = this.gridOptionsService.is('suppressMovableColumns') || movingCols.some(function (col) { return col.getColDef().suppressMovable; });
|
31189 | if (isMoveBlocked) {
|
31190 | return [];
|
31191 | }
|
31192 |
|
31193 | var allDisplayedCols = this.columnModel.getDisplayedColumns(this.pinned);
|
31194 |
|
31195 |
|
31196 | var allGridCols = this.columnModel.getAllGridColumns();
|
31197 | var movingDisplayedCols = allDisplayedCols.filter(function (col) { return includes(movingCols, col); });
|
31198 | var otherDisplayedCols = allDisplayedCols.filter(function (col) { return !includes(movingCols, col); });
|
31199 | var otherGridCols = allGridCols.filter(function (col) { return !includes(movingCols, col); });
|
31200 |
|
31201 |
|
31202 |
|
31203 | var displayIndex = 0;
|
31204 | var availableWidth = mouseX;
|
31205 |
|
31206 |
|
31207 | if (draggingRight) {
|
31208 | var widthOfMovingDisplayedCols_1 = 0;
|
31209 | movingDisplayedCols.forEach(function (col) { return widthOfMovingDisplayedCols_1 += col.getActualWidth(); });
|
31210 | availableWidth -= widthOfMovingDisplayedCols_1;
|
31211 | }
|
31212 | if (availableWidth > 0) {
|
31213 |
|
31214 | for (var i = 0; i < otherDisplayedCols.length; i++) {
|
31215 | var col = otherDisplayedCols[i];
|
31216 | availableWidth -= col.getActualWidth();
|
31217 | if (availableWidth < 0) {
|
31218 | break;
|
31219 | }
|
31220 | displayIndex++;
|
31221 | }
|
31222 |
|
31223 | if (draggingRight) {
|
31224 | displayIndex++;
|
31225 | }
|
31226 | }
|
31227 |
|
31228 |
|
31229 | var firstValidMove;
|
31230 | if (displayIndex > 0) {
|
31231 | var leftColumn = otherDisplayedCols[displayIndex - 1];
|
31232 | firstValidMove = otherGridCols.indexOf(leftColumn) + 1;
|
31233 | }
|
31234 | else {
|
31235 | firstValidMove = otherGridCols.indexOf(otherDisplayedCols[0]);
|
31236 | if (firstValidMove === -1) {
|
31237 | firstValidMove = 0;
|
31238 | }
|
31239 | }
|
31240 | var validMoves = [firstValidMove];
|
31241 | var numberComparator = function (a, b) { return a - b; };
|
31242 |
|
31243 |
|
31244 |
|
31245 |
|
31246 |
|
31247 |
|
31248 |
|
31249 |
|
31250 |
|
31251 |
|
31252 | if (draggingRight) {
|
31253 |
|
31254 |
|
31255 | var pointer = firstValidMove + 1;
|
31256 | var lastIndex = allGridCols.length - 1;
|
31257 | while (pointer <= lastIndex) {
|
31258 | validMoves.push(pointer);
|
31259 | pointer++;
|
31260 | }
|
31261 |
|
31262 | validMoves.sort(numberComparator);
|
31263 | }
|
31264 | else {
|
31265 |
|
31266 |
|
31267 |
|
31268 |
|
31269 |
|
31270 | var pointer = firstValidMove;
|
31271 | var lastIndex = allGridCols.length - 1;
|
31272 | var displacedCol = allGridCols[pointer];
|
31273 | while (pointer <= lastIndex && this.isColumnHidden(allDisplayedCols, displacedCol)) {
|
31274 | pointer++;
|
31275 | validMoves.push(pointer);
|
31276 | displacedCol = allGridCols[pointer];
|
31277 | }
|
31278 |
|
31279 | pointer = firstValidMove - 1;
|
31280 | var firstDisplayIndex = 0;
|
31281 | while (pointer >= firstDisplayIndex) {
|
31282 | validMoves.push(pointer);
|
31283 | pointer--;
|
31284 | }
|
31285 |
|
31286 | validMoves.sort(numberComparator).reverse();
|
31287 | }
|
31288 | return validMoves;
|
31289 | };
|
31290 |
|
31291 | MoveColumnFeature.prototype.isColumnHidden = function (displayedColumns, col) {
|
31292 | return displayedColumns.indexOf(col) < 0;
|
31293 | };
|
31294 | MoveColumnFeature.prototype.ensureIntervalStarted = function () {
|
31295 | if (!this.movingIntervalId) {
|
31296 | this.intervalCount = 0;
|
31297 | this.failedMoveAttempts = 0;
|
31298 | this.movingIntervalId = window.setInterval(this.moveInterval.bind(this), 100);
|
31299 | if (this.needToMoveLeft) {
|
31300 | this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_LEFT, true);
|
31301 | }
|
31302 | else {
|
31303 | this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_RIGHT, true);
|
31304 | }
|
31305 | }
|
31306 | };
|
31307 | MoveColumnFeature.prototype.ensureIntervalCleared = function () {
|
31308 | if (this.movingIntervalId) {
|
31309 | window.clearInterval(this.movingIntervalId);
|
31310 | this.movingIntervalId = null;
|
31311 | this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_MOVE);
|
31312 | }
|
31313 | };
|
31314 | MoveColumnFeature.prototype.moveInterval = function () {
|
31315 |
|
31316 |
|
31317 | var pixelsToMove;
|
31318 | this.intervalCount++;
|
31319 | pixelsToMove = 10 + (this.intervalCount * 5);
|
31320 | if (pixelsToMove > 100) {
|
31321 | pixelsToMove = 100;
|
31322 | }
|
31323 | var pixelsMoved = null;
|
31324 | var scrollFeature = this.gridBodyCon.getScrollFeature();
|
31325 | if (this.needToMoveLeft) {
|
31326 | pixelsMoved = scrollFeature.scrollHorizontally(-pixelsToMove);
|
31327 | }
|
31328 | else if (this.needToMoveRight) {
|
31329 | pixelsMoved = scrollFeature.scrollHorizontally(pixelsToMove);
|
31330 | }
|
31331 | if (pixelsMoved !== 0) {
|
31332 | this.onDragging(this.lastDraggingEvent);
|
31333 | this.failedMoveAttempts = 0;
|
31334 | }
|
31335 | else {
|
31336 |
|
31337 |
|
31338 | this.failedMoveAttempts++;
|
31339 | var columns = this.lastDraggingEvent.dragItem.columns;
|
31340 | var columnsThatCanPin = columns.filter(function (c) { return !c.getColDef().lockPinned; });
|
31341 | if (columnsThatCanPin.length > 0) {
|
31342 | this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_PINNED);
|
31343 | if (this.failedMoveAttempts > 7) {
|
31344 | var pinType = this.needToMoveLeft ? 'left' : 'right';
|
31345 | this.setColumnsPinned(columnsThatCanPin, pinType, "uiColumnDragged");
|
31346 | this.dragAndDropService.nudge();
|
31347 | }
|
31348 | }
|
31349 | }
|
31350 | };
|
31351 | __decorate$1v([
|
31352 | Autowired('columnModel')
|
31353 | ], MoveColumnFeature.prototype, "columnModel", void 0);
|
31354 | __decorate$1v([
|
31355 | Autowired('dragAndDropService')
|
31356 | ], MoveColumnFeature.prototype, "dragAndDropService", void 0);
|
31357 | __decorate$1v([
|
31358 | Autowired('gridOptionsService')
|
31359 | ], MoveColumnFeature.prototype, "gridOptionsService", void 0);
|
31360 | __decorate$1v([
|
31361 | Autowired('ctrlsService')
|
31362 | ], MoveColumnFeature.prototype, "ctrlsService", void 0);
|
31363 | __decorate$1v([
|
31364 | PostConstruct
|
31365 | ], MoveColumnFeature.prototype, "init", null);
|
31366 | return MoveColumnFeature;
|
31367 | }());
|
31368 |
|
31369 |
|
31370 |
|
31371 |
|
31372 |
|
31373 |
|
31374 |
|
31375 | var __extends$1x = (undefined && undefined.__extends) || (function () {
|
31376 | var extendStatics = function (d, b) {
|
31377 | extendStatics = Object.setPrototypeOf ||
|
31378 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
31379 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
31380 | return extendStatics(d, b);
|
31381 | };
|
31382 | return function (d, b) {
|
31383 | extendStatics(d, b);
|
31384 | function __() { this.constructor = d; }
|
31385 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
31386 | };
|
31387 | })();
|
31388 | var __decorate$1u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
31389 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
31390 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
31391 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
31392 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
31393 | };
|
31394 | var BodyDropTarget = (function (_super) {
|
31395 | __extends$1x(BodyDropTarget, _super);
|
31396 | function BodyDropTarget(pinned, eContainer) {
|
31397 | var _this = _super.call(this) || this;
|
31398 | _this.pinned = pinned;
|
31399 | _this.eContainer = eContainer;
|
31400 | return _this;
|
31401 | }
|
31402 | BodyDropTarget.prototype.postConstruct = function () {
|
31403 | var _this = this;
|
31404 | this.ctrlsService.whenReady(function (p) {
|
31405 | switch (_this.pinned) {
|
31406 | case 'left':
|
31407 | _this.eSecondaryContainers = [
|
31408 | [p.gridBodyCtrl.getBodyViewportElement(), p.leftRowContainerCtrl.getContainerElement()],
|
31409 | [p.bottomLeftRowContainerCtrl.getContainerElement()],
|
31410 | [p.topLeftRowContainerCtrl.getContainerElement()]
|
31411 | ];
|
31412 | break;
|
31413 | case 'right':
|
31414 | _this.eSecondaryContainers = [
|
31415 | [p.gridBodyCtrl.getBodyViewportElement(), p.rightRowContainerCtrl.getContainerElement()],
|
31416 | [p.bottomRightRowContainerCtrl.getContainerElement()],
|
31417 | [p.topRightRowContainerCtrl.getContainerElement()]
|
31418 | ];
|
31419 | break;
|
31420 | default:
|
31421 | _this.eSecondaryContainers = [
|
31422 | [p.gridBodyCtrl.getBodyViewportElement(), p.centerRowContainerCtrl.getViewportElement()],
|
31423 | [p.bottomCenterRowContainerCtrl.getViewportElement()],
|
31424 | [p.topCenterRowContainerCtrl.getViewportElement()]
|
31425 | ];
|
31426 | break;
|
31427 | }
|
31428 | });
|
31429 | };
|
31430 | BodyDropTarget.prototype.isInterestedIn = function (type) {
|
31431 | return type === DragSourceType.HeaderCell ||
|
31432 | (type === DragSourceType.ToolPanel && this.gridOptionsService.is('allowDragFromColumnsToolPanel'));
|
31433 | };
|
31434 | BodyDropTarget.prototype.getSecondaryContainers = function () {
|
31435 | return this.eSecondaryContainers;
|
31436 | };
|
31437 | BodyDropTarget.prototype.getContainer = function () {
|
31438 | return this.eContainer;
|
31439 | };
|
31440 | BodyDropTarget.prototype.init = function () {
|
31441 | this.moveColumnFeature = this.createManagedBean(new MoveColumnFeature(this.pinned, this.eContainer));
|
31442 | this.bodyDropPivotTarget = this.createManagedBean(new BodyDropPivotTarget(this.pinned));
|
31443 | this.dragAndDropService.addDropTarget(this);
|
31444 | };
|
31445 | BodyDropTarget.prototype.getIconName = function () {
|
31446 | return this.currentDropListener.getIconName();
|
31447 | };
|
31448 |
|
31449 |
|
31450 |
|
31451 | BodyDropTarget.prototype.isDropColumnInPivotMode = function (draggingEvent) {
|
31452 |
|
31453 |
|
31454 |
|
31455 | return this.columnModel.isPivotMode() && draggingEvent.dragSource.type === DragSourceType.ToolPanel;
|
31456 | };
|
31457 | BodyDropTarget.prototype.onDragEnter = function (draggingEvent) {
|
31458 |
|
31459 |
|
31460 |
|
31461 | this.currentDropListener = this.isDropColumnInPivotMode(draggingEvent) ? this.bodyDropPivotTarget : this.moveColumnFeature;
|
31462 | this.currentDropListener.onDragEnter(draggingEvent);
|
31463 | };
|
31464 | BodyDropTarget.prototype.onDragLeave = function (params) {
|
31465 | this.currentDropListener.onDragLeave(params);
|
31466 | };
|
31467 | BodyDropTarget.prototype.onDragging = function (params) {
|
31468 | this.currentDropListener.onDragging(params);
|
31469 | };
|
31470 | BodyDropTarget.prototype.onDragStop = function (params) {
|
31471 | this.currentDropListener.onDragStop(params);
|
31472 | };
|
31473 | __decorate$1u([
|
31474 | Autowired('dragAndDropService')
|
31475 | ], BodyDropTarget.prototype, "dragAndDropService", void 0);
|
31476 | __decorate$1u([
|
31477 | Autowired('columnModel')
|
31478 | ], BodyDropTarget.prototype, "columnModel", void 0);
|
31479 | __decorate$1u([
|
31480 | Autowired('ctrlsService')
|
31481 | ], BodyDropTarget.prototype, "ctrlsService", void 0);
|
31482 | __decorate$1u([
|
31483 | PostConstruct
|
31484 | ], BodyDropTarget.prototype, "postConstruct", null);
|
31485 | __decorate$1u([
|
31486 | PostConstruct
|
31487 | ], BodyDropTarget.prototype, "init", null);
|
31488 | return BodyDropTarget;
|
31489 | }(BeanStub));
|
31490 |
|
31491 |
|
31492 |
|
31493 |
|
31494 |
|
31495 |
|
31496 |
|
31497 | var __read$g = (undefined && undefined.__read) || function (o, n) {
|
31498 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
31499 | if (!m) return o;
|
31500 | var i = m.call(o), r, ar = [], e;
|
31501 | try {
|
31502 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
31503 | }
|
31504 | catch (error) { e = { error: error }; }
|
31505 | finally {
|
31506 | try {
|
31507 | if (r && !r.done && (m = i["return"])) m.call(i);
|
31508 | }
|
31509 | finally { if (e) throw e.error; }
|
31510 | }
|
31511 | return ar;
|
31512 | };
|
31513 | var __spread$e = (undefined && undefined.__spread) || function () {
|
31514 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$g(arguments[i]));
|
31515 | return ar;
|
31516 | };
|
31517 | var CssClassApplier = (function () {
|
31518 | function CssClassApplier() {
|
31519 | }
|
31520 | CssClassApplier.getHeaderClassesFromColDef = function (abstractColDef, gridOptionsService, column, columnGroup) {
|
31521 | if (missing(abstractColDef)) {
|
31522 | return [];
|
31523 | }
|
31524 | return this.getColumnClassesFromCollDef(abstractColDef.headerClass, abstractColDef, gridOptionsService, column, columnGroup);
|
31525 | };
|
31526 | CssClassApplier.getToolPanelClassesFromColDef = function (abstractColDef, gridOptionsService, column, columnGroup) {
|
31527 | if (missing(abstractColDef)) {
|
31528 | return [];
|
31529 | }
|
31530 | return this.getColumnClassesFromCollDef(abstractColDef.toolPanelClass, abstractColDef, gridOptionsService, column, columnGroup);
|
31531 | };
|
31532 | CssClassApplier.getClassParams = function (abstractColDef, gridOptionsService, column, columnGroup) {
|
31533 | return {
|
31534 |
|
31535 |
|
31536 |
|
31537 | colDef: abstractColDef,
|
31538 | column: column,
|
31539 | columnGroup: columnGroup,
|
31540 | api: gridOptionsService.api,
|
31541 | columnApi: gridOptionsService.columnApi,
|
31542 | context: gridOptionsService.context
|
31543 | };
|
31544 | };
|
31545 | CssClassApplier.getColumnClassesFromCollDef = function (classesOrFunc, abstractColDef, gridOptionsService, column, columnGroup) {
|
31546 | if (missing(classesOrFunc)) {
|
31547 | return [];
|
31548 | }
|
31549 | var classToUse;
|
31550 | if (typeof classesOrFunc === 'function') {
|
31551 | var params = this.getClassParams(abstractColDef, gridOptionsService, column, columnGroup);
|
31552 | classToUse = classesOrFunc(params);
|
31553 | }
|
31554 | else {
|
31555 | classToUse = classesOrFunc;
|
31556 | }
|
31557 | if (typeof classToUse === 'string') {
|
31558 | return [classToUse];
|
31559 | }
|
31560 | if (Array.isArray(classToUse)) {
|
31561 | return __spread$e(classToUse);
|
31562 | }
|
31563 | return [];
|
31564 | };
|
31565 | return CssClassApplier;
|
31566 | }());
|
31567 |
|
31568 |
|
31569 |
|
31570 |
|
31571 |
|
31572 |
|
31573 |
|
31574 | var __extends$1w = (undefined && undefined.__extends) || (function () {
|
31575 | var extendStatics = function (d, b) {
|
31576 | extendStatics = Object.setPrototypeOf ||
|
31577 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
31578 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
31579 | return extendStatics(d, b);
|
31580 | };
|
31581 | return function (d, b) {
|
31582 | extendStatics(d, b);
|
31583 | function __() { this.constructor = d; }
|
31584 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
31585 | };
|
31586 | })();
|
31587 | var __decorate$1t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
31588 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
31589 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
31590 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
31591 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
31592 | };
|
31593 | var HeaderCellComp = (function (_super) {
|
31594 | __extends$1w(HeaderCellComp, _super);
|
31595 | function HeaderCellComp(ctrl) {
|
31596 | var _this = _super.call(this, HeaderCellComp.TEMPLATE, ctrl) || this;
|
31597 | _this.headerCompVersion = 0;
|
31598 | _this.column = ctrl.getColumnGroupChild();
|
31599 | _this.pinned = ctrl.getPinned();
|
31600 | return _this;
|
31601 | }
|
31602 | HeaderCellComp.prototype.postConstruct = function () {
|
31603 | var _this = this;
|
31604 | var eGui = this.getGui();
|
31605 | var setAttribute = function (name, value, element) {
|
31606 | var actualElement = element ? element : eGui;
|
31607 | if (value != null && value != '') {
|
31608 | actualElement.setAttribute(name, value);
|
31609 | }
|
31610 | else {
|
31611 | actualElement.removeAttribute(name);
|
31612 | }
|
31613 | };
|
31614 | var compProxy = {
|
31615 | setWidth: function (width) { return eGui.style.width = width; },
|
31616 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
31617 | setColId: function (id) { return setAttribute('col-id', id); },
|
31618 | setTitle: function (title) { return setAttribute('title', title); },
|
31619 | setAriaDescription: function (label) { return setAriaDescription(eGui, label); },
|
31620 | setAriaSort: function (sort) { return sort ? setAriaSort(eGui, sort) : removeAriaSort(eGui); },
|
31621 | setUserCompDetails: function (compDetails) { return _this.setUserCompDetails(compDetails); },
|
31622 | getUserCompInstance: function () { return _this.headerComp; }
|
31623 | };
|
31624 | this.ctrl.setComp(compProxy, this.getGui(), this.eResize, this.eHeaderCompWrapper);
|
31625 | var selectAllGui = this.ctrl.getSelectAllGui();
|
31626 | this.eResize.insertAdjacentElement('afterend', selectAllGui);
|
31627 | };
|
31628 | HeaderCellComp.prototype.destroyHeaderComp = function () {
|
31629 | if (this.headerComp) {
|
31630 | this.eHeaderCompWrapper.removeChild(this.headerCompGui);
|
31631 | this.headerComp = this.destroyBean(this.headerComp);
|
31632 | this.headerCompGui = undefined;
|
31633 | }
|
31634 | };
|
31635 | HeaderCellComp.prototype.setUserCompDetails = function (compDetails) {
|
31636 | var _this = this;
|
31637 | this.headerCompVersion++;
|
31638 | var versionCopy = this.headerCompVersion;
|
31639 | compDetails.newAgStackInstance().then(function (comp) { return _this.afterCompCreated(versionCopy, comp); });
|
31640 | };
|
31641 | HeaderCellComp.prototype.afterCompCreated = function (version, headerComp) {
|
31642 | if (version != this.headerCompVersion || !this.isAlive()) {
|
31643 | this.destroyBean(headerComp);
|
31644 | return;
|
31645 | }
|
31646 | this.destroyHeaderComp();
|
31647 | this.headerComp = headerComp;
|
31648 | this.headerCompGui = headerComp.getGui();
|
31649 | this.eHeaderCompWrapper.appendChild(this.headerCompGui);
|
31650 | this.ctrl.setDragSource(this.getGui());
|
31651 | };
|
31652 | 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 ref=\"eHeaderCompWrapper\" class=\"ag-header-cell-comp-wrapper\" role=\"presentation\"></div>\n </div>";
|
31653 | __decorate$1t([
|
31654 | RefSelector('eResize')
|
31655 | ], HeaderCellComp.prototype, "eResize", void 0);
|
31656 | __decorate$1t([
|
31657 | RefSelector('eHeaderCompWrapper')
|
31658 | ], HeaderCellComp.prototype, "eHeaderCompWrapper", void 0);
|
31659 | __decorate$1t([
|
31660 | PostConstruct
|
31661 | ], HeaderCellComp.prototype, "postConstruct", null);
|
31662 | __decorate$1t([
|
31663 | PreDestroy
|
31664 | ], HeaderCellComp.prototype, "destroyHeaderComp", null);
|
31665 | return HeaderCellComp;
|
31666 | }(AbstractHeaderCellComp));
|
31667 |
|
31668 |
|
31669 |
|
31670 |
|
31671 |
|
31672 |
|
31673 |
|
31674 | var __extends$1v = (undefined && undefined.__extends) || (function () {
|
31675 | var extendStatics = function (d, b) {
|
31676 | extendStatics = Object.setPrototypeOf ||
|
31677 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
31678 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
31679 | return extendStatics(d, b);
|
31680 | };
|
31681 | return function (d, b) {
|
31682 | extendStatics(d, b);
|
31683 | function __() { this.constructor = d; }
|
31684 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
31685 | };
|
31686 | })();
|
31687 | var __decorate$1s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
31688 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
31689 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
31690 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
31691 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
31692 | };
|
31693 | var HeaderGroupCellComp = (function (_super) {
|
31694 | __extends$1v(HeaderGroupCellComp, _super);
|
31695 | function HeaderGroupCellComp(ctrl) {
|
31696 | return _super.call(this, HeaderGroupCellComp.TEMPLATE, ctrl) || this;
|
31697 | }
|
31698 | HeaderGroupCellComp.prototype.postConstruct = function () {
|
31699 | var _this = this;
|
31700 | var eGui = this.getGui();
|
31701 | var setAttribute = function (key, value) {
|
31702 | return value != undefined ? eGui.setAttribute(key, value) : eGui.removeAttribute(key);
|
31703 | };
|
31704 | var compProxy = {
|
31705 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
31706 | setResizableDisplayed: function (displayed) { return setDisplayed(_this.eResize, displayed); },
|
31707 | setWidth: function (width) { return eGui.style.width = width; },
|
31708 | setColId: function (id) { return eGui.setAttribute("col-id", id); },
|
31709 | setAriaExpanded: function (expanded) { return setAttribute('aria-expanded', expanded); },
|
31710 | setTitle: function (title) { return setAttribute("title", title); },
|
31711 | setUserCompDetails: function (details) { return _this.setUserCompDetails(details); }
|
31712 | };
|
31713 | this.ctrl.setComp(compProxy, eGui, this.eResize);
|
31714 | };
|
31715 | HeaderGroupCellComp.prototype.setUserCompDetails = function (details) {
|
31716 | var _this = this;
|
31717 | details.newAgStackInstance().then(function (comp) { return _this.afterHeaderCompCreated(comp); });
|
31718 | };
|
31719 | HeaderGroupCellComp.prototype.afterHeaderCompCreated = function (headerGroupComp) {
|
31720 | var _this = this;
|
31721 | var destroyFunc = function () { return _this.destroyBean(headerGroupComp); };
|
31722 | if (!this.isAlive()) {
|
31723 | destroyFunc();
|
31724 | return;
|
31725 | }
|
31726 | this.getGui().appendChild(headerGroupComp.getGui());
|
31727 | this.addDestroyFunc(destroyFunc);
|
31728 | this.ctrl.setDragSource(headerGroupComp.getGui());
|
31729 | };
|
31730 | 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>";
|
31731 | __decorate$1s([
|
31732 | Autowired('userComponentFactory')
|
31733 | ], HeaderGroupCellComp.prototype, "userComponentFactory", void 0);
|
31734 | __decorate$1s([
|
31735 | RefSelector('eResize')
|
31736 | ], HeaderGroupCellComp.prototype, "eResize", void 0);
|
31737 | __decorate$1s([
|
31738 | PostConstruct
|
31739 | ], HeaderGroupCellComp.prototype, "postConstruct", null);
|
31740 | return HeaderGroupCellComp;
|
31741 | }(AbstractHeaderCellComp));
|
31742 |
|
31743 |
|
31744 |
|
31745 |
|
31746 |
|
31747 |
|
31748 |
|
31749 | var __extends$1u = (undefined && undefined.__extends) || (function () {
|
31750 | var extendStatics = function (d, b) {
|
31751 | extendStatics = Object.setPrototypeOf ||
|
31752 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
31753 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
31754 | return extendStatics(d, b);
|
31755 | };
|
31756 | return function (d, b) {
|
31757 | extendStatics(d, b);
|
31758 | function __() { this.constructor = d; }
|
31759 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
31760 | };
|
31761 | })();
|
31762 | var __decorate$1r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
31763 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
31764 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
31765 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
31766 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
31767 | };
|
31768 | var HeaderRowType;
|
31769 | (function (HeaderRowType) {
|
31770 | HeaderRowType["COLUMN_GROUP"] = "group";
|
31771 | HeaderRowType["COLUMN"] = "column";
|
31772 | HeaderRowType["FLOATING_FILTER"] = "filter";
|
31773 | })(HeaderRowType || (HeaderRowType = {}));
|
31774 | var HeaderRowComp = (function (_super) {
|
31775 | __extends$1u(HeaderRowComp, _super);
|
31776 | function HeaderRowComp(ctrl) {
|
31777 | var _this = _super.call(this) || this;
|
31778 | _this.headerComps = {};
|
31779 | var extraClass = ctrl.getType() == HeaderRowType.COLUMN_GROUP ? "ag-header-row-column-group" :
|
31780 | ctrl.getType() == HeaderRowType.FLOATING_FILTER ? "ag-header-row-column-filter" : "ag-header-row-column";
|
31781 | _this.setTemplate( "<div class=\"ag-header-row " + extraClass + "\" role=\"row\"></div>");
|
31782 | _this.ctrl = ctrl;
|
31783 | return _this;
|
31784 | }
|
31785 |
|
31786 | HeaderRowComp.prototype.init = function () {
|
31787 | var _this = this;
|
31788 | var compProxy = {
|
31789 | setTransform: function (transform) { return _this.getGui().style.transform = transform; },
|
31790 | setHeight: function (height) { return _this.getGui().style.height = height; },
|
31791 | setTop: function (top) { return _this.getGui().style.top = top; },
|
31792 | setHeaderCtrls: function (ctrls) { return _this.setHeaderCtrls(ctrls); },
|
31793 | setWidth: function (width) { return _this.getGui().style.width = width; },
|
31794 | setAriaRowIndex: function (rowIndex) { return setAriaRowIndex(_this.getGui(), rowIndex); }
|
31795 | };
|
31796 | this.ctrl.setComp(compProxy);
|
31797 | };
|
31798 | HeaderRowComp.prototype.destroyHeaderCtrls = function () {
|
31799 | this.setHeaderCtrls([]);
|
31800 | };
|
31801 | HeaderRowComp.prototype.setHeaderCtrls = function (ctrls) {
|
31802 | var _this = this;
|
31803 | if (!this.isAlive()) {
|
31804 | return;
|
31805 | }
|
31806 | var oldComps = this.headerComps;
|
31807 | this.headerComps = {};
|
31808 | ctrls.forEach(function (ctrl) {
|
31809 | var id = ctrl.getInstanceId();
|
31810 | var comp = oldComps[id];
|
31811 | delete oldComps[id];
|
31812 | if (comp == null) {
|
31813 | comp = _this.createHeaderComp(ctrl);
|
31814 | _this.getGui().appendChild(comp.getGui());
|
31815 | }
|
31816 | _this.headerComps[id] = comp;
|
31817 | });
|
31818 | iterateObject(oldComps, function (id, comp) {
|
31819 | _this.getGui().removeChild(comp.getGui());
|
31820 | _this.destroyBean(comp);
|
31821 | });
|
31822 | var isEnsureDomOrder = this.gridOptionsService.is('ensureDomOrder');
|
31823 | var isPrintLayout = this.gridOptionsService.isDomLayout('print');
|
31824 | if (isEnsureDomOrder || isPrintLayout) {
|
31825 | var comps = getAllValuesInObject(this.headerComps);
|
31826 |
|
31827 | comps.sort(function (a, b) {
|
31828 | var leftA = a.getCtrl().getColumnGroupChild().getLeft();
|
31829 | var leftB = b.getCtrl().getColumnGroupChild().getLeft();
|
31830 | return leftA - leftB;
|
31831 | });
|
31832 | var elementsInOrder = comps.map(function (c) { return c.getGui(); });
|
31833 | setDomChildOrder(this.getGui(), elementsInOrder);
|
31834 | }
|
31835 | };
|
31836 | HeaderRowComp.prototype.createHeaderComp = function (headerCtrl) {
|
31837 | var result;
|
31838 | switch (this.ctrl.getType()) {
|
31839 | case HeaderRowType.COLUMN_GROUP:
|
31840 | result = new HeaderGroupCellComp(headerCtrl);
|
31841 | break;
|
31842 | case HeaderRowType.FLOATING_FILTER:
|
31843 | result = new HeaderFilterCellComp(headerCtrl);
|
31844 | break;
|
31845 | default:
|
31846 | result = new HeaderCellComp(headerCtrl);
|
31847 | break;
|
31848 | }
|
31849 | this.createBean(result);
|
31850 | result.setParentComponent(this);
|
31851 | return result;
|
31852 | };
|
31853 | __decorate$1r([
|
31854 | PostConstruct
|
31855 | ], HeaderRowComp.prototype, "init", null);
|
31856 | __decorate$1r([
|
31857 | PreDestroy
|
31858 | ], HeaderRowComp.prototype, "destroyHeaderCtrls", null);
|
31859 | return HeaderRowComp;
|
31860 | }(Component));
|
31861 |
|
31862 |
|
31863 |
|
31864 |
|
31865 |
|
31866 |
|
31867 |
|
31868 | var __extends$1t = (undefined && undefined.__extends) || (function () {
|
31869 | var extendStatics = function (d, b) {
|
31870 | extendStatics = Object.setPrototypeOf ||
|
31871 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
31872 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
31873 | return extendStatics(d, b);
|
31874 | };
|
31875 | return function (d, b) {
|
31876 | extendStatics(d, b);
|
31877 | function __() { this.constructor = d; }
|
31878 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
31879 | };
|
31880 | })();
|
31881 | var __decorate$1q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
31882 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
31883 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
31884 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
31885 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
31886 | };
|
31887 | var instanceIdSequence$1 = 0;
|
31888 | var AbstractHeaderCellCtrl = (function (_super) {
|
31889 | __extends$1t(AbstractHeaderCellCtrl, _super);
|
31890 | function AbstractHeaderCellCtrl(columnGroupChild, parentRowCtrl) {
|
31891 | var _this = _super.call(this) || this;
|
31892 | _this.lastFocusEvent = null;
|
31893 | _this.columnGroupChild = columnGroupChild;
|
31894 | _this.parentRowCtrl = parentRowCtrl;
|
31895 |
|
31896 | _this.instanceId = columnGroupChild.getUniqueId() + '-' + instanceIdSequence$1++;
|
31897 | return _this;
|
31898 | }
|
31899 | AbstractHeaderCellCtrl.prototype.shouldStopEventPropagation = function (e) {
|
31900 | var _a = this.focusService.getFocusedHeader(), headerRowIndex = _a.headerRowIndex, column = _a.column;
|
31901 | return isUserSuppressingHeaderKeyboardEvent(this.gridOptionsService, e, headerRowIndex, column);
|
31902 | };
|
31903 | AbstractHeaderCellCtrl.prototype.getWrapperHasFocus = function () {
|
31904 | var eDocument = this.gridOptionsService.getDocument();
|
31905 | var activeEl = eDocument.activeElement;
|
31906 | return activeEl === this.eGui;
|
31907 | };
|
31908 | AbstractHeaderCellCtrl.prototype.setGui = function (eGui) {
|
31909 | this.eGui = eGui;
|
31910 | this.addDomData();
|
31911 | };
|
31912 | AbstractHeaderCellCtrl.prototype.handleKeyDown = function (e) {
|
31913 | var wrapperHasFocus = this.getWrapperHasFocus();
|
31914 | switch (e.key) {
|
31915 | case KeyCode.PAGE_DOWN:
|
31916 | case KeyCode.PAGE_UP:
|
31917 | case KeyCode.PAGE_HOME:
|
31918 | case KeyCode.PAGE_END:
|
31919 | if (wrapperHasFocus) {
|
31920 | e.preventDefault();
|
31921 | }
|
31922 | }
|
31923 | };
|
31924 | AbstractHeaderCellCtrl.prototype.addDomData = function () {
|
31925 | var _this = this;
|
31926 | var key = AbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL;
|
31927 | this.gridOptionsService.setDomData(this.eGui, key, this);
|
31928 | this.addDestroyFunc(function () { return _this.gridOptionsService.setDomData(_this.eGui, key, null); });
|
31929 | };
|
31930 | AbstractHeaderCellCtrl.prototype.getGui = function () {
|
31931 | return this.eGui;
|
31932 | };
|
31933 | AbstractHeaderCellCtrl.prototype.focus = function (event) {
|
31934 | if (!this.eGui) {
|
31935 | return false;
|
31936 | }
|
31937 | this.lastFocusEvent = event || null;
|
31938 | this.eGui.focus();
|
31939 | return true;
|
31940 | };
|
31941 | AbstractHeaderCellCtrl.prototype.getRowIndex = function () {
|
31942 | return this.parentRowCtrl.getRowIndex();
|
31943 | };
|
31944 | AbstractHeaderCellCtrl.prototype.getParentRowCtrl = function () {
|
31945 | return this.parentRowCtrl;
|
31946 | };
|
31947 | AbstractHeaderCellCtrl.prototype.getPinned = function () {
|
31948 | return this.parentRowCtrl.getPinned();
|
31949 | };
|
31950 | AbstractHeaderCellCtrl.prototype.getInstanceId = function () {
|
31951 | return this.instanceId;
|
31952 | };
|
31953 | AbstractHeaderCellCtrl.prototype.getColumnGroupChild = function () {
|
31954 | return this.columnGroupChild;
|
31955 | };
|
31956 | AbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL = 'headerCtrl';
|
31957 | __decorate$1q([
|
31958 | Autowired('focusService')
|
31959 | ], AbstractHeaderCellCtrl.prototype, "focusService", void 0);
|
31960 | __decorate$1q([
|
31961 | Autowired('beans')
|
31962 | ], AbstractHeaderCellCtrl.prototype, "beans", void 0);
|
31963 | __decorate$1q([
|
31964 | Autowired('userComponentFactory')
|
31965 | ], AbstractHeaderCellCtrl.prototype, "userComponentFactory", void 0);
|
31966 | return AbstractHeaderCellCtrl;
|
31967 | }(BeanStub));
|
31968 |
|
31969 |
|
31970 |
|
31971 |
|
31972 |
|
31973 |
|
31974 |
|
31975 | var __extends$1s = (undefined && undefined.__extends) || (function () {
|
31976 | var extendStatics = function (d, b) {
|
31977 | extendStatics = Object.setPrototypeOf ||
|
31978 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
31979 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
31980 | return extendStatics(d, b);
|
31981 | };
|
31982 | return function (d, b) {
|
31983 | extendStatics(d, b);
|
31984 | function __() { this.constructor = d; }
|
31985 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
31986 | };
|
31987 | })();
|
31988 | var __decorate$1p = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
31989 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
31990 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
31991 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
31992 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
31993 | };
|
31994 | var SetLeftFeature = (function (_super) {
|
31995 | __extends$1s(SetLeftFeature, _super);
|
31996 | function SetLeftFeature(columnOrGroup, eCell, beans, colsSpanning) {
|
31997 | var _this = _super.call(this) || this;
|
31998 | _this.columnOrGroup = columnOrGroup;
|
31999 | _this.eCell = eCell;
|
32000 | _this.ariaEl = _this.eCell.querySelector('[role=columnheader]') || _this.eCell;
|
32001 | _this.colsSpanning = colsSpanning;
|
32002 | _this.beans = beans;
|
32003 | return _this;
|
32004 | }
|
32005 | SetLeftFeature.prototype.setColsSpanning = function (colsSpanning) {
|
32006 | this.colsSpanning = colsSpanning;
|
32007 | this.onLeftChanged();
|
32008 | };
|
32009 | SetLeftFeature.prototype.getColumnOrGroup = function () {
|
32010 | if (this.beans.gridOptionsService.is('enableRtl') && this.colsSpanning) {
|
32011 | return last(this.colsSpanning);
|
32012 | }
|
32013 | return this.columnOrGroup;
|
32014 | };
|
32015 | SetLeftFeature.prototype.postConstruct = function () {
|
32016 | this.addManagedListener(this.columnOrGroup, Column.EVENT_LEFT_CHANGED, this.onLeftChanged.bind(this));
|
32017 | this.setLeftFirstTime();
|
32018 |
|
32019 |
|
32020 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onLeftChanged.bind(this));
|
32021 |
|
32022 | this.addManagedPropertyListener('domLayout', this.onLeftChanged.bind(this));
|
32023 | };
|
32024 | SetLeftFeature.prototype.setLeftFirstTime = function () {
|
32025 | var suppressMoveAnimation = this.beans.gridOptionsService.is('suppressColumnMoveAnimation');
|
32026 | var oldLeftExists = exists(this.columnOrGroup.getOldLeft());
|
32027 | var animateColumnMove = this.beans.columnAnimationService.isActive() && oldLeftExists && !suppressMoveAnimation;
|
32028 | if (animateColumnMove) {
|
32029 | this.animateInLeft();
|
32030 | }
|
32031 | else {
|
32032 | this.onLeftChanged();
|
32033 | }
|
32034 | };
|
32035 | SetLeftFeature.prototype.animateInLeft = function () {
|
32036 | var _this = this;
|
32037 | var colOrGroup = this.getColumnOrGroup();
|
32038 | var left = colOrGroup.getLeft();
|
32039 | var oldLeft = colOrGroup.getOldLeft();
|
32040 | var oldActualLeft = this.modifyLeftForPrintLayout(colOrGroup, oldLeft);
|
32041 | var actualLeft = this.modifyLeftForPrintLayout(colOrGroup, left);
|
32042 | this.setLeft(oldActualLeft);
|
32043 |
|
32044 |
|
32045 |
|
32046 |
|
32047 |
|
32048 | this.actualLeft = actualLeft;
|
32049 | this.beans.columnAnimationService.executeNextVMTurn(function () {
|
32050 |
|
32051 | if (_this.actualLeft === actualLeft) {
|
32052 | _this.setLeft(actualLeft);
|
32053 | }
|
32054 | });
|
32055 | };
|
32056 | SetLeftFeature.prototype.onLeftChanged = function () {
|
32057 | var colOrGroup = this.getColumnOrGroup();
|
32058 | var left = colOrGroup.getLeft();
|
32059 | this.actualLeft = this.modifyLeftForPrintLayout(colOrGroup, left);
|
32060 | this.setLeft(this.actualLeft);
|
32061 | };
|
32062 | SetLeftFeature.prototype.modifyLeftForPrintLayout = function (colOrGroup, leftPosition) {
|
32063 | var printLayout = this.beans.gridOptionsService.isDomLayout('print');
|
32064 | if (!printLayout) {
|
32065 | return leftPosition;
|
32066 | }
|
32067 | if (colOrGroup.getPinned() === 'left') {
|
32068 | return leftPosition;
|
32069 | }
|
32070 | var leftWidth = this.beans.columnModel.getDisplayedColumnsLeftWidth();
|
32071 | if (colOrGroup.getPinned() === 'right') {
|
32072 | var bodyWidth = this.beans.columnModel.getBodyContainerWidth();
|
32073 | return leftWidth + bodyWidth + leftPosition;
|
32074 | }
|
32075 |
|
32076 | return leftWidth + leftPosition;
|
32077 | };
|
32078 | SetLeftFeature.prototype.setLeft = function (value) {
|
32079 |
|
32080 |
|
32081 |
|
32082 | if (exists(value)) {
|
32083 | this.eCell.style.left = value + "px";
|
32084 | }
|
32085 | var indexColumn;
|
32086 | if (this.columnOrGroup instanceof Column) {
|
32087 | indexColumn = this.columnOrGroup;
|
32088 | }
|
32089 | else {
|
32090 | var columnGroup = this.columnOrGroup;
|
32091 | var children = columnGroup.getLeafColumns();
|
32092 | if (!children.length) {
|
32093 | return;
|
32094 | }
|
32095 | if (children.length > 1) {
|
32096 | setAriaColSpan(this.ariaEl, children.length);
|
32097 | }
|
32098 | indexColumn = children[0];
|
32099 | }
|
32100 | var index = this.beans.columnModel.getAriaColumnIndex(indexColumn);
|
32101 | setAriaColIndex(this.ariaEl, index);
|
32102 | };
|
32103 | __decorate$1p([
|
32104 | PostConstruct
|
32105 | ], SetLeftFeature.prototype, "postConstruct", null);
|
32106 | return SetLeftFeature;
|
32107 | }(BeanStub));
|
32108 |
|
32109 |
|
32110 |
|
32111 |
|
32112 |
|
32113 |
|
32114 |
|
32115 | var __extends$1r = (undefined && undefined.__extends) || (function () {
|
32116 | var extendStatics = function (d, b) {
|
32117 | extendStatics = Object.setPrototypeOf ||
|
32118 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
32119 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
32120 | return extendStatics(d, b);
|
32121 | };
|
32122 | return function (d, b) {
|
32123 | extendStatics(d, b);
|
32124 | function __() { this.constructor = d; }
|
32125 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32126 | };
|
32127 | })();
|
32128 | var __decorate$1o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
32129 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
32130 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
32131 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
32132 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
32133 | };
|
32134 | var HoverFeature = (function (_super) {
|
32135 | __extends$1r(HoverFeature, _super);
|
32136 | function HoverFeature(columns, element) {
|
32137 | var _this = _super.call(this) || this;
|
32138 | _this.columns = columns;
|
32139 | _this.element = element;
|
32140 | return _this;
|
32141 | }
|
32142 | HoverFeature.prototype.postConstruct = function () {
|
32143 | if (this.gridOptionsService.is('columnHoverHighlight')) {
|
32144 | this.addMouseHoverListeners();
|
32145 | }
|
32146 | };
|
32147 | HoverFeature.prototype.addMouseHoverListeners = function () {
|
32148 | this.addManagedListener(this.element, 'mouseout', this.onMouseOut.bind(this));
|
32149 | this.addManagedListener(this.element, 'mouseover', this.onMouseOver.bind(this));
|
32150 | };
|
32151 | HoverFeature.prototype.onMouseOut = function () {
|
32152 | this.columnHoverService.clearMouseOver();
|
32153 | };
|
32154 | HoverFeature.prototype.onMouseOver = function () {
|
32155 | this.columnHoverService.setMouseOver(this.columns);
|
32156 | };
|
32157 | __decorate$1o([
|
32158 | Autowired('columnHoverService')
|
32159 | ], HoverFeature.prototype, "columnHoverService", void 0);
|
32160 | __decorate$1o([
|
32161 | PostConstruct
|
32162 | ], HoverFeature.prototype, "postConstruct", null);
|
32163 | return HoverFeature;
|
32164 | }(BeanStub));
|
32165 |
|
32166 |
|
32167 |
|
32168 |
|
32169 |
|
32170 |
|
32171 |
|
32172 | var __extends$1q = (undefined && undefined.__extends) || (function () {
|
32173 | var extendStatics = function (d, b) {
|
32174 | extendStatics = Object.setPrototypeOf ||
|
32175 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
32176 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
32177 | return extendStatics(d, b);
|
32178 | };
|
32179 | return function (d, b) {
|
32180 | extendStatics(d, b);
|
32181 | function __() { this.constructor = d; }
|
32182 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32183 | };
|
32184 | })();
|
32185 | var __decorate$1n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
32186 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
32187 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
32188 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
32189 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
32190 | };
|
32191 | var HeaderFilterCellCtrl = (function (_super) {
|
32192 | __extends$1q(HeaderFilterCellCtrl, _super);
|
32193 | function HeaderFilterCellCtrl(column, parentRowCtrl) {
|
32194 | var _this = _super.call(this, column, parentRowCtrl) || this;
|
32195 | _this.column = column;
|
32196 | return _this;
|
32197 | }
|
32198 | HeaderFilterCellCtrl.prototype.setComp = function (comp, eGui, eButtonShowMainFilter, eFloatingFilterBody) {
|
32199 | _super.prototype.setGui.call(this, eGui);
|
32200 | this.comp = comp;
|
32201 | this.eButtonShowMainFilter = eButtonShowMainFilter;
|
32202 | this.eFloatingFilterBody = eFloatingFilterBody;
|
32203 | var colDef = this.column.getColDef();
|
32204 | var filterExists = !!colDef.filter || !!colDef.filterFramework;
|
32205 | var floatingFilterExists = !!colDef.floatingFilter;
|
32206 | this.active = filterExists && floatingFilterExists;
|
32207 | this.setupWidth();
|
32208 | this.setupLeft();
|
32209 | this.setupHover();
|
32210 | this.setupFocus();
|
32211 | this.setupUserComp();
|
32212 | this.setupSyncWithFilter();
|
32213 | this.setupUi();
|
32214 | this.addManagedListener(this.eButtonShowMainFilter, 'click', this.showParentFilter.bind(this));
|
32215 | if (this.active) {
|
32216 | this.addManagedListener(this.column, Column.EVENT_FILTER_CHANGED, this.updateFilterButton.bind(this));
|
32217 | }
|
32218 | };
|
32219 | HeaderFilterCellCtrl.prototype.setupUi = function () {
|
32220 | this.comp.setButtonWrapperDisplayed(!this.suppressFilterButton && this.active);
|
32221 | if (!this.active) {
|
32222 | return;
|
32223 | }
|
32224 | this.comp.addOrRemoveBodyCssClass('ag-floating-filter-full-body', this.suppressFilterButton);
|
32225 | this.comp.addOrRemoveBodyCssClass('ag-floating-filter-body', !this.suppressFilterButton);
|
32226 | var eMenuIcon = createIconNoSpan('filter', this.gridOptionsService, this.column);
|
32227 | if (eMenuIcon) {
|
32228 | this.eButtonShowMainFilter.appendChild(eMenuIcon);
|
32229 | }
|
32230 | };
|
32231 | HeaderFilterCellCtrl.prototype.setupFocus = function () {
|
32232 | this.createManagedBean(new ManagedFocusFeature(this.eGui, {
|
32233 | shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this),
|
32234 | onTabKeyDown: this.onTabKeyDown.bind(this),
|
32235 | handleKeyDown: this.handleKeyDown.bind(this),
|
32236 | onFocusIn: this.onFocusIn.bind(this)
|
32237 | }));
|
32238 | };
|
32239 | HeaderFilterCellCtrl.prototype.onTabKeyDown = function (e) {
|
32240 | var eDocument = this.gridOptionsService.getDocument();
|
32241 | var activeEl = eDocument.activeElement;
|
32242 | var wrapperHasFocus = activeEl === this.eGui;
|
32243 | if (wrapperHasFocus) {
|
32244 | return;
|
32245 | }
|
32246 | var nextFocusableEl = this.focusService.findNextFocusableElement(this.eGui, null, e.shiftKey);
|
32247 | if (nextFocusableEl) {
|
32248 | this.beans.headerNavigationService.scrollToColumn(this.column);
|
32249 | e.preventDefault();
|
32250 | nextFocusableEl.focus();
|
32251 | return;
|
32252 | }
|
32253 | var nextFocusableColumn = this.findNextColumnWithFloatingFilter(e.shiftKey);
|
32254 | if (!nextFocusableColumn) {
|
32255 | return;
|
32256 | }
|
32257 | if (this.focusService.focusHeaderPosition({
|
32258 | headerPosition: {
|
32259 | headerRowIndex: this.getParentRowCtrl().getRowIndex(),
|
32260 | column: nextFocusableColumn
|
32261 | },
|
32262 | event: e
|
32263 | })) {
|
32264 | e.preventDefault();
|
32265 | }
|
32266 | };
|
32267 | HeaderFilterCellCtrl.prototype.findNextColumnWithFloatingFilter = function (backwards) {
|
32268 | var columModel = this.beans.columnModel;
|
32269 | var nextCol = this.column;
|
32270 | do {
|
32271 | nextCol = backwards
|
32272 | ? columModel.getDisplayedColBefore(nextCol)
|
32273 | : columModel.getDisplayedColAfter(nextCol);
|
32274 | if (!nextCol) {
|
32275 | break;
|
32276 | }
|
32277 | } while (!nextCol.getColDef().filter || !nextCol.getColDef().floatingFilter);
|
32278 | return nextCol;
|
32279 | };
|
32280 | HeaderFilterCellCtrl.prototype.handleKeyDown = function (e) {
|
32281 | _super.prototype.handleKeyDown.call(this, e);
|
32282 | var wrapperHasFocus = this.getWrapperHasFocus();
|
32283 | switch (e.key) {
|
32284 | case KeyCode.UP:
|
32285 | case KeyCode.DOWN:
|
32286 | if (!wrapperHasFocus) {
|
32287 | e.preventDefault();
|
32288 | }
|
32289 | case KeyCode.LEFT:
|
32290 | case KeyCode.RIGHT:
|
32291 | if (wrapperHasFocus) {
|
32292 | return;
|
32293 | }
|
32294 | e.stopPropagation();
|
32295 | case KeyCode.ENTER:
|
32296 | if (wrapperHasFocus) {
|
32297 | if (this.focusService.focusInto(this.eGui)) {
|
32298 | e.preventDefault();
|
32299 | }
|
32300 | }
|
32301 | break;
|
32302 | case KeyCode.ESCAPE:
|
32303 | if (!wrapperHasFocus) {
|
32304 | this.eGui.focus();
|
32305 | }
|
32306 | }
|
32307 | };
|
32308 | HeaderFilterCellCtrl.prototype.onFocusIn = function (e) {
|
32309 | var isRelatedWithin = this.eGui.contains(e.relatedTarget);
|
32310 |
|
32311 |
|
32312 | if (isRelatedWithin) {
|
32313 | return;
|
32314 | }
|
32315 | var notFromHeaderWrapper = !!e.relatedTarget && !e.relatedTarget.classList.contains('ag-floating-filter');
|
32316 | var fromWithinHeader = !!e.relatedTarget && isElementChildOfClass(e.relatedTarget, 'ag-floating-filter');
|
32317 | if (notFromHeaderWrapper && fromWithinHeader && e.target === this.eGui) {
|
32318 | var lastFocusEvent = this.lastFocusEvent;
|
32319 | var fromTab = !!(lastFocusEvent && lastFocusEvent.key === KeyCode.TAB);
|
32320 | if (lastFocusEvent && fromTab) {
|
32321 | var shouldFocusLast = lastFocusEvent.shiftKey;
|
32322 | this.focusService.focusInto(this.eGui, shouldFocusLast);
|
32323 | }
|
32324 | }
|
32325 | var rowIndex = this.getRowIndex();
|
32326 | this.beans.focusService.setFocusedHeader(rowIndex, this.column);
|
32327 | };
|
32328 | HeaderFilterCellCtrl.prototype.setupHover = function () {
|
32329 | var _this = this;
|
32330 | this.createManagedBean(new HoverFeature([this.column], this.eGui));
|
32331 | var listener = function () {
|
32332 | if (!_this.gridOptionsService.is('columnHoverHighlight')) {
|
32333 | return;
|
32334 | }
|
32335 | var hovered = _this.columnHoverService.isHovered(_this.column);
|
32336 | _this.comp.addOrRemoveCssClass('ag-column-hover', hovered);
|
32337 | };
|
32338 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, listener);
|
32339 | listener();
|
32340 | };
|
32341 | HeaderFilterCellCtrl.prototype.setupLeft = function () {
|
32342 | var setLeftFeature = new SetLeftFeature(this.column, this.eGui, this.beans);
|
32343 | this.createManagedBean(setLeftFeature);
|
32344 | };
|
32345 | HeaderFilterCellCtrl.prototype.setupUserComp = function () {
|
32346 | var _this = this;
|
32347 | if (!this.active) {
|
32348 | return;
|
32349 | }
|
32350 | var colDef = this.column.getColDef();
|
32351 |
|
32352 |
|
32353 | this.suppressFilterButton = colDef.floatingFilterComponentParams ? !!colDef.floatingFilterComponentParams.suppressFilterButton : false;
|
32354 | var compDetails = this.filterManager.getFloatingFilterCompDetails(this.column, function () { return _this.showParentFilter(); });
|
32355 | if (compDetails) {
|
32356 | this.comp.setCompDetails(compDetails);
|
32357 | }
|
32358 | };
|
32359 | HeaderFilterCellCtrl.prototype.showParentFilter = function () {
|
32360 | var eventSource = this.suppressFilterButton ? this.eFloatingFilterBody : this.eButtonShowMainFilter;
|
32361 | this.menuFactory.showMenuAfterButtonClick(this.column, eventSource, 'floatingFilter', 'filterMenuTab', ['filterMenuTab']);
|
32362 | };
|
32363 | HeaderFilterCellCtrl.prototype.setupSyncWithFilter = function () {
|
32364 | var _this = this;
|
32365 | if (!this.active) {
|
32366 | return;
|
32367 | }
|
32368 | var syncWithFilter = function (filterChangedEvent) {
|
32369 | var compPromise = _this.comp.getFloatingFilterComp();
|
32370 | if (!compPromise) {
|
32371 | return;
|
32372 | }
|
32373 | var parentModel = _this.filterManager.getCurrentFloatingFilterParentModel(_this.column);
|
32374 | compPromise.then(function (comp) {
|
32375 | if (comp) {
|
32376 | comp.onParentModelChanged(parentModel, filterChangedEvent);
|
32377 | }
|
32378 | });
|
32379 | };
|
32380 | this.addManagedListener(this.column, Column.EVENT_FILTER_CHANGED, syncWithFilter);
|
32381 | if (this.filterManager.isFilterActive(this.column)) {
|
32382 | syncWithFilter(null);
|
32383 | }
|
32384 | };
|
32385 | HeaderFilterCellCtrl.prototype.setupWidth = function () {
|
32386 | var _this = this;
|
32387 | var listener = function () {
|
32388 | var width = _this.column.getActualWidth() + "px";
|
32389 | _this.comp.setWidth(width);
|
32390 | };
|
32391 | this.addManagedListener(this.column, Column.EVENT_WIDTH_CHANGED, listener);
|
32392 | listener();
|
32393 | };
|
32394 | HeaderFilterCellCtrl.prototype.updateFilterButton = function () {
|
32395 | if (!this.suppressFilterButton && this.comp) {
|
32396 | this.comp.setButtonWrapperDisplayed(this.filterManager.isFilterAllowed(this.column));
|
32397 | }
|
32398 | };
|
32399 | __decorate$1n([
|
32400 | Autowired('filterManager')
|
32401 | ], HeaderFilterCellCtrl.prototype, "filterManager", void 0);
|
32402 | __decorate$1n([
|
32403 | Autowired('columnHoverService')
|
32404 | ], HeaderFilterCellCtrl.prototype, "columnHoverService", void 0);
|
32405 | __decorate$1n([
|
32406 | Autowired('menuFactory')
|
32407 | ], HeaderFilterCellCtrl.prototype, "menuFactory", void 0);
|
32408 | return HeaderFilterCellCtrl;
|
32409 | }(AbstractHeaderCellCtrl));
|
32410 |
|
32411 |
|
32412 |
|
32413 |
|
32414 |
|
32415 |
|
32416 |
|
32417 | var __extends$1p = (undefined && undefined.__extends) || (function () {
|
32418 | var extendStatics = function (d, b) {
|
32419 | extendStatics = Object.setPrototypeOf ||
|
32420 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
32421 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
32422 | return extendStatics(d, b);
|
32423 | };
|
32424 | return function (d, b) {
|
32425 | extendStatics(d, b);
|
32426 | function __() { this.constructor = d; }
|
32427 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32428 | };
|
32429 | })();
|
32430 | var __decorate$1m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
32431 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
32432 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
32433 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
32434 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
32435 | };
|
32436 | var ResizeFeature = (function (_super) {
|
32437 | __extends$1p(ResizeFeature, _super);
|
32438 | function ResizeFeature(pinned, column, eResize, comp, ctrl) {
|
32439 | var _this = _super.call(this) || this;
|
32440 | _this.pinned = pinned;
|
32441 | _this.column = column;
|
32442 | _this.eResize = eResize;
|
32443 | _this.comp = comp;
|
32444 | _this.ctrl = ctrl;
|
32445 | return _this;
|
32446 | }
|
32447 | ResizeFeature.prototype.postConstruct = function () {
|
32448 | var _this = this;
|
32449 | var colDef = this.column.getColDef();
|
32450 | var destroyResizeFuncs = [];
|
32451 | var canResize;
|
32452 | var canAutosize;
|
32453 | var addResize = function () {
|
32454 | setDisplayed(_this.eResize, canResize);
|
32455 | if (!canResize) {
|
32456 | return;
|
32457 | }
|
32458 | var finishedWithResizeFunc = _this.horizontalResizeService.addResizeBar({
|
32459 | eResizeBar: _this.eResize,
|
32460 | onResizeStart: _this.onResizeStart.bind(_this),
|
32461 | onResizing: _this.onResizing.bind(_this, false),
|
32462 | onResizeEnd: _this.onResizing.bind(_this, true)
|
32463 | });
|
32464 | destroyResizeFuncs.push(finishedWithResizeFunc);
|
32465 | if (canAutosize) {
|
32466 | var skipHeaderOnAutoSize_1 = _this.gridOptionsService.is('skipHeaderOnAutoSize');
|
32467 | var autoSizeColListener_1 = function () {
|
32468 | _this.columnModel.autoSizeColumn(_this.column, skipHeaderOnAutoSize_1, "uiColumnResized");
|
32469 | };
|
32470 | _this.eResize.addEventListener('dblclick', autoSizeColListener_1);
|
32471 | var touchListener_1 = new TouchListener(_this.eResize);
|
32472 | touchListener_1.addEventListener(TouchListener.EVENT_DOUBLE_TAP, autoSizeColListener_1);
|
32473 | _this.addDestroyFunc(function () {
|
32474 | _this.eResize.removeEventListener('dblclick', autoSizeColListener_1);
|
32475 | touchListener_1.removeEventListener(TouchListener.EVENT_DOUBLE_TAP, autoSizeColListener_1);
|
32476 | touchListener_1.destroy();
|
32477 | });
|
32478 | }
|
32479 | };
|
32480 | var removeResize = function () {
|
32481 | destroyResizeFuncs.forEach(function (f) { return f(); });
|
32482 | destroyResizeFuncs.length = 0;
|
32483 | };
|
32484 | var refresh = function () {
|
32485 | var resize = _this.column.isResizable();
|
32486 | var autoSize = !_this.gridOptionsService.is('suppressAutoSize') && !colDef.suppressAutoSize;
|
32487 | var propertyChange = resize !== canResize || autoSize !== canAutosize;
|
32488 | if (propertyChange) {
|
32489 | canResize = resize;
|
32490 | canAutosize = autoSize;
|
32491 | removeResize();
|
32492 | addResize();
|
32493 | }
|
32494 | };
|
32495 | refresh();
|
32496 | this.addDestroyFunc(removeResize);
|
32497 | this.ctrl.addRefreshFunction(refresh);
|
32498 | };
|
32499 | ResizeFeature.prototype.onResizing = function (finished, resizeAmount) {
|
32500 | var resizeAmountNormalised = this.normaliseResizeAmount(resizeAmount);
|
32501 | var columnWidths = [{ key: this.column, newWidth: this.resizeStartWidth + resizeAmountNormalised }];
|
32502 | this.columnModel.setColumnWidths(columnWidths, this.resizeWithShiftKey, finished, "uiColumnDragged");
|
32503 | if (finished) {
|
32504 | this.comp.addOrRemoveCssClass('ag-column-resizing', false);
|
32505 | }
|
32506 | };
|
32507 | ResizeFeature.prototype.onResizeStart = function (shiftKey) {
|
32508 | this.resizeStartWidth = this.column.getActualWidth();
|
32509 | this.resizeWithShiftKey = shiftKey;
|
32510 | this.comp.addOrRemoveCssClass('ag-column-resizing', true);
|
32511 | };
|
32512 |
|
32513 |
|
32514 | ResizeFeature.prototype.normaliseResizeAmount = function (dragChange) {
|
32515 | var result = dragChange;
|
32516 | var notPinningLeft = this.pinned !== 'left';
|
32517 | var pinningRight = this.pinned === 'right';
|
32518 | if (this.gridOptionsService.is('enableRtl')) {
|
32519 |
|
32520 | if (notPinningLeft) {
|
32521 | result *= -1;
|
32522 | }
|
32523 | }
|
32524 | else {
|
32525 |
|
32526 | if (pinningRight) {
|
32527 | result *= -1;
|
32528 | }
|
32529 | }
|
32530 | return result;
|
32531 | };
|
32532 | __decorate$1m([
|
32533 | Autowired('horizontalResizeService')
|
32534 | ], ResizeFeature.prototype, "horizontalResizeService", void 0);
|
32535 | __decorate$1m([
|
32536 | Autowired('columnModel')
|
32537 | ], ResizeFeature.prototype, "columnModel", void 0);
|
32538 | __decorate$1m([
|
32539 | PostConstruct
|
32540 | ], ResizeFeature.prototype, "postConstruct", null);
|
32541 | return ResizeFeature;
|
32542 | }(BeanStub));
|
32543 |
|
32544 |
|
32545 |
|
32546 |
|
32547 |
|
32548 |
|
32549 |
|
32550 | var __extends$1o = (undefined && undefined.__extends) || (function () {
|
32551 | var extendStatics = function (d, b) {
|
32552 | extendStatics = Object.setPrototypeOf ||
|
32553 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
32554 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
32555 | return extendStatics(d, b);
|
32556 | };
|
32557 | return function (d, b) {
|
32558 | extendStatics(d, b);
|
32559 | function __() { this.constructor = d; }
|
32560 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32561 | };
|
32562 | })();
|
32563 | var __decorate$1l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
32564 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
32565 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
32566 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
32567 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
32568 | };
|
32569 | var SelectAllFeature = (function (_super) {
|
32570 | __extends$1o(SelectAllFeature, _super);
|
32571 | function SelectAllFeature(column) {
|
32572 | var _this = _super.call(this) || this;
|
32573 | _this.cbSelectAllVisible = false;
|
32574 | _this.processingEventFromCheckbox = false;
|
32575 | _this.column = column;
|
32576 | var colDef = column.getColDef();
|
32577 | _this.filteredOnly = !!(colDef === null || colDef === void 0 ? void 0 : colDef.headerCheckboxSelectionFilteredOnly);
|
32578 | _this.currentPageOnly = !!(colDef === null || colDef === void 0 ? void 0 : colDef.headerCheckboxSelectionCurrentPageOnly);
|
32579 | return _this;
|
32580 | }
|
32581 | SelectAllFeature.prototype.onSpaceKeyPressed = function (e) {
|
32582 | var checkbox = this.cbSelectAll;
|
32583 | var eDocument = this.gridOptionsService.getDocument();
|
32584 | if (checkbox.isDisplayed() && !checkbox.getGui().contains(eDocument.activeElement)) {
|
32585 | e.preventDefault();
|
32586 | checkbox.setValue(!checkbox.getValue());
|
32587 | }
|
32588 | };
|
32589 | SelectAllFeature.prototype.getCheckboxGui = function () {
|
32590 | return this.cbSelectAll.getGui();
|
32591 | };
|
32592 | SelectAllFeature.prototype.setComp = function (ctrl) {
|
32593 | this.headerCellCtrl = ctrl;
|
32594 | this.cbSelectAll = this.createManagedBean(new AgCheckbox());
|
32595 | this.cbSelectAll.addCssClass('ag-header-select-all');
|
32596 | setAriaRole(this.cbSelectAll.getGui(), 'presentation');
|
32597 | this.showOrHideSelectAll();
|
32598 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.showOrHideSelectAll.bind(this));
|
32599 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.showOrHideSelectAll.bind(this));
|
32600 | this.addManagedListener(this.eventService, Events.EVENT_SELECTION_CHANGED, this.onSelectionChanged.bind(this));
|
32601 | this.addManagedListener(this.eventService, Events.EVENT_PAGINATION_CHANGED, this.onSelectionChanged.bind(this));
|
32602 | this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, this.onModelChanged.bind(this));
|
32603 | this.addManagedListener(this.cbSelectAll, AgCheckbox.EVENT_CHANGED, this.onCbSelectAll.bind(this));
|
32604 | setAriaHidden(this.cbSelectAll.getGui(), true);
|
32605 | this.cbSelectAll.getInputElement().setAttribute('tabindex', '-1');
|
32606 | this.refreshSelectAllLabel();
|
32607 | };
|
32608 | SelectAllFeature.prototype.showOrHideSelectAll = function () {
|
32609 | this.cbSelectAllVisible = this.isCheckboxSelection();
|
32610 | this.cbSelectAll.setDisplayed(this.cbSelectAllVisible, { skipAriaHidden: true });
|
32611 | if (this.cbSelectAllVisible) {
|
32612 |
|
32613 | this.checkRightRowModelType('selectAllCheckbox');
|
32614 |
|
32615 | this.updateStateOfCheckbox();
|
32616 | }
|
32617 | this.refreshSelectAllLabel();
|
32618 | };
|
32619 | SelectAllFeature.prototype.onModelChanged = function () {
|
32620 | if (!this.cbSelectAllVisible) {
|
32621 | return;
|
32622 | }
|
32623 | this.updateStateOfCheckbox();
|
32624 | };
|
32625 | SelectAllFeature.prototype.onSelectionChanged = function () {
|
32626 | if (!this.cbSelectAllVisible) {
|
32627 | return;
|
32628 | }
|
32629 | this.updateStateOfCheckbox();
|
32630 | };
|
32631 | SelectAllFeature.prototype.updateStateOfCheckbox = function () {
|
32632 | if (this.processingEventFromCheckbox) {
|
32633 | return;
|
32634 | }
|
32635 | this.processingEventFromCheckbox = true;
|
32636 | var allSelected = this.selectionService.getSelectAllState();
|
32637 | this.cbSelectAll.setValue(allSelected);
|
32638 | this.refreshSelectAllLabel();
|
32639 | this.processingEventFromCheckbox = false;
|
32640 | };
|
32641 | SelectAllFeature.prototype.refreshSelectAllLabel = function () {
|
32642 | if (!this.cbSelectAllVisible) {
|
32643 | this.headerCellCtrl.setAriaDescriptionProperty('selectAll', null);
|
32644 | this.cbSelectAll.setInputAriaLabel(null);
|
32645 | }
|
32646 | else {
|
32647 | var translate = this.localeService.getLocaleTextFunc();
|
32648 | var checked = this.cbSelectAll.getValue();
|
32649 | var ariaStatus = checked ? translate('ariaChecked', 'checked') : translate('ariaUnchecked', 'unchecked');
|
32650 | var ariaLabel = translate('ariaRowSelectAll', 'Press Space to toggle all rows selection');
|
32651 | this.headerCellCtrl.setAriaDescriptionProperty('selectAll', ariaLabel + " (" + ariaStatus + ")");
|
32652 | this.cbSelectAll.setInputAriaLabel(ariaLabel + " (" + ariaStatus + ")");
|
32653 | }
|
32654 | this.headerCellCtrl.refreshAriaDescription();
|
32655 | };
|
32656 | SelectAllFeature.prototype.checkRightRowModelType = function (feature) {
|
32657 | var rowModelType = this.rowModel.getType();
|
32658 | var rowModelMatches = rowModelType === 'clientSide' || rowModelType === 'serverSide';
|
32659 | if (!rowModelMatches) {
|
32660 | console.warn("AG Grid: " + feature + " is only available if using 'clientSide' or 'serverSide' rowModelType, you are using " + rowModelType + ".");
|
32661 | return false;
|
32662 | }
|
32663 | return true;
|
32664 | };
|
32665 | SelectAllFeature.prototype.onCbSelectAll = function () {
|
32666 | if (this.processingEventFromCheckbox) {
|
32667 | return;
|
32668 | }
|
32669 | if (!this.cbSelectAllVisible) {
|
32670 | return;
|
32671 | }
|
32672 | var value = this.cbSelectAll.getValue();
|
32673 | var source = 'uiSelectAll';
|
32674 | if (this.currentPageOnly)
|
32675 | source = 'uiSelectAllCurrentPage';
|
32676 | else if (this.filteredOnly)
|
32677 | source = 'uiSelectAllFiltered';
|
32678 | var params = {
|
32679 | source: source,
|
32680 | justFiltered: this.filteredOnly,
|
32681 | justCurrentPage: this.currentPageOnly,
|
32682 | };
|
32683 | if (value) {
|
32684 | this.selectionService.selectAllRowNodes(params);
|
32685 | }
|
32686 | else {
|
32687 | this.selectionService.deselectAllRowNodes(params);
|
32688 | }
|
32689 | };
|
32690 | SelectAllFeature.prototype.isCheckboxSelection = function () {
|
32691 | var result = this.column.getColDef().headerCheckboxSelection;
|
32692 | if (typeof result === 'function') {
|
32693 | var func = result;
|
32694 | var params = {
|
32695 | column: this.column,
|
32696 | colDef: this.column.getColDef(),
|
32697 | columnApi: this.columnApi,
|
32698 | api: this.gridApi,
|
32699 | context: this.gridOptionsService.context
|
32700 | };
|
32701 | result = func(params);
|
32702 | }
|
32703 | if (result) {
|
32704 | return this.checkRightRowModelType('headerCheckboxSelection');
|
32705 | }
|
32706 | return false;
|
32707 | };
|
32708 | __decorate$1l([
|
32709 | Autowired('gridApi')
|
32710 | ], SelectAllFeature.prototype, "gridApi", void 0);
|
32711 | __decorate$1l([
|
32712 | Autowired('columnApi')
|
32713 | ], SelectAllFeature.prototype, "columnApi", void 0);
|
32714 | __decorate$1l([
|
32715 | Autowired('rowModel')
|
32716 | ], SelectAllFeature.prototype, "rowModel", void 0);
|
32717 | __decorate$1l([
|
32718 | Autowired('selectionService')
|
32719 | ], SelectAllFeature.prototype, "selectionService", void 0);
|
32720 | return SelectAllFeature;
|
32721 | }(BeanStub));
|
32722 |
|
32723 |
|
32724 |
|
32725 |
|
32726 |
|
32727 |
|
32728 |
|
32729 | var __extends$1n = (undefined && undefined.__extends) || (function () {
|
32730 | var extendStatics = function (d, b) {
|
32731 | extendStatics = Object.setPrototypeOf ||
|
32732 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
32733 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
32734 | return extendStatics(d, b);
|
32735 | };
|
32736 | return function (d, b) {
|
32737 | extendStatics(d, b);
|
32738 | function __() { this.constructor = d; }
|
32739 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32740 | };
|
32741 | })();
|
32742 | var __decorate$1k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
32743 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
32744 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
32745 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
32746 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
32747 | };
|
32748 | var HeaderCellCtrl = (function (_super) {
|
32749 | __extends$1n(HeaderCellCtrl, _super);
|
32750 | function HeaderCellCtrl(column, parentRowCtrl) {
|
32751 | var _this = _super.call(this, column, parentRowCtrl) || this;
|
32752 | _this.refreshFunctions = [];
|
32753 | _this.userHeaderClasses = new Set();
|
32754 | _this.ariaDescriptionProperties = new Map();
|
32755 | _this.column = column;
|
32756 | return _this;
|
32757 | }
|
32758 | HeaderCellCtrl.prototype.setComp = function (comp, eGui, eResize, eHeaderCompWrapper) {
|
32759 | var _this = this;
|
32760 | _super.prototype.setGui.call(this, eGui);
|
32761 | this.comp = comp;
|
32762 | this.updateState();
|
32763 | this.setupWidth();
|
32764 | this.setupMovingCss();
|
32765 | this.setupMenuClass();
|
32766 | this.setupSortableClass();
|
32767 | this.setupWrapTextClass();
|
32768 | this.refreshSpanHeaderHeight();
|
32769 | this.setupAutoHeight(eHeaderCompWrapper);
|
32770 | this.addColumnHoverListener();
|
32771 | this.setupFilterCss();
|
32772 | this.setupColId();
|
32773 | this.setupClassesFromColDef();
|
32774 | this.setupTooltip();
|
32775 | this.addActiveHeaderMouseListeners();
|
32776 | this.setupSelectAll();
|
32777 | this.setupUserComp();
|
32778 | this.refreshAria();
|
32779 | this.createManagedBean(new ResizeFeature(this.getPinned(), this.column, eResize, comp, this));
|
32780 | this.createManagedBean(new HoverFeature([this.column], eGui));
|
32781 | this.createManagedBean(new SetLeftFeature(this.column, eGui, this.beans));
|
32782 | this.createManagedBean(new ManagedFocusFeature(eGui, {
|
32783 | shouldStopEventPropagation: function (e) { return _this.shouldStopEventPropagation(e); },
|
32784 | onTabKeyDown: function () { return null; },
|
32785 | handleKeyDown: this.handleKeyDown.bind(this),
|
32786 | onFocusIn: this.onFocusIn.bind(this),
|
32787 | onFocusOut: this.onFocusOut.bind(this)
|
32788 | }));
|
32789 | this.addManagedListener(this.column, Column.EVENT_COL_DEF_CHANGED, this.onColDefChanged.bind(this));
|
32790 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, this.onColumnValueChanged.bind(this));
|
32791 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.onColumnRowGroupChanged.bind(this));
|
32792 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_CHANGED, this.onColumnPivotChanged.bind(this));
|
32793 | this.addManagedListener(this.eventService, Events.EVENT_HEADER_HEIGHT_CHANGED, this.onHeaderHeightChanged.bind(this));
|
32794 | };
|
32795 | HeaderCellCtrl.prototype.setupUserComp = function () {
|
32796 | var compDetails = this.lookupUserCompDetails();
|
32797 | this.setCompDetails(compDetails);
|
32798 | };
|
32799 | HeaderCellCtrl.prototype.setCompDetails = function (compDetails) {
|
32800 | this.userCompDetails = compDetails;
|
32801 | this.comp.setUserCompDetails(compDetails);
|
32802 | };
|
32803 | HeaderCellCtrl.prototype.lookupUserCompDetails = function () {
|
32804 | var params = this.createParams();
|
32805 | var colDef = this.column.getColDef();
|
32806 | return this.userComponentFactory.getHeaderCompDetails(colDef, params);
|
32807 | };
|
32808 | HeaderCellCtrl.prototype.createParams = function () {
|
32809 | var _this = this;
|
32810 | var colDef = this.column.getColDef();
|
32811 | var params = {
|
32812 | column: this.column,
|
32813 | displayName: this.displayName,
|
32814 | enableSorting: colDef.sortable,
|
32815 | enableMenu: this.menuEnabled,
|
32816 | showColumnMenu: function (source) {
|
32817 | _this.gridApi.showColumnMenuAfterButtonClick(_this.column, source);
|
32818 | },
|
32819 | progressSort: function (multiSort) {
|
32820 | _this.sortController.progressSort(_this.column, !!multiSort, "uiColumnSorted");
|
32821 | },
|
32822 | setSort: function (sort, multiSort) {
|
32823 | _this.sortController.setSortForColumn(_this.column, sort, !!multiSort, "uiColumnSorted");
|
32824 | },
|
32825 | api: this.gridApi,
|
32826 | columnApi: this.columnApi,
|
32827 | context: this.gridOptionsService.context,
|
32828 | eGridHeader: this.getGui()
|
32829 | };
|
32830 | return params;
|
32831 | };
|
32832 | HeaderCellCtrl.prototype.setupSelectAll = function () {
|
32833 | this.selectAllFeature = this.createManagedBean(new SelectAllFeature(this.column));
|
32834 | this.selectAllFeature.setComp(this);
|
32835 | };
|
32836 | HeaderCellCtrl.prototype.getSelectAllGui = function () {
|
32837 | return this.selectAllFeature.getCheckboxGui();
|
32838 | };
|
32839 | HeaderCellCtrl.prototype.handleKeyDown = function (e) {
|
32840 | _super.prototype.handleKeyDown.call(this, e);
|
32841 | if (e.key === KeyCode.SPACE) {
|
32842 | this.selectAllFeature.onSpaceKeyPressed(e);
|
32843 | }
|
32844 | if (e.key === KeyCode.ENTER) {
|
32845 | this.onEnterKeyPressed(e);
|
32846 | }
|
32847 | };
|
32848 | HeaderCellCtrl.prototype.onEnterKeyPressed = function (e) {
|
32849 |
|
32850 | var headerComp = this.comp.getUserCompInstance();
|
32851 | if (!headerComp) {
|
32852 | return;
|
32853 | }
|
32854 | if (e.ctrlKey || e.metaKey) {
|
32855 | if (this.menuEnabled && headerComp.showMenu) {
|
32856 | e.preventDefault();
|
32857 | headerComp.showMenu();
|
32858 | }
|
32859 | }
|
32860 | else if (this.sortable) {
|
32861 | var multiSort = e.shiftKey;
|
32862 | this.sortController.progressSort(this.column, multiSort, "uiColumnSorted");
|
32863 | }
|
32864 | };
|
32865 | HeaderCellCtrl.prototype.isMenuEnabled = function () {
|
32866 | return this.menuEnabled;
|
32867 | };
|
32868 | HeaderCellCtrl.prototype.onFocusIn = function (e) {
|
32869 | if (!this.getGui().contains(e.relatedTarget)) {
|
32870 | var rowIndex = this.getRowIndex();
|
32871 | this.focusService.setFocusedHeader(rowIndex, this.column);
|
32872 | }
|
32873 | this.setActiveHeader(true);
|
32874 | };
|
32875 | HeaderCellCtrl.prototype.onFocusOut = function (e) {
|
32876 | if (this.getGui().contains(e.relatedTarget)) {
|
32877 | return;
|
32878 | }
|
32879 | this.setActiveHeader(false);
|
32880 | };
|
32881 | HeaderCellCtrl.prototype.setupTooltip = function () {
|
32882 | var _this = this;
|
32883 | var tooltipCtrl = {
|
32884 | getColumn: function () { return _this.column; },
|
32885 | getColDef: function () { return _this.column.getColDef(); },
|
32886 | getGui: function () { return _this.eGui; },
|
32887 | getLocation: function () { return 'header'; },
|
32888 | getTooltipValue: function () {
|
32889 | var res = _this.column.getColDef().headerTooltip;
|
32890 | return res;
|
32891 | },
|
32892 | };
|
32893 | var tooltipFeature = this.createManagedBean(new TooltipFeature(tooltipCtrl, this.beans));
|
32894 | tooltipFeature.setComp(this.comp);
|
32895 | this.refreshFunctions.push(function () { return tooltipFeature.refreshToolTip(); });
|
32896 | };
|
32897 | HeaderCellCtrl.prototype.setupClassesFromColDef = function () {
|
32898 | var _this = this;
|
32899 | var refreshHeaderClasses = function () {
|
32900 | var colDef = _this.column.getColDef();
|
32901 | var classes = CssClassApplier.getHeaderClassesFromColDef(colDef, _this.gridOptionsService, _this.column, null);
|
32902 | var oldClasses = _this.userHeaderClasses;
|
32903 | _this.userHeaderClasses = new Set(classes);
|
32904 | classes.forEach(function (c) {
|
32905 | if (oldClasses.has(c)) {
|
32906 |
|
32907 | oldClasses.delete(c);
|
32908 | }
|
32909 | else {
|
32910 |
|
32911 | _this.comp.addOrRemoveCssClass(c, true);
|
32912 | }
|
32913 | });
|
32914 |
|
32915 | oldClasses.forEach(function (c) { return _this.comp.addOrRemoveCssClass(c, false); });
|
32916 | };
|
32917 | this.refreshFunctions.push(refreshHeaderClasses);
|
32918 | refreshHeaderClasses();
|
32919 | };
|
32920 | HeaderCellCtrl.prototype.setDragSource = function (eSource) {
|
32921 | var _this = this;
|
32922 | this.dragSourceElement = eSource;
|
32923 | this.removeDragSource();
|
32924 | if (!eSource) {
|
32925 | return;
|
32926 | }
|
32927 | if (!this.draggable) {
|
32928 | return;
|
32929 | }
|
32930 | var hideColumnOnExit = !this.gridOptionsService.is('suppressDragLeaveHidesColumns');
|
32931 | this.moveDragSource = {
|
32932 | type: DragSourceType.HeaderCell,
|
32933 | eElement: eSource,
|
32934 | defaultIconName: hideColumnOnExit ? DragAndDropService.ICON_HIDE : DragAndDropService.ICON_NOT_ALLOWED,
|
32935 | getDragItem: function () { return _this.createDragItem(); },
|
32936 | dragItemName: this.displayName,
|
32937 | onDragStarted: function () { return _this.column.setMoving(true, "uiColumnMoved"); },
|
32938 | onDragStopped: function () { return _this.column.setMoving(false, "uiColumnMoved"); },
|
32939 | onGridEnter: function (dragItem) {
|
32940 | var _a;
|
32941 | if (hideColumnOnExit) {
|
32942 | var unlockedColumns = ((_a = dragItem === null || dragItem === void 0 ? void 0 : dragItem.columns) === null || _a === void 0 ? void 0 : _a.filter(function (col) { return !col.getColDef().lockVisible; })) || [];
|
32943 | _this.columnModel.setColumnsVisible(unlockedColumns, true, "uiColumnMoved");
|
32944 | }
|
32945 | },
|
32946 | onGridExit: function (dragItem) {
|
32947 | var _a;
|
32948 | if (hideColumnOnExit) {
|
32949 | var unlockedColumns = ((_a = dragItem === null || dragItem === void 0 ? void 0 : dragItem.columns) === null || _a === void 0 ? void 0 : _a.filter(function (col) { return !col.getColDef().lockVisible; })) || [];
|
32950 | _this.columnModel.setColumnsVisible(unlockedColumns, false, "uiColumnMoved");
|
32951 | }
|
32952 | },
|
32953 | };
|
32954 | this.dragAndDropService.addDragSource(this.moveDragSource, true);
|
32955 | };
|
32956 | HeaderCellCtrl.prototype.createDragItem = function () {
|
32957 | var visibleState = {};
|
32958 | visibleState[this.column.getId()] = this.column.isVisible();
|
32959 | return {
|
32960 | columns: [this.column],
|
32961 | visibleState: visibleState
|
32962 | };
|
32963 | };
|
32964 | HeaderCellCtrl.prototype.removeDragSource = function () {
|
32965 | if (this.moveDragSource) {
|
32966 | this.dragAndDropService.removeDragSource(this.moveDragSource);
|
32967 | this.moveDragSource = undefined;
|
32968 | }
|
32969 | };
|
32970 | HeaderCellCtrl.prototype.onColDefChanged = function () {
|
32971 | this.refresh();
|
32972 | };
|
32973 | HeaderCellCtrl.prototype.updateState = function () {
|
32974 | var colDef = this.column.getColDef();
|
32975 | this.menuEnabled = this.menuFactory.isMenuEnabled(this.column) && !colDef.suppressMenu;
|
32976 | this.sortable = colDef.sortable;
|
32977 | this.displayName = this.calculateDisplayName();
|
32978 | this.draggable = this.workOutDraggable();
|
32979 | };
|
32980 | HeaderCellCtrl.prototype.addRefreshFunction = function (func) {
|
32981 | this.refreshFunctions.push(func);
|
32982 | };
|
32983 | HeaderCellCtrl.prototype.refresh = function () {
|
32984 | this.updateState();
|
32985 | this.refreshHeaderComp();
|
32986 | this.refreshAria();
|
32987 | this.refreshFunctions.forEach(function (f) { return f(); });
|
32988 | };
|
32989 | HeaderCellCtrl.prototype.refreshHeaderComp = function () {
|
32990 | var newCompDetails = this.lookupUserCompDetails();
|
32991 | var compInstance = this.comp.getUserCompInstance();
|
32992 |
|
32993 | var attemptRefresh = compInstance != null && this.userCompDetails.componentClass == newCompDetails.componentClass;
|
32994 | var headerCompRefreshed = attemptRefresh ? this.attemptHeaderCompRefresh(newCompDetails.params) : false;
|
32995 | if (headerCompRefreshed) {
|
32996 |
|
32997 |
|
32998 |
|
32999 | this.setDragSource(this.dragSourceElement);
|
33000 | }
|
33001 | else {
|
33002 | this.setCompDetails(newCompDetails);
|
33003 | }
|
33004 | };
|
33005 | HeaderCellCtrl.prototype.attemptHeaderCompRefresh = function (params) {
|
33006 | var headerComp = this.comp.getUserCompInstance();
|
33007 | if (!headerComp) {
|
33008 | return false;
|
33009 | }
|
33010 |
|
33011 | if (!headerComp.refresh) {
|
33012 | return false;
|
33013 | }
|
33014 | var res = headerComp.refresh(params);
|
33015 | return res;
|
33016 | };
|
33017 | HeaderCellCtrl.prototype.calculateDisplayName = function () {
|
33018 | return this.columnModel.getDisplayNameForColumn(this.column, 'header', true);
|
33019 | };
|
33020 | HeaderCellCtrl.prototype.checkDisplayName = function () {
|
33021 |
|
33022 | if (this.displayName !== this.calculateDisplayName()) {
|
33023 | this.refresh();
|
33024 | }
|
33025 | };
|
33026 | HeaderCellCtrl.prototype.workOutDraggable = function () {
|
33027 | var colDef = this.column.getColDef();
|
33028 | var isSuppressMovableColumns = this.gridOptionsService.is('suppressMovableColumns');
|
33029 | var colCanMove = !isSuppressMovableColumns && !colDef.suppressMovable && !colDef.lockPosition;
|
33030 |
|
33031 |
|
33032 | return !!colCanMove || !!colDef.enableRowGroup || !!colDef.enablePivot;
|
33033 | };
|
33034 | HeaderCellCtrl.prototype.onColumnRowGroupChanged = function () {
|
33035 | this.checkDisplayName();
|
33036 | };
|
33037 | HeaderCellCtrl.prototype.onColumnPivotChanged = function () {
|
33038 | this.checkDisplayName();
|
33039 | };
|
33040 | HeaderCellCtrl.prototype.onColumnValueChanged = function () {
|
33041 | this.checkDisplayName();
|
33042 | };
|
33043 | HeaderCellCtrl.prototype.setupWidth = function () {
|
33044 | var _this = this;
|
33045 | var listener = function () {
|
33046 | var columnWidth = _this.column.getActualWidth();
|
33047 | _this.comp.setWidth(columnWidth + "px");
|
33048 | };
|
33049 | this.addManagedListener(this.column, Column.EVENT_WIDTH_CHANGED, listener);
|
33050 | listener();
|
33051 | };
|
33052 | HeaderCellCtrl.prototype.setupMovingCss = function () {
|
33053 | var _this = this;
|
33054 | var listener = function () {
|
33055 |
|
33056 |
|
33057 | _this.comp.addOrRemoveCssClass('ag-header-cell-moving', _this.column.isMoving());
|
33058 | };
|
33059 | this.addManagedListener(this.column, Column.EVENT_MOVING_CHANGED, listener);
|
33060 | listener();
|
33061 | };
|
33062 | HeaderCellCtrl.prototype.setupMenuClass = function () {
|
33063 | var _this = this;
|
33064 | var listener = function () {
|
33065 | _this.comp.addOrRemoveCssClass('ag-column-menu-visible', _this.column.isMenuVisible());
|
33066 | };
|
33067 | this.addManagedListener(this.column, Column.EVENT_MENU_VISIBLE_CHANGED, listener);
|
33068 | listener();
|
33069 | };
|
33070 | HeaderCellCtrl.prototype.setupSortableClass = function () {
|
33071 | var _this = this;
|
33072 | var updateSortableCssClass = function () {
|
33073 | _this.comp.addOrRemoveCssClass('ag-header-cell-sortable', !!_this.sortable);
|
33074 | };
|
33075 | updateSortableCssClass();
|
33076 | this.addRefreshFunction(updateSortableCssClass);
|
33077 | this.addManagedListener(this.eventService, Column.EVENT_SORT_CHANGED, this.refreshAriaSort.bind(this));
|
33078 | };
|
33079 | HeaderCellCtrl.prototype.setupWrapTextClass = function () {
|
33080 | var _this = this;
|
33081 | var listener = function () {
|
33082 | var wrapText = !!_this.column.getColDef().wrapHeaderText;
|
33083 | _this.comp.addOrRemoveCssClass('ag-header-cell-wrap-text', wrapText);
|
33084 | };
|
33085 | listener();
|
33086 | this.addRefreshFunction(listener);
|
33087 | };
|
33088 | HeaderCellCtrl.prototype.onHeaderHeightChanged = function () {
|
33089 | this.refreshSpanHeaderHeight();
|
33090 | };
|
33091 | HeaderCellCtrl.prototype.refreshSpanHeaderHeight = function () {
|
33092 | var _a = this, eGui = _a.eGui, column = _a.column, comp = _a.comp, columnModel = _a.columnModel, gridOptionsService = _a.gridOptionsService;
|
33093 | if (!column.isSpanHeaderHeight()) {
|
33094 | return;
|
33095 | }
|
33096 | var _b = this.getColumnGroupPaddingInfo(), numberOfParents = _b.numberOfParents, isSpanningTotal = _b.isSpanningTotal;
|
33097 | comp.addOrRemoveCssClass('ag-header-span-height', numberOfParents > 0);
|
33098 | if (numberOfParents === 0) {
|
33099 | return;
|
33100 | }
|
33101 | comp.addOrRemoveCssClass('ag-header-span-total', isSpanningTotal);
|
33102 | var pivotMode = gridOptionsService.is('pivotMode');
|
33103 | var groupHeaderHeight = pivotMode
|
33104 | ? columnModel.getPivotGroupHeaderHeight()
|
33105 | : columnModel.getGroupHeaderHeight();
|
33106 | var headerHeight = columnModel.getColumnHeaderRowHeight();
|
33107 | var extraHeight = numberOfParents * groupHeaderHeight;
|
33108 | eGui.style.setProperty('top', -extraHeight + "px");
|
33109 | eGui.style.setProperty('height', headerHeight + extraHeight + "px");
|
33110 | };
|
33111 | HeaderCellCtrl.prototype.getColumnGroupPaddingInfo = function () {
|
33112 | var parent = this.column.getParent();
|
33113 | if (!parent || !parent.isPadding()) {
|
33114 | return { numberOfParents: 0, isSpanningTotal: false };
|
33115 | }
|
33116 | var numberOfParents = parent.getPaddingLevel() + 1;
|
33117 | var isSpanningTotal = true;
|
33118 | while (parent) {
|
33119 | if (!parent.isPadding()) {
|
33120 | isSpanningTotal = false;
|
33121 | break;
|
33122 | }
|
33123 | parent = parent.getParent();
|
33124 | }
|
33125 | return { numberOfParents: numberOfParents, isSpanningTotal: isSpanningTotal };
|
33126 | };
|
33127 | HeaderCellCtrl.prototype.setupAutoHeight = function (wrapperElement) {
|
33128 | var _this = this;
|
33129 | var measureHeight = function (timesCalled) {
|
33130 | if (!_this.isAlive()) {
|
33131 | return;
|
33132 | }
|
33133 | var _a = getElementSize(_this.getGui()), paddingTop = _a.paddingTop, paddingBottom = _a.paddingBottom, borderBottomWidth = _a.borderBottomWidth, borderTopWidth = _a.borderTopWidth;
|
33134 | var extraHeight = paddingTop + paddingBottom + borderBottomWidth + borderTopWidth;
|
33135 | var wrapperHeight = wrapperElement.offsetHeight;
|
33136 | var autoHeight = wrapperHeight + extraHeight;
|
33137 | if (timesCalled < 5) {
|
33138 |
|
33139 |
|
33140 | var doc = _this.beans.gridOptionsService.getDocument();
|
33141 | var notYetInDom = !doc || !doc.contains(wrapperElement);
|
33142 |
|
33143 |
|
33144 | var possiblyNoContentYet = autoHeight == 0;
|
33145 | if (notYetInDom || possiblyNoContentYet) {
|
33146 | _this.beans.frameworkOverrides.setTimeout(function () { return measureHeight(timesCalled + 1); }, 0);
|
33147 | return;
|
33148 | }
|
33149 | }
|
33150 | _this.columnModel.setColumnHeaderHeight(_this.column, autoHeight);
|
33151 | };
|
33152 | var isMeasuring = false;
|
33153 | var stopResizeObserver;
|
33154 | var checkMeasuring = function () {
|
33155 | var isSpanHeaderHeight = _this.column.isSpanHeaderHeight();
|
33156 | var newValue = _this.column.isAutoHeaderHeight();
|
33157 | if (isSpanHeaderHeight) {
|
33158 | stopMeasuring();
|
33159 | if (newValue) {
|
33160 | var message_1 = "AG Grid: The properties `spanHeaderHeight` and `autoHeaderHeight` cannot be used together in the same column.";
|
33161 | doOnce(function () { return console.warn(message_1); }, 'HeaderCellCtrl.spanHeaderHeightAndAutoHeaderHeight');
|
33162 | }
|
33163 | return;
|
33164 | }
|
33165 | if (newValue && !isMeasuring) {
|
33166 | startMeasuring();
|
33167 | }
|
33168 | if (!newValue && isMeasuring) {
|
33169 | stopMeasuring();
|
33170 | }
|
33171 | };
|
33172 | var startMeasuring = function () {
|
33173 | isMeasuring = true;
|
33174 | measureHeight(0);
|
33175 | _this.comp.addOrRemoveCssClass('ag-header-cell-auto-height', true);
|
33176 | stopResizeObserver = _this.resizeObserverService.observeResize(wrapperElement, function () { return measureHeight(0); });
|
33177 | };
|
33178 | var stopMeasuring = function () {
|
33179 | isMeasuring = false;
|
33180 | if (stopResizeObserver) {
|
33181 | stopResizeObserver();
|
33182 | }
|
33183 | _this.comp.addOrRemoveCssClass('ag-header-cell-auto-height', false);
|
33184 | stopResizeObserver = undefined;
|
33185 | };
|
33186 | checkMeasuring();
|
33187 | this.addDestroyFunc(function () { return stopMeasuring(); });
|
33188 |
|
33189 |
|
33190 |
|
33191 | this.addManagedListener(this.column, Column.EVENT_WIDTH_CHANGED, function () { return isMeasuring && measureHeight(0); });
|
33192 |
|
33193 | this.addManagedListener(this.eventService, Column.EVENT_SORT_CHANGED, function () {
|
33194 |
|
33195 | if (isMeasuring) {
|
33196 | _this.beans.frameworkOverrides.setTimeout(function () { return measureHeight(0); });
|
33197 | }
|
33198 | });
|
33199 | this.addRefreshFunction(checkMeasuring);
|
33200 | };
|
33201 | HeaderCellCtrl.prototype.refreshAriaSort = function () {
|
33202 | if (this.sortable) {
|
33203 | var translate = this.localeService.getLocaleTextFunc();
|
33204 | var sort = this.sortController.getDisplaySortForColumn(this.column) || null;
|
33205 | this.comp.setAriaSort(getAriaSortState(sort));
|
33206 | this.setAriaDescriptionProperty('sort', translate('ariaSortableColumn', 'Press ENTER to sort.'));
|
33207 | }
|
33208 | else {
|
33209 | this.comp.setAriaSort();
|
33210 | this.setAriaDescriptionProperty('sort', null);
|
33211 | }
|
33212 | };
|
33213 | HeaderCellCtrl.prototype.refreshAriaMenu = function () {
|
33214 | if (this.menuEnabled) {
|
33215 | var translate = this.localeService.getLocaleTextFunc();
|
33216 | this.setAriaDescriptionProperty('menu', translate('ariaMenuColumn', 'Press CTRL ENTER to open column menu.'));
|
33217 | }
|
33218 | else {
|
33219 | this.setAriaDescriptionProperty('menu', null);
|
33220 | }
|
33221 | };
|
33222 | HeaderCellCtrl.prototype.setAriaDescriptionProperty = function (property, value) {
|
33223 | if (value != null) {
|
33224 | this.ariaDescriptionProperties.set(property, value);
|
33225 | }
|
33226 | else {
|
33227 | this.ariaDescriptionProperties.delete(property);
|
33228 | }
|
33229 | };
|
33230 | HeaderCellCtrl.prototype.refreshAriaDescription = function () {
|
33231 | var descriptionArray = Array.from(this.ariaDescriptionProperties.values());
|
33232 | this.comp.setAriaDescription(descriptionArray.length ? descriptionArray.join(' ') : undefined);
|
33233 | };
|
33234 | HeaderCellCtrl.prototype.refreshAria = function () {
|
33235 | this.refreshAriaSort();
|
33236 | this.refreshAriaMenu();
|
33237 | this.refreshAriaDescription();
|
33238 | };
|
33239 | HeaderCellCtrl.prototype.addColumnHoverListener = function () {
|
33240 | var _this = this;
|
33241 | var listener = function () {
|
33242 | if (!_this.gridOptionsService.is('columnHoverHighlight')) {
|
33243 | return;
|
33244 | }
|
33245 | var isHovered = _this.columnHoverService.isHovered(_this.column);
|
33246 | _this.comp.addOrRemoveCssClass('ag-column-hover', isHovered);
|
33247 | };
|
33248 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, listener);
|
33249 | listener();
|
33250 | };
|
33251 | HeaderCellCtrl.prototype.setupFilterCss = function () {
|
33252 | var _this = this;
|
33253 | var listener = function () {
|
33254 | _this.comp.addOrRemoveCssClass('ag-header-cell-filtered', _this.column.isFilterActive());
|
33255 | };
|
33256 | this.addManagedListener(this.column, Column.EVENT_FILTER_ACTIVE_CHANGED, listener);
|
33257 | listener();
|
33258 | };
|
33259 | HeaderCellCtrl.prototype.setupColId = function () {
|
33260 | this.comp.setColId(this.column.getColId());
|
33261 | };
|
33262 | HeaderCellCtrl.prototype.addActiveHeaderMouseListeners = function () {
|
33263 | var _this = this;
|
33264 | var listener = function (e) { return _this.setActiveHeader(e.type === 'mouseenter'); };
|
33265 | this.addManagedListener(this.getGui(), 'mouseenter', listener);
|
33266 | this.addManagedListener(this.getGui(), 'mouseleave', listener);
|
33267 | };
|
33268 | HeaderCellCtrl.prototype.setActiveHeader = function (active) {
|
33269 | this.comp.addOrRemoveCssClass('ag-header-active', active);
|
33270 | };
|
33271 | __decorate$1k([
|
33272 | Autowired('columnModel')
|
33273 | ], HeaderCellCtrl.prototype, "columnModel", void 0);
|
33274 | __decorate$1k([
|
33275 | Autowired('columnHoverService')
|
33276 | ], HeaderCellCtrl.prototype, "columnHoverService", void 0);
|
33277 | __decorate$1k([
|
33278 | Autowired('sortController')
|
33279 | ], HeaderCellCtrl.prototype, "sortController", void 0);
|
33280 | __decorate$1k([
|
33281 | Autowired('menuFactory')
|
33282 | ], HeaderCellCtrl.prototype, "menuFactory", void 0);
|
33283 | __decorate$1k([
|
33284 | Autowired('dragAndDropService')
|
33285 | ], HeaderCellCtrl.prototype, "dragAndDropService", void 0);
|
33286 | __decorate$1k([
|
33287 | Autowired('resizeObserverService')
|
33288 | ], HeaderCellCtrl.prototype, "resizeObserverService", void 0);
|
33289 | __decorate$1k([
|
33290 | Autowired('gridApi')
|
33291 | ], HeaderCellCtrl.prototype, "gridApi", void 0);
|
33292 | __decorate$1k([
|
33293 | Autowired('columnApi')
|
33294 | ], HeaderCellCtrl.prototype, "columnApi", void 0);
|
33295 | __decorate$1k([
|
33296 | PreDestroy
|
33297 | ], HeaderCellCtrl.prototype, "removeDragSource", null);
|
33298 | return HeaderCellCtrl;
|
33299 | }(AbstractHeaderCellCtrl));
|
33300 |
|
33301 |
|
33302 |
|
33303 |
|
33304 |
|
33305 |
|
33306 |
|
33307 | var __extends$1m = (undefined && undefined.__extends) || (function () {
|
33308 | var extendStatics = function (d, b) {
|
33309 | extendStatics = Object.setPrototypeOf ||
|
33310 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
33311 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
33312 | return extendStatics(d, b);
|
33313 | };
|
33314 | return function (d, b) {
|
33315 | extendStatics(d, b);
|
33316 | function __() { this.constructor = d; }
|
33317 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
33318 | };
|
33319 | })();
|
33320 | var __decorate$1j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
33321 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
33322 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
33323 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
33324 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
33325 | };
|
33326 | var GroupResizeFeature = (function (_super) {
|
33327 | __extends$1m(GroupResizeFeature, _super);
|
33328 | function GroupResizeFeature(comp, eResize, pinned, columnGroup) {
|
33329 | var _this = _super.call(this) || this;
|
33330 | _this.eResize = eResize;
|
33331 | _this.comp = comp;
|
33332 | _this.pinned = pinned;
|
33333 | _this.columnGroup = columnGroup;
|
33334 | return _this;
|
33335 | }
|
33336 | GroupResizeFeature.prototype.postConstruct = function () {
|
33337 | var _this = this;
|
33338 | if (!this.columnGroup.isResizable()) {
|
33339 | this.comp.setResizableDisplayed(false);
|
33340 | return;
|
33341 | }
|
33342 | var finishedWithResizeFunc = this.horizontalResizeService.addResizeBar({
|
33343 | eResizeBar: this.eResize,
|
33344 | onResizeStart: this.onResizeStart.bind(this),
|
33345 | onResizing: this.onResizing.bind(this, false),
|
33346 | onResizeEnd: this.onResizing.bind(this, true)
|
33347 | });
|
33348 | this.addDestroyFunc(finishedWithResizeFunc);
|
33349 | if (!this.gridOptionsService.is('suppressAutoSize')) {
|
33350 | var skipHeaderOnAutoSize_1 = this.gridOptionsService.is('skipHeaderOnAutoSize');
|
33351 | this.eResize.addEventListener('dblclick', function () {
|
33352 |
|
33353 | var keys = [];
|
33354 | var leafCols = _this.columnGroup.getDisplayedLeafColumns();
|
33355 | leafCols.forEach(function (column) {
|
33356 |
|
33357 | if (!column.getColDef().suppressAutoSize) {
|
33358 | keys.push(column.getColId());
|
33359 | }
|
33360 | });
|
33361 | if (keys.length > 0) {
|
33362 | _this.columnModel.autoSizeColumns({
|
33363 | columns: keys,
|
33364 | skipHeader: skipHeaderOnAutoSize_1,
|
33365 | stopAtGroup: _this.columnGroup,
|
33366 | source: 'uiColumnResized'
|
33367 | });
|
33368 | }
|
33369 | _this.resizeLeafColumnsToFit();
|
33370 | });
|
33371 | }
|
33372 | };
|
33373 | GroupResizeFeature.prototype.onResizeStart = function (shiftKey) {
|
33374 | var _this = this;
|
33375 | this.calculateInitialValues();
|
33376 | var takeFromGroup = null;
|
33377 | if (shiftKey) {
|
33378 | takeFromGroup = this.columnModel.getDisplayedGroupAfter(this.columnGroup);
|
33379 | }
|
33380 | if (takeFromGroup) {
|
33381 | var takeFromLeafCols = takeFromGroup.getDisplayedLeafColumns();
|
33382 | this.resizeTakeFromCols = takeFromLeafCols.filter(function (col) { return col.isResizable(); });
|
33383 | this.resizeTakeFromStartWidth = 0;
|
33384 | this.resizeTakeFromCols.forEach(function (col) { return _this.resizeTakeFromStartWidth += col.getActualWidth(); });
|
33385 | this.resizeTakeFromRatios = [];
|
33386 | this.resizeTakeFromCols.forEach(function (col) { return _this.resizeTakeFromRatios.push(col.getActualWidth() / _this.resizeTakeFromStartWidth); });
|
33387 | }
|
33388 | else {
|
33389 | this.resizeTakeFromCols = null;
|
33390 | this.resizeTakeFromStartWidth = null;
|
33391 | this.resizeTakeFromRatios = null;
|
33392 | }
|
33393 | this.comp.addOrRemoveCssClass('ag-column-resizing', true);
|
33394 | };
|
33395 | GroupResizeFeature.prototype.onResizing = function (finished, resizeAmount) {
|
33396 | var resizeAmountNormalised = this.normaliseDragChange(resizeAmount);
|
33397 | var width = this.resizeStartWidth + resizeAmountNormalised;
|
33398 | this.resizeColumns(width, finished);
|
33399 | };
|
33400 | GroupResizeFeature.prototype.resizeLeafColumnsToFit = function () {
|
33401 | var preferredSize = this.autoWidthCalculator.getPreferredWidthForColumnGroup(this.columnGroup);
|
33402 | this.calculateInitialValues();
|
33403 | if (preferredSize > this.resizeStartWidth) {
|
33404 | this.resizeColumns(preferredSize, true);
|
33405 | }
|
33406 | };
|
33407 | GroupResizeFeature.prototype.resizeColumns = function (totalWidth, finished) {
|
33408 | if (finished === void 0) { finished = true; }
|
33409 | var resizeSets = [];
|
33410 | resizeSets.push({
|
33411 | columns: this.resizeCols,
|
33412 | ratios: this.resizeRatios,
|
33413 | width: totalWidth
|
33414 | });
|
33415 | if (this.resizeTakeFromCols) {
|
33416 | var diff = totalWidth - this.resizeStartWidth;
|
33417 | resizeSets.push({
|
33418 | columns: this.resizeTakeFromCols,
|
33419 | ratios: this.resizeTakeFromRatios,
|
33420 | width: this.resizeTakeFromStartWidth - diff
|
33421 | });
|
33422 | }
|
33423 | this.columnModel.resizeColumnSets({
|
33424 | resizeSets: resizeSets,
|
33425 | finished: finished,
|
33426 | source: 'uiColumnDragged'
|
33427 | });
|
33428 | if (finished) {
|
33429 | this.comp.addOrRemoveCssClass('ag-column-resizing', false);
|
33430 | }
|
33431 | };
|
33432 | GroupResizeFeature.prototype.calculateInitialValues = function () {
|
33433 | var _this = this;
|
33434 | var leafCols = this.columnGroup.getDisplayedLeafColumns();
|
33435 | this.resizeCols = leafCols.filter(function (col) { return col.isResizable(); });
|
33436 | this.resizeStartWidth = 0;
|
33437 | this.resizeCols.forEach(function (col) { return _this.resizeStartWidth += col.getActualWidth(); });
|
33438 | this.resizeRatios = [];
|
33439 | this.resizeCols.forEach(function (col) { return _this.resizeRatios.push(col.getActualWidth() / _this.resizeStartWidth); });
|
33440 | };
|
33441 |
|
33442 |
|
33443 | GroupResizeFeature.prototype.normaliseDragChange = function (dragChange) {
|
33444 | var result = dragChange;
|
33445 | if (this.gridOptionsService.is('enableRtl')) {
|
33446 |
|
33447 | if (this.pinned !== 'left') {
|
33448 | result *= -1;
|
33449 | }
|
33450 | }
|
33451 | else if (this.pinned === 'right') {
|
33452 |
|
33453 | result *= -1;
|
33454 | }
|
33455 | return result;
|
33456 | };
|
33457 | __decorate$1j([
|
33458 | Autowired('horizontalResizeService')
|
33459 | ], GroupResizeFeature.prototype, "horizontalResizeService", void 0);
|
33460 | __decorate$1j([
|
33461 | Autowired('autoWidthCalculator')
|
33462 | ], GroupResizeFeature.prototype, "autoWidthCalculator", void 0);
|
33463 | __decorate$1j([
|
33464 | Autowired('columnModel')
|
33465 | ], GroupResizeFeature.prototype, "columnModel", void 0);
|
33466 | __decorate$1j([
|
33467 | PostConstruct
|
33468 | ], GroupResizeFeature.prototype, "postConstruct", null);
|
33469 | return GroupResizeFeature;
|
33470 | }(BeanStub));
|
33471 |
|
33472 |
|
33473 |
|
33474 |
|
33475 |
|
33476 |
|
33477 |
|
33478 | var __extends$1l = (undefined && undefined.__extends) || (function () {
|
33479 | var extendStatics = function (d, b) {
|
33480 | extendStatics = Object.setPrototypeOf ||
|
33481 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
33482 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
33483 | return extendStatics(d, b);
|
33484 | };
|
33485 | return function (d, b) {
|
33486 | extendStatics(d, b);
|
33487 | function __() { this.constructor = d; }
|
33488 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
33489 | };
|
33490 | })();
|
33491 | var __decorate$1i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
33492 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
33493 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
33494 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
33495 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
33496 | };
|
33497 | var GroupWidthFeature = (function (_super) {
|
33498 | __extends$1l(GroupWidthFeature, _super);
|
33499 | function GroupWidthFeature(comp, columnGroup) {
|
33500 | var _this = _super.call(this) || this;
|
33501 |
|
33502 | _this.removeChildListenersFuncs = [];
|
33503 | _this.columnGroup = columnGroup;
|
33504 | _this.comp = comp;
|
33505 | return _this;
|
33506 | }
|
33507 | GroupWidthFeature.prototype.postConstruct = function () {
|
33508 |
|
33509 | this.addListenersToChildrenColumns();
|
33510 |
|
33511 | this.addManagedListener(this.columnGroup, ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED, this.onDisplayedChildrenChanged.bind(this));
|
33512 | this.onWidthChanged();
|
33513 |
|
33514 |
|
33515 |
|
33516 | this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this));
|
33517 | };
|
33518 | GroupWidthFeature.prototype.addListenersToChildrenColumns = function () {
|
33519 | var _this = this;
|
33520 |
|
33521 | this.removeListenersOnChildrenColumns();
|
33522 |
|
33523 | var widthChangedListener = this.onWidthChanged.bind(this);
|
33524 | this.columnGroup.getLeafColumns().forEach(function (column) {
|
33525 | column.addEventListener('widthChanged', widthChangedListener);
|
33526 | column.addEventListener('visibleChanged', widthChangedListener);
|
33527 | _this.removeChildListenersFuncs.push(function () {
|
33528 | column.removeEventListener('widthChanged', widthChangedListener);
|
33529 | column.removeEventListener('visibleChanged', widthChangedListener);
|
33530 | });
|
33531 | });
|
33532 | };
|
33533 | GroupWidthFeature.prototype.removeListenersOnChildrenColumns = function () {
|
33534 | this.removeChildListenersFuncs.forEach(function (func) { return func(); });
|
33535 | this.removeChildListenersFuncs = [];
|
33536 | };
|
33537 | GroupWidthFeature.prototype.onDisplayedChildrenChanged = function () {
|
33538 | this.addListenersToChildrenColumns();
|
33539 | this.onWidthChanged();
|
33540 | };
|
33541 | GroupWidthFeature.prototype.onWidthChanged = function () {
|
33542 | var columnWidth = this.columnGroup.getActualWidth();
|
33543 | this.comp.setWidth(columnWidth + "px");
|
33544 | this.comp.addOrRemoveCssClass('ag-hidden', columnWidth === 0);
|
33545 | };
|
33546 | __decorate$1i([
|
33547 | PostConstruct
|
33548 | ], GroupWidthFeature.prototype, "postConstruct", null);
|
33549 | return GroupWidthFeature;
|
33550 | }(BeanStub));
|
33551 |
|
33552 |
|
33553 |
|
33554 |
|
33555 |
|
33556 |
|
33557 |
|
33558 | var __extends$1k = (undefined && undefined.__extends) || (function () {
|
33559 | var extendStatics = function (d, b) {
|
33560 | extendStatics = Object.setPrototypeOf ||
|
33561 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
33562 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
33563 | return extendStatics(d, b);
|
33564 | };
|
33565 | return function (d, b) {
|
33566 | extendStatics(d, b);
|
33567 | function __() { this.constructor = d; }
|
33568 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
33569 | };
|
33570 | })();
|
33571 | var __decorate$1h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
33572 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
33573 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
33574 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
33575 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
33576 | };
|
33577 | var HeaderGroupCellCtrl = (function (_super) {
|
33578 | __extends$1k(HeaderGroupCellCtrl, _super);
|
33579 | function HeaderGroupCellCtrl(columnGroup, parentRowCtrl) {
|
33580 | var _this = _super.call(this, columnGroup, parentRowCtrl) || this;
|
33581 | _this.columnGroup = columnGroup;
|
33582 | return _this;
|
33583 | }
|
33584 | HeaderGroupCellCtrl.prototype.setComp = function (comp, eGui, eResize) {
|
33585 | _super.prototype.setGui.call(this, eGui);
|
33586 | this.comp = comp;
|
33587 | this.displayName = this.columnModel.getDisplayNameForColumnGroup(this.columnGroup, 'header');
|
33588 | this.addClasses();
|
33589 | this.addAttributes();
|
33590 | this.setupMovingCss();
|
33591 | this.setupExpandable();
|
33592 | this.setupTooltip();
|
33593 | this.setupUserComp();
|
33594 | var pinned = this.getParentRowCtrl().getPinned();
|
33595 | var leafCols = this.columnGroup.getProvidedColumnGroup().getLeafColumns();
|
33596 | this.createManagedBean(new HoverFeature(leafCols, eGui));
|
33597 | this.createManagedBean(new SetLeftFeature(this.columnGroup, eGui, this.beans));
|
33598 | this.createManagedBean(new GroupWidthFeature(comp, this.columnGroup));
|
33599 | this.groupResizeFeature = this.createManagedBean(new GroupResizeFeature(comp, eResize, pinned, this.columnGroup));
|
33600 | this.createManagedBean(new ManagedFocusFeature(eGui, {
|
33601 | shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this),
|
33602 | onTabKeyDown: function () { return undefined; },
|
33603 | handleKeyDown: this.handleKeyDown.bind(this),
|
33604 | onFocusIn: this.onFocusIn.bind(this)
|
33605 | }));
|
33606 | };
|
33607 | HeaderGroupCellCtrl.prototype.resizeLeafColumnsToFit = function () {
|
33608 | var _a, _b;
|
33609 |
|
33610 | (_a = this.groupResizeFeature) === null || _a === void 0 ? void 0 : _a.onResizeStart(false);
|
33611 | (_b = this.groupResizeFeature) === null || _b === void 0 ? void 0 : _b.resizeLeafColumnsToFit();
|
33612 | };
|
33613 | HeaderGroupCellCtrl.prototype.setupUserComp = function () {
|
33614 | var _this = this;
|
33615 | var displayName = this.displayName;
|
33616 | var params = {
|
33617 | displayName: this.displayName,
|
33618 | columnGroup: this.columnGroup,
|
33619 | setExpanded: function (expanded) {
|
33620 | _this.columnModel.setColumnGroupOpened(_this.columnGroup.getProvidedColumnGroup(), expanded, "gridInitializing");
|
33621 | },
|
33622 | api: this.gridApi,
|
33623 | columnApi: this.columnApi,
|
33624 | context: this.gridOptionsService.context
|
33625 | };
|
33626 | if (!displayName) {
|
33627 | var columnGroup = this.columnGroup;
|
33628 | var leafCols = columnGroup.getLeafColumns();
|
33629 |
|
33630 |
|
33631 |
|
33632 |
|
33633 |
|
33634 | while (columnGroup.getParent() && columnGroup.getParent().getLeafColumns().length === leafCols.length) {
|
33635 | columnGroup = columnGroup.getParent();
|
33636 | }
|
33637 | var colGroupDef = columnGroup.getColGroupDef();
|
33638 | if (colGroupDef) {
|
33639 | displayName = colGroupDef.headerName;
|
33640 | }
|
33641 | if (!displayName) {
|
33642 | displayName = leafCols ? this.columnModel.getDisplayNameForColumn(leafCols[0], 'header', true) : '';
|
33643 | }
|
33644 | }
|
33645 | var compDetails = this.userComponentFactory.getHeaderGroupCompDetails(params);
|
33646 | this.comp.setUserCompDetails(compDetails);
|
33647 | };
|
33648 | HeaderGroupCellCtrl.prototype.setupTooltip = function () {
|
33649 | var _this = this;
|
33650 | var colGroupDef = this.columnGroup.getColGroupDef();
|
33651 | var tooltipCtrl = {
|
33652 | getColumn: function () { return _this.columnGroup; },
|
33653 | getGui: function () { return _this.eGui; },
|
33654 | getLocation: function () { return 'headerGroup'; },
|
33655 | getTooltipValue: function () { return colGroupDef && colGroupDef.headerTooltip; }
|
33656 | };
|
33657 | if (colGroupDef) {
|
33658 | tooltipCtrl.getColDef = function () { return colGroupDef; };
|
33659 | }
|
33660 | var tooltipFeature = this.createManagedBean(new TooltipFeature(tooltipCtrl, this.beans));
|
33661 | tooltipFeature.setComp(this.comp);
|
33662 | };
|
33663 | HeaderGroupCellCtrl.prototype.setupExpandable = function () {
|
33664 | var providedColGroup = this.columnGroup.getProvidedColumnGroup();
|
33665 | this.refreshExpanded();
|
33666 | this.addManagedListener(providedColGroup, ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED, this.refreshExpanded.bind(this));
|
33667 | this.addManagedListener(providedColGroup, ProvidedColumnGroup.EVENT_EXPANDED_CHANGED, this.refreshExpanded.bind(this));
|
33668 | };
|
33669 | HeaderGroupCellCtrl.prototype.refreshExpanded = function () {
|
33670 | var column = this.columnGroup;
|
33671 | this.expandable = column.isExpandable();
|
33672 | var expanded = column.isExpanded();
|
33673 | if (this.expandable) {
|
33674 | this.comp.setAriaExpanded(expanded ? 'true' : 'false');
|
33675 | }
|
33676 | else {
|
33677 | this.comp.setAriaExpanded(undefined);
|
33678 | }
|
33679 | };
|
33680 | HeaderGroupCellCtrl.prototype.addAttributes = function () {
|
33681 | this.comp.setColId(this.columnGroup.getUniqueId());
|
33682 | };
|
33683 | HeaderGroupCellCtrl.prototype.addClasses = function () {
|
33684 | var _this = this;
|
33685 | var colGroupDef = this.columnGroup.getColGroupDef();
|
33686 | var classes = CssClassApplier.getHeaderClassesFromColDef(colGroupDef, this.gridOptionsService, null, this.columnGroup);
|
33687 |
|
33688 |
|
33689 | if (this.columnGroup.isPadding()) {
|
33690 | classes.push('ag-header-group-cell-no-group');
|
33691 | var leafCols = this.columnGroup.getLeafColumns();
|
33692 | if (leafCols.every(function (col) { return col.isSpanHeaderHeight(); })) {
|
33693 | classes.push('ag-header-span-height');
|
33694 | }
|
33695 | }
|
33696 | else {
|
33697 | classes.push('ag-header-group-cell-with-group');
|
33698 | }
|
33699 | classes.forEach(function (c) { return _this.comp.addOrRemoveCssClass(c, true); });
|
33700 | };
|
33701 | HeaderGroupCellCtrl.prototype.setupMovingCss = function () {
|
33702 | var _this = this;
|
33703 | var providedColumnGroup = this.columnGroup.getProvidedColumnGroup();
|
33704 | var leafColumns = providedColumnGroup.getLeafColumns();
|
33705 |
|
33706 |
|
33707 |
|
33708 | var listener = function () { return _this.comp.addOrRemoveCssClass('ag-header-cell-moving', _this.columnGroup.isMoving()); };
|
33709 | leafColumns.forEach(function (col) {
|
33710 | _this.addManagedListener(col, Column.EVENT_MOVING_CHANGED, listener);
|
33711 | });
|
33712 | listener();
|
33713 | };
|
33714 | HeaderGroupCellCtrl.prototype.onFocusIn = function (e) {
|
33715 | if (!this.eGui.contains(e.relatedTarget)) {
|
33716 | var rowIndex = this.getRowIndex();
|
33717 | this.beans.focusService.setFocusedHeader(rowIndex, this.columnGroup);
|
33718 | }
|
33719 | };
|
33720 | HeaderGroupCellCtrl.prototype.handleKeyDown = function (e) {
|
33721 | _super.prototype.handleKeyDown.call(this, e);
|
33722 | var wrapperHasFocus = this.getWrapperHasFocus();
|
33723 | if (!this.expandable || !wrapperHasFocus) {
|
33724 | return;
|
33725 | }
|
33726 | if (e.key === KeyCode.ENTER) {
|
33727 | var column = this.columnGroup;
|
33728 | var newExpandedValue = !column.isExpanded();
|
33729 | this.columnModel.setColumnGroupOpened(column.getProvidedColumnGroup(), newExpandedValue, "uiColumnExpanded");
|
33730 | }
|
33731 | };
|
33732 |
|
33733 |
|
33734 | HeaderGroupCellCtrl.prototype.setDragSource = function (eHeaderGroup) {
|
33735 | var _this = this;
|
33736 | if (this.isSuppressMoving()) {
|
33737 | return;
|
33738 | }
|
33739 | var allLeafColumns = this.columnGroup.getProvidedColumnGroup().getLeafColumns();
|
33740 | var hideColumnOnExit = !this.gridOptionsService.is('suppressDragLeaveHidesColumns');
|
33741 | var dragSource = {
|
33742 | type: DragSourceType.HeaderCell,
|
33743 | eElement: eHeaderGroup,
|
33744 | defaultIconName: hideColumnOnExit ? DragAndDropService.ICON_HIDE : DragAndDropService.ICON_NOT_ALLOWED,
|
33745 | dragItemName: this.displayName,
|
33746 |
|
33747 | getDragItem: this.getDragItemForGroup.bind(this),
|
33748 | onDragStarted: function () { return allLeafColumns.forEach(function (col) { return col.setMoving(true, "uiColumnDragged"); }); },
|
33749 | onDragStopped: function () { return allLeafColumns.forEach(function (col) { return col.setMoving(false, "uiColumnDragged"); }); },
|
33750 | onGridEnter: function (dragItem) {
|
33751 | var _a;
|
33752 | if (hideColumnOnExit) {
|
33753 | var unlockedColumns = ((_a = dragItem === null || dragItem === void 0 ? void 0 : dragItem.columns) === null || _a === void 0 ? void 0 : _a.filter(function (col) { return !col.getColDef().lockVisible; })) || [];
|
33754 | _this.columnModel.setColumnsVisible(unlockedColumns, true, "uiColumnMoved");
|
33755 | }
|
33756 | },
|
33757 | onGridExit: function (dragItem) {
|
33758 | var _a;
|
33759 | if (hideColumnOnExit) {
|
33760 | var unlockedColumns = ((_a = dragItem === null || dragItem === void 0 ? void 0 : dragItem.columns) === null || _a === void 0 ? void 0 : _a.filter(function (col) { return !col.getColDef().lockVisible; })) || [];
|
33761 | _this.columnModel.setColumnsVisible(unlockedColumns, false, "uiColumnMoved");
|
33762 | }
|
33763 | },
|
33764 | };
|
33765 | this.dragAndDropService.addDragSource(dragSource, true);
|
33766 | this.addDestroyFunc(function () { return _this.dragAndDropService.removeDragSource(dragSource); });
|
33767 | };
|
33768 |
|
33769 |
|
33770 | HeaderGroupCellCtrl.prototype.getDragItemForGroup = function () {
|
33771 | var allColumnsOriginalOrder = this.columnGroup.getProvidedColumnGroup().getLeafColumns();
|
33772 |
|
33773 | var visibleState = {};
|
33774 | allColumnsOriginalOrder.forEach(function (column) { return visibleState[column.getId()] = column.isVisible(); });
|
33775 | var allColumnsCurrentOrder = [];
|
33776 | this.columnModel.getAllDisplayedColumns().forEach(function (column) {
|
33777 | if (allColumnsOriginalOrder.indexOf(column) >= 0) {
|
33778 | allColumnsCurrentOrder.push(column);
|
33779 | removeFromArray(allColumnsOriginalOrder, column);
|
33780 | }
|
33781 | });
|
33782 |
|
33783 | allColumnsOriginalOrder.forEach(function (column) { return allColumnsCurrentOrder.push(column); });
|
33784 |
|
33785 | return {
|
33786 | columns: allColumnsCurrentOrder,
|
33787 | visibleState: visibleState
|
33788 | };
|
33789 | };
|
33790 | HeaderGroupCellCtrl.prototype.isSuppressMoving = function () {
|
33791 |
|
33792 | var childSuppressesMoving = false;
|
33793 | this.columnGroup.getLeafColumns().forEach(function (column) {
|
33794 | if (column.getColDef().suppressMovable || column.getColDef().lockPosition) {
|
33795 | childSuppressesMoving = true;
|
33796 | }
|
33797 | });
|
33798 | var result = childSuppressesMoving || this.gridOptionsService.is('suppressMovableColumns');
|
33799 | return result;
|
33800 | };
|
33801 | __decorate$1h([
|
33802 | Autowired('columnModel')
|
33803 | ], HeaderGroupCellCtrl.prototype, "columnModel", void 0);
|
33804 | __decorate$1h([
|
33805 | Autowired('dragAndDropService')
|
33806 | ], HeaderGroupCellCtrl.prototype, "dragAndDropService", void 0);
|
33807 | __decorate$1h([
|
33808 | Autowired('gridApi')
|
33809 | ], HeaderGroupCellCtrl.prototype, "gridApi", void 0);
|
33810 | __decorate$1h([
|
33811 | Autowired('columnApi')
|
33812 | ], HeaderGroupCellCtrl.prototype, "columnApi", void 0);
|
33813 | return HeaderGroupCellCtrl;
|
33814 | }(AbstractHeaderCellCtrl));
|
33815 |
|
33816 |
|
33817 |
|
33818 |
|
33819 |
|
33820 |
|
33821 |
|
33822 | var __extends$1j = (undefined && undefined.__extends) || (function () {
|
33823 | var extendStatics = function (d, b) {
|
33824 | extendStatics = Object.setPrototypeOf ||
|
33825 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
33826 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
33827 | return extendStatics(d, b);
|
33828 | };
|
33829 | return function (d, b) {
|
33830 | extendStatics(d, b);
|
33831 | function __() { this.constructor = d; }
|
33832 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
33833 | };
|
33834 | })();
|
33835 | var __decorate$1g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
33836 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
33837 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
33838 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
33839 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
33840 | };
|
33841 | var instanceIdSequence = 0;
|
33842 | var HeaderRowCtrl = (function (_super) {
|
33843 | __extends$1j(HeaderRowCtrl, _super);
|
33844 | function HeaderRowCtrl(rowIndex, pinned, type) {
|
33845 | var _this = _super.call(this) || this;
|
33846 | _this.instanceId = instanceIdSequence++;
|
33847 | _this.headerCellCtrls = {};
|
33848 | _this.rowIndex = rowIndex;
|
33849 | _this.pinned = pinned;
|
33850 | _this.type = type;
|
33851 | return _this;
|
33852 | }
|
33853 | HeaderRowCtrl.prototype.getInstanceId = function () {
|
33854 | return this.instanceId;
|
33855 | };
|
33856 | HeaderRowCtrl.prototype.setComp = function (comp) {
|
33857 | this.comp = comp;
|
33858 | this.onRowHeightChanged();
|
33859 | this.onVirtualColumnsChanged();
|
33860 | this.setWidth();
|
33861 | this.addEventListeners();
|
33862 | if (isBrowserSafari()) {
|
33863 |
|
33864 |
|
33865 | this.comp.setTransform('translateZ(0)');
|
33866 | }
|
33867 | comp.setAriaRowIndex(this.rowIndex + 1);
|
33868 | };
|
33869 | HeaderRowCtrl.prototype.addEventListeners = function () {
|
33870 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_RESIZED, this.onColumnResized.bind(this));
|
33871 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
|
33872 | this.addManagedListener(this.eventService, Events.EVENT_VIRTUAL_COLUMNS_CHANGED, this.onVirtualColumnsChanged.bind(this));
|
33873 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HEADER_HEIGHT_CHANGED, this.onRowHeightChanged.bind(this));
|
33874 | this.addManagedListener(this.eventService, Events.EVENT_GRID_STYLES_CHANGED, this.onRowHeightChanged.bind(this));
|
33875 |
|
33876 | this.addManagedPropertyListener('domLayout', this.onDisplayedColumnsChanged.bind(this));
|
33877 | this.addManagedPropertyListener('headerHeight', this.onRowHeightChanged.bind(this));
|
33878 | this.addManagedPropertyListener('pivotHeaderHeight', this.onRowHeightChanged.bind(this));
|
33879 | this.addManagedPropertyListener('groupHeaderHeight', this.onRowHeightChanged.bind(this));
|
33880 | this.addManagedPropertyListener('pivotGroupHeaderHeight', this.onRowHeightChanged.bind(this));
|
33881 | this.addManagedPropertyListener('floatingFiltersHeight', this.onRowHeightChanged.bind(this));
|
33882 | };
|
33883 | HeaderRowCtrl.prototype.getHeaderCellCtrl = function (column) {
|
33884 | return values(this.headerCellCtrls).find(function (cellCtrl) { return cellCtrl.getColumnGroupChild() === column; });
|
33885 | };
|
33886 | HeaderRowCtrl.prototype.onDisplayedColumnsChanged = function () {
|
33887 | this.onVirtualColumnsChanged();
|
33888 | this.setWidth();
|
33889 | this.onRowHeightChanged();
|
33890 | };
|
33891 | HeaderRowCtrl.prototype.getType = function () {
|
33892 | return this.type;
|
33893 | };
|
33894 | HeaderRowCtrl.prototype.onColumnResized = function () {
|
33895 | this.setWidth();
|
33896 | };
|
33897 | HeaderRowCtrl.prototype.setWidth = function () {
|
33898 | var width = this.getWidthForRow();
|
33899 | this.comp.setWidth(width + "px");
|
33900 | };
|
33901 | HeaderRowCtrl.prototype.getWidthForRow = function () {
|
33902 | var printLayout = this.gridOptionsService.isDomLayout('print');
|
33903 | if (printLayout) {
|
33904 | var pinned = this.pinned != null;
|
33905 | if (pinned) {
|
33906 | return 0;
|
33907 | }
|
33908 | return this.columnModel.getContainerWidth('right')
|
33909 | + this.columnModel.getContainerWidth('left')
|
33910 | + this.columnModel.getContainerWidth(null);
|
33911 | }
|
33912 |
|
33913 | return this.columnModel.getContainerWidth(this.pinned);
|
33914 | };
|
33915 | HeaderRowCtrl.prototype.onRowHeightChanged = function () {
|
33916 | var headerRowCount = this.columnModel.getHeaderRowCount();
|
33917 | var sizes = [];
|
33918 | var numberOfFloating = 0;
|
33919 | if (this.columnModel.hasFloatingFilters()) {
|
33920 | headerRowCount++;
|
33921 | numberOfFloating = 1;
|
33922 | }
|
33923 | var groupHeight = this.columnModel.getColumnGroupHeaderRowHeight();
|
33924 | var headerHeight = this.columnModel.getColumnHeaderRowHeight();
|
33925 | var numberOfNonGroups = 1 + numberOfFloating;
|
33926 | var numberOfGroups = headerRowCount - numberOfNonGroups;
|
33927 | for (var i = 0; i < numberOfGroups; i++) {
|
33928 | sizes.push(groupHeight);
|
33929 | }
|
33930 | sizes.push(headerHeight);
|
33931 | for (var i = 0; i < numberOfFloating; i++) {
|
33932 | sizes.push(this.columnModel.getFloatingFiltersHeight());
|
33933 | }
|
33934 | var topOffset = 0;
|
33935 | for (var i = 0; i < this.rowIndex; i++) {
|
33936 | topOffset += sizes[i];
|
33937 | }
|
33938 | var thisRowHeight = sizes[this.rowIndex] + 'px';
|
33939 | this.comp.setTop(topOffset + 'px');
|
33940 | this.comp.setHeight(thisRowHeight);
|
33941 | };
|
33942 | HeaderRowCtrl.prototype.getPinned = function () {
|
33943 | return this.pinned;
|
33944 | };
|
33945 | HeaderRowCtrl.prototype.getRowIndex = function () {
|
33946 | return this.rowIndex;
|
33947 | };
|
33948 | HeaderRowCtrl.prototype.onVirtualColumnsChanged = function () {
|
33949 | var _this = this;
|
33950 | var oldCtrls = this.headerCellCtrls;
|
33951 | this.headerCellCtrls = {};
|
33952 | var columns = this.getColumnsInViewport();
|
33953 | columns.forEach(function (child) {
|
33954 |
|
33955 |
|
33956 |
|
33957 |
|
33958 | if (child.isEmptyGroup()) {
|
33959 | return;
|
33960 | }
|
33961 | var idOfChild = child.getUniqueId();
|
33962 |
|
33963 | var headerCtrl = oldCtrls[idOfChild];
|
33964 | delete oldCtrls[idOfChild];
|
33965 |
|
33966 |
|
33967 |
|
33968 |
|
33969 | var forOldColumn = headerCtrl && headerCtrl.getColumnGroupChild() != child;
|
33970 | if (forOldColumn) {
|
33971 | _this.destroyBean(headerCtrl);
|
33972 | headerCtrl = undefined;
|
33973 | }
|
33974 | if (headerCtrl == null) {
|
33975 | switch (_this.type) {
|
33976 | case HeaderRowType.FLOATING_FILTER:
|
33977 | headerCtrl = _this.createBean(new HeaderFilterCellCtrl(child, _this));
|
33978 | break;
|
33979 | case HeaderRowType.COLUMN_GROUP:
|
33980 | headerCtrl = _this.createBean(new HeaderGroupCellCtrl(child, _this));
|
33981 | break;
|
33982 | default:
|
33983 | headerCtrl = _this.createBean(new HeaderCellCtrl(child, _this));
|
33984 | break;
|
33985 | }
|
33986 | }
|
33987 | _this.headerCellCtrls[idOfChild] = headerCtrl;
|
33988 | });
|
33989 |
|
33990 | var isFocusedAndDisplayed = function (ctrl) {
|
33991 | var isFocused = _this.focusService.isHeaderWrapperFocused(ctrl);
|
33992 | if (!isFocused) {
|
33993 | return false;
|
33994 | }
|
33995 | var isDisplayed = _this.columnModel.isDisplayed(ctrl.getColumnGroupChild());
|
33996 | return isDisplayed;
|
33997 | };
|
33998 | iterateObject(oldCtrls, function (id, oldCtrl) {
|
33999 | var keepCtrl = isFocusedAndDisplayed(oldCtrl);
|
34000 | if (keepCtrl) {
|
34001 | _this.headerCellCtrls[id] = oldCtrl;
|
34002 | }
|
34003 | else {
|
34004 | _this.destroyBean(oldCtrl);
|
34005 | }
|
34006 | });
|
34007 | var ctrlsToDisplay = getAllValuesInObject(this.headerCellCtrls);
|
34008 | this.comp.setHeaderCtrls(ctrlsToDisplay);
|
34009 | };
|
34010 | HeaderRowCtrl.prototype.getColumnsInViewport = function () {
|
34011 | var printLayout = this.gridOptionsService.isDomLayout('print');
|
34012 | return printLayout ? this.getColumnsInViewportPrintLayout() : this.getColumnsInViewportNormalLayout();
|
34013 | };
|
34014 | HeaderRowCtrl.prototype.getColumnsInViewportPrintLayout = function () {
|
34015 | var _this = this;
|
34016 |
|
34017 | if (this.pinned != null) {
|
34018 | return [];
|
34019 | }
|
34020 | var viewportColumns = [];
|
34021 | var actualDepth = this.getActualDepth();
|
34022 | ['left', null, 'right'].forEach(function (pinned) {
|
34023 | var items = _this.columnModel.getVirtualHeaderGroupRow(pinned, actualDepth);
|
34024 | viewportColumns = viewportColumns.concat(items);
|
34025 | });
|
34026 | return viewportColumns;
|
34027 | };
|
34028 | HeaderRowCtrl.prototype.getActualDepth = function () {
|
34029 | return this.type == HeaderRowType.FLOATING_FILTER ? this.rowIndex - 1 : this.rowIndex;
|
34030 | };
|
34031 | HeaderRowCtrl.prototype.getColumnsInViewportNormalLayout = function () {
|
34032 |
|
34033 | return this.columnModel.getVirtualHeaderGroupRow(this.pinned, this.getActualDepth());
|
34034 | };
|
34035 | HeaderRowCtrl.prototype.focusHeader = function (column, event) {
|
34036 | var allCtrls = getAllValuesInObject(this.headerCellCtrls);
|
34037 | var ctrl = allCtrls.find(function (ctrl) { return ctrl.getColumnGroupChild() == column; });
|
34038 | if (!ctrl) {
|
34039 | return false;
|
34040 | }
|
34041 | ctrl.focus(event);
|
34042 | return true;
|
34043 | };
|
34044 | HeaderRowCtrl.prototype.destroy = function () {
|
34045 | var _this = this;
|
34046 | iterateObject(this.headerCellCtrls, function (key, ctrl) {
|
34047 | _this.destroyBean(ctrl);
|
34048 | });
|
34049 | this.headerCellCtrls = {};
|
34050 | _super.prototype.destroy.call(this);
|
34051 | };
|
34052 | __decorate$1g([
|
34053 | Autowired('columnModel')
|
34054 | ], HeaderRowCtrl.prototype, "columnModel", void 0);
|
34055 | __decorate$1g([
|
34056 | Autowired('focusService')
|
34057 | ], HeaderRowCtrl.prototype, "focusService", void 0);
|
34058 | return HeaderRowCtrl;
|
34059 | }(BeanStub));
|
34060 |
|
34061 |
|
34062 |
|
34063 |
|
34064 |
|
34065 |
|
34066 |
|
34067 | var __extends$1i = (undefined && undefined.__extends) || (function () {
|
34068 | var extendStatics = function (d, b) {
|
34069 | extendStatics = Object.setPrototypeOf ||
|
34070 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34071 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
34072 | return extendStatics(d, b);
|
34073 | };
|
34074 | return function (d, b) {
|
34075 | extendStatics(d, b);
|
34076 | function __() { this.constructor = d; }
|
34077 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34078 | };
|
34079 | })();
|
34080 | var __decorate$1f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34081 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34082 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34083 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34084 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34085 | };
|
34086 | var __read$f = (undefined && undefined.__read) || function (o, n) {
|
34087 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
34088 | if (!m) return o;
|
34089 | var i = m.call(o), r, ar = [], e;
|
34090 | try {
|
34091 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
34092 | }
|
34093 | catch (error) { e = { error: error }; }
|
34094 | finally {
|
34095 | try {
|
34096 | if (r && !r.done && (m = i["return"])) m.call(i);
|
34097 | }
|
34098 | finally { if (e) throw e.error; }
|
34099 | }
|
34100 | return ar;
|
34101 | };
|
34102 | var __spread$d = (undefined && undefined.__spread) || function () {
|
34103 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$f(arguments[i]));
|
34104 | return ar;
|
34105 | };
|
34106 | var HeaderRowContainerCtrl = (function (_super) {
|
34107 | __extends$1i(HeaderRowContainerCtrl, _super);
|
34108 | function HeaderRowContainerCtrl(pinned) {
|
34109 | var _this = _super.call(this) || this;
|
34110 | _this.hidden = false;
|
34111 | _this.groupsRowCtrls = [];
|
34112 | _this.pinned = pinned;
|
34113 | return _this;
|
34114 | }
|
34115 | HeaderRowContainerCtrl.prototype.setComp = function (comp, eGui) {
|
34116 | this.comp = comp;
|
34117 | this.eViewport = eGui;
|
34118 | this.setupCenterWidth();
|
34119 | this.setupPinnedWidth();
|
34120 | this.setupDragAndDrop(this.eViewport);
|
34121 | this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.onGridColumnsChanged.bind(this));
|
34122 | this.addManagedListener(this.eViewport, 'scroll', this.resetScrollLeft.bind(this));
|
34123 | this.ctrlsService.registerHeaderContainer(this, this.pinned);
|
34124 | if (this.columnModel.isReady()) {
|
34125 | this.refresh();
|
34126 | }
|
34127 | };
|
34128 | HeaderRowContainerCtrl.prototype.setupDragAndDrop = function (dropContainer) {
|
34129 | var bodyDropTarget = new BodyDropTarget(this.pinned, dropContainer);
|
34130 | this.createManagedBean(bodyDropTarget);
|
34131 | };
|
34132 | HeaderRowContainerCtrl.prototype.refresh = function (keepColumns) {
|
34133 | var _this = this;
|
34134 | if (keepColumns === void 0) { keepColumns = false; }
|
34135 | var sequence = new NumberSequence();
|
34136 | var focusedHeaderPosition = this.focusService.getFocusHeaderToUseAfterRefresh();
|
34137 | var refreshColumnGroups = function () {
|
34138 | var groupRowCount = _this.columnModel.getHeaderRowCount() - 1;
|
34139 | _this.groupsRowCtrls = _this.destroyBeans(_this.groupsRowCtrls);
|
34140 | for (var i = 0; i < groupRowCount; i++) {
|
34141 | var ctrl = _this.createBean(new HeaderRowCtrl(sequence.next(), _this.pinned, HeaderRowType.COLUMN_GROUP));
|
34142 | _this.groupsRowCtrls.push(ctrl);
|
34143 | }
|
34144 | };
|
34145 | var refreshColumns = function () {
|
34146 | var rowIndex = sequence.next();
|
34147 | var needNewInstance = !_this.hidden && (_this.columnsRowCtrl == null || !keepColumns || _this.columnsRowCtrl.getRowIndex() !== rowIndex);
|
34148 | var shouldDestroyInstance = needNewInstance || _this.hidden;
|
34149 | if (shouldDestroyInstance) {
|
34150 | _this.columnsRowCtrl = _this.destroyBean(_this.columnsRowCtrl);
|
34151 | }
|
34152 | if (needNewInstance) {
|
34153 | _this.columnsRowCtrl = _this.createBean(new HeaderRowCtrl(rowIndex, _this.pinned, HeaderRowType.COLUMN));
|
34154 | }
|
34155 | };
|
34156 | var refreshFilters = function () {
|
34157 | var includeFloatingFilter = _this.columnModel.hasFloatingFilters() && !_this.hidden;
|
34158 | var destroyPreviousComp = function () {
|
34159 | _this.filtersRowCtrl = _this.destroyBean(_this.filtersRowCtrl);
|
34160 | };
|
34161 | if (!includeFloatingFilter) {
|
34162 | destroyPreviousComp();
|
34163 | return;
|
34164 | }
|
34165 | var rowIndex = sequence.next();
|
34166 | if (_this.filtersRowCtrl) {
|
34167 | var rowIndexMismatch = _this.filtersRowCtrl.getRowIndex() !== rowIndex;
|
34168 | if (!keepColumns || rowIndexMismatch) {
|
34169 | destroyPreviousComp();
|
34170 | }
|
34171 | }
|
34172 | if (!_this.filtersRowCtrl) {
|
34173 | _this.filtersRowCtrl = _this.createBean(new HeaderRowCtrl(rowIndex, _this.pinned, HeaderRowType.FLOATING_FILTER));
|
34174 | }
|
34175 | };
|
34176 | refreshColumnGroups();
|
34177 | refreshColumns();
|
34178 | refreshFilters();
|
34179 | var allCtrls = this.getAllCtrls();
|
34180 | this.comp.setCtrls(allCtrls);
|
34181 | this.restoreFocusOnHeader(focusedHeaderPosition);
|
34182 | };
|
34183 | HeaderRowContainerCtrl.prototype.restoreFocusOnHeader = function (position) {
|
34184 | if (position == null || position.column.getPinned() != this.pinned) {
|
34185 | return;
|
34186 | }
|
34187 | this.focusService.focusHeaderPosition({ headerPosition: position });
|
34188 | };
|
34189 | HeaderRowContainerCtrl.prototype.getAllCtrls = function () {
|
34190 | var res = __spread$d(this.groupsRowCtrls);
|
34191 | if (this.columnsRowCtrl) {
|
34192 | res.push(this.columnsRowCtrl);
|
34193 | }
|
34194 | if (this.filtersRowCtrl) {
|
34195 | res.push(this.filtersRowCtrl);
|
34196 | }
|
34197 | return res;
|
34198 | };
|
34199 |
|
34200 |
|
34201 | HeaderRowContainerCtrl.prototype.onGridColumnsChanged = function () {
|
34202 | this.refresh(true);
|
34203 | };
|
34204 | HeaderRowContainerCtrl.prototype.setupCenterWidth = function () {
|
34205 | var _this = this;
|
34206 | if (this.pinned != null) {
|
34207 | return;
|
34208 | }
|
34209 | this.createManagedBean(new CenterWidthFeature(function (width) { return _this.comp.setCenterWidth(width + "px"); }));
|
34210 | };
|
34211 | HeaderRowContainerCtrl.prototype.setHorizontalScroll = function (offset) {
|
34212 | this.comp.setContainerTransform("translateX(" + offset + "px)");
|
34213 | };
|
34214 | HeaderRowContainerCtrl.prototype.resetScrollLeft = function () {
|
34215 | this.eViewport.scrollLeft = 0;
|
34216 | };
|
34217 | HeaderRowContainerCtrl.prototype.setupPinnedWidth = function () {
|
34218 | var _this = this;
|
34219 | if (this.pinned == null) {
|
34220 | return;
|
34221 | }
|
34222 | var pinningLeft = this.pinned === 'left';
|
34223 | var pinningRight = this.pinned === 'right';
|
34224 | this.hidden = true;
|
34225 | var listener = function () {
|
34226 | var width = pinningLeft ? _this.pinnedWidthService.getPinnedLeftWidth() : _this.pinnedWidthService.getPinnedRightWidth();
|
34227 | if (width == null) {
|
34228 | return;
|
34229 | }
|
34230 | var hidden = (width == 0);
|
34231 | var hiddenChanged = _this.hidden !== hidden;
|
34232 | var isRtl = _this.gridOptionsService.is('enableRtl');
|
34233 | var scrollbarWidth = _this.gridOptionsService.getScrollbarWidth();
|
34234 |
|
34235 |
|
34236 |
|
34237 | var addPaddingForScrollbar = _this.scrollVisibleService.isVerticalScrollShowing() && ((isRtl && pinningLeft) || (!isRtl && pinningRight));
|
34238 | var widthWithPadding = addPaddingForScrollbar ? width + scrollbarWidth : width;
|
34239 | _this.comp.setPinnedContainerWidth(widthWithPadding + "px");
|
34240 | _this.comp.setDisplayed(!hidden);
|
34241 | if (hiddenChanged) {
|
34242 | _this.hidden = hidden;
|
34243 | _this.refresh();
|
34244 | }
|
34245 | };
|
34246 | this.addManagedListener(this.eventService, Events.EVENT_LEFT_PINNED_WIDTH_CHANGED, listener);
|
34247 | this.addManagedListener(this.eventService, Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED, listener);
|
34248 | this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, listener);
|
34249 | this.addManagedListener(this.eventService, Events.EVENT_SCROLLBAR_WIDTH_CHANGED, listener);
|
34250 | };
|
34251 | HeaderRowContainerCtrl.prototype.getHeaderCtrlForColumn = function (column) {
|
34252 | if (column instanceof Column) {
|
34253 | if (!this.columnsRowCtrl) {
|
34254 | return;
|
34255 | }
|
34256 | return this.columnsRowCtrl.getHeaderCellCtrl(column);
|
34257 | }
|
34258 | if (this.groupsRowCtrls.length === 0) {
|
34259 | return;
|
34260 | }
|
34261 | for (var i = 0; i < this.groupsRowCtrls.length; i++) {
|
34262 | var ctrl = this.groupsRowCtrls[i].getHeaderCellCtrl(column);
|
34263 | if (ctrl) {
|
34264 | return ctrl;
|
34265 | }
|
34266 | }
|
34267 | };
|
34268 | HeaderRowContainerCtrl.prototype.getHtmlElementForColumnHeader = function (column) {
|
34269 |
|
34270 | var cellCtrl = this.getHeaderCtrlForColumn(column);
|
34271 | if (!cellCtrl) {
|
34272 | return null;
|
34273 | }
|
34274 | return cellCtrl.getGui();
|
34275 | };
|
34276 | HeaderRowContainerCtrl.prototype.getRowType = function (rowIndex) {
|
34277 | var allCtrls = this.getAllCtrls();
|
34278 | var ctrl = allCtrls[rowIndex];
|
34279 | return ctrl ? ctrl.getType() : undefined;
|
34280 | };
|
34281 | HeaderRowContainerCtrl.prototype.focusHeader = function (rowIndex, column, event) {
|
34282 | var allCtrls = this.getAllCtrls();
|
34283 | var ctrl = allCtrls[rowIndex];
|
34284 | if (!ctrl) {
|
34285 | return false;
|
34286 | }
|
34287 | return ctrl.focusHeader(column, event);
|
34288 | };
|
34289 | HeaderRowContainerCtrl.prototype.getRowCount = function () {
|
34290 | return this.getAllCtrls().length;
|
34291 | };
|
34292 | HeaderRowContainerCtrl.prototype.destroy = function () {
|
34293 | if (this.filtersRowCtrl) {
|
34294 | this.filtersRowCtrl = this.destroyBean(this.filtersRowCtrl);
|
34295 | }
|
34296 | if (this.columnsRowCtrl) {
|
34297 | this.columnsRowCtrl = this.destroyBean(this.columnsRowCtrl);
|
34298 | }
|
34299 | if (this.groupsRowCtrls && this.groupsRowCtrls.length) {
|
34300 | this.groupsRowCtrls = this.destroyBeans(this.groupsRowCtrls);
|
34301 | }
|
34302 | _super.prototype.destroy.call(this);
|
34303 | };
|
34304 | __decorate$1f([
|
34305 | Autowired('ctrlsService')
|
34306 | ], HeaderRowContainerCtrl.prototype, "ctrlsService", void 0);
|
34307 | __decorate$1f([
|
34308 | Autowired('scrollVisibleService')
|
34309 | ], HeaderRowContainerCtrl.prototype, "scrollVisibleService", void 0);
|
34310 | __decorate$1f([
|
34311 | Autowired('pinnedWidthService')
|
34312 | ], HeaderRowContainerCtrl.prototype, "pinnedWidthService", void 0);
|
34313 | __decorate$1f([
|
34314 | Autowired('columnModel')
|
34315 | ], HeaderRowContainerCtrl.prototype, "columnModel", void 0);
|
34316 | __decorate$1f([
|
34317 | Autowired('focusService')
|
34318 | ], HeaderRowContainerCtrl.prototype, "focusService", void 0);
|
34319 | return HeaderRowContainerCtrl;
|
34320 | }(BeanStub));
|
34321 |
|
34322 |
|
34323 |
|
34324 |
|
34325 |
|
34326 |
|
34327 |
|
34328 | var __extends$1h = (undefined && undefined.__extends) || (function () {
|
34329 | var extendStatics = function (d, b) {
|
34330 | extendStatics = Object.setPrototypeOf ||
|
34331 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34332 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
34333 | return extendStatics(d, b);
|
34334 | };
|
34335 | return function (d, b) {
|
34336 | extendStatics(d, b);
|
34337 | function __() { this.constructor = d; }
|
34338 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34339 | };
|
34340 | })();
|
34341 | var __decorate$1e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34342 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34343 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34344 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34345 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34346 | };
|
34347 | var HeaderRowContainerComp = (function (_super) {
|
34348 | __extends$1h(HeaderRowContainerComp, _super);
|
34349 | function HeaderRowContainerComp(pinned) {
|
34350 | var _this = _super.call(this) || this;
|
34351 | _this.headerRowComps = {};
|
34352 | _this.rowCompsList = [];
|
34353 | _this.pinned = pinned;
|
34354 | return _this;
|
34355 | }
|
34356 | HeaderRowContainerComp.prototype.init = function () {
|
34357 | var _this = this;
|
34358 | this.selectAndSetTemplate();
|
34359 | var compProxy = {
|
34360 | setDisplayed: function (displayed) { return _this.setDisplayed(displayed); },
|
34361 | setCtrls: function (ctrls) { return _this.setCtrls(ctrls); },
|
34362 |
|
34363 | setCenterWidth: function (width) { return _this.eCenterContainer.style.width = width; },
|
34364 | setContainerTransform: function (transform) { return _this.eCenterContainer.style.transform = transform; },
|
34365 |
|
34366 | setPinnedContainerWidth: function (width) {
|
34367 | var eGui = _this.getGui();
|
34368 | eGui.style.width = width;
|
34369 | eGui.style.maxWidth = width;
|
34370 | eGui.style.minWidth = width;
|
34371 | }
|
34372 | };
|
34373 | var ctrl = this.createManagedBean(new HeaderRowContainerCtrl(this.pinned));
|
34374 | ctrl.setComp(compProxy, this.getGui());
|
34375 | };
|
34376 | HeaderRowContainerComp.prototype.selectAndSetTemplate = function () {
|
34377 | var pinnedLeft = this.pinned == 'left';
|
34378 | var pinnedRight = this.pinned == 'right';
|
34379 | var template = pinnedLeft ? HeaderRowContainerComp.PINNED_LEFT_TEMPLATE :
|
34380 | pinnedRight ? HeaderRowContainerComp.PINNED_RIGHT_TEMPLATE : HeaderRowContainerComp.CENTER_TEMPLATE;
|
34381 | this.setTemplate(template);
|
34382 |
|
34383 |
|
34384 | this.eRowContainer = this.eCenterContainer ? this.eCenterContainer : this.getGui();
|
34385 | };
|
34386 | HeaderRowContainerComp.prototype.destroyRowComps = function () {
|
34387 | this.setCtrls([]);
|
34388 | };
|
34389 | HeaderRowContainerComp.prototype.destroyRowComp = function (rowComp) {
|
34390 | this.destroyBean(rowComp);
|
34391 | this.eRowContainer.removeChild(rowComp.getGui());
|
34392 | };
|
34393 | HeaderRowContainerComp.prototype.setCtrls = function (ctrls) {
|
34394 | var _this = this;
|
34395 | var oldRowComps = this.headerRowComps;
|
34396 | this.headerRowComps = {};
|
34397 | this.rowCompsList = [];
|
34398 | var prevGui;
|
34399 | var appendEnsuringDomOrder = function (rowComp) {
|
34400 | var eGui = rowComp.getGui();
|
34401 | var notAlreadyIn = eGui.parentElement != _this.eRowContainer;
|
34402 | if (notAlreadyIn) {
|
34403 | _this.eRowContainer.appendChild(eGui);
|
34404 | }
|
34405 | if (prevGui) {
|
34406 | ensureDomOrder(_this.eRowContainer, eGui, prevGui);
|
34407 | }
|
34408 | prevGui = eGui;
|
34409 | };
|
34410 | ctrls.forEach(function (ctrl) {
|
34411 | var ctrlId = ctrl.getInstanceId();
|
34412 | var existingComp = oldRowComps[ctrlId];
|
34413 | delete oldRowComps[ctrlId];
|
34414 | var rowComp = existingComp ? existingComp : _this.createBean(new HeaderRowComp(ctrl));
|
34415 | _this.headerRowComps[ctrlId] = rowComp;
|
34416 | _this.rowCompsList.push(rowComp);
|
34417 | appendEnsuringDomOrder(rowComp);
|
34418 | });
|
34419 | getAllValuesInObject(oldRowComps).forEach(function (c) { return _this.destroyRowComp(c); });
|
34420 | };
|
34421 | HeaderRowContainerComp.PINNED_LEFT_TEMPLATE = "<div class=\"ag-pinned-left-header\" role=\"presentation\"></div>";
|
34422 | HeaderRowContainerComp.PINNED_RIGHT_TEMPLATE = "<div class=\"ag-pinned-right-header\" role=\"presentation\"></div>";
|
34423 | HeaderRowContainerComp.CENTER_TEMPLATE = "<div class=\"ag-header-viewport\" role=\"presentation\">\n <div class=\"ag-header-container\" ref=\"eCenterContainer\" role=\"rowgroup\"></div>\n </div>";
|
34424 | __decorate$1e([
|
34425 | RefSelector('eCenterContainer')
|
34426 | ], HeaderRowContainerComp.prototype, "eCenterContainer", void 0);
|
34427 | __decorate$1e([
|
34428 | PostConstruct
|
34429 | ], HeaderRowContainerComp.prototype, "init", null);
|
34430 | __decorate$1e([
|
34431 | PreDestroy
|
34432 | ], HeaderRowContainerComp.prototype, "destroyRowComps", null);
|
34433 | return HeaderRowContainerComp;
|
34434 | }(Component));
|
34435 |
|
34436 |
|
34437 |
|
34438 |
|
34439 |
|
34440 |
|
34441 |
|
34442 | var __extends$1g = (undefined && undefined.__extends) || (function () {
|
34443 | var extendStatics = function (d, b) {
|
34444 | extendStatics = Object.setPrototypeOf ||
|
34445 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34446 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
34447 | return extendStatics(d, b);
|
34448 | };
|
34449 | return function (d, b) {
|
34450 | extendStatics(d, b);
|
34451 | function __() { this.constructor = d; }
|
34452 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34453 | };
|
34454 | })();
|
34455 | var __decorate$1d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34456 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34457 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34458 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34459 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34460 | };
|
34461 | var HeaderNavigationDirection;
|
34462 | (function (HeaderNavigationDirection) {
|
34463 | HeaderNavigationDirection[HeaderNavigationDirection["UP"] = 0] = "UP";
|
34464 | HeaderNavigationDirection[HeaderNavigationDirection["DOWN"] = 1] = "DOWN";
|
34465 | HeaderNavigationDirection[HeaderNavigationDirection["LEFT"] = 2] = "LEFT";
|
34466 | HeaderNavigationDirection[HeaderNavigationDirection["RIGHT"] = 3] = "RIGHT";
|
34467 | })(HeaderNavigationDirection || (HeaderNavigationDirection = {}));
|
34468 | var HeaderNavigationService = (function (_super) {
|
34469 | __extends$1g(HeaderNavigationService, _super);
|
34470 | function HeaderNavigationService() {
|
34471 | return _super !== null && _super.apply(this, arguments) || this;
|
34472 | }
|
34473 | HeaderNavigationService.prototype.postConstruct = function () {
|
34474 | var _this = this;
|
34475 | this.ctrlsService.whenReady(function (p) {
|
34476 | _this.gridBodyCon = p.gridBodyCtrl;
|
34477 | });
|
34478 | };
|
34479 | HeaderNavigationService.prototype.getHeaderRowCount = function () {
|
34480 | var centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();
|
34481 | return centerHeaderContainer ? centerHeaderContainer.getRowCount() : 0;
|
34482 | };
|
34483 | |
34484 |
|
34485 |
|
34486 |
|
34487 | HeaderNavigationService.prototype.navigateVertically = function (direction, fromHeader, event) {
|
34488 | if (!fromHeader) {
|
34489 | fromHeader = this.focusService.getFocusedHeader();
|
34490 | }
|
34491 | if (!fromHeader) {
|
34492 | return false;
|
34493 | }
|
34494 | var headerRowIndex = fromHeader.headerRowIndex, column = fromHeader.column;
|
34495 | var rowLen = this.getHeaderRowCount();
|
34496 | var isUp = direction === HeaderNavigationDirection.UP;
|
34497 | var _a = isUp
|
34498 | ? this.headerPositionUtils.getColumnVisibleParent(column, headerRowIndex)
|
34499 | : this.headerPositionUtils.getColumnVisibleChild(column, headerRowIndex), nextRow = _a.nextRow, nextFocusColumn = _a.nextFocusColumn;
|
34500 | var skipColumn = false;
|
34501 | if (nextRow < 0) {
|
34502 | nextRow = 0;
|
34503 | nextFocusColumn = column;
|
34504 | skipColumn = true;
|
34505 | }
|
34506 | if (nextRow >= rowLen) {
|
34507 | nextRow = -1;
|
34508 | }
|
34509 | if (!skipColumn && !nextFocusColumn) {
|
34510 | return false;
|
34511 | }
|
34512 | return this.focusService.focusHeaderPosition({
|
34513 | headerPosition: { headerRowIndex: nextRow, column: nextFocusColumn },
|
34514 | allowUserOverride: true,
|
34515 | event: event
|
34516 | });
|
34517 | };
|
34518 | |
34519 |
|
34520 |
|
34521 |
|
34522 | HeaderNavigationService.prototype.navigateHorizontally = function (direction, fromTab, event) {
|
34523 | if (fromTab === void 0) { fromTab = false; }
|
34524 | var focusedHeader = this.focusService.getFocusedHeader();
|
34525 | var isLeft = direction === HeaderNavigationDirection.LEFT;
|
34526 | var isRtl = this.gridOptionsService.is('enableRtl');
|
34527 | var nextHeader;
|
34528 | var normalisedDirection;
|
34529 |
|
34530 | if (isLeft !== isRtl) {
|
34531 | normalisedDirection = 'Before';
|
34532 | nextHeader = this.headerPositionUtils.findHeader(focusedHeader, normalisedDirection);
|
34533 | }
|
34534 | else {
|
34535 | normalisedDirection = 'After';
|
34536 | nextHeader = this.headerPositionUtils.findHeader(focusedHeader, normalisedDirection);
|
34537 | }
|
34538 | if (nextHeader || !fromTab) {
|
34539 | return this.focusService.focusHeaderPosition({
|
34540 | headerPosition: nextHeader,
|
34541 | direction: normalisedDirection,
|
34542 | fromTab: fromTab,
|
34543 | allowUserOverride: true,
|
34544 | event: event
|
34545 | });
|
34546 | }
|
34547 | return this.focusNextHeaderRow(focusedHeader, normalisedDirection, event);
|
34548 | };
|
34549 | HeaderNavigationService.prototype.focusNextHeaderRow = function (focusedHeader, direction, event) {
|
34550 | var currentIndex = focusedHeader.headerRowIndex;
|
34551 | var nextPosition = null;
|
34552 | var nextRowIndex;
|
34553 | if (direction === 'Before') {
|
34554 | if (currentIndex > 0) {
|
34555 | nextRowIndex = currentIndex - 1;
|
34556 | nextPosition = this.headerPositionUtils.findColAtEdgeForHeaderRow(nextRowIndex, 'end');
|
34557 | }
|
34558 | }
|
34559 | else {
|
34560 | nextRowIndex = currentIndex + 1;
|
34561 | nextPosition = this.headerPositionUtils.findColAtEdgeForHeaderRow(nextRowIndex, 'start');
|
34562 | }
|
34563 | return this.focusService.focusHeaderPosition({
|
34564 | headerPosition: nextPosition,
|
34565 | direction: direction,
|
34566 | fromTab: true,
|
34567 | allowUserOverride: true,
|
34568 | event: event
|
34569 | });
|
34570 | };
|
34571 | HeaderNavigationService.prototype.scrollToColumn = function (column, direction) {
|
34572 | if (direction === void 0) { direction = 'After'; }
|
34573 | if (column.getPinned()) {
|
34574 | return;
|
34575 | }
|
34576 | var columnToScrollTo;
|
34577 | if (column instanceof ColumnGroup) {
|
34578 | var columns = column.getDisplayedLeafColumns();
|
34579 | columnToScrollTo = direction === 'Before' ? last(columns) : columns[0];
|
34580 | }
|
34581 | else {
|
34582 | columnToScrollTo = column;
|
34583 | }
|
34584 | this.gridBodyCon.getScrollFeature().ensureColumnVisible(columnToScrollTo);
|
34585 | };
|
34586 | __decorate$1d([
|
34587 | Autowired('focusService')
|
34588 | ], HeaderNavigationService.prototype, "focusService", void 0);
|
34589 | __decorate$1d([
|
34590 | Autowired('headerPositionUtils')
|
34591 | ], HeaderNavigationService.prototype, "headerPositionUtils", void 0);
|
34592 | __decorate$1d([
|
34593 | Autowired('ctrlsService')
|
34594 | ], HeaderNavigationService.prototype, "ctrlsService", void 0);
|
34595 | __decorate$1d([
|
34596 | PostConstruct
|
34597 | ], HeaderNavigationService.prototype, "postConstruct", null);
|
34598 | HeaderNavigationService = __decorate$1d([
|
34599 | Bean('headerNavigationService')
|
34600 | ], HeaderNavigationService);
|
34601 | return HeaderNavigationService;
|
34602 | }(BeanStub));
|
34603 |
|
34604 |
|
34605 |
|
34606 |
|
34607 |
|
34608 |
|
34609 |
|
34610 | var __extends$1f = (undefined && undefined.__extends) || (function () {
|
34611 | var extendStatics = function (d, b) {
|
34612 | extendStatics = Object.setPrototypeOf ||
|
34613 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34614 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
34615 | return extendStatics(d, b);
|
34616 | };
|
34617 | return function (d, b) {
|
34618 | extendStatics(d, b);
|
34619 | function __() { this.constructor = d; }
|
34620 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34621 | };
|
34622 | })();
|
34623 | var __decorate$1c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34624 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34625 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34626 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34627 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34628 | };
|
34629 | var GridHeaderCtrl = (function (_super) {
|
34630 | __extends$1f(GridHeaderCtrl, _super);
|
34631 | function GridHeaderCtrl() {
|
34632 | return _super !== null && _super.apply(this, arguments) || this;
|
34633 | }
|
34634 | GridHeaderCtrl.prototype.setComp = function (comp, eGui, eFocusableElement) {
|
34635 | this.comp = comp;
|
34636 | this.eGui = eGui;
|
34637 | this.createManagedBean(new ManagedFocusFeature(eFocusableElement, {
|
34638 | onTabKeyDown: this.onTabKeyDown.bind(this),
|
34639 | handleKeyDown: this.handleKeyDown.bind(this),
|
34640 | onFocusOut: this.onFocusOut.bind(this)
|
34641 | }));
|
34642 |
|
34643 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, this.onPivotModeChanged.bind(this));
|
34644 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
|
34645 | this.onPivotModeChanged();
|
34646 | this.setupHeaderHeight();
|
34647 | this.ctrlsService.registerGridHeaderCtrl(this);
|
34648 | };
|
34649 | GridHeaderCtrl.prototype.setupHeaderHeight = function () {
|
34650 | var listener = this.setHeaderHeight.bind(this);
|
34651 | listener();
|
34652 | this.addManagedPropertyListener('headerHeight', listener);
|
34653 | this.addManagedPropertyListener('pivotHeaderHeight', listener);
|
34654 | this.addManagedPropertyListener('groupHeaderHeight', listener);
|
34655 | this.addManagedPropertyListener('pivotGroupHeaderHeight', listener);
|
34656 | this.addManagedPropertyListener('floatingFiltersHeight', listener);
|
34657 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);
|
34658 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HEADER_HEIGHT_CHANGED, listener);
|
34659 | this.addManagedListener(this.eventService, Events.EVENT_GRID_STYLES_CHANGED, listener);
|
34660 | };
|
34661 | GridHeaderCtrl.prototype.getHeaderHeight = function () {
|
34662 | return this.headerHeight;
|
34663 | };
|
34664 | GridHeaderCtrl.prototype.setHeaderHeight = function () {
|
34665 | var columnModel = this.columnModel;
|
34666 | var numberOfFloating = 0;
|
34667 | var headerRowCount = columnModel.getHeaderRowCount();
|
34668 | var totalHeaderHeight;
|
34669 | var hasFloatingFilters = columnModel.hasFloatingFilters();
|
34670 | if (hasFloatingFilters) {
|
34671 | headerRowCount++;
|
34672 | numberOfFloating = 1;
|
34673 | }
|
34674 | var groupHeight = this.columnModel.getColumnGroupHeaderRowHeight();
|
34675 | var headerHeight = this.columnModel.getColumnHeaderRowHeight();
|
34676 | var numberOfNonGroups = 1 + numberOfFloating;
|
34677 | var numberOfGroups = headerRowCount - numberOfNonGroups;
|
34678 | totalHeaderHeight = numberOfFloating * columnModel.getFloatingFiltersHeight();
|
34679 | totalHeaderHeight += numberOfGroups * groupHeight;
|
34680 | totalHeaderHeight += headerHeight;
|
34681 | if (this.headerHeight === totalHeaderHeight) {
|
34682 | return;
|
34683 | }
|
34684 | this.headerHeight = totalHeaderHeight;
|
34685 |
|
34686 |
|
34687 | var px = totalHeaderHeight + 1 + "px";
|
34688 | this.comp.setHeightAndMinHeight(px);
|
34689 | this.eventService.dispatchEvent({
|
34690 | type: Events.EVENT_HEADER_HEIGHT_CHANGED
|
34691 | });
|
34692 | };
|
34693 | GridHeaderCtrl.prototype.onPivotModeChanged = function () {
|
34694 | var pivotMode = this.columnModel.isPivotMode();
|
34695 | this.comp.addOrRemoveCssClass('ag-pivot-on', pivotMode);
|
34696 | this.comp.addOrRemoveCssClass('ag-pivot-off', !pivotMode);
|
34697 | };
|
34698 | GridHeaderCtrl.prototype.onDisplayedColumnsChanged = function () {
|
34699 | var columns = this.columnModel.getAllDisplayedColumns();
|
34700 | var shouldAllowOverflow = columns.some(function (col) { return col.isSpanHeaderHeight(); });
|
34701 | this.comp.addOrRemoveCssClass('ag-header-allow-overflow', shouldAllowOverflow);
|
34702 | };
|
34703 | GridHeaderCtrl.prototype.onTabKeyDown = function (e) {
|
34704 | var isRtl = this.gridOptionsService.is('enableRtl');
|
34705 | var direction = e.shiftKey !== isRtl
|
34706 | ? HeaderNavigationDirection.LEFT
|
34707 | : HeaderNavigationDirection.RIGHT;
|
34708 | if (this.headerNavigationService.navigateHorizontally(direction, true, e) ||
|
34709 | this.focusService.focusNextGridCoreContainer(e.shiftKey)) {
|
34710 | e.preventDefault();
|
34711 | }
|
34712 | };
|
34713 | GridHeaderCtrl.prototype.handleKeyDown = function (e) {
|
34714 | var direction = null;
|
34715 | switch (e.key) {
|
34716 | case KeyCode.LEFT:
|
34717 | direction = HeaderNavigationDirection.LEFT;
|
34718 | case KeyCode.RIGHT:
|
34719 | if (!exists(direction)) {
|
34720 | direction = HeaderNavigationDirection.RIGHT;
|
34721 | }
|
34722 | this.headerNavigationService.navigateHorizontally(direction, false, e);
|
34723 | break;
|
34724 | case KeyCode.UP:
|
34725 | direction = HeaderNavigationDirection.UP;
|
34726 | case KeyCode.DOWN:
|
34727 | if (!exists(direction)) {
|
34728 | direction = HeaderNavigationDirection.DOWN;
|
34729 | }
|
34730 | if (this.headerNavigationService.navigateVertically(direction, null, e)) {
|
34731 | e.preventDefault();
|
34732 | }
|
34733 | break;
|
34734 | default:
|
34735 | return;
|
34736 | }
|
34737 | };
|
34738 | GridHeaderCtrl.prototype.onFocusOut = function (e) {
|
34739 | var eDocument = this.gridOptionsService.getDocument();
|
34740 | var relatedTarget = e.relatedTarget;
|
34741 | if (!relatedTarget && this.eGui.contains(eDocument.activeElement)) {
|
34742 | return;
|
34743 | }
|
34744 | if (!this.eGui.contains(relatedTarget)) {
|
34745 | this.focusService.clearFocusedHeader();
|
34746 | }
|
34747 | };
|
34748 | __decorate$1c([
|
34749 | Autowired('headerNavigationService')
|
34750 | ], GridHeaderCtrl.prototype, "headerNavigationService", void 0);
|
34751 | __decorate$1c([
|
34752 | Autowired('focusService')
|
34753 | ], GridHeaderCtrl.prototype, "focusService", void 0);
|
34754 | __decorate$1c([
|
34755 | Autowired('columnModel')
|
34756 | ], GridHeaderCtrl.prototype, "columnModel", void 0);
|
34757 | __decorate$1c([
|
34758 | Autowired('ctrlsService')
|
34759 | ], GridHeaderCtrl.prototype, "ctrlsService", void 0);
|
34760 | return GridHeaderCtrl;
|
34761 | }(BeanStub));
|
34762 |
|
34763 |
|
34764 |
|
34765 |
|
34766 |
|
34767 |
|
34768 |
|
34769 | var __extends$1e = (undefined && undefined.__extends) || (function () {
|
34770 | var extendStatics = function (d, b) {
|
34771 | extendStatics = Object.setPrototypeOf ||
|
34772 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34773 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
34774 | return extendStatics(d, b);
|
34775 | };
|
34776 | return function (d, b) {
|
34777 | extendStatics(d, b);
|
34778 | function __() { this.constructor = d; }
|
34779 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34780 | };
|
34781 | })();
|
34782 | var __decorate$1b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34783 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34784 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34785 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34786 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34787 | };
|
34788 | var GridHeaderComp = (function (_super) {
|
34789 | __extends$1e(GridHeaderComp, _super);
|
34790 | function GridHeaderComp() {
|
34791 | return _super.call(this, GridHeaderComp.TEMPLATE) || this;
|
34792 | }
|
34793 | GridHeaderComp.prototype.postConstruct = function () {
|
34794 | var _this = this;
|
34795 | var compProxy = {
|
34796 | addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
|
34797 | setHeightAndMinHeight: function (height) {
|
34798 | _this.getGui().style.height = height;
|
34799 | _this.getGui().style.minHeight = height;
|
34800 | }
|
34801 | };
|
34802 | var ctrl = this.createManagedBean(new GridHeaderCtrl());
|
34803 | ctrl.setComp(compProxy, this.getGui(), this.getFocusableElement());
|
34804 | var addContainer = function (container) {
|
34805 | _this.createManagedBean(container);
|
34806 | _this.appendChild(container);
|
34807 | };
|
34808 | addContainer(new HeaderRowContainerComp('left'));
|
34809 | addContainer(new HeaderRowContainerComp(null));
|
34810 | addContainer(new HeaderRowContainerComp('right'));
|
34811 | };
|
34812 | GridHeaderComp.TEMPLATE = "<div class=\"ag-header\" role=\"presentation\"/>";
|
34813 | __decorate$1b([
|
34814 | PostConstruct
|
34815 | ], GridHeaderComp.prototype, "postConstruct", null);
|
34816 | return GridHeaderComp;
|
34817 | }(Component));
|
34818 |
|
34819 |
|
34820 |
|
34821 |
|
34822 |
|
34823 |
|
34824 |
|
34825 | var __extends$1d = (undefined && undefined.__extends) || (function () {
|
34826 | var extendStatics = function (d, b) {
|
34827 | extendStatics = Object.setPrototypeOf ||
|
34828 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34829 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
34830 | return extendStatics(d, b);
|
34831 | };
|
34832 | return function (d, b) {
|
34833 | extendStatics(d, b);
|
34834 | function __() { this.constructor = d; }
|
34835 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34836 | };
|
34837 | })();
|
34838 | var __decorate$1a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34839 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34840 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34841 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34842 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34843 | };
|
34844 | var HorizontalResizeService = (function (_super) {
|
34845 | __extends$1d(HorizontalResizeService, _super);
|
34846 | function HorizontalResizeService() {
|
34847 | return _super !== null && _super.apply(this, arguments) || this;
|
34848 | }
|
34849 | HorizontalResizeService.prototype.addResizeBar = function (params) {
|
34850 | var _this = this;
|
34851 | var dragSource = {
|
34852 | dragStartPixels: params.dragStartPixels || 0,
|
34853 | eElement: params.eResizeBar,
|
34854 | onDragStart: this.onDragStart.bind(this, params),
|
34855 | onDragStop: this.onDragStop.bind(this, params),
|
34856 | onDragging: this.onDragging.bind(this, params)
|
34857 | };
|
34858 | this.dragService.addDragSource(dragSource, true);
|
34859 |
|
34860 |
|
34861 | var finishedWithResizeFunc = function () { return _this.dragService.removeDragSource(dragSource); };
|
34862 | return finishedWithResizeFunc;
|
34863 | };
|
34864 | HorizontalResizeService.prototype.onDragStart = function (params, mouseEvent) {
|
34865 | this.dragStartX = mouseEvent.clientX;
|
34866 | this.setResizeIcons();
|
34867 | var shiftKey = mouseEvent instanceof MouseEvent && mouseEvent.shiftKey === true;
|
34868 | params.onResizeStart(shiftKey);
|
34869 | };
|
34870 | HorizontalResizeService.prototype.setResizeIcons = function () {
|
34871 | var ctrl = this.ctrlsService.getGridCtrl();
|
34872 |
|
34873 | ctrl.setResizeCursor(true);
|
34874 |
|
34875 | ctrl.disableUserSelect(true);
|
34876 | };
|
34877 | HorizontalResizeService.prototype.onDragStop = function (params, mouseEvent) {
|
34878 | params.onResizeEnd(this.resizeAmount);
|
34879 | this.resetIcons();
|
34880 | };
|
34881 | HorizontalResizeService.prototype.resetIcons = function () {
|
34882 | var ctrl = this.ctrlsService.getGridCtrl();
|
34883 | ctrl.setResizeCursor(false);
|
34884 | ctrl.disableUserSelect(false);
|
34885 | };
|
34886 | HorizontalResizeService.prototype.onDragging = function (params, mouseEvent) {
|
34887 | this.resizeAmount = mouseEvent.clientX - this.dragStartX;
|
34888 | params.onResizing(this.resizeAmount);
|
34889 | };
|
34890 | __decorate$1a([
|
34891 | Autowired('dragService')
|
34892 | ], HorizontalResizeService.prototype, "dragService", void 0);
|
34893 | __decorate$1a([
|
34894 | Autowired('ctrlsService')
|
34895 | ], HorizontalResizeService.prototype, "ctrlsService", void 0);
|
34896 | HorizontalResizeService = __decorate$1a([
|
34897 | Bean('horizontalResizeService')
|
34898 | ], HorizontalResizeService);
|
34899 | return HorizontalResizeService;
|
34900 | }(BeanStub));
|
34901 |
|
34902 |
|
34903 |
|
34904 |
|
34905 |
|
34906 |
|
34907 |
|
34908 | var __extends$1c = (undefined && undefined.__extends) || (function () {
|
34909 | var extendStatics = function (d, b) {
|
34910 | extendStatics = Object.setPrototypeOf ||
|
34911 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
34912 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
34913 | return extendStatics(d, b);
|
34914 | };
|
34915 | return function (d, b) {
|
34916 | extendStatics(d, b);
|
34917 | function __() { this.constructor = d; }
|
34918 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
34919 | };
|
34920 | })();
|
34921 | var __decorate$19 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
34922 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
34923 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
34924 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
34925 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
34926 | };
|
34927 | var StandardMenuFactory = (function (_super) {
|
34928 | __extends$1c(StandardMenuFactory, _super);
|
34929 | function StandardMenuFactory() {
|
34930 | return _super !== null && _super.apply(this, arguments) || this;
|
34931 | }
|
34932 | StandardMenuFactory.prototype.hideActiveMenu = function () {
|
34933 | if (this.hidePopup) {
|
34934 | this.hidePopup();
|
34935 | }
|
34936 | };
|
34937 | StandardMenuFactory.prototype.showMenuAfterMouseEvent = function (column, mouseEvent) {
|
34938 | var _this = this;
|
34939 | this.showPopup(column, function (eMenu) {
|
34940 | _this.popupService.positionPopupUnderMouseEvent({
|
34941 | column: column,
|
34942 | type: 'columnMenu',
|
34943 | mouseEvent: mouseEvent,
|
34944 | ePopup: eMenu
|
34945 | });
|
34946 | }, 'columnMenu', mouseEvent.target);
|
34947 | };
|
34948 | StandardMenuFactory.prototype.showMenuAfterButtonClick = function (column, eventSource, containerType) {
|
34949 | var _this = this;
|
34950 | this.showPopup(column, function (eMenu) {
|
34951 | _this.popupService.positionPopupByComponent({
|
34952 | type: containerType,
|
34953 | eventSource: eventSource,
|
34954 | ePopup: eMenu,
|
34955 | keepWithinBounds: true,
|
34956 | position: 'under',
|
34957 | column: column,
|
34958 | shouldSetMaxHeight: true
|
34959 | });
|
34960 | }, containerType, eventSource);
|
34961 | };
|
34962 | StandardMenuFactory.prototype.showPopup = function (column, positionCallback, containerType, eventSource) {
|
34963 | var _this = this;
|
34964 | var filterWrapper = this.filterManager.getOrCreateFilterWrapper(column, 'COLUMN_MENU');
|
34965 | if (!filterWrapper) {
|
34966 | throw new Error('AG Grid - unable to show popup filter, filter instantiation failed');
|
34967 | }
|
34968 | var eMenu = document.createElement('div');
|
34969 | setAriaRole(eMenu, 'presentation');
|
34970 | eMenu.classList.add('ag-menu');
|
34971 | this.tabListener = this.addManagedListener(eMenu, 'keydown', function (e) { return _this.trapFocusWithin(e, eMenu); });
|
34972 | filterWrapper.guiPromise.then(function (gui) { return eMenu.appendChild(gui); });
|
34973 | var hidePopup;
|
34974 | var afterGuiDetached = function () { var _a; return (_a = filterWrapper.filterPromise) === null || _a === void 0 ? void 0 : _a.then(function (filter) { var _a; return (_a = filter === null || filter === void 0 ? void 0 : filter.afterGuiDetached) === null || _a === void 0 ? void 0 : _a.call(filter); }); };
|
34975 | var anchorToElement = eventSource || this.ctrlsService.getGridBodyCtrl().getGui();
|
34976 | var closedCallback = function (e) {
|
34977 | column.setMenuVisible(false, 'contextMenu');
|
34978 | var isKeyboardEvent = e instanceof KeyboardEvent;
|
34979 | if (_this.tabListener) {
|
34980 | _this.tabListener = _this.tabListener();
|
34981 | }
|
34982 | if (isKeyboardEvent && eventSource && isVisible(eventSource)) {
|
34983 | var focusableEl = _this.focusService.findTabbableParent(eventSource);
|
34984 | if (focusableEl) {
|
34985 | focusableEl.focus();
|
34986 | }
|
34987 | }
|
34988 | afterGuiDetached();
|
34989 | };
|
34990 | var translate = this.localeService.getLocaleTextFunc();
|
34991 | var addPopupRes = this.popupService.addPopup({
|
34992 | modal: true,
|
34993 | eChild: eMenu,
|
34994 | closeOnEsc: true,
|
34995 | closedCallback: closedCallback,
|
34996 | positionCallback: function () { return positionCallback(eMenu); },
|
34997 | anchorToElement: anchorToElement,
|
34998 | ariaLabel: translate('ariaLabelColumnMenu', 'Column Menu')
|
34999 | });
|
35000 | if (addPopupRes) {
|
35001 | this.hidePopup = hidePopup = addPopupRes.hideFunc;
|
35002 | }
|
35003 | filterWrapper.filterPromise.then(function (filter) {
|
35004 |
|
35005 |
|
35006 | positionCallback(eMenu);
|
35007 | if (filter.afterGuiAttached) {
|
35008 | filter.afterGuiAttached({ container: containerType, hidePopup: hidePopup });
|
35009 | }
|
35010 | });
|
35011 | column.setMenuVisible(true, 'contextMenu');
|
35012 | };
|
35013 | StandardMenuFactory.prototype.trapFocusWithin = function (e, menu) {
|
35014 | if (e.key !== KeyCode.TAB ||
|
35015 | e.defaultPrevented ||
|
35016 | this.focusService.findNextFocusableElement(menu, false, e.shiftKey)) {
|
35017 | return;
|
35018 | }
|
35019 | e.preventDefault();
|
35020 | this.focusService.focusInto(menu, e.shiftKey);
|
35021 | };
|
35022 | StandardMenuFactory.prototype.isMenuEnabled = function (column) {
|
35023 |
|
35024 | return column.isFilterAllowed();
|
35025 | };
|
35026 | __decorate$19([
|
35027 | Autowired('filterManager')
|
35028 | ], StandardMenuFactory.prototype, "filterManager", void 0);
|
35029 | __decorate$19([
|
35030 | Autowired('popupService')
|
35031 | ], StandardMenuFactory.prototype, "popupService", void 0);
|
35032 | __decorate$19([
|
35033 | Autowired('focusService')
|
35034 | ], StandardMenuFactory.prototype, "focusService", void 0);
|
35035 | __decorate$19([
|
35036 | Autowired('ctrlsService')
|
35037 | ], StandardMenuFactory.prototype, "ctrlsService", void 0);
|
35038 | StandardMenuFactory = __decorate$19([
|
35039 | Bean('menuFactory')
|
35040 | ], StandardMenuFactory);
|
35041 | return StandardMenuFactory;
|
35042 | }(BeanStub));
|
35043 |
|
35044 |
|
35045 |
|
35046 |
|
35047 |
|
35048 |
|
35049 |
|
35050 | var __extends$1b = (undefined && undefined.__extends) || (function () {
|
35051 | var extendStatics = function (d, b) {
|
35052 | extendStatics = Object.setPrototypeOf ||
|
35053 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
35054 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
35055 | return extendStatics(d, b);
|
35056 | };
|
35057 | return function (d, b) {
|
35058 | extendStatics(d, b);
|
35059 | function __() { this.constructor = d; }
|
35060 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
35061 | };
|
35062 | })();
|
35063 | var __decorate$18 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
35064 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
35065 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
35066 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
35067 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
35068 | };
|
35069 | var TabbedLayout = (function (_super) {
|
35070 | __extends$1b(TabbedLayout, _super);
|
35071 | function TabbedLayout(params) {
|
35072 | var _this = _super.call(this, TabbedLayout.getTemplate(params.cssClass)) || this;
|
35073 | _this.items = [];
|
35074 | _this.tabbedItemScrollMap = new Map();
|
35075 | _this.params = params;
|
35076 | if (params.items) {
|
35077 | params.items.forEach(function (item) { return _this.addItem(item); });
|
35078 | }
|
35079 | return _this;
|
35080 | }
|
35081 | TabbedLayout.prototype.postConstruct = function () {
|
35082 | var _this = this;
|
35083 | this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), {
|
35084 | onTabKeyDown: this.onTabKeyDown.bind(this),
|
35085 | handleKeyDown: this.handleKeyDown.bind(this)
|
35086 | }));
|
35087 | this.addDestroyFunc(function () { var _a, _b, _c; return (_c = (_b = (_a = _this.activeItem) === null || _a === void 0 ? void 0 : _a.tabbedItem) === null || _b === void 0 ? void 0 : _b.afterDetachedCallback) === null || _c === void 0 ? void 0 : _c.call(_b); });
|
35088 | };
|
35089 | TabbedLayout.getTemplate = function (cssClass) {
|
35090 | 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>";
|
35091 | };
|
35092 | TabbedLayout.prototype.handleKeyDown = function (e) {
|
35093 | var eDocument = this.gridOptionsService.getDocument();
|
35094 | switch (e.key) {
|
35095 | case KeyCode.RIGHT:
|
35096 | case KeyCode.LEFT:
|
35097 | if (!this.eHeader.contains(eDocument.activeElement)) {
|
35098 | return;
|
35099 | }
|
35100 | var isRightKey = e.key === KeyCode.RIGHT;
|
35101 | var isRtl = this.gridOptionsService.is('enableRtl');
|
35102 | var currentPosition = this.items.indexOf(this.activeItem);
|
35103 | var nextPosition = isRightKey !== isRtl ? Math.min(currentPosition + 1, this.items.length - 1) : Math.max(currentPosition - 1, 0);
|
35104 | if (currentPosition === nextPosition) {
|
35105 | return;
|
35106 | }
|
35107 | e.preventDefault();
|
35108 | var nextItem = this.items[nextPosition];
|
35109 | this.showItemWrapper(nextItem);
|
35110 | nextItem.eHeaderButton.focus();
|
35111 | break;
|
35112 | case KeyCode.UP:
|
35113 | case KeyCode.DOWN:
|
35114 | e.stopPropagation();
|
35115 | break;
|
35116 | }
|
35117 | };
|
35118 | TabbedLayout.prototype.onTabKeyDown = function (e) {
|
35119 | if (e.defaultPrevented) {
|
35120 | return;
|
35121 | }
|
35122 | var _a = this, focusService = _a.focusService, eHeader = _a.eHeader, eBody = _a.eBody, activeItem = _a.activeItem;
|
35123 | var eDocument = this.gridOptionsService.getDocument();
|
35124 | var activeElement = eDocument.activeElement;
|
35125 | var target = e.target;
|
35126 | e.preventDefault();
|
35127 | if (eHeader.contains(activeElement)) {
|
35128 |
|
35129 | focusService.focusInto(eBody, e.shiftKey);
|
35130 | return;
|
35131 | }
|
35132 | var nextEl = null;
|
35133 | if (focusService.isTargetUnderManagedComponent(eBody, target)) {
|
35134 | if (e.shiftKey) {
|
35135 | nextEl = this.focusService.findFocusableElementBeforeTabGuard(eBody, target);
|
35136 | }
|
35137 | if (!nextEl) {
|
35138 | nextEl = activeItem.eHeaderButton;
|
35139 | }
|
35140 | }
|
35141 | if (!nextEl && eBody.contains(activeElement)) {
|
35142 | nextEl = focusService.findNextFocusableElement(eBody, false, e.shiftKey);
|
35143 | if (!nextEl) {
|
35144 | nextEl = activeItem.eHeaderButton;
|
35145 | }
|
35146 | }
|
35147 | if (nextEl) {
|
35148 | nextEl.focus();
|
35149 | }
|
35150 | };
|
35151 | TabbedLayout.prototype.setAfterAttachedParams = function (params) {
|
35152 | this.afterAttachedParams = params;
|
35153 | };
|
35154 | TabbedLayout.prototype.showFirstItem = function () {
|
35155 | if (this.items.length > 0) {
|
35156 | this.showItemWrapper(this.items[0]);
|
35157 | }
|
35158 | };
|
35159 | TabbedLayout.prototype.addItem = function (item) {
|
35160 | var eHeaderButton = document.createElement('span');
|
35161 | setAriaRole(eHeaderButton, 'tab');
|
35162 | eHeaderButton.setAttribute('tabIndex', '-1');
|
35163 | eHeaderButton.appendChild(item.title);
|
35164 | eHeaderButton.classList.add('ag-tab');
|
35165 | this.eHeader.appendChild(eHeaderButton);
|
35166 | setAriaLabel(eHeaderButton, item.titleLabel);
|
35167 | var wrapper = {
|
35168 | tabbedItem: item,
|
35169 | eHeaderButton: eHeaderButton
|
35170 | };
|
35171 | this.items.push(wrapper);
|
35172 | eHeaderButton.addEventListener('click', this.showItemWrapper.bind(this, wrapper));
|
35173 | };
|
35174 | TabbedLayout.prototype.showItem = function (tabbedItem) {
|
35175 | var itemWrapper = this.items.find(function (wrapper) { return wrapper.tabbedItem === tabbedItem; });
|
35176 | if (itemWrapper) {
|
35177 | this.showItemWrapper(itemWrapper);
|
35178 | }
|
35179 | };
|
35180 | TabbedLayout.prototype.showItemWrapper = function (wrapper) {
|
35181 | var _this = this;
|
35182 | var _a, _b;
|
35183 | var tabbedItem = wrapper.tabbedItem, eHeaderButton = wrapper.eHeaderButton;
|
35184 | if (this.params.onItemClicked) {
|
35185 | this.params.onItemClicked({ item: tabbedItem });
|
35186 | }
|
35187 | if (this.activeItem === wrapper) {
|
35188 | callIfPresent(this.params.onActiveItemClicked);
|
35189 | return;
|
35190 | }
|
35191 | if (this.lastScrollListener) {
|
35192 | this.lastScrollListener = this.lastScrollListener();
|
35193 | }
|
35194 | clearElement(this.eBody);
|
35195 | tabbedItem.bodyPromise.then(function (body) {
|
35196 | _this.eBody.appendChild(body);
|
35197 | var onlyUnmanaged = !_this.focusService.isKeyboardMode();
|
35198 | _this.focusService.focusInto(_this.eBody, false, onlyUnmanaged);
|
35199 | if (tabbedItem.afterAttachedCallback) {
|
35200 | tabbedItem.afterAttachedCallback(_this.afterAttachedParams);
|
35201 | }
|
35202 | if (_this.params.keepScrollPosition) {
|
35203 | var scrollableContainer_1 = (tabbedItem.getScrollableContainer && tabbedItem.getScrollableContainer()) || body;
|
35204 | _this.lastScrollListener = _this.addManagedListener(scrollableContainer_1, 'scroll', function () {
|
35205 | _this.tabbedItemScrollMap.set(tabbedItem.name, scrollableContainer_1.scrollTop);
|
35206 | });
|
35207 | var scrollPosition_1 = _this.tabbedItemScrollMap.get(tabbedItem.name);
|
35208 | if (scrollPosition_1 !== undefined) {
|
35209 |
|
35210 | setTimeout(function () {
|
35211 | scrollableContainer_1.scrollTop = scrollPosition_1;
|
35212 | }, 0);
|
35213 | }
|
35214 | }
|
35215 | });
|
35216 | if (this.activeItem) {
|
35217 | this.activeItem.eHeaderButton.classList.remove('ag-tab-selected');
|
35218 | (_b = (_a = this.activeItem.tabbedItem).afterDetachedCallback) === null || _b === void 0 ? void 0 : _b.call(_a);
|
35219 | }
|
35220 | eHeaderButton.classList.add('ag-tab-selected');
|
35221 | this.activeItem = wrapper;
|
35222 | };
|
35223 | __decorate$18([
|
35224 | Autowired('focusService')
|
35225 | ], TabbedLayout.prototype, "focusService", void 0);
|
35226 | __decorate$18([
|
35227 | RefSelector('eHeader')
|
35228 | ], TabbedLayout.prototype, "eHeader", void 0);
|
35229 | __decorate$18([
|
35230 | RefSelector('eBody')
|
35231 | ], TabbedLayout.prototype, "eBody", void 0);
|
35232 | __decorate$18([
|
35233 | PostConstruct
|
35234 | ], TabbedLayout.prototype, "postConstruct", null);
|
35235 | return TabbedLayout;
|
35236 | }(Component));
|
35237 |
|
35238 |
|
35239 |
|
35240 |
|
35241 |
|
35242 |
|
35243 |
|
35244 |
|
35245 |
|
35246 |
|
35247 | function simpleHttpRequest(params) {
|
35248 | doOnce(function () { return console.warn("AG Grid: Since v29 simpleHttpRequest has been deprecated as it was only meant for use in internal AG Grid documentation examples. Please use the browser fetch api directly."); }, 'simpleHttpRequest');
|
35249 | return new AgPromise(function (resolve) {
|
35250 | var httpRequest = new XMLHttpRequest();
|
35251 | httpRequest.open('GET', params.url);
|
35252 | httpRequest.send();
|
35253 | httpRequest.onreadystatechange = function () {
|
35254 | if (httpRequest.readyState === 4 && httpRequest.status === 200) {
|
35255 | resolve(JSON.parse(httpRequest.responseText));
|
35256 | }
|
35257 | };
|
35258 | });
|
35259 | }
|
35260 |
|
35261 |
|
35262 |
|
35263 |
|
35264 |
|
35265 |
|
35266 |
|
35267 | var __extends$1a = (undefined && undefined.__extends) || (function () {
|
35268 | var extendStatics = function (d, b) {
|
35269 | extendStatics = Object.setPrototypeOf ||
|
35270 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
35271 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
35272 | return extendStatics(d, b);
|
35273 | };
|
35274 | return function (d, b) {
|
35275 | extendStatics(d, b);
|
35276 | function __() { this.constructor = d; }
|
35277 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
35278 | };
|
35279 | })();
|
35280 | var __decorate$17 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
35281 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
35282 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
35283 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
35284 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
35285 | };
|
35286 | var DEBOUNCE_DELAY = 50;
|
35287 | var ResizeObserverService = (function (_super) {
|
35288 | __extends$1a(ResizeObserverService, _super);
|
35289 | function ResizeObserverService() {
|
35290 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
35291 | _this.polyfillFunctions = [];
|
35292 | return _this;
|
35293 | }
|
35294 | ResizeObserverService.prototype.observeResize = function (element, callback) {
|
35295 | var _this = this;
|
35296 | var eDocument = this.gridOptionsService.getDocument();
|
35297 | var win = (eDocument.defaultView || window);
|
35298 |
|
35299 |
|
35300 | var debouncedCallback = debounce(callback, DEBOUNCE_DELAY);
|
35301 | var useBrowserResizeObserver = function () {
|
35302 | var resizeObserver = new win.ResizeObserver(debouncedCallback);
|
35303 | resizeObserver.observe(element);
|
35304 | return function () { return resizeObserver.disconnect(); };
|
35305 | };
|
35306 | var usePolyfill = function () {
|
35307 |
|
35308 | var widthLastTime = offsetWidth(element);
|
35309 | var heightLastTime = offsetHeight(element);
|
35310 |
|
35311 | var running = true;
|
35312 | var periodicallyCheckWidthAndHeight = function () {
|
35313 | if (running) {
|
35314 | var newWidth = offsetWidth(element);
|
35315 | var newHeight = offsetHeight(element);
|
35316 | var changed = newWidth !== widthLastTime || newHeight !== heightLastTime;
|
35317 | if (changed) {
|
35318 | widthLastTime = newWidth;
|
35319 | heightLastTime = newHeight;
|
35320 | callback();
|
35321 | }
|
35322 | _this.doNextPolyfillTurn(periodicallyCheckWidthAndHeight);
|
35323 | }
|
35324 | };
|
35325 | periodicallyCheckWidthAndHeight();
|
35326 |
|
35327 | return function () { return running = false; };
|
35328 | };
|
35329 | var suppressResize = this.gridOptionsService.is('suppressBrowserResizeObserver');
|
35330 | var resizeObserverExists = !!win.ResizeObserver;
|
35331 | if (resizeObserverExists && !suppressResize) {
|
35332 | return useBrowserResizeObserver();
|
35333 | }
|
35334 | return usePolyfill();
|
35335 | };
|
35336 | ResizeObserverService.prototype.doNextPolyfillTurn = function (func) {
|
35337 | this.polyfillFunctions.push(func);
|
35338 | this.schedulePolyfill();
|
35339 | };
|
35340 | ResizeObserverService.prototype.schedulePolyfill = function () {
|
35341 | var _this = this;
|
35342 | if (this.polyfillScheduled) {
|
35343 | return;
|
35344 | }
|
35345 | var executeAllFuncs = function () {
|
35346 | var funcs = _this.polyfillFunctions;
|
35347 |
|
35348 |
|
35349 | _this.polyfillScheduled = false;
|
35350 | _this.polyfillFunctions = [];
|
35351 | funcs.forEach(function (f) { return f(); });
|
35352 | };
|
35353 | this.polyfillScheduled = true;
|
35354 | this.getFrameworkOverrides().setTimeout(executeAllFuncs, DEBOUNCE_DELAY);
|
35355 | };
|
35356 | ResizeObserverService = __decorate$17([
|
35357 | Bean('resizeObserverService')
|
35358 | ], ResizeObserverService);
|
35359 | return ResizeObserverService;
|
35360 | }(BeanStub));
|
35361 |
|
35362 |
|
35363 |
|
35364 |
|
35365 |
|
35366 |
|
35367 |
|
35368 | var __extends$19 = (undefined && undefined.__extends) || (function () {
|
35369 | var extendStatics = function (d, b) {
|
35370 | extendStatics = Object.setPrototypeOf ||
|
35371 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
35372 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
35373 | return extendStatics(d, b);
|
35374 | };
|
35375 | return function (d, b) {
|
35376 | extendStatics(d, b);
|
35377 | function __() { this.constructor = d; }
|
35378 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
35379 | };
|
35380 | })();
|
35381 | var __decorate$16 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
35382 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
35383 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
35384 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
35385 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
35386 | };
|
35387 | var AnimationFrameService = (function (_super) {
|
35388 | __extends$19(AnimationFrameService, _super);
|
35389 | function AnimationFrameService() {
|
35390 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
35391 |
|
35392 |
|
35393 |
|
35394 | _this.createTasksP1 = { list: [], sorted: false };
|
35395 | _this.createTasksP2 = { list: [], sorted: false };
|
35396 |
|
35397 |
|
35398 |
|
35399 | _this.destroyTasks = [];
|
35400 | _this.ticking = false;
|
35401 |
|
35402 |
|
35403 | _this.scrollGoingDown = true;
|
35404 | _this.lastPage = 0;
|
35405 | _this.lastScrollTop = 0;
|
35406 | _this.taskCount = 0;
|
35407 | _this.cancelledTasks = new Set();
|
35408 | return _this;
|
35409 | }
|
35410 | AnimationFrameService.prototype.setScrollTop = function (scrollTop) {
|
35411 | var isPaginationActive = this.gridOptionsService.is('pagination');
|
35412 | this.scrollGoingDown = scrollTop >= this.lastScrollTop;
|
35413 | if (isPaginationActive && scrollTop === 0) {
|
35414 | var currentPage = this.paginationProxy.getCurrentPage();
|
35415 | if (currentPage !== this.lastPage) {
|
35416 | this.lastPage = currentPage;
|
35417 | this.scrollGoingDown = true;
|
35418 | }
|
35419 | }
|
35420 | this.lastScrollTop = scrollTop;
|
35421 | };
|
35422 | AnimationFrameService.prototype.init = function () {
|
35423 | this.useAnimationFrame = !this.gridOptionsService.is('suppressAnimationFrame');
|
35424 | };
|
35425 | AnimationFrameService.prototype.isOn = function () {
|
35426 | return this.useAnimationFrame;
|
35427 | };
|
35428 |
|
35429 |
|
35430 |
|
35431 |
|
35432 | AnimationFrameService.prototype.verifyAnimationFrameOn = function (methodName) {
|
35433 | if (this.useAnimationFrame === false) {
|
35434 | console.warn("AG Grid: AnimationFrameService." + methodName + " called but animation frames are off");
|
35435 | }
|
35436 | };
|
35437 | AnimationFrameService.prototype.createTask = function (task, index, list) {
|
35438 | this.verifyAnimationFrameOn(list);
|
35439 | var taskItem = { task: task, index: index, createOrder: ++this.taskCount };
|
35440 | this.addTaskToList(this[list], taskItem);
|
35441 | this.schedule();
|
35442 | };
|
35443 | AnimationFrameService.prototype.cancelTask = function (task) {
|
35444 | this.cancelledTasks.add(task);
|
35445 | };
|
35446 | AnimationFrameService.prototype.addTaskToList = function (taskList, task) {
|
35447 | taskList.list.push(task);
|
35448 | taskList.sorted = false;
|
35449 | };
|
35450 | AnimationFrameService.prototype.sortTaskList = function (taskList) {
|
35451 | if (taskList.sorted) {
|
35452 | return;
|
35453 | }
|
35454 | var sortDirection = this.scrollGoingDown ? 1 : -1;
|
35455 |
|
35456 |
|
35457 | taskList.list.sort(function (a, b) { return a.index !== b.index ? sortDirection * (b.index - a.index) : b.createOrder - a.createOrder; });
|
35458 | taskList.sorted = true;
|
35459 | };
|
35460 | AnimationFrameService.prototype.addDestroyTask = function (task) {
|
35461 | this.verifyAnimationFrameOn('createTasksP3');
|
35462 | this.destroyTasks.push(task);
|
35463 | this.schedule();
|
35464 | };
|
35465 | AnimationFrameService.prototype.executeFrame = function (millis) {
|
35466 | this.verifyAnimationFrameOn('executeFrame');
|
35467 | var p1TaskList = this.createTasksP1;
|
35468 | var p1Tasks = p1TaskList.list;
|
35469 | var p2TaskList = this.createTasksP2;
|
35470 | var p2Tasks = p2TaskList.list;
|
35471 | var destroyTasks = this.destroyTasks;
|
35472 | var frameStart = new Date().getTime();
|
35473 | var duration = (new Date().getTime()) - frameStart;
|
35474 |
|
35475 | var noMaxMillis = millis <= 0;
|
35476 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
35477 | while (noMaxMillis || duration < millis) {
|
35478 | var gridBodyDidSomething = gridBodyCon.getScrollFeature().scrollGridIfNeeded();
|
35479 | if (!gridBodyDidSomething) {
|
35480 | var task = void 0;
|
35481 | if (p1Tasks.length) {
|
35482 | this.sortTaskList(p1TaskList);
|
35483 | task = p1Tasks.pop().task;
|
35484 | }
|
35485 | else if (p2Tasks.length) {
|
35486 | this.sortTaskList(p2TaskList);
|
35487 | task = p2Tasks.pop().task;
|
35488 | }
|
35489 | else if (destroyTasks.length) {
|
35490 | task = destroyTasks.pop();
|
35491 | }
|
35492 | else {
|
35493 | this.cancelledTasks.clear();
|
35494 | break;
|
35495 | }
|
35496 | if (!this.cancelledTasks.has(task)) {
|
35497 | task();
|
35498 | }
|
35499 | }
|
35500 | duration = (new Date().getTime()) - frameStart;
|
35501 | }
|
35502 | if (p1Tasks.length || p2Tasks.length || destroyTasks.length) {
|
35503 | this.requestFrame();
|
35504 | }
|
35505 | else {
|
35506 | this.stopTicking();
|
35507 | }
|
35508 | };
|
35509 | AnimationFrameService.prototype.stopTicking = function () {
|
35510 | this.ticking = false;
|
35511 | };
|
35512 | AnimationFrameService.prototype.flushAllFrames = function () {
|
35513 | if (!this.useAnimationFrame) {
|
35514 | return;
|
35515 | }
|
35516 | this.executeFrame(-1);
|
35517 | };
|
35518 | AnimationFrameService.prototype.schedule = function () {
|
35519 | if (!this.useAnimationFrame) {
|
35520 | return;
|
35521 | }
|
35522 | if (!this.ticking) {
|
35523 | this.ticking = true;
|
35524 | this.requestFrame();
|
35525 | }
|
35526 | };
|
35527 | AnimationFrameService.prototype.requestFrame = function () {
|
35528 |
|
35529 |
|
35530 | var callback = this.executeFrame.bind(this, 60);
|
35531 | var eDocument = this.gridOptionsService.getDocument();
|
35532 | var win = (eDocument.defaultView || window);
|
35533 | if (win.requestAnimationFrame) {
|
35534 | win.requestAnimationFrame(callback);
|
35535 | }
|
35536 | else if (win.webkitRequestAnimationFrame) {
|
35537 | win.webkitRequestAnimationFrame(callback);
|
35538 | }
|
35539 | else {
|
35540 | win.setTimeout(callback, 0);
|
35541 | }
|
35542 | };
|
35543 | AnimationFrameService.prototype.isQueueEmpty = function () {
|
35544 | return !this.ticking;
|
35545 | };
|
35546 |
|
35547 |
|
35548 |
|
35549 |
|
35550 | AnimationFrameService.prototype.debounce = function (func) {
|
35551 | var _this = this;
|
35552 | var pending = false;
|
35553 | return function () {
|
35554 | if (!_this.isOn()) {
|
35555 | _this.getFrameworkOverrides().setTimeout(func, 0);
|
35556 | return;
|
35557 | }
|
35558 | if (pending) {
|
35559 | return;
|
35560 | }
|
35561 | pending = true;
|
35562 | _this.addDestroyTask(function () {
|
35563 | pending = false;
|
35564 | func();
|
35565 | });
|
35566 | };
|
35567 | };
|
35568 | __decorate$16([
|
35569 | Autowired('ctrlsService')
|
35570 | ], AnimationFrameService.prototype, "ctrlsService", void 0);
|
35571 | __decorate$16([
|
35572 | Autowired('paginationProxy')
|
35573 | ], AnimationFrameService.prototype, "paginationProxy", void 0);
|
35574 | __decorate$16([
|
35575 | PostConstruct
|
35576 | ], AnimationFrameService.prototype, "init", null);
|
35577 | AnimationFrameService = __decorate$16([
|
35578 | Bean('animationFrameService')
|
35579 | ], AnimationFrameService);
|
35580 | return AnimationFrameService;
|
35581 | }(BeanStub));
|
35582 |
|
35583 |
|
35584 |
|
35585 |
|
35586 |
|
35587 |
|
35588 |
|
35589 | var __extends$18 = (undefined && undefined.__extends) || (function () {
|
35590 | var extendStatics = function (d, b) {
|
35591 | extendStatics = Object.setPrototypeOf ||
|
35592 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
35593 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
35594 | return extendStatics(d, b);
|
35595 | };
|
35596 | return function (d, b) {
|
35597 | extendStatics(d, b);
|
35598 | function __() { this.constructor = d; }
|
35599 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
35600 | };
|
35601 | })();
|
35602 | var __decorate$15 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
35603 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
35604 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
35605 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
35606 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
35607 | };
|
35608 | var AutoWidthCalculator = (function (_super) {
|
35609 | __extends$18(AutoWidthCalculator, _super);
|
35610 | function AutoWidthCalculator() {
|
35611 | return _super !== null && _super.apply(this, arguments) || this;
|
35612 | }
|
35613 | AutoWidthCalculator.prototype.postConstruct = function () {
|
35614 | var _this = this;
|
35615 | this.ctrlsService.whenReady(function (p) {
|
35616 | _this.centerRowContainerCtrl = p.centerRowContainerCtrl;
|
35617 | });
|
35618 | };
|
35619 |
|
35620 |
|
35621 |
|
35622 |
|
35623 | AutoWidthCalculator.prototype.getPreferredWidthForColumn = function (column, skipHeader) {
|
35624 | var eHeaderCell = this.getHeaderCellForColumn(column);
|
35625 |
|
35626 | if (!eHeaderCell) {
|
35627 | return -1;
|
35628 | }
|
35629 | var elements = this.rowRenderer.getAllCellsForColumn(column);
|
35630 | if (!skipHeader) {
|
35631 |
|
35632 |
|
35633 |
|
35634 | elements.push(eHeaderCell);
|
35635 | }
|
35636 | return this.addElementsToContainerAndGetWidth(elements);
|
35637 | };
|
35638 | AutoWidthCalculator.prototype.getPreferredWidthForColumnGroup = function (columnGroup) {
|
35639 | var eHeaderCell = this.getHeaderCellForColumn(columnGroup);
|
35640 | if (!eHeaderCell) {
|
35641 | return -1;
|
35642 | }
|
35643 | return this.addElementsToContainerAndGetWidth([eHeaderCell]);
|
35644 | };
|
35645 | AutoWidthCalculator.prototype.addElementsToContainerAndGetWidth = function (elements) {
|
35646 | var _this = this;
|
35647 |
|
35648 |
|
35649 |
|
35650 | var eDummyContainer = document.createElement('form');
|
35651 |
|
35652 | eDummyContainer.style.position = 'fixed';
|
35653 |
|
35654 |
|
35655 | var eBodyContainer = this.centerRowContainerCtrl.getContainerElement();
|
35656 | eBodyContainer.appendChild(eDummyContainer);
|
35657 | elements.forEach(function (el) { return _this.cloneItemIntoDummy(el, eDummyContainer); });
|
35658 |
|
35659 |
|
35660 | var dummyContainerWidth = eDummyContainer.offsetWidth;
|
35661 |
|
35662 | eBodyContainer.removeChild(eDummyContainer);
|
35663 |
|
35664 |
|
35665 | var autoSizePadding = this.getAutoSizePadding();
|
35666 | return dummyContainerWidth + autoSizePadding;
|
35667 | };
|
35668 | AutoWidthCalculator.prototype.getAutoSizePadding = function () {
|
35669 | var value = this.gridOptionsService.getNum('autoSizePadding');
|
35670 | return value != null && value >= 0 ? value : 20;
|
35671 | };
|
35672 | AutoWidthCalculator.prototype.getHeaderCellForColumn = function (column) {
|
35673 |
|
35674 | var element = null;
|
35675 | this.ctrlsService.getHeaderRowContainerCtrls().forEach(function (container) {
|
35676 | var res = container.getHtmlElementForColumnHeader(column);
|
35677 | if (res != null) {
|
35678 | element = res;
|
35679 | }
|
35680 | });
|
35681 | return element;
|
35682 | };
|
35683 | AutoWidthCalculator.prototype.cloneItemIntoDummy = function (eCell, eDummyContainer) {
|
35684 |
|
35685 | var eCellClone = eCell.cloneNode(true);
|
35686 |
|
35687 | eCellClone.style.width = '';
|
35688 |
|
35689 | eCellClone.style.position = 'static';
|
35690 | eCellClone.style.left = '';
|
35691 |
|
35692 |
|
35693 |
|
35694 | var eCloneParent = document.createElement('div');
|
35695 | var eCloneParentClassList = eCloneParent.classList;
|
35696 | var isHeader = ['ag-header-cell', 'ag-header-group-cell'].some(function (cls) { return eCellClone.classList.contains(cls); });
|
35697 | if (isHeader) {
|
35698 | eCloneParentClassList.add('ag-header', 'ag-header-row');
|
35699 | eCloneParent.style.position = 'static';
|
35700 | }
|
35701 | else {
|
35702 | eCloneParentClassList.add('ag-row');
|
35703 | }
|
35704 |
|
35705 |
|
35706 |
|
35707 | var pointer = eCell.parentElement;
|
35708 | while (pointer) {
|
35709 | var isRow = ['ag-header-row', 'ag-row'].some(function (cls) { return pointer.classList.contains(cls); });
|
35710 | if (isRow) {
|
35711 | for (var i = 0; i < pointer.classList.length; i++) {
|
35712 | var item = pointer.classList[i];
|
35713 |
|
35714 |
|
35715 |
|
35716 | if (item != 'ag-row-position-absolute') {
|
35717 | eCloneParentClassList.add(item);
|
35718 | }
|
35719 | }
|
35720 | break;
|
35721 | }
|
35722 | pointer = pointer.parentElement;
|
35723 | }
|
35724 |
|
35725 |
|
35726 |
|
35727 | eCloneParent.appendChild(eCellClone);
|
35728 | eDummyContainer.appendChild(eCloneParent);
|
35729 | };
|
35730 | __decorate$15([
|
35731 | Autowired('rowRenderer')
|
35732 | ], AutoWidthCalculator.prototype, "rowRenderer", void 0);
|
35733 | __decorate$15([
|
35734 | Autowired('ctrlsService')
|
35735 | ], AutoWidthCalculator.prototype, "ctrlsService", void 0);
|
35736 | __decorate$15([
|
35737 | Autowired('rowCssClassCalculator')
|
35738 | ], AutoWidthCalculator.prototype, "rowCssClassCalculator", void 0);
|
35739 | __decorate$15([
|
35740 | PostConstruct
|
35741 | ], AutoWidthCalculator.prototype, "postConstruct", null);
|
35742 | AutoWidthCalculator = __decorate$15([
|
35743 | Bean('autoWidthCalculator')
|
35744 | ], AutoWidthCalculator);
|
35745 | return AutoWidthCalculator;
|
35746 | }(BeanStub));
|
35747 |
|
35748 |
|
35749 |
|
35750 |
|
35751 |
|
35752 |
|
35753 |
|
35754 | var __extends$17 = (undefined && undefined.__extends) || (function () {
|
35755 | var extendStatics = function (d, b) {
|
35756 | extendStatics = Object.setPrototypeOf ||
|
35757 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
35758 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
35759 | return extendStatics(d, b);
|
35760 | };
|
35761 | return function (d, b) {
|
35762 | extendStatics(d, b);
|
35763 | function __() { this.constructor = d; }
|
35764 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
35765 | };
|
35766 | })();
|
35767 | var __decorate$14 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
35768 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
35769 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
35770 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
35771 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
35772 | };
|
35773 | var __values$2 = (undefined && undefined.__values) || function(o) {
|
35774 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
35775 | if (m) return m.call(o);
|
35776 | if (o && typeof o.length === "number") return {
|
35777 | next: function () {
|
35778 | if (o && i >= o.length) o = void 0;
|
35779 | return { value: o && o[i++], done: !o };
|
35780 | }
|
35781 | };
|
35782 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
35783 | };
|
35784 | var __read$e = (undefined && undefined.__read) || function (o, n) {
|
35785 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
35786 | if (!m) return o;
|
35787 | var i = m.call(o), r, ar = [], e;
|
35788 | try {
|
35789 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
35790 | }
|
35791 | catch (error) { e = { error: error }; }
|
35792 | finally {
|
35793 | try {
|
35794 | if (r && !r.done && (m = i["return"])) m.call(i);
|
35795 | }
|
35796 | finally { if (e) throw e.error; }
|
35797 | }
|
35798 | return ar;
|
35799 | };
|
35800 | var __spread$c = (undefined && undefined.__spread) || function () {
|
35801 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$e(arguments[i]));
|
35802 | return ar;
|
35803 | };
|
35804 | var StickyRowFeature = (function (_super) {
|
35805 | __extends$17(StickyRowFeature, _super);
|
35806 | function StickyRowFeature(createRowCon, destroyRowCtrls) {
|
35807 | var _this = _super.call(this) || this;
|
35808 | _this.createRowCon = createRowCon;
|
35809 | _this.destroyRowCtrls = destroyRowCtrls;
|
35810 | _this.stickyRowCtrls = [];
|
35811 | _this.containerHeight = 0;
|
35812 | return _this;
|
35813 | }
|
35814 | StickyRowFeature.prototype.postConstruct = function () {
|
35815 | var _this = this;
|
35816 | this.ctrlsService.whenReady(function (params) {
|
35817 | _this.gridBodyCtrl = params.gridBodyCtrl;
|
35818 | });
|
35819 | };
|
35820 | StickyRowFeature.prototype.getStickyRowCtrls = function () {
|
35821 | return this.stickyRowCtrls;
|
35822 | };
|
35823 | StickyRowFeature.prototype.checkStickyRows = function () {
|
35824 | var height = 0;
|
35825 | if (!this.gridOptionsService.is('groupRowsSticky')) {
|
35826 | this.refreshNodesAndContainerHeight([], height);
|
35827 | return;
|
35828 | }
|
35829 | var stickyRows = [];
|
35830 | var firstPixel = this.rowRenderer.getFirstVisibleVerticalPixel();
|
35831 | var addStickyRow = function (stickyRow) {
|
35832 | stickyRows.push(stickyRow);
|
35833 | var lastAncester = stickyRow;
|
35834 | while (lastAncester.expanded) {
|
35835 | lastAncester = last(lastAncester.childrenAfterSort);
|
35836 | }
|
35837 | var lastChildBottom = lastAncester.rowTop + lastAncester.rowHeight;
|
35838 | var stickRowBottom = firstPixel + height + stickyRow.rowHeight;
|
35839 | if (lastChildBottom < stickRowBottom) {
|
35840 | stickyRow.stickyRowTop = height + (lastChildBottom - stickRowBottom);
|
35841 | }
|
35842 | else {
|
35843 | stickyRow.stickyRowTop = height;
|
35844 | }
|
35845 | height = 0;
|
35846 | stickyRows.forEach(function (rowNode) {
|
35847 | var thisRowLastPx = rowNode.stickyRowTop + rowNode.rowHeight;
|
35848 | if (height < thisRowLastPx) {
|
35849 | height = thisRowLastPx;
|
35850 | }
|
35851 | });
|
35852 | };
|
35853 | while (true) {
|
35854 | var firstPixelAfterStickyRows = firstPixel + height;
|
35855 | var firstIndex = this.rowModel.getRowIndexAtPixel(firstPixelAfterStickyRows);
|
35856 | var firstRow = this.rowModel.getRow(firstIndex);
|
35857 | if (firstRow == null) {
|
35858 | break;
|
35859 | }
|
35860 |
|
35861 | if (firstRow.level < 0) {
|
35862 | break;
|
35863 | }
|
35864 | var parents = [];
|
35865 | var p = firstRow.parent;
|
35866 | while (p.level >= 0) {
|
35867 | parents.push(p);
|
35868 | p = p.parent;
|
35869 | }
|
35870 | var firstMissingParent = parents.reverse().find(function (parent) { return stickyRows.indexOf(parent) < 0 && parent.displayed; });
|
35871 | if (firstMissingParent) {
|
35872 | addStickyRow(firstMissingParent);
|
35873 | continue;
|
35874 | }
|
35875 |
|
35876 |
|
35877 | if (firstRow.group && firstRow.expanded && !firstRow.footer && firstRow.rowTop < firstPixelAfterStickyRows) {
|
35878 | addStickyRow(firstRow);
|
35879 | continue;
|
35880 | }
|
35881 | break;
|
35882 | }
|
35883 | this.refreshNodesAndContainerHeight(stickyRows, height);
|
35884 | };
|
35885 | StickyRowFeature.prototype.refreshNodesAndContainerHeight = function (allStickyNodes, height) {
|
35886 | var e_1, _a, _b;
|
35887 | var _this = this;
|
35888 | var removedCtrls = this.stickyRowCtrls.filter(function (ctrl) { return allStickyNodes.indexOf(ctrl.getRowNode()) === -1; });
|
35889 | var addedNodes = allStickyNodes.filter(function (rowNode) { return _this.stickyRowCtrls.findIndex(function (ctrl) { return ctrl.getRowNode() === rowNode; }) === -1; });
|
35890 | var ctrlsToDestroy = {};
|
35891 | removedCtrls.forEach(function (removedCtrl) {
|
35892 | ctrlsToDestroy[removedCtrl.getRowNode().id] = removedCtrl;
|
35893 | _this.stickyRowCtrls = _this.stickyRowCtrls.filter(function (ctrl) { return ctrl !== removedCtrl; });
|
35894 | });
|
35895 | try {
|
35896 | for (var _c = __values$2(Object.values(ctrlsToDestroy)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
35897 | var ctrl = _d.value;
|
35898 | ctrl.getRowNode().sticky = false;
|
35899 | }
|
35900 | }
|
35901 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
35902 | finally {
|
35903 | try {
|
35904 | if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
35905 | }
|
35906 | finally { if (e_1) throw e_1.error; }
|
35907 | }
|
35908 | this.destroyRowCtrls(ctrlsToDestroy, false);
|
35909 | var newCtrls = addedNodes.map(function (rowNode) {
|
35910 | rowNode.sticky = true;
|
35911 | return _this.createRowCon(rowNode, false, false);
|
35912 | });
|
35913 | (_b = this.stickyRowCtrls).push.apply(_b, __spread$c(newCtrls));
|
35914 | this.stickyRowCtrls.forEach(function (ctrl) { return ctrl.setRowTop(ctrl.getRowNode().stickyRowTop); });
|
35915 | this.stickyRowCtrls.sort(function (a, b) { return b.getRowNode().rowIndex - a.getRowNode().rowIndex; });
|
35916 | if (this.containerHeight !== height) {
|
35917 | this.containerHeight = height;
|
35918 | this.gridBodyCtrl.setStickyTopHeight(height);
|
35919 | }
|
35920 | };
|
35921 | __decorate$14([
|
35922 | Autowired("rowModel")
|
35923 | ], StickyRowFeature.prototype, "rowModel", void 0);
|
35924 | __decorate$14([
|
35925 | Autowired("rowRenderer")
|
35926 | ], StickyRowFeature.prototype, "rowRenderer", void 0);
|
35927 | __decorate$14([
|
35928 | Autowired("ctrlsService")
|
35929 | ], StickyRowFeature.prototype, "ctrlsService", void 0);
|
35930 | __decorate$14([
|
35931 | PostConstruct
|
35932 | ], StickyRowFeature.prototype, "postConstruct", null);
|
35933 | return StickyRowFeature;
|
35934 | }(BeanStub));
|
35935 |
|
35936 |
|
35937 |
|
35938 |
|
35939 |
|
35940 |
|
35941 |
|
35942 | var __extends$16 = (undefined && undefined.__extends) || (function () {
|
35943 | var extendStatics = function (d, b) {
|
35944 | extendStatics = Object.setPrototypeOf ||
|
35945 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
35946 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
35947 | return extendStatics(d, b);
|
35948 | };
|
35949 | return function (d, b) {
|
35950 | extendStatics(d, b);
|
35951 | function __() { this.constructor = d; }
|
35952 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
35953 | };
|
35954 | })();
|
35955 | var __decorate$13 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
35956 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
35957 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
35958 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
35959 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
35960 | };
|
35961 | var __read$d = (undefined && undefined.__read) || function (o, n) {
|
35962 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
35963 | if (!m) return o;
|
35964 | var i = m.call(o), r, ar = [], e;
|
35965 | try {
|
35966 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
35967 | }
|
35968 | catch (error) { e = { error: error }; }
|
35969 | finally {
|
35970 | try {
|
35971 | if (r && !r.done && (m = i["return"])) m.call(i);
|
35972 | }
|
35973 | finally { if (e) throw e.error; }
|
35974 | }
|
35975 | return ar;
|
35976 | };
|
35977 | var __spread$b = (undefined && undefined.__spread) || function () {
|
35978 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$d(arguments[i]));
|
35979 | return ar;
|
35980 | };
|
35981 | var __values$1 = (undefined && undefined.__values) || function(o) {
|
35982 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
35983 | if (m) return m.call(o);
|
35984 | if (o && typeof o.length === "number") return {
|
35985 | next: function () {
|
35986 | if (o && i >= o.length) o = void 0;
|
35987 | return { value: o && o[i++], done: !o };
|
35988 | }
|
35989 | };
|
35990 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
35991 | };
|
35992 | var DEFAULT_KEEP_DETAIL_ROW_COUNT = 10;
|
35993 | var RowRenderer = (function (_super) {
|
35994 | __extends$16(RowRenderer, _super);
|
35995 | function RowRenderer() {
|
35996 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
35997 | _this.destroyFuncsForColumnListeners = [];
|
35998 |
|
35999 |
|
36000 | _this.rowCtrlsByRowIndex = {};
|
36001 | _this.zombieRowCtrls = {};
|
36002 | _this.allRowCtrls = [];
|
36003 | _this.topRowCtrls = [];
|
36004 | _this.bottomRowCtrls = [];
|
36005 |
|
36006 |
|
36007 |
|
36008 |
|
36009 | _this.refreshInProgress = false;
|
36010 | _this.dataFirstRenderedFired = false;
|
36011 | return _this;
|
36012 | }
|
36013 | RowRenderer.prototype.postConstruct = function () {
|
36014 | var _this = this;
|
36015 | this.ctrlsService.whenReady(function () {
|
36016 | _this.gridBodyCtrl = _this.ctrlsService.getGridBodyCtrl();
|
36017 | _this.initialise();
|
36018 | });
|
36019 | };
|
36020 | RowRenderer.prototype.initialise = function () {
|
36021 | this.addManagedListener(this.eventService, Events.EVENT_PAGINATION_CHANGED, this.onPageLoaded.bind(this));
|
36022 | this.addManagedListener(this.eventService, Events.EVENT_PINNED_ROW_DATA_CHANGED, this.onPinnedRowDataChanged.bind(this));
|
36023 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
|
36024 | this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, this.onBodyScroll.bind(this));
|
36025 | this.addManagedListener(this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, this.redrawAfterScroll.bind(this));
|
36026 | this.addManagedPropertyListener('domLayout', this.onDomLayoutChanged.bind(this));
|
36027 | this.addManagedPropertyListener('rowClass', this.redrawRows.bind(this));
|
36028 | if (this.gridOptionsService.is('groupRowsSticky')) {
|
36029 | if (this.rowModel.getType() != 'clientSide') {
|
36030 | doOnce(function () { return console.warn('AG Grid: The feature Sticky Row Groups only works with the Client Side Row Model'); }, 'rowRenderer.stickyWorksWithCsrmOnly');
|
36031 | }
|
36032 | else if (this.gridOptionsService.isTreeData()) {
|
36033 | doOnce(function () { return console.warn('AG Grid: The feature Sticky Row Groups does not work with Tree Data.'); }, 'rowRenderer.stickyDoesNotWorkWithTreeData');
|
36034 | }
|
36035 | else {
|
36036 | this.stickyRowFeature = this.createManagedBean(new StickyRowFeature(this.createRowCon.bind(this), this.destroyRowCtrls.bind(this)));
|
36037 | }
|
36038 | }
|
36039 | this.registerCellEventListeners();
|
36040 | this.initialiseCache();
|
36041 | this.printLayout = this.gridOptionsService.isDomLayout('print');
|
36042 | this.embedFullWidthRows = this.printLayout || this.gridOptionsService.is('embedFullWidthRows');
|
36043 | this.redrawAfterModelUpdate();
|
36044 | };
|
36045 | RowRenderer.prototype.initialiseCache = function () {
|
36046 | if (this.gridOptionsService.is('keepDetailRows')) {
|
36047 | var countProp = this.getKeepDetailRowsCount();
|
36048 | var count = countProp != null ? countProp : 3;
|
36049 | this.cachedRowCtrls = new RowCtrlCache(count);
|
36050 | }
|
36051 | };
|
36052 | RowRenderer.prototype.getKeepDetailRowsCount = function () {
|
36053 | var keepDetailRowsCount = this.gridOptionsService.getNum('keepDetailRowsCount');
|
36054 | if (exists(keepDetailRowsCount) && keepDetailRowsCount > 0) {
|
36055 | return keepDetailRowsCount;
|
36056 | }
|
36057 | return DEFAULT_KEEP_DETAIL_ROW_COUNT;
|
36058 | };
|
36059 | RowRenderer.prototype.getRowCtrls = function () {
|
36060 | return this.allRowCtrls;
|
36061 | };
|
36062 | RowRenderer.prototype.getStickyTopRowCtrls = function () {
|
36063 | if (!this.stickyRowFeature) {
|
36064 | return [];
|
36065 | }
|
36066 | return this.stickyRowFeature.getStickyRowCtrls();
|
36067 | };
|
36068 | RowRenderer.prototype.updateAllRowCtrls = function () {
|
36069 | var liveList = getAllValuesInObject(this.rowCtrlsByRowIndex);
|
36070 | var isEnsureDomOrder = this.gridOptionsService.is('ensureDomOrder');
|
36071 | var isPrintLayout = this.gridOptionsService.isDomLayout('print');
|
36072 | if (isEnsureDomOrder || isPrintLayout) {
|
36073 | liveList.sort(function (a, b) { return a.getRowNode().rowIndex - b.getRowNode.rowIndex; });
|
36074 | }
|
36075 | var zombieList = getAllValuesInObject(this.zombieRowCtrls);
|
36076 | var cachedList = this.cachedRowCtrls ? this.cachedRowCtrls.getEntries() : [];
|
36077 | this.allRowCtrls = __spread$b(liveList, zombieList, cachedList);
|
36078 | };
|
36079 | RowRenderer.prototype.onCellFocusChanged = function (event) {
|
36080 | this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onCellFocused(event); });
|
36081 | this.getFullWidthRowCtrls().forEach(function (rowCtrl) { return rowCtrl.onFullWidthRowFocused(event); });
|
36082 | };
|
36083 |
|
36084 |
|
36085 |
|
36086 | RowRenderer.prototype.registerCellEventListeners = function () {
|
36087 | var _this = this;
|
36088 | this.addManagedListener(this.eventService, Events.EVENT_CELL_FOCUSED, function (event) {
|
36089 | _this.onCellFocusChanged(event);
|
36090 | });
|
36091 | this.addManagedListener(this.eventService, Events.EVENT_CELL_FOCUS_CLEARED, function () {
|
36092 | _this.onCellFocusChanged();
|
36093 | });
|
36094 | this.addManagedListener(this.eventService, Events.EVENT_FLASH_CELLS, function (event) {
|
36095 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onFlashCells(event); });
|
36096 | });
|
36097 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, function () {
|
36098 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onColumnHover(); });
|
36099 | });
|
36100 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, function () {
|
36101 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onDisplayedColumnsChanged(); });
|
36102 | });
|
36103 |
|
36104 |
|
36105 |
|
36106 |
|
36107 |
|
36108 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, function () {
|
36109 | if (_this.printLayout) {
|
36110 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onLeftChanged(); });
|
36111 | }
|
36112 | });
|
36113 | var rangeSelectionEnabled = this.gridOptionsService.isEnableRangeSelection();
|
36114 | if (rangeSelectionEnabled) {
|
36115 | this.addManagedListener(this.eventService, Events.EVENT_RANGE_SELECTION_CHANGED, function () {
|
36116 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onRangeSelectionChanged(); });
|
36117 | });
|
36118 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, function () {
|
36119 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.updateRangeBordersIfRangeCount(); });
|
36120 | });
|
36121 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, function () {
|
36122 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.updateRangeBordersIfRangeCount(); });
|
36123 | });
|
36124 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, function () {
|
36125 | _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.updateRangeBordersIfRangeCount(); });
|
36126 | });
|
36127 | }
|
36128 |
|
36129 | this.refreshListenersToColumnsForCellComps();
|
36130 |
|
36131 | this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.refreshListenersToColumnsForCellComps.bind(this));
|
36132 | this.addDestroyFunc(this.removeGridColumnListeners.bind(this));
|
36133 | };
|
36134 |
|
36135 | RowRenderer.prototype.removeGridColumnListeners = function () {
|
36136 | this.destroyFuncsForColumnListeners.forEach(function (func) { return func(); });
|
36137 | this.destroyFuncsForColumnListeners.length = 0;
|
36138 | };
|
36139 |
|
36140 |
|
36141 |
|
36142 |
|
36143 | RowRenderer.prototype.refreshListenersToColumnsForCellComps = function () {
|
36144 | var _this = this;
|
36145 | this.removeGridColumnListeners();
|
36146 | var cols = this.columnModel.getAllGridColumns();
|
36147 | if (!cols) {
|
36148 | return;
|
36149 | }
|
36150 | cols.forEach(function (col) {
|
36151 | var forEachCellWithThisCol = function (callback) {
|
36152 | _this.getAllCellCtrls().forEach(function (cellCtrl) {
|
36153 | if (cellCtrl.getColumn() === col) {
|
36154 | callback(cellCtrl);
|
36155 | }
|
36156 | });
|
36157 | };
|
36158 | var leftChangedListener = function () {
|
36159 | forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onLeftChanged(); });
|
36160 | };
|
36161 | var widthChangedListener = function () {
|
36162 | forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onWidthChanged(); });
|
36163 | };
|
36164 | var firstRightPinnedChangedListener = function () {
|
36165 | forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onFirstRightPinnedChanged(); });
|
36166 | };
|
36167 | var lastLeftPinnedChangedListener = function () {
|
36168 | forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onLastLeftPinnedChanged(); });
|
36169 | };
|
36170 | var colDefChangedListener = function () {
|
36171 | forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onColDefChanged(); });
|
36172 | };
|
36173 | col.addEventListener('leftChanged', leftChangedListener);
|
36174 | col.addEventListener('widthChanged', widthChangedListener);
|
36175 | col.addEventListener('firstRightPinnedChanged', firstRightPinnedChangedListener);
|
36176 | col.addEventListener('lastLeftPinnedChanged', lastLeftPinnedChangedListener);
|
36177 | col.addEventListener('colDefChanged', colDefChangedListener);
|
36178 | _this.destroyFuncsForColumnListeners.push(function () {
|
36179 | col.removeEventListener('leftChanged', leftChangedListener);
|
36180 | col.removeEventListener('widthChanged', widthChangedListener);
|
36181 | col.removeEventListener('firstRightPinnedChanged', firstRightPinnedChangedListener);
|
36182 | col.removeEventListener('lastLeftPinnedChanged', lastLeftPinnedChangedListener);
|
36183 | col.removeEventListener('colDefChanged', colDefChangedListener);
|
36184 | });
|
36185 | });
|
36186 | };
|
36187 | RowRenderer.prototype.onDomLayoutChanged = function () {
|
36188 | var printLayout = this.gridOptionsService.isDomLayout('print');
|
36189 | var embedFullWidthRows = printLayout || this.gridOptionsService.is('embedFullWidthRows');
|
36190 |
|
36191 |
|
36192 | var destroyRows = embedFullWidthRows !== this.embedFullWidthRows || this.printLayout !== printLayout;
|
36193 | this.printLayout = printLayout;
|
36194 | this.embedFullWidthRows = embedFullWidthRows;
|
36195 | if (destroyRows) {
|
36196 | this.redrawAfterModelUpdate({ domLayoutChanged: true });
|
36197 | }
|
36198 | };
|
36199 |
|
36200 |
|
36201 | RowRenderer.prototype.datasourceChanged = function () {
|
36202 | this.firstRenderedRow = 0;
|
36203 | this.lastRenderedRow = -1;
|
36204 | var rowIndexesToRemove = Object.keys(this.rowCtrlsByRowIndex);
|
36205 | this.removeRowCtrls(rowIndexesToRemove);
|
36206 | };
|
36207 | RowRenderer.prototype.onPageLoaded = function (event) {
|
36208 | var params = {
|
36209 | recycleRows: event.keepRenderedRows,
|
36210 | animate: event.animate,
|
36211 | newData: event.newData,
|
36212 | newPage: event.newPage,
|
36213 |
|
36214 |
|
36215 |
|
36216 |
|
36217 | onlyBody: true
|
36218 | };
|
36219 | this.redrawAfterModelUpdate(params);
|
36220 | };
|
36221 | RowRenderer.prototype.getAllCellsForColumn = function (column) {
|
36222 | var res = [];
|
36223 | this.getAllRowCtrls().forEach(function (rowCtrl) {
|
36224 | var eCell = rowCtrl.getCellElement(column);
|
36225 | if (eCell) {
|
36226 | res.push(eCell);
|
36227 | }
|
36228 | });
|
36229 | return res;
|
36230 | };
|
36231 | RowRenderer.prototype.refreshFloatingRowComps = function () {
|
36232 | this.refreshFloatingRows(this.topRowCtrls, this.pinnedRowModel.getPinnedTopRowData());
|
36233 | this.refreshFloatingRows(this.bottomRowCtrls, this.pinnedRowModel.getPinnedBottomRowData());
|
36234 | };
|
36235 | RowRenderer.prototype.getTopRowCtrls = function () {
|
36236 | return this.topRowCtrls;
|
36237 | };
|
36238 | RowRenderer.prototype.getBottomRowCtrls = function () {
|
36239 | return this.bottomRowCtrls;
|
36240 | };
|
36241 | RowRenderer.prototype.refreshFloatingRows = function (rowComps, rowNodes) {
|
36242 | var _this = this;
|
36243 | rowComps.forEach(function (row) {
|
36244 | row.destroyFirstPass();
|
36245 | row.destroySecondPass();
|
36246 | });
|
36247 | rowComps.length = 0;
|
36248 | if (!rowNodes) {
|
36249 | return;
|
36250 | }
|
36251 | rowNodes.forEach(function (rowNode) {
|
36252 | var rowCtrl = new RowCtrl(rowNode, _this.beans, false, false, _this.printLayout);
|
36253 | rowComps.push(rowCtrl);
|
36254 | });
|
36255 | };
|
36256 | RowRenderer.prototype.onPinnedRowDataChanged = function () {
|
36257 |
|
36258 | var params = {
|
36259 | recycleRows: true
|
36260 | };
|
36261 | this.redrawAfterModelUpdate(params);
|
36262 | };
|
36263 |
|
36264 | RowRenderer.prototype.getRenderedIndexesForRowNodes = function (rowNodes) {
|
36265 | var result = [];
|
36266 | if (missing(rowNodes)) {
|
36267 | return result;
|
36268 | }
|
36269 | iterateObject(this.rowCtrlsByRowIndex, function (index, renderedRow) {
|
36270 | var rowNode = renderedRow.getRowNode();
|
36271 | if (rowNodes.indexOf(rowNode) >= 0) {
|
36272 | result.push(index);
|
36273 | }
|
36274 | });
|
36275 | return result;
|
36276 | };
|
36277 | RowRenderer.prototype.redrawRows = function (rowNodes) {
|
36278 |
|
36279 | var partialRefresh = rowNodes != null && rowNodes.length > 0;
|
36280 | if (partialRefresh) {
|
36281 | var indexesToRemove = this.getRenderedIndexesForRowNodes(rowNodes);
|
36282 |
|
36283 | this.removeRowCtrls(indexesToRemove);
|
36284 | }
|
36285 |
|
36286 | this.redrawAfterModelUpdate({
|
36287 | recycleRows: partialRefresh
|
36288 | });
|
36289 | };
|
36290 | RowRenderer.prototype.getCellToRestoreFocusToAfterRefresh = function (params) {
|
36291 | var focusedCell = (params === null || params === void 0 ? void 0 : params.suppressKeepFocus) ? null : this.focusService.getFocusCellToUseAfterRefresh();
|
36292 | if (focusedCell == null) {
|
36293 | return null;
|
36294 | }
|
36295 |
|
36296 |
|
36297 |
|
36298 |
|
36299 |
|
36300 |
|
36301 | var eDocument = this.gridOptionsService.getDocument();
|
36302 | var activeElement = eDocument.activeElement;
|
36303 | var cellDomData = this.gridOptionsService.getDomData(activeElement, CellCtrl.DOM_DATA_KEY_CELL_CTRL);
|
36304 | var rowDomData = this.gridOptionsService.getDomData(activeElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL);
|
36305 | var gridElementFocused = cellDomData || rowDomData;
|
36306 | return gridElementFocused ? focusedCell : null;
|
36307 | };
|
36308 |
|
36309 |
|
36310 |
|
36311 |
|
36312 |
|
36313 |
|
36314 | RowRenderer.prototype.redrawAfterModelUpdate = function (params) {
|
36315 | if (params === void 0) { params = {}; }
|
36316 | this.getLockOnRefresh();
|
36317 | var focusedCell = this.getCellToRestoreFocusToAfterRefresh(params);
|
36318 | this.updateContainerHeights();
|
36319 | this.scrollToTopIfNewData(params);
|
36320 |
|
36321 |
|
36322 | var recycleRows = !params.domLayoutChanged && !!params.recycleRows;
|
36323 | var animate = params.animate && this.gridOptionsService.isAnimateRows();
|
36324 |
|
36325 |
|
36326 | var rowsToRecycle = recycleRows ? this.recycleRows() : null;
|
36327 | if (!recycleRows) {
|
36328 | this.removeAllRowComps();
|
36329 | }
|
36330 | this.redraw(rowsToRecycle, animate);
|
36331 | this.gridBodyCtrl.updateRowCount();
|
36332 | if (!params.onlyBody) {
|
36333 | this.refreshFloatingRowComps();
|
36334 | }
|
36335 | this.dispatchDisplayedRowsChanged();
|
36336 |
|
36337 | if (focusedCell != null) {
|
36338 | this.restoreFocusedCell(focusedCell);
|
36339 | }
|
36340 | this.releaseLockOnRefresh();
|
36341 | };
|
36342 | RowRenderer.prototype.scrollToTopIfNewData = function (params) {
|
36343 | var scrollToTop = params.newData || params.newPage;
|
36344 | var suppressScrollToTop = this.gridOptionsService.is('suppressScrollOnNewData');
|
36345 | if (scrollToTop && !suppressScrollToTop) {
|
36346 | this.gridBodyCtrl.getScrollFeature().scrollToTop();
|
36347 | }
|
36348 | };
|
36349 | RowRenderer.prototype.updateContainerHeights = function () {
|
36350 |
|
36351 | if (this.printLayout) {
|
36352 | this.rowContainerHeightService.setModelHeight(null);
|
36353 | return;
|
36354 | }
|
36355 | var containerHeight = this.paginationProxy.getCurrentPageHeight();
|
36356 |
|
36357 |
|
36358 |
|
36359 |
|
36360 |
|
36361 | if (containerHeight === 0) {
|
36362 | containerHeight = 1;
|
36363 | }
|
36364 | this.rowContainerHeightService.setModelHeight(containerHeight);
|
36365 | };
|
36366 | RowRenderer.prototype.getLockOnRefresh = function () {
|
36367 | if (this.refreshInProgress) {
|
36368 | throw new Error("AG Grid: cannot get grid to draw rows when it is in the middle of drawing rows. " +
|
36369 | "Your code probably called a grid API method while the grid was in the render stage. To overcome " +
|
36370 | "this, put the API call into a timeout, e.g. instead of api.redrawRows(), " +
|
36371 | "call setTimeout(function() { api.redrawRows(); }, 0). To see what part of your code " +
|
36372 | "that caused the refresh check this stacktrace.");
|
36373 | }
|
36374 | this.refreshInProgress = true;
|
36375 | };
|
36376 | RowRenderer.prototype.releaseLockOnRefresh = function () {
|
36377 | this.refreshInProgress = false;
|
36378 | };
|
36379 | RowRenderer.prototype.isRefreshInProgress = function () {
|
36380 | return this.refreshInProgress;
|
36381 | };
|
36382 |
|
36383 |
|
36384 |
|
36385 |
|
36386 | RowRenderer.prototype.restoreFocusedCell = function (cellPosition) {
|
36387 | if (cellPosition) {
|
36388 |
|
36389 |
|
36390 |
|
36391 | this.onCellFocusChanged({
|
36392 | rowIndex: cellPosition.rowIndex,
|
36393 | column: cellPosition.column,
|
36394 | rowPinned: cellPosition.rowPinned,
|
36395 | forceBrowserFocus: true,
|
36396 | preventScrollOnBrowserFocus: true,
|
36397 | api: this.beans.gridApi,
|
36398 | columnApi: this.beans.columnApi,
|
36399 | context: this.beans.gridOptionsService.context,
|
36400 | type: 'mock',
|
36401 | });
|
36402 | }
|
36403 | };
|
36404 | RowRenderer.prototype.stopEditing = function (cancel) {
|
36405 | if (cancel === void 0) { cancel = false; }
|
36406 | this.getAllRowCtrls().forEach(function (rowCtrl) {
|
36407 | rowCtrl.stopEditing(cancel);
|
36408 | });
|
36409 | };
|
36410 | RowRenderer.prototype.getAllCellCtrls = function () {
|
36411 | var res = [];
|
36412 | var rowCtrls = this.getAllRowCtrls();
|
36413 | var rowCtrlsLength = rowCtrls.length;
|
36414 | for (var i = 0; i < rowCtrlsLength; i++) {
|
36415 | var cellCtrls = rowCtrls[i].getAllCellCtrls();
|
36416 | var cellCtrlsLength = cellCtrls.length;
|
36417 | for (var j = 0; j < cellCtrlsLength; j++) {
|
36418 | res.push(cellCtrls[j]);
|
36419 | }
|
36420 | }
|
36421 | return res;
|
36422 | };
|
36423 | RowRenderer.prototype.getAllRowCtrls = function () {
|
36424 | var e_1, _a;
|
36425 | var stickyRowCtrls = (this.stickyRowFeature && this.stickyRowFeature.getStickyRowCtrls()) || [];
|
36426 | var res = __spread$b(this.topRowCtrls, this.bottomRowCtrls, stickyRowCtrls);
|
36427 | try {
|
36428 | for (var _b = __values$1(Object.keys(this.rowCtrlsByRowIndex)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
36429 | var key = _c.value;
|
36430 | res.push(this.rowCtrlsByRowIndex[key]);
|
36431 | }
|
36432 | }
|
36433 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
36434 | finally {
|
36435 | try {
|
36436 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
36437 | }
|
36438 | finally { if (e_1) throw e_1.error; }
|
36439 | }
|
36440 | return res;
|
36441 | };
|
36442 | RowRenderer.prototype.addRenderedRowListener = function (eventName, rowIndex, callback) {
|
36443 | var rowComp = this.rowCtrlsByRowIndex[rowIndex];
|
36444 | if (rowComp) {
|
36445 | rowComp.addEventListener(eventName, callback);
|
36446 | }
|
36447 | };
|
36448 | RowRenderer.prototype.flashCells = function (params) {
|
36449 | if (params === void 0) { params = {}; }
|
36450 | var flashDelay = params.flashDelay, fadeDelay = params.fadeDelay;
|
36451 | this.getCellCtrls(params.rowNodes, params.columns)
|
36452 | .forEach(function (cellCtrl) { return cellCtrl.flashCell({ flashDelay: flashDelay, fadeDelay: fadeDelay }); });
|
36453 | };
|
36454 | RowRenderer.prototype.refreshCells = function (params) {
|
36455 | if (params === void 0) { params = {}; }
|
36456 | var refreshCellParams = {
|
36457 | forceRefresh: params.force,
|
36458 | newData: false,
|
36459 | suppressFlash: params.suppressFlash
|
36460 | };
|
36461 | this.getCellCtrls(params.rowNodes, params.columns)
|
36462 | .forEach(function (cellCtrl) {
|
36463 | if (cellCtrl.refreshShouldDestroy()) {
|
36464 | var rowCtrl = cellCtrl.getRowCtrl();
|
36465 | if (rowCtrl) {
|
36466 | rowCtrl.refreshCell(cellCtrl);
|
36467 | }
|
36468 | }
|
36469 | else {
|
36470 | cellCtrl.refreshCell(refreshCellParams);
|
36471 | }
|
36472 | });
|
36473 | this.getFullWidthRowCtrls(params.rowNodes).forEach(function (fullWidthRowCtrl) {
|
36474 | fullWidthRowCtrl.refreshFullWidth();
|
36475 | });
|
36476 | };
|
36477 | RowRenderer.prototype.getCellRendererInstances = function (params) {
|
36478 | var _this = this;
|
36479 | var _a;
|
36480 | var cellRenderers = this.getCellCtrls(params.rowNodes, params.columns)
|
36481 | .map(function (cellCtrl) { return cellCtrl.getCellRenderer(); })
|
36482 | .filter(function (renderer) { return renderer != null; });
|
36483 | if ((_a = params.columns) === null || _a === void 0 ? void 0 : _a.length) {
|
36484 | return cellRenderers;
|
36485 | }
|
36486 | var fullWidthRenderers = [];
|
36487 | var rowIdMap = this.mapRowNodes(params.rowNodes);
|
36488 | this.getAllRowCtrls().forEach(function (rowCtrl) {
|
36489 | if (rowIdMap && !_this.isRowInMap(rowCtrl.getRowNode(), rowIdMap)) {
|
36490 | return;
|
36491 | }
|
36492 | if (!rowCtrl.isFullWidth()) {
|
36493 | return;
|
36494 | }
|
36495 | var fullWidthRenderer = rowCtrl.getFullWidthCellRenderer();
|
36496 | if (fullWidthRenderer) {
|
36497 | fullWidthRenderers.push(fullWidthRenderer);
|
36498 | }
|
36499 | });
|
36500 | return __spread$b(fullWidthRenderers, cellRenderers);
|
36501 | };
|
36502 | RowRenderer.prototype.getCellEditorInstances = function (params) {
|
36503 | var res = [];
|
36504 | this.getCellCtrls(params.rowNodes, params.columns).forEach(function (cellCtrl) {
|
36505 | var cellEditor = cellCtrl.getCellEditor();
|
36506 | if (cellEditor) {
|
36507 | res.push(cellEditor);
|
36508 | }
|
36509 | });
|
36510 | return res;
|
36511 | };
|
36512 | RowRenderer.prototype.getEditingCells = function () {
|
36513 | var res = [];
|
36514 | this.getAllCellCtrls().forEach(function (cellCtrl) {
|
36515 | if (cellCtrl.isEditing()) {
|
36516 | var cellPosition = cellCtrl.getCellPosition();
|
36517 | res.push(cellPosition);
|
36518 | }
|
36519 | });
|
36520 | return res;
|
36521 | };
|
36522 | RowRenderer.prototype.mapRowNodes = function (rowNodes) {
|
36523 | if (!rowNodes) {
|
36524 | return;
|
36525 | }
|
36526 | var res = {
|
36527 | top: {},
|
36528 | bottom: {},
|
36529 | normal: {}
|
36530 | };
|
36531 | rowNodes.forEach(function (rowNode) {
|
36532 | var id = rowNode.id;
|
36533 | if (rowNode.rowPinned === 'top') {
|
36534 | res.top[id] = rowNode;
|
36535 | }
|
36536 | else if (rowNode.rowPinned === 'bottom') {
|
36537 | res.bottom[id] = rowNode;
|
36538 | }
|
36539 | else {
|
36540 | res.normal[id] = rowNode;
|
36541 | }
|
36542 | });
|
36543 | return res;
|
36544 | };
|
36545 | RowRenderer.prototype.isRowInMap = function (rowNode, rowIdsMap) {
|
36546 |
|
36547 | var id = rowNode.id;
|
36548 | var floating = rowNode.rowPinned;
|
36549 | if (floating === 'bottom') {
|
36550 | return rowIdsMap.bottom[id] != null;
|
36551 | }
|
36552 | if (floating === 'top') {
|
36553 | return rowIdsMap.top[id] != null;
|
36554 | }
|
36555 | return rowIdsMap.normal[id] != null;
|
36556 | };
|
36557 |
|
36558 |
|
36559 | RowRenderer.prototype.getCellCtrls = function (rowNodes, columns) {
|
36560 | var _this = this;
|
36561 | var rowIdsMap = this.mapRowNodes(rowNodes);
|
36562 | var res = [];
|
36563 | var colIdsMap;
|
36564 | if (exists(columns)) {
|
36565 | colIdsMap = {};
|
36566 | columns.forEach(function (colKey) {
|
36567 | var column = _this.columnModel.getGridColumn(colKey);
|
36568 | if (exists(column)) {
|
36569 | colIdsMap[column.getId()] = true;
|
36570 | }
|
36571 | });
|
36572 | }
|
36573 | var processRow = function (rowCtrl) {
|
36574 | var rowNode = rowCtrl.getRowNode();
|
36575 |
|
36576 | if (rowIdsMap != null && !_this.isRowInMap(rowNode, rowIdsMap)) {
|
36577 | return;
|
36578 | }
|
36579 | rowCtrl.getAllCellCtrls().forEach(function (cellCtrl) {
|
36580 | var colId = cellCtrl.getColumn().getId();
|
36581 | var excludeColFromRefresh = colIdsMap && !colIdsMap[colId];
|
36582 | if (excludeColFromRefresh) {
|
36583 | return;
|
36584 | }
|
36585 | res.push(cellCtrl);
|
36586 | });
|
36587 | };
|
36588 | this.getAllRowCtrls().forEach(function (row) { return processRow(row); });
|
36589 | return res;
|
36590 | };
|
36591 | RowRenderer.prototype.destroy = function () {
|
36592 | this.removeAllRowComps();
|
36593 | _super.prototype.destroy.call(this);
|
36594 | };
|
36595 | RowRenderer.prototype.removeAllRowComps = function () {
|
36596 | var rowIndexesToRemove = Object.keys(this.rowCtrlsByRowIndex);
|
36597 | this.removeRowCtrls(rowIndexesToRemove);
|
36598 | };
|
36599 | RowRenderer.prototype.recycleRows = function () {
|
36600 |
|
36601 | var stubNodeIndexes = [];
|
36602 | iterateObject(this.rowCtrlsByRowIndex, function (index, rowComp) {
|
36603 | var stubNode = rowComp.getRowNode().id == null;
|
36604 | if (stubNode) {
|
36605 | stubNodeIndexes.push(index);
|
36606 | }
|
36607 | });
|
36608 | this.removeRowCtrls(stubNodeIndexes);
|
36609 |
|
36610 | var ctrlsByIdMap = {};
|
36611 | iterateObject(this.rowCtrlsByRowIndex, function (index, rowComp) {
|
36612 | var rowNode = rowComp.getRowNode();
|
36613 | ctrlsByIdMap[rowNode.id] = rowComp;
|
36614 | });
|
36615 | this.rowCtrlsByRowIndex = {};
|
36616 | return ctrlsByIdMap;
|
36617 | };
|
36618 |
|
36619 | RowRenderer.prototype.removeRowCtrls = function (rowsToRemove) {
|
36620 | var _this = this;
|
36621 |
|
36622 |
|
36623 | rowsToRemove.forEach(function (indexToRemove) {
|
36624 | var rowCtrl = _this.rowCtrlsByRowIndex[indexToRemove];
|
36625 | if (rowCtrl) {
|
36626 | rowCtrl.destroyFirstPass();
|
36627 | rowCtrl.destroySecondPass();
|
36628 | }
|
36629 | delete _this.rowCtrlsByRowIndex[indexToRemove];
|
36630 | });
|
36631 | };
|
36632 | RowRenderer.prototype.onBodyScroll = function (e) {
|
36633 | if (e.direction !== 'vertical') {
|
36634 | return;
|
36635 | }
|
36636 | this.redrawAfterScroll();
|
36637 | };
|
36638 |
|
36639 |
|
36640 |
|
36641 |
|
36642 | RowRenderer.prototype.redrawAfterScroll = function () {
|
36643 | var cellFocused;
|
36644 |
|
36645 |
|
36646 | if (this.stickyRowFeature && browserSupportsPreventScroll()) {
|
36647 | cellFocused = this.getCellToRestoreFocusToAfterRefresh() || undefined;
|
36648 | }
|
36649 | this.getLockOnRefresh();
|
36650 | this.redraw(null, false, true);
|
36651 | this.releaseLockOnRefresh();
|
36652 | this.dispatchDisplayedRowsChanged();
|
36653 | if (cellFocused != null) {
|
36654 | var newFocusedCell = this.getCellToRestoreFocusToAfterRefresh();
|
36655 | if (cellFocused != null && newFocusedCell == null) {
|
36656 | this.animationFrameService.flushAllFrames();
|
36657 | this.restoreFocusedCell(cellFocused);
|
36658 | }
|
36659 | }
|
36660 | };
|
36661 | RowRenderer.prototype.removeRowCompsNotToDraw = function (indexesToDraw) {
|
36662 |
|
36663 | var indexesToDrawMap = {};
|
36664 | indexesToDraw.forEach(function (index) { return (indexesToDrawMap[index] = true); });
|
36665 | var existingIndexes = Object.keys(this.rowCtrlsByRowIndex);
|
36666 | var indexesNotToDraw = existingIndexes.filter(function (index) { return !indexesToDrawMap[index]; });
|
36667 | this.removeRowCtrls(indexesNotToDraw);
|
36668 | };
|
36669 | RowRenderer.prototype.calculateIndexesToDraw = function (rowsToRecycle) {
|
36670 | var _this = this;
|
36671 |
|
36672 | var indexesToDraw = createArrayOfNumbers(this.firstRenderedRow, this.lastRenderedRow);
|
36673 | var checkRowToDraw = function (indexStr, rowComp) {
|
36674 | var index = rowComp.getRowNode().rowIndex;
|
36675 | if (index == null) {
|
36676 | return;
|
36677 | }
|
36678 | if (index < _this.firstRenderedRow || index > _this.lastRenderedRow) {
|
36679 | if (_this.doNotUnVirtualiseRow(rowComp)) {
|
36680 | indexesToDraw.push(index);
|
36681 | }
|
36682 | }
|
36683 | };
|
36684 |
|
36685 | iterateObject(this.rowCtrlsByRowIndex, checkRowToDraw);
|
36686 |
|
36687 | iterateObject(rowsToRecycle, checkRowToDraw);
|
36688 | indexesToDraw.sort(function (a, b) { return a - b; });
|
36689 | indexesToDraw = indexesToDraw.filter(function (index) {
|
36690 | var rowNode = _this.paginationProxy.getRow(index);
|
36691 | return rowNode && !rowNode.sticky;
|
36692 | });
|
36693 | return indexesToDraw;
|
36694 | };
|
36695 | RowRenderer.prototype.redraw = function (rowsToRecycle, animate, afterScroll) {
|
36696 | var _this = this;
|
36697 | if (animate === void 0) { animate = false; }
|
36698 | if (afterScroll === void 0) { afterScroll = false; }
|
36699 | this.rowContainerHeightService.updateOffset();
|
36700 | this.workOutFirstAndLastRowsToRender();
|
36701 | if (this.stickyRowFeature) {
|
36702 | this.stickyRowFeature.checkStickyRows();
|
36703 | }
|
36704 |
|
36705 |
|
36706 |
|
36707 |
|
36708 |
|
36709 |
|
36710 | var indexesToDraw = this.calculateIndexesToDraw(rowsToRecycle);
|
36711 | this.removeRowCompsNotToDraw(indexesToDraw);
|
36712 |
|
36713 |
|
36714 | if (this.printLayout) {
|
36715 | animate = false;
|
36716 | }
|
36717 | indexesToDraw.forEach(function (rowIndex) {
|
36718 | var rowCtrl = _this.createOrUpdateRowCtrl(rowIndex, rowsToRecycle, animate, afterScroll);
|
36719 | if (exists(rowCtrl)) ;
|
36720 | });
|
36721 | if (rowsToRecycle) {
|
36722 | var useAnimationFrame = afterScroll && !this.gridOptionsService.is('suppressAnimationFrame') && !this.printLayout;
|
36723 | if (useAnimationFrame) {
|
36724 | this.beans.animationFrameService.addDestroyTask(function () {
|
36725 | _this.destroyRowCtrls(rowsToRecycle, animate);
|
36726 | _this.updateAllRowCtrls();
|
36727 | _this.dispatchDisplayedRowsChanged();
|
36728 | });
|
36729 | }
|
36730 | else {
|
36731 | this.destroyRowCtrls(rowsToRecycle, animate);
|
36732 | }
|
36733 | }
|
36734 | this.updateAllRowCtrls();
|
36735 | };
|
36736 | RowRenderer.prototype.dispatchDisplayedRowsChanged = function () {
|
36737 | var event = { type: Events.EVENT_DISPLAYED_ROWS_CHANGED };
|
36738 | this.eventService.dispatchEvent(event);
|
36739 | };
|
36740 | RowRenderer.prototype.onDisplayedColumnsChanged = function () {
|
36741 | var pinningLeft = this.columnModel.isPinningLeft();
|
36742 | var pinningRight = this.columnModel.isPinningRight();
|
36743 | var atLeastOneChanged = this.pinningLeft !== pinningLeft || pinningRight !== this.pinningRight;
|
36744 | if (atLeastOneChanged) {
|
36745 | this.pinningLeft = pinningLeft;
|
36746 | this.pinningRight = pinningRight;
|
36747 | if (this.embedFullWidthRows) {
|
36748 | this.redrawFullWidthEmbeddedRows();
|
36749 | }
|
36750 | }
|
36751 | };
|
36752 |
|
36753 |
|
36754 | RowRenderer.prototype.redrawFullWidthEmbeddedRows = function () {
|
36755 |
|
36756 |
|
36757 | var rowsToRemove = [];
|
36758 | this.getFullWidthRowCtrls().forEach(function (fullWidthCtrl) {
|
36759 | var rowIndex = fullWidthCtrl.getRowNode().rowIndex;
|
36760 | rowsToRemove.push(rowIndex.toString());
|
36761 | });
|
36762 | this.refreshFloatingRowComps();
|
36763 | this.removeRowCtrls(rowsToRemove);
|
36764 | this.redrawAfterScroll();
|
36765 | };
|
36766 | RowRenderer.prototype.getFullWidthRowCtrls = function (rowNodes) {
|
36767 | var _this = this;
|
36768 | var rowNodesMap = this.mapRowNodes(rowNodes);
|
36769 | return getAllValuesInObject(this.rowCtrlsByRowIndex).filter(function (rowCtrl) {
|
36770 |
|
36771 | if (!rowCtrl.isFullWidth()) {
|
36772 | return false;
|
36773 | }
|
36774 |
|
36775 | var rowNode = rowCtrl.getRowNode();
|
36776 | if (rowNodesMap != null && !_this.isRowInMap(rowNode, rowNodesMap)) {
|
36777 | return false;
|
36778 | }
|
36779 | return true;
|
36780 | });
|
36781 | };
|
36782 | RowRenderer.prototype.refreshFullWidthRows = function (rowNodesToRefresh) {
|
36783 | var rowsToRemove = [];
|
36784 | var selectivelyRefreshing = !!rowNodesToRefresh;
|
36785 | var idsToRefresh = selectivelyRefreshing ? {} : undefined;
|
36786 | if (selectivelyRefreshing && idsToRefresh) {
|
36787 | rowNodesToRefresh.forEach(function (r) { return idsToRefresh[r.id] = true; });
|
36788 | }
|
36789 | this.getFullWidthRowCtrls().forEach(function (fullWidthRowCtrl) {
|
36790 | var rowNode = fullWidthRowCtrl.getRowNode();
|
36791 | if (selectivelyRefreshing && idsToRefresh) {
|
36792 |
|
36793 |
|
36794 |
|
36795 |
|
36796 | var parentId = (rowNode.level > 0 && rowNode.parent) ? rowNode.parent.id : undefined;
|
36797 | var skipThisNode = !idsToRefresh[rowNode.id] && !idsToRefresh[parentId];
|
36798 | if (skipThisNode) {
|
36799 | return;
|
36800 | }
|
36801 | }
|
36802 | var fullWidthRowsRefreshed = fullWidthRowCtrl.refreshFullWidth();
|
36803 | if (!fullWidthRowsRefreshed) {
|
36804 | var rowIndex = fullWidthRowCtrl.getRowNode().rowIndex;
|
36805 | rowsToRemove.push(rowIndex.toString());
|
36806 | }
|
36807 | });
|
36808 | this.removeRowCtrls(rowsToRemove);
|
36809 | this.redrawAfterScroll();
|
36810 | };
|
36811 | RowRenderer.prototype.createOrUpdateRowCtrl = function (rowIndex, rowsToRecycle, animate, afterScroll) {
|
36812 | var rowNode;
|
36813 | var rowCtrl = this.rowCtrlsByRowIndex[rowIndex];
|
36814 |
|
36815 | if (!rowCtrl) {
|
36816 | rowNode = this.paginationProxy.getRow(rowIndex);
|
36817 | if (exists(rowNode) && exists(rowsToRecycle) && rowsToRecycle[rowNode.id] && rowNode.alreadyRendered) {
|
36818 | rowCtrl = rowsToRecycle[rowNode.id];
|
36819 | rowsToRecycle[rowNode.id] = null;
|
36820 | }
|
36821 | }
|
36822 | var creatingNewRowCtrl = !rowCtrl;
|
36823 | if (creatingNewRowCtrl) {
|
36824 |
|
36825 | if (!rowNode) {
|
36826 | rowNode = this.paginationProxy.getRow(rowIndex);
|
36827 | }
|
36828 | if (exists(rowNode)) {
|
36829 | rowCtrl = this.createRowCon(rowNode, animate, afterScroll);
|
36830 | }
|
36831 | else {
|
36832 |
|
36833 |
|
36834 | return;
|
36835 | }
|
36836 | }
|
36837 | if (rowNode) {
|
36838 |
|
36839 |
|
36840 | rowNode.alreadyRendered = true;
|
36841 | }
|
36842 | this.rowCtrlsByRowIndex[rowIndex] = rowCtrl;
|
36843 | return rowCtrl;
|
36844 | };
|
36845 | RowRenderer.prototype.destroyRowCtrls = function (rowCtrlsMap, animate) {
|
36846 | var _this = this;
|
36847 | var executeInAWhileFuncs = [];
|
36848 | iterateObject(rowCtrlsMap, function (nodeId, rowCtrl) {
|
36849 |
|
36850 | if (!rowCtrl) {
|
36851 | return;
|
36852 | }
|
36853 | if (_this.cachedRowCtrls && rowCtrl.isCacheable()) {
|
36854 | _this.cachedRowCtrls.addRow(rowCtrl);
|
36855 | return;
|
36856 | }
|
36857 | rowCtrl.destroyFirstPass();
|
36858 | if (animate) {
|
36859 | _this.zombieRowCtrls[rowCtrl.getInstanceId()] = rowCtrl;
|
36860 | executeInAWhileFuncs.push(function () {
|
36861 | rowCtrl.destroySecondPass();
|
36862 | delete _this.zombieRowCtrls[rowCtrl.getInstanceId()];
|
36863 | });
|
36864 | }
|
36865 | else {
|
36866 | rowCtrl.destroySecondPass();
|
36867 | }
|
36868 | });
|
36869 | if (animate) {
|
36870 |
|
36871 |
|
36872 | executeInAWhileFuncs.push(function () {
|
36873 | _this.updateAllRowCtrls();
|
36874 | _this.dispatchDisplayedRowsChanged();
|
36875 | });
|
36876 | executeInAWhile(executeInAWhileFuncs);
|
36877 | }
|
36878 | };
|
36879 | RowRenderer.prototype.getRowBuffer = function () {
|
36880 | var rowBuffer = this.gridOptionsService.getNum('rowBuffer');
|
36881 | if (typeof rowBuffer === 'number') {
|
36882 | if (rowBuffer < 0) {
|
36883 | doOnce(function () { return console.warn("AG Grid: rowBuffer should not be negative"); }, 'warn rowBuffer negative');
|
36884 | rowBuffer = 0;
|
36885 | this.gridOptionsService.set('rowBuffer', 0);
|
36886 | }
|
36887 | }
|
36888 | else {
|
36889 | rowBuffer = 10;
|
36890 | }
|
36891 | return rowBuffer;
|
36892 | };
|
36893 | RowRenderer.prototype.getRowBufferInPixels = function () {
|
36894 | var rowsToBuffer = this.getRowBuffer();
|
36895 | var defaultRowHeight = this.gridOptionsService.getRowHeightAsNumber();
|
36896 | return rowsToBuffer * defaultRowHeight;
|
36897 | };
|
36898 | RowRenderer.prototype.workOutFirstAndLastRowsToRender = function () {
|
36899 | var newFirst;
|
36900 | var newLast;
|
36901 | if (!this.paginationProxy.isRowsToRender()) {
|
36902 | newFirst = 0;
|
36903 | newLast = -1;
|
36904 | }
|
36905 | else if (this.printLayout) {
|
36906 | newFirst = this.paginationProxy.getPageFirstRow();
|
36907 | newLast = this.paginationProxy.getPageLastRow();
|
36908 | }
|
36909 | else {
|
36910 | var bufferPixels = this.getRowBufferInPixels();
|
36911 | var gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();
|
36912 | var suppressRowVirtualisation = this.gridOptionsService.is('suppressRowVirtualisation');
|
36913 | var rowHeightsChanged = false;
|
36914 | var firstPixel = void 0;
|
36915 | var lastPixel = void 0;
|
36916 | do {
|
36917 | var paginationOffset = this.paginationProxy.getPixelOffset();
|
36918 | var _a = this.paginationProxy.getCurrentPagePixelRange(), pageFirstPixel = _a.pageFirstPixel, pageLastPixel = _a.pageLastPixel;
|
36919 | var divStretchOffset = this.rowContainerHeightService.getDivStretchOffset();
|
36920 | var bodyVRange = gridBodyCtrl.getScrollFeature().getVScrollPosition();
|
36921 | var bodyTopPixel = bodyVRange.top;
|
36922 | var bodyBottomPixel = bodyVRange.bottom;
|
36923 | if (suppressRowVirtualisation) {
|
36924 | firstPixel = pageFirstPixel + divStretchOffset;
|
36925 | lastPixel = pageLastPixel + divStretchOffset;
|
36926 | }
|
36927 | else {
|
36928 | firstPixel = Math.max(bodyTopPixel + paginationOffset - bufferPixels, pageFirstPixel) + divStretchOffset;
|
36929 | lastPixel = Math.min(bodyBottomPixel + paginationOffset + bufferPixels, pageLastPixel) + divStretchOffset;
|
36930 | }
|
36931 | this.firstVisibleVPixel = Math.max(bodyTopPixel + paginationOffset, pageFirstPixel) + divStretchOffset;
|
36932 |
|
36933 | rowHeightsChanged = this.ensureAllRowsInRangeHaveHeightsCalculated(firstPixel, lastPixel);
|
36934 | } while (rowHeightsChanged);
|
36935 | var firstRowIndex = this.paginationProxy.getRowIndexAtPixel(firstPixel);
|
36936 | var lastRowIndex = this.paginationProxy.getRowIndexAtPixel(lastPixel);
|
36937 | var pageFirstRow = this.paginationProxy.getPageFirstRow();
|
36938 | var pageLastRow = this.paginationProxy.getPageLastRow();
|
36939 |
|
36940 | if (firstRowIndex < pageFirstRow) {
|
36941 | firstRowIndex = pageFirstRow;
|
36942 | }
|
36943 | if (lastRowIndex > pageLastRow) {
|
36944 | lastRowIndex = pageLastRow;
|
36945 | }
|
36946 | newFirst = firstRowIndex;
|
36947 | newLast = lastRowIndex;
|
36948 | }
|
36949 |
|
36950 |
|
36951 |
|
36952 |
|
36953 | var rowLayoutNormal = this.gridOptionsService.isDomLayout('normal');
|
36954 | var suppressRowCountRestriction = this.gridOptionsService.is('suppressMaxRenderedRowRestriction');
|
36955 | var rowBufferMaxSize = Math.max(this.getRowBuffer(), 500);
|
36956 | if (rowLayoutNormal && !suppressRowCountRestriction) {
|
36957 | if (newLast - newFirst > rowBufferMaxSize) {
|
36958 | newLast = newFirst + rowBufferMaxSize;
|
36959 | }
|
36960 | }
|
36961 | var firstDiffers = newFirst !== this.firstRenderedRow;
|
36962 | var lastDiffers = newLast !== this.lastRenderedRow;
|
36963 | if (firstDiffers || lastDiffers) {
|
36964 | this.firstRenderedRow = newFirst;
|
36965 | this.lastRenderedRow = newLast;
|
36966 | var event_1 = {
|
36967 | type: Events.EVENT_VIEWPORT_CHANGED,
|
36968 | firstRow: newFirst,
|
36969 | lastRow: newLast
|
36970 | };
|
36971 | this.eventService.dispatchEvent(event_1);
|
36972 | }
|
36973 | };
|
36974 | |
36975 |
|
36976 |
|
36977 |
|
36978 |
|
36979 | RowRenderer.prototype.dispatchFirstDataRenderedEvent = function () {
|
36980 | var _this = this;
|
36981 | if (this.dataFirstRenderedFired) {
|
36982 | return;
|
36983 | }
|
36984 | this.dataFirstRenderedFired = true;
|
36985 | var event = {
|
36986 | type: Events.EVENT_FIRST_DATA_RENDERED,
|
36987 | firstRow: this.firstRenderedRow,
|
36988 | lastRow: this.lastRenderedRow,
|
36989 | };
|
36990 |
|
36991 | window.requestAnimationFrame(function () {
|
36992 | _this.beans.eventService.dispatchEvent(event);
|
36993 | });
|
36994 | };
|
36995 | RowRenderer.prototype.ensureAllRowsInRangeHaveHeightsCalculated = function (topPixel, bottomPixel) {
|
36996 |
|
36997 |
|
36998 | var res = this.paginationProxy.ensureRowHeightsValid(topPixel, bottomPixel, -1, -1);
|
36999 | if (res) {
|
37000 | this.updateContainerHeights();
|
37001 | }
|
37002 | return res;
|
37003 | };
|
37004 | RowRenderer.prototype.getFirstVisibleVerticalPixel = function () {
|
37005 | return this.firstVisibleVPixel;
|
37006 | };
|
37007 | RowRenderer.prototype.getFirstVirtualRenderedRow = function () {
|
37008 | return this.firstRenderedRow;
|
37009 | };
|
37010 | RowRenderer.prototype.getLastVirtualRenderedRow = function () {
|
37011 | return this.lastRenderedRow;
|
37012 | };
|
37013 |
|
37014 |
|
37015 |
|
37016 |
|
37017 |
|
37018 |
|
37019 |
|
37020 |
|
37021 |
|
37022 |
|
37023 |
|
37024 | RowRenderer.prototype.doNotUnVirtualiseRow = function (rowComp) {
|
37025 | var REMOVE_ROW = false;
|
37026 | var KEEP_ROW = true;
|
37027 | var rowNode = rowComp.getRowNode();
|
37028 | var rowHasFocus = this.focusService.isRowNodeFocused(rowNode);
|
37029 | var rowIsEditing = rowComp.isEditing();
|
37030 | var rowIsDetail = rowNode.detail;
|
37031 | var mightWantToKeepRow = rowHasFocus || rowIsEditing || rowIsDetail;
|
37032 |
|
37033 | if (!mightWantToKeepRow) {
|
37034 | return REMOVE_ROW;
|
37035 | }
|
37036 |
|
37037 |
|
37038 |
|
37039 | var rowNodePresent = this.paginationProxy.isRowPresent(rowNode);
|
37040 | return rowNodePresent ? KEEP_ROW : REMOVE_ROW;
|
37041 | };
|
37042 | RowRenderer.prototype.createRowCon = function (rowNode, animate, afterScroll) {
|
37043 | var rowCtrlFromCache = this.cachedRowCtrls ? this.cachedRowCtrls.getRow(rowNode) : null;
|
37044 | if (rowCtrlFromCache) {
|
37045 | return rowCtrlFromCache;
|
37046 | }
|
37047 |
|
37048 |
|
37049 |
|
37050 |
|
37051 |
|
37052 | var suppressAnimationFrame = this.gridOptionsService.is('suppressAnimationFrame');
|
37053 | var useAnimationFrameForCreate = afterScroll && !suppressAnimationFrame && !this.printLayout;
|
37054 | var res = new RowCtrl(rowNode, this.beans, animate, useAnimationFrameForCreate, this.printLayout);
|
37055 | return res;
|
37056 | };
|
37057 | RowRenderer.prototype.getRenderedNodes = function () {
|
37058 | var renderedRows = this.rowCtrlsByRowIndex;
|
37059 | return Object.keys(renderedRows).map(function (key) { return renderedRows[key].getRowNode(); });
|
37060 | };
|
37061 | RowRenderer.prototype.getRowByPosition = function (rowPosition) {
|
37062 | var rowCtrl;
|
37063 | var rowIndex = rowPosition.rowIndex;
|
37064 | switch (rowPosition.rowPinned) {
|
37065 | case 'top':
|
37066 | rowCtrl = this.topRowCtrls[rowIndex];
|
37067 | break;
|
37068 | case 'bottom':
|
37069 | rowCtrl = this.bottomRowCtrls[rowIndex];
|
37070 | break;
|
37071 | default:
|
37072 | rowCtrl = this.rowCtrlsByRowIndex[rowIndex];
|
37073 | if (!rowCtrl) {
|
37074 | rowCtrl = this.getStickyTopRowCtrls().find(function (ctrl) { return ctrl.getRowNode().rowIndex === rowIndex; }) || null;
|
37075 | }
|
37076 | break;
|
37077 | }
|
37078 | return rowCtrl;
|
37079 | };
|
37080 | RowRenderer.prototype.getRowNode = function (gridRow) {
|
37081 | switch (gridRow.rowPinned) {
|
37082 | case 'top':
|
37083 | return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];
|
37084 | case 'bottom':
|
37085 | return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];
|
37086 | default:
|
37087 | return this.rowModel.getRow(gridRow.rowIndex);
|
37088 | }
|
37089 | };
|
37090 |
|
37091 |
|
37092 | RowRenderer.prototype.isRangeInRenderedViewport = function (startIndex, endIndex) {
|
37093 |
|
37094 | var parentClosed = startIndex == null || endIndex == null;
|
37095 | if (parentClosed) {
|
37096 | return false;
|
37097 | }
|
37098 | var blockAfterViewport = startIndex > this.lastRenderedRow;
|
37099 | var blockBeforeViewport = endIndex < this.firstRenderedRow;
|
37100 | var blockInsideViewport = !blockBeforeViewport && !blockAfterViewport;
|
37101 | return blockInsideViewport;
|
37102 | };
|
37103 | __decorate$13([
|
37104 | Autowired("animationFrameService")
|
37105 | ], RowRenderer.prototype, "animationFrameService", void 0);
|
37106 | __decorate$13([
|
37107 | Autowired("paginationProxy")
|
37108 | ], RowRenderer.prototype, "paginationProxy", void 0);
|
37109 | __decorate$13([
|
37110 | Autowired("columnModel")
|
37111 | ], RowRenderer.prototype, "columnModel", void 0);
|
37112 | __decorate$13([
|
37113 | Autowired("pinnedRowModel")
|
37114 | ], RowRenderer.prototype, "pinnedRowModel", void 0);
|
37115 | __decorate$13([
|
37116 | Autowired("rowModel")
|
37117 | ], RowRenderer.prototype, "rowModel", void 0);
|
37118 | __decorate$13([
|
37119 | Autowired("focusService")
|
37120 | ], RowRenderer.prototype, "focusService", void 0);
|
37121 | __decorate$13([
|
37122 | Autowired("beans")
|
37123 | ], RowRenderer.prototype, "beans", void 0);
|
37124 | __decorate$13([
|
37125 | Autowired("rowContainerHeightService")
|
37126 | ], RowRenderer.prototype, "rowContainerHeightService", void 0);
|
37127 | __decorate$13([
|
37128 | Autowired("ctrlsService")
|
37129 | ], RowRenderer.prototype, "ctrlsService", void 0);
|
37130 | __decorate$13([
|
37131 | PostConstruct
|
37132 | ], RowRenderer.prototype, "postConstruct", null);
|
37133 | RowRenderer = __decorate$13([
|
37134 | Bean("rowRenderer")
|
37135 | ], RowRenderer);
|
37136 | return RowRenderer;
|
37137 | }(BeanStub));
|
37138 | var RowCtrlCache = (function () {
|
37139 | function RowCtrlCache(maxCount) {
|
37140 |
|
37141 | this.entriesMap = {};
|
37142 |
|
37143 | this.entriesList = [];
|
37144 | this.maxCount = maxCount;
|
37145 | }
|
37146 | RowCtrlCache.prototype.addRow = function (rowCtrl) {
|
37147 | this.entriesMap[rowCtrl.getRowNode().id] = rowCtrl;
|
37148 | this.entriesList.push(rowCtrl);
|
37149 | rowCtrl.setCached(true);
|
37150 | if (this.entriesList.length > this.maxCount) {
|
37151 | var rowCtrlToDestroy = this.entriesList[0];
|
37152 | rowCtrlToDestroy.destroyFirstPass();
|
37153 | rowCtrlToDestroy.destroySecondPass();
|
37154 | this.removeFromCache(rowCtrlToDestroy);
|
37155 | }
|
37156 | };
|
37157 | RowCtrlCache.prototype.getRow = function (rowNode) {
|
37158 | if (rowNode == null || rowNode.id == null) {
|
37159 | return null;
|
37160 | }
|
37161 | var res = this.entriesMap[rowNode.id];
|
37162 | if (!res) {
|
37163 | return null;
|
37164 | }
|
37165 | this.removeFromCache(res);
|
37166 | res.setCached(false);
|
37167 |
|
37168 |
|
37169 | var rowNodeMismatch = res.getRowNode() != rowNode;
|
37170 | return rowNodeMismatch ? null : res;
|
37171 | };
|
37172 | RowCtrlCache.prototype.removeFromCache = function (rowCtrl) {
|
37173 | var rowNodeId = rowCtrl.getRowNode().id;
|
37174 | delete this.entriesMap[rowNodeId];
|
37175 | removeFromArray(this.entriesList, rowCtrl);
|
37176 | };
|
37177 | RowCtrlCache.prototype.getEntries = function () {
|
37178 | return this.entriesList;
|
37179 | };
|
37180 | return RowCtrlCache;
|
37181 | }());
|
37182 |
|
37183 |
|
37184 |
|
37185 |
|
37186 |
|
37187 |
|
37188 |
|
37189 | var __extends$15 = (undefined && undefined.__extends) || (function () {
|
37190 | var extendStatics = function (d, b) {
|
37191 | extendStatics = Object.setPrototypeOf ||
|
37192 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
37193 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
37194 | return extendStatics(d, b);
|
37195 | };
|
37196 | return function (d, b) {
|
37197 | extendStatics(d, b);
|
37198 | function __() { this.constructor = d; }
|
37199 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
37200 | };
|
37201 | })();
|
37202 | var __decorate$12 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
37203 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
37204 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
37205 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
37206 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
37207 | };
|
37208 | var ValueFormatterService = (function (_super) {
|
37209 | __extends$15(ValueFormatterService, _super);
|
37210 | function ValueFormatterService() {
|
37211 | return _super !== null && _super.apply(this, arguments) || this;
|
37212 | }
|
37213 | ValueFormatterService.prototype.formatValue = function (column, node, value, suppliedFormatter, useFormatterFromColumn) {
|
37214 | if (useFormatterFromColumn === void 0) { useFormatterFromColumn = true; }
|
37215 | var result = null;
|
37216 | var formatter;
|
37217 | var colDef = column.getColDef();
|
37218 | if (suppliedFormatter) {
|
37219 |
|
37220 | formatter = suppliedFormatter;
|
37221 | }
|
37222 | else if (useFormatterFromColumn) {
|
37223 | formatter = colDef.valueFormatter;
|
37224 | }
|
37225 | if (formatter) {
|
37226 | var params = {
|
37227 | value: value,
|
37228 | node: node,
|
37229 | data: node ? node.data : null,
|
37230 | colDef: colDef,
|
37231 | column: column,
|
37232 | api: this.gridOptionsService.api,
|
37233 | columnApi: this.gridOptionsService.columnApi,
|
37234 | context: this.gridOptionsService.context
|
37235 | };
|
37236 | if (typeof formatter === 'function') {
|
37237 | result = formatter(params);
|
37238 | }
|
37239 | else {
|
37240 | result = this.expressionService.evaluate(formatter, params);
|
37241 | }
|
37242 | }
|
37243 | else if (colDef.refData) {
|
37244 | return colDef.refData[value] || '';
|
37245 | }
|
37246 |
|
37247 | if (result == null && Array.isArray(value)) {
|
37248 | result = value.join(', ');
|
37249 | }
|
37250 | return result;
|
37251 | };
|
37252 | __decorate$12([
|
37253 | Autowired('expressionService')
|
37254 | ], ValueFormatterService.prototype, "expressionService", void 0);
|
37255 | ValueFormatterService = __decorate$12([
|
37256 | Bean('valueFormatterService')
|
37257 | ], ValueFormatterService);
|
37258 | return ValueFormatterService;
|
37259 | }(BeanStub));
|
37260 |
|
37261 |
|
37262 |
|
37263 |
|
37264 |
|
37265 |
|
37266 |
|
37267 | var __extends$14 = (undefined && undefined.__extends) || (function () {
|
37268 | var extendStatics = function (d, b) {
|
37269 | extendStatics = Object.setPrototypeOf ||
|
37270 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
37271 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
37272 | return extendStatics(d, b);
|
37273 | };
|
37274 | return function (d, b) {
|
37275 | extendStatics(d, b);
|
37276 | function __() { this.constructor = d; }
|
37277 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
37278 | };
|
37279 | })();
|
37280 | var __decorate$11 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
37281 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
37282 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
37283 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
37284 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
37285 | };
|
37286 | var PinnedRowModel = (function (_super) {
|
37287 | __extends$14(PinnedRowModel, _super);
|
37288 | function PinnedRowModel() {
|
37289 | return _super !== null && _super.apply(this, arguments) || this;
|
37290 | }
|
37291 | PinnedRowModel.prototype.init = function () {
|
37292 | this.setPinnedTopRowData(this.gridOptionsService.get('pinnedTopRowData'));
|
37293 | this.setPinnedBottomRowData(this.gridOptionsService.get('pinnedBottomRowData'));
|
37294 | };
|
37295 | PinnedRowModel.prototype.isEmpty = function (floating) {
|
37296 | var rows = floating === 'top' ? this.pinnedTopRows : this.pinnedBottomRows;
|
37297 | return missingOrEmpty(rows);
|
37298 | };
|
37299 | PinnedRowModel.prototype.isRowsToRender = function (floating) {
|
37300 | return !this.isEmpty(floating);
|
37301 | };
|
37302 | PinnedRowModel.prototype.getRowAtPixel = function (pixel, floating) {
|
37303 | var rows = floating === 'top' ? this.pinnedTopRows : this.pinnedBottomRows;
|
37304 | if (missingOrEmpty(rows)) {
|
37305 | return 0;
|
37306 | }
|
37307 | for (var i = 0; i < rows.length; i++) {
|
37308 | var rowNode = rows[i];
|
37309 | var rowTopPixel = rowNode.rowTop + rowNode.rowHeight - 1;
|
37310 |
|
37311 |
|
37312 | if (rowTopPixel >= pixel) {
|
37313 | return i;
|
37314 | }
|
37315 | }
|
37316 | return rows.length - 1;
|
37317 | };
|
37318 | PinnedRowModel.prototype.setPinnedTopRowData = function (rowData) {
|
37319 | this.pinnedTopRows = this.createNodesFromData(rowData, true);
|
37320 | var event = {
|
37321 | type: Events.EVENT_PINNED_ROW_DATA_CHANGED
|
37322 | };
|
37323 | this.eventService.dispatchEvent(event);
|
37324 | };
|
37325 | PinnedRowModel.prototype.setPinnedBottomRowData = function (rowData) {
|
37326 | this.pinnedBottomRows = this.createNodesFromData(rowData, false);
|
37327 | var event = {
|
37328 | type: Events.EVENT_PINNED_ROW_DATA_CHANGED
|
37329 | };
|
37330 | this.eventService.dispatchEvent(event);
|
37331 | };
|
37332 | PinnedRowModel.prototype.createNodesFromData = function (allData, isTop) {
|
37333 | var _this = this;
|
37334 | var rowNodes = [];
|
37335 | if (allData) {
|
37336 | var nextRowTop_1 = 0;
|
37337 | allData.forEach(function (dataItem, index) {
|
37338 | var rowNode = new RowNode(_this.beans);
|
37339 | rowNode.data = dataItem;
|
37340 | var idPrefix = isTop ? RowNode.ID_PREFIX_TOP_PINNED : RowNode.ID_PREFIX_BOTTOM_PINNED;
|
37341 | rowNode.id = idPrefix + index;
|
37342 | rowNode.rowPinned = isTop ? 'top' : 'bottom';
|
37343 | rowNode.setRowTop(nextRowTop_1);
|
37344 | rowNode.setRowHeight(_this.gridOptionsService.getRowHeightForNode(rowNode).height);
|
37345 | rowNode.setRowIndex(index);
|
37346 | nextRowTop_1 += rowNode.rowHeight;
|
37347 | rowNodes.push(rowNode);
|
37348 | });
|
37349 | }
|
37350 | return rowNodes;
|
37351 | };
|
37352 | PinnedRowModel.prototype.getPinnedTopRowData = function () {
|
37353 | return this.pinnedTopRows;
|
37354 | };
|
37355 | PinnedRowModel.prototype.getPinnedBottomRowData = function () {
|
37356 | return this.pinnedBottomRows;
|
37357 | };
|
37358 | PinnedRowModel.prototype.getPinnedTopTotalHeight = function () {
|
37359 | return this.getTotalHeight(this.pinnedTopRows);
|
37360 | };
|
37361 | PinnedRowModel.prototype.getPinnedTopRowCount = function () {
|
37362 | return this.pinnedTopRows ? this.pinnedTopRows.length : 0;
|
37363 | };
|
37364 | PinnedRowModel.prototype.getPinnedBottomRowCount = function () {
|
37365 | return this.pinnedBottomRows ? this.pinnedBottomRows.length : 0;
|
37366 | };
|
37367 | PinnedRowModel.prototype.getPinnedTopRow = function (index) {
|
37368 | return this.pinnedTopRows[index];
|
37369 | };
|
37370 | PinnedRowModel.prototype.getPinnedBottomRow = function (index) {
|
37371 | return this.pinnedBottomRows[index];
|
37372 | };
|
37373 | PinnedRowModel.prototype.forEachPinnedTopRow = function (callback) {
|
37374 | if (missingOrEmpty(this.pinnedTopRows)) {
|
37375 | return;
|
37376 | }
|
37377 | this.pinnedTopRows.forEach(callback);
|
37378 | };
|
37379 | PinnedRowModel.prototype.forEachPinnedBottomRow = function (callback) {
|
37380 | if (missingOrEmpty(this.pinnedBottomRows)) {
|
37381 | return;
|
37382 | }
|
37383 | this.pinnedBottomRows.forEach(callback);
|
37384 | };
|
37385 | PinnedRowModel.prototype.getPinnedBottomTotalHeight = function () {
|
37386 | return this.getTotalHeight(this.pinnedBottomRows);
|
37387 | };
|
37388 | PinnedRowModel.prototype.getTotalHeight = function (rowNodes) {
|
37389 | if (!rowNodes || rowNodes.length === 0) {
|
37390 | return 0;
|
37391 | }
|
37392 | var lastNode = last(rowNodes);
|
37393 | return lastNode.rowTop + lastNode.rowHeight;
|
37394 | };
|
37395 | __decorate$11([
|
37396 | Autowired('beans')
|
37397 | ], PinnedRowModel.prototype, "beans", void 0);
|
37398 | __decorate$11([
|
37399 | PostConstruct
|
37400 | ], PinnedRowModel.prototype, "init", null);
|
37401 | PinnedRowModel = __decorate$11([
|
37402 | Bean('pinnedRowModel')
|
37403 | ], PinnedRowModel);
|
37404 | return PinnedRowModel;
|
37405 | }(BeanStub));
|
37406 |
|
37407 |
|
37408 |
|
37409 |
|
37410 |
|
37411 |
|
37412 |
|
37413 | var ServerSideTransactionResultStatus;
|
37414 | (function (ServerSideTransactionResultStatus) {
|
37415 |
|
37416 | ServerSideTransactionResultStatus["Applied"] = "Applied";
|
37417 | |
37418 |
|
37419 |
|
37420 |
|
37421 | ServerSideTransactionResultStatus["StoreNotFound"] = "StoreNotFound";
|
37422 | |
37423 |
|
37424 |
|
37425 | ServerSideTransactionResultStatus["StoreLoading"] = "StoreLoading";
|
37426 | |
37427 |
|
37428 |
|
37429 | ServerSideTransactionResultStatus["StoreWaitingToLoad"] = "StoreWaitingToLoad";
|
37430 | |
37431 |
|
37432 |
|
37433 | ServerSideTransactionResultStatus["StoreLoadingFailed"] = "StoreLoadingFailed";
|
37434 | |
37435 |
|
37436 |
|
37437 | ServerSideTransactionResultStatus["StoreWrongType"] = "StoreWrongType";
|
37438 | |
37439 |
|
37440 |
|
37441 |
|
37442 | ServerSideTransactionResultStatus["Cancelled"] = "Cancelled";
|
37443 | })(ServerSideTransactionResultStatus || (ServerSideTransactionResultStatus = {}));
|
37444 |
|
37445 |
|
37446 |
|
37447 |
|
37448 |
|
37449 |
|
37450 |
|
37451 |
|
37452 |
|
37453 |
|
37454 |
|
37455 |
|
37456 |
|
37457 | var ChangedPath = (function () {
|
37458 | function ChangedPath(keepingColumns, rootNode) {
|
37459 |
|
37460 |
|
37461 |
|
37462 |
|
37463 |
|
37464 |
|
37465 | this.active = true;
|
37466 |
|
37467 |
|
37468 | this.nodeIdsToColumns = {};
|
37469 |
|
37470 | this.mapToItems = {};
|
37471 | this.keepingColumns = keepingColumns;
|
37472 | this.pathRoot = {
|
37473 | rowNode: rootNode,
|
37474 | children: null
|
37475 | };
|
37476 | this.mapToItems[rootNode.id] = this.pathRoot;
|
37477 | }
|
37478 |
|
37479 |
|
37480 |
|
37481 | ChangedPath.prototype.setInactive = function () {
|
37482 | this.active = false;
|
37483 | };
|
37484 | ChangedPath.prototype.isActive = function () {
|
37485 | return this.active;
|
37486 | };
|
37487 | ChangedPath.prototype.depthFirstSearchChangedPath = function (pathItem, callback) {
|
37488 | if (pathItem.children) {
|
37489 | for (var i = 0; i < pathItem.children.length; i++) {
|
37490 | this.depthFirstSearchChangedPath(pathItem.children[i], callback);
|
37491 | }
|
37492 | }
|
37493 | callback(pathItem.rowNode);
|
37494 | };
|
37495 | ChangedPath.prototype.depthFirstSearchEverything = function (rowNode, callback, traverseEverything) {
|
37496 | if (rowNode.childrenAfterGroup) {
|
37497 | for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) {
|
37498 | var childNode = rowNode.childrenAfterGroup[i];
|
37499 | if (childNode.childrenAfterGroup) {
|
37500 | this.depthFirstSearchEverything(rowNode.childrenAfterGroup[i], callback, traverseEverything);
|
37501 | }
|
37502 | else if (traverseEverything) {
|
37503 | callback(childNode);
|
37504 | }
|
37505 | }
|
37506 | }
|
37507 | callback(rowNode);
|
37508 | };
|
37509 |
|
37510 |
|
37511 | ChangedPath.prototype.forEachChangedNodeDepthFirst = function (callback, traverseLeafNodes, includeUnchangedNodes) {
|
37512 | if (traverseLeafNodes === void 0) { traverseLeafNodes = false; }
|
37513 | if (includeUnchangedNodes === void 0) { includeUnchangedNodes = false; }
|
37514 | if (this.active && !includeUnchangedNodes) {
|
37515 |
|
37516 |
|
37517 | this.depthFirstSearchChangedPath(this.pathRoot, callback);
|
37518 | }
|
37519 | else {
|
37520 |
|
37521 | this.depthFirstSearchEverything(this.pathRoot.rowNode, callback, traverseLeafNodes);
|
37522 | }
|
37523 | };
|
37524 | ChangedPath.prototype.executeFromRootNode = function (callback) {
|
37525 | callback(this.pathRoot.rowNode);
|
37526 | };
|
37527 | ChangedPath.prototype.createPathItems = function (rowNode) {
|
37528 | var pointer = rowNode;
|
37529 | var newEntryCount = 0;
|
37530 | while (!this.mapToItems[pointer.id]) {
|
37531 | var newEntry = {
|
37532 | rowNode: pointer,
|
37533 | children: null
|
37534 | };
|
37535 | this.mapToItems[pointer.id] = newEntry;
|
37536 | newEntryCount++;
|
37537 | pointer = pointer.parent;
|
37538 | }
|
37539 | return newEntryCount;
|
37540 | };
|
37541 | ChangedPath.prototype.populateColumnsMap = function (rowNode, columns) {
|
37542 | var _this = this;
|
37543 | if (!this.keepingColumns || !columns) {
|
37544 | return;
|
37545 | }
|
37546 | var pointer = rowNode;
|
37547 | while (pointer) {
|
37548 |
|
37549 |
|
37550 | if (!this.nodeIdsToColumns[pointer.id]) {
|
37551 | this.nodeIdsToColumns[pointer.id] = {};
|
37552 | }
|
37553 | columns.forEach(function (col) { return _this.nodeIdsToColumns[pointer.id][col.getId()] = true; });
|
37554 | pointer = pointer.parent;
|
37555 | }
|
37556 | };
|
37557 | ChangedPath.prototype.linkPathItems = function (rowNode, newEntryCount) {
|
37558 | var pointer = rowNode;
|
37559 | for (var i = 0; i < newEntryCount; i++) {
|
37560 | var thisItem = this.mapToItems[pointer.id];
|
37561 | var parentItem = this.mapToItems[pointer.parent.id];
|
37562 | if (!parentItem.children) {
|
37563 | parentItem.children = [];
|
37564 | }
|
37565 | parentItem.children.push(thisItem);
|
37566 | pointer = pointer.parent;
|
37567 | }
|
37568 | };
|
37569 |
|
37570 |
|
37571 |
|
37572 | ChangedPath.prototype.addParentNode = function (rowNode, columns) {
|
37573 | if (!rowNode || rowNode.isRowPinned()) {
|
37574 | return;
|
37575 | }
|
37576 |
|
37577 |
|
37578 |
|
37579 |
|
37580 |
|
37581 | var newEntryCount = this.createPathItems(rowNode);
|
37582 |
|
37583 | this.linkPathItems(rowNode, newEntryCount);
|
37584 |
|
37585 | this.populateColumnsMap(rowNode, columns);
|
37586 | };
|
37587 | ChangedPath.prototype.canSkip = function (rowNode) {
|
37588 | return this.active && !this.mapToItems[rowNode.id];
|
37589 | };
|
37590 | ChangedPath.prototype.getValueColumnsForNode = function (rowNode, valueColumns) {
|
37591 | if (!this.keepingColumns) {
|
37592 | return valueColumns;
|
37593 | }
|
37594 | var colsForThisNode = this.nodeIdsToColumns[rowNode.id];
|
37595 | var result = valueColumns.filter(function (col) { return colsForThisNode[col.getId()]; });
|
37596 | return result;
|
37597 | };
|
37598 | ChangedPath.prototype.getNotValueColumnsForNode = function (rowNode, valueColumns) {
|
37599 | if (!this.keepingColumns) {
|
37600 | return null;
|
37601 | }
|
37602 | var colsForThisNode = this.nodeIdsToColumns[rowNode.id];
|
37603 | var result = valueColumns.filter(function (col) { return !colsForThisNode[col.getId()]; });
|
37604 | return result;
|
37605 | };
|
37606 | return ChangedPath;
|
37607 | }());
|
37608 |
|
37609 |
|
37610 |
|
37611 |
|
37612 |
|
37613 |
|
37614 |
|
37615 | var __extends$13 = (undefined && undefined.__extends) || (function () {
|
37616 | var extendStatics = function (d, b) {
|
37617 | extendStatics = Object.setPrototypeOf ||
|
37618 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
37619 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
37620 | return extendStatics(d, b);
|
37621 | };
|
37622 | return function (d, b) {
|
37623 | extendStatics(d, b);
|
37624 | function __() { this.constructor = d; }
|
37625 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
37626 | };
|
37627 | })();
|
37628 | var RowNodeBlock = (function (_super) {
|
37629 | __extends$13(RowNodeBlock, _super);
|
37630 | function RowNodeBlock(id) {
|
37631 | var _this = _super.call(this) || this;
|
37632 | _this.state = RowNodeBlock.STATE_WAITING_TO_LOAD;
|
37633 | _this.version = 0;
|
37634 | _this.id = id;
|
37635 | return _this;
|
37636 | }
|
37637 | RowNodeBlock.prototype.getId = function () {
|
37638 | return this.id;
|
37639 | };
|
37640 | RowNodeBlock.prototype.load = function () {
|
37641 | this.state = RowNodeBlock.STATE_LOADING;
|
37642 | this.loadFromDatasource();
|
37643 | };
|
37644 | RowNodeBlock.prototype.getVersion = function () {
|
37645 | return this.version;
|
37646 | };
|
37647 | RowNodeBlock.prototype.setStateWaitingToLoad = function () {
|
37648 |
|
37649 | this.version++;
|
37650 | this.state = RowNodeBlock.STATE_WAITING_TO_LOAD;
|
37651 | };
|
37652 | RowNodeBlock.prototype.getState = function () {
|
37653 | return this.state;
|
37654 | };
|
37655 | RowNodeBlock.prototype.pageLoadFailed = function (version) {
|
37656 | var requestMostRecentAndLive = this.isRequestMostRecentAndLive(version);
|
37657 | if (requestMostRecentAndLive) {
|
37658 | this.state = RowNodeBlock.STATE_FAILED;
|
37659 | this.processServerFail();
|
37660 | }
|
37661 | this.dispatchLoadCompleted(false);
|
37662 | };
|
37663 | RowNodeBlock.prototype.success = function (version, params) {
|
37664 | this.successCommon(version, params);
|
37665 | };
|
37666 | RowNodeBlock.prototype.pageLoaded = function (version, rows, lastRow) {
|
37667 | this.successCommon(version, { rowData: rows, rowCount: lastRow });
|
37668 | };
|
37669 | RowNodeBlock.prototype.isRequestMostRecentAndLive = function (version) {
|
37670 |
|
37671 |
|
37672 | var thisIsMostRecentRequest = version === this.version;
|
37673 |
|
37674 |
|
37675 | var weAreNotDestroyed = this.isAlive();
|
37676 | return thisIsMostRecentRequest && weAreNotDestroyed;
|
37677 | };
|
37678 | RowNodeBlock.prototype.successCommon = function (version, params) {
|
37679 |
|
37680 |
|
37681 |
|
37682 | this.dispatchLoadCompleted();
|
37683 | var requestMostRecentAndLive = this.isRequestMostRecentAndLive(version);
|
37684 | if (requestMostRecentAndLive) {
|
37685 | this.state = RowNodeBlock.STATE_LOADED;
|
37686 | this.processServerResult(params);
|
37687 | }
|
37688 | };
|
37689 | RowNodeBlock.prototype.dispatchLoadCompleted = function (success) {
|
37690 | if (success === void 0) { success = true; }
|
37691 |
|
37692 |
|
37693 | var event = {
|
37694 | type: RowNodeBlock.EVENT_LOAD_COMPLETE,
|
37695 | success: success,
|
37696 | block: this
|
37697 | };
|
37698 | this.dispatchEvent(event);
|
37699 | };
|
37700 | RowNodeBlock.EVENT_LOAD_COMPLETE = 'loadComplete';
|
37701 | RowNodeBlock.STATE_WAITING_TO_LOAD = 'needsLoading';
|
37702 | RowNodeBlock.STATE_LOADING = 'loading';
|
37703 | RowNodeBlock.STATE_LOADED = 'loaded';
|
37704 | RowNodeBlock.STATE_FAILED = 'failed';
|
37705 | return RowNodeBlock;
|
37706 | }(BeanStub));
|
37707 |
|
37708 |
|
37709 |
|
37710 |
|
37711 |
|
37712 |
|
37713 |
|
37714 | var __extends$12 = (undefined && undefined.__extends) || (function () {
|
37715 | var extendStatics = function (d, b) {
|
37716 | extendStatics = Object.setPrototypeOf ||
|
37717 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
37718 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
37719 | return extendStatics(d, b);
|
37720 | };
|
37721 | return function (d, b) {
|
37722 | extendStatics(d, b);
|
37723 | function __() { this.constructor = d; }
|
37724 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
37725 | };
|
37726 | })();
|
37727 | var __decorate$10 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
37728 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
37729 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
37730 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
37731 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
37732 | };
|
37733 | var __param$7 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
37734 | return function (target, key) { decorator(target, key, paramIndex); }
|
37735 | };
|
37736 | var RowNodeBlockLoader = (function (_super) {
|
37737 | __extends$12(RowNodeBlockLoader, _super);
|
37738 | function RowNodeBlockLoader() {
|
37739 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
37740 | _this.activeBlockLoadsCount = 0;
|
37741 | _this.blocks = [];
|
37742 | _this.active = true;
|
37743 | return _this;
|
37744 | }
|
37745 | RowNodeBlockLoader_1 = RowNodeBlockLoader;
|
37746 | RowNodeBlockLoader.prototype.postConstruct = function () {
|
37747 | this.maxConcurrentRequests = this.getMaxConcurrentDatasourceRequests();
|
37748 | var blockLoadDebounceMillis = this.gridOptionsService.getNum('blockLoadDebounceMillis');
|
37749 | if (blockLoadDebounceMillis && blockLoadDebounceMillis > 0) {
|
37750 | this.checkBlockToLoadDebounce = _.debounce(this.performCheckBlocksToLoad.bind(this), blockLoadDebounceMillis);
|
37751 | }
|
37752 | };
|
37753 | RowNodeBlockLoader.prototype.setBeans = function (loggerFactory) {
|
37754 | this.logger = loggerFactory.create('RowNodeBlockLoader');
|
37755 | };
|
37756 | RowNodeBlockLoader.prototype.getMaxConcurrentDatasourceRequests = function () {
|
37757 | var res = this.gridOptionsService.getNum('maxConcurrentDatasourceRequests');
|
37758 | if (res == null) {
|
37759 | return 2;
|
37760 | }
|
37761 | if (res <= 0) {
|
37762 | return;
|
37763 | }
|
37764 | return res;
|
37765 | };
|
37766 | RowNodeBlockLoader.prototype.addBlock = function (block) {
|
37767 | this.blocks.push(block);
|
37768 |
|
37769 |
|
37770 |
|
37771 | block.addEventListener(RowNodeBlock.EVENT_LOAD_COMPLETE, this.loadComplete.bind(this));
|
37772 | this.checkBlockToLoad();
|
37773 | };
|
37774 | RowNodeBlockLoader.prototype.removeBlock = function (block) {
|
37775 | _.removeFromArray(this.blocks, block);
|
37776 | };
|
37777 | RowNodeBlockLoader.prototype.destroy = function () {
|
37778 | _super.prototype.destroy.call(this);
|
37779 | this.active = false;
|
37780 | };
|
37781 | RowNodeBlockLoader.prototype.loadComplete = function () {
|
37782 | this.activeBlockLoadsCount--;
|
37783 | this.checkBlockToLoad();
|
37784 | this.dispatchEvent({ type: RowNodeBlockLoader_1.BLOCK_LOADED_EVENT });
|
37785 | if (this.activeBlockLoadsCount == 0) {
|
37786 | this.dispatchEvent({ type: RowNodeBlockLoader_1.BLOCK_LOADER_FINISHED_EVENT });
|
37787 | }
|
37788 | };
|
37789 | RowNodeBlockLoader.prototype.checkBlockToLoad = function () {
|
37790 | if (this.checkBlockToLoadDebounce) {
|
37791 | this.checkBlockToLoadDebounce();
|
37792 | }
|
37793 | else {
|
37794 | this.performCheckBlocksToLoad();
|
37795 | }
|
37796 | };
|
37797 | RowNodeBlockLoader.prototype.performCheckBlocksToLoad = function () {
|
37798 | if (!this.active) {
|
37799 | return;
|
37800 | }
|
37801 | this.printCacheStatus();
|
37802 | if (this.maxConcurrentRequests != null && this.activeBlockLoadsCount >= this.maxConcurrentRequests) {
|
37803 | this.logger.log("checkBlockToLoad: max loads exceeded");
|
37804 | return;
|
37805 | }
|
37806 | var loadAvailability = this.getAvailableLoadingCount();
|
37807 | var blocksToLoad = this.blocks.filter(function (block) { return (block.getState() === RowNodeBlock.STATE_WAITING_TO_LOAD); }).slice(0, loadAvailability);
|
37808 | this.registerLoads(blocksToLoad.length);
|
37809 | blocksToLoad.forEach(function (block) { return block.load(); });
|
37810 | this.printCacheStatus();
|
37811 | };
|
37812 | RowNodeBlockLoader.prototype.getBlockState = function () {
|
37813 | if (this.gridOptionsService.isRowModelType('serverSide')) {
|
37814 | var ssrm = this.rowModel;
|
37815 | return ssrm.getBlockStates();
|
37816 | }
|
37817 | var result = {};
|
37818 | this.blocks.forEach(function (block) {
|
37819 | var _a = block.getBlockStateJson(), id = _a.id, state = _a.state;
|
37820 | result[id] = state;
|
37821 | });
|
37822 | return result;
|
37823 | };
|
37824 | RowNodeBlockLoader.prototype.printCacheStatus = function () {
|
37825 | if (this.logger.isLogging()) {
|
37826 | this.logger.log("printCacheStatus: activePageLoadsCount = " + this.activeBlockLoadsCount + ","
|
37827 | + (" blocks = " + JSON.stringify(this.getBlockState())));
|
37828 | }
|
37829 | };
|
37830 | RowNodeBlockLoader.prototype.isLoading = function () {
|
37831 | return this.activeBlockLoadsCount > 0;
|
37832 | };
|
37833 | RowNodeBlockLoader.prototype.registerLoads = function (count) {
|
37834 | this.activeBlockLoadsCount += count;
|
37835 | };
|
37836 | RowNodeBlockLoader.prototype.getAvailableLoadingCount = function () {
|
37837 | return this.maxConcurrentRequests !== undefined ? this.maxConcurrentRequests - this.activeBlockLoadsCount : undefined;
|
37838 | };
|
37839 | var RowNodeBlockLoader_1;
|
37840 | RowNodeBlockLoader.BLOCK_LOADED_EVENT = 'blockLoaded';
|
37841 | RowNodeBlockLoader.BLOCK_LOADER_FINISHED_EVENT = 'blockLoaderFinished';
|
37842 | __decorate$10([
|
37843 | Autowired('rowModel')
|
37844 | ], RowNodeBlockLoader.prototype, "rowModel", void 0);
|
37845 | __decorate$10([
|
37846 | PostConstruct
|
37847 | ], RowNodeBlockLoader.prototype, "postConstruct", null);
|
37848 | __decorate$10([
|
37849 | __param$7(0, Qualifier('loggerFactory'))
|
37850 | ], RowNodeBlockLoader.prototype, "setBeans", null);
|
37851 | RowNodeBlockLoader = RowNodeBlockLoader_1 = __decorate$10([
|
37852 | Bean('rowNodeBlockLoader')
|
37853 | ], RowNodeBlockLoader);
|
37854 | return RowNodeBlockLoader;
|
37855 | }(BeanStub));
|
37856 |
|
37857 |
|
37858 |
|
37859 |
|
37860 |
|
37861 |
|
37862 |
|
37863 | var __extends$11 = (undefined && undefined.__extends) || (function () {
|
37864 | var extendStatics = function (d, b) {
|
37865 | extendStatics = Object.setPrototypeOf ||
|
37866 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
37867 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
37868 | return extendStatics(d, b);
|
37869 | };
|
37870 | return function (d, b) {
|
37871 | extendStatics(d, b);
|
37872 | function __() { this.constructor = d; }
|
37873 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
37874 | };
|
37875 | })();
|
37876 | var __decorate$$ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
37877 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
37878 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
37879 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
37880 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
37881 | };
|
37882 | var PaginationProxy = (function (_super) {
|
37883 | __extends$11(PaginationProxy, _super);
|
37884 | function PaginationProxy() {
|
37885 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
37886 | _this.currentPage = 0;
|
37887 | _this.topDisplayedRowIndex = 0;
|
37888 | _this.bottomDisplayedRowIndex = 0;
|
37889 | _this.pixelOffset = 0;
|
37890 | _this.masterRowCount = 0;
|
37891 | return _this;
|
37892 | }
|
37893 | PaginationProxy.prototype.postConstruct = function () {
|
37894 | this.active = this.gridOptionsService.is('pagination');
|
37895 | this.paginateChildRows = this.isPaginateChildRows();
|
37896 | this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, this.onModelUpdated.bind(this));
|
37897 | this.addManagedPropertyListener('pagination', this.onPaginationPageSizeChanged.bind(this));
|
37898 | this.addManagedPropertyListener('paginationPageSize', this.onPaginationPageSizeChanged.bind(this));
|
37899 | this.onModelUpdated();
|
37900 | };
|
37901 | PaginationProxy.prototype.ensureRowHeightsValid = function (startPixel, endPixel, startLimitIndex, endLimitIndex) {
|
37902 | var res = this.rowModel.ensureRowHeightsValid(startPixel, endPixel, this.getPageFirstRow(), this.getPageLastRow());
|
37903 | if (res) {
|
37904 | this.calculatePages();
|
37905 | }
|
37906 | return res;
|
37907 | };
|
37908 | PaginationProxy.prototype.isPaginateChildRows = function () {
|
37909 | var shouldPaginate = this.gridOptionsService.is('groupRemoveSingleChildren') || this.gridOptionsService.is('groupRemoveLowestSingleChildren');
|
37910 | if (shouldPaginate) {
|
37911 | return true;
|
37912 | }
|
37913 | return this.gridOptionsService.is('paginateChildRows');
|
37914 | };
|
37915 | PaginationProxy.prototype.onModelUpdated = function (modelUpdatedEvent) {
|
37916 | this.calculatePages();
|
37917 | var paginationChangedEvent = {
|
37918 | type: Events.EVENT_PAGINATION_CHANGED,
|
37919 | animate: modelUpdatedEvent ? modelUpdatedEvent.animate : false,
|
37920 | newData: modelUpdatedEvent ? modelUpdatedEvent.newData : false,
|
37921 | newPage: modelUpdatedEvent ? modelUpdatedEvent.newPage : false,
|
37922 | keepRenderedRows: modelUpdatedEvent ? modelUpdatedEvent.keepRenderedRows : false
|
37923 | };
|
37924 | this.eventService.dispatchEvent(paginationChangedEvent);
|
37925 | };
|
37926 | PaginationProxy.prototype.onPaginationPageSizeChanged = function () {
|
37927 | this.active = this.gridOptionsService.is('pagination');
|
37928 | this.calculatePages();
|
37929 | var paginationChangedEvent = {
|
37930 | type: Events.EVENT_PAGINATION_CHANGED,
|
37931 | animate: false,
|
37932 | newData: false,
|
37933 | newPage: false,
|
37934 |
|
37935 |
|
37936 | keepRenderedRows: true
|
37937 | };
|
37938 | this.eventService.dispatchEvent(paginationChangedEvent);
|
37939 | };
|
37940 | PaginationProxy.prototype.goToPage = function (page) {
|
37941 | if (!this.active || this.currentPage === page || typeof this.currentPage !== 'number') {
|
37942 | return;
|
37943 | }
|
37944 | this.currentPage = page;
|
37945 | var event = {
|
37946 | type: Events.EVENT_MODEL_UPDATED,
|
37947 | animate: false,
|
37948 | keepRenderedRows: false,
|
37949 | newData: false,
|
37950 | newPage: true
|
37951 | };
|
37952 | this.onModelUpdated(event);
|
37953 | };
|
37954 | PaginationProxy.prototype.getPixelOffset = function () {
|
37955 | return this.pixelOffset;
|
37956 | };
|
37957 | PaginationProxy.prototype.getRow = function (index) {
|
37958 | return this.rowModel.getRow(index);
|
37959 | };
|
37960 | PaginationProxy.prototype.getRowNode = function (id) {
|
37961 | return this.rowModel.getRowNode(id);
|
37962 | };
|
37963 | PaginationProxy.prototype.getRowIndexAtPixel = function (pixel) {
|
37964 | return this.rowModel.getRowIndexAtPixel(pixel);
|
37965 | };
|
37966 | PaginationProxy.prototype.getCurrentPageHeight = function () {
|
37967 | if (missing(this.topRowBounds) || missing(this.bottomRowBounds)) {
|
37968 | return 0;
|
37969 | }
|
37970 | return Math.max(this.bottomRowBounds.rowTop + this.bottomRowBounds.rowHeight - this.topRowBounds.rowTop, 0);
|
37971 | };
|
37972 | PaginationProxy.prototype.getCurrentPagePixelRange = function () {
|
37973 | var pageFirstPixel = this.topRowBounds ? this.topRowBounds.rowTop : 0;
|
37974 | var pageLastPixel = this.bottomRowBounds ? this.bottomRowBounds.rowTop + this.bottomRowBounds.rowHeight : 0;
|
37975 | return { pageFirstPixel: pageFirstPixel, pageLastPixel: pageLastPixel };
|
37976 | };
|
37977 | PaginationProxy.prototype.isRowPresent = function (rowNode) {
|
37978 | if (!this.rowModel.isRowPresent(rowNode)) {
|
37979 | return false;
|
37980 | }
|
37981 | var nodeIsInPage = rowNode.rowIndex >= this.topDisplayedRowIndex && rowNode.rowIndex <= this.bottomDisplayedRowIndex;
|
37982 | return nodeIsInPage;
|
37983 | };
|
37984 | PaginationProxy.prototype.isEmpty = function () {
|
37985 | return this.rowModel.isEmpty();
|
37986 | };
|
37987 | PaginationProxy.prototype.isRowsToRender = function () {
|
37988 | return this.rowModel.isRowsToRender();
|
37989 | };
|
37990 | PaginationProxy.prototype.forEachNode = function (callback) {
|
37991 | return this.rowModel.forEachNode(callback);
|
37992 | };
|
37993 | PaginationProxy.prototype.forEachNodeOnPage = function (callback) {
|
37994 | var firstRow = this.getPageFirstRow();
|
37995 | var lastRow = this.getPageLastRow();
|
37996 | for (var i = firstRow; i <= lastRow; i++) {
|
37997 | var node = this.getRow(i);
|
37998 | if (node) {
|
37999 | callback(node);
|
38000 | }
|
38001 | }
|
38002 | };
|
38003 | PaginationProxy.prototype.getType = function () {
|
38004 | return this.rowModel.getType();
|
38005 | };
|
38006 | PaginationProxy.prototype.getRowBounds = function (index) {
|
38007 | var res = this.rowModel.getRowBounds(index);
|
38008 | res.rowIndex = index;
|
38009 | return res;
|
38010 | };
|
38011 | PaginationProxy.prototype.getPageFirstRow = function () {
|
38012 | return this.topRowBounds ? this.topRowBounds.rowIndex : -1;
|
38013 | };
|
38014 | PaginationProxy.prototype.getPageLastRow = function () {
|
38015 | return this.bottomRowBounds ? this.bottomRowBounds.rowIndex : -1;
|
38016 | };
|
38017 | PaginationProxy.prototype.getRowCount = function () {
|
38018 | return this.rowModel.getRowCount();
|
38019 | };
|
38020 | PaginationProxy.prototype.getPageForIndex = function (index) {
|
38021 | return Math.floor(index / this.pageSize);
|
38022 | };
|
38023 | PaginationProxy.prototype.goToPageWithIndex = function (index) {
|
38024 | if (!this.active) {
|
38025 | return;
|
38026 | }
|
38027 | var pageNumber = this.getPageForIndex(index);
|
38028 | this.goToPage(pageNumber);
|
38029 | };
|
38030 | PaginationProxy.prototype.isRowInPage = function (row) {
|
38031 | if (!this.active) {
|
38032 | return true;
|
38033 | }
|
38034 | var rowPage = this.getPageForIndex(row.rowIndex);
|
38035 | return rowPage === this.currentPage;
|
38036 | };
|
38037 | PaginationProxy.prototype.isLastPageFound = function () {
|
38038 | return this.rowModel.isLastRowIndexKnown();
|
38039 | };
|
38040 | PaginationProxy.prototype.getCurrentPage = function () {
|
38041 | return this.currentPage;
|
38042 | };
|
38043 | PaginationProxy.prototype.goToNextPage = function () {
|
38044 | this.goToPage(this.currentPage + 1);
|
38045 | };
|
38046 | PaginationProxy.prototype.goToPreviousPage = function () {
|
38047 | this.goToPage(this.currentPage - 1);
|
38048 | };
|
38049 | PaginationProxy.prototype.goToFirstPage = function () {
|
38050 | this.goToPage(0);
|
38051 | };
|
38052 | PaginationProxy.prototype.goToLastPage = function () {
|
38053 | var rowCount = this.rowModel.getRowCount();
|
38054 | var lastPage = Math.floor(rowCount / this.pageSize);
|
38055 | this.goToPage(lastPage);
|
38056 | };
|
38057 | PaginationProxy.prototype.getPageSize = function () {
|
38058 | return this.pageSize;
|
38059 | };
|
38060 | PaginationProxy.prototype.getTotalPages = function () {
|
38061 | return this.totalPages;
|
38062 | };
|
38063 | PaginationProxy.prototype.setPageSize = function () {
|
38064 |
|
38065 | this.pageSize = this.gridOptionsService.getNum('paginationPageSize');
|
38066 | if (this.pageSize == null || this.pageSize < 1) {
|
38067 | this.pageSize = 100;
|
38068 | }
|
38069 | };
|
38070 | PaginationProxy.prototype.calculatePages = function () {
|
38071 | if (this.active) {
|
38072 | this.setPageSize();
|
38073 | if (this.paginateChildRows) {
|
38074 | this.calculatePagesAllRows();
|
38075 | }
|
38076 | else {
|
38077 | this.calculatePagesMasterRowsOnly();
|
38078 | }
|
38079 | }
|
38080 | else {
|
38081 | this.calculatedPagesNotActive();
|
38082 | }
|
38083 | this.topRowBounds = this.rowModel.getRowBounds(this.topDisplayedRowIndex);
|
38084 | if (this.topRowBounds) {
|
38085 | this.topRowBounds.rowIndex = this.topDisplayedRowIndex;
|
38086 | }
|
38087 | this.bottomRowBounds = this.rowModel.getRowBounds(this.bottomDisplayedRowIndex);
|
38088 | if (this.bottomRowBounds) {
|
38089 | this.bottomRowBounds.rowIndex = this.bottomDisplayedRowIndex;
|
38090 | }
|
38091 | this.setPixelOffset(exists(this.topRowBounds) ? this.topRowBounds.rowTop : 0);
|
38092 | };
|
38093 | PaginationProxy.prototype.setPixelOffset = function (value) {
|
38094 | if (this.pixelOffset === value) {
|
38095 | return;
|
38096 | }
|
38097 | this.pixelOffset = value;
|
38098 | this.eventService.dispatchEvent({ type: Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED });
|
38099 | };
|
38100 | PaginationProxy.prototype.setZeroRows = function () {
|
38101 | this.masterRowCount = 0;
|
38102 | this.topDisplayedRowIndex = 0;
|
38103 | this.bottomDisplayedRowIndex = -1;
|
38104 | this.currentPage = 0;
|
38105 | this.totalPages = 0;
|
38106 | };
|
38107 | PaginationProxy.prototype.adjustCurrentPageIfInvalid = function () {
|
38108 | if (this.currentPage >= this.totalPages) {
|
38109 | this.currentPage = this.totalPages - 1;
|
38110 | }
|
38111 | if (!isFinite(this.currentPage) || isNaN(this.currentPage) || this.currentPage < 0) {
|
38112 | this.currentPage = 0;
|
38113 | }
|
38114 | };
|
38115 | PaginationProxy.prototype.calculatePagesMasterRowsOnly = function () {
|
38116 |
|
38117 |
|
38118 |
|
38119 | this.masterRowCount = this.rowModel.getTopLevelRowCount();
|
38120 |
|
38121 | if (this.masterRowCount <= 0) {
|
38122 | this.setZeroRows();
|
38123 | return;
|
38124 | }
|
38125 | var masterLastRowIndex = this.masterRowCount - 1;
|
38126 | this.totalPages = Math.floor((masterLastRowIndex) / this.pageSize) + 1;
|
38127 | this.adjustCurrentPageIfInvalid();
|
38128 | var masterPageStartIndex = this.pageSize * this.currentPage;
|
38129 | var masterPageEndIndex = (this.pageSize * (this.currentPage + 1)) - 1;
|
38130 | if (masterPageEndIndex > masterLastRowIndex) {
|
38131 | masterPageEndIndex = masterLastRowIndex;
|
38132 | }
|
38133 | this.topDisplayedRowIndex = this.rowModel.getTopLevelRowDisplayedIndex(masterPageStartIndex);
|
38134 |
|
38135 | if (masterPageEndIndex === masterLastRowIndex) {
|
38136 |
|
38137 | this.bottomDisplayedRowIndex = this.rowModel.getRowCount() - 1;
|
38138 | }
|
38139 | else {
|
38140 | var firstIndexNotToShow = this.rowModel.getTopLevelRowDisplayedIndex(masterPageEndIndex + 1);
|
38141 |
|
38142 |
|
38143 |
|
38144 | this.bottomDisplayedRowIndex = firstIndexNotToShow - 1;
|
38145 | }
|
38146 | };
|
38147 | PaginationProxy.prototype.getMasterRowCount = function () {
|
38148 | return this.masterRowCount;
|
38149 | };
|
38150 | PaginationProxy.prototype.calculatePagesAllRows = function () {
|
38151 | this.masterRowCount = this.rowModel.getRowCount();
|
38152 | if (this.masterRowCount === 0) {
|
38153 | this.setZeroRows();
|
38154 | return;
|
38155 | }
|
38156 | var maxRowIndex = this.masterRowCount - 1;
|
38157 | this.totalPages = Math.floor((maxRowIndex) / this.pageSize) + 1;
|
38158 | this.adjustCurrentPageIfInvalid();
|
38159 | this.topDisplayedRowIndex = this.pageSize * this.currentPage;
|
38160 | this.bottomDisplayedRowIndex = (this.pageSize * (this.currentPage + 1)) - 1;
|
38161 | if (this.bottomDisplayedRowIndex > maxRowIndex) {
|
38162 | this.bottomDisplayedRowIndex = maxRowIndex;
|
38163 | }
|
38164 | };
|
38165 | PaginationProxy.prototype.calculatedPagesNotActive = function () {
|
38166 | this.pageSize = this.rowModel.getRowCount();
|
38167 | this.totalPages = 1;
|
38168 | this.currentPage = 0;
|
38169 | this.topDisplayedRowIndex = 0;
|
38170 | this.bottomDisplayedRowIndex = this.rowModel.getRowCount() - 1;
|
38171 | };
|
38172 | __decorate$$([
|
38173 | Autowired('rowModel')
|
38174 | ], PaginationProxy.prototype, "rowModel", void 0);
|
38175 | __decorate$$([
|
38176 | PostConstruct
|
38177 | ], PaginationProxy.prototype, "postConstruct", null);
|
38178 | PaginationProxy = __decorate$$([
|
38179 | Bean('paginationProxy')
|
38180 | ], PaginationProxy);
|
38181 | return PaginationProxy;
|
38182 | }(BeanStub));
|
38183 |
|
38184 |
|
38185 |
|
38186 |
|
38187 |
|
38188 |
|
38189 |
|
38190 | var __extends$10 = (undefined && undefined.__extends) || (function () {
|
38191 | var extendStatics = function (d, b) {
|
38192 | extendStatics = Object.setPrototypeOf ||
|
38193 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38194 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
38195 | return extendStatics(d, b);
|
38196 | };
|
38197 | return function (d, b) {
|
38198 | extendStatics(d, b);
|
38199 | function __() { this.constructor = d; }
|
38200 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38201 | };
|
38202 | })();
|
38203 | var __decorate$_ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
38204 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
38205 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
38206 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
38207 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
38208 | };
|
38209 | var StylingService = (function (_super) {
|
38210 | __extends$10(StylingService, _super);
|
38211 | function StylingService() {
|
38212 | return _super !== null && _super.apply(this, arguments) || this;
|
38213 | }
|
38214 | StylingService.prototype.processAllCellClasses = function (colDef, params, onApplicableClass, onNotApplicableClass) {
|
38215 | this.processClassRules(colDef.cellClassRules, params, onApplicableClass, onNotApplicableClass);
|
38216 | this.processStaticCellClasses(colDef, params, onApplicableClass);
|
38217 | };
|
38218 | StylingService.prototype.processClassRules = function (classRules, params, onApplicableClass, onNotApplicableClass) {
|
38219 | if (classRules == null) {
|
38220 | return;
|
38221 | }
|
38222 | var classNames = Object.keys(classRules);
|
38223 | var classesToApply = {};
|
38224 | var classesToRemove = {};
|
38225 | var _loop_1 = function (i) {
|
38226 | var className = classNames[i];
|
38227 | var rule = classRules[className];
|
38228 | var resultOfRule;
|
38229 | if (typeof rule === 'string') {
|
38230 | resultOfRule = this_1.expressionService.evaluate(rule, params);
|
38231 | }
|
38232 | else if (typeof rule === 'function') {
|
38233 | resultOfRule = rule(params);
|
38234 | }
|
38235 |
|
38236 | className.split(' ').forEach(function (singleClass) {
|
38237 | if (singleClass == null || singleClass.trim() == '') {
|
38238 | return;
|
38239 | }
|
38240 | resultOfRule ? classesToApply[singleClass] = true : classesToRemove[singleClass] = true;
|
38241 | });
|
38242 | };
|
38243 | var this_1 = this;
|
38244 | for (var i = 0; i < classNames.length; i++) {
|
38245 | _loop_1(i);
|
38246 | }
|
38247 |
|
38248 |
|
38249 |
|
38250 | if (onNotApplicableClass) {
|
38251 | Object.keys(classesToRemove).forEach(onNotApplicableClass);
|
38252 | }
|
38253 | Object.keys(classesToApply).forEach(onApplicableClass);
|
38254 | };
|
38255 | StylingService.prototype.getStaticCellClasses = function (colDef, params) {
|
38256 | var cellClass = colDef.cellClass;
|
38257 | if (!cellClass) {
|
38258 | return [];
|
38259 | }
|
38260 | var classOrClasses;
|
38261 | if (typeof cellClass === 'function') {
|
38262 | var cellClassFunc = cellClass;
|
38263 | classOrClasses = cellClassFunc(params);
|
38264 | }
|
38265 | else {
|
38266 | classOrClasses = cellClass;
|
38267 | }
|
38268 | if (typeof classOrClasses === 'string') {
|
38269 | classOrClasses = [classOrClasses];
|
38270 | }
|
38271 | return classOrClasses || [];
|
38272 | };
|
38273 | StylingService.prototype.processStaticCellClasses = function (colDef, params, onApplicableClass) {
|
38274 | var classOrClasses = this.getStaticCellClasses(colDef, params);
|
38275 | classOrClasses.forEach(function (cssClassItem) {
|
38276 | onApplicableClass(cssClassItem);
|
38277 | });
|
38278 | };
|
38279 | __decorate$_([
|
38280 | Autowired('expressionService')
|
38281 | ], StylingService.prototype, "expressionService", void 0);
|
38282 | StylingService = __decorate$_([
|
38283 | Bean('stylingService')
|
38284 | ], StylingService);
|
38285 | return StylingService;
|
38286 | }(BeanStub));
|
38287 |
|
38288 |
|
38289 |
|
38290 |
|
38291 |
|
38292 |
|
38293 |
|
38294 | var __extends$$ = (undefined && undefined.__extends) || (function () {
|
38295 | var extendStatics = function (d, b) {
|
38296 | extendStatics = Object.setPrototypeOf ||
|
38297 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38298 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
38299 | return extendStatics(d, b);
|
38300 | };
|
38301 | return function (d, b) {
|
38302 | extendStatics(d, b);
|
38303 | function __() { this.constructor = d; }
|
38304 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38305 | };
|
38306 | })();
|
38307 | var AgToggleButton = (function (_super) {
|
38308 | __extends$$(AgToggleButton, _super);
|
38309 | function AgToggleButton(config) {
|
38310 | return _super.call(this, config, 'ag-toggle-button') || this;
|
38311 | }
|
38312 | AgToggleButton.prototype.setValue = function (value, silent) {
|
38313 | _super.prototype.setValue.call(this, value, silent);
|
38314 | this.addOrRemoveCssClass('ag-selected', this.getValue());
|
38315 | return this;
|
38316 | };
|
38317 | return AgToggleButton;
|
38318 | }(AgCheckbox));
|
38319 |
|
38320 |
|
38321 |
|
38322 |
|
38323 |
|
38324 |
|
38325 |
|
38326 | var __extends$_ = (undefined && undefined.__extends) || (function () {
|
38327 | var extendStatics = function (d, b) {
|
38328 | extendStatics = Object.setPrototypeOf ||
|
38329 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38330 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
38331 | return extendStatics(d, b);
|
38332 | };
|
38333 | return function (d, b) {
|
38334 | extendStatics(d, b);
|
38335 | function __() { this.constructor = d; }
|
38336 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38337 | };
|
38338 | })();
|
38339 | var AgInputTextArea = (function (_super) {
|
38340 | __extends$_(AgInputTextArea, _super);
|
38341 | function AgInputTextArea(config) {
|
38342 | return _super.call(this, config, 'ag-text-area', null, 'textarea') || this;
|
38343 | }
|
38344 | AgInputTextArea.prototype.setValue = function (value, silent) {
|
38345 | var ret = _super.prototype.setValue.call(this, value, silent);
|
38346 | this.eInput.value = value;
|
38347 | return ret;
|
38348 | };
|
38349 | AgInputTextArea.prototype.setCols = function (cols) {
|
38350 | this.eInput.cols = cols;
|
38351 | return this;
|
38352 | };
|
38353 | AgInputTextArea.prototype.setRows = function (rows) {
|
38354 | this.eInput.rows = rows;
|
38355 | return this;
|
38356 | };
|
38357 | return AgInputTextArea;
|
38358 | }(AgAbstractInputField));
|
38359 |
|
38360 |
|
38361 |
|
38362 |
|
38363 |
|
38364 |
|
38365 |
|
38366 | var __extends$Z = (undefined && undefined.__extends) || (function () {
|
38367 | var extendStatics = function (d, b) {
|
38368 | extendStatics = Object.setPrototypeOf ||
|
38369 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38370 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
38371 | return extendStatics(d, b);
|
38372 | };
|
38373 | return function (d, b) {
|
38374 | extendStatics(d, b);
|
38375 | function __() { this.constructor = d; }
|
38376 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38377 | };
|
38378 | })();
|
38379 | var AgInputRange = (function (_super) {
|
38380 | __extends$Z(AgInputRange, _super);
|
38381 | function AgInputRange(config) {
|
38382 | return _super.call(this, config, 'ag-range-field', 'range') || this;
|
38383 | }
|
38384 | AgInputRange.prototype.postConstruct = function () {
|
38385 | _super.prototype.postConstruct.call(this);
|
38386 | var _a = this.config, min = _a.min, max = _a.max, step = _a.step;
|
38387 | if (min != null) {
|
38388 | this.setMinValue(min);
|
38389 | }
|
38390 | if (max != null) {
|
38391 | this.setMaxValue(max);
|
38392 | }
|
38393 | this.setStep(step || 1);
|
38394 | };
|
38395 | AgInputRange.prototype.addInputListeners = function () {
|
38396 | var _this = this;
|
38397 | this.addManagedListener(this.eInput, 'input', function (e) {
|
38398 | var value = e.target.value;
|
38399 | _this.setValue(value);
|
38400 | });
|
38401 | };
|
38402 | AgInputRange.prototype.setMinValue = function (value) {
|
38403 | this.min = value;
|
38404 | this.eInput.setAttribute('min', value.toString());
|
38405 | return this;
|
38406 | };
|
38407 | AgInputRange.prototype.setMaxValue = function (value) {
|
38408 | this.max = value;
|
38409 | this.eInput.setAttribute('max', value.toString());
|
38410 | return this;
|
38411 | };
|
38412 | AgInputRange.prototype.setStep = function (value) {
|
38413 | this.eInput.setAttribute('step', value.toString());
|
38414 | return this;
|
38415 | };
|
38416 | AgInputRange.prototype.setValue = function (value, silent) {
|
38417 | if (this.min != null) {
|
38418 | value = Math.max(parseFloat(value), this.min).toString();
|
38419 | }
|
38420 | if (this.max != null) {
|
38421 | value = Math.min(parseFloat(value), this.max).toString();
|
38422 | }
|
38423 | var ret = _super.prototype.setValue.call(this, value, silent);
|
38424 | this.eInput.value = value;
|
38425 | return ret;
|
38426 | };
|
38427 | return AgInputRange;
|
38428 | }(AgAbstractInputField));
|
38429 |
|
38430 |
|
38431 |
|
38432 |
|
38433 |
|
38434 |
|
38435 |
|
38436 | var __extends$Y = (undefined && undefined.__extends) || (function () {
|
38437 | var extendStatics = function (d, b) {
|
38438 | extendStatics = Object.setPrototypeOf ||
|
38439 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38440 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
38441 | return extendStatics(d, b);
|
38442 | };
|
38443 | return function (d, b) {
|
38444 | extendStatics(d, b);
|
38445 | function __() { this.constructor = d; }
|
38446 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38447 | };
|
38448 | })();
|
38449 | var __decorate$Z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
38450 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
38451 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
38452 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
38453 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
38454 | };
|
38455 | var AgSlider = (function (_super) {
|
38456 | __extends$Y(AgSlider, _super);
|
38457 | function AgSlider(config) {
|
38458 | var _this = _super.call(this, config, AgSlider.TEMPLATE) || this;
|
38459 | _this.labelAlignment = 'top';
|
38460 | return _this;
|
38461 | }
|
38462 | AgSlider.prototype.init = function () {
|
38463 | this.eSlider.addCssClass('ag-slider-field');
|
38464 | };
|
38465 | AgSlider.prototype.onValueChange = function (callbackFn) {
|
38466 | var _this = this;
|
38467 | var eventChanged = AgAbstractField.EVENT_CHANGED;
|
38468 | this.addManagedListener(this.eText, eventChanged, function () {
|
38469 | var textValue = parseFloat(_this.eText.getValue());
|
38470 | _this.eSlider.setValue(textValue.toString(), true);
|
38471 | callbackFn(textValue || 0);
|
38472 | });
|
38473 | this.addManagedListener(this.eSlider, eventChanged, function () {
|
38474 | var sliderValue = _this.eSlider.getValue();
|
38475 | _this.eText.setValue(sliderValue, true);
|
38476 | callbackFn(parseFloat(sliderValue));
|
38477 | });
|
38478 | return this;
|
38479 | };
|
38480 | AgSlider.prototype.setSliderWidth = function (width) {
|
38481 | this.eSlider.setWidth(width);
|
38482 | return this;
|
38483 | };
|
38484 | AgSlider.prototype.setTextFieldWidth = function (width) {
|
38485 | this.eText.setWidth(width);
|
38486 | return this;
|
38487 | };
|
38488 | AgSlider.prototype.setMinValue = function (minValue) {
|
38489 | this.eSlider.setMinValue(minValue);
|
38490 | this.eText.setMin(minValue);
|
38491 | return this;
|
38492 | };
|
38493 | AgSlider.prototype.setMaxValue = function (maxValue) {
|
38494 | this.eSlider.setMaxValue(maxValue);
|
38495 | this.eText.setMax(maxValue);
|
38496 | return this;
|
38497 | };
|
38498 | AgSlider.prototype.getValue = function () {
|
38499 | return this.eText.getValue();
|
38500 | };
|
38501 | AgSlider.prototype.setValue = function (value) {
|
38502 | if (this.getValue() === value) {
|
38503 | return this;
|
38504 | }
|
38505 | this.eText.setValue(value, true);
|
38506 | this.eSlider.setValue(value, true);
|
38507 | this.dispatchEvent({ type: AgAbstractField.EVENT_CHANGED });
|
38508 | return this;
|
38509 | };
|
38510 | AgSlider.prototype.setStep = function (step) {
|
38511 | this.eSlider.setStep(step);
|
38512 | this.eText.setStep(step);
|
38513 | return this;
|
38514 | };
|
38515 | 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>";
|
38516 | __decorate$Z([
|
38517 | RefSelector('eLabel')
|
38518 | ], AgSlider.prototype, "eLabel", void 0);
|
38519 | __decorate$Z([
|
38520 | RefSelector('eSlider')
|
38521 | ], AgSlider.prototype, "eSlider", void 0);
|
38522 | __decorate$Z([
|
38523 | RefSelector('eText')
|
38524 | ], AgSlider.prototype, "eText", void 0);
|
38525 | __decorate$Z([
|
38526 | PostConstruct
|
38527 | ], AgSlider.prototype, "init", null);
|
38528 | return AgSlider;
|
38529 | }(AgAbstractLabel));
|
38530 |
|
38531 |
|
38532 |
|
38533 |
|
38534 |
|
38535 |
|
38536 |
|
38537 | var __extends$X = (undefined && undefined.__extends) || (function () {
|
38538 | var extendStatics = function (d, b) {
|
38539 | extendStatics = Object.setPrototypeOf ||
|
38540 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38541 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
38542 | return extendStatics(d, b);
|
38543 | };
|
38544 | return function (d, b) {
|
38545 | extendStatics(d, b);
|
38546 | function __() { this.constructor = d; }
|
38547 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38548 | };
|
38549 | })();
|
38550 | var __decorate$Y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
38551 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
38552 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
38553 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
38554 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
38555 | };
|
38556 | var AgGroupComponent = (function (_super) {
|
38557 | __extends$X(AgGroupComponent, _super);
|
38558 | function AgGroupComponent(params) {
|
38559 | if (params === void 0) { params = {}; }
|
38560 | var _this = _super.call(this, AgGroupComponent.getTemplate(params)) || this;
|
38561 | _this.suppressEnabledCheckbox = true;
|
38562 | _this.suppressOpenCloseIcons = false;
|
38563 | var title = params.title, enabled = params.enabled, items = params.items, suppressEnabledCheckbox = params.suppressEnabledCheckbox, suppressOpenCloseIcons = params.suppressOpenCloseIcons;
|
38564 | _this.title = title;
|
38565 | _this.cssIdentifier = params.cssIdentifier || 'default';
|
38566 | _this.enabled = enabled != null ? enabled : true;
|
38567 | _this.items = items || [];
|
38568 | _this.alignItems = params.alignItems || 'center';
|
38569 | if (suppressEnabledCheckbox != null) {
|
38570 | _this.suppressEnabledCheckbox = suppressEnabledCheckbox;
|
38571 | }
|
38572 | if (suppressOpenCloseIcons != null) {
|
38573 | _this.suppressOpenCloseIcons = suppressOpenCloseIcons;
|
38574 | }
|
38575 | return _this;
|
38576 | }
|
38577 | AgGroupComponent.getTemplate = function (params) {
|
38578 | var cssIdentifier = params.cssIdentifier || 'default';
|
38579 | var direction = params.direction || 'vertical';
|
38580 | 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>";
|
38581 | };
|
38582 | AgGroupComponent.prototype.postConstruct = function () {
|
38583 | if (this.items.length) {
|
38584 | var initialItems = this.items;
|
38585 | this.items = [];
|
38586 | this.addItems(initialItems);
|
38587 | }
|
38588 | var localeTextFunc = this.localeService.getLocaleTextFunc();
|
38589 | this.cbGroupEnabled.setLabel(localeTextFunc('enabled', 'Enabled'));
|
38590 | if (this.title) {
|
38591 | this.setTitle(this.title);
|
38592 | }
|
38593 | if (this.enabled) {
|
38594 | this.setEnabled(this.enabled);
|
38595 | }
|
38596 | this.setAlignItems(this.alignItems);
|
38597 | this.hideEnabledCheckbox(this.suppressEnabledCheckbox);
|
38598 | this.hideOpenCloseIcons(this.suppressOpenCloseIcons);
|
38599 | this.setupExpandContract();
|
38600 | this.refreshAriaStatus();
|
38601 | this.refreshChildDisplay();
|
38602 | };
|
38603 | AgGroupComponent.prototype.setupExpandContract = function () {
|
38604 | var _this = this;
|
38605 | this.eGroupClosedIcon.appendChild(createIcon('columnSelectClosed', this.gridOptionsService, null));
|
38606 | this.eGroupOpenedIcon.appendChild(createIcon('columnSelectOpen', this.gridOptionsService, null));
|
38607 | this.addManagedListener(this.eTitleBar, 'click', function () { return _this.toggleGroupExpand(); });
|
38608 | this.addManagedListener(this.eTitleBar, 'keydown', function (e) {
|
38609 | switch (e.key) {
|
38610 | case KeyCode.ENTER:
|
38611 | case KeyCode.SPACE:
|
38612 | e.preventDefault();
|
38613 | _this.toggleGroupExpand();
|
38614 | break;
|
38615 | case KeyCode.RIGHT:
|
38616 | case KeyCode.LEFT:
|
38617 | e.preventDefault();
|
38618 | _this.toggleGroupExpand(e.key === KeyCode.RIGHT);
|
38619 | break;
|
38620 | }
|
38621 | });
|
38622 | };
|
38623 | AgGroupComponent.prototype.refreshAriaStatus = function () {
|
38624 | if (!this.suppressOpenCloseIcons) {
|
38625 | setAriaExpanded(this.eTitleBar, this.expanded);
|
38626 | }
|
38627 | };
|
38628 | AgGroupComponent.prototype.refreshChildDisplay = function () {
|
38629 | var showIcon = !this.suppressOpenCloseIcons;
|
38630 | setDisplayed(this.eToolbar, this.expanded && !this.suppressEnabledCheckbox);
|
38631 | setDisplayed(this.eGroupOpenedIcon, showIcon && this.expanded);
|
38632 | setDisplayed(this.eGroupClosedIcon, showIcon && !this.expanded);
|
38633 | };
|
38634 | AgGroupComponent.prototype.isExpanded = function () {
|
38635 | return this.expanded;
|
38636 | };
|
38637 | AgGroupComponent.prototype.setAlignItems = function (alignment) {
|
38638 | if (this.alignItems !== alignment) {
|
38639 | this.removeCssClass("ag-group-item-alignment-" + this.alignItems);
|
38640 | }
|
38641 | this.alignItems = alignment;
|
38642 | var newCls = "ag-group-item-alignment-" + this.alignItems;
|
38643 | this.addCssClass(newCls);
|
38644 | return this;
|
38645 | };
|
38646 | AgGroupComponent.prototype.toggleGroupExpand = function (expanded) {
|
38647 | if (this.suppressOpenCloseIcons) {
|
38648 | this.expanded = true;
|
38649 | this.refreshChildDisplay();
|
38650 | setDisplayed(this.eContainer, true);
|
38651 | return this;
|
38652 | }
|
38653 | expanded = expanded != null ? expanded : !this.expanded;
|
38654 | if (this.expanded === expanded) {
|
38655 | return this;
|
38656 | }
|
38657 | this.expanded = expanded;
|
38658 | this.refreshAriaStatus();
|
38659 | this.refreshChildDisplay();
|
38660 | setDisplayed(this.eContainer, expanded);
|
38661 | this.dispatchEvent({ type: this.expanded ? AgGroupComponent.EVENT_EXPANDED : AgGroupComponent.EVENT_COLLAPSED });
|
38662 | return this;
|
38663 | };
|
38664 | AgGroupComponent.prototype.addItems = function (items) {
|
38665 | var _this = this;
|
38666 | items.forEach(function (item) { return _this.addItem(item); });
|
38667 | };
|
38668 | AgGroupComponent.prototype.addItem = function (item) {
|
38669 | var container = this.eContainer;
|
38670 | var el = item instanceof Component ? item.getGui() : item;
|
38671 | el.classList.add('ag-group-item', "ag-" + this.cssIdentifier + "-group-item");
|
38672 | container.appendChild(el);
|
38673 | this.items.push(el);
|
38674 | };
|
38675 | AgGroupComponent.prototype.hideItem = function (hide, index) {
|
38676 | var itemToHide = this.items[index];
|
38677 | setDisplayed(itemToHide, !hide);
|
38678 | };
|
38679 | AgGroupComponent.prototype.setTitle = function (title) {
|
38680 | this.eTitle.innerText = title;
|
38681 | return this;
|
38682 | };
|
38683 | AgGroupComponent.prototype.addCssClassToTitleBar = function (cssClass) {
|
38684 | this.eTitleBar.classList.add(cssClass);
|
38685 | };
|
38686 | AgGroupComponent.prototype.setEnabled = function (enabled, skipToggle) {
|
38687 | this.enabled = enabled;
|
38688 | this.refreshDisabledStyles();
|
38689 | this.toggleGroupExpand(enabled);
|
38690 | if (!skipToggle) {
|
38691 | this.cbGroupEnabled.setValue(enabled);
|
38692 | }
|
38693 | return this;
|
38694 | };
|
38695 | AgGroupComponent.prototype.isEnabled = function () {
|
38696 | return this.enabled;
|
38697 | };
|
38698 | AgGroupComponent.prototype.onEnableChange = function (callbackFn) {
|
38699 | var _this = this;
|
38700 | this.cbGroupEnabled.onValueChange(function (newSelection) {
|
38701 | _this.setEnabled(newSelection, true);
|
38702 | callbackFn(newSelection);
|
38703 | });
|
38704 | return this;
|
38705 | };
|
38706 | AgGroupComponent.prototype.hideEnabledCheckbox = function (hide) {
|
38707 | this.suppressEnabledCheckbox = hide;
|
38708 | this.refreshChildDisplay();
|
38709 | this.refreshDisabledStyles();
|
38710 | return this;
|
38711 | };
|
38712 | AgGroupComponent.prototype.hideOpenCloseIcons = function (hide) {
|
38713 | this.suppressOpenCloseIcons = hide;
|
38714 | if (hide) {
|
38715 | this.toggleGroupExpand(true);
|
38716 | }
|
38717 | return this;
|
38718 | };
|
38719 | AgGroupComponent.prototype.refreshDisabledStyles = function () {
|
38720 | this.addOrRemoveCssClass('ag-disabled', !this.enabled);
|
38721 | if (this.suppressEnabledCheckbox && !this.enabled) {
|
38722 | this.eTitleBar.classList.add('ag-disabled-group-title-bar');
|
38723 | this.eTitleBar.removeAttribute('tabindex');
|
38724 | }
|
38725 | else {
|
38726 | this.eTitleBar.classList.remove('ag-disabled-group-title-bar');
|
38727 | this.eTitleBar.setAttribute('tabindex', '0');
|
38728 | }
|
38729 | this.eContainer.classList.toggle('ag-disabled-group-container', !this.enabled);
|
38730 | };
|
38731 | AgGroupComponent.EVENT_EXPANDED = 'expanded';
|
38732 | AgGroupComponent.EVENT_COLLAPSED = 'collapsed';
|
38733 | __decorate$Y([
|
38734 | RefSelector('eTitleBar')
|
38735 | ], AgGroupComponent.prototype, "eTitleBar", void 0);
|
38736 | __decorate$Y([
|
38737 | RefSelector('eGroupOpenedIcon')
|
38738 | ], AgGroupComponent.prototype, "eGroupOpenedIcon", void 0);
|
38739 | __decorate$Y([
|
38740 | RefSelector('eGroupClosedIcon')
|
38741 | ], AgGroupComponent.prototype, "eGroupClosedIcon", void 0);
|
38742 | __decorate$Y([
|
38743 | RefSelector('eToolbar')
|
38744 | ], AgGroupComponent.prototype, "eToolbar", void 0);
|
38745 | __decorate$Y([
|
38746 | RefSelector('cbGroupEnabled')
|
38747 | ], AgGroupComponent.prototype, "cbGroupEnabled", void 0);
|
38748 | __decorate$Y([
|
38749 | RefSelector('eTitle')
|
38750 | ], AgGroupComponent.prototype, "eTitle", void 0);
|
38751 | __decorate$Y([
|
38752 | RefSelector('eContainer')
|
38753 | ], AgGroupComponent.prototype, "eContainer", void 0);
|
38754 | __decorate$Y([
|
38755 | PostConstruct
|
38756 | ], AgGroupComponent.prototype, "postConstruct", null);
|
38757 | return AgGroupComponent;
|
38758 | }(Component));
|
38759 |
|
38760 |
|
38761 |
|
38762 |
|
38763 |
|
38764 |
|
38765 |
|
38766 | var __extends$W = (undefined && undefined.__extends) || (function () {
|
38767 | var extendStatics = function (d, b) {
|
38768 | extendStatics = Object.setPrototypeOf ||
|
38769 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38770 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
38771 | return extendStatics(d, b);
|
38772 | };
|
38773 | return function (d, b) {
|
38774 | extendStatics(d, b);
|
38775 | function __() { this.constructor = d; }
|
38776 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38777 | };
|
38778 | })();
|
38779 | var __decorate$X = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
38780 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
38781 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
38782 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
38783 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
38784 | };
|
38785 | var TabGuardClassNames;
|
38786 | (function (TabGuardClassNames) {
|
38787 | TabGuardClassNames["TAB_GUARD"] = "ag-tab-guard";
|
38788 | TabGuardClassNames["TAB_GUARD_TOP"] = "ag-tab-guard-top";
|
38789 | TabGuardClassNames["TAB_GUARD_BOTTOM"] = "ag-tab-guard-bottom";
|
38790 | })(TabGuardClassNames || (TabGuardClassNames = {}));
|
38791 | var TabGuardCtrl = (function (_super) {
|
38792 | __extends$W(TabGuardCtrl, _super);
|
38793 | function TabGuardCtrl(params) {
|
38794 | var _this = _super.call(this) || this;
|
38795 | _this.skipTabGuardFocus = false;
|
38796 | 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;
|
38797 | _this.comp = comp;
|
38798 | _this.eTopGuard = eTopGuard;
|
38799 | _this.eBottomGuard = eBottomGuard;
|
38800 | _this.providedFocusInnerElement = focusInnerElement;
|
38801 | _this.eFocusableElement = eFocusableElement;
|
38802 | _this.providedFocusIn = onFocusIn;
|
38803 | _this.providedFocusOut = onFocusOut;
|
38804 | _this.providedShouldStopEventPropagation = shouldStopEventPropagation;
|
38805 | _this.providedOnTabKeyDown = onTabKeyDown;
|
38806 | _this.providedHandleKeyDown = handleKeyDown;
|
38807 | return _this;
|
38808 | }
|
38809 | TabGuardCtrl.prototype.postConstruct = function () {
|
38810 | var _this = this;
|
38811 | this.createManagedBean(new ManagedFocusFeature(this.eFocusableElement, {
|
38812 | shouldStopEventPropagation: function () { return _this.shouldStopEventPropagation(); },
|
38813 | onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
|
38814 | handleKeyDown: function (e) { return _this.handleKeyDown(e); },
|
38815 | onFocusIn: function (e) { return _this.onFocusIn(e); },
|
38816 | onFocusOut: function (e) { return _this.onFocusOut(e); }
|
38817 | }));
|
38818 | this.activateTabGuards();
|
38819 | [this.eTopGuard, this.eBottomGuard].forEach(function (guard) { return _this.addManagedListener(guard, 'focus', _this.onFocus.bind(_this)); });
|
38820 | };
|
38821 | TabGuardCtrl.prototype.handleKeyDown = function (e) {
|
38822 | if (this.providedHandleKeyDown) {
|
38823 | this.providedHandleKeyDown(e);
|
38824 | }
|
38825 | };
|
38826 | TabGuardCtrl.prototype.tabGuardsAreActive = function () {
|
38827 | return !!this.eTopGuard && this.eTopGuard.hasAttribute('tabIndex');
|
38828 | };
|
38829 | TabGuardCtrl.prototype.shouldStopEventPropagation = function () {
|
38830 | if (this.providedShouldStopEventPropagation) {
|
38831 | return this.providedShouldStopEventPropagation();
|
38832 | }
|
38833 | return false;
|
38834 | };
|
38835 | TabGuardCtrl.prototype.activateTabGuards = function () {
|
38836 | this.comp.setTabIndex(this.getGridTabIndex());
|
38837 | };
|
38838 | TabGuardCtrl.prototype.deactivateTabGuards = function () {
|
38839 | this.comp.setTabIndex();
|
38840 | };
|
38841 | TabGuardCtrl.prototype.onFocus = function (e) {
|
38842 | if (this.skipTabGuardFocus) {
|
38843 | this.skipTabGuardFocus = false;
|
38844 | return;
|
38845 | }
|
38846 | var fromBottom = e.target === this.eBottomGuard;
|
38847 | if (this.providedFocusInnerElement) {
|
38848 | this.providedFocusInnerElement(fromBottom);
|
38849 | }
|
38850 | else {
|
38851 | this.focusInnerElement(fromBottom);
|
38852 | }
|
38853 | };
|
38854 | TabGuardCtrl.prototype.onFocusIn = function (e) {
|
38855 | if (this.providedFocusIn && this.providedFocusIn(e)) {
|
38856 | return;
|
38857 | }
|
38858 | this.deactivateTabGuards();
|
38859 | };
|
38860 | TabGuardCtrl.prototype.onFocusOut = function (e) {
|
38861 | if (this.providedFocusOut && this.providedFocusOut(e)) {
|
38862 | return;
|
38863 | }
|
38864 | if (!this.eFocusableElement.contains(e.relatedTarget)) {
|
38865 | this.activateTabGuards();
|
38866 | }
|
38867 | };
|
38868 | TabGuardCtrl.prototype.onTabKeyDown = function (e) {
|
38869 | var _this = this;
|
38870 | if (this.providedOnTabKeyDown) {
|
38871 | this.providedOnTabKeyDown(e);
|
38872 | return;
|
38873 | }
|
38874 | if (e.defaultPrevented) {
|
38875 | return;
|
38876 | }
|
38877 | var tabGuardsAreActive = this.tabGuardsAreActive();
|
38878 | if (tabGuardsAreActive) {
|
38879 | this.deactivateTabGuards();
|
38880 | }
|
38881 | var nextRoot = this.getNextFocusableElement(e.shiftKey);
|
38882 | if (tabGuardsAreActive) {
|
38883 |
|
38884 |
|
38885 | setTimeout(function () { return _this.activateTabGuards(); }, 0);
|
38886 | }
|
38887 | if (!nextRoot) {
|
38888 | return;
|
38889 | }
|
38890 | nextRoot.focus();
|
38891 | e.preventDefault();
|
38892 | };
|
38893 | TabGuardCtrl.prototype.getGridTabIndex = function () {
|
38894 | return (this.gridOptionsService.getNum('tabIndex') || 0).toString();
|
38895 | };
|
38896 | TabGuardCtrl.prototype.focusInnerElement = function (fromBottom) {
|
38897 | if (fromBottom === void 0) { fromBottom = false; }
|
38898 | var focusable = this.focusService.findFocusableElements(this.eFocusableElement);
|
38899 | if (this.tabGuardsAreActive()) {
|
38900 |
|
38901 | focusable.splice(0, 1);
|
38902 | focusable.splice(focusable.length - 1, 1);
|
38903 | }
|
38904 | if (!focusable.length) {
|
38905 | return;
|
38906 | }
|
38907 | focusable[fromBottom ? focusable.length - 1 : 0].focus();
|
38908 | };
|
38909 | TabGuardCtrl.prototype.getNextFocusableElement = function (backwards) {
|
38910 | return this.focusService.findNextFocusableElement(this.eFocusableElement, false, backwards);
|
38911 | };
|
38912 | TabGuardCtrl.prototype.forceFocusOutOfContainer = function (up) {
|
38913 | if (up === void 0) { up = false; }
|
38914 | var tabGuardToFocus = up ? this.eTopGuard : this.eBottomGuard;
|
38915 | this.activateTabGuards();
|
38916 | this.skipTabGuardFocus = true;
|
38917 | tabGuardToFocus.focus();
|
38918 | };
|
38919 | __decorate$X([
|
38920 | Autowired('focusService')
|
38921 | ], TabGuardCtrl.prototype, "focusService", void 0);
|
38922 | __decorate$X([
|
38923 | PostConstruct
|
38924 | ], TabGuardCtrl.prototype, "postConstruct", null);
|
38925 | return TabGuardCtrl;
|
38926 | }(BeanStub));
|
38927 |
|
38928 |
|
38929 |
|
38930 |
|
38931 |
|
38932 |
|
38933 |
|
38934 | var __extends$V = (undefined && undefined.__extends) || (function () {
|
38935 | var extendStatics = function (d, b) {
|
38936 | extendStatics = Object.setPrototypeOf ||
|
38937 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
38938 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
38939 | return extendStatics(d, b);
|
38940 | };
|
38941 | return function (d, b) {
|
38942 | extendStatics(d, b);
|
38943 | function __() { this.constructor = d; }
|
38944 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38945 | };
|
38946 | })();
|
38947 | var __read$c = (undefined && undefined.__read) || function (o, n) {
|
38948 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
38949 | if (!m) return o;
|
38950 | var i = m.call(o), r, ar = [], e;
|
38951 | try {
|
38952 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
38953 | }
|
38954 | catch (error) { e = { error: error }; }
|
38955 | finally {
|
38956 | try {
|
38957 | if (r && !r.done && (m = i["return"])) m.call(i);
|
38958 | }
|
38959 | finally { if (e) throw e.error; }
|
38960 | }
|
38961 | return ar;
|
38962 | };
|
38963 | var __spread$a = (undefined && undefined.__spread) || function () {
|
38964 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$c(arguments[i]));
|
38965 | return ar;
|
38966 | };
|
38967 | var TabGuardComp = (function (_super) {
|
38968 | __extends$V(TabGuardComp, _super);
|
38969 | function TabGuardComp() {
|
38970 | return _super !== null && _super.apply(this, arguments) || this;
|
38971 | }
|
38972 | TabGuardComp.prototype.initialiseTabGuard = function (params) {
|
38973 | this.eTopGuard = this.createTabGuard('top');
|
38974 | this.eBottomGuard = this.createTabGuard('bottom');
|
38975 | this.eFocusableElement = this.getFocusableElement();
|
38976 | var tabGuards = [this.eTopGuard, this.eBottomGuard];
|
38977 | var compProxy = {
|
38978 | setTabIndex: function (tabIndex) {
|
38979 | tabGuards.forEach(function (tabGuard) { return tabIndex != null ? tabGuard.setAttribute('tabIndex', tabIndex) : tabGuard.removeAttribute('tabIndex'); });
|
38980 | }
|
38981 | };
|
38982 | this.addTabGuards(this.eTopGuard, this.eBottomGuard);
|
38983 | this.tabGuardCtrl = this.createManagedBean(new TabGuardCtrl({
|
38984 | comp: compProxy,
|
38985 | eTopGuard: this.eTopGuard,
|
38986 | eBottomGuard: this.eBottomGuard,
|
38987 | eFocusableElement: this.eFocusableElement,
|
38988 | onFocusIn: params.onFocusIn,
|
38989 | onFocusOut: params.onFocusOut,
|
38990 | focusInnerElement: params.focusInnerElement,
|
38991 | handleKeyDown: params.handleKeyDown,
|
38992 | onTabKeyDown: params.onTabKeyDown,
|
38993 | shouldStopEventPropagation: params.shouldStopEventPropagation
|
38994 | }));
|
38995 | };
|
38996 | TabGuardComp.prototype.createTabGuard = function (side) {
|
38997 | var tabGuard = document.createElement('div');
|
38998 | var cls = side === 'top' ? TabGuardClassNames.TAB_GUARD_TOP : TabGuardClassNames.TAB_GUARD_BOTTOM;
|
38999 | tabGuard.classList.add(TabGuardClassNames.TAB_GUARD, cls);
|
39000 | setAriaRole(tabGuard, 'presentation');
|
39001 | return tabGuard;
|
39002 | };
|
39003 | TabGuardComp.prototype.addTabGuards = function (topTabGuard, bottomTabGuard) {
|
39004 | this.eFocusableElement.insertAdjacentElement('afterbegin', topTabGuard);
|
39005 | this.eFocusableElement.insertAdjacentElement('beforeend', bottomTabGuard);
|
39006 | };
|
39007 | TabGuardComp.prototype.removeAllChildrenExceptTabGuards = function () {
|
39008 | var tabGuards = [this.eTopGuard, this.eBottomGuard];
|
39009 | clearElement(this.getFocusableElement());
|
39010 | this.addTabGuards.apply(this, __spread$a(tabGuards));
|
39011 | };
|
39012 | TabGuardComp.prototype.forceFocusOutOfContainer = function (up) {
|
39013 | if (up === void 0) { up = false; }
|
39014 | this.tabGuardCtrl.forceFocusOutOfContainer(up);
|
39015 | };
|
39016 | TabGuardComp.prototype.appendChild = function (newChild, container) {
|
39017 | if (!isNodeOrElement(newChild)) {
|
39018 | newChild = newChild.getGui();
|
39019 | }
|
39020 | var bottomTabGuard = this.eBottomGuard;
|
39021 | if (bottomTabGuard) {
|
39022 | bottomTabGuard.insertAdjacentElement('beforebegin', newChild);
|
39023 | }
|
39024 | else {
|
39025 | _super.prototype.appendChild.call(this, newChild, container);
|
39026 | }
|
39027 | };
|
39028 | return TabGuardComp;
|
39029 | }(Component));
|
39030 |
|
39031 |
|
39032 |
|
39033 |
|
39034 |
|
39035 |
|
39036 |
|
39037 | var __extends$U = (undefined && undefined.__extends) || (function () {
|
39038 | var extendStatics = function (d, b) {
|
39039 | extendStatics = Object.setPrototypeOf ||
|
39040 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
39041 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
39042 | return extendStatics(d, b);
|
39043 | };
|
39044 | return function (d, b) {
|
39045 | extendStatics(d, b);
|
39046 | function __() { this.constructor = d; }
|
39047 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39048 | };
|
39049 | })();
|
39050 | var __assign$5 = (undefined && undefined.__assign) || function () {
|
39051 | __assign$5 = Object.assign || function(t) {
|
39052 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
39053 | s = arguments[i];
|
39054 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
39055 | t[p] = s[p];
|
39056 | }
|
39057 | return t;
|
39058 | };
|
39059 | return __assign$5.apply(this, arguments);
|
39060 | };
|
39061 | var __decorate$W = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
39062 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
39063 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
39064 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
39065 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
39066 | };
|
39067 | var AgMenuList = (function (_super) {
|
39068 | __extends$U(AgMenuList, _super);
|
39069 | function AgMenuList(level) {
|
39070 | if (level === void 0) { level = 1; }
|
39071 | var _this = _super.call(this, "<div class=\"ag-menu-list\" role=\"tree\"></div>") || this;
|
39072 | _this.level = level;
|
39073 | _this.menuItems = [];
|
39074 | return _this;
|
39075 | }
|
39076 | AgMenuList.prototype.postConstruct = function () {
|
39077 | var _this = this;
|
39078 | this.initialiseTabGuard({
|
39079 | onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
|
39080 | handleKeyDown: function (e) { return _this.handleKeyDown(e); }
|
39081 | });
|
39082 | };
|
39083 | AgMenuList.prototype.onTabKeyDown = function (e) {
|
39084 | var parent = this.getParentComponent();
|
39085 | var parentGui = parent && parent.getGui();
|
39086 | var isManaged = parentGui && parentGui.classList.contains('ag-focus-managed');
|
39087 | if (!isManaged) {
|
39088 | e.preventDefault();
|
39089 | }
|
39090 | if (e.shiftKey) {
|
39091 | this.closeIfIsChild(e);
|
39092 | }
|
39093 | };
|
39094 | AgMenuList.prototype.handleKeyDown = function (e) {
|
39095 | switch (e.key) {
|
39096 | case KeyCode.UP:
|
39097 | case KeyCode.RIGHT:
|
39098 | case KeyCode.DOWN:
|
39099 | case KeyCode.LEFT:
|
39100 | e.preventDefault();
|
39101 | this.handleNavKey(e.key);
|
39102 | break;
|
39103 | case KeyCode.ESCAPE:
|
39104 | var topMenu = this.findTopMenu();
|
39105 | if (topMenu) {
|
39106 | this.focusService.focusInto(topMenu.getGui());
|
39107 | }
|
39108 | break;
|
39109 | }
|
39110 | };
|
39111 | AgMenuList.prototype.clearActiveItem = function () {
|
39112 | if (this.activeMenuItem) {
|
39113 | this.activeMenuItem.deactivate();
|
39114 | this.activeMenuItem = null;
|
39115 | }
|
39116 | };
|
39117 | AgMenuList.prototype.addMenuItems = function (menuItems) {
|
39118 | var _this = this;
|
39119 | if (menuItems == null) {
|
39120 | return;
|
39121 | }
|
39122 | menuItems.forEach(function (menuItemOrString) {
|
39123 | if (menuItemOrString === 'separator') {
|
39124 | _this.addSeparator();
|
39125 | }
|
39126 | else if (typeof menuItemOrString === 'string') {
|
39127 | console.warn("AG Grid: unrecognised menu item " + menuItemOrString);
|
39128 | }
|
39129 | else {
|
39130 | _this.addItem(menuItemOrString);
|
39131 | }
|
39132 | });
|
39133 | };
|
39134 | AgMenuList.prototype.addItem = function (menuItemDef) {
|
39135 | var _this = this;
|
39136 | var menuItem = this.createManagedBean(new AgMenuItemComponent(__assign$5(__assign$5({}, menuItemDef), { isAnotherSubMenuOpen: function () { return _this.menuItems.some(function (m) { return m.isSubMenuOpen(); }); } })));
|
39137 | menuItem.setParentComponent(this);
|
39138 | setAriaLevel(menuItem.getGui(), this.level);
|
39139 | this.menuItems.push(menuItem);
|
39140 | this.appendChild(menuItem.getGui());
|
39141 | this.addManagedListener(menuItem, AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED, function (event) {
|
39142 | _this.dispatchEvent(event);
|
39143 | });
|
39144 | this.addManagedListener(menuItem, AgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED, function (event) {
|
39145 | if (_this.activeMenuItem && _this.activeMenuItem !== event.menuItem) {
|
39146 | _this.activeMenuItem.deactivate();
|
39147 | }
|
39148 | _this.activeMenuItem = event.menuItem;
|
39149 | });
|
39150 | };
|
39151 | AgMenuList.prototype.activateFirstItem = function () {
|
39152 | var item = this.menuItems.filter(function (currentItem) { return !currentItem.isDisabled(); })[0];
|
39153 | if (!item) {
|
39154 | return;
|
39155 | }
|
39156 | item.activate();
|
39157 | };
|
39158 | AgMenuList.prototype.addSeparator = function () {
|
39159 | 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>";
|
39160 | this.appendChild(loadTemplate(separatorHtml));
|
39161 | };
|
39162 | AgMenuList.prototype.findTopMenu = function () {
|
39163 | var parent = this.getParentComponent();
|
39164 | if (!parent && this instanceof AgMenuList) {
|
39165 | return this;
|
39166 | }
|
39167 | while (true) {
|
39168 | var nextParent = parent && parent.getParentComponent && parent.getParentComponent();
|
39169 | if (!nextParent || (!(nextParent instanceof AgMenuList || nextParent instanceof AgMenuItemComponent))) {
|
39170 | break;
|
39171 | }
|
39172 | parent = nextParent;
|
39173 | }
|
39174 | return parent instanceof AgMenuList ? parent : undefined;
|
39175 | };
|
39176 | AgMenuList.prototype.handleNavKey = function (key) {
|
39177 | switch (key) {
|
39178 | case KeyCode.UP:
|
39179 | case KeyCode.DOWN:
|
39180 | var nextItem = this.findNextItem(key === KeyCode.UP);
|
39181 | if (nextItem && nextItem !== this.activeMenuItem) {
|
39182 | nextItem.activate();
|
39183 | }
|
39184 | return;
|
39185 | }
|
39186 | var left = this.gridOptionsService.is('enableRtl') ? KeyCode.RIGHT : KeyCode.LEFT;
|
39187 | if (key === left) {
|
39188 | this.closeIfIsChild();
|
39189 | }
|
39190 | else {
|
39191 | this.openChild();
|
39192 | }
|
39193 | };
|
39194 | AgMenuList.prototype.closeIfIsChild = function (e) {
|
39195 | var parentItem = this.getParentComponent();
|
39196 | if (parentItem && parentItem instanceof AgMenuItemComponent) {
|
39197 | if (e) {
|
39198 | e.preventDefault();
|
39199 | }
|
39200 | parentItem.closeSubMenu();
|
39201 | parentItem.getGui().focus();
|
39202 | }
|
39203 | };
|
39204 | AgMenuList.prototype.openChild = function () {
|
39205 | if (this.activeMenuItem) {
|
39206 | this.activeMenuItem.openSubMenu(true);
|
39207 | }
|
39208 | };
|
39209 | AgMenuList.prototype.findNextItem = function (up) {
|
39210 | var items = this.menuItems.filter(function (item) { return !item.isDisabled(); });
|
39211 | if (!items.length) {
|
39212 | return;
|
39213 | }
|
39214 | if (!this.activeMenuItem) {
|
39215 | return up ? last(items) : items[0];
|
39216 | }
|
39217 | if (up) {
|
39218 | items.reverse();
|
39219 | }
|
39220 | var nextItem;
|
39221 | var foundCurrent = false;
|
39222 | for (var i = 0; i < items.length; i++) {
|
39223 | var item = items[i];
|
39224 | if (!foundCurrent) {
|
39225 | if (item === this.activeMenuItem) {
|
39226 | foundCurrent = true;
|
39227 | }
|
39228 | continue;
|
39229 | }
|
39230 | nextItem = item;
|
39231 | break;
|
39232 | }
|
39233 | return nextItem || this.activeMenuItem;
|
39234 | };
|
39235 | AgMenuList.prototype.destroy = function () {
|
39236 | this.clearActiveItem();
|
39237 | _super.prototype.destroy.call(this);
|
39238 | };
|
39239 | __decorate$W([
|
39240 | Autowired('focusService')
|
39241 | ], AgMenuList.prototype, "focusService", void 0);
|
39242 | __decorate$W([
|
39243 | PostConstruct
|
39244 | ], AgMenuList.prototype, "postConstruct", null);
|
39245 | return AgMenuList;
|
39246 | }(TabGuardComp));
|
39247 |
|
39248 |
|
39249 |
|
39250 |
|
39251 |
|
39252 |
|
39253 |
|
39254 | var __extends$T = (undefined && undefined.__extends) || (function () {
|
39255 | var extendStatics = function (d, b) {
|
39256 | extendStatics = Object.setPrototypeOf ||
|
39257 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
39258 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
39259 | return extendStatics(d, b);
|
39260 | };
|
39261 | return function (d, b) {
|
39262 | extendStatics(d, b);
|
39263 | function __() { this.constructor = d; }
|
39264 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39265 | };
|
39266 | })();
|
39267 | var __decorate$V = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
39268 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
39269 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
39270 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
39271 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
39272 | };
|
39273 | var AgMenuPanel = (function (_super) {
|
39274 | __extends$T(AgMenuPanel, _super);
|
39275 | function AgMenuPanel(wrappedComponent) {
|
39276 | var _this = _super.call(this) || this;
|
39277 | _this.wrappedComponent = wrappedComponent;
|
39278 | _this.setTemplateFromElement(wrappedComponent.getGui());
|
39279 | return _this;
|
39280 | }
|
39281 | AgMenuPanel.prototype.postConstruct = function () {
|
39282 | var _this = this;
|
39283 | this.initialiseTabGuard({
|
39284 | onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
|
39285 | handleKeyDown: function (e) { return _this.handleKeyDown(e); }
|
39286 | });
|
39287 | };
|
39288 | AgMenuPanel.prototype.handleKeyDown = function (e) {
|
39289 | if (e.key === KeyCode.ESCAPE) {
|
39290 | this.closePanel();
|
39291 | }
|
39292 | };
|
39293 | AgMenuPanel.prototype.onTabKeyDown = function (e) {
|
39294 | if (e.defaultPrevented) {
|
39295 | return;
|
39296 | }
|
39297 | this.closePanel();
|
39298 | e.preventDefault();
|
39299 | };
|
39300 | AgMenuPanel.prototype.closePanel = function () {
|
39301 | var menuItem = this.parentComponent;
|
39302 | menuItem.closeSubMenu();
|
39303 | setTimeout(function () { return menuItem.getGui().focus(); }, 0);
|
39304 | };
|
39305 | __decorate$V([
|
39306 | PostConstruct
|
39307 | ], AgMenuPanel.prototype, "postConstruct", null);
|
39308 | return AgMenuPanel;
|
39309 | }(TabGuardComp));
|
39310 |
|
39311 |
|
39312 |
|
39313 |
|
39314 |
|
39315 |
|
39316 |
|
39317 | var __extends$S = (undefined && undefined.__extends) || (function () {
|
39318 | var extendStatics = function (d, b) {
|
39319 | extendStatics = Object.setPrototypeOf ||
|
39320 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
39321 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
39322 | return extendStatics(d, b);
|
39323 | };
|
39324 | return function (d, b) {
|
39325 | extendStatics(d, b);
|
39326 | function __() { this.constructor = d; }
|
39327 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39328 | };
|
39329 | })();
|
39330 | var __decorate$U = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
39331 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
39332 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
39333 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
39334 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
39335 | };
|
39336 | var AgMenuItemComponent = (function (_super) {
|
39337 | __extends$S(AgMenuItemComponent, _super);
|
39338 | function AgMenuItemComponent(params) {
|
39339 | var _this = _super.call(this) || this;
|
39340 | _this.params = params;
|
39341 | _this.isActive = false;
|
39342 | _this.subMenuIsOpen = false;
|
39343 | _this.setTemplate( "<div class=\"" + _this.getClassName() + "\" tabindex=\"-1\" role=\"treeitem\"></div>");
|
39344 | return _this;
|
39345 | }
|
39346 | AgMenuItemComponent.prototype.init = function () {
|
39347 | var _this = this;
|
39348 | this.addIcon();
|
39349 | this.addName();
|
39350 | this.addShortcut();
|
39351 | this.addSubMenu();
|
39352 | this.addTooltip();
|
39353 | var eGui = this.getGui();
|
39354 | if (this.params.disabled) {
|
39355 | this.addCssClass(this.getClassName('disabled'));
|
39356 | setAriaDisabled(eGui, true);
|
39357 | }
|
39358 | else {
|
39359 | this.addGuiEventListener('click', function (e) { return _this.onItemSelected(e); });
|
39360 | this.addGuiEventListener('keydown', function (e) {
|
39361 | if (e.key === KeyCode.ENTER || e.key === KeyCode.SPACE) {
|
39362 | e.preventDefault();
|
39363 | _this.onItemSelected(e);
|
39364 | }
|
39365 | });
|
39366 | this.addGuiEventListener('mousedown', function (e) {
|
39367 |
|
39368 |
|
39369 | e.stopPropagation();
|
39370 | e.preventDefault();
|
39371 | });
|
39372 | this.addGuiEventListener('mouseenter', function () { return _this.onMouseEnter(); });
|
39373 | this.addGuiEventListener('mouseleave', function () { return _this.onMouseLeave(); });
|
39374 | }
|
39375 | if (this.params.cssClasses) {
|
39376 | this.params.cssClasses.forEach(function (it) { return _this.addCssClass(it); });
|
39377 | }
|
39378 | };
|
39379 | AgMenuItemComponent.prototype.isDisabled = function () {
|
39380 | return !!this.params.disabled;
|
39381 | };
|
39382 | AgMenuItemComponent.prototype.openSubMenu = function (activateFirstItem) {
|
39383 | var _this = this;
|
39384 | if (activateFirstItem === void 0) { activateFirstItem = false; }
|
39385 | this.closeSubMenu();
|
39386 | if (!this.params.subMenu) {
|
39387 | return;
|
39388 | }
|
39389 | var ePopup = loadTemplate( "<div class=\"ag-menu\" role=\"presentation\"></div>");
|
39390 | var destroySubMenu;
|
39391 | if (this.params.subMenu instanceof Array) {
|
39392 | var currentLevel = getAriaLevel(this.getGui());
|
39393 | var nextLevel = isNaN(currentLevel) ? 1 : (currentLevel + 1);
|
39394 | var childMenu_1 = this.createBean(new AgMenuList(nextLevel));
|
39395 | childMenu_1.setParentComponent(this);
|
39396 | childMenu_1.addMenuItems(this.params.subMenu);
|
39397 | ePopup.appendChild(childMenu_1.getGui());
|
39398 |
|
39399 | this.addManagedListener(childMenu_1, AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED, function (e) { return _this.dispatchEvent(e); });
|
39400 | childMenu_1.addGuiEventListener('mouseenter', function () { return _this.cancelDeactivate(); });
|
39401 | destroySubMenu = function () { return _this.destroyBean(childMenu_1); };
|
39402 | if (activateFirstItem) {
|
39403 | setTimeout(function () { return childMenu_1.activateFirstItem(); }, 0);
|
39404 | }
|
39405 | }
|
39406 | else {
|
39407 | var subMenu_1 = this.params.subMenu;
|
39408 | var menuPanel = this.createBean(new AgMenuPanel(subMenu_1));
|
39409 | menuPanel.setParentComponent(this);
|
39410 | var subMenuGui_1 = menuPanel.getGui();
|
39411 | var mouseEvent_1 = 'mouseenter';
|
39412 | var mouseEnterListener_1 = function () { return _this.cancelDeactivate(); };
|
39413 | subMenuGui_1.addEventListener(mouseEvent_1, mouseEnterListener_1);
|
39414 | destroySubMenu = function () { return subMenuGui_1.removeEventListener(mouseEvent_1, mouseEnterListener_1); };
|
39415 | ePopup.appendChild(subMenuGui_1);
|
39416 | if (subMenu_1.afterGuiAttached) {
|
39417 | setTimeout(function () { return subMenu_1.afterGuiAttached(); }, 0);
|
39418 | }
|
39419 | }
|
39420 | var eGui = this.getGui();
|
39421 | var positionCallback = this.popupService.positionPopupForMenu.bind(this.popupService, { eventSource: eGui, ePopup: ePopup, shouldSetMaxHeight: this.params.shouldSetMaxHeight });
|
39422 | var translate = this.localeService.getLocaleTextFunc();
|
39423 | var addPopupRes = this.popupService.addPopup({
|
39424 | modal: true,
|
39425 | eChild: ePopup,
|
39426 | positionCallback: positionCallback,
|
39427 | anchorToElement: eGui,
|
39428 | ariaLabel: translate('ariaLabelSubMenu', 'SubMenu')
|
39429 | });
|
39430 | this.subMenuIsOpen = true;
|
39431 | setAriaExpanded(eGui, true);
|
39432 | this.hideSubMenu = function () {
|
39433 | if (addPopupRes) {
|
39434 | addPopupRes.hideFunc();
|
39435 | }
|
39436 | _this.subMenuIsOpen = false;
|
39437 | setAriaExpanded(eGui, false);
|
39438 | destroySubMenu();
|
39439 | };
|
39440 | };
|
39441 | AgMenuItemComponent.prototype.closeSubMenu = function () {
|
39442 | if (!this.hideSubMenu) {
|
39443 | return;
|
39444 | }
|
39445 | this.hideSubMenu();
|
39446 | this.hideSubMenu = null;
|
39447 | setAriaExpanded(this.getGui(), false);
|
39448 | };
|
39449 | AgMenuItemComponent.prototype.isSubMenuOpen = function () {
|
39450 | return this.subMenuIsOpen;
|
39451 | };
|
39452 | AgMenuItemComponent.prototype.activate = function (openSubMenu) {
|
39453 | var _this = this;
|
39454 | this.cancelActivate();
|
39455 | if (this.params.disabled) {
|
39456 | return;
|
39457 | }
|
39458 | this.isActive = true;
|
39459 | this.addCssClass(this.getClassName('active'));
|
39460 | this.getGui().focus();
|
39461 | if (openSubMenu && this.params.subMenu) {
|
39462 | window.setTimeout(function () {
|
39463 | if (_this.isAlive() && _this.isActive) {
|
39464 | _this.openSubMenu();
|
39465 | }
|
39466 | }, 300);
|
39467 | }
|
39468 | this.onItemActivated();
|
39469 | };
|
39470 | AgMenuItemComponent.prototype.deactivate = function () {
|
39471 | this.cancelDeactivate();
|
39472 | this.removeCssClass(this.getClassName('active'));
|
39473 | this.isActive = false;
|
39474 | if (this.subMenuIsOpen) {
|
39475 | this.hideSubMenu();
|
39476 | }
|
39477 | };
|
39478 | AgMenuItemComponent.prototype.addIcon = function () {
|
39479 | if (!this.params.checked && !this.params.icon && this.params.isCompact) {
|
39480 | return;
|
39481 | }
|
39482 | var icon = loadTemplate( "<span ref=\"eIcon\" class=\"" + this.getClassName('part') + " " + this.getClassName('icon') + "\" role=\"presentation\"></span>");
|
39483 | if (this.params.checked) {
|
39484 | icon.appendChild(createIconNoSpan('check', this.gridOptionsService));
|
39485 | }
|
39486 | else if (this.params.icon) {
|
39487 | if (isNodeOrElement(this.params.icon)) {
|
39488 | icon.appendChild(this.params.icon);
|
39489 | }
|
39490 | else if (typeof this.params.icon === 'string') {
|
39491 | icon.innerHTML = this.params.icon;
|
39492 | }
|
39493 | else {
|
39494 | console.warn('AG Grid: menu item icon must be DOM node or string');
|
39495 | }
|
39496 | }
|
39497 | this.getGui().appendChild(icon);
|
39498 | };
|
39499 | AgMenuItemComponent.prototype.addName = function () {
|
39500 | if (!this.params.name && this.params.isCompact) {
|
39501 | return;
|
39502 | }
|
39503 | var name = loadTemplate( "<span ref=\"eName\" class=\"" + this.getClassName('part') + " " + this.getClassName('text') + "\">" + (this.params.name || '') + "</span>");
|
39504 | this.getGui().appendChild(name);
|
39505 | };
|
39506 | AgMenuItemComponent.prototype.addTooltip = function () {
|
39507 | if (!this.params.tooltip) {
|
39508 | return;
|
39509 | }
|
39510 | this.tooltip = this.params.tooltip;
|
39511 | if (this.gridOptionsService.is('enableBrowserTooltips')) {
|
39512 | this.getGui().setAttribute('title', this.tooltip);
|
39513 | }
|
39514 | else {
|
39515 | this.createManagedBean(new CustomTooltipFeature(this));
|
39516 | }
|
39517 | };
|
39518 | AgMenuItemComponent.prototype.getTooltipParams = function () {
|
39519 | return {
|
39520 | location: 'menu',
|
39521 | value: this.tooltip
|
39522 | };
|
39523 | };
|
39524 | AgMenuItemComponent.prototype.addShortcut = function () {
|
39525 | if (!this.params.shortcut && this.params.isCompact) {
|
39526 | return;
|
39527 | }
|
39528 | var shortcut = loadTemplate( "<span ref=\"eShortcut\" class=\"" + this.getClassName('part') + " " + this.getClassName('shortcut') + "\">" + (this.params.shortcut || '') + "</span>");
|
39529 | this.getGui().appendChild(shortcut);
|
39530 | };
|
39531 | AgMenuItemComponent.prototype.addSubMenu = function () {
|
39532 | if (!this.params.subMenu && this.params.isCompact) {
|
39533 | return;
|
39534 | }
|
39535 | var pointer = loadTemplate( "<span ref=\"ePopupPointer\" class=\"" + this.getClassName('part') + " " + this.getClassName('popup-pointer') + "\"></span>");
|
39536 | var eGui = this.getGui();
|
39537 | if (this.params.subMenu) {
|
39538 | var iconName = this.gridOptionsService.is('enableRtl') ? 'smallLeft' : 'smallRight';
|
39539 | setAriaExpanded(eGui, false);
|
39540 | pointer.appendChild(createIconNoSpan(iconName, this.gridOptionsService));
|
39541 | }
|
39542 | eGui.appendChild(pointer);
|
39543 | };
|
39544 | AgMenuItemComponent.prototype.onItemSelected = function (event) {
|
39545 | if (this.params.action) {
|
39546 | this.params.action();
|
39547 | }
|
39548 | else {
|
39549 | this.openSubMenu(event && event.type === 'keydown');
|
39550 | }
|
39551 | if (this.params.subMenu && !this.params.action) {
|
39552 | return;
|
39553 | }
|
39554 | var e = {
|
39555 | type: AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED,
|
39556 | action: this.params.action,
|
39557 | checked: this.params.checked,
|
39558 | cssClasses: this.params.cssClasses,
|
39559 | disabled: this.params.disabled,
|
39560 | icon: this.params.icon,
|
39561 | name: this.params.name,
|
39562 | shortcut: this.params.shortcut,
|
39563 | subMenu: this.params.subMenu,
|
39564 | tooltip: this.params.tooltip,
|
39565 | event: event
|
39566 | };
|
39567 | this.dispatchEvent(e);
|
39568 | };
|
39569 | AgMenuItemComponent.prototype.onItemActivated = function () {
|
39570 | var event = {
|
39571 | type: AgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED,
|
39572 | menuItem: this,
|
39573 | };
|
39574 | this.dispatchEvent(event);
|
39575 | };
|
39576 | AgMenuItemComponent.prototype.cancelActivate = function () {
|
39577 | if (this.activateTimeoutId) {
|
39578 | window.clearTimeout(this.activateTimeoutId);
|
39579 | this.activateTimeoutId = 0;
|
39580 | }
|
39581 | };
|
39582 | AgMenuItemComponent.prototype.cancelDeactivate = function () {
|
39583 | if (this.deactivateTimeoutId) {
|
39584 | window.clearTimeout(this.deactivateTimeoutId);
|
39585 | this.deactivateTimeoutId = 0;
|
39586 | }
|
39587 | };
|
39588 | AgMenuItemComponent.prototype.onMouseEnter = function () {
|
39589 | var _this = this;
|
39590 | this.cancelDeactivate();
|
39591 | if (this.params.isAnotherSubMenuOpen()) {
|
39592 |
|
39593 | this.activateTimeoutId = window.setTimeout(function () { return _this.activate(true); }, AgMenuItemComponent.ACTIVATION_DELAY);
|
39594 | }
|
39595 | else {
|
39596 |
|
39597 | this.activate(true);
|
39598 | }
|
39599 | };
|
39600 | AgMenuItemComponent.prototype.onMouseLeave = function () {
|
39601 | var _this = this;
|
39602 | this.cancelActivate();
|
39603 | if (this.isSubMenuOpen()) {
|
39604 |
|
39605 | this.deactivateTimeoutId = window.setTimeout(function () { return _this.deactivate(); }, AgMenuItemComponent.ACTIVATION_DELAY);
|
39606 | }
|
39607 | else {
|
39608 |
|
39609 | this.deactivate();
|
39610 | }
|
39611 | };
|
39612 | AgMenuItemComponent.prototype.getClassName = function (suffix) {
|
39613 | var prefix = this.params.isCompact ? 'ag-compact-menu-option' : 'ag-menu-option';
|
39614 | return suffix ? prefix + "-" + suffix : prefix;
|
39615 | };
|
39616 | AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED = 'menuItemSelected';
|
39617 | AgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED = 'menuItemActivated';
|
39618 | AgMenuItemComponent.ACTIVATION_DELAY = 80;
|
39619 | __decorate$U([
|
39620 | Autowired('popupService')
|
39621 | ], AgMenuItemComponent.prototype, "popupService", void 0);
|
39622 | __decorate$U([
|
39623 | PostConstruct
|
39624 | ], AgMenuItemComponent.prototype, "init", null);
|
39625 | return AgMenuItemComponent;
|
39626 | }(Component));
|
39627 |
|
39628 |
|
39629 |
|
39630 |
|
39631 |
|
39632 |
|
39633 |
|
39634 | var __extends$R = (undefined && undefined.__extends) || (function () {
|
39635 | var extendStatics = function (d, b) {
|
39636 | extendStatics = Object.setPrototypeOf ||
|
39637 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
39638 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
39639 | return extendStatics(d, b);
|
39640 | };
|
39641 | return function (d, b) {
|
39642 | extendStatics(d, b);
|
39643 | function __() { this.constructor = d; }
|
39644 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39645 | };
|
39646 | })();
|
39647 | var __decorate$T = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
39648 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
39649 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
39650 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
39651 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
39652 | };
|
39653 | var AgPanel = (function (_super) {
|
39654 | __extends$R(AgPanel, _super);
|
39655 | function AgPanel(config) {
|
39656 | var _this = _super.call(this, AgPanel.getTemplate(config)) || this;
|
39657 | _this.closable = true;
|
39658 | _this.config = config;
|
39659 | return _this;
|
39660 | }
|
39661 | AgPanel.getTemplate = function (config) {
|
39662 | var cssIdentifier = (config && config.cssIdentifier) || 'default';
|
39663 | 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>";
|
39664 | };
|
39665 | AgPanel.prototype.postConstruct = function () {
|
39666 | var _this = this;
|
39667 | 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;
|
39668 | this.positionableFeature = new PositionableFeature(this.getGui(), {
|
39669 | minWidth: minWidth, width: width, minHeight: minHeight, height: height, centered: centered, x: x, y: y, popup: popup,
|
39670 | calculateTopBuffer: function () { return _this.positionableFeature.getHeight() - _this.getBodyHeight(); }
|
39671 | });
|
39672 | this.createManagedBean(this.positionableFeature);
|
39673 | var eGui = this.getGui();
|
39674 | if (component) {
|
39675 | this.setBodyComponent(component);
|
39676 | }
|
39677 | if (!hideTitleBar) {
|
39678 | if (title) {
|
39679 | this.setTitle(title);
|
39680 | }
|
39681 | this.setClosable(closable != null ? closable : this.closable);
|
39682 | }
|
39683 | else {
|
39684 | setDisplayed(this.eTitleBar, false);
|
39685 | }
|
39686 | this.addManagedListener(this.eTitleBar, 'mousedown', function (e) {
|
39687 | var eDocument = _this.gridOptionsService.getDocument();
|
39688 | if (eGui.contains(e.relatedTarget) ||
|
39689 | eGui.contains(eDocument.activeElement) ||
|
39690 | _this.eTitleBarButtons.contains(e.target)) {
|
39691 | e.preventDefault();
|
39692 | return;
|
39693 | }
|
39694 | var focusEl = _this.eContentWrapper.querySelector('button, [href], input, select, textarea, [tabindex]');
|
39695 | if (focusEl) {
|
39696 | focusEl.focus();
|
39697 | }
|
39698 | });
|
39699 | if (popup && this.positionableFeature.isPositioned()) {
|
39700 | return;
|
39701 | }
|
39702 | if (this.renderComponent) {
|
39703 | this.renderComponent();
|
39704 | }
|
39705 | this.positionableFeature.initialisePosition();
|
39706 | this.eContentWrapper.style.height = '0';
|
39707 | };
|
39708 | AgPanel.prototype.renderComponent = function () {
|
39709 | var _this = this;
|
39710 | var eGui = this.getGui();
|
39711 | eGui.focus();
|
39712 | this.close = function () {
|
39713 | eGui.parentElement.removeChild(eGui);
|
39714 | _this.destroy();
|
39715 | };
|
39716 | };
|
39717 | AgPanel.prototype.getHeight = function () {
|
39718 | return this.positionableFeature.getHeight();
|
39719 | };
|
39720 | AgPanel.prototype.setHeight = function (height) {
|
39721 | this.positionableFeature.setHeight(height);
|
39722 | };
|
39723 | AgPanel.prototype.getWidth = function () {
|
39724 | return this.positionableFeature.getWidth();
|
39725 | };
|
39726 | AgPanel.prototype.setWidth = function (width) {
|
39727 | this.positionableFeature.setWidth(width);
|
39728 | };
|
39729 | AgPanel.prototype.setClosable = function (closable) {
|
39730 | if (closable !== this.closable) {
|
39731 | this.closable = closable;
|
39732 | }
|
39733 | if (closable) {
|
39734 | var closeButtonComp = this.closeButtonComp = new Component(AgPanel.CLOSE_BTN_TEMPLATE);
|
39735 | this.getContext().createBean(closeButtonComp);
|
39736 | var eGui = closeButtonComp.getGui();
|
39737 | var child = createIconNoSpan('close', this.gridOptionsService);
|
39738 | child.classList.add('ag-panel-title-bar-button-icon');
|
39739 | eGui.appendChild(child);
|
39740 | this.addTitleBarButton(closeButtonComp);
|
39741 | closeButtonComp.addManagedListener(eGui, 'click', this.onBtClose.bind(this));
|
39742 | }
|
39743 | else if (this.closeButtonComp) {
|
39744 | var eGui = this.closeButtonComp.getGui();
|
39745 | eGui.parentElement.removeChild(eGui);
|
39746 | this.closeButtonComp = this.destroyBean(this.closeButtonComp);
|
39747 | }
|
39748 | };
|
39749 | AgPanel.prototype.setBodyComponent = function (bodyComponent) {
|
39750 | bodyComponent.setParentComponent(this);
|
39751 | this.eContentWrapper.appendChild(bodyComponent.getGui());
|
39752 | };
|
39753 | AgPanel.prototype.addTitleBarButton = function (button, position) {
|
39754 | var eTitleBarButtons = this.eTitleBarButtons;
|
39755 | var buttons = eTitleBarButtons.children;
|
39756 | var len = buttons.length;
|
39757 | if (position == null) {
|
39758 | position = len;
|
39759 | }
|
39760 | position = Math.max(0, Math.min(position, len));
|
39761 | button.addCssClass('ag-panel-title-bar-button');
|
39762 | var eGui = button.getGui();
|
39763 | if (position === 0) {
|
39764 | eTitleBarButtons.insertAdjacentElement('afterbegin', eGui);
|
39765 | }
|
39766 | else if (position === len) {
|
39767 | eTitleBarButtons.insertAdjacentElement('beforeend', eGui);
|
39768 | }
|
39769 | else {
|
39770 | buttons[position - 1].insertAdjacentElement('afterend', eGui);
|
39771 | }
|
39772 | button.setParentComponent(this);
|
39773 | };
|
39774 | AgPanel.prototype.getBodyHeight = function () {
|
39775 | return getInnerHeight(this.eContentWrapper);
|
39776 | };
|
39777 | AgPanel.prototype.getBodyWidth = function () {
|
39778 | return getInnerWidth(this.eContentWrapper);
|
39779 | };
|
39780 | AgPanel.prototype.setTitle = function (title) {
|
39781 | this.eTitle.innerText = title;
|
39782 | };
|
39783 |
|
39784 | AgPanel.prototype.onBtClose = function () {
|
39785 | this.close();
|
39786 | };
|
39787 | AgPanel.prototype.destroy = function () {
|
39788 | if (this.closeButtonComp) {
|
39789 | this.closeButtonComp = this.destroyBean(this.closeButtonComp);
|
39790 | }
|
39791 | var eGui = this.getGui();
|
39792 | if (eGui && eGui.offsetParent) {
|
39793 | this.close();
|
39794 | }
|
39795 | _super.prototype.destroy.call(this);
|
39796 | };
|
39797 | AgPanel.CLOSE_BTN_TEMPLATE = "<div class=\"ag-button\"></div>";
|
39798 | __decorate$T([
|
39799 | RefSelector('eContentWrapper')
|
39800 | ], AgPanel.prototype, "eContentWrapper", void 0);
|
39801 | __decorate$T([
|
39802 | RefSelector('eTitleBar')
|
39803 | ], AgPanel.prototype, "eTitleBar", void 0);
|
39804 | __decorate$T([
|
39805 | RefSelector('eTitleBarButtons')
|
39806 | ], AgPanel.prototype, "eTitleBarButtons", void 0);
|
39807 | __decorate$T([
|
39808 | RefSelector('eTitle')
|
39809 | ], AgPanel.prototype, "eTitle", void 0);
|
39810 | __decorate$T([
|
39811 | PostConstruct
|
39812 | ], AgPanel.prototype, "postConstruct", null);
|
39813 | return AgPanel;
|
39814 | }(Component));
|
39815 |
|
39816 |
|
39817 |
|
39818 |
|
39819 |
|
39820 |
|
39821 |
|
39822 | var __extends$Q = (undefined && undefined.__extends) || (function () {
|
39823 | var extendStatics = function (d, b) {
|
39824 | extendStatics = Object.setPrototypeOf ||
|
39825 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
39826 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
39827 | return extendStatics(d, b);
|
39828 | };
|
39829 | return function (d, b) {
|
39830 | extendStatics(d, b);
|
39831 | function __() { this.constructor = d; }
|
39832 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39833 | };
|
39834 | })();
|
39835 | var __assign$4 = (undefined && undefined.__assign) || function () {
|
39836 | __assign$4 = Object.assign || function(t) {
|
39837 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
39838 | s = arguments[i];
|
39839 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
39840 | t[p] = s[p];
|
39841 | }
|
39842 | return t;
|
39843 | };
|
39844 | return __assign$4.apply(this, arguments);
|
39845 | };
|
39846 | var __decorate$S = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
39847 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
39848 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
39849 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
39850 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
39851 | };
|
39852 | var AgDialog = (function (_super) {
|
39853 | __extends$Q(AgDialog, _super);
|
39854 | function AgDialog(config) {
|
39855 | var _this = _super.call(this, __assign$4(__assign$4({}, config), { popup: true })) || this;
|
39856 | _this.isMaximizable = false;
|
39857 | _this.isMaximized = false;
|
39858 | _this.maximizeListeners = [];
|
39859 | _this.resizeListenerDestroy = null;
|
39860 | _this.lastPosition = {
|
39861 | x: 0,
|
39862 | y: 0,
|
39863 | width: 0,
|
39864 | height: 0
|
39865 | };
|
39866 | return _this;
|
39867 | }
|
39868 | AgDialog.prototype.postConstruct = function () {
|
39869 | var _this = this;
|
39870 | var eGui = this.getGui();
|
39871 | var _a = this.config, movable = _a.movable, resizable = _a.resizable, maximizable = _a.maximizable;
|
39872 | this.addCssClass('ag-dialog');
|
39873 | _super.prototype.postConstruct.call(this);
|
39874 | this.addManagedListener(eGui, 'focusin', function (e) {
|
39875 | if (eGui.contains(e.relatedTarget)) {
|
39876 | return;
|
39877 | }
|
39878 | _this.popupService.bringPopupToFront(eGui);
|
39879 | });
|
39880 | if (movable) {
|
39881 | this.setMovable(movable);
|
39882 | }
|
39883 | if (maximizable) {
|
39884 | this.setMaximizable(maximizable);
|
39885 | }
|
39886 | if (resizable) {
|
39887 | this.setResizable(resizable);
|
39888 | }
|
39889 | };
|
39890 | AgDialog.prototype.renderComponent = function () {
|
39891 | var eGui = this.getGui();
|
39892 | var _a = this.config, alwaysOnTop = _a.alwaysOnTop, modal = _a.modal, title = _a.title;
|
39893 | var translate = this.localeService.getLocaleTextFunc();
|
39894 | var addPopupRes = this.popupService.addPopup({
|
39895 | modal: modal,
|
39896 | eChild: eGui,
|
39897 | closeOnEsc: true,
|
39898 | closedCallback: this.destroy.bind(this),
|
39899 | alwaysOnTop: alwaysOnTop,
|
39900 | ariaLabel: title || translate('ariaLabelDialog', 'Dialog')
|
39901 | });
|
39902 | if (addPopupRes) {
|
39903 | this.close = addPopupRes.hideFunc;
|
39904 | }
|
39905 | };
|
39906 | AgDialog.prototype.toggleMaximize = function () {
|
39907 | var position = this.positionableFeature.getPosition();
|
39908 | if (this.isMaximized) {
|
39909 | var _a = this.lastPosition, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
39910 | this.setWidth(width);
|
39911 | this.setHeight(height);
|
39912 | this.positionableFeature.offsetElement(x, y);
|
39913 | }
|
39914 | else {
|
39915 | this.lastPosition.width = this.getWidth();
|
39916 | this.lastPosition.height = this.getHeight();
|
39917 | this.lastPosition.x = position.x;
|
39918 | this.lastPosition.y = position.y;
|
39919 | this.positionableFeature.offsetElement(0, 0);
|
39920 | this.setHeight('100%');
|
39921 | this.setWidth('100%');
|
39922 | }
|
39923 | this.isMaximized = !this.isMaximized;
|
39924 | this.refreshMaximizeIcon();
|
39925 | };
|
39926 | AgDialog.prototype.refreshMaximizeIcon = function () {
|
39927 | setDisplayed(this.maximizeIcon, !this.isMaximized);
|
39928 | setDisplayed(this.minimizeIcon, this.isMaximized);
|
39929 | };
|
39930 | AgDialog.prototype.clearMaximizebleListeners = function () {
|
39931 | if (this.maximizeListeners.length) {
|
39932 | this.maximizeListeners.forEach(function (destroyListener) { return destroyListener(); });
|
39933 | this.maximizeListeners.length = 0;
|
39934 | }
|
39935 | if (this.resizeListenerDestroy) {
|
39936 | this.resizeListenerDestroy();
|
39937 | this.resizeListenerDestroy = null;
|
39938 | }
|
39939 | };
|
39940 | AgDialog.prototype.destroy = function () {
|
39941 | this.maximizeButtonComp = this.destroyBean(this.maximizeButtonComp);
|
39942 | this.clearMaximizebleListeners();
|
39943 | _super.prototype.destroy.call(this);
|
39944 | };
|
39945 | AgDialog.prototype.setResizable = function (resizable) {
|
39946 | this.positionableFeature.setResizable(resizable);
|
39947 | };
|
39948 | AgDialog.prototype.setMovable = function (movable) {
|
39949 | this.positionableFeature.setMovable(movable, this.eTitleBar);
|
39950 | };
|
39951 | AgDialog.prototype.setMaximizable = function (maximizable) {
|
39952 | var _this = this;
|
39953 | if (!maximizable) {
|
39954 | this.clearMaximizebleListeners();
|
39955 | if (this.maximizeButtonComp) {
|
39956 | this.destroyBean(this.maximizeButtonComp);
|
39957 | this.maximizeButtonComp = this.maximizeIcon = this.minimizeIcon = undefined;
|
39958 | }
|
39959 | return;
|
39960 | }
|
39961 | var eTitleBar = this.eTitleBar;
|
39962 | if (!eTitleBar || maximizable === this.isMaximizable) {
|
39963 | return;
|
39964 | }
|
39965 | var maximizeButtonComp = this.buildMaximizeAndMinimizeElements();
|
39966 | this.refreshMaximizeIcon();
|
39967 | maximizeButtonComp.addManagedListener(maximizeButtonComp.getGui(), 'click', this.toggleMaximize.bind(this));
|
39968 | this.addTitleBarButton(maximizeButtonComp, 0);
|
39969 | this.maximizeListeners.push(this.addManagedListener(eTitleBar, 'dblclick', this.toggleMaximize.bind(this)));
|
39970 | this.resizeListenerDestroy = this.addManagedListener(this, 'resize', function () {
|
39971 | _this.isMaximized = false;
|
39972 | _this.refreshMaximizeIcon();
|
39973 | });
|
39974 | };
|
39975 | AgDialog.prototype.buildMaximizeAndMinimizeElements = function () {
|
39976 | var maximizeButtonComp = this.maximizeButtonComp =
|
39977 | this.createBean(new Component( "<div class=\"ag-dialog-button\"></span>"));
|
39978 | var eGui = maximizeButtonComp.getGui();
|
39979 | this.maximizeIcon = createIconNoSpan('maximize', this.gridOptionsService);
|
39980 | eGui.appendChild(this.maximizeIcon);
|
39981 | this.maximizeIcon.classList.add('ag-panel-title-bar-button-icon');
|
39982 | this.minimizeIcon = createIconNoSpan('minimize', this.gridOptionsService);
|
39983 | eGui.appendChild(this.minimizeIcon);
|
39984 | this.minimizeIcon.classList.add('ag-panel-title-bar-button-icon');
|
39985 | return maximizeButtonComp;
|
39986 | };
|
39987 | __decorate$S([
|
39988 | Autowired('popupService')
|
39989 | ], AgDialog.prototype, "popupService", void 0);
|
39990 | return AgDialog;
|
39991 | }(AgPanel));
|
39992 |
|
39993 |
|
39994 |
|
39995 |
|
39996 |
|
39997 |
|
39998 |
|
39999 | var __extends$P = (undefined && undefined.__extends) || (function () {
|
40000 | var extendStatics = function (d, b) {
|
40001 | extendStatics = Object.setPrototypeOf ||
|
40002 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
40003 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
40004 | return extendStatics(d, b);
|
40005 | };
|
40006 | return function (d, b) {
|
40007 | extendStatics(d, b);
|
40008 | function __() { this.constructor = d; }
|
40009 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
40010 | };
|
40011 | })();
|
40012 | var __assign$3 = (undefined && undefined.__assign) || function () {
|
40013 | __assign$3 = Object.assign || function(t) {
|
40014 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
40015 | s = arguments[i];
|
40016 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
40017 | t[p] = s[p];
|
40018 | }
|
40019 | return t;
|
40020 | };
|
40021 | return __assign$3.apply(this, arguments);
|
40022 | };
|
40023 | var __decorate$R = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
40024 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
40025 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
40026 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
40027 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
40028 | };
|
40029 | var __read$b = (undefined && undefined.__read) || function (o, n) {
|
40030 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
40031 | if (!m) return o;
|
40032 | var i = m.call(o), r, ar = [], e;
|
40033 | try {
|
40034 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
40035 | }
|
40036 | catch (error) { e = { error: error }; }
|
40037 | finally {
|
40038 | try {
|
40039 | if (r && !r.done && (m = i["return"])) m.call(i);
|
40040 | }
|
40041 | finally { if (e) throw e.error; }
|
40042 | }
|
40043 | return ar;
|
40044 | };
|
40045 | var __spread$9 = (undefined && undefined.__spread) || function () {
|
40046 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$b(arguments[i]));
|
40047 | return ar;
|
40048 | };
|
40049 | var FocusService = (function (_super) {
|
40050 | __extends$P(FocusService, _super);
|
40051 | function FocusService() {
|
40052 | return _super !== null && _super.apply(this, arguments) || this;
|
40053 | }
|
40054 | FocusService_1 = FocusService;
|
40055 | |
40056 |
|
40057 |
|
40058 |
|
40059 |
|
40060 |
|
40061 |
|
40062 | FocusService.addKeyboardModeEvents = function (doc, controller) {
|
40063 | var docControllers = FocusService_1.instancesMonitored.get(doc);
|
40064 | if (docControllers && docControllers.length > 0) {
|
40065 | if (docControllers.indexOf(controller) === -1) {
|
40066 | docControllers.push(controller);
|
40067 | }
|
40068 | }
|
40069 | else {
|
40070 | FocusService_1.instancesMonitored.set(doc, [controller]);
|
40071 | doc.addEventListener('keydown', FocusService_1.toggleKeyboardMode);
|
40072 | doc.addEventListener('mousedown', FocusService_1.toggleKeyboardMode);
|
40073 | }
|
40074 | };
|
40075 | |
40076 |
|
40077 |
|
40078 |
|
40079 |
|
40080 |
|
40081 |
|
40082 | FocusService.removeKeyboardModeEvents = function (doc, controller) {
|
40083 | var docControllers = FocusService_1.instancesMonitored.get(doc);
|
40084 | var newControllers = [];
|
40085 | if (docControllers && docControllers.length) {
|
40086 | newControllers = __spread$9(docControllers).filter(function (currentGridCore) { return currentGridCore !== controller; });
|
40087 | FocusService_1.instancesMonitored.set(doc, newControllers);
|
40088 | }
|
40089 | if (newControllers.length === 0) {
|
40090 | doc.removeEventListener('keydown', FocusService_1.toggleKeyboardMode);
|
40091 | doc.removeEventListener('mousedown', FocusService_1.toggleKeyboardMode);
|
40092 | }
|
40093 | };
|
40094 | |
40095 |
|
40096 |
|
40097 |
|
40098 |
|
40099 |
|
40100 |
|
40101 | FocusService.toggleKeyboardMode = function (event) {
|
40102 | var isKeyboardActive = FocusService_1.keyboardModeActive;
|
40103 | var isKeyboardEvent = event.type === 'keydown';
|
40104 | if (isKeyboardEvent) {
|
40105 |
|
40106 | if (event.ctrlKey || event.metaKey || event.altKey) {
|
40107 | return;
|
40108 | }
|
40109 | }
|
40110 | if (isKeyboardActive && isKeyboardEvent || !isKeyboardActive && !isKeyboardEvent) {
|
40111 | return;
|
40112 | }
|
40113 | FocusService_1.keyboardModeActive = isKeyboardEvent;
|
40114 | var doc = event.target.ownerDocument;
|
40115 | if (!doc) {
|
40116 | return;
|
40117 | }
|
40118 | var controllersForDoc = FocusService_1.instancesMonitored.get(doc);
|
40119 | if (controllersForDoc) {
|
40120 | controllersForDoc.forEach(function (controller) {
|
40121 | controller.dispatchEvent({ type: isKeyboardEvent ? Events.EVENT_KEYBOARD_FOCUS : Events.EVENT_MOUSE_FOCUS });
|
40122 | });
|
40123 | }
|
40124 | };
|
40125 | FocusService.prototype.init = function () {
|
40126 | var _this = this;
|
40127 | var clearFocusedCellListener = this.clearFocusedCell.bind(this);
|
40128 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, clearFocusedCellListener);
|
40129 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onColumnEverythingChanged.bind(this));
|
40130 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, clearFocusedCellListener);
|
40131 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, clearFocusedCellListener);
|
40132 | this.ctrlsService.whenReady(function (p) {
|
40133 | _this.gridCtrl = p.gridCtrl;
|
40134 | var doc = _this.gridOptionsService.getDocument();
|
40135 | FocusService_1.addKeyboardModeEvents(doc, _this.gridCtrl);
|
40136 | _this.addDestroyFunc(function () { return _this.unregisterGridCompController(_this.gridCtrl); });
|
40137 | });
|
40138 | };
|
40139 | FocusService.prototype.unregisterGridCompController = function (gridCompController) {
|
40140 | var doc = this.gridOptionsService.getDocument();
|
40141 | FocusService_1.removeKeyboardModeEvents(doc, gridCompController);
|
40142 | };
|
40143 | FocusService.prototype.onColumnEverythingChanged = function () {
|
40144 |
|
40145 |
|
40146 | if (!this.focusedCellPosition) {
|
40147 | return;
|
40148 | }
|
40149 | var col = this.focusedCellPosition.column;
|
40150 | var colFromColumnModel = this.columnModel.getGridColumn(col.getId());
|
40151 | if (col !== colFromColumnModel) {
|
40152 | this.clearFocusedCell();
|
40153 | }
|
40154 | };
|
40155 | FocusService.prototype.isKeyboardMode = function () {
|
40156 | return FocusService_1.keyboardModeActive;
|
40157 | };
|
40158 |
|
40159 |
|
40160 |
|
40161 |
|
40162 |
|
40163 |
|
40164 |
|
40165 | FocusService.prototype.getFocusCellToUseAfterRefresh = function () {
|
40166 | var eDocument = this.gridOptionsService.getDocument();
|
40167 | if (this.gridOptionsService.is('suppressFocusAfterRefresh') || !this.focusedCellPosition) {
|
40168 | return null;
|
40169 | }
|
40170 |
|
40171 |
|
40172 |
|
40173 | if (this.isDomDataMissingInHierarchy(eDocument.activeElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL)) {
|
40174 | return null;
|
40175 | }
|
40176 | return this.focusedCellPosition;
|
40177 | };
|
40178 | FocusService.prototype.getFocusHeaderToUseAfterRefresh = function () {
|
40179 | var eDocument = this.gridOptionsService.getDocument();
|
40180 | if (this.gridOptionsService.is('suppressFocusAfterRefresh') || !this.focusedHeaderPosition) {
|
40181 | return null;
|
40182 | }
|
40183 |
|
40184 |
|
40185 | if (this.isDomDataMissingInHierarchy(eDocument.activeElement, AbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL)) {
|
40186 | return null;
|
40187 | }
|
40188 | return this.focusedHeaderPosition;
|
40189 | };
|
40190 | FocusService.prototype.isDomDataMissingInHierarchy = function (eBrowserCell, key) {
|
40191 | var ePointer = eBrowserCell;
|
40192 | while (ePointer) {
|
40193 | var data = this.gridOptionsService.getDomData(ePointer, key);
|
40194 | if (data) {
|
40195 | return false;
|
40196 | }
|
40197 | ePointer = ePointer.parentNode;
|
40198 | }
|
40199 | return true;
|
40200 | };
|
40201 | FocusService.prototype.getFocusedCell = function () {
|
40202 | return this.focusedCellPosition;
|
40203 | };
|
40204 | FocusService.prototype.getFocusEventParams = function () {
|
40205 | var _a = this.focusedCellPosition, rowIndex = _a.rowIndex, rowPinned = _a.rowPinned, column = _a.column;
|
40206 | var params = {
|
40207 | rowIndex: rowIndex,
|
40208 | rowPinned: rowPinned,
|
40209 | column: column,
|
40210 | isFullWidthCell: false
|
40211 | };
|
40212 | var rowCtrl = this.rowRenderer.getRowByPosition({ rowIndex: rowIndex, rowPinned: rowPinned });
|
40213 | if (rowCtrl) {
|
40214 | params.isFullWidthCell = rowCtrl.isFullWidth();
|
40215 | }
|
40216 | return params;
|
40217 | };
|
40218 | FocusService.prototype.clearFocusedCell = function () {
|
40219 | if (this.focusedCellPosition == null) {
|
40220 | return;
|
40221 | }
|
40222 | var event = __assign$3({ type: Events.EVENT_CELL_FOCUS_CLEARED }, this.getFocusEventParams());
|
40223 | this.focusedCellPosition = null;
|
40224 | this.eventService.dispatchEvent(event);
|
40225 | };
|
40226 | FocusService.prototype.setFocusedCell = function (params) {
|
40227 | var column = params.column, rowIndex = params.rowIndex, rowPinned = params.rowPinned, _a = params.forceBrowserFocus, forceBrowserFocus = _a === void 0 ? false : _a, _b = params.preventScrollOnBrowserFocus, preventScrollOnBrowserFocus = _b === void 0 ? false : _b;
|
40228 | var gridColumn = this.columnModel.getGridColumn(column);
|
40229 |
|
40230 |
|
40231 |
|
40232 | if (!gridColumn) {
|
40233 | this.focusedCellPosition = null;
|
40234 | return;
|
40235 | }
|
40236 | this.focusedCellPosition = gridColumn ? {
|
40237 | rowIndex: rowIndex,
|
40238 | rowPinned: makeNull(rowPinned),
|
40239 | column: gridColumn
|
40240 | } : null;
|
40241 | var event = __assign$3(__assign$3({ type: Events.EVENT_CELL_FOCUSED }, this.getFocusEventParams()), { forceBrowserFocus: forceBrowserFocus,
|
40242 | preventScrollOnBrowserFocus: preventScrollOnBrowserFocus, floating: null });
|
40243 | this.eventService.dispatchEvent(event);
|
40244 | };
|
40245 | FocusService.prototype.isCellFocused = function (cellPosition) {
|
40246 | if (this.focusedCellPosition == null) {
|
40247 | return false;
|
40248 | }
|
40249 | return this.focusedCellPosition.column === cellPosition.column &&
|
40250 | this.isRowFocused(cellPosition.rowIndex, cellPosition.rowPinned);
|
40251 | };
|
40252 | FocusService.prototype.isRowNodeFocused = function (rowNode) {
|
40253 | return this.isRowFocused(rowNode.rowIndex, rowNode.rowPinned);
|
40254 | };
|
40255 | FocusService.prototype.isHeaderWrapperFocused = function (headerCtrl) {
|
40256 | if (this.focusedHeaderPosition == null) {
|
40257 | return false;
|
40258 | }
|
40259 | var column = headerCtrl.getColumnGroupChild();
|
40260 | var headerRowIndex = headerCtrl.getRowIndex();
|
40261 | var pinned = headerCtrl.getPinned();
|
40262 | var _a = this.focusedHeaderPosition, focusedColumn = _a.column, focusedHeaderRowIndex = _a.headerRowIndex;
|
40263 | return column === focusedColumn &&
|
40264 | headerRowIndex === focusedHeaderRowIndex &&
|
40265 | pinned == focusedColumn.getPinned();
|
40266 | };
|
40267 | FocusService.prototype.clearFocusedHeader = function () {
|
40268 | this.focusedHeaderPosition = null;
|
40269 | };
|
40270 | FocusService.prototype.getFocusedHeader = function () {
|
40271 | return this.focusedHeaderPosition;
|
40272 | };
|
40273 | FocusService.prototype.setFocusedHeader = function (headerRowIndex, column) {
|
40274 | this.focusedHeaderPosition = { headerRowIndex: headerRowIndex, column: column };
|
40275 | };
|
40276 | FocusService.prototype.focusHeaderPosition = function (params) {
|
40277 | var direction = params.direction, fromTab = params.fromTab, allowUserOverride = params.allowUserOverride, event = params.event;
|
40278 | var headerPosition = params.headerPosition;
|
40279 | if (allowUserOverride) {
|
40280 | var currentPosition = this.getFocusedHeader();
|
40281 | var headerRowCount = this.headerNavigationService.getHeaderRowCount();
|
40282 | if (fromTab) {
|
40283 | var userFunc = this.gridOptionsService.getCallback('tabToNextHeader');
|
40284 | if (userFunc) {
|
40285 | var params_1 = {
|
40286 | backwards: direction === 'Before',
|
40287 | previousHeaderPosition: currentPosition,
|
40288 | nextHeaderPosition: headerPosition,
|
40289 | headerRowCount: headerRowCount,
|
40290 | };
|
40291 | headerPosition = userFunc(params_1);
|
40292 | }
|
40293 | }
|
40294 | else {
|
40295 | var userFunc = this.gridOptionsService.getCallback('navigateToNextHeader');
|
40296 | if (userFunc && event) {
|
40297 | var params_2 = {
|
40298 | key: event.key,
|
40299 | previousHeaderPosition: currentPosition,
|
40300 | nextHeaderPosition: headerPosition,
|
40301 | headerRowCount: headerRowCount,
|
40302 | event: event,
|
40303 | };
|
40304 | headerPosition = userFunc(params_2);
|
40305 | }
|
40306 | }
|
40307 | }
|
40308 | if (!headerPosition) {
|
40309 | return false;
|
40310 | }
|
40311 | if (headerPosition.headerRowIndex === -1) {
|
40312 | return this.focusGridView(headerPosition.column);
|
40313 | }
|
40314 | this.headerNavigationService.scrollToColumn(headerPosition.column, direction);
|
40315 | var headerRowContainerCtrl = this.ctrlsService.getHeaderRowContainerCtrl(headerPosition.column.getPinned());
|
40316 |
|
40317 | var focusSuccess = headerRowContainerCtrl.focusHeader(headerPosition.headerRowIndex, headerPosition.column, event);
|
40318 | return focusSuccess;
|
40319 | };
|
40320 | FocusService.prototype.focusFirstHeader = function () {
|
40321 | var firstColumn = this.columnModel.getAllDisplayedColumns()[0];
|
40322 | if (!firstColumn) {
|
40323 | return false;
|
40324 | }
|
40325 | if (firstColumn.getParent()) {
|
40326 | firstColumn = this.columnModel.getColumnGroupAtLevel(firstColumn, 0);
|
40327 | }
|
40328 | return this.focusHeaderPosition({
|
40329 | headerPosition: { headerRowIndex: 0, column: firstColumn }
|
40330 | });
|
40331 | };
|
40332 | FocusService.prototype.focusLastHeader = function (event) {
|
40333 | var headerRowIndex = this.headerNavigationService.getHeaderRowCount() - 1;
|
40334 | var column = last(this.columnModel.getAllDisplayedColumns());
|
40335 | return this.focusHeaderPosition({
|
40336 | headerPosition: { headerRowIndex: headerRowIndex, column: column },
|
40337 | event: event
|
40338 | });
|
40339 | };
|
40340 | FocusService.prototype.isAnyCellFocused = function () {
|
40341 | return !!this.focusedCellPosition;
|
40342 | };
|
40343 | FocusService.prototype.isRowFocused = function (rowIndex, floating) {
|
40344 | if (this.focusedCellPosition == null) {
|
40345 | return false;
|
40346 | }
|
40347 | return this.focusedCellPosition.rowIndex === rowIndex && this.focusedCellPosition.rowPinned === makeNull(floating);
|
40348 | };
|
40349 | FocusService.prototype.findFocusableElements = function (rootNode, exclude, onlyUnmanaged) {
|
40350 | if (onlyUnmanaged === void 0) { onlyUnmanaged = false; }
|
40351 | var focusableString = FOCUSABLE_SELECTOR;
|
40352 | var excludeString = FOCUSABLE_EXCLUDE;
|
40353 | if (exclude) {
|
40354 | excludeString += ', ' + exclude;
|
40355 | }
|
40356 | if (onlyUnmanaged) {
|
40357 | excludeString += ', [tabindex="-1"]';
|
40358 | }
|
40359 | var nodes = Array.prototype.slice.apply(rootNode.querySelectorAll(focusableString));
|
40360 | var excludeNodes = Array.prototype.slice.apply(rootNode.querySelectorAll(excludeString));
|
40361 | if (!excludeNodes.length) {
|
40362 | return nodes;
|
40363 | }
|
40364 | var diff = function (a, b) { return a.filter(function (element) { return b.indexOf(element) === -1; }); };
|
40365 | return diff(nodes, excludeNodes);
|
40366 | };
|
40367 | FocusService.prototype.focusInto = function (rootNode, up, onlyUnmanaged) {
|
40368 | if (up === void 0) { up = false; }
|
40369 | if (onlyUnmanaged === void 0) { onlyUnmanaged = false; }
|
40370 | var focusableElements = this.findFocusableElements(rootNode, null, onlyUnmanaged);
|
40371 | var toFocus = up ? last(focusableElements) : focusableElements[0];
|
40372 | if (toFocus) {
|
40373 | toFocus.focus();
|
40374 | return true;
|
40375 | }
|
40376 | return false;
|
40377 | };
|
40378 | FocusService.prototype.findFocusableElementBeforeTabGuard = function (rootNode, referenceElement) {
|
40379 | if (!referenceElement) {
|
40380 | return null;
|
40381 | }
|
40382 | var focusableElements = this.findFocusableElements(rootNode);
|
40383 | var referenceIndex = focusableElements.indexOf(referenceElement);
|
40384 | if (referenceIndex === -1) {
|
40385 | return null;
|
40386 | }
|
40387 | var lastTabGuardIndex = -1;
|
40388 | for (var i = referenceIndex - 1; i >= 0; i--) {
|
40389 | if (focusableElements[i].classList.contains(TabGuardClassNames.TAB_GUARD_TOP)) {
|
40390 | lastTabGuardIndex = i;
|
40391 | break;
|
40392 | }
|
40393 | }
|
40394 | if (lastTabGuardIndex <= 0) {
|
40395 | return null;
|
40396 | }
|
40397 | return focusableElements[lastTabGuardIndex - 1];
|
40398 | };
|
40399 | FocusService.prototype.findNextFocusableElement = function (rootNode, onlyManaged, backwards) {
|
40400 | if (rootNode === void 0) { rootNode = this.eGridDiv; }
|
40401 | var focusable = this.findFocusableElements(rootNode, onlyManaged ? ':not([tabindex="-1"])' : null);
|
40402 | var eDocument = this.gridOptionsService.getDocument();
|
40403 | var activeEl = eDocument.activeElement;
|
40404 | var currentIndex;
|
40405 | if (onlyManaged) {
|
40406 | currentIndex = focusable.findIndex(function (el) { return el.contains(activeEl); });
|
40407 | }
|
40408 | else {
|
40409 | currentIndex = focusable.indexOf(activeEl);
|
40410 | }
|
40411 | var nextIndex = currentIndex + (backwards ? -1 : 1);
|
40412 | if (nextIndex < 0 || nextIndex >= focusable.length) {
|
40413 | return null;
|
40414 | }
|
40415 | return focusable[nextIndex];
|
40416 | };
|
40417 | FocusService.prototype.isTargetUnderManagedComponent = function (rootNode, target) {
|
40418 | if (!target) {
|
40419 | return false;
|
40420 | }
|
40421 | var managedContainers = rootNode.querySelectorAll("." + ManagedFocusFeature.FOCUS_MANAGED_CLASS);
|
40422 | if (!managedContainers.length) {
|
40423 | return false;
|
40424 | }
|
40425 | for (var i = 0; i < managedContainers.length; i++) {
|
40426 | if (managedContainers[i].contains(target)) {
|
40427 | return true;
|
40428 | }
|
40429 | }
|
40430 | return false;
|
40431 | };
|
40432 | FocusService.prototype.findTabbableParent = function (node, limit) {
|
40433 | if (limit === void 0) { limit = 5; }
|
40434 | var counter = 0;
|
40435 | while (node && getTabIndex(node) === null && ++counter <= limit) {
|
40436 | node = node.parentElement;
|
40437 | }
|
40438 | if (getTabIndex(node) === null) {
|
40439 | return null;
|
40440 | }
|
40441 | return node;
|
40442 | };
|
40443 | FocusService.prototype.focusGridView = function (column, backwards) {
|
40444 |
|
40445 |
|
40446 |
|
40447 | if (this.gridOptionsService.is('suppressCellFocus')) {
|
40448 | if (backwards) {
|
40449 | return this.focusLastHeader();
|
40450 | }
|
40451 | return this.focusNextGridCoreContainer(false);
|
40452 | }
|
40453 | var nextRow = backwards
|
40454 | ? this.rowPositionUtils.getLastRow()
|
40455 | : this.rowPositionUtils.getFirstRow();
|
40456 | if (!nextRow) {
|
40457 | return false;
|
40458 | }
|
40459 | var rowIndex = nextRow.rowIndex, rowPinned = nextRow.rowPinned;
|
40460 | var focusedHeader = this.getFocusedHeader();
|
40461 | if (!column && focusedHeader) {
|
40462 | column = focusedHeader.column;
|
40463 | }
|
40464 | if (rowIndex == null || !column) {
|
40465 | return false;
|
40466 | }
|
40467 | this.navigationService.ensureCellVisible({ rowIndex: rowIndex, column: column, rowPinned: rowPinned });
|
40468 | this.setFocusedCell({
|
40469 | rowIndex: rowIndex,
|
40470 | column: column,
|
40471 | rowPinned: makeNull(rowPinned),
|
40472 | forceBrowserFocus: true
|
40473 | });
|
40474 | if (this.rangeService) {
|
40475 | var cellPosition = { rowIndex: rowIndex, rowPinned: rowPinned, column: column };
|
40476 | this.rangeService.setRangeToCell(cellPosition);
|
40477 | }
|
40478 | return true;
|
40479 | };
|
40480 | FocusService.prototype.focusNextGridCoreContainer = function (backwards) {
|
40481 | if (this.gridCtrl.focusNextInnerContainer(backwards)) {
|
40482 | return true;
|
40483 | }
|
40484 | if (!backwards && !this.gridCtrl.isDetailGrid()) {
|
40485 | this.gridCtrl.forceFocusOutOfContainer();
|
40486 | }
|
40487 | return false;
|
40488 | };
|
40489 | var FocusService_1;
|
40490 | FocusService.AG_KEYBOARD_FOCUS = 'ag-keyboard-focus';
|
40491 | FocusService.keyboardModeActive = false;
|
40492 | FocusService.instancesMonitored = new Map();
|
40493 | __decorate$R([
|
40494 | Autowired('eGridDiv')
|
40495 | ], FocusService.prototype, "eGridDiv", void 0);
|
40496 | __decorate$R([
|
40497 | Autowired('columnModel')
|
40498 | ], FocusService.prototype, "columnModel", void 0);
|
40499 | __decorate$R([
|
40500 | Autowired('headerNavigationService')
|
40501 | ], FocusService.prototype, "headerNavigationService", void 0);
|
40502 | __decorate$R([
|
40503 | Autowired('rowRenderer')
|
40504 | ], FocusService.prototype, "rowRenderer", void 0);
|
40505 | __decorate$R([
|
40506 | Autowired('rowPositionUtils')
|
40507 | ], FocusService.prototype, "rowPositionUtils", void 0);
|
40508 | __decorate$R([
|
40509 | Optional('rangeService')
|
40510 | ], FocusService.prototype, "rangeService", void 0);
|
40511 | __decorate$R([
|
40512 | Autowired('navigationService')
|
40513 | ], FocusService.prototype, "navigationService", void 0);
|
40514 | __decorate$R([
|
40515 | Autowired('ctrlsService')
|
40516 | ], FocusService.prototype, "ctrlsService", void 0);
|
40517 | __decorate$R([
|
40518 | PostConstruct
|
40519 | ], FocusService.prototype, "init", null);
|
40520 | FocusService = FocusService_1 = __decorate$R([
|
40521 | Bean('focusService')
|
40522 | ], FocusService);
|
40523 | return FocusService;
|
40524 | }(BeanStub));
|
40525 |
|
40526 |
|
40527 |
|
40528 |
|
40529 |
|
40530 |
|
40531 |
|
40532 | var __extends$O = (undefined && undefined.__extends) || (function () {
|
40533 | var extendStatics = function (d, b) {
|
40534 | extendStatics = Object.setPrototypeOf ||
|
40535 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
40536 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
40537 | return extendStatics(d, b);
|
40538 | };
|
40539 | return function (d, b) {
|
40540 | extendStatics(d, b);
|
40541 | function __() { this.constructor = d; }
|
40542 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
40543 | };
|
40544 | })();
|
40545 | var __decorate$Q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
40546 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
40547 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
40548 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
40549 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
40550 | };
|
40551 | var __read$a = (undefined && undefined.__read) || function (o, n) {
|
40552 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
40553 | if (!m) return o;
|
40554 | var i = m.call(o), r, ar = [], e;
|
40555 | try {
|
40556 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
40557 | }
|
40558 | catch (error) { e = { error: error }; }
|
40559 | finally {
|
40560 | try {
|
40561 | if (r && !r.done && (m = i["return"])) m.call(i);
|
40562 | }
|
40563 | finally { if (e) throw e.error; }
|
40564 | }
|
40565 | return ar;
|
40566 | };
|
40567 | var __spread$8 = (undefined && undefined.__spread) || function () {
|
40568 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$a(arguments[i]));
|
40569 | return ar;
|
40570 | };
|
40571 | var DIRECTION;
|
40572 | (function (DIRECTION) {
|
40573 | DIRECTION[DIRECTION["vertical"] = 0] = "vertical";
|
40574 | DIRECTION[DIRECTION["horizontal"] = 1] = "horizontal";
|
40575 | })(DIRECTION || (DIRECTION = {}));
|
40576 | var instanceIdSeq = 0;
|
40577 | var PopupService = (function (_super) {
|
40578 | __extends$O(PopupService, _super);
|
40579 | function PopupService() {
|
40580 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
40581 | _this.popupList = [];
|
40582 | return _this;
|
40583 | }
|
40584 | PopupService_1 = PopupService;
|
40585 | PopupService.prototype.postConstruct = function () {
|
40586 | var _this = this;
|
40587 | this.ctrlsService.whenReady(function (p) {
|
40588 | _this.gridCtrl = p.gridCtrl;
|
40589 | _this.addManagedListener(_this.gridCtrl, Events.EVENT_KEYBOARD_FOCUS, function () {
|
40590 | _this.popupList.forEach(function (popup) { return popup.element.classList.add(FocusService.AG_KEYBOARD_FOCUS); });
|
40591 | });
|
40592 | _this.addManagedListener(_this.gridCtrl, Events.EVENT_MOUSE_FOCUS, function () {
|
40593 | _this.popupList.forEach(function (popup) { return popup.element.classList.remove(FocusService.AG_KEYBOARD_FOCUS); });
|
40594 | });
|
40595 | });
|
40596 | };
|
40597 | PopupService.prototype.getPopupParent = function () {
|
40598 | var ePopupParent = this.gridOptionsService.get('popupParent');
|
40599 | if (ePopupParent) {
|
40600 | return ePopupParent;
|
40601 | }
|
40602 | return this.gridCtrl.getGui();
|
40603 | };
|
40604 | PopupService.prototype.positionPopupForMenu = function (params) {
|
40605 | var sourceRect = params.eventSource.getBoundingClientRect();
|
40606 | var parentRect = this.getParentRect();
|
40607 | this.checkClearMaxHeight(params.ePopup, params.shouldSetMaxHeight);
|
40608 | var y = this.keepXYWithinBounds(params.ePopup, sourceRect.top - parentRect.top, DIRECTION.vertical);
|
40609 | var minWidth = (params.ePopup.clientWidth > 0) ? params.ePopup.clientWidth : 200;
|
40610 | params.ePopup.style.minWidth = minWidth + "px";
|
40611 | var widthOfParent = parentRect.right - parentRect.left;
|
40612 | var maxX = widthOfParent - minWidth;
|
40613 |
|
40614 |
|
40615 |
|
40616 | var x;
|
40617 | if (this.gridOptionsService.is('enableRtl')) {
|
40618 |
|
40619 | x = xLeftPosition();
|
40620 | if (x < 0) {
|
40621 | x = xRightPosition();
|
40622 | }
|
40623 | if (x > maxX) {
|
40624 | x = 0;
|
40625 | }
|
40626 | }
|
40627 | else {
|
40628 |
|
40629 | x = xRightPosition();
|
40630 | if (x > maxX) {
|
40631 | x = xLeftPosition();
|
40632 | }
|
40633 | if (x < 0) {
|
40634 | x = 0;
|
40635 | }
|
40636 | }
|
40637 | params.ePopup.style.left = x + "px";
|
40638 | params.ePopup.style.top = y + "px";
|
40639 | this.checkSetMaxHeight(params.ePopup, y, params.shouldSetMaxHeight);
|
40640 | function xRightPosition() {
|
40641 | return sourceRect.right - parentRect.left - 2;
|
40642 | }
|
40643 | function xLeftPosition() {
|
40644 | return sourceRect.left - parentRect.left - minWidth;
|
40645 | }
|
40646 | };
|
40647 | PopupService.prototype.positionPopupUnderMouseEvent = function (params) {
|
40648 | var _this = this;
|
40649 | var ePopup = params.ePopup, nudgeX = params.nudgeX, nudgeY = params.nudgeY, skipObserver = params.skipObserver, shouldSetMaxHeight = params.shouldSetMaxHeight;
|
40650 | this.positionPopup({
|
40651 | ePopup: ePopup,
|
40652 | nudgeX: nudgeX,
|
40653 | nudgeY: nudgeY,
|
40654 | keepWithinBounds: true,
|
40655 | skipObserver: skipObserver,
|
40656 | shouldSetMaxHeight: shouldSetMaxHeight,
|
40657 | updatePosition: function () { return _this.calculatePointerAlign(params.mouseEvent); },
|
40658 | postProcessCallback: function () { return _this.callPostProcessPopup(params.type, params.ePopup, null, params.mouseEvent, params.column, params.rowNode); }
|
40659 | });
|
40660 | };
|
40661 | PopupService.prototype.calculatePointerAlign = function (e) {
|
40662 | var parentRect = this.getParentRect();
|
40663 | return {
|
40664 | x: e.clientX - parentRect.left,
|
40665 | y: e.clientY - parentRect.top
|
40666 | };
|
40667 | };
|
40668 | PopupService.prototype.positionPopupByComponent = function (params) {
|
40669 | var _this = this;
|
40670 | var sourceRect = params.eventSource.getBoundingClientRect();
|
40671 | var alignSide = params.alignSide || 'left';
|
40672 | var position = params.position || 'over';
|
40673 | var parentRect = this.getParentRect();
|
40674 | var updatePosition = function () {
|
40675 | var x = sourceRect.left - parentRect.left;
|
40676 | if (alignSide === 'right') {
|
40677 | x -= (params.ePopup.offsetWidth - sourceRect.width);
|
40678 | }
|
40679 | var y = position === 'over'
|
40680 | ? (sourceRect.top - parentRect.top)
|
40681 | : (sourceRect.top - parentRect.top + sourceRect.height);
|
40682 | return { x: x, y: y };
|
40683 | };
|
40684 | this.positionPopup({
|
40685 | ePopup: params.ePopup,
|
40686 | nudgeX: params.nudgeX,
|
40687 | nudgeY: params.nudgeY,
|
40688 | keepWithinBounds: params.keepWithinBounds,
|
40689 | shouldSetMaxHeight: params.shouldSetMaxHeight,
|
40690 | updatePosition: updatePosition,
|
40691 | postProcessCallback: function () { return _this.callPostProcessPopup(params.type, params.ePopup, params.eventSource, null, params.column, params.rowNode); }
|
40692 | });
|
40693 | };
|
40694 | PopupService.prototype.callPostProcessPopup = function (type, ePopup, eventSource, mouseEvent, column, rowNode) {
|
40695 | var callback = this.gridOptionsService.getCallback('postProcessPopup');
|
40696 | if (callback) {
|
40697 | var params = {
|
40698 | column: column,
|
40699 | rowNode: rowNode,
|
40700 | ePopup: ePopup,
|
40701 | type: type,
|
40702 | eventSource: eventSource,
|
40703 | mouseEvent: mouseEvent
|
40704 | };
|
40705 | callback(params);
|
40706 | }
|
40707 | };
|
40708 | PopupService.prototype.positionPopup = function (params) {
|
40709 | var _this = this;
|
40710 | var ePopup = params.ePopup, keepWithinBounds = params.keepWithinBounds, nudgeX = params.nudgeX, nudgeY = params.nudgeY, skipObserver = params.skipObserver, shouldSetMaxHeight = params.shouldSetMaxHeight, updatePosition = params.updatePosition;
|
40711 | var lastSize = { width: 0, height: 0 };
|
40712 | var updatePopupPosition = function (fromResizeObserver) {
|
40713 | if (fromResizeObserver === void 0) { fromResizeObserver = false; }
|
40714 | var _a = updatePosition(), x = _a.x, y = _a.y;
|
40715 | if (fromResizeObserver &&
|
40716 | ePopup.clientWidth === lastSize.width &&
|
40717 | ePopup.clientHeight === lastSize.height) {
|
40718 | return;
|
40719 | }
|
40720 | lastSize.width = ePopup.clientWidth;
|
40721 | lastSize.height = ePopup.clientHeight;
|
40722 | if (nudgeX) {
|
40723 | x += nudgeX;
|
40724 | }
|
40725 | if (nudgeY) {
|
40726 | y += nudgeY;
|
40727 | }
|
40728 | _this.checkClearMaxHeight(ePopup, shouldSetMaxHeight);
|
40729 |
|
40730 | if (keepWithinBounds) {
|
40731 | x = _this.keepXYWithinBounds(ePopup, x, DIRECTION.horizontal);
|
40732 | y = _this.keepXYWithinBounds(ePopup, y, DIRECTION.vertical);
|
40733 | }
|
40734 | ePopup.style.left = x + "px";
|
40735 | ePopup.style.top = y + "px";
|
40736 | _this.checkSetMaxHeight(ePopup, y, shouldSetMaxHeight);
|
40737 | if (params.postProcessCallback) {
|
40738 | params.postProcessCallback();
|
40739 | }
|
40740 | };
|
40741 | updatePopupPosition();
|
40742 |
|
40743 | if (!skipObserver) {
|
40744 |
|
40745 |
|
40746 | var resizeObserverDestroyFunc_1 = this.resizeObserverService.observeResize(ePopup, function () { return updatePopupPosition(true); });
|
40747 |
|
40748 | setTimeout(function () { return resizeObserverDestroyFunc_1(); }, PopupService_1.WAIT_FOR_POPUP_CONTENT_RESIZE);
|
40749 | }
|
40750 | };
|
40751 | PopupService.prototype.getActivePopups = function () {
|
40752 | return this.popupList.map(function (popup) { return popup.element; });
|
40753 | };
|
40754 | PopupService.prototype.getPopupList = function () {
|
40755 | return this.popupList;
|
40756 | };
|
40757 | PopupService.prototype.getParentRect = function () {
|
40758 |
|
40759 |
|
40760 |
|
40761 |
|
40762 | var eDocument = this.gridOptionsService.getDocument();
|
40763 | var popupParent = this.getPopupParent();
|
40764 | if (popupParent === eDocument.body) {
|
40765 | popupParent = eDocument.documentElement;
|
40766 | }
|
40767 | else if (getComputedStyle(popupParent).position === 'static') {
|
40768 | popupParent = popupParent.offsetParent;
|
40769 | }
|
40770 | var style = getComputedStyle(popupParent);
|
40771 | var bounds = popupParent.getBoundingClientRect();
|
40772 | return {
|
40773 | top: bounds.top + parseFloat(style.borderTopWidth) || 0,
|
40774 | left: bounds.left + parseFloat(style.borderLeftWidth) || 0,
|
40775 | right: bounds.right + parseFloat(style.borderRightWidth) || 0,
|
40776 | bottom: bounds.bottom + parseFloat(style.borderBottomWidth) || 0,
|
40777 | };
|
40778 | };
|
40779 | PopupService.prototype.keepXYWithinBounds = function (ePopup, position, direction) {
|
40780 | var isVertical = direction === DIRECTION.vertical;
|
40781 | var sizeProperty = isVertical ? 'clientHeight' : 'clientWidth';
|
40782 | var anchorProperty = isVertical ? 'top' : 'left';
|
40783 | var offsetProperty = isVertical ? 'offsetHeight' : 'offsetWidth';
|
40784 | var scrollPositionProperty = isVertical ? 'scrollTop' : 'scrollLeft';
|
40785 | var eDocument = this.gridOptionsService.getDocument();
|
40786 | var docElement = eDocument.documentElement;
|
40787 | var popupParent = this.getPopupParent();
|
40788 | var parentRect = popupParent.getBoundingClientRect();
|
40789 | var documentRect = eDocument.documentElement.getBoundingClientRect();
|
40790 | var isBody = popupParent === eDocument.body;
|
40791 | var offsetSize = ePopup[offsetProperty];
|
40792 | var getSize = isVertical ? getAbsoluteHeight : getAbsoluteWidth;
|
40793 | var sizeOfParent = isBody ? (getSize(docElement) + docElement[scrollPositionProperty]) : popupParent[sizeProperty];
|
40794 | if (isBody) {
|
40795 | sizeOfParent -= Math.abs(documentRect[anchorProperty] - parentRect[anchorProperty]);
|
40796 | }
|
40797 | var max = sizeOfParent - offsetSize;
|
40798 | return Math.min(Math.max(position, 0), Math.abs(max));
|
40799 | };
|
40800 | PopupService.prototype.keepPopupPositionedRelativeTo = function (params) {
|
40801 | var _this = this;
|
40802 | var eParent = this.getPopupParent();
|
40803 | var parentRect = eParent.getBoundingClientRect();
|
40804 | var sourceRect = params.element.getBoundingClientRect();
|
40805 | var initialDiffTop = parentRect.top - sourceRect.top;
|
40806 | var initialDiffLeft = parentRect.left - sourceRect.left;
|
40807 | var lastDiffTop = initialDiffTop;
|
40808 | var lastDiffLeft = initialDiffLeft;
|
40809 | var topPx = params.ePopup.style.top;
|
40810 | var top = parseInt(topPx.substring(0, topPx.length - 1), 10);
|
40811 | var leftPx = params.ePopup.style.left;
|
40812 | var left = parseInt(leftPx.substring(0, leftPx.length - 1), 10);
|
40813 | return new AgPromise(function (resolve) {
|
40814 | _this.getFrameworkOverrides().setInterval(function () {
|
40815 | var pRect = eParent.getBoundingClientRect();
|
40816 | var sRect = params.element.getBoundingClientRect();
|
40817 | var elementNotInDom = sRect.top == 0 && sRect.left == 0 && sRect.height == 0 && sRect.width == 0;
|
40818 | if (elementNotInDom) {
|
40819 | params.hidePopup();
|
40820 | return;
|
40821 | }
|
40822 | var currentDiffTop = pRect.top - sRect.top;
|
40823 | if (currentDiffTop != lastDiffTop) {
|
40824 | var newTop = _this.keepXYWithinBounds(params.ePopup, top + initialDiffTop - currentDiffTop, DIRECTION.vertical);
|
40825 | params.ePopup.style.top = newTop + "px";
|
40826 | }
|
40827 | lastDiffTop = currentDiffTop;
|
40828 | var currentDiffLeft = pRect.left - sRect.left;
|
40829 | if (currentDiffLeft != lastDiffLeft) {
|
40830 | var newLeft = _this.keepXYWithinBounds(params.ePopup, left + initialDiffLeft - currentDiffLeft, DIRECTION.horizontal);
|
40831 | params.ePopup.style.left = newLeft + "px";
|
40832 | }
|
40833 | lastDiffLeft = currentDiffLeft;
|
40834 | }, 200).then(function (intervalId) {
|
40835 | var result = function () {
|
40836 | if (intervalId != null) {
|
40837 | window.clearInterval(intervalId);
|
40838 | }
|
40839 | };
|
40840 | resolve(result);
|
40841 | });
|
40842 | });
|
40843 | };
|
40844 | PopupService.prototype.addPopup = function (params) {
|
40845 | var _a;
|
40846 | var _this = this;
|
40847 | 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;
|
40848 | var eDocument = this.gridOptionsService.getDocument();
|
40849 | var destroyPositionTracker = new AgPromise(function (resolve) { return resolve(function () { }); });
|
40850 | if (!eDocument) {
|
40851 | console.warn('AG Grid: could not find the document, document is empty');
|
40852 | return { hideFunc: function () { }, stopAnchoringPromise: destroyPositionTracker };
|
40853 | }
|
40854 | var pos = this.popupList.findIndex(function (popup) { return popup.element === eChild; });
|
40855 | if (pos !== -1) {
|
40856 | var popup = this.popupList[pos];
|
40857 | return { hideFunc: popup.hideFunc, stopAnchoringPromise: popup.stopAnchoringPromise };
|
40858 | }
|
40859 | var ePopupParent = this.getPopupParent();
|
40860 | if (eChild.style.top == null) {
|
40861 | eChild.style.top = '0px';
|
40862 | }
|
40863 | if (eChild.style.left == null) {
|
40864 | eChild.style.left = '0px';
|
40865 | }
|
40866 |
|
40867 |
|
40868 | var eWrapper = document.createElement('div');
|
40869 | var allThemes = this.environment.getTheme().allThemes;
|
40870 | if (allThemes.length) {
|
40871 | (_a = eWrapper.classList).add.apply(_a, __spread$8(allThemes));
|
40872 | }
|
40873 | eWrapper.classList.add('ag-popup');
|
40874 | eChild.classList.add(this.gridOptionsService.is('enableRtl') ? 'ag-rtl' : 'ag-ltr', 'ag-popup-child');
|
40875 | if (!eChild.hasAttribute('role')) {
|
40876 | setAriaRole(eChild, 'dialog');
|
40877 | }
|
40878 | setAriaLabel(eChild, ariaLabel);
|
40879 | if (this.focusService.isKeyboardMode()) {
|
40880 | eChild.classList.add(FocusService.AG_KEYBOARD_FOCUS);
|
40881 | }
|
40882 | eWrapper.appendChild(eChild);
|
40883 | ePopupParent.appendChild(eWrapper);
|
40884 | if (alwaysOnTop) {
|
40885 | this.setAlwaysOnTop(eWrapper, true);
|
40886 | }
|
40887 | else {
|
40888 | this.bringPopupToFront(eWrapper);
|
40889 | }
|
40890 | var popupHidden = false;
|
40891 | var hidePopupOnKeyboardEvent = function (event) {
|
40892 | if (!eWrapper.contains(eDocument.activeElement)) {
|
40893 | return;
|
40894 | }
|
40895 | var key = event.key;
|
40896 | if (key === KeyCode.ESCAPE) {
|
40897 | hidePopup({ keyboardEvent: event });
|
40898 | }
|
40899 | };
|
40900 | var hidePopupOnMouseEvent = function (event) { return hidePopup({ mouseEvent: event }); };
|
40901 | var hidePopupOnTouchEvent = function (event) { return hidePopup({ touchEvent: event }); };
|
40902 | var hidePopup = function (popupParams) {
|
40903 | if (popupParams === void 0) { popupParams = {}; }
|
40904 | var mouseEvent = popupParams.mouseEvent, touchEvent = popupParams.touchEvent, keyboardEvent = popupParams.keyboardEvent;
|
40905 | if (
|
40906 |
|
40907 |
|
40908 | _this.isEventFromCurrentPopup({ mouseEvent: mouseEvent, touchEvent: touchEvent }, eChild) ||
|
40909 |
|
40910 | _this.isEventSameChainAsOriginalEvent({ originalMouseEvent: click, mouseEvent: mouseEvent, touchEvent: touchEvent }) ||
|
40911 |
|
40912 |
|
40913 | popupHidden) {
|
40914 | return;
|
40915 | }
|
40916 | popupHidden = true;
|
40917 | ePopupParent.removeChild(eWrapper);
|
40918 | eDocument.removeEventListener('keydown', hidePopupOnKeyboardEvent);
|
40919 | eDocument.removeEventListener('mousedown', hidePopupOnMouseEvent);
|
40920 | eDocument.removeEventListener('touchstart', hidePopupOnTouchEvent);
|
40921 | eDocument.removeEventListener('contextmenu', hidePopupOnMouseEvent);
|
40922 | _this.eventService.removeEventListener(Events.EVENT_DRAG_STARTED, hidePopupOnMouseEvent);
|
40923 | if (closedCallback) {
|
40924 | closedCallback(mouseEvent || touchEvent || keyboardEvent);
|
40925 | }
|
40926 | _this.popupList = _this.popupList.filter(function (popup) { return popup.element !== eChild; });
|
40927 | if (destroyPositionTracker) {
|
40928 | destroyPositionTracker.then(function (destroyFunc) { return destroyFunc && destroyFunc(); });
|
40929 | }
|
40930 | };
|
40931 | if (afterGuiAttached) {
|
40932 | afterGuiAttached({ hidePopup: hidePopup });
|
40933 | }
|
40934 |
|
40935 |
|
40936 | window.setTimeout(function () {
|
40937 | if (closeOnEsc) {
|
40938 | eDocument.addEventListener('keydown', hidePopupOnKeyboardEvent);
|
40939 | }
|
40940 | if (modal) {
|
40941 | eDocument.addEventListener('mousedown', hidePopupOnMouseEvent);
|
40942 | _this.eventService.addEventListener(Events.EVENT_DRAG_STARTED, hidePopupOnMouseEvent);
|
40943 | eDocument.addEventListener('touchstart', hidePopupOnTouchEvent);
|
40944 | eDocument.addEventListener('contextmenu', hidePopupOnMouseEvent);
|
40945 | }
|
40946 | }, 0);
|
40947 | if (positionCallback) {
|
40948 | positionCallback();
|
40949 | }
|
40950 | if (anchorToElement) {
|
40951 |
|
40952 |
|
40953 | destroyPositionTracker = this.keepPopupPositionedRelativeTo({
|
40954 | element: anchorToElement,
|
40955 | ePopup: eChild,
|
40956 | hidePopup: hidePopup
|
40957 | });
|
40958 | }
|
40959 | this.popupList.push({
|
40960 | element: eChild,
|
40961 | wrapper: eWrapper,
|
40962 | hideFunc: hidePopup,
|
40963 | stopAnchoringPromise: destroyPositionTracker,
|
40964 | instanceId: instanceIdSeq++,
|
40965 | isAnchored: !!anchorToElement
|
40966 | });
|
40967 | return {
|
40968 | hideFunc: hidePopup,
|
40969 | stopAnchoringPromise: destroyPositionTracker
|
40970 | };
|
40971 | };
|
40972 | PopupService.prototype.hasAnchoredPopup = function () {
|
40973 | return this.popupList.some(function (popup) { return popup.isAnchored; });
|
40974 | };
|
40975 | PopupService.prototype.isEventFromCurrentPopup = function (params, target) {
|
40976 | var mouseEvent = params.mouseEvent, touchEvent = params.touchEvent;
|
40977 | var event = mouseEvent ? mouseEvent : touchEvent;
|
40978 | if (!event) {
|
40979 | return false;
|
40980 | }
|
40981 | var indexOfThisChild = this.popupList.findIndex(function (popup) { return popup.element === target; });
|
40982 | if (indexOfThisChild === -1) {
|
40983 | return false;
|
40984 | }
|
40985 | for (var i = indexOfThisChild; i < this.popupList.length; i++) {
|
40986 | var popup = this.popupList[i];
|
40987 | if (isElementInEventPath(popup.element, event)) {
|
40988 | return true;
|
40989 | }
|
40990 | }
|
40991 |
|
40992 |
|
40993 |
|
40994 | return this.isElementWithinCustomPopup(event.target);
|
40995 | };
|
40996 | PopupService.prototype.isElementWithinCustomPopup = function (el) {
|
40997 | var eDocument = this.gridOptionsService.getDocument();
|
40998 | while (el && el !== eDocument.body) {
|
40999 | if (el.classList.contains('ag-custom-component-popup') || el.parentElement === null) {
|
41000 | return true;
|
41001 | }
|
41002 | el = el.parentElement;
|
41003 | }
|
41004 | return false;
|
41005 | };
|
41006 |
|
41007 |
|
41008 | PopupService.prototype.isEventSameChainAsOriginalEvent = function (params) {
|
41009 | var originalMouseEvent = params.originalMouseEvent, mouseEvent = params.mouseEvent, touchEvent = params.touchEvent;
|
41010 |
|
41011 |
|
41012 |
|
41013 |
|
41014 | var mouseEventOrTouch = null;
|
41015 | if (mouseEvent) {
|
41016 |
|
41017 | mouseEventOrTouch = mouseEvent;
|
41018 | }
|
41019 | else if (touchEvent) {
|
41020 |
|
41021 | mouseEventOrTouch = touchEvent.touches[0];
|
41022 | }
|
41023 | if (mouseEventOrTouch && originalMouseEvent) {
|
41024 |
|
41025 |
|
41026 | var screenX_1 = mouseEvent ? mouseEvent.screenX : 0;
|
41027 | var screenY_1 = mouseEvent ? mouseEvent.screenY : 0;
|
41028 | var xMatch = Math.abs(originalMouseEvent.screenX - screenX_1) < 5;
|
41029 | var yMatch = Math.abs(originalMouseEvent.screenY - screenY_1) < 5;
|
41030 | if (xMatch && yMatch) {
|
41031 | return true;
|
41032 | }
|
41033 | }
|
41034 | return false;
|
41035 | };
|
41036 | PopupService.prototype.getWrapper = function (ePopup) {
|
41037 | while (!ePopup.classList.contains('ag-popup') && ePopup.parentElement) {
|
41038 | ePopup = ePopup.parentElement;
|
41039 | }
|
41040 | return ePopup.classList.contains('ag-popup') ? ePopup : null;
|
41041 | };
|
41042 | PopupService.prototype.setAlwaysOnTop = function (ePopup, alwaysOnTop) {
|
41043 | var eWrapper = this.getWrapper(ePopup);
|
41044 | if (!eWrapper) {
|
41045 | return;
|
41046 | }
|
41047 | eWrapper.classList.toggle('ag-always-on-top', !!alwaysOnTop);
|
41048 | if (alwaysOnTop) {
|
41049 | this.bringPopupToFront(eWrapper);
|
41050 | }
|
41051 | };
|
41052 | PopupService.prototype.bringPopupToFront = function (ePopup) {
|
41053 | var parent = this.getPopupParent();
|
41054 | var popupList = Array.prototype.slice.call(parent.querySelectorAll('.ag-popup'));
|
41055 | var popupLen = popupList.length;
|
41056 | var alwaysOnTopList = Array.prototype.slice.call(parent.querySelectorAll('.ag-popup.ag-always-on-top'));
|
41057 | var onTopLength = alwaysOnTopList.length;
|
41058 | var eWrapper = this.getWrapper(ePopup);
|
41059 | if (!eWrapper || popupLen <= 1 || !parent.contains(ePopup)) {
|
41060 | return;
|
41061 | }
|
41062 | var pos = popupList.indexOf(eWrapper);
|
41063 | var innerEls = eWrapper.querySelectorAll('div');
|
41064 | var innerElsScrollMap = [];
|
41065 | innerEls.forEach(function (el) {
|
41066 | if (el.scrollTop !== 0) {
|
41067 | innerElsScrollMap.push([el, el.scrollTop]);
|
41068 | }
|
41069 | });
|
41070 | if (onTopLength) {
|
41071 | var isPopupAlwaysOnTop = eWrapper.classList.contains('ag-always-on-top');
|
41072 | if (isPopupAlwaysOnTop) {
|
41073 | if (pos !== popupLen - 1) {
|
41074 | last(alwaysOnTopList).insertAdjacentElement('afterend', eWrapper);
|
41075 | }
|
41076 | }
|
41077 | else if (pos !== popupLen - onTopLength - 1) {
|
41078 | alwaysOnTopList[0].insertAdjacentElement('beforebegin', eWrapper);
|
41079 | }
|
41080 | }
|
41081 | else if (pos !== popupLen - 1) {
|
41082 | last(popupList).insertAdjacentElement('afterend', eWrapper);
|
41083 | }
|
41084 | while (innerElsScrollMap.length) {
|
41085 | var currentEl = innerElsScrollMap.pop();
|
41086 | currentEl[0].scrollTop = currentEl[1];
|
41087 | }
|
41088 | var params = {
|
41089 | type: 'popupToFront',
|
41090 | api: this.gridOptionsService.api,
|
41091 | columnApi: this.gridOptionsService.columnApi,
|
41092 | eWrapper: eWrapper
|
41093 | };
|
41094 | this.eventService.dispatchEvent(params);
|
41095 | };
|
41096 | PopupService.prototype.checkClearMaxHeight = function (ePopup, shouldSetMaxHeight) {
|
41097 | if (shouldSetMaxHeight) {
|
41098 |
|
41099 | ePopup.style.removeProperty('max-height');
|
41100 | }
|
41101 | };
|
41102 | PopupService.prototype.checkSetMaxHeight = function (ePopup, y, shouldSetMaxHeight) {
|
41103 | if (shouldSetMaxHeight && getComputedStyle(ePopup).maxHeight === '100%') {
|
41104 |
|
41105 | ePopup.style.maxHeight = "calc(100% - " + y + "px)";
|
41106 | }
|
41107 | };
|
41108 | var PopupService_1;
|
41109 | PopupService.WAIT_FOR_POPUP_CONTENT_RESIZE = 200;
|
41110 | __decorate$Q([
|
41111 | Autowired('focusService')
|
41112 | ], PopupService.prototype, "focusService", void 0);
|
41113 | __decorate$Q([
|
41114 | Autowired('ctrlsService')
|
41115 | ], PopupService.prototype, "ctrlsService", void 0);
|
41116 | __decorate$Q([
|
41117 | Autowired('resizeObserverService')
|
41118 | ], PopupService.prototype, "resizeObserverService", void 0);
|
41119 | __decorate$Q([
|
41120 | PostConstruct
|
41121 | ], PopupService.prototype, "postConstruct", null);
|
41122 | PopupService = PopupService_1 = __decorate$Q([
|
41123 | Bean('popupService')
|
41124 | ], PopupService);
|
41125 | return PopupService;
|
41126 | }(BeanStub));
|
41127 |
|
41128 |
|
41129 |
|
41130 |
|
41131 |
|
41132 |
|
41133 |
|
41134 | var __extends$N = (undefined && undefined.__extends) || (function () {
|
41135 | var extendStatics = function (d, b) {
|
41136 | extendStatics = Object.setPrototypeOf ||
|
41137 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
41138 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
41139 | return extendStatics(d, b);
|
41140 | };
|
41141 | return function (d, b) {
|
41142 | extendStatics(d, b);
|
41143 | function __() { this.constructor = d; }
|
41144 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
41145 | };
|
41146 | })();
|
41147 | var __decorate$P = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
41148 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
41149 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
41150 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
41151 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
41152 | };
|
41153 | var VirtualList = (function (_super) {
|
41154 | __extends$N(VirtualList, _super);
|
41155 | function VirtualList(cssIdentifier, ariaRole, listName) {
|
41156 | if (cssIdentifier === void 0) { cssIdentifier = 'default'; }
|
41157 | if (ariaRole === void 0) { ariaRole = 'listbox'; }
|
41158 | var _this = _super.call(this, VirtualList.getTemplate(cssIdentifier)) || this;
|
41159 | _this.cssIdentifier = cssIdentifier;
|
41160 | _this.ariaRole = ariaRole;
|
41161 | _this.listName = listName;
|
41162 | _this.renderedRows = new Map();
|
41163 | _this.rowHeight = 20;
|
41164 | return _this;
|
41165 | }
|
41166 | VirtualList.prototype.postConstruct = function () {
|
41167 | var _this = this;
|
41168 | this.addScrollListener();
|
41169 | this.rowHeight = this.getItemHeight();
|
41170 | this.addResizeObserver();
|
41171 | this.initialiseTabGuard({
|
41172 | onFocusIn: function (e) { return _this.onFocusIn(e); },
|
41173 | onFocusOut: function (e) { return _this.onFocusOut(e); },
|
41174 | focusInnerElement: function (fromBottom) { return _this.focusInnerElement(fromBottom); },
|
41175 | onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
|
41176 | handleKeyDown: function (e) { return _this.handleKeyDown(e); }
|
41177 | });
|
41178 | this.setAriaProperties();
|
41179 | this.addManagedListener(this.eventService, Events.EVENT_GRID_STYLES_CHANGED, this.onGridStylesChanged.bind(this));
|
41180 | };
|
41181 | VirtualList.prototype.onGridStylesChanged = function () {
|
41182 | this.rowHeight = this.getItemHeight();
|
41183 | this.refresh();
|
41184 | };
|
41185 | VirtualList.prototype.setAriaProperties = function () {
|
41186 | var translate = this.localeService.getLocaleTextFunc();
|
41187 | var listName = translate('ariaDefaultListName', this.listName || 'List');
|
41188 | var ariaEl = this.eContainer;
|
41189 | setAriaRole(ariaEl, this.ariaRole);
|
41190 | setAriaLabel(ariaEl, listName);
|
41191 | };
|
41192 | VirtualList.prototype.addResizeObserver = function () {
|
41193 | var _this = this;
|
41194 | var listener = function () { return _this.drawVirtualRows(); };
|
41195 | var destroyObserver = this.resizeObserverService.observeResize(this.getGui(), listener);
|
41196 | this.addDestroyFunc(destroyObserver);
|
41197 | };
|
41198 | VirtualList.prototype.focusInnerElement = function (fromBottom) {
|
41199 | this.focusRow(fromBottom ? this.model.getRowCount() - 1 : 0);
|
41200 | };
|
41201 | VirtualList.prototype.onFocusIn = function (e) {
|
41202 | var target = e.target;
|
41203 | if (target.classList.contains('ag-virtual-list-item')) {
|
41204 | this.lastFocusedRowIndex = getAriaPosInSet(target) - 1;
|
41205 | }
|
41206 | return false;
|
41207 | };
|
41208 | VirtualList.prototype.onFocusOut = function (e) {
|
41209 | if (!this.getFocusableElement().contains(e.relatedTarget)) {
|
41210 | this.lastFocusedRowIndex = null;
|
41211 | }
|
41212 | return false;
|
41213 | };
|
41214 | VirtualList.prototype.handleKeyDown = function (e) {
|
41215 | switch (e.key) {
|
41216 | case KeyCode.UP:
|
41217 | case KeyCode.DOWN:
|
41218 | if (this.navigate(e.key === KeyCode.UP)) {
|
41219 | e.preventDefault();
|
41220 | }
|
41221 | break;
|
41222 | }
|
41223 | };
|
41224 | VirtualList.prototype.onTabKeyDown = function (e) {
|
41225 | if (this.navigate(e.shiftKey)) {
|
41226 | e.preventDefault();
|
41227 | }
|
41228 | else {
|
41229 | this.forceFocusOutOfContainer(e.shiftKey);
|
41230 | }
|
41231 | };
|
41232 | VirtualList.prototype.navigate = function (up) {
|
41233 | if (this.lastFocusedRowIndex == null) {
|
41234 | return false;
|
41235 | }
|
41236 | var nextRow = this.lastFocusedRowIndex + (up ? -1 : 1);
|
41237 | if (nextRow < 0 || nextRow >= this.model.getRowCount()) {
|
41238 | return false;
|
41239 | }
|
41240 | this.focusRow(nextRow);
|
41241 | return true;
|
41242 | };
|
41243 | VirtualList.prototype.getLastFocusedRow = function () {
|
41244 | return this.lastFocusedRowIndex;
|
41245 | };
|
41246 | VirtualList.prototype.focusRow = function (rowNumber) {
|
41247 | var _this = this;
|
41248 | this.ensureIndexVisible(rowNumber);
|
41249 | window.setTimeout(function () {
|
41250 | if (!_this.isAlive()) {
|
41251 | return;
|
41252 | }
|
41253 | var renderedRow = _this.renderedRows.get(rowNumber);
|
41254 | if (renderedRow) {
|
41255 | renderedRow.eDiv.focus();
|
41256 | }
|
41257 | }, 10);
|
41258 | };
|
41259 | VirtualList.prototype.getComponentAt = function (rowIndex) {
|
41260 | var comp = this.renderedRows.get(rowIndex);
|
41261 | return comp && comp.rowComponent;
|
41262 | };
|
41263 | VirtualList.prototype.forEachRenderedRow = function (func) {
|
41264 | this.renderedRows.forEach(function (value, key) { return func(value.rowComponent, key); });
|
41265 | };
|
41266 | VirtualList.getTemplate = function (cssIdentifier) {
|
41267 | 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>";
|
41268 | };
|
41269 | VirtualList.prototype.getItemHeight = function () {
|
41270 | return this.environment.getListItemHeight();
|
41271 | };
|
41272 | VirtualList.prototype.ensureIndexVisible = function (index) {
|
41273 | var lastRow = this.model.getRowCount();
|
41274 | if (typeof index !== 'number' || index < 0 || index >= lastRow) {
|
41275 | console.warn('AG Grid: invalid row index for ensureIndexVisible: ' + index);
|
41276 | return;
|
41277 | }
|
41278 | var rowTopPixel = index * this.rowHeight;
|
41279 | var rowBottomPixel = rowTopPixel + this.rowHeight;
|
41280 | var eGui = this.getGui();
|
41281 | var viewportTopPixel = eGui.scrollTop;
|
41282 | var viewportHeight = eGui.offsetHeight;
|
41283 | var viewportBottomPixel = viewportTopPixel + viewportHeight;
|
41284 | var viewportScrolledPastRow = viewportTopPixel > rowTopPixel;
|
41285 | var viewportScrolledBeforeRow = viewportBottomPixel < rowBottomPixel;
|
41286 | if (viewportScrolledPastRow) {
|
41287 |
|
41288 | eGui.scrollTop = rowTopPixel;
|
41289 | }
|
41290 | else if (viewportScrolledBeforeRow) {
|
41291 |
|
41292 | var newScrollPosition = rowBottomPixel - viewportHeight;
|
41293 | eGui.scrollTop = newScrollPosition;
|
41294 | }
|
41295 | };
|
41296 | VirtualList.prototype.setComponentCreator = function (componentCreator) {
|
41297 | this.componentCreator = componentCreator;
|
41298 | };
|
41299 | VirtualList.prototype.setComponentUpdater = function (componentUpdater) {
|
41300 | this.componentUpdater = componentUpdater;
|
41301 | };
|
41302 | VirtualList.prototype.getRowHeight = function () {
|
41303 | return this.rowHeight;
|
41304 | };
|
41305 | VirtualList.prototype.getScrollTop = function () {
|
41306 | return this.getGui().scrollTop;
|
41307 | };
|
41308 | VirtualList.prototype.setRowHeight = function (rowHeight) {
|
41309 | this.rowHeight = rowHeight;
|
41310 | this.refresh();
|
41311 | };
|
41312 | VirtualList.prototype.refresh = function (softRefresh) {
|
41313 | var _this = this;
|
41314 | if (this.model == null || !this.isAlive()) {
|
41315 | return;
|
41316 | }
|
41317 | var rowCount = this.model.getRowCount();
|
41318 | this.eContainer.style.height = rowCount * this.rowHeight + "px";
|
41319 |
|
41320 | waitUntil(function () { return _this.eContainer.clientHeight >= rowCount * _this.rowHeight; }, function () {
|
41321 | if (!_this.isAlive()) {
|
41322 | return;
|
41323 | }
|
41324 | if (_this.canSoftRefresh(softRefresh)) {
|
41325 | _this.drawVirtualRows(true);
|
41326 | }
|
41327 | else {
|
41328 | _this.clearVirtualRows();
|
41329 | _this.drawVirtualRows();
|
41330 | }
|
41331 | });
|
41332 | };
|
41333 | VirtualList.prototype.canSoftRefresh = function (softRefresh) {
|
41334 | return !!(softRefresh && this.renderedRows.size && typeof this.model.areRowsEqual === 'function' && this.componentUpdater);
|
41335 | };
|
41336 | VirtualList.prototype.clearVirtualRows = function () {
|
41337 | var _this = this;
|
41338 | this.renderedRows.forEach(function (_, rowIndex) { return _this.removeRow(rowIndex); });
|
41339 | };
|
41340 | VirtualList.prototype.drawVirtualRows = function (softRefresh) {
|
41341 | if (!this.isAlive()) {
|
41342 | return;
|
41343 | }
|
41344 | var gui = this.getGui();
|
41345 | var topPixel = gui.scrollTop;
|
41346 | var bottomPixel = topPixel + gui.offsetHeight;
|
41347 | var firstRow = Math.floor(topPixel / this.rowHeight);
|
41348 | var lastRow = Math.floor(bottomPixel / this.rowHeight);
|
41349 | this.ensureRowsRendered(firstRow, lastRow, softRefresh);
|
41350 | };
|
41351 | VirtualList.prototype.ensureRowsRendered = function (start, finish, softRefresh) {
|
41352 | var _this = this;
|
41353 |
|
41354 | this.renderedRows.forEach(function (_, rowIndex) {
|
41355 | if ((rowIndex < start || rowIndex > finish) && rowIndex !== _this.lastFocusedRowIndex) {
|
41356 | _this.removeRow(rowIndex);
|
41357 | }
|
41358 | });
|
41359 | if (softRefresh) {
|
41360 |
|
41361 | this.refreshRows();
|
41362 | }
|
41363 |
|
41364 | for (var rowIndex = start; rowIndex <= finish; rowIndex++) {
|
41365 | if (this.renderedRows.has(rowIndex)) {
|
41366 | continue;
|
41367 | }
|
41368 |
|
41369 | if (rowIndex < this.model.getRowCount()) {
|
41370 | this.insertRow(rowIndex);
|
41371 | }
|
41372 | }
|
41373 | };
|
41374 | VirtualList.prototype.insertRow = function (rowIndex) {
|
41375 | var _this = this;
|
41376 | var value = this.model.getRow(rowIndex);
|
41377 | var eDiv = document.createElement('div');
|
41378 | eDiv.classList.add('ag-virtual-list-item', "ag-" + this.cssIdentifier + "-virtual-list-item");
|
41379 | setAriaRole(eDiv, this.ariaRole === 'tree' ? 'treeitem' : 'option');
|
41380 | setAriaSetSize(eDiv, this.model.getRowCount());
|
41381 | setAriaPosInSet(eDiv, rowIndex + 1);
|
41382 | eDiv.setAttribute('tabindex', '-1');
|
41383 | if (typeof this.model.isRowSelected === 'function') {
|
41384 | var isSelected = this.model.isRowSelected(rowIndex);
|
41385 | setAriaSelected(eDiv, !!isSelected);
|
41386 | setAriaChecked(eDiv, isSelected);
|
41387 | }
|
41388 | eDiv.style.height = this.rowHeight + "px";
|
41389 | eDiv.style.top = this.rowHeight * rowIndex + "px";
|
41390 | var rowComponent = this.componentCreator(value, eDiv);
|
41391 | rowComponent.addGuiEventListener('focusin', function () { return _this.lastFocusedRowIndex = rowIndex; });
|
41392 | eDiv.appendChild(rowComponent.getGui());
|
41393 |
|
41394 | if (this.renderedRows.has(rowIndex - 1)) {
|
41395 | this.renderedRows.get(rowIndex - 1).eDiv.insertAdjacentElement('afterend', eDiv);
|
41396 | }
|
41397 | else if (this.renderedRows.has(rowIndex + 1)) {
|
41398 | this.renderedRows.get(rowIndex + 1).eDiv.insertAdjacentElement('beforebegin', eDiv);
|
41399 | }
|
41400 | else {
|
41401 | this.eContainer.appendChild(eDiv);
|
41402 | }
|
41403 | this.renderedRows.set(rowIndex, { rowComponent: rowComponent, eDiv: eDiv, value: value });
|
41404 | };
|
41405 | VirtualList.prototype.removeRow = function (rowIndex) {
|
41406 | var component = this.renderedRows.get(rowIndex);
|
41407 | this.eContainer.removeChild(component.eDiv);
|
41408 | this.destroyBean(component.rowComponent);
|
41409 | this.renderedRows.delete(rowIndex);
|
41410 | };
|
41411 | VirtualList.prototype.refreshRows = function () {
|
41412 | var _this = this;
|
41413 | var rowCount = this.model.getRowCount();
|
41414 | this.renderedRows.forEach(function (row, rowIndex) {
|
41415 | var _a, _b;
|
41416 | if (rowIndex >= rowCount) {
|
41417 | _this.removeRow(rowIndex);
|
41418 | }
|
41419 | else {
|
41420 | var newValue = _this.model.getRow(rowIndex);
|
41421 | if ((_b = (_a = _this.model).areRowsEqual) === null || _b === void 0 ? void 0 : _b.call(_a, row.value, newValue)) {
|
41422 | _this.componentUpdater(newValue, row.rowComponent);
|
41423 | }
|
41424 | else {
|
41425 |
|
41426 | _this.removeRow(rowIndex);
|
41427 | }
|
41428 | }
|
41429 | });
|
41430 | };
|
41431 | VirtualList.prototype.addScrollListener = function () {
|
41432 | var _this = this;
|
41433 | this.addGuiEventListener('scroll', function () { return _this.drawVirtualRows(); }, { passive: true });
|
41434 | };
|
41435 | VirtualList.prototype.setModel = function (model) {
|
41436 | this.model = model;
|
41437 | };
|
41438 | VirtualList.prototype.destroy = function () {
|
41439 | if (!this.isAlive()) {
|
41440 | return;
|
41441 | }
|
41442 | this.clearVirtualRows();
|
41443 | _super.prototype.destroy.call(this);
|
41444 | };
|
41445 | __decorate$P([
|
41446 | Autowired('resizeObserverService')
|
41447 | ], VirtualList.prototype, "resizeObserverService", void 0);
|
41448 | __decorate$P([
|
41449 | RefSelector('eContainer')
|
41450 | ], VirtualList.prototype, "eContainer", void 0);
|
41451 | __decorate$P([
|
41452 | PostConstruct
|
41453 | ], VirtualList.prototype, "postConstruct", null);
|
41454 | return VirtualList;
|
41455 | }(TabGuardComp));
|
41456 |
|
41457 |
|
41458 |
|
41459 |
|
41460 |
|
41461 |
|
41462 |
|
41463 | var OUTSIDE_ANGULAR_EVENTS = ['mouseover', 'mouseout', 'mouseenter', 'mouseleave'];
|
41464 | var PASSIVE_EVENTS = ['touchstart', 'touchend', 'touchmove', 'touchcancel'];
|
41465 |
|
41466 | var VanillaFrameworkOverrides = (function () {
|
41467 | function VanillaFrameworkOverrides() {
|
41468 | this.isOutsideAngular = function (eventType) { return includes(OUTSIDE_ANGULAR_EVENTS, eventType); };
|
41469 | }
|
41470 |
|
41471 | VanillaFrameworkOverrides.prototype.setTimeout = function (action, timeout) {
|
41472 | window.setTimeout(action, timeout);
|
41473 | };
|
41474 | VanillaFrameworkOverrides.prototype.setInterval = function (action, timeout) {
|
41475 | return new AgPromise(function (resolve) {
|
41476 | resolve(window.setInterval(action, timeout));
|
41477 | });
|
41478 | };
|
41479 |
|
41480 | VanillaFrameworkOverrides.prototype.addEventListener = function (element, type, listener, useCapture) {
|
41481 | var isPassive = includes(PASSIVE_EVENTS, type);
|
41482 | element.addEventListener(type, listener, { capture: !!useCapture, passive: isPassive });
|
41483 | };
|
41484 |
|
41485 | VanillaFrameworkOverrides.prototype.dispatchEvent = function (eventType, listener, global) {
|
41486 | listener();
|
41487 | };
|
41488 | VanillaFrameworkOverrides.prototype.frameworkComponent = function (name) {
|
41489 | return null;
|
41490 | };
|
41491 | VanillaFrameworkOverrides.prototype.isFrameworkComponent = function (comp) {
|
41492 | return false;
|
41493 | };
|
41494 | return VanillaFrameworkOverrides;
|
41495 | }());
|
41496 |
|
41497 |
|
41498 |
|
41499 |
|
41500 |
|
41501 |
|
41502 |
|
41503 | var __extends$M = (undefined && undefined.__extends) || (function () {
|
41504 | var extendStatics = function (d, b) {
|
41505 | extendStatics = Object.setPrototypeOf ||
|
41506 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
41507 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
41508 | return extendStatics(d, b);
|
41509 | };
|
41510 | return function (d, b) {
|
41511 | extendStatics(d, b);
|
41512 | function __() { this.constructor = d; }
|
41513 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
41514 | };
|
41515 | })();
|
41516 | var __decorate$O = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
41517 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
41518 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
41519 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
41520 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
41521 | };
|
41522 | var __read$9 = (undefined && undefined.__read) || function (o, n) {
|
41523 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
41524 | if (!m) return o;
|
41525 | var i = m.call(o), r, ar = [], e;
|
41526 | try {
|
41527 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
41528 | }
|
41529 | catch (error) { e = { error: error }; }
|
41530 | finally {
|
41531 | try {
|
41532 | if (r && !r.done && (m = i["return"])) m.call(i);
|
41533 | }
|
41534 | finally { if (e) throw e.error; }
|
41535 | }
|
41536 | return ar;
|
41537 | };
|
41538 | var __spread$7 = (undefined && undefined.__spread) || function () {
|
41539 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$9(arguments[i]));
|
41540 | return ar;
|
41541 | };
|
41542 | var CellNavigationService = (function (_super) {
|
41543 | __extends$M(CellNavigationService, _super);
|
41544 | function CellNavigationService() {
|
41545 | return _super !== null && _super.apply(this, arguments) || this;
|
41546 | }
|
41547 |
|
41548 | CellNavigationService.prototype.getNextCellToFocus = function (key, focusedCell, ctrlPressed) {
|
41549 | if (ctrlPressed === void 0) { ctrlPressed = false; }
|
41550 | if (ctrlPressed) {
|
41551 | return this.getNextCellToFocusWithCtrlPressed(key, focusedCell);
|
41552 | }
|
41553 | return this.getNextCellToFocusWithoutCtrlPressed(key, focusedCell);
|
41554 | };
|
41555 | CellNavigationService.prototype.getNextCellToFocusWithCtrlPressed = function (key, focusedCell) {
|
41556 | var upKey = key === KeyCode.UP;
|
41557 | var downKey = key === KeyCode.DOWN;
|
41558 | var leftKey = key === KeyCode.LEFT;
|
41559 | var column;
|
41560 | var rowIndex;
|
41561 | if (upKey || downKey) {
|
41562 | rowIndex = upKey ? this.paginationProxy.getPageFirstRow() : this.paginationProxy.getPageLastRow();
|
41563 | column = focusedCell.column;
|
41564 | }
|
41565 | else {
|
41566 | var allColumns = this.columnModel.getAllDisplayedColumns();
|
41567 | var isRtl = this.gridOptionsService.is('enableRtl');
|
41568 | rowIndex = focusedCell.rowIndex;
|
41569 | column = leftKey !== isRtl ? allColumns[0] : last(allColumns);
|
41570 | }
|
41571 | return {
|
41572 | rowIndex: rowIndex,
|
41573 | rowPinned: null,
|
41574 | column: column
|
41575 | };
|
41576 | };
|
41577 | CellNavigationService.prototype.getNextCellToFocusWithoutCtrlPressed = function (key, focusedCell) {
|
41578 |
|
41579 |
|
41580 | var pointer = focusedCell;
|
41581 | var finished = false;
|
41582 |
|
41583 |
|
41584 |
|
41585 | while (!finished) {
|
41586 | switch (key) {
|
41587 | case KeyCode.UP:
|
41588 | pointer = this.getCellAbove(pointer);
|
41589 | break;
|
41590 | case KeyCode.DOWN:
|
41591 | pointer = this.getCellBelow(pointer);
|
41592 | break;
|
41593 | case KeyCode.RIGHT:
|
41594 | if (this.gridOptionsService.is('enableRtl')) {
|
41595 | pointer = this.getCellToLeft(pointer);
|
41596 | }
|
41597 | else {
|
41598 | pointer = this.getCellToRight(pointer);
|
41599 | }
|
41600 | break;
|
41601 | case KeyCode.LEFT:
|
41602 | if (this.gridOptionsService.is('enableRtl')) {
|
41603 | pointer = this.getCellToRight(pointer);
|
41604 | }
|
41605 | else {
|
41606 | pointer = this.getCellToLeft(pointer);
|
41607 | }
|
41608 | break;
|
41609 | default:
|
41610 | pointer = null;
|
41611 | console.warn('AG Grid: unknown key for navigation ' + key);
|
41612 | break;
|
41613 | }
|
41614 | if (pointer) {
|
41615 | finished = this.isCellGoodToFocusOn(pointer);
|
41616 | }
|
41617 | else {
|
41618 | finished = true;
|
41619 | }
|
41620 | }
|
41621 | return pointer;
|
41622 | };
|
41623 | CellNavigationService.prototype.isCellGoodToFocusOn = function (gridCell) {
|
41624 | var column = gridCell.column;
|
41625 | var rowNode;
|
41626 | switch (gridCell.rowPinned) {
|
41627 | case 'top':
|
41628 | rowNode = this.pinnedRowModel.getPinnedTopRow(gridCell.rowIndex);
|
41629 | break;
|
41630 | case 'bottom':
|
41631 | rowNode = this.pinnedRowModel.getPinnedBottomRow(gridCell.rowIndex);
|
41632 | break;
|
41633 | default:
|
41634 | rowNode = this.rowModel.getRow(gridCell.rowIndex);
|
41635 | break;
|
41636 | }
|
41637 | if (!rowNode) {
|
41638 | return false;
|
41639 | }
|
41640 | var suppressNavigable = column.isSuppressNavigable(rowNode);
|
41641 | return !suppressNavigable;
|
41642 | };
|
41643 | CellNavigationService.prototype.getCellToLeft = function (lastCell) {
|
41644 | if (!lastCell) {
|
41645 | return null;
|
41646 | }
|
41647 | var colToLeft = this.columnModel.getDisplayedColBefore(lastCell.column);
|
41648 | if (!colToLeft) {
|
41649 | return null;
|
41650 | }
|
41651 | return {
|
41652 | rowIndex: lastCell.rowIndex,
|
41653 | column: colToLeft,
|
41654 | rowPinned: lastCell.rowPinned
|
41655 | };
|
41656 | };
|
41657 | CellNavigationService.prototype.getCellToRight = function (lastCell) {
|
41658 | if (!lastCell) {
|
41659 | return null;
|
41660 | }
|
41661 | var colToRight = this.columnModel.getDisplayedColAfter(lastCell.column);
|
41662 |
|
41663 | if (!colToRight) {
|
41664 | return null;
|
41665 | }
|
41666 | return {
|
41667 | rowIndex: lastCell.rowIndex,
|
41668 | column: colToRight,
|
41669 | rowPinned: lastCell.rowPinned
|
41670 | };
|
41671 | };
|
41672 | CellNavigationService.prototype.getRowBelow = function (rowPosition) {
|
41673 |
|
41674 | var index = rowPosition.rowIndex;
|
41675 | var pinned = rowPosition.rowPinned;
|
41676 | if (this.isLastRowInContainer(rowPosition)) {
|
41677 | switch (pinned) {
|
41678 | case 'bottom':
|
41679 |
|
41680 | return null;
|
41681 | case 'top':
|
41682 |
|
41683 |
|
41684 | if (this.rowModel.isRowsToRender()) {
|
41685 | return { rowIndex: this.paginationProxy.getPageFirstRow(), rowPinned: null };
|
41686 | }
|
41687 | if (this.pinnedRowModel.isRowsToRender('bottom')) {
|
41688 | return { rowIndex: 0, rowPinned: 'bottom' };
|
41689 | }
|
41690 | return null;
|
41691 | default:
|
41692 |
|
41693 | if (this.pinnedRowModel.isRowsToRender('bottom')) {
|
41694 | return { rowIndex: 0, rowPinned: 'bottom' };
|
41695 | }
|
41696 | return null;
|
41697 | }
|
41698 | }
|
41699 | var rowNode = this.rowModel.getRow(rowPosition.rowIndex);
|
41700 | var nextStickyPosition = this.getNextStickyPosition(rowNode);
|
41701 | if (nextStickyPosition) {
|
41702 | return nextStickyPosition;
|
41703 | }
|
41704 | return { rowIndex: index + 1, rowPinned: pinned };
|
41705 | };
|
41706 | CellNavigationService.prototype.getNextStickyPosition = function (rowNode, up) {
|
41707 | if (!this.gridOptionsService.is('groupRowsSticky') || !rowNode || !rowNode.sticky) {
|
41708 | return;
|
41709 | }
|
41710 | var stickyRowCtrls = __spread$7(this.rowRenderer.getStickyTopRowCtrls()).sort(function (a, b) { return a.getRowNode().rowIndex - b.getRowNode().rowIndex; });
|
41711 | var diff = up ? -1 : 1;
|
41712 | var idx = stickyRowCtrls.findIndex(function (ctrl) { return ctrl.getRowNode().rowIndex === rowNode.rowIndex; });
|
41713 | var nextCtrl = stickyRowCtrls[idx + diff];
|
41714 | if (nextCtrl) {
|
41715 | return { rowIndex: nextCtrl.getRowNode().rowIndex, rowPinned: null };
|
41716 | }
|
41717 | };
|
41718 | CellNavigationService.prototype.getCellBelow = function (lastCell) {
|
41719 | if (!lastCell) {
|
41720 | return null;
|
41721 | }
|
41722 | var rowBelow = this.getRowBelow(lastCell);
|
41723 | if (rowBelow) {
|
41724 | return {
|
41725 | rowIndex: rowBelow.rowIndex,
|
41726 | column: lastCell.column,
|
41727 | rowPinned: rowBelow.rowPinned
|
41728 | };
|
41729 | }
|
41730 | return null;
|
41731 | };
|
41732 | CellNavigationService.prototype.isLastRowInContainer = function (rowPosition) {
|
41733 | var pinned = rowPosition.rowPinned;
|
41734 | var index = rowPosition.rowIndex;
|
41735 | if (pinned === 'top') {
|
41736 | var lastTopIndex = this.pinnedRowModel.getPinnedTopRowData().length - 1;
|
41737 | return lastTopIndex <= index;
|
41738 | }
|
41739 | if (pinned === 'bottom') {
|
41740 | var lastBottomIndex = this.pinnedRowModel.getPinnedBottomRowData().length - 1;
|
41741 | return lastBottomIndex <= index;
|
41742 | }
|
41743 | var lastBodyIndex = this.paginationProxy.getPageLastRow();
|
41744 | return lastBodyIndex <= index;
|
41745 | };
|
41746 | CellNavigationService.prototype.getRowAbove = function (rowPosition) {
|
41747 |
|
41748 | var index = rowPosition.rowIndex;
|
41749 | var pinned = rowPosition.rowPinned;
|
41750 | var isFirstRow = pinned ? index === 0 : index === this.paginationProxy.getPageFirstRow();
|
41751 |
|
41752 | if (isFirstRow) {
|
41753 | if (pinned === 'top') {
|
41754 | return null;
|
41755 | }
|
41756 | if (!pinned) {
|
41757 | if (this.pinnedRowModel.isRowsToRender('top')) {
|
41758 | return this.getLastFloatingTopRow();
|
41759 | }
|
41760 | return null;
|
41761 | }
|
41762 |
|
41763 | if (this.rowModel.isRowsToRender()) {
|
41764 | return this.getLastBodyCell();
|
41765 | }
|
41766 | if (this.pinnedRowModel.isRowsToRender('top')) {
|
41767 | return this.getLastFloatingTopRow();
|
41768 | }
|
41769 | return null;
|
41770 | }
|
41771 | var rowNode = this.rowModel.getRow(rowPosition.rowIndex);
|
41772 | var nextStickyPosition = this.getNextStickyPosition(rowNode, true);
|
41773 | if (nextStickyPosition) {
|
41774 | return nextStickyPosition;
|
41775 | }
|
41776 | return { rowIndex: index - 1, rowPinned: pinned };
|
41777 | };
|
41778 | CellNavigationService.prototype.getCellAbove = function (lastCell) {
|
41779 | if (!lastCell) {
|
41780 | return null;
|
41781 | }
|
41782 | var rowAbove = this.getRowAbove({ rowIndex: lastCell.rowIndex, rowPinned: lastCell.rowPinned });
|
41783 | if (rowAbove) {
|
41784 | return {
|
41785 | rowIndex: rowAbove.rowIndex,
|
41786 | column: lastCell.column,
|
41787 | rowPinned: rowAbove.rowPinned
|
41788 | };
|
41789 | }
|
41790 | return null;
|
41791 | };
|
41792 | CellNavigationService.prototype.getLastBodyCell = function () {
|
41793 | var lastBodyRow = this.paginationProxy.getPageLastRow();
|
41794 | return { rowIndex: lastBodyRow, rowPinned: null };
|
41795 | };
|
41796 | CellNavigationService.prototype.getLastFloatingTopRow = function () {
|
41797 | var lastFloatingRow = this.pinnedRowModel.getPinnedTopRowData().length - 1;
|
41798 | return { rowIndex: lastFloatingRow, rowPinned: 'top' };
|
41799 | };
|
41800 | CellNavigationService.prototype.getNextTabbedCell = function (gridCell, backwards) {
|
41801 | if (backwards) {
|
41802 | return this.getNextTabbedCellBackwards(gridCell);
|
41803 | }
|
41804 | return this.getNextTabbedCellForwards(gridCell);
|
41805 | };
|
41806 | CellNavigationService.prototype.getNextTabbedCellForwards = function (gridCell) {
|
41807 | var displayedColumns = this.columnModel.getAllDisplayedColumns();
|
41808 | var newRowIndex = gridCell.rowIndex;
|
41809 | var newFloating = gridCell.rowPinned;
|
41810 |
|
41811 | var newColumn = this.columnModel.getDisplayedColAfter(gridCell.column);
|
41812 |
|
41813 | if (!newColumn) {
|
41814 | newColumn = displayedColumns[0];
|
41815 | var rowBelow = this.getRowBelow(gridCell);
|
41816 | if (missing(rowBelow)) {
|
41817 | return null;
|
41818 | }
|
41819 |
|
41820 |
|
41821 | if (!rowBelow.rowPinned && !this.paginationProxy.isRowInPage(rowBelow)) {
|
41822 | return null;
|
41823 | }
|
41824 | newRowIndex = rowBelow ? rowBelow.rowIndex : null;
|
41825 | newFloating = rowBelow ? rowBelow.rowPinned : null;
|
41826 | }
|
41827 | return { rowIndex: newRowIndex, column: newColumn, rowPinned: newFloating };
|
41828 | };
|
41829 | CellNavigationService.prototype.getNextTabbedCellBackwards = function (gridCell) {
|
41830 | var displayedColumns = this.columnModel.getAllDisplayedColumns();
|
41831 | var newRowIndex = gridCell.rowIndex;
|
41832 | var newFloating = gridCell.rowPinned;
|
41833 |
|
41834 | var newColumn = this.columnModel.getDisplayedColBefore(gridCell.column);
|
41835 |
|
41836 | if (!newColumn) {
|
41837 | newColumn = last(displayedColumns);
|
41838 | var rowAbove = this.getRowAbove({ rowIndex: gridCell.rowIndex, rowPinned: gridCell.rowPinned });
|
41839 | if (missing(rowAbove)) {
|
41840 | return null;
|
41841 | }
|
41842 |
|
41843 |
|
41844 | if (!rowAbove.rowPinned && !this.paginationProxy.isRowInPage(rowAbove)) {
|
41845 | return null;
|
41846 | }
|
41847 | newRowIndex = rowAbove ? rowAbove.rowIndex : null;
|
41848 | newFloating = rowAbove ? rowAbove.rowPinned : null;
|
41849 | }
|
41850 | return { rowIndex: newRowIndex, column: newColumn, rowPinned: newFloating };
|
41851 | };
|
41852 | __decorate$O([
|
41853 | Autowired('columnModel')
|
41854 | ], CellNavigationService.prototype, "columnModel", void 0);
|
41855 | __decorate$O([
|
41856 | Autowired('rowModel')
|
41857 | ], CellNavigationService.prototype, "rowModel", void 0);
|
41858 | __decorate$O([
|
41859 | Autowired('rowRenderer')
|
41860 | ], CellNavigationService.prototype, "rowRenderer", void 0);
|
41861 | __decorate$O([
|
41862 | Autowired('pinnedRowModel')
|
41863 | ], CellNavigationService.prototype, "pinnedRowModel", void 0);
|
41864 | __decorate$O([
|
41865 | Autowired('paginationProxy')
|
41866 | ], CellNavigationService.prototype, "paginationProxy", void 0);
|
41867 | CellNavigationService = __decorate$O([
|
41868 | Bean('cellNavigationService')
|
41869 | ], CellNavigationService);
|
41870 | return CellNavigationService;
|
41871 | }(BeanStub));
|
41872 |
|
41873 |
|
41874 |
|
41875 |
|
41876 |
|
41877 |
|
41878 |
|
41879 | var __extends$L = (undefined && undefined.__extends) || (function () {
|
41880 | var extendStatics = function (d, b) {
|
41881 | extendStatics = Object.setPrototypeOf ||
|
41882 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
41883 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
41884 | return extendStatics(d, b);
|
41885 | };
|
41886 | return function (d, b) {
|
41887 | extendStatics(d, b);
|
41888 | function __() { this.constructor = d; }
|
41889 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
41890 | };
|
41891 | })();
|
41892 | var __decorate$N = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
41893 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
41894 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
41895 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
41896 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
41897 | };
|
41898 | var __param$6 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
41899 | return function (target, key) { decorator(target, key, paramIndex); }
|
41900 | };
|
41901 | var AlignedGridsService = (function (_super) {
|
41902 | __extends$L(AlignedGridsService, _super);
|
41903 | function AlignedGridsService() {
|
41904 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
41905 |
|
41906 |
|
41907 |
|
41908 | _this.consuming = false;
|
41909 | return _this;
|
41910 | }
|
41911 | AlignedGridsService.prototype.setBeans = function (loggerFactory) {
|
41912 | this.logger = loggerFactory.create('AlignedGridsService');
|
41913 | };
|
41914 | AlignedGridsService.prototype.init = function () {
|
41915 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, this.fireColumnEvent.bind(this));
|
41916 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, this.fireColumnEvent.bind(this));
|
41917 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, this.fireColumnEvent.bind(this));
|
41918 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, this.fireColumnEvent.bind(this));
|
41919 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_RESIZED, this.fireColumnEvent.bind(this));
|
41920 | this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, this.fireScrollEvent.bind(this));
|
41921 | };
|
41922 |
|
41923 | AlignedGridsService.prototype.fireEvent = function (callback) {
|
41924 |
|
41925 |
|
41926 | if (this.consuming) {
|
41927 | return;
|
41928 | }
|
41929 |
|
41930 | var otherGrids = this.gridOptionsService.get('alignedGrids');
|
41931 | if (otherGrids) {
|
41932 | otherGrids.forEach(function (otherGridOptions) {
|
41933 | if (otherGridOptions.api) {
|
41934 | var alignedGridService = otherGridOptions.api.__getAlignedGridService();
|
41935 | callback(alignedGridService);
|
41936 | }
|
41937 | });
|
41938 | }
|
41939 | };
|
41940 |
|
41941 |
|
41942 | AlignedGridsService.prototype.onEvent = function (callback) {
|
41943 | this.consuming = true;
|
41944 | callback();
|
41945 | this.consuming = false;
|
41946 | };
|
41947 | AlignedGridsService.prototype.fireColumnEvent = function (event) {
|
41948 | this.fireEvent(function (alignedGridsService) {
|
41949 | alignedGridsService.onColumnEvent(event);
|
41950 | });
|
41951 | };
|
41952 | AlignedGridsService.prototype.fireScrollEvent = function (event) {
|
41953 | if (event.direction !== 'horizontal') {
|
41954 | return;
|
41955 | }
|
41956 | this.fireEvent(function (alignedGridsService) {
|
41957 | alignedGridsService.onScrollEvent(event);
|
41958 | });
|
41959 | };
|
41960 | AlignedGridsService.prototype.onScrollEvent = function (event) {
|
41961 | var _this = this;
|
41962 | this.onEvent(function () {
|
41963 | var gridBodyCon = _this.ctrlsService.getGridBodyCtrl();
|
41964 | gridBodyCon.getScrollFeature().setHorizontalScrollPosition(event.left);
|
41965 | });
|
41966 | };
|
41967 | AlignedGridsService.prototype.getMasterColumns = function (event) {
|
41968 | var result = [];
|
41969 | if (event.columns) {
|
41970 | event.columns.forEach(function (column) {
|
41971 | result.push(column);
|
41972 | });
|
41973 | }
|
41974 | else if (event.column) {
|
41975 | result.push(event.column);
|
41976 | }
|
41977 | return result;
|
41978 | };
|
41979 | AlignedGridsService.prototype.getColumnIds = function (event) {
|
41980 | var result = [];
|
41981 | if (event.columns) {
|
41982 | event.columns.forEach(function (column) {
|
41983 | result.push(column.getColId());
|
41984 | });
|
41985 | }
|
41986 | else if (event.column) {
|
41987 | result.push(event.column.getColId());
|
41988 | }
|
41989 | return result;
|
41990 | };
|
41991 | AlignedGridsService.prototype.onColumnEvent = function (event) {
|
41992 | var _this = this;
|
41993 | this.onEvent(function () {
|
41994 | switch (event.type) {
|
41995 | case Events.EVENT_COLUMN_MOVED:
|
41996 | case Events.EVENT_COLUMN_VISIBLE:
|
41997 | case Events.EVENT_COLUMN_PINNED:
|
41998 | case Events.EVENT_COLUMN_RESIZED:
|
41999 | var colEvent = event;
|
42000 | _this.processColumnEvent(colEvent);
|
42001 | break;
|
42002 | case Events.EVENT_COLUMN_GROUP_OPENED:
|
42003 | var groupOpenedEvent = event;
|
42004 | _this.processGroupOpenedEvent(groupOpenedEvent);
|
42005 | break;
|
42006 | case Events.EVENT_COLUMN_PIVOT_CHANGED:
|
42007 |
|
42008 |
|
42009 | console.warn('AG Grid: pivoting is not supported with aligned grids. ' +
|
42010 | 'You can only use one of these features at a time in a grid.');
|
42011 | break;
|
42012 | }
|
42013 | });
|
42014 | };
|
42015 | AlignedGridsService.prototype.processGroupOpenedEvent = function (groupOpenedEvent) {
|
42016 |
|
42017 | var masterColumnGroup = groupOpenedEvent.columnGroup;
|
42018 | var otherColumnGroup = null;
|
42019 | if (masterColumnGroup) {
|
42020 | var groupId = masterColumnGroup.getGroupId();
|
42021 | otherColumnGroup = this.columnModel.getProvidedColumnGroup(groupId);
|
42022 | }
|
42023 | if (masterColumnGroup && !otherColumnGroup) {
|
42024 | return;
|
42025 | }
|
42026 | this.logger.log('onColumnEvent-> processing ' + groupOpenedEvent + ' expanded = ' + masterColumnGroup.isExpanded());
|
42027 | this.columnModel.setColumnGroupOpened(otherColumnGroup, masterColumnGroup.isExpanded(), "alignedGridChanged");
|
42028 | };
|
42029 | AlignedGridsService.prototype.processColumnEvent = function (colEvent) {
|
42030 | var _this = this;
|
42031 | var _a;
|
42032 |
|
42033 |
|
42034 | var masterColumn = colEvent.column;
|
42035 | var otherColumn = null;
|
42036 | if (masterColumn) {
|
42037 | otherColumn = this.columnModel.getPrimaryColumn(masterColumn.getColId());
|
42038 | }
|
42039 |
|
42040 |
|
42041 | if (masterColumn && !otherColumn) {
|
42042 | return;
|
42043 | }
|
42044 |
|
42045 |
|
42046 | var masterColumns = this.getMasterColumns(colEvent);
|
42047 | switch (colEvent.type) {
|
42048 | case Events.EVENT_COLUMN_MOVED:
|
42049 |
|
42050 |
|
42051 |
|
42052 | {
|
42053 | var movedEvent = colEvent;
|
42054 | var srcColState = colEvent.columnApi.getColumnState();
|
42055 | var destColState = srcColState.map(function (s) { return ({ colId: s.colId }); });
|
42056 | this.columnModel.applyColumnState({ state: destColState, applyOrder: true }, "alignedGridChanged");
|
42057 | this.logger.log("onColumnEvent-> processing " + colEvent.type + " toIndex = " + movedEvent.toIndex);
|
42058 | }
|
42059 | break;
|
42060 | case Events.EVENT_COLUMN_VISIBLE:
|
42061 |
|
42062 |
|
42063 |
|
42064 | {
|
42065 | var visibleEvent = colEvent;
|
42066 | var srcColState = colEvent.columnApi.getColumnState();
|
42067 | var destColState = srcColState.map(function (s) { return ({ colId: s.colId, hide: s.hide }); });
|
42068 | this.columnModel.applyColumnState({ state: destColState }, "alignedGridChanged");
|
42069 | this.logger.log("onColumnEvent-> processing " + colEvent.type + " visible = " + visibleEvent.visible);
|
42070 | }
|
42071 | break;
|
42072 | case Events.EVENT_COLUMN_PINNED:
|
42073 | {
|
42074 | var pinnedEvent = colEvent;
|
42075 | var srcColState = colEvent.columnApi.getColumnState();
|
42076 | var destColState = srcColState.map(function (s) { return ({ colId: s.colId, pinned: s.pinned }); });
|
42077 | this.columnModel.applyColumnState({ state: destColState }, "alignedGridChanged");
|
42078 | this.logger.log("onColumnEvent-> processing " + colEvent.type + " pinned = " + pinnedEvent.pinned);
|
42079 | }
|
42080 | break;
|
42081 | case Events.EVENT_COLUMN_RESIZED:
|
42082 | var resizedEvent = colEvent;
|
42083 | var columnWidths_1 = {};
|
42084 | masterColumns.forEach(function (column) {
|
42085 | _this.logger.log("onColumnEvent-> processing " + colEvent.type + " actualWidth = " + column.getActualWidth());
|
42086 | columnWidths_1[column.getId()] = { key: column.getColId(), newWidth: column.getActualWidth() };
|
42087 | });
|
42088 |
|
42089 | (_a = resizedEvent.flexColumns) === null || _a === void 0 ? void 0 : _a.forEach(function (col) {
|
42090 | if (columnWidths_1[col.getId()]) {
|
42091 | delete columnWidths_1[col.getId()];
|
42092 | }
|
42093 | });
|
42094 | this.columnModel.setColumnWidths(Object.values(columnWidths_1), false, resizedEvent.finished, "alignedGridChanged");
|
42095 | break;
|
42096 | }
|
42097 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
42098 | var isVerticalScrollShowing = gridBodyCon.isVerticalScrollShowing();
|
42099 | var alignedGrids = this.gridOptionsService.get('alignedGrids');
|
42100 | if (alignedGrids) {
|
42101 | alignedGrids.forEach(function (grid) {
|
42102 | if (grid.api) {
|
42103 | grid.api.setAlwaysShowVerticalScroll(isVerticalScrollShowing);
|
42104 | }
|
42105 | });
|
42106 | }
|
42107 | };
|
42108 | __decorate$N([
|
42109 | Autowired('columnModel')
|
42110 | ], AlignedGridsService.prototype, "columnModel", void 0);
|
42111 | __decorate$N([
|
42112 | Autowired('ctrlsService')
|
42113 | ], AlignedGridsService.prototype, "ctrlsService", void 0);
|
42114 | __decorate$N([
|
42115 | __param$6(0, Qualifier('loggerFactory'))
|
42116 | ], AlignedGridsService.prototype, "setBeans", null);
|
42117 | __decorate$N([
|
42118 | PostConstruct
|
42119 | ], AlignedGridsService.prototype, "init", null);
|
42120 | AlignedGridsService = __decorate$N([
|
42121 | Bean('alignedGridsService')
|
42122 | ], AlignedGridsService);
|
42123 | return AlignedGridsService;
|
42124 | }(BeanStub));
|
42125 |
|
42126 |
|
42127 |
|
42128 |
|
42129 |
|
42130 |
|
42131 |
|
42132 | var __extends$K = (undefined && undefined.__extends) || (function () {
|
42133 | var extendStatics = function (d, b) {
|
42134 | extendStatics = Object.setPrototypeOf ||
|
42135 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
42136 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
42137 | return extendStatics(d, b);
|
42138 | };
|
42139 | return function (d, b) {
|
42140 | extendStatics(d, b);
|
42141 | function __() { this.constructor = d; }
|
42142 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
42143 | };
|
42144 | })();
|
42145 | var __assign$2 = (undefined && undefined.__assign) || function () {
|
42146 | __assign$2 = Object.assign || function(t) {
|
42147 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
42148 | s = arguments[i];
|
42149 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
42150 | t[p] = s[p];
|
42151 | }
|
42152 | return t;
|
42153 | };
|
42154 | return __assign$2.apply(this, arguments);
|
42155 | };
|
42156 | var __decorate$M = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
42157 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
42158 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
42159 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
42160 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
42161 | };
|
42162 | var __param$5 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
42163 | return function (target, key) { decorator(target, key, paramIndex); }
|
42164 | };
|
42165 | var __read$8 = (undefined && undefined.__read) || function (o, n) {
|
42166 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
42167 | if (!m) return o;
|
42168 | var i = m.call(o), r, ar = [], e;
|
42169 | try {
|
42170 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
42171 | }
|
42172 | catch (error) { e = { error: error }; }
|
42173 | finally {
|
42174 | try {
|
42175 | if (r && !r.done && (m = i["return"])) m.call(i);
|
42176 | }
|
42177 | finally { if (e) throw e.error; }
|
42178 | }
|
42179 | return ar;
|
42180 | };
|
42181 | var SelectionService = (function (_super) {
|
42182 | __extends$K(SelectionService, _super);
|
42183 | function SelectionService() {
|
42184 | return _super !== null && _super.apply(this, arguments) || this;
|
42185 | }
|
42186 | SelectionService.prototype.setBeans = function (loggerFactory) {
|
42187 | this.logger = loggerFactory.create('selectionService');
|
42188 | this.reset();
|
42189 | };
|
42190 | SelectionService.prototype.init = function () {
|
42191 | var _this = this;
|
42192 | this.groupSelectsChildren = this.gridOptionsService.is('groupSelectsChildren');
|
42193 | this.addManagedPropertyListener('groupSelectsChildren', function (propChange) { return _this.groupSelectsChildren = propChange.currentValue; });
|
42194 | this.rowSelection = this.gridOptionsService.get('rowSelection');
|
42195 | this.addManagedPropertyListener('rowSelection', function (propChange) { return _this.rowSelection = propChange.currentValue; });
|
42196 | this.addManagedListener(this.eventService, Events.EVENT_ROW_SELECTED, this.onRowSelected.bind(this));
|
42197 | };
|
42198 | SelectionService.prototype.isMultiselect = function () {
|
42199 | return this.rowSelection === 'multiple';
|
42200 | };
|
42201 | SelectionService.prototype.setNodeSelected = function (params) {
|
42202 | var _a;
|
42203 | var newValue = params.newValue, clearSelection = params.clearSelection, suppressFinishActions = params.suppressFinishActions, rangeSelect = params.rangeSelect; params.event; var node = params.node, _b = params.source, source = _b === void 0 ? 'api' : _b;
|
42204 |
|
42205 | var groupSelectsFiltered = this.groupSelectsChildren && (params.groupSelectsFiltered === true);
|
42206 | if (node.id === undefined) {
|
42207 | console.warn('AG Grid: cannot select node until id for node is known');
|
42208 | return 0;
|
42209 | }
|
42210 | if (node.rowPinned) {
|
42211 | console.warn('AG Grid: cannot select pinned rows');
|
42212 | return 0;
|
42213 | }
|
42214 |
|
42215 |
|
42216 | if (node.footer) {
|
42217 | return this.setNodeSelected(__assign$2(__assign$2({}, params), { node: node.sibling }));
|
42218 | }
|
42219 | var lastSelectedNode = this.getLastSelectedNode();
|
42220 | if (rangeSelect && lastSelectedNode) {
|
42221 | var newRowClicked = lastSelectedNode !== node;
|
42222 | if (newRowClicked && this.isMultiselect()) {
|
42223 | var nodesChanged = this.selectRange(node, lastSelectedNode, params.newValue, source);
|
42224 | this.setLastSelectedNode(node);
|
42225 | return nodesChanged;
|
42226 | }
|
42227 | }
|
42228 |
|
42229 |
|
42230 |
|
42231 |
|
42232 | var skipThisNode = groupSelectsFiltered && node.group;
|
42233 | var updatedCount = 0;
|
42234 | if (!skipThisNode) {
|
42235 | var thisNodeWasSelected = node.selectThisNode(newValue, params.event, source);
|
42236 | if (thisNodeWasSelected) {
|
42237 | updatedCount++;
|
42238 | }
|
42239 | }
|
42240 | if (this.groupSelectsChildren && ((_a = node.childrenAfterGroup) === null || _a === void 0 ? void 0 : _a.length)) {
|
42241 | updatedCount += this.selectChildren(node, newValue, groupSelectsFiltered, source);
|
42242 | }
|
42243 |
|
42244 | if (!suppressFinishActions) {
|
42245 | var clearOtherNodes = newValue && (clearSelection || !this.isMultiselect());
|
42246 | if (clearOtherNodes) {
|
42247 | updatedCount += this.clearOtherNodes(node, source);
|
42248 | }
|
42249 |
|
42250 | if (updatedCount > 0) {
|
42251 | this.updateGroupsFromChildrenSelections(source);
|
42252 |
|
42253 |
|
42254 | var event_1 = {
|
42255 | type: Events.EVENT_SELECTION_CHANGED,
|
42256 | source: source
|
42257 | };
|
42258 | this.eventService.dispatchEvent(event_1);
|
42259 | }
|
42260 |
|
42261 | if (newValue) {
|
42262 | this.setLastSelectedNode(node);
|
42263 | }
|
42264 | }
|
42265 | return updatedCount;
|
42266 | };
|
42267 |
|
42268 |
|
42269 |
|
42270 | SelectionService.prototype.selectRange = function (fromNode, toNode, value, source) {
|
42271 | var _this = this;
|
42272 | if (value === void 0) { value = true; }
|
42273 | var nodesToSelect = this.rowModel.getNodesInRangeForSelection(fromNode, toNode);
|
42274 | var updatedCount = 0;
|
42275 | nodesToSelect.forEach(function (rowNode) {
|
42276 | if (rowNode.group && _this.groupSelectsChildren || (value === false && fromNode === rowNode)) {
|
42277 | return;
|
42278 | }
|
42279 | var nodeWasSelected = rowNode.selectThisNode(value, undefined, source);
|
42280 | if (nodeWasSelected) {
|
42281 | updatedCount++;
|
42282 | }
|
42283 | });
|
42284 | this.updateGroupsFromChildrenSelections(source);
|
42285 | var event = {
|
42286 | type: Events.EVENT_SELECTION_CHANGED,
|
42287 | source: source
|
42288 | };
|
42289 | this.eventService.dispatchEvent(event);
|
42290 | return updatedCount;
|
42291 | };
|
42292 | SelectionService.prototype.selectChildren = function (node, newValue, groupSelectsFiltered, source) {
|
42293 | var children = groupSelectsFiltered ? node.childrenAfterAggFilter : node.childrenAfterGroup;
|
42294 | if (_.missing(children)) {
|
42295 | return 0;
|
42296 | }
|
42297 | var updatedCount = 0;
|
42298 | for (var i = 0; i < children.length; i++) {
|
42299 | updatedCount += children[i].setSelectedParams({
|
42300 | newValue: newValue,
|
42301 | clearSelection: false,
|
42302 | suppressFinishActions: true,
|
42303 | groupSelectsFiltered: groupSelectsFiltered,
|
42304 | source: source
|
42305 | });
|
42306 | }
|
42307 | return updatedCount;
|
42308 | };
|
42309 | SelectionService.prototype.setLastSelectedNode = function (rowNode) {
|
42310 | this.lastSelectedNode = rowNode;
|
42311 | };
|
42312 | SelectionService.prototype.getLastSelectedNode = function () {
|
42313 | return this.lastSelectedNode;
|
42314 | };
|
42315 | SelectionService.prototype.getSelectedNodes = function () {
|
42316 | var selectedNodes = [];
|
42317 | iterateObject(this.selectedNodes, function (key, rowNode) {
|
42318 | if (rowNode) {
|
42319 | selectedNodes.push(rowNode);
|
42320 | }
|
42321 | });
|
42322 | return selectedNodes;
|
42323 | };
|
42324 | SelectionService.prototype.getSelectedRows = function () {
|
42325 | var selectedRows = [];
|
42326 | iterateObject(this.selectedNodes, function (key, rowNode) {
|
42327 | if (rowNode && rowNode.data) {
|
42328 | selectedRows.push(rowNode.data);
|
42329 | }
|
42330 | });
|
42331 | return selectedRows;
|
42332 | };
|
42333 | SelectionService.prototype.getSelectionCount = function () {
|
42334 | return Object.values(this.selectedNodes).length;
|
42335 | };
|
42336 | |
42337 |
|
42338 |
|
42339 |
|
42340 | SelectionService.prototype.filterFromSelection = function (predicate) {
|
42341 | var newSelectedNodes = {};
|
42342 | Object.entries(this.selectedNodes).forEach(function (_a) {
|
42343 | var _b = __read$8(_a, 2), key = _b[0], node = _b[1];
|
42344 | var passesPredicate = node && predicate(node);
|
42345 | if (passesPredicate) {
|
42346 | newSelectedNodes[key] = node;
|
42347 | }
|
42348 | });
|
42349 | this.selectedNodes = newSelectedNodes;
|
42350 | };
|
42351 |
|
42352 | SelectionService.prototype.updateGroupsFromChildrenSelections = function (source, changedPath) {
|
42353 |
|
42354 | if (!this.groupSelectsChildren) {
|
42355 | return false;
|
42356 | }
|
42357 |
|
42358 | if (this.rowModel.getType() !== 'clientSide') {
|
42359 | return false;
|
42360 | }
|
42361 | var clientSideRowModel = this.rowModel;
|
42362 | var rootNode = clientSideRowModel.getRootNode();
|
42363 | if (!changedPath) {
|
42364 | changedPath = new ChangedPath(true, rootNode);
|
42365 | changedPath.setInactive();
|
42366 | }
|
42367 | var selectionChanged = false;
|
42368 | changedPath.forEachChangedNodeDepthFirst(function (rowNode) {
|
42369 | if (rowNode !== rootNode) {
|
42370 | var selected = rowNode.calculateSelectedFromChildren();
|
42371 | selectionChanged = rowNode.selectThisNode(selected === null ? false : selected, undefined, source) || selectionChanged;
|
42372 | }
|
42373 | });
|
42374 | return selectionChanged;
|
42375 | };
|
42376 | SelectionService.prototype.clearOtherNodes = function (rowNodeToKeepSelected, source) {
|
42377 | var _this = this;
|
42378 | var groupsToRefresh = {};
|
42379 | var updatedCount = 0;
|
42380 | iterateObject(this.selectedNodes, function (key, otherRowNode) {
|
42381 | if (otherRowNode && otherRowNode.id !== rowNodeToKeepSelected.id) {
|
42382 | var rowNode = _this.selectedNodes[otherRowNode.id];
|
42383 | updatedCount += rowNode.setSelectedParams({
|
42384 | newValue: false,
|
42385 | clearSelection: false,
|
42386 | suppressFinishActions: true,
|
42387 | source: source
|
42388 | });
|
42389 | if (_this.groupSelectsChildren && otherRowNode.parent) {
|
42390 | groupsToRefresh[otherRowNode.parent.id] = otherRowNode.parent;
|
42391 | }
|
42392 | }
|
42393 | });
|
42394 | iterateObject(groupsToRefresh, function (key, group) {
|
42395 | var selected = group.calculateSelectedFromChildren();
|
42396 | group.selectThisNode(selected === null ? false : selected, undefined, source);
|
42397 | });
|
42398 | return updatedCount;
|
42399 | };
|
42400 | SelectionService.prototype.onRowSelected = function (event) {
|
42401 | var rowNode = event.node;
|
42402 |
|
42403 | if (this.groupSelectsChildren && rowNode.group) {
|
42404 | return;
|
42405 | }
|
42406 | if (rowNode.isSelected()) {
|
42407 | this.selectedNodes[rowNode.id] = rowNode;
|
42408 | }
|
42409 | else {
|
42410 | this.selectedNodes[rowNode.id] = undefined;
|
42411 | }
|
42412 | };
|
42413 | SelectionService.prototype.syncInRowNode = function (rowNode, oldNode) {
|
42414 | this.syncInOldRowNode(rowNode, oldNode);
|
42415 | this.syncInNewRowNode(rowNode);
|
42416 | };
|
42417 |
|
42418 |
|
42419 |
|
42420 |
|
42421 |
|
42422 |
|
42423 |
|
42424 |
|
42425 |
|
42426 |
|
42427 |
|
42428 | SelectionService.prototype.syncInOldRowNode = function (rowNode, oldNode) {
|
42429 | var oldNodeHasDifferentId = exists(oldNode) && (rowNode.id !== oldNode.id);
|
42430 | if (oldNodeHasDifferentId && oldNode) {
|
42431 | var id = oldNode.id;
|
42432 | var oldNodeSelected = this.selectedNodes[id] == rowNode;
|
42433 | if (oldNodeSelected) {
|
42434 | this.selectedNodes[oldNode.id] = oldNode;
|
42435 | }
|
42436 | }
|
42437 | };
|
42438 | SelectionService.prototype.syncInNewRowNode = function (rowNode) {
|
42439 | if (exists(this.selectedNodes[rowNode.id])) {
|
42440 | rowNode.setSelectedInitialValue(true);
|
42441 | this.selectedNodes[rowNode.id] = rowNode;
|
42442 | }
|
42443 | else {
|
42444 | rowNode.setSelectedInitialValue(false);
|
42445 | }
|
42446 | };
|
42447 | SelectionService.prototype.reset = function () {
|
42448 | this.logger.log('reset');
|
42449 | this.selectedNodes = {};
|
42450 | this.lastSelectedNode = null;
|
42451 | };
|
42452 |
|
42453 |
|
42454 |
|
42455 |
|
42456 |
|
42457 | SelectionService.prototype.getBestCostNodeSelection = function () {
|
42458 | if (this.rowModel.getType() !== 'clientSide') {
|
42459 |
|
42460 | return;
|
42461 | }
|
42462 | var clientSideRowModel = this.rowModel;
|
42463 | var topLevelNodes = clientSideRowModel.getTopLevelNodes();
|
42464 | if (topLevelNodes === null) {
|
42465 | return;
|
42466 | }
|
42467 | var result = [];
|
42468 |
|
42469 | function traverse(nodes) {
|
42470 | for (var i = 0, l = nodes.length; i < l; i++) {
|
42471 | var node = nodes[i];
|
42472 | if (node.isSelected()) {
|
42473 | result.push(node);
|
42474 | }
|
42475 | else {
|
42476 |
|
42477 |
|
42478 | var maybeGroup = node;
|
42479 | if (maybeGroup.group && maybeGroup.children) {
|
42480 | traverse(maybeGroup.children);
|
42481 | }
|
42482 | }
|
42483 | }
|
42484 | }
|
42485 | traverse(topLevelNodes);
|
42486 | return result;
|
42487 | };
|
42488 | SelectionService.prototype.isEmpty = function () {
|
42489 | var count = 0;
|
42490 | iterateObject(this.selectedNodes, function (nodeId, rowNode) {
|
42491 | if (rowNode) {
|
42492 | count++;
|
42493 | }
|
42494 | });
|
42495 | return count === 0;
|
42496 | };
|
42497 | SelectionService.prototype.deselectAllRowNodes = function (params) {
|
42498 | var callback = function (rowNode) { return rowNode.selectThisNode(false, undefined, source); };
|
42499 | var rowModelClientSide = this.rowModel.getType() === 'clientSide';
|
42500 | var source = params.source, justFiltered = params.justFiltered, justCurrentPage = params.justCurrentPage;
|
42501 | if (justCurrentPage || justFiltered) {
|
42502 | if (!rowModelClientSide) {
|
42503 | console.error("AG Grid: selecting just filtered only works when gridOptions.rowModelType='clientSide'");
|
42504 | return;
|
42505 | }
|
42506 | this.getNodesToSelect(justFiltered, justCurrentPage).forEach(callback);
|
42507 | }
|
42508 | else {
|
42509 | iterateObject(this.selectedNodes, function (id, rowNode) {
|
42510 |
|
42511 | if (rowNode) {
|
42512 | callback(rowNode);
|
42513 | }
|
42514 | });
|
42515 |
|
42516 | this.reset();
|
42517 | }
|
42518 |
|
42519 | if (rowModelClientSide && this.groupSelectsChildren) {
|
42520 | this.updateGroupsFromChildrenSelections(source);
|
42521 | }
|
42522 | var event = {
|
42523 | type: Events.EVENT_SELECTION_CHANGED,
|
42524 | source: source
|
42525 | };
|
42526 | this.eventService.dispatchEvent(event);
|
42527 | };
|
42528 | SelectionService.prototype.getSelectAllState = function (justFiltered, justCurrentPage) {
|
42529 | var _this = this;
|
42530 | var selectedCount = 0;
|
42531 | var notSelectedCount = 0;
|
42532 | var callback = function (node) {
|
42533 | if (_this.groupSelectsChildren && node.group) {
|
42534 | return;
|
42535 | }
|
42536 | if (node.isSelected()) {
|
42537 | selectedCount++;
|
42538 | }
|
42539 | else if (!node.selectable) ;
|
42540 | else {
|
42541 | notSelectedCount++;
|
42542 | }
|
42543 | };
|
42544 | this.getNodesToSelect(justFiltered, justCurrentPage).forEach(callback);
|
42545 |
|
42546 | if (selectedCount === 0 && notSelectedCount === 0) {
|
42547 | return false;
|
42548 | }
|
42549 |
|
42550 | if (selectedCount > 0 && notSelectedCount > 0) {
|
42551 | return null;
|
42552 | }
|
42553 |
|
42554 | return selectedCount > 0;
|
42555 | };
|
42556 | |
42557 |
|
42558 |
|
42559 |
|
42560 |
|
42561 | SelectionService.prototype.getNodesToSelect = function (justFiltered, justCurrentPage) {
|
42562 | var _this = this;
|
42563 | if (justFiltered === void 0) { justFiltered = false; }
|
42564 | if (justCurrentPage === void 0) { justCurrentPage = false; }
|
42565 | if (this.rowModel.getType() !== 'clientSide') {
|
42566 | throw new Error("selectAll only available when rowModelType='clientSide', ie not " + this.rowModel.getType());
|
42567 | }
|
42568 | var nodes = [];
|
42569 | if (justCurrentPage) {
|
42570 | this.paginationProxy.forEachNodeOnPage(function (node) {
|
42571 | if (!node.group) {
|
42572 | nodes.push(node);
|
42573 | return;
|
42574 | }
|
42575 | if (!node.expanded) {
|
42576 |
|
42577 |
|
42578 | var recursivelyAddChildren_1 = function (child) {
|
42579 | var _a;
|
42580 | nodes.push(child);
|
42581 | if ((_a = child.childrenAfterFilter) === null || _a === void 0 ? void 0 : _a.length) {
|
42582 | child.childrenAfterFilter.forEach(recursivelyAddChildren_1);
|
42583 | }
|
42584 | };
|
42585 | recursivelyAddChildren_1(node);
|
42586 | return;
|
42587 | }
|
42588 |
|
42589 | if (!_this.groupSelectsChildren) {
|
42590 | nodes.push(node);
|
42591 | }
|
42592 | });
|
42593 | return nodes;
|
42594 | }
|
42595 | var clientSideRowModel = this.rowModel;
|
42596 | if (justFiltered) {
|
42597 | clientSideRowModel.forEachNodeAfterFilter(function (node) {
|
42598 | nodes.push(node);
|
42599 | });
|
42600 | return nodes;
|
42601 | }
|
42602 | clientSideRowModel.forEachNode(function (node) {
|
42603 | nodes.push(node);
|
42604 | });
|
42605 | return nodes;
|
42606 | };
|
42607 | SelectionService.prototype.selectAllRowNodes = function (params) {
|
42608 | if (this.rowModel.getType() !== 'clientSide') {
|
42609 | throw new Error("selectAll only available when rowModelType='clientSide', ie not " + this.rowModel.getType());
|
42610 | }
|
42611 | var source = params.source, justFiltered = params.justFiltered, justCurrentPage = params.justCurrentPage;
|
42612 | var callback = function (rowNode) { return rowNode.selectThisNode(true, undefined, source); };
|
42613 | this.getNodesToSelect(justFiltered, justCurrentPage).forEach(callback);
|
42614 |
|
42615 | if (this.rowModel.getType() === 'clientSide' && this.groupSelectsChildren) {
|
42616 | this.updateGroupsFromChildrenSelections(source);
|
42617 | }
|
42618 | var event = {
|
42619 | type: Events.EVENT_SELECTION_CHANGED,
|
42620 | source: source
|
42621 | };
|
42622 | this.eventService.dispatchEvent(event);
|
42623 | };
|
42624 |
|
42625 | SelectionService.prototype.getServerSideSelectionState = function () {
|
42626 | return null;
|
42627 | };
|
42628 | SelectionService.prototype.setServerSideSelectionState = function (state) { };
|
42629 | __decorate$M([
|
42630 | Autowired('rowModel')
|
42631 | ], SelectionService.prototype, "rowModel", void 0);
|
42632 | __decorate$M([
|
42633 | Autowired('paginationProxy')
|
42634 | ], SelectionService.prototype, "paginationProxy", void 0);
|
42635 | __decorate$M([
|
42636 | __param$5(0, Qualifier('loggerFactory'))
|
42637 | ], SelectionService.prototype, "setBeans", null);
|
42638 | __decorate$M([
|
42639 | PostConstruct
|
42640 | ], SelectionService.prototype, "init", null);
|
42641 | SelectionService = __decorate$M([
|
42642 | Bean('selectionService')
|
42643 | ], SelectionService);
|
42644 | return SelectionService;
|
42645 | }(BeanStub));
|
42646 |
|
42647 |
|
42648 |
|
42649 |
|
42650 |
|
42651 |
|
42652 |
|
42653 | var __decorate$L = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
42654 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
42655 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
42656 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
42657 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
42658 | };
|
42659 | var ColumnApi = (function () {
|
42660 | function ColumnApi() {
|
42661 | }
|
42662 |
|
42663 | ColumnApi.prototype.sizeColumnsToFit = function (gridWidth) {
|
42664 |
|
42665 |
|
42666 | if (typeof gridWidth === "undefined") {
|
42667 | console.error('AG Grid: missing parameter to columnApi.sizeColumnsToFit(gridWidth)');
|
42668 | }
|
42669 | this.columnModel.sizeColumnsToFit(gridWidth, 'api');
|
42670 | };
|
42671 |
|
42672 | ColumnApi.prototype.setColumnGroupOpened = function (group, newValue) { this.columnModel.setColumnGroupOpened(group, newValue, 'api'); };
|
42673 |
|
42674 | ColumnApi.prototype.getColumnGroup = function (name, instanceId) { return this.columnModel.getColumnGroup(name, instanceId); };
|
42675 |
|
42676 | ColumnApi.prototype.getProvidedColumnGroup = function (name) { return this.columnModel.getProvidedColumnGroup(name); };
|
42677 |
|
42678 | ColumnApi.prototype.getDisplayNameForColumn = function (column, location) { return this.columnModel.getDisplayNameForColumn(column, location) || ''; };
|
42679 |
|
42680 | ColumnApi.prototype.getDisplayNameForColumnGroup = function (columnGroup, location) { return this.columnModel.getDisplayNameForColumnGroup(columnGroup, location) || ''; };
|
42681 |
|
42682 | ColumnApi.prototype.getColumn = function (key) { return this.columnModel.getPrimaryColumn(key); };
|
42683 |
|
42684 | ColumnApi.prototype.getColumns = function () { return this.columnModel.getAllPrimaryColumns(); };
|
42685 |
|
42686 | ColumnApi.prototype.applyColumnState = function (params) { return this.columnModel.applyColumnState(params, 'api'); };
|
42687 |
|
42688 | ColumnApi.prototype.getColumnState = function () { return this.columnModel.getColumnState(); };
|
42689 |
|
42690 | ColumnApi.prototype.resetColumnState = function () { this.columnModel.resetColumnState('api'); };
|
42691 |
|
42692 | ColumnApi.prototype.getColumnGroupState = function () { return this.columnModel.getColumnGroupState(); };
|
42693 |
|
42694 | ColumnApi.prototype.setColumnGroupState = function (stateItems) { this.columnModel.setColumnGroupState(stateItems, 'api'); };
|
42695 |
|
42696 | ColumnApi.prototype.resetColumnGroupState = function () { this.columnModel.resetColumnGroupState('api'); };
|
42697 |
|
42698 | ColumnApi.prototype.isPinning = function () { return this.columnModel.isPinningLeft() || this.columnModel.isPinningRight(); };
|
42699 |
|
42700 | ColumnApi.prototype.isPinningLeft = function () { return this.columnModel.isPinningLeft(); };
|
42701 |
|
42702 | ColumnApi.prototype.isPinningRight = function () { return this.columnModel.isPinningRight(); };
|
42703 |
|
42704 | ColumnApi.prototype.getDisplayedColAfter = function (col) { return this.columnModel.getDisplayedColAfter(col); };
|
42705 |
|
42706 | ColumnApi.prototype.getDisplayedColBefore = function (col) { return this.columnModel.getDisplayedColBefore(col); };
|
42707 |
|
42708 | ColumnApi.prototype.setColumnVisible = function (key, visible) { this.columnModel.setColumnVisible(key, visible, 'api'); };
|
42709 |
|
42710 | ColumnApi.prototype.setColumnsVisible = function (keys, visible) { this.columnModel.setColumnsVisible(keys, visible, 'api'); };
|
42711 |
|
42712 | ColumnApi.prototype.setColumnPinned = function (key, pinned) { this.columnModel.setColumnPinned(key, pinned, 'api'); };
|
42713 |
|
42714 | ColumnApi.prototype.setColumnsPinned = function (keys, pinned) { this.columnModel.setColumnsPinned(keys, pinned, 'api'); };
|
42715 | |
42716 |
|
42717 |
|
42718 |
|
42719 |
|
42720 |
|
42721 |
|
42722 | ColumnApi.prototype.getAllGridColumns = function () { return this.columnModel.getAllGridColumns(); };
|
42723 |
|
42724 | ColumnApi.prototype.getDisplayedLeftColumns = function () { return this.columnModel.getDisplayedLeftColumns(); };
|
42725 |
|
42726 | ColumnApi.prototype.getDisplayedCenterColumns = function () { return this.columnModel.getDisplayedCenterColumns(); };
|
42727 |
|
42728 | ColumnApi.prototype.getDisplayedRightColumns = function () { return this.columnModel.getDisplayedRightColumns(); };
|
42729 |
|
42730 | ColumnApi.prototype.getAllDisplayedColumns = function () { return this.columnModel.getAllDisplayedColumns(); };
|
42731 |
|
42732 | ColumnApi.prototype.getAllDisplayedVirtualColumns = function () { return this.columnModel.getViewportColumns(); };
|
42733 |
|
42734 | ColumnApi.prototype.moveColumn = function (key, toIndex) {
|
42735 | this.columnModel.moveColumn(key, toIndex, 'api');
|
42736 | };
|
42737 |
|
42738 | ColumnApi.prototype.moveColumnByIndex = function (fromIndex, toIndex) { this.columnModel.moveColumnByIndex(fromIndex, toIndex, 'api'); };
|
42739 |
|
42740 | ColumnApi.prototype.moveColumns = function (columnsToMoveKeys, toIndex) { this.columnModel.moveColumns(columnsToMoveKeys, toIndex, 'api'); };
|
42741 |
|
42742 | ColumnApi.prototype.moveRowGroupColumn = function (fromIndex, toIndex) { this.columnModel.moveRowGroupColumn(fromIndex, toIndex); };
|
42743 |
|
42744 | ColumnApi.prototype.setColumnAggFunc = function (key, aggFunc) { this.columnModel.setColumnAggFunc(key, aggFunc); };
|
42745 |
|
42746 | ColumnApi.prototype.setColumnWidth = function (key, newWidth, finished, source) {
|
42747 | if (finished === void 0) { finished = true; }
|
42748 | this.columnModel.setColumnWidths([{ key: key, newWidth: newWidth }], false, finished, source);
|
42749 | };
|
42750 |
|
42751 | ColumnApi.prototype.setColumnWidths = function (columnWidths, finished, source) {
|
42752 | if (finished === void 0) { finished = true; }
|
42753 | this.columnModel.setColumnWidths(columnWidths, false, finished, source);
|
42754 | };
|
42755 |
|
42756 | ColumnApi.prototype.setPivotMode = function (pivotMode) { this.columnModel.setPivotMode(pivotMode); };
|
42757 |
|
42758 | ColumnApi.prototype.isPivotMode = function () { return this.columnModel.isPivotMode(); };
|
42759 |
|
42760 | ColumnApi.prototype.getPivotResultColumn = function (pivotKeys, valueColKey) { return this.columnModel.getSecondaryPivotColumn(pivotKeys, valueColKey); };
|
42761 |
|
42762 | ColumnApi.prototype.setValueColumns = function (colKeys) { this.columnModel.setValueColumns(colKeys, 'api'); };
|
42763 |
|
42764 | ColumnApi.prototype.getValueColumns = function () { return this.columnModel.getValueColumns(); };
|
42765 |
|
42766 | ColumnApi.prototype.removeValueColumn = function (colKey) { this.columnModel.removeValueColumn(colKey, 'api'); };
|
42767 |
|
42768 | ColumnApi.prototype.removeValueColumns = function (colKeys) { this.columnModel.removeValueColumns(colKeys, 'api'); };
|
42769 |
|
42770 | ColumnApi.prototype.addValueColumn = function (colKey) { this.columnModel.addValueColumn(colKey, 'api'); };
|
42771 |
|
42772 | ColumnApi.prototype.addValueColumns = function (colKeys) { this.columnModel.addValueColumns(colKeys, 'api'); };
|
42773 |
|
42774 | ColumnApi.prototype.setRowGroupColumns = function (colKeys) { this.columnModel.setRowGroupColumns(colKeys, 'api'); };
|
42775 |
|
42776 | ColumnApi.prototype.removeRowGroupColumn = function (colKey) { this.columnModel.removeRowGroupColumn(colKey, 'api'); };
|
42777 |
|
42778 | ColumnApi.prototype.removeRowGroupColumns = function (colKeys) { this.columnModel.removeRowGroupColumns(colKeys, 'api'); };
|
42779 |
|
42780 | ColumnApi.prototype.addRowGroupColumn = function (colKey) { this.columnModel.addRowGroupColumn(colKey, 'api'); };
|
42781 |
|
42782 | ColumnApi.prototype.addRowGroupColumns = function (colKeys) { this.columnModel.addRowGroupColumns(colKeys, 'api'); };
|
42783 |
|
42784 | ColumnApi.prototype.getRowGroupColumns = function () { return this.columnModel.getRowGroupColumns(); };
|
42785 |
|
42786 | ColumnApi.prototype.setPivotColumns = function (colKeys) { this.columnModel.setPivotColumns(colKeys, 'api'); };
|
42787 |
|
42788 | ColumnApi.prototype.removePivotColumn = function (colKey) { this.columnModel.removePivotColumn(colKey, 'api'); };
|
42789 |
|
42790 | ColumnApi.prototype.removePivotColumns = function (colKeys) { this.columnModel.removePivotColumns(colKeys, 'api'); };
|
42791 |
|
42792 | ColumnApi.prototype.addPivotColumn = function (colKey) { this.columnModel.addPivotColumn(colKey, 'api'); };
|
42793 |
|
42794 | ColumnApi.prototype.addPivotColumns = function (colKeys) { this.columnModel.addPivotColumns(colKeys, 'api'); };
|
42795 |
|
42796 | ColumnApi.prototype.getPivotColumns = function () { return this.columnModel.getPivotColumns(); };
|
42797 |
|
42798 | ColumnApi.prototype.getLeftDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeLeft(); };
|
42799 |
|
42800 | ColumnApi.prototype.getCenterDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeCentre(); };
|
42801 |
|
42802 | ColumnApi.prototype.getRightDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeRight(); };
|
42803 |
|
42804 | ColumnApi.prototype.getAllDisplayedColumnGroups = function () { return this.columnModel.getAllDisplayedTrees(); };
|
42805 |
|
42806 | ColumnApi.prototype.autoSizeColumn = function (key, skipHeader) { return this.columnModel.autoSizeColumn(key, skipHeader, 'api'); };
|
42807 |
|
42808 | ColumnApi.prototype.autoSizeColumns = function (keys, skipHeader) {
|
42809 | this.columnModel.autoSizeColumns({ columns: keys, skipHeader: skipHeader });
|
42810 | };
|
42811 |
|
42812 | ColumnApi.prototype.autoSizeAllColumns = function (skipHeader) { this.columnModel.autoSizeAllColumns(skipHeader, 'api'); };
|
42813 |
|
42814 | ColumnApi.prototype.setPivotResultColumns = function (colDefs) { this.columnModel.setSecondaryColumns(colDefs, 'api'); };
|
42815 |
|
42816 | ColumnApi.prototype.getPivotResultColumns = function () { return this.columnModel.getSecondaryColumns(); };
|
42817 | ColumnApi.prototype.cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid = function () {
|
42818 |
|
42819 |
|
42820 |
|
42821 |
|
42822 |
|
42823 |
|
42824 | setTimeout(_.removeAllReferences.bind(window, this, 'Column API'), 100);
|
42825 | };
|
42826 |
|
42827 | ColumnApi.prototype.getAllColumns = function () {
|
42828 | logDeprecation('28.0', 'getAllColumns', 'getColumns');
|
42829 | return this.getColumns();
|
42830 | };
|
42831 |
|
42832 | ColumnApi.prototype.getOriginalColumnGroup = function (name) {
|
42833 | logDeprecation('27.0', 'getOriginalColumnGroup', 'getProvidedColumnGroup');
|
42834 | return this.columnModel.getProvidedColumnGroup(name);
|
42835 | };
|
42836 |
|
42837 | ColumnApi.prototype.getPrimaryColumns = function () {
|
42838 | logDeprecation('28.0', 'getPrimaryColumns', 'getColumns');
|
42839 | return this.getColumns();
|
42840 | };
|
42841 |
|
42842 | ColumnApi.prototype.getSecondaryColumns = function () {
|
42843 | logDeprecation('28.0', 'getSecondaryColumns', 'getPivotResultColumns');
|
42844 | return this.getPivotResultColumns();
|
42845 | };
|
42846 |
|
42847 | ColumnApi.prototype.setSecondaryColumns = function (colDefs) {
|
42848 | logDeprecation('28.0', 'setSecondaryColumns', 'setPivotResultColumns');
|
42849 | this.setPivotResultColumns(colDefs);
|
42850 | };
|
42851 |
|
42852 | ColumnApi.prototype.getSecondaryPivotColumn = function (pivotKeys, valueColKey) {
|
42853 | logDeprecation('28.0', 'getSecondaryPivotColumn', 'getPivotResultColumn');
|
42854 | return this.getPivotResultColumn(pivotKeys, valueColKey);
|
42855 | };
|
42856 | __decorate$L([
|
42857 | Autowired('columnModel')
|
42858 | ], ColumnApi.prototype, "columnModel", void 0);
|
42859 | __decorate$L([
|
42860 | PreDestroy
|
42861 | ], ColumnApi.prototype, "cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid", null);
|
42862 | ColumnApi = __decorate$L([
|
42863 | Bean('columnApi')
|
42864 | ], ColumnApi);
|
42865 | return ColumnApi;
|
42866 | }());
|
42867 |
|
42868 |
|
42869 |
|
42870 |
|
42871 |
|
42872 |
|
42873 |
|
42874 | var __extends$J = (undefined && undefined.__extends) || (function () {
|
42875 | var extendStatics = function (d, b) {
|
42876 | extendStatics = Object.setPrototypeOf ||
|
42877 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
42878 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
42879 | return extendStatics(d, b);
|
42880 | };
|
42881 | return function (d, b) {
|
42882 | extendStatics(d, b);
|
42883 | function __() { this.constructor = d; }
|
42884 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
42885 | };
|
42886 | })();
|
42887 | var __decorate$K = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
42888 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
42889 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
42890 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
42891 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
42892 | };
|
42893 | var ValueService = (function (_super) {
|
42894 | __extends$J(ValueService, _super);
|
42895 | function ValueService() {
|
42896 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
42897 | _this.initialised = false;
|
42898 | return _this;
|
42899 | }
|
42900 | ValueService.prototype.init = function () {
|
42901 | var _this = this;
|
42902 | this.cellExpressions = this.gridOptionsService.is('enableCellExpressions');
|
42903 | this.isTreeData = this.gridOptionsService.is('treeData');
|
42904 | this.initialised = true;
|
42905 |
|
42906 |
|
42907 | this.eventService.addEventListener(Events.EVENT_CELL_VALUE_CHANGED, function (event) { return _this.callColumnCellValueChangedHandler(event); }, this.gridOptionsService.useAsyncEvents());
|
42908 | this.addManagedPropertyListener('treeData', function (propChange) { return _this.isTreeData = propChange.currentValue; });
|
42909 | };
|
42910 | ValueService.prototype.getValue = function (column, rowNode, forFilter, ignoreAggData) {
|
42911 | if (forFilter === void 0) { forFilter = false; }
|
42912 | if (ignoreAggData === void 0) { ignoreAggData = false; }
|
42913 |
|
42914 |
|
42915 | if (!this.initialised) {
|
42916 | this.init();
|
42917 | }
|
42918 | if (!rowNode) {
|
42919 | return;
|
42920 | }
|
42921 |
|
42922 | var colDef = column.getColDef();
|
42923 | var field = colDef.field;
|
42924 | var colId = column.getColId();
|
42925 | var data = rowNode.data;
|
42926 | var result;
|
42927 |
|
42928 | var groupDataExists = rowNode.groupData && rowNode.groupData[colId] !== undefined;
|
42929 | var aggDataExists = !ignoreAggData && rowNode.aggData && rowNode.aggData[colId] !== undefined;
|
42930 | if (forFilter && colDef.filterValueGetter) {
|
42931 | result = this.executeFilterValueGetter(colDef.filterValueGetter, data, column, rowNode);
|
42932 | }
|
42933 | else if (this.isTreeData && aggDataExists) {
|
42934 | result = rowNode.aggData[colId];
|
42935 | }
|
42936 | else if (this.isTreeData && colDef.valueGetter) {
|
42937 | result = this.executeValueGetter(colDef.valueGetter, data, column, rowNode);
|
42938 | }
|
42939 | else if (this.isTreeData && (field && data)) {
|
42940 | result = getValueUsingField(data, field, column.isFieldContainsDots());
|
42941 | }
|
42942 | else if (groupDataExists) {
|
42943 | result = rowNode.groupData[colId];
|
42944 | }
|
42945 | else if (aggDataExists) {
|
42946 | result = rowNode.aggData[colId];
|
42947 | }
|
42948 | else if (colDef.valueGetter) {
|
42949 | result = this.executeValueGetter(colDef.valueGetter, data, column, rowNode);
|
42950 | }
|
42951 | else if (field && data) {
|
42952 | result = getValueUsingField(data, field, column.isFieldContainsDots());
|
42953 | }
|
42954 |
|
42955 | if (this.cellExpressions && (typeof result === 'string') && result.indexOf('=') === 0) {
|
42956 | var cellValueGetter = result.substring(1);
|
42957 | result = this.executeValueGetter(cellValueGetter, data, column, rowNode);
|
42958 | }
|
42959 | if (result == null) {
|
42960 | var openedGroup = this.getOpenedGroup(rowNode, column);
|
42961 | if (openedGroup != null) {
|
42962 | return openedGroup;
|
42963 | }
|
42964 | }
|
42965 | return result;
|
42966 | };
|
42967 | ValueService.prototype.getOpenedGroup = function (rowNode, column) {
|
42968 | if (!this.gridOptionsService.is('showOpenedGroup')) {
|
42969 | return;
|
42970 | }
|
42971 | var colDef = column.getColDef();
|
42972 | if (!colDef.showRowGroup) {
|
42973 | return;
|
42974 | }
|
42975 | var showRowGroup = column.getColDef().showRowGroup;
|
42976 | var pointer = rowNode.parent;
|
42977 | while (pointer != null) {
|
42978 | if (pointer.rowGroupColumn && (showRowGroup === true || showRowGroup === pointer.rowGroupColumn.getColId())) {
|
42979 | return pointer.key;
|
42980 | }
|
42981 | pointer = pointer.parent;
|
42982 | }
|
42983 | return undefined;
|
42984 | };
|
42985 | |
42986 |
|
42987 |
|
42988 |
|
42989 |
|
42990 |
|
42991 |
|
42992 |
|
42993 | ValueService.prototype.setValue = function (rowNode, colKey, newValue, eventSource) {
|
42994 | var column = this.columnModel.getPrimaryColumn(colKey);
|
42995 | if (!rowNode || !column) {
|
42996 | return false;
|
42997 | }
|
42998 |
|
42999 |
|
43000 | if (missing(rowNode.data)) {
|
43001 | rowNode.data = {};
|
43002 | }
|
43003 | var _a = column.getColDef(), field = _a.field, valueSetter = _a.valueSetter;
|
43004 | if (missing(field) && missing(valueSetter)) {
|
43005 | console.warn("AG Grid: you need either field or valueSetter set on colDef for editing to work");
|
43006 | return false;
|
43007 | }
|
43008 | var params = {
|
43009 | node: rowNode,
|
43010 | data: rowNode.data,
|
43011 | oldValue: this.getValue(column, rowNode),
|
43012 | newValue: newValue,
|
43013 | colDef: column.getColDef(),
|
43014 | column: column,
|
43015 | api: this.gridOptionsService.api,
|
43016 | columnApi: this.gridOptionsService.columnApi,
|
43017 | context: this.gridOptionsService.context
|
43018 | };
|
43019 | params.newValue = newValue;
|
43020 | var valueWasDifferent;
|
43021 | if (exists(valueSetter)) {
|
43022 | if (typeof valueSetter === 'function') {
|
43023 | valueWasDifferent = valueSetter(params);
|
43024 | }
|
43025 | else {
|
43026 | valueWasDifferent = this.expressionService.evaluate(valueSetter, params);
|
43027 | }
|
43028 | }
|
43029 | else {
|
43030 | valueWasDifferent = this.setValueUsingField(rowNode.data, field, newValue, column.isFieldContainsDots());
|
43031 | }
|
43032 |
|
43033 |
|
43034 | if (valueWasDifferent === undefined) {
|
43035 | valueWasDifferent = true;
|
43036 | }
|
43037 |
|
43038 |
|
43039 |
|
43040 | if (!valueWasDifferent) {
|
43041 | return false;
|
43042 | }
|
43043 |
|
43044 | rowNode.resetQuickFilterAggregateText();
|
43045 | this.valueCache.onDataChanged();
|
43046 | params.newValue = this.getValue(column, rowNode);
|
43047 | var event = {
|
43048 | type: Events.EVENT_CELL_VALUE_CHANGED,
|
43049 | event: null,
|
43050 | rowIndex: rowNode.rowIndex,
|
43051 | rowPinned: rowNode.rowPinned,
|
43052 | column: params.column,
|
43053 | api: params.api,
|
43054 | columnApi: params.columnApi,
|
43055 | colDef: params.colDef,
|
43056 | context: params.context,
|
43057 | data: rowNode.data,
|
43058 | node: rowNode,
|
43059 | oldValue: params.oldValue,
|
43060 | newValue: params.newValue,
|
43061 | value: params.newValue,
|
43062 | source: eventSource
|
43063 | };
|
43064 | this.eventService.dispatchEvent(event);
|
43065 | return true;
|
43066 | };
|
43067 | ValueService.prototype.callColumnCellValueChangedHandler = function (event) {
|
43068 | var onCellValueChanged = event.colDef.onCellValueChanged;
|
43069 | if (typeof onCellValueChanged === 'function') {
|
43070 | onCellValueChanged({
|
43071 | node: event.node,
|
43072 | data: event.data,
|
43073 | oldValue: event.oldValue,
|
43074 | newValue: event.newValue,
|
43075 | colDef: event.colDef,
|
43076 | column: event.column,
|
43077 | api: event.api,
|
43078 | columnApi: event.columnApi,
|
43079 | context: event.context
|
43080 | });
|
43081 | }
|
43082 | };
|
43083 | ValueService.prototype.setValueUsingField = function (data, field, newValue, isFieldContainsDots) {
|
43084 | if (!field) {
|
43085 | return false;
|
43086 | }
|
43087 |
|
43088 | var valuesAreSame = false;
|
43089 | if (!isFieldContainsDots) {
|
43090 |
|
43091 | valuesAreSame = data[field] == newValue;
|
43092 | if (!valuesAreSame) {
|
43093 | data[field] = newValue;
|
43094 | }
|
43095 | }
|
43096 | else {
|
43097 |
|
43098 | var fieldPieces = field.split('.');
|
43099 | var currentObject = data;
|
43100 | while (fieldPieces.length > 0 && currentObject) {
|
43101 | var fieldPiece = fieldPieces.shift();
|
43102 | if (fieldPieces.length === 0) {
|
43103 |
|
43104 | valuesAreSame = currentObject[fieldPiece] == newValue;
|
43105 | if (!valuesAreSame) {
|
43106 | currentObject[fieldPiece] = newValue;
|
43107 | }
|
43108 | }
|
43109 | else {
|
43110 | currentObject = currentObject[fieldPiece];
|
43111 | }
|
43112 | }
|
43113 | }
|
43114 | return !valuesAreSame;
|
43115 | };
|
43116 | ValueService.prototype.executeFilterValueGetter = function (valueGetter, data, column, rowNode) {
|
43117 | var params = {
|
43118 | data: data,
|
43119 | node: rowNode,
|
43120 | column: column,
|
43121 | colDef: column.getColDef(),
|
43122 | api: this.gridOptionsService.api,
|
43123 | columnApi: this.gridOptionsService.columnApi,
|
43124 | context: this.gridOptionsService.context,
|
43125 | getValue: this.getValueCallback.bind(this, rowNode)
|
43126 | };
|
43127 | if (typeof valueGetter === 'function') {
|
43128 | return valueGetter(params);
|
43129 | }
|
43130 | return this.expressionService.evaluate(valueGetter, params);
|
43131 | };
|
43132 | ValueService.prototype.executeValueGetter = function (valueGetter, data, column, rowNode) {
|
43133 | var colId = column.getColId();
|
43134 |
|
43135 | var valueFromCache = this.valueCache.getValue(rowNode, colId);
|
43136 | if (valueFromCache !== undefined) {
|
43137 | return valueFromCache;
|
43138 | }
|
43139 | var params = {
|
43140 | data: data,
|
43141 | node: rowNode,
|
43142 | column: column,
|
43143 | colDef: column.getColDef(),
|
43144 | api: this.gridOptionsService.api,
|
43145 | columnApi: this.gridOptionsService.columnApi,
|
43146 | context: this.gridOptionsService.context,
|
43147 | getValue: this.getValueCallback.bind(this, rowNode)
|
43148 | };
|
43149 | var result;
|
43150 | if (typeof valueGetter === 'function') {
|
43151 | result = valueGetter(params);
|
43152 | }
|
43153 | else {
|
43154 | result = this.expressionService.evaluate(valueGetter, params);
|
43155 | }
|
43156 |
|
43157 | this.valueCache.setValue(rowNode, colId, result);
|
43158 | return result;
|
43159 | };
|
43160 | ValueService.prototype.getValueCallback = function (node, field) {
|
43161 | var otherColumn = this.columnModel.getPrimaryColumn(field);
|
43162 | if (otherColumn) {
|
43163 | return this.getValue(otherColumn, node);
|
43164 | }
|
43165 | return null;
|
43166 | };
|
43167 |
|
43168 | ValueService.prototype.getKeyForNode = function (col, rowNode) {
|
43169 | var value = this.getValue(col, rowNode);
|
43170 | var keyCreator = col.getColDef().keyCreator;
|
43171 | var result = value;
|
43172 | if (keyCreator) {
|
43173 | var keyParams = {
|
43174 | value: value,
|
43175 | colDef: col.getColDef(),
|
43176 | column: col,
|
43177 | node: rowNode,
|
43178 | data: rowNode.data,
|
43179 | api: this.gridOptionsService.api,
|
43180 | columnApi: this.gridOptionsService.columnApi,
|
43181 | context: this.gridOptionsService.context
|
43182 | };
|
43183 | result = keyCreator(keyParams);
|
43184 | }
|
43185 |
|
43186 | if (typeof result === 'string' || result == null) {
|
43187 | return result;
|
43188 | }
|
43189 | result = String(result);
|
43190 | if (result === '[object Object]') {
|
43191 | doOnce(function () {
|
43192 | 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');
|
43193 | }, 'getKeyForNode - warn about [object,object]');
|
43194 | }
|
43195 | return result;
|
43196 | };
|
43197 | __decorate$K([
|
43198 | Autowired('expressionService')
|
43199 | ], ValueService.prototype, "expressionService", void 0);
|
43200 | __decorate$K([
|
43201 | Autowired('columnModel')
|
43202 | ], ValueService.prototype, "columnModel", void 0);
|
43203 | __decorate$K([
|
43204 | Autowired('valueCache')
|
43205 | ], ValueService.prototype, "valueCache", void 0);
|
43206 | __decorate$K([
|
43207 | PostConstruct
|
43208 | ], ValueService.prototype, "init", null);
|
43209 | ValueService = __decorate$K([
|
43210 | Bean('valueService')
|
43211 | ], ValueService);
|
43212 | return ValueService;
|
43213 | }(BeanStub));
|
43214 |
|
43215 |
|
43216 |
|
43217 |
|
43218 |
|
43219 |
|
43220 |
|
43221 | var __extends$I = (undefined && undefined.__extends) || (function () {
|
43222 | var extendStatics = function (d, b) {
|
43223 | extendStatics = Object.setPrototypeOf ||
|
43224 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43225 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
43226 | return extendStatics(d, b);
|
43227 | };
|
43228 | return function (d, b) {
|
43229 | extendStatics(d, b);
|
43230 | function __() { this.constructor = d; }
|
43231 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43232 | };
|
43233 | })();
|
43234 | var __decorate$J = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43235 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43236 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43237 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43238 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43239 | };
|
43240 | var __param$4 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
43241 | return function (target, key) { decorator(target, key, paramIndex); }
|
43242 | };
|
43243 | var ExpressionService = (function (_super) {
|
43244 | __extends$I(ExpressionService, _super);
|
43245 | function ExpressionService() {
|
43246 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
43247 | _this.expressionToFunctionCache = {};
|
43248 | return _this;
|
43249 | }
|
43250 | ExpressionService.prototype.setBeans = function (loggerFactory) {
|
43251 | this.logger = loggerFactory.create('ExpressionService');
|
43252 | };
|
43253 | ExpressionService.prototype.evaluate = function (expression, params) {
|
43254 | if (typeof expression === 'string') {
|
43255 |
|
43256 | return this.evaluateExpression(expression, params);
|
43257 | }
|
43258 | else {
|
43259 | console.error('AG Grid: value should be either a string or a function', expression);
|
43260 | }
|
43261 | };
|
43262 | ExpressionService.prototype.evaluateExpression = function (expression, params) {
|
43263 | try {
|
43264 | var javaScriptFunction = this.createExpressionFunction(expression);
|
43265 |
|
43266 |
|
43267 | 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);
|
43268 | return result;
|
43269 | }
|
43270 | catch (e) {
|
43271 |
|
43272 |
|
43273 |
|
43274 | console.log('Processing of the expression failed');
|
43275 |
|
43276 | console.log('Expression = ' + expression);
|
43277 |
|
43278 | console.log('Params =', params);
|
43279 |
|
43280 | console.log('Exception = ' + e);
|
43281 | return null;
|
43282 | }
|
43283 | };
|
43284 | ExpressionService.prototype.createExpressionFunction = function (expression) {
|
43285 |
|
43286 | if (this.expressionToFunctionCache[expression]) {
|
43287 | return this.expressionToFunctionCache[expression];
|
43288 | }
|
43289 |
|
43290 | var functionBody = this.createFunctionBody(expression);
|
43291 | var theFunction = new Function('x, ctx, oldValue, newValue, value, node, data, colDef, rowIndex, api, columnApi, getValue, column, columnGroup', functionBody);
|
43292 |
|
43293 | this.expressionToFunctionCache[expression] = theFunction;
|
43294 | return theFunction;
|
43295 | };
|
43296 | ExpressionService.prototype.createFunctionBody = function (expression) {
|
43297 |
|
43298 |
|
43299 | if (expression.indexOf('return') >= 0) {
|
43300 | return expression;
|
43301 | }
|
43302 | else {
|
43303 | return 'return ' + expression + ';';
|
43304 | }
|
43305 | };
|
43306 | __decorate$J([
|
43307 | __param$4(0, Qualifier('loggerFactory'))
|
43308 | ], ExpressionService.prototype, "setBeans", null);
|
43309 | ExpressionService = __decorate$J([
|
43310 | Bean('expressionService')
|
43311 | ], ExpressionService);
|
43312 | return ExpressionService;
|
43313 | }(BeanStub));
|
43314 |
|
43315 |
|
43316 |
|
43317 |
|
43318 |
|
43319 |
|
43320 |
|
43321 | var __extends$H = (undefined && undefined.__extends) || (function () {
|
43322 | var extendStatics = function (d, b) {
|
43323 | extendStatics = Object.setPrototypeOf ||
|
43324 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43325 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
43326 | return extendStatics(d, b);
|
43327 | };
|
43328 | return function (d, b) {
|
43329 | extendStatics(d, b);
|
43330 | function __() { this.constructor = d; }
|
43331 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43332 | };
|
43333 | })();
|
43334 | var __decorate$I = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43335 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43336 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43337 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43338 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43339 | };
|
43340 | var TemplateService = (function (_super) {
|
43341 | __extends$H(TemplateService, _super);
|
43342 | function TemplateService() {
|
43343 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
43344 | _this.templateCache = {};
|
43345 | _this.waitingCallbacks = {};
|
43346 | return _this;
|
43347 | }
|
43348 |
|
43349 |
|
43350 | TemplateService.prototype.getTemplate = function (url, callback) {
|
43351 | var templateFromCache = this.templateCache[url];
|
43352 | if (templateFromCache) {
|
43353 | return templateFromCache;
|
43354 | }
|
43355 | var callbackList = this.waitingCallbacks[url];
|
43356 | var that = this;
|
43357 | if (!callbackList) {
|
43358 |
|
43359 | callbackList = [];
|
43360 | this.waitingCallbacks[url] = callbackList;
|
43361 |
|
43362 | var client = new XMLHttpRequest();
|
43363 | client.onload = function () {
|
43364 | that.handleHttpResult(this, url);
|
43365 | };
|
43366 | client.open("GET", url);
|
43367 | client.send();
|
43368 | }
|
43369 |
|
43370 | if (callback) {
|
43371 | callbackList.push(callback);
|
43372 | }
|
43373 |
|
43374 | return null;
|
43375 | };
|
43376 | TemplateService.prototype.handleHttpResult = function (httpResult, url) {
|
43377 | if (httpResult.status !== 200 || httpResult.response === null) {
|
43378 | console.warn("AG Grid: Unable to get template error " + httpResult.status + " - " + url);
|
43379 | return;
|
43380 | }
|
43381 |
|
43382 |
|
43383 | this.templateCache[url] = httpResult.response || httpResult.responseText;
|
43384 |
|
43385 | var callbacks = this.waitingCallbacks[url];
|
43386 | for (var i = 0; i < callbacks.length; i++) {
|
43387 | var callback = callbacks[i];
|
43388 |
|
43389 |
|
43390 |
|
43391 | callback();
|
43392 | }
|
43393 | };
|
43394 | TemplateService = __decorate$I([
|
43395 | Bean('templateService')
|
43396 | ], TemplateService);
|
43397 | return TemplateService;
|
43398 | }(BeanStub));
|
43399 |
|
43400 |
|
43401 |
|
43402 |
|
43403 |
|
43404 |
|
43405 |
|
43406 | var __extends$G = (undefined && undefined.__extends) || (function () {
|
43407 | var extendStatics = function (d, b) {
|
43408 | extendStatics = Object.setPrototypeOf ||
|
43409 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43410 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
43411 | return extendStatics(d, b);
|
43412 | };
|
43413 | return function (d, b) {
|
43414 | extendStatics(d, b);
|
43415 | function __() { this.constructor = d; }
|
43416 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43417 | };
|
43418 | })();
|
43419 | var __decorate$H = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43420 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43421 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43422 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43423 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43424 | };
|
43425 | var __param$3 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
43426 | return function (target, key) { decorator(target, key, paramIndex); }
|
43427 | };
|
43428 | var LoggerFactory = (function (_super) {
|
43429 | __extends$G(LoggerFactory, _super);
|
43430 | function LoggerFactory() {
|
43431 | return _super !== null && _super.apply(this, arguments) || this;
|
43432 | }
|
43433 | LoggerFactory.prototype.setBeans = function (gridOptionsService) {
|
43434 | this.logging = gridOptionsService.is('debug');
|
43435 | };
|
43436 | LoggerFactory.prototype.create = function (name) {
|
43437 | return new Logger(name, this.isLogging.bind(this));
|
43438 | };
|
43439 | LoggerFactory.prototype.isLogging = function () {
|
43440 | return this.logging;
|
43441 | };
|
43442 | __decorate$H([
|
43443 | __param$3(0, Qualifier('gridOptionsService'))
|
43444 | ], LoggerFactory.prototype, "setBeans", null);
|
43445 | LoggerFactory = __decorate$H([
|
43446 | Bean('loggerFactory')
|
43447 | ], LoggerFactory);
|
43448 | return LoggerFactory;
|
43449 | }(BeanStub));
|
43450 | var Logger = (function () {
|
43451 | function Logger(name, isLoggingFunc) {
|
43452 | this.name = name;
|
43453 | this.isLoggingFunc = isLoggingFunc;
|
43454 | }
|
43455 | Logger.prototype.isLogging = function () {
|
43456 | return this.isLoggingFunc();
|
43457 | };
|
43458 | Logger.prototype.log = function (message) {
|
43459 | if (this.isLoggingFunc()) {
|
43460 |
|
43461 | console.log('AG Grid.' + this.name + ': ' + message);
|
43462 | }
|
43463 | };
|
43464 | return Logger;
|
43465 | }());
|
43466 |
|
43467 |
|
43468 |
|
43469 |
|
43470 |
|
43471 |
|
43472 |
|
43473 | var __extends$F = (undefined && undefined.__extends) || (function () {
|
43474 | var extendStatics = function (d, b) {
|
43475 | extendStatics = Object.setPrototypeOf ||
|
43476 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43477 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
43478 | return extendStatics(d, b);
|
43479 | };
|
43480 | return function (d, b) {
|
43481 | extendStatics(d, b);
|
43482 | function __() { this.constructor = d; }
|
43483 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43484 | };
|
43485 | })();
|
43486 | var __decorate$G = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43487 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43488 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43489 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43490 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43491 | };
|
43492 | var GridCtrl = (function (_super) {
|
43493 | __extends$F(GridCtrl, _super);
|
43494 | function GridCtrl() {
|
43495 | return _super !== null && _super.apply(this, arguments) || this;
|
43496 | }
|
43497 | GridCtrl.prototype.setComp = function (view, eGridDiv, eGui) {
|
43498 | var _this = this;
|
43499 | this.view = view;
|
43500 | this.eGridHostDiv = eGridDiv;
|
43501 | this.eGui = eGui;
|
43502 |
|
43503 | this.dragAndDropService.addDropTarget({
|
43504 | getContainer: function () { return _this.eGui; },
|
43505 | isInterestedIn: function (type) { return type === DragSourceType.HeaderCell || type === DragSourceType.ToolPanel; },
|
43506 | getIconName: function () { return DragAndDropService.ICON_NOT_ALLOWED; },
|
43507 | });
|
43508 | this.mouseEventService.stampTopLevelGridCompWithGridInstance(eGridDiv);
|
43509 | this.createManagedBean(new LayoutFeature(this.view));
|
43510 | this.addRtlSupport();
|
43511 | this.addManagedListener(this, Events.EVENT_KEYBOARD_FOCUS, function () {
|
43512 | _this.view.addOrRemoveKeyboardFocusClass(true);
|
43513 | });
|
43514 | this.addManagedListener(this, Events.EVENT_MOUSE_FOCUS, function () {
|
43515 | _this.view.addOrRemoveKeyboardFocusClass(false);
|
43516 | });
|
43517 | var unsubscribeFromResize = this.resizeObserverService.observeResize(this.eGridHostDiv, this.onGridSizeChanged.bind(this));
|
43518 | this.addDestroyFunc(function () { return unsubscribeFromResize(); });
|
43519 | this.ctrlsService.registerGridCtrl(this);
|
43520 | };
|
43521 | GridCtrl.prototype.isDetailGrid = function () {
|
43522 | var _a;
|
43523 | var el = this.focusService.findTabbableParent(this.getGui());
|
43524 | return ((_a = el === null || el === void 0 ? void 0 : el.getAttribute('row-id')) === null || _a === void 0 ? void 0 : _a.startsWith('detail')) || false;
|
43525 | };
|
43526 | GridCtrl.prototype.showDropZones = function () {
|
43527 | return ModuleRegistry.isRegistered(ModuleNames.RowGroupingModule);
|
43528 | };
|
43529 | GridCtrl.prototype.showSideBar = function () {
|
43530 | return ModuleRegistry.isRegistered(ModuleNames.SideBarModule);
|
43531 | };
|
43532 | GridCtrl.prototype.showStatusBar = function () {
|
43533 | return ModuleRegistry.isRegistered(ModuleNames.StatusBarModule);
|
43534 | };
|
43535 | GridCtrl.prototype.showWatermark = function () {
|
43536 | return ModuleRegistry.isRegistered(ModuleNames.EnterpriseCoreModule);
|
43537 | };
|
43538 | GridCtrl.prototype.onGridSizeChanged = function () {
|
43539 | var event = {
|
43540 | type: Events.EVENT_GRID_SIZE_CHANGED,
|
43541 | clientWidth: this.eGridHostDiv.clientWidth,
|
43542 | clientHeight: this.eGridHostDiv.clientHeight
|
43543 | };
|
43544 | this.eventService.dispatchEvent(event);
|
43545 | };
|
43546 | GridCtrl.prototype.addRtlSupport = function () {
|
43547 | var cssClass = this.gridOptionsService.is('enableRtl') ? 'ag-rtl' : 'ag-ltr';
|
43548 | this.view.setRtlClass(cssClass);
|
43549 | };
|
43550 | GridCtrl.prototype.destroyGridUi = function () {
|
43551 | this.view.destroyGridUi();
|
43552 | };
|
43553 | GridCtrl.prototype.getGui = function () {
|
43554 | return this.eGui;
|
43555 | };
|
43556 | GridCtrl.prototype.setResizeCursor = function (on) {
|
43557 | this.view.setCursor(on ? 'ew-resize' : null);
|
43558 | };
|
43559 | GridCtrl.prototype.disableUserSelect = function (on) {
|
43560 | this.view.setUserSelect(on ? 'none' : null);
|
43561 | };
|
43562 | GridCtrl.prototype.focusNextInnerContainer = function (backwards) {
|
43563 | var eDocument = this.gridOptionsService.getDocument();
|
43564 | var focusableContainers = this.view.getFocusableContainers();
|
43565 | var idxWithFocus = focusableContainers.findIndex(function (container) { return container.contains(eDocument.activeElement); });
|
43566 | var nextIdx = idxWithFocus + (backwards ? -1 : 1);
|
43567 | if (nextIdx <= 0 || nextIdx >= focusableContainers.length) {
|
43568 | return false;
|
43569 | }
|
43570 | return this.focusService.focusInto(focusableContainers[nextIdx]);
|
43571 | };
|
43572 | GridCtrl.prototype.focusInnerElement = function (fromBottom) {
|
43573 | var focusableContainers = this.view.getFocusableContainers();
|
43574 | if (fromBottom) {
|
43575 | if (focusableContainers.length > 1) {
|
43576 | return this.focusService.focusInto(last(focusableContainers), true);
|
43577 | }
|
43578 | var lastColumn = last(this.columnModel.getAllDisplayedColumns());
|
43579 | if (this.focusService.focusGridView(lastColumn, true)) {
|
43580 | return true;
|
43581 | }
|
43582 | }
|
43583 | return this.focusService.focusFirstHeader();
|
43584 | };
|
43585 | GridCtrl.prototype.forceFocusOutOfContainer = function (up) {
|
43586 | if (up === void 0) { up = false; }
|
43587 | this.view.forceFocusOutOfContainer(up);
|
43588 | };
|
43589 | __decorate$G([
|
43590 | Autowired('focusService')
|
43591 | ], GridCtrl.prototype, "focusService", void 0);
|
43592 | __decorate$G([
|
43593 | Autowired('resizeObserverService')
|
43594 | ], GridCtrl.prototype, "resizeObserverService", void 0);
|
43595 | __decorate$G([
|
43596 | Autowired('columnModel')
|
43597 | ], GridCtrl.prototype, "columnModel", void 0);
|
43598 | __decorate$G([
|
43599 | Autowired('ctrlsService')
|
43600 | ], GridCtrl.prototype, "ctrlsService", void 0);
|
43601 | __decorate$G([
|
43602 | Autowired('mouseEventService')
|
43603 | ], GridCtrl.prototype, "mouseEventService", void 0);
|
43604 | __decorate$G([
|
43605 | Autowired('dragAndDropService')
|
43606 | ], GridCtrl.prototype, "dragAndDropService", void 0);
|
43607 | return GridCtrl;
|
43608 | }(BeanStub));
|
43609 |
|
43610 |
|
43611 |
|
43612 |
|
43613 |
|
43614 |
|
43615 |
|
43616 | var __extends$E = (undefined && undefined.__extends) || (function () {
|
43617 | var extendStatics = function (d, b) {
|
43618 | extendStatics = Object.setPrototypeOf ||
|
43619 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43620 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
43621 | return extendStatics(d, b);
|
43622 | };
|
43623 | return function (d, b) {
|
43624 | extendStatics(d, b);
|
43625 | function __() { this.constructor = d; }
|
43626 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43627 | };
|
43628 | })();
|
43629 | var __decorate$F = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43630 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43631 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43632 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43633 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43634 | };
|
43635 | var GridComp = (function (_super) {
|
43636 | __extends$E(GridComp, _super);
|
43637 | function GridComp(eGridDiv) {
|
43638 | var _this = _super.call(this) || this;
|
43639 | _this.eGridDiv = eGridDiv;
|
43640 | return _this;
|
43641 | }
|
43642 | GridComp.prototype.postConstruct = function () {
|
43643 | var _this = this;
|
43644 | this.logger = this.loggerFactory.create('GridComp');
|
43645 | var compProxy = {
|
43646 | destroyGridUi: function () { return _this.destroyBean(_this); },
|
43647 | setRtlClass: function (cssClass) { return _this.addCssClass(cssClass); },
|
43648 | addOrRemoveKeyboardFocusClass: function (addOrRemove) { return _this.addOrRemoveCssClass(FocusService.AG_KEYBOARD_FOCUS, addOrRemove); },
|
43649 | forceFocusOutOfContainer: this.forceFocusOutOfContainer.bind(this),
|
43650 | updateLayoutClasses: this.updateLayoutClasses.bind(this),
|
43651 | getFocusableContainers: this.getFocusableContainers.bind(this),
|
43652 | setUserSelect: function (value) {
|
43653 | _this.getGui().style.userSelect = value != null ? value : '';
|
43654 | _this.getGui().style.webkitUserSelect = value != null ? value : '';
|
43655 | },
|
43656 | setCursor: function (value) {
|
43657 | _this.getGui().style.cursor = value != null ? value : '';
|
43658 | }
|
43659 | };
|
43660 | this.ctrl = this.createManagedBean(new GridCtrl());
|
43661 | var template = this.createTemplate();
|
43662 | this.setTemplate(template);
|
43663 | this.ctrl.setComp(compProxy, this.eGridDiv, this.getGui());
|
43664 | this.insertGridIntoDom();
|
43665 | this.initialiseTabGuard({
|
43666 |
|
43667 | onTabKeyDown: function () { return undefined; },
|
43668 | focusInnerElement: function (fromBottom) { return _this.ctrl.focusInnerElement(fromBottom); }
|
43669 | });
|
43670 | };
|
43671 | GridComp.prototype.insertGridIntoDom = function () {
|
43672 | var _this = this;
|
43673 | var eGui = this.getGui();
|
43674 | this.eGridDiv.appendChild(eGui);
|
43675 | this.addDestroyFunc(function () {
|
43676 | _this.eGridDiv.removeChild(eGui);
|
43677 | _this.logger.log('Grid removed from DOM');
|
43678 | });
|
43679 | };
|
43680 | GridComp.prototype.updateLayoutClasses = function (cssClass, params) {
|
43681 | var eRootWrapperBodyClassList = this.eRootWrapperBody.classList;
|
43682 | eRootWrapperBodyClassList.toggle(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
|
43683 | eRootWrapperBodyClassList.toggle(LayoutCssClasses.NORMAL, params.normal);
|
43684 | eRootWrapperBodyClassList.toggle(LayoutCssClasses.PRINT, params.print);
|
43685 | this.addOrRemoveCssClass(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
|
43686 | this.addOrRemoveCssClass(LayoutCssClasses.NORMAL, params.normal);
|
43687 | this.addOrRemoveCssClass(LayoutCssClasses.PRINT, params.print);
|
43688 | };
|
43689 | GridComp.prototype.createTemplate = function () {
|
43690 | var dropZones = this.ctrl.showDropZones() ? '<ag-grid-header-drop-zones></ag-grid-header-drop-zones>' : '';
|
43691 | var sideBar = this.ctrl.showSideBar() ? '<ag-side-bar ref="sideBar"></ag-side-bar>' : '';
|
43692 | var statusBar = this.ctrl.showStatusBar() ? '<ag-status-bar ref="statusBar"></ag-status-bar>' : '';
|
43693 | var watermark = this.ctrl.showWatermark() ? '<ag-watermark></ag-watermark>' : '';
|
43694 | var template = "<div class=\"ag-root-wrapper\" role=\"presentation\">\n " + dropZones + "\n <div class=\"ag-root-wrapper-body\" ref=\"rootWrapperBody\" role=\"presentation\">\n <ag-grid-body ref=\"gridBody\"></ag-grid-body>\n " + sideBar + "\n </div>\n " + statusBar + "\n <ag-pagination></ag-pagination>\n " + watermark + "\n </div>";
|
43695 | return template;
|
43696 | };
|
43697 | GridComp.prototype.getFocusableElement = function () {
|
43698 | return this.eRootWrapperBody;
|
43699 | };
|
43700 | GridComp.prototype.getFocusableContainers = function () {
|
43701 | var focusableContainers = [
|
43702 | this.gridBodyComp.getGui()
|
43703 | ];
|
43704 | if (this.sideBarComp) {
|
43705 | focusableContainers.push(this.sideBarComp.getGui());
|
43706 | }
|
43707 | return focusableContainers.filter(function (el) { return isVisible(el); });
|
43708 | };
|
43709 | __decorate$F([
|
43710 | Autowired('loggerFactory')
|
43711 | ], GridComp.prototype, "loggerFactory", void 0);
|
43712 | __decorate$F([
|
43713 | RefSelector('gridBody')
|
43714 | ], GridComp.prototype, "gridBodyComp", void 0);
|
43715 | __decorate$F([
|
43716 | RefSelector('sideBar')
|
43717 | ], GridComp.prototype, "sideBarComp", void 0);
|
43718 | __decorate$F([
|
43719 | RefSelector('rootWrapperBody')
|
43720 | ], GridComp.prototype, "eRootWrapperBody", void 0);
|
43721 | __decorate$F([
|
43722 | PostConstruct
|
43723 | ], GridComp.prototype, "postConstruct", null);
|
43724 | return GridComp;
|
43725 | }(TabGuardComp));
|
43726 |
|
43727 |
|
43728 |
|
43729 |
|
43730 |
|
43731 |
|
43732 |
|
43733 | var __extends$D = (undefined && undefined.__extends) || (function () {
|
43734 | var extendStatics = function (d, b) {
|
43735 | extendStatics = Object.setPrototypeOf ||
|
43736 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
43737 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
43738 | return extendStatics(d, b);
|
43739 | };
|
43740 | return function (d, b) {
|
43741 | extendStatics(d, b);
|
43742 | function __() { this.constructor = d; }
|
43743 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43744 | };
|
43745 | })();
|
43746 | var __decorate$E = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
43747 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
43748 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
43749 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
43750 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
43751 | };
|
43752 | var __read$7 = (undefined && undefined.__read) || function (o, n) {
|
43753 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
43754 | if (!m) return o;
|
43755 | var i = m.call(o), r, ar = [], e;
|
43756 | try {
|
43757 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
43758 | }
|
43759 | catch (error) { e = { error: error }; }
|
43760 | finally {
|
43761 | try {
|
43762 | if (r && !r.done && (m = i["return"])) m.call(i);
|
43763 | }
|
43764 | finally { if (e) throw e.error; }
|
43765 | }
|
43766 | return ar;
|
43767 | };
|
43768 | var __spread$6 = (undefined && undefined.__spread) || function () {
|
43769 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$7(arguments[i]));
|
43770 | return ar;
|
43771 | };
|
43772 | var SortController = (function (_super) {
|
43773 | __extends$D(SortController, _super);
|
43774 | function SortController() {
|
43775 | return _super !== null && _super.apply(this, arguments) || this;
|
43776 | }
|
43777 | SortController_1 = SortController;
|
43778 | SortController.prototype.progressSort = function (column, multiSort, source) {
|
43779 | var nextDirection = this.getNextSortDirection(column);
|
43780 | this.setSortForColumn(column, nextDirection, multiSort, source);
|
43781 | };
|
43782 | SortController.prototype.setSortForColumn = function (column, sort, multiSort, source) {
|
43783 |
|
43784 | if (sort !== 'asc' && sort !== 'desc') {
|
43785 | sort = null;
|
43786 | }
|
43787 | var isColumnsSortingCoupledToGroup = this.gridOptionsService.isColumnsSortingCoupledToGroup();
|
43788 | var columnsToUpdate = [column];
|
43789 | if (isColumnsSortingCoupledToGroup && column.getColDef().showRowGroup) {
|
43790 | if (!column.getColDef().field) {
|
43791 |
|
43792 | columnsToUpdate = [];
|
43793 | }
|
43794 | var rowGroupColumns = this.columnModel.getSourceColumnsForGroupColumn(column);
|
43795 | var sortableRowGroupColumns = rowGroupColumns === null || rowGroupColumns === void 0 ? void 0 : rowGroupColumns.filter(function (col) { return col.getColDef().sortable; });
|
43796 | if (sortableRowGroupColumns) {
|
43797 | columnsToUpdate = __spread$6(columnsToUpdate, sortableRowGroupColumns);
|
43798 | }
|
43799 | }
|
43800 | columnsToUpdate.forEach(function (col) { return col.setSort(sort, source); });
|
43801 | var doingMultiSort = (multiSort || this.gridOptionsService.is('alwaysMultiSort')) && !this.gridOptionsService.is('suppressMultiSort');
|
43802 |
|
43803 | if (!doingMultiSort) {
|
43804 | this.clearSortBarTheseColumns(columnsToUpdate, source);
|
43805 | }
|
43806 |
|
43807 | this.updateSortIndex(column);
|
43808 | this.dispatchSortChangedEvents(source);
|
43809 | };
|
43810 | SortController.prototype.updateSortIndex = function (lastColToChange) {
|
43811 | var isCoupled = this.gridOptionsService.isColumnsSortingCoupledToGroup();
|
43812 | var groupParent = this.columnModel.getGroupDisplayColumnForGroup(lastColToChange.getId());
|
43813 | var lastSortIndexCol = isCoupled ? groupParent || lastColToChange : lastColToChange;
|
43814 | var allSortedCols = this.getColumnsWithSortingOrdered(true);
|
43815 |
|
43816 | this.columnModel.getPrimaryAndSecondaryAndAutoColumns().forEach(function (col) { return col.setSortIndex(null); });
|
43817 | var allSortedColsWithoutChanges = allSortedCols.filter(function (col) { return col !== lastSortIndexCol; });
|
43818 | var sortedColsWithIndices = !!lastSortIndexCol.getSort() ? __spread$6(allSortedColsWithoutChanges, [lastSortIndexCol]) : allSortedColsWithoutChanges;
|
43819 | sortedColsWithIndices.forEach(function (col, idx) { return (col.setSortIndex(idx)); });
|
43820 | };
|
43821 |
|
43822 |
|
43823 | SortController.prototype.onSortChanged = function (source) {
|
43824 | this.dispatchSortChangedEvents(source);
|
43825 | };
|
43826 | SortController.prototype.isSortActive = function () {
|
43827 |
|
43828 | var allCols = this.columnModel.getPrimaryAndSecondaryAndAutoColumns();
|
43829 | var sortedCols = allCols.filter(function (column) { return !!column.getSort(); });
|
43830 | return sortedCols && sortedCols.length > 0;
|
43831 | };
|
43832 | SortController.prototype.dispatchSortChangedEvents = function (source) {
|
43833 | var event = {
|
43834 | type: Events.EVENT_SORT_CHANGED,
|
43835 | source: source
|
43836 | };
|
43837 | this.eventService.dispatchEvent(event);
|
43838 | };
|
43839 | SortController.prototype.clearSortBarTheseColumns = function (columnsToSkip, source) {
|
43840 | this.columnModel.getPrimaryAndSecondaryAndAutoColumns().forEach(function (columnToClear) {
|
43841 |
|
43842 | if (!columnsToSkip.includes(columnToClear)) {
|
43843 |
|
43844 |
|
43845 | columnToClear.setSort(undefined, source);
|
43846 | }
|
43847 | });
|
43848 | };
|
43849 | SortController.prototype.getNextSortDirection = function (column) {
|
43850 | var sortingOrder;
|
43851 | if (column.getColDef().sortingOrder) {
|
43852 | sortingOrder = column.getColDef().sortingOrder;
|
43853 | }
|
43854 | else if (this.gridOptionsService.get('sortingOrder')) {
|
43855 | sortingOrder = this.gridOptionsService.get('sortingOrder');
|
43856 | }
|
43857 | else {
|
43858 | sortingOrder = SortController_1.DEFAULT_SORTING_ORDER;
|
43859 | }
|
43860 | if (!Array.isArray(sortingOrder) || sortingOrder.length <= 0) {
|
43861 | console.warn("AG Grid: sortingOrder must be an array with at least one element, currently it's " + sortingOrder);
|
43862 | return null;
|
43863 | }
|
43864 |
|
43865 | var currentSort = !!column.getColDef().field ? column.getSort() : this.getDisplaySortForColumn(column);
|
43866 | var result = sortingOrder[0];
|
43867 | if (currentSort !== 'mixed') {
|
43868 | var currentIndex = sortingOrder.indexOf(currentSort);
|
43869 | var notInArray = currentIndex < 0;
|
43870 | var lastItemInArray = currentIndex == sortingOrder.length - 1;
|
43871 | if (notInArray || lastItemInArray) {
|
43872 | result = sortingOrder[0];
|
43873 | }
|
43874 | else {
|
43875 | result = sortingOrder[currentIndex + 1];
|
43876 | }
|
43877 | }
|
43878 |
|
43879 | if (SortController_1.DEFAULT_SORTING_ORDER.indexOf(result) < 0) {
|
43880 | console.warn('AG Grid: invalid sort type ' + result);
|
43881 | return null;
|
43882 | }
|
43883 | return result;
|
43884 | };
|
43885 | |
43886 |
|
43887 |
|
43888 |
|
43889 | SortController.prototype.getIndexedSortMap = function (includeRedundantColumns) {
|
43890 | var _this = this;
|
43891 | if (includeRedundantColumns === void 0) { includeRedundantColumns = false; }
|
43892 |
|
43893 | var allSortedCols = this.columnModel.getPrimaryAndSecondaryAndAutoColumns()
|
43894 | .filter(function (col) { return !!col.getSort(); });
|
43895 | if (!includeRedundantColumns && this.columnModel.isPivotMode()) {
|
43896 | allSortedCols = allSortedCols.filter(function (col) { return (!!col.getAggFunc() || !col.isPrimary() || _this.columnModel.getGroupDisplayColumnForGroup(col.getId())); });
|
43897 | }
|
43898 | var sortedRowGroupCols = this.columnModel.getRowGroupColumns()
|
43899 | .filter(function (col) { return !!col.getSort(); });
|
43900 | var isSortLinked = this.gridOptionsService.isColumnsSortingCoupledToGroup() && !!sortedRowGroupCols.length;
|
43901 | if (isSortLinked) {
|
43902 | allSortedCols = __spread$6(new Set(
|
43903 |
|
43904 | allSortedCols.map(function (col) { var _a; return (_a = _this.columnModel.getGroupDisplayColumnForGroup(col.getId())) !== null && _a !== void 0 ? _a : col; })));
|
43905 | }
|
43906 |
|
43907 |
|
43908 |
|
43909 | var allColsIndexes = {};
|
43910 | allSortedCols.forEach(function (col, index) { return allColsIndexes[col.getId()] = index; });
|
43911 |
|
43912 | allSortedCols.sort(function (a, b) {
|
43913 | var iA = a.getSortIndex();
|
43914 | var iB = b.getSortIndex();
|
43915 | if (iA != null && iB != null) {
|
43916 | return iA - iB;
|
43917 | }
|
43918 | else if (iA == null && iB == null) {
|
43919 |
|
43920 | var posA = allColsIndexes[a.getId()];
|
43921 | var posB = allColsIndexes[b.getId()];
|
43922 | return posA > posB ? 1 : -1;
|
43923 | }
|
43924 | else if (iB == null) {
|
43925 | return -1;
|
43926 | }
|
43927 | else {
|
43928 | return 1;
|
43929 | }
|
43930 | });
|
43931 | var indexMap = new Map();
|
43932 | allSortedCols.forEach(function (col, idx) { return indexMap.set(col, idx); });
|
43933 |
|
43934 | if (isSortLinked) {
|
43935 | sortedRowGroupCols.forEach(function (col) {
|
43936 | var groupDisplayCol = _this.columnModel.getGroupDisplayColumnForGroup(col.getId());
|
43937 | indexMap.set(col, indexMap.get(groupDisplayCol));
|
43938 | });
|
43939 | }
|
43940 | return indexMap;
|
43941 | };
|
43942 | SortController.prototype.getColumnsWithSortingOrdered = function (includeRedundantColumns) {
|
43943 | if (includeRedundantColumns === void 0) { includeRedundantColumns = false; }
|
43944 |
|
43945 | return __spread$6(this.getIndexedSortMap(includeRedundantColumns).entries()).sort(function (_a, _b) {
|
43946 | var _c = __read$7(_a, 2); _c[0]; var idx1 = _c[1];
|
43947 | var _d = __read$7(_b, 2); _d[0]; var idx2 = _d[1];
|
43948 | return idx1 - idx2;
|
43949 | })
|
43950 | .map(function (_a) {
|
43951 | var _b = __read$7(_a, 1), col = _b[0];
|
43952 | return col;
|
43953 | });
|
43954 | };
|
43955 |
|
43956 | SortController.prototype.getSortModel = function () {
|
43957 |
|
43958 | return this.getColumnsWithSortingOrdered(true).map(function (column) { return ({
|
43959 | sort: column.getSort(),
|
43960 | colId: column.getId()
|
43961 | }); });
|
43962 | };
|
43963 | SortController.prototype.getSortOptions = function () {
|
43964 |
|
43965 | return this.getColumnsWithSortingOrdered().map(function (column) { return ({
|
43966 | sort: column.getSort(),
|
43967 | column: column
|
43968 | }); });
|
43969 | };
|
43970 | SortController.prototype.canColumnDisplayMixedSort = function (column) {
|
43971 | var isColumnSortCouplingActive = this.gridOptionsService.isColumnsSortingCoupledToGroup();
|
43972 | var isGroupDisplayColumn = !!column.getColDef().showRowGroup;
|
43973 | return isColumnSortCouplingActive && isGroupDisplayColumn;
|
43974 | };
|
43975 | SortController.prototype.getDisplaySortForColumn = function (column) {
|
43976 | var linkedColumns = this.columnModel.getSourceColumnsForGroupColumn(column);
|
43977 | if (!this.canColumnDisplayMixedSort(column) || !(linkedColumns === null || linkedColumns === void 0 ? void 0 : linkedColumns.length)) {
|
43978 | return column.getSort();
|
43979 | }
|
43980 |
|
43981 | var columnHasUniqueData = !!column.getColDef().field;
|
43982 | var sortableColumns = columnHasUniqueData ? __spread$6([column], linkedColumns) : linkedColumns;
|
43983 | var firstSort = sortableColumns[0].getSort();
|
43984 |
|
43985 | var allMatch = sortableColumns.every(function (col) { return col.getSort() == firstSort; });
|
43986 | if (!allMatch) {
|
43987 | return 'mixed';
|
43988 | }
|
43989 | return firstSort;
|
43990 | };
|
43991 | SortController.prototype.getDisplaySortIndexForColumn = function (column) {
|
43992 | return this.getIndexedSortMap().get(column);
|
43993 | };
|
43994 | var SortController_1;
|
43995 | SortController.DEFAULT_SORTING_ORDER = ['asc', 'desc', null];
|
43996 | __decorate$E([
|
43997 | Autowired('columnModel')
|
43998 | ], SortController.prototype, "columnModel", void 0);
|
43999 | SortController = SortController_1 = __decorate$E([
|
44000 | Bean('sortController')
|
44001 | ], SortController);
|
44002 | return SortController;
|
44003 | }(BeanStub));
|
44004 |
|
44005 |
|
44006 |
|
44007 |
|
44008 |
|
44009 |
|
44010 |
|
44011 | var __extends$C = (undefined && undefined.__extends) || (function () {
|
44012 | var extendStatics = function (d, b) {
|
44013 | extendStatics = Object.setPrototypeOf ||
|
44014 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44015 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
44016 | return extendStatics(d, b);
|
44017 | };
|
44018 | return function (d, b) {
|
44019 | extendStatics(d, b);
|
44020 | function __() { this.constructor = d; }
|
44021 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44022 | };
|
44023 | })();
|
44024 | var __decorate$D = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44025 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44026 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44027 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44028 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44029 | };
|
44030 | var ColumnHoverService = (function (_super) {
|
44031 | __extends$C(ColumnHoverService, _super);
|
44032 | function ColumnHoverService() {
|
44033 | return _super !== null && _super.apply(this, arguments) || this;
|
44034 | }
|
44035 | ColumnHoverService.prototype.setMouseOver = function (columns) {
|
44036 | this.selectedColumns = columns;
|
44037 | var event = {
|
44038 | type: Events.EVENT_COLUMN_HOVER_CHANGED
|
44039 | };
|
44040 | this.eventService.dispatchEvent(event);
|
44041 | };
|
44042 | ColumnHoverService.prototype.clearMouseOver = function () {
|
44043 | this.selectedColumns = null;
|
44044 | var event = {
|
44045 | type: Events.EVENT_COLUMN_HOVER_CHANGED
|
44046 | };
|
44047 | this.eventService.dispatchEvent(event);
|
44048 | };
|
44049 | ColumnHoverService.prototype.isHovered = function (column) {
|
44050 | return !!this.selectedColumns && this.selectedColumns.indexOf(column) >= 0;
|
44051 | };
|
44052 | ColumnHoverService = __decorate$D([
|
44053 | Bean('columnHoverService')
|
44054 | ], ColumnHoverService);
|
44055 | return ColumnHoverService;
|
44056 | }(BeanStub));
|
44057 |
|
44058 |
|
44059 |
|
44060 |
|
44061 |
|
44062 |
|
44063 |
|
44064 | var __extends$B = (undefined && undefined.__extends) || (function () {
|
44065 | var extendStatics = function (d, b) {
|
44066 | extendStatics = Object.setPrototypeOf ||
|
44067 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44068 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
44069 | return extendStatics(d, b);
|
44070 | };
|
44071 | return function (d, b) {
|
44072 | extendStatics(d, b);
|
44073 | function __() { this.constructor = d; }
|
44074 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44075 | };
|
44076 | })();
|
44077 | var __decorate$C = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44078 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44079 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44080 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44081 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44082 | };
|
44083 | var ColumnAnimationService = (function (_super) {
|
44084 | __extends$B(ColumnAnimationService, _super);
|
44085 | function ColumnAnimationService() {
|
44086 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
44087 | _this.executeNextFuncs = [];
|
44088 | _this.executeLaterFuncs = [];
|
44089 | _this.active = false;
|
44090 | _this.animationThreadCount = 0;
|
44091 | return _this;
|
44092 | }
|
44093 | ColumnAnimationService.prototype.postConstruct = function () {
|
44094 | var _this = this;
|
44095 | this.ctrlsService.whenReady(function (p) { return _this.gridBodyCtrl = p.gridBodyCtrl; });
|
44096 | };
|
44097 | ColumnAnimationService.prototype.isActive = function () {
|
44098 | return this.active;
|
44099 | };
|
44100 | ColumnAnimationService.prototype.start = function () {
|
44101 | if (this.active) {
|
44102 | return;
|
44103 | }
|
44104 | if (this.gridOptionsService.is('suppressColumnMoveAnimation')) {
|
44105 | return;
|
44106 | }
|
44107 |
|
44108 |
|
44109 |
|
44110 | if (this.gridOptionsService.is('enableRtl')) {
|
44111 | return;
|
44112 | }
|
44113 | this.ensureAnimationCssClassPresent();
|
44114 | this.active = true;
|
44115 | };
|
44116 | ColumnAnimationService.prototype.finish = function () {
|
44117 | if (!this.active) {
|
44118 | return;
|
44119 | }
|
44120 | this.flush();
|
44121 | this.active = false;
|
44122 | };
|
44123 | ColumnAnimationService.prototype.executeNextVMTurn = function (func) {
|
44124 | if (this.active) {
|
44125 | this.executeNextFuncs.push(func);
|
44126 | }
|
44127 | else {
|
44128 | func();
|
44129 | }
|
44130 | };
|
44131 | ColumnAnimationService.prototype.executeLaterVMTurn = function (func) {
|
44132 | if (this.active) {
|
44133 | this.executeLaterFuncs.push(func);
|
44134 | }
|
44135 | else {
|
44136 | func();
|
44137 | }
|
44138 | };
|
44139 | ColumnAnimationService.prototype.ensureAnimationCssClassPresent = function () {
|
44140 | var _this = this;
|
44141 |
|
44142 |
|
44143 | this.animationThreadCount++;
|
44144 | var animationThreadCountCopy = this.animationThreadCount;
|
44145 | this.gridBodyCtrl.setColumnMovingCss(true);
|
44146 | this.executeLaterFuncs.push(function () {
|
44147 |
|
44148 | if (_this.animationThreadCount === animationThreadCountCopy) {
|
44149 | _this.gridBodyCtrl.setColumnMovingCss(false);
|
44150 | }
|
44151 | });
|
44152 | };
|
44153 | ColumnAnimationService.prototype.flush = function () {
|
44154 | var nowFuncs = this.executeNextFuncs;
|
44155 | this.executeNextFuncs = [];
|
44156 | var waitFuncs = this.executeLaterFuncs;
|
44157 | this.executeLaterFuncs = [];
|
44158 | if (nowFuncs.length === 0 && waitFuncs.length === 0) {
|
44159 | return;
|
44160 | }
|
44161 | window.setTimeout(function () { return nowFuncs.forEach(function (func) { return func(); }); }, 0);
|
44162 | window.setTimeout(function () { return waitFuncs.forEach(function (func) { return func(); }); }, 300);
|
44163 | };
|
44164 | __decorate$C([
|
44165 | Autowired('ctrlsService')
|
44166 | ], ColumnAnimationService.prototype, "ctrlsService", void 0);
|
44167 | __decorate$C([
|
44168 | PostConstruct
|
44169 | ], ColumnAnimationService.prototype, "postConstruct", null);
|
44170 | ColumnAnimationService = __decorate$C([
|
44171 | Bean('columnAnimationService')
|
44172 | ], ColumnAnimationService);
|
44173 | return ColumnAnimationService;
|
44174 | }(BeanStub));
|
44175 |
|
44176 |
|
44177 |
|
44178 |
|
44179 |
|
44180 |
|
44181 |
|
44182 | var __extends$A = (undefined && undefined.__extends) || (function () {
|
44183 | var extendStatics = function (d, b) {
|
44184 | extendStatics = Object.setPrototypeOf ||
|
44185 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44186 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
44187 | return extendStatics(d, b);
|
44188 | };
|
44189 | return function (d, b) {
|
44190 | extendStatics(d, b);
|
44191 | function __() { this.constructor = d; }
|
44192 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44193 | };
|
44194 | })();
|
44195 | var __decorate$B = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44196 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44197 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44198 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44199 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44200 | };
|
44201 | var PaginationAutoPageSizeService = (function (_super) {
|
44202 | __extends$A(PaginationAutoPageSizeService, _super);
|
44203 | function PaginationAutoPageSizeService() {
|
44204 | return _super !== null && _super.apply(this, arguments) || this;
|
44205 | }
|
44206 | PaginationAutoPageSizeService.prototype.postConstruct = function () {
|
44207 | var _this = this;
|
44208 | this.ctrlsService.whenReady(function (p) {
|
44209 | _this.centerRowContainerCon = p.centerRowContainerCtrl;
|
44210 | _this.addManagedListener(_this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, _this.onBodyHeightChanged.bind(_this));
|
44211 | _this.addManagedListener(_this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, _this.onScrollVisibilityChanged.bind(_this));
|
44212 | _this.checkPageSize();
|
44213 | });
|
44214 | };
|
44215 | PaginationAutoPageSizeService.prototype.notActive = function () {
|
44216 | return !this.gridOptionsService.is('paginationAutoPageSize');
|
44217 | };
|
44218 | PaginationAutoPageSizeService.prototype.onScrollVisibilityChanged = function () {
|
44219 | this.checkPageSize();
|
44220 | };
|
44221 | PaginationAutoPageSizeService.prototype.onBodyHeightChanged = function () {
|
44222 | this.checkPageSize();
|
44223 | };
|
44224 | PaginationAutoPageSizeService.prototype.checkPageSize = function () {
|
44225 | if (this.notActive()) {
|
44226 | return;
|
44227 | }
|
44228 | var rowHeight = this.gridOptionsService.getRowHeightAsNumber();
|
44229 | var bodyHeight = this.centerRowContainerCon.getViewportSizeFeature().getBodyHeight();
|
44230 | if (bodyHeight > 0) {
|
44231 | var newPageSize = Math.floor(bodyHeight / rowHeight);
|
44232 | this.gridOptionsService.set('paginationPageSize', newPageSize);
|
44233 | }
|
44234 | };
|
44235 | __decorate$B([
|
44236 | Autowired('ctrlsService')
|
44237 | ], PaginationAutoPageSizeService.prototype, "ctrlsService", void 0);
|
44238 | __decorate$B([
|
44239 | PostConstruct
|
44240 | ], PaginationAutoPageSizeService.prototype, "postConstruct", null);
|
44241 | PaginationAutoPageSizeService = __decorate$B([
|
44242 | Bean('paginationAutoPageSizeService')
|
44243 | ], PaginationAutoPageSizeService);
|
44244 | return PaginationAutoPageSizeService;
|
44245 | }(BeanStub));
|
44246 |
|
44247 |
|
44248 |
|
44249 |
|
44250 |
|
44251 |
|
44252 |
|
44253 | var __extends$z = (undefined && undefined.__extends) || (function () {
|
44254 | var extendStatics = function (d, b) {
|
44255 | extendStatics = Object.setPrototypeOf ||
|
44256 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44257 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
44258 | return extendStatics(d, b);
|
44259 | };
|
44260 | return function (d, b) {
|
44261 | extendStatics(d, b);
|
44262 | function __() { this.constructor = d; }
|
44263 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44264 | };
|
44265 | })();
|
44266 | var __decorate$A = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44267 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44268 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44269 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44270 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44271 | };
|
44272 | var ValueCache = (function (_super) {
|
44273 | __extends$z(ValueCache, _super);
|
44274 | function ValueCache() {
|
44275 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
44276 | _this.cacheVersion = 0;
|
44277 | return _this;
|
44278 | }
|
44279 | ValueCache.prototype.init = function () {
|
44280 | this.active = this.gridOptionsService.is('valueCache');
|
44281 | this.neverExpires = this.gridOptionsService.is('valueCacheNeverExpires');
|
44282 | };
|
44283 | ValueCache.prototype.onDataChanged = function () {
|
44284 | if (this.neverExpires) {
|
44285 | return;
|
44286 | }
|
44287 | this.expire();
|
44288 | };
|
44289 | ValueCache.prototype.expire = function () {
|
44290 | this.cacheVersion++;
|
44291 | };
|
44292 | ValueCache.prototype.setValue = function (rowNode, colId, value) {
|
44293 | if (this.active) {
|
44294 | if (rowNode.__cacheVersion !== this.cacheVersion) {
|
44295 | rowNode.__cacheVersion = this.cacheVersion;
|
44296 | rowNode.__cacheData = {};
|
44297 | }
|
44298 | rowNode.__cacheData[colId] = value;
|
44299 | }
|
44300 | };
|
44301 | ValueCache.prototype.getValue = function (rowNode, colId) {
|
44302 | if (!this.active || rowNode.__cacheVersion !== this.cacheVersion) {
|
44303 | return undefined;
|
44304 | }
|
44305 | return rowNode.__cacheData[colId];
|
44306 | };
|
44307 | __decorate$A([
|
44308 | PostConstruct
|
44309 | ], ValueCache.prototype, "init", null);
|
44310 | ValueCache = __decorate$A([
|
44311 | Bean('valueCache')
|
44312 | ], ValueCache);
|
44313 | return ValueCache;
|
44314 | }(BeanStub));
|
44315 |
|
44316 |
|
44317 |
|
44318 |
|
44319 |
|
44320 |
|
44321 |
|
44322 | var __extends$y = (undefined && undefined.__extends) || (function () {
|
44323 | var extendStatics = function (d, b) {
|
44324 | extendStatics = Object.setPrototypeOf ||
|
44325 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44326 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
44327 | return extendStatics(d, b);
|
44328 | };
|
44329 | return function (d, b) {
|
44330 | extendStatics(d, b);
|
44331 | function __() { this.constructor = d; }
|
44332 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44333 | };
|
44334 | })();
|
44335 | var __decorate$z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44336 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44337 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44338 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44339 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44340 | };
|
44341 |
|
44342 | var SOURCE_PASTE = 'paste';
|
44343 | var ChangeDetectionService = (function (_super) {
|
44344 | __extends$y(ChangeDetectionService, _super);
|
44345 | function ChangeDetectionService() {
|
44346 | return _super !== null && _super.apply(this, arguments) || this;
|
44347 | }
|
44348 | ChangeDetectionService.prototype.init = function () {
|
44349 | if (this.rowModel.getType() === 'clientSide') {
|
44350 | this.clientSideRowModel = this.rowModel;
|
44351 | }
|
44352 | this.addManagedListener(this.eventService, Events.EVENT_CELL_VALUE_CHANGED, this.onCellValueChanged.bind(this));
|
44353 | };
|
44354 | ChangeDetectionService.prototype.onCellValueChanged = function (event) {
|
44355 |
|
44356 |
|
44357 |
|
44358 |
|
44359 |
|
44360 |
|
44361 | if (event.source === SOURCE_PASTE) {
|
44362 | return;
|
44363 | }
|
44364 | this.doChangeDetection(event.node, event.column);
|
44365 | };
|
44366 | ChangeDetectionService.prototype.doChangeDetection = function (rowNode, column) {
|
44367 | if (this.gridOptionsService.is('suppressChangeDetection')) {
|
44368 | return;
|
44369 | }
|
44370 |
|
44371 | if (this.clientSideRowModel && !rowNode.isRowPinned()) {
|
44372 | var onlyChangedColumns = this.gridOptionsService.is('aggregateOnlyChangedColumns');
|
44373 | var changedPath = new ChangedPath(onlyChangedColumns, this.clientSideRowModel.getRootNode());
|
44374 | changedPath.addParentNode(rowNode.parent, [column]);
|
44375 | this.clientSideRowModel.doAggregate(changedPath);
|
44376 | }
|
44377 |
|
44378 | this.rowRenderer.refreshCells();
|
44379 | };
|
44380 | __decorate$z([
|
44381 | Autowired('rowModel')
|
44382 | ], ChangeDetectionService.prototype, "rowModel", void 0);
|
44383 | __decorate$z([
|
44384 | Autowired('rowRenderer')
|
44385 | ], ChangeDetectionService.prototype, "rowRenderer", void 0);
|
44386 | __decorate$z([
|
44387 | PostConstruct
|
44388 | ], ChangeDetectionService.prototype, "init", null);
|
44389 | ChangeDetectionService = __decorate$z([
|
44390 | Bean('changeDetectionService')
|
44391 | ], ChangeDetectionService);
|
44392 | return ChangeDetectionService;
|
44393 | }(BeanStub));
|
44394 |
|
44395 |
|
44396 |
|
44397 |
|
44398 |
|
44399 |
|
44400 |
|
44401 | var __extends$x = (undefined && undefined.__extends) || (function () {
|
44402 | var extendStatics = function (d, b) {
|
44403 | extendStatics = Object.setPrototypeOf ||
|
44404 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44405 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
44406 | return extendStatics(d, b);
|
44407 | };
|
44408 | return function (d, b) {
|
44409 | extendStatics(d, b);
|
44410 | function __() { this.constructor = d; }
|
44411 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44412 | };
|
44413 | })();
|
44414 | var __decorate$y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44415 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44416 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44417 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44418 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44419 | };
|
44420 | var AgComponentUtils = (function (_super) {
|
44421 | __extends$x(AgComponentUtils, _super);
|
44422 | function AgComponentUtils() {
|
44423 | return _super !== null && _super.apply(this, arguments) || this;
|
44424 | }
|
44425 | AgComponentUtils.prototype.adaptFunction = function (propertyName, jsCompFunc) {
|
44426 | var metadata = this.componentMetadataProvider.retrieve(propertyName);
|
44427 | if (metadata && metadata.functionAdapter) {
|
44428 | return metadata.functionAdapter(jsCompFunc);
|
44429 | }
|
44430 | return null;
|
44431 | };
|
44432 | AgComponentUtils.prototype.adaptCellRendererFunction = function (callback) {
|
44433 | var Adapter = (function () {
|
44434 | function Adapter() {
|
44435 | }
|
44436 | Adapter.prototype.refresh = function (params) {
|
44437 | return false;
|
44438 | };
|
44439 | Adapter.prototype.getGui = function () {
|
44440 | return this.eGui;
|
44441 | };
|
44442 | Adapter.prototype.init = function (params) {
|
44443 | var callbackResult = callback(params);
|
44444 | var type = typeof callbackResult;
|
44445 | if (type === 'string' || type === 'number' || type === 'boolean') {
|
44446 | this.eGui = loadTemplate('<span>' + callbackResult + '</span>');
|
44447 | return;
|
44448 | }
|
44449 | if (callbackResult == null) {
|
44450 | this.eGui = loadTemplate('<span></span>');
|
44451 | return;
|
44452 | }
|
44453 | this.eGui = callbackResult;
|
44454 | };
|
44455 | return Adapter;
|
44456 | }());
|
44457 | return Adapter;
|
44458 | };
|
44459 | AgComponentUtils.prototype.doesImplementIComponent = function (candidate) {
|
44460 | if (!candidate) {
|
44461 | return false;
|
44462 | }
|
44463 | return candidate.prototype && 'getGui' in candidate.prototype;
|
44464 | };
|
44465 | __decorate$y([
|
44466 | Autowired("componentMetadataProvider")
|
44467 | ], AgComponentUtils.prototype, "componentMetadataProvider", void 0);
|
44468 | AgComponentUtils = __decorate$y([
|
44469 | Bean("agComponentUtils")
|
44470 | ], AgComponentUtils);
|
44471 | return AgComponentUtils;
|
44472 | }(BeanStub));
|
44473 |
|
44474 |
|
44475 |
|
44476 |
|
44477 |
|
44478 |
|
44479 |
|
44480 | var __extends$w = (undefined && undefined.__extends) || (function () {
|
44481 | var extendStatics = function (d, b) {
|
44482 | extendStatics = Object.setPrototypeOf ||
|
44483 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44484 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
44485 | return extendStatics(d, b);
|
44486 | };
|
44487 | return function (d, b) {
|
44488 | extendStatics(d, b);
|
44489 | function __() { this.constructor = d; }
|
44490 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44491 | };
|
44492 | })();
|
44493 | var __decorate$x = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44494 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44495 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44496 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44497 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44498 | };
|
44499 | var ComponentMetadataProvider = (function (_super) {
|
44500 | __extends$w(ComponentMetadataProvider, _super);
|
44501 | function ComponentMetadataProvider() {
|
44502 | return _super !== null && _super.apply(this, arguments) || this;
|
44503 | }
|
44504 | ComponentMetadataProvider.prototype.postConstruct = function () {
|
44505 | this.componentMetaData = {
|
44506 | dateComponent: {
|
44507 | mandatoryMethodList: ['getDate', 'setDate'],
|
44508 | optionalMethodList: ['afterGuiAttached', 'setInputPlaceholder', 'setInputAriaLabel']
|
44509 | },
|
44510 | detailCellRenderer: {
|
44511 | mandatoryMethodList: [],
|
44512 | optionalMethodList: ['refresh'],
|
44513 | functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
|
44514 | },
|
44515 | headerComponent: {
|
44516 | mandatoryMethodList: [],
|
44517 | optionalMethodList: ['refresh']
|
44518 | },
|
44519 | headerGroupComponent: {
|
44520 | mandatoryMethodList: [],
|
44521 | optionalMethodList: []
|
44522 | },
|
44523 | loadingCellRenderer: {
|
44524 | mandatoryMethodList: [],
|
44525 | optionalMethodList: []
|
44526 | },
|
44527 | loadingOverlayComponent: {
|
44528 | mandatoryMethodList: [],
|
44529 | optionalMethodList: []
|
44530 | },
|
44531 | noRowsOverlayComponent: {
|
44532 | mandatoryMethodList: [],
|
44533 | optionalMethodList: []
|
44534 | },
|
44535 | floatingFilterComponent: {
|
44536 | mandatoryMethodList: ['onParentModelChanged'],
|
44537 | optionalMethodList: ['afterGuiAttached']
|
44538 | },
|
44539 | floatingFilterWrapperComponent: {
|
44540 | mandatoryMethodList: [],
|
44541 | optionalMethodList: []
|
44542 | },
|
44543 | cellRenderer: {
|
44544 | mandatoryMethodList: [],
|
44545 | optionalMethodList: ['refresh', 'afterGuiAttached'],
|
44546 | functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
|
44547 | },
|
44548 | cellEditor: {
|
44549 | mandatoryMethodList: ['getValue'],
|
44550 | optionalMethodList: ['isPopup', 'isCancelBeforeStart', 'isCancelAfterEnd', 'getPopupPosition', 'focusIn', 'focusOut', 'afterGuiAttached']
|
44551 | },
|
44552 | innerRenderer: {
|
44553 | mandatoryMethodList: [],
|
44554 | optionalMethodList: ['afterGuiAttached'],
|
44555 | functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
|
44556 | },
|
44557 | fullWidthCellRenderer: {
|
44558 | mandatoryMethodList: [],
|
44559 | optionalMethodList: ['refresh', 'afterGuiAttached'],
|
44560 | functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
|
44561 | },
|
44562 | groupRowRenderer: {
|
44563 | mandatoryMethodList: [],
|
44564 | optionalMethodList: ['afterGuiAttached'],
|
44565 | functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
|
44566 | },
|
44567 | filter: {
|
44568 | mandatoryMethodList: ['isFilterActive', 'doesFilterPass', 'getModel', 'setModel'],
|
44569 | optionalMethodList: ['afterGuiAttached', 'afterGuiDetached', 'onNewRowsLoaded', 'getModelAsString', 'onFloatingFilterChanged', 'onAnyFilterChanged']
|
44570 | },
|
44571 | filterComponent: {
|
44572 | mandatoryMethodList: ['isFilterActive', 'doesFilterPass', 'getModel', 'setModel'],
|
44573 | optionalMethodList: ['afterGuiAttached', 'afterGuiDetached', 'onNewRowsLoaded', 'getModelAsString', 'onFloatingFilterChanged', 'onAnyFilterChanged']
|
44574 | },
|
44575 | statusPanel: {
|
44576 | mandatoryMethodList: [],
|
44577 | optionalMethodList: ['afterGuiAttached'],
|
44578 | },
|
44579 | toolPanel: {
|
44580 | mandatoryMethodList: [],
|
44581 | optionalMethodList: ['refresh', 'afterGuiAttached']
|
44582 | },
|
44583 | tooltipComponent: {
|
44584 | mandatoryMethodList: [],
|
44585 | optionalMethodList: []
|
44586 | }
|
44587 | };
|
44588 | };
|
44589 | ComponentMetadataProvider.prototype.retrieve = function (name) {
|
44590 | return this.componentMetaData[name];
|
44591 | };
|
44592 | __decorate$x([
|
44593 | Autowired("agComponentUtils")
|
44594 | ], ComponentMetadataProvider.prototype, "agComponentUtils", void 0);
|
44595 | __decorate$x([
|
44596 | PostConstruct
|
44597 | ], ComponentMetadataProvider.prototype, "postConstruct", null);
|
44598 | ComponentMetadataProvider = __decorate$x([
|
44599 | Bean("componentMetadataProvider")
|
44600 | ], ComponentMetadataProvider);
|
44601 | return ComponentMetadataProvider;
|
44602 | }(BeanStub));
|
44603 |
|
44604 |
|
44605 |
|
44606 |
|
44607 |
|
44608 |
|
44609 |
|
44610 | var __extends$v = (undefined && undefined.__extends) || (function () {
|
44611 | var extendStatics = function (d, b) {
|
44612 | extendStatics = Object.setPrototypeOf ||
|
44613 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44614 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
44615 | return extendStatics(d, b);
|
44616 | };
|
44617 | return function (d, b) {
|
44618 | extendStatics(d, b);
|
44619 | function __() { this.constructor = d; }
|
44620 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44621 | };
|
44622 | })();
|
44623 | var __decorate$w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44624 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44625 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44626 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44627 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44628 | };
|
44629 | var __read$6 = (undefined && undefined.__read) || function (o, n) {
|
44630 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
44631 | if (!m) return o;
|
44632 | var i = m.call(o), r, ar = [], e;
|
44633 | try {
|
44634 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
44635 | }
|
44636 | catch (error) { e = { error: error }; }
|
44637 | finally {
|
44638 | try {
|
44639 | if (r && !r.done && (m = i["return"])) m.call(i);
|
44640 | }
|
44641 | finally { if (e) throw e.error; }
|
44642 | }
|
44643 | return ar;
|
44644 | };
|
44645 | var __spread$5 = (undefined && undefined.__spread) || function () {
|
44646 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$6(arguments[i]));
|
44647 | return ar;
|
44648 | };
|
44649 | var DEFAULT_ROW_HEIGHT = 25;
|
44650 | var MIN_COL_WIDTH = 10;
|
44651 | var MAT_GRID_SIZE = 8;
|
44652 | var BASE_GRID_SIZE = 4;
|
44653 | var BALHAM_GRID_SIZE = 4;
|
44654 | var ALPINE_GRID_SIZE = 6;
|
44655 | var HARD_CODED_SIZES = {
|
44656 |
|
44657 | 'ag-theme-custom': {
|
44658 | headerHeight: 25,
|
44659 | headerCellMinWidth: 24,
|
44660 | listItemHeight: BASE_GRID_SIZE * 5,
|
44661 | rowHeight: 25,
|
44662 | chartMenuPanelWidth: 220
|
44663 | },
|
44664 | 'ag-theme-material': {
|
44665 | headerHeight: MAT_GRID_SIZE * 7,
|
44666 | headerCellMinWidth: 48,
|
44667 | listItemHeight: MAT_GRID_SIZE * 4,
|
44668 | rowHeight: MAT_GRID_SIZE * 6,
|
44669 | chartMenuPanelWidth: 240
|
44670 | },
|
44671 | 'ag-theme-balham': {
|
44672 | headerHeight: BALHAM_GRID_SIZE * 8,
|
44673 | headerCellMinWidth: 24,
|
44674 | listItemHeight: BALHAM_GRID_SIZE * 6,
|
44675 | rowHeight: BALHAM_GRID_SIZE * 7,
|
44676 | chartMenuPanelWidth: 220
|
44677 | },
|
44678 | 'ag-theme-alpine': {
|
44679 | headerHeight: ALPINE_GRID_SIZE * 8,
|
44680 | headerCellMinWidth: 36,
|
44681 | listItemHeight: ALPINE_GRID_SIZE * 4,
|
44682 | rowHeight: ALPINE_GRID_SIZE * 7,
|
44683 | chartMenuPanelWidth: 240
|
44684 | }
|
44685 | };
|
44686 |
|
44687 |
|
44688 |
|
44689 |
|
44690 |
|
44691 |
|
44692 |
|
44693 |
|
44694 |
|
44695 |
|
44696 | var SASS_PROPERTY_BUILDER = {
|
44697 | headerHeight: ['ag-header-row'],
|
44698 | headerCellMinWidth: ['ag-header-cell'],
|
44699 | listItemHeight: ['ag-virtual-list-item'],
|
44700 | rowHeight: ['ag-row'],
|
44701 | chartMenuPanelWidth: ['ag-chart-docked-container']
|
44702 | };
|
44703 | var Environment = (function (_super) {
|
44704 | __extends$v(Environment, _super);
|
44705 | function Environment() {
|
44706 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
44707 | _this.calculatedSizes = {};
|
44708 | return _this;
|
44709 | }
|
44710 | Environment.prototype.postConstruct = function () {
|
44711 | var _this = this;
|
44712 | var _a;
|
44713 | var el = (_a = this.getTheme().el) !== null && _a !== void 0 ? _a : this.eGridDiv;
|
44714 | this.mutationObserver = new MutationObserver(function () {
|
44715 | _this.calculatedSizes = {};
|
44716 | _this.fireGridStylesChangedEvent();
|
44717 | });
|
44718 | this.mutationObserver.observe(el || this.eGridDiv, {
|
44719 | attributes: true,
|
44720 | attributeFilter: ['class']
|
44721 | });
|
44722 | };
|
44723 | Environment.prototype.fireGridStylesChangedEvent = function () {
|
44724 | var event = {
|
44725 | type: Events.EVENT_GRID_STYLES_CHANGED
|
44726 | };
|
44727 | this.eventService.dispatchEvent(event);
|
44728 | };
|
44729 | Environment.prototype.getSassVariable = function (key) {
|
44730 | var _a = this.getTheme(), themeFamily = _a.themeFamily, el = _a.el;
|
44731 | if (!themeFamily || themeFamily.indexOf('ag-theme') !== 0) {
|
44732 | return;
|
44733 | }
|
44734 | if (!this.calculatedSizes) {
|
44735 | this.calculatedSizes = {};
|
44736 | }
|
44737 | if (!this.calculatedSizes[themeFamily]) {
|
44738 | this.calculatedSizes[themeFamily] = {};
|
44739 | }
|
44740 | var size = this.calculatedSizes[themeFamily][key];
|
44741 | if (size != null) {
|
44742 | return size;
|
44743 | }
|
44744 | this.calculatedSizes[themeFamily][key] = this.calculateValueForSassProperty(key, themeFamily, el);
|
44745 | return this.calculatedSizes[themeFamily][key];
|
44746 | };
|
44747 | Environment.prototype.calculateValueForSassProperty = function (property, theme, themeElement) {
|
44748 | var _a;
|
44749 | var useTheme = 'ag-theme-' + (theme.match('material') ? 'material' : theme.match('balham') ? 'balham' : theme.match('alpine') ? 'alpine' : 'custom');
|
44750 | var defaultValue = HARD_CODED_SIZES[useTheme][property];
|
44751 | var eDocument = this.gridOptionsService.getDocument();
|
44752 | if (!themeElement) {
|
44753 | themeElement = this.eGridDiv;
|
44754 | }
|
44755 | if (!SASS_PROPERTY_BUILDER[property]) {
|
44756 | return defaultValue;
|
44757 | }
|
44758 | var classList = SASS_PROPERTY_BUILDER[property];
|
44759 | var div = eDocument.createElement('div');
|
44760 |
|
44761 | var classesFromThemeElement = Array.from(themeElement.classList);
|
44762 | (_a = div.classList).add.apply(_a, __spread$5([theme], classesFromThemeElement));
|
44763 | div.style.position = 'absolute';
|
44764 | var el = classList.reduce(function (prevEl, currentClass) {
|
44765 | var currentDiv = eDocument.createElement('div');
|
44766 | currentDiv.style.position = 'static';
|
44767 | currentDiv.classList.add(currentClass);
|
44768 | prevEl.appendChild(currentDiv);
|
44769 | return currentDiv;
|
44770 | }, div);
|
44771 | var calculatedValue = 0;
|
44772 | if (eDocument.body) {
|
44773 | eDocument.body.appendChild(div);
|
44774 | var sizeName = property.toLowerCase().indexOf('height') !== -1 ? 'height' : 'width';
|
44775 | calculatedValue = parseInt(window.getComputedStyle(el)[sizeName], 10);
|
44776 | eDocument.body.removeChild(div);
|
44777 | }
|
44778 | return calculatedValue || defaultValue;
|
44779 | };
|
44780 | Environment.prototype.isThemeDark = function () {
|
44781 | var theme = this.getTheme().theme;
|
44782 | return !!theme && theme.indexOf('dark') >= 0;
|
44783 | };
|
44784 | Environment.prototype.chartMenuPanelWidth = function () {
|
44785 | return this.getSassVariable('chartMenuPanelWidth');
|
44786 | };
|
44787 | Environment.prototype.getTheme = function () {
|
44788 | var reg = /\bag-(material|(?:theme-([\w\-]*)))\b/g;
|
44789 | var el = this.eGridDiv;
|
44790 | var themeMatch = null;
|
44791 | var allThemes = [];
|
44792 | while (el) {
|
44793 | themeMatch = reg.exec(el.className);
|
44794 | if (!themeMatch) {
|
44795 | el = el.parentElement || undefined;
|
44796 | }
|
44797 | else {
|
44798 | var matched = el.className.match(reg);
|
44799 | if (matched) {
|
44800 | allThemes = matched;
|
44801 | }
|
44802 | break;
|
44803 | }
|
44804 | }
|
44805 | if (!themeMatch) {
|
44806 | return { allThemes: allThemes };
|
44807 | }
|
44808 | var theme = themeMatch[0];
|
44809 | return { theme: theme, el: el, themeFamily: theme.replace(/-dark$/, ''), allThemes: allThemes };
|
44810 | };
|
44811 | Environment.prototype.getFromTheme = function (defaultValue, sassVariableName) {
|
44812 | var _a;
|
44813 | return (_a = this.getSassVariable(sassVariableName)) !== null && _a !== void 0 ? _a : defaultValue;
|
44814 | };
|
44815 | Environment.prototype.getDefaultRowHeight = function () {
|
44816 | return this.getFromTheme(DEFAULT_ROW_HEIGHT, 'rowHeight');
|
44817 | };
|
44818 | Environment.prototype.getListItemHeight = function () {
|
44819 | return this.getFromTheme(20, 'listItemHeight');
|
44820 | };
|
44821 | Environment.prototype.setRowHeightVariable = function (height) {
|
44822 | var oldRowHeight = this.eGridDiv.style.getPropertyValue('--ag-line-height').trim();
|
44823 | var newRowHeight = height + "px";
|
44824 | if (oldRowHeight != newRowHeight) {
|
44825 | this.eGridDiv.style.setProperty('--ag-line-height', newRowHeight);
|
44826 | }
|
44827 | };
|
44828 | Environment.prototype.getMinColWidth = function () {
|
44829 | var measuredMin = this.getFromTheme(null, 'headerCellMinWidth');
|
44830 | return exists(measuredMin) ? Math.max(measuredMin, MIN_COL_WIDTH) : MIN_COL_WIDTH;
|
44831 | };
|
44832 | Environment.prototype.destroy = function () {
|
44833 | this.calculatedSizes = null;
|
44834 | if (this.mutationObserver) {
|
44835 | this.mutationObserver.disconnect();
|
44836 | }
|
44837 | _super.prototype.destroy.call(this);
|
44838 | };
|
44839 | __decorate$w([
|
44840 | Autowired('eGridDiv')
|
44841 | ], Environment.prototype, "eGridDiv", void 0);
|
44842 | __decorate$w([
|
44843 | PostConstruct
|
44844 | ], Environment.prototype, "postConstruct", null);
|
44845 | Environment = __decorate$w([
|
44846 | Bean('environment')
|
44847 | ], Environment);
|
44848 | return Environment;
|
44849 | }(BeanStub));
|
44850 |
|
44851 |
|
44852 |
|
44853 |
|
44854 |
|
44855 |
|
44856 |
|
44857 | var __extends$u = (undefined && undefined.__extends) || (function () {
|
44858 | var extendStatics = function (d, b) {
|
44859 | extendStatics = Object.setPrototypeOf ||
|
44860 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
44861 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
44862 | return extendStatics(d, b);
|
44863 | };
|
44864 | return function (d, b) {
|
44865 | extendStatics(d, b);
|
44866 | function __() { this.constructor = d; }
|
44867 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44868 | };
|
44869 | })();
|
44870 | var __decorate$v = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
44871 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
44872 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
44873 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
44874 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
44875 | };
|
44876 | var __param$2 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
44877 | return function (target, key) { decorator(target, key, paramIndex); }
|
44878 | };
|
44879 |
|
44880 |
|
44881 |
|
44882 |
|
44883 | var RowContainerHeightService = (function (_super) {
|
44884 | __extends$u(RowContainerHeightService, _super);
|
44885 | function RowContainerHeightService() {
|
44886 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
44887 |
|
44888 | _this.scrollY = 0;
|
44889 |
|
44890 | _this.uiBodyHeight = 0;
|
44891 | return _this;
|
44892 | }
|
44893 | RowContainerHeightService.prototype.agWire = function (loggerFactory) {
|
44894 | this.logger = loggerFactory.create("RowContainerHeightService");
|
44895 | };
|
44896 | RowContainerHeightService.prototype.postConstruct = function () {
|
44897 | this.addManagedListener(this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, this.updateOffset.bind(this));
|
44898 | this.maxDivHeight = getMaxDivHeight();
|
44899 | this.logger.log('maxDivHeight = ' + this.maxDivHeight);
|
44900 | };
|
44901 | RowContainerHeightService.prototype.isStretching = function () {
|
44902 | return this.stretching;
|
44903 | };
|
44904 | RowContainerHeightService.prototype.getDivStretchOffset = function () {
|
44905 | return this.divStretchOffset;
|
44906 | };
|
44907 | RowContainerHeightService.prototype.updateOffset = function () {
|
44908 | if (!this.stretching) {
|
44909 | return;
|
44910 | }
|
44911 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
44912 | var newScrollY = gridBodyCon.getScrollFeature().getVScrollPosition().top;
|
44913 | var newBodyHeight = this.getUiBodyHeight();
|
44914 | var atLeastOneChanged = newScrollY !== this.scrollY || newBodyHeight !== this.uiBodyHeight;
|
44915 | if (atLeastOneChanged) {
|
44916 | this.scrollY = newScrollY;
|
44917 | this.uiBodyHeight = newBodyHeight;
|
44918 | this.calculateOffset();
|
44919 | }
|
44920 | };
|
44921 | RowContainerHeightService.prototype.calculateOffset = function () {
|
44922 | this.setUiContainerHeight(this.maxDivHeight);
|
44923 | this.pixelsToShave = this.modelHeight - this.uiContainerHeight;
|
44924 | this.maxScrollY = this.uiContainerHeight - this.uiBodyHeight;
|
44925 | var scrollPercent = this.scrollY / this.maxScrollY;
|
44926 | var divStretchOffset = scrollPercent * this.pixelsToShave;
|
44927 | this.logger.log("Div Stretch Offset = " + divStretchOffset + " (" + this.pixelsToShave + " * " + scrollPercent + ")");
|
44928 | this.setDivStretchOffset(divStretchOffset);
|
44929 | };
|
44930 | RowContainerHeightService.prototype.setUiContainerHeight = function (height) {
|
44931 | if (height !== this.uiContainerHeight) {
|
44932 | this.uiContainerHeight = height;
|
44933 | this.eventService.dispatchEvent({ type: Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED });
|
44934 | }
|
44935 | };
|
44936 | RowContainerHeightService.prototype.clearOffset = function () {
|
44937 | this.setUiContainerHeight(this.modelHeight);
|
44938 | this.pixelsToShave = 0;
|
44939 | this.setDivStretchOffset(0);
|
44940 | };
|
44941 | RowContainerHeightService.prototype.setDivStretchOffset = function (newOffset) {
|
44942 |
|
44943 | var newOffsetFloor = typeof newOffset === 'number' ? Math.floor(newOffset) : null;
|
44944 | if (this.divStretchOffset === newOffsetFloor) {
|
44945 | return;
|
44946 | }
|
44947 | this.divStretchOffset = newOffsetFloor;
|
44948 | this.eventService.dispatchEvent({ type: Events.EVENT_HEIGHT_SCALE_CHANGED });
|
44949 | };
|
44950 | RowContainerHeightService.prototype.setModelHeight = function (modelHeight) {
|
44951 | this.modelHeight = modelHeight;
|
44952 | this.stretching = modelHeight != null
|
44953 | && this.maxDivHeight > 0
|
44954 | && modelHeight > this.maxDivHeight;
|
44955 | if (this.stretching) {
|
44956 | this.calculateOffset();
|
44957 | }
|
44958 | else {
|
44959 | this.clearOffset();
|
44960 | }
|
44961 | };
|
44962 | RowContainerHeightService.prototype.getUiContainerHeight = function () {
|
44963 | return this.uiContainerHeight;
|
44964 | };
|
44965 | RowContainerHeightService.prototype.getRealPixelPosition = function (modelPixel) {
|
44966 | return modelPixel - this.divStretchOffset;
|
44967 | };
|
44968 | RowContainerHeightService.prototype.getUiBodyHeight = function () {
|
44969 | var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
44970 | var pos = gridBodyCon.getScrollFeature().getVScrollPosition();
|
44971 | return pos.bottom - pos.top;
|
44972 | };
|
44973 | RowContainerHeightService.prototype.getScrollPositionForPixel = function (rowTop) {
|
44974 | if (this.pixelsToShave <= 0) {
|
44975 | return rowTop;
|
44976 | }
|
44977 | var modelMaxScroll = this.modelHeight - this.getUiBodyHeight();
|
44978 | var scrollPercent = rowTop / modelMaxScroll;
|
44979 | var scrollPixel = this.maxScrollY * scrollPercent;
|
44980 | return scrollPixel;
|
44981 | };
|
44982 | __decorate$v([
|
44983 | Autowired('ctrlsService')
|
44984 | ], RowContainerHeightService.prototype, "ctrlsService", void 0);
|
44985 | __decorate$v([
|
44986 | __param$2(0, Qualifier("loggerFactory"))
|
44987 | ], RowContainerHeightService.prototype, "agWire", null);
|
44988 | __decorate$v([
|
44989 | PostConstruct
|
44990 | ], RowContainerHeightService.prototype, "postConstruct", null);
|
44991 | RowContainerHeightService = __decorate$v([
|
44992 | Bean('rowContainerHeightService')
|
44993 | ], RowContainerHeightService);
|
44994 | return RowContainerHeightService;
|
44995 | }(BeanStub));
|
44996 |
|
44997 |
|
44998 |
|
44999 |
|
45000 |
|
45001 |
|
45002 |
|
45003 | var __extends$t = (undefined && undefined.__extends) || (function () {
|
45004 | var extendStatics = function (d, b) {
|
45005 | extendStatics = Object.setPrototypeOf ||
|
45006 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45007 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
45008 | return extendStatics(d, b);
|
45009 | };
|
45010 | return function (d, b) {
|
45011 | extendStatics(d, b);
|
45012 | function __() { this.constructor = d; }
|
45013 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45014 | };
|
45015 | })();
|
45016 | var __decorate$u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45017 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45018 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45019 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45020 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45021 | };
|
45022 | var SelectableService = (function (_super) {
|
45023 | __extends$t(SelectableService, _super);
|
45024 | function SelectableService() {
|
45025 | return _super !== null && _super.apply(this, arguments) || this;
|
45026 | }
|
45027 | SelectableService.prototype.init = function () {
|
45028 | this.groupSelectsChildren = this.gridOptionsService.is('groupSelectsChildren');
|
45029 | this.isRowSelectableFunc = this.gridOptionsService.get('isRowSelectable');
|
45030 | };
|
45031 | SelectableService.prototype.updateSelectableAfterGrouping = function (rowNode) {
|
45032 | if (this.isRowSelectableFunc) {
|
45033 | var nextChildrenFunc = function (node) { return node.childrenAfterGroup; };
|
45034 | this.recurseDown(rowNode.childrenAfterGroup, nextChildrenFunc);
|
45035 | }
|
45036 | };
|
45037 | SelectableService.prototype.recurseDown = function (children, nextChildrenFunc) {
|
45038 | var _this = this;
|
45039 | if (!children) {
|
45040 | return;
|
45041 | }
|
45042 | children.forEach(function (child) {
|
45043 | if (!child.group) {
|
45044 | return;
|
45045 | }
|
45046 | if (child.hasChildren()) {
|
45047 | _this.recurseDown(nextChildrenFunc(child), nextChildrenFunc);
|
45048 | }
|
45049 | var rowSelectable;
|
45050 | if (_this.groupSelectsChildren) {
|
45051 |
|
45052 | var firstSelectable = (nextChildrenFunc(child) || []).find(function (rowNode) { return rowNode.selectable === true; });
|
45053 | rowSelectable = exists(firstSelectable);
|
45054 | }
|
45055 | else {
|
45056 |
|
45057 | rowSelectable = _this.isRowSelectableFunc ? _this.isRowSelectableFunc(child) : false;
|
45058 | }
|
45059 | child.setRowSelectable(rowSelectable);
|
45060 | });
|
45061 | };
|
45062 | __decorate$u([
|
45063 | PostConstruct
|
45064 | ], SelectableService.prototype, "init", null);
|
45065 | SelectableService = __decorate$u([
|
45066 | Bean('selectableService')
|
45067 | ], SelectableService);
|
45068 | return SelectableService;
|
45069 | }(BeanStub));
|
45070 |
|
45071 |
|
45072 |
|
45073 |
|
45074 |
|
45075 |
|
45076 |
|
45077 | var __extends$s = (undefined && undefined.__extends) || (function () {
|
45078 | var extendStatics = function (d, b) {
|
45079 | extendStatics = Object.setPrototypeOf ||
|
45080 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45081 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
45082 | return extendStatics(d, b);
|
45083 | };
|
45084 | return function (d, b) {
|
45085 | extendStatics(d, b);
|
45086 | function __() { this.constructor = d; }
|
45087 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45088 | };
|
45089 | })();
|
45090 | var __decorate$t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45091 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45092 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45093 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45094 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45095 | };
|
45096 | var PaginationComp = (function (_super) {
|
45097 | __extends$s(PaginationComp, _super);
|
45098 | function PaginationComp() {
|
45099 | var _this = _super.call(this) || this;
|
45100 | _this.previousAndFirstButtonsDisabled = false;
|
45101 | _this.nextButtonDisabled = false;
|
45102 | _this.lastButtonDisabled = false;
|
45103 | _this.areListenersSetup = false;
|
45104 | return _this;
|
45105 | }
|
45106 | PaginationComp.prototype.postConstruct = function () {
|
45107 | var isRtl = this.gridOptionsService.is('enableRtl');
|
45108 | this.setTemplate(this.getTemplate());
|
45109 | this.btFirst.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'last' : 'first', this.gridOptionsService));
|
45110 | this.btPrevious.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'next' : 'previous', this.gridOptionsService));
|
45111 | this.btNext.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'previous' : 'next', this.gridOptionsService));
|
45112 | this.btLast.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'first' : 'last', this.gridOptionsService));
|
45113 | this.addManagedPropertyListener('pagination', this.onPaginationChanged.bind(this));
|
45114 | this.addManagedPropertyListener('suppressPaginationPanel', this.onPaginationChanged.bind(this));
|
45115 | this.onPaginationChanged();
|
45116 | };
|
45117 | PaginationComp.prototype.onPaginationChanged = function () {
|
45118 | var isPaging = this.gridOptionsService.is('pagination');
|
45119 | var paginationPanelEnabled = isPaging && !this.gridOptionsService.is('suppressPaginationPanel');
|
45120 | this.setDisplayed(paginationPanelEnabled);
|
45121 | if (!paginationPanelEnabled) {
|
45122 | return;
|
45123 | }
|
45124 | this.setupListeners();
|
45125 | this.enableOrDisableButtons();
|
45126 | this.updateRowLabels();
|
45127 | this.setCurrentPageLabel();
|
45128 | this.setTotalLabels();
|
45129 | };
|
45130 | PaginationComp.prototype.setupListeners = function () {
|
45131 | var _this = this;
|
45132 | if (!this.areListenersSetup) {
|
45133 | this.addManagedListener(this.eventService, Events.EVENT_PAGINATION_CHANGED, this.onPaginationChanged.bind(this));
|
45134 | [
|
45135 | { el: this.btFirst, fn: this.onBtFirst.bind(this) },
|
45136 | { el: this.btPrevious, fn: this.onBtPrevious.bind(this) },
|
45137 | { el: this.btNext, fn: this.onBtNext.bind(this) },
|
45138 | { el: this.btLast, fn: this.onBtLast.bind(this) }
|
45139 | ].forEach(function (item) {
|
45140 | var el = item.el, fn = item.fn;
|
45141 | _this.addManagedListener(el, 'click', fn);
|
45142 | _this.addManagedListener(el, 'keydown', function (e) {
|
45143 | if (e.key === KeyCode.ENTER || e.key === KeyCode.SPACE) {
|
45144 | e.preventDefault();
|
45145 | fn();
|
45146 | }
|
45147 | });
|
45148 | });
|
45149 | this.areListenersSetup = true;
|
45150 | }
|
45151 | };
|
45152 | PaginationComp.prototype.onBtFirst = function () {
|
45153 | if (!this.previousAndFirstButtonsDisabled) {
|
45154 | this.paginationProxy.goToFirstPage();
|
45155 | }
|
45156 | };
|
45157 | PaginationComp.prototype.setCurrentPageLabel = function () {
|
45158 | var pagesExist = this.paginationProxy.getTotalPages() > 0;
|
45159 | var currentPage = this.paginationProxy.getCurrentPage();
|
45160 | var toDisplay = pagesExist ? currentPage + 1 : 0;
|
45161 | this.lbCurrent.innerHTML = this.formatNumber(toDisplay);
|
45162 | };
|
45163 | PaginationComp.prototype.formatNumber = function (value) {
|
45164 | var userFunc = this.gridOptionsService.getCallback('paginationNumberFormatter');
|
45165 | if (userFunc) {
|
45166 | var params = { value: value };
|
45167 | return userFunc(params);
|
45168 | }
|
45169 | var localeTextFunc = this.localeService.getLocaleTextFunc();
|
45170 | var thousandSeparator = localeTextFunc('thousandSeparator', ',');
|
45171 | var decimalSeparator = localeTextFunc('decimalSeparator', '.');
|
45172 | return formatNumberCommas(value, thousandSeparator, decimalSeparator);
|
45173 | };
|
45174 | PaginationComp.prototype.getTemplate = function () {
|
45175 | var localeTextFunc = this.localeService.getLocaleTextFunc();
|
45176 | var strPage = localeTextFunc('page', 'Page');
|
45177 | var strTo = localeTextFunc('to', 'to');
|
45178 | var strOf = localeTextFunc('of', 'of');
|
45179 | var strFirst = localeTextFunc('firstPage', 'First Page');
|
45180 | var strPrevious = localeTextFunc('previousPage', 'Previous Page');
|
45181 | var strNext = localeTextFunc('nextPage', 'Next Page');
|
45182 | var strLast = localeTextFunc('lastPage', 'Last Page');
|
45183 | var compId = this.getCompId();
|
45184 | 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>";
|
45185 | };
|
45186 | PaginationComp.prototype.onBtNext = function () {
|
45187 | if (!this.nextButtonDisabled) {
|
45188 | this.paginationProxy.goToNextPage();
|
45189 | }
|
45190 | };
|
45191 | PaginationComp.prototype.onBtPrevious = function () {
|
45192 | if (!this.previousAndFirstButtonsDisabled) {
|
45193 | this.paginationProxy.goToPreviousPage();
|
45194 | }
|
45195 | };
|
45196 | PaginationComp.prototype.onBtLast = function () {
|
45197 | if (!this.lastButtonDisabled) {
|
45198 | this.paginationProxy.goToLastPage();
|
45199 | }
|
45200 | };
|
45201 | PaginationComp.prototype.enableOrDisableButtons = function () {
|
45202 | var currentPage = this.paginationProxy.getCurrentPage();
|
45203 | var maxRowFound = this.paginationProxy.isLastPageFound();
|
45204 | var totalPages = this.paginationProxy.getTotalPages();
|
45205 | this.previousAndFirstButtonsDisabled = currentPage === 0;
|
45206 | this.toggleButtonDisabled(this.btFirst, this.previousAndFirstButtonsDisabled);
|
45207 | this.toggleButtonDisabled(this.btPrevious, this.previousAndFirstButtonsDisabled);
|
45208 | var zeroPagesToDisplay = this.isZeroPagesToDisplay();
|
45209 | var onLastPage = maxRowFound && currentPage === (totalPages - 1);
|
45210 | this.nextButtonDisabled = onLastPage || zeroPagesToDisplay;
|
45211 | this.lastButtonDisabled = !maxRowFound || zeroPagesToDisplay || currentPage === (totalPages - 1);
|
45212 | this.toggleButtonDisabled(this.btNext, this.nextButtonDisabled);
|
45213 | this.toggleButtonDisabled(this.btLast, this.lastButtonDisabled);
|
45214 | };
|
45215 | PaginationComp.prototype.toggleButtonDisabled = function (button, disabled) {
|
45216 | setAriaDisabled(button, disabled);
|
45217 | button.classList.toggle('ag-disabled', disabled);
|
45218 | if (disabled) {
|
45219 | button.removeAttribute('tabindex');
|
45220 | }
|
45221 | else {
|
45222 | button.setAttribute('tabindex', '0');
|
45223 | }
|
45224 | };
|
45225 | PaginationComp.prototype.updateRowLabels = function () {
|
45226 | var currentPage = this.paginationProxy.getCurrentPage();
|
45227 | var pageSize = this.paginationProxy.getPageSize();
|
45228 | var maxRowFound = this.paginationProxy.isLastPageFound();
|
45229 | var rowCount = this.paginationProxy.isLastPageFound() ?
|
45230 | this.paginationProxy.getMasterRowCount() : null;
|
45231 | var startRow;
|
45232 | var endRow;
|
45233 | if (this.isZeroPagesToDisplay()) {
|
45234 | startRow = endRow = 0;
|
45235 | }
|
45236 | else {
|
45237 | startRow = (pageSize * currentPage) + 1;
|
45238 | endRow = startRow + pageSize - 1;
|
45239 | if (maxRowFound && endRow > rowCount) {
|
45240 | endRow = rowCount;
|
45241 | }
|
45242 | }
|
45243 | this.lbFirstRowOnPage.innerHTML = this.formatNumber(startRow);
|
45244 | if (this.rowNodeBlockLoader.isLoading()) {
|
45245 | this.lbLastRowOnPage.innerHTML = '?';
|
45246 | }
|
45247 | else {
|
45248 | this.lbLastRowOnPage.innerHTML = this.formatNumber(endRow);
|
45249 | }
|
45250 | };
|
45251 | PaginationComp.prototype.isZeroPagesToDisplay = function () {
|
45252 | var maxRowFound = this.paginationProxy.isLastPageFound();
|
45253 | var totalPages = this.paginationProxy.getTotalPages();
|
45254 | return maxRowFound && totalPages === 0;
|
45255 | };
|
45256 | PaginationComp.prototype.setTotalLabels = function () {
|
45257 | var lastPageFound = this.paginationProxy.isLastPageFound();
|
45258 | var totalPages = this.paginationProxy.getTotalPages();
|
45259 | var rowCount = lastPageFound ? this.paginationProxy.getMasterRowCount() : null;
|
45260 |
|
45261 |
|
45262 |
|
45263 | if (rowCount === 1) {
|
45264 | var firstRow = this.paginationProxy.getRow(0);
|
45265 |
|
45266 | var hiddenGroupRow = firstRow && firstRow.group && !(firstRow.groupData || firstRow.aggData);
|
45267 | if (hiddenGroupRow) {
|
45268 | this.setTotalLabelsToZero();
|
45269 | return;
|
45270 | }
|
45271 | }
|
45272 | if (lastPageFound) {
|
45273 | this.lbTotal.innerHTML = this.formatNumber(totalPages);
|
45274 | this.lbRecordCount.innerHTML = this.formatNumber(rowCount);
|
45275 | }
|
45276 | else {
|
45277 | var moreText = this.localeService.getLocaleTextFunc()('more', 'more');
|
45278 | this.lbTotal.innerHTML = moreText;
|
45279 | this.lbRecordCount.innerHTML = moreText;
|
45280 | }
|
45281 | };
|
45282 | PaginationComp.prototype.setTotalLabelsToZero = function () {
|
45283 | this.lbFirstRowOnPage.innerHTML = this.formatNumber(0);
|
45284 | this.lbCurrent.innerHTML = this.formatNumber(0);
|
45285 | this.lbLastRowOnPage.innerHTML = this.formatNumber(0);
|
45286 | this.lbTotal.innerHTML = this.formatNumber(0);
|
45287 | this.lbRecordCount.innerHTML = this.formatNumber(0);
|
45288 | };
|
45289 | __decorate$t([
|
45290 | Autowired('paginationProxy')
|
45291 | ], PaginationComp.prototype, "paginationProxy", void 0);
|
45292 | __decorate$t([
|
45293 | Autowired('rowNodeBlockLoader')
|
45294 | ], PaginationComp.prototype, "rowNodeBlockLoader", void 0);
|
45295 | __decorate$t([
|
45296 | RefSelector('btFirst')
|
45297 | ], PaginationComp.prototype, "btFirst", void 0);
|
45298 | __decorate$t([
|
45299 | RefSelector('btPrevious')
|
45300 | ], PaginationComp.prototype, "btPrevious", void 0);
|
45301 | __decorate$t([
|
45302 | RefSelector('btNext')
|
45303 | ], PaginationComp.prototype, "btNext", void 0);
|
45304 | __decorate$t([
|
45305 | RefSelector('btLast')
|
45306 | ], PaginationComp.prototype, "btLast", void 0);
|
45307 | __decorate$t([
|
45308 | RefSelector('lbRecordCount')
|
45309 | ], PaginationComp.prototype, "lbRecordCount", void 0);
|
45310 | __decorate$t([
|
45311 | RefSelector('lbFirstRowOnPage')
|
45312 | ], PaginationComp.prototype, "lbFirstRowOnPage", void 0);
|
45313 | __decorate$t([
|
45314 | RefSelector('lbLastRowOnPage')
|
45315 | ], PaginationComp.prototype, "lbLastRowOnPage", void 0);
|
45316 | __decorate$t([
|
45317 | RefSelector('lbCurrent')
|
45318 | ], PaginationComp.prototype, "lbCurrent", void 0);
|
45319 | __decorate$t([
|
45320 | RefSelector('lbTotal')
|
45321 | ], PaginationComp.prototype, "lbTotal", void 0);
|
45322 | __decorate$t([
|
45323 | PostConstruct
|
45324 | ], PaginationComp.prototype, "postConstruct", null);
|
45325 | return PaginationComp;
|
45326 | }(Component));
|
45327 |
|
45328 |
|
45329 |
|
45330 |
|
45331 |
|
45332 |
|
45333 |
|
45334 | var __extends$r = (undefined && undefined.__extends) || (function () {
|
45335 | var extendStatics = function (d, b) {
|
45336 | extendStatics = Object.setPrototypeOf ||
|
45337 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45338 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
45339 | return extendStatics(d, b);
|
45340 | };
|
45341 | return function (d, b) {
|
45342 | extendStatics(d, b);
|
45343 | function __() { this.constructor = d; }
|
45344 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45345 | };
|
45346 | })();
|
45347 | var __decorate$s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45348 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45349 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45350 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45351 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45352 | };
|
45353 | var LoadingType;
|
45354 | (function (LoadingType) {
|
45355 | LoadingType[LoadingType["Loading"] = 0] = "Loading";
|
45356 | LoadingType[LoadingType["NoRows"] = 1] = "NoRows";
|
45357 | })(LoadingType || (LoadingType = {}));
|
45358 | var OverlayWrapperComponent = (function (_super) {
|
45359 | __extends$r(OverlayWrapperComponent, _super);
|
45360 | function OverlayWrapperComponent() {
|
45361 | var _this = _super.call(this, OverlayWrapperComponent.TEMPLATE) || this;
|
45362 | _this.inProgress = false;
|
45363 | _this.destroyRequested = false;
|
45364 | _this.manuallyDisplayed = false;
|
45365 | return _this;
|
45366 | }
|
45367 | OverlayWrapperComponent.prototype.updateLayoutClasses = function (cssClass, params) {
|
45368 | var overlayWrapperClassList = this.eOverlayWrapper.classList;
|
45369 | overlayWrapperClassList.toggle(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
|
45370 | overlayWrapperClassList.toggle(LayoutCssClasses.NORMAL, params.normal);
|
45371 | overlayWrapperClassList.toggle(LayoutCssClasses.PRINT, params.print);
|
45372 | };
|
45373 | OverlayWrapperComponent.prototype.postConstruct = function () {
|
45374 | this.createManagedBean(new LayoutFeature(this));
|
45375 | this.setDisplayed(false, { skipAriaHidden: true });
|
45376 | this.addManagedListener(this.eventService, Events.EVENT_ROW_DATA_UPDATED, this.onRowDataUpdated.bind(this));
|
45377 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onNewColumnsLoaded.bind(this));
|
45378 | if (this.gridOptionsService.isRowModelType('clientSide') && !this.gridOptionsService.get('rowData')) {
|
45379 | this.showLoadingOverlay();
|
45380 | }
|
45381 | this.gridApi.registerOverlayWrapperComp(this);
|
45382 | };
|
45383 | OverlayWrapperComponent.prototype.setWrapperTypeClass = function (loadingType) {
|
45384 | var overlayWrapperClassList = this.eOverlayWrapper.classList;
|
45385 | overlayWrapperClassList.toggle('ag-overlay-loading-wrapper', loadingType === LoadingType.Loading);
|
45386 | overlayWrapperClassList.toggle('ag-overlay-no-rows-wrapper', loadingType === LoadingType.NoRows);
|
45387 | };
|
45388 | OverlayWrapperComponent.prototype.showLoadingOverlay = function () {
|
45389 | if (this.gridOptionsService.is('suppressLoadingOverlay')) {
|
45390 | return;
|
45391 | }
|
45392 | var params = {};
|
45393 | var compDetails = this.userComponentFactory.getLoadingOverlayCompDetails(params);
|
45394 | var promise = compDetails.newAgStackInstance();
|
45395 | this.showOverlay(promise, LoadingType.Loading);
|
45396 | };
|
45397 | OverlayWrapperComponent.prototype.showNoRowsOverlay = function () {
|
45398 | if (this.gridOptionsService.is('suppressNoRowsOverlay')) {
|
45399 | return;
|
45400 | }
|
45401 | var params = {};
|
45402 | var compDetails = this.userComponentFactory.getNoRowsOverlayCompDetails(params);
|
45403 | var promise = compDetails.newAgStackInstance();
|
45404 | this.showOverlay(promise, LoadingType.NoRows);
|
45405 | };
|
45406 | OverlayWrapperComponent.prototype.showOverlay = function (workItem, type) {
|
45407 | var _this = this;
|
45408 | if (this.inProgress) {
|
45409 | return;
|
45410 | }
|
45411 | this.setWrapperTypeClass(type);
|
45412 | this.destroyActiveOverlay();
|
45413 | this.inProgress = true;
|
45414 | if (workItem) {
|
45415 | workItem.then(function (comp) {
|
45416 | _this.inProgress = false;
|
45417 | _this.eOverlayWrapper.appendChild(comp.getGui());
|
45418 | _this.activeOverlay = comp;
|
45419 | if (_this.destroyRequested) {
|
45420 | _this.destroyRequested = false;
|
45421 | _this.destroyActiveOverlay();
|
45422 | }
|
45423 | });
|
45424 | }
|
45425 | this.manuallyDisplayed = this.columnModel.isReady() && !this.paginationProxy.isEmpty();
|
45426 | this.setDisplayed(true, { skipAriaHidden: true });
|
45427 | };
|
45428 | OverlayWrapperComponent.prototype.destroyActiveOverlay = function () {
|
45429 | if (this.inProgress) {
|
45430 | this.destroyRequested = true;
|
45431 | return;
|
45432 | }
|
45433 | if (!this.activeOverlay) {
|
45434 | return;
|
45435 | }
|
45436 | this.activeOverlay = this.getContext().destroyBean(this.activeOverlay);
|
45437 | clearElement(this.eOverlayWrapper);
|
45438 | };
|
45439 | OverlayWrapperComponent.prototype.hideOverlay = function () {
|
45440 | this.manuallyDisplayed = false;
|
45441 | this.destroyActiveOverlay();
|
45442 | this.setDisplayed(false, { skipAriaHidden: true });
|
45443 | };
|
45444 | OverlayWrapperComponent.prototype.destroy = function () {
|
45445 | this.destroyActiveOverlay();
|
45446 | _super.prototype.destroy.call(this);
|
45447 | };
|
45448 | OverlayWrapperComponent.prototype.showOrHideOverlay = function () {
|
45449 | var isEmpty = this.paginationProxy.isEmpty();
|
45450 | var isSuppressNoRowsOverlay = this.gridOptionsService.is('suppressNoRowsOverlay');
|
45451 | if (isEmpty && !isSuppressNoRowsOverlay) {
|
45452 | this.showNoRowsOverlay();
|
45453 | }
|
45454 | else {
|
45455 | this.hideOverlay();
|
45456 | }
|
45457 | };
|
45458 | OverlayWrapperComponent.prototype.onRowDataUpdated = function () {
|
45459 | this.showOrHideOverlay();
|
45460 | };
|
45461 | OverlayWrapperComponent.prototype.onNewColumnsLoaded = function () {
|
45462 |
|
45463 |
|
45464 |
|
45465 |
|
45466 | if (this.columnModel.isReady() && !this.paginationProxy.isEmpty() && !this.manuallyDisplayed) {
|
45467 | this.hideOverlay();
|
45468 | }
|
45469 | };
|
45470 |
|
45471 | 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>";
|
45472 | __decorate$s([
|
45473 | Autowired('userComponentFactory')
|
45474 | ], OverlayWrapperComponent.prototype, "userComponentFactory", void 0);
|
45475 | __decorate$s([
|
45476 | Autowired('paginationProxy')
|
45477 | ], OverlayWrapperComponent.prototype, "paginationProxy", void 0);
|
45478 | __decorate$s([
|
45479 | Autowired('gridApi')
|
45480 | ], OverlayWrapperComponent.prototype, "gridApi", void 0);
|
45481 | __decorate$s([
|
45482 | Autowired('columnModel')
|
45483 | ], OverlayWrapperComponent.prototype, "columnModel", void 0);
|
45484 | __decorate$s([
|
45485 | RefSelector('eOverlayWrapper')
|
45486 | ], OverlayWrapperComponent.prototype, "eOverlayWrapper", void 0);
|
45487 | __decorate$s([
|
45488 | PostConstruct
|
45489 | ], OverlayWrapperComponent.prototype, "postConstruct", null);
|
45490 | return OverlayWrapperComponent;
|
45491 | }(Component));
|
45492 |
|
45493 |
|
45494 |
|
45495 |
|
45496 |
|
45497 |
|
45498 |
|
45499 | var __extends$q = (undefined && undefined.__extends) || (function () {
|
45500 | var extendStatics = function (d, b) {
|
45501 | extendStatics = Object.setPrototypeOf ||
|
45502 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45503 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
45504 | return extendStatics(d, b);
|
45505 | };
|
45506 | return function (d, b) {
|
45507 | extendStatics(d, b);
|
45508 | function __() { this.constructor = d; }
|
45509 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45510 | };
|
45511 | })();
|
45512 | var __decorate$r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45513 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45514 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45515 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45516 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45517 | };
|
45518 | var RowPositionUtils = (function (_super) {
|
45519 | __extends$q(RowPositionUtils, _super);
|
45520 | function RowPositionUtils() {
|
45521 | return _super !== null && _super.apply(this, arguments) || this;
|
45522 | }
|
45523 | RowPositionUtils.prototype.getFirstRow = function () {
|
45524 | var rowIndex = 0;
|
45525 | var rowPinned;
|
45526 | if (this.pinnedRowModel.getPinnedTopRowCount()) {
|
45527 | rowPinned = 'top';
|
45528 | }
|
45529 | else if (this.rowModel.getRowCount()) {
|
45530 | rowPinned = null;
|
45531 | rowIndex = this.paginationProxy.getPageFirstRow();
|
45532 | }
|
45533 | else if (this.pinnedRowModel.getPinnedBottomRowCount()) {
|
45534 | rowPinned = 'bottom';
|
45535 | }
|
45536 | return rowPinned === undefined ? null : { rowIndex: rowIndex, rowPinned: rowPinned };
|
45537 | };
|
45538 | RowPositionUtils.prototype.getLastRow = function () {
|
45539 | var rowIndex;
|
45540 | var rowPinned = null;
|
45541 | var pinnedBottomCount = this.pinnedRowModel.getPinnedBottomRowCount();
|
45542 | var pinnedTopCount = this.pinnedRowModel.getPinnedTopRowCount();
|
45543 | if (pinnedBottomCount) {
|
45544 | rowPinned = 'bottom';
|
45545 | rowIndex = pinnedBottomCount - 1;
|
45546 | }
|
45547 | else if (this.rowModel.getRowCount()) {
|
45548 | rowPinned = null;
|
45549 | rowIndex = this.paginationProxy.getPageLastRow();
|
45550 | }
|
45551 | else if (pinnedTopCount) {
|
45552 | rowPinned = 'top';
|
45553 | rowIndex = pinnedTopCount - 1;
|
45554 | }
|
45555 | return rowIndex === undefined ? null : { rowIndex: rowIndex, rowPinned: rowPinned };
|
45556 | };
|
45557 | RowPositionUtils.prototype.getRowNode = function (gridRow) {
|
45558 | switch (gridRow.rowPinned) {
|
45559 | case 'top':
|
45560 | return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];
|
45561 | case 'bottom':
|
45562 | return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];
|
45563 | default:
|
45564 | return this.rowModel.getRow(gridRow.rowIndex);
|
45565 | }
|
45566 | };
|
45567 | RowPositionUtils.prototype.sameRow = function (rowA, rowB) {
|
45568 |
|
45569 | if (!rowA && !rowB) {
|
45570 | return true;
|
45571 | }
|
45572 |
|
45573 | if ((rowA && !rowB) || (!rowA && rowB)) {
|
45574 | return false;
|
45575 | }
|
45576 |
|
45577 | return rowA.rowIndex === rowB.rowIndex && rowA.rowPinned == rowB.rowPinned;
|
45578 | };
|
45579 |
|
45580 | RowPositionUtils.prototype.before = function (rowA, rowB) {
|
45581 | switch (rowA.rowPinned) {
|
45582 | case 'top':
|
45583 |
|
45584 | if (rowB.rowPinned !== 'top') {
|
45585 | return true;
|
45586 | }
|
45587 | break;
|
45588 | case 'bottom':
|
45589 |
|
45590 | if (rowB.rowPinned !== 'bottom') {
|
45591 | return false;
|
45592 | }
|
45593 | break;
|
45594 | default:
|
45595 |
|
45596 | if (exists(rowB.rowPinned)) {
|
45597 | return rowB.rowPinned !== 'top';
|
45598 | }
|
45599 | break;
|
45600 | }
|
45601 | return rowA.rowIndex < rowB.rowIndex;
|
45602 | };
|
45603 | RowPositionUtils.prototype.rowMax = function (rows) {
|
45604 | var _this = this;
|
45605 | var max;
|
45606 | rows.forEach(function (row) {
|
45607 | if (max === undefined || _this.before(max, row)) {
|
45608 | max = row;
|
45609 | }
|
45610 | });
|
45611 | return max;
|
45612 | };
|
45613 | RowPositionUtils.prototype.rowMin = function (rows) {
|
45614 | var _this = this;
|
45615 | var min;
|
45616 | rows.forEach(function (row) {
|
45617 | if (min === undefined || _this.before(row, min)) {
|
45618 | min = row;
|
45619 | }
|
45620 | });
|
45621 | return min;
|
45622 | };
|
45623 | __decorate$r([
|
45624 | Autowired('rowModel')
|
45625 | ], RowPositionUtils.prototype, "rowModel", void 0);
|
45626 | __decorate$r([
|
45627 | Autowired('pinnedRowModel')
|
45628 | ], RowPositionUtils.prototype, "pinnedRowModel", void 0);
|
45629 | __decorate$r([
|
45630 | Autowired('paginationProxy')
|
45631 | ], RowPositionUtils.prototype, "paginationProxy", void 0);
|
45632 | RowPositionUtils = __decorate$r([
|
45633 | Bean('rowPositionUtils')
|
45634 | ], RowPositionUtils);
|
45635 | return RowPositionUtils;
|
45636 | }(BeanStub));
|
45637 |
|
45638 |
|
45639 |
|
45640 |
|
45641 |
|
45642 |
|
45643 |
|
45644 | var __extends$p = (undefined && undefined.__extends) || (function () {
|
45645 | var extendStatics = function (d, b) {
|
45646 | extendStatics = Object.setPrototypeOf ||
|
45647 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45648 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
45649 | return extendStatics(d, b);
|
45650 | };
|
45651 | return function (d, b) {
|
45652 | extendStatics(d, b);
|
45653 | function __() { this.constructor = d; }
|
45654 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45655 | };
|
45656 | })();
|
45657 | var __decorate$q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45658 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45659 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45660 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45661 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45662 | };
|
45663 | var CellPositionUtils = (function (_super) {
|
45664 | __extends$p(CellPositionUtils, _super);
|
45665 | function CellPositionUtils() {
|
45666 | return _super !== null && _super.apply(this, arguments) || this;
|
45667 | }
|
45668 | CellPositionUtils.prototype.createId = function (cellPosition) {
|
45669 | var rowIndex = cellPosition.rowIndex, rowPinned = cellPosition.rowPinned, column = cellPosition.column;
|
45670 | return this.createIdFromValues({ rowIndex: rowIndex, column: column, rowPinned: rowPinned });
|
45671 | };
|
45672 | CellPositionUtils.prototype.createIdFromValues = function (cellPosition) {
|
45673 | var rowIndex = cellPosition.rowIndex, rowPinned = cellPosition.rowPinned, column = cellPosition.column;
|
45674 | return rowIndex + "." + (rowPinned == null ? 'null' : rowPinned) + "." + column.getId();
|
45675 | };
|
45676 | CellPositionUtils.prototype.equals = function (cellA, cellB) {
|
45677 | var colsMatch = cellA.column === cellB.column;
|
45678 | var floatingMatch = cellA.rowPinned === cellB.rowPinned;
|
45679 | var indexMatch = cellA.rowIndex === cellB.rowIndex;
|
45680 | return colsMatch && floatingMatch && indexMatch;
|
45681 | };
|
45682 | CellPositionUtils = __decorate$q([
|
45683 | Bean('cellPositionUtils')
|
45684 | ], CellPositionUtils);
|
45685 | return CellPositionUtils;
|
45686 | }(BeanStub));
|
45687 |
|
45688 |
|
45689 |
|
45690 |
|
45691 |
|
45692 |
|
45693 |
|
45694 | var __extends$o = (undefined && undefined.__extends) || (function () {
|
45695 | var extendStatics = function (d, b) {
|
45696 | extendStatics = Object.setPrototypeOf ||
|
45697 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45698 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
45699 | return extendStatics(d, b);
|
45700 | };
|
45701 | return function (d, b) {
|
45702 | extendStatics(d, b);
|
45703 | function __() { this.constructor = d; }
|
45704 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45705 | };
|
45706 | })();
|
45707 | var UndoRedoAction = (function () {
|
45708 | function UndoRedoAction(cellValueChanges) {
|
45709 | this.cellValueChanges = cellValueChanges;
|
45710 | }
|
45711 | return UndoRedoAction;
|
45712 | }());
|
45713 | var RangeUndoRedoAction = (function (_super) {
|
45714 | __extends$o(RangeUndoRedoAction, _super);
|
45715 | function RangeUndoRedoAction(cellValueChanges, initialRange, finalRange, ranges) {
|
45716 | var _this = _super.call(this, cellValueChanges) || this;
|
45717 | _this.initialRange = initialRange;
|
45718 | _this.finalRange = finalRange;
|
45719 | _this.ranges = ranges;
|
45720 | return _this;
|
45721 | }
|
45722 | return RangeUndoRedoAction;
|
45723 | }(UndoRedoAction));
|
45724 | var UndoRedoStack = (function () {
|
45725 | function UndoRedoStack(maxStackSize) {
|
45726 | this.actionStack = [];
|
45727 | this.maxStackSize = maxStackSize ? maxStackSize : UndoRedoStack.DEFAULT_STACK_SIZE;
|
45728 | this.actionStack = new Array(this.maxStackSize);
|
45729 | }
|
45730 | UndoRedoStack.prototype.pop = function () {
|
45731 | return this.actionStack.pop();
|
45732 | };
|
45733 | UndoRedoStack.prototype.push = function (item) {
|
45734 | var shouldAddActions = item.cellValueChanges && item.cellValueChanges.length > 0;
|
45735 | if (!shouldAddActions) {
|
45736 | return;
|
45737 | }
|
45738 | if (this.actionStack.length === this.maxStackSize) {
|
45739 | this.actionStack.shift();
|
45740 | }
|
45741 | this.actionStack.push(item);
|
45742 | };
|
45743 | UndoRedoStack.prototype.clear = function () {
|
45744 | this.actionStack = [];
|
45745 | };
|
45746 | UndoRedoStack.prototype.getCurrentStackSize = function () {
|
45747 | return this.actionStack.length;
|
45748 | };
|
45749 | UndoRedoStack.DEFAULT_STACK_SIZE = 10;
|
45750 | return UndoRedoStack;
|
45751 | }());
|
45752 |
|
45753 |
|
45754 |
|
45755 |
|
45756 |
|
45757 |
|
45758 |
|
45759 | var __extends$n = (undefined && undefined.__extends) || (function () {
|
45760 | var extendStatics = function (d, b) {
|
45761 | extendStatics = Object.setPrototypeOf ||
|
45762 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
45763 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
45764 | return extendStatics(d, b);
|
45765 | };
|
45766 | return function (d, b) {
|
45767 | extendStatics(d, b);
|
45768 | function __() { this.constructor = d; }
|
45769 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45770 | };
|
45771 | })();
|
45772 | var __assign$1 = (undefined && undefined.__assign) || function () {
|
45773 | __assign$1 = Object.assign || function(t) {
|
45774 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
45775 | s = arguments[i];
|
45776 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
45777 | t[p] = s[p];
|
45778 | }
|
45779 | return t;
|
45780 | };
|
45781 | return __assign$1.apply(this, arguments);
|
45782 | };
|
45783 | var __decorate$p = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
45784 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
45785 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
45786 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
45787 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
45788 | };
|
45789 | var __read$5 = (undefined && undefined.__read) || function (o, n) {
|
45790 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
45791 | if (!m) return o;
|
45792 | var i = m.call(o), r, ar = [], e;
|
45793 | try {
|
45794 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
45795 | }
|
45796 | catch (error) { e = { error: error }; }
|
45797 | finally {
|
45798 | try {
|
45799 | if (r && !r.done && (m = i["return"])) m.call(i);
|
45800 | }
|
45801 | finally { if (e) throw e.error; }
|
45802 | }
|
45803 | return ar;
|
45804 | };
|
45805 | var __spread$4 = (undefined && undefined.__spread) || function () {
|
45806 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$5(arguments[i]));
|
45807 | return ar;
|
45808 | };
|
45809 | var UndoRedoService = (function (_super) {
|
45810 | __extends$n(UndoRedoService, _super);
|
45811 | function UndoRedoService() {
|
45812 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
45813 | _this.cellValueChanges = [];
|
45814 | _this.activeCellEdit = null;
|
45815 | _this.activeRowEdit = null;
|
45816 | _this.isPasting = false;
|
45817 | _this.isRangeInAction = false;
|
45818 | _this.onCellValueChanged = function (event) {
|
45819 | var eventCell = { column: event.column, rowIndex: event.rowIndex, rowPinned: event.rowPinned };
|
45820 | var isCellEditing = _this.activeCellEdit !== null && _this.cellPositionUtils.equals(_this.activeCellEdit, eventCell);
|
45821 | var isRowEditing = _this.activeRowEdit !== null && _this.rowPositionUtils.sameRow(_this.activeRowEdit, eventCell);
|
45822 | var shouldCaptureAction = isCellEditing || isRowEditing || _this.isPasting || _this.isRangeInAction;
|
45823 | if (!shouldCaptureAction) {
|
45824 | return;
|
45825 | }
|
45826 | var rowPinned = event.rowPinned, rowIndex = event.rowIndex, column = event.column, oldValue = event.oldValue, value = event.value;
|
45827 | var cellValueChange = {
|
45828 | rowPinned: rowPinned,
|
45829 | rowIndex: rowIndex,
|
45830 | columnId: column.getColId(),
|
45831 | newValue: value,
|
45832 | oldValue: oldValue
|
45833 | };
|
45834 | _this.cellValueChanges.push(cellValueChange);
|
45835 | };
|
45836 | _this.clearStacks = function () {
|
45837 | _this.undoStack.clear();
|
45838 | _this.redoStack.clear();
|
45839 | };
|
45840 | return _this;
|
45841 | }
|
45842 | UndoRedoService.prototype.init = function () {
|
45843 | var _this = this;
|
45844 | if (!this.gridOptionsService.is('undoRedoCellEditing')) {
|
45845 | return;
|
45846 | }
|
45847 | var undoRedoLimit = this.gridOptionsService.getNum('undoRedoCellEditingLimit');
|
45848 | if (undoRedoLimit <= 0) {
|
45849 | return;
|
45850 | }
|
45851 | this.undoStack = new UndoRedoStack(undoRedoLimit);
|
45852 | this.redoStack = new UndoRedoStack(undoRedoLimit);
|
45853 | this.addRowEditingListeners();
|
45854 | this.addCellEditingListeners();
|
45855 | this.addPasteListeners();
|
45856 | this.addFillListeners();
|
45857 | this.addCellKeyListeners();
|
45858 | this.addManagedListener(this.eventService, Events.EVENT_CELL_VALUE_CHANGED, this.onCellValueChanged);
|
45859 |
|
45860 |
|
45861 | this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, function (e) {
|
45862 | if (!e.keepUndoRedoStack) {
|
45863 | _this.clearStacks();
|
45864 | }
|
45865 | });
|
45866 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, this.clearStacks);
|
45867 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.clearStacks);
|
45868 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, this.clearStacks);
|
45869 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.clearStacks);
|
45870 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, this.clearStacks);
|
45871 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, this.clearStacks);
|
45872 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, this.clearStacks);
|
45873 | this.addManagedListener(this.eventService, Events.EVENT_ROW_DRAG_END, this.clearStacks);
|
45874 | this.ctrlsService.whenReady(function () {
|
45875 | _this.gridBodyCtrl = _this.ctrlsService.getGridBodyCtrl();
|
45876 | });
|
45877 | };
|
45878 | UndoRedoService.prototype.getCurrentUndoStackSize = function () {
|
45879 | return this.undoStack ? this.undoStack.getCurrentStackSize() : 0;
|
45880 | };
|
45881 | UndoRedoService.prototype.getCurrentRedoStackSize = function () {
|
45882 | return this.redoStack ? this.redoStack.getCurrentStackSize() : 0;
|
45883 | };
|
45884 | UndoRedoService.prototype.undo = function (source) {
|
45885 | var startEvent = {
|
45886 | type: Events.EVENT_UNDO_STARTED,
|
45887 | source: source
|
45888 | };
|
45889 | this.eventService.dispatchEvent(startEvent);
|
45890 | var operationPerformed = this.undoRedo(this.undoStack, this.redoStack, 'initialRange', 'oldValue', 'undo');
|
45891 | var endEvent = {
|
45892 | type: Events.EVENT_UNDO_ENDED,
|
45893 | source: source,
|
45894 | operationPerformed: operationPerformed
|
45895 | };
|
45896 | this.eventService.dispatchEvent(endEvent);
|
45897 | };
|
45898 | UndoRedoService.prototype.redo = function (source) {
|
45899 | var startEvent = {
|
45900 | type: Events.EVENT_REDO_STARTED,
|
45901 | source: source
|
45902 | };
|
45903 | this.eventService.dispatchEvent(startEvent);
|
45904 | var operationPerformed = this.undoRedo(this.redoStack, this.undoStack, 'finalRange', 'newValue', 'redo');
|
45905 | var endEvent = {
|
45906 | type: Events.EVENT_REDO_ENDED,
|
45907 | source: source,
|
45908 | operationPerformed: operationPerformed
|
45909 | };
|
45910 | this.eventService.dispatchEvent(endEvent);
|
45911 | };
|
45912 | UndoRedoService.prototype.undoRedo = function (undoRedoStack, opposingUndoRedoStack, rangeProperty, cellValueChangeProperty, source) {
|
45913 | if (!undoRedoStack) {
|
45914 | return false;
|
45915 | }
|
45916 | var undoRedoAction = undoRedoStack.pop();
|
45917 | if (!undoRedoAction || !undoRedoAction.cellValueChanges) {
|
45918 | return false;
|
45919 | }
|
45920 | this.processAction(undoRedoAction, function (cellValueChange) { return cellValueChange[cellValueChangeProperty]; }, source);
|
45921 | if (undoRedoAction instanceof RangeUndoRedoAction) {
|
45922 | this.processRange(undoRedoAction.ranges || [undoRedoAction[rangeProperty]]);
|
45923 | }
|
45924 | else {
|
45925 | this.processCell(undoRedoAction.cellValueChanges);
|
45926 | }
|
45927 | opposingUndoRedoStack.push(undoRedoAction);
|
45928 | return true;
|
45929 | };
|
45930 | UndoRedoService.prototype.processAction = function (action, valueExtractor, source) {
|
45931 | var _this = this;
|
45932 | action.cellValueChanges.forEach(function (cellValueChange) {
|
45933 | var rowIndex = cellValueChange.rowIndex, rowPinned = cellValueChange.rowPinned, columnId = cellValueChange.columnId;
|
45934 | var rowPosition = { rowIndex: rowIndex, rowPinned: rowPinned };
|
45935 | var currentRow = _this.getRowNode(rowPosition);
|
45936 |
|
45937 | if (!currentRow.displayed) {
|
45938 | return;
|
45939 | }
|
45940 | currentRow.setDataValue(columnId, valueExtractor(cellValueChange), source);
|
45941 | });
|
45942 | };
|
45943 | UndoRedoService.prototype.processRange = function (ranges) {
|
45944 | var _this = this;
|
45945 | var lastFocusedCell;
|
45946 | this.rangeService.removeAllCellRanges(true);
|
45947 | ranges.forEach(function (range, idx) {
|
45948 | if (!range) {
|
45949 | return;
|
45950 | }
|
45951 | var startRow = range.startRow;
|
45952 | var endRow = range.endRow;
|
45953 | if (idx === ranges.length - 1) {
|
45954 | lastFocusedCell = {
|
45955 | rowPinned: startRow.rowPinned,
|
45956 | rowIndex: startRow.rowIndex,
|
45957 | columnId: range.startColumn.getColId()
|
45958 | };
|
45959 | _this.setLastFocusedCell(lastFocusedCell);
|
45960 | }
|
45961 | var cellRangeParams = {
|
45962 | rowStartIndex: startRow.rowIndex,
|
45963 | rowStartPinned: startRow.rowPinned,
|
45964 | rowEndIndex: endRow.rowIndex,
|
45965 | rowEndPinned: endRow.rowPinned,
|
45966 | columnStart: range.startColumn,
|
45967 | columns: range.columns
|
45968 | };
|
45969 | _this.rangeService.addCellRange(cellRangeParams);
|
45970 | });
|
45971 | };
|
45972 | UndoRedoService.prototype.processCell = function (cellValueChanges) {
|
45973 | var cellValueChange = cellValueChanges[0];
|
45974 | var rowIndex = cellValueChange.rowIndex, rowPinned = cellValueChange.rowPinned;
|
45975 | var rowPosition = { rowIndex: rowIndex, rowPinned: rowPinned };
|
45976 | var row = this.getRowNode(rowPosition);
|
45977 | var lastFocusedCell = {
|
45978 | rowPinned: cellValueChange.rowPinned,
|
45979 | rowIndex: row.rowIndex,
|
45980 | columnId: cellValueChange.columnId
|
45981 | };
|
45982 |
|
45983 |
|
45984 |
|
45985 | this.setLastFocusedCell(lastFocusedCell, !!this.rangeService);
|
45986 | };
|
45987 | UndoRedoService.prototype.setLastFocusedCell = function (lastFocusedCell, setRangeToCell) {
|
45988 | var rowIndex = lastFocusedCell.rowIndex, columnId = lastFocusedCell.columnId, rowPinned = lastFocusedCell.rowPinned;
|
45989 | var scrollFeature = this.gridBodyCtrl.getScrollFeature();
|
45990 | var column = this.columnModel.getGridColumn(columnId);
|
45991 | if (!column) {
|
45992 | return;
|
45993 | }
|
45994 | scrollFeature.ensureIndexVisible(rowIndex);
|
45995 | scrollFeature.ensureColumnVisible(column);
|
45996 | var cellPosition = { rowIndex: rowIndex, column: column, rowPinned: rowPinned };
|
45997 | this.focusService.setFocusedCell(__assign$1(__assign$1({}, cellPosition), { forceBrowserFocus: true }));
|
45998 | if (setRangeToCell) {
|
45999 | this.rangeService.setRangeToCell(cellPosition);
|
46000 | }
|
46001 | };
|
46002 | UndoRedoService.prototype.addRowEditingListeners = function () {
|
46003 | var _this = this;
|
46004 | this.addManagedListener(this.eventService, Events.EVENT_ROW_EDITING_STARTED, function (e) {
|
46005 | _this.activeRowEdit = { rowIndex: e.rowIndex, rowPinned: e.rowPinned };
|
46006 | });
|
46007 | this.addManagedListener(this.eventService, Events.EVENT_ROW_EDITING_STOPPED, function () {
|
46008 | var action = new UndoRedoAction(_this.cellValueChanges);
|
46009 | _this.pushActionsToUndoStack(action);
|
46010 | _this.activeRowEdit = null;
|
46011 | });
|
46012 | };
|
46013 | UndoRedoService.prototype.addCellEditingListeners = function () {
|
46014 | var _this = this;
|
46015 | this.addManagedListener(this.eventService, Events.EVENT_CELL_EDITING_STARTED, function (e) {
|
46016 | _this.activeCellEdit = { column: e.column, rowIndex: e.rowIndex, rowPinned: e.rowPinned };
|
46017 | });
|
46018 | this.addManagedListener(this.eventService, Events.EVENT_CELL_EDITING_STOPPED, function (e) {
|
46019 | _this.activeCellEdit = null;
|
46020 | var shouldPushAction = e.valueChanged && !_this.activeRowEdit && !_this.isPasting && !_this.isRangeInAction;
|
46021 | if (shouldPushAction) {
|
46022 | var action = new UndoRedoAction(_this.cellValueChanges);
|
46023 | _this.pushActionsToUndoStack(action);
|
46024 | }
|
46025 | });
|
46026 | };
|
46027 | UndoRedoService.prototype.addPasteListeners = function () {
|
46028 | var _this = this;
|
46029 | this.addManagedListener(this.eventService, Events.EVENT_PASTE_START, function () {
|
46030 | _this.isPasting = true;
|
46031 | });
|
46032 | this.addManagedListener(this.eventService, Events.EVENT_PASTE_END, function () {
|
46033 | var action = new UndoRedoAction(_this.cellValueChanges);
|
46034 | _this.pushActionsToUndoStack(action);
|
46035 | _this.isPasting = false;
|
46036 | });
|
46037 | };
|
46038 | UndoRedoService.prototype.addFillListeners = function () {
|
46039 | var _this = this;
|
46040 | this.addManagedListener(this.eventService, Events.EVENT_FILL_START, function () {
|
46041 | _this.isRangeInAction = true;
|
46042 | });
|
46043 | this.addManagedListener(this.eventService, Events.EVENT_FILL_END, function (event) {
|
46044 | var action = new RangeUndoRedoAction(_this.cellValueChanges, event.initialRange, event.finalRange);
|
46045 | _this.pushActionsToUndoStack(action);
|
46046 | _this.isRangeInAction = false;
|
46047 | });
|
46048 | };
|
46049 | UndoRedoService.prototype.addCellKeyListeners = function () {
|
46050 | var _this = this;
|
46051 | this.addManagedListener(this.eventService, Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_START, function () {
|
46052 | _this.isRangeInAction = true;
|
46053 | });
|
46054 | this.addManagedListener(this.eventService, Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_END, function () {
|
46055 | var action;
|
46056 | if (_this.rangeService && _this.gridOptionsService.isEnableRangeSelection()) {
|
46057 | action = new RangeUndoRedoAction(_this.cellValueChanges, undefined, undefined, __spread$4(_this.rangeService.getCellRanges()));
|
46058 | }
|
46059 | else {
|
46060 | action = new UndoRedoAction(_this.cellValueChanges);
|
46061 | }
|
46062 | _this.pushActionsToUndoStack(action);
|
46063 | _this.isRangeInAction = false;
|
46064 | });
|
46065 | };
|
46066 | UndoRedoService.prototype.pushActionsToUndoStack = function (action) {
|
46067 | this.undoStack.push(action);
|
46068 | this.cellValueChanges = [];
|
46069 | this.redoStack.clear();
|
46070 | };
|
46071 | UndoRedoService.prototype.getRowNode = function (gridRow) {
|
46072 | switch (gridRow.rowPinned) {
|
46073 | case 'top':
|
46074 | return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];
|
46075 | case 'bottom':
|
46076 | return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];
|
46077 | default:
|
46078 | return this.rowModel.getRow(gridRow.rowIndex);
|
46079 | }
|
46080 | };
|
46081 | __decorate$p([
|
46082 | Autowired('focusService')
|
46083 | ], UndoRedoService.prototype, "focusService", void 0);
|
46084 | __decorate$p([
|
46085 | Autowired('ctrlsService')
|
46086 | ], UndoRedoService.prototype, "ctrlsService", void 0);
|
46087 | __decorate$p([
|
46088 | Autowired('rowModel')
|
46089 | ], UndoRedoService.prototype, "rowModel", void 0);
|
46090 | __decorate$p([
|
46091 | Autowired('pinnedRowModel')
|
46092 | ], UndoRedoService.prototype, "pinnedRowModel", void 0);
|
46093 | __decorate$p([
|
46094 | Autowired('cellPositionUtils')
|
46095 | ], UndoRedoService.prototype, "cellPositionUtils", void 0);
|
46096 | __decorate$p([
|
46097 | Autowired('rowPositionUtils')
|
46098 | ], UndoRedoService.prototype, "rowPositionUtils", void 0);
|
46099 | __decorate$p([
|
46100 | Autowired('columnModel')
|
46101 | ], UndoRedoService.prototype, "columnModel", void 0);
|
46102 | __decorate$p([
|
46103 | Optional('rangeService')
|
46104 | ], UndoRedoService.prototype, "rangeService", void 0);
|
46105 | __decorate$p([
|
46106 | PostConstruct
|
46107 | ], UndoRedoService.prototype, "init", null);
|
46108 | UndoRedoService = __decorate$p([
|
46109 | Bean('undoRedoService')
|
46110 | ], UndoRedoService);
|
46111 | return UndoRedoService;
|
46112 | }(BeanStub));
|
46113 |
|
46114 |
|
46115 |
|
46116 |
|
46117 |
|
46118 |
|
46119 |
|
46120 | var __extends$m = (undefined && undefined.__extends) || (function () {
|
46121 | var extendStatics = function (d, b) {
|
46122 | extendStatics = Object.setPrototypeOf ||
|
46123 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
46124 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
46125 | return extendStatics(d, b);
|
46126 | };
|
46127 | return function (d, b) {
|
46128 | extendStatics(d, b);
|
46129 | function __() { this.constructor = d; }
|
46130 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
46131 | };
|
46132 | })();
|
46133 | var __decorate$o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46134 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46135 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46136 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46137 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46138 | };
|
46139 | var HeaderPositionUtils = (function (_super) {
|
46140 | __extends$m(HeaderPositionUtils, _super);
|
46141 | function HeaderPositionUtils() {
|
46142 | return _super !== null && _super.apply(this, arguments) || this;
|
46143 | }
|
46144 | HeaderPositionUtils.prototype.findHeader = function (focusedHeader, direction) {
|
46145 | var nextColumn;
|
46146 | var getGroupMethod;
|
46147 | var getColMethod;
|
46148 | if (focusedHeader.column instanceof ColumnGroup) {
|
46149 | getGroupMethod = "getDisplayedGroup" + direction;
|
46150 | nextColumn = this.columnModel[getGroupMethod](focusedHeader.column);
|
46151 | }
|
46152 | else {
|
46153 | getColMethod = "getDisplayedCol" + direction;
|
46154 | nextColumn = this.columnModel[getColMethod](focusedHeader.column);
|
46155 | }
|
46156 | if (!nextColumn) {
|
46157 | return;
|
46158 | }
|
46159 | var headerRowIndex = focusedHeader.headerRowIndex;
|
46160 | var currentRowType = this.getHeaderRowType(headerRowIndex);
|
46161 | if (currentRowType === HeaderRowType.COLUMN_GROUP) {
|
46162 | var columnGroup = nextColumn;
|
46163 | if (columnGroup.isPadding() && this.isAnyChildSpanningHeaderHeight(columnGroup)) {
|
46164 | var _a = this.getColumnVisibleChild(columnGroup, headerRowIndex, direction), nextFocusColumn = _a.nextFocusColumn, nextRow = _a.nextRow;
|
46165 | if (nextFocusColumn) {
|
46166 | nextColumn = nextFocusColumn;
|
46167 | headerRowIndex = nextRow;
|
46168 | }
|
46169 | }
|
46170 | }
|
46171 | return {
|
46172 | column: nextColumn,
|
46173 | headerRowIndex: headerRowIndex
|
46174 | };
|
46175 | };
|
46176 | HeaderPositionUtils.prototype.isAnyChildSpanningHeaderHeight = function (columnGroup) {
|
46177 | if (!columnGroup) {
|
46178 | return false;
|
46179 | }
|
46180 | return columnGroup.getLeafColumns().some(function (col) { return col.isSpanHeaderHeight(); });
|
46181 | };
|
46182 | HeaderPositionUtils.prototype.getColumnVisibleParent = function (currentColumn, currentIndex) {
|
46183 | var currentRowType = this.getHeaderRowType(currentIndex);
|
46184 | var isFloatingFilter = currentRowType === HeaderRowType.FLOATING_FILTER;
|
46185 | var isColumn = currentRowType === HeaderRowType.COLUMN;
|
46186 | var nextFocusColumn = isFloatingFilter ? currentColumn : currentColumn.getParent();
|
46187 | var nextRow = currentIndex - 1;
|
46188 | if (isColumn && this.isAnyChildSpanningHeaderHeight(currentColumn.getParent())) {
|
46189 | while (nextFocusColumn && nextFocusColumn.isPadding()) {
|
46190 | nextFocusColumn = nextFocusColumn.getParent();
|
46191 | nextRow--;
|
46192 | }
|
46193 | if (nextRow < 0) {
|
46194 | nextFocusColumn = currentColumn;
|
46195 | nextRow = currentIndex;
|
46196 | }
|
46197 | }
|
46198 | return { nextFocusColumn: nextFocusColumn, nextRow: nextRow };
|
46199 | };
|
46200 | HeaderPositionUtils.prototype.getColumnVisibleChild = function (column, currentIndex, direction) {
|
46201 | if (direction === void 0) { direction = 'After'; }
|
46202 | var currentRowType = this.getHeaderRowType(currentIndex);
|
46203 | var nextFocusColumn = column;
|
46204 | var nextRow = currentIndex + 1;
|
46205 | if (currentRowType === HeaderRowType.COLUMN_GROUP) {
|
46206 | var leafColumns = column.getLeafColumns();
|
46207 | var leafChild = direction === 'After' ? leafColumns[0] : last(leafColumns);
|
46208 | if (this.isAnyChildSpanningHeaderHeight(leafChild.getParent())) {
|
46209 | nextFocusColumn = leafChild;
|
46210 | var currentColumn = leafChild.getParent();
|
46211 | while (currentColumn && currentColumn !== column) {
|
46212 | currentColumn = currentColumn.getParent();
|
46213 | nextRow++;
|
46214 | }
|
46215 | }
|
46216 | else {
|
46217 | nextFocusColumn = column.getDisplayedChildren()[0];
|
46218 | }
|
46219 | }
|
46220 | return { nextFocusColumn: nextFocusColumn, nextRow: nextRow };
|
46221 | };
|
46222 | HeaderPositionUtils.prototype.getHeaderRowType = function (rowIndex) {
|
46223 | var centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();
|
46224 | if (centerHeaderContainer) {
|
46225 | return centerHeaderContainer.getRowType(rowIndex);
|
46226 | }
|
46227 | };
|
46228 | HeaderPositionUtils.prototype.findColAtEdgeForHeaderRow = function (level, position) {
|
46229 | var displayedColumns = this.columnModel.getAllDisplayedColumns();
|
46230 | var column = displayedColumns[position === 'start' ? 0 : displayedColumns.length - 1];
|
46231 | if (!column) {
|
46232 | return;
|
46233 | }
|
46234 | var childContainer = this.ctrlsService.getHeaderRowContainerCtrl(column.getPinned());
|
46235 | var type = childContainer.getRowType(level);
|
46236 | if (type == HeaderRowType.COLUMN_GROUP) {
|
46237 | var columnGroup = this.columnModel.getColumnGroupAtLevel(column, level);
|
46238 | return {
|
46239 | headerRowIndex: level,
|
46240 | column: columnGroup
|
46241 | };
|
46242 | }
|
46243 | return {
|
46244 |
|
46245 | headerRowIndex: type == null ? -1 : level,
|
46246 | column: column
|
46247 | };
|
46248 | };
|
46249 | __decorate$o([
|
46250 | Autowired('columnModel')
|
46251 | ], HeaderPositionUtils.prototype, "columnModel", void 0);
|
46252 | __decorate$o([
|
46253 | Autowired('ctrlsService')
|
46254 | ], HeaderPositionUtils.prototype, "ctrlsService", void 0);
|
46255 | HeaderPositionUtils = __decorate$o([
|
46256 | Bean('headerPositionUtils')
|
46257 | ], HeaderPositionUtils);
|
46258 | return HeaderPositionUtils;
|
46259 | }(BeanStub));
|
46260 |
|
46261 |
|
46262 |
|
46263 |
|
46264 |
|
46265 |
|
46266 |
|
46267 | var __decorate$n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46268 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46269 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46270 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46271 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46272 | };
|
46273 | var ColumnDefFactory = (function () {
|
46274 | function ColumnDefFactory() {
|
46275 | }
|
46276 | ColumnDefFactory.prototype.buildColumnDefs = function (cols, rowGroupColumns, pivotColumns) {
|
46277 | var _this = this;
|
46278 | var res = [];
|
46279 | var colGroupDefs = {};
|
46280 | cols.forEach(function (col) {
|
46281 | var colDef = _this.createDefFromColumn(col, rowGroupColumns, pivotColumns);
|
46282 | var addToResult = true;
|
46283 | var childDef = colDef;
|
46284 | var pointer = col.getOriginalParent();
|
46285 | while (pointer) {
|
46286 | var parentDef = null;
|
46287 |
|
46288 |
|
46289 |
|
46290 | if (pointer.isPadding()) {
|
46291 | pointer = pointer.getOriginalParent();
|
46292 | continue;
|
46293 | }
|
46294 |
|
46295 | var existingParentDef = colGroupDefs[pointer.getGroupId()];
|
46296 | if (existingParentDef) {
|
46297 | existingParentDef.children.push(childDef);
|
46298 |
|
46299 | addToResult = false;
|
46300 |
|
46301 |
|
46302 | break;
|
46303 | }
|
46304 | parentDef = _this.createDefFromGroup(pointer);
|
46305 | if (parentDef) {
|
46306 | parentDef.children = [childDef];
|
46307 | colGroupDefs[parentDef.groupId] = parentDef;
|
46308 | childDef = parentDef;
|
46309 | pointer = pointer.getOriginalParent();
|
46310 | }
|
46311 | }
|
46312 | if (addToResult) {
|
46313 | res.push(childDef);
|
46314 | }
|
46315 | });
|
46316 | return res;
|
46317 | };
|
46318 | ColumnDefFactory.prototype.createDefFromGroup = function (group) {
|
46319 | var defCloned = deepCloneDefinition(group.getColGroupDef(), ['children']);
|
46320 | if (defCloned) {
|
46321 | defCloned.groupId = group.getGroupId();
|
46322 | }
|
46323 | return defCloned;
|
46324 | };
|
46325 | ColumnDefFactory.prototype.createDefFromColumn = function (col, rowGroupColumns, pivotColumns) {
|
46326 | var colDefCloned = deepCloneDefinition(col.getColDef());
|
46327 | colDefCloned.colId = col.getColId();
|
46328 | colDefCloned.width = col.getActualWidth();
|
46329 | colDefCloned.rowGroup = col.isRowGroupActive();
|
46330 | colDefCloned.rowGroupIndex = col.isRowGroupActive() ? rowGroupColumns.indexOf(col) : null;
|
46331 | colDefCloned.pivot = col.isPivotActive();
|
46332 | colDefCloned.pivotIndex = col.isPivotActive() ? pivotColumns.indexOf(col) : null;
|
46333 | colDefCloned.aggFunc = col.isValueActive() ? col.getAggFunc() : null;
|
46334 | colDefCloned.hide = col.isVisible() ? undefined : true;
|
46335 | colDefCloned.pinned = col.isPinned() ? col.getPinned() : null;
|
46336 | colDefCloned.sort = col.getSort() ? col.getSort() : null;
|
46337 | colDefCloned.sortIndex = col.getSortIndex() != null ? col.getSortIndex() : null;
|
46338 | return colDefCloned;
|
46339 | };
|
46340 | ColumnDefFactory = __decorate$n([
|
46341 | Bean('columnDefFactory')
|
46342 | ], ColumnDefFactory);
|
46343 | return ColumnDefFactory;
|
46344 | }());
|
46345 |
|
46346 |
|
46347 |
|
46348 |
|
46349 |
|
46350 |
|
46351 |
|
46352 | var __decorate$m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46353 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46354 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46355 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46356 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46357 | };
|
46358 | var RowCssClassCalculator = (function () {
|
46359 | function RowCssClassCalculator() {
|
46360 | }
|
46361 | RowCssClassCalculator.prototype.getInitialRowClasses = function (params) {
|
46362 | var classes = [];
|
46363 | if (exists(params.extraCssClass)) {
|
46364 | classes.push(params.extraCssClass);
|
46365 | }
|
46366 | classes.push('ag-row');
|
46367 | classes.push(params.rowFocused ? 'ag-row-focus' : 'ag-row-no-focus');
|
46368 | if (params.fadeRowIn) {
|
46369 | classes.push('ag-opacity-zero');
|
46370 | }
|
46371 | classes.push(params.rowIsEven ? 'ag-row-even' : 'ag-row-odd');
|
46372 | if (params.rowNode.isRowPinned()) {
|
46373 | classes.push('ag-row-pinned');
|
46374 | }
|
46375 | if (params.rowNode.isSelected()) {
|
46376 | classes.push('ag-row-selected');
|
46377 | }
|
46378 | if (params.rowNode.footer) {
|
46379 | classes.push('ag-row-footer');
|
46380 | }
|
46381 | classes.push('ag-row-level-' + params.rowLevel);
|
46382 | if (params.rowNode.stub) {
|
46383 | classes.push('ag-row-loading');
|
46384 | }
|
46385 | if (params.fullWidthRow) {
|
46386 | classes.push('ag-full-width-row');
|
46387 | }
|
46388 | if (params.expandable) {
|
46389 | classes.push('ag-row-group');
|
46390 | classes.push(params.rowNode.expanded ? 'ag-row-group-expanded' : 'ag-row-group-contracted');
|
46391 | }
|
46392 | if (params.rowNode.dragging) {
|
46393 | classes.push('ag-row-dragging');
|
46394 | }
|
46395 | pushAll(classes, this.processClassesFromGridOptions(params.rowNode));
|
46396 | pushAll(classes, this.preProcessRowClassRules(params.rowNode));
|
46397 |
|
46398 | classes.push(params.printLayout ? 'ag-row-position-relative' : 'ag-row-position-absolute');
|
46399 | if (params.firstRowOnPage) {
|
46400 | classes.push('ag-row-first');
|
46401 | }
|
46402 | if (params.lastRowOnPage) {
|
46403 | classes.push('ag-row-last');
|
46404 | }
|
46405 | if (params.fullWidthRow) {
|
46406 | if (params.pinned === 'left') {
|
46407 | classes.push('ag-cell-last-left-pinned');
|
46408 | }
|
46409 | if (params.pinned === 'right') {
|
46410 | classes.push('ag-cell-first-right-pinned');
|
46411 | }
|
46412 | }
|
46413 | return classes;
|
46414 | };
|
46415 | RowCssClassCalculator.prototype.processClassesFromGridOptions = function (rowNode) {
|
46416 | var res = [];
|
46417 | var process = function (rowCls) {
|
46418 | if (typeof rowCls === 'string') {
|
46419 | res.push(rowCls);
|
46420 | }
|
46421 | else if (Array.isArray(rowCls)) {
|
46422 | rowCls.forEach(function (e) { return res.push(e); });
|
46423 | }
|
46424 | };
|
46425 |
|
46426 | var rowClass = this.gridOptionsService.get('rowClass');
|
46427 | if (rowClass) {
|
46428 | if (typeof rowClass === 'function') {
|
46429 | console.warn('AG Grid: rowClass should not be a function, please use getRowClass instead');
|
46430 | return [];
|
46431 | }
|
46432 | process(rowClass);
|
46433 | }
|
46434 |
|
46435 | var rowClassFunc = this.gridOptionsService.getCallback('getRowClass');
|
46436 | if (rowClassFunc) {
|
46437 | var params = {
|
46438 | data: rowNode.data,
|
46439 | node: rowNode,
|
46440 | rowIndex: rowNode.rowIndex
|
46441 | };
|
46442 | var rowClassFuncResult = rowClassFunc(params);
|
46443 | process(rowClassFuncResult);
|
46444 | }
|
46445 | return res;
|
46446 | };
|
46447 | RowCssClassCalculator.prototype.preProcessRowClassRules = function (rowNode) {
|
46448 | var res = [];
|
46449 | this.processRowClassRules(rowNode, function (className) {
|
46450 | res.push(className);
|
46451 | }, function (className) {
|
46452 |
|
46453 |
|
46454 | });
|
46455 | return res;
|
46456 | };
|
46457 | RowCssClassCalculator.prototype.processRowClassRules = function (rowNode, onApplicableClass, onNotApplicableClass) {
|
46458 | var rowClassParams = {
|
46459 | data: rowNode.data,
|
46460 | node: rowNode,
|
46461 | rowIndex: rowNode.rowIndex,
|
46462 | api: this.gridOptionsService.api,
|
46463 | columnApi: this.gridOptionsService.columnApi,
|
46464 | context: this.gridOptionsService.context
|
46465 | };
|
46466 | this.stylingService.processClassRules(this.gridOptionsService.get('rowClassRules'), rowClassParams, onApplicableClass, onNotApplicableClass);
|
46467 | };
|
46468 | RowCssClassCalculator.prototype.calculateRowLevel = function (rowNode) {
|
46469 | if (rowNode.group) {
|
46470 | return rowNode.level;
|
46471 | }
|
46472 |
|
46473 | return rowNode.parent ? (rowNode.parent.level + 1) : 0;
|
46474 | };
|
46475 | __decorate$m([
|
46476 | Autowired('stylingService')
|
46477 | ], RowCssClassCalculator.prototype, "stylingService", void 0);
|
46478 | __decorate$m([
|
46479 | Autowired('gridOptionsService')
|
46480 | ], RowCssClassCalculator.prototype, "gridOptionsService", void 0);
|
46481 | RowCssClassCalculator = __decorate$m([
|
46482 | Bean('rowCssClassCalculator')
|
46483 | ], RowCssClassCalculator);
|
46484 | return RowCssClassCalculator;
|
46485 | }());
|
46486 |
|
46487 |
|
46488 |
|
46489 |
|
46490 |
|
46491 |
|
46492 |
|
46493 | var __extends$l = (undefined && undefined.__extends) || (function () {
|
46494 | var extendStatics = function (d, b) {
|
46495 | extendStatics = Object.setPrototypeOf ||
|
46496 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
46497 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
46498 | return extendStatics(d, b);
|
46499 | };
|
46500 | return function (d, b) {
|
46501 | extendStatics(d, b);
|
46502 | function __() { this.constructor = d; }
|
46503 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
46504 | };
|
46505 | })();
|
46506 | var __decorate$l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46507 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46508 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46509 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46510 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46511 | };
|
46512 |
|
46513 | var RowNodeSorter = (function (_super) {
|
46514 | __extends$l(RowNodeSorter, _super);
|
46515 | function RowNodeSorter() {
|
46516 | return _super !== null && _super.apply(this, arguments) || this;
|
46517 | }
|
46518 | RowNodeSorter.prototype.init = function () {
|
46519 | var _this = this;
|
46520 | this.isAccentedSort = this.gridOptionsService.is('accentedSort');
|
46521 | this.primaryColumnsSortGroups = this.gridOptionsService.isColumnsSortingCoupledToGroup();
|
46522 | this.addManagedPropertyListener('accentedSort', function (propChange) { return _this.isAccentedSort = propChange.currentValue; });
|
46523 | this.addManagedPropertyListener('autoGroupColumnDef', function () { return _this.primaryColumnsSortGroups = _this.gridOptionsService.isColumnsSortingCoupledToGroup(); });
|
46524 | };
|
46525 | RowNodeSorter.prototype.doFullSort = function (rowNodes, sortOptions) {
|
46526 | var mapper = function (rowNode, pos) { return ({ currentPos: pos, rowNode: rowNode }); };
|
46527 | var sortedRowNodes = rowNodes.map(mapper);
|
46528 | sortedRowNodes.sort(this.compareRowNodes.bind(this, sortOptions));
|
46529 | return sortedRowNodes.map(function (item) { return item.rowNode; });
|
46530 | };
|
46531 | RowNodeSorter.prototype.compareRowNodes = function (sortOptions, sortedNodeA, sortedNodeB) {
|
46532 | var nodeA = sortedNodeA.rowNode;
|
46533 | var nodeB = sortedNodeB.rowNode;
|
46534 |
|
46535 | for (var i = 0, len = sortOptions.length; i < len; i++) {
|
46536 | var sortOption = sortOptions[i];
|
46537 | var isDescending = sortOption.sort === 'desc';
|
46538 | var valueA = this.getValue(nodeA, sortOption.column);
|
46539 | var valueB = this.getValue(nodeB, sortOption.column);
|
46540 | var comparatorResult = void 0;
|
46541 | var providedComparator = this.getComparator(sortOption, nodeA);
|
46542 | if (providedComparator) {
|
46543 |
|
46544 | comparatorResult = providedComparator(valueA, valueB, nodeA, nodeB, isDescending);
|
46545 | }
|
46546 | else {
|
46547 |
|
46548 | comparatorResult = _.defaultComparator(valueA, valueB, this.isAccentedSort);
|
46549 | }
|
46550 |
|
46551 |
|
46552 | var validResult = !isNaN(comparatorResult);
|
46553 | if (validResult && comparatorResult !== 0) {
|
46554 | return sortOption.sort === 'asc' ? comparatorResult : comparatorResult * -1;
|
46555 | }
|
46556 | }
|
46557 |
|
46558 | return sortedNodeA.currentPos - sortedNodeB.currentPos;
|
46559 | };
|
46560 | RowNodeSorter.prototype.getComparator = function (sortOption, rowNode) {
|
46561 | var column = sortOption.column;
|
46562 |
|
46563 | var comparatorOnCol = column.getColDef().comparator;
|
46564 | if (comparatorOnCol != null) {
|
46565 | return comparatorOnCol;
|
46566 | }
|
46567 | if (!column.getColDef().showRowGroup) {
|
46568 | return;
|
46569 | }
|
46570 |
|
46571 | var groupLeafField = !rowNode.group && column.getColDef().field;
|
46572 | if (!groupLeafField) {
|
46573 | return;
|
46574 | }
|
46575 | var primaryColumn = this.columnModel.getPrimaryColumn(groupLeafField);
|
46576 | if (!primaryColumn) {
|
46577 | return;
|
46578 | }
|
46579 | return primaryColumn.getColDef().comparator;
|
46580 | };
|
46581 | RowNodeSorter.prototype.getValue = function (node, column) {
|
46582 | var _a, _b;
|
46583 | if (!this.primaryColumnsSortGroups) {
|
46584 | return this.valueService.getValue(column, node, false, false);
|
46585 | }
|
46586 | var isNodeGroupedAtLevel = node.rowGroupColumn === column;
|
46587 | if (isNodeGroupedAtLevel) {
|
46588 | var isGroupRows = this.gridOptionsService.isGroupUseEntireRow(this.columnModel.isPivotActive());
|
46589 | if (isGroupRows) {
|
46590 |
|
46591 |
|
46592 | var keyCreator = column.getColDef().keyCreator;
|
46593 | if (keyCreator) {
|
46594 | return node.key;
|
46595 | }
|
46596 |
|
46597 |
|
46598 | var leafChild = (_a = node.allLeafChildren) === null || _a === void 0 ? void 0 : _a[0];
|
46599 | if (leafChild) {
|
46600 | return this.valueService.getValue(column, leafChild, false, false);
|
46601 | }
|
46602 | return undefined;
|
46603 | }
|
46604 | var displayCol = this.columnModel.getGroupDisplayColumnForGroup(column.getId());
|
46605 | if (!displayCol) {
|
46606 | return undefined;
|
46607 | }
|
46608 | return (_b = node.groupData) === null || _b === void 0 ? void 0 : _b[displayCol.getId()];
|
46609 | }
|
46610 | if (node.group && column.getColDef().showRowGroup) {
|
46611 | return undefined;
|
46612 | }
|
46613 | return this.valueService.getValue(column, node, false, false);
|
46614 | };
|
46615 | __decorate$l([
|
46616 | Autowired('valueService')
|
46617 | ], RowNodeSorter.prototype, "valueService", void 0);
|
46618 | __decorate$l([
|
46619 | Autowired('columnModel')
|
46620 | ], RowNodeSorter.prototype, "columnModel", void 0);
|
46621 | __decorate$l([
|
46622 | PostConstruct
|
46623 | ], RowNodeSorter.prototype, "init", null);
|
46624 | RowNodeSorter = __decorate$l([
|
46625 | Bean('rowNodeSorter')
|
46626 | ], RowNodeSorter);
|
46627 | return RowNodeSorter;
|
46628 | }(BeanStub));
|
46629 |
|
46630 |
|
46631 |
|
46632 |
|
46633 |
|
46634 |
|
46635 |
|
46636 | var __extends$k = (undefined && undefined.__extends) || (function () {
|
46637 | var extendStatics = function (d, b) {
|
46638 | extendStatics = Object.setPrototypeOf ||
|
46639 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
46640 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
46641 | return extendStatics(d, b);
|
46642 | };
|
46643 | return function (d, b) {
|
46644 | extendStatics(d, b);
|
46645 | function __() { this.constructor = d; }
|
46646 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
46647 | };
|
46648 | })();
|
46649 | var __decorate$k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46650 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46651 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46652 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46653 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46654 | };
|
46655 | var CtrlsService = (function (_super) {
|
46656 | __extends$k(CtrlsService, _super);
|
46657 | function CtrlsService() {
|
46658 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
46659 | _this.ready = false;
|
46660 | _this.readyCallbacks = [];
|
46661 | return _this;
|
46662 | }
|
46663 | CtrlsService_1 = CtrlsService;
|
46664 | CtrlsService.prototype.checkReady = function () {
|
46665 | this.ready =
|
46666 | this.gridCtrl != null
|
46667 | && this.gridBodyCtrl != null
|
46668 | && this.centerRowContainerCtrl != null
|
46669 | && this.leftRowContainerCtrl != null
|
46670 | && this.rightRowContainerCtrl != null
|
46671 | && this.bottomCenterRowContainerCtrl != null
|
46672 | && this.bottomLeftRowContainerCtrl != null
|
46673 | && this.bottomRightRowContainerCtrl != null
|
46674 | && this.topCenterRowContainerCtrl != null
|
46675 | && this.topLeftRowContainerCtrl != null
|
46676 | && this.topRightRowContainerCtrl != null
|
46677 | && this.stickyTopCenterRowContainerCtrl != null
|
46678 | && this.stickyTopLeftRowContainerCtrl != null
|
46679 | && this.stickyTopRightRowContainerCtrl != null
|
46680 | && this.centerHeaderRowContainerCtrl != null
|
46681 | && this.leftHeaderRowContainerCtrl != null
|
46682 | && this.rightHeaderRowContainerCtrl != null
|
46683 | && this.fakeHScrollComp != null
|
46684 | && this.fakeVScrollComp != null
|
46685 | && this.gridHeaderCtrl != null;
|
46686 | if (this.ready) {
|
46687 | var p_1 = this.createReadyParams();
|
46688 | this.readyCallbacks.forEach(function (c) { return c(p_1); });
|
46689 | this.readyCallbacks.length = 0;
|
46690 | }
|
46691 | };
|
46692 | CtrlsService.prototype.whenReady = function (callback) {
|
46693 | if (this.ready) {
|
46694 | callback(this.createReadyParams());
|
46695 | }
|
46696 | else {
|
46697 | this.readyCallbacks.push(callback);
|
46698 | }
|
46699 | };
|
46700 | CtrlsService.prototype.createReadyParams = function () {
|
46701 | return {
|
46702 | centerRowContainerCtrl: this.centerRowContainerCtrl,
|
46703 | leftRowContainerCtrl: this.leftRowContainerCtrl,
|
46704 | rightRowContainerCtrl: this.rightRowContainerCtrl,
|
46705 | bottomCenterRowContainerCtrl: this.bottomCenterRowContainerCtrl,
|
46706 | bottomLeftRowContainerCtrl: this.bottomLeftRowContainerCtrl,
|
46707 | bottomRightRowContainerCtrl: this.bottomRightRowContainerCtrl,
|
46708 | topCenterRowContainerCtrl: this.topCenterRowContainerCtrl,
|
46709 | topLeftRowContainerCtrl: this.topLeftRowContainerCtrl,
|
46710 | topRightRowContainerCtrl: this.topRightRowContainerCtrl,
|
46711 | stickyTopCenterRowContainerCtrl: this.stickyTopCenterRowContainerCtrl,
|
46712 | stickyTopLeftRowContainerCtrl: this.stickyTopLeftRowContainerCtrl,
|
46713 | stickyTopRightRowContainerCtrl: this.stickyTopRightRowContainerCtrl,
|
46714 | centerHeaderRowContainerCtrl: this.centerHeaderRowContainerCtrl,
|
46715 | leftHeaderRowContainerCtrl: this.leftHeaderRowContainerCtrl,
|
46716 | rightHeaderRowContainerCtrl: this.rightHeaderRowContainerCtrl,
|
46717 | fakeHScrollComp: this.fakeHScrollComp,
|
46718 | fakeVScrollComp: this.fakeVScrollComp,
|
46719 | gridBodyCtrl: this.gridBodyCtrl,
|
46720 | gridCtrl: this.gridCtrl,
|
46721 | gridHeaderCtrl: this.gridHeaderCtrl,
|
46722 | };
|
46723 | };
|
46724 | CtrlsService.prototype.registerFakeHScrollComp = function (comp) {
|
46725 | this.fakeHScrollComp = comp;
|
46726 | this.checkReady();
|
46727 | };
|
46728 | CtrlsService.prototype.registerFakeVScrollComp = function (comp) {
|
46729 | this.fakeVScrollComp = comp;
|
46730 | this.checkReady();
|
46731 | };
|
46732 | CtrlsService.prototype.registerGridHeaderCtrl = function (gridHeaderCtrl) {
|
46733 | this.gridHeaderCtrl = gridHeaderCtrl;
|
46734 | this.checkReady();
|
46735 | };
|
46736 | CtrlsService.prototype.registerCenterRowContainerCtrl = function (ctrl) {
|
46737 | this.centerRowContainerCtrl = ctrl;
|
46738 | this.checkReady();
|
46739 | };
|
46740 | CtrlsService.prototype.registerLeftRowContainerCtrl = function (ctrl) {
|
46741 | this.leftRowContainerCtrl = ctrl;
|
46742 | this.checkReady();
|
46743 | };
|
46744 | CtrlsService.prototype.registerRightRowContainerCtrl = function (ctrl) {
|
46745 | this.rightRowContainerCtrl = ctrl;
|
46746 | this.checkReady();
|
46747 | };
|
46748 | CtrlsService.prototype.registerTopCenterRowContainerCtrl = function (ctrl) {
|
46749 | this.topCenterRowContainerCtrl = ctrl;
|
46750 | this.checkReady();
|
46751 | };
|
46752 | CtrlsService.prototype.registerTopLeftRowContainerCon = function (ctrl) {
|
46753 | this.topLeftRowContainerCtrl = ctrl;
|
46754 | this.checkReady();
|
46755 | };
|
46756 | CtrlsService.prototype.registerTopRightRowContainerCtrl = function (ctrl) {
|
46757 | this.topRightRowContainerCtrl = ctrl;
|
46758 | this.checkReady();
|
46759 | };
|
46760 | CtrlsService.prototype.registerStickyTopCenterRowContainerCtrl = function (ctrl) {
|
46761 | this.stickyTopCenterRowContainerCtrl = ctrl;
|
46762 | this.checkReady();
|
46763 | };
|
46764 | CtrlsService.prototype.registerStickyTopLeftRowContainerCon = function (ctrl) {
|
46765 | this.stickyTopLeftRowContainerCtrl = ctrl;
|
46766 | this.checkReady();
|
46767 | };
|
46768 | CtrlsService.prototype.registerStickyTopRightRowContainerCtrl = function (ctrl) {
|
46769 | this.stickyTopRightRowContainerCtrl = ctrl;
|
46770 | this.checkReady();
|
46771 | };
|
46772 | CtrlsService.prototype.registerBottomCenterRowContainerCtrl = function (ctrl) {
|
46773 | this.bottomCenterRowContainerCtrl = ctrl;
|
46774 | this.checkReady();
|
46775 | };
|
46776 | CtrlsService.prototype.registerBottomLeftRowContainerCtrl = function (ctrl) {
|
46777 | this.bottomLeftRowContainerCtrl = ctrl;
|
46778 | this.checkReady();
|
46779 | };
|
46780 | CtrlsService.prototype.registerBottomRightRowContainerCtrl = function (ctrl) {
|
46781 | this.bottomRightRowContainerCtrl = ctrl;
|
46782 | this.checkReady();
|
46783 | };
|
46784 | CtrlsService.prototype.registerHeaderContainer = function (ctrl, pinned) {
|
46785 | switch (pinned) {
|
46786 | case 'left':
|
46787 | this.leftHeaderRowContainerCtrl = ctrl;
|
46788 | break;
|
46789 | case 'right':
|
46790 | this.rightHeaderRowContainerCtrl = ctrl;
|
46791 | break;
|
46792 | default:
|
46793 | this.centerHeaderRowContainerCtrl = ctrl;
|
46794 | break;
|
46795 | }
|
46796 | this.checkReady();
|
46797 | };
|
46798 | CtrlsService.prototype.registerGridBodyCtrl = function (ctrl) {
|
46799 | this.gridBodyCtrl = ctrl;
|
46800 | this.checkReady();
|
46801 | };
|
46802 | CtrlsService.prototype.registerGridCtrl = function (ctrl) {
|
46803 | this.gridCtrl = ctrl;
|
46804 | this.checkReady();
|
46805 | };
|
46806 | CtrlsService.prototype.getFakeHScrollComp = function () {
|
46807 | return this.fakeHScrollComp;
|
46808 | };
|
46809 | CtrlsService.prototype.getFakeVScrollComp = function () {
|
46810 | return this.fakeVScrollComp;
|
46811 | };
|
46812 | CtrlsService.prototype.getGridHeaderCtrl = function () {
|
46813 | return this.gridHeaderCtrl;
|
46814 | };
|
46815 | CtrlsService.prototype.getGridCtrl = function () {
|
46816 | return this.gridCtrl;
|
46817 | };
|
46818 | CtrlsService.prototype.getCenterRowContainerCtrl = function () {
|
46819 | return this.centerRowContainerCtrl;
|
46820 | };
|
46821 | CtrlsService.prototype.getTopCenterRowContainerCtrl = function () {
|
46822 | return this.topCenterRowContainerCtrl;
|
46823 | };
|
46824 | CtrlsService.prototype.getBottomCenterRowContainerCtrl = function () {
|
46825 | return this.bottomCenterRowContainerCtrl;
|
46826 | };
|
46827 | CtrlsService.prototype.getStickyTopCenterRowContainerCtrl = function () {
|
46828 | return this.stickyTopCenterRowContainerCtrl;
|
46829 | };
|
46830 | CtrlsService.prototype.getGridBodyCtrl = function () {
|
46831 | return this.gridBodyCtrl;
|
46832 | };
|
46833 | CtrlsService.prototype.getHeaderRowContainerCtrls = function () {
|
46834 | return [this.leftHeaderRowContainerCtrl, this.rightHeaderRowContainerCtrl, this.centerHeaderRowContainerCtrl];
|
46835 | };
|
46836 | CtrlsService.prototype.getHeaderRowContainerCtrl = function (pinned) {
|
46837 | switch (pinned) {
|
46838 | case 'left': return this.leftHeaderRowContainerCtrl;
|
46839 | case 'right': return this.rightHeaderRowContainerCtrl;
|
46840 | default: return this.centerHeaderRowContainerCtrl;
|
46841 | }
|
46842 | };
|
46843 | var CtrlsService_1;
|
46844 | CtrlsService.NAME = 'ctrlsService';
|
46845 | CtrlsService = CtrlsService_1 = __decorate$k([
|
46846 | Bean(CtrlsService_1.NAME)
|
46847 | ], CtrlsService);
|
46848 | return CtrlsService;
|
46849 | }(BeanStub));
|
46850 |
|
46851 |
|
46852 |
|
46853 |
|
46854 |
|
46855 |
|
46856 |
|
46857 | var __extends$j = (undefined && undefined.__extends) || (function () {
|
46858 | var extendStatics = function (d, b) {
|
46859 | extendStatics = Object.setPrototypeOf ||
|
46860 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
46861 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
46862 | return extendStatics(d, b);
|
46863 | };
|
46864 | return function (d, b) {
|
46865 | extendStatics(d, b);
|
46866 | function __() { this.constructor = d; }
|
46867 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
46868 | };
|
46869 | })();
|
46870 | var __decorate$j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46871 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46872 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46873 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46874 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46875 | };
|
46876 | var CtrlsFactory = (function (_super) {
|
46877 | __extends$j(CtrlsFactory, _super);
|
46878 | function CtrlsFactory() {
|
46879 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
46880 | _this.registry = {};
|
46881 | return _this;
|
46882 | }
|
46883 | CtrlsFactory.prototype.register = function (meta) {
|
46884 | this.registry[meta.controllerName] = meta.controllerClass;
|
46885 | };
|
46886 | CtrlsFactory.prototype.getInstance = function (name) {
|
46887 | var ControllerClass = this.registry[name];
|
46888 | if (ControllerClass == null) {
|
46889 | return undefined;
|
46890 | }
|
46891 | return new ControllerClass();
|
46892 | };
|
46893 | CtrlsFactory = __decorate$j([
|
46894 | Bean('ctrlsFactory')
|
46895 | ], CtrlsFactory);
|
46896 | return CtrlsFactory;
|
46897 | }(BeanStub));
|
46898 |
|
46899 |
|
46900 |
|
46901 |
|
46902 |
|
46903 |
|
46904 |
|
46905 | var __extends$i = (undefined && undefined.__extends) || (function () {
|
46906 | var extendStatics = function (d, b) {
|
46907 | extendStatics = Object.setPrototypeOf ||
|
46908 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
46909 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
46910 | return extendStatics(d, b);
|
46911 | };
|
46912 | return function (d, b) {
|
46913 | extendStatics(d, b);
|
46914 | function __() { this.constructor = d; }
|
46915 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
46916 | };
|
46917 | })();
|
46918 | var __decorate$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
46919 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
46920 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
46921 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
46922 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
46923 | };
|
46924 | var AbstractFakeScrollComp = (function (_super) {
|
46925 | __extends$i(AbstractFakeScrollComp, _super);
|
46926 | function AbstractFakeScrollComp(template, direction) {
|
46927 | var _this = _super.call(this, template) || this;
|
46928 | _this.direction = direction;
|
46929 | _this.hideTimeout = null;
|
46930 | return _this;
|
46931 | }
|
46932 | AbstractFakeScrollComp.prototype.postConstruct = function () {
|
46933 | this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, this.onScrollVisibilityChanged.bind(this));
|
46934 | this.onScrollVisibilityChanged();
|
46935 | this.addOrRemoveCssClass('ag-apple-scrollbar', isMacOsUserAgent() || isIOSUserAgent());
|
46936 | };
|
46937 | AbstractFakeScrollComp.prototype.initialiseInvisibleScrollbar = function () {
|
46938 | if (this.invisibleScrollbar !== undefined) {
|
46939 | return;
|
46940 | }
|
46941 | this.invisibleScrollbar = isInvisibleScrollbar();
|
46942 | if (this.invisibleScrollbar) {
|
46943 | this.hideAndShowInvisibleScrollAsNeeded();
|
46944 | this.addActiveListenerToggles();
|
46945 | }
|
46946 | };
|
46947 | AbstractFakeScrollComp.prototype.addActiveListenerToggles = function () {
|
46948 | var _this = this;
|
46949 | var activateEvents = ['mouseenter', 'mousedown', 'touchstart'];
|
46950 | var deactivateEvents = ['mouseleave', 'touchend'];
|
46951 | var eGui = this.getGui();
|
46952 | activateEvents.forEach(function (eventName) { return _this.addManagedListener(eGui, eventName, function () { return _this.addOrRemoveCssClass('ag-scrollbar-active', true); }); });
|
46953 | deactivateEvents.forEach(function (eventName) { return _this.addManagedListener(eGui, eventName, function () { return _this.addOrRemoveCssClass('ag-scrollbar-active', false); }); });
|
46954 | };
|
46955 | AbstractFakeScrollComp.prototype.onScrollVisibilityChanged = function () {
|
46956 |
|
46957 |
|
46958 |
|
46959 | if (this.invisibleScrollbar === undefined) {
|
46960 | this.initialiseInvisibleScrollbar();
|
46961 | }
|
46962 | this.setScrollVisible();
|
46963 | };
|
46964 | AbstractFakeScrollComp.prototype.hideAndShowInvisibleScrollAsNeeded = function () {
|
46965 | var _this = this;
|
46966 | this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, function (params) {
|
46967 | if (params.direction === _this.direction) {
|
46968 | if (_this.hideTimeout !== null) {
|
46969 | window.clearTimeout(_this.hideTimeout);
|
46970 | _this.hideTimeout = null;
|
46971 | }
|
46972 | _this.addOrRemoveCssClass('ag-scrollbar-scrolling', true);
|
46973 | }
|
46974 | });
|
46975 | this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL_END, function () {
|
46976 | _this.hideTimeout = window.setTimeout(function () {
|
46977 | _this.addOrRemoveCssClass('ag-scrollbar-scrolling', false);
|
46978 | _this.hideTimeout = null;
|
46979 | }, 400);
|
46980 | });
|
46981 | };
|
46982 | AbstractFakeScrollComp.prototype.getViewport = function () {
|
46983 | return this.eViewport;
|
46984 | };
|
46985 | AbstractFakeScrollComp.prototype.getContainer = function () {
|
46986 | return this.eContainer;
|
46987 | };
|
46988 | __decorate$i([
|
46989 | RefSelector('eViewport')
|
46990 | ], AbstractFakeScrollComp.prototype, "eViewport", void 0);
|
46991 | __decorate$i([
|
46992 | RefSelector('eContainer')
|
46993 | ], AbstractFakeScrollComp.prototype, "eContainer", void 0);
|
46994 | __decorate$i([
|
46995 | Autowired('scrollVisibleService')
|
46996 | ], AbstractFakeScrollComp.prototype, "scrollVisibleService", void 0);
|
46997 | __decorate$i([
|
46998 | Autowired('ctrlsService')
|
46999 | ], AbstractFakeScrollComp.prototype, "ctrlsService", void 0);
|
47000 | return AbstractFakeScrollComp;
|
47001 | }(Component));
|
47002 |
|
47003 |
|
47004 |
|
47005 |
|
47006 |
|
47007 |
|
47008 |
|
47009 | var __extends$h = (undefined && undefined.__extends) || (function () {
|
47010 | var extendStatics = function (d, b) {
|
47011 | extendStatics = Object.setPrototypeOf ||
|
47012 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
47013 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
47014 | return extendStatics(d, b);
|
47015 | };
|
47016 | return function (d, b) {
|
47017 | extendStatics(d, b);
|
47018 | function __() { this.constructor = d; }
|
47019 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
47020 | };
|
47021 | })();
|
47022 | var __decorate$h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
47023 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
47024 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
47025 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
47026 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
47027 | };
|
47028 | var FakeHScrollComp = (function (_super) {
|
47029 | __extends$h(FakeHScrollComp, _super);
|
47030 | function FakeHScrollComp() {
|
47031 | return _super.call(this, FakeHScrollComp.TEMPLATE, 'horizontal') || this;
|
47032 | }
|
47033 | FakeHScrollComp.prototype.postConstruct = function () {
|
47034 | var _this = this;
|
47035 | _super.prototype.postConstruct.call(this);
|
47036 |
|
47037 | var spacerWidthsListener = this.setFakeHScrollSpacerWidths.bind(this);
|
47038 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, spacerWidthsListener);
|
47039 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, spacerWidthsListener);
|
47040 | this.addManagedListener(this.eventService, Events.EVENT_PINNED_ROW_DATA_CHANGED, this.onPinnedRowDataChanged.bind(this));
|
47041 | this.addManagedPropertyListener('domLayout', spacerWidthsListener);
|
47042 | this.ctrlsService.registerFakeHScrollComp(this);
|
47043 | this.createManagedBean(new CenterWidthFeature(function (width) { return _this.eContainer.style.width = width + "px"; }));
|
47044 | };
|
47045 | FakeHScrollComp.prototype.initialiseInvisibleScrollbar = function () {
|
47046 | if (this.invisibleScrollbar !== undefined) {
|
47047 | return;
|
47048 | }
|
47049 | this.enableRtl = this.gridOptionsService.is('enableRtl');
|
47050 | _super.prototype.initialiseInvisibleScrollbar.call(this);
|
47051 | if (this.invisibleScrollbar) {
|
47052 | this.refreshCompBottom();
|
47053 | }
|
47054 | };
|
47055 | FakeHScrollComp.prototype.onPinnedRowDataChanged = function () {
|
47056 | this.refreshCompBottom();
|
47057 | };
|
47058 | FakeHScrollComp.prototype.refreshCompBottom = function () {
|
47059 | if (!this.invisibleScrollbar) {
|
47060 | return;
|
47061 | }
|
47062 | var bottomPinnedHeight = this.pinnedRowModel.getPinnedBottomTotalHeight();
|
47063 | this.getGui().style.bottom = bottomPinnedHeight + "px";
|
47064 | };
|
47065 | FakeHScrollComp.prototype.onScrollVisibilityChanged = function () {
|
47066 | _super.prototype.onScrollVisibilityChanged.call(this);
|
47067 | this.setFakeHScrollSpacerWidths();
|
47068 | };
|
47069 | FakeHScrollComp.prototype.setFakeHScrollSpacerWidths = function () {
|
47070 | var vScrollShowing = this.scrollVisibleService.isVerticalScrollShowing();
|
47071 |
|
47072 |
|
47073 | var rightSpacing = this.columnModel.getDisplayedColumnsRightWidth();
|
47074 | var scrollOnRight = !this.enableRtl && vScrollShowing;
|
47075 | var scrollbarWidth = this.gridOptionsService.getScrollbarWidth();
|
47076 | if (scrollOnRight) {
|
47077 | rightSpacing += scrollbarWidth;
|
47078 | }
|
47079 | setFixedWidth(this.eRightSpacer, rightSpacing);
|
47080 | this.eRightSpacer.classList.toggle('ag-scroller-corner', rightSpacing <= scrollbarWidth);
|
47081 |
|
47082 |
|
47083 | var leftSpacing = this.columnModel.getDisplayedColumnsLeftWidth();
|
47084 | var scrollOnLeft = this.enableRtl && vScrollShowing;
|
47085 | if (scrollOnLeft) {
|
47086 | leftSpacing += scrollbarWidth;
|
47087 | }
|
47088 | setFixedWidth(this.eLeftSpacer, leftSpacing);
|
47089 | this.eLeftSpacer.classList.toggle('ag-scroller-corner', leftSpacing <= scrollbarWidth);
|
47090 | };
|
47091 | FakeHScrollComp.prototype.setScrollVisible = function () {
|
47092 | var hScrollShowing = this.scrollVisibleService.isHorizontalScrollShowing();
|
47093 | var invisibleScrollbar = this.invisibleScrollbar;
|
47094 | var isSuppressHorizontalScroll = this.gridOptionsService.is('suppressHorizontalScroll');
|
47095 | var scrollbarWidth = hScrollShowing ? (this.gridOptionsService.getScrollbarWidth() || 0) : 0;
|
47096 | var adjustedScrollbarWidth = (scrollbarWidth === 0 && invisibleScrollbar) ? 16 : scrollbarWidth;
|
47097 | var scrollContainerSize = !isSuppressHorizontalScroll ? adjustedScrollbarWidth : 0;
|
47098 | this.addOrRemoveCssClass('ag-scrollbar-invisible', invisibleScrollbar);
|
47099 | setFixedHeight(this.getGui(), scrollContainerSize);
|
47100 | setFixedHeight(this.eViewport, scrollContainerSize);
|
47101 | setFixedHeight(this.eContainer, scrollContainerSize);
|
47102 | this.setDisplayed(hScrollShowing, { skipAriaHidden: true });
|
47103 | };
|
47104 | 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>";
|
47105 | __decorate$h([
|
47106 | RefSelector('eLeftSpacer')
|
47107 | ], FakeHScrollComp.prototype, "eLeftSpacer", void 0);
|
47108 | __decorate$h([
|
47109 | RefSelector('eRightSpacer')
|
47110 | ], FakeHScrollComp.prototype, "eRightSpacer", void 0);
|
47111 | __decorate$h([
|
47112 | Autowired('columnModel')
|
47113 | ], FakeHScrollComp.prototype, "columnModel", void 0);
|
47114 | __decorate$h([
|
47115 | Autowired('pinnedRowModel')
|
47116 | ], FakeHScrollComp.prototype, "pinnedRowModel", void 0);
|
47117 | __decorate$h([
|
47118 | PostConstruct
|
47119 | ], FakeHScrollComp.prototype, "postConstruct", null);
|
47120 | return FakeHScrollComp;
|
47121 | }(AbstractFakeScrollComp));
|
47122 |
|
47123 |
|
47124 |
|
47125 |
|
47126 |
|
47127 |
|
47128 |
|
47129 | var __extends$g = (undefined && undefined.__extends) || (function () {
|
47130 | var extendStatics = function (d, b) {
|
47131 | extendStatics = Object.setPrototypeOf ||
|
47132 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
47133 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
47134 | return extendStatics(d, b);
|
47135 | };
|
47136 | return function (d, b) {
|
47137 | extendStatics(d, b);
|
47138 | function __() { this.constructor = d; }
|
47139 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
47140 | };
|
47141 | })();
|
47142 | var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
47143 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
47144 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
47145 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
47146 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
47147 | };
|
47148 | var PinnedWidthService = (function (_super) {
|
47149 | __extends$g(PinnedWidthService, _super);
|
47150 | function PinnedWidthService() {
|
47151 | return _super !== null && _super.apply(this, arguments) || this;
|
47152 | }
|
47153 | PinnedWidthService.prototype.postConstruct = function () {
|
47154 | var listener = this.checkContainerWidths.bind(this);
|
47155 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);
|
47156 | this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, listener);
|
47157 | this.addManagedPropertyListener('domLayout', listener);
|
47158 | };
|
47159 | PinnedWidthService.prototype.checkContainerWidths = function () {
|
47160 | var printLayout = this.gridOptionsService.isDomLayout('print');
|
47161 | var newLeftWidth = printLayout ? 0 : this.columnModel.getDisplayedColumnsLeftWidth();
|
47162 | var newRightWidth = printLayout ? 0 : this.columnModel.getDisplayedColumnsRightWidth();
|
47163 | if (newLeftWidth != this.leftWidth) {
|
47164 | this.leftWidth = newLeftWidth;
|
47165 | this.eventService.dispatchEvent({ type: Events.EVENT_LEFT_PINNED_WIDTH_CHANGED });
|
47166 | }
|
47167 | if (newRightWidth != this.rightWidth) {
|
47168 | this.rightWidth = newRightWidth;
|
47169 | this.eventService.dispatchEvent({ type: Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED });
|
47170 | }
|
47171 | };
|
47172 | PinnedWidthService.prototype.getPinnedRightWidth = function () {
|
47173 | return this.rightWidth;
|
47174 | };
|
47175 | PinnedWidthService.prototype.getPinnedLeftWidth = function () {
|
47176 | return this.leftWidth;
|
47177 | };
|
47178 | __decorate$g([
|
47179 | Autowired('columnModel')
|
47180 | ], PinnedWidthService.prototype, "columnModel", void 0);
|
47181 | __decorate$g([
|
47182 | PostConstruct
|
47183 | ], PinnedWidthService.prototype, "postConstruct", null);
|
47184 | PinnedWidthService = __decorate$g([
|
47185 | Bean('pinnedWidthService')
|
47186 | ], PinnedWidthService);
|
47187 | return PinnedWidthService;
|
47188 | }(BeanStub));
|
47189 |
|
47190 |
|
47191 |
|
47192 |
|
47193 |
|
47194 |
|
47195 |
|
47196 | var __extends$f = (undefined && undefined.__extends) || (function () {
|
47197 | var extendStatics = function (d, b) {
|
47198 | extendStatics = Object.setPrototypeOf ||
|
47199 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
47200 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
47201 | return extendStatics(d, b);
|
47202 | };
|
47203 | return function (d, b) {
|
47204 | extendStatics(d, b);
|
47205 | function __() { this.constructor = d; }
|
47206 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
47207 | };
|
47208 | })();
|
47209 | var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
47210 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
47211 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
47212 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
47213 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
47214 | };
|
47215 | var RowNodeEventThrottle = (function (_super) {
|
47216 | __extends$f(RowNodeEventThrottle, _super);
|
47217 | function RowNodeEventThrottle() {
|
47218 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
47219 | _this.events = [];
|
47220 | return _this;
|
47221 | }
|
47222 | RowNodeEventThrottle.prototype.postConstruct = function () {
|
47223 | if (this.rowModel.getType() == 'clientSide') {
|
47224 | this.clientSideRowModel = this.rowModel;
|
47225 | }
|
47226 | };
|
47227 |
|
47228 |
|
47229 |
|
47230 |
|
47231 |
|
47232 |
|
47233 |
|
47234 |
|
47235 |
|
47236 |
|
47237 |
|
47238 | RowNodeEventThrottle.prototype.dispatchExpanded = function (event) {
|
47239 | var _this = this;
|
47240 |
|
47241 | if (this.clientSideRowModel == null) {
|
47242 | this.eventService.dispatchEvent(event);
|
47243 | return;
|
47244 | }
|
47245 | this.events.push(event);
|
47246 | var func = function () {
|
47247 | if (_this.clientSideRowModel) {
|
47248 | _this.clientSideRowModel.onRowGroupOpened();
|
47249 | }
|
47250 | _this.events.forEach(function (e) { return _this.eventService.dispatchEvent(e); });
|
47251 | _this.events = [];
|
47252 | };
|
47253 | if (this.dispatchExpandedDebounced == null) {
|
47254 | this.dispatchExpandedDebounced = this.animationFrameService.debounce(func);
|
47255 | }
|
47256 | this.dispatchExpandedDebounced();
|
47257 | };
|
47258 | __decorate$f([
|
47259 | Autowired('animationFrameService')
|
47260 | ], RowNodeEventThrottle.prototype, "animationFrameService", void 0);
|
47261 | __decorate$f([
|
47262 | Autowired('rowModel')
|
47263 | ], RowNodeEventThrottle.prototype, "rowModel", void 0);
|
47264 | __decorate$f([
|
47265 | PostConstruct
|
47266 | ], RowNodeEventThrottle.prototype, "postConstruct", null);
|
47267 | RowNodeEventThrottle = __decorate$f([
|
47268 | Bean('rowNodeEventThrottle')
|
47269 | ], RowNodeEventThrottle);
|
47270 | return RowNodeEventThrottle;
|
47271 | }(BeanStub));
|
47272 |
|
47273 |
|
47274 |
|
47275 |
|
47276 |
|
47277 |
|
47278 |
|
47279 | var __assign = (undefined && undefined.__assign) || function () {
|
47280 | __assign = Object.assign || function(t) {
|
47281 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
47282 | s = arguments[i];
|
47283 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
47284 | t[p] = s[p];
|
47285 | }
|
47286 | return t;
|
47287 | };
|
47288 | return __assign.apply(this, arguments);
|
47289 | };
|
47290 | var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
47291 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
47292 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
47293 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
47294 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
47295 | };
|
47296 | var __param$1 = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
47297 | return function (target, key) { decorator(target, key, paramIndex); }
|
47298 | };
|
47299 | var __read$4 = (undefined && undefined.__read) || function (o, n) {
|
47300 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
47301 | if (!m) return o;
|
47302 | var i = m.call(o), r, ar = [], e;
|
47303 | try {
|
47304 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
47305 | }
|
47306 | catch (error) { e = { error: error }; }
|
47307 | finally {
|
47308 | try {
|
47309 | if (r && !r.done && (m = i["return"])) m.call(i);
|
47310 | }
|
47311 | finally { if (e) throw e.error; }
|
47312 | }
|
47313 | return ar;
|
47314 | };
|
47315 | var __spread$3 = (undefined && undefined.__spread) || function () {
|
47316 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$4(arguments[i]));
|
47317 | return ar;
|
47318 | };
|
47319 | function toNumber(value) {
|
47320 | if (typeof value == 'number') {
|
47321 | return value;
|
47322 | }
|
47323 | if (typeof value == 'string') {
|
47324 | return parseInt(value, 10);
|
47325 | }
|
47326 | }
|
47327 | function isTrue(value) {
|
47328 | return value === true || value === 'true';
|
47329 | }
|
47330 | var GridOptionsService = (function () {
|
47331 | function GridOptionsService() {
|
47332 | this.destroyed = false;
|
47333 | this.domDataKey = '__AG_' + Math.random().toString();
|
47334 | this.propertyEventService = new EventService();
|
47335 | }
|
47336 | Object.defineProperty(GridOptionsService.prototype, "context", {
|
47337 |
|
47338 | get: function () {
|
47339 | return this.gridOptions['context'];
|
47340 | },
|
47341 | enumerable: false,
|
47342 | configurable: true
|
47343 | });
|
47344 | GridOptionsService.prototype.agWire = function (gridApi, columnApi) {
|
47345 | this.gridOptions.api = gridApi;
|
47346 | this.gridOptions.columnApi = columnApi;
|
47347 | this.api = gridApi;
|
47348 | this.columnApi = columnApi;
|
47349 | };
|
47350 | GridOptionsService.prototype.init = function () {
|
47351 | this.gridOptionLookup = new Set(__spread$3(ComponentUtil.ALL_PROPERTIES, ComponentUtil.EVENT_CALLBACKS));
|
47352 | var async = !this.is('suppressAsyncEvents');
|
47353 | this.eventService.addGlobalListener(this.globalEventHandler.bind(this), async);
|
47354 |
|
47355 | this.getScrollbarWidth();
|
47356 | };
|
47357 | GridOptionsService.prototype.destroy = function () {
|
47358 |
|
47359 |
|
47360 |
|
47361 | this.gridOptions.api = null;
|
47362 | this.gridOptions.columnApi = null;
|
47363 | this.destroyed = true;
|
47364 | };
|
47365 | |
47366 |
|
47367 |
|
47368 |
|
47369 | GridOptionsService.prototype.is = function (property) {
|
47370 | return isTrue(this.gridOptions[property]);
|
47371 | };
|
47372 | |
47373 |
|
47374 |
|
47375 |
|
47376 | GridOptionsService.prototype.get = function (property) {
|
47377 | return this.gridOptions[property];
|
47378 | };
|
47379 | |
47380 |
|
47381 |
|
47382 |
|
47383 | GridOptionsService.prototype.getNum = function (property) {
|
47384 | return toNumber(this.gridOptions[property]);
|
47385 | };
|
47386 | |
47387 |
|
47388 |
|
47389 |
|
47390 | GridOptionsService.prototype.getCallback = function (property) {
|
47391 | return this.mergeGridCommonParams(this.gridOptions[property]);
|
47392 | };
|
47393 | |
47394 |
|
47395 |
|
47396 |
|
47397 | GridOptionsService.prototype.exists = function (property) {
|
47398 | return exists(this.gridOptions[property]);
|
47399 | };
|
47400 | |
47401 |
|
47402 |
|
47403 |
|
47404 |
|
47405 | GridOptionsService.prototype.mergeGridCommonParams = function (callback) {
|
47406 | var _this = this;
|
47407 | if (callback) {
|
47408 | var wrapped = function (callbackParams) {
|
47409 | var mergedParams = callbackParams;
|
47410 | mergedParams.api = _this.api;
|
47411 | mergedParams.columnApi = _this.columnApi;
|
47412 | mergedParams.context = _this.context;
|
47413 | return callback(mergedParams);
|
47414 | };
|
47415 | return wrapped;
|
47416 | }
|
47417 | return callback;
|
47418 | };
|
47419 | |
47420 |
|
47421 |
|
47422 |
|
47423 |
|
47424 |
|
47425 |
|
47426 | GridOptionsService.prototype.set = function (key, newValue, force, eventParams) {
|
47427 | if (force === void 0) { force = false; }
|
47428 | if (eventParams === void 0) { eventParams = {}; }
|
47429 | if (this.gridOptionLookup.has(key)) {
|
47430 | var previousValue = this.gridOptions[key];
|
47431 | if (force || previousValue !== newValue) {
|
47432 | this.gridOptions[key] = newValue;
|
47433 | var event_1 = __assign({ type: key, currentValue: newValue, previousValue: previousValue }, eventParams);
|
47434 | this.propertyEventService.dispatchEvent(event_1);
|
47435 | }
|
47436 | }
|
47437 | };
|
47438 | GridOptionsService.prototype.addEventListener = function (key, listener) {
|
47439 | this.propertyEventService.addEventListener(key, listener);
|
47440 | };
|
47441 | GridOptionsService.prototype.removeEventListener = function (key, listener) {
|
47442 | this.propertyEventService.removeEventListener(key, listener);
|
47443 | };
|
47444 |
|
47445 | GridOptionsService.prototype.globalEventHandler = function (eventName, event) {
|
47446 |
|
47447 | if (this.destroyed) {
|
47448 | return;
|
47449 | }
|
47450 | var callbackMethodName = ComponentUtil.getCallbackForEvent(eventName);
|
47451 | if (typeof this.gridOptions[callbackMethodName] === 'function') {
|
47452 | this.gridOptions[callbackMethodName](event);
|
47453 | }
|
47454 | };
|
47455 |
|
47456 |
|
47457 |
|
47458 |
|
47459 |
|
47460 | GridOptionsService.prototype.getScrollbarWidth = function () {
|
47461 | if (this.scrollbarWidth == null) {
|
47462 | var useGridOptions = typeof this.gridOptions.scrollbarWidth === 'number' && this.gridOptions.scrollbarWidth >= 0;
|
47463 | var scrollbarWidth = useGridOptions ? this.gridOptions.scrollbarWidth : getScrollbarWidth();
|
47464 | if (scrollbarWidth != null) {
|
47465 | this.scrollbarWidth = scrollbarWidth;
|
47466 | this.eventService.dispatchEvent({
|
47467 | type: Events.EVENT_SCROLLBAR_WIDTH_CHANGED
|
47468 | });
|
47469 | }
|
47470 | }
|
47471 | return this.scrollbarWidth;
|
47472 | };
|
47473 | GridOptionsService.prototype.isRowModelType = function (rowModelType) {
|
47474 | return this.gridOptions.rowModelType === rowModelType ||
|
47475 | (rowModelType === 'clientSide' && missing(this.gridOptions.rowModelType));
|
47476 | };
|
47477 | GridOptionsService.prototype.isDomLayout = function (domLayout) {
|
47478 | var _a;
|
47479 | var gridLayout = (_a = this.gridOptions.domLayout) !== null && _a !== void 0 ? _a : 'normal';
|
47480 | return gridLayout === domLayout;
|
47481 | };
|
47482 | GridOptionsService.prototype.isRowSelection = function () {
|
47483 | return this.gridOptions.rowSelection === 'single' || this.gridOptions.rowSelection === 'multiple';
|
47484 | };
|
47485 | GridOptionsService.prototype.useAsyncEvents = function () {
|
47486 | return !this.is('suppressAsyncEvents');
|
47487 | };
|
47488 | GridOptionsService.prototype.isGetRowHeightFunction = function () {
|
47489 | return typeof this.gridOptions.getRowHeight === 'function';
|
47490 | };
|
47491 | GridOptionsService.prototype.getRowHeightForNode = function (rowNode, allowEstimate, defaultRowHeight) {
|
47492 | if (allowEstimate === void 0) { allowEstimate = false; }
|
47493 | if (defaultRowHeight == null) {
|
47494 | defaultRowHeight = this.environment.getDefaultRowHeight();
|
47495 | }
|
47496 |
|
47497 |
|
47498 |
|
47499 | if (this.isGetRowHeightFunction()) {
|
47500 | if (allowEstimate) {
|
47501 | return { height: defaultRowHeight, estimated: true };
|
47502 | }
|
47503 | var params = {
|
47504 | node: rowNode,
|
47505 | data: rowNode.data
|
47506 | };
|
47507 | var height = this.getCallback('getRowHeight')(params);
|
47508 | if (this.isNumeric(height)) {
|
47509 | if (height === 0) {
|
47510 | 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');
|
47511 | }
|
47512 | return { height: Math.max(1, height), estimated: false };
|
47513 | }
|
47514 | }
|
47515 | if (rowNode.detail && this.is('masterDetail')) {
|
47516 | return this.getMasterDetailRowHeight();
|
47517 | }
|
47518 | var rowHeight = this.gridOptions.rowHeight && this.isNumeric(this.gridOptions.rowHeight) ? this.gridOptions.rowHeight : defaultRowHeight;
|
47519 | return { height: rowHeight, estimated: false };
|
47520 | };
|
47521 | GridOptionsService.prototype.getMasterDetailRowHeight = function () {
|
47522 |
|
47523 |
|
47524 |
|
47525 | if (this.is('detailRowAutoHeight')) {
|
47526 | return { height: 1, estimated: false };
|
47527 | }
|
47528 | if (this.isNumeric(this.gridOptions.detailRowHeight)) {
|
47529 | return { height: this.gridOptions.detailRowHeight, estimated: false };
|
47530 | }
|
47531 | return { height: 300, estimated: false };
|
47532 | };
|
47533 |
|
47534 | GridOptionsService.prototype.getRowHeightAsNumber = function () {
|
47535 | if (!this.gridOptions.rowHeight || missing(this.gridOptions.rowHeight)) {
|
47536 | return this.environment.getDefaultRowHeight();
|
47537 | }
|
47538 | var rowHeight = this.gridOptions.rowHeight;
|
47539 | if (rowHeight && this.isNumeric(rowHeight)) {
|
47540 | this.environment.setRowHeightVariable(rowHeight);
|
47541 | return rowHeight;
|
47542 | }
|
47543 | console.warn('AG Grid row height must be a number if not using standard row model');
|
47544 | return this.environment.getDefaultRowHeight();
|
47545 | };
|
47546 | GridOptionsService.prototype.isNumeric = function (value) {
|
47547 | return !isNaN(value) && typeof value === 'number' && isFinite(value);
|
47548 | };
|
47549 | GridOptionsService.prototype.getDomDataKey = function () {
|
47550 | return this.domDataKey;
|
47551 | };
|
47552 |
|
47553 | GridOptionsService.prototype.getDomData = function (element, key) {
|
47554 | var domData = element[this.getDomDataKey()];
|
47555 | return domData ? domData[key] : undefined;
|
47556 | };
|
47557 | GridOptionsService.prototype.setDomData = function (element, key, value) {
|
47558 | var domDataKey = this.getDomDataKey();
|
47559 | var domData = element[domDataKey];
|
47560 | if (missing(domData)) {
|
47561 | domData = {};
|
47562 | element[domDataKey] = domData;
|
47563 | }
|
47564 | domData[key] = value;
|
47565 | };
|
47566 | GridOptionsService.prototype.getDocument = function () {
|
47567 |
|
47568 |
|
47569 | var result = null;
|
47570 | if (this.gridOptions.getDocument && exists(this.gridOptions.getDocument)) {
|
47571 | result = this.gridOptions.getDocument();
|
47572 | }
|
47573 | else if (this.eGridDiv) {
|
47574 | result = this.eGridDiv.ownerDocument;
|
47575 | }
|
47576 | if (result && exists(result)) {
|
47577 | return result;
|
47578 | }
|
47579 | return document;
|
47580 | };
|
47581 | GridOptionsService.prototype.getRootNode = function () {
|
47582 | return this.eGridDiv.getRootNode();
|
47583 | };
|
47584 | GridOptionsService.prototype.getRowIdFunc = function () {
|
47585 | var getRowId = this.getCallback('getRowId');
|
47586 | if (getRowId) {
|
47587 | return getRowId;
|
47588 | }
|
47589 |
|
47590 | var getRowNodeId = this.gridOptions.getRowNodeId;
|
47591 | if (getRowNodeId) {
|
47592 | return function (params) { return getRowNodeId(params.data); };
|
47593 | }
|
47594 | };
|
47595 | GridOptionsService.prototype.getAsyncTransactionWaitMillis = function () {
|
47596 | return exists(this.gridOptions.asyncTransactionWaitMillis) ? this.gridOptions.asyncTransactionWaitMillis : 50;
|
47597 | };
|
47598 | GridOptionsService.prototype.isAnimateRows = function () {
|
47599 |
|
47600 | if (this.is('ensureDomOrder')) {
|
47601 | return false;
|
47602 | }
|
47603 | return this.is('animateRows');
|
47604 | };
|
47605 | GridOptionsService.prototype.isTreeData = function () {
|
47606 | return this.is('treeData') && ModuleRegistry.assertRegistered(ModuleNames.RowGroupingModule, 'Tree Data');
|
47607 | };
|
47608 | GridOptionsService.prototype.isMasterDetail = function () {
|
47609 | return this.is('masterDetail') && ModuleRegistry.assertRegistered(ModuleNames.MasterDetailModule, 'masterDetail');
|
47610 | };
|
47611 | GridOptionsService.prototype.isEnableRangeSelection = function () {
|
47612 | return this.is('enableRangeSelection') && ModuleRegistry.isRegistered(ModuleNames.RangeSelectionModule);
|
47613 | };
|
47614 | GridOptionsService.prototype.isColumnsSortingCoupledToGroup = function () {
|
47615 | var autoGroupColumnDef = this.gridOptions.autoGroupColumnDef;
|
47616 | var isClientSideRowModel = this.isRowModelType('clientSide');
|
47617 | return isClientSideRowModel && !(autoGroupColumnDef === null || autoGroupColumnDef === void 0 ? void 0 : autoGroupColumnDef.comparator);
|
47618 | };
|
47619 | GridOptionsService.prototype.getGroupAggFiltering = function () {
|
47620 | var userValue = this.gridOptions.groupAggFiltering;
|
47621 | if (typeof userValue === 'function') {
|
47622 | return this.getCallback('groupAggFiltering');
|
47623 | }
|
47624 | if (isTrue(userValue)) {
|
47625 | return function () { return true; };
|
47626 | }
|
47627 | return undefined;
|
47628 | };
|
47629 | GridOptionsService.prototype.isGroupMultiAutoColumn = function () {
|
47630 | if (this.gridOptions.groupDisplayType) {
|
47631 | return matchesGroupDisplayType('multipleColumns', this.gridOptions.groupDisplayType);
|
47632 | }
|
47633 |
|
47634 | return this.is('groupHideOpenParents');
|
47635 | };
|
47636 | GridOptionsService.prototype.isGroupUseEntireRow = function (pivotMode) {
|
47637 |
|
47638 | if (pivotMode) {
|
47639 | return false;
|
47640 | }
|
47641 | return this.gridOptions.groupDisplayType ? matchesGroupDisplayType('groupRows', this.gridOptions.groupDisplayType) : false;
|
47642 | };
|
47643 | __decorate$e([
|
47644 | Autowired('gridOptions')
|
47645 | ], GridOptionsService.prototype, "gridOptions", void 0);
|
47646 | __decorate$e([
|
47647 | Autowired('eventService')
|
47648 | ], GridOptionsService.prototype, "eventService", void 0);
|
47649 | __decorate$e([
|
47650 | Autowired('environment')
|
47651 | ], GridOptionsService.prototype, "environment", void 0);
|
47652 | __decorate$e([
|
47653 | Autowired('eGridDiv')
|
47654 | ], GridOptionsService.prototype, "eGridDiv", void 0);
|
47655 | __decorate$e([
|
47656 | __param$1(0, Qualifier('gridApi')), __param$1(1, Qualifier('columnApi'))
|
47657 | ], GridOptionsService.prototype, "agWire", null);
|
47658 | __decorate$e([
|
47659 | PostConstruct
|
47660 | ], GridOptionsService.prototype, "init", null);
|
47661 | __decorate$e([
|
47662 | PreDestroy
|
47663 | ], GridOptionsService.prototype, "destroy", null);
|
47664 | GridOptionsService = __decorate$e([
|
47665 | Bean('gridOptionsService')
|
47666 | ], GridOptionsService);
|
47667 | return GridOptionsService;
|
47668 | }());
|
47669 |
|
47670 |
|
47671 |
|
47672 |
|
47673 |
|
47674 |
|
47675 |
|
47676 | var __extends$e = (undefined && undefined.__extends) || (function () {
|
47677 | var extendStatics = function (d, b) {
|
47678 | extendStatics = Object.setPrototypeOf ||
|
47679 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
47680 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
47681 | return extendStatics(d, b);
|
47682 | };
|
47683 | return function (d, b) {
|
47684 | extendStatics(d, b);
|
47685 | function __() { this.constructor = d; }
|
47686 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
47687 | };
|
47688 | })();
|
47689 | var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
47690 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
47691 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
47692 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
47693 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
47694 | };
|
47695 | var LocaleService = (function (_super) {
|
47696 | __extends$e(LocaleService, _super);
|
47697 | function LocaleService() {
|
47698 | return _super !== null && _super.apply(this, arguments) || this;
|
47699 | }
|
47700 | LocaleService.prototype.getLocaleTextFunc = function () {
|
47701 | var getLocaleText = this.gridOptionsService.getCallback('getLocaleText');
|
47702 | if (getLocaleText) {
|
47703 |
|
47704 | return function (key, defaultValue, variableValues) {
|
47705 | var params = {
|
47706 | key: key,
|
47707 | defaultValue: defaultValue,
|
47708 | variableValues: variableValues
|
47709 | };
|
47710 | return getLocaleText(params);
|
47711 | };
|
47712 | }
|
47713 | var localeTextFunc = this.gridOptionsService.get('localeTextFunc');
|
47714 | if (localeTextFunc) {
|
47715 | return localeTextFunc;
|
47716 | }
|
47717 | var localeText = this.gridOptionsService.get('localeText');
|
47718 | return function (key, defaultValue, variableValues) {
|
47719 | var localisedText = localeText && localeText[key];
|
47720 | if (localisedText && variableValues && variableValues.length) {
|
47721 | var found = 0;
|
47722 | while (true) {
|
47723 | if (found >= variableValues.length) {
|
47724 | break;
|
47725 | }
|
47726 | var idx = localisedText.indexOf('${variable}');
|
47727 | if (idx === -1) {
|
47728 | break;
|
47729 | }
|
47730 | localisedText = localisedText.replace('${variable}', variableValues[found++]);
|
47731 | }
|
47732 | }
|
47733 | return localisedText !== null && localisedText !== void 0 ? localisedText : defaultValue;
|
47734 | };
|
47735 | };
|
47736 | LocaleService = __decorate$d([
|
47737 | Bean('localeService')
|
47738 | ], LocaleService);
|
47739 | return LocaleService;
|
47740 | }(BeanStub));
|
47741 |
|
47742 |
|
47743 |
|
47744 |
|
47745 |
|
47746 |
|
47747 |
|
47748 | var __extends$d = (undefined && undefined.__extends) || (function () {
|
47749 | var extendStatics = function (d, b) {
|
47750 | extendStatics = Object.setPrototypeOf ||
|
47751 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
47752 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
47753 | return extendStatics(d, b);
|
47754 | };
|
47755 | return function (d, b) {
|
47756 | extendStatics(d, b);
|
47757 | function __() { this.constructor = d; }
|
47758 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
47759 | };
|
47760 | })();
|
47761 | var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
47762 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
47763 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
47764 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
47765 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
47766 | };
|
47767 | var FakeVScrollComp = (function (_super) {
|
47768 | __extends$d(FakeVScrollComp, _super);
|
47769 | function FakeVScrollComp() {
|
47770 | return _super.call(this, FakeVScrollComp.TEMPLATE, 'vertical') || this;
|
47771 | }
|
47772 | FakeVScrollComp.prototype.postConstruct = function () {
|
47773 | _super.prototype.postConstruct.call(this);
|
47774 | this.createManagedBean(new SetHeightFeature(this.eContainer));
|
47775 | this.ctrlsService.registerFakeVScrollComp(this);
|
47776 | };
|
47777 | FakeVScrollComp.prototype.setScrollVisible = function () {
|
47778 | var vScrollShowing = this.scrollVisibleService.isVerticalScrollShowing();
|
47779 | var invisibleScrollbar = this.invisibleScrollbar;
|
47780 | var scrollbarWidth = vScrollShowing ? (this.gridOptionsService.getScrollbarWidth() || 0) : 0;
|
47781 | var adjustedScrollbarWidth = (scrollbarWidth === 0 && invisibleScrollbar) ? 16 : scrollbarWidth;
|
47782 | this.addOrRemoveCssClass('ag-scrollbar-invisible', invisibleScrollbar);
|
47783 | setFixedWidth(this.getGui(), adjustedScrollbarWidth);
|
47784 | setFixedWidth(this.eViewport, adjustedScrollbarWidth);
|
47785 | setFixedWidth(this.eContainer, adjustedScrollbarWidth);
|
47786 | this.setDisplayed(vScrollShowing, { skipAriaHidden: true });
|
47787 | };
|
47788 | FakeVScrollComp.TEMPLATE = "<div class=\"ag-body-vertical-scroll\" aria-hidden=\"true\">\n <div class=\"ag-body-vertical-scroll-viewport\" ref=\"eViewport\">\n <div class=\"ag-body-vertical-scroll-container\" ref=\"eContainer\"></div>\n </div>\n </div>";
|
47789 | __decorate$c([
|
47790 | PostConstruct
|
47791 | ], FakeVScrollComp.prototype, "postConstruct", null);
|
47792 | return FakeVScrollComp;
|
47793 | }(AbstractFakeScrollComp));
|
47794 |
|
47795 |
|
47796 |
|
47797 |
|
47798 |
|
47799 |
|
47800 |
|
47801 | var __read$3 = (undefined && undefined.__read) || function (o, n) {
|
47802 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
47803 | if (!m) return o;
|
47804 | var i = m.call(o), r, ar = [], e;
|
47805 | try {
|
47806 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
47807 | }
|
47808 | catch (error) { e = { error: error }; }
|
47809 | finally {
|
47810 | try {
|
47811 | if (r && !r.done && (m = i["return"])) m.call(i);
|
47812 | }
|
47813 | finally { if (e) throw e.error; }
|
47814 | }
|
47815 | return ar;
|
47816 | };
|
47817 | var __spread$2 = (undefined && undefined.__spread) || function () {
|
47818 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$3(arguments[i]));
|
47819 | return ar;
|
47820 | };
|
47821 |
|
47822 |
|
47823 | var Grid = (function () {
|
47824 | function Grid(eGridDiv, gridOptions, params) {
|
47825 | if (!gridOptions) {
|
47826 | console.error('AG Grid: no gridOptions provided to the grid');
|
47827 | return;
|
47828 | }
|
47829 | this.gridOptions = gridOptions;
|
47830 | new GridCoreCreator().create(eGridDiv, gridOptions, function (context) {
|
47831 | var gridComp = new GridComp(eGridDiv);
|
47832 | context.createBean(gridComp);
|
47833 | }, undefined, params);
|
47834 | }
|
47835 | Grid.prototype.destroy = function () {
|
47836 | if (this.gridOptions && this.gridOptions.api) {
|
47837 | this.gridOptions.api.destroy();
|
47838 | }
|
47839 | };
|
47840 | return Grid;
|
47841 | }());
|
47842 |
|
47843 |
|
47844 | var GridCoreCreator = (function () {
|
47845 | function GridCoreCreator() {
|
47846 | }
|
47847 | GridCoreCreator.prototype.create = function (eGridDiv, gridOptions, createUi, acceptChanges, params) {
|
47848 | var _this = this;
|
47849 | var debug = !!gridOptions.debug;
|
47850 | var registeredModules = this.getRegisteredModules(params);
|
47851 | var beanClasses = this.createBeansList(gridOptions.rowModelType, registeredModules);
|
47852 | var providedBeanInstances = this.createProvidedBeans(eGridDiv, gridOptions, params);
|
47853 | if (!beanClasses) {
|
47854 | return;
|
47855 | }
|
47856 | var contextParams = {
|
47857 | providedBeanInstances: providedBeanInstances,
|
47858 | beanClasses: beanClasses,
|
47859 | debug: debug
|
47860 | };
|
47861 | var logger = new Logger('AG Grid', function () { return gridOptions.debug; });
|
47862 | var contextLogger = new Logger('Context', function () { return contextParams.debug; });
|
47863 | var context = new Context(contextParams, contextLogger);
|
47864 | var beans = context.getBean('beans');
|
47865 | this.registerModuleUserComponents(beans, registeredModules);
|
47866 | this.registerStackComponents(beans, registeredModules);
|
47867 | this.registerControllers(beans, registeredModules);
|
47868 | createUi(context);
|
47869 |
|
47870 | beans.ctrlsService.whenReady(function () {
|
47871 | _this.setColumnsAndData(beans);
|
47872 | _this.dispatchGridReadyEvent(beans);
|
47873 | var isEnterprise = ModuleRegistry.isRegistered(ModuleNames.EnterpriseCoreModule);
|
47874 | logger.log("initialised successfully, enterprise = " + isEnterprise);
|
47875 | });
|
47876 | if (acceptChanges) {
|
47877 | acceptChanges(context);
|
47878 | }
|
47879 | };
|
47880 | GridCoreCreator.prototype.registerControllers = function (beans, registeredModules) {
|
47881 | registeredModules.forEach(function (module) {
|
47882 | if (module.controllers) {
|
47883 | module.controllers.forEach(function (meta) { return beans.ctrlsFactory.register(meta); });
|
47884 | }
|
47885 | });
|
47886 | };
|
47887 | GridCoreCreator.prototype.registerStackComponents = function (beans, registeredModules) {
|
47888 | var agStackComponents = this.createAgStackComponentsList(registeredModules);
|
47889 | beans.agStackComponentsRegistry.setupComponents(agStackComponents);
|
47890 | };
|
47891 | GridCoreCreator.prototype.getRegisteredModules = function (params) {
|
47892 | var passedViaConstructor = params ? params.modules : null;
|
47893 | var registered = ModuleRegistry.getRegisteredModules();
|
47894 | var allModules = [];
|
47895 | var mapNames = {};
|
47896 |
|
47897 | function addModule(moduleBased, mod) {
|
47898 | function addIndividualModule(currentModule) {
|
47899 | if (!mapNames[currentModule.moduleName]) {
|
47900 | mapNames[currentModule.moduleName] = true;
|
47901 | allModules.push(currentModule);
|
47902 | ModuleRegistry.register(currentModule, moduleBased);
|
47903 | }
|
47904 | }
|
47905 | addIndividualModule(mod);
|
47906 | if (mod.dependantModules) {
|
47907 | mod.dependantModules.forEach(addModule.bind(null, moduleBased));
|
47908 | }
|
47909 | }
|
47910 | if (passedViaConstructor) {
|
47911 | passedViaConstructor.forEach(addModule.bind(null, true));
|
47912 | }
|
47913 | if (registered) {
|
47914 | registered.forEach(addModule.bind(null, !ModuleRegistry.isPackageBased()));
|
47915 | }
|
47916 | return allModules;
|
47917 | };
|
47918 | GridCoreCreator.prototype.registerModuleUserComponents = function (beans, registeredModules) {
|
47919 | var moduleUserComps = this.extractModuleEntity(registeredModules, function (module) { return module.userComponents ? module.userComponents : []; });
|
47920 | moduleUserComps.forEach(function (compMeta) {
|
47921 | beans.userComponentRegistry.registerDefaultComponent(compMeta.componentName, compMeta.componentClass);
|
47922 | });
|
47923 | };
|
47924 | GridCoreCreator.prototype.createProvidedBeans = function (eGridDiv, gridOptions, params) {
|
47925 | var frameworkOverrides = params ? params.frameworkOverrides : null;
|
47926 | if (missing(frameworkOverrides)) {
|
47927 | frameworkOverrides = new VanillaFrameworkOverrides();
|
47928 | }
|
47929 | var seed = {
|
47930 | gridOptions: gridOptions,
|
47931 | eGridDiv: eGridDiv,
|
47932 | globalEventListener: params ? params.globalEventListener : null,
|
47933 | frameworkOverrides: frameworkOverrides
|
47934 | };
|
47935 | if (params && params.providedBeanInstances) {
|
47936 | Object.assign(seed, params.providedBeanInstances);
|
47937 | }
|
47938 | return seed;
|
47939 | };
|
47940 | GridCoreCreator.prototype.createAgStackComponentsList = function (registeredModules) {
|
47941 | var components = [
|
47942 | { componentName: 'AgCheckbox', componentClass: AgCheckbox },
|
47943 | { componentName: 'AgRadioButton', componentClass: AgRadioButton },
|
47944 | { componentName: 'AgToggleButton', componentClass: AgToggleButton },
|
47945 | { componentName: 'AgInputTextField', componentClass: AgInputTextField },
|
47946 | { componentName: 'AgInputTextArea', componentClass: AgInputTextArea },
|
47947 | { componentName: 'AgInputNumberField', componentClass: AgInputNumberField },
|
47948 | { componentName: 'AgInputRange', componentClass: AgInputRange },
|
47949 | { componentName: 'AgSelect', componentClass: AgSelect },
|
47950 | { componentName: 'AgSlider', componentClass: AgSlider },
|
47951 | { componentName: 'AgGridBody', componentClass: GridBodyComp },
|
47952 | { componentName: 'AgHeaderRoot', componentClass: GridHeaderComp },
|
47953 | { componentName: 'AgSortIndicator', componentClass: SortIndicatorComp },
|
47954 | { componentName: 'AgPagination', componentClass: PaginationComp },
|
47955 | { componentName: 'AgOverlayWrapper', componentClass: OverlayWrapperComponent },
|
47956 | { componentName: 'AgGroupComponent', componentClass: AgGroupComponent },
|
47957 | { componentName: 'AgPanel', componentClass: AgPanel },
|
47958 | { componentName: 'AgDialog', componentClass: AgDialog },
|
47959 | { componentName: 'AgRowContainer', componentClass: RowContainerComp },
|
47960 | { componentName: 'AgFakeHorizontalScroll', componentClass: FakeHScrollComp },
|
47961 | { componentName: 'AgFakeVerticalScroll', componentClass: FakeVScrollComp }
|
47962 | ];
|
47963 | var moduleAgStackComps = this.extractModuleEntity(registeredModules, function (module) { return module.agStackComponents ? module.agStackComponents : []; });
|
47964 | components = components.concat(moduleAgStackComps);
|
47965 | return components;
|
47966 | };
|
47967 | GridCoreCreator.prototype.createBeansList = function (rowModelType, registeredModules) {
|
47968 | if (rowModelType === void 0) { rowModelType = 'clientSide'; }
|
47969 |
|
47970 | var rowModelModules = registeredModules.filter(function (module) { return !module.rowModel || module.rowModel === rowModelType; });
|
47971 |
|
47972 | var rowModelModuleNames = {
|
47973 | clientSide: ModuleNames.ClientSideRowModelModule,
|
47974 | infinite: ModuleNames.InfiniteRowModelModule,
|
47975 | serverSide: ModuleNames.ServerSideRowModelModule,
|
47976 | viewport: ModuleNames.ViewportRowModelModule
|
47977 | };
|
47978 | if (!rowModelModuleNames[rowModelType]) {
|
47979 | console.error('AG Grid: could not find row model for rowModelType = ' + rowModelType);
|
47980 | return;
|
47981 | }
|
47982 | if (!ModuleRegistry.assertRegistered(rowModelModuleNames[rowModelType], "rowModelType = '" + rowModelType + "'")) {
|
47983 | return;
|
47984 | }
|
47985 |
|
47986 | var beans = [
|
47987 | Beans, RowPositionUtils, CellPositionUtils, HeaderPositionUtils,
|
47988 | PaginationAutoPageSizeService, GridApi, UserComponentRegistry, AgComponentUtils,
|
47989 | ComponentMetadataProvider, ResizeObserverService, UserComponentFactory,
|
47990 | RowContainerHeightService, HorizontalResizeService, LocaleService, GridOptionsValidator,
|
47991 | PinnedRowModel, DragService, DisplayedGroupCreator, EventService, GridOptionsService,
|
47992 | PopupService, SelectionService, FilterManager, ColumnModel, HeaderNavigationService,
|
47993 | PaginationProxy, RowRenderer, ExpressionService, ColumnFactory, TemplateService,
|
47994 | AlignedGridsService, NavigationService, ValueCache, ValueService, LoggerFactory,
|
47995 | ColumnUtils, AutoWidthCalculator, StandardMenuFactory, DragAndDropService, ColumnApi,
|
47996 | FocusService, MouseEventService, Environment, CellNavigationService, ValueFormatterService,
|
47997 | StylingService, ScrollVisibleService, SortController, ColumnHoverService, ColumnAnimationService,
|
47998 | SelectableService, AutoGroupColService, ChangeDetectionService, AnimationFrameService,
|
47999 | UndoRedoService, AgStackComponentsRegistry, ColumnDefFactory,
|
48000 | RowCssClassCalculator, RowNodeBlockLoader, RowNodeSorter, CtrlsService,
|
48001 | PinnedWidthService, RowNodeEventThrottle, CtrlsFactory
|
48002 | ];
|
48003 | var moduleBeans = this.extractModuleEntity(rowModelModules, function (module) { return module.beans ? module.beans : []; });
|
48004 | beans.push.apply(beans, __spread$2(moduleBeans));
|
48005 |
|
48006 |
|
48007 | var beansNoDuplicates = [];
|
48008 | beans.forEach(function (bean) {
|
48009 | if (beansNoDuplicates.indexOf(bean) < 0) {
|
48010 | beansNoDuplicates.push(bean);
|
48011 | }
|
48012 | });
|
48013 | return beansNoDuplicates;
|
48014 | };
|
48015 | GridCoreCreator.prototype.extractModuleEntity = function (moduleEntities, extractor) {
|
48016 | return [].concat.apply([], __spread$2(moduleEntities.map(extractor)));
|
48017 | };
|
48018 | GridCoreCreator.prototype.setColumnsAndData = function (beans) {
|
48019 | var columnDefs = beans.gridOptionsService.get('columnDefs');
|
48020 | beans.columnModel.setColumnDefs(columnDefs || [], "gridInitializing");
|
48021 | beans.rowModel.start();
|
48022 | };
|
48023 | GridCoreCreator.prototype.dispatchGridReadyEvent = function (beans) {
|
48024 | var readyEvent = {
|
48025 | type: Events.EVENT_GRID_READY,
|
48026 | };
|
48027 | beans.eventService.dispatchEvent(readyEvent);
|
48028 | };
|
48029 | return GridCoreCreator;
|
48030 | }());
|
48031 |
|
48032 |
|
48033 |
|
48034 |
|
48035 |
|
48036 |
|
48037 |
|
48038 | var BaseComponentWrapper = (function () {
|
48039 | function BaseComponentWrapper() {
|
48040 | }
|
48041 | BaseComponentWrapper.prototype.wrap = function (OriginalConstructor, mandatoryMethodList, optionalMethodList, componentType) {
|
48042 | var _this = this;
|
48043 | if (optionalMethodList === void 0) { optionalMethodList = []; }
|
48044 | var wrapper = this.createWrapper(OriginalConstructor, componentType);
|
48045 | mandatoryMethodList.forEach((function (methodName) {
|
48046 | _this.createMethod(wrapper, methodName, true);
|
48047 | }));
|
48048 | optionalMethodList.forEach((function (methodName) {
|
48049 | _this.createMethod(wrapper, methodName, false);
|
48050 | }));
|
48051 | return wrapper;
|
48052 | };
|
48053 | BaseComponentWrapper.prototype.unwrap = function (comp) {
|
48054 | return comp;
|
48055 | };
|
48056 | BaseComponentWrapper.prototype.createMethod = function (wrapper, methodName, mandatory) {
|
48057 | wrapper.addMethod(methodName, this.createMethodProxy(wrapper, methodName, mandatory));
|
48058 | };
|
48059 | BaseComponentWrapper.prototype.createMethodProxy = function (wrapper, methodName, mandatory) {
|
48060 | return function () {
|
48061 | if (wrapper.hasMethod(methodName)) {
|
48062 | return wrapper.callMethod(methodName, arguments);
|
48063 | }
|
48064 | if (mandatory) {
|
48065 | console.warn('AG Grid: Framework component is missing the method ' + methodName + '()');
|
48066 | }
|
48067 | return null;
|
48068 | };
|
48069 | };
|
48070 | return BaseComponentWrapper;
|
48071 | }());
|
48072 |
|
48073 |
|
48074 |
|
48075 |
|
48076 |
|
48077 |
|
48078 |
|
48079 | var DEFAULT_CHART_GROUPS = {
|
48080 | columnGroup: [
|
48081 | 'column',
|
48082 | 'stackedColumn',
|
48083 | 'normalizedColumn'
|
48084 | ],
|
48085 | barGroup: [
|
48086 | 'bar',
|
48087 | 'stackedBar',
|
48088 | 'normalizedBar'
|
48089 | ],
|
48090 | pieGroup: [
|
48091 | 'pie',
|
48092 | 'doughnut'
|
48093 | ],
|
48094 | lineGroup: [
|
48095 | 'line'
|
48096 | ],
|
48097 | scatterGroup: [
|
48098 | 'scatter',
|
48099 | 'bubble'
|
48100 | ],
|
48101 | areaGroup: [
|
48102 | 'area',
|
48103 | 'stackedArea',
|
48104 | 'normalizedArea'
|
48105 | ],
|
48106 | histogramGroup: [
|
48107 | 'histogram'
|
48108 | ],
|
48109 | combinationGroup: [
|
48110 | 'columnLineCombo',
|
48111 | 'areaColumnCombo',
|
48112 | 'customCombo'
|
48113 | ]
|
48114 | };
|
48115 | var CHART_TOOL_PANEL_ALLOW_LIST = [
|
48116 | 'chartSettings',
|
48117 | 'chartData',
|
48118 | 'chartFormat'
|
48119 | ];
|
48120 | var CHART_TOOLBAR_ALLOW_LIST = [
|
48121 | 'chartUnlink',
|
48122 | 'chartLink',
|
48123 | 'chartDownload'
|
48124 | ];
|
48125 | var CHART_TOOL_PANEL_MENU_OPTIONS = {
|
48126 | settings: "chartSettings",
|
48127 | data: "chartData",
|
48128 | format: "chartFormat"
|
48129 | };
|
48130 |
|
48131 |
|
48132 |
|
48133 |
|
48134 |
|
48135 |
|
48136 |
|
48137 |
|
48138 |
|
48139 |
|
48140 | var __FORCE_MODULE_DETECTION = 0;
|
48141 |
|
48142 |
|
48143 |
|
48144 |
|
48145 |
|
48146 |
|
48147 |
|
48148 | var BarColumnLabelPlacement;
|
48149 | (function (BarColumnLabelPlacement) {
|
48150 | BarColumnLabelPlacement["InsideBase"] = "insideBase";
|
48151 | BarColumnLabelPlacement["InsideEnd"] = "insideEnd";
|
48152 | BarColumnLabelPlacement["Center"] = "center";
|
48153 | BarColumnLabelPlacement["OutsideEnd"] = "outsideEnd";
|
48154 | })(BarColumnLabelPlacement || (BarColumnLabelPlacement = {}));
|
48155 |
|
48156 |
|
48157 |
|
48158 |
|
48159 |
|
48160 |
|
48161 |
|
48162 | var globalObj = typeof global === 'undefined' ? {} : global;
|
48163 | globalObj.HTMLElement = typeof HTMLElement === 'undefined' ? {} : HTMLElement;
|
48164 | globalObj.HTMLButtonElement = typeof HTMLButtonElement === 'undefined' ? {} : HTMLButtonElement;
|
48165 | globalObj.HTMLSelectElement = typeof HTMLSelectElement === 'undefined' ? {} : HTMLSelectElement;
|
48166 | globalObj.HTMLInputElement = typeof HTMLInputElement === 'undefined' ? {} : HTMLInputElement;
|
48167 | globalObj.Node = typeof Node === 'undefined' ? {} : Node;
|
48168 | globalObj.MouseEvent = typeof MouseEvent === 'undefined' ? {} : MouseEvent;
|
48169 |
|
48170 | var __read$2 = (undefined && undefined.__read) || function (o, n) {
|
48171 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
48172 | if (!m) return o;
|
48173 | var i = m.call(o), r, ar = [], e;
|
48174 | try {
|
48175 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
48176 | }
|
48177 | catch (error) { e = { error: error }; }
|
48178 | finally {
|
48179 | try {
|
48180 | if (r && !r.done && (m = i["return"])) m.call(i);
|
48181 | }
|
48182 | finally { if (e) throw e.error; }
|
48183 | }
|
48184 | return ar;
|
48185 | };
|
48186 | var __spread$1 = (undefined && undefined.__spread) || function () {
|
48187 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$2(arguments[i]));
|
48188 | return ar;
|
48189 | };
|
48190 | var ClientSideNodeManager = (function () {
|
48191 | function ClientSideNodeManager(rootNode, gridOptionsService, eventService, columnModel, selectionService, beans) {
|
48192 | this.nextId = 0;
|
48193 |
|
48194 | this.allNodesMap = {};
|
48195 | this.rootNode = rootNode;
|
48196 | this.gridOptionsService = gridOptionsService;
|
48197 | this.eventService = eventService;
|
48198 | this.columnModel = columnModel;
|
48199 | this.beans = beans;
|
48200 | this.selectionService = selectionService;
|
48201 | this.rootNode.group = true;
|
48202 | this.rootNode.level = -1;
|
48203 | this.rootNode.id = ClientSideNodeManager.ROOT_NODE_ID;
|
48204 | this.rootNode.allLeafChildren = [];
|
48205 | this.rootNode.childrenAfterGroup = [];
|
48206 | this.rootNode.childrenAfterSort = [];
|
48207 | this.rootNode.childrenAfterAggFilter = [];
|
48208 | this.rootNode.childrenAfterFilter = [];
|
48209 |
|
48210 | this.postConstruct();
|
48211 | }
|
48212 |
|
48213 | ClientSideNodeManager.prototype.postConstruct = function () {
|
48214 |
|
48215 | this.suppressParentsInRowNodes = this.gridOptionsService.is('suppressParentsInRowNodes');
|
48216 | this.isRowMasterFunc = this.gridOptionsService.get('isRowMaster');
|
48217 | this.doingTreeData = this.gridOptionsService.isTreeData();
|
48218 | this.doingMasterDetail = this.gridOptionsService.isMasterDetail();
|
48219 | };
|
48220 | ClientSideNodeManager.prototype.getCopyOfNodesMap = function () {
|
48221 | return _.cloneObject(this.allNodesMap);
|
48222 | };
|
48223 | ClientSideNodeManager.prototype.getRowNode = function (id) {
|
48224 | return this.allNodesMap[id];
|
48225 | };
|
48226 | ClientSideNodeManager.prototype.setRowData = function (rowData) {
|
48227 | var _this = this;
|
48228 | if (typeof rowData === 'string') {
|
48229 | 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');
|
48230 | return;
|
48231 | }
|
48232 | var rootNode = this.rootNode;
|
48233 | var sibling = this.rootNode.sibling;
|
48234 | rootNode.childrenAfterFilter = null;
|
48235 | rootNode.childrenAfterGroup = null;
|
48236 | rootNode.childrenAfterAggFilter = null;
|
48237 | rootNode.childrenAfterSort = null;
|
48238 | rootNode.childrenMapped = null;
|
48239 | rootNode.updateHasChildren();
|
48240 | this.nextId = 0;
|
48241 | this.allNodesMap = {};
|
48242 | if (rowData) {
|
48243 |
|
48244 |
|
48245 |
|
48246 | rootNode.allLeafChildren = rowData.map(function (dataItem) { return _this.createNode(dataItem, _this.rootNode, ClientSideNodeManager.TOP_LEVEL); });
|
48247 | }
|
48248 | else {
|
48249 | rootNode.allLeafChildren = [];
|
48250 | rootNode.childrenAfterGroup = [];
|
48251 | }
|
48252 | if (sibling) {
|
48253 | sibling.childrenAfterFilter = rootNode.childrenAfterFilter;
|
48254 | sibling.childrenAfterGroup = rootNode.childrenAfterGroup;
|
48255 | sibling.childrenAfterAggFilter = rootNode.childrenAfterAggFilter;
|
48256 | sibling.childrenAfterSort = rootNode.childrenAfterSort;
|
48257 | sibling.childrenMapped = rootNode.childrenMapped;
|
48258 | sibling.allLeafChildren = rootNode.allLeafChildren;
|
48259 | }
|
48260 | };
|
48261 | ClientSideNodeManager.prototype.updateRowData = function (rowDataTran, rowNodeOrder) {
|
48262 | var rowNodeTransaction = {
|
48263 | remove: [],
|
48264 | update: [],
|
48265 | add: []
|
48266 | };
|
48267 | var nodesToUnselect = [];
|
48268 | this.executeRemove(rowDataTran, rowNodeTransaction, nodesToUnselect);
|
48269 | this.executeUpdate(rowDataTran, rowNodeTransaction, nodesToUnselect);
|
48270 | this.executeAdd(rowDataTran, rowNodeTransaction);
|
48271 | this.updateSelection(nodesToUnselect, 'rowDataChanged');
|
48272 | if (rowNodeOrder) {
|
48273 | _.sortRowNodesByOrder(this.rootNode.allLeafChildren, rowNodeOrder);
|
48274 | }
|
48275 | return rowNodeTransaction;
|
48276 | };
|
48277 | ClientSideNodeManager.prototype.updateSelection = function (nodesToUnselect, source) {
|
48278 | var selectionChanged = nodesToUnselect.length > 0;
|
48279 | if (selectionChanged) {
|
48280 | nodesToUnselect.forEach(function (rowNode) {
|
48281 | rowNode.setSelected(false, false, true, source);
|
48282 | });
|
48283 | }
|
48284 |
|
48285 |
|
48286 |
|
48287 |
|
48288 | this.selectionService.updateGroupsFromChildrenSelections(source);
|
48289 | if (selectionChanged) {
|
48290 | var event_1 = {
|
48291 | type: Events.EVENT_SELECTION_CHANGED,
|
48292 | source: source
|
48293 | };
|
48294 | this.eventService.dispatchEvent(event_1);
|
48295 | }
|
48296 | };
|
48297 | ClientSideNodeManager.prototype.executeAdd = function (rowDataTran, rowNodeTransaction) {
|
48298 | var _this = this;
|
48299 | var _a;
|
48300 | var add = rowDataTran.add, addIndex = rowDataTran.addIndex;
|
48301 | if (_.missingOrEmpty(add)) {
|
48302 | return;
|
48303 | }
|
48304 |
|
48305 | var newNodes = add.map(function (item) { return _this.createNode(item, _this.rootNode, ClientSideNodeManager.TOP_LEVEL); });
|
48306 | if (typeof addIndex === 'number' && addIndex >= 0) {
|
48307 |
|
48308 |
|
48309 | var allLeafChildren = this.rootNode.allLeafChildren;
|
48310 | var len = allLeafChildren.length;
|
48311 | var normalisedAddIndex = addIndex;
|
48312 | if (this.doingTreeData && addIndex > 0 && len > 0) {
|
48313 | for (var i = 0; i < len; i++) {
|
48314 | if (((_a = allLeafChildren[i]) === null || _a === void 0 ? void 0 : _a.rowIndex) == addIndex - 1) {
|
48315 | normalisedAddIndex = i + 1;
|
48316 | break;
|
48317 | }
|
48318 | }
|
48319 | }
|
48320 | var nodesBeforeIndex = allLeafChildren.slice(0, normalisedAddIndex);
|
48321 | var nodesAfterIndex = allLeafChildren.slice(normalisedAddIndex, allLeafChildren.length);
|
48322 | this.rootNode.allLeafChildren = __spread$1(nodesBeforeIndex, newNodes, nodesAfterIndex);
|
48323 | }
|
48324 | else {
|
48325 | this.rootNode.allLeafChildren = __spread$1(this.rootNode.allLeafChildren, newNodes);
|
48326 | }
|
48327 | if (this.rootNode.sibling) {
|
48328 | this.rootNode.sibling.allLeafChildren = this.rootNode.allLeafChildren;
|
48329 | }
|
48330 |
|
48331 | rowNodeTransaction.add = newNodes;
|
48332 | };
|
48333 | ClientSideNodeManager.prototype.executeRemove = function (rowDataTran, rowNodeTransaction, nodesToUnselect) {
|
48334 | var _this = this;
|
48335 | var remove = rowDataTran.remove;
|
48336 | if (_.missingOrEmpty(remove)) {
|
48337 | return;
|
48338 | }
|
48339 | var rowIdsRemoved = {};
|
48340 | remove.forEach(function (item) {
|
48341 | var rowNode = _this.lookupRowNode(item);
|
48342 | if (!rowNode) {
|
48343 | return;
|
48344 | }
|
48345 |
|
48346 |
|
48347 | if (rowNode.isSelected()) {
|
48348 | nodesToUnselect.push(rowNode);
|
48349 | }
|
48350 |
|
48351 | rowNode.clearRowTopAndRowIndex();
|
48352 |
|
48353 |
|
48354 | rowIdsRemoved[rowNode.id] = true;
|
48355 |
|
48356 | delete _this.allNodesMap[rowNode.id];
|
48357 | rowNodeTransaction.remove.push(rowNode);
|
48358 | });
|
48359 | this.rootNode.allLeafChildren = this.rootNode.allLeafChildren.filter(function (rowNode) { return !rowIdsRemoved[rowNode.id]; });
|
48360 | if (this.rootNode.sibling) {
|
48361 | this.rootNode.sibling.allLeafChildren = this.rootNode.allLeafChildren;
|
48362 | }
|
48363 | };
|
48364 | ClientSideNodeManager.prototype.executeUpdate = function (rowDataTran, rowNodeTransaction, nodesToUnselect) {
|
48365 | var _this = this;
|
48366 | var update = rowDataTran.update;
|
48367 | if (_.missingOrEmpty(update)) {
|
48368 | return;
|
48369 | }
|
48370 | update.forEach(function (item) {
|
48371 | var rowNode = _this.lookupRowNode(item);
|
48372 | if (!rowNode) {
|
48373 | return;
|
48374 | }
|
48375 | rowNode.updateData(item);
|
48376 | if (!rowNode.selectable && rowNode.isSelected()) {
|
48377 | nodesToUnselect.push(rowNode);
|
48378 | }
|
48379 | _this.setMasterForRow(rowNode, item, ClientSideNodeManager.TOP_LEVEL, false);
|
48380 | rowNodeTransaction.update.push(rowNode);
|
48381 | });
|
48382 | };
|
48383 | ClientSideNodeManager.prototype.lookupRowNode = function (data) {
|
48384 | var getRowIdFunc = this.gridOptionsService.getRowIdFunc();
|
48385 | var rowNode;
|
48386 | if (getRowIdFunc) {
|
48387 |
|
48388 | var id = getRowIdFunc({ data: data, level: 0 });
|
48389 | rowNode = this.allNodesMap[id];
|
48390 | if (!rowNode) {
|
48391 | console.error("AG Grid: could not find row id=" + id + ", data item was not found for this id");
|
48392 | return null;
|
48393 | }
|
48394 | }
|
48395 | else {
|
48396 |
|
48397 | rowNode = this.rootNode.allLeafChildren.find(function (node) { return node.data === data; });
|
48398 | if (!rowNode) {
|
48399 | console.error("AG Grid: could not find data item as object was not found", data);
|
48400 | console.error("Consider using getRowId to help the Grid find matching row data");
|
48401 | return null;
|
48402 | }
|
48403 | }
|
48404 | return rowNode || null;
|
48405 | };
|
48406 | ClientSideNodeManager.prototype.createNode = function (dataItem, parent, level) {
|
48407 | var node = new RowNode(this.beans);
|
48408 | node.group = false;
|
48409 | this.setMasterForRow(node, dataItem, level, true);
|
48410 | if (parent && !this.suppressParentsInRowNodes) {
|
48411 | node.parent = parent;
|
48412 | }
|
48413 | node.level = level;
|
48414 | node.setDataAndId(dataItem, this.nextId.toString());
|
48415 | if (this.allNodesMap[node.id]) {
|
48416 | console.warn("AG Grid: duplicate node id '" + node.id + "' detected from getRowId callback, this could cause issues in your grid.");
|
48417 | }
|
48418 | this.allNodesMap[node.id] = node;
|
48419 | this.nextId++;
|
48420 | return node;
|
48421 | };
|
48422 | ClientSideNodeManager.prototype.setMasterForRow = function (rowNode, data, level, setExpanded) {
|
48423 | if (this.doingTreeData) {
|
48424 | rowNode.setMaster(false);
|
48425 | if (setExpanded) {
|
48426 | rowNode.expanded = false;
|
48427 | }
|
48428 | }
|
48429 | else {
|
48430 |
|
48431 | if (this.doingMasterDetail) {
|
48432 |
|
48433 |
|
48434 | if (this.isRowMasterFunc) {
|
48435 | rowNode.setMaster(this.isRowMasterFunc(data));
|
48436 | }
|
48437 | else {
|
48438 | rowNode.setMaster(true);
|
48439 | }
|
48440 | }
|
48441 | else {
|
48442 | rowNode.setMaster(false);
|
48443 | }
|
48444 | if (setExpanded) {
|
48445 | var rowGroupColumns = this.columnModel.getRowGroupColumns();
|
48446 | var numRowGroupColumns = rowGroupColumns ? rowGroupColumns.length : 0;
|
48447 |
|
48448 | var masterRowLevel = level + numRowGroupColumns;
|
48449 | rowNode.expanded = rowNode.master ? this.isExpanded(masterRowLevel) : false;
|
48450 | }
|
48451 | }
|
48452 | };
|
48453 | ClientSideNodeManager.prototype.isExpanded = function (level) {
|
48454 | var expandByDefault = this.gridOptionsService.getNum('groupDefaultExpanded');
|
48455 | if (expandByDefault === -1) {
|
48456 | return true;
|
48457 | }
|
48458 | return level < expandByDefault;
|
48459 | };
|
48460 | ClientSideNodeManager.TOP_LEVEL = 0;
|
48461 | ClientSideNodeManager.ROOT_NODE_ID = 'ROOT_NODE_ID';
|
48462 | return ClientSideNodeManager;
|
48463 | }());
|
48464 |
|
48465 | var __extends$c = (undefined && undefined.__extends) || (function () {
|
48466 | var extendStatics = function (d, b) {
|
48467 | extendStatics = Object.setPrototypeOf ||
|
48468 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
48469 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
48470 | return extendStatics(d, b);
|
48471 | };
|
48472 | return function (d, b) {
|
48473 | extendStatics(d, b);
|
48474 | function __() { this.constructor = d; }
|
48475 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
48476 | };
|
48477 | })();
|
48478 | var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
48479 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
48480 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
48481 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
48482 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
48483 | };
|
48484 | var __read$1 = (undefined && undefined.__read) || function (o, n) {
|
48485 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
48486 | if (!m) return o;
|
48487 | var i = m.call(o), r, ar = [], e;
|
48488 | try {
|
48489 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
48490 | }
|
48491 | catch (error) { e = { error: error }; }
|
48492 | finally {
|
48493 | try {
|
48494 | if (r && !r.done && (m = i["return"])) m.call(i);
|
48495 | }
|
48496 | finally { if (e) throw e.error; }
|
48497 | }
|
48498 | return ar;
|
48499 | };
|
48500 | var __spread = (undefined && undefined.__spread) || function () {
|
48501 | for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i]));
|
48502 | return ar;
|
48503 | };
|
48504 | var RecursionType;
|
48505 | (function (RecursionType) {
|
48506 | RecursionType[RecursionType["Normal"] = 0] = "Normal";
|
48507 | RecursionType[RecursionType["AfterFilter"] = 1] = "AfterFilter";
|
48508 | RecursionType[RecursionType["AfterFilterAndSort"] = 2] = "AfterFilterAndSort";
|
48509 | RecursionType[RecursionType["PivotNodes"] = 3] = "PivotNodes";
|
48510 | })(RecursionType || (RecursionType = {}));
|
48511 | var ClientSideRowModel = (function (_super) {
|
48512 | __extends$c(ClientSideRowModel, _super);
|
48513 | function ClientSideRowModel() {
|
48514 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
48515 | _this.onRowHeightChanged_debounced = _.debounce(_this.onRowHeightChanged.bind(_this), 100);
|
48516 | _this.rowsToDisplay = [];
|
48517 | return _this;
|
48518 | }
|
48519 | ClientSideRowModel.prototype.init = function () {
|
48520 | var refreshEverythingFunc = this.refreshModel.bind(this, { step: ClientSideRowModelSteps.EVERYTHING });
|
48521 | var animate = !this.gridOptionsService.is('suppressAnimationFrame');
|
48522 | var refreshEverythingAfterColsChangedFunc = this.refreshModel.bind(this, {
|
48523 | step: ClientSideRowModelSteps.EVERYTHING,
|
48524 | afterColumnsChanged: true,
|
48525 | keepRenderedRows: true,
|
48526 | animate: animate
|
48527 | });
|
48528 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, refreshEverythingAfterColsChangedFunc);
|
48529 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, refreshEverythingFunc);
|
48530 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, this.onValueChanged.bind(this));
|
48531 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_CHANGED, this.refreshModel.bind(this, { step: ClientSideRowModelSteps.PIVOT }));
|
48532 | this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
|
48533 | this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
|
48534 | this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, refreshEverythingFunc);
|
48535 | this.addManagedListener(this.eventService, Events.EVENT_GRID_STYLES_CHANGED, this.resetRowHeights.bind(this));
|
48536 | var refreshMapListener = this.refreshModel.bind(this, {
|
48537 | step: ClientSideRowModelSteps.MAP,
|
48538 | keepRenderedRows: true,
|
48539 | animate: animate
|
48540 | });
|
48541 | this.addManagedPropertyListener('groupRemoveSingleChildren', refreshMapListener);
|
48542 | this.addManagedPropertyListener('groupRemoveLowestSingleChildren', refreshMapListener);
|
48543 | this.rootNode = new RowNode(this.beans);
|
48544 | this.nodeManager = new ClientSideNodeManager(this.rootNode, this.gridOptionsService, this.eventService, this.columnModel, this.selectionService, this.beans);
|
48545 | };
|
48546 | ClientSideRowModel.prototype.start = function () {
|
48547 | var rowData = this.gridOptionsService.get('rowData');
|
48548 | if (rowData) {
|
48549 | this.setRowData(rowData);
|
48550 | }
|
48551 | };
|
48552 | ClientSideRowModel.prototype.ensureRowHeightsValid = function (startPixel, endPixel, startLimitIndex, endLimitIndex) {
|
48553 | var atLeastOneChange;
|
48554 | var res = false;
|
48555 |
|
48556 |
|
48557 |
|
48558 | do {
|
48559 | atLeastOneChange = false;
|
48560 | var rowAtStartPixel = this.getRowIndexAtPixel(startPixel);
|
48561 | var rowAtEndPixel = this.getRowIndexAtPixel(endPixel);
|
48562 |
|
48563 | var firstRow = Math.max(rowAtStartPixel, startLimitIndex);
|
48564 | var lastRow = Math.min(rowAtEndPixel, endLimitIndex);
|
48565 | for (var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++) {
|
48566 | var rowNode = this.getRow(rowIndex);
|
48567 | if (rowNode.rowHeightEstimated) {
|
48568 | var rowHeight = this.gridOptionsService.getRowHeightForNode(rowNode);
|
48569 | rowNode.setRowHeight(rowHeight.height);
|
48570 | atLeastOneChange = true;
|
48571 | res = true;
|
48572 | }
|
48573 | }
|
48574 | if (atLeastOneChange) {
|
48575 | this.setRowTopAndRowIndex();
|
48576 | }
|
48577 | } while (atLeastOneChange);
|
48578 | return res;
|
48579 | };
|
48580 | ClientSideRowModel.prototype.setRowTopAndRowIndex = function () {
|
48581 | var defaultRowHeight = this.environment.getDefaultRowHeight();
|
48582 | var nextRowTop = 0;
|
48583 |
|
48584 |
|
48585 |
|
48586 |
|
48587 | var displayedRowsMapped = new Set();
|
48588 |
|
48589 |
|
48590 | var allowEstimate = this.gridOptionsService.isDomLayout('normal');
|
48591 | for (var i = 0; i < this.rowsToDisplay.length; i++) {
|
48592 | var rowNode = this.rowsToDisplay[i];
|
48593 | if (rowNode.id != null) {
|
48594 | displayedRowsMapped.add(rowNode.id);
|
48595 | }
|
48596 | if (rowNode.rowHeight == null) {
|
48597 | var rowHeight = this.gridOptionsService.getRowHeightForNode(rowNode, allowEstimate, defaultRowHeight);
|
48598 | rowNode.setRowHeight(rowHeight.height, rowHeight.estimated);
|
48599 | }
|
48600 | rowNode.setRowTop(nextRowTop);
|
48601 | rowNode.setRowIndex(i);
|
48602 | nextRowTop += rowNode.rowHeight;
|
48603 | }
|
48604 | return displayedRowsMapped;
|
48605 | };
|
48606 | ClientSideRowModel.prototype.clearRowTopAndRowIndex = function (changedPath, displayedRowsMapped) {
|
48607 | var changedPathActive = changedPath.isActive();
|
48608 | var clearIfNotDisplayed = function (rowNode) {
|
48609 | if (rowNode && rowNode.id != null && !displayedRowsMapped.has(rowNode.id)) {
|
48610 | rowNode.clearRowTopAndRowIndex();
|
48611 | }
|
48612 | };
|
48613 | var recurse = function (rowNode) {
|
48614 | clearIfNotDisplayed(rowNode);
|
48615 | clearIfNotDisplayed(rowNode.detailNode);
|
48616 | clearIfNotDisplayed(rowNode.sibling);
|
48617 | if (rowNode.hasChildren()) {
|
48618 | if (rowNode.childrenAfterGroup) {
|
48619 |
|
48620 |
|
48621 |
|
48622 |
|
48623 |
|
48624 | var isRootNode = rowNode.level == -1;
|
48625 |
|
48626 | var skipChildren = changedPathActive && !isRootNode && !rowNode.expanded;
|
48627 | if (!skipChildren) {
|
48628 | rowNode.childrenAfterGroup.forEach(recurse);
|
48629 | }
|
48630 | }
|
48631 | }
|
48632 | };
|
48633 | recurse(this.rootNode);
|
48634 | };
|
48635 |
|
48636 | ClientSideRowModel.prototype.ensureRowsAtPixel = function (rowNodes, pixel, increment) {
|
48637 | var _this = this;
|
48638 | if (increment === void 0) { increment = 0; }
|
48639 | var indexAtPixelNow = this.getRowIndexAtPixel(pixel);
|
48640 | var rowNodeAtPixelNow = this.getRow(indexAtPixelNow);
|
48641 | var animate = !this.gridOptionsService.is('suppressAnimationFrame');
|
48642 | if (rowNodeAtPixelNow === rowNodes[0]) {
|
48643 | return false;
|
48644 | }
|
48645 | rowNodes.forEach(function (rowNode) {
|
48646 | _.removeFromArray(_this.rootNode.allLeafChildren, rowNode);
|
48647 | });
|
48648 | rowNodes.forEach(function (rowNode, idx) {
|
48649 | _.insertIntoArray(_this.rootNode.allLeafChildren, rowNode, Math.max(indexAtPixelNow + increment, 0) + idx);
|
48650 | });
|
48651 | this.refreshModel({
|
48652 | step: ClientSideRowModelSteps.EVERYTHING,
|
48653 | keepRenderedRows: true,
|
48654 | keepEditingRows: true,
|
48655 | animate: animate
|
48656 | });
|
48657 | return true;
|
48658 | };
|
48659 | ClientSideRowModel.prototype.highlightRowAtPixel = function (rowNode, pixel) {
|
48660 | var indexAtPixelNow = pixel != null ? this.getRowIndexAtPixel(pixel) : null;
|
48661 | var rowNodeAtPixelNow = indexAtPixelNow != null ? this.getRow(indexAtPixelNow) : null;
|
48662 | if (!rowNodeAtPixelNow || !rowNode || rowNodeAtPixelNow === rowNode || pixel == null) {
|
48663 | if (this.lastHighlightedRow) {
|
48664 | this.lastHighlightedRow.setHighlighted(null);
|
48665 | this.lastHighlightedRow = null;
|
48666 | }
|
48667 | return;
|
48668 | }
|
48669 | var highlight = this.getHighlightPosition(pixel, rowNodeAtPixelNow);
|
48670 | if (this.lastHighlightedRow && this.lastHighlightedRow !== rowNodeAtPixelNow) {
|
48671 | this.lastHighlightedRow.setHighlighted(null);
|
48672 | this.lastHighlightedRow = null;
|
48673 | }
|
48674 | rowNodeAtPixelNow.setHighlighted(highlight);
|
48675 | this.lastHighlightedRow = rowNodeAtPixelNow;
|
48676 | };
|
48677 | ClientSideRowModel.prototype.getHighlightPosition = function (pixel, rowNode) {
|
48678 | if (!rowNode) {
|
48679 | var index = this.getRowIndexAtPixel(pixel);
|
48680 | rowNode = this.getRow(index || 0);
|
48681 | if (!rowNode) {
|
48682 | return RowHighlightPosition.Below;
|
48683 | }
|
48684 | }
|
48685 | var rowTop = rowNode.rowTop, rowHeight = rowNode.rowHeight;
|
48686 | return pixel - rowTop < rowHeight / 2 ? RowHighlightPosition.Above : RowHighlightPosition.Below;
|
48687 | };
|
48688 | ClientSideRowModel.prototype.getLastHighlightedRowNode = function () {
|
48689 | return this.lastHighlightedRow;
|
48690 | };
|
48691 | ClientSideRowModel.prototype.isLastRowIndexKnown = function () {
|
48692 | return true;
|
48693 | };
|
48694 | ClientSideRowModel.prototype.getRowCount = function () {
|
48695 | if (this.rowsToDisplay) {
|
48696 | return this.rowsToDisplay.length;
|
48697 | }
|
48698 | return 0;
|
48699 | };
|
48700 | ClientSideRowModel.prototype.getTopLevelRowCount = function () {
|
48701 | var showingRootNode = this.rowsToDisplay && this.rowsToDisplay[0] === this.rootNode;
|
48702 | if (showingRootNode) {
|
48703 | return 1;
|
48704 | }
|
48705 | var filteredChildren = this.rootNode.childrenAfterAggFilter;
|
48706 | return filteredChildren ? filteredChildren.length : 0;
|
48707 | };
|
48708 | ClientSideRowModel.prototype.getTopLevelRowDisplayedIndex = function (topLevelIndex) {
|
48709 | var showingRootNode = this.rowsToDisplay && this.rowsToDisplay[0] === this.rootNode;
|
48710 | if (showingRootNode) {
|
48711 | return topLevelIndex;
|
48712 | }
|
48713 | var rowNode = this.rootNode.childrenAfterSort[topLevelIndex];
|
48714 | if (this.gridOptionsService.is('groupHideOpenParents')) {
|
48715 |
|
48716 | while (rowNode.expanded && rowNode.childrenAfterSort && rowNode.childrenAfterSort.length > 0) {
|
48717 | rowNode = rowNode.childrenAfterSort[0];
|
48718 | }
|
48719 | }
|
48720 | return rowNode.rowIndex;
|
48721 | };
|
48722 | ClientSideRowModel.prototype.getRowBounds = function (index) {
|
48723 | if (_.missing(this.rowsToDisplay)) {
|
48724 | return null;
|
48725 | }
|
48726 | var rowNode = this.rowsToDisplay[index];
|
48727 | if (rowNode) {
|
48728 | return {
|
48729 | rowTop: rowNode.rowTop,
|
48730 | rowHeight: rowNode.rowHeight
|
48731 | };
|
48732 | }
|
48733 | return null;
|
48734 | };
|
48735 | ClientSideRowModel.prototype.onRowGroupOpened = function () {
|
48736 | var animate = this.gridOptionsService.isAnimateRows();
|
48737 | this.refreshModel({ step: ClientSideRowModelSteps.MAP, keepRenderedRows: true, animate: animate });
|
48738 | };
|
48739 | ClientSideRowModel.prototype.onFilterChanged = function (event) {
|
48740 | if (event.afterDataChange) {
|
48741 | return;
|
48742 | }
|
48743 | var animate = this.gridOptionsService.isAnimateRows();
|
48744 | var primaryOrQuickFilterChanged = event.columns.length === 0 || event.columns.some(function (col) { return col.isPrimary(); });
|
48745 | var step = primaryOrQuickFilterChanged ? ClientSideRowModelSteps.FILTER : ClientSideRowModelSteps.FILTER_AGGREGATES;
|
48746 | this.refreshModel({ step: step, keepRenderedRows: true, animate: animate });
|
48747 | };
|
48748 | ClientSideRowModel.prototype.onSortChanged = function () {
|
48749 | var animate = this.gridOptionsService.isAnimateRows();
|
48750 | this.refreshModel({ step: ClientSideRowModelSteps.SORT, keepRenderedRows: true, animate: animate, keepEditingRows: true });
|
48751 | };
|
48752 | ClientSideRowModel.prototype.getType = function () {
|
48753 | return 'clientSide';
|
48754 | };
|
48755 | ClientSideRowModel.prototype.onValueChanged = function () {
|
48756 | if (this.columnModel.isPivotActive()) {
|
48757 | this.refreshModel({ step: ClientSideRowModelSteps.PIVOT });
|
48758 | }
|
48759 | else {
|
48760 | this.refreshModel({ step: ClientSideRowModelSteps.AGGREGATE });
|
48761 | }
|
48762 | };
|
48763 | ClientSideRowModel.prototype.createChangePath = function (rowNodeTransactions) {
|
48764 |
|
48765 |
|
48766 |
|
48767 |
|
48768 |
|
48769 |
|
48770 |
|
48771 | var noTransactions = _.missingOrEmpty(rowNodeTransactions);
|
48772 | var changedPath = new ChangedPath(false, this.rootNode);
|
48773 | if (noTransactions || this.gridOptionsService.isTreeData()) {
|
48774 | changedPath.setInactive();
|
48775 | }
|
48776 | return changedPath;
|
48777 | };
|
48778 | ClientSideRowModel.prototype.isSuppressModelUpdateAfterUpdateTransaction = function (params) {
|
48779 | if (!this.gridOptionsService.is('suppressModelUpdateAfterUpdateTransaction')) {
|
48780 | return false;
|
48781 | }
|
48782 |
|
48783 | if (params.rowNodeTransactions == null) {
|
48784 | return false;
|
48785 | }
|
48786 | var transWithAddsOrDeletes = params.rowNodeTransactions.filter(function (tx) {
|
48787 | return (tx.add != null && tx.add.length > 0) || (tx.remove != null && tx.remove.length > 0);
|
48788 | });
|
48789 | var transactionsContainUpdatesOnly = transWithAddsOrDeletes == null || transWithAddsOrDeletes.length == 0;
|
48790 | return transactionsContainUpdatesOnly;
|
48791 | };
|
48792 | ClientSideRowModel.prototype.buildRefreshModelParams = function (step) {
|
48793 | var paramsStep = ClientSideRowModelSteps.EVERYTHING;
|
48794 | var stepsMapped = {
|
48795 | everything: ClientSideRowModelSteps.EVERYTHING,
|
48796 | group: ClientSideRowModelSteps.EVERYTHING,
|
48797 | filter: ClientSideRowModelSteps.FILTER,
|
48798 | map: ClientSideRowModelSteps.MAP,
|
48799 | aggregate: ClientSideRowModelSteps.AGGREGATE,
|
48800 | sort: ClientSideRowModelSteps.SORT,
|
48801 | pivot: ClientSideRowModelSteps.PIVOT
|
48802 | };
|
48803 | if (_.exists(step)) {
|
48804 | paramsStep = stepsMapped[step];
|
48805 | }
|
48806 | if (_.missing(paramsStep)) {
|
48807 | console.error("AG Grid: invalid step " + step + ", available steps are " + Object.keys(stepsMapped).join(', '));
|
48808 | return undefined;
|
48809 | }
|
48810 | var animate = !this.gridOptionsService.is('suppressAnimationFrame');
|
48811 | var modelParams = {
|
48812 | step: paramsStep,
|
48813 | keepRenderedRows: true,
|
48814 | keepEditingRows: true,
|
48815 | animate: animate
|
48816 | };
|
48817 | return modelParams;
|
48818 | };
|
48819 | ClientSideRowModel.prototype.refreshModel = function (paramsOrStep) {
|
48820 | var params = typeof paramsOrStep === 'object' && "step" in paramsOrStep ? paramsOrStep : this.buildRefreshModelParams(paramsOrStep);
|
48821 | if (!params) {
|
48822 | return;
|
48823 | }
|
48824 | if (this.isSuppressModelUpdateAfterUpdateTransaction(params)) {
|
48825 | return;
|
48826 | }
|
48827 |
|
48828 |
|
48829 |
|
48830 |
|
48831 |
|
48832 |
|
48833 |
|
48834 |
|
48835 |
|
48836 |
|
48837 | var changedPath = this.createChangePath(params.rowNodeTransactions);
|
48838 | switch (params.step) {
|
48839 | case ClientSideRowModelSteps.EVERYTHING:
|
48840 | this.doRowGrouping(params.groupState, params.rowNodeTransactions, params.rowNodeOrder, changedPath, !!params.afterColumnsChanged);
|
48841 | case ClientSideRowModelSteps.FILTER:
|
48842 | this.doFilter(changedPath);
|
48843 | case ClientSideRowModelSteps.PIVOT:
|
48844 | this.doPivot(changedPath);
|
48845 | case ClientSideRowModelSteps.AGGREGATE:
|
48846 | this.doAggregate(changedPath);
|
48847 | case ClientSideRowModelSteps.FILTER_AGGREGATES:
|
48848 | this.doFilterAggregates(changedPath);
|
48849 | case ClientSideRowModelSteps.SORT:
|
48850 | this.doSort(params.rowNodeTransactions, changedPath);
|
48851 | case ClientSideRowModelSteps.MAP:
|
48852 | this.doRowsToDisplay();
|
48853 | }
|
48854 |
|
48855 |
|
48856 |
|
48857 | var displayedNodesMapped = this.setRowTopAndRowIndex();
|
48858 | this.clearRowTopAndRowIndex(changedPath, displayedNodesMapped);
|
48859 | var event = {
|
48860 | type: Events.EVENT_MODEL_UPDATED,
|
48861 | animate: params.animate,
|
48862 | keepRenderedRows: params.keepRenderedRows,
|
48863 | newData: params.newData,
|
48864 | newPage: false,
|
48865 | keepUndoRedoStack: params.keepUndoRedoStack
|
48866 | };
|
48867 | this.eventService.dispatchEvent(event);
|
48868 | };
|
48869 | ClientSideRowModel.prototype.isEmpty = function () {
|
48870 | var rowsMissing = _.missing(this.rootNode.allLeafChildren) || this.rootNode.allLeafChildren.length === 0;
|
48871 | return _.missing(this.rootNode) || rowsMissing || !this.columnModel.isReady();
|
48872 | };
|
48873 | ClientSideRowModel.prototype.isRowsToRender = function () {
|
48874 | return _.exists(this.rowsToDisplay) && this.rowsToDisplay.length > 0;
|
48875 | };
|
48876 | ClientSideRowModel.prototype.getNodesInRangeForSelection = function (firstInRange, lastInRange) {
|
48877 |
|
48878 | var firstRowHit = !lastInRange;
|
48879 | var lastRowHit = false;
|
48880 | var lastRow;
|
48881 | var result = [];
|
48882 | var groupsSelectChildren = this.gridOptionsService.is('groupSelectsChildren');
|
48883 | this.forEachNodeAfterFilterAndSort(function (rowNode) {
|
48884 | var lookingForLastRow = firstRowHit && !lastRowHit;
|
48885 |
|
48886 | if (!firstRowHit) {
|
48887 | if (rowNode === lastInRange || rowNode === firstInRange) {
|
48888 | firstRowHit = true;
|
48889 | }
|
48890 | }
|
48891 | var skipThisGroupNode = rowNode.group && groupsSelectChildren;
|
48892 | if (!skipThisGroupNode) {
|
48893 | var inRange = firstRowHit && !lastRowHit;
|
48894 | var childOfLastRow = rowNode.isParentOfNode(lastRow);
|
48895 | if (inRange || childOfLastRow) {
|
48896 | result.push(rowNode);
|
48897 | }
|
48898 | }
|
48899 | if (lookingForLastRow) {
|
48900 | if (rowNode === lastInRange || rowNode === firstInRange) {
|
48901 | lastRowHit = true;
|
48902 | if (rowNode === lastInRange) {
|
48903 | lastRow = lastInRange;
|
48904 | }
|
48905 | else {
|
48906 | lastRow = firstInRange;
|
48907 | }
|
48908 | }
|
48909 | }
|
48910 | });
|
48911 | return result;
|
48912 | };
|
48913 | ClientSideRowModel.prototype.setDatasource = function (datasource) {
|
48914 | console.error('AG Grid: should never call setDatasource on clientSideRowController');
|
48915 | };
|
48916 | ClientSideRowModel.prototype.getTopLevelNodes = function () {
|
48917 | return this.rootNode ? this.rootNode.childrenAfterGroup : null;
|
48918 | };
|
48919 | ClientSideRowModel.prototype.getRootNode = function () {
|
48920 | return this.rootNode;
|
48921 | };
|
48922 | ClientSideRowModel.prototype.getRow = function (index) {
|
48923 | return this.rowsToDisplay[index];
|
48924 | };
|
48925 | ClientSideRowModel.prototype.isRowPresent = function (rowNode) {
|
48926 | return this.rowsToDisplay.indexOf(rowNode) >= 0;
|
48927 | };
|
48928 | ClientSideRowModel.prototype.getRowIndexAtPixel = function (pixelToMatch) {
|
48929 | if (this.isEmpty() || this.rowsToDisplay.length === 0) {
|
48930 | return -1;
|
48931 | }
|
48932 |
|
48933 |
|
48934 | var bottomPointer = 0;
|
48935 | var topPointer = this.rowsToDisplay.length - 1;
|
48936 |
|
48937 | if (pixelToMatch <= 0) {
|
48938 |
|
48939 | return 0;
|
48940 | }
|
48941 | var lastNode = _.last(this.rowsToDisplay);
|
48942 | if (lastNode.rowTop <= pixelToMatch) {
|
48943 | return this.rowsToDisplay.length - 1;
|
48944 | }
|
48945 | var oldBottomPointer = -1;
|
48946 | var oldTopPointer = -1;
|
48947 | while (true) {
|
48948 | var midPointer = Math.floor((bottomPointer + topPointer) / 2);
|
48949 | var currentRowNode = this.rowsToDisplay[midPointer];
|
48950 | if (this.isRowInPixel(currentRowNode, pixelToMatch)) {
|
48951 | return midPointer;
|
48952 | }
|
48953 | if (currentRowNode.rowTop < pixelToMatch) {
|
48954 | bottomPointer = midPointer + 1;
|
48955 | }
|
48956 | else if (currentRowNode.rowTop > pixelToMatch) {
|
48957 | topPointer = midPointer - 1;
|
48958 | }
|
48959 |
|
48960 |
|
48961 |
|
48962 | var caughtInInfiniteLoop = oldBottomPointer === bottomPointer
|
48963 | && oldTopPointer === topPointer;
|
48964 | if (caughtInInfiniteLoop) {
|
48965 | return midPointer;
|
48966 | }
|
48967 | oldBottomPointer = bottomPointer;
|
48968 | oldTopPointer = topPointer;
|
48969 | }
|
48970 | };
|
48971 | ClientSideRowModel.prototype.isRowInPixel = function (rowNode, pixelToMatch) {
|
48972 | var topPixel = rowNode.rowTop;
|
48973 | var bottomPixel = rowNode.rowTop + rowNode.rowHeight;
|
48974 | var pixelInRow = topPixel <= pixelToMatch && bottomPixel > pixelToMatch;
|
48975 | return pixelInRow;
|
48976 | };
|
48977 | ClientSideRowModel.prototype.forEachLeafNode = function (callback) {
|
48978 | if (this.rootNode.allLeafChildren) {
|
48979 | this.rootNode.allLeafChildren.forEach(function (rowNode, index) { return callback(rowNode, index); });
|
48980 | }
|
48981 | };
|
48982 | ClientSideRowModel.prototype.forEachNode = function (callback, includeFooterNodes) {
|
48983 | if (includeFooterNodes === void 0) { includeFooterNodes = false; }
|
48984 | this.recursivelyWalkNodesAndCallback({
|
48985 | nodes: __spread((this.rootNode.childrenAfterGroup || [])),
|
48986 | callback: callback,
|
48987 | recursionType: RecursionType.Normal,
|
48988 | index: 0,
|
48989 | includeFooterNodes: includeFooterNodes
|
48990 | });
|
48991 | };
|
48992 | ClientSideRowModel.prototype.forEachNodeAfterFilter = function (callback, includeFooterNodes) {
|
48993 | if (includeFooterNodes === void 0) { includeFooterNodes = false; }
|
48994 | this.recursivelyWalkNodesAndCallback({
|
48995 | nodes: __spread((this.rootNode.childrenAfterAggFilter || [])),
|
48996 | callback: callback,
|
48997 | recursionType: RecursionType.AfterFilter,
|
48998 | index: 0,
|
48999 | includeFooterNodes: includeFooterNodes
|
49000 | });
|
49001 | };
|
49002 | ClientSideRowModel.prototype.forEachNodeAfterFilterAndSort = function (callback, includeFooterNodes) {
|
49003 | if (includeFooterNodes === void 0) { includeFooterNodes = false; }
|
49004 | this.recursivelyWalkNodesAndCallback({
|
49005 | nodes: __spread((this.rootNode.childrenAfterSort || [])),
|
49006 | callback: callback,
|
49007 | recursionType: RecursionType.AfterFilterAndSort,
|
49008 | index: 0,
|
49009 | includeFooterNodes: includeFooterNodes
|
49010 | });
|
49011 | };
|
49012 | ClientSideRowModel.prototype.forEachPivotNode = function (callback, includeFooterNodes) {
|
49013 | if (includeFooterNodes === void 0) { includeFooterNodes = false; }
|
49014 | this.recursivelyWalkNodesAndCallback({
|
49015 | nodes: [this.rootNode],
|
49016 | callback: callback,
|
49017 | recursionType: RecursionType.PivotNodes,
|
49018 | index: 0,
|
49019 | includeFooterNodes: includeFooterNodes
|
49020 | });
|
49021 | };
|
49022 |
|
49023 |
|
49024 |
|
49025 |
|
49026 |
|
49027 | ClientSideRowModel.prototype.recursivelyWalkNodesAndCallback = function (params) {
|
49028 | var _a;
|
49029 | var nodes = params.nodes, callback = params.callback, recursionType = params.recursionType, includeFooterNodes = params.includeFooterNodes;
|
49030 | var index = params.index;
|
49031 | var firstNode = nodes[0];
|
49032 | if (includeFooterNodes && ((_a = firstNode === null || firstNode === void 0 ? void 0 : firstNode.parent) === null || _a === void 0 ? void 0 : _a.sibling)) {
|
49033 | nodes.push(firstNode.parent.sibling);
|
49034 | }
|
49035 | for (var i = 0; i < nodes.length; i++) {
|
49036 | var node = nodes[i];
|
49037 | callback(node, index++);
|
49038 |
|
49039 | if (node.hasChildren() && !node.footer) {
|
49040 |
|
49041 | var nodeChildren = null;
|
49042 | switch (recursionType) {
|
49043 | case RecursionType.Normal:
|
49044 | nodeChildren = node.childrenAfterGroup;
|
49045 | break;
|
49046 | case RecursionType.AfterFilter:
|
49047 | nodeChildren = node.childrenAfterAggFilter;
|
49048 | break;
|
49049 | case RecursionType.AfterFilterAndSort:
|
49050 | nodeChildren = node.childrenAfterSort;
|
49051 | break;
|
49052 | case RecursionType.PivotNodes:
|
49053 |
|
49054 | nodeChildren = !node.leafGroup ? node.childrenAfterSort : null;
|
49055 | break;
|
49056 | }
|
49057 | if (nodeChildren) {
|
49058 | index = this.recursivelyWalkNodesAndCallback({
|
49059 | nodes: __spread(nodeChildren),
|
49060 | callback: callback,
|
49061 | recursionType: recursionType,
|
49062 | index: index,
|
49063 | includeFooterNodes: includeFooterNodes
|
49064 | });
|
49065 | }
|
49066 | }
|
49067 | }
|
49068 | return index;
|
49069 | };
|
49070 |
|
49071 |
|
49072 | ClientSideRowModel.prototype.doAggregate = function (changedPath) {
|
49073 | if (this.aggregationStage) {
|
49074 | this.aggregationStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
|
49075 | }
|
49076 | };
|
49077 | ClientSideRowModel.prototype.doFilterAggregates = function (changedPath) {
|
49078 | if (this.filterAggregatesStage) {
|
49079 | this.filterAggregatesStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
|
49080 | }
|
49081 | else {
|
49082 |
|
49083 | this.rootNode.childrenAfterAggFilter = this.rootNode.childrenAfterFilter;
|
49084 | }
|
49085 | };
|
49086 |
|
49087 |
|
49088 | ClientSideRowModel.prototype.expandOrCollapseAll = function (expand) {
|
49089 | var usingTreeData = this.gridOptionsService.isTreeData();
|
49090 | var usingPivotMode = this.columnModel.isPivotActive();
|
49091 | var recursiveExpandOrCollapse = function (rowNodes) {
|
49092 | if (!rowNodes) {
|
49093 | return;
|
49094 | }
|
49095 | rowNodes.forEach(function (rowNode) {
|
49096 | var actionRow = function () {
|
49097 | rowNode.expanded = expand;
|
49098 | recursiveExpandOrCollapse(rowNode.childrenAfterGroup);
|
49099 | };
|
49100 | if (usingTreeData) {
|
49101 | var hasChildren = _.exists(rowNode.childrenAfterGroup);
|
49102 | if (hasChildren) {
|
49103 | actionRow();
|
49104 | }
|
49105 | return;
|
49106 | }
|
49107 | if (usingPivotMode) {
|
49108 | var notLeafGroup = !rowNode.leafGroup;
|
49109 | if (notLeafGroup) {
|
49110 | actionRow();
|
49111 | }
|
49112 | return;
|
49113 | }
|
49114 | var isRowGroup = rowNode.group;
|
49115 | if (isRowGroup) {
|
49116 | actionRow();
|
49117 | }
|
49118 | });
|
49119 | };
|
49120 | if (this.rootNode) {
|
49121 | recursiveExpandOrCollapse(this.rootNode.childrenAfterGroup);
|
49122 | }
|
49123 | this.refreshModel({ step: ClientSideRowModelSteps.MAP });
|
49124 | var eventSource = expand ? 'expandAll' : 'collapseAll';
|
49125 | var event = {
|
49126 | type: Events.EVENT_EXPAND_COLLAPSE_ALL,
|
49127 | source: eventSource
|
49128 | };
|
49129 | this.eventService.dispatchEvent(event);
|
49130 | };
|
49131 | ClientSideRowModel.prototype.doSort = function (rowNodeTransactions, changedPath) {
|
49132 | this.sortStage.execute({
|
49133 | rowNode: this.rootNode,
|
49134 | rowNodeTransactions: rowNodeTransactions,
|
49135 | changedPath: changedPath
|
49136 | });
|
49137 | };
|
49138 | ClientSideRowModel.prototype.doRowGrouping = function (groupState, rowNodeTransactions, rowNodeOrder, changedPath, afterColumnsChanged) {
|
49139 | if (this.groupStage) {
|
49140 | if (rowNodeTransactions) {
|
49141 | this.groupStage.execute({
|
49142 | rowNode: this.rootNode,
|
49143 | rowNodeTransactions: rowNodeTransactions,
|
49144 | rowNodeOrder: rowNodeOrder,
|
49145 | changedPath: changedPath
|
49146 | });
|
49147 | }
|
49148 | else {
|
49149 | this.groupStage.execute({
|
49150 | rowNode: this.rootNode,
|
49151 | changedPath: changedPath,
|
49152 | afterColumnsChanged: afterColumnsChanged
|
49153 | });
|
49154 |
|
49155 | this.restoreGroupState(groupState);
|
49156 | }
|
49157 | if (this.gridOptionsService.is('groupSelectsChildren')) {
|
49158 | var selectionChanged = this.selectionService.updateGroupsFromChildrenSelections('rowGroupChanged', changedPath);
|
49159 | if (selectionChanged) {
|
49160 | var event_1 = {
|
49161 | type: Events.EVENT_SELECTION_CHANGED,
|
49162 | source: 'rowGroupChanged'
|
49163 | };
|
49164 | this.eventService.dispatchEvent(event_1);
|
49165 | }
|
49166 | }
|
49167 | }
|
49168 | else {
|
49169 | this.rootNode.childrenAfterGroup = this.rootNode.allLeafChildren;
|
49170 | if (this.rootNode.sibling) {
|
49171 | this.rootNode.sibling.childrenAfterGroup = this.rootNode.childrenAfterGroup;
|
49172 | }
|
49173 | this.rootNode.updateHasChildren();
|
49174 | }
|
49175 | };
|
49176 | ClientSideRowModel.prototype.restoreGroupState = function (groupState) {
|
49177 | if (!groupState) {
|
49178 | return;
|
49179 | }
|
49180 | _.traverseNodesWithKey(this.rootNode.childrenAfterGroup, function (node, key) {
|
49181 |
|
49182 |
|
49183 |
|
49184 | if (typeof groupState[key] === 'boolean') {
|
49185 | node.expanded = groupState[key];
|
49186 | }
|
49187 | });
|
49188 | };
|
49189 | ClientSideRowModel.prototype.doFilter = function (changedPath) {
|
49190 | this.filterStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
|
49191 | };
|
49192 | ClientSideRowModel.prototype.doPivot = function (changedPath) {
|
49193 | if (this.pivotStage) {
|
49194 | this.pivotStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
|
49195 | }
|
49196 | };
|
49197 | ClientSideRowModel.prototype.getGroupState = function () {
|
49198 | if (!this.rootNode.childrenAfterGroup || !this.gridOptionsService.is('rememberGroupStateWhenNewData')) {
|
49199 | return null;
|
49200 | }
|
49201 | var result = {};
|
49202 | _.traverseNodesWithKey(this.rootNode.childrenAfterGroup, function (node, key) { return result[key] = node.expanded; });
|
49203 | return result;
|
49204 | };
|
49205 | ClientSideRowModel.prototype.getCopyOfNodesMap = function () {
|
49206 | return this.nodeManager.getCopyOfNodesMap();
|
49207 | };
|
49208 | ClientSideRowModel.prototype.getRowNode = function (id) {
|
49209 |
|
49210 | var idIsGroup = typeof id == 'string' && id.indexOf(RowNode.ID_PREFIX_ROW_GROUP) == 0;
|
49211 | if (idIsGroup) {
|
49212 |
|
49213 |
|
49214 |
|
49215 |
|
49216 | var res_1 = undefined;
|
49217 | this.forEachNode(function (node) {
|
49218 | if (node.id === id) {
|
49219 | res_1 = node;
|
49220 | }
|
49221 | });
|
49222 | return res_1;
|
49223 | }
|
49224 | return this.nodeManager.getRowNode(id);
|
49225 | };
|
49226 |
|
49227 | ClientSideRowModel.prototype.setRowData = function (rowData) {
|
49228 |
|
49229 |
|
49230 |
|
49231 | var groupState = this.getGroupState();
|
49232 | this.nodeManager.setRowData(rowData);
|
49233 |
|
49234 | this.selectionService.reset();
|
49235 |
|
49236 | this.filterManager.onNewRowsLoaded('rowDataUpdated');
|
49237 |
|
49238 |
|
49239 | var rowDataUpdatedEvent = {
|
49240 | type: Events.EVENT_ROW_DATA_UPDATED
|
49241 | };
|
49242 | this.eventService.dispatchEvent(rowDataUpdatedEvent);
|
49243 | this.refreshModel({
|
49244 | step: ClientSideRowModelSteps.EVERYTHING,
|
49245 | groupState: groupState,
|
49246 | newData: true
|
49247 | });
|
49248 | };
|
49249 | ClientSideRowModel.prototype.batchUpdateRowData = function (rowDataTransaction, callback) {
|
49250 | var _this = this;
|
49251 | if (this.applyAsyncTransactionsTimeout == null) {
|
49252 | this.rowDataTransactionBatch = [];
|
49253 | var waitMillis = this.gridOptionsService.getAsyncTransactionWaitMillis();
|
49254 | this.applyAsyncTransactionsTimeout = window.setTimeout(function () {
|
49255 | _this.executeBatchUpdateRowData();
|
49256 | }, waitMillis);
|
49257 | }
|
49258 | this.rowDataTransactionBatch.push({ rowDataTransaction: rowDataTransaction, callback: callback });
|
49259 | };
|
49260 | ClientSideRowModel.prototype.flushAsyncTransactions = function () {
|
49261 | if (this.applyAsyncTransactionsTimeout != null) {
|
49262 | clearTimeout(this.applyAsyncTransactionsTimeout);
|
49263 | this.executeBatchUpdateRowData();
|
49264 | }
|
49265 | };
|
49266 | ClientSideRowModel.prototype.executeBatchUpdateRowData = function () {
|
49267 | var _this = this;
|
49268 | this.valueCache.onDataChanged();
|
49269 | var callbackFuncsBound = [];
|
49270 | var rowNodeTrans = [];
|
49271 |
|
49272 |
|
49273 | var forceRowNodeOrder = false;
|
49274 | if (this.rowDataTransactionBatch) {
|
49275 | this.rowDataTransactionBatch.forEach(function (tranItem) {
|
49276 | var rowNodeTran = _this.nodeManager.updateRowData(tranItem.rowDataTransaction, undefined);
|
49277 | rowNodeTrans.push(rowNodeTran);
|
49278 | if (tranItem.callback) {
|
49279 | callbackFuncsBound.push(tranItem.callback.bind(null, rowNodeTran));
|
49280 | }
|
49281 | if (typeof tranItem.rowDataTransaction.addIndex === 'number') {
|
49282 | forceRowNodeOrder = true;
|
49283 | }
|
49284 | });
|
49285 | }
|
49286 | this.commonUpdateRowData(rowNodeTrans, undefined, forceRowNodeOrder);
|
49287 |
|
49288 | if (callbackFuncsBound.length > 0) {
|
49289 | window.setTimeout(function () {
|
49290 | callbackFuncsBound.forEach(function (func) { return func(); });
|
49291 | }, 0);
|
49292 | }
|
49293 | if (rowNodeTrans.length > 0) {
|
49294 | var event_2 = {
|
49295 | type: Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED,
|
49296 | results: rowNodeTrans
|
49297 | };
|
49298 | this.eventService.dispatchEvent(event_2);
|
49299 | }
|
49300 | this.rowDataTransactionBatch = null;
|
49301 | this.applyAsyncTransactionsTimeout = undefined;
|
49302 | };
|
49303 | ClientSideRowModel.prototype.updateRowData = function (rowDataTran, rowNodeOrder) {
|
49304 | this.valueCache.onDataChanged();
|
49305 | var rowNodeTran = this.nodeManager.updateRowData(rowDataTran, rowNodeOrder);
|
49306 |
|
49307 |
|
49308 |
|
49309 | var forceRowNodeOrder = typeof rowDataTran.addIndex === 'number';
|
49310 | this.commonUpdateRowData([rowNodeTran], rowNodeOrder, forceRowNodeOrder);
|
49311 | return rowNodeTran;
|
49312 | };
|
49313 | ClientSideRowModel.prototype.createRowNodeOrder = function () {
|
49314 | var suppressSortOrder = this.gridOptionsService.is('suppressMaintainUnsortedOrder');
|
49315 | if (suppressSortOrder) {
|
49316 | return;
|
49317 | }
|
49318 | var orderMap = {};
|
49319 | if (this.rootNode && this.rootNode.allLeafChildren) {
|
49320 | for (var index = 0; index < this.rootNode.allLeafChildren.length; index++) {
|
49321 | var node = this.rootNode.allLeafChildren[index];
|
49322 | orderMap[node.id] = index;
|
49323 | }
|
49324 | }
|
49325 | return orderMap;
|
49326 | };
|
49327 |
|
49328 | ClientSideRowModel.prototype.commonUpdateRowData = function (rowNodeTrans, rowNodeOrder, forceRowNodeOrder) {
|
49329 | var animate = !this.gridOptionsService.is('suppressAnimationFrame');
|
49330 | if (forceRowNodeOrder) {
|
49331 | rowNodeOrder = this.createRowNodeOrder();
|
49332 | }
|
49333 | this.refreshModel({
|
49334 | step: ClientSideRowModelSteps.EVERYTHING,
|
49335 | rowNodeTransactions: rowNodeTrans,
|
49336 | rowNodeOrder: rowNodeOrder,
|
49337 | keepRenderedRows: true,
|
49338 | keepEditingRows: true,
|
49339 | animate: animate
|
49340 | });
|
49341 |
|
49342 | this.filterManager.onNewRowsLoaded('rowDataUpdated');
|
49343 | var event = {
|
49344 | type: Events.EVENT_ROW_DATA_UPDATED
|
49345 | };
|
49346 | this.eventService.dispatchEvent(event);
|
49347 | };
|
49348 | ClientSideRowModel.prototype.doRowsToDisplay = function () {
|
49349 | this.rowsToDisplay = this.flattenStage.execute({ rowNode: this.rootNode });
|
49350 | };
|
49351 | ClientSideRowModel.prototype.onRowHeightChanged = function () {
|
49352 | this.refreshModel({ step: ClientSideRowModelSteps.MAP, keepRenderedRows: true, keepEditingRows: true, keepUndoRedoStack: true });
|
49353 | };
|
49354 | |
49355 |
|
49356 |
|
49357 |
|
49358 |
|
49359 |
|
49360 | ClientSideRowModel.prototype.onRowHeightChangedDebounced = function () {
|
49361 | this.onRowHeightChanged_debounced();
|
49362 | };
|
49363 | ClientSideRowModel.prototype.resetRowHeights = function () {
|
49364 | var atLeastOne = false;
|
49365 | this.forEachNode(function (rowNode) {
|
49366 | rowNode.setRowHeight(rowNode.rowHeight, true);
|
49367 |
|
49368 |
|
49369 |
|
49370 | var detailNode = rowNode.detailNode;
|
49371 | if (detailNode) {
|
49372 | detailNode.setRowHeight(detailNode.rowHeight, true);
|
49373 | }
|
49374 | atLeastOne = true;
|
49375 | });
|
49376 |
|
49377 |
|
49378 | this.rootNode.setRowHeight(this.rootNode.rowHeight, true);
|
49379 | if (atLeastOne) {
|
49380 | this.onRowHeightChanged();
|
49381 | }
|
49382 | };
|
49383 | __decorate$b([
|
49384 | Autowired('columnModel')
|
49385 | ], ClientSideRowModel.prototype, "columnModel", void 0);
|
49386 | __decorate$b([
|
49387 | Autowired('selectionService')
|
49388 | ], ClientSideRowModel.prototype, "selectionService", void 0);
|
49389 | __decorate$b([
|
49390 | Autowired('filterManager')
|
49391 | ], ClientSideRowModel.prototype, "filterManager", void 0);
|
49392 | __decorate$b([
|
49393 | Autowired('valueCache')
|
49394 | ], ClientSideRowModel.prototype, "valueCache", void 0);
|
49395 | __decorate$b([
|
49396 | Autowired('beans')
|
49397 | ], ClientSideRowModel.prototype, "beans", void 0);
|
49398 | __decorate$b([
|
49399 | Autowired('filterStage')
|
49400 | ], ClientSideRowModel.prototype, "filterStage", void 0);
|
49401 | __decorate$b([
|
49402 | Autowired('sortStage')
|
49403 | ], ClientSideRowModel.prototype, "sortStage", void 0);
|
49404 | __decorate$b([
|
49405 | Autowired('flattenStage')
|
49406 | ], ClientSideRowModel.prototype, "flattenStage", void 0);
|
49407 | __decorate$b([
|
49408 | Optional('groupStage')
|
49409 | ], ClientSideRowModel.prototype, "groupStage", void 0);
|
49410 | __decorate$b([
|
49411 | Optional('aggregationStage')
|
49412 | ], ClientSideRowModel.prototype, "aggregationStage", void 0);
|
49413 | __decorate$b([
|
49414 | Optional('pivotStage')
|
49415 | ], ClientSideRowModel.prototype, "pivotStage", void 0);
|
49416 | __decorate$b([
|
49417 | Optional('filterAggregatesStage')
|
49418 | ], ClientSideRowModel.prototype, "filterAggregatesStage", void 0);
|
49419 | __decorate$b([
|
49420 | PostConstruct
|
49421 | ], ClientSideRowModel.prototype, "init", null);
|
49422 | ClientSideRowModel = __decorate$b([
|
49423 | Bean('rowModel')
|
49424 | ], ClientSideRowModel);
|
49425 | return ClientSideRowModel;
|
49426 | }(BeanStub));
|
49427 |
|
49428 | var __extends$b = (undefined && undefined.__extends) || (function () {
|
49429 | var extendStatics = function (d, b) {
|
49430 | extendStatics = Object.setPrototypeOf ||
|
49431 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
49432 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
49433 | return extendStatics(d, b);
|
49434 | };
|
49435 | return function (d, b) {
|
49436 | extendStatics(d, b);
|
49437 | function __() { this.constructor = d; }
|
49438 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
49439 | };
|
49440 | })();
|
49441 | var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
49442 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
49443 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
49444 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
49445 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
49446 | };
|
49447 | var FilterStage = (function (_super) {
|
49448 | __extends$b(FilterStage, _super);
|
49449 | function FilterStage() {
|
49450 | return _super !== null && _super.apply(this, arguments) || this;
|
49451 | }
|
49452 | FilterStage.prototype.execute = function (params) {
|
49453 | var changedPath = params.changedPath;
|
49454 | this.filterService.filter(changedPath);
|
49455 | };
|
49456 | __decorate$a([
|
49457 | Autowired('filterService')
|
49458 | ], FilterStage.prototype, "filterService", void 0);
|
49459 | FilterStage = __decorate$a([
|
49460 | Bean('filterStage')
|
49461 | ], FilterStage);
|
49462 | return FilterStage;
|
49463 | }(BeanStub));
|
49464 |
|
49465 | var __extends$a = (undefined && undefined.__extends) || (function () {
|
49466 | var extendStatics = function (d, b) {
|
49467 | extendStatics = Object.setPrototypeOf ||
|
49468 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
49469 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
49470 | return extendStatics(d, b);
|
49471 | };
|
49472 | return function (d, b) {
|
49473 | extendStatics(d, b);
|
49474 | function __() { this.constructor = d; }
|
49475 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
49476 | };
|
49477 | })();
|
49478 | var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
49479 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
49480 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
49481 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
49482 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
49483 | };
|
49484 | var SortStage = (function (_super) {
|
49485 | __extends$a(SortStage, _super);
|
49486 | function SortStage() {
|
49487 | return _super !== null && _super.apply(this, arguments) || this;
|
49488 | }
|
49489 | SortStage.prototype.execute = function (params) {
|
49490 | var _this = this;
|
49491 | var sortOptions = this.sortController.getSortOptions();
|
49492 | var sortActive = _.exists(sortOptions) && sortOptions.length > 0;
|
49493 | var deltaSort = sortActive
|
49494 | && _.exists(params.rowNodeTransactions)
|
49495 |
|
49496 |
|
49497 |
|
49498 |
|
49499 | && this.gridOptionsService.is('deltaSort');
|
49500 | var sortContainsGroupColumns = sortOptions.some(function (opt) { return !!_this.columnModel.getGroupDisplayColumnForGroup(opt.column.getId()); });
|
49501 | this.sortService.sort(sortOptions, sortActive, deltaSort, params.rowNodeTransactions, params.changedPath, sortContainsGroupColumns);
|
49502 | };
|
49503 | __decorate$9([
|
49504 | Autowired('sortService')
|
49505 | ], SortStage.prototype, "sortService", void 0);
|
49506 | __decorate$9([
|
49507 | Autowired('sortController')
|
49508 | ], SortStage.prototype, "sortController", void 0);
|
49509 | __decorate$9([
|
49510 | Autowired('columnModel')
|
49511 | ], SortStage.prototype, "columnModel", void 0);
|
49512 | SortStage = __decorate$9([
|
49513 | Bean('sortStage')
|
49514 | ], SortStage);
|
49515 | return SortStage;
|
49516 | }(BeanStub));
|
49517 |
|
49518 | var __extends$9 = (undefined && undefined.__extends) || (function () {
|
49519 | var extendStatics = function (d, b) {
|
49520 | extendStatics = Object.setPrototypeOf ||
|
49521 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
49522 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
49523 | return extendStatics(d, b);
|
49524 | };
|
49525 | return function (d, b) {
|
49526 | extendStatics(d, b);
|
49527 | function __() { this.constructor = d; }
|
49528 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
49529 | };
|
49530 | })();
|
49531 | var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
49532 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
49533 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
49534 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
49535 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
49536 | };
|
49537 | var FlattenStage = (function (_super) {
|
49538 | __extends$9(FlattenStage, _super);
|
49539 | function FlattenStage() {
|
49540 | return _super !== null && _super.apply(this, arguments) || this;
|
49541 | }
|
49542 | FlattenStage.prototype.execute = function (params) {
|
49543 | var rootNode = params.rowNode;
|
49544 |
|
49545 |
|
49546 | var result = [];
|
49547 |
|
49548 | var nextRowTop = { value: 0 };
|
49549 | var skipLeafNodes = this.columnModel.isPivotMode();
|
49550 |
|
49551 |
|
49552 | var showRootNode = skipLeafNodes && rootNode.leafGroup;
|
49553 | var topList = showRootNode ? [rootNode] : rootNode.childrenAfterSort;
|
49554 | this.recursivelyAddToRowsToDisplay(topList, result, nextRowTop, skipLeafNodes, 0);
|
49555 |
|
49556 | var atLeastOneRowPresent = result.length > 0;
|
49557 | var includeGroupTotalFooter = !showRootNode
|
49558 |
|
49559 | && atLeastOneRowPresent
|
49560 | && this.gridOptionsService.is('groupIncludeTotalFooter');
|
49561 | if (includeGroupTotalFooter) {
|
49562 | rootNode.createFooter();
|
49563 | this.addRowNodeToRowsToDisplay(rootNode.sibling, result, nextRowTop, 0);
|
49564 | }
|
49565 | return result;
|
49566 | };
|
49567 | FlattenStage.prototype.recursivelyAddToRowsToDisplay = function (rowsToFlatten, result, nextRowTop, skipLeafNodes, uiLevel) {
|
49568 | if (_.missingOrEmpty(rowsToFlatten)) {
|
49569 | return;
|
49570 | }
|
49571 | var hideOpenParents = this.gridOptionsService.is('groupHideOpenParents');
|
49572 |
|
49573 | var groupRemoveSingleChildren = this.gridOptionsService.is('groupRemoveSingleChildren');
|
49574 | var groupRemoveLowestSingleChildren = !groupRemoveSingleChildren && this.gridOptionsService.is('groupRemoveLowestSingleChildren');
|
49575 | for (var i = 0; i < rowsToFlatten.length; i++) {
|
49576 | var rowNode = rowsToFlatten[i];
|
49577 |
|
49578 | var isParent = rowNode.hasChildren();
|
49579 | var isSkippedLeafNode = skipLeafNodes && !isParent;
|
49580 | var isRemovedSingleChildrenGroup = groupRemoveSingleChildren &&
|
49581 | isParent &&
|
49582 | rowNode.childrenAfterGroup.length === 1;
|
49583 | var isRemovedLowestSingleChildrenGroup = groupRemoveLowestSingleChildren &&
|
49584 | isParent &&
|
49585 | rowNode.leafGroup &&
|
49586 | rowNode.childrenAfterGroup.length === 1;
|
49587 |
|
49588 |
|
49589 |
|
49590 | var neverAllowToExpand = skipLeafNodes && rowNode.leafGroup;
|
49591 | var isHiddenOpenParent = hideOpenParents && rowNode.expanded && !rowNode.master && (!neverAllowToExpand);
|
49592 | var thisRowShouldBeRendered = !isSkippedLeafNode && !isHiddenOpenParent &&
|
49593 | !isRemovedSingleChildrenGroup && !isRemovedLowestSingleChildrenGroup;
|
49594 | if (thisRowShouldBeRendered) {
|
49595 | this.addRowNodeToRowsToDisplay(rowNode, result, nextRowTop, uiLevel);
|
49596 | }
|
49597 |
|
49598 | if (skipLeafNodes && rowNode.leafGroup) {
|
49599 | continue;
|
49600 | }
|
49601 | if (isParent) {
|
49602 | var excludedParent = isRemovedSingleChildrenGroup || isRemovedLowestSingleChildrenGroup;
|
49603 |
|
49604 |
|
49605 | if (rowNode.expanded || excludedParent) {
|
49606 |
|
49607 | var uiLevelForChildren = excludedParent ? uiLevel : uiLevel + 1;
|
49608 | this.recursivelyAddToRowsToDisplay(rowNode.childrenAfterSort, result, nextRowTop, skipLeafNodes, uiLevelForChildren);
|
49609 |
|
49610 | if (this.gridOptionsService.is('groupIncludeFooter')) {
|
49611 | this.addRowNodeToRowsToDisplay(rowNode.sibling, result, nextRowTop, uiLevel);
|
49612 | }
|
49613 | }
|
49614 | }
|
49615 | else if (rowNode.master && rowNode.expanded) {
|
49616 | var detailNode = this.createDetailNode(rowNode);
|
49617 | this.addRowNodeToRowsToDisplay(detailNode, result, nextRowTop, uiLevel);
|
49618 | }
|
49619 | }
|
49620 | };
|
49621 |
|
49622 | FlattenStage.prototype.addRowNodeToRowsToDisplay = function (rowNode, result, nextRowTop, uiLevel) {
|
49623 | var isGroupMultiAutoColumn = this.gridOptionsService.isGroupMultiAutoColumn();
|
49624 | result.push(rowNode);
|
49625 | rowNode.setUiLevel(isGroupMultiAutoColumn ? 0 : uiLevel);
|
49626 | };
|
49627 | FlattenStage.prototype.createDetailNode = function (masterNode) {
|
49628 | if (_.exists(masterNode.detailNode)) {
|
49629 | return masterNode.detailNode;
|
49630 | }
|
49631 | var detailNode = new RowNode(this.beans);
|
49632 | detailNode.detail = true;
|
49633 | detailNode.selectable = false;
|
49634 | detailNode.parent = masterNode;
|
49635 | if (_.exists(masterNode.id)) {
|
49636 | detailNode.id = 'detail_' + masterNode.id;
|
49637 | }
|
49638 | detailNode.data = masterNode.data;
|
49639 | detailNode.level = masterNode.level + 1;
|
49640 | masterNode.detailNode = detailNode;
|
49641 | return detailNode;
|
49642 | };
|
49643 | __decorate$8([
|
49644 | Autowired('columnModel')
|
49645 | ], FlattenStage.prototype, "columnModel", void 0);
|
49646 | __decorate$8([
|
49647 | Autowired('beans')
|
49648 | ], FlattenStage.prototype, "beans", void 0);
|
49649 | FlattenStage = __decorate$8([
|
49650 | Bean('flattenStage')
|
49651 | ], FlattenStage);
|
49652 | return FlattenStage;
|
49653 | }(BeanStub));
|
49654 |
|
49655 | var __extends$8 = (undefined && undefined.__extends) || (function () {
|
49656 | var extendStatics = function (d, b) {
|
49657 | extendStatics = Object.setPrototypeOf ||
|
49658 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
49659 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
49660 | return extendStatics(d, b);
|
49661 | };
|
49662 | return function (d, b) {
|
49663 | extendStatics(d, b);
|
49664 | function __() { this.constructor = d; }
|
49665 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
49666 | };
|
49667 | })();
|
49668 | var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
49669 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
49670 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
49671 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
49672 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
49673 | };
|
49674 | var SortService = (function (_super) {
|
49675 | __extends$8(SortService, _super);
|
49676 | function SortService() {
|
49677 | return _super !== null && _super.apply(this, arguments) || this;
|
49678 | }
|
49679 | SortService.prototype.init = function () {
|
49680 | this.postSortFunc = this.getPostSortFunc();
|
49681 | };
|
49682 | SortService.prototype.sort = function (sortOptions, sortActive, useDeltaSort, rowNodeTransactions, changedPath, sortContainsGroupColumns) {
|
49683 | var _this = this;
|
49684 | var groupMaintainOrder = this.gridOptionsService.is('groupMaintainOrder');
|
49685 | var groupColumnsPresent = this.columnModel.getAllGridColumns().some(function (c) { return c.isRowGroupActive(); });
|
49686 | var allDirtyNodes = {};
|
49687 | if (useDeltaSort && rowNodeTransactions) {
|
49688 | allDirtyNodes = this.calculateDirtyNodes(rowNodeTransactions);
|
49689 | }
|
49690 | var isPivotMode = this.columnModel.isPivotMode();
|
49691 | var callback = function (rowNode) {
|
49692 |
|
49693 | _this.pullDownGroupDataForHideOpenParents(rowNode.childrenAfterAggFilter, true);
|
49694 |
|
49695 | var skipSortingPivotLeafs = isPivotMode && rowNode.leafGroup;
|
49696 |
|
49697 |
|
49698 |
|
49699 | var skipSortingGroups = groupMaintainOrder && groupColumnsPresent && !rowNode.leafGroup && !sortContainsGroupColumns;
|
49700 | if (skipSortingGroups) {
|
49701 | var childrenToBeSorted = rowNode.childrenAfterAggFilter.slice(0);
|
49702 | if (rowNode.childrenAfterSort) {
|
49703 | var indexedOrders_1 = {};
|
49704 | rowNode.childrenAfterSort.forEach(function (node, idx) {
|
49705 | indexedOrders_1[node.id] = idx;
|
49706 | });
|
49707 | childrenToBeSorted.sort(function (row1, row2) { var _a, _b; return ((_a = indexedOrders_1[row1.id]) !== null && _a !== void 0 ? _a : 0) - ((_b = indexedOrders_1[row2.id]) !== null && _b !== void 0 ? _b : 0); });
|
49708 | }
|
49709 | rowNode.childrenAfterSort = childrenToBeSorted;
|
49710 | }
|
49711 | else if (!sortActive || skipSortingPivotLeafs) {
|
49712 |
|
49713 | rowNode.childrenAfterSort = rowNode.childrenAfterAggFilter.slice(0);
|
49714 | }
|
49715 | else if (useDeltaSort) {
|
49716 | rowNode.childrenAfterSort = _this.doDeltaSort(rowNode, allDirtyNodes, changedPath, sortOptions);
|
49717 | }
|
49718 | else {
|
49719 | rowNode.childrenAfterSort = _this.rowNodeSorter.doFullSort(rowNode.childrenAfterAggFilter, sortOptions);
|
49720 | }
|
49721 | if (rowNode.sibling) {
|
49722 | rowNode.sibling.childrenAfterSort = rowNode.childrenAfterSort;
|
49723 | }
|
49724 | _this.updateChildIndexes(rowNode);
|
49725 | if (_this.postSortFunc) {
|
49726 | var params = { nodes: rowNode.childrenAfterSort };
|
49727 | _this.postSortFunc(params);
|
49728 | }
|
49729 | };
|
49730 | if (changedPath) {
|
49731 | changedPath.forEachChangedNodeDepthFirst(callback);
|
49732 | }
|
49733 | this.updateGroupDataForHideOpenParents(changedPath);
|
49734 | };
|
49735 | SortService.prototype.getPostSortFunc = function () {
|
49736 | var postSortRows = this.gridOptionsService.getCallback('postSortRows');
|
49737 | if (postSortRows) {
|
49738 | return postSortRows;
|
49739 | }
|
49740 |
|
49741 | var postSort = this.gridOptionsService.get('postSort');
|
49742 | if (postSort) {
|
49743 | return function (params) { return postSort(params.nodes); };
|
49744 | }
|
49745 | };
|
49746 | SortService.prototype.calculateDirtyNodes = function (rowNodeTransactions) {
|
49747 | var dirtyNodes = {};
|
49748 | var addNodesFunc = function (rowNodes) {
|
49749 | if (rowNodes) {
|
49750 | rowNodes.forEach(function (rowNode) { return dirtyNodes[rowNode.id] = true; });
|
49751 | }
|
49752 | };
|
49753 |
|
49754 | if (rowNodeTransactions) {
|
49755 | rowNodeTransactions.forEach(function (tran) {
|
49756 | addNodesFunc(tran.add);
|
49757 | addNodesFunc(tran.update);
|
49758 | addNodesFunc(tran.remove);
|
49759 | });
|
49760 | }
|
49761 | return dirtyNodes;
|
49762 | };
|
49763 | SortService.prototype.doDeltaSort = function (rowNode, allTouchedNodes, changedPath, sortOptions) {
|
49764 | var _this = this;
|
49765 | var unsortedRows = rowNode.childrenAfterAggFilter;
|
49766 | var oldSortedRows = rowNode.childrenAfterSort;
|
49767 | if (!oldSortedRows) {
|
49768 | return this.rowNodeSorter.doFullSort(unsortedRows, sortOptions);
|
49769 | }
|
49770 | var untouchedRowsMap = {};
|
49771 | var touchedRows = [];
|
49772 | unsortedRows.forEach(function (row) {
|
49773 | if (allTouchedNodes[row.id] || !changedPath.canSkip(row)) {
|
49774 | touchedRows.push(row);
|
49775 | }
|
49776 | else {
|
49777 | untouchedRowsMap[row.id] = true;
|
49778 | }
|
49779 | });
|
49780 | var sortedUntouchedRows = oldSortedRows.filter(function (child) { return untouchedRowsMap[child.id]; });
|
49781 | var mapNodeToSortedNode = function (rowNode, pos) { return ({ currentPos: pos, rowNode: rowNode }); };
|
49782 | var sortedChangedRows = touchedRows
|
49783 | .map(mapNodeToSortedNode)
|
49784 | .sort(function (a, b) { return _this.rowNodeSorter.compareRowNodes(sortOptions, a, b); });
|
49785 | return this.mergeSortedArrays(sortOptions, sortedChangedRows, sortedUntouchedRows.map(mapNodeToSortedNode)).map(function (_a) {
|
49786 | var rowNode = _a.rowNode;
|
49787 | return rowNode;
|
49788 | });
|
49789 | };
|
49790 |
|
49791 | SortService.prototype.mergeSortedArrays = function (sortOptions, arr1, arr2) {
|
49792 | var res = [];
|
49793 | var i = 0;
|
49794 | var j = 0;
|
49795 |
|
49796 | while (i < arr1.length && j < arr2.length) {
|
49797 |
|
49798 |
|
49799 |
|
49800 |
|
49801 |
|
49802 | var compareResult = this.rowNodeSorter.compareRowNodes(sortOptions, arr1[i], arr2[j]);
|
49803 | if (compareResult < 0) {
|
49804 | res.push(arr1[i++]);
|
49805 | }
|
49806 | else {
|
49807 | res.push(arr2[j++]);
|
49808 | }
|
49809 | }
|
49810 |
|
49811 | while (i < arr1.length) {
|
49812 | res.push(arr1[i++]);
|
49813 | }
|
49814 |
|
49815 | while (j < arr2.length) {
|
49816 | res.push(arr2[j++]);
|
49817 | }
|
49818 | return res;
|
49819 | };
|
49820 | SortService.prototype.updateChildIndexes = function (rowNode) {
|
49821 | if (_.missing(rowNode.childrenAfterSort)) {
|
49822 | return;
|
49823 | }
|
49824 | var listToSort = rowNode.childrenAfterSort;
|
49825 | for (var i = 0; i < listToSort.length; i++) {
|
49826 | var child = listToSort[i];
|
49827 | var firstChild = i === 0;
|
49828 | var lastChild = i === rowNode.childrenAfterSort.length - 1;
|
49829 | child.setFirstChild(firstChild);
|
49830 | child.setLastChild(lastChild);
|
49831 | child.setChildIndex(i);
|
49832 | }
|
49833 | };
|
49834 | SortService.prototype.updateGroupDataForHideOpenParents = function (changedPath) {
|
49835 | var _this = this;
|
49836 | if (!this.gridOptionsService.is('groupHideOpenParents')) {
|
49837 | return;
|
49838 | }
|
49839 | if (this.gridOptionsService.isTreeData()) {
|
49840 | 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).";
|
49841 | _.doOnce(function () { return console.warn(msg_1); }, 'sortService.hideOpenParentsWithTreeData');
|
49842 | return false;
|
49843 | }
|
49844 |
|
49845 | var callback = function (rowNode) {
|
49846 | _this.pullDownGroupDataForHideOpenParents(rowNode.childrenAfterSort, false);
|
49847 | rowNode.childrenAfterSort.forEach(function (child) {
|
49848 | if (child.hasChildren()) {
|
49849 | callback(child);
|
49850 | }
|
49851 | });
|
49852 | };
|
49853 | if (changedPath) {
|
49854 | changedPath.executeFromRootNode(function (rowNode) { return callback(rowNode); });
|
49855 | }
|
49856 | };
|
49857 | SortService.prototype.pullDownGroupDataForHideOpenParents = function (rowNodes, clearOperation) {
|
49858 | var _this = this;
|
49859 | if (!this.gridOptionsService.is('groupHideOpenParents') || _.missing(rowNodes)) {
|
49860 | return;
|
49861 | }
|
49862 | rowNodes.forEach(function (childRowNode) {
|
49863 | var groupDisplayCols = _this.columnModel.getGroupDisplayColumns();
|
49864 | groupDisplayCols.forEach(function (groupDisplayCol) {
|
49865 | var showRowGroup = groupDisplayCol.getColDef().showRowGroup;
|
49866 | if (typeof showRowGroup !== 'string') {
|
49867 | console.error('AG Grid: groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup');
|
49868 | return;
|
49869 | }
|
49870 | var displayingGroupKey = showRowGroup;
|
49871 | var rowGroupColumn = _this.columnModel.getPrimaryColumn(displayingGroupKey);
|
49872 | var thisRowNodeMatches = rowGroupColumn === childRowNode.rowGroupColumn;
|
49873 | if (thisRowNodeMatches) {
|
49874 | return;
|
49875 | }
|
49876 | if (clearOperation) {
|
49877 |
|
49878 | childRowNode.setGroupValue(groupDisplayCol.getId(), undefined);
|
49879 | }
|
49880 | else {
|
49881 |
|
49882 | var parentToStealFrom = childRowNode.getFirstChildOfFirstChild(rowGroupColumn);
|
49883 | if (parentToStealFrom) {
|
49884 | childRowNode.setGroupValue(groupDisplayCol.getId(), parentToStealFrom.key);
|
49885 | }
|
49886 | }
|
49887 | });
|
49888 | });
|
49889 | };
|
49890 | __decorate$7([
|
49891 | Autowired('columnModel')
|
49892 | ], SortService.prototype, "columnModel", void 0);
|
49893 | __decorate$7([
|
49894 | Autowired('rowNodeSorter')
|
49895 | ], SortService.prototype, "rowNodeSorter", void 0);
|
49896 | __decorate$7([
|
49897 | PostConstruct
|
49898 | ], SortService.prototype, "init", null);
|
49899 | SortService = __decorate$7([
|
49900 | Bean('sortService')
|
49901 | ], SortService);
|
49902 | return SortService;
|
49903 | }(BeanStub));
|
49904 |
|
49905 | var __extends$7 = (undefined && undefined.__extends) || (function () {
|
49906 | var extendStatics = function (d, b) {
|
49907 | extendStatics = Object.setPrototypeOf ||
|
49908 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
49909 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
49910 | return extendStatics(d, b);
|
49911 | };
|
49912 | return function (d, b) {
|
49913 | extendStatics(d, b);
|
49914 | function __() { this.constructor = d; }
|
49915 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
49916 | };
|
49917 | })();
|
49918 | var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
49919 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
49920 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
49921 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
49922 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
49923 | };
|
49924 | var FilterService = (function (_super) {
|
49925 | __extends$7(FilterService, _super);
|
49926 | function FilterService() {
|
49927 | return _super !== null && _super.apply(this, arguments) || this;
|
49928 | }
|
49929 | FilterService.prototype.filter = function (changedPath) {
|
49930 | var filterActive = this.filterManager.isColumnFilterPresent()
|
49931 | || this.filterManager.isQuickFilterPresent()
|
49932 | || this.filterManager.isExternalFilterPresent();
|
49933 | this.filterNodes(filterActive, changedPath);
|
49934 | };
|
49935 | FilterService.prototype.filterNodes = function (filterActive, changedPath) {
|
49936 | var _this = this;
|
49937 | var filterCallback = function (rowNode, includeChildNodes) {
|
49938 |
|
49939 | if (rowNode.hasChildren()) {
|
49940 |
|
49941 | if (filterActive && !includeChildNodes) {
|
49942 | rowNode.childrenAfterFilter = rowNode.childrenAfterGroup.filter(function (childNode) {
|
49943 |
|
49944 |
|
49945 | var passBecauseChildren = childNode.childrenAfterFilter && childNode.childrenAfterFilter.length > 0;
|
49946 |
|
49947 |
|
49948 | var passBecauseDataPasses = childNode.data
|
49949 | && _this.filterManager.doesRowPassFilter({ rowNode: childNode });
|
49950 |
|
49951 | return passBecauseChildren || passBecauseDataPasses;
|
49952 | });
|
49953 | }
|
49954 | else {
|
49955 |
|
49956 | rowNode.childrenAfterFilter = rowNode.childrenAfterGroup;
|
49957 | }
|
49958 | }
|
49959 | else {
|
49960 | rowNode.childrenAfterFilter = rowNode.childrenAfterGroup;
|
49961 | }
|
49962 | if (rowNode.sibling) {
|
49963 | rowNode.sibling.childrenAfterFilter = rowNode.childrenAfterFilter;
|
49964 | }
|
49965 | };
|
49966 | if (this.doingTreeDataFiltering()) {
|
49967 | var treeDataDepthFirstFilter_1 = function (rowNode, alreadyFoundInParent) {
|
49968 |
|
49969 |
|
49970 | if (rowNode.childrenAfterGroup) {
|
49971 | for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) {
|
49972 | var childNode = rowNode.childrenAfterGroup[i];
|
49973 |
|
49974 | var foundInParent = alreadyFoundInParent
|
49975 | || _this.filterManager.doesRowPassFilter({ rowNode: childNode });
|
49976 | if (childNode.childrenAfterGroup) {
|
49977 | treeDataDepthFirstFilter_1(rowNode.childrenAfterGroup[i], foundInParent);
|
49978 | }
|
49979 | else {
|
49980 | filterCallback(childNode, foundInParent);
|
49981 | }
|
49982 | }
|
49983 | }
|
49984 | filterCallback(rowNode, alreadyFoundInParent);
|
49985 | };
|
49986 | var treeDataFilterCallback = function (rowNode) { return treeDataDepthFirstFilter_1(rowNode, false); };
|
49987 | changedPath.executeFromRootNode(treeDataFilterCallback);
|
49988 | }
|
49989 | else {
|
49990 | var defaultFilterCallback = function (rowNode) { return filterCallback(rowNode, false); };
|
49991 | changedPath.forEachChangedNodeDepthFirst(defaultFilterCallback, true);
|
49992 | }
|
49993 | };
|
49994 | FilterService.prototype.doingTreeDataFiltering = function () {
|
49995 | return this.gridOptionsService.isTreeData() && !this.gridOptionsService.is('excludeChildrenWhenTreeDataFiltering');
|
49996 | };
|
49997 | __decorate$6([
|
49998 | Autowired('filterManager')
|
49999 | ], FilterService.prototype, "filterManager", void 0);
|
50000 | FilterService = __decorate$6([
|
50001 | Bean("filterService")
|
50002 | ], FilterService);
|
50003 | return FilterService;
|
50004 | }(BeanStub));
|
50005 |
|
50006 | var __extends$6 = (undefined && undefined.__extends) || (function () {
|
50007 | var extendStatics = function (d, b) {
|
50008 | extendStatics = Object.setPrototypeOf ||
|
50009 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
50010 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
50011 | return extendStatics(d, b);
|
50012 | };
|
50013 | return function (d, b) {
|
50014 | extendStatics(d, b);
|
50015 | function __() { this.constructor = d; }
|
50016 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
50017 | };
|
50018 | })();
|
50019 | var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
50020 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
50021 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
50022 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
50023 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
50024 | };
|
50025 | var __read = (undefined && undefined.__read) || function (o, n) {
|
50026 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
50027 | if (!m) return o;
|
50028 | var i = m.call(o), r, ar = [], e;
|
50029 | try {
|
50030 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
50031 | }
|
50032 | catch (error) { e = { error: error }; }
|
50033 | finally {
|
50034 | try {
|
50035 | if (r && !r.done && (m = i["return"])) m.call(i);
|
50036 | }
|
50037 | finally { if (e) throw e.error; }
|
50038 | }
|
50039 | return ar;
|
50040 | };
|
50041 | var ImmutableService = (function (_super) {
|
50042 | __extends$6(ImmutableService, _super);
|
50043 | function ImmutableService() {
|
50044 | return _super !== null && _super.apply(this, arguments) || this;
|
50045 | }
|
50046 | ImmutableService.prototype.postConstruct = function () {
|
50047 | if (this.rowModel.getType() === 'clientSide') {
|
50048 | this.clientSideRowModel = this.rowModel;
|
50049 | }
|
50050 | };
|
50051 | ImmutableService.prototype.isActive = function () {
|
50052 |
|
50053 |
|
50054 | var getRowIdProvided = this.gridOptionsService.exists('getRowId');
|
50055 | var immutableData = this.gridOptionsService.is('immutableData');
|
50056 |
|
50057 |
|
50058 | var resetRowDataOnUpdate = this.gridOptionsService.is('resetRowDataOnUpdate');
|
50059 | if (resetRowDataOnUpdate) {
|
50060 | return false;
|
50061 | }
|
50062 | return getRowIdProvided || immutableData;
|
50063 | };
|
50064 | ImmutableService.prototype.setRowData = function (rowData) {
|
50065 | var transactionAndMap = this.createTransactionForRowData(rowData);
|
50066 | if (!transactionAndMap) {
|
50067 | return;
|
50068 | }
|
50069 | var _a = __read(transactionAndMap, 2), transaction = _a[0], orderIdMap = _a[1];
|
50070 | var nodeTransaction = this.clientSideRowModel.updateRowData(transaction, orderIdMap);
|
50071 |
|
50072 |
|
50073 | if (nodeTransaction) {
|
50074 | this.rowRenderer.refreshFullWidthRows(nodeTransaction.update);
|
50075 | }
|
50076 | };
|
50077 |
|
50078 | ImmutableService.prototype.createTransactionForRowData = function (rowData) {
|
50079 | if (_.missing(this.clientSideRowModel)) {
|
50080 | console.error('AG Grid: ImmutableService only works with ClientSideRowModel');
|
50081 | return;
|
50082 | }
|
50083 | var getRowIdFunc = this.gridOptionsService.getRowIdFunc();
|
50084 | if (getRowIdFunc == null) {
|
50085 | console.error('AG Grid: ImmutableService requires getRowId() callback to be implemented, your row data needs IDs!');
|
50086 | return;
|
50087 | }
|
50088 |
|
50089 | var transaction = {
|
50090 | remove: [],
|
50091 | update: [],
|
50092 | add: []
|
50093 | };
|
50094 | var existingNodesMap = this.clientSideRowModel.getCopyOfNodesMap();
|
50095 | var suppressSortOrder = this.gridOptionsService.is('suppressMaintainUnsortedOrder');
|
50096 | var orderMap = suppressSortOrder ? undefined : {};
|
50097 | if (_.exists(rowData)) {
|
50098 |
|
50099 |
|
50100 |
|
50101 |
|
50102 | rowData.forEach(function (data, index) {
|
50103 | var id = getRowIdFunc({ data: data, level: 0 });
|
50104 | var existingNode = existingNodesMap[id];
|
50105 | if (orderMap) {
|
50106 | orderMap[id] = index;
|
50107 | }
|
50108 | if (existingNode) {
|
50109 | var dataHasChanged = existingNode.data !== data;
|
50110 | if (dataHasChanged) {
|
50111 | transaction.update.push(data);
|
50112 | }
|
50113 |
|
50114 |
|
50115 | existingNodesMap[id] = undefined;
|
50116 | }
|
50117 | else {
|
50118 | transaction.add.push(data);
|
50119 | }
|
50120 | });
|
50121 | }
|
50122 |
|
50123 | _.iterateObject(existingNodesMap, function (id, rowNode) {
|
50124 | if (rowNode) {
|
50125 | transaction.remove.push(rowNode.data);
|
50126 | }
|
50127 | });
|
50128 | return [transaction, orderMap];
|
50129 | };
|
50130 | __decorate$5([
|
50131 | Autowired('rowModel')
|
50132 | ], ImmutableService.prototype, "rowModel", void 0);
|
50133 | __decorate$5([
|
50134 | Autowired('rowRenderer')
|
50135 | ], ImmutableService.prototype, "rowRenderer", void 0);
|
50136 | __decorate$5([
|
50137 | PostConstruct
|
50138 | ], ImmutableService.prototype, "postConstruct", null);
|
50139 | ImmutableService = __decorate$5([
|
50140 | Bean('immutableService')
|
50141 | ], ImmutableService);
|
50142 | return ImmutableService;
|
50143 | }(BeanStub));
|
50144 |
|
50145 |
|
50146 | var VERSION$2 = '29.2.0';
|
50147 |
|
50148 | var ClientSideRowModelModule = {
|
50149 | version: VERSION$2,
|
50150 | moduleName: ModuleNames.ClientSideRowModelModule,
|
50151 | rowModel: 'clientSide',
|
50152 | beans: [ClientSideRowModel, FilterStage, SortStage, FlattenStage, SortService, FilterService, ImmutableService],
|
50153 | };
|
50154 |
|
50155 | var __extends$5 = (undefined && undefined.__extends) || (function () {
|
50156 | var extendStatics = function (d, b) {
|
50157 | extendStatics = Object.setPrototypeOf ||
|
50158 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
50159 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
50160 | return extendStatics(d, b);
|
50161 | };
|
50162 | return function (d, b) {
|
50163 | extendStatics(d, b);
|
50164 | function __() { this.constructor = d; }
|
50165 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
50166 | };
|
50167 | })();
|
50168 | var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
50169 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
50170 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
50171 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
50172 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
50173 | };
|
50174 | var InfiniteBlock = (function (_super) {
|
50175 | __extends$5(InfiniteBlock, _super);
|
50176 | function InfiniteBlock(id, parentCache, params) {
|
50177 | var _this = _super.call(this, id) || this;
|
50178 | _this.parentCache = parentCache;
|
50179 | _this.params = params;
|
50180 |
|
50181 |
|
50182 | _this.startRow = id * params.blockSize;
|
50183 | _this.endRow = _this.startRow + params.blockSize;
|
50184 | return _this;
|
50185 | }
|
50186 | InfiniteBlock.prototype.postConstruct = function () {
|
50187 | this.createRowNodes();
|
50188 | };
|
50189 | InfiniteBlock.prototype.getBlockStateJson = function () {
|
50190 | return {
|
50191 | id: '' + this.getId(),
|
50192 | state: {
|
50193 | blockNumber: this.getId(),
|
50194 | startRow: this.getStartRow(),
|
50195 | endRow: this.getEndRow(),
|
50196 | pageStatus: this.getState()
|
50197 | }
|
50198 | };
|
50199 | };
|
50200 | InfiniteBlock.prototype.setDataAndId = function (rowNode, data, index) {
|
50201 |
|
50202 |
|
50203 |
|
50204 | if (!rowNode.id && rowNode.alreadyRendered) {
|
50205 | rowNode.alreadyRendered = false;
|
50206 | }
|
50207 | if (_.exists(data)) {
|
50208 |
|
50209 |
|
50210 |
|
50211 |
|
50212 | rowNode.setDataAndId(data, index.toString());
|
50213 | }
|
50214 | else {
|
50215 | rowNode.setDataAndId(undefined, undefined);
|
50216 | }
|
50217 | };
|
50218 | InfiniteBlock.prototype.loadFromDatasource = function () {
|
50219 | var _this = this;
|
50220 | var params = this.createLoadParams();
|
50221 | if (_.missing(this.params.datasource.getRows)) {
|
50222 | console.warn("AG Grid: datasource is missing getRows method");
|
50223 | return;
|
50224 | }
|
50225 |
|
50226 | window.setTimeout(function () {
|
50227 | _this.params.datasource.getRows(params);
|
50228 | }, 0);
|
50229 | };
|
50230 | InfiniteBlock.prototype.processServerFail = function () {
|
50231 |
|
50232 | };
|
50233 | InfiniteBlock.prototype.createLoadParams = function () {
|
50234 |
|
50235 |
|
50236 |
|
50237 |
|
50238 | var params = {
|
50239 | startRow: this.getStartRow(),
|
50240 | endRow: this.getEndRow(),
|
50241 | successCallback: this.pageLoaded.bind(this, this.getVersion()),
|
50242 | failCallback: this.pageLoadFailed.bind(this, this.getVersion()),
|
50243 | sortModel: this.params.sortModel,
|
50244 | filterModel: this.params.filterModel,
|
50245 | context: this.gridOptionsService.context
|
50246 | };
|
50247 | return params;
|
50248 | };
|
50249 | InfiniteBlock.prototype.forEachNode = function (callback, sequence, rowCount) {
|
50250 | var _this = this;
|
50251 | this.rowNodes.forEach(function (rowNode, index) {
|
50252 | var rowIndex = _this.startRow + index;
|
50253 | if (rowIndex < rowCount) {
|
50254 | callback(rowNode, sequence.next());
|
50255 | }
|
50256 | });
|
50257 | };
|
50258 | InfiniteBlock.prototype.getLastAccessed = function () {
|
50259 | return this.lastAccessed;
|
50260 | };
|
50261 | InfiniteBlock.prototype.getRow = function (rowIndex, dontTouchLastAccessed) {
|
50262 | if (dontTouchLastAccessed === void 0) { dontTouchLastAccessed = false; }
|
50263 | if (!dontTouchLastAccessed) {
|
50264 | this.lastAccessed = this.params.lastAccessedSequence.next();
|
50265 | }
|
50266 | var localIndex = rowIndex - this.startRow;
|
50267 | return this.rowNodes[localIndex];
|
50268 | };
|
50269 | InfiniteBlock.prototype.getStartRow = function () {
|
50270 | return this.startRow;
|
50271 | };
|
50272 | InfiniteBlock.prototype.getEndRow = function () {
|
50273 | return this.endRow;
|
50274 | };
|
50275 |
|
50276 | InfiniteBlock.prototype.createRowNodes = function () {
|
50277 | this.rowNodes = [];
|
50278 | for (var i = 0; i < this.params.blockSize; i++) {
|
50279 | var rowIndex = this.startRow + i;
|
50280 | var rowNode = new RowNode(this.beans);
|
50281 | rowNode.setRowHeight(this.params.rowHeight);
|
50282 | rowNode.uiLevel = 0;
|
50283 | rowNode.setRowIndex(rowIndex);
|
50284 | rowNode.setRowTop(this.params.rowHeight * rowIndex);
|
50285 | this.rowNodes.push(rowNode);
|
50286 | }
|
50287 | };
|
50288 | InfiniteBlock.prototype.processServerResult = function (params) {
|
50289 | var _this = this;
|
50290 | this.rowNodes.forEach(function (rowNode, index) {
|
50291 | var data = params.rowData ? params.rowData[index] : undefined;
|
50292 | _this.setDataAndId(rowNode, data, _this.startRow + index);
|
50293 | });
|
50294 | var finalRowCount = params.rowCount != null && params.rowCount >= 0 ? params.rowCount : undefined;
|
50295 | this.parentCache.pageLoaded(this, finalRowCount);
|
50296 | };
|
50297 | InfiniteBlock.prototype.destroyRowNodes = function () {
|
50298 | this.rowNodes.forEach(function (rowNode) {
|
50299 |
|
50300 |
|
50301 | rowNode.clearRowTopAndRowIndex();
|
50302 | });
|
50303 | };
|
50304 | __decorate$4([
|
50305 | Autowired('beans')
|
50306 | ], InfiniteBlock.prototype, "beans", void 0);
|
50307 | __decorate$4([
|
50308 | PostConstruct
|
50309 | ], InfiniteBlock.prototype, "postConstruct", null);
|
50310 | __decorate$4([
|
50311 | PreDestroy
|
50312 | ], InfiniteBlock.prototype, "destroyRowNodes", null);
|
50313 | return InfiniteBlock;
|
50314 | }(RowNodeBlock));
|
50315 |
|
50316 | var __extends$4 = (undefined && undefined.__extends) || (function () {
|
50317 | var extendStatics = function (d, b) {
|
50318 | extendStatics = Object.setPrototypeOf ||
|
50319 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
50320 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
50321 | return extendStatics(d, b);
|
50322 | };
|
50323 | return function (d, b) {
|
50324 | extendStatics(d, b);
|
50325 | function __() { this.constructor = d; }
|
50326 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
50327 | };
|
50328 | })();
|
50329 | var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
50330 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
50331 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
50332 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
50333 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
50334 | };
|
50335 | var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
50336 | return function (target, key) { decorator(target, key, paramIndex); }
|
50337 | };
|
50338 | var InfiniteCache = (function (_super) {
|
50339 | __extends$4(InfiniteCache, _super);
|
50340 | function InfiniteCache(params) {
|
50341 | var _this = _super.call(this) || this;
|
50342 | _this.lastRowIndexKnown = false;
|
50343 | _this.blocks = {};
|
50344 | _this.blockCount = 0;
|
50345 | _this.rowCount = params.initialRowCount;
|
50346 | _this.params = params;
|
50347 | return _this;
|
50348 | }
|
50349 | InfiniteCache.prototype.setBeans = function (loggerFactory) {
|
50350 | this.logger = loggerFactory.create('InfiniteCache');
|
50351 | };
|
50352 |
|
50353 |
|
50354 |
|
50355 | InfiniteCache.prototype.getRow = function (rowIndex, dontCreatePage) {
|
50356 | if (dontCreatePage === void 0) { dontCreatePage = false; }
|
50357 | var blockId = Math.floor(rowIndex / this.params.blockSize);
|
50358 | var block = this.blocks[blockId];
|
50359 | if (!block) {
|
50360 | if (dontCreatePage) {
|
50361 | return undefined;
|
50362 | }
|
50363 | block = this.createBlock(blockId);
|
50364 | }
|
50365 | return block.getRow(rowIndex);
|
50366 | };
|
50367 | InfiniteCache.prototype.createBlock = function (blockNumber) {
|
50368 | var newBlock = this.createBean(new InfiniteBlock(blockNumber, this, this.params));
|
50369 | this.blocks[newBlock.getId()] = newBlock;
|
50370 | this.blockCount++;
|
50371 | this.purgeBlocksIfNeeded(newBlock);
|
50372 | this.params.rowNodeBlockLoader.addBlock(newBlock);
|
50373 | return newBlock;
|
50374 | };
|
50375 |
|
50376 |
|
50377 |
|
50378 |
|
50379 | InfiniteCache.prototype.refreshCache = function () {
|
50380 | var nothingToRefresh = this.blockCount == 0;
|
50381 | if (nothingToRefresh) {
|
50382 | this.purgeCache();
|
50383 | return;
|
50384 | }
|
50385 | this.getBlocksInOrder().forEach(function (block) { return block.setStateWaitingToLoad(); });
|
50386 | this.params.rowNodeBlockLoader.checkBlockToLoad();
|
50387 | };
|
50388 | InfiniteCache.prototype.destroyAllBlocks = function () {
|
50389 | var _this = this;
|
50390 | this.getBlocksInOrder().forEach(function (block) { return _this.destroyBlock(block); });
|
50391 | };
|
50392 | InfiniteCache.prototype.getRowCount = function () {
|
50393 | return this.rowCount;
|
50394 | };
|
50395 | InfiniteCache.prototype.isLastRowIndexKnown = function () {
|
50396 | return this.lastRowIndexKnown;
|
50397 | };
|
50398 |
|
50399 | InfiniteCache.prototype.pageLoaded = function (block, lastRow) {
|
50400 |
|
50401 |
|
50402 | if (!this.isAlive()) {
|
50403 | return;
|
50404 | }
|
50405 | this.logger.log("onPageLoaded: page = " + block.getId() + ", lastRow = " + lastRow);
|
50406 | this.checkRowCount(block, lastRow);
|
50407 |
|
50408 |
|
50409 |
|
50410 | this.onCacheUpdated();
|
50411 | };
|
50412 | InfiniteCache.prototype.purgeBlocksIfNeeded = function (blockToExclude) {
|
50413 | var _this = this;
|
50414 |
|
50415 |
|
50416 | var blocksForPurging = this.getBlocksInOrder().filter(function (b) { return b != blockToExclude; });
|
50417 | var lastAccessedComparator = function (a, b) { return b.getLastAccessed() - a.getLastAccessed(); };
|
50418 | blocksForPurging.sort(lastAccessedComparator);
|
50419 |
|
50420 |
|
50421 |
|
50422 | var maxBlocksProvided = this.params.maxBlocksInCache > 0;
|
50423 | var blocksToKeep = maxBlocksProvided ? this.params.maxBlocksInCache - 1 : null;
|
50424 | var emptyBlocksToKeep = InfiniteCache.MAX_EMPTY_BLOCKS_TO_KEEP - 1;
|
50425 | blocksForPurging.forEach(function (block, index) {
|
50426 | var purgeBecauseBlockEmpty = block.getState() === InfiniteBlock.STATE_WAITING_TO_LOAD && index >= emptyBlocksToKeep;
|
50427 | var purgeBecauseCacheFull = maxBlocksProvided ? index >= blocksToKeep : false;
|
50428 | if (purgeBecauseBlockEmpty || purgeBecauseCacheFull) {
|
50429 |
|
50430 |
|
50431 |
|
50432 | if (_this.isBlockCurrentlyDisplayed(block)) {
|
50433 | return;
|
50434 | }
|
50435 |
|
50436 | if (_this.isBlockFocused(block)) {
|
50437 | return;
|
50438 | }
|
50439 |
|
50440 | _this.removeBlockFromCache(block);
|
50441 | }
|
50442 | });
|
50443 | };
|
50444 | InfiniteCache.prototype.isBlockFocused = function (block) {
|
50445 | var focusedCell = this.focusService.getFocusCellToUseAfterRefresh();
|
50446 | if (!focusedCell) {
|
50447 | return false;
|
50448 | }
|
50449 | if (focusedCell.rowPinned != null) {
|
50450 | return false;
|
50451 | }
|
50452 | var blockIndexStart = block.getStartRow();
|
50453 | var blockIndexEnd = block.getEndRow();
|
50454 | var hasFocus = focusedCell.rowIndex >= blockIndexStart && focusedCell.rowIndex < blockIndexEnd;
|
50455 | return hasFocus;
|
50456 | };
|
50457 | InfiniteCache.prototype.isBlockCurrentlyDisplayed = function (block) {
|
50458 | var startIndex = block.getStartRow();
|
50459 | var endIndex = block.getEndRow() - 1;
|
50460 | return this.rowRenderer.isRangeInRenderedViewport(startIndex, endIndex);
|
50461 | };
|
50462 | InfiniteCache.prototype.removeBlockFromCache = function (blockToRemove) {
|
50463 | if (!blockToRemove) {
|
50464 | return;
|
50465 | }
|
50466 | this.destroyBlock(blockToRemove);
|
50467 |
|
50468 |
|
50469 |
|
50470 | };
|
50471 | InfiniteCache.prototype.checkRowCount = function (block, lastRow) {
|
50472 |
|
50473 |
|
50474 | if (typeof lastRow === 'number' && lastRow >= 0) {
|
50475 | this.rowCount = lastRow;
|
50476 | this.lastRowIndexKnown = true;
|
50477 | }
|
50478 | else if (!this.lastRowIndexKnown) {
|
50479 |
|
50480 | var lastRowIndex = (block.getId() + 1) * this.params.blockSize;
|
50481 | var lastRowIndexPlusOverflow = lastRowIndex + this.params.overflowSize;
|
50482 | if (this.rowCount < lastRowIndexPlusOverflow) {
|
50483 | this.rowCount = lastRowIndexPlusOverflow;
|
50484 | }
|
50485 | }
|
50486 | };
|
50487 | InfiniteCache.prototype.setRowCount = function (rowCount, lastRowIndexKnown) {
|
50488 | this.rowCount = rowCount;
|
50489 |
|
50490 |
|
50491 | if (_.exists(lastRowIndexKnown)) {
|
50492 | this.lastRowIndexKnown = lastRowIndexKnown;
|
50493 | }
|
50494 |
|
50495 |
|
50496 |
|
50497 | if (!this.lastRowIndexKnown) {
|
50498 | if (this.rowCount % this.params.blockSize === 0) {
|
50499 | this.rowCount++;
|
50500 | }
|
50501 | }
|
50502 | this.onCacheUpdated();
|
50503 | };
|
50504 | InfiniteCache.prototype.forEachNodeDeep = function (callback) {
|
50505 | var _this = this;
|
50506 | var sequence = new NumberSequence();
|
50507 | this.getBlocksInOrder().forEach(function (block) { return block.forEachNode(callback, sequence, _this.rowCount); });
|
50508 | };
|
50509 | InfiniteCache.prototype.getBlocksInOrder = function () {
|
50510 |
|
50511 | var blockComparator = function (a, b) { return a.getId() - b.getId(); };
|
50512 | var blocks = _.getAllValuesInObject(this.blocks).sort(blockComparator);
|
50513 | return blocks;
|
50514 | };
|
50515 | InfiniteCache.prototype.destroyBlock = function (block) {
|
50516 | delete this.blocks[block.getId()];
|
50517 | this.destroyBean(block);
|
50518 | this.blockCount--;
|
50519 | this.params.rowNodeBlockLoader.removeBlock(block);
|
50520 | };
|
50521 |
|
50522 | InfiniteCache.prototype.onCacheUpdated = function () {
|
50523 | if (this.isAlive()) {
|
50524 |
|
50525 |
|
50526 |
|
50527 |
|
50528 | this.destroyAllBlocksPastVirtualRowCount();
|
50529 |
|
50530 |
|
50531 | var event_1 = {
|
50532 | type: Events.EVENT_STORE_UPDATED
|
50533 | };
|
50534 | this.eventService.dispatchEvent(event_1);
|
50535 | }
|
50536 | };
|
50537 | InfiniteCache.prototype.destroyAllBlocksPastVirtualRowCount = function () {
|
50538 | var _this = this;
|
50539 | var blocksToDestroy = [];
|
50540 | this.getBlocksInOrder().forEach(function (block) {
|
50541 | var startRow = block.getId() * _this.params.blockSize;
|
50542 | if (startRow >= _this.rowCount) {
|
50543 | blocksToDestroy.push(block);
|
50544 | }
|
50545 | });
|
50546 | if (blocksToDestroy.length > 0) {
|
50547 | blocksToDestroy.forEach(function (block) { return _this.destroyBlock(block); });
|
50548 | }
|
50549 | };
|
50550 | InfiniteCache.prototype.purgeCache = function () {
|
50551 | var _this = this;
|
50552 | this.getBlocksInOrder().forEach(function (block) { return _this.removeBlockFromCache(block); });
|
50553 | this.lastRowIndexKnown = false;
|
50554 |
|
50555 |
|
50556 |
|
50557 |
|
50558 | if (this.rowCount === 0) {
|
50559 | this.rowCount = this.params.initialRowCount;
|
50560 | }
|
50561 | this.onCacheUpdated();
|
50562 | };
|
50563 | InfiniteCache.prototype.getRowNodesInRange = function (firstInRange, lastInRange) {
|
50564 | var _this = this;
|
50565 | var result = [];
|
50566 | var lastBlockId = -1;
|
50567 | var inActiveRange = false;
|
50568 | var numberSequence = new NumberSequence();
|
50569 |
|
50570 | if (_.missing(firstInRange)) {
|
50571 | inActiveRange = true;
|
50572 | }
|
50573 | var foundGapInSelection = false;
|
50574 | this.getBlocksInOrder().forEach(function (block) {
|
50575 | if (foundGapInSelection) {
|
50576 | return;
|
50577 | }
|
50578 | if (inActiveRange && (lastBlockId + 1 !== block.getId())) {
|
50579 | foundGapInSelection = true;
|
50580 | return;
|
50581 | }
|
50582 | lastBlockId = block.getId();
|
50583 | block.forEachNode(function (rowNode) {
|
50584 | var hitFirstOrLast = rowNode === firstInRange || rowNode === lastInRange;
|
50585 | if (inActiveRange || hitFirstOrLast) {
|
50586 | result.push(rowNode);
|
50587 | }
|
50588 | if (hitFirstOrLast) {
|
50589 | inActiveRange = !inActiveRange;
|
50590 | }
|
50591 | }, numberSequence, _this.rowCount);
|
50592 | });
|
50593 |
|
50594 | var invalidRange = foundGapInSelection || inActiveRange;
|
50595 | return invalidRange ? [] : result;
|
50596 | };
|
50597 |
|
50598 |
|
50599 |
|
50600 | InfiniteCache.MAX_EMPTY_BLOCKS_TO_KEEP = 2;
|
50601 | __decorate$3([
|
50602 | Autowired('rowRenderer')
|
50603 | ], InfiniteCache.prototype, "rowRenderer", void 0);
|
50604 | __decorate$3([
|
50605 | Autowired("focusService")
|
50606 | ], InfiniteCache.prototype, "focusService", void 0);
|
50607 | __decorate$3([
|
50608 | __param(0, Qualifier('loggerFactory'))
|
50609 | ], InfiniteCache.prototype, "setBeans", null);
|
50610 | __decorate$3([
|
50611 | PreDestroy
|
50612 | ], InfiniteCache.prototype, "destroyAllBlocks", null);
|
50613 | return InfiniteCache;
|
50614 | }(BeanStub));
|
50615 |
|
50616 | var __extends$3 = (undefined && undefined.__extends) || (function () {
|
50617 | var extendStatics = function (d, b) {
|
50618 | extendStatics = Object.setPrototypeOf ||
|
50619 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
50620 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
50621 | return extendStatics(d, b);
|
50622 | };
|
50623 | return function (d, b) {
|
50624 | extendStatics(d, b);
|
50625 | function __() { this.constructor = d; }
|
50626 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
50627 | };
|
50628 | })();
|
50629 | var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
50630 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
50631 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
50632 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
50633 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
50634 | };
|
50635 | var InfiniteRowModel = (function (_super) {
|
50636 | __extends$3(InfiniteRowModel, _super);
|
50637 | function InfiniteRowModel() {
|
50638 | return _super !== null && _super.apply(this, arguments) || this;
|
50639 | }
|
50640 | InfiniteRowModel.prototype.getRowBounds = function (index) {
|
50641 | return {
|
50642 | rowHeight: this.rowHeight,
|
50643 | rowTop: this.rowHeight * index
|
50644 | };
|
50645 | };
|
50646 |
|
50647 | InfiniteRowModel.prototype.ensureRowHeightsValid = function (startPixel, endPixel, startLimitIndex, endLimitIndex) {
|
50648 | return false;
|
50649 | };
|
50650 | InfiniteRowModel.prototype.init = function () {
|
50651 | var _this = this;
|
50652 | if (!this.gridOptionsService.isRowModelType('infinite')) {
|
50653 | return;
|
50654 | }
|
50655 | this.rowHeight = this.gridOptionsService.getRowHeightAsNumber();
|
50656 | this.addEventListeners();
|
50657 | this.addDestroyFunc(function () { return _this.destroyCache(); });
|
50658 | this.verifyProps();
|
50659 | };
|
50660 | InfiniteRowModel.prototype.verifyProps = function () {
|
50661 | if (this.gridOptionsService.exists('initialGroupOrderComparator') || this.gridOptionsService.exists('defaultGroupOrderComparator')) {
|
50662 | 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.";
|
50663 | _.doOnce(function () { return console.warn(message_1); }, 'IRM.InitialGroupOrderComparator');
|
50664 | }
|
50665 | };
|
50666 | InfiniteRowModel.prototype.start = function () {
|
50667 | this.setDatasource(this.gridOptionsService.get('datasource'));
|
50668 | };
|
50669 | InfiniteRowModel.prototype.destroyDatasource = function () {
|
50670 | if (this.datasource) {
|
50671 | this.getContext().destroyBean(this.datasource);
|
50672 | this.rowRenderer.datasourceChanged();
|
50673 | this.datasource = null;
|
50674 | }
|
50675 | };
|
50676 | InfiniteRowModel.prototype.addEventListeners = function () {
|
50677 | this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
|
50678 | this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
|
50679 | this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onColumnEverything.bind(this));
|
50680 | this.addManagedListener(this.eventService, Events.EVENT_STORE_UPDATED, this.onCacheUpdated.bind(this));
|
50681 | };
|
50682 | InfiniteRowModel.prototype.onFilterChanged = function () {
|
50683 | this.reset();
|
50684 | };
|
50685 | InfiniteRowModel.prototype.onSortChanged = function () {
|
50686 | this.reset();
|
50687 | };
|
50688 | InfiniteRowModel.prototype.onColumnEverything = function () {
|
50689 | var resetRequired;
|
50690 |
|
50691 |
|
50692 |
|
50693 | if (this.cacheParams) {
|
50694 | resetRequired = this.isSortModelDifferent();
|
50695 | }
|
50696 | else {
|
50697 |
|
50698 | resetRequired = true;
|
50699 | }
|
50700 | if (resetRequired) {
|
50701 | this.reset();
|
50702 | }
|
50703 | };
|
50704 | InfiniteRowModel.prototype.isSortModelDifferent = function () {
|
50705 | return !_.jsonEquals(this.cacheParams.sortModel, this.sortController.getSortModel());
|
50706 | };
|
50707 | InfiniteRowModel.prototype.getType = function () {
|
50708 | return 'infinite';
|
50709 | };
|
50710 | InfiniteRowModel.prototype.setDatasource = function (datasource) {
|
50711 | this.destroyDatasource();
|
50712 | this.datasource = datasource;
|
50713 |
|
50714 | if (datasource) {
|
50715 | this.reset();
|
50716 | }
|
50717 | };
|
50718 | InfiniteRowModel.prototype.isEmpty = function () {
|
50719 | return !this.infiniteCache;
|
50720 | };
|
50721 | InfiniteRowModel.prototype.isRowsToRender = function () {
|
50722 | return !!this.infiniteCache;
|
50723 | };
|
50724 | InfiniteRowModel.prototype.getNodesInRangeForSelection = function (firstInRange, lastInRange) {
|
50725 | return this.infiniteCache ? this.infiniteCache.getRowNodesInRange(firstInRange, lastInRange) : [];
|
50726 | };
|
50727 | InfiniteRowModel.prototype.reset = function () {
|
50728 |
|
50729 |
|
50730 | if (!this.datasource) {
|
50731 | return;
|
50732 | }
|
50733 |
|
50734 |
|
50735 |
|
50736 | var getRowIdFunc = this.gridOptionsService.getRowIdFunc();
|
50737 | var userGeneratingIds = getRowIdFunc != null;
|
50738 | if (!userGeneratingIds) {
|
50739 | this.selectionService.reset();
|
50740 | }
|
50741 | this.resetCache();
|
50742 | var event = this.createModelUpdatedEvent();
|
50743 | this.eventService.dispatchEvent(event);
|
50744 | };
|
50745 | InfiniteRowModel.prototype.createModelUpdatedEvent = function () {
|
50746 | return {
|
50747 | type: Events.EVENT_MODEL_UPDATED,
|
50748 |
|
50749 |
|
50750 | newPage: false,
|
50751 | newData: false,
|
50752 | keepRenderedRows: true,
|
50753 | animate: false
|
50754 | };
|
50755 | };
|
50756 | InfiniteRowModel.prototype.resetCache = function () {
|
50757 |
|
50758 | this.destroyCache();
|
50759 | this.cacheParams = {
|
50760 |
|
50761 | datasource: this.datasource,
|
50762 |
|
50763 | filterModel: this.filterManager.getFilterModel(),
|
50764 | sortModel: this.sortController.getSortModel(),
|
50765 | rowNodeBlockLoader: this.rowNodeBlockLoader,
|
50766 |
|
50767 |
|
50768 |
|
50769 | initialRowCount: this.defaultIfInvalid(this.gridOptionsService.getNum('infiniteInitialRowCount'), 1),
|
50770 | maxBlocksInCache: this.gridOptionsService.getNum('maxBlocksInCache'),
|
50771 | rowHeight: this.gridOptionsService.getRowHeightAsNumber(),
|
50772 |
|
50773 |
|
50774 | overflowSize: this.defaultIfInvalid(this.gridOptionsService.getNum('cacheOverflowSize'), 1),
|
50775 |
|
50776 |
|
50777 | blockSize: this.defaultIfInvalid(this.gridOptionsService.getNum('cacheBlockSize'), 100),
|
50778 |
|
50779 |
|
50780 | lastAccessedSequence: new NumberSequence()
|
50781 | };
|
50782 | this.infiniteCache = this.createBean(new InfiniteCache(this.cacheParams));
|
50783 | };
|
50784 | InfiniteRowModel.prototype.defaultIfInvalid = function (value, defaultValue) {
|
50785 | return value > 0 ? value : defaultValue;
|
50786 | };
|
50787 | InfiniteRowModel.prototype.destroyCache = function () {
|
50788 | if (this.infiniteCache) {
|
50789 | this.infiniteCache = this.destroyBean(this.infiniteCache);
|
50790 | }
|
50791 | };
|
50792 | InfiniteRowModel.prototype.onCacheUpdated = function () {
|
50793 | var event = this.createModelUpdatedEvent();
|
50794 | this.eventService.dispatchEvent(event);
|
50795 | };
|
50796 | InfiniteRowModel.prototype.getRow = function (rowIndex) {
|
50797 | if (!this.infiniteCache) {
|
50798 | return undefined;
|
50799 | }
|
50800 | if (rowIndex >= this.infiniteCache.getRowCount()) {
|
50801 | return undefined;
|
50802 | }
|
50803 | return this.infiniteCache.getRow(rowIndex);
|
50804 | };
|
50805 | InfiniteRowModel.prototype.getRowNode = function (id) {
|
50806 | var result;
|
50807 | this.forEachNode(function (rowNode) {
|
50808 | if (rowNode.id === id) {
|
50809 | result = rowNode;
|
50810 | }
|
50811 | });
|
50812 | return result;
|
50813 | };
|
50814 | InfiniteRowModel.prototype.forEachNode = function (callback) {
|
50815 | if (this.infiniteCache) {
|
50816 | this.infiniteCache.forEachNodeDeep(callback);
|
50817 | }
|
50818 | };
|
50819 | InfiniteRowModel.prototype.getTopLevelRowCount = function () {
|
50820 | return this.getRowCount();
|
50821 | };
|
50822 | InfiniteRowModel.prototype.getTopLevelRowDisplayedIndex = function (topLevelIndex) {
|
50823 | return topLevelIndex;
|
50824 | };
|
50825 | InfiniteRowModel.prototype.getRowIndexAtPixel = function (pixel) {
|
50826 | if (this.rowHeight !== 0) {
|
50827 | var rowIndexForPixel = Math.floor(pixel / this.rowHeight);
|
50828 | var lastRowIndex = this.getRowCount() - 1;
|
50829 | if (rowIndexForPixel > lastRowIndex) {
|
50830 | return lastRowIndex;
|
50831 | }
|
50832 | return rowIndexForPixel;
|
50833 | }
|
50834 | return 0;
|
50835 | };
|
50836 | InfiniteRowModel.prototype.getRowCount = function () {
|
50837 | return this.infiniteCache ? this.infiniteCache.getRowCount() : 0;
|
50838 | };
|
50839 | InfiniteRowModel.prototype.isRowPresent = function (rowNode) {
|
50840 | var foundRowNode = this.getRowNode(rowNode.id);
|
50841 | return !!foundRowNode;
|
50842 | };
|
50843 | InfiniteRowModel.prototype.refreshCache = function () {
|
50844 | if (this.infiniteCache) {
|
50845 | this.infiniteCache.refreshCache();
|
50846 | }
|
50847 | };
|
50848 | InfiniteRowModel.prototype.purgeCache = function () {
|
50849 | if (this.infiniteCache) {
|
50850 | this.infiniteCache.purgeCache();
|
50851 | }
|
50852 | };
|
50853 |
|
50854 | InfiniteRowModel.prototype.isLastRowIndexKnown = function () {
|
50855 | if (this.infiniteCache) {
|
50856 | return this.infiniteCache.isLastRowIndexKnown();
|
50857 | }
|
50858 | return false;
|
50859 | };
|
50860 | InfiniteRowModel.prototype.setRowCount = function (rowCount, lastRowIndexKnown) {
|
50861 | if (this.infiniteCache) {
|
50862 | this.infiniteCache.setRowCount(rowCount, lastRowIndexKnown);
|
50863 | }
|
50864 | };
|
50865 | __decorate$2([
|
50866 | Autowired('filterManager')
|
50867 | ], InfiniteRowModel.prototype, "filterManager", void 0);
|
50868 | __decorate$2([
|
50869 | Autowired('sortController')
|
50870 | ], InfiniteRowModel.prototype, "sortController", void 0);
|
50871 | __decorate$2([
|
50872 | Autowired('selectionService')
|
50873 | ], InfiniteRowModel.prototype, "selectionService", void 0);
|
50874 | __decorate$2([
|
50875 | Autowired('rowRenderer')
|
50876 | ], InfiniteRowModel.prototype, "rowRenderer", void 0);
|
50877 | __decorate$2([
|
50878 | Autowired('rowNodeBlockLoader')
|
50879 | ], InfiniteRowModel.prototype, "rowNodeBlockLoader", void 0);
|
50880 | __decorate$2([
|
50881 | PostConstruct
|
50882 | ], InfiniteRowModel.prototype, "init", null);
|
50883 | __decorate$2([
|
50884 | PreDestroy
|
50885 | ], InfiniteRowModel.prototype, "destroyDatasource", null);
|
50886 | InfiniteRowModel = __decorate$2([
|
50887 | Bean('rowModel')
|
50888 | ], InfiniteRowModel);
|
50889 | return InfiniteRowModel;
|
50890 | }(BeanStub));
|
50891 |
|
50892 |
|
50893 | var VERSION$1 = '29.2.0';
|
50894 |
|
50895 | var InfiniteRowModelModule = {
|
50896 | version: VERSION$1,
|
50897 | moduleName: ModuleNames.InfiniteRowModelModule,
|
50898 | rowModel: 'infinite',
|
50899 | beans: [InfiniteRowModel],
|
50900 | };
|
50901 |
|
50902 | var BaseCreator = (function () {
|
50903 | function BaseCreator() {
|
50904 | }
|
50905 | BaseCreator.prototype.setBeans = function (beans) {
|
50906 | this.beans = beans;
|
50907 | };
|
50908 | BaseCreator.prototype.getFileName = function (fileName) {
|
50909 | var extension = this.getDefaultFileExtension();
|
50910 | if (fileName == null || !fileName.length) {
|
50911 | fileName = this.getDefaultFileName();
|
50912 | }
|
50913 | return fileName.indexOf('.') === -1 ? fileName + "." + extension : fileName;
|
50914 | };
|
50915 | BaseCreator.prototype.getData = function (params) {
|
50916 | var serializingSession = this.createSerializingSession(params);
|
50917 | var data = this.beans.gridSerializer.serialize(serializingSession, params);
|
50918 | return data;
|
50919 | };
|
50920 | return BaseCreator;
|
50921 | }());
|
50922 |
|
50923 | var BaseGridSerializingSession = (function () {
|
50924 | function BaseGridSerializingSession(config) {
|
50925 | this.groupColumns = [];
|
50926 | var columnModel = config.columnModel, valueService = config.valueService, gridOptionsService = config.gridOptionsService, processCellCallback = config.processCellCallback, processHeaderCallback = config.processHeaderCallback, processGroupHeaderCallback = config.processGroupHeaderCallback, processRowGroupCallback = config.processRowGroupCallback;
|
50927 | this.columnModel = columnModel;
|
50928 | this.valueService = valueService;
|
50929 | this.gridOptionsService = gridOptionsService;
|
50930 | this.processCellCallback = processCellCallback;
|
50931 | this.processHeaderCallback = processHeaderCallback;
|
50932 | this.processGroupHeaderCallback = processGroupHeaderCallback;
|
50933 | this.processRowGroupCallback = processRowGroupCallback;
|
50934 | }
|
50935 | BaseGridSerializingSession.prototype.prepare = function (columnsToExport) {
|
50936 | this.groupColumns = columnsToExport.filter(function (col) { return !!col.getColDef().showRowGroup; });
|
50937 | };
|
50938 | BaseGridSerializingSession.prototype.extractHeaderValue = function (column) {
|
50939 | var value = this.getHeaderName(this.processHeaderCallback, column);
|
50940 | return value != null ? value : '';
|
50941 | };
|
50942 | BaseGridSerializingSession.prototype.extractRowCellValue = function (column, index, accumulatedRowIndex, type, node) {
|
50943 |
|
50944 | var hideOpenParents = this.gridOptionsService.is('groupHideOpenParents');
|
50945 | var value = (!hideOpenParents && this.shouldRenderGroupSummaryCell(node, column, index))
|
50946 | ? this.createValueForGroupNode(node)
|
50947 | : this.valueService.getValue(column, node);
|
50948 | var processedValue = this.processCell({
|
50949 | accumulatedRowIndex: accumulatedRowIndex,
|
50950 | rowNode: node,
|
50951 | column: column,
|
50952 | value: value,
|
50953 | processCellCallback: this.processCellCallback,
|
50954 | type: type
|
50955 | });
|
50956 | return processedValue != null ? processedValue : '';
|
50957 | };
|
50958 | BaseGridSerializingSession.prototype.shouldRenderGroupSummaryCell = function (node, column, currentColumnIndex) {
|
50959 | var _a;
|
50960 | var isGroupNode = node && node.group;
|
50961 |
|
50962 | if (!isGroupNode) {
|
50963 | return false;
|
50964 | }
|
50965 | var currentColumnGroupIndex = this.groupColumns.indexOf(column);
|
50966 | if (currentColumnGroupIndex !== -1) {
|
50967 | if ((_a = node.groupData) === null || _a === void 0 ? void 0 : _a[column.getId()]) {
|
50968 | return true;
|
50969 | }
|
50970 |
|
50971 | if (node.footer && node.level === -1) {
|
50972 | var colDef = column.getColDef();
|
50973 | var isFullWidth = colDef == null || colDef.showRowGroup === true;
|
50974 | return isFullWidth || colDef.showRowGroup === this.columnModel.getRowGroupColumns()[0].getId();
|
50975 | }
|
50976 | }
|
50977 | var isGroupUseEntireRow = this.gridOptionsService.isGroupUseEntireRow(this.columnModel.isPivotMode());
|
50978 | return currentColumnIndex === 0 && isGroupUseEntireRow;
|
50979 | };
|
50980 | BaseGridSerializingSession.prototype.getHeaderName = function (callback, column) {
|
50981 | if (callback) {
|
50982 | return callback({
|
50983 | column: column,
|
50984 | api: this.gridOptionsService.api,
|
50985 | columnApi: this.gridOptionsService.columnApi,
|
50986 | context: this.gridOptionsService.context
|
50987 | });
|
50988 | }
|
50989 | return this.columnModel.getDisplayNameForColumn(column, 'csv', true);
|
50990 | };
|
50991 | BaseGridSerializingSession.prototype.createValueForGroupNode = function (node) {
|
50992 | if (this.processRowGroupCallback) {
|
50993 | return this.processRowGroupCallback({
|
50994 | node: node,
|
50995 | api: this.gridOptionsService.api,
|
50996 | columnApi: this.gridOptionsService.columnApi,
|
50997 | context: this.gridOptionsService.context,
|
50998 | });
|
50999 | }
|
51000 | var isFooter = node.footer;
|
51001 | var keys = [node.key];
|
51002 | if (!this.gridOptionsService.isGroupMultiAutoColumn()) {
|
51003 | while (node.parent) {
|
51004 | node = node.parent;
|
51005 | keys.push(node.key);
|
51006 | }
|
51007 | }
|
51008 | var groupValue = keys.reverse().join(' -> ');
|
51009 | return isFooter ? "Total " + groupValue : groupValue;
|
51010 | };
|
51011 | BaseGridSerializingSession.prototype.processCell = function (params) {
|
51012 | var accumulatedRowIndex = params.accumulatedRowIndex, rowNode = params.rowNode, column = params.column, value = params.value, processCellCallback = params.processCellCallback, type = params.type;
|
51013 | if (processCellCallback) {
|
51014 | return processCellCallback({
|
51015 | accumulatedRowIndex: accumulatedRowIndex,
|
51016 | column: column,
|
51017 | node: rowNode,
|
51018 | value: value,
|
51019 | api: this.gridOptionsService.api,
|
51020 | columnApi: this.gridOptionsService.columnApi,
|
51021 | context: this.gridOptionsService.context,
|
51022 | type: type
|
51023 | });
|
51024 | }
|
51025 | return value != null ? value : '';
|
51026 | };
|
51027 | return BaseGridSerializingSession;
|
51028 | }());
|
51029 |
|
51030 | var Downloader = (function () {
|
51031 | function Downloader() {
|
51032 | }
|
51033 | Downloader.download = function (fileName, content) {
|
51034 | var win = document.defaultView || window;
|
51035 | if (!win) {
|
51036 | console.warn('AG Grid: There is no `window` associated with the current `document`');
|
51037 | return;
|
51038 | }
|
51039 | var element = document.createElement('a');
|
51040 |
|
51041 | var url = win.URL.createObjectURL(content);
|
51042 | element.setAttribute('href', url);
|
51043 | element.setAttribute('download', fileName);
|
51044 | element.style.display = 'none';
|
51045 | document.body.appendChild(element);
|
51046 | element.dispatchEvent(new MouseEvent('click', {
|
51047 | bubbles: false,
|
51048 | cancelable: true,
|
51049 | view: win
|
51050 | }));
|
51051 | document.body.removeChild(element);
|
51052 | win.setTimeout(function () {
|
51053 |
|
51054 | win.URL.revokeObjectURL(url);
|
51055 | }, 0);
|
51056 | };
|
51057 | return Downloader;
|
51058 | }());
|
51059 |
|
51060 | var __extends$2 = (undefined && undefined.__extends) || (function () {
|
51061 | var extendStatics = function (d, b) {
|
51062 | extendStatics = Object.setPrototypeOf ||
|
51063 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
51064 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
51065 | return extendStatics(d, b);
|
51066 | };
|
51067 | return function (d, b) {
|
51068 | extendStatics(d, b);
|
51069 | function __() { this.constructor = d; }
|
51070 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
51071 | };
|
51072 | })();
|
51073 | var LINE_SEPARATOR$1 = '\r\n';
|
51074 | var CsvSerializingSession = (function (_super) {
|
51075 | __extends$2(CsvSerializingSession, _super);
|
51076 | function CsvSerializingSession(config) {
|
51077 | var _this = _super.call(this, config) || this;
|
51078 | _this.isFirstLine = true;
|
51079 | _this.result = '';
|
51080 | var suppressQuotes = config.suppressQuotes, columnSeparator = config.columnSeparator;
|
51081 | _this.suppressQuotes = suppressQuotes;
|
51082 | _this.columnSeparator = columnSeparator;
|
51083 | return _this;
|
51084 | }
|
51085 | CsvSerializingSession.prototype.addCustomContent = function (content) {
|
51086 | var _this = this;
|
51087 | if (!content) {
|
51088 | return;
|
51089 | }
|
51090 | if (typeof content === 'string') {
|
51091 | if (!/^\s*\n/.test(content)) {
|
51092 | this.beginNewLine();
|
51093 | }
|
51094 |
|
51095 | content = content.replace(/\r?\n/g, LINE_SEPARATOR$1);
|
51096 | this.result += content;
|
51097 | }
|
51098 | else {
|
51099 | content.forEach(function (row) {
|
51100 | _this.beginNewLine();
|
51101 | row.forEach(function (cell, index) {
|
51102 | if (index !== 0) {
|
51103 | _this.result += _this.columnSeparator;
|
51104 | }
|
51105 | _this.result += _this.putInQuotes(cell.data.value || '');
|
51106 | if (cell.mergeAcross) {
|
51107 | _this.appendEmptyCells(cell.mergeAcross);
|
51108 | }
|
51109 | });
|
51110 | });
|
51111 | }
|
51112 | };
|
51113 | CsvSerializingSession.prototype.onNewHeaderGroupingRow = function () {
|
51114 | this.beginNewLine();
|
51115 | return {
|
51116 | onColumn: this.onNewHeaderGroupingRowColumn.bind(this)
|
51117 | };
|
51118 | };
|
51119 | CsvSerializingSession.prototype.onNewHeaderGroupingRowColumn = function (columnGroup, header, index, span) {
|
51120 | if (index != 0) {
|
51121 | this.result += this.columnSeparator;
|
51122 | }
|
51123 | this.result += this.putInQuotes(header);
|
51124 | this.appendEmptyCells(span);
|
51125 | };
|
51126 | CsvSerializingSession.prototype.appendEmptyCells = function (count) {
|
51127 | for (var i = 1; i <= count; i++) {
|
51128 | this.result += this.columnSeparator + this.putInQuotes("");
|
51129 | }
|
51130 | };
|
51131 | CsvSerializingSession.prototype.onNewHeaderRow = function () {
|
51132 | this.beginNewLine();
|
51133 | return {
|
51134 | onColumn: this.onNewHeaderRowColumn.bind(this)
|
51135 | };
|
51136 | };
|
51137 | CsvSerializingSession.prototype.onNewHeaderRowColumn = function (column, index) {
|
51138 | if (index != 0) {
|
51139 | this.result += this.columnSeparator;
|
51140 | }
|
51141 | this.result += this.putInQuotes(this.extractHeaderValue(column));
|
51142 | };
|
51143 | CsvSerializingSession.prototype.onNewBodyRow = function () {
|
51144 | this.beginNewLine();
|
51145 | return {
|
51146 | onColumn: this.onNewBodyRowColumn.bind(this)
|
51147 | };
|
51148 | };
|
51149 | CsvSerializingSession.prototype.onNewBodyRowColumn = function (column, index, node) {
|
51150 | if (index != 0) {
|
51151 | this.result += this.columnSeparator;
|
51152 | }
|
51153 | this.result += this.putInQuotes(this.extractRowCellValue(column, index, index, 'csv', node));
|
51154 | };
|
51155 | CsvSerializingSession.prototype.putInQuotes = function (value) {
|
51156 | if (this.suppressQuotes) {
|
51157 | return value;
|
51158 | }
|
51159 | if (value === null || value === undefined) {
|
51160 | return '""';
|
51161 | }
|
51162 | var stringValue;
|
51163 | if (typeof value === 'string') {
|
51164 | stringValue = value;
|
51165 | }
|
51166 | else if (typeof value.toString === 'function') {
|
51167 | stringValue = value.toString();
|
51168 | }
|
51169 | else {
|
51170 | console.warn('AG Grid: unknown value type during csv conversion');
|
51171 | stringValue = '';
|
51172 | }
|
51173 |
|
51174 | var valueEscaped = stringValue.replace(/"/g, "\"\"");
|
51175 | return '"' + valueEscaped + '"';
|
51176 | };
|
51177 | CsvSerializingSession.prototype.parse = function () {
|
51178 | return this.result;
|
51179 | };
|
51180 | CsvSerializingSession.prototype.beginNewLine = function () {
|
51181 | if (!this.isFirstLine) {
|
51182 | this.result += LINE_SEPARATOR$1;
|
51183 | }
|
51184 | this.isFirstLine = false;
|
51185 | };
|
51186 | return CsvSerializingSession;
|
51187 | }(BaseGridSerializingSession));
|
51188 |
|
51189 | var __extends$1 = (undefined && undefined.__extends) || (function () {
|
51190 | var extendStatics = function (d, b) {
|
51191 | extendStatics = Object.setPrototypeOf ||
|
51192 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
51193 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
51194 | return extendStatics(d, b);
|
51195 | };
|
51196 | return function (d, b) {
|
51197 | extendStatics(d, b);
|
51198 | function __() { this.constructor = d; }
|
51199 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
51200 | };
|
51201 | })();
|
51202 | var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
51203 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
51204 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
51205 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
51206 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
51207 | };
|
51208 | var CsvCreator = (function (_super) {
|
51209 | __extends$1(CsvCreator, _super);
|
51210 | function CsvCreator() {
|
51211 | return _super !== null && _super.apply(this, arguments) || this;
|
51212 | }
|
51213 | CsvCreator.prototype.postConstruct = function () {
|
51214 | this.setBeans({
|
51215 | gridSerializer: this.gridSerializer,
|
51216 | gridOptionsService: this.gridOptionsService
|
51217 | });
|
51218 | };
|
51219 | CsvCreator.prototype.getMergedParams = function (params) {
|
51220 | var baseParams = this.gridOptionsService.get('defaultCsvExportParams');
|
51221 | return Object.assign({}, baseParams, params);
|
51222 | };
|
51223 | CsvCreator.prototype.export = function (userParams) {
|
51224 | if (this.isExportSuppressed()) {
|
51225 | console.warn("AG Grid: Export cancelled. Export is not allowed as per your configuration.");
|
51226 | return '';
|
51227 | }
|
51228 | var mergedParams = this.getMergedParams(userParams);
|
51229 | var data = this.getData(mergedParams);
|
51230 | var packagedFile = new Blob(["\ufeff", data], { type: 'text/plain' });
|
51231 | Downloader.download(this.getFileName(mergedParams.fileName), packagedFile);
|
51232 | return data;
|
51233 | };
|
51234 | CsvCreator.prototype.exportDataAsCsv = function (params) {
|
51235 | return this.export(params);
|
51236 | };
|
51237 | CsvCreator.prototype.getDataAsCsv = function (params, skipDefaultParams) {
|
51238 | if (skipDefaultParams === void 0) { skipDefaultParams = false; }
|
51239 | var mergedParams = skipDefaultParams
|
51240 | ? Object.assign({}, params)
|
51241 | : this.getMergedParams(params);
|
51242 | return this.getData(mergedParams);
|
51243 | };
|
51244 | CsvCreator.prototype.getDefaultFileName = function () {
|
51245 | return 'export.csv';
|
51246 | };
|
51247 | CsvCreator.prototype.getDefaultFileExtension = function () {
|
51248 | return 'csv';
|
51249 | };
|
51250 | CsvCreator.prototype.createSerializingSession = function (params) {
|
51251 | var _a = this, columnModel = _a.columnModel, valueService = _a.valueService, gridOptionsService = _a.gridOptionsService;
|
51252 | var _b = params, processCellCallback = _b.processCellCallback, processHeaderCallback = _b.processHeaderCallback, processGroupHeaderCallback = _b.processGroupHeaderCallback, processRowGroupCallback = _b.processRowGroupCallback, suppressQuotes = _b.suppressQuotes, columnSeparator = _b.columnSeparator;
|
51253 | return new CsvSerializingSession({
|
51254 | columnModel: columnModel,
|
51255 | valueService: valueService,
|
51256 | gridOptionsService: gridOptionsService,
|
51257 | processCellCallback: processCellCallback || undefined,
|
51258 | processHeaderCallback: processHeaderCallback || undefined,
|
51259 | processGroupHeaderCallback: processGroupHeaderCallback || undefined,
|
51260 | processRowGroupCallback: processRowGroupCallback || undefined,
|
51261 | suppressQuotes: suppressQuotes || false,
|
51262 | columnSeparator: columnSeparator || ','
|
51263 | });
|
51264 | };
|
51265 | CsvCreator.prototype.isExportSuppressed = function () {
|
51266 | return this.gridOptionsService.is('suppressCsvExport');
|
51267 | };
|
51268 | __decorate$1([
|
51269 | Autowired('columnModel')
|
51270 | ], CsvCreator.prototype, "columnModel", void 0);
|
51271 | __decorate$1([
|
51272 | Autowired('valueService')
|
51273 | ], CsvCreator.prototype, "valueService", void 0);
|
51274 | __decorate$1([
|
51275 | Autowired('gridSerializer')
|
51276 | ], CsvCreator.prototype, "gridSerializer", void 0);
|
51277 | __decorate$1([
|
51278 | Autowired('gridOptionsService')
|
51279 | ], CsvCreator.prototype, "gridOptionsService", void 0);
|
51280 | __decorate$1([
|
51281 | PostConstruct
|
51282 | ], CsvCreator.prototype, "postConstruct", null);
|
51283 | CsvCreator = __decorate$1([
|
51284 | Bean('csvCreator')
|
51285 | ], CsvCreator);
|
51286 | return CsvCreator;
|
51287 | }(BaseCreator));
|
51288 |
|
51289 | var __extends = (undefined && undefined.__extends) || (function () {
|
51290 | var extendStatics = function (d, b) {
|
51291 | extendStatics = Object.setPrototypeOf ||
|
51292 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
51293 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
51294 | return extendStatics(d, b);
|
51295 | };
|
51296 | return function (d, b) {
|
51297 | extendStatics(d, b);
|
51298 | function __() { this.constructor = d; }
|
51299 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
51300 | };
|
51301 | })();
|
51302 | var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
51303 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
51304 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
51305 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
51306 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
51307 | };
|
51308 | var RowType;
|
51309 | (function (RowType) {
|
51310 | RowType[RowType["HEADER_GROUPING"] = 0] = "HEADER_GROUPING";
|
51311 | RowType[RowType["HEADER"] = 1] = "HEADER";
|
51312 | RowType[RowType["BODY"] = 2] = "BODY";
|
51313 | })(RowType || (RowType = {}));
|
51314 | var GridSerializer = (function (_super) {
|
51315 | __extends(GridSerializer, _super);
|
51316 | function GridSerializer() {
|
51317 | return _super !== null && _super.apply(this, arguments) || this;
|
51318 | }
|
51319 | GridSerializer.prototype.serialize = function (gridSerializingSession, params) {
|
51320 | if (params === void 0) { params = {}; }
|
51321 | var columnsToExport = this.getColumnsToExport(params.allColumns, params.columnKeys);
|
51322 | var serializeChain = _.compose(
|
51323 |
|
51324 | 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));
|
51325 | return serializeChain(gridSerializingSession).parse();
|
51326 | };
|
51327 | GridSerializer.prototype.processRow = function (gridSerializingSession, params, columnsToExport, node) {
|
51328 | var rowSkipper = params.shouldRowBeSkipped || (function () { return false; });
|
51329 | var context = this.gridOptionsService.context;
|
51330 | var api = this.gridOptionsService.api;
|
51331 | var columnApi = this.gridOptionsService.columnApi;
|
51332 | var skipSingleChildrenGroup = this.gridOptionsService.is('groupRemoveSingleChildren');
|
51333 | var skipLowestSingleChildrenGroup = this.gridOptionsService.is('groupRemoveLowestSingleChildren');
|
51334 |
|
51335 |
|
51336 | var isClipboardExport = params.rowPositions != null;
|
51337 | var isExplicitExportSelection = isClipboardExport || !!params.onlySelected;
|
51338 | var hideOpenParents = this.gridOptionsService.is('groupHideOpenParents') && !isExplicitExportSelection;
|
51339 | var isLeafNode = this.columnModel.isPivotMode() ? node.leafGroup : !node.group;
|
51340 | var skipRowGroups = params.skipGroups || params.skipRowGroups;
|
51341 | var shouldSkipLowestGroup = skipLowestSingleChildrenGroup && node.leafGroup;
|
51342 | var shouldSkipCurrentGroup = node.allChildrenCount === 1 && (skipSingleChildrenGroup || shouldSkipLowestGroup);
|
51343 | if (skipRowGroups && params.skipGroups) {
|
51344 | _.doOnce(function () { return console.warn('AG Grid: Since v25.2 `skipGroups` has been renamed to `skipRowGroups`.'); }, 'gridSerializer-skipGroups');
|
51345 | }
|
51346 | if ((!isLeafNode && (params.skipRowGroups || shouldSkipCurrentGroup || hideOpenParents)) ||
|
51347 | (params.onlySelected && !node.isSelected()) ||
|
51348 | (params.skipPinnedTop && node.rowPinned === 'top') ||
|
51349 | (params.skipPinnedBottom && node.rowPinned === 'bottom')) {
|
51350 | return;
|
51351 | }
|
51352 |
|
51353 |
|
51354 | var nodeIsRootNode = node.level === -1;
|
51355 | if (nodeIsRootNode && !node.leafGroup && !node.footer) {
|
51356 | return;
|
51357 | }
|
51358 | var shouldRowBeSkipped = rowSkipper({ node: node, api: api, columnApi: columnApi, context: context });
|
51359 | if (shouldRowBeSkipped) {
|
51360 | return;
|
51361 | }
|
51362 | var rowAccumulator = gridSerializingSession.onNewBodyRow();
|
51363 | columnsToExport.forEach(function (column, index) {
|
51364 | rowAccumulator.onColumn(column, index, node);
|
51365 | });
|
51366 | if (params.getCustomContentBelowRow) {
|
51367 | var content = params.getCustomContentBelowRow({ node: node, api: api, columnApi: columnApi, context: context });
|
51368 | if (content) {
|
51369 | gridSerializingSession.addCustomContent(content);
|
51370 | }
|
51371 | }
|
51372 | };
|
51373 | GridSerializer.prototype.appendContent = function (params) {
|
51374 | return function (gridSerializingSession) {
|
51375 | var appendContent = params.customFooter || params.appendContent;
|
51376 | if (appendContent) {
|
51377 | if (params.customFooter) {
|
51378 | _.doOnce(function () { return console.warn('AG Grid: Since version 25.2.0 the `customFooter` param has been deprecated. Use `appendContent` instead.'); }, 'gridSerializer-customFooter');
|
51379 | }
|
51380 | gridSerializingSession.addCustomContent(appendContent);
|
51381 | }
|
51382 | return gridSerializingSession;
|
51383 | };
|
51384 | };
|
51385 | GridSerializer.prototype.prependContent = function (params) {
|
51386 | return function (gridSerializingSession) {
|
51387 | var prependContent = params.customHeader || params.prependContent;
|
51388 | if (prependContent) {
|
51389 | if (params.customHeader) {
|
51390 | _.doOnce(function () { return console.warn('AG Grid: Since version 25.2.0 the `customHeader` param has been deprecated. Use `prependContent` instead.'); }, 'gridSerializer-customHeader');
|
51391 | }
|
51392 | gridSerializingSession.addCustomContent(prependContent);
|
51393 | }
|
51394 | return gridSerializingSession;
|
51395 | };
|
51396 | };
|
51397 | GridSerializer.prototype.prepareSession = function (columnsToExport) {
|
51398 | return function (gridSerializingSession) {
|
51399 | gridSerializingSession.prepare(columnsToExport);
|
51400 | return gridSerializingSession;
|
51401 | };
|
51402 | };
|
51403 | GridSerializer.prototype.exportColumnGroups = function (params, columnsToExport) {
|
51404 | var _this = this;
|
51405 | return function (gridSerializingSession) {
|
51406 | if (!params.skipColumnGroupHeaders) {
|
51407 | var groupInstanceIdCreator = new GroupInstanceIdCreator();
|
51408 | var displayedGroups = _this.displayedGroupCreator.createDisplayedGroups(columnsToExport, _this.columnModel.getGridBalancedTree(), groupInstanceIdCreator, null);
|
51409 | _this.recursivelyAddHeaderGroups(displayedGroups, gridSerializingSession, params.processGroupHeaderCallback);
|
51410 | }
|
51411 | else if (params.columnGroups) {
|
51412 | _.doOnce(function () { return console.warn('AG Grid: Since v25.2 the `columnGroups` param has deprecated, and groups are exported by default.'); }, 'gridSerializer-columnGroups');
|
51413 | }
|
51414 | return gridSerializingSession;
|
51415 | };
|
51416 | };
|
51417 | GridSerializer.prototype.exportHeaders = function (params, columnsToExport) {
|
51418 | return function (gridSerializingSession) {
|
51419 | if (!params.skipHeader && !params.skipColumnHeaders) {
|
51420 | var gridRowIterator_1 = gridSerializingSession.onNewHeaderRow();
|
51421 | columnsToExport.forEach(function (column, index) {
|
51422 | gridRowIterator_1.onColumn(column, index, undefined);
|
51423 | });
|
51424 | }
|
51425 | else if (params.skipHeader) {
|
51426 | _.doOnce(function () { return console.warn('AG Grid: Since v25.2 the `skipHeader` param has been renamed to `skipColumnHeaders`.'); }, 'gridSerializer-skipHeader');
|
51427 | }
|
51428 | return gridSerializingSession;
|
51429 | };
|
51430 | };
|
51431 | GridSerializer.prototype.processPinnedTopRows = function (params, columnsToExport) {
|
51432 | var _this = this;
|
51433 | return function (gridSerializingSession) {
|
51434 | var processRow = _this.processRow.bind(_this, gridSerializingSession, params, columnsToExport);
|
51435 | if (params.rowPositions) {
|
51436 | params.rowPositions
|
51437 |
|
51438 | .filter(function (position) { return position.rowPinned === 'top'; })
|
51439 | .sort(function (a, b) { return a.rowIndex - b.rowIndex; })
|
51440 | .map(function (position) { return _this.pinnedRowModel.getPinnedTopRow(position.rowIndex); })
|
51441 | .forEach(processRow);
|
51442 | }
|
51443 | else {
|
51444 | _this.pinnedRowModel.forEachPinnedTopRow(processRow);
|
51445 | }
|
51446 | return gridSerializingSession;
|
51447 | };
|
51448 | };
|
51449 | GridSerializer.prototype.processRows = function (params, columnsToExport) {
|
51450 | var _this = this;
|
51451 | return function (gridSerializingSession) {
|
51452 |
|
51453 | var rowModel = _this.rowModel;
|
51454 | var rowModelType = rowModel.getType();
|
51455 | var usingCsrm = rowModelType === 'clientSide';
|
51456 | var usingSsrm = rowModelType === 'serverSide';
|
51457 | var onlySelectedNonStandardModel = !usingCsrm && params.onlySelected;
|
51458 | var processRow = _this.processRow.bind(_this, gridSerializingSession, params, columnsToExport);
|
51459 | var _a = params.exportedRows, exportedRows = _a === void 0 ? 'filteredAndSorted' : _a;
|
51460 | if (params.rowPositions) {
|
51461 | params.rowPositions
|
51462 |
|
51463 | .filter(function (position) { return position.rowPinned == null; })
|
51464 | .sort(function (a, b) { return a.rowIndex - b.rowIndex; })
|
51465 | .map(function (position) { return rowModel.getRow(position.rowIndex); })
|
51466 | .forEach(processRow);
|
51467 | }
|
51468 | else if (_this.columnModel.isPivotMode()) {
|
51469 | if (usingCsrm) {
|
51470 | rowModel.forEachPivotNode(processRow, true);
|
51471 | }
|
51472 | else {
|
51473 |
|
51474 | rowModel.forEachNode(processRow);
|
51475 | }
|
51476 | }
|
51477 | else {
|
51478 |
|
51479 |
|
51480 |
|
51481 |
|
51482 |
|
51483 | if (params.onlySelectedAllPages || onlySelectedNonStandardModel) {
|
51484 | var selectedNodes = _this.selectionService.getSelectedNodes();
|
51485 | _this.replicateSortedOrder(selectedNodes);
|
51486 |
|
51487 | selectedNodes.forEach(processRow);
|
51488 | }
|
51489 | else {
|
51490 |
|
51491 |
|
51492 |
|
51493 | if (exportedRows === 'all') {
|
51494 | rowModel.forEachNode(processRow);
|
51495 | }
|
51496 | else if (usingCsrm) {
|
51497 | rowModel.forEachNodeAfterFilterAndSort(processRow, true);
|
51498 | }
|
51499 | else if (usingSsrm) {
|
51500 | rowModel.forEachNodeAfterFilterAndSort(processRow);
|
51501 | }
|
51502 | else {
|
51503 | rowModel.forEachNode(processRow);
|
51504 | }
|
51505 | }
|
51506 | }
|
51507 | return gridSerializingSession;
|
51508 | };
|
51509 | };
|
51510 | GridSerializer.prototype.replicateSortedOrder = function (rows) {
|
51511 | var _this = this;
|
51512 | var sortOptions = this.sortController.getSortOptions();
|
51513 | var compareNodes = function (rowA, rowB) {
|
51514 | var _a, _b, _c, _d;
|
51515 | if (rowA.rowIndex != null && rowB.rowIndex != null) {
|
51516 |
|
51517 |
|
51518 | return rowA.rowIndex - rowB.rowIndex;
|
51519 | }
|
51520 |
|
51521 | if (rowA.level === rowB.level) {
|
51522 | if (((_a = rowA.parent) === null || _a === void 0 ? void 0 : _a.id) === ((_b = rowB.parent) === null || _b === void 0 ? void 0 : _b.id)) {
|
51523 | return _this.rowNodeSorter.compareRowNodes(sortOptions, {
|
51524 | rowNode: rowA,
|
51525 | currentPos: (_c = rowA.rowIndex) !== null && _c !== void 0 ? _c : -1,
|
51526 | }, {
|
51527 | rowNode: rowB,
|
51528 | currentPos: (_d = rowB.rowIndex) !== null && _d !== void 0 ? _d : -1,
|
51529 | });
|
51530 | }
|
51531 |
|
51532 | return compareNodes(rowA.parent, rowB.parent);
|
51533 | }
|
51534 |
|
51535 | if (rowA.level > rowB.level) {
|
51536 | return compareNodes(rowA.parent, rowB);
|
51537 | }
|
51538 | return compareNodes(rowA, rowB.parent);
|
51539 | };
|
51540 |
|
51541 | rows.sort(compareNodes);
|
51542 | };
|
51543 | GridSerializer.prototype.processPinnedBottomRows = function (params, columnsToExport) {
|
51544 | var _this = this;
|
51545 | return function (gridSerializingSession) {
|
51546 | var processRow = _this.processRow.bind(_this, gridSerializingSession, params, columnsToExport);
|
51547 | if (params.rowPositions) {
|
51548 | params.rowPositions
|
51549 |
|
51550 | .filter(function (position) { return position.rowPinned === 'bottom'; })
|
51551 | .sort(function (a, b) { return a.rowIndex - b.rowIndex; })
|
51552 | .map(function (position) { return _this.pinnedRowModel.getPinnedBottomRow(position.rowIndex); })
|
51553 | .forEach(processRow);
|
51554 | }
|
51555 | else {
|
51556 | _this.pinnedRowModel.forEachPinnedBottomRow(processRow);
|
51557 | }
|
51558 | return gridSerializingSession;
|
51559 | };
|
51560 | };
|
51561 | GridSerializer.prototype.getColumnsToExport = function (allColumns, columnKeys) {
|
51562 | if (allColumns === void 0) { allColumns = false; }
|
51563 | var isPivotMode = this.columnModel.isPivotMode();
|
51564 | if (columnKeys && columnKeys.length) {
|
51565 | return this.columnModel.getGridColumns(columnKeys);
|
51566 | }
|
51567 | if (allColumns && !isPivotMode) {
|
51568 |
|
51569 | var columns = this.gridOptionsService.isTreeData()
|
51570 | ? this.columnModel.getGridColumns([GROUP_AUTO_COLUMN_ID])
|
51571 | : [];
|
51572 | return columns.concat(this.columnModel.getAllPrimaryColumns() || []);
|
51573 | }
|
51574 | return this.columnModel.getAllDisplayedColumns();
|
51575 | };
|
51576 | GridSerializer.prototype.recursivelyAddHeaderGroups = function (displayedGroups, gridSerializingSession, processGroupHeaderCallback) {
|
51577 | var directChildrenHeaderGroups = [];
|
51578 | displayedGroups.forEach(function (columnGroupChild) {
|
51579 | var columnGroup = columnGroupChild;
|
51580 | if (!columnGroup.getChildren) {
|
51581 | return;
|
51582 | }
|
51583 | columnGroup.getChildren().forEach(function (it) { return directChildrenHeaderGroups.push(it); });
|
51584 | });
|
51585 | if (displayedGroups.length > 0 && displayedGroups[0] instanceof ColumnGroup) {
|
51586 | this.doAddHeaderHeader(gridSerializingSession, displayedGroups, processGroupHeaderCallback);
|
51587 | }
|
51588 | if (directChildrenHeaderGroups && directChildrenHeaderGroups.length > 0) {
|
51589 | this.recursivelyAddHeaderGroups(directChildrenHeaderGroups, gridSerializingSession, processGroupHeaderCallback);
|
51590 | }
|
51591 | };
|
51592 | GridSerializer.prototype.doAddHeaderHeader = function (gridSerializingSession, displayedGroups, processGroupHeaderCallback) {
|
51593 | var _this = this;
|
51594 | var gridRowIterator = gridSerializingSession.onNewHeaderGroupingRow();
|
51595 | var columnIndex = 0;
|
51596 | displayedGroups.forEach(function (columnGroupChild) {
|
51597 | var columnGroup = columnGroupChild;
|
51598 | var name;
|
51599 | if (processGroupHeaderCallback) {
|
51600 | name = processGroupHeaderCallback({
|
51601 | columnGroup: columnGroup,
|
51602 | api: _this.gridOptionsService.api,
|
51603 | columnApi: _this.gridOptionsService.columnApi,
|
51604 | context: _this.gridOptionsService.context
|
51605 | });
|
51606 | }
|
51607 | else {
|
51608 | name = _this.columnModel.getDisplayNameForColumnGroup(columnGroup, 'header');
|
51609 | }
|
51610 | var collapsibleGroupRanges = columnGroup.getLeafColumns().reduce(function (collapsibleGroups, currentColumn, currentIdx, arr) {
|
51611 | var lastGroup = _.last(collapsibleGroups);
|
51612 | var groupShow = currentColumn.getColumnGroupShow() === 'open';
|
51613 | if (!groupShow) {
|
51614 | if (lastGroup && lastGroup[1] == null) {
|
51615 | lastGroup[1] = currentIdx - 1;
|
51616 | }
|
51617 | }
|
51618 | else if (!lastGroup || lastGroup[1] != null) {
|
51619 | lastGroup = [currentIdx];
|
51620 | collapsibleGroups.push(lastGroup);
|
51621 | }
|
51622 | if (currentIdx === arr.length - 1 && lastGroup && lastGroup[1] == null) {
|
51623 | lastGroup[1] = currentIdx;
|
51624 | }
|
51625 | return collapsibleGroups;
|
51626 | }, []);
|
51627 | gridRowIterator.onColumn(columnGroup, name || '', columnIndex++, columnGroup.getLeafColumns().length - 1, collapsibleGroupRanges);
|
51628 | });
|
51629 | };
|
51630 | __decorate([
|
51631 | Autowired('displayedGroupCreator')
|
51632 | ], GridSerializer.prototype, "displayedGroupCreator", void 0);
|
51633 | __decorate([
|
51634 | Autowired('columnModel')
|
51635 | ], GridSerializer.prototype, "columnModel", void 0);
|
51636 | __decorate([
|
51637 | Autowired('rowModel')
|
51638 | ], GridSerializer.prototype, "rowModel", void 0);
|
51639 | __decorate([
|
51640 | Autowired('pinnedRowModel')
|
51641 | ], GridSerializer.prototype, "pinnedRowModel", void 0);
|
51642 | __decorate([
|
51643 | Autowired('selectionService')
|
51644 | ], GridSerializer.prototype, "selectionService", void 0);
|
51645 | __decorate([
|
51646 | Autowired('rowNodeSorter')
|
51647 | ], GridSerializer.prototype, "rowNodeSorter", void 0);
|
51648 | __decorate([
|
51649 | Autowired('sortController')
|
51650 | ], GridSerializer.prototype, "sortController", void 0);
|
51651 | GridSerializer = __decorate([
|
51652 | Bean("gridSerializer")
|
51653 | ], GridSerializer);
|
51654 | return GridSerializer;
|
51655 | }(BeanStub));
|
51656 |
|
51657 |
|
51658 | var VERSION = '29.2.0';
|
51659 |
|
51660 | var CsvExportModule = {
|
51661 | version: VERSION,
|
51662 | moduleName: ModuleNames.CsvExportModule,
|
51663 | beans: [CsvCreator, GridSerializer]
|
51664 | };
|
51665 |
|
51666 | var LINE_SEPARATOR = '\r\n';
|
51667 | var XmlFactory = (function () {
|
51668 | function XmlFactory() {
|
51669 | }
|
51670 | XmlFactory.createHeader = function (headerElement) {
|
51671 | if (headerElement === void 0) { headerElement = {}; }
|
51672 | var headerStart = '<?';
|
51673 | var headerEnd = '?>';
|
51674 | var keys = ['version'];
|
51675 | if (!headerElement.version) {
|
51676 | headerElement.version = "1.0";
|
51677 | }
|
51678 | if (headerElement.encoding) {
|
51679 | keys.push('encoding');
|
51680 | }
|
51681 | if (headerElement.standalone) {
|
51682 | keys.push('standalone');
|
51683 | }
|
51684 | var att = keys.map(function (key) { return key + "=\"" + headerElement[key] + "\""; }).join(' ');
|
51685 | return headerStart + "xml " + att + " " + headerEnd;
|
51686 | };
|
51687 | XmlFactory.createXml = function (xmlElement, booleanTransformer) {
|
51688 | var _this = this;
|
51689 | var props = '';
|
51690 | if (xmlElement.properties) {
|
51691 | if (xmlElement.properties.prefixedAttributes) {
|
51692 | xmlElement.properties.prefixedAttributes.forEach(function (prefixedSet) {
|
51693 | Object.keys(prefixedSet.map).forEach(function (key) {
|
51694 | props += _this.returnAttributeIfPopulated(prefixedSet.prefix + key, prefixedSet.map[key], booleanTransformer);
|
51695 | });
|
51696 | });
|
51697 | }
|
51698 | if (xmlElement.properties.rawMap) {
|
51699 | Object.keys(xmlElement.properties.rawMap).forEach(function (key) {
|
51700 | props += _this.returnAttributeIfPopulated(key, xmlElement.properties.rawMap[key], booleanTransformer);
|
51701 | });
|
51702 | }
|
51703 | }
|
51704 | var result = '<' + xmlElement.name + props;
|
51705 | if (!xmlElement.children && xmlElement.textNode == null) {
|
51706 | return result + '/>' + LINE_SEPARATOR;
|
51707 | }
|
51708 | if (xmlElement.textNode != null) {
|
51709 | return result + '>' + xmlElement.textNode + '</' + xmlElement.name + '>' + LINE_SEPARATOR;
|
51710 | }
|
51711 | result += '>' + LINE_SEPARATOR;
|
51712 | if (xmlElement.children) {
|
51713 | xmlElement.children.forEach(function (it) {
|
51714 | result += _this.createXml(it, booleanTransformer);
|
51715 | });
|
51716 | }
|
51717 | return result + '</' + xmlElement.name + '>' + LINE_SEPARATOR;
|
51718 | };
|
51719 | XmlFactory.returnAttributeIfPopulated = function (key, value, booleanTransformer) {
|
51720 | if (!value && value !== '' && value !== 0) {
|
51721 | return '';
|
51722 | }
|
51723 | var xmlValue = value;
|
51724 | if ((typeof (value) === 'boolean')) {
|
51725 | if (booleanTransformer) {
|
51726 | xmlValue = booleanTransformer(value);
|
51727 | }
|
51728 | }
|
51729 | return " " + key + "=\"" + xmlValue + "\"";
|
51730 | };
|
51731 | return XmlFactory;
|
51732 | }());
|
51733 |
|
51734 | var __values = (undefined && undefined.__values) || function(o) {
|
51735 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
51736 | if (m) return m.call(o);
|
51737 | if (o && typeof o.length === "number") return {
|
51738 | next: function () {
|
51739 | if (o && i >= o.length) o = void 0;
|
51740 | return { value: o && o[i++], done: !o };
|
51741 | }
|
51742 | };
|
51743 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
51744 | };
|
51745 |
|
51746 |
|
51747 | var crcTable = new Uint32Array([
|
51748 | 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
51749 | 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
51750 | 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
|
51751 | 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
51752 | 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
51753 | 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
|
51754 | 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
|
51755 | 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
51756 | 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
|
51757 | 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
51758 | 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
|
51759 | 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
51760 | 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
|
51761 | 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
|
51762 | 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
51763 | 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
51764 | 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
|
51765 | 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
|
51766 | 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
|
51767 | 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
51768 | 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
|
51769 | 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
|
51770 | 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
|
51771 | 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
51772 | 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
51773 | 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
|
51774 | 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
|
51775 | 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
51776 | 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
|
51777 | 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
51778 | 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
|
51779 | 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
51780 | 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
|
51781 | 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
|
51782 | 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
51783 | 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
51784 | 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
|
51785 | 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
|
51786 | 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
|
51787 | 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
51788 | 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
|
51789 | 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
51790 | 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
51791 | ]);
|
51792 | var ZipContainer = (function () {
|
51793 | function ZipContainer() {
|
51794 | }
|
51795 | ZipContainer.addFolders = function (paths) {
|
51796 | paths.forEach(this.addFolder.bind(this));
|
51797 | };
|
51798 | ZipContainer.addFolder = function (path) {
|
51799 | this.folders.push({
|
51800 | path: path,
|
51801 | created: new Date(),
|
51802 | isBase64: false
|
51803 | });
|
51804 | };
|
51805 | ZipContainer.addFile = function (path, content, isBase64) {
|
51806 | if (isBase64 === void 0) { isBase64 = false; }
|
51807 | this.files.push({
|
51808 | path: path,
|
51809 | created: new Date(),
|
51810 | content: content,
|
51811 | isBase64: isBase64
|
51812 | });
|
51813 | };
|
51814 | ZipContainer.getContent = function (mimeType) {
|
51815 | if (mimeType === void 0) { mimeType = 'application/zip'; }
|
51816 | var textOutput = this.buildFileStream();
|
51817 | var uInt8Output = this.buildUint8Array(textOutput);
|
51818 | this.clearStream();
|
51819 | return new Blob([uInt8Output], { type: mimeType });
|
51820 | };
|
51821 | ZipContainer.clearStream = function () {
|
51822 | this.folders = [];
|
51823 | this.files = [];
|
51824 | };
|
51825 | ZipContainer.buildFileStream = function (fData) {
|
51826 | var e_1, _a;
|
51827 | if (fData === void 0) { fData = ''; }
|
51828 | var totalFiles = this.folders.concat(this.files);
|
51829 | var len = totalFiles.length;
|
51830 | var foData = '';
|
51831 | var lL = 0;
|
51832 | var cL = 0;
|
51833 | try {
|
51834 | for (var totalFiles_1 = __values(totalFiles), totalFiles_1_1 = totalFiles_1.next(); !totalFiles_1_1.done; totalFiles_1_1 = totalFiles_1.next()) {
|
51835 | var currentFile = totalFiles_1_1.value;
|
51836 | var _b = this.getHeader(currentFile, lL), fileHeader = _b.fileHeader, folderHeader = _b.folderHeader, content = _b.content;
|
51837 | lL += fileHeader.length + content.length;
|
51838 | cL += folderHeader.length;
|
51839 | fData += fileHeader + content;
|
51840 | foData += folderHeader;
|
51841 | }
|
51842 | }
|
51843 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
51844 | finally {
|
51845 | try {
|
51846 | if (totalFiles_1_1 && !totalFiles_1_1.done && (_a = totalFiles_1.return)) _a.call(totalFiles_1);
|
51847 | }
|
51848 | finally { if (e_1) throw e_1.error; }
|
51849 | }
|
51850 | var foEnd = this.buildFolderEnd(len, cL, lL);
|
51851 | return fData + foData + foEnd;
|
51852 | };
|
51853 | ZipContainer.getHeader = function (currentFile, offset) {
|
51854 | var content = currentFile.content, path = currentFile.path, created = currentFile.created, isBase64 = currentFile.isBase64;
|
51855 | var utf8_encode = _.utf8_encode, decToHex = _.decToHex;
|
51856 | var utfPath = utf8_encode(path);
|
51857 | var isUTF8 = utfPath !== path;
|
51858 | var time = this.convertTime(created);
|
51859 | var dt = this.convertDate(created);
|
51860 | var extraFields = '';
|
51861 | if (isUTF8) {
|
51862 | var uExtraFieldPath = decToHex(1, 1) + decToHex(this.getFromCrc32Table(utfPath), 4) + utfPath;
|
51863 | extraFields = "\x75\x70" + decToHex(uExtraFieldPath.length, 2) + uExtraFieldPath;
|
51864 | }
|
51865 | var _a = !content ? { size: 0, content: '' } : this.getConvertedContent(content, isBase64), size = _a.size, convertedContent = _a.content;
|
51866 | var header = '\x0A\x00' +
|
51867 | (isUTF8 ? '\x00\x08' : '\x00\x00') +
|
51868 | '\x00\x00' +
|
51869 | decToHex(time, 2) +
|
51870 | decToHex(dt, 2) +
|
51871 | decToHex(size ? this.getFromCrc32Table(convertedContent) : 0, 4) +
|
51872 | decToHex(size, 4) +
|
51873 | decToHex(size, 4) +
|
51874 | decToHex(utfPath.length, 2) +
|
51875 | decToHex(extraFields.length, 2);
|
51876 | var fileHeader = 'PK\x03\x04' + header + utfPath + extraFields;
|
51877 | var folderHeader = 'PK\x01\x02' +
|
51878 | '\x14\x00' +
|
51879 | header +
|
51880 | '\x00\x00' +
|
51881 | '\x00\x00' +
|
51882 | '\x00\x00' +
|
51883 | (content ? '\x00\x00\x00\x00' : '\x10\x00\x00\x00') +
|
51884 | decToHex(offset, 4) +
|
51885 | utfPath +
|
51886 | extraFields;
|
51887 | return { fileHeader: fileHeader, folderHeader: folderHeader, content: convertedContent || '' };
|
51888 | };
|
51889 | ZipContainer.getConvertedContent = function (content, isBase64) {
|
51890 | if (isBase64 === void 0) { isBase64 = false; }
|
51891 | if (isBase64) {
|
51892 | content = content.split(';base64,')[1];
|
51893 | }
|
51894 | content = isBase64 ? atob(content) : content;
|
51895 | return {
|
51896 | size: content.length,
|
51897 | content: content
|
51898 | };
|
51899 | };
|
51900 | ZipContainer.buildFolderEnd = function (tLen, cLen, lLen) {
|
51901 | var decToHex = _.decToHex;
|
51902 | return 'PK\x05\x06' +
|
51903 | '\x00\x00' +
|
51904 | '\x00\x00' +
|
51905 | decToHex(tLen, 2) +
|
51906 | decToHex(tLen, 2) +
|
51907 | decToHex(cLen, 4) +
|
51908 | decToHex(lLen, 4) +
|
51909 | '\x00\x00';
|
51910 | };
|
51911 | ZipContainer.buildUint8Array = function (content) {
|
51912 | var uint8 = new Uint8Array(content.length);
|
51913 | for (var i = 0; i < uint8.length; i++) {
|
51914 | uint8[i] = content.charCodeAt(i);
|
51915 | }
|
51916 | return uint8;
|
51917 | };
|
51918 | ZipContainer.getFromCrc32Table = function (content) {
|
51919 | if (!content.length) {
|
51920 | return 0;
|
51921 | }
|
51922 | var size = content.length;
|
51923 | var iterable = new Uint8Array(size);
|
51924 | for (var i = 0; i < size; i++) {
|
51925 | iterable[i] = content.charCodeAt(i);
|
51926 | }
|
51927 | var crc = 0 ^ (-1);
|
51928 | var j = 0;
|
51929 | var k = 0;
|
51930 | var l = 0;
|
51931 | for (var i = 0; i < size; i++) {
|
51932 | j = iterable[i];
|
51933 | k = (crc ^ j) & 0xFF;
|
51934 | l = crcTable[k];
|
51935 | crc = (crc >>> 8) ^ l;
|
51936 | }
|
51937 | return crc ^ (-1);
|
51938 | };
|
51939 | ZipContainer.convertTime = function (date) {
|
51940 | var time = date.getHours();
|
51941 | time <<= 6;
|
51942 | time = time | date.getMinutes();
|
51943 | time <<= 5;
|
51944 | time = time | date.getSeconds() / 2;
|
51945 | return time;
|
51946 | };
|
51947 | ZipContainer.convertDate = function (date) {
|
51948 | var dt = date.getFullYear() - 1980;
|
51949 | dt <<= 4;
|
51950 | dt = dt | (date.getMonth() + 1);
|
51951 | dt <<= 5;
|
51952 | dt = dt | date.getDate();
|
51953 | return dt;
|
51954 | };
|
51955 | ZipContainer.folders = [];
|
51956 | ZipContainer.files = [];
|
51957 | return ZipContainer;
|
51958 | }());
|
51959 |
|
51960 | var AllCommunityModules = [ClientSideRowModelModule, InfiniteRowModelModule, CsvExportModule];
|
51961 |
|
51962 | export { AbstractHeaderCellCtrl, AgAbstractField, AgAbstractLabel, AgCheckbox, AgDialog, AgGroupComponent, AgInputNumberField, AgInputRange, AgInputTextArea, AgInputTextField, AgMenuItemComponent, AgMenuList, AgMenuPanel, AgPanel, AgPickerField, AgPromise, AgPromiseStatus, AgRadioButton, AgSelect, AgSlider, AgStackComponentsRegistry, AgToggleButton, AlignedGridsService, AllCommunityModules, AnimateShowChangeCellRenderer, AnimateSlideCellRenderer, AnimationFrameService, AutoScrollService, AutoWidthCalculator, Autowired, BarColumnLabelPlacement, BaseComponentWrapper, BaseCreator, BaseGridSerializingSession, Bean, BeanStub, Beans, BodyDropPivotTarget, BodyDropTarget, CHART_TOOLBAR_ALLOW_LIST, CHART_TOOL_PANEL_ALLOW_LIST, CHART_TOOL_PANEL_MENU_OPTIONS, CellComp, CellCtrl, CellNavigationService, CellPositionUtils, CellRangeType, ChangedPath, CheckboxSelectionComponent, ClientSideRowModelModule, ClientSideRowModelSteps, ColDefUtil, Column, ColumnApi, ColumnFactory, ColumnGroup, ColumnKeyCreator, ColumnModel, ColumnUtils, Component, ComponentUtil, Context, CssClassApplier, CssClassManager, CsvCreator, CsvExportModule, CtrlsService, CustomTooltipFeature, DEFAULT_CHART_GROUPS, DateFilter, DisplayedGroupCreator, Downloader, DragAndDropService, DragService, DragSourceType, Environment, EventService, Events, ExcelFactoryMode, ExpressionService, FilterManager, FloatingFilterMapper, FocusService, GROUP_AUTO_COLUMN_ID, Grid, GridApi, GridBodyComp, GridBodyCtrl, GridComp, GridCoreCreator, GridCtrl, GridHeaderComp, GridHeaderCtrl, GridOptionsService, GridSerializer, GroupCellRenderer, GroupCellRendererCtrl, GroupInstanceIdCreator, HeaderCellCtrl, HeaderFilterCellComp, HeaderFilterCellCtrl, HeaderGroupCellCtrl, HeaderNavigationDirection, HeaderNavigationService, HeaderPositionUtils, HeaderRowComp, HeaderRowContainerComp, HeaderRowContainerCtrl, HeaderRowCtrl, HeaderRowType, HorizontalDirection, HorizontalResizeService, InfiniteRowModelModule, KeyCode, LargeTextCellEditor, LayoutCssClasses, LocaleService, Logger, LoggerFactory, ManagedFocusFeature, ModuleNames, ModuleRegistry, MouseEventService, MoveColumnFeature, NavigationService, NumberFilter, NumberSequence, Optional, PaginationProxy, PinnedRowModel, PopupComponent, PopupEditorWrapper, PopupService, 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, ScalarFilter, ScrollVisibleService, SelectCellEditor, SelectableService, SelectionHandleType, ServerSideTransactionResultStatus, SetLeftFeature, SimpleFilter, SortController, SortIndicatorComp, StandardMenuFactory, StylingService, TabGuardClassNames, TabGuardComp, TabGuardCtrl, TabbedLayout, TemplateService, TextCellEditor, TextFilter, TextFloatingFilter, Timer, TouchListener, UserComponentFactory, UserComponentRegistry, ValueCache, ValueFormatterService, ValueService, VanillaFrameworkOverrides, VerticalDirection, VirtualList, XmlFactory, ZipContainer, _, __FORCE_MODULE_DETECTION, getRowContainerTypeForName, simpleHttpRequest };
|