// ag-grid-community v21.2.1
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["agGrid"] = factory();
else
root["agGrid"] = factory();
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
// same as main.js, except also includes the styles, so webpack includes the css in the bundle
var agGrid = __webpack_require__(1);
Object.keys(agGrid).forEach(function(key) {
exports[key] = agGrid[key];
});
__webpack_require__(187);
__webpack_require__(192);
__webpack_require__(194);
__webpack_require__(196);
__webpack_require__(198);
__webpack_require__(200);
__webpack_require__(202);
__webpack_require__(204);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var globalObj = typeof global === 'undefined' ? {} : global;
globalObj.HTMLElement = typeof HTMLElement === 'undefined' ? {} : HTMLElement;
globalObj.HTMLButtonElement = typeof HTMLButtonElement === 'undefined' ? {} : HTMLButtonElement;
globalObj.HTMLSelectElement = typeof HTMLSelectElement === 'undefined' ? {} : HTMLSelectElement;
globalObj.HTMLInputElement = typeof HTMLInputElement === 'undefined' ? {} : HTMLInputElement;
globalObj.Node = typeof Node === 'undefined' ? {} : Node;
globalObj.MouseEvent = typeof MouseEvent === 'undefined' ? {} : MouseEvent;
// columnController
var columnFactory_1 = __webpack_require__(3);
exports.ColumnFactory = columnFactory_1.ColumnFactory;
var columnController_1 = __webpack_require__(21);
exports.ColumnController = columnController_1.ColumnController;
var columnKeyCreator_1 = __webpack_require__(122);
exports.ColumnKeyCreator = columnKeyCreator_1.ColumnKeyCreator;
var columnUtils_1 = __webpack_require__(24);
exports.ColumnUtils = columnUtils_1.ColumnUtils;
var displayedGroupCreator_1 = __webpack_require__(28);
exports.DisplayedGroupCreator = displayedGroupCreator_1.DisplayedGroupCreator;
var groupInstanceIdCreator_1 = __webpack_require__(114);
exports.GroupInstanceIdCreator = groupInstanceIdCreator_1.GroupInstanceIdCreator;
// components
var componentUtil_1 = __webpack_require__(14);
exports.ComponentUtil = componentUtil_1.ComponentUtil;
var colDefUtil_1 = __webpack_require__(119);
exports.ColDefUtil = colDefUtil_1.ColDefUtil;
var userComponentRegistry_1 = __webpack_require__(61);
exports.UserComponentRegistry = userComponentRegistry_1.UserComponentRegistry;
var userComponentFactory_1 = __webpack_require__(60);
exports.UserComponentFactory = userComponentFactory_1.UserComponentFactory;
var agGridNg1_1 = __webpack_require__(124);
exports.initialiseAgGridWithAngular1 = agGridNg1_1.initialiseAgGridWithAngular1;
var agGridWebComponent_1 = __webpack_require__(179);
exports.initialiseAgGridWithWebComponents = agGridWebComponent_1.initialiseAgGridWithWebComponents;
// context
var beanStub_1 = __webpack_require__(34);
exports.BeanStub = beanStub_1.BeanStub;
var context_1 = __webpack_require__(13);
exports.Context = context_1.Context;
exports.Autowired = context_1.Autowired;
exports.PostConstruct = context_1.PostConstruct;
exports.PreConstruct = context_1.PreConstruct;
exports.Optional = context_1.Optional;
exports.Bean = context_1.Bean;
exports.Qualifier = context_1.Qualifier;
exports.PreDestroy = context_1.PreDestroy;
var componentAnnotations_1 = __webpack_require__(64);
exports.QuerySelector = componentAnnotations_1.QuerySelector;
exports.Listener = componentAnnotations_1.Listener;
exports.RefSelector = componentAnnotations_1.RefSelector;
// dragAndDrop
var dragAndDropService_1 = __webpack_require__(43);
exports.DragAndDropService = dragAndDropService_1.DragAndDropService;
exports.DragSourceType = dragAndDropService_1.DragSourceType;
exports.HDirection = dragAndDropService_1.HDirection;
exports.VDirection = dragAndDropService_1.VDirection;
var dragService_1 = __webpack_require__(44);
exports.DragService = dragService_1.DragService;
// entities
var column_1 = __webpack_require__(23);
exports.Column = column_1.Column;
var columnGroup_1 = __webpack_require__(22);
exports.ColumnGroup = columnGroup_1.ColumnGroup;
var originalColumnGroup_1 = __webpack_require__(25);
exports.OriginalColumnGroup = originalColumnGroup_1.OriginalColumnGroup;
var rowNode_1 = __webpack_require__(36);
exports.RowNode = rowNode_1.RowNode;
// filter
var filterManager_1 = __webpack_require__(58);
exports.FilterManager = filterManager_1.FilterManager;
var providedFilter_1 = __webpack_require__(68);
exports.ProvidedFilter = providedFilter_1.ProvidedFilter;
var simpleFilter_1 = __webpack_require__(66);
exports.SimpleFilter = simpleFilter_1.SimpleFilter;
var scalerFilter_1 = __webpack_require__(69);
exports.ScalerFilter = scalerFilter_1.ScalerFilter;
var numberFilter_1 = __webpack_require__(83);
exports.NumberFilter = numberFilter_1.NumberFilter;
var textFilter_1 = __webpack_require__(90);
exports.TextFilter = textFilter_1.TextFilter;
var dateFilter_1 = __webpack_require__(63);
exports.DateFilter = dateFilter_1.DateFilter;
// gridPanel
var gridPanel_1 = __webpack_require__(136);
exports.GridPanel = gridPanel_1.GridPanel;
var scrollVisibleService_1 = __webpack_require__(135);
exports.ScrollVisibleService = scrollVisibleService_1.ScrollVisibleService;
var mouseEventService_1 = __webpack_require__(76);
exports.MouseEventService = mouseEventService_1.MouseEventService;
// headerRendering
var bodyDropPivotTarget_1 = __webpack_require__(134);
exports.BodyDropPivotTarget = bodyDropPivotTarget_1.BodyDropPivotTarget;
var bodyDropTarget_1 = __webpack_require__(132);
exports.BodyDropTarget = bodyDropTarget_1.BodyDropTarget;
var cssClassApplier_1 = __webpack_require__(106);
exports.CssClassApplier = cssClassApplier_1.CssClassApplier;
var headerContainer_1 = __webpack_require__(127);
exports.HeaderContainer = headerContainer_1.HeaderContainer;
var headerRootComp_1 = __webpack_require__(126);
exports.HeaderRootComp = headerRootComp_1.HeaderRootComp;
var headerRowComp_1 = __webpack_require__(128);
exports.HeaderRowComp = headerRowComp_1.HeaderRowComp;
var horizontalResizeService_1 = __webpack_require__(105);
exports.HorizontalResizeService = horizontalResizeService_1.HorizontalResizeService;
var moveColumnController_1 = __webpack_require__(133);
exports.MoveColumnController = moveColumnController_1.MoveColumnController;
var standardMenu_1 = __webpack_require__(144);
exports.StandardMenuFactory = standardMenu_1.StandardMenuFactory;
// layout
var tabbedLayout_1 = __webpack_require__(180);
exports.TabbedLayout = tabbedLayout_1.TabbedLayout;
var verticalStack_1 = __webpack_require__(181);
exports.VerticalStack = verticalStack_1.VerticalStack;
// misc
var simpleHttpRequest_1 = __webpack_require__(182);
exports.simpleHttpRequest = simpleHttpRequest_1.simpleHttpRequest;
var resizeObserverService_1 = __webpack_require__(142);
exports.ResizeObserverService = resizeObserverService_1.ResizeObserverService;
var largeTextCellEditor_1 = __webpack_require__(82);
exports.LargeTextCellEditor = largeTextCellEditor_1.LargeTextCellEditor;
var popupEditorWrapper_1 = __webpack_require__(46);
exports.PopupEditorWrapper = popupEditorWrapper_1.PopupEditorWrapper;
var popupSelectCellEditor_1 = __webpack_require__(81);
exports.PopupSelectCellEditor = popupSelectCellEditor_1.PopupSelectCellEditor;
var popupTextCellEditor_1 = __webpack_require__(80);
exports.PopupTextCellEditor = popupTextCellEditor_1.PopupTextCellEditor;
var selectCellEditor_1 = __webpack_require__(79);
exports.SelectCellEditor = selectCellEditor_1.SelectCellEditor;
var textCellEditor_1 = __webpack_require__(62);
exports.TextCellEditor = textCellEditor_1.TextCellEditor;
var animateShowChangeCellRenderer_1 = __webpack_require__(77);
exports.AnimateShowChangeCellRenderer = animateShowChangeCellRenderer_1.AnimateShowChangeCellRenderer;
var animateSlideCellRenderer_1 = __webpack_require__(57);
exports.AnimateSlideCellRenderer = animateSlideCellRenderer_1.AnimateSlideCellRenderer;
var groupCellRenderer_1 = __webpack_require__(74);
exports.GroupCellRenderer = groupCellRenderer_1.GroupCellRenderer;
// features
var setLeftFeature_1 = __webpack_require__(107);
exports.SetLeftFeature = setLeftFeature_1.SetLeftFeature;
// rendering
var autoWidthCalculator_1 = __webpack_require__(29);
exports.AutoWidthCalculator = autoWidthCalculator_1.AutoWidthCalculator;
var cellRendererFactory_1 = __webpack_require__(56);
exports.CellRendererFactory = cellRendererFactory_1.CellRendererFactory;
var checkboxSelectionComponent_1 = __webpack_require__(35);
exports.CheckboxSelectionComponent = checkboxSelectionComponent_1.CheckboxSelectionComponent;
var cellComp_1 = __webpack_require__(32);
exports.CellComp = cellComp_1.CellComp;
var rowComp_1 = __webpack_require__(31);
exports.RowComp = rowComp_1.RowComp;
var rowRenderer_1 = __webpack_require__(30);
exports.RowRenderer = rowRenderer_1.RowRenderer;
var valueFormatterService_1 = __webpack_require__(75);
exports.ValueFormatterService = valueFormatterService_1.ValueFormatterService;
// rowControllers/inMemory
var filterStage_1 = __webpack_require__(145);
exports.FilterStage = filterStage_1.FilterStage;
var flattenStage_1 = __webpack_require__(150);
exports.FlattenStage = flattenStage_1.FlattenStage;
var sortStage_1 = __webpack_require__(148);
exports.SortStage = sortStage_1.SortStage;
// row models
var pinnedRowModel_1 = __webpack_require__(51);
exports.PinnedRowModel = pinnedRowModel_1.PinnedRowModel;
var clientSideRowModel_1 = __webpack_require__(157);
exports.ClientSideRowModel = clientSideRowModel_1.ClientSideRowModel;
var changedPath_1 = __webpack_require__(38);
exports.ChangedPath = changedPath_1.ChangedPath;
var clientSideNodeManager_1 = __webpack_require__(158);
exports.ClientSideNodeManager = clientSideNodeManager_1.ClientSideNodeManager;
var infiniteRowModel_1 = __webpack_require__(151);
exports.InfiniteRowModel = infiniteRowModel_1.InfiniteRowModel;
var rowNodeBlock_1 = __webpack_require__(154);
exports.RowNodeBlock = rowNodeBlock_1.RowNodeBlock;
var rowNodeBlockLoader_1 = __webpack_require__(156);
exports.RowNodeBlockLoader = rowNodeBlockLoader_1.RowNodeBlockLoader;
var paginationProxy_1 = __webpack_require__(52);
exports.PaginationProxy = paginationProxy_1.PaginationProxy;
var rowNodeCache_1 = __webpack_require__(155);
exports.RowNodeCache = rowNodeCache_1.RowNodeCache;
//styling
var stylingService_1 = __webpack_require__(96);
exports.StylingService = stylingService_1.StylingService;
// widgets
var agAbstractField_1 = __webpack_require__(110);
exports.AgAbstractField = agAbstractField_1.AgAbstractField;
var agCheckbox_1 = __webpack_require__(108);
exports.AgCheckbox = agCheckbox_1.AgCheckbox;
var agRadioButton_1 = __webpack_require__(159);
exports.AgRadioButton = agRadioButton_1.AgRadioButton;
var agToggleButton_1 = __webpack_require__(178);
exports.AgToggleButton = agToggleButton_1.AgToggleButton;
var agInputTextField_1 = __webpack_require__(168);
exports.AgInputTextField = agInputTextField_1.AgInputTextField;
var agInputTextArea_1 = __webpack_require__(169);
exports.AgInputTextArea = agInputTextArea_1.AgInputTextArea;
var agInputNumberField_1 = __webpack_require__(172);
exports.AgInputNumberField = agInputNumberField_1.AgInputNumberField;
var agInputRange_1 = __webpack_require__(171);
exports.AgInputRange = agInputRange_1.AgInputRange;
var agSelect_1 = __webpack_require__(176);
exports.AgSelect = agSelect_1.AgSelect;
var agSlider_1 = __webpack_require__(170);
exports.AgSlider = agSlider_1.AgSlider;
var agAngleSelect_1 = __webpack_require__(177);
exports.AgAngleSelect = agAngleSelect_1.AgAngleSelect;
var agColorPicker_1 = __webpack_require__(173);
exports.AgColorPicker = agColorPicker_1.AgColorPicker;
var agGroupComponent_1 = __webpack_require__(165);
exports.AgGroupComponent = agGroupComponent_1.AgGroupComponent;
var agDialog_1 = __webpack_require__(166);
exports.AgDialog = agDialog_1.AgDialog;
var agPanel_1 = __webpack_require__(167);
exports.AgPanel = agPanel_1.AgPanel;
var messageBox_1 = __webpack_require__(183);
exports.MessageBox = messageBox_1.MessageBox;
var component_1 = __webpack_require__(33);
exports.Component = component_1.Component;
var popupComponent_1 = __webpack_require__(47);
exports.PopupComponent = popupComponent_1.PopupComponent;
var popupService_1 = __webpack_require__(59);
exports.PopupService = popupService_1.PopupService;
var touchListener_1 = __webpack_require__(72);
exports.TouchListener = touchListener_1.TouchListener;
// range
var iRangeController_1 = __webpack_require__(41);
exports.CellRangeType = iRangeController_1.CellRangeType;
// exporter
var csvCreator_1 = __webpack_require__(19);
exports.CsvCreator = csvCreator_1.CsvCreator;
exports.BaseCreator = csvCreator_1.BaseCreator;
var downloader_1 = __webpack_require__(116);
exports.Downloader = downloader_1.Downloader;
var xmlFactory_1 = __webpack_require__(161);
exports.XmlFactory = xmlFactory_1.XmlFactory;
var gridSerializer_1 = __webpack_require__(20);
exports.BaseGridSerializingSession = gridSerializer_1.BaseGridSerializingSession;
exports.GridSerializer = gridSerializer_1.GridSerializer;
var gridSerializer_2 = __webpack_require__(20);
exports.RowType = gridSerializer_2.RowType;
var zipContainer_1 = __webpack_require__(164);
exports.ZipContainer = zipContainer_1.ZipContainer;
// root
var vanillaFrameworkOverrides_1 = __webpack_require__(160);
exports.VanillaFrameworkOverrides = vanillaFrameworkOverrides_1.VanillaFrameworkOverrides;
var cellNavigationService_1 = __webpack_require__(50);
exports.CellNavigationService = cellNavigationService_1.CellNavigationService;
var alignedGridsService_1 = __webpack_require__(118);
exports.AlignedGridsService = alignedGridsService_1.AlignedGridsService;
var constants_1 = __webpack_require__(8);
exports.Constants = constants_1.Constants;
var grid_1 = __webpack_require__(125);
exports.Grid = grid_1.Grid;
var gridApi_1 = __webpack_require__(18);
exports.GridApi = gridApi_1.GridApi;
var eventKeys_1 = __webpack_require__(16);
exports.Events = eventKeys_1.Events;
var focusedCellController_1 = __webpack_require__(49);
exports.FocusedCellController = focusedCellController_1.FocusedCellController;
var functions_1 = __webpack_require__(184);
exports.defaultGroupComparator = functions_1.defaultGroupComparator;
var gridOptionsWrapper_1 = __webpack_require__(4);
exports.GridOptionsWrapper = gridOptionsWrapper_1.GridOptionsWrapper;
var eventService_1 = __webpack_require__(11);
exports.EventService = eventService_1.EventService;
var selectableService_1 = __webpack_require__(147);
exports.SelectableService = selectableService_1.SelectableService;
var gridCore_1 = __webpack_require__(143);
exports.GridCore = gridCore_1.GridCore;
var logger_1 = __webpack_require__(12);
exports.Logger = logger_1.Logger;
var selectionController_1 = __webpack_require__(37);
exports.SelectionController = selectionController_1.SelectionController;
var sortController_1 = __webpack_require__(71);
exports.SortController = sortController_1.SortController;
var templateService_1 = __webpack_require__(54);
exports.TemplateService = templateService_1.TemplateService;
var utils_1 = __webpack_require__(5);
exports.Color = utils_1.Color;
exports.Utils = utils_1.Utils;
exports.NumberSequence = utils_1.NumberSequence;
exports._ = utils_1._;
exports.Promise = utils_1.Promise;
var valueService_1 = __webpack_require__(39);
exports.ValueService = valueService_1.ValueService;
var expressionService_1 = __webpack_require__(27);
exports.ExpressionService = expressionService_1.ExpressionService;
var logger_2 = __webpack_require__(12);
exports.LoggerFactory = logger_2.LoggerFactory;
var cellPosition_1 = __webpack_require__(102);
exports.CellPositionUtils = cellPosition_1.CellPositionUtils;
var rowPosition_1 = __webpack_require__(103);
exports.RowPositionUtils = rowPosition_1.RowPositionUtils;
var columnApi_1 = __webpack_require__(26);
exports.ColumnApi = columnApi_1.ColumnApi;
var frameworkComponentWrapper_1 = __webpack_require__(185);
exports.BaseComponentWrapper = frameworkComponentWrapper_1.BaseComponentWrapper;
var environment_1 = __webpack_require__(45);
exports.Environment = environment_1.Environment;
var tooltipManager_1 = __webpack_require__(100);
exports.TooltipManager = tooltipManager_1.TooltipManager;
// charts
var iChartOptions_1 = __webpack_require__(186);
exports.ChartType = iChartOptions_1.ChartType;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2)))
/***/ }),
/* 2 */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || new Function("return this")();
} catch (e) {
// This works if the window reference is available
if (typeof window === "object") g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
var gridOptionsWrapper_1 = __webpack_require__(4);
var logger_1 = __webpack_require__(12);
var columnUtils_1 = __webpack_require__(24);
var columnKeyCreator_1 = __webpack_require__(122);
var originalColumnGroup_1 = __webpack_require__(25);
var column_1 = __webpack_require__(23);
var context_1 = __webpack_require__(13);
var defaultColumnTypes_1 = __webpack_require__(123);
var utils_1 = __webpack_require__(5);
// takes ColDefs and ColGroupDefs and turns them into Columns and OriginalGroups
var ColumnFactory = /** @class */ (function () {
function ColumnFactory() {
}
ColumnFactory.prototype.setBeans = function (loggerFactory) {
this.logger = loggerFactory.create('ColumnFactory');
};
ColumnFactory.prototype.createColumnTree = function (defs, primaryColumns, existingColumns) {
// column key creator dishes out unique column id's in a deterministic way,
// so if we have two grids (that could be master/slave) with same column definitions,
// then this ensures the two grids use identical id's.
var columnKeyCreator = new columnKeyCreator_1.ColumnKeyCreator();
if (existingColumns) {
var existingKeys = existingColumns.map(function (col) { return col.getId(); });
columnKeyCreator.addExistingKeys(existingKeys);
}
// we take a copy of the columns as we are going to be removing from them
var existingColsCopy = existingColumns ? existingColumns.slice() : null;
// create am unbalanced tree that maps the provided definitions
var unbalancedTree = this.recursivelyCreateColumns(defs, 0, primaryColumns, existingColsCopy, columnKeyCreator, null);
var treeDept = this.findMaxDept(unbalancedTree, 0);
this.logger.log('Number of levels for grouped columns is ' + treeDept);
var res = this.balanceColumnTree(unbalancedTree, 0, treeDept, columnKeyCreator);
var deptFirstCallback = function (child, parent) {
if (child instanceof originalColumnGroup_1.OriginalColumnGroup) {
child.setupExpandable();
}
// we set the original parents at the end, rather than when we go along, as balancing the tree
// adds extra levels into the tree. so we can only set parents when balancing is done.
child.setOriginalParent(parent);
};
this.columnUtils.depthFirstOriginalTreeSearch(null, res, deptFirstCallback);
return {
columnTree: res,
treeDept: treeDept
};
};
ColumnFactory.prototype.createForAutoGroups = function (autoGroupCols, gridBalancedTree) {
var _this = this;
var autoColBalancedTree = [];
autoGroupCols.forEach(function (col) {
var fakeTreeItem = _this.createAutoGroupTreeItem(gridBalancedTree, col);
autoColBalancedTree.push(fakeTreeItem);
});
return autoColBalancedTree;
};
ColumnFactory.prototype.createAutoGroupTreeItem = function (balancedColumnTree, column) {
var dept = this.findDepth(balancedColumnTree);
// at the end, this will be the top of the tree item.
var nextChild = column;
for (var i = dept - 1; i >= 0; i--) {
var autoGroup = new originalColumnGroup_1.OriginalColumnGroup(null, "FAKE_PATH_" + column.getId() + "}_" + i, true, i);
this.context.wireBean(autoGroup);
autoGroup.setChildren([nextChild]);
nextChild.setOriginalParent(autoGroup);
nextChild = autoGroup;
}
// at this point, the nextChild is the top most item in the tree
return nextChild;
};
ColumnFactory.prototype.findDepth = function (balancedColumnTree) {
var dept = 0;
var pointer = balancedColumnTree;
while (pointer && pointer[0] && pointer[0] instanceof originalColumnGroup_1.OriginalColumnGroup) {
dept++;
pointer = pointer[0].getChildren();
}
return dept;
};
ColumnFactory.prototype.balanceColumnTree = function (unbalancedTree, currentDept, columnDept, columnKeyCreator) {
var result = [];
// go through each child, for groups, recurse a level deeper,
// for columns we need to pad
for (var i = 0; i < unbalancedTree.length; i++) {
var child = unbalancedTree[i];
if (child instanceof originalColumnGroup_1.OriginalColumnGroup) {
// child is a group, all we do is go to the next level of recursion
var originalGroup = child;
var newChildren = this.balanceColumnTree(originalGroup.getChildren(), currentDept + 1, columnDept, columnKeyCreator);
originalGroup.setChildren(newChildren);
result.push(originalGroup);
}
else {
// child is a column - so here we add in the padded column groups if needed
var firstPaddedGroup = void 0;
var currentPaddedGroup = void 0;
// this for loop will NOT run any loops if no padded column groups are needed
for (var j = columnDept - 1; j >= currentDept; j--) {
var newColId = columnKeyCreator.getUniqueKey(null, null);
var colGroupDefMerged = this.createMergedColGroupDef(null);
var paddedGroup = new originalColumnGroup_1.OriginalColumnGroup(colGroupDefMerged, newColId, true, currentDept);
this.context.wireBean(paddedGroup);
if (currentPaddedGroup) {
currentPaddedGroup.setChildren([paddedGroup]);
}
currentPaddedGroup = paddedGroup;
if (!firstPaddedGroup) {
firstPaddedGroup = currentPaddedGroup;
}
}
// likewise this if statement will not run if no padded groups
if (firstPaddedGroup) {
result.push(firstPaddedGroup);
var hasGroups = unbalancedTree.some(function (child) { return child instanceof originalColumnGroup_1.OriginalColumnGroup; });
if (hasGroups) {
currentPaddedGroup.setChildren([child]);
continue;
}
else {
currentPaddedGroup.setChildren(unbalancedTree);
break;
}
}
result.push(child);
}
}
return result;
};
ColumnFactory.prototype.findMaxDept = function (treeChildren, dept) {
var maxDeptThisLevel = dept;
for (var i = 0; i < treeChildren.length; i++) {
var abstractColumn = treeChildren[i];
if (abstractColumn instanceof originalColumnGroup_1.OriginalColumnGroup) {
var originalGroup = abstractColumn;
var newDept = this.findMaxDept(originalGroup.getChildren(), dept + 1);
if (maxDeptThisLevel < newDept) {
maxDeptThisLevel = newDept;
}
}
}
return maxDeptThisLevel;
};
ColumnFactory.prototype.recursivelyCreateColumns = function (defs, level, primaryColumns, existingColsCopy, columnKeyCreator, parent) {
var _this = this;
var result = [];
if (!defs) {
return result;
}
defs.forEach(function (def) {
var newGroupOrColumn;
if (_this.isColumnGroup(def)) {
newGroupOrColumn = _this.createColumnGroup(primaryColumns, def, level, existingColsCopy, columnKeyCreator, parent);
}
else {
newGroupOrColumn = _this.createColumn(primaryColumns, def, existingColsCopy, columnKeyCreator, parent);
}
result.push(newGroupOrColumn);
});
return result;
};
ColumnFactory.prototype.createColumnGroup = function (primaryColumns, colGroupDef, level, existingColumns, columnKeyCreator, parent) {
var colGroupDefMerged = this.createMergedColGroupDef(colGroupDef);
var groupId = columnKeyCreator.getUniqueKey(colGroupDefMerged.groupId, null);
var originalGroup = new originalColumnGroup_1.OriginalColumnGroup(colGroupDefMerged, groupId, false, level);
this.context.wireBean(originalGroup);
var children = this.recursivelyCreateColumns(colGroupDefMerged.children, level + 1, primaryColumns, existingColumns, columnKeyCreator, originalGroup);
originalGroup.setChildren(children);
return originalGroup;
};
ColumnFactory.prototype.createMergedColGroupDef = function (colGroupDef) {
var colGroupDefMerged = {};
utils_1._.assign(colGroupDefMerged, this.gridOptionsWrapper.getDefaultColGroupDef());
utils_1._.assign(colGroupDefMerged, colGroupDef);
this.checkForDeprecatedItems(colGroupDefMerged);
return colGroupDefMerged;
};
ColumnFactory.prototype.createColumn = function (primaryColumns, colDef, existingColsCopy, columnKeyCreator, parent) {
var colDefMerged = this.mergeColDefs(colDef);
this.checkForDeprecatedItems(colDefMerged);
// see if column already exists
var column = this.findExistingColumn(colDef, existingColsCopy);
if (!column) {
// no existing column, need to create one
var colId = columnKeyCreator.getUniqueKey(colDefMerged.colId, colDefMerged.field);
column = new column_1.Column(colDefMerged, colDef, colId, primaryColumns);
this.context.wireBean(column);
}
else {
column.setColDef(colDefMerged, colDef);
}
return column;
};
ColumnFactory.prototype.findExistingColumn = function (colDef, existingColsCopy) {
var res = utils_1._.find(existingColsCopy, function (col) {
var oldColDef = col.getUserProvidedColDef();
if (!oldColDef) {
return false;
}
// first check object references
if (oldColDef === colDef) {
return true;
}
// second check id's
var oldColHadId = oldColDef.colId !== null && oldColDef.colId !== undefined;
if (oldColHadId) {
return oldColDef.colId === colDef.colId;
}
else {
return false;
}
});
// make sure we remove, so if user provided duplicate id, then we don't have more than
// one column instance for colDef with common id
if (res) {
utils_1._.removeFromArray(existingColsCopy, res);
}
return res;
};
ColumnFactory.prototype.mergeColDefs = function (colDef) {
// start with empty merged definition
var colDefMerged = {};
// merge properties from default column definitions
utils_1._.assign(colDefMerged, this.gridOptionsWrapper.getDefaultColDef());
// merge properties from column type properties
if (colDef.type) {
this.assignColumnTypes(colDef, colDefMerged);
}
// merge properties from column definitions
utils_1._.assign(colDefMerged, colDef);
return colDefMerged;
};
ColumnFactory.prototype.assignColumnTypes = function (colDef, colDefMerged) {
var typeKeys;
if (colDef.type instanceof Array) {
var invalidArray = colDef.type.some(function (a) { return typeof a !== 'string'; });
if (invalidArray) {
console.warn("ag-grid: if colDef.type is supplied an array it should be of type 'string[]'");
}
else {
typeKeys = colDef.type;
}
}
else if (typeof colDef.type === 'string') {
typeKeys = colDef.type.split(',');
}
else {
console.warn("ag-grid: colDef.type should be of type 'string' | 'string[]'");
return;
}
// merge user defined with default column types
var allColumnTypes = utils_1._.assign({}, this.gridOptionsWrapper.getColumnTypes(), defaultColumnTypes_1.DefaultColumnTypes);
typeKeys.forEach(function (t) {
var typeColDef = allColumnTypes[t.trim()];
if (typeColDef) {
utils_1._.assign(colDefMerged, typeColDef);
}
else {
console.warn("ag-grid: colDef.type '" + t + "' does not correspond to defined gridOptions.columnTypes");
}
});
};
ColumnFactory.prototype.checkForDeprecatedItems = function (colDef) {
if (colDef) {
var colDefNoType = colDef; // take out the type, so we can access attributes not defined in the type
if (colDefNoType.group !== undefined) {
console.warn('ag-grid: colDef.group is invalid, please check documentation on how to do grouping as it changed in version 3');
}
if (colDefNoType.headerGroup !== undefined) {
console.warn('ag-grid: colDef.headerGroup is invalid, please check documentation on how to do grouping as it changed in version 3');
}
if (colDefNoType.headerGroupShow !== undefined) {
console.warn('ag-grid: colDef.headerGroupShow is invalid, should be columnGroupShow, please check documentation on how to do grouping as it changed in version 3');
}
if (colDefNoType.suppressRowGroup !== undefined) {
console.warn('ag-grid: colDef.suppressRowGroup is deprecated, please use colDef.type instead');
}
if (colDefNoType.suppressAggregation !== undefined) {
console.warn('ag-grid: colDef.suppressAggregation is deprecated, please use colDef.type instead');
}
if (colDefNoType.suppressRowGroup || colDefNoType.suppressAggregation) {
console.warn('ag-grid: colDef.suppressAggregation and colDef.suppressRowGroup are deprecated, use allowRowGroup, allowPivot and allowValue instead');
}
if (colDefNoType.displayName) {
console.warn("ag-grid: Found displayName " + colDefNoType.displayName + ", please use headerName instead, displayName is deprecated.");
colDefNoType.headerName = colDefNoType.displayName;
}
}
};
// if object has children, we assume it's a group
ColumnFactory.prototype.isColumnGroup = function (abstractColDef) {
return abstractColDef.children !== undefined;
};
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], ColumnFactory.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.Autowired('columnUtils'),
__metadata("design:type", columnUtils_1.ColumnUtils)
], ColumnFactory.prototype, "columnUtils", void 0);
__decorate([
context_1.Autowired('context'),
__metadata("design:type", context_1.Context)
], ColumnFactory.prototype, "context", void 0);
__decorate([
__param(0, context_1.Qualifier('loggerFactory')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [logger_1.LoggerFactory]),
__metadata("design:returntype", void 0)
], ColumnFactory.prototype, "setBeans", null);
ColumnFactory = __decorate([
context_1.Bean('columnFactory')
], ColumnFactory);
return ColumnFactory;
}());
exports.ColumnFactory = ColumnFactory;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = __webpack_require__(5);
var eventService_1 = __webpack_require__(11);
var constants_1 = __webpack_require__(8);
var componentUtil_1 = __webpack_require__(14);
var gridApi_1 = __webpack_require__(18);
var context_1 = __webpack_require__(13);
var columnApi_1 = __webpack_require__(26);
var columnController_1 = __webpack_require__(21);
var environment_1 = __webpack_require__(45);
var propertyKeys_1 = __webpack_require__(17);
var colDefUtil_1 = __webpack_require__(119);
var eventKeys_1 = __webpack_require__(16);
var autoHeightCalculator_1 = __webpack_require__(120);
var sideBar_1 = __webpack_require__(121);
var DEFAULT_ROW_HEIGHT = 25;
var DEFAULT_DETAIL_ROW_HEIGHT = 300;
var DEFAULT_VIEWPORT_ROW_MODEL_PAGE_SIZE = 5;
var DEFAULT_VIEWPORT_ROW_MODEL_BUFFER_SIZE = 5;
var DEFAULT_KEEP_DETAIL_ROW_COUNT = 10;
function isTrue(value) {
return value === true || value === 'true';
}
function zeroOrGreater(value, defaultValue) {
if (value >= 0) {
return value;
}
// zero gets returned if number is missing or the wrong type
return defaultValue;
}
function oneOrGreater(value, defaultValue) {
if (value > 0) {
return value;
}
// zero gets returned if number is missing or the wrong type
return defaultValue;
}
var GridOptionsWrapper = /** @class */ (function () {
function GridOptionsWrapper() {
this.propertyEventService = new eventService_1.EventService();
this.domDataKey = '__AG_' + Math.random().toString();
this.layoutElements = [];
}
GridOptionsWrapper_1 = GridOptionsWrapper;
GridOptionsWrapper.prototype.agWire = function (gridApi, columnApi) {
this.gridOptions.api = gridApi;
this.gridOptions.columnApi = columnApi;
this.checkForDeprecated();
this.checkForViolations();
};
GridOptionsWrapper.prototype.destroy = function () {
// need to remove these, as we don't own the lifecycle of the gridOptions, we need to
// remove the references in case the user keeps the grid options, we want the rest
// of the grid to be picked up by the garbage collector
this.gridOptions.api = null;
this.gridOptions.columnApi = null;
};
GridOptionsWrapper.prototype.init = function () {
if (!(this.gridOptions.suppressPropertyNamesCheck === true)) {
this.checkGridOptionsProperties();
this.checkColumnDefProperties();
}
var async = this.useAsyncEvents();
this.eventService.addGlobalListener(this.globalEventHandler.bind(this), async);
if (this.isGroupSelectsChildren() && this.isSuppressParentsInRowNodes()) {
console.warn('ag-Grid: groupSelectsChildren does not work wth suppressParentsInRowNodes, this selection method needs the part in rowNode to work');
}
if (this.isGroupSelectsChildren()) {
if (!this.isRowSelectionMulti()) {
console.warn("ag-Grid: rowSelection must be 'multiple' for groupSelectsChildren to make sense");
}
if (this.isRowModelServerSide()) {
console.warn('ag-Grid: group selects children is NOT support for Server Side Row Model. ' +
'This is because the rows are lazy loaded, so selecting a group is not possible as' +
'the grid has no way of knowing what the children are.');
}
}
if (this.isGroupRemoveSingleChildren() && this.isGroupHideOpenParents()) {
console.warn('ag-Grid: groupRemoveSingleChildren and groupHideOpenParents do not work with each other, you need to pick one. And don\'t ask us how to us these together on our support forum either you will get the same answer!');
}
this.addEventListener(GridOptionsWrapper_1.PROP_DOM_LAYOUT, this.updateLayoutClasses.bind(this));
};
GridOptionsWrapper.prototype.checkColumnDefProperties = function () {
var _this = this;
if (this.gridOptions.columnDefs == null) {
return;
}
this.gridOptions.columnDefs.forEach(function (colDef) {
var userProperties = Object.getOwnPropertyNames(colDef);
var validProperties = colDefUtil_1.ColDefUtil.ALL_PROPERTIES.concat(colDefUtil_1.ColDefUtil.FRAMEWORK_PROPERTIES);
_this.checkProperties(userProperties, validProperties, validProperties, 'colDef', 'https://www.ag-grid.com/javascript-grid-column-properties/');
});
};
GridOptionsWrapper.prototype.checkGridOptionsProperties = function () {
var userProperties = Object.getOwnPropertyNames(this.gridOptions);
var validProperties = propertyKeys_1.PropertyKeys.ALL_PROPERTIES.concat(propertyKeys_1.PropertyKeys.FRAMEWORK_PROPERTIES);
Object.keys(eventKeys_1.Events).forEach(function (it) { return validProperties.push(componentUtil_1.ComponentUtil.getCallbackForEvent(eventKeys_1.Events[it])); });
var validPropertiesAndExceptions = validProperties.concat('api', 'columnApi');
this.checkProperties(userProperties, validPropertiesAndExceptions, validProperties, 'gridOptions', 'https://www.ag-grid.com/javascript-grid-properties/');
};
GridOptionsWrapper.prototype.checkProperties = function (userProperties, validPropertiesAndExceptions, validProperties, containerName, docsUrl) {
var invalidProperties = utils_1._.fuzzyCheckStrings(userProperties, validPropertiesAndExceptions, validProperties);
var invalidPropertyKeys = Object.keys(invalidProperties);
invalidPropertyKeys.forEach(function (invalidPropertyKey) {
var fuzzySuggestions = invalidProperties[invalidPropertyKey];
console.warn("ag-grid: invalid " + containerName + " property '" + invalidPropertyKey + "' did you mean any of these: " + fuzzySuggestions.slice(0, 8).join(","));
});
if (invalidPropertyKeys.length > 0) {
console.warn("ag-grid: to see all the valid " + containerName + " properties please check: " + docsUrl);
}
};
// returns the dom data, or undefined if not found
GridOptionsWrapper.prototype.getDomData = function (element, key) {
var domData = element[this.domDataKey];
if (domData) {
return domData[key];
}
return;
};
GridOptionsWrapper.prototype.setDomData = function (element, key, value) {
var domData = element[this.domDataKey];
if (utils_1._.missing(domData)) {
domData = {};
element[this.domDataKey] = domData;
}
domData[key] = value;
};
GridOptionsWrapper.prototype.isEnterprise = function () {
return this.enterprise;
};
GridOptionsWrapper.prototype.isRowSelection = function () {
return this.gridOptions.rowSelection === "single" || this.gridOptions.rowSelection === "multiple";
};
GridOptionsWrapper.prototype.isRowDeselection = function () {
return isTrue(this.gridOptions.rowDeselection);
};
GridOptionsWrapper.prototype.isRowSelectionMulti = function () {
return this.gridOptions.rowSelection === 'multiple';
};
GridOptionsWrapper.prototype.isRowMultiSelectWithClick = function () {
return isTrue(this.gridOptions.rowMultiSelectWithClick);
};
GridOptionsWrapper.prototype.getContext = function () {
return this.gridOptions.context;
};
GridOptionsWrapper.prototype.isPivotMode = function () {
return isTrue(this.gridOptions.pivotMode);
};
GridOptionsWrapper.prototype.isPivotTotals = function () {
return isTrue(this.gridOptions.pivotTotals);
};
GridOptionsWrapper.prototype.getPivotColumnGroupTotals = function () {
return this.gridOptions.pivotColumnGroupTotals;
};
GridOptionsWrapper.prototype.getPivotRowTotals = function () {
return this.gridOptions.pivotRowTotals;
};
GridOptionsWrapper.prototype.isRowModelInfinite = function () {
return this.gridOptions.rowModelType === constants_1.Constants.ROW_MODEL_TYPE_INFINITE;
};
GridOptionsWrapper.prototype.isRowModelViewport = function () {
return this.gridOptions.rowModelType === constants_1.Constants.ROW_MODEL_TYPE_VIEWPORT;
};
GridOptionsWrapper.prototype.isRowModelServerSide = function () {
return this.gridOptions.rowModelType === constants_1.Constants.ROW_MODEL_TYPE_SERVER_SIDE;
};
GridOptionsWrapper.prototype.isRowModelDefault = function () {
return utils_1._.missing(this.gridOptions.rowModelType) ||
this.gridOptions.rowModelType === constants_1.Constants.ROW_MODEL_TYPE_CLIENT_SIDE ||
this.gridOptions.rowModelType === constants_1.Constants.DEPRECATED_ROW_MODEL_TYPE_NORMAL;
};
GridOptionsWrapper.prototype.isFullRowEdit = function () {
return this.gridOptions.editType === 'fullRow';
};
GridOptionsWrapper.prototype.isSuppressFocusAfterRefresh = function () {
return isTrue(this.gridOptions.suppressFocusAfterRefresh);
};
GridOptionsWrapper.prototype.isSuppressBrowserResizeObserver = function () {
return isTrue(this.gridOptions.suppressBrowserResizeObserver);
};
GridOptionsWrapper.prototype.isSuppressMaintainUnsortedOrder = function () {
return isTrue(this.gridOptions.suppressMaintainUnsortedOrder);
};
GridOptionsWrapper.prototype.isShowToolPanel = function () {
return isTrue(this.gridOptions.sideBar && Array.isArray(this.getSideBar().toolPanels));
};
GridOptionsWrapper.prototype.getSideBar = function () {
return this.gridOptions.sideBar;
};
GridOptionsWrapper.prototype.isSuppressTouch = function () {
return isTrue(this.gridOptions.suppressTouch);
};
GridOptionsWrapper.prototype.isSuppressRowTransform = function () {
return isTrue(this.gridOptions.suppressRowTransform);
};
GridOptionsWrapper.prototype.isSuppressSetColumnStateEvents = function () {
return isTrue(this.gridOptions.suppressSetColumnStateEvents);
};
GridOptionsWrapper.prototype.useAsyncEvents = function () {
return !isTrue(this.gridOptions.suppressAsyncEvents);
};
GridOptionsWrapper.prototype.isEnableCellChangeFlash = function () {
return isTrue(this.gridOptions.enableCellChangeFlash);
};
GridOptionsWrapper.prototype.isGroupSelectsChildren = function () {
var result = isTrue(this.gridOptions.groupSelectsChildren);
if (result && this.isTreeData()) {
console.warn('ag-Grid: groupSelectsChildren does not work with tree data');
return false;
}
return result;
};
GridOptionsWrapper.prototype.isSuppressRowHoverHighlight = function () {
return isTrue(this.gridOptions.suppressRowHoverHighlight);
};
GridOptionsWrapper.prototype.isGroupSelectsFiltered = function () {
return isTrue(this.gridOptions.groupSelectsFiltered);
};
GridOptionsWrapper.prototype.isGroupHideOpenParents = function () {
return isTrue(this.gridOptions.groupHideOpenParents);
};
// if we are doing hideOpenParents, then we always have groupMultiAutoColumn, otherwise hideOpenParents would not work
GridOptionsWrapper.prototype.isGroupMultiAutoColumn = function () {
return isTrue(this.gridOptions.groupMultiAutoColumn) || isTrue(this.gridOptions.groupHideOpenParents);
};
GridOptionsWrapper.prototype.isGroupRemoveSingleChildren = function () {
return isTrue(this.gridOptions.groupRemoveSingleChildren);
};
GridOptionsWrapper.prototype.isGroupRemoveLowestSingleChildren = function () {
return isTrue(this.gridOptions.groupRemoveLowestSingleChildren);
};
GridOptionsWrapper.prototype.isGroupIncludeFooter = function () {
return isTrue(this.gridOptions.groupIncludeFooter);
};
GridOptionsWrapper.prototype.isGroupIncludeTotalFooter = function () {
return isTrue(this.gridOptions.groupIncludeTotalFooter);
};
GridOptionsWrapper.prototype.isGroupSuppressBlankHeader = function () {
return isTrue(this.gridOptions.groupSuppressBlankHeader);
};
GridOptionsWrapper.prototype.isSuppressRowClickSelection = function () {
return isTrue(this.gridOptions.suppressRowClickSelection);
};
GridOptionsWrapper.prototype.isSuppressCellSelection = function () {
return isTrue(this.gridOptions.suppressCellSelection);
};
GridOptionsWrapper.prototype.isSuppressMultiSort = function () {
return isTrue(this.gridOptions.suppressMultiSort);
};
GridOptionsWrapper.prototype.isMultiSortKeyCtrl = function () {
return this.gridOptions.multiSortKey === 'ctrl';
};
GridOptionsWrapper.prototype.isGroupSuppressAutoColumn = function () {
return isTrue(this.gridOptions.groupSuppressAutoColumn);
};
GridOptionsWrapper.prototype.isSuppressDragLeaveHidesColumns = function () {
return isTrue(this.gridOptions.suppressDragLeaveHidesColumns);
};
GridOptionsWrapper.prototype.isSuppressScrollOnNewData = function () {
return isTrue(this.gridOptions.suppressScrollOnNewData);
};
GridOptionsWrapper.prototype.isRowDragManaged = function () {
return isTrue(this.gridOptions.rowDragManaged);
};
GridOptionsWrapper.prototype.isSuppressRowDrag = function () {
return isTrue(this.gridOptions.suppressRowDrag);
};
// returns either 'print', 'autoHeight' or 'normal' (normal is the default)
GridOptionsWrapper.prototype.getDomLayout = function () {
var _this = this;
var domLayout = this.gridOptions.domLayout;
if (domLayout === constants_1.Constants.DOM_LAYOUT_PRINT
|| domLayout === constants_1.Constants.DOM_LAYOUT_AUTO_HEIGHT
|| domLayout === constants_1.Constants.DOM_LAYOUT_NORMAL) {
return domLayout;
}
else if (domLayout === null || domLayout === undefined) {
return constants_1.Constants.DOM_LAYOUT_NORMAL;
}
else {
utils_1._.doOnce(function () { return console.warn("ag-Grid: " + _this.gridOptions.domLayout + " is not valid for DOM Layout, valid values are " + constants_1.Constants.DOM_LAYOUT_NORMAL + ", " + constants_1.Constants.DOM_LAYOUT_AUTO_HEIGHT + " and " + constants_1.Constants.DOM_LAYOUT_PRINT); }, 'warn about dom layout values');
return constants_1.Constants.DOM_LAYOUT_NORMAL;
}
};
GridOptionsWrapper.prototype.isSuppressHorizontalScroll = function () {
return isTrue(this.gridOptions.suppressHorizontalScroll);
};
GridOptionsWrapper.prototype.isSuppressMaxRenderedRowRestriction = function () {
return isTrue(this.gridOptions.suppressMaxRenderedRowRestriction);
};
GridOptionsWrapper.prototype.isExcludeChildrenWhenTreeDataFiltering = function () {
return isTrue(this.gridOptions.excludeChildrenWhenTreeDataFiltering);
};
GridOptionsWrapper.prototype.isAlwaysShowVerticalScroll = function () {
return isTrue(this.gridOptions.alwaysShowVerticalScroll);
};
GridOptionsWrapper.prototype.isSuppressLoadingOverlay = function () {
return isTrue(this.gridOptions.suppressLoadingOverlay);
};
GridOptionsWrapper.prototype.isSuppressNoRowsOverlay = function () {
return isTrue(this.gridOptions.suppressNoRowsOverlay);
};
GridOptionsWrapper.prototype.isSuppressFieldDotNotation = function () {
return isTrue(this.gridOptions.suppressFieldDotNotation);
};
GridOptionsWrapper.prototype.getPinnedTopRowData = function () {
return this.gridOptions.pinnedTopRowData;
};
GridOptionsWrapper.prototype.getPinnedBottomRowData = function () {
return this.gridOptions.pinnedBottomRowData;
};
GridOptionsWrapper.prototype.isFunctionsPassive = function () {
return isTrue(this.gridOptions.functionsPassive);
};
GridOptionsWrapper.prototype.isSuppressTabbing = function () {
return isTrue(this.gridOptions.suppressTabbing);
};
GridOptionsWrapper.prototype.isSuppressChangeDetection = function () {
return isTrue(this.gridOptions.suppressChangeDetection);
};
GridOptionsWrapper.prototype.isSuppressAnimationFrame = function () {
return isTrue(this.gridOptions.suppressAnimationFrame);
};
GridOptionsWrapper.prototype.getQuickFilterText = function () {
return this.gridOptions.quickFilterText;
};
GridOptionsWrapper.prototype.isCacheQuickFilter = function () {
return isTrue(this.gridOptions.cacheQuickFilter);
};
GridOptionsWrapper.prototype.isUnSortIcon = function () {
return isTrue(this.gridOptions.unSortIcon);
};
GridOptionsWrapper.prototype.isSuppressMenuHide = function () {
return isTrue(this.gridOptions.suppressMenuHide);
};
GridOptionsWrapper.prototype.isEnterMovesDownAfterEdit = function () {
return isTrue(this.gridOptions.enterMovesDownAfterEdit);
};
GridOptionsWrapper.prototype.isEnterMovesDown = function () {
return isTrue(this.gridOptions.enterMovesDown);
};
GridOptionsWrapper.prototype.getRowStyle = function () {
return this.gridOptions.rowStyle;
};
GridOptionsWrapper.prototype.getRowClass = function () {
return this.gridOptions.rowClass;
};
GridOptionsWrapper.prototype.getRowStyleFunc = function () {
return this.gridOptions.getRowStyle;
};
GridOptionsWrapper.prototype.getRowClassFunc = function () {
return this.gridOptions.getRowClass;
};
GridOptionsWrapper.prototype.rowClassRules = function () {
return this.gridOptions.rowClassRules;
};
GridOptionsWrapper.prototype.getCreateChartContainerFunc = function () {
return this.gridOptions.createChartContainer;
};
GridOptionsWrapper.prototype.getPopupParent = function () {
return this.gridOptions.popupParent;
};
GridOptionsWrapper.prototype.getBlockLoadDebounceMillis = function () {
return this.gridOptions.blockLoadDebounceMillis;
};
GridOptionsWrapper.prototype.getPostProcessPopupFunc = function () {
return this.gridOptions.postProcessPopup;
};
GridOptionsWrapper.prototype.getDoesDataFlowerFunc = function () {
return this.gridOptions.doesDataFlower;
};
GridOptionsWrapper.prototype.getPaginationNumberFormatterFunc = function () {
return this.gridOptions.paginationNumberFormatter;
};
GridOptionsWrapper.prototype.getChildCountFunc = function () {
return this.gridOptions.getChildCount;
};
GridOptionsWrapper.prototype.getDefaultGroupSortComparator = function () {
return this.gridOptions.defaultGroupSortComparator;
};
GridOptionsWrapper.prototype.getIsFullWidthCellFunc = function () {
return this.gridOptions.isFullWidthCell;
};
GridOptionsWrapper.prototype.getFullWidthCellRendererParams = function () {
return this.gridOptions.fullWidthCellRendererParams;
};
GridOptionsWrapper.prototype.isEmbedFullWidthRows = function () {
return isTrue(this.gridOptions.embedFullWidthRows) || isTrue(this.gridOptions.deprecatedEmbedFullWidthRows);
};
GridOptionsWrapper.prototype.getSuppressKeyboardEventFunc = function () {
return this.gridOptions.suppressKeyboardEvent;
};
GridOptionsWrapper.prototype.getBusinessKeyForNodeFunc = function () {
return this.gridOptions.getBusinessKeyForNode;
};
GridOptionsWrapper.prototype.getApi = function () {
return this.gridOptions.api;
};
GridOptionsWrapper.prototype.getColumnApi = function () {
return this.gridOptions.columnApi;
};
GridOptionsWrapper.prototype.isDeltaRowDataMode = function () {
return isTrue(this.gridOptions.deltaRowDataMode);
};
GridOptionsWrapper.prototype.isDeltaColumnMode = function () {
return isTrue(this.gridOptions.deltaColumnMode);
};
GridOptionsWrapper.prototype.isEnsureDomOrder = function () {
return isTrue(this.gridOptions.ensureDomOrder);
};
GridOptionsWrapper.prototype.isEnableCharts = function () {
if (isTrue((this.gridOptions.enableCharts))) {
if (!this.context.isModuleRegistered("chartsModule" /* ChartsModule */)) {
utils_1._.doOnce(function () {
console.warn('ag-grid: Charts is enabled but the Charts Module has not been included.');
}, 'ChartsModuleCheck');
return false;
}
return true;
}
return false;
};
GridOptionsWrapper.prototype.getColResizeDefault = function () {
return this.gridOptions.colResizeDefault;
};
GridOptionsWrapper.prototype.isSingleClickEdit = function () {
return isTrue(this.gridOptions.singleClickEdit);
};
GridOptionsWrapper.prototype.isSuppressClickEdit = function () {
return isTrue(this.gridOptions.suppressClickEdit);
};
GridOptionsWrapper.prototype.isStopEditingWhenGridLosesFocus = function () {
return isTrue(this.gridOptions.stopEditingWhenGridLosesFocus);
};
GridOptionsWrapper.prototype.getGroupDefaultExpanded = function () {
return this.gridOptions.groupDefaultExpanded;
};
GridOptionsWrapper.prototype.getMaxConcurrentDatasourceRequests = function () {
return this.gridOptions.maxConcurrentDatasourceRequests;
};
GridOptionsWrapper.prototype.getMaxBlocksInCache = function () {
return this.gridOptions.maxBlocksInCache;
};
GridOptionsWrapper.prototype.getCacheOverflowSize = function () {
return this.gridOptions.cacheOverflowSize;
};
GridOptionsWrapper.prototype.getPaginationPageSize = function () {
return this.gridOptions.paginationPageSize;
};
GridOptionsWrapper.prototype.isPaginateChildRows = function () {
// if using groupSuppressRow, means we are not showing parent rows,
// so we always paginate on the child rows here as there are no parent rows
if (this.isGroupSuppressRow() || this.isGroupRemoveSingleChildren()
|| this.isGroupRemoveLowestSingleChildren()) {
return true;
}
return isTrue(this.gridOptions.paginateChildRows);
};
GridOptionsWrapper.prototype.getCacheBlockSize = function () {
return this.gridOptions.cacheBlockSize;
};
GridOptionsWrapper.prototype.getInfiniteInitialRowCount = function () {
return this.gridOptions.infiniteInitialRowCount;
};
GridOptionsWrapper.prototype.isPurgeClosedRowNodes = function () {
return isTrue(this.gridOptions.purgeClosedRowNodes);
};
GridOptionsWrapper.prototype.isSuppressPaginationPanel = function () {
return isTrue(this.gridOptions.suppressPaginationPanel);
};
GridOptionsWrapper.prototype.getRowData = function () {
return this.gridOptions.rowData;
};
// this property is different - we never allow groupUseEntireRow if in pivot mode,
// as otherwise we don't see the pivot values.
GridOptionsWrapper.prototype.isGroupUseEntireRow = function (pivotMode) {
return pivotMode ? false : isTrue(this.gridOptions.groupUseEntireRow);
};
GridOptionsWrapper.prototype.isEnableRtl = function () {
return isTrue(this.gridOptions.enableRtl);
};
GridOptionsWrapper.prototype.getAutoGroupColumnDef = function () {
return this.gridOptions.autoGroupColumnDef;
};
GridOptionsWrapper.prototype.isGroupSuppressRow = function () {
return isTrue(this.gridOptions.groupSuppressRow);
};
GridOptionsWrapper.prototype.getRowGroupPanelShow = function () {
return this.gridOptions.rowGroupPanelShow;
};
GridOptionsWrapper.prototype.getPivotPanelShow = function () {
return this.gridOptions.pivotPanelShow;
};
GridOptionsWrapper.prototype.isAngularCompileRows = function () {
return isTrue(this.gridOptions.angularCompileRows);
};
GridOptionsWrapper.prototype.isAngularCompileFilters = function () {
return isTrue(this.gridOptions.angularCompileFilters);
};
GridOptionsWrapper.prototype.isAngularCompileHeaders = function () {
return isTrue(this.gridOptions.angularCompileHeaders);
};
GridOptionsWrapper.prototype.isDebug = function () {
return isTrue(this.gridOptions.debug);
};
GridOptionsWrapper.prototype.getColumnDefs = function () {
return this.gridOptions.columnDefs;
};
GridOptionsWrapper.prototype.getColumnTypes = function () {
return this.gridOptions.columnTypes;
};
GridOptionsWrapper.prototype.getDatasource = function () {
return this.gridOptions.datasource;
};
GridOptionsWrapper.prototype.getViewportDatasource = function () {
return this.gridOptions.viewportDatasource;
};
GridOptionsWrapper.prototype.getServerSideDatasource = function () {
return this.gridOptions.serverSideDatasource;
};
GridOptionsWrapper.prototype.isAccentedSort = function () {
return isTrue(this.gridOptions.accentedSort);
};
GridOptionsWrapper.prototype.isEnableBrowserTooltips = function () {
return isTrue(this.gridOptions.enableBrowserTooltips);
};
GridOptionsWrapper.prototype.isEnableCellExpressions = function () {
return isTrue(this.gridOptions.enableCellExpressions);
};
GridOptionsWrapper.prototype.isEnableGroupEdit = function () {
return isTrue(this.gridOptions.enableGroupEdit);
};
GridOptionsWrapper.prototype.isSuppressMiddleClickScrolls = function () {
return isTrue(this.gridOptions.suppressMiddleClickScrolls);
};
GridOptionsWrapper.prototype.isPreventDefaultOnContextMenu = function () {
return isTrue(this.gridOptions.preventDefaultOnContextMenu);
};
GridOptionsWrapper.prototype.isSuppressPreventDefaultOnMouseWheel = function () {
return isTrue(this.gridOptions.suppressPreventDefaultOnMouseWheel);
};
GridOptionsWrapper.prototype.isSuppressColumnVirtualisation = function () {
return isTrue(this.gridOptions.suppressColumnVirtualisation);
};
GridOptionsWrapper.prototype.isSuppressContextMenu = function () {
return isTrue(this.gridOptions.suppressContextMenu);
};
GridOptionsWrapper.prototype.isAllowContextMenuWithControlKey = function () {
return isTrue(this.gridOptions.allowContextMenuWithControlKey);
};
GridOptionsWrapper.prototype.isSuppressCopyRowsToClipboard = function () {
return isTrue(this.gridOptions.suppressCopyRowsToClipboard);
};
GridOptionsWrapper.prototype.isCopyHeadersToClipboard = function () {
return isTrue(this.gridOptions.copyHeadersToClipboard);
};
GridOptionsWrapper.prototype.isSuppressClipboardPaste = function () {
return isTrue(this.gridOptions.suppressClipboardPaste);
};
GridOptionsWrapper.prototype.isPagination = function () {
return isTrue(this.gridOptions.pagination);
};
GridOptionsWrapper.prototype.isSuppressEnterpriseResetOnNewColumns = function () {
return isTrue(this.gridOptions.suppressEnterpriseResetOnNewColumns);
};
GridOptionsWrapper.prototype.getProcessDataFromClipboardFunc = function () {
return this.gridOptions.processDataFromClipboard;
};
GridOptionsWrapper.prototype.getBatchUpdateWaitMillis = function () {
return utils_1._.exists(this.gridOptions.batchUpdateWaitMillis) ? this.gridOptions.batchUpdateWaitMillis : constants_1.Constants.BATCH_WAIT_MILLIS;
};
GridOptionsWrapper.prototype.isSuppressMovableColumns = function () {
return isTrue(this.gridOptions.suppressMovableColumns);
};
GridOptionsWrapper.prototype.isAnimateRows = function () {
// never allow animating if enforcing the row order
if (this.isEnsureDomOrder()) {
return false;
}
return isTrue(this.gridOptions.animateRows);
};
GridOptionsWrapper.prototype.isSuppressColumnMoveAnimation = function () {
return isTrue(this.gridOptions.suppressColumnMoveAnimation);
};
GridOptionsWrapper.prototype.isSuppressAggFuncInHeader = function () {
return isTrue(this.gridOptions.suppressAggFuncInHeader);
};
GridOptionsWrapper.prototype.isSuppressAggAtRootLevel = function () {
return isTrue(this.gridOptions.suppressAggAtRootLevel);
};
GridOptionsWrapper.prototype.isEnableRangeSelection = function () {
return this.enterprise && isTrue(this.gridOptions.enableRangeSelection);
};
GridOptionsWrapper.prototype.isEnableRangeHandle = function () {
return isTrue(this.gridOptions.enableRangeHandle);
};
GridOptionsWrapper.prototype.isEnableFillHandle = function () {
return isTrue(this.gridOptions.enableFillHandle);
};
GridOptionsWrapper.prototype.isSuppressMultiRangeSelection = function () {
return isTrue(this.gridOptions.suppressMultiRangeSelection);
};
GridOptionsWrapper.prototype.isPaginationAutoPageSize = function () {
return isTrue(this.gridOptions.paginationAutoPageSize);
};
GridOptionsWrapper.prototype.isRememberGroupStateWhenNewData = function () {
return isTrue(this.gridOptions.rememberGroupStateWhenNewData);
};
GridOptionsWrapper.prototype.getIcons = function () {
return this.gridOptions.icons;
};
GridOptionsWrapper.prototype.getAggFuncs = function () {
return this.gridOptions.aggFuncs;
};
GridOptionsWrapper.prototype.getSortingOrder = function () {
return this.gridOptions.sortingOrder;
};
GridOptionsWrapper.prototype.getAlignedGrids = function () {
return this.gridOptions.alignedGrids;
};
GridOptionsWrapper.prototype.isMasterDetail = function () {
var _this = this;
var usingMasterDetail = isTrue(this.gridOptions.masterDetail);
utils_1._.doOnce(function () {
if (usingMasterDetail && !_this.enterprise) {
console.warn('ag-grid: Master Detail is an Enterprise feature of ag-Grid.');
}
}, 'MasterDetailEnterpriseCheck');
return usingMasterDetail && this.enterprise;
};
GridOptionsWrapper.prototype.isKeepDetailRows = function () {
return isTrue(this.gridOptions.keepDetailRows);
};
GridOptionsWrapper.prototype.getKeepDetailRowsCount = function () {
if (this.gridOptions.keepDetailRowsCount > 0) {
return this.gridOptions.keepDetailRowsCount;
}
else {
return DEFAULT_KEEP_DETAIL_ROW_COUNT;
}
};
GridOptionsWrapper.prototype.getIsRowMasterFunc = function () {
return this.gridOptions.isRowMaster;
};
GridOptionsWrapper.prototype.getIsRowSelectableFunc = function () {
return this.gridOptions.isRowSelectable;
};
GridOptionsWrapper.prototype.getGroupRowRendererParams = function () {
return this.gridOptions.groupRowRendererParams;
};
GridOptionsWrapper.prototype.getOverlayLoadingTemplate = function () {
return this.gridOptions.overlayLoadingTemplate;
};
GridOptionsWrapper.prototype.getOverlayNoRowsTemplate = function () {
return this.gridOptions.overlayNoRowsTemplate;
};
GridOptionsWrapper.prototype.isSuppressAutoSize = function () {
return isTrue(this.gridOptions.suppressAutoSize);
};
GridOptionsWrapper.prototype.isEnableCellTextSelection = function () {
return isTrue(this.gridOptions.enableCellTextSelection);
};
GridOptionsWrapper.prototype.isSuppressParentsInRowNodes = function () {
return isTrue(this.gridOptions.suppressParentsInRowNodes);
};
GridOptionsWrapper.prototype.isFunctionsReadOnly = function () {
return isTrue(this.gridOptions.functionsReadOnly);
};
GridOptionsWrapper.prototype.isFloatingFilter = function () {
return this.gridOptions.floatingFilter;
};
GridOptionsWrapper.prototype.isEnableCellTextSelect = function () {
return isTrue(this.gridOptions.enableCellTextSelection);
};
GridOptionsWrapper.prototype.isEnableOldSetFilterModel = function () {
return isTrue(this.gridOptions.enableOldSetFilterModel);
};
GridOptionsWrapper.prototype.getDefaultColDef = function () {
return this.gridOptions.defaultColDef;
};
GridOptionsWrapper.prototype.getDefaultColGroupDef = function () {
return this.gridOptions.defaultColGroupDef;
};
GridOptionsWrapper.prototype.getDefaultExportParams = function () {
return this.gridOptions.defaultExportParams;
};
GridOptionsWrapper.prototype.isSuppressCsvExport = function () {
return isTrue(this.gridOptions.suppressCsvExport);
};
GridOptionsWrapper.prototype.isAllowShowChangeAfterFilter = function () {
return isTrue(this.gridOptions.allowShowChangeAfterFilter);
};
GridOptionsWrapper.prototype.isSuppressExcelExport = function () {
return isTrue(this.gridOptions.suppressExcelExport);
};
GridOptionsWrapper.prototype.isSuppressMakeColumnVisibleAfterUnGroup = function () {
return isTrue(this.gridOptions.suppressMakeColumnVisibleAfterUnGroup);
};
GridOptionsWrapper.prototype.getNodeChildDetailsFunc = function () {
return this.gridOptions.getNodeChildDetails;
};
GridOptionsWrapper.prototype.getDataPathFunc = function () {
return this.gridOptions.getDataPath;
};
GridOptionsWrapper.prototype.getIsServerSideGroupFunc = function () {
return this.gridOptions.isServerSideGroup;
};
GridOptionsWrapper.prototype.getServerSideGroupKeyFunc = function () {
return this.gridOptions.getServerSideGroupKey;
};
GridOptionsWrapper.prototype.getGroupRowAggNodesFunc = function () {
return this.gridOptions.groupRowAggNodes;
};
GridOptionsWrapper.prototype.getContextMenuItemsFunc = function () {
return this.gridOptions.getContextMenuItems;
};
GridOptionsWrapper.prototype.getMainMenuItemsFunc = function () {
return this.gridOptions.getMainMenuItems;
};
GridOptionsWrapper.prototype.getChartToolbarItemsFunc = function () {
return this.gridOptions.getChartToolbarItems;
};
GridOptionsWrapper.prototype.getRowNodeIdFunc = function () {
return this.gridOptions.getRowNodeId;
};
GridOptionsWrapper.prototype.getNavigateToNextCellFunc = function () {
return this.gridOptions.navigateToNextCell;
};
GridOptionsWrapper.prototype.getTabToNextCellFunc = function () {
return this.gridOptions.tabToNextCell;
};
GridOptionsWrapper.prototype.isTreeData = function () {
var _this = this;
var usingTreeData = isTrue(this.gridOptions.treeData);
utils_1._.doOnce(function () {
if (usingTreeData && !_this.enterprise) {
console.warn('ag-grid: TreeData is an Enterprise feature of ag-Grid.');
}
}, 'TreeDataEnterpriseCheck');
return usingTreeData;
};
GridOptionsWrapper.prototype.isValueCache = function () {
return isTrue(this.gridOptions.valueCache);
};
GridOptionsWrapper.prototype.isValueCacheNeverExpires = function () {
return isTrue(this.gridOptions.valueCacheNeverExpires);
};
GridOptionsWrapper.prototype.isDeltaSort = function () {
return isTrue(this.gridOptions.deltaSort);
};
GridOptionsWrapper.prototype.isAggregateOnlyChangedColumns = function () {
return isTrue(this.gridOptions.aggregateOnlyChangedColumns);
};
GridOptionsWrapper.prototype.getProcessSecondaryColDefFunc = function () {
return this.gridOptions.processSecondaryColDef;
};
GridOptionsWrapper.prototype.getProcessSecondaryColGroupDefFunc = function () {
return this.gridOptions.processSecondaryColGroupDef;
};
GridOptionsWrapper.prototype.getSendToClipboardFunc = function () {
return this.gridOptions.sendToClipboard;
};
GridOptionsWrapper.prototype.getProcessRowPostCreateFunc = function () {
return this.gridOptions.processRowPostCreate;
};
GridOptionsWrapper.prototype.getProcessCellForClipboardFunc = function () {
return this.gridOptions.processCellForClipboard;
};
GridOptionsWrapper.prototype.getProcessHeaderForClipboardFunc = function () {
return this.gridOptions.processHeaderForClipboard;
};
GridOptionsWrapper.prototype.getProcessCellFromClipboardFunc = function () {
return this.gridOptions.processCellFromClipboard;
};
GridOptionsWrapper.prototype.getViewportRowModelPageSize = function () {
return oneOrGreater(this.gridOptions.viewportRowModelPageSize, DEFAULT_VIEWPORT_ROW_MODEL_PAGE_SIZE);
};
GridOptionsWrapper.prototype.getViewportRowModelBufferSize = function () {
return zeroOrGreater(this.gridOptions.viewportRowModelBufferSize, DEFAULT_VIEWPORT_ROW_MODEL_BUFFER_SIZE);
};
// public getCellRenderers(): {[key: string]: {new(): ICellRenderer} | ICellRendererFunc} { return this.gridOptions.cellRenderers; }
// public getCellEditors(): {[key: string]: {new(): ICellEditor}} { return this.gridOptions.cellEditors; }
GridOptionsWrapper.prototype.isServerSideSortingAlwaysResets = function () {
return isTrue(this.gridOptions.serverSideSortingAlwaysResets);
};
GridOptionsWrapper.prototype.getPostSortFunc = function () {
return this.gridOptions.postSort;
};
GridOptionsWrapper.prototype.getProcessChartOptionsFunc = function () {
return this.gridOptions.processChartOptions;
};
GridOptionsWrapper.prototype.getClipboardDeliminator = function () {
return utils_1._.exists(this.gridOptions.clipboardDeliminator) ? this.gridOptions.clipboardDeliminator : '\t';
};
GridOptionsWrapper.prototype.setProperty = function (key, value) {
var gridOptionsNoType = this.gridOptions;
var previousValue = gridOptionsNoType[key];
if (previousValue !== value) {
gridOptionsNoType[key] = value;
var event_1 = {
type: key,
currentValue: value,
previousValue: previousValue
};
this.propertyEventService.dispatchEvent(event_1);
}
};
// this logic is repeated in lots of places. any element that had different CSS
// dependent on the layout needs to have the layout class added ot it.
GridOptionsWrapper.prototype.addLayoutElement = function (element) {
this.layoutElements.push(element);
this.updateLayoutClasses();
};
GridOptionsWrapper.prototype.updateLayoutClasses = function () {
var domLayout = this.getDomLayout();
var domLayoutAutoHeight = domLayout === constants_1.Constants.DOM_LAYOUT_AUTO_HEIGHT;
var domLayoutPrint = domLayout === constants_1.Constants.DOM_LAYOUT_PRINT;
var domLayoutNormal = domLayout === constants_1.Constants.DOM_LAYOUT_NORMAL;
this.layoutElements.forEach(function (e) {
utils_1._.addOrRemoveCssClass(e, 'ag-layout-auto-height', domLayoutAutoHeight);
utils_1._.addOrRemoveCssClass(e, 'ag-layout-normal', domLayoutNormal);
utils_1._.addOrRemoveCssClass(e, 'ag-layout-print', domLayoutPrint);
});
};
GridOptionsWrapper.prototype.addEventListener = function (key, listener) {
GridOptionsWrapper_1.checkEventDeprecation(key);
this.propertyEventService.addEventListener(key, listener);
};
GridOptionsWrapper.checkEventDeprecation = function (eventName) {
if (eventName === 'floatingRowDataChanged') {
console.warn('ag-Grid: floatingRowDataChanged is now called pinnedRowDataChanged');
}
};
GridOptionsWrapper.prototype.removeEventListener = function (key, listener) {
this.propertyEventService.removeEventListener(key, listener);
};
GridOptionsWrapper.prototype.getAutoSizePadding = function () {
return this.gridOptions.autoSizePadding && this.gridOptions.autoSizePadding > 0 ? this.gridOptions.autoSizePadding : 20;
};
// properties
GridOptionsWrapper.prototype.getHeaderHeight = function () {
if (typeof this.gridOptions.headerHeight === 'number') {
return this.gridOptions.headerHeight;
}
return this.specialForNewMaterial(25, 'headerHeight');
};
GridOptionsWrapper.prototype.getFloatingFiltersHeight = function () {
if (typeof this.gridOptions.floatingFiltersHeight === 'number') {
return this.gridOptions.floatingFiltersHeight;
}
return this.specialForNewMaterial(25, 'headerHeight');
};
GridOptionsWrapper.prototype.getGroupHeaderHeight = function () {
if (typeof this.gridOptions.groupHeaderHeight === 'number') {
return this.gridOptions.groupHeaderHeight;
}
return this.getHeaderHeight();
};
GridOptionsWrapper.prototype.getPivotHeaderHeight = function () {
if (typeof this.gridOptions.pivotHeaderHeight === 'number') {
return this.gridOptions.pivotHeaderHeight;
}
return this.getHeaderHeight();
};
GridOptionsWrapper.prototype.getPivotGroupHeaderHeight = function () {
if (typeof this.gridOptions.pivotGroupHeaderHeight === 'number') {
return this.gridOptions.pivotGroupHeaderHeight;
}
return this.getGroupHeaderHeight();
};
GridOptionsWrapper.prototype.isExternalFilterPresent = function () {
if (typeof this.gridOptions.isExternalFilterPresent === 'function') {
return this.gridOptions.isExternalFilterPresent();
}
return false;
};
GridOptionsWrapper.prototype.doesExternalFilterPass = function (node) {
if (typeof this.gridOptions.doesExternalFilterPass === 'function') {
return this.gridOptions.doesExternalFilterPass(node);
}
return false;
};
GridOptionsWrapper.prototype.getDocument = function () {
// if user is providing document, we use the users one,
// otherwise we use the document on the global namespace.
var result = null;
if (this.gridOptions.getDocument && utils_1._.exists(this.gridOptions.getDocument)) {
result = this.gridOptions.getDocument();
}
if (result && utils_1._.exists(result)) {
return result;
}
return document;
};
GridOptionsWrapper.prototype.getMinColWidth = function () {
if (this.gridOptions.minColWidth && (this.gridOptions.minColWidth > GridOptionsWrapper_1.MIN_COL_WIDTH)) {
return this.gridOptions.minColWidth;
}
return GridOptionsWrapper_1.MIN_COL_WIDTH;
};
GridOptionsWrapper.prototype.getMaxColWidth = function () {
if (this.gridOptions.maxColWidth && (this.gridOptions.maxColWidth > GridOptionsWrapper_1.MIN_COL_WIDTH)) {
return this.gridOptions.maxColWidth;
}
return null;
};
GridOptionsWrapper.prototype.getColWidth = function () {
if (typeof this.gridOptions.colWidth !== 'number' || this.gridOptions.colWidth < GridOptionsWrapper_1.MIN_COL_WIDTH) {
return 200;
}
return this.gridOptions.colWidth;
};
GridOptionsWrapper.prototype.getRowBuffer = function () {
var rowBuffer = this.gridOptions.rowBuffer;
if (typeof rowBuffer === 'number') {
if (rowBuffer < 0) {
utils_1._.doOnce(function () { return console.warn("ag-Grid: rowBuffer should not be negative"); }, 'warn rowBuffer negative');
this.gridOptions.rowBuffer = rowBuffer = 0;
}
}
else {
rowBuffer = constants_1.Constants.ROW_BUFFER_SIZE;
}
return rowBuffer;
};
GridOptionsWrapper.prototype.getRowBufferInPixels = function () {
var rowsToBuffer = this.getRowBuffer();
var defaultRowHeight = this.getRowHeightAsNumber();
return rowsToBuffer * defaultRowHeight;
};
// the user might be using some non-standard scrollbar, eg a scrollbar that has zero
// width and overlays (like the Safari scrollbar, but presented in Chrome). so we
// allow the user to provide the scroll width before we work it out.
GridOptionsWrapper.prototype.getScrollbarWidth = function () {
if (this.scrollWidth == null) {
var useGridOptions = typeof this.gridOptions.scrollbarWidth === 'number' &&
this.gridOptions.scrollbarWidth >= 0;
this.scrollWidth = useGridOptions ? this.gridOptions.scrollbarWidth : utils_1._.getScrollbarWidth();
}
return this.scrollWidth;
};
GridOptionsWrapper.prototype.checkForDeprecated = function () {
var _this = this;
// casting to generic object, so typescript compiles even though
// we are looking for attributes that don't exist
var options = this.gridOptions;
if (options.suppressUnSort) {
console.warn('ag-grid: as of v1.12.4 suppressUnSort is not used. Please use sortingOrder instead.');
}
if (options.suppressDescSort) {
console.warn('ag-grid: as of v1.12.4 suppressDescSort is not used. Please use sortingOrder instead.');
}
if (options.groupAggFields) {
console.warn('ag-grid: as of v3 groupAggFields is not used. Please add appropriate agg fields to your columns.');
}
if (options.groupHidePivotColumns) {
console.warn('ag-grid: as of v3 groupHidePivotColumns is not used as pivot columns are now called rowGroup columns. Please refer to the documentation');
}
if (options.groupKeys) {
console.warn('ag-grid: as of v3 groupKeys is not used. You need to set rowGroupIndex on the columns to group. Please refer to the documentation');
}
if (typeof options.groupDefaultExpanded === 'boolean') {
console.warn('ag-grid: groupDefaultExpanded can no longer be boolean. for groupDefaultExpanded=true, use groupDefaultExpanded=9999 instead, to expand all the groups');
}
if (options.onRowDeselected || options.rowDeselected) {
console.warn('ag-grid: since version 3.4 event rowDeselected no longer exists, please check the docs');
}
if (options.rowsAlreadyGrouped) {
console.warn('ag-grid: since version 3.4 rowsAlreadyGrouped no longer exists, please use getNodeChildDetails() instead');
}
if (options.groupAggFunction) {
console.warn('ag-grid: since version 4.3.x groupAggFunction is now called groupRowAggNodes');
}
if (options.checkboxSelection) {
console.warn('ag-grid: since version 8.0.x checkboxSelection is not supported as a grid option. ' +
'If you want this on all columns, use defaultColDef instead and set it there');
}
if (options.paginationInitialRowCount) {
console.warn('ag-grid: since version 9.0.x paginationInitialRowCount is now called infiniteInitialRowCount');
}
if (options.infinitePageSize) {
console.warn('ag-grid: since version 9.0.x infinitePageSize is now called cacheBlockSize');
}
if (options.infiniteBlockSize) {
console.warn('ag-grid: since version 10.0.x infiniteBlockSize is now called cacheBlockSize');
}
if (options.maxPagesInCache) {
console.warn('ag-grid: since version 10.0.x maxPagesInCache is now called maxBlocksInCache');
}
if (options.paginationOverflowSize) {
console.warn('ag-grid: since version 10.0.x paginationOverflowSize is now called cacheOverflowSize');
}
// if (options.forPrint) {
// console.warn('ag-grid: since version 10.1.x, use property domLayout="forPrint" instead of forPrint=true');
// }
if (options.suppressMenuFilterPanel) {
console.warn("ag-grid: since version 11.0.x, use property colDef.menuTabs=['generalMenuTab','columnsMenuTab'] instead of suppressMenuFilterPanel=true");
}
if (options.suppressMenuMainPanel) {
console.warn("ag-grid: since version 11.0.x, use property colDef.menuTabs=['filterMenuTab','columnsMenuTab'] instead of suppressMenuMainPanel=true");
}
if (options.suppressMenuColumnPanel) {
console.warn("ag-grid: since version 11.0.x, use property colDef.menuTabs=['generalMenuTab','filterMenuTab'] instead of suppressMenuColumnPanel=true");
}
if (options.suppressUseColIdForGroups) {
console.warn("ag-grid: since version 11.0.x, this is not in use anymore. You should be able to remove it from your definition");
}
if (options.groupSuppressRow) {
console.warn("ag-grid: since version 18.2.x, 'groupSuppressRow' should not be used anymore. Instead remove row groups and perform custom sorting.");
}
if (options.groupColumnDef) {
console.warn("ag-grid: since version 11.0.x, groupColumnDef has been renamed, this property is now called autoGroupColumnDef. Please change your configuration accordingly");
}
if (options.slaveGrids) {
console.warn("ag-grid: since version 12.x, slaveGrids has been renamed, this property is now called alignedGrids. Please change your configuration accordingly");
}
if (options.floatingTopRowData) {
console.warn("ag-grid: since version 12.x, floatingTopRowData is now called pinnedTopRowData");
}
if (options.floatingBottomRowData) {
console.warn("ag-grid: since version 12.x, floatingBottomRowData is now called pinnedBottomRowData");
}
if (options.paginationStartPage) {
console.warn("ag-grid: since version 12.x, paginationStartPage is gone, please call api.paginationGoToPage(" + options.paginationStartPage + ") instead.");
}
if (options.getHeaderCellTemplate) {
console.warn("ag-grid: since version 15.x, getHeaderCellTemplate is gone, please check the header documentation on how to set header templates.");
}
if (options.headerCellTemplate) {
console.warn("ag-grid: since version 15.x, headerCellTemplate is gone, please check the header documentation on how to set header templates.");
}
if (options.headerCellRenderer) {
console.warn("ag-grid: since version 15.x, headerCellRenderer is gone, please check the header documentation on how to set header templates.");
}
if (options.angularCompileHeaders) {
console.warn("ag-grid: since version 15.x, angularCompileHeaders is gone, please see the getting started for Angular 1 docs to see how to do headers in Angular 1.x.");
}
if (options.pivotTotals) {
console.warn("ag-grid: since version 18.x, pivotTotals has been removed, instead if using pivotTotals, set pivotColumnGroupTotals='before'|'after'.");
options.pivotColumnGroupTotals = 'before';
}
if (options.rowModelType === 'inMemory') {
console.warn("ag-grid: since version 18.x, The In Memory Row Model has been renamed to the Client Side Row Model, set rowModelType='clientSide' instead.");
options.rowModelType = 'clientSide';
}
if (options.rowModelType === 'enterprise') {
console.warn("ag-grid: since version 18.x, The Enterprise Row Model has been renamed to the Server Side Row Model, set rowModelType='serverSide' instead.");
options.rowModelType = 'serverSide';
}
if (options.layoutInterval) {
console.warn("ag-grid: since version 18.x, layoutInterval is no longer a property. This is because the grid now uses CSS Flex for layout.");
}
if (options.gridAutoHeight) {
console.warn("ag-grid: since version 19.x, gridAutoHeight is gone, please use domLayout=autoHeight instead");
options.domLayout = 'autoHeight';
}
if (options.showToolPanel === true) {
console.warn("ag-grid: since version 19.x, showToolPanel is gone, please specify toolPanel components. See https://www.ag-grid.com/javascript-grid-tool-panel/");
options.showToolPanel = undefined;
options.sideBar = options.sideBar || true;
}
if (options.showToolPanel === false) {
console.warn("ag-grid: since version 19.x, showToolPanel is gone, please specify toolPanel components. See https://www.ag-grid.com/javascript-grid-tool-panel/");
options.showToolPanel = undefined;
options.sideBar = options.sideBar || false;
}
var oldToolPanelProperties = {
toolPanelSuppressRowGroups: 'suppressRowGroups',
toolPanelSuppressValues: 'suppressValues',
toolPanelSuppressPivots: 'suppressPivots',
toolPanelSuppressPivotMode: 'suppressPivotMode',
toolPanelSuppressColumnFilter: 'suppressColumnFilter',
toolPanelSuppressColumnSelectAll: 'suppressColumnSelectAll',
toolPanelSuppressSideButtons: 'suppressSideButtons',
toolPanelSuppressColumnExpandAll: 'suppressColumnExpandAll',
contractColumnSelection: 'contractColumnSelection'
};
var toolPanelColumnsCompProps = {};
Object.keys(oldToolPanelProperties).forEach(function (key) {
var translation = oldToolPanelProperties[key];
var value = _this.gridOptions[key];
if (value !== undefined) {
if (key === 'toolPanelSuppressSideButtons') {
console.warn('ag-grid: since v19.0 toolPanelSuppressSideButtons has been completely removed. See https://www.ag-grid.com/javascript-grid-tool-panel/');
return;
}
console.warn("ag-grid: since v19.0 gridOptions." + key + " is deprecated, please use gridOptions.sideBar.toolPanel[columnsIndex].componentParams." + translation);
toolPanelColumnsCompProps[translation] = value;
}
});
if (Object.keys(toolPanelColumnsCompProps).length > 0 && !utils_1._.exists(options.sideBar)) {
console.warn("ag-grid: since version 19.x, sideBar is mandatory if using toolPanel related properties. See https://www.ag-grid.com/javascript-grid-tool-panel/");
options.sideBar = true;
}
if (options.sideBar != null) {
options.sideBar = sideBar_1.SideBarDefParser.parse(options.sideBar);
}
var sideBarDef = this.gridOptions.sideBar;
if (Object.keys(toolPanelColumnsCompProps).length > 0 && sideBarDef && sideBarDef.toolPanels) {
var columnsDef = (sideBarDef.toolPanels.filter(function (it) { return it.id === 'columns'; }));
if (columnsDef.length === 1) {
utils_1._.mergeDeep(columnsDef[0], {
componentParams: toolPanelColumnsCompProps
});
}
}
if (options.enableStatusBar) {
console.warn("ag-grid: since version 19.x, enableStatusBar is gone, please specify statusBar components");
options.statusBar = options.statusBar ||
{
components: [{ component: 'agAggregationComponent' }]
};
}
if (options.alwaysShowStatusBar) {
console.warn("ag-grid: since version 19.x, alwaysShowStatusBar is gone. Please specify a min-height on the ag-status-bar css class, eg .ag-status-bar {min-height: 35px; }");
}
if (options.enableServerSideSorting || options.enableSorting) {
console.warn("ag-Grid: since v20, grid options enableSorting and enableServerSideSorting are gone. Instead set sortable=true on the column definition for the columns sorting are allowed on. To migrate from gridOption.enableSorting=true, set gridOptions.defaultColDef.sortable=true");
if (!options.defaultColDef) {
options.defaultColDef = {};
}
if (!options.defaultColDef.sortable) {
options.defaultColDef.sortable = true;
}
}
if (options.enableFilter || options.enableServerSideFilter) {
console.warn("ag-Grid: since v20, grid options enableFilter and enableServerSideFilter are gone. Instead set filter=true (if not already specifying a specific filter) on the column definition for the columns filtering is allowed on. To migrate from gridOptions.enableFilter=true, set gridOptions.defaultColDef.filter=true. If you are explicitly setting specific filters for each column (ie colDef.filter is already set) the you don't need to do anything.");
if (!options.defaultColDef) {
options.defaultColDef = {};
}
if (!options.defaultColDef.filter) {
options.defaultColDef.filter = true;
}
}
if (options.enableColResize) {
console.warn("ag-Grid: since v20, grid options enableColResize is gone. Instead set resizable=true on the column definition for the columns resizing are allowed on. To migrate from gridOption.enableColResize=true, set gridOptions.defaultColDef.resizable=true");
if (!options.defaultColDef) {
options.defaultColDef = {};
}
if (!options.defaultColDef.resizable) {
options.defaultColDef.resizable = true;
}
}
if (options.deprecatedEmbedFullWidthRows) {
console.warn("ag-Grid: since v21.2, deprecatedEmbedFullWidthRows has been replaced with embedFullWidthRows.");
}
if (options.suppressTabbing) {
console.warn("ag-Grid: since v20.1, suppressTabbing is replaced with the more powerful grid callback suppressKeyboardEvent(params) which can suppress any keyboard event including tabbing.");
}
if (options.doesDataFlower) {
console.warn('ag-Grid: since v21.1, doesDataFlower is deprecated. Master/Detail is the new way for showing child data for a row and was introduced over a year ago. Please migrate your code to use master/detail instead.');
}
};
GridOptionsWrapper.prototype.checkForViolations = function () {
if (this.isTreeData()) {
this.treeDataViolations();
}
};
GridOptionsWrapper.prototype.treeDataViolations = function () {
if (this.isRowModelDefault()) {
if (utils_1._.missing(this.getDataPathFunc())) {
console.warn('ag-Grid: property usingTreeData=true with rowModel=clientSide, but you did not ' +
'provide getDataPath function, please provide getDataPath function if using tree data.');
}
}
if (this.isRowModelServerSide()) {
if (utils_1._.missing(this.getIsServerSideGroupFunc())) {
console.warn('ag-Grid: property usingTreeData=true with rowModel=serverSide, but you did not ' +
'provide isServerSideGroup function, please provide isServerSideGroup function if using tree data.');
}
if (utils_1._.missing(this.getServerSideGroupKeyFunc())) {
console.warn('ag-Grid: property usingTreeData=true with rowModel=serverSide, but you did not ' +
'provide getServerSideGroupKey function, please provide getServerSideGroupKey function if using tree data.');
}
}
};
GridOptionsWrapper.prototype.getLocaleTextFunc = function () {
if (this.gridOptions.localeTextFunc) {
return this.gridOptions.localeTextFunc;
}
var that = this;
return function (key, defaultValue) {
var localeText = that.gridOptions.localeText;
if (localeText && localeText[key]) {
return localeText[key];
}
return defaultValue;
};
};
// responsible for calling the onXXX functions on gridOptions
GridOptionsWrapper.prototype.globalEventHandler = function (eventName, event) {
var callbackMethodName = componentUtil_1.ComponentUtil.getCallbackForEvent(eventName);
if (typeof this.gridOptions[callbackMethodName] === 'function') {
this.gridOptions[callbackMethodName](event);
}
};
// we don't allow dynamic row height for virtual paging
GridOptionsWrapper.prototype.getRowHeightAsNumber = function () {
if (!this.gridOptions.rowHeight || utils_1._.missing(this.gridOptions.rowHeight)) {
return this.getDefaultRowHeight();
}
else if (this.gridOptions.rowHeight && this.isNumeric(this.gridOptions.rowHeight)) {
return this.gridOptions.rowHeight;
}
console.warn('ag-Grid row height must be a number if not using standard row model');
return this.getDefaultRowHeight();
};
GridOptionsWrapper.prototype.getRowHeightForNode = function (rowNode, allowEstimate) {
// check the function first, in case use set both function and
// number, when using virtual pagination then function can be
// used for pinned rows and the number for the body rows.
if (allowEstimate === void 0) { allowEstimate = false; }
if (typeof this.gridOptions.getRowHeight === 'function') {
if (allowEstimate) {
return { height: this.getDefaultRowHeight(), estimated: true };
}
var params = {
node: rowNode,
data: rowNode.data,
api: this.gridOptions.api,
context: this.gridOptions.context
};
return { height: this.gridOptions.getRowHeight(params), estimated: false };
}
else if (rowNode.detail && this.isMasterDetail()) {
if (this.isNumeric(this.gridOptions.detailRowHeight)) {
return { height: this.gridOptions.detailRowHeight, estimated: false };
}
else {
return { height: DEFAULT_DETAIL_ROW_HEIGHT, estimated: false };
}
}
var defaultRowHeight = this.getDefaultRowHeight();
var rowHeight = this.gridOptions.rowHeight && this.isNumeric(this.gridOptions.rowHeight) ?
this.gridOptions.rowHeight : defaultRowHeight;
var minRowHeight = Math.min(defaultRowHeight, rowHeight);
if (this.columnController.isAutoRowHeightActive()) {
if (allowEstimate) {
return { height: rowHeight, estimated: true };
}
var autoHeight = this.autoHeightCalculator.getPreferredHeightForRow(rowNode);
// never return less than the default row height - covers when auto height
// cells are blank.
return { height: Math.max(autoHeight, minRowHeight), estimated: false };
}
return { height: rowHeight, estimated: false };
};
GridOptionsWrapper.prototype.isDynamicRowHeight = function () {
return typeof this.gridOptions.getRowHeight === 'function';
};
GridOptionsWrapper.prototype.getVirtualItemHeight = function () {
return this.specialForNewMaterial(20, 'virtualItemHeight');
};
GridOptionsWrapper.prototype.isNumeric = function (value) {
return !isNaN(value) && typeof value === 'number';
};
// Material data table has strict guidelines about whitespace, and these values are different than the ones
// ag-grid uses by default. We override the default ones for the sake of making it better out of the box
GridOptionsWrapper.prototype.specialForNewMaterial = function (defaultValue, sassVariableName) {
var theme = this.environment.getTheme().theme;
if (theme && theme.indexOf('ag-theme') === 0) {
return this.environment.getSassVariable(theme, sassVariableName);
}
return defaultValue;
};
GridOptionsWrapper.prototype.getDefaultRowHeight = function () {
return this.specialForNewMaterial(DEFAULT_ROW_HEIGHT, 'rowHeight');
};
var GridOptionsWrapper_1;
GridOptionsWrapper.MIN_COL_WIDTH = 10;
GridOptionsWrapper.PROP_HEADER_HEIGHT = 'headerHeight';
GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN = 'groupRemoveSingleChildren';
GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN = 'groupRemoveLowestSingleChildren';
GridOptionsWrapper.PROP_PIVOT_HEADER_HEIGHT = 'pivotHeaderHeight';
GridOptionsWrapper.PROP_SUPPRESS_CLIPBOARD_PASTE = 'suppressClipboardPaste';
GridOptionsWrapper.PROP_GROUP_HEADER_HEIGHT = 'groupHeaderHeight';
GridOptionsWrapper.PROP_PIVOT_GROUP_HEADER_HEIGHT = 'pivotGroupHeaderHeight';
GridOptionsWrapper.PROP_FLOATING_FILTERS_HEIGHT = 'floatingFiltersHeight';
GridOptionsWrapper.PROP_SUPPRESS_ROW_DRAG = 'suppressRowDrag';
GridOptionsWrapper.PROP_POPUP_PARENT = 'popupParent';
GridOptionsWrapper.PROP_DOM_LAYOUT = 'domLayout';
__decorate([
context_1.Autowired('gridOptions'),
__metadata("design:type", Object)
], GridOptionsWrapper.prototype, "gridOptions", void 0);
__decorate([
context_1.Autowired('columnController'),
__metadata("design:type", columnController_1.ColumnController)
], GridOptionsWrapper.prototype, "columnController", void 0);
__decorate([
context_1.Autowired('eventService'),
__metadata("design:type", eventService_1.EventService)
], GridOptionsWrapper.prototype, "eventService", void 0);
__decorate([
context_1.Autowired('enterprise'),
__metadata("design:type", Boolean)
], GridOptionsWrapper.prototype, "enterprise", void 0);
__decorate([
context_1.Autowired('gridApi'),
__metadata("design:type", gridApi_1.GridApi)
], GridOptionsWrapper.prototype, "gridApi", void 0);
__decorate([
context_1.Autowired('columnApi'),
__metadata("design:type", columnApi_1.ColumnApi)
], GridOptionsWrapper.prototype, "columnApi", void 0);
__decorate([
context_1.Autowired('environment'),
__metadata("design:type", environment_1.Environment)
], GridOptionsWrapper.prototype, "environment", void 0);
__decorate([
context_1.Autowired('autoHeightCalculator'),
__metadata("design:type", autoHeightCalculator_1.AutoHeightCalculator)
], GridOptionsWrapper.prototype, "autoHeightCalculator", void 0);
__decorate([
context_1.Autowired('context'),
__metadata("design:type", context_1.Context)
], GridOptionsWrapper.prototype, "context", void 0);
__decorate([
__param(0, context_1.Qualifier('gridApi')), __param(1, context_1.Qualifier('columnApi')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [gridApi_1.GridApi, columnApi_1.ColumnApi]),
__metadata("design:returntype", void 0)
], GridOptionsWrapper.prototype, "agWire", null);
__decorate([
context_1.PreDestroy,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], GridOptionsWrapper.prototype, "destroy", null);
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], GridOptionsWrapper.prototype, "init", null);
GridOptionsWrapper = GridOptionsWrapper_1 = __decorate([
context_1.Bean('gridOptionsWrapper')
], GridOptionsWrapper);
return GridOptionsWrapper;
}());
exports.GridOptionsWrapper = GridOptionsWrapper;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(__webpack_require__(6));
__export(__webpack_require__(7));
__export(__webpack_require__(9));
__export(__webpack_require__(10));
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var Color = /** @class */ (function () {
/**
* Every color component should be in the [0, 1] range.
* Some easing functions (such as elastic easing) can overshoot the target value by some amount.
* So, when animating colors, if the source or target color components are already near
* or at the edge of the allowed [0, 1] range, it is possible for the intermediate color
* component value to end up outside of that range mid-animation. For this reason the constructor
* performs range checking/constraining.
* @param r Red component.
* @param g Green component.
* @param b Blue component.
* @param a Alpha (opacity) component.
*/
function Color(r, g, b, a) {
if (a === void 0) { a = 1; }
// NaN is treated as 0.
this.r = Math.min(1, Math.max(0, r || 0));
this.g = Math.min(1, Math.max(0, g || 0));
this.b = Math.min(1, Math.max(0, b || 0));
this.a = Math.min(1, Math.max(0, a || 0));
}
/**
* The given string can be in one of the following formats:
* - #rgb
* - #rrggbb
* - rgb(r, g, b)
* - rgba(r, g, b, a)
* - CSS color name such as 'white', 'orange', 'cyan', etc.
* @param str
*/
Color.fromString = function (str) {
// hexadecimal notation
if (str.indexOf('#') >= 0) { // there can be some leading whitespace
return Color.fromHexString(str);
}
// color name
var hex = Color.nameToHex[str];
if (hex) {
return Color.fromHexString(hex);
}
// rgb(a) notation
if (str.indexOf('rgb') >= 0) {
return Color.fromRgbaString(str);
}
throw new Error("Invalid color string: '" + str + "'");
};
// Using separate RegExp for the short hex notation because strings like `#abcd`
// are matched as ['#abcd', 'ab', 'c', 'd', undefined] when the `{1,2}` quantifier is used.
Color.fromHexString = function (str) {
var values = str.match(Color.hexRe);
if (values) {
var r = parseInt(values[1], 16);
var g = parseInt(values[2], 16);
var b = parseInt(values[3], 16);
var a = values[4] !== undefined ? parseInt(values[4], 16) : 255;
return new Color(r / 255, g / 255, b / 255, a / 255);
}
values = str.match(Color.shortHexRe);
if (values) {
var r = parseInt(values[1], 16);
var g = parseInt(values[2], 16);
var b = parseInt(values[3], 16);
var a = values[4] !== undefined ? parseInt(values[4], 16) : 15;
r += r * 16;
g += g * 16;
b += b * 16;
a += a * 16;
return new Color(r / 255, g / 255, b / 255, a / 255);
}
throw new Error("Malformed hexadecimal color string: '" + str + "'");
};
Color.fromRgbaString = function (str) {
var values = str.match(Color.rgbRe);
if (values) {
return new Color(+values[1] / 255, +values[2] / 255, +values[3] / 255);
}
values = str.match(Color.rgbaRe);
if (values) {
return new Color(+values[1] / 255, +values[2] / 255, +values[3] / 255, +values[4]);
}
throw new Error("Malformed rgb/rgba color string: '" + str + "'");
};
Color.fromArray = function (arr) {
if (arr.length === 4) {
return new Color(arr[0], arr[1], arr[2], arr[3]);
}
if (arr.length === 3) {
return new Color(arr[0], arr[1], arr[2]);
}
throw new Error('The given array should contain 3 or 4 color components (numbers).');
};
Color.fromHSB = function (h, s, b, alpha) {
if (alpha === void 0) { alpha = 1; }
var rgb = Color.HSBtoRGB(h, s, b);
return new Color(rgb[0], rgb[1], rgb[2], alpha);
};
Color.padHex = function (str) {
// Can't use `padStart(2, '0')` here because of IE.
return str.length === 1 ? '0' + str : str;
};
Color.prototype.toHexString = function () {
var hex = '#'
+ Color.padHex(Math.round(this.r * 255).toString(16))
+ Color.padHex(Math.round(this.g * 255).toString(16))
+ Color.padHex(Math.round(this.b * 255).toString(16));
if (this.a < 1) {
hex += Color.padHex(Math.round(this.a * 255).toString(16));
}
return hex;
};
Color.prototype.toRgbaString = function (fractionDigits) {
if (fractionDigits === void 0) { fractionDigits = 3; }
var components = [
Math.round(this.r * 255),
Math.round(this.g * 255),
Math.round(this.b * 255)
];
var k = Math.pow(10, fractionDigits);
if (this.a !== 1) {
components.push(Math.round(this.a * k) / k);
return "rgba(" + components.join(', ') + ")";
}
return "rgb(" + components.join(', ') + ")";
};
Color.prototype.toString = function () {
if (this.a === 1) {
return this.toHexString();
}
return this.toRgbaString();
};
Color.prototype.toHSB = function () {
return Color.RGBtoHSB(this.r, this.g, this.b);
};
/**
* Converts the given RGB triple to an array of HSB (HSV) components.
* The hue component will be `NaN` for achromatic colors.
*/
Color.RGBtoHSB = function (r, g, b) {
var min = Math.min(r, g, b);
var max = Math.max(r, g, b);
var S = max !== 0 ? (max - min) / max : 0;
var H = NaN;
// min == max, means all components are the same
// and the color is a shade of gray with no hue (H is NaN)
if (min !== max) {
var delta = max - min;
var rc = (max - r) / delta;
var gc = (max - g) / delta;
var bc = (max - b) / delta;
if (r === max) {
H = bc - gc;
}
else if (g === max) {
H = 2.0 + rc - bc;
}
else {
H = 4.0 + gc - rc;
}
H /= 6.0;
if (H < 0) {
H = H + 1.0;
}
}
return [H * 360, S, max];
};
/**
* Converts the given HSB (HSV) triple to an array of RGB components.
*/
Color.HSBtoRGB = function (H, S, B) {
if (isNaN(H)) {
H = 0;
}
H = (((H % 360) + 360) % 360) / 360; // normalize hue to [0, 360] interval, then scale to [0, 1]
var r = 0;
var g = 0;
var b = 0;
if (S === 0) {
r = g = b = B;
}
else {
var h = (H - Math.floor(H)) * 6;
var f = h - Math.floor(h);
var p = B * (1 - S);
var q = B * (1 - S * f);
var t = B * (1 - (S * (1 - f)));
switch (h >> 0) { // discard the floating point part of the number
case 0:
r = B;
g = t;
b = p;
break;
case 1:
r = q;
g = B;
b = p;
break;
case 2:
r = p;
g = B;
b = t;
break;
case 3:
r = p;
g = q;
b = B;
break;
case 4:
r = t;
g = p;
b = B;
break;
case 5:
r = B;
g = p;
b = q;
break;
}
}
return [r, g, b];
};
Color.prototype.derive = function (hueShift, saturationFactor, brightnessFactor, opacityFactor) {
var hsb = Color.RGBtoHSB(this.r, this.g, this.b);
var b = hsb[2];
if (b == 0 && brightnessFactor > 1.0) {
b = 0.05;
}
var h = (((hsb[0] + hueShift) % 360) + 360) % 360;
var s = Math.max(Math.min(hsb[1] * saturationFactor, 1.0), 0.0);
b = Math.max(Math.min(b * brightnessFactor, 1.0), 0.0);
var a = Math.max(Math.min(this.a * opacityFactor, 1.0), 0.0);
var rgba = Color.HSBtoRGB(h, s, b);
rgba.push(a);
return Color.fromArray(rgba);
};
Color.prototype.brighter = function () {
return this.derive(0, 1.0, 1.0 / 0.7, 1.0);
};
Color.prototype.darker = function () {
return this.derive(0, 1.0, 0.7, 1.0);
};
// See https://drafts.csswg.org/css-color/#hex-notation
Color.hexRe = /\s*#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?\s*$/;
Color.shortHexRe = /\s*#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?\s*$/;
Color.rgbRe = /\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)\s*/;
Color.rgbaRe = /\s*rgba\((\d+),\s*(\d+),\s*(\d+),\s*([.\d]+)\)\s*/;
/**
* CSS Color Module Level 4:
* https://drafts.csswg.org/css-color/#named-colors
*/
Color.nameToHex = Object.freeze({
aliceblue: '#F0F8FF',
antiquewhite: '#FAEBD7',
aqua: '#00FFFF',
aquamarine: '#7FFFD4',
azure: '#F0FFFF',
beige: '#F5F5DC',
bisque: '#FFE4C4',
black: '#000000',
blanchedalmond: '#FFEBCD',
blue: '#0000FF',
blueviolet: '#8A2BE2',
brown: '#A52A2A',
burlywood: '#DEB887',
cadetblue: '#5F9EA0',
chartreuse: '#7FFF00',
chocolate: '#D2691E',
coral: '#FF7F50',
cornflowerblue: '#6495ED',
cornsilk: '#FFF8DC',
crimson: '#DC143C',
cyan: '#00FFFF',
darkblue: '#00008B',
darkcyan: '#008B8B',
darkgoldenrod: '#B8860B',
darkgray: '#A9A9A9',
darkgreen: '#006400',
darkgrey: '#A9A9A9',
darkkhaki: '#BDB76B',
darkmagenta: '#8B008B',
darkolivegreen: '#556B2F',
darkorange: '#FF8C00',
darkorchid: '#9932CC',
darkred: '#8B0000',
darksalmon: '#E9967A',
darkseagreen: '#8FBC8F',
darkslateblue: '#483D8B',
darkslategray: '#2F4F4F',
darkslategrey: '#2F4F4F',
darkturquoise: '#00CED1',
darkviolet: '#9400D3',
deeppink: '#FF1493',
deepskyblue: '#00BFFF',
dimgray: '#696969',
dimgrey: '#696969',
dodgerblue: '#1E90FF',
firebrick: '#B22222',
floralwhite: '#FFFAF0',
forestgreen: '#228B22',
fuchsia: '#FF00FF',
gainsboro: '#DCDCDC',
ghostwhite: '#F8F8FF',
gold: '#FFD700',
goldenrod: '#DAA520',
gray: '#808080',
green: '#008000',
greenyellow: '#ADFF2F',
grey: '#808080',
honeydew: '#F0FFF0',
hotpink: '#FF69B4',
indianred: '#CD5C5C',
indigo: '#4B0082',
ivory: '#FFFFF0',
khaki: '#F0E68C',
lavender: '#E6E6FA',
lavenderblush: '#FFF0F5',
lawngreen: '#7CFC00',
lemonchiffon: '#FFFACD',
lightblue: '#ADD8E6',
lightcoral: '#F08080',
lightcyan: '#E0FFFF',
lightgoldenrodyellow: '#FAFAD2',
lightgray: '#D3D3D3',
lightgreen: '#90EE90',
lightgrey: '#D3D3D3',
lightpink: '#FFB6C1',
lightsalmon: '#FFA07A',
lightseagreen: '#20B2AA',
lightskyblue: '#87CEFA',
lightslategray: '#778899',
lightslategrey: '#778899',
lightsteelblue: '#B0C4DE',
lightyellow: '#FFFFE0',
lime: '#00FF00',
limegreen: '#32CD32',
linen: '#FAF0E6',
magenta: '#FF00FF',
maroon: '#800000',
mediumaquamarine: '#66CDAA',
mediumblue: '#0000CD',
mediumorchid: '#BA55D3',
mediumpurple: '#9370DB',
mediumseagreen: '#3CB371',
mediumslateblue: '#7B68EE',
mediumspringgreen: '#00FA9A',
mediumturquoise: '#48D1CC',
mediumvioletred: '#C71585',
midnightblue: '#191970',
mintcream: '#F5FFFA',
mistyrose: '#FFE4E1',
moccasin: '#FFE4B5',
navajowhite: '#FFDEAD',
navy: '#000080',
oldlace: '#FDF5E6',
olive: '#808000',
olivedrab: '#6B8E23',
orange: '#FFA500',
orangered: '#FF4500',
orchid: '#DA70D6',
palegoldenrod: '#EEE8AA',
palegreen: '#98FB98',
paleturquoise: '#AFEEEE',
palevioletred: '#DB7093',
papayawhip: '#FFEFD5',
peachpuff: '#FFDAB9',
peru: '#CD853F',
pink: '#FFC0CB',
plum: '#DDA0DD',
powderblue: '#B0E0E6',
purple: '#800080',
rebeccapurple: '#663399',
red: '#FF0000',
rosybrown: '#BC8F8F',
royalblue: '#4169E1',
saddlebrown: '#8B4513',
salmon: '#FA8072',
sandybrown: '#F4A460',
seagreen: '#2E8B57',
seashell: '#FFF5EE',
sienna: '#A0522D',
silver: '#C0C0C0',
skyblue: '#87CEEB',
slateblue: '#6A5ACD',
slategray: '#708090',
slategrey: '#708090',
snow: '#FFFAFA',
springgreen: '#00FF7F',
steelblue: '#4682B4',
tan: '#D2B48C',
teal: '#008080',
thistle: '#D8BFD8',
tomato: '#FF6347',
turquoise: '#40E0D0',
violet: '#EE82EE',
wheat: '#F5DEB3',
white: '#FFFFFF',
whitesmoke: '#F5F5F5',
yellow: '#FFFF00',
yellowgreen: '#9ACD32'
});
return Color;
}());
exports.Color = Color;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = __webpack_require__(8);
var FUNCTION_STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var FUNCTION_ARGUMENT_NAMES = /([^\s,]+)/g;
var AG_GRID_STOP_PROPAGATION = '__ag_Grid_Stop_Propagation';
/**
* HTML Escapes.
*/
var HTML_ESCAPES = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};
var reUnescapedHtml = /[&<>"']/g;
var Utils = /** @class */ (function () {
function Utils() {
}
/**
* When in IE or Edge, when you are editing a cell, then click on another cell,
* the other cell doesn't keep focus, so navigation keys, type to start edit etc
* don't work. appears that when you update the dom in IE it looses focus
* https://ag-grid.com/forum/showthread.php?tid=4362
* @param {HTMLElement} el
*/
Utils.doIeFocusHack = function (el) {
if (exports._.isBrowserIE() || exports._.isBrowserEdge()) {
if (exports._.missing(document.activeElement) || document.activeElement === document.body) {
// console.log('missing focus');
el.focus();
}
}
};
/**
* If the key was passed before, then doesn't execute the func
* @param {Function} func
* @param {string} key
*/
Utils.doOnce = function (func, key) {
if (this.doOnceFlags[key]) {
return;
}
func();
this.doOnceFlags[key] = true;
};
/**
* Checks if event was issued by a left click
* from https://stackoverflow.com/questions/3944122/detect-left-mouse-button-press
* @param {MouseEvent} mouseEvent
* @returns {boolean}
*/
Utils.isLeftClick = function (mouseEvent) {
if ("buttons" in mouseEvent) {
return mouseEvent.buttons == 1;
}
var button = mouseEvent.which || mouseEvent.button;
return button == 1;
};
/**
* `True` if the event is close to the original event by X pixels either vertically or horizontally.
* we only start dragging after X pixels so this allows us to know if we should start dragging yet.
* @param {MouseEvent | TouchEvent} e1
* @param {MouseEvent | TouchEvent} e2
* @param {number} pixelCount
* @returns {boolean}
*/
Utils.areEventsNear = function (e1, e2, pixelCount) {
// by default, we wait 4 pixels before starting the drag
if (pixelCount === 0) {
return false;
}
var diffX = Math.abs(e1.clientX - e2.clientX);
var diffY = Math.abs(e1.clientY - e2.clientY);
return Math.max(diffX, diffY) <= pixelCount;
};
Utils.jsonEquals = function (val1, val2) {
var val1Json = val1 ? JSON.stringify(val1) : null;
var val2Json = val2 ? JSON.stringify(val2) : null;
var res = val1Json === val2Json;
return res;
};
Utils.shallowCompare = function (arr1, arr2) {
// if both are missing, then they are the same
if (this.missing(arr1) && this.missing(arr2)) {
return true;
}
// if one is present, but other is missing, then then are different
if (this.missing(arr1) || this.missing(arr2)) {
return false;
}
if (arr1.length !== arr2.length) {
return false;
}
for (var i = 0; i < arr1.length; i++) {
if (arr1[i] !== arr2[i]) {
return false;
}
}
return true;
};
Utils.getNameOfClass = function (TheClass) {
var funcNameRegex = /function (.{1,})\(/;
var funcAsString = TheClass.toString();
var results = (funcNameRegex).exec(funcAsString);
return (results && results.length > 1) ? results[1] : "";
};
Utils.values = function (object) {
var result = [];
this.iterateObject(object, function (key, value) {
result.push(value);
});
return result;
};
Utils.getValueUsingField = function (data, field, fieldContainsDots) {
if (!field || !data) {
return;
}
// if no '.', then it's not a deep value
if (!fieldContainsDots) {
return data[field];
}
else {
// otherwise it is a deep value, so need to dig for it
var fields = field.split('.');
var currentObject = data;
for (var i = 0; i < fields.length; i++) {
currentObject = currentObject[fields[i]];
if (this.missing(currentObject)) {
return null;
}
}
return currentObject;
}
};
Utils.getElementSize = function (el) {
var _a = window.getComputedStyle(el), height = _a.height, width = _a.width, paddingTop = _a.paddingTop, paddingRight = _a.paddingRight, paddingBottom = _a.paddingBottom, paddingLeft = _a.paddingLeft, marginTop = _a.marginTop, marginRight = _a.marginRight, marginBottom = _a.marginBottom, marginLeft = _a.marginLeft, boxSizing = _a.boxSizing;
return {
height: parseFloat(height),
width: parseFloat(width),
paddingTop: parseFloat(paddingTop),
paddingRight: parseFloat(paddingRight),
paddingBottom: parseFloat(paddingBottom),
paddingLeft: parseFloat(paddingLeft),
marginTop: parseFloat(marginTop),
marginRight: parseFloat(marginRight),
marginBottom: parseFloat(marginBottom),
marginLeft: parseFloat(marginLeft),
boxSizing: boxSizing
};
};
Utils.getInnerHeight = function (el) {
var size = this.getElementSize(el);
if (size.boxSizing === 'border-box') {
return size.height - size.paddingTop - size.paddingBottom;
}
return size.height;
};
Utils.getInnerWidth = function (el) {
var size = this.getElementSize(el);
if (size.boxSizing === 'border-box') {
return size.width - size.paddingLeft - size.paddingRight;
}
return size.width;
};
Utils.getAbsoluteHeight = function (el) {
var size = this.getElementSize(el);
var marginRight = size.marginBottom + size.marginTop;
return Math.ceil(el.offsetHeight + marginRight);
};
Utils.getAbsoluteWidth = function (el) {
var size = this.getElementSize(el);
var marginWidth = size.marginLeft + size.marginRight;
return Math.ceil(el.offsetWidth + marginWidth);
};
Utils.getScrollLeft = function (element, rtl) {
var scrollLeft = element.scrollLeft;
if (rtl) {
// Absolute value - for FF that reports RTL scrolls in negative numbers
scrollLeft = Math.abs(scrollLeft);
// Get Chrome to return the same value as well
if (this.isBrowserChrome()) {
scrollLeft = element.scrollWidth - element.clientWidth - scrollLeft;
}
}
return scrollLeft;
};
Utils.cleanNumber = function (value) {
if (typeof value === 'string') {
value = parseInt(value, 10);
}
if (typeof value === 'number') {
value = Math.floor(value);
}
else {
value = null;
}
return value;
};
Utils.setScrollLeft = function (element, value, rtl) {
if (rtl) {
// Chrome and Safari when doing RTL have the END position of the scroll as zero, not the start
if (this.isBrowserSafari() || this.isBrowserChrome()) {
value = element.scrollWidth - element.clientWidth - value;
}
// Firefox uses negative numbers when doing RTL scrolling
if (this.isBrowserFirefox()) {
value *= -1;
}
}
element.scrollLeft = value;
};
Utils.iterateNamedNodeMap = function (map, callback) {
if (!map) {
return;
}
for (var i = 0; i < map.length; i++) {
var attr = map[i];
callback(attr.name, attr.value);
}
};
Utils.iterateObject = function (object, callback) {
if (!object || this.missing(object)) {
return;
}
if (Array.isArray(object)) {
object.forEach(function (value, index) {
callback(index + '', value);
});
}
else {
var keys = Object.keys(object);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var value = object[key];
callback(key, value);
}
}
};
Utils.cloneObject = function (object) {
var copy = {};
var keys = Object.keys(object);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var value = object[key];
copy[key] = value;
}
return copy;
};
Utils.deepCloneObject = function (object) {
return JSON.parse(JSON.stringify(object));
};
Utils.map = function (array, callback) {
var result = [];
for (var i = 0; i < array.length; i++) {
var item = array[i];
var mappedItem = callback(item, i);
result.push(mappedItem);
}
return result;
};
Utils.mapObject = function (object, callback) {
var result = [];
Utils.iterateObject(object, function (key, value) {
result.push(callback(value));
});
return result;
};
Utils.forEach = function (array, callback) {
if (!array) {
return;
}
for (var i = 0; i < array.length; i++) {
var value = array[i];
callback(value, i);
}
};
Utils.filter = function (array, callback) {
var result = [];
array.forEach(function (item) {
if (callback(item)) {
result.push(item);
}
});
return result;
};
Utils.getAllKeysInObjects = function (objects) {
var allValues = {};
objects.forEach(function (obj) {
if (obj) {
Object.keys(obj).forEach(function (key) { return allValues[key] = null; });
}
});
return Object.keys(allValues);
};
Utils.mergeDeep = function (dest, source) {
if (!this.exists(source)) {
return;
}
this.iterateObject(source, function (key, newValue) {
var oldValue = dest[key];
if (oldValue === newValue) {
return;
}
if (typeof oldValue === 'object' && typeof newValue === 'object') {
Utils.mergeDeep(oldValue, newValue);
}
else {
dest[key] = newValue;
}
});
};
Utils.assign = function (object) {
var _this = this;
var sources = [];
for (var _i = 1; _i < arguments.length; _i++) {
sources[_i - 1] = arguments[_i];
}
sources.forEach(function (source) {
if (_this.exists(source)) {
_this.iterateObject(source, function (key, value) {
object[key] = value;
});
}
});
return object;
};
Utils.flatten = function (arrayOfArrays) {
return [].concat.apply([], arrayOfArrays);
};
Utils.parseYyyyMmDdToDate = function (yyyyMmDd, separator) {
try {
if (!yyyyMmDd) {
return null;
}
if (yyyyMmDd.indexOf(separator) === -1) {
return null;
}
var fields = yyyyMmDd.split(separator);
if (fields.length != 3) {
return null;
}
return new Date(Number(fields[0]), Number(fields[1]) - 1, Number(fields[2]));
}
catch (e) {
return null;
}
};
Utils.serializeDateToYyyyMmDd = function (date, separator) {
if (!date) {
return null;
}
return date.getFullYear() + separator + Utils.pad(date.getMonth() + 1, 2) + separator + Utils.pad(date.getDate(), 2);
};
Utils.pad = function (num, totalStringSize) {
var asString = num + "";
while (asString.length < totalStringSize) {
asString = "0" + asString;
}
return asString;
};
Utils.pushAll = function (target, source) {
if (this.missing(source) || this.missing(target)) {
return;
}
source.forEach(function (func) { return target.push(func); });
};
Utils.createArrayOfNumbers = function (first, last) {
var result = [];
for (var i = first; i <= last; i++) {
result.push(i);
}
return result;
};
Utils.getFunctionParameters = function (func) {
var fnStr = func.toString().replace(FUNCTION_STRIP_COMMENTS, '');
var result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(FUNCTION_ARGUMENT_NAMES);
if (result === null) {
return [];
}
else {
return result;
}
};
Utils.find = function (collection, predicate, value) {
if (collection === null || collection === undefined) {
return null;
}
if (!Array.isArray(collection)) {
var objToArray = this.values(collection);
return this.find(objToArray, predicate, value);
}
var collectionAsArray = collection;
var firstMatchingItem = null;
for (var i = 0; i < collectionAsArray.length; i++) {
var item = collectionAsArray[i];
if (typeof predicate === 'string') {
if (item[predicate] === value) {
firstMatchingItem = item;
break;
}
}
else {
var callback = predicate;
if (callback(item)) {
firstMatchingItem = item;
break;
}
}
}
return firstMatchingItem;
};
Utils.toStrings = function (array) {
return this.map(array, function (item) {
if (item === undefined || item === null || !item.toString) {
return null;
}
else {
return item.toString();
}
});
};
Utils.iterateArray = function (array, callback) {
for (var index = 0; index < array.length; index++) {
var value = array[index];
callback(value, index);
}
};
Utils.findIndex = function (collection, predicate) {
for (var i = 0; i < collection.length; i++) {
if (predicate(collection[i], i, collection)) {
return i;
}
}
return -1;
};
/**
* Returns true if it is a DOM node
* taken from: http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
* @param {any} o
* @return {boolean}
*/
Utils.isNode = function (o) {
return (typeof Node === "function" ? o instanceof Node :
o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName === "string");
};
//
/**
* Returns true if it is a DOM element
* taken from: http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
* @param {any} o
* @returns {boolean}
*/
Utils.isElement = function (o) {
return (typeof HTMLElement === "function" ? o instanceof HTMLElement : //DOM2
o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string");
};
Utils.isNodeOrElement = function (o) {
return this.isNode(o) || this.isElement(o);
};
/**
* Makes a copy of a node list into a list
* @param {NodeList} nodeList
* @returns {Node[]}
*/
Utils.copyNodeList = function (nodeList) {
var childCount = nodeList ? nodeList.length : 0;
var res = [];
for (var i = 0; i < childCount; i++) {
res.push(nodeList[i]);
}
return res;
};
Utils.isEventFromPrintableCharacter = function (event) {
var pressedChar = String.fromCharCode(event.charCode);
// newline is an exception, as it counts as a printable character, but we don't
// want to start editing when it is pressed. without this check, if user is in chrome
// and editing a cell, and they press ctrl+enter, the cell stops editing, and then
// starts editing again with a blank value (two 'key down' events are fired). to
// test this, remove the line below, edit a cell in chrome and hit ctrl+enter while editing.
// https://ag-grid.atlassian.net/browse/AG-605
if (this.isKeyPressed(event, constants_1.Constants.KEY_NEW_LINE)) {
return false;
}
// no allowed printable chars have alt or ctrl key combinations
if (event.altKey || event.ctrlKey) {
return false;
}
if (exports._.exists(event.key)) {
// modern browser will implement key, so we return if key is length 1, eg if it is 'a' for the
// a key, or '2' for the '2' key. non-printable characters have names, eg 'Enter' or 'Backspace'.
var printableCharacter = event.key.length === 1;
// IE11 & Edge treat the numpad del key differently - with numlock on we get "Del" for key,
// so this addition checks if its IE11/Edge and handles that specific case the same was as all other browsers
var numpadDelWithNumlockOnForEdgeOrIe = Utils.isNumpadDelWithNumlockOnForEdgeOrIe(event);
return printableCharacter || numpadDelWithNumlockOnForEdgeOrIe;
}
else {
// otherwise, for older browsers, we test against a list of characters, which doesn't include
// accents for non-English, but don't care much, as most users are on modern browsers
return Utils.PRINTABLE_CHARACTERS.indexOf(pressedChar) >= 0;
}
};
/**
* Allows user to tell the grid to skip specific keyboard events
* @param {GridOptionsWrapper} gridOptionsWrapper
* @param {KeyboardEvent} keyboardEvent
* @param {RowNode} rowNode
* @param {Column} column
* @param {boolean} editing
* @returns {boolean}
*/
Utils.isUserSuppressingKeyboardEvent = function (gridOptionsWrapper, keyboardEvent, rowNode, column, editing) {
var gridOptionsFunc = gridOptionsWrapper.getSuppressKeyboardEventFunc();
var colDefFunc = column.getColDef().suppressKeyboardEvent;
// if no callbacks provided by user, then do nothing
if (!gridOptionsFunc && !colDefFunc) {
return false;
}
var params = {
event: keyboardEvent,
editing: editing,
column: column,
api: gridOptionsWrapper.getApi(),
node: rowNode,
data: rowNode.data,
colDef: column.getColDef(),
context: gridOptionsWrapper.getContext(),
columnApi: gridOptionsWrapper.getColumnApi()
};
// colDef get first preference on suppressing events
if (colDefFunc) {
var colDefFuncResult = colDefFunc(params);
// if colDef func suppressed, then return now, no need to call gridOption func
if (colDefFuncResult) {
return true;
}
}
if (gridOptionsFunc) {
// if gridOption func, return the result
return gridOptionsFunc(params);
}
else {
// otherwise return false, don't suppress, as colDef didn't suppress and no func on gridOptions
return false;
}
};
Utils.getCellCompForEvent = function (gridOptionsWrapper, event) {
var sourceElement = this.getTarget(event);
while (sourceElement) {
var renderedCell = gridOptionsWrapper.getDomData(sourceElement, 'cellComp');
if (renderedCell) {
return renderedCell;
}
sourceElement = sourceElement.parentElement;
}
return null;
};
/**
* Adds all type of change listeners to an element, intended to be a text field
* @param {HTMLElement} element
* @param {EventListener} listener
*/
Utils.addChangeListener = function (element, listener) {
element.addEventListener("changed", listener);
element.addEventListener("paste", listener);
element.addEventListener("input", listener);
// IE doesn't fire changed for special keys (eg delete, backspace), so need to
// listen for this further ones
element.addEventListener("keydown", listener);
element.addEventListener("keyup", listener);
};
/**
* If value is undefined, null or blank, returns null, otherwise returns the value
* @param {T} value
* @returns {T | null}
*/
Utils.makeNull = function (value) {
var valueNoType = value;
if (value === null || value === undefined || valueNoType === "") {
return null;
}
return value;
};
Utils.missing = function (value) {
return !this.exists(value);
};
Utils.missingOrEmpty = function (value) {
return !value || this.missing(value) || value.length === 0;
};
Utils.missingOrEmptyObject = function (value) {
return this.missing(value) || Object.keys(value).length === 0;
};
Utils.exists = function (value, allowEmptyString) {
if (allowEmptyString === void 0) { allowEmptyString = false; }
return value != null && (value !== '' || allowEmptyString);
};
Utils.firstExistingValue = function () {
var values = [];
for (var _i = 0; _i < arguments.length; _i++) {
values[_i] = arguments[_i];
}
for (var i = 0; i < values.length; i++) {
var value = values[i];
if (exports._.exists(value)) {
return value;
}
}
return null;
};
Utils.anyExists = function (values) {
if (values) {
for (var i = 0; i < values.length; i++) {
if (this.exists(values[i])) {
return true;
}
}
}
return false;
};
Utils.existsAndNotEmpty = function (value) {
return value != null && this.exists(value) && value.length > 0;
};
Utils.clearElement = function (el) {
while (el && el.firstChild) {
el.removeChild(el.firstChild);
}
};
Utils.removeElement = function (parent, cssSelector) {
this.removeFromParent(parent.querySelector(cssSelector));
};
Utils.removeFromParent = function (node) {
if (node && node.parentNode) {
node.parentNode.removeChild(node);
}
};
Utils.isVisible = function (element) {
return (element.offsetParent !== null);
};
Utils.callIfPresent = function (func) {
if (func) {
func();
}
};
/**
* Loads the template and returns it as an element. makes up for no simple way in
* the dom api to load html directly, eg we cannot do this: document.createElement(template)
* @param {string} template
* @returns {HTMLElement}
*/
Utils.loadTemplate = function (template) {
var tempDiv = document.createElement("div");
tempDiv.innerHTML = template;
return tempDiv.firstChild;
};
Utils.appendHtml = function (eContainer, htmlTemplate) {
if (eContainer.lastChild) {
// https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML
// we put the items at the start, so new items appear underneath old items,
// so when expanding/collapsing groups, the new rows don't go on top of the
// rows below that are moving our of the way
eContainer.insertAdjacentHTML('afterbegin', htmlTemplate);
}
else {
eContainer.innerHTML = htmlTemplate;
}
};
Utils.addOrRemoveCssClass = function (element, className, addOrRemove) {
if (addOrRemove) {
this.addCssClass(element, className);
}
else {
this.removeCssClass(element, className);
}
};
/**
* This method adds a class to an element and remove that class from all siblings.
* Useful for toggling state.
* @param {HTMLElement} element The element to receive the class
* @param {string} className The class to be assigned to the element
* @param {boolean} [inverted] This inverts the effect, adding the class to all siblings and
* removing from the relevant element (useful when adding a class to hide non-selected elements).
*/
Utils.radioCssClass = function (element, className, inverted) {
var parent = element.parentElement;
var sibling = parent.firstChild;
while (sibling) {
exports._.addOrRemoveCssClass(sibling, className, inverted ? (sibling !== element) : (sibling === element));
sibling = sibling.nextSibling;
}
};
Utils.addCssClass = function (element, className) {
var _this = this;
if (!className || className.length === 0) {
return;
}
if (className.indexOf(' ') >= 0) {
className.split(' ').forEach(function (value) { return _this.addCssClass(element, value); });
return;
}
if (element.classList) {
if (!element.classList.contains(className)) {
element.classList.add(className);
}
}
else {
if (element.className && element.className.length > 0) {
var cssClasses = element.className.split(' ');
if (cssClasses.indexOf(className) < 0) {
cssClasses.push(className);
element.setAttribute('class', cssClasses.join(' '));
}
}
else {
// do not use element.classList = className here, it will cause
// a read-only assignment error on some browsers (IE/Edge).
element.setAttribute('class', className);
}
}
};
Utils.removeCssClass = function (element, className) {
if (element.classList) {
if (element.classList.contains(className)) {
element.classList.remove(className);
}
}
else {
if (element.className && element.className.length > 0) {
var cssClasses = element.className.split(' ');
if (cssClasses.indexOf(className) >= 0) {
// remove all instances of the item, not just the first, in case it's in more than once
while (cssClasses.indexOf(className) >= 0) {
cssClasses.splice(cssClasses.indexOf(className), 1);
}
element.setAttribute('class', cssClasses.join(' '));
}
}
}
};
Utils.containsClass = function (element, className) {
if (element.classList) {
// for modern browsers
return element.classList.contains(className);
}
else if (element.className) {
// for older browsers, check against the string of class names
// if only one class, can check for exact match
var onlyClass = element.className === className;
// if many classes, check for class name, we have to pad with ' ' to stop other
// class names that are a substring of this class
var contains = element.className.indexOf(' ' + className + ' ') >= 0;
// the padding above then breaks when it's the first or last class names
var startsWithClass = element.className.indexOf(className + ' ') === 0;
var endsWithClass = element.className.lastIndexOf(' ' + className) === (element.className.length - className.length - 1);
return onlyClass || contains || startsWithClass || endsWithClass;
}
else {
// if item is not a node
return false;
}
};
Utils.getElementAttribute = function (element, attributeName) {
if (element.attributes) {
if (element.attributes[attributeName]) {
var attribute = element.attributes[attributeName];
return attribute.value;
}
else {
return null;
}
}
else {
return null;
}
};
Utils.offsetHeight = function (element) {
return element && element.clientHeight ? element.clientHeight : 0;
};
Utils.offsetWidth = function (element) {
return element && element.clientWidth ? element.clientWidth : 0;
};
Utils.sortNumberArray = function (numberArray) {
numberArray.sort(function (a, b) { return a - b; });
};
Utils.removeRepeatsFromArray = function (array, object) {
if (!array) {
return;
}
for (var index = array.length - 2; index >= 0; index--) {
var thisOneMatches = array[index] === object;
var nextOneMatches = array[index + 1] === object;
if (thisOneMatches && nextOneMatches) {
array.splice(index + 1, 1);
}
}
};
Utils.removeFromArray = function (array, object) {
var index = array.indexOf(object);
if (index >= 0) {
array.splice(index, 1);
}
};
Utils.removeAllFromArray = function (array, toRemove) {
toRemove.forEach(function (item) {
var index = array.indexOf(item);
if (index >= 0) {
array.splice(index, 1);
}
});
};
Utils.insertIntoArray = function (array, object, toIndex) {
array.splice(toIndex, 0, object);
};
Utils.insertArrayIntoArray = function (dest, src, toIndex) {
if (this.missing(dest) || this.missing(src)) {
return;
}
// put items in backwards, otherwise inserted items end up in reverse order
for (var i = src.length - 1; i >= 0; i--) {
var item = src[i];
this.insertIntoArray(dest, item, toIndex);
}
};
Utils.moveInArray = function (array, objectsToMove, toIndex) {
var _this = this;
// first take out it items from the array
objectsToMove.forEach(function (obj) {
_this.removeFromArray(array, obj);
});
// now add the objects, in same order as provided to us, that means we start at the end
// as the objects will be pushed to the right as they are inserted
objectsToMove.slice().reverse().forEach(function (obj) {
_this.insertIntoArray(array, obj, toIndex);
});
};
Utils.defaultComparator = function (valueA, valueB, accentedCompare) {
if (accentedCompare === void 0) { accentedCompare = false; }
var valueAMissing = valueA === null || valueA === undefined;
var valueBMissing = valueB === null || valueB === undefined;
// this is for aggregations sum and avg, where the result can be a number that is wrapped.
// if we didn't do this, then the toString() value would be used, which would result in
// the strings getting used instead of the numbers.
if (valueA && valueA.toNumber) {
valueA = valueA.toNumber();
}
if (valueB && valueB.toNumber) {
valueB = valueB.toNumber();
}
if (valueAMissing && valueBMissing) {
return 0;
}
if (valueAMissing) {
return -1;
}
if (valueBMissing) {
return 1;
}
if (typeof valueA === "string") {
if (!accentedCompare) {
return doQuickCompare(valueA, valueB);
}
else {
try {
// using local compare also allows chinese comparisons
return valueA.localeCompare(valueB);
}
catch (e) {
// if something wrong with localeCompare, eg not supported
// by browser, then just continue with the quick one
return doQuickCompare(valueA, valueB);
}
}
}
if (valueA < valueB) {
return -1;
}
else if (valueA > valueB) {
return 1;
}
else {
return 0;
}
function doQuickCompare(a, b) {
return (a > b ? 1 : (a < b ? -1 : 0));
}
};
Utils.last = function (arr) {
if (!arr || !arr.length) {
return undefined;
}
return arr[arr.length - 1];
};
Utils.compareArrays = function (array1, array2) {
if (this.missing(array1) && this.missing(array2)) {
return true;
}
if ((this.missing(array1) || this.missing(array2)) ||
(!array1 || !array2)) {
return false;
}
if (array1.length !== array2.length) {
return false;
}
for (var i = 0; i < array1.length; i++) {
if (array1[i] !== array2[i]) {
return false;
}
}
return true;
};
Utils.ensureDomOrder = function (eContainer, eChild, eChildBefore) {
// if already in right order, do nothing
if (eChildBefore && eChildBefore.nextSibling === eChild) {
return;
}
if (eChildBefore) {
if (eChildBefore.nextSibling) {
// insert between the eRowBefore and the row after it
eContainer.insertBefore(eChild, eChildBefore.nextSibling);
}
else {
// if nextSibling is missing, means other row is at end, so just append new row at the end
eContainer.appendChild(eChild);
}
}
else {
// otherwise put at start
if (eContainer.firstChild && eContainer.firstChild !== eChild) {
// insert it at the first location
eContainer.insertAdjacentElement('afterbegin', eChild);
}
}
};
Utils.insertWithDomOrder = function (eContainer, eChild, eChildBefore) {
if (eChildBefore) {
if (eChildBefore.nextSibling) {
// insert between the eRowBefore and the row after it
eContainer.insertBefore(eChild, eChildBefore.nextSibling);
}
else {
// if nextSibling is missing, means other row is at end, so just append new row at the end
eContainer.appendChild(eChild);
}
}
else {
if (eContainer.firstChild) {
// insert it at the first location
eContainer.insertBefore(eChild, eContainer.firstChild);
}
else {
// otherwise eContainer is empty, so just append it
eContainer.appendChild(eChild);
}
}
};
Utils.insertTemplateWithDomOrder = function (eContainer, htmlTemplate, eChildBefore) {
var res;
if (eChildBefore) {
// if previous element exists, just slot in after the previous element
eChildBefore.insertAdjacentHTML('afterend', htmlTemplate);
res = eChildBefore.nextSibling;
}
else {
if (eContainer.firstChild) {
// insert it at the first location
eContainer.insertAdjacentHTML('afterbegin', htmlTemplate);
}
else {
// otherwise eContainer is empty, so just append it
eContainer.innerHTML = htmlTemplate;
}
res = eContainer.firstChild;
}
return res;
};
Utils.every = function (items, callback) {
if (!items || items.length === 0) {
return true;
}
for (var i = 0; i < items.length; i++) {
if (!callback(items[i])) {
return false;
}
}
return true;
};
Utils.toStringOrNull = function (value) {
if (this.exists(value) && value.toString) {
return value.toString();
}
else {
return null;
}
};
Utils.formatSize = function (size) {
if (typeof size === "number") {
return size + "px";
}
else {
return size;
}
};
Utils.formatNumberTwoDecimalPlacesAndCommas = function (value) {
if (typeof value !== 'number') {
return '';
}
// took this from: http://blog.tompawlak.org/number-currency-formatting-javascript
return (Math.round(value * 100) / 100).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
};
/**
* the native method number.toLocaleString(undefined, {minimumFractionDigits: 0})
* puts in decimal places in IE, so we use this method instead
* from: http://blog.tompawlak.org/number-currency-formatting-javascript
* @param {number} value
* @returns {string}
*/
Utils.formatNumberCommas = function (value) {
if (typeof value !== 'number') {
return '';
}
return value.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
};
Utils.prependDC = function (parent, documentFragment) {
if (this.exists(parent.firstChild)) {
parent.insertBefore(documentFragment, parent.firstChild);
}
else {
parent.appendChild(documentFragment);
}
};
/**
* If icon provided, use this (either a string, or a function callback).
* if not, then use the default icon from the theme
* @param {string} iconName
* @param {GridOptionsWrapper} gridOptionsWrapper
* @param {Column | null} [column]
* @returns {HTMLElement}
*/
Utils.createIcon = function (iconName, gridOptionsWrapper, column) {
var iconContents = this.createIconNoSpan(iconName, gridOptionsWrapper, column);
if (iconContents.className.indexOf('ag-icon') > -1) {
return iconContents;
}
else {
var eResult = document.createElement('span');
eResult.appendChild(iconContents);
return eResult;
}
};
Utils.createIconNoSpan = function (iconName, gridOptionsWrapper, column, forceCreate) {
var userProvidedIcon = null;
// check col for icon first
var icons = column && column.getColDef().icons;
if (icons) {
userProvidedIcon = icons[iconName];
}
// if not in col, try grid options
if (gridOptionsWrapper && !userProvidedIcon) {
var optionsIcons = gridOptionsWrapper.getIcons();
if (optionsIcons) {
userProvidedIcon = optionsIcons[iconName];
}
}
// now if user provided, use it
if (userProvidedIcon) {
var rendererResult = void 0;
if (typeof userProvidedIcon === 'function') {
rendererResult = userProvidedIcon();
}
else if (typeof userProvidedIcon === 'string') {
rendererResult = userProvidedIcon;
}
else {
throw new Error('icon from grid options needs to be a string or a function');
}
if (typeof rendererResult === 'string') {
return this.loadTemplate(rendererResult);
}
else if (this.isNodeOrElement(rendererResult)) {
return rendererResult;
}
else {
throw new Error('iconRenderer should return back a string or a dom object');
}
}
else {
var span = document.createElement('span');
var cssClass = this.iconNameClassMap[iconName];
if (!cssClass) {
if (!forceCreate) {
throw new Error(iconName + " did not find class");
}
else {
cssClass = iconName;
}
}
span.setAttribute("class", "ag-icon ag-icon-" + cssClass);
span.setAttribute("unselectable", "on");
return span;
}
};
Utils.addStylesToElement = function (eElement, styles) {
var _this = this;
if (!styles) {
return;
}
Object.keys(styles).forEach(function (key) {
var keyCamelCase = _this.hyphenToCamelCase(key);
if (keyCamelCase) {
eElement.style[keyCamelCase] = styles[key];
}
});
};
Utils.isHorizontalScrollShowing = function (element) {
return element.clientWidth < element.scrollWidth;
};
Utils.isVerticalScrollShowing = function (element) {
return element.clientHeight < element.scrollHeight;
};
Utils.getMaxDivHeight = function () {
if (!document.body) {
return -1;
}
var res = 1000000;
// FF reports the height back but still renders blank after ~6M px
var testUpTo = navigator.userAgent.toLowerCase().match(/firefox/) ? 6000000 : 1000000000;
var div = this.loadTemplate("
");
document.body.appendChild(div);
while (true) {
var test = res * 2;
div.style.height = test + 'px';
if (test > testUpTo || div.clientHeight !== test) {
break;
}
else {
res = test;
}
}
document.body.removeChild(div);
return res;
};
Utils.getScrollbarWidth = function () {
var body = document.body;
var div = document.createElement("div");
div.style.width = div.style.height = "100px";
div.style.opacity = "0";
div.style.overflow = "scroll";
div.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
div.style.position = "absolute";
body.appendChild(div);
var width = div.offsetWidth - div.clientWidth;
// remove divs
if (div.parentNode) {
div.parentNode.removeChild(div);
}
return width;
};
Utils.hasOverflowScrolling = function () {
var prefixes = ['webkit', 'moz', 'o', 'ms'];
var div = document.createElement('div');
var body = document.getElementsByTagName('body')[0];
var found = false;
var p;
body.appendChild(div);
div.setAttribute('style', prefixes.map(function (prefix) { return "-" + prefix + "-overflow-scrolling: touch"; }).concat('overflow-scrolling: touch').join(';'));
var computedStyle = window.getComputedStyle(div);
if (computedStyle.overflowScrolling === 'touch') {
found = true;
}
if (!found) {
for (var _i = 0, prefixes_1 = prefixes; _i < prefixes_1.length; _i++) {
p = prefixes_1[_i];
if (computedStyle[p + "OverflowScrolling"] === 'touch') {
found = true;
break;
}
}
}
if (div.parentNode) {
div.parentNode.removeChild(div);
}
return found;
};
Utils.isKeyPressed = function (event, keyToCheck) {
var pressedKey = event.which || event.keyCode;
return pressedKey === keyToCheck;
};
Utils.isCharacterKey = function (event) {
// from: https://stackoverflow.com/questions/4179708/how-to-detect-if-the-pressed-key-will-produce-a-character-inside-an-input-text
var which = event.which;
if (typeof which === 'number' && which) {
return !event.ctrlKey && !event.metaKey && !event.altKey && event.which !== 8 && event.which !== 16;
}
return which === undefined;
};
Utils.setDisplayed = function (element, displayed) {
this.addOrRemoveCssClass(element, 'ag-hidden', !displayed);
};
Utils.setVisible = function (element, visible) {
this.addOrRemoveCssClass(element, 'ag-invisible', !visible);
};
Utils.setElementWidth = function (element, width) {
if (width === 'flex') {
element.style.width = null;
element.style.minWidth = null;
element.style.maxWidth = null;
element.style.flex = '1 1 auto';
}
else {
this.setFixedWidth(element, width);
}
};
Utils.setFixedWidth = function (element, width) {
width = this.formatSize(width);
element.style.width = width;
element.style.maxWidth = width;
element.style.minWidth = width;
};
Utils.setElementHeight = function (element, height) {
if (height === 'flex') {
element.style.height = null;
element.style.minHeight = null;
element.style.maxHeight = null;
element.style.flex = '1 1 auto';
}
else {
this.setFixedHeight(element, height);
}
};
Utils.setFixedHeight = function (element, height) {
height = this.formatSize(height);
element.style.height = height;
element.style.maxHeight = height;
element.style.minHeight = height;
};
Utils.isBrowserIE = function () {
if (this.isIE === undefined) {
this.isIE = /*@cc_on!@*/ false || !!document.documentMode; // At least IE6
}
return this.isIE;
};
Utils.isBrowserEdge = function () {
if (this.isEdge === undefined) {
this.isEdge = !this.isBrowserIE() && !!window.StyleMedia;
}
return this.isEdge;
};
Utils.isBrowserSafari = function () {
if (this.isSafari === undefined) {
var anyWindow = window;
// taken from https://github.com/ag-grid/ag-grid/issues/550
this.isSafari = Object.prototype.toString.call(anyWindow.HTMLElement).indexOf('Constructor') > 0
|| (function (p) {
return p ? p.toString() === "[object SafariRemoteNotification]" : false;
})(!anyWindow.safari || anyWindow.safari.pushNotification);
}
return this.isSafari;
};
Utils.isBrowserChrome = function () {
if (this.isChrome === undefined) {
var win = window;
this.isChrome = (!!win.chrome && (!!win.chrome.webstore || !!win.chrome.runtime)) ||
(/Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor));
}
return this.isChrome;
};
Utils.isBrowserFirefox = function () {
if (this.isFirefox === undefined) {
var win = window;
this.isFirefox = typeof win.InstallTrigger !== 'undefined';
}
return this.isFirefox;
};
Utils.isUserAgentIPad = function () {
if (this.isIPad === undefined) {
// taken from https://davidwalsh.name/detect-ipad
this.isIPad = navigator.userAgent.match(/iPad|iPhone/i) != null;
}
return this.isIPad;
};
/**
* srcElement is only available in IE. In all other browsers it is target
* http://stackoverflow.com/questions/5301643/how-can-i-make-event-srcelement-work-in-firefox-and-what-does-it-mean
* @param {Event} event
* @returns {Element}
*/
Utils.getTarget = function (event) {
var eventNoType = event;
return eventNoType.target || eventNoType.srcElement;
};
Utils.isElementChildOfClass = function (element, cls, maxNest) {
var counter = 0;
while (element) {
if (this.containsClass(element, cls)) {
return true;
}
element = element.parentElement;
if (maxNest && ++counter > maxNest) {
break;
}
}
return false;
};
Utils.isElementInEventPath = function (element, event) {
if (!event || !element) {
return false;
}
var path = exports._.getEventPath(event);
return path.indexOf(element) >= 0;
};
Utils.isFunction = function (val) {
return !!(val && val.constructor && val.call && val.apply);
};
Utils.createEventPath = function (event) {
var res = [];
var pointer = exports._.getTarget(event);
while (pointer) {
res.push(pointer);
pointer = pointer.parentElement;
}
return res;
};
/**
* firefox doesn't have event.path set, or any alternative to it, so we hack
* it in. this is needed as it's to late to work out the path when the item is
* removed from the dom. used by MouseEventService, where it works out if a click
* was from the current grid, or a detail grid (master / detail).
* @param {Event} event
*/
Utils.addAgGridEventPath = function (event) {
event.__agGridEventPath = this.getEventPath(event);
};
/**
* Gets the path for an Event.
* https://stackoverflow.com/questions/39245488/event-path-undefined-with-firefox-and-vue-js
* https://developer.mozilla.org/en-US/docs/Web/API/Event
* @param {Event} event
* @returns {EventTarget[]}
*/
Utils.getEventPath = function (event) {
var eventNoType = event;
if (eventNoType.deepPath) {
// IE supports deep path
return eventNoType.deepPath();
}
else if (eventNoType.path) {
// Chrome supports path
return eventNoType.path;
}
else if (eventNoType.composedPath) {
// Firefox supports composePath
return eventNoType.composedPath();
}
else if (eventNoType.__agGridEventPath) {
// Firefox supports composePath
return eventNoType.__agGridEventPath;
}
else {
// and finally, if none of the above worked,
// we create the path ourselves
return this.createEventPath(event);
}
};
Utils.forEachSnapshotFirst = function (list, callback) {
if (list) {
var arrayCopy = list.slice(0);
arrayCopy.forEach(callback);
}
};
/**
* Gets the document body width
* from: http://stackoverflow.com/questions/1038727/how-to-get-browser-width-using-javascript-code
* @returns {number}
*/
Utils.getBodyWidth = function () {
if (document.body) {
return document.body.clientWidth;
}
if (window.innerHeight) {
return window.innerWidth;
}
if (document.documentElement && document.documentElement.clientWidth) {
return document.documentElement.clientWidth;
}
return -1;
};
/**
* Gets the body height
* from: http://stackoverflow.com/questions/1038727/how-to-get-browser-width-using-javascript-code
* @returns {number}
*/
Utils.getBodyHeight = function () {
if (document.body) {
return document.body.clientHeight;
}
if (window.innerHeight) {
return window.innerHeight;
}
if (document.documentElement && document.documentElement.clientHeight) {
return document.documentElement.clientHeight;
}
return -1;
};
Utils.setCheckboxState = function (eCheckbox, state) {
if (typeof state === 'boolean') {
eCheckbox.checked = state;
eCheckbox.indeterminate = false;
}
else {
// isNodeSelected returns back undefined if it's a group and the children
// are a mix of selected and unselected
eCheckbox.indeterminate = true;
}
};
Utils.traverseNodesWithKey = function (nodes, callback) {
var keyParts = [];
recursiveSearchNodes(nodes);
function recursiveSearchNodes(currentNodes) {
currentNodes.forEach(function (node) {
// also checking for children for tree data
if (node.group || node.hasChildren()) {
keyParts.push(node.key);
var key = keyParts.join('|');
callback(node, key);
recursiveSearchNodes(node.childrenAfterGroup);
keyParts.pop();
}
});
}
};
/**
* Converts a camelCase string into hyphenated string
* from https://gist.github.com/youssman/745578062609e8acac9f
* @param {string} str
* @return {string}
*/
Utils.camelCaseToHyphen = function (str) {
if (str === null || str === undefined) {
return null;
}
return str.replace(/([A-Z])/g, function (g) { return '-' + g[0].toLowerCase(); });
};
/**
* Converts a hyphenated string into camelCase string
* from https://stackoverflow.com/questions/6660977/convert-hyphens-to-camel-case-camelcase
* @param {string} str
* @return {string}
*/
Utils.hyphenToCamelCase = function (str) {
if (str === null || str === undefined) {
return null;
}
return str.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
};
Utils.capitalise = function (str) {
return str[0].toUpperCase() + str.substr(1).toLowerCase();
};
/**
* Converts a CSS object into string
* @param {Object} stylesToUse an object eg: {color: 'black', top: '25px'}
* @return {string} A string like "color: black; top: 25px;" for html
*/
Utils.cssStyleObjectToMarkup = function (stylesToUse) {
var _this = this;
if (!stylesToUse) {
return '';
}
var resParts = [];
this.iterateObject(stylesToUse, function (styleKey, styleValue) {
var styleKeyDashed = _this.camelCaseToHyphen(styleKey);
resParts.push(styleKeyDashed + ": " + styleValue + ";");
});
return resParts.join(' ');
};
/**
* Check if a value is numeric
* from http://stackoverflow.com/questions/9716468/is-there-any-function-like-isnumeric-in-javascript-to-validate-numbers
* @param {any} value
* @return {boolean}
*/
Utils.isNumeric = function (value) {
if (value === '') {
return false;
}
return !isNaN(parseFloat(value)) && isFinite(value);
};
Utils.escape = function (toEscape) {
if (toEscape === null || toEscape === undefined || !toEscape.replace) {
return toEscape;
}
return toEscape.replace(reUnescapedHtml, function (chr) { return HTML_ESCAPES[chr]; });
};
/**
* Mouse wheel (and 2-finger trackpad) support on the web sucks. It is
* complicated, thus this doc is long and (hopefully) detailed enough to answer
* your questions.
*
* If you need to react to the mouse wheel in a predictable way, this code is
* like your bestest friend. * hugs *
*
* As of today, there are 4 DOM event types you can listen to:
*
* 'wheel' -- Chrome(31+), FF(17+), IE(9+)
* 'mousewheel' -- Chrome, IE(6+), Opera, Safari
* 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother!
* 'DOMMouseScroll' -- FF(0.9.7+) since 2003
*
* So what to do? The is the best:
*
* normalizeWheel.getEventType();
*
* In your event callback, use this code to get sane interpretation of the
* deltas. This code will return an object with properties:
*
* spinX -- normalized spin speed (use for zoom) - x plane
* spinY -- " - y plane
* pixelX -- normalized distance (to pixels) - x plane
* pixelY -- " - y plane
*
* Wheel values are provided by the browser assuming you are using the wheel to
* scroll a web page by a number of lines or pixels (or pages). Values can vary
* significantly on different platforms and browsers, forgetting that you can
* scroll at different speeds. Some devices (like trackpads) emit more events
* at smaller increments with fine granularity, and some emit massive jumps with
* linear speed or acceleration.
*
* This code does its best to normalize the deltas for you:
*
* - spin is trying to normalize how far the wheel was spun (or trackpad
* dragged). This is super useful for zoom support where you want to
* throw away the chunky scroll steps on the PC and make those equal to
* the slow and smooth tiny steps on the Mac. Key data: This code tries to
* resolve a single slow step on a wheel to 1.
*
* - pixel is normalizing the desired scroll delta in pixel units. You'll
* get the crazy differences between browsers, but at least it'll be in
* pixels!
*
* - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This
* should translate to positive value zooming IN, negative zooming OUT.
* This matches the newer 'wheel' event.
*
* Why are there spinX, spinY (or pixels)?
*
* - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn
* with a mouse. It results in side-scrolling in the browser by default.
*
* - spinY is what you expect -- it's the classic axis of a mouse wheel.
*
* - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and
* probably is by browsers in conjunction with fancy 3D controllers .. but
* you know.
*
* Implementation info:
*
* Examples of 'wheel' event if you scroll slowly (down) by one step with an
* average mouse:
*
* OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120)
* OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12)
* OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A)
* Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120)
* Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120)
*
* On the trackpad:
*
* OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6)
* OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A)
*
* On other/older browsers.. it's more complicated as there can be multiple and
* also missing delta values.
*
* The 'wheel' event is more standard:
*
* http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
*
* The basics is that it includes a unit, deltaMode (pixels, lines, pages), and
* deltaX, deltaY and deltaZ. Some browsers provide other values to maintain
* backward compatibility with older events. Those other values help us
* better normalize spin speed. Example of what the browsers provide:
*
* | event.wheelDelta | event.detail
* ------------------+------------------+--------------
* Safari v5/OS X | -120 | 0
* Safari v5/Win7 | -120 | 0
* Chrome v17/OS X | -120 | 0
* Chrome v17/Win7 | -120 | 0
* IE9/Win7 | -120 | undefined
* Firefox v4/OS X | undefined | 1
* Firefox v4/Win7 | undefined | 3
*
* from: https://github.com/facebook/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js
* @param {any} event
* @return {any}
*/
Utils.normalizeWheel = function (event) {
var PIXEL_STEP = 10;
var LINE_HEIGHT = 40;
var PAGE_HEIGHT = 800;
// spinX, spinY
var sX = 0;
var sY = 0;
// pixelX, pixelY
var pX = 0;
var pY = 0;
// Legacy
if ('detail' in event) {
sY = event.detail;
}
if ('wheelDelta' in event) {
sY = -event.wheelDelta / 120;
}
if ('wheelDeltaY' in event) {
sY = -event.wheelDeltaY / 120;
}
if ('wheelDeltaX' in event) {
sX = -event.wheelDeltaX / 120;
}
// side scrolling on FF with DOMMouseScroll
if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
sX = sY;
sY = 0;
}
pX = sX * PIXEL_STEP;
pY = sY * PIXEL_STEP;
if ('deltaY' in event) {
pY = event.deltaY;
}
if ('deltaX' in event) {
pX = event.deltaX;
}
if ((pX || pY) && event.deltaMode) {
if (event.deltaMode == 1) { // delta in LINE units
pX *= LINE_HEIGHT;
pY *= LINE_HEIGHT;
}
else { // delta in PAGE units
pX *= PAGE_HEIGHT;
pY *= PAGE_HEIGHT;
}
}
// Fall-back if spin cannot be determined
if (pX && !sX) {
sX = (pX < 1) ? -1 : 1;
}
if (pY && !sY) {
sY = (pY < 1) ? -1 : 1;
}
return {
spinX: sX,
spinY: sY,
pixelX: pX,
pixelY: pY
};
};
/**
* from https://stackoverflow.com/questions/24004791/can-someone-explain-the-debounce-function-in-javascript
* @param {Function} func The function to be debounced
* @param {number} wait The time in ms to debounce
* @param {boolean} immediate If it should run immediately or wait for the initial debounce delay
* @return {Function} The debounced function
*/
Utils.debounce = function (func, wait, immediate) {
if (immediate === void 0) { immediate = false; }
// 'private' variable for instance
// The returned function will be able to reference this due to closure.
// Each call to the returned function will share this common timer.
var timeout;
// Calling debounce returns a new anonymous function
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
// reference the context and args for the setTimeout function
var context = this;
// Should the function be called now? If immediate is true
// and not already in a timeout then the answer is: Yes
var callNow = immediate && !timeout;
// This is the basic debounce behaviour where you can call this
// function several times, but it will only execute once
// [before or after imposing a delay].
// Each time the returned function is called, the timer starts over.
window.clearTimeout(timeout);
// Set the new timeout
timeout = window.setTimeout(function () {
// Inside the timeout function, clear the timeout variable
// which will let the next execution run when in 'immediate' mode
timeout = null;
// Check if the function already ran with the immediate flag
if (!immediate) {
// Call the original function with apply
// apply lets you define the 'this' object as well as the arguments
// (both captured before setTimeout)
func.apply(context, args);
}
}, wait);
// Immediate mode and no wait timer? Execute the function..
if (callNow) {
func.apply(context, args);
}
};
};
/**
* a user once raised an issue - they said that when you opened a popup (eg context menu)
* and then clicked on a selection checkbox, the popup wasn't closed. this is because the
* popup listens for clicks on the body, however ag-grid WAS stopping propagation on the
* checkbox clicks (so the rows didn't pick them up as row selection selection clicks).
* to get around this, we have a pattern to stop propagation for the purposes of ag-Grid,
* but we still let the event pass back to teh body.
* @param {Event} event
*/
Utils.stopPropagationForAgGrid = function (event) {
event[AG_GRID_STOP_PROPAGATION] = true;
};
Utils.isStopPropagationForAgGrid = function (event) {
return event[AG_GRID_STOP_PROPAGATION] === true;
};
Utils.executeInAWhile = function (funcs) {
this.executeAfter(funcs, 400);
};
Utils.executeNextVMTurn = function (funcs) {
this.executeAfter(funcs, 0);
};
Utils.executeAfter = function (funcs, millis) {
if (funcs.length > 0) {
window.setTimeout(function () {
funcs.forEach(function (func) { return func(); });
}, millis);
}
};
Utils.referenceCompare = function (left, right) {
if (left == null && right == null) {
return true;
}
if (left == null && right) {
return false;
}
if (left && right == null) {
return false;
}
return left === right;
};
Utils.get = function (source, expression, defaultValue) {
if (source == null) {
return defaultValue;
}
if (expression.indexOf('.') > -1) {
var fields = expression.split('.');
var thisKey = fields[0];
var nextValue_1 = source[thisKey];
if (nextValue_1 != null) {
return Utils.get(nextValue_1, fields.slice(1, fields.length).join('.'), defaultValue);
}
return defaultValue;
}
var nextValue = source[expression];
return nextValue != null ? nextValue : defaultValue;
};
Utils.addSafePassiveEventListener = function (frameworkOverrides, eElement, event, listener) {
var isPassive = Utils.PASSIVE_EVENTS.indexOf(event) >= 0;
var isOutsideAngular = Utils.OUTSIDE_ANGULAR_EVENTS.indexOf(event) >= 0;
var options = isPassive ? { passive: true } : undefined;
if (isOutsideAngular) {
frameworkOverrides.addEventListenerOutsideAngular(eElement, event, listener, options);
}
else {
eElement.addEventListener(event, listener, options);
}
};
/**
* Converts a camelCase string into regular text
* from: https://stackoverflow.com/questions/15369566/putting-space-in-camel-case-string-using-regular-expression
* @param {string} camelCase
* @return {string}
*/
Utils.camelCaseToHumanText = function (camelCase) {
if (!camelCase || camelCase == null) {
return null;
}
var rex = /([A-Z])([A-Z])([a-z])|([a-z])([A-Z])/g;
var words = camelCase.replace(rex, '$1$4 $2$3$5').replace('.', ' ').split(' ');
return words.map(function (word) { return word.substring(0, 1).toUpperCase() + ((word.length > 1) ? word.substring(1, word.length) : ''); }).join(' ');
};
/**
* Displays a message to the browser. this is useful in iPad, where you can't easily see the console.
* so the javascript code can use this to give feedback. this is NOT intended to be called in production.
* it is intended the ag-Grid developer calls this to troubleshoot, but then takes out the calls before
* checking in.
* @param {string} msg
*/
Utils.message = function (msg) {
var eMessage = document.createElement('div');
eMessage.innerHTML = msg;
var eBox = document.querySelector('#__ag__message');
if (!eBox) {
var template = "";
eBox = this.loadTemplate(template);
if (document.body) {
document.body.appendChild(eBox);
}
}
eBox.insertBefore(eMessage, eBox.children[0]);
// eBox.appendChild(eMessage);
};
/**
* Gets called by: a) ClientSideNodeManager and b) GroupStage to do sorting.
* when in ClientSideNodeManager we always have indexes (as this sorts the items the
* user provided) but when in GroupStage, the nodes can contain filler nodes that
* don't have order id's
* @param {RowNode[]} rowNodes
* @param {Object} rowNodeOrder
*/
Utils.sortRowNodesByOrder = function (rowNodes, rowNodeOrder) {
if (!rowNodes) {
return;
}
var comparator = function (nodeA, nodeB) {
var positionA = rowNodeOrder[nodeA.id];
var positionB = rowNodeOrder[nodeB.id];
var aHasIndex = positionA !== undefined;
var bHasIndex = positionB !== undefined;
var bothNodesAreUserNodes = aHasIndex && bHasIndex;
var bothNodesAreFillerNodes = !aHasIndex && !bHasIndex;
if (bothNodesAreUserNodes) {
// when comparing two nodes the user has provided, they always
// have indexes
return positionA - positionB;
}
else if (bothNodesAreFillerNodes) {
// when comparing two filler nodes, we have no index to compare them
// against, however we want this sorting to be deterministic, so that
// the rows don't jump around as the user does delta updates. so we
// want the same sort result. so we use the __objectId - which doesn't make sense
// from a sorting point of view, but does give consistent behaviour between
// calls. otherwise groups jump around as delta updates are done.
// note: previously here we used nodeId, however this gave a strange order
// as string ordering of numbers is wrong, so using id based on creation order
// as least gives better looking order.
return nodeA.__objectId - nodeB.__objectId;
}
else if (aHasIndex) {
return 1;
}
return -1;
};
// const a = new Date().getTime();
// check if the list first needs sorting
var rowNodeA;
var rowNodeB;
var atLeastOneOutOfOrder = false;
for (var i = 0; i < rowNodes.length - 1; i++) {
rowNodeA = rowNodes[i];
rowNodeB = rowNodes[i + 1];
if (comparator(rowNodeA, rowNodeB) > 0) {
atLeastOneOutOfOrder = true;
break;
}
}
// const b = new Date().getTime();
if (atLeastOneOutOfOrder) {
rowNodes.sort(comparator);
}
// const c = new Date().getTime();
// console.log(`${this.count}: ${rowNodes.length} items, ${b-a}ms ${atLeastOneOutOfOrder} ${c-b}ms`);
};
Utils.fuzzyCheckStrings = function (inputValues, validValues, allSuggestions) {
var _this = this;
var fuzzyMatches = {};
var invalidInputs = inputValues.filter(function (inputValue) {
return !validValues.some(function (validValue) { return validValue === inputValue; });
});
if (invalidInputs.length > 0) {
invalidInputs.forEach(function (invalidInput) {
return fuzzyMatches[invalidInput] = _this.fuzzySuggestions(invalidInput, allSuggestions);
});
}
return fuzzyMatches;
};
/**
*
* @param {String} inputValue The value to be compared against a list of strings
* @param allSuggestions The list of strings to be compared against
* @param hideIrrelevant By default, fuzzy suggestions will just sort the allSuggestions list, set this to true
* to filter out the irrelevant values
* @param weighted Set this to true, to make letters matched in the order they were typed have priority in the results.
*/
Utils.fuzzySuggestions = function (inputValue, allSuggestions, hideIrrelevant, weighted) {
var search = weighted ? exports._.string_weighted_distances : exports._.string_distances;
var thisSuggestions = allSuggestions.map(function (text) { return ({
value: text,
relevance: search(inputValue.toLowerCase(), text.toLocaleLowerCase())
}); });
thisSuggestions.sort(function (a, b) {
return b.relevance - a.relevance;
});
if (hideIrrelevant) {
thisSuggestions = thisSuggestions.filter(function (suggestion) { return suggestion.relevance !== 0; });
}
return thisSuggestions.map(function (suggestion) { return suggestion.value; });
};
/**
* Algorithm to do fuzzy search
* from https://stackoverflow.com/questions/23305000/javascript-fuzzy-search-that-makes-sense
* @param {string} from
* @return {[]}
*/
Utils.get_bigrams = function (from) {
var s = from.toLowerCase();
var v = new Array(s.length - 1);
var i;
var j;
var ref;
for (i = j = 0, ref = v.length; j <= ref; i = j += 1) {
v[i] = s.slice(i, i + 2);
}
return v;
};
Utils.string_distances = function (str1, str2) {
if (str1.length === 0 && str2.length === 0) {
return 0;
}
var pairs1 = exports._.get_bigrams(str1);
var pairs2 = exports._.get_bigrams(str2);
var union = pairs1.length + pairs2.length;
var hit_count = 0;
var j;
var len;
for (j = 0, len = pairs1.length; j < len; j++) {
var x = pairs1[j];
var k = void 0;
var len1 = void 0;
for (k = 0, len1 = pairs2.length; k < len1; k++) {
var y = pairs2[k];
if (x === y) {
hit_count++;
}
}
}
return hit_count > 0 ? (2 * hit_count) / union : 0;
};
Utils.string_weighted_distances = function (str1, str2) {
var a = str1.replace(/\s/g, '');
var b = str2.replace(/\s/g, '');
var weight = 0;
var lastIndex = 0;
for (var i = 0; i < a.length; i++) {
var idx = b.indexOf(a[i]);
if (idx === -1) {
continue;
}
lastIndex = idx;
weight += ((b.length - lastIndex) * 100) / b.length;
weight *= weight;
}
return weight;
};
Utils.isNumpadDelWithNumlockOnForEdgeOrIe = function (event) {
if (Utils.isBrowserEdge() || Utils.isBrowserIE()) {
return event.key === Utils.NUMPAD_DEL_NUMLOCK_ON_KEY &&
event.charCode === Utils.NUMPAD_DEL_NUMLOCK_ON_CHARCODE;
}
return false;
};
/**
* cell renderers are used in a few places. they bind to dom slightly differently to other cell renderes as they
* can return back strings (instead of html elemnt) in the getGui() method. common code placed here to handle that.
* @param {Promise} cellRendererPromise
* @param {HTMLElement} eTarget
*/
Utils.bindCellRendererToHtmlElement = function (cellRendererPromise, eTarget) {
cellRendererPromise.then(function (cellRenderer) {
var gui = cellRenderer.getGui();
if (gui != null) {
if (typeof gui == 'object') {
eTarget.appendChild(gui);
}
else {
eTarget.innerHTML = gui;
}
}
});
};
Utils.PASSIVE_EVENTS = ['touchstart', 'touchend', 'touchmove', 'touchcancel'];
Utils.OUTSIDE_ANGULAR_EVENTS = ['mouseover', 'mouseout', 'mouseenter', 'mouseleave'];
Utils.PRINTABLE_CHARACTERS = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890!"£$%^&*()_+-=[];\'#,./\\|<>?:@~{}';
Utils.NUMPAD_DEL_NUMLOCK_ON_KEY = 'Del';
Utils.NUMPAD_DEL_NUMLOCK_ON_CHARCODE = 46;
Utils.doOnceFlags = {};
Utils.compose = function () {
var fns = [];
for (var _i = 0; _i < arguments.length; _i++) {
fns[_i] = arguments[_i];
}
return function (arg) { return fns.reduce(function (composed, f) { return f(composed); }, arg); };
};
Utils.decToHex = function (number, bytes) {
var hex = '';
for (var i = 0; i < bytes; i++) {
hex += String.fromCharCode(number & 0xff);
number >>>= 8;
}
return hex;
};
/**
* It encodes any string in UTF-8 format
* taken from https://github.com/mathiasbynens/utf8.js
* @param {string} s
* @returns {string}
*/
Utils.utf8_encode = function (s) {
var stringFromCharCode = String.fromCharCode;
function ucs2decode(string) {
var output = [];
var counter = 0;
var length = string.length;
var value;
var extra;
while (counter < length) {
value = string.charCodeAt(counter++);
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
// high surrogate, and there is a next character
extra = string.charCodeAt(counter++);
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
}
else {
// unmatched surrogate; only append this code unit, in case the next
// code unit is the high surrogate of a surrogate pair
output.push(value);
counter--;
}
}
else {
output.push(value);
}
}
return output;
}
function checkScalarValue(codePoint) {
if (codePoint >= 0xD800 && codePoint <= 0xDFFF) {
throw Error('Lone surrogate U+' + codePoint.toString(16).toUpperCase() +
' is not a scalar value');
}
}
function createByte(codePoint, shift) {
return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
}
function encodeCodePoint(codePoint) {
if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
return stringFromCharCode(codePoint);
}
var symbol = '';
if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
}
else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
checkScalarValue(codePoint);
symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
symbol += createByte(codePoint, 6);
}
else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
symbol += createByte(codePoint, 12);
symbol += createByte(codePoint, 6);
}
symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
return symbol;
}
var codePoints = ucs2decode(s);
var length = codePoints.length;
var index = -1;
var codePoint;
var byteString = '';
while (++index < length) {
codePoint = codePoints[index];
byteString += encodeCodePoint(codePoint);
}
return byteString;
};
Utils.iconNameClassMap = {
columnGroupOpened: 'expanded',
columnGroupClosed: 'contracted',
columnSelectClosed: 'tree-closed',
columnSelectOpen: 'tree-open',
columnSelectIndeterminate: 'tree-indeterminate',
columnMovePin: 'pin',
columnMoveAdd: 'plus',
columnMoveHide: 'eye-slash',
columnMoveMove: 'arrows',
columnMoveLeft: 'left',
columnMoveRight: 'right',
columnMoveGroup: 'group',
columnMoveValue: 'aggregation',
columnMovePivot: 'pivot',
dropNotAllowed: 'not-allowed',
groupContracted: 'expanded',
groupExpanded: 'contracted',
chart: 'chart',
close: 'cross',
cancel: 'cancel',
check: 'tick',
checkboxChecked: 'checkbox-checked',
checkboxUnchecked: 'checkbox-unchecked',
checkboxIndeterminate: 'checkbox-indeterminate',
checkboxCheckedReadOnly: 'checkbox-checked-readonly',
checkboxUncheckedReadOnly: 'checkbox-unchecked-readonly',
checkboxIndeterminateReadOnly: 'checkbox-indeterminate-readonly',
first: 'first',
previous: 'previous',
next: 'next',
last: 'last',
linked: 'linked',
unlinked: 'unlinked',
colorPicker: 'color-picker',
radioButtonOn: 'radio-button-on',
radioButtonOff: 'radio-button-off',
groupLoading: 'loading',
data: 'data',
menu: 'menu',
filter: 'filter',
columns: 'columns',
maximize: 'maximize',
minimize: 'minimize',
menuPin: 'pin',
menuValue: 'aggregation',
menuAddRowGroup: 'group',
menuRemoveRowGroup: 'group',
clipboardCopy: 'copy',
clipboardCut: 'cut',
clipboardPaste: 'paste',
pivotPanel: 'pivot',
rowGroupPanel: 'group',
valuePanel: 'aggregation',
columnDrag: 'grip',
rowDrag: 'grip',
save: 'save',
smallLeft: 'small-left',
smallRight: 'small-right',
smallUp: 'small-up',
smallDown: 'small-down',
sortAscending: 'asc',
sortDescending: 'desc',
sortUnSort: 'none'
};
return Utils;
}());
exports.Utils = Utils;
var NumberSequence = /** @class */ (function () {
function NumberSequence(initValue, step) {
if (initValue === void 0) { initValue = 0; }
if (step === void 0) { step = 1; }
this.nextValue = initValue;
this.step = step;
}
NumberSequence.prototype.next = function () {
var valToReturn = this.nextValue;
this.nextValue += this.step;
return valToReturn;
};
NumberSequence.prototype.peek = function () {
return this.nextValue;
};
NumberSequence.prototype.skip = function (count) {
this.nextValue += count;
};
return NumberSequence;
}());
exports.NumberSequence = NumberSequence;
exports._ = Utils;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var Constants = /** @class */ (function () {
function Constants() {
}
Constants.STEP_EVERYTHING = 0;
Constants.STEP_FILTER = 1;
Constants.STEP_SORT = 2;
Constants.STEP_MAP = 3;
Constants.STEP_AGGREGATE = 4;
Constants.STEP_PIVOT = 5;
Constants.ROW_BUFFER_SIZE = 10;
Constants.LAYOUT_INTERVAL = 500;
Constants.BATCH_WAIT_MILLIS = 50;
Constants.EXPORT_TYPE_DRAG_COPY = 'dragCopy';
Constants.EXPORT_TYPE_CLIPBOARD = 'clipboard';
Constants.EXPORT_TYPE_EXCEL = 'excel';
Constants.EXPORT_TYPE_CSV = 'csv';
Constants.KEY_BACKSPACE = 8;
Constants.KEY_TAB = 9;
Constants.KEY_NEW_LINE = 10;
Constants.KEY_ENTER = 13;
Constants.KEY_SHIFT = 16;
Constants.KEY_ESCAPE = 27;
Constants.KEY_SPACE = 32;
Constants.KEY_LEFT = 37;
Constants.KEY_UP = 38;
Constants.KEY_RIGHT = 39;
Constants.KEY_DOWN = 40;
Constants.KEY_DELETE = 46;
Constants.KEY_A = 65;
Constants.KEY_C = 67;
Constants.KEY_V = 86;
Constants.KEY_D = 68;
Constants.KEY_F2 = 113;
Constants.KEY_PAGE_UP = 33;
Constants.KEY_PAGE_DOWN = 34;
Constants.KEY_PAGE_HOME = 36;
Constants.KEY_PAGE_END = 35;
Constants.ROW_MODEL_TYPE_INFINITE = 'infinite';
Constants.ROW_MODEL_TYPE_VIEWPORT = 'viewport';
Constants.ROW_MODEL_TYPE_CLIENT_SIDE = 'clientSide';
Constants.ROW_MODEL_TYPE_SERVER_SIDE = 'serverSide';
Constants.DEPRECATED_ROW_MODEL_TYPE_NORMAL = 'normal';
Constants.ALWAYS = 'always';
Constants.ONLY_WHEN_GROUPING = 'onlyWhenGrouping';
Constants.PINNED_TOP = 'top';
Constants.PINNED_BOTTOM = 'bottom';
Constants.DOM_LAYOUT_NORMAL = 'normal';
Constants.DOM_LAYOUT_PRINT = 'print';
Constants.DOM_LAYOUT_AUTO_HEIGHT = 'autoHeight';
Constants.GROUP_AUTO_COLUMN_ID = 'ag-Grid-AutoColumn';
return Constants;
}());
exports.Constants = Constants;
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var PromiseStatus;
(function (PromiseStatus) {
PromiseStatus[PromiseStatus["IN_PROGRESS"] = 0] = "IN_PROGRESS";
PromiseStatus[PromiseStatus["RESOLVED"] = 1] = "RESOLVED";
})(PromiseStatus = exports.PromiseStatus || (exports.PromiseStatus = {}));
var Promise = /** @class */ (function () {
function Promise(callback) {
this.status = PromiseStatus.IN_PROGRESS;
this.resolution = null;
this.listOfWaiters = [];
callback(this.onDone.bind(this), this.onReject.bind(this));
}
Promise.all = function (toCombine) {
return new Promise(function (resolve) {
var combinedValues = [];
var remainingToResolve = toCombine.length;
toCombine.forEach(function (source, index) {
source.then(function (sourceResolved) {
remainingToResolve--;
combinedValues[index] = sourceResolved;
if (remainingToResolve == 0) {
resolve(combinedValues);
}
});
combinedValues.push(null); // spl todo: review with Alberto - why?
});
});
};
Promise.resolve = function (value) {
return new Promise(function (resolve) { return resolve(value); });
};
Promise.external = function () {
var capture;
var promise = new Promise(function (resolve) {
capture = resolve;
});
return {
promise: promise,
resolve: function (value) {
capture(value);
}
};
};
Promise.prototype.then = function (func) {
if (this.status === PromiseStatus.IN_PROGRESS) {
this.listOfWaiters.push(func);
}
else {
func(this.resolution);
}
};
Promise.prototype.firstOneOnly = function (func) {
if (this.status === PromiseStatus.IN_PROGRESS) {
if (this.listOfWaiters.length === 0) {
this.listOfWaiters.push(func);
}
}
else {
func(this.resolution);
}
};
Promise.prototype.map = function (adapter) {
var _this = this;
return new Promise(function (resolve) {
_this.then(function (unmapped) {
resolve(adapter(unmapped));
});
});
};
Promise.prototype.resolveNow = function (ifNotResolvedValue, ifResolved) {
if (this.status == PromiseStatus.IN_PROGRESS) {
return ifNotResolvedValue;
}
return ifResolved(this.resolution);
};
Promise.prototype.onDone = function (value) {
this.status = PromiseStatus.RESOLVED;
this.resolution = value;
this.listOfWaiters.forEach(function (waiter) { return waiter(value); });
};
Promise.prototype.onReject = function (params) {
console.warn('TBI');
};
return Promise;
}());
exports.Promise = Promise;
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* A Util Class only used when debugging for printing time to console
*/
var Timer = /** @class */ (function () {
function Timer() {
this.timestamp = new Date().getTime();
}
Timer.prototype.print = function (msg) {
var duration = (new Date().getTime()) - this.timestamp;
console.info(msg + " = " + duration);
this.timestamp = new Date().getTime();
};
return Timer;
}());
exports.Timer = Timer;
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
var logger_1 = __webpack_require__(12);
var context_1 = __webpack_require__(13);
var context_2 = __webpack_require__(13);
var gridOptionsWrapper_1 = __webpack_require__(4);
var utils_1 = __webpack_require__(5);
var EventService = /** @class */ (function () {
function EventService() {
this.allSyncListeners = {};
this.allAsyncListeners = {};
this.globalSyncListeners = [];
this.globalAsyncListeners = [];
this.asyncFunctionsQueue = [];
this.scheduled = false;
this.firedEvents = {};
}
EventService_1 = EventService;
// because this class is used both inside the context and outside the context, we do not
// use autowired attributes, as that would be confusing, as sometimes the attributes
// would be wired, and sometimes not.
//
// the global event servers used by ag-Grid is autowired by the context once, and this
// setBeans method gets called once.
//
// the times when this class is used outside of the context (eg RowNode has an instance of this
// class) then it is not a bean, and this setBeans method is not called.
EventService.prototype.setBeans = function (loggerFactory, gridOptionsWrapper, globalEventListener) {
if (globalEventListener === void 0) { globalEventListener = null; }
this.logger = loggerFactory.create('EventService');
if (globalEventListener) {
var async = gridOptionsWrapper.useAsyncEvents();
this.addGlobalListener(globalEventListener, async);
}
};
EventService.prototype.getListenerList = function (eventType, async) {
var listenerMap = async ? this.allAsyncListeners : this.allSyncListeners;
var listenerList = listenerMap[eventType];
if (!listenerList) {
listenerList = [];
listenerMap[eventType] = listenerList;
}
return listenerList;
};
EventService.prototype.addEventListener = function (eventType, listener, async) {
if (async === void 0) { async = false; }
var listenerList = this.getListenerList(eventType, async);
if (listenerList.indexOf(listener) < 0) {
listenerList.push(listener);
}
};
// for some events, it's important that the model gets to hear about them before the view,
// as the model may need to update before the view works on the info. if you register
// via this method, you get notified before the view parts
EventService.prototype.addModalPriorityEventListener = function (eventType, listener, async) {
if (async === void 0) { async = false; }
this.addEventListener(eventType + EventService_1.PRIORITY, listener, async);
};
EventService.prototype.addGlobalListener = function (listener, async) {
if (async === void 0) { async = false; }
if (async) {
this.globalAsyncListeners.push(listener);
}
else {
this.globalSyncListeners.push(listener);
}
};
EventService.prototype.removeEventListener = function (eventType, listener, async) {
if (async === void 0) { async = false; }
var listenerList = this.getListenerList(eventType, async);
utils_1._.removeFromArray(listenerList, listener);
};
EventService.prototype.removeGlobalListener = function (listener, async) {
if (async === void 0) { async = false; }
if (async) {
utils_1._.removeFromArray(this.globalAsyncListeners, listener);
}
else {
utils_1._.removeFromArray(this.globalSyncListeners, listener);
}
};
// why do we pass the type here? the type is in ColumnChangeEvent, so unless the
// type is not in other types of events???
EventService.prototype.dispatchEvent = function (event) {
// console.log(`dispatching ${eventType}: ${event}`);
this.dispatchToListeners(event, true);
this.dispatchToListeners(event, false);
this.firedEvents[event.type] = true;
};
EventService.prototype.dispatchEventOnce = function (event) {
if (!this.firedEvents[event.type]) {
this.dispatchEvent(event);
}
};
EventService.prototype.dispatchToListeners = function (event, async) {
var _this = this;
var globalListeners = async ? this.globalAsyncListeners : this.globalSyncListeners;
var eventType = event.type;
// this allows the columnController to get events before anyone else
var p1ListenerList = this.getListenerList(eventType + EventService_1.PRIORITY, async);
utils_1._.forEachSnapshotFirst(p1ListenerList, function (listener) {
if (async) {
_this.dispatchAsync(function () { return listener(event); });
}
else {
listener(event);
}
});
var listenerList = this.getListenerList(eventType, async);
utils_1._.forEachSnapshotFirst(listenerList, function (listener) {
if (async) {
_this.dispatchAsync(function () { return listener(event); });
}
else {
listener(event);
}
});
utils_1._.forEachSnapshotFirst(globalListeners, function (listener) {
if (async) {
_this.dispatchAsync(function () { return listener(eventType, event); });
}
else {
listener(eventType, event);
}
});
};
// this gets called inside the grid's thread, for each event that it
// wants to set async. the grid then batches the events into one setTimeout()
// because setTimeout() is an expensive operation. ideally we would have
// each event in it's own setTimeout(), but we batch for performance.
EventService.prototype.dispatchAsync = function (func) {
// add to the queue for executing later in the next VM turn
this.asyncFunctionsQueue.push(func);
// check if timeout is already scheduled. the first time the grid calls
// this within it's thread turn, this should be false, so it will schedule
// the 'flush queue' method the first time it comes here. then the flag is
// set to 'true' so it will know it's already scheduled for subsequent calls.
if (!this.scheduled) {
// if not scheduled, schedule one
window.setTimeout(this.flushAsyncQueue.bind(this), 0);
// mark that it is scheduled
this.scheduled = true;
}
};
// this happens in the next VM turn only, and empties the queue of events
EventService.prototype.flushAsyncQueue = function () {
this.scheduled = false;
// we take a copy, because the event listener could be using
// the grid, which would cause more events, which would be potentially
// added to the queue, so safe to take a copy, the new events will
// get executed in a later VM turn rather than risk updating the
// queue as we are flushing it.
var queueCopy = this.asyncFunctionsQueue.slice();
this.asyncFunctionsQueue = [];
// execute the queue
queueCopy.forEach(function (func) { return func(); });
};
var EventService_1;
// this is an old idea niall had, should really take it out, was to do with ordering who gets to process
// events first, to give model and service objects preference over the view
EventService.PRIORITY = '-P1';
__decorate([
__param(0, context_2.Qualifier('loggerFactory')),
__param(1, context_2.Qualifier('gridOptionsWrapper')),
__param(2, context_2.Qualifier('globalEventListener')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [logger_1.LoggerFactory,
gridOptionsWrapper_1.GridOptionsWrapper,
Function]),
__metadata("design:returntype", void 0)
], EventService.prototype, "setBeans", null);
EventService = EventService_1 = __decorate([
context_1.Bean('eventService')
], EventService);
return EventService;
}());
exports.EventService = EventService;
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
var gridOptionsWrapper_1 = __webpack_require__(4);
var context_1 = __webpack_require__(13);
var context_2 = __webpack_require__(13);
var LoggerFactory = /** @class */ (function () {
function LoggerFactory() {
}
LoggerFactory.prototype.setBeans = function (gridOptionsWrapper) {
this.logging = gridOptionsWrapper.isDebug();
};
LoggerFactory.prototype.create = function (name) {
return new Logger(name, this.isLogging.bind(this));
};
LoggerFactory.prototype.isLogging = function () {
return this.logging;
};
__decorate([
__param(0, context_2.Qualifier('gridOptionsWrapper')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [gridOptionsWrapper_1.GridOptionsWrapper]),
__metadata("design:returntype", void 0)
], LoggerFactory.prototype, "setBeans", null);
LoggerFactory = __decorate([
context_1.Bean('loggerFactory')
], LoggerFactory);
return LoggerFactory;
}());
exports.LoggerFactory = LoggerFactory;
var Logger = /** @class */ (function () {
function Logger(name, isLoggingFunc) {
this.name = name;
this.isLoggingFunc = isLoggingFunc;
}
Logger.prototype.isLogging = function () {
return this.isLoggingFunc();
};
Logger.prototype.log = function (message) {
if (this.isLoggingFunc()) {
// tslint:disable-next-line
console.log('ag-Grid.' + this.name + ': ' + message);
}
};
return Logger;
}());
exports.Logger = Logger;
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = __webpack_require__(5);
var Context = /** @class */ (function () {
function Context(params, logger) {
this.beanWrappers = {};
this.registeredModules = [];
this.componentsMappedByName = {};
this.destroyed = false;
if (!params || !params.beans) {
return;
}
this.contextParams = params;
this.registeredModules = params.registeredModules;
this.logger = logger;
this.logger.log(">> creating ag-Application Context");
this.setupComponents();
this.createBeans();
var beanInstances = this.getBeanInstances();
this.wireBeans(beanInstances);
this.logger.log(">> ag-Application Context ready - component is alive");
}
Context.prototype.getBeanInstances = function () {
return utils_1._.mapObject(this.beanWrappers, function (beanEntry) { return beanEntry.beanInstance; });
};
Context.prototype.setupComponents = function () {
var _this = this;
if (this.contextParams.components) {
this.contextParams.components.forEach(function (componentMeta) { return _this.addComponent(componentMeta); });
}
};
Context.prototype.addComponent = function (componentMeta) {
// get name of the class as a string
// let className = _.getNameOfClass(ComponentClass);
// insert a dash after every capital letter
// let classEscaped = className.replace(/([A-Z])/g, "-$1").toLowerCase();
var classEscaped = componentMeta.componentName.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
// put all to upper case
var classUpperCase = classEscaped.toUpperCase();
// finally store
this.componentsMappedByName[classUpperCase] = componentMeta.theClass;
};
Context.prototype.createComponentFromElement = function (element, afterPreCreateCallback) {
var key = element.nodeName;
if (this.componentsMappedByName && this.componentsMappedByName[key]) {
var newComponent = new this.componentsMappedByName[key]();
this.wireBean(newComponent, afterPreCreateCallback);
return newComponent;
}
return null;
};
Context.prototype.wireBean = function (bean, afterPreCreateCallback) {
if (!bean) {
throw Error("Can't wire to bean since it is null");
}
this.wireBeans([bean], afterPreCreateCallback);
};
Context.prototype.wireBeans = function (beanInstances, afterPreCreateCallback) {
this.autoWireBeans(beanInstances);
this.methodWireBeans(beanInstances);
this.callLifeCycleMethods(beanInstances, 'preConstructMethods');
// the callback sets the attributes, so the component has access to attributes
// before postConstruct methods in the component are executed
if (utils_1._.exists(afterPreCreateCallback)) {
beanInstances.forEach(afterPreCreateCallback);
}
this.callLifeCycleMethods(beanInstances, 'postConstructMethods');
};
Context.prototype.createBeans = function () {
var _this = this;
// register all normal beans
this.contextParams.beans.forEach(this.createBeanWrapper.bind(this));
// register override beans, these will overwrite beans above of same name
if (this.contextParams.overrideBeans) {
this.contextParams.overrideBeans.forEach(this.createBeanWrapper.bind(this));
}
// instantiate all beans - overridden beans will be left out
utils_1._.iterateObject(this.beanWrappers, function (key, beanEntry) {
var constructorParamsMeta;
if (beanEntry.bean.__agBeanMetaData && beanEntry.bean.__agBeanMetaData.autowireMethods && beanEntry.bean.__agBeanMetaData.autowireMethods.agConstructor) {
constructorParamsMeta = beanEntry.bean.__agBeanMetaData.autowireMethods.agConstructor;
}
var constructorParams = _this.getBeansForParameters(constructorParamsMeta, beanEntry.bean.name);
var newInstance = applyToConstructor(beanEntry.bean, constructorParams);
beanEntry.beanInstance = newInstance;
_this.logger.log("bean " + _this.getBeanName(newInstance) + " created");
});
};
// tslint:disable-next-line
Context.prototype.createBeanWrapper = function (Bean) {
var metaData = Bean.__agBeanMetaData;
if (!metaData) {
var beanName = void 0;
if (Bean.prototype.constructor) {
beanName = Bean.prototype.constructor.name;
}
else {
beanName = "" + Bean;
}
console.error("context item " + beanName + " is not a bean");
return;
}
var beanEntry = {
bean: Bean,
beanInstance: null,
beanName: metaData.beanName
};
this.beanWrappers[metaData.beanName] = beanEntry;
};
Context.prototype.autoWireBeans = function (beanInstances) {
var _this = this;
beanInstances.forEach(function (beanInstance) {
_this.forEachMetaDataInHierarchy(beanInstance, function (metaData, beanName) {
var attributes = metaData.agClassAttributes;
if (!attributes) {
return;
}
attributes.forEach(function (attribute) {
var otherBean = _this.lookupBeanInstance(beanName, attribute.beanName, attribute.optional);
beanInstance[attribute.attributeName] = otherBean;
});
});
});
};
Context.prototype.methodWireBeans = function (beanInstances) {
var _this = this;
beanInstances.forEach(function (beanInstance) {
_this.forEachMetaDataInHierarchy(beanInstance, function (metaData, beanName) {
utils_1._.iterateObject(metaData.autowireMethods, function (methodName, wireParams) {
// skip constructor, as this is dealt with elsewhere
if (methodName === "agConstructor") {
return;
}
var initParams = _this.getBeansForParameters(wireParams, beanName);
beanInstance[methodName].apply(beanInstance, initParams);
});
});
});
};
Context.prototype.forEachMetaDataInHierarchy = function (beanInstance, callback) {
var prototype = Object.getPrototypeOf(beanInstance);
while (prototype != null) {
var constructor = prototype.constructor;
if (constructor.hasOwnProperty('__agBeanMetaData')) {
var metaData = constructor.__agBeanMetaData;
var beanName = this.getBeanName(constructor);
callback(metaData, beanName);
}
prototype = Object.getPrototypeOf(prototype);
}
};
Context.prototype.getBeanName = function (constructor) {
if (constructor.__agBeanMetaData && constructor.__agBeanMetaData.beanName) {
return constructor.__agBeanMetaData.beanName;
}
var constructorString = constructor.toString();
var beanName = constructorString.substring(9, constructorString.indexOf("("));
return beanName;
};
Context.prototype.getBeansForParameters = function (parameters, beanName) {
var _this = this;
var beansList = [];
if (parameters) {
utils_1._.iterateObject(parameters, function (paramIndex, otherBeanName) {
var otherBean = _this.lookupBeanInstance(beanName, otherBeanName);
beansList[Number(paramIndex)] = otherBean;
});
}
return beansList;
};
Context.prototype.lookupBeanInstance = function (wiringBean, beanName, optional) {
if (optional === void 0) { optional = false; }
if (beanName === "context") {
return this;
}
else if (this.contextParams.seed && this.contextParams.seed.hasOwnProperty(beanName)) {
return this.contextParams.seed[beanName];
}
else {
var beanEntry = this.beanWrappers[beanName];
if (beanEntry) {
return beanEntry.beanInstance;
}
if (!optional) {
console.error("ag-Grid: unable to find bean reference " + beanName + " while initialising " + wiringBean);
}
return null;
}
};
Context.prototype.callLifeCycleMethods = function (beanInstances, lifeCycleMethod) {
var _this = this;
beanInstances.forEach(function (beanInstance) {
_this.forEachMetaDataInHierarchy(beanInstance, function (metaData) {
var methods = metaData[lifeCycleMethod];
if (!methods) {
return;
}
methods.forEach(function (methodName) { return beanInstance[methodName](); });
});
});
};
Context.prototype.getBean = function (name) {
return this.lookupBeanInstance("getBean", name, true);
};
Context.prototype.getEnterpriseDefaultComponents = function () {
return this.contextParams.enterpriseDefaultComponents;
};
Context.prototype.destroy = function () {
// should only be able to destroy once
if (this.destroyed) {
return;
}
this.logger.log(">> Shutting down ag-Application Context");
var beanInstances = this.getBeanInstances();
this.callLifeCycleMethods(beanInstances, 'preDestroyMethods');
this.contextParams.seed = null;
this.destroyed = true;
this.logger.log(">> ag-Application Context shut down - component is dead");
};
Context.prototype.isModuleRegistered = function (moduleName) {
return this.registeredModules.indexOf(moduleName) !== -1;
};
return Context;
}());
exports.Context = Context;
// taken from: http://stackoverflow.com/questions/3362471/how-can-i-call-a-javascript-constructor-using-call-or-apply
// allows calling 'apply' on a constructor
function applyToConstructor(constructor, argArray) {
var args = [null].concat(argArray);
var factoryFunction = constructor.bind.apply(constructor, args);
return new factoryFunction();
}
function PreConstruct(target, methodName, descriptor) {
var props = getOrCreateProps(target.constructor);
if (!props.postConstructMethods) {
props.preConstructMethods = [];
}
props.preConstructMethods.push(methodName);
}
exports.PreConstruct = PreConstruct;
function PostConstruct(target, methodName, descriptor) {
var props = getOrCreateProps(target.constructor);
if (!props.postConstructMethods) {
props.postConstructMethods = [];
}
props.postConstructMethods.push(methodName);
}
exports.PostConstruct = PostConstruct;
function PreDestroy(target, methodName, descriptor) {
var props = getOrCreateProps(target.constructor);
if (!props.preDestroyMethods) {
props.preDestroyMethods = [];
}
props.preDestroyMethods.push(methodName);
}
exports.PreDestroy = PreDestroy;
function Bean(beanName) {
return function (classConstructor) {
var props = getOrCreateProps(classConstructor);
props.beanName = beanName;
};
}
exports.Bean = Bean;
function Autowired(name) {
return function (target, propertyKey, descriptor) {
autowiredFunc(target, name, false, target, propertyKey, null);
};
}
exports.Autowired = Autowired;
function Optional(name) {
return function (target, propertyKey, descriptor) {
autowiredFunc(target, name, true, target, propertyKey, null);
};
}
exports.Optional = Optional;
function autowiredFunc(target, name, optional, classPrototype, methodOrAttributeName, index) {
if (name === null) {
console.error("ag-Grid: Autowired name should not be null");
return;
}
if (typeof index === "number") {
console.error("ag-Grid: Autowired should be on an attribute");
return;
}
// it's an attribute on the class
var props = getOrCreateProps(target.constructor);
if (!props.agClassAttributes) {
props.agClassAttributes = [];
}
props.agClassAttributes.push({
attributeName: methodOrAttributeName,
beanName: name,
optional: optional
});
}
function Qualifier(name) {
return function (classPrototype, methodOrAttributeName, index) {
var constructor = typeof classPrototype == "function" ? classPrototype : classPrototype.constructor;
var props;
if (typeof index === "number") {
// it's a parameter on a method
var methodName = void 0;
if (methodOrAttributeName) {
props = getOrCreateProps(constructor);
methodName = methodOrAttributeName;
}
else {
props = getOrCreateProps(constructor);
methodName = "agConstructor";
}
if (!props.autowireMethods) {
props.autowireMethods = {};
}
if (!props.autowireMethods[methodName]) {
props.autowireMethods[methodName] = {};
}
props.autowireMethods[methodName][index] = name;
}
};
}
exports.Qualifier = Qualifier;
function getOrCreateProps(target) {
if (!target.hasOwnProperty("__agBeanMetaData")) {
target.__agBeanMetaData = {};
}
return target.__agBeanMetaData;
}
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var events_1 = __webpack_require__(15);
var propertyKeys_1 = __webpack_require__(17);
var gridOptionsWrapper_1 = __webpack_require__(4);
var utils_1 = __webpack_require__(5);
var ComponentUtil = /** @class */ (function () {
function ComponentUtil() {
}
ComponentUtil.getEventCallbacks = function () {
if (!ComponentUtil.EVENT_CALLBACKS) {
ComponentUtil.EVENT_CALLBACKS = [];
ComponentUtil.EVENT_CALLBACKS_NO_PREFIX = [];
ComponentUtil.EVENTS.forEach(function (eventName) {
ComponentUtil.EVENT_CALLBACKS.push(ComponentUtil.getCallbackForEvent(eventName));
ComponentUtil.EVENT_CALLBACKS_NO_PREFIX.push(eventName);
});
}
return ComponentUtil.EVENT_CALLBACKS;
};
ComponentUtil.copyAttributesToGridOptions = function (gridOptions, component, skipEventDeprecationCheck) {
if (skipEventDeprecationCheck === void 0) { skipEventDeprecationCheck = false; }
checkForDeprecated(component);
// create empty grid options if none were passed
if (typeof gridOptions !== 'object') {
gridOptions = {};
}
// to allow array style lookup in TypeScript, take type away from 'this' and 'gridOptions'
var pGridOptions = gridOptions;
// add in all the simple properties
ComponentUtil.ARRAY_PROPERTIES
.concat(ComponentUtil.STRING_PROPERTIES)
.concat(ComponentUtil.OBJECT_PROPERTIES)
.concat(ComponentUtil.FUNCTION_PROPERTIES)
.forEach(function (key) {
if (typeof component[key] !== 'undefined') {
pGridOptions[key] = component[key];
}
});
ComponentUtil.BOOLEAN_PROPERTIES.forEach(function (key) {
if (typeof component[key] !== 'undefined') {
pGridOptions[key] = ComponentUtil.toBoolean(component[key]);
}
});
ComponentUtil.NUMBER_PROPERTIES.forEach(function (key) {
if (typeof component[key] !== 'undefined') {
pGridOptions[key] = ComponentUtil.toNumber(component[key]);
}
});
ComponentUtil.getEventCallbacks().forEach(function (funcName) {
if (typeof component[funcName] !== 'undefined') {
pGridOptions[funcName] = component[funcName];
}
});
// purely for event deprecation checks (for frameworks - wouldn't apply for non-fw versions)
if (!skipEventDeprecationCheck) {
ComponentUtil.EVENT_CALLBACKS_NO_PREFIX.forEach(function (funcName) {
// react uses onXXX...not sure why this is diff to the other frameworks
var onMethodName = ComponentUtil.getCallbackForEvent(funcName);
if (typeof component[funcName] !== 'undefined' ||
typeof component[onMethodName] !== 'undefined') {
gridOptionsWrapper_1.GridOptionsWrapper.checkEventDeprecation(funcName);
}
});
}
return gridOptions;
};
ComponentUtil.getCallbackForEvent = function (eventName) {
if (!eventName || eventName.length < 2) {
return eventName;
}
else {
return 'on' + eventName[0].toUpperCase() + eventName.substr(1);
}
};
ComponentUtil.processOnChange = function (changes, gridOptions, api, columnApi) {
if (!changes) {
return;
}
checkForDeprecated(changes);
// to allow array style lookup in TypeScript, take type away from 'this' and 'gridOptions'
var pGridOptions = gridOptions;
// check if any change for the simple types, and if so, then just copy in the new value
ComponentUtil.ARRAY_PROPERTIES
.concat(ComponentUtil.OBJECT_PROPERTIES)
.concat(ComponentUtil.STRING_PROPERTIES)
.forEach(function (key) {
if (changes[key]) {
pGridOptions[key] = changes[key].currentValue;
}
});
ComponentUtil.BOOLEAN_PROPERTIES.forEach(function (key) {
if (changes[key]) {
pGridOptions[key] = ComponentUtil.toBoolean(changes[key].currentValue);
}
});
ComponentUtil.NUMBER_PROPERTIES.forEach(function (key) {
if (changes[key]) {
pGridOptions[key] = ComponentUtil.toNumber(changes[key].currentValue);
}
});
ComponentUtil.getEventCallbacks().forEach(function (funcName) {
if (changes[funcName]) {
pGridOptions[funcName] = changes[funcName].currentValue;
}
});
if (changes.enableCellTextSelection) {
api.setEnableCellTextSelection(ComponentUtil.toBoolean(changes.enableCellTextSelection.currentValue));
}
if (changes.showToolPanel) {
api.showToolPanel(ComponentUtil.toBoolean(changes.showToolPanel.currentValue));
}
if (changes.quickFilterText) {
api.setQuickFilter(changes.quickFilterText.currentValue);
}
if (changes.rowData) {
api.setRowData(changes.rowData.currentValue);
}
if (changes.pinnedTopRowData) {
api.setPinnedTopRowData(changes.pinnedTopRowData.currentValue);
}
if (changes.pinnedBottomRowData) {
api.setPinnedBottomRowData(changes.pinnedBottomRowData.currentValue);
}
if (changes.columnDefs) {
api.setColumnDefs(changes.columnDefs.currentValue, "gridOptionsChanged");
}
if (changes.datasource) {
api.setDatasource(changes.datasource.currentValue);
}
if (changes.headerHeight) {
api.setHeaderHeight(ComponentUtil.toNumber(changes.headerHeight.currentValue));
}
if (changes.paginationPageSize) {
api.paginationSetPageSize(ComponentUtil.toNumber(changes.paginationPageSize.currentValue));
}
if (changes.pivotMode) {
columnApi.setPivotMode(ComponentUtil.toBoolean(changes.pivotMode.currentValue));
}
if (changes.groupRemoveSingleChildren) {
api.setGroupRemoveSingleChildren(ComponentUtil.toBoolean(changes.groupRemoveSingleChildren.currentValue));
}
if (changes.suppressRowDrag) {
api.setSuppressRowDrag(ComponentUtil.toBoolean(changes.suppressRowDrag.currentValue));
}
if (changes.gridAutoHeight) {
api.setGridAutoHeight(ComponentUtil.toBoolean(changes.gridAutoHeight.currentValue));
}
if (changes.suppressClipboardPaste) {
api.setSuppressClipboardPaste(ComponentUtil.toBoolean(changes.suppressClipboardPaste.currentValue));
}
if (changes.sideBar) {
api.setSideBar(changes.sideBar.currentValue);
}
if (changes.datasource) {
api.setDatasource(changes.datasource.currentValue);
}
// copy changes into an event for dispatch
var event = {
type: events_1.Events.EVENT_COMPONENT_STATE_CHANGED,
api: gridOptions.api,
columnApi: gridOptions.columnApi
};
utils_1._.iterateObject(changes, function (key, value) {
event[key] = value;
});
api.dispatchEvent(event);
};
ComponentUtil.toBoolean = function (value) {
if (typeof value === 'boolean') {
return value;
}
else if (typeof value === 'string') {
// for boolean, compare to empty String to allow attributes appearing with
// not value to be treated as 'true'
return value.toUpperCase() === 'TRUE' || value == '';
}
else {
return false;
}
};
ComponentUtil.toNumber = function (value) {
if (typeof value === 'number') {
return value;
}
else if (typeof value === 'string') {
return Number(value);
}
else {
return undefined;
}
};
// all the events are populated in here AFTER this class (at the bottom of the file).
ComponentUtil.EVENTS = [];
ComponentUtil.STRING_PROPERTIES = propertyKeys_1.PropertyKeys.STRING_PROPERTIES;
ComponentUtil.OBJECT_PROPERTIES = propertyKeys_1.PropertyKeys.OBJECT_PROPERTIES;
ComponentUtil.ARRAY_PROPERTIES = propertyKeys_1.PropertyKeys.ARRAY_PROPERTIES;
ComponentUtil.NUMBER_PROPERTIES = propertyKeys_1.PropertyKeys.NUMBER_PROPERTIES;
ComponentUtil.BOOLEAN_PROPERTIES = propertyKeys_1.PropertyKeys.BOOLEAN_PROPERTIES;
ComponentUtil.FUNCTION_PROPERTIES = propertyKeys_1.PropertyKeys.FUNCTION_PROPERTIES;
ComponentUtil.ALL_PROPERTIES = propertyKeys_1.PropertyKeys.ALL_PROPERTIES;
return ComponentUtil;
}());
exports.ComponentUtil = ComponentUtil;
utils_1._.iterateObject(events_1.Events, function (key, value) {
ComponentUtil.EVENTS.push(value);
});
function checkForDeprecated(changes) {
if (changes.rowDeselected || changes.onRowDeselected) {
console.warn('ag-grid: as of v3.4 rowDeselected no longer exists. Please check the docs.');
}
}
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var eventKeys_1 = __webpack_require__(16);
exports.Events = eventKeys_1.Events;
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var Events = /** @class */ (function () {
function Events() {
}
/** Everything has changed with the columns. Either complete new set of columns set, or user called setState()*/
Events.EVENT_COLUMN_EVERYTHING_CHANGED = 'columnEverythingChanged';
/** User has set in new columns. */
Events.EVENT_NEW_COLUMNS_LOADED = 'newColumnsLoaded';
/** The pivot mode flag was changed */
Events.EVENT_COLUMN_PIVOT_MODE_CHANGED = 'columnPivotModeChanged';
/** A row group column was added, removed or order changed. */
Events.EVENT_COLUMN_ROW_GROUP_CHANGED = 'columnRowGroupChanged';
/** expandAll / collapseAll was called from the api. */
Events.EVENT_EXPAND_COLLAPSE_ALL = 'expandOrCollapseAll';
/** A pivot column was added, removed or order changed. */
Events.EVENT_COLUMN_PIVOT_CHANGED = 'columnPivotChanged';
/** The list of grid columns has changed. */
Events.EVENT_GRID_COLUMNS_CHANGED = 'gridColumnsChanged';
/** A value column was added, removed or agg function was changed. */
Events.EVENT_COLUMN_VALUE_CHANGED = 'columnValueChanged';
/** A column was moved */
Events.EVENT_COLUMN_MOVED = 'columnMoved';
/** One or more columns was shown / hidden */
Events.EVENT_COLUMN_VISIBLE = 'columnVisible';
/** One or more columns was pinned / unpinned*/
Events.EVENT_COLUMN_PINNED = 'columnPinned';
/** A column group was opened / closed */
Events.EVENT_COLUMN_GROUP_OPENED = 'columnGroupOpened';
/** One or more columns was resized. If just one, the column in the event is set. */
Events.EVENT_COLUMN_RESIZED = 'columnResized';
/** The list of displayed columns has changed, can result from columns open / close, column move, pivot, group, etc */
Events.EVENT_DISPLAYED_COLUMNS_CHANGED = 'displayedColumnsChanged';
/** The list of virtual columns has changed, results from viewport changing */
Events.EVENT_VIRTUAL_COLUMNS_CHANGED = 'virtualColumnsChanged';
/** A row group was opened / closed */
Events.EVENT_ROW_GROUP_OPENED = 'rowGroupOpened';
/** The client has set new data into the grid */
Events.EVENT_ROW_DATA_CHANGED = 'rowDataChanged';
/** The client has updated data for the grid */
Events.EVENT_ROW_DATA_UPDATED = 'rowDataUpdated';
/** The client has set new floating data into the grid */
Events.EVENT_PINNED_ROW_DATA_CHANGED = 'pinnedRowDataChanged';
/** Range selection has changed */
Events.EVENT_RANGE_SELECTION_CHANGED = 'rangeSelectionChanged';
/** Chart Range selection has changed */
Events.EVENT_CHART_RANGE_SELECTION_CHANGED = 'chartRangeSelectionChanged';
/** Chart Options have changed */
Events.EVENT_CHART_OPTIONS_CHANGED = 'chartOptionsChanged';
/** For when the tool panel is shown / hidden */
Events.EVENT_TOOL_PANEL_VISIBLE_CHANGED = 'toolPanelVisibleChanged';
/** Model was updated - grid updates the drawn rows when this happens */
Events.EVENT_MODEL_UPDATED = 'modelUpdated';
Events.EVENT_PASTE_START = 'pasteStart';
Events.EVENT_PASTE_END = 'pasteEnd';
Events.EVENT_CELL_CLICKED = 'cellClicked';
Events.EVENT_CELL_DOUBLE_CLICKED = 'cellDoubleClicked';
Events.EVENT_CELL_MOUSE_DOWN = 'cellMouseDown';
Events.EVENT_CELL_CONTEXT_MENU = 'cellContextMenu';
Events.EVENT_CELL_VALUE_CHANGED = 'cellValueChanged';
Events.EVENT_ROW_VALUE_CHANGED = 'rowValueChanged';
Events.EVENT_CELL_FOCUSED = 'cellFocused';
Events.EVENT_ROW_SELECTED = 'rowSelected';
Events.EVENT_SELECTION_CHANGED = 'selectionChanged';
Events.EVENT_CELL_KEY_DOWN = 'cellKeyDown';
Events.EVENT_CELL_KEY_PRESS = 'cellKeyPress';
Events.EVENT_CELL_MOUSE_OVER = 'cellMouseOver';
Events.EVENT_CELL_MOUSE_OUT = 'cellMouseOut';
/** 2 events for filtering. The grid LISTENS for filterChanged and afterFilterChanged */
Events.EVENT_FILTER_CHANGED = 'filterChanged';
/** Filter was change but not applied. Only useful if apply buttons are used in filters. */
Events.EVENT_FILTER_MODIFIED = 'filterModified';
Events.EVENT_FILTER_OPENED = 'filterOpened';
Events.EVENT_SORT_CHANGED = 'sortChanged';
/** A row was removed from the dom, for any reason. Use to clean up resources (if any) used by the row. */
Events.EVENT_VIRTUAL_ROW_REMOVED = 'virtualRowRemoved';
Events.EVENT_ROW_CLICKED = 'rowClicked';
Events.EVENT_ROW_DOUBLE_CLICKED = 'rowDoubleClicked';
/** Gets called once after the grid has finished initialising. */
Events.EVENT_GRID_READY = 'gridReady';
/** Width of height of the main grid div has changed. Grid listens for this and does layout of grid if it's
* changed, so always filling the space it was given. */
Events.EVENT_GRID_SIZE_CHANGED = 'gridSizeChanged';
/** The indexes of the rows rendered has changed, eg user has scrolled to a new vertical position. */
Events.EVENT_VIEWPORT_CHANGED = 'viewportChanged';
/** Rows were rendered for the first time (ie on async data load). */
Events.EVENT_FIRST_DATA_RENDERED = 'firstDataRendered';
/** A column drag has started, either resizing a column or moving a column. */
Events.EVENT_DRAG_STARTED = 'dragStarted';
/** A column drag has stopped */
Events.EVENT_DRAG_STOPPED = 'dragStopped';
Events.EVENT_ROW_EDITING_STARTED = 'rowEditingStarted';
Events.EVENT_ROW_EDITING_STOPPED = 'rowEditingStopped';
Events.EVENT_CELL_EDITING_STARTED = 'cellEditingStarted';
Events.EVENT_CELL_EDITING_STOPPED = 'cellEditingStopped';
/** Main body of grid has scrolled, either horizontally or vertically */
Events.EVENT_BODY_SCROLL = 'bodyScroll';
Events.EVENT_ANIMATION_QUEUE_EMPTY = 'animationQueueEmpty';
Events.EVENT_HEIGHT_SCALE_CHANGED = 'heightScaleChanged';
/** The displayed page for pagination has changed. For example the data was filtered or sorted,
* or the user has moved to a different page. */
Events.EVENT_PAGINATION_CHANGED = 'paginationChanged';
/** Only used by React, Angular 2+, Web Components and VueJS ag-Grid components
* (not used if doing plain JavaScript or Angular 1.x). If the grid receives changes due
* to bound properties, this event fires after the grid has finished processing the change. */
Events.EVENT_COMPONENT_STATE_CHANGED = 'componentStateChanged';
/** All items from here down are used internally by the grid, not intended for external use. */
// not documented, either experimental, or we just don't want users using an depending on them
Events.EVENT_BODY_HEIGHT_CHANGED = 'bodyHeightChanged';
Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED = 'displayedColumnsWidthChanged';
Events.EVENT_SCROLL_VISIBILITY_CHANGED = 'scrollVisibilityChanged';
Events.EVENT_COLUMN_HOVER_CHANGED = 'columnHoverChanged';
Events.EVENT_FLASH_CELLS = 'flashCells';
Events.EVENT_ROW_DRAG_ENTER = 'rowDragEnter';
Events.EVENT_ROW_DRAG_MOVE = 'rowDragMove';
Events.EVENT_ROW_DRAG_LEAVE = 'rowDragLeave';
Events.EVENT_ROW_DRAG_END = 'rowDragEnd';
// these are used for server side group and agg - only used by CS with Viewport Row Model - intention is
// to design these better around server side functions and then release to general public when fully working with
// all the row models.
Events.EVENT_COLUMN_ROW_GROUP_CHANGE_REQUEST = 'columnRowGroupChangeRequest';
Events.EVENT_COLUMN_PIVOT_CHANGE_REQUEST = 'columnPivotChangeRequest';
Events.EVENT_COLUMN_VALUE_CHANGE_REQUEST = 'columnValueChangeRequest';
Events.EVENT_COLUMN_AGG_FUNC_CHANGE_REQUEST = 'columnAggFuncChangeRequest';
return Events;
}());
exports.Events = Events;
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var PropertyKeys = /** @class */ (function () {
function PropertyKeys() {
}
PropertyKeys.STRING_PROPERTIES = [
'sortingOrder', 'rowClass', 'rowSelection', 'overlayLoadingTemplate',
'overlayNoRowsTemplate', 'quickFilterText', 'rowModelType',
'editType', 'domLayout', 'clipboardDeliminator', 'rowGroupPanelShow',
'multiSortKey', 'pivotColumnGroupTotals', 'pivotRowTotals', 'pivotPanelShow'
];
PropertyKeys.OBJECT_PROPERTIES = [
'components', 'frameworkComponents', 'rowStyle', 'context', 'autoGroupColumnDef', 'groupColumnDef', 'localeText',
'icons', 'datasource', 'serverSideDatasource', 'viewportDatasource', 'groupRowRendererParams', 'aggFuncs',
'fullWidthCellRendererParams', 'defaultColGroupDef', 'defaultColDef', 'defaultExportParams', 'columnTypes',
'rowClassRules', 'detailGridOptions', 'detailCellRendererParams', 'loadingCellRendererParams', 'loadingOverlayComponentParams',
'noRowsOverlayComponentParams', 'popupParent', 'colResizeDefault', 'reduxStore', 'statusBar', 'sideBar'
];
PropertyKeys.ARRAY_PROPERTIES = [
'slaveGrids', 'alignedGrids', 'rowData',
'columnDefs', 'excelStyles', 'pinnedTopRowData', 'pinnedBottomRowData'
/** @deprecated */
];
PropertyKeys.NUMBER_PROPERTIES = [
'rowHeight', 'detailRowHeight', 'rowBuffer', 'colWidth', 'headerHeight', 'groupHeaderHeight',
'floatingFiltersHeight', 'pivotHeaderHeight', 'pivotGroupHeaderHeight', 'groupDefaultExpanded',
'minColWidth', 'maxColWidth', 'viewportRowModelPageSize', 'viewportRowModelBufferSize',
'autoSizePadding', 'maxBlocksInCache', 'maxConcurrentDatasourceRequests',
'cacheOverflowSize', 'paginationPageSize', 'cacheBlockSize', 'infiniteInitialRowCount',
'scrollbarWidth', 'paginationStartPage', 'infiniteBlockSize', 'batchUpdateWaitMillis',
'blockLoadDebounceMillis', 'keepDetailRowsCount'
];
PropertyKeys.BOOLEAN_PROPERTIES = [
'toolPanelSuppressRowGroups', 'toolPanelSuppressValues', 'toolPanelSuppressPivots', 'toolPanelSuppressPivotMode',
'toolPanelSuppressSideButtons', 'toolPanelSuppressColumnFilter', 'toolPanelSuppressColumnSelectAll',
'toolPanelSuppressColumnExpandAll', 'suppressMakeColumnVisibleAfterUnGroup', 'suppressRowClickSelection',
'suppressCellSelection', 'suppressHorizontalScroll', 'alwaysShowVerticalScroll', 'debug', 'enableBrowserTooltips', 'enableColResize',
'enableCellExpressions', 'enableSorting', 'enableServerSideSorting', 'enableFilter', 'enableServerSideFilter',
'angularCompileRows', 'angularCompileFilters', 'angularCompileHeaders', 'groupSuppressAutoColumn', 'groupSelectsChildren',
'groupIncludeFooter', 'groupIncludeTotalFooter', 'groupUseEntireRow', 'groupSuppressRow', 'groupSuppressBlankHeader',
'forPrint', 'suppressMenuHide', 'rowDeselection', 'unSortIcon', 'suppressMultiSort', 'singleClickEdit',
'suppressLoadingOverlay', 'suppressNoRowsOverlay', 'suppressAutoSize', 'suppressParentsInRowNodes', 'showToolPanel',
'suppressColumnMoveAnimation', 'suppressMovableColumns', 'suppressFieldDotNotation', 'enableRangeSelection',
'enableRangeHandle', 'enableFillHandle', 'deltaSort', 'suppressTouch', 'suppressAsyncEvents', 'allowContextMenuWithControlKey',
'suppressContextMenu', 'suppressMenuFilterPanel', 'suppressMenuMainPanel', 'suppressMenuColumnPanel', 'rememberGroupStateWhenNewData',
'enableCellChangeFlash', 'suppressDragLeaveHidesColumns', 'suppressMiddleClickScrolls', 'suppressPreventDefaultOnMouseWheel',
'suppressUseColIdForGroups', 'suppressCopyRowsToClipboard', 'copyHeadersToClipboard', 'pivotMode', 'suppressAggFuncInHeader',
'suppressColumnVirtualisation', 'suppressAggAtRootLevel', 'suppressFocusAfterRefresh', 'functionsPassive', 'functionsReadOnly',
'animateRows', 'groupSelectsFiltered', 'groupRemoveSingleChildren', 'groupRemoveLowestSingleChildren', 'enableRtl',
'suppressClickEdit', 'rowDragManaged', 'suppressRowDrag', 'enableGroupEdit', 'embedFullWidthRows', 'deprecatedEmbedFullWidthRows',
'suppressTabbing', 'suppressPaginationPanel', 'floatingFilter', 'groupHideOpenParents', 'groupMultiAutoColumn', 'pagination',
'stopEditingWhenGridLosesFocus', 'paginationAutoPageSize', 'suppressScrollOnNewData', 'purgeClosedRowNodes', 'cacheQuickFilter',
'deltaRowDataMode', 'ensureDomOrder', 'accentedSort', 'pivotTotals', 'suppressChangeDetection', 'valueCache', 'valueCacheNeverExpires',
'aggregateOnlyChangedColumns', 'suppressAnimationFrame', 'suppressExcelExport', 'suppressCsvExport', 'treeData', 'masterDetail',
'suppressMultiRangeSelection', 'enterMovesDownAfterEdit', 'enterMovesDown', 'suppressPropertyNamesCheck', 'rowMultiSelectWithClick',
'contractColumnSelection', 'suppressEnterpriseResetOnNewColumns', 'enableOldSetFilterModel', 'suppressRowHoverHighlight',
'gridAutoHeight', 'suppressRowTransform', 'suppressClipboardPaste', 'serverSideSortingAlwaysResets', 'reactNext',
'suppressSetColumnStateEvents', 'enableCharts', 'deltaColumnMode', 'suppressMaintainUnsortedOrder', 'enableCellTextSelection',
'suppressBrowserResizeObserver', 'suppressMaxRenderedRowRestriction', 'excludeChildrenWhenTreeDataFiltering',
'keepDetailRows', 'paginateChildRows', 'preventDefaultOnContextMenu'
];
PropertyKeys.FUNCTION_PROPERTIES = ['localeTextFunc', 'groupRowInnerRenderer', 'groupRowInnerRendererFramework',
'dateComponent', 'dateComponentFramework', 'groupRowRenderer', 'groupRowRendererFramework', 'isExternalFilterPresent',
'getRowHeight', 'doesExternalFilterPass', 'getRowClass', 'getRowStyle', 'getRowClassRules',
'traverseNode', 'getContextMenuItems', 'getMainMenuItems', 'processRowPostCreate', 'processCellForClipboard',
'getNodeChildDetails', 'groupRowAggNodes', 'getRowNodeId', 'isFullWidthCell', 'fullWidthCellRenderer',
'fullWidthCellRendererFramework', 'doesDataFlower', 'processSecondaryColDef', 'processSecondaryColGroupDef',
'getBusinessKeyForNode', 'sendToClipboard', 'navigateToNextCell', 'tabToNextCell', 'getDetailRowData',
'processCellFromClipboard', 'getDocument', 'postProcessPopup', 'getChildCount', 'getDataPath', 'loadingCellRenderer',
'loadingCellRendererFramework', 'loadingOverlayComponent', 'loadingOverlayComponentFramework', 'noRowsOverlayComponent',
'noRowsOverlayComponentFramework', 'detailCellRenderer', 'detailCellRendererFramework', 'onGridReady',
'defaultGroupSortComparator', 'isRowMaster', 'isRowSelectable', 'postSort', 'processHeaderForClipboard',
'paginationNumberFormatter', 'processDataFromClipboard', 'getServerSideGroupKey', 'isServerSideGroup',
'suppressKeyboardEvent', 'createChartContainer', 'processChartOptions', 'getChartToolbarItems'];
PropertyKeys.ALL_PROPERTIES = PropertyKeys.ARRAY_PROPERTIES
.concat(PropertyKeys.OBJECT_PROPERTIES)
.concat(PropertyKeys.STRING_PROPERTIES)
.concat(PropertyKeys.NUMBER_PROPERTIES)
.concat(PropertyKeys.FUNCTION_PROPERTIES)
.concat(PropertyKeys.BOOLEAN_PROPERTIES);
// used when doing property checks - this causes noise when using frameworks which can add their own fw specific
// properties to colDefs, gridOptions etc
PropertyKeys.FRAMEWORK_PROPERTIES = ['__ob__', '__metadata__', 'mappedColumnProperties', 'hasChildColumns',
'toColDef', 'createColDefFromGridColumn'];
return PropertyKeys;
}());
exports.PropertyKeys = PropertyKeys;
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var csvCreator_1 = __webpack_require__(19);
var rowRenderer_1 = __webpack_require__(30);
var filterManager_1 = __webpack_require__(58);
var columnController_1 = __webpack_require__(21);
var selectionController_1 = __webpack_require__(37);
var gridOptionsWrapper_1 = __webpack_require__(4);
var valueService_1 = __webpack_require__(39);
var eventService_1 = __webpack_require__(11);
var constants_1 = __webpack_require__(8);
var context_1 = __webpack_require__(13);
var sortController_1 = __webpack_require__(71);
var focusedCellController_1 = __webpack_require__(49);
var cellRendererFactory_1 = __webpack_require__(56);
var paginationProxy_1 = __webpack_require__(52);
var immutableService_1 = __webpack_require__(117);
var valueCache_1 = __webpack_require__(40);
var alignedGridsService_1 = __webpack_require__(118);
var pinnedRowModel_1 = __webpack_require__(51);
var animationFrameService_1 = __webpack_require__(98);
var utils_1 = __webpack_require__(5);
var GridApi = /** @class */ (function () {
function GridApi() {
this.detailGridInfoMap = {};
}
GridApi.prototype.registerGridComp = function (gridPanel) {
this.gridPanel = gridPanel;
};
GridApi.prototype.registerGridCore = function (gridCore) {
this.gridCore = gridCore;
};
GridApi.prototype.registerHeaderRootComp = function (headerRootComp) {
this.headerRootComp = headerRootComp;
};
GridApi.prototype.init = function () {
switch (this.rowModel.getType()) {
case constants_1.Constants.ROW_MODEL_TYPE_CLIENT_SIDE:
this.clientSideRowModel = this.rowModel;
break;
case constants_1.Constants.ROW_MODEL_TYPE_INFINITE:
this.infinitePageRowModel = this.rowModel;
break;
case constants_1.Constants.ROW_MODEL_TYPE_SERVER_SIDE:
this.serverSideRowModel = this.rowModel;
break;
}
};
/** Used internally by grid. Not intended to be used by the client. Interface may change between releases. */
GridApi.prototype.__getAlignedGridService = function () {
return this.alignedGridsService;
};
GridApi.prototype.addDetailGridInfo = function (id, gridInfo) {
this.detailGridInfoMap[id] = gridInfo;
};
GridApi.prototype.removeDetailGridInfo = function (id) {
this.detailGridInfoMap[id] = undefined;
};
GridApi.prototype.getDetailGridInfo = function (id) {
return this.detailGridInfoMap[id];
};
GridApi.prototype.forEachDetailGridInfo = function (callback) {
var index = 0;
utils_1._.iterateObject(this.detailGridInfoMap, function (id, gridInfo) {
// check for undefined, as old references will still be lying around
if (utils_1._.exists(gridInfo)) {
callback(gridInfo, index);
index++;
}
});
};
GridApi.prototype.getDataAsCsv = function (params) {
return this.csvCreator.getDataAsCsv(params);
};
GridApi.prototype.exportDataAsCsv = function (params) {
this.csvCreator.exportDataAsCsv(params);
};
GridApi.prototype.getDataAsExcel = function (params) {
if (!this.excelCreator) {
console.warn('ag-Grid: Excel export is only available in ag-Grid Enterprise');
}
return this.excelCreator.getDataAsExcelXml(params);
};
GridApi.prototype.exportDataAsExcel = function (params) {
if (!this.excelCreator) {
console.warn('ag-Grid: Excel export is only available in ag-Grid Enterprise');
}
this.excelCreator.exportDataAsExcel(params);
};
/** @deprecated */
GridApi.prototype.setEnterpriseDatasource = function (datasource) {
console.warn("ag-grid: since version 18.x, api.setEnterpriseDatasource() should be replaced with api.setServerSideDatasource()");
this.setServerSideDatasource(datasource);
};
GridApi.prototype.setServerSideDatasource = function (datasource) {
if (this.gridOptionsWrapper.isRowModelServerSide()) {
// should really have an IEnterpriseRowModel interface, so we are not casting to any
this.rowModel.setDatasource(datasource);
}
else {
console.warn("ag-Grid: you can only use an enterprise datasource when gridOptions.rowModelType is '" + constants_1.Constants.ROW_MODEL_TYPE_SERVER_SIDE + "'");
}
};
GridApi.prototype.setDatasource = function (datasource) {
if (this.gridOptionsWrapper.isRowModelInfinite()) {
this.rowModel.setDatasource(datasource);
}
else {
console.warn("ag-Grid: you can only use a datasource when gridOptions.rowModelType is '" + constants_1.Constants.ROW_MODEL_TYPE_INFINITE + "'");
}
};
GridApi.prototype.setViewportDatasource = function (viewportDatasource) {
if (this.gridOptionsWrapper.isRowModelViewport()) {
// this is bad coding, because it's using an interface that's exposed in the enterprise.
// really we should create an interface in the core for viewportDatasource and let
// the enterprise implement it, rather than casting to 'any' here
this.rowModel.setViewportDatasource(viewportDatasource);
}
else {
console.warn("ag-Grid: you can only use a viewport datasource when gridOptions.rowModelType is '" + constants_1.Constants.ROW_MODEL_TYPE_VIEWPORT + "'");
}
};
GridApi.prototype.setRowData = function (rowData) {
if (this.gridOptionsWrapper.isRowModelDefault()) {
if (this.gridOptionsWrapper.isDeltaRowDataMode()) {
var _a = this.immutableService.createTransactionForRowData(rowData), transaction = _a[0], orderIdMap = _a[1];
this.clientSideRowModel.updateRowData(transaction, orderIdMap);
// need to force updating of full width rows - note this wouldn't be necessary the full width cell comp listened
// to the data change event on the row node and refreshed itself.
this.rowRenderer.refreshFullWidthRows();
}
else {
this.selectionController.reset();
this.clientSideRowModel.setRowData(rowData);
}
}
else {
console.warn('cannot call setRowData unless using normal row model');
}
};
/** @deprecated */
GridApi.prototype.setFloatingTopRowData = function (rows) {
console.warn('ag-Grid: since v12, api.setFloatingTopRowData() is now api.setPinnedTopRowData()');
this.setPinnedTopRowData(rows);
};
/** @deprecated */
GridApi.prototype.setFloatingBottomRowData = function (rows) {
console.warn('ag-Grid: since v12, api.setFloatingBottomRowData() is now api.setPinnedBottomRowData()');
this.setPinnedBottomRowData(rows);
};
/** @deprecated */
GridApi.prototype.getFloatingTopRowCount = function () {
console.warn('ag-Grid: since v12, api.getFloatingTopRowCount() is now api.getPinnedTopRowCount()');
return this.getPinnedTopRowCount();
};
/** @deprecated */
GridApi.prototype.getFloatingBottomRowCount = function () {
console.warn('ag-Grid: since v12, api.getFloatingBottomRowCount() is now api.getPinnedBottomRowCount()');
return this.getPinnedBottomRowCount();
};
/** @deprecated */
GridApi.prototype.getFloatingTopRow = function (index) {
console.warn('ag-Grid: since v12, api.getFloatingTopRow() is now api.getPinnedTopRow()');
return this.getPinnedTopRow(index);
};
/** @deprecated */
GridApi.prototype.getFloatingBottomRow = function (index) {
console.warn('ag-Grid: since v12, api.getFloatingBottomRow() is now api.getPinnedBottomRow()');
return this.getPinnedBottomRow(index);
};
GridApi.prototype.setPinnedTopRowData = function (rows) {
this.pinnedRowModel.setPinnedTopRowData(rows);
};
GridApi.prototype.setPinnedBottomRowData = function (rows) {
this.pinnedRowModel.setPinnedBottomRowData(rows);
};
GridApi.prototype.getPinnedTopRowCount = function () {
return this.pinnedRowModel.getPinnedTopRowCount();
};
GridApi.prototype.getPinnedBottomRowCount = function () {
return this.pinnedRowModel.getPinnedBottomRowCount();
};
GridApi.prototype.getPinnedTopRow = function (index) {
return this.pinnedRowModel.getPinnedTopRow(index);
};
GridApi.prototype.getPinnedBottomRow = function (index) {
return this.pinnedRowModel.getPinnedBottomRow(index);
};
GridApi.prototype.setColumnDefs = function (colDefs, source) {
if (source === void 0) { source = "api"; }
this.columnController.setColumnDefs(colDefs, source);
};
GridApi.prototype.expireValueCache = function () {
this.valueCache.expire();
};
GridApi.prototype.getVerticalPixelRange = function () {
return this.gridPanel.getVScrollPosition();
};
GridApi.prototype.getHorizontalPixelRange = function () {
return this.gridPanel.getHScrollPosition();
};
GridApi.prototype.setAlwaysShowVerticalScroll = function (show) {
this.gridOptionsWrapper.setProperty('alwaysShowVerticalScroll', show);
};
GridApi.prototype.refreshToolPanel = function () {
this.gridCore.refreshSideBar();
};
GridApi.prototype.refreshCells = function (params) {
if (params === void 0) { params = {}; }
if (Array.isArray(params)) {
// the old version of refreshCells() took an array of rowNodes for the first argument
console.warn('since ag-Grid v11.1, refreshCells() now takes parameters, please see the documentation.');
return;
}
this.rowRenderer.refreshCells(params);
};
GridApi.prototype.flashCells = function (params) {
if (params === void 0) { params = {}; }
this.rowRenderer.flashCells(params);
};
GridApi.prototype.redrawRows = function (params) {
if (params === void 0) { params = {}; }
if (params && params.rowNodes) {
this.rowRenderer.redrawRows(params.rowNodes);
}
else {
this.rowRenderer.redrawAfterModelUpdate();
}
};
GridApi.prototype.timeFullRedraw = function (count) {
if (count === void 0) { count = 1; }
var iterationCount = 0;
var totalProcessing = 0;
var totalReflow = 0;
var that = this;
doOneIteration();
function doOneIteration() {
var start = (new Date()).getTime();
that.rowRenderer.redrawAfterModelUpdate();
var endProcessing = (new Date()).getTime();
window.setTimeout(function () {
var endReflow = (new Date()).getTime();
var durationProcessing = endProcessing - start;
var durationReflow = endReflow - endProcessing;
// tslint:disable-next-line
console.log('duration: processing = ' + durationProcessing + 'ms, reflow = ' + durationReflow + 'ms');
iterationCount++;
totalProcessing += durationProcessing;
totalReflow += durationReflow;
if (iterationCount < count) {
// wait for 1s between tests
window.setTimeout(doOneIteration, 1000);
}
else {
finish();
}
}, 0);
}
function finish() {
// tslint:disable-next-line
console.log('tests complete. iteration count = ' + iterationCount);
// tslint:disable-next-line
console.log('average processing = ' + (totalProcessing / iterationCount) + 'ms');
// tslint:disable-next-line
console.log('average reflow = ' + (totalReflow / iterationCount) + 'ms');
}
};
/** @deprecated */
GridApi.prototype.refreshView = function () {
console.warn('ag-Grid: since v11.1, refreshView() is deprecated, please call refreshCells() or redrawRows() instead');
this.redrawRows();
};
//** @deprecated */
GridApi.prototype.refreshRows = function (rowNodes) {
console.warn('since ag-Grid v11.1, refreshRows() is deprecated, please use refreshCells({rowNodes: rows}) or redrawRows({rowNodes: rows}) instead');
this.refreshCells({ rowNodes: rowNodes });
};
/** @deprecated */
GridApi.prototype.rowDataChanged = function (rows) {
console.warn('ag-Grid: rowDataChanged is deprecated, either call refreshView() to refresh everything, or call rowNode.setRowData(newData) to set value on a particular node');
this.redrawRows();
};
/** @deprecated */
GridApi.prototype.softRefreshView = function () {
console.error('ag-Grid: since v16, softRefreshView() is no longer supported. Please check the documentation on how to refresh.');
};
/** @deprecated */
GridApi.prototype.refreshGroupRows = function () {
console.warn('ag-Grid: since v11.1, refreshGroupRows() is no longer supported, call refreshCells() instead. ' +
'Because refreshCells() now does dirty checking, it will only refresh cells that have changed, so it should ' +
'not be necessary to only refresh the group rows.');
this.refreshCells();
};
GridApi.prototype.setFunctionsReadOnly = function (readOnly) {
this.gridOptionsWrapper.setProperty('functionsReadOnly', readOnly);
};
GridApi.prototype.refreshHeader = function () {
this.headerRootComp.refreshHeader();
this.gridPanel.setHeaderAndFloatingHeights();
};
GridApi.prototype.isAnyFilterPresent = function () {
return this.filterManager.isAnyFilterPresent();
};
GridApi.prototype.isAdvancedFilterPresent = function () {
console.warn('ag-Grid: isAdvancedFilterPresent() is deprecated, please use isColumnFilterPresent()');
return this.isColumnFilterPresent();
};
GridApi.prototype.isColumnFilterPresent = function () {
return this.filterManager.isAdvancedFilterPresent();
};
GridApi.prototype.isQuickFilterPresent = function () {
return this.filterManager.isQuickFilterPresent();
};
GridApi.prototype.getModel = function () {
return this.rowModel;
};
GridApi.prototype.setRowNodeExpanded = function (rowNode, expanded) {
if (rowNode) {
rowNode.setExpanded(expanded);
}
};
GridApi.prototype.onGroupExpandedOrCollapsed = function (deprecated_refreshFromIndex) {
if (utils_1._.missing(this.clientSideRowModel)) {
console.warn('ag-Grid: cannot call onGroupExpandedOrCollapsed unless using normal row model');
}
if (utils_1._.exists(deprecated_refreshFromIndex)) {
console.warn('ag-Grid: api.onGroupExpandedOrCollapsed - refreshFromIndex parameter is no longer used, the grid will refresh all rows');
}
// we don't really want the user calling this if only one rowNode was expanded, instead they should be
// calling rowNode.setExpanded(boolean) - this way we do a 'keepRenderedRows=false' so that the whole
// grid gets refreshed again - otherwise the row with the rowNodes that were changed won't get updated,
// and thus the expand icon in the group cell won't get 'opened' or 'closed'.
this.clientSideRowModel.refreshModel({ step: constants_1.Constants.STEP_MAP });
};
GridApi.prototype.refreshInMemoryRowModel = function (step) {
console.warn("ag-grid: since version 18.x, api.refreshInMemoryRowModel() should be replaced with api.refreshClientSideRowModel()");
this.refreshClientSideRowModel(step);
};
GridApi.prototype.refreshClientSideRowModel = function (step) {
if (utils_1._.missing(this.clientSideRowModel)) {
console.warn('cannot call refreshClientSideRowModel unless using normal row model');
}
var paramsStep = constants_1.Constants.STEP_EVERYTHING;
var stepsMapped = {
group: constants_1.Constants.STEP_EVERYTHING,
filter: constants_1.Constants.STEP_FILTER,
map: constants_1.Constants.STEP_MAP,
aggregate: constants_1.Constants.STEP_AGGREGATE,
sort: constants_1.Constants.STEP_SORT,
pivot: constants_1.Constants.STEP_PIVOT
};
if (utils_1._.exists(step)) {
paramsStep = stepsMapped[step];
}
if (utils_1._.missing(paramsStep)) {
console.error("ag-Grid: invalid step " + step + ", available steps are " + Object.keys(stepsMapped).join(', '));
return;
}
var modelParams = {
step: paramsStep,
keepRenderedRows: true,
animate: true,
keepEditingRows: true
};
this.clientSideRowModel.refreshModel(modelParams);
};
GridApi.prototype.isAnimationFrameQueueEmpty = function () {
return this.animationFrameService.isQueueEmpty();
};
GridApi.prototype.getRowNode = function (id) {
return this.rowModel.getRowNode(id);
};
GridApi.prototype.expandAll = function () {
if (utils_1._.missing(this.clientSideRowModel)) {
console.warn('ag-Grid: cannot call expandAll unless using normal row model');
return;
}
this.clientSideRowModel.expandOrCollapseAll(true);
};
GridApi.prototype.collapseAll = function () {
if (utils_1._.missing(this.clientSideRowModel)) {
console.warn('ag-Grid: cannot call collapseAll unless using normal row model');
return;
}
this.clientSideRowModel.expandOrCollapseAll(false);
};
GridApi.prototype.addVirtualRowListener = function (eventName, rowIndex, callback) {
if (typeof eventName !== 'string') {
console.warn('ag-Grid: addVirtualRowListener is deprecated, please use addRenderedRowListener.');
}
this.addRenderedRowListener(eventName, rowIndex, callback);
};
GridApi.prototype.addRenderedRowListener = function (eventName, rowIndex, callback) {
if (eventName === 'virtualRowSelected') {
console.warn("ag-Grid: event virtualRowSelected is deprecated, to register for individual row\n selection events, add a listener directly to the row node.");
}
this.rowRenderer.addRenderedRowListener(eventName, rowIndex, callback);
};
GridApi.prototype.setQuickFilter = function (newFilter) {
this.filterManager.setQuickFilter(newFilter);
};
GridApi.prototype.selectIndex = function (index, tryMulti, suppressEvents) {
console.warn('ag-Grid: do not use api for selection, call node.setSelected(value) instead');
if (suppressEvents) {
console.warn('ag-Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
}
this.selectionController.selectIndex(index, tryMulti);
};
GridApi.prototype.deselectIndex = function (index, suppressEvents) {
if (suppressEvents === void 0) { suppressEvents = false; }
console.warn('ag-Grid: do not use api for selection, call node.setSelected(value) instead');
if (suppressEvents) {
console.warn('ag-Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
}
this.selectionController.deselectIndex(index);
};
GridApi.prototype.selectNode = function (node, tryMulti, suppressEvents) {
if (tryMulti === void 0) { tryMulti = false; }
if (suppressEvents === void 0) { suppressEvents = false; }
console.warn('ag-Grid: API for selection is deprecated, call node.setSelected(value) instead');
if (suppressEvents) {
console.warn('ag-Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
}
node.setSelectedParams({ newValue: true, clearSelection: !tryMulti });
};
GridApi.prototype.deselectNode = function (node, suppressEvents) {
if (suppressEvents === void 0) { suppressEvents = false; }
console.warn('ag-Grid: API for selection is deprecated, call node.setSelected(value) instead');
if (suppressEvents) {
console.warn('ag-Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
}
node.setSelectedParams({ newValue: false });
};
GridApi.prototype.selectAll = function () {
this.selectionController.selectAllRowNodes();
};
GridApi.prototype.deselectAll = function () {
this.selectionController.deselectAllRowNodes();
};
GridApi.prototype.selectAllFiltered = function () {
this.selectionController.selectAllRowNodes(true);
};
GridApi.prototype.deselectAllFiltered = function () {
this.selectionController.deselectAllRowNodes(true);
};
GridApi.prototype.recomputeAggregates = function () {
if (utils_1._.missing(this.clientSideRowModel)) {
console.warn('cannot call recomputeAggregates unless using normal row model');
}
console.warn("recomputeAggregates is deprecated, please call api.refreshClientSideRowModel('aggregate') instead");
this.clientSideRowModel.refreshModel({ step: constants_1.Constants.STEP_AGGREGATE });
};
GridApi.prototype.sizeColumnsToFit = function () {
this.gridPanel.sizeColumnsToFit();
};
GridApi.prototype.showLoadingOverlay = function () {
this.gridPanel.showLoadingOverlay();
};
GridApi.prototype.showNoRowsOverlay = function () {
this.gridPanel.showNoRowsOverlay();
};
GridApi.prototype.hideOverlay = function () {
this.gridPanel.hideOverlay();
};
GridApi.prototype.isNodeSelected = function (node) {
console.warn('ag-Grid: no need to call api.isNodeSelected(), just call node.isSelected() instead');
return node.isSelected();
};
GridApi.prototype.getSelectedNodesById = function () {
console.error('ag-Grid: since version 3.4, getSelectedNodesById no longer exists, use getSelectedNodes() instead');
return null;
};
GridApi.prototype.getSelectedNodes = function () {
return this.selectionController.getSelectedNodes();
};
GridApi.prototype.getSelectedRows = function () {
return this.selectionController.getSelectedRows();
};
GridApi.prototype.getBestCostNodeSelection = function () {
return this.selectionController.getBestCostNodeSelection();
};
GridApi.prototype.getRenderedNodes = function () {
return this.rowRenderer.getRenderedNodes();
};
GridApi.prototype.ensureColIndexVisible = function (index) {
console.warn('ag-Grid: ensureColIndexVisible(index) no longer supported, use ensureColumnVisible(colKey) instead.');
};
GridApi.prototype.ensureColumnVisible = function (key) {
this.gridPanel.ensureColumnVisible(key);
};
// Valid values for position are bottom, middle and top
GridApi.prototype.ensureIndexVisible = function (index, position) {
this.gridPanel.ensureIndexVisible(index, position);
};
// Valid values for position are bottom, middle and top
GridApi.prototype.ensureNodeVisible = function (comparator, position) {
this.gridCore.ensureNodeVisible(comparator, position);
};
GridApi.prototype.forEachLeafNode = function (callback) {
if (utils_1._.missing(this.clientSideRowModel)) {
console.warn('cannot call forEachNode unless using normal row model');
}
this.clientSideRowModel.forEachLeafNode(callback);
};
GridApi.prototype.forEachNode = function (callback) {
this.rowModel.forEachNode(callback);
};
GridApi.prototype.forEachNodeAfterFilter = function (callback) {
if (utils_1._.missing(this.clientSideRowModel)) {
console.warn('cannot call forEachNodeAfterFilter unless using normal row model');
}
this.clientSideRowModel.forEachNodeAfterFilter(callback);
};
GridApi.prototype.forEachNodeAfterFilterAndSort = function (callback) {
if (utils_1._.missing(this.clientSideRowModel)) {
console.warn('cannot call forEachNodeAfterFilterAndSort unless using normal row model');
}
this.clientSideRowModel.forEachNodeAfterFilterAndSort(callback);
};
GridApi.prototype.getFilterApiForColDef = function (colDef) {
console.warn('ag-grid API method getFilterApiForColDef deprecated, use getFilterApi instead');
return this.getFilterInstance(colDef);
};
GridApi.prototype.getFilterInstance = function (key) {
var column = this.columnController.getPrimaryColumn(key);
if (column) {
return this.filterManager.getFilterComponent(column, 'NO_UI').resolveNow(null, function (filterComp) { return filterComp; });
}
};
GridApi.prototype.getFilterApi = function (key) {
console.warn('ag-Grid: getFilterApi is deprecated, use getFilterInstance instead');
return this.getFilterInstance(key);
};
GridApi.prototype.destroyFilter = function (key) {
var column = this.columnController.getPrimaryColumn(key);
if (column) {
return this.filterManager.destroyFilter(column, "filterDestroyed");
}
};
GridApi.prototype.getStatusPanel = function (key) {
if (this.statusBarService) {
return this.statusBarService.getStatusPanel(key);
}
};
GridApi.prototype.getColumnDef = function (key) {
var column = this.columnController.getPrimaryColumn(key);
if (column) {
return column.getColDef();
}
else {
return null;
}
};
GridApi.prototype.onFilterChanged = function () {
this.filterManager.onFilterChanged();
};
GridApi.prototype.onSortChanged = function () {
this.sortController.onSortChanged();
};
GridApi.prototype.setSortModel = function (sortModel, source) {
if (source === void 0) { source = "api"; }
this.sortController.setSortModel(sortModel, source);
};
GridApi.prototype.getSortModel = function () {
return this.sortController.getSortModel();
};
GridApi.prototype.setFilterModel = function (model) {
this.filterManager.setFilterModel(model);
};
GridApi.prototype.getFilterModel = function () {
return this.filterManager.getFilterModel();
};
GridApi.prototype.getFocusedCell = function () {
return this.focusedCellController.getFocusedCell();
};
GridApi.prototype.clearFocusedCell = function () {
return this.focusedCellController.clearFocusedCell();
};
GridApi.prototype.setFocusedCell = function (rowIndex, colKey, floating) {
this.focusedCellController.setFocusedCell(rowIndex, colKey, floating, true);
};
GridApi.prototype.setSuppressRowDrag = function (value) {
this.gridOptionsWrapper.setProperty(gridOptionsWrapper_1.GridOptionsWrapper.PROP_SUPPRESS_ROW_DRAG, value);
};
GridApi.prototype.setHeaderHeight = function (headerHeight) {
this.gridOptionsWrapper.setProperty(gridOptionsWrapper_1.GridOptionsWrapper.PROP_HEADER_HEIGHT, headerHeight);
this.doLayout();
};
GridApi.prototype.setGridAutoHeight = function (gridAutoHeight) {
console.warn('api.setGridAutoHeight(boolean) is deprecated, please use api.setDomLayout() instead');
this.setDomLayout(gridAutoHeight ? 'autoHeight' : 'normal');
};
GridApi.prototype.setDomLayout = function (domLayout) {
this.gridOptionsWrapper.setProperty(gridOptionsWrapper_1.GridOptionsWrapper.PROP_DOM_LAYOUT, domLayout);
};
GridApi.prototype.setEnableCellTextSelection = function (selectable) {
this.gridPanel.setCellTextSelection(selectable);
};
GridApi.prototype.setGroupHeaderHeight = function (headerHeight) {
this.gridOptionsWrapper.setProperty(gridOptionsWrapper_1.GridOptionsWrapper.PROP_GROUP_HEADER_HEIGHT, headerHeight);
this.doLayout();
};
GridApi.prototype.setFloatingFiltersHeight = function (headerHeight) {
this.gridOptionsWrapper.setProperty(gridOptionsWrapper_1.GridOptionsWrapper.PROP_FLOATING_FILTERS_HEIGHT, headerHeight);
this.doLayout();
};
GridApi.prototype.setPivotGroupHeaderHeight = function (headerHeight) {
this.gridOptionsWrapper.setProperty(gridOptionsWrapper_1.GridOptionsWrapper.PROP_PIVOT_GROUP_HEADER_HEIGHT, headerHeight);
this.doLayout();
};
GridApi.prototype.setPivotHeaderHeight = function (headerHeight) {
this.gridOptionsWrapper.setProperty(gridOptionsWrapper_1.GridOptionsWrapper.PROP_PIVOT_HEADER_HEIGHT, headerHeight);
this.doLayout();
};
GridApi.prototype.isSideBarVisible = function () {
return this.gridCore.isSideBarVisible();
};
GridApi.prototype.setSideBarVisible = function (show) {
this.gridCore.setSideBarVisible(show);
};
GridApi.prototype.showToolPanel = function (show) {
console.warn("ag-grid: from v19 api.showToolPanel has been deprecated in favour of api.setSideBarVisible");
this.setSideBarVisible(show);
};
GridApi.prototype.openToolPanel = function (key) {
this.gridCore.openToolPanel(key);
};
GridApi.prototype.closeToolPanel = function () {
this.gridCore.closeToolPanel();
};
GridApi.prototype.getOpenedToolPanel = function () {
return this.gridCore.getOpenedToolPanel();
};
GridApi.prototype.getSideBar = function () {
return this.gridCore.getSideBar();
};
GridApi.prototype.setSideBar = function (def) {
return this.gridCore.setSideBar(def);
};
GridApi.prototype.setSuppressClipboardPaste = function (value) {
this.gridOptionsWrapper.setProperty(gridOptionsWrapper_1.GridOptionsWrapper.PROP_SUPPRESS_CLIPBOARD_PASTE, value);
};
GridApi.prototype.isToolPanelShowing = function () {
return this.gridCore.isToolPanelShowing();
};
GridApi.prototype.doLayout = function () {
this.gridPanel.checkViewportAndScrolls();
};
GridApi.prototype.resetRowHeights = function () {
if (utils_1._.exists(this.clientSideRowModel)) {
this.clientSideRowModel.resetRowHeights();
}
};
GridApi.prototype.setGroupRemoveSingleChildren = function (value) {
this.gridOptionsWrapper.setProperty(gridOptionsWrapper_1.GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN, value);
};
GridApi.prototype.setGroupRemoveLowestSingleChildren = function (value) {
this.gridOptionsWrapper.setProperty(gridOptionsWrapper_1.GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, value);
};
GridApi.prototype.onRowHeightChanged = function () {
if (utils_1._.exists(this.clientSideRowModel)) {
this.clientSideRowModel.onRowHeightChanged();
}
};
GridApi.prototype.getValue = function (colKey, rowNode) {
var column = this.columnController.getPrimaryColumn(colKey);
if (utils_1._.missing(column)) {
column = this.columnController.getGridColumn(colKey);
}
if (utils_1._.missing(column)) {
return null;
}
else {
return this.valueService.getValue(column, rowNode);
}
};
GridApi.prototype.addEventListener = function (eventType, listener) {
var async = this.gridOptionsWrapper.useAsyncEvents();
this.eventService.addEventListener(eventType, listener, async);
};
GridApi.prototype.addGlobalListener = function (listener) {
var async = this.gridOptionsWrapper.useAsyncEvents();
this.eventService.addGlobalListener(listener, async);
};
GridApi.prototype.removeEventListener = function (eventType, listener) {
var async = this.gridOptionsWrapper.useAsyncEvents();
this.eventService.removeEventListener(eventType, listener, async);
};
GridApi.prototype.removeGlobalListener = function (listener) {
var async = this.gridOptionsWrapper.useAsyncEvents();
this.eventService.removeGlobalListener(listener, async);
};
GridApi.prototype.dispatchEvent = function (event) {
this.eventService.dispatchEvent(event);
};
GridApi.prototype.destroy = function () {
// destroy the UI first (as they use the services)
this.gridCore.destroy();
// destroy the services
this.context.destroy();
};
GridApi.prototype.resetQuickFilter = function () {
this.rowModel.forEachNode(function (node) { return node.quickFilterAggregateText = null; });
};
GridApi.prototype.getRangeSelections = function () {
console.warn("ag-Grid: in v20.1.x, api.getRangeSelections() is gone, please use getCellRanges() instead.\n We had to change how cell selections works a small bit to allow charting to integrate. The return type of\n getCellRanges() is a bit different, please check the ag-Grid documentation.");
return null;
};
GridApi.prototype.getCellRanges = function () {
if (this.rangeController) {
return this.rangeController.getCellRanges();
}
else {
console.warn('ag-Grid: cell range selection is only available in ag-Grid Enterprise');
return null;
}
};
GridApi.prototype.camelCaseToHumanReadable = function (camelCase) {
return utils_1._.camelCaseToHumanText(camelCase);
};
GridApi.prototype.addRangeSelection = function (deprecatedNoLongerUsed) {
console.warn('ag-Grid: As of version 21.x, range selection changed slightly to allow charting integration. Please call api.addCellRange() instead of api.addRangeSelection()');
};
GridApi.prototype.addCellRange = function (params) {
if (!this.rangeController) {
console.warn('ag-Grid: cell range selection is only available in ag-Grid Enterprise');
}
this.rangeController.addCellRange(params);
};
GridApi.prototype.clearRangeSelection = function () {
if (!this.rangeController) {
console.warn('ag-Grid: cell range selection is only available in ag-Grid Enterprise');
}
this.rangeController.removeAllCellRanges();
};
GridApi.prototype.chartRange = function (params) {
if (!this.context.isModuleRegistered("chartsModule" /* ChartsModule */)) {
utils_1._.doOnce(function () {
console.warn('ag-grid: Cannot chart range - the Charts Module has not been included.');
}, 'ChartsModuleCheck');
return;
}
return this.chartService.chartCellRange(params);
};
GridApi.prototype.copySelectedRowsToClipboard = function (includeHeader, columnKeys) {
if (!this.clipboardService) {
console.warn('ag-Grid: clipboard is only available in ag-Grid Enterprise');
}
this.clipboardService.copySelectedRowsToClipboard(includeHeader, columnKeys);
};
GridApi.prototype.copySelectedRangeToClipboard = function (includeHeader) {
if (!this.clipboardService) {
console.warn('ag-Grid: clipboard is only available in ag-Grid Enterprise');
}
this.clipboardService.copySelectedRangeToClipboard(includeHeader);
};
GridApi.prototype.copySelectedRangeDown = function () {
if (!this.clipboardService) {
console.warn('ag-Grid: clipboard is only available in ag-Grid Enterprise');
}
this.clipboardService.copyRangeDown();
};
GridApi.prototype.showColumnMenuAfterButtonClick = function (colKey, buttonElement) {
// use grid column so works with pivot mode
var column = this.columnController.getGridColumn(colKey);
this.menuFactory.showMenuAfterButtonClick(column, buttonElement);
};
GridApi.prototype.showColumnMenuAfterMouseClick = function (colKey, mouseEvent) {
// use grid column so works with pivot mode
var column = this.columnController.getGridColumn(colKey);
this.menuFactory.showMenuAfterMouseEvent(column, mouseEvent);
};
GridApi.prototype.hidePopupMenu = function () {
// hide the context menu if in enterprise
if (this.contextMenuFactory) {
this.contextMenuFactory.hideActiveMenu();
}
// and hide the column menu always
this.menuFactory.hideActiveMenu();
};
GridApi.prototype.setPopupParent = function (ePopupParent) {
this.gridOptionsWrapper.setProperty(gridOptionsWrapper_1.GridOptionsWrapper.PROP_POPUP_PARENT, ePopupParent);
};
GridApi.prototype.tabToNextCell = function () {
return this.rowRenderer.tabToNextCell(false);
};
GridApi.prototype.tabToPreviousCell = function () {
return this.rowRenderer.tabToNextCell(true);
};
GridApi.prototype.getCellRendererInstances = function (params) {
if (params === void 0) { params = {}; }
return this.rowRenderer.getCellRendererInstances(params);
};
GridApi.prototype.getCellEditorInstances = function (params) {
if (params === void 0) { params = {}; }
return this.rowRenderer.getCellEditorInstances(params);
};
GridApi.prototype.getEditingCells = function () {
return this.rowRenderer.getEditingCells();
};
GridApi.prototype.stopEditing = function (cancel) {
if (cancel === void 0) { cancel = false; }
this.rowRenderer.stopEditing(cancel);
};
GridApi.prototype.startEditingCell = function (params) {
var column = this.columnController.getGridColumn(params.colKey);
if (!column) {
console.warn("ag-Grid: no column found for " + params.colKey);
return;
}
var cellPosition = {
rowIndex: params.rowIndex,
rowPinned: params.rowPinned,
column: column
};
var notPinned = utils_1._.missing(params.rowPinned);
if (notPinned) {
this.gridPanel.ensureIndexVisible(params.rowIndex);
}
this.rowRenderer.startEditingCell(cellPosition, params.keyPress, params.charPress);
};
GridApi.prototype.addAggFunc = function (key, aggFunc) {
if (this.aggFuncService) {
this.aggFuncService.addAggFunc(key, aggFunc);
}
};
GridApi.prototype.addAggFuncs = function (aggFuncs) {
if (this.aggFuncService) {
this.aggFuncService.addAggFuncs(aggFuncs);
}
};
GridApi.prototype.clearAggFuncs = function () {
if (this.aggFuncService) {
this.aggFuncService.clear();
}
};
GridApi.prototype.updateRowData = function (rowDataTransaction) {
var res = null;
if (this.clientSideRowModel) {
res = this.clientSideRowModel.updateRowData(rowDataTransaction);
}
else if (this.infinitePageRowModel) {
this.infinitePageRowModel.updateRowData(rowDataTransaction);
}
else {
console.error('ag-Grid: updateRowData() only works with ClientSideRowModel and InfiniteRowModel.');
}
// refresh all the full width rows
this.rowRenderer.refreshFullWidthRows();
// do change detection for all present cells
if (!this.gridOptionsWrapper.isSuppressChangeDetection()) {
this.rowRenderer.refreshCells();
}
return res;
};
GridApi.prototype.batchUpdateRowData = function (rowDataTransaction, callback) {
if (!this.clientSideRowModel) {
console.error('ag-Grid: api.batchUpdateRowData() only works with ClientSideRowModel.');
return;
}
this.clientSideRowModel.batchUpdateRowData(rowDataTransaction, callback);
};
GridApi.prototype.insertItemsAtIndex = function (index, items, skipRefresh) {
if (skipRefresh === void 0) { skipRefresh = false; }
console.warn('ag-Grid: insertItemsAtIndex() is deprecated, use updateRowData(transaction) instead.');
this.updateRowData({ add: items, addIndex: index, update: null, remove: null });
};
GridApi.prototype.removeItems = function (rowNodes, skipRefresh) {
if (skipRefresh === void 0) { skipRefresh = false; }
console.warn('ag-Grid: removeItems() is deprecated, use updateRowData(transaction) instead.');
var dataToRemove = rowNodes.map(function (rowNode) { return rowNode.data; });
this.updateRowData({ add: null, addIndex: null, update: null, remove: dataToRemove });
};
GridApi.prototype.addItems = function (items, skipRefresh) {
if (skipRefresh === void 0) { skipRefresh = false; }
console.warn('ag-Grid: addItems() is deprecated, use updateRowData(transaction) instead.');
this.updateRowData({ add: items, addIndex: null, update: null, remove: null });
};
GridApi.prototype.refreshVirtualPageCache = function () {
console.warn('ag-Grid: refreshVirtualPageCache() is now called refreshInfiniteCache(), please call refreshInfiniteCache() instead');
this.refreshInfiniteCache();
};
GridApi.prototype.refreshInfinitePageCache = function () {
console.warn('ag-Grid: refreshInfinitePageCache() is now called refreshInfiniteCache(), please call refreshInfiniteCache() instead');
this.refreshInfiniteCache();
};
GridApi.prototype.refreshInfiniteCache = function () {
if (this.infinitePageRowModel) {
this.infinitePageRowModel.refreshCache();
}
else {
console.warn("ag-Grid: api.refreshInfiniteCache is only available when rowModelType='infinite'.");
}
};
GridApi.prototype.purgeVirtualPageCache = function () {
console.warn('ag-Grid: purgeVirtualPageCache() is now called purgeInfiniteCache(), please call purgeInfiniteCache() instead');
this.purgeInfinitePageCache();
};
GridApi.prototype.purgeInfinitePageCache = function () {
console.warn('ag-Grid: purgeInfinitePageCache() is now called purgeInfiniteCache(), please call purgeInfiniteCache() instead');
this.purgeInfiniteCache();
};
GridApi.prototype.purgeInfiniteCache = function () {
if (this.infinitePageRowModel) {
this.infinitePageRowModel.purgeCache();
}
else {
console.warn("ag-Grid: api.purgeInfiniteCache is only available when rowModelType='infinite'.");
}
};
/** @deprecated */
GridApi.prototype.purgeEnterpriseCache = function (route) {
console.warn("ag-grid: since version 18.x, api.purgeEnterpriseCache() should be replaced with api.purgeServerSideCache()");
this.purgeServerSideCache(route);
};
GridApi.prototype.purgeServerSideCache = function (route) {
if (this.serverSideRowModel) {
this.serverSideRowModel.purgeCache(route);
}
else {
console.warn("ag-Grid: api.purgeServerSideCache is only available when rowModelType='enterprise'.");
}
};
GridApi.prototype.getVirtualRowCount = function () {
console.warn('ag-Grid: getVirtualRowCount() is now called getInfiniteRowCount(), please call getInfiniteRowCount() instead');
return this.getInfiniteRowCount();
};
GridApi.prototype.getInfiniteRowCount = function () {
if (this.infinitePageRowModel) {
return this.infinitePageRowModel.getVirtualRowCount();
}
else {
console.warn("ag-Grid: api.getVirtualRowCount is only available when rowModelType='virtual'.");
}
};
GridApi.prototype.isMaxRowFound = function () {
if (this.infinitePageRowModel) {
return this.infinitePageRowModel.isMaxRowFound();
}
else {
console.warn("ag-Grid: api.isMaxRowFound is only available when rowModelType='virtual'.");
}
};
GridApi.prototype.setVirtualRowCount = function (rowCount, maxRowFound) {
console.warn('ag-Grid: setVirtualRowCount() is now called setInfiniteRowCount(), please call setInfiniteRowCount() instead');
this.setInfiniteRowCount(rowCount, maxRowFound);
};
GridApi.prototype.setInfiniteRowCount = function (rowCount, maxRowFound) {
if (this.infinitePageRowModel) {
this.infinitePageRowModel.setVirtualRowCount(rowCount, maxRowFound);
}
else {
console.warn("ag-Grid: api.setVirtualRowCount is only available when rowModelType='virtual'.");
}
};
GridApi.prototype.getVirtualPageState = function () {
console.warn('ag-Grid: getVirtualPageState() is now called getCacheBlockState(), please call getCacheBlockState() instead');
return this.getCacheBlockState();
};
GridApi.prototype.getInfinitePageState = function () {
console.warn('ag-Grid: getInfinitePageState() is now called getCacheBlockState(), please call getCacheBlockState() instead');
return this.getCacheBlockState();
};
GridApi.prototype.getCacheBlockState = function () {
if (this.infinitePageRowModel) {
return this.infinitePageRowModel.getBlockState();
}
else if (this.serverSideRowModel) {
return this.serverSideRowModel.getBlockState();
}
else {
console.warn("ag-Grid: api.getCacheBlockState() is only available when rowModelType='infinite' or rowModelType='serverSide'.");
}
};
GridApi.prototype.checkGridSize = function () {
this.gridPanel.setHeaderAndFloatingHeights();
};
GridApi.prototype.getFirstRenderedRow = function () {
console.warn('in ag-Grid v12, getFirstRenderedRow() was renamed to getFirstDisplayedRow()');
return this.getFirstDisplayedRow();
};
GridApi.prototype.getFirstDisplayedRow = function () {
return this.rowRenderer.getFirstVirtualRenderedRow();
};
GridApi.prototype.getLastRenderedRow = function () {
console.warn('in ag-Grid v12, getLastRenderedRow() was renamed to getLastDisplayedRow()');
return this.getLastDisplayedRow();
};
GridApi.prototype.getLastDisplayedRow = function () {
return this.rowRenderer.getLastVirtualRenderedRow();
};
GridApi.prototype.getDisplayedRowAtIndex = function (index) {
return this.rowModel.getRow(index);
};
GridApi.prototype.getDisplayedRowCount = function () {
return this.rowModel.getRowCount();
};
GridApi.prototype.paginationIsLastPageFound = function () {
return this.paginationProxy.isLastPageFound();
};
GridApi.prototype.paginationGetPageSize = function () {
return this.paginationProxy.getPageSize();
};
GridApi.prototype.paginationSetPageSize = function (size) {
this.gridOptionsWrapper.setProperty('paginationPageSize', size);
};
GridApi.prototype.paginationGetCurrentPage = function () {
return this.paginationProxy.getCurrentPage();
};
GridApi.prototype.paginationGetTotalPages = function () {
return this.paginationProxy.getTotalPages();
};
GridApi.prototype.paginationGetRowCount = function () {
return this.paginationProxy.getMasterRowCount();
};
GridApi.prototype.paginationGoToNextPage = function () {
this.paginationProxy.goToNextPage();
};
GridApi.prototype.paginationGoToPreviousPage = function () {
this.paginationProxy.goToPreviousPage();
};
GridApi.prototype.paginationGoToFirstPage = function () {
this.paginationProxy.goToFirstPage();
};
GridApi.prototype.paginationGoToLastPage = function () {
this.paginationProxy.goToLastPage();
};
GridApi.prototype.paginationGoToPage = function (page) {
this.paginationProxy.goToPage(page);
};
__decorate([
context_1.Autowired('immutableService'),
__metadata("design:type", immutableService_1.ImmutableService)
], GridApi.prototype, "immutableService", void 0);
__decorate([
context_1.Autowired('csvCreator'),
__metadata("design:type", csvCreator_1.CsvCreator)
], GridApi.prototype, "csvCreator", void 0);
__decorate([
context_1.Optional('excelCreator'),
__metadata("design:type", Object)
], GridApi.prototype, "excelCreator", void 0);
__decorate([
context_1.Autowired('rowRenderer'),
__metadata("design:type", rowRenderer_1.RowRenderer)
], GridApi.prototype, "rowRenderer", void 0);
__decorate([
context_1.Autowired('filterManager'),
__metadata("design:type", filterManager_1.FilterManager)
], GridApi.prototype, "filterManager", void 0);
__decorate([
context_1.Autowired('columnController'),
__metadata("design:type", columnController_1.ColumnController)
], GridApi.prototype, "columnController", void 0);
__decorate([
context_1.Autowired('selectionController'),
__metadata("design:type", selectionController_1.SelectionController)
], GridApi.prototype, "selectionController", void 0);
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], GridApi.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.Autowired('valueService'),
__metadata("design:type", valueService_1.ValueService)
], GridApi.prototype, "valueService", void 0);
__decorate([
context_1.Autowired('alignedGridsService'),
__metadata("design:type", alignedGridsService_1.AlignedGridsService)
], GridApi.prototype, "alignedGridsService", void 0);
__decorate([
context_1.Autowired('eventService'),
__metadata("design:type", eventService_1.EventService)
], GridApi.prototype, "eventService", void 0);
__decorate([
context_1.Autowired('pinnedRowModel'),
__metadata("design:type", pinnedRowModel_1.PinnedRowModel)
], GridApi.prototype, "pinnedRowModel", void 0);
__decorate([
context_1.Autowired('context'),
__metadata("design:type", context_1.Context)
], GridApi.prototype, "context", void 0);
__decorate([
context_1.Autowired('rowModel'),
__metadata("design:type", Object)
], GridApi.prototype, "rowModel", void 0);
__decorate([
context_1.Autowired('sortController'),
__metadata("design:type", sortController_1.SortController)
], GridApi.prototype, "sortController", void 0);
__decorate([
context_1.Autowired('paginationProxy'),
__metadata("design:type", paginationProxy_1.PaginationProxy)
], GridApi.prototype, "paginationProxy", void 0);
__decorate([
context_1.Autowired('focusedCellController'),
__metadata("design:type", focusedCellController_1.FocusedCellController)
], GridApi.prototype, "focusedCellController", void 0);
__decorate([
context_1.Optional('rangeController'),
__metadata("design:type", Object)
], GridApi.prototype, "rangeController", void 0);
__decorate([
context_1.Optional('clipboardService'),
__metadata("design:type", Object)
], GridApi.prototype, "clipboardService", void 0);
__decorate([
context_1.Optional('aggFuncService'),
__metadata("design:type", Object)
], GridApi.prototype, "aggFuncService", void 0);
__decorate([
context_1.Autowired('menuFactory'),
__metadata("design:type", Object)
], GridApi.prototype, "menuFactory", void 0);
__decorate([
context_1.Optional('contextMenuFactory'),
__metadata("design:type", Object)
], GridApi.prototype, "contextMenuFactory", void 0);
__decorate([
context_1.Autowired('cellRendererFactory'),
__metadata("design:type", cellRendererFactory_1.CellRendererFactory)
], GridApi.prototype, "cellRendererFactory", void 0);
__decorate([
context_1.Autowired('valueCache'),
__metadata("design:type", valueCache_1.ValueCache)
], GridApi.prototype, "valueCache", void 0);
__decorate([
context_1.Optional('sideBarComp'),
__metadata("design:type", Object)
], GridApi.prototype, "sideBarComp", void 0);
__decorate([
context_1.Autowired('animationFrameService'),
__metadata("design:type", animationFrameService_1.AnimationFrameService)
], GridApi.prototype, "animationFrameService", void 0);
__decorate([
context_1.Optional('statusBarService'),
__metadata("design:type", Object)
], GridApi.prototype, "statusBarService", void 0);
__decorate([
context_1.Optional('chartService'),
__metadata("design:type", Object)
], GridApi.prototype, "chartService", void 0);
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], GridApi.prototype, "init", null);
GridApi = __decorate([
context_1.Bean('gridApi')
], GridApi);
return GridApi;
}());
exports.GridApi = GridApi;
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var context_1 = __webpack_require__(13);
var gridSerializer_1 = __webpack_require__(20);
var downloader_1 = __webpack_require__(116);
var columnController_1 = __webpack_require__(21);
var valueService_1 = __webpack_require__(39);
var gridOptionsWrapper_1 = __webpack_require__(4);
var constants_1 = __webpack_require__(8);
var utils_1 = __webpack_require__(5);
var LINE_SEPARATOR = '\r\n';
var CsvSerializingSession = /** @class */ (function (_super) {
__extends(CsvSerializingSession, _super);
function CsvSerializingSession(config) {
var _this = _super.call(this, {
columnController: config.columnController,
valueService: config.valueService,
gridOptionsWrapper: config.gridOptionsWrapper,
processCellCallback: config.processCellCallback,
processHeaderCallback: config.processHeaderCallback
}) || this;
_this.result = '';
_this.lineOpened = false;
var suppressQuotes = config.suppressQuotes, columnSeparator = config.columnSeparator;
_this.suppressQuotes = suppressQuotes;
_this.columnSeparator = columnSeparator;
return _this;
}
CsvSerializingSession.prototype.prepare = function (columnsToExport) {
};
CsvSerializingSession.prototype.addCustomHeader = function (customHeader) {
if (!customHeader) {
return;
}
this.result += customHeader + LINE_SEPARATOR;
};
CsvSerializingSession.prototype.addCustomFooter = function (customFooter) {
if (!customFooter) {
return;
}
this.result += customFooter + LINE_SEPARATOR;
};
CsvSerializingSession.prototype.onNewHeaderGroupingRow = function () {
if (this.lineOpened) {
this.result += LINE_SEPARATOR;
}
return {
onColumn: this.onNewHeaderGroupingRowColumn.bind(this)
};
};
CsvSerializingSession.prototype.onNewHeaderGroupingRowColumn = function (header, index, span) {
if (index != 0) {
this.result += this.columnSeparator;
}
this.result += this.putInQuotes(header, this.suppressQuotes);
for (var i = 1; i <= span; i++) {
this.result += this.columnSeparator + this.putInQuotes("", this.suppressQuotes);
}
this.lineOpened = true;
};
CsvSerializingSession.prototype.onNewHeaderRow = function () {
if (this.lineOpened) {
this.result += LINE_SEPARATOR;
}
return {
onColumn: this.onNewHeaderRowColumn.bind(this)
};
};
CsvSerializingSession.prototype.onNewHeaderRowColumn = function (column, index, node) {
if (index != 0) {
this.result += this.columnSeparator;
}
this.result += this.putInQuotes(this.extractHeaderValue(column), this.suppressQuotes);
this.lineOpened = true;
};
CsvSerializingSession.prototype.onNewBodyRow = function () {
if (this.lineOpened) {
this.result += LINE_SEPARATOR;
}
return {
onColumn: this.onNewBodyRowColumn.bind(this)
};
};
CsvSerializingSession.prototype.onNewBodyRowColumn = function (column, index, node) {
if (index != 0) {
this.result += this.columnSeparator;
}
this.result += this.putInQuotes(this.extractRowCellValue(column, index, constants_1.Constants.EXPORT_TYPE_CSV, node), this.suppressQuotes);
this.lineOpened = true;
};
CsvSerializingSession.prototype.putInQuotes = function (value, suppressQuotes) {
if (suppressQuotes) {
return value;
}
if (value === null || value === undefined) {
return '""';
}
var stringValue;
if (typeof value === 'string') {
stringValue = value;
}
else if (typeof value.toString === 'function') {
stringValue = value.toString();
}
else {
console.warn('unknown value type during csv conversion');
stringValue = '';
}
// replace each " with "" (ie two sets of double quotes is how to do double quotes in csv)
var valueEscaped = stringValue.replace(/"/g, "\"\"");
return '"' + valueEscaped + '"';
};
CsvSerializingSession.prototype.parse = function () {
return this.result;
};
return CsvSerializingSession;
}(gridSerializer_1.BaseGridSerializingSession));
exports.CsvSerializingSession = CsvSerializingSession;
var BaseCreator = /** @class */ (function () {
function BaseCreator() {
}
BaseCreator.prototype.setBeans = function (beans) {
this.beans = beans;
};
BaseCreator.prototype.export = function (userParams) {
if (this.isExportSuppressed()) {
console.warn("ag-grid: Export cancelled. Export is not allowed as per your configuration.");
return '';
}
var _a = this.getMergedParamsAndData(userParams), mergedParams = _a.mergedParams, data = _a.data;
var fileNamePresent = mergedParams && mergedParams.fileName && mergedParams.fileName.length !== 0;
var fileName = fileNamePresent ? mergedParams.fileName : this.getDefaultFileName();
if (fileName.indexOf(".") === -1) {
fileName = fileName + "." + this.getDefaultFileExtension();
}
this.beans.downloader.download(fileName, this.packageFile(data));
return data;
};
BaseCreator.prototype.getData = function (params) {
return this.getMergedParamsAndData(params).data;
};
BaseCreator.prototype.getMergedParamsAndData = function (userParams) {
var mergedParams = this.mergeDefaultParams(userParams);
var data = this.beans.gridSerializer.serialize(this.createSerializingSession(mergedParams), mergedParams);
return { mergedParams: mergedParams, data: data };
};
BaseCreator.prototype.mergeDefaultParams = function (userParams) {
var baseParams = this.beans.gridOptionsWrapper.getDefaultExportParams();
var params = {};
utils_1._.assign(params, baseParams);
utils_1._.assign(params, userParams);
return params;
};
BaseCreator.prototype.packageFile = function (data) {
return new Blob(["\ufeff", data], {
type: window.navigator.msSaveOrOpenBlob ? this.getMimeType() : 'octet/stream'
});
};
return BaseCreator;
}());
exports.BaseCreator = BaseCreator;
var CsvCreator = /** @class */ (function (_super) {
__extends(CsvCreator, _super);
function CsvCreator() {
return _super !== null && _super.apply(this, arguments) || this;
}
CsvCreator.prototype.postConstruct = function () {
this.setBeans({
downloader: this.downloader,
gridSerializer: this.gridSerializer,
gridOptionsWrapper: this.gridOptionsWrapper
});
};
CsvCreator.prototype.exportDataAsCsv = function (params) {
return this.export(params);
};
CsvCreator.prototype.getDataAsCsv = function (params) {
return this.getData(params);
};
CsvCreator.prototype.getMimeType = function () {
return 'text/csv;charset=utf-8;';
};
CsvCreator.prototype.getDefaultFileName = function () {
return 'export.csv';
};
CsvCreator.prototype.getDefaultFileExtension = function () {
return 'csv';
};
CsvCreator.prototype.createSerializingSession = function (params) {
var _a = this, columnController = _a.columnController, valueService = _a.valueService, gridOptionsWrapper = _a.gridOptionsWrapper;
var _b = params, processCellCallback = _b.processCellCallback, processHeaderCallback = _b.processHeaderCallback, suppressQuotes = _b.suppressQuotes, columnSeparator = _b.columnSeparator;
return new CsvSerializingSession({
columnController: columnController,
valueService: valueService,
gridOptionsWrapper: gridOptionsWrapper,
processCellCallback: processCellCallback || undefined,
processHeaderCallback: processHeaderCallback || undefined,
suppressQuotes: suppressQuotes || false,
columnSeparator: columnSeparator || ','
});
};
CsvCreator.prototype.isExportSuppressed = function () {
return this.gridOptionsWrapper.isSuppressCsvExport();
};
__decorate([
context_1.Autowired('columnController'),
__metadata("design:type", columnController_1.ColumnController)
], CsvCreator.prototype, "columnController", void 0);
__decorate([
context_1.Autowired('valueService'),
__metadata("design:type", valueService_1.ValueService)
], CsvCreator.prototype, "valueService", void 0);
__decorate([
context_1.Autowired('downloader'),
__metadata("design:type", downloader_1.Downloader)
], CsvCreator.prototype, "downloader", void 0);
__decorate([
context_1.Autowired('gridSerializer'),
__metadata("design:type", gridSerializer_1.GridSerializer)
], CsvCreator.prototype, "gridSerializer", void 0);
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], CsvCreator.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], CsvCreator.prototype, "postConstruct", null);
CsvCreator = __decorate([
context_1.Bean('csvCreator')
], CsvCreator);
return CsvCreator;
}(BaseCreator));
exports.CsvCreator = CsvCreator;
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var context_1 = __webpack_require__(13);
var columnController_1 = __webpack_require__(21);
var constants_1 = __webpack_require__(8);
var selectionController_1 = __webpack_require__(37);
var gridOptionsWrapper_1 = __webpack_require__(4);
var displayedGroupCreator_1 = __webpack_require__(28);
var columnFactory_1 = __webpack_require__(3);
var groupInstanceIdCreator_1 = __webpack_require__(114);
var columnGroup_1 = __webpack_require__(22);
var pinnedRowModel_1 = __webpack_require__(51);
var utils_1 = __webpack_require__(5);
var BaseGridSerializingSession = /** @class */ (function () {
function BaseGridSerializingSession(config) {
var columnController = config.columnController, valueService = config.valueService, gridOptionsWrapper = config.gridOptionsWrapper, processCellCallback = config.processCellCallback, processHeaderCallback = config.processHeaderCallback, cellAndHeaderEscaper = config.cellAndHeaderEscaper;
this.columnController = columnController;
this.valueService = valueService;
this.gridOptionsWrapper = gridOptionsWrapper;
this.processCellCallback = processCellCallback;
this.processHeaderCallback = processHeaderCallback;
this.cellAndHeaderEscaper = cellAndHeaderEscaper;
}
BaseGridSerializingSession.prototype.extractHeaderValue = function (column) {
var nameForCol = this.getHeaderName(this.processHeaderCallback, column);
if (nameForCol === null || nameForCol === undefined) {
nameForCol = '';
}
return this.cellAndHeaderEscaper ? this.cellAndHeaderEscaper(nameForCol) : nameForCol;
};
BaseGridSerializingSession.prototype.extractRowCellValue = function (column, index, type, node) {
var isRowGrouping = this.columnController.getRowGroupColumns().length > 0;
var valueForCell;
if (node && node.group && isRowGrouping && index === 0) {
valueForCell = this.createValueForGroupNode(node);
}
else {
valueForCell = this.valueService.getValue(column, node);
}
valueForCell = this.processCell(node, column, valueForCell, this.processCellCallback, type);
if (valueForCell === null || valueForCell === undefined) {
valueForCell = '';
}
return this.cellAndHeaderEscaper ? this.cellAndHeaderEscaper(valueForCell) : valueForCell;
};
BaseGridSerializingSession.prototype.getHeaderName = function (callback, column) {
if (callback) {
return callback({
column: column,
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi(),
context: this.gridOptionsWrapper.getContext()
});
}
else {
return this.columnController.getDisplayNameForColumn(column, 'csv', true);
}
};
BaseGridSerializingSession.prototype.createValueForGroupNode = function (node) {
var keys = [node.key];
while (node.parent) {
node = node.parent;
keys.push(node.key);
}
return keys.reverse().join(' -> ');
};
BaseGridSerializingSession.prototype.processCell = function (rowNode, column, value, processCellCallback, type) {
if (processCellCallback) {
return processCellCallback({
column: column,
node: rowNode,
value: value,
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi(),
context: this.gridOptionsWrapper.getContext(),
type: type
});
}
else {
return value;
}
};
return BaseGridSerializingSession;
}());
exports.BaseGridSerializingSession = BaseGridSerializingSession;
var GridSerializer = /** @class */ (function () {
function GridSerializer() {
}
GridSerializer.prototype.serialize = function (gridSerializingSession, params) {
var dontSkipRows = function () { return false; };
var skipGroups = params && params.skipGroups;
var skipHeader = params && params.skipHeader;
var columnGroups = params && params.columnGroups;
var skipFooters = params && params.skipFooters;
var skipPinnedTop = params && params.skipPinnedTop;
var skipPinnedBottom = params && params.skipPinnedBottom;
var includeCustomHeader = params && params.customHeader;
var includeCustomFooter = params && params.customFooter;
var allColumns = params && params.allColumns;
var onlySelected = params && params.onlySelected;
var columnKeys = params && params.columnKeys;
var onlySelectedAllPages = params && params.onlySelectedAllPages;
var rowSkipper = (params && params.shouldRowBeSkipped) || dontSkipRows;
var api = this.gridOptionsWrapper.getApi();
var skipSingleChildrenGroup = this.gridOptionsWrapper.isGroupRemoveSingleChildren();
var skipLowestSingleChildrenGroup = this.gridOptionsWrapper.isGroupRemoveLowestSingleChildren();
var context = this.gridOptionsWrapper.getContext();
// when in pivot mode, we always render cols on screen, never 'all columns'
var isPivotMode = this.columnController.isPivotMode();
var rowModelNormal = this.rowModel.getType() === constants_1.Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
var onlySelectedNonStandardModel = !rowModelNormal && onlySelected;
var columnsToExport = [];
if (utils_1._.existsAndNotEmpty(columnKeys)) {
columnsToExport = this.columnController.getGridColumns(columnKeys);
}
else if (allColumns && !isPivotMode) {
// add auto group column for tree data
columnsToExport = this.gridOptionsWrapper.isTreeData() ?
this.columnController.getGridColumns([constants_1.Constants.GROUP_AUTO_COLUMN_ID]) : [];
columnsToExport = columnsToExport.concat(this.columnController.getAllPrimaryColumns() || []);
}
else {
columnsToExport = this.columnController.getAllDisplayedColumns();
}
if (includeCustomHeader) {
gridSerializingSession.addCustomHeader(includeCustomHeader);
}
gridSerializingSession.prepare(columnsToExport);
// first pass, put in the header names of the cols
if (columnGroups) {
var groupInstanceIdCreator = new groupInstanceIdCreator_1.GroupInstanceIdCreator();
var displayedGroups = this.displayedGroupCreator.createDisplayedGroups(columnsToExport, this.columnController.getGridBalancedTree(), groupInstanceIdCreator, null);
this.recursivelyAddHeaderGroups(displayedGroups, gridSerializingSession);
}
if (!skipHeader) {
var gridRowIterator_1 = gridSerializingSession.onNewHeaderRow();
columnsToExport.forEach(function (column, index) {
gridRowIterator_1.onColumn(column, index, undefined);
});
}
this.pinnedRowModel.forEachPinnedTopRow(processRow);
if (isPivotMode) {
if (this.rowModel.forEachPivotNode) {
this.rowModel.forEachPivotNode(processRow);
}
else {
//Must be enterprise, so we can just loop through all the nodes
this.rowModel.forEachNode(processRow);
}
}
else {
// onlySelectedAllPages: user doing pagination and wants selected items from
// other pages, so cannot use the standard row model as it won't have rows from
// other pages.
// onlySelectedNonStandardModel: if user wants selected in non standard row model
// (eg viewport) then again rowmodel cannot be used, so need to use selected instead.
if (onlySelectedAllPages || onlySelectedNonStandardModel) {
var selectedNodes = this.selectionController.getSelectedNodes();
selectedNodes.forEach(function (node) {
processRow(node);
});
}
else {
// here is everything else - including standard row model and selected. we don't use
// the selection model even when just using selected, so that the result is the order
// of the rows appearing on the screen.
if (rowModelNormal) {
this.rowModel.forEachNodeAfterFilterAndSort(processRow);
}
else {
this.rowModel.forEachNode(processRow);
}
}
}
this.pinnedRowModel.forEachPinnedBottomRow(processRow);
if (includeCustomFooter) {
gridSerializingSession.addCustomFooter(includeCustomFooter);
}
function processRow(node) {
var shouldSkipLowestGroup = skipLowestSingleChildrenGroup && node.leafGroup;
var shouldSkipCurrentGroup = node.allChildrenCount === 1 && (skipSingleChildrenGroup || shouldSkipLowestGroup);
if (node.group && (skipGroups || shouldSkipCurrentGroup)) {
return;
}
if (skipFooters && node.footer) {
return;
}
if (onlySelected && !node.isSelected()) {
return;
}
if (skipPinnedTop && node.rowPinned === 'top') {
return;
}
if (skipPinnedBottom && node.rowPinned === 'bottom') {
return;
}
// if we are in pivotMode, then the grid will show the root node only
// if it's not a leaf group
var nodeIsRootNode = node.level === -1;
if (nodeIsRootNode && !node.leafGroup) {
return;
}
var shouldRowBeSkipped = rowSkipper({
node: node,
api: api,
context: context
});
if (shouldRowBeSkipped) {
return;
}
var rowAccumulator = gridSerializingSession.onNewBodyRow();
columnsToExport.forEach(function (column, index) {
rowAccumulator.onColumn(column, index, node);
});
}
return gridSerializingSession.parse();
};
GridSerializer.prototype.recursivelyAddHeaderGroups = function (displayedGroups, gridSerializingSession) {
var directChildrenHeaderGroups = [];
displayedGroups.forEach(function (columnGroupChild) {
var columnGroup = columnGroupChild;
if (!columnGroup.getChildren) {
return;
}
columnGroup.getChildren().forEach(function (it) { return directChildrenHeaderGroups.push(it); });
});
if (displayedGroups.length > 0 && displayedGroups[0] instanceof columnGroup_1.ColumnGroup) {
this.doAddHeaderHeader(gridSerializingSession, displayedGroups);
}
if (directChildrenHeaderGroups && directChildrenHeaderGroups.length > 0) {
this.recursivelyAddHeaderGroups(directChildrenHeaderGroups, gridSerializingSession);
}
};
GridSerializer.prototype.doAddHeaderHeader = function (gridSerializingSession, displayedGroups) {
var _this = this;
var gridRowIterator = gridSerializingSession.onNewHeaderGroupingRow();
var columnIndex = 0;
displayedGroups.forEach(function (columnGroupChild) {
var columnGroup = columnGroupChild;
var columnName = _this.columnController.getDisplayNameForColumnGroup(columnGroup, 'header');
gridRowIterator.onColumn(columnName || '', columnIndex++, columnGroup.getLeafColumns().length - 1);
});
};
__decorate([
context_1.Autowired('displayedGroupCreator'),
__metadata("design:type", displayedGroupCreator_1.DisplayedGroupCreator)
], GridSerializer.prototype, "displayedGroupCreator", void 0);
__decorate([
context_1.Autowired('columnController'),
__metadata("design:type", columnController_1.ColumnController)
], GridSerializer.prototype, "columnController", void 0);
__decorate([
context_1.Autowired('rowModel'),
__metadata("design:type", Object)
], GridSerializer.prototype, "rowModel", void 0);
__decorate([
context_1.Autowired('pinnedRowModel'),
__metadata("design:type", pinnedRowModel_1.PinnedRowModel)
], GridSerializer.prototype, "pinnedRowModel", void 0);
__decorate([
context_1.Autowired('selectionController'),
__metadata("design:type", selectionController_1.SelectionController)
], GridSerializer.prototype, "selectionController", void 0);
__decorate([
context_1.Autowired('columnFactory'),
__metadata("design:type", columnFactory_1.ColumnFactory)
], GridSerializer.prototype, "columnFactory", void 0);
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], GridSerializer.prototype, "gridOptionsWrapper", void 0);
GridSerializer = __decorate([
context_1.Bean("gridSerializer")
], GridSerializer);
return GridSerializer;
}());
exports.GridSerializer = GridSerializer;
var RowType;
(function (RowType) {
RowType[RowType["HEADER_GROUPING"] = 0] = "HEADER_GROUPING";
RowType[RowType["HEADER"] = 1] = "HEADER";
RowType[RowType["BODY"] = 2] = "BODY";
})(RowType = exports.RowType || (exports.RowType = {}));
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
var columnGroup_1 = __webpack_require__(22);
var column_1 = __webpack_require__(23);
var gridOptionsWrapper_1 = __webpack_require__(4);
var expressionService_1 = __webpack_require__(27);
var columnFactory_1 = __webpack_require__(3);
var displayedGroupCreator_1 = __webpack_require__(28);
var autoWidthCalculator_1 = __webpack_require__(29);
var eventService_1 = __webpack_require__(11);
var columnUtils_1 = __webpack_require__(24);
var logger_1 = __webpack_require__(12);
var events_1 = __webpack_require__(15);
var originalColumnGroup_1 = __webpack_require__(25);
var groupInstanceIdCreator_1 = __webpack_require__(114);
var context_1 = __webpack_require__(13);
var columnAnimationService_1 = __webpack_require__(55);
var autoGroupColService_1 = __webpack_require__(115);
var valueCache_1 = __webpack_require__(40);
var gridApi_1 = __webpack_require__(18);
var columnApi_1 = __webpack_require__(26);
var utils_1 = __webpack_require__(5);
var ColumnController = /** @class */ (function () {
function ColumnController() {
// header row count, based on user provided columns
this.primaryHeaderRowCount = 0;
this.secondaryHeaderRowCount = 0;
this.secondaryColumnsPresent = false;
// header row count, either above, or based on pivoting if we are pivoting
this.gridHeaderRowCount = 0;
// these are the lists used by the rowRenderer to render nodes. almost the leaf nodes of the above
// displayed trees, however it also takes into account if the groups are open or not.
this.displayedLeftColumns = [];
this.displayedRightColumns = [];
this.displayedCenterColumns = [];
// all three lists above combined
this.allDisplayedColumns = [];
// same as above, except trimmed down to only columns within the viewport
this.allDisplayedVirtualColumns = [];
this.allDisplayedCenterVirtualColumns = [];
this.rowGroupColumns = [];
this.valueColumns = [];
this.pivotColumns = [];
this.ready = false;
this.autoGroupsNeedBuilding = false;
this.pivotMode = false;
this.bodyWidth = 0;
this.leftWidth = 0;
this.rightWidth = 0;
this.bodyWidthDirty = true;
}
ColumnController.prototype.init = function () {
var pivotMode = this.gridOptionsWrapper.isPivotMode();
this.suppressColumnVirtualisation = this.gridOptionsWrapper.isSuppressColumnVirtualisation();
if (this.isPivotSettingAllowed(pivotMode)) {
this.pivotMode = pivotMode;
}
this.usingTreeData = this.gridOptionsWrapper.isTreeData();
};
ColumnController.prototype.setColumnDefs = function (columnDefs, source) {
if (source === void 0) { source = "api"; }
var colsPreviouslyExisted = !!this.columnDefs;
this.columnDefs = columnDefs;
// always invalidate cache on changing columns, as the column id's for the new columns
// could overlap with the old id's, so the cache would return old values for new columns.
this.valueCache.expire();
// NOTE ==================
// we should be destroying the existing columns and groups if they exist, for example, the original column
// group adds a listener to the columns, it should be also removing the listeners
this.autoGroupsNeedBuilding = true;
var oldPrimaryColumns = this.primaryColumns;
var balancedTreeResult = this.columnFactory.createColumnTree(columnDefs, true, oldPrimaryColumns);
this.primaryColumnTree = balancedTreeResult.columnTree;
this.primaryHeaderRowCount = balancedTreeResult.treeDept + 1;
this.primaryColumns = this.getColumnsFromTree(this.primaryColumnTree);
this.extractRowGroupColumns(source, oldPrimaryColumns);
this.extractPivotColumns(source, oldPrimaryColumns);
this.createValueColumns(source, oldPrimaryColumns);
this.ready = true;
this.updateGridColumns();
this.updateDisplayedColumns(source);
this.checkDisplayedVirtualColumns();
if (this.gridOptionsWrapper.isDeltaColumnMode() && colsPreviouslyExisted) {
this.resetColumnState(true, source);
}
var eventEverythingChanged = {
type: events_1.Events.EVENT_COLUMN_EVERYTHING_CHANGED,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(eventEverythingChanged);
var newColumnsLoadedEvent = {
type: events_1.Events.EVENT_NEW_COLUMNS_LOADED,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEvent(newColumnsLoadedEvent);
};
ColumnController.prototype.isAutoRowHeightActive = function () {
return this.autoRowHeightColumns && this.autoRowHeightColumns.length > 0;
};
ColumnController.prototype.getAllAutoRowHeightCols = function () {
return this.autoRowHeightColumns;
};
ColumnController.prototype.setVirtualViewportLeftAndRight = function () {
if (this.gridOptionsWrapper.isEnableRtl()) {
this.viewportLeft = this.bodyWidth - this.scrollPosition - this.scrollWidth;
this.viewportRight = this.bodyWidth - this.scrollPosition;
}
else {
this.viewportLeft = this.scrollPosition;
this.viewportRight = this.scrollWidth + this.scrollPosition;
}
};
// used by clipboard service, to know what columns to paste into
ColumnController.prototype.getDisplayedColumnsStartingAt = function (column) {
var currentColumn = column;
var result = [];
while (currentColumn && utils_1._.exists(currentColumn)) {
result.push(currentColumn);
currentColumn = this.getDisplayedColAfter(currentColumn);
}
return result;
};
// checks what columns are currently displayed due to column virtualisation. fires an event
// if the list of columns has changed.
// + setColumnWidth(), setVirtualViewportPosition(), setColumnDefs(), sizeColumnsToFit()
ColumnController.prototype.checkDisplayedVirtualColumns = function () {
// check displayCenterColumnTree exists first, as it won't exist when grid is initialising
if (utils_1._.exists(this.displayedCenterColumns)) {
var hashBefore = this.allDisplayedVirtualColumns.map(function (column) { return column.getId(); }).join('#');
this.updateVirtualSets();
var hashAfter = this.allDisplayedVirtualColumns.map(function (column) { return column.getId(); }).join('#');
if (hashBefore !== hashAfter) {
var event_1 = {
type: events_1.Events.EVENT_VIRTUAL_COLUMNS_CHANGED,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEvent(event_1);
}
}
};
ColumnController.prototype.setVirtualViewportPosition = function (scrollWidth, scrollPosition) {
if (scrollWidth !== this.scrollWidth || scrollPosition !== this.scrollPosition || this.bodyWidthDirty) {
this.scrollWidth = scrollWidth;
this.scrollPosition = scrollPosition;
// we need to call setVirtualViewportLeftAndRight() at least once after the body width changes,
// as the viewport can stay the same, but in RTL, if body width changes, we need to work out the
// virtual columns again
this.bodyWidthDirty = true;
this.setVirtualViewportLeftAndRight();
if (this.ready) {
this.checkDisplayedVirtualColumns();
}
}
};
ColumnController.prototype.isPivotMode = function () {
return this.pivotMode;
};
ColumnController.prototype.isPivotSettingAllowed = function (pivot) {
if (pivot) {
if (this.gridOptionsWrapper.isTreeData()) {
console.warn("ag-Grid: Pivot mode not available in conjunction Tree Data i.e. 'gridOptions.treeData: true'");
return false;
}
else {
return true;
}
}
else {
return true;
}
};
ColumnController.prototype.setPivotMode = function (pivotMode, source) {
if (source === void 0) { source = "api"; }
if (pivotMode === this.pivotMode) {
return;
}
if (!this.isPivotSettingAllowed(this.pivotMode)) {
return;
}
this.pivotMode = pivotMode;
// we need to update grid columns to cover the scenario where user has groupSuppressAutoColumn=true, as
// this means we don't use auto group column UNLESS we are in pivot mode (it's mandatory in pivot mode),
// so need to updateGridColumn() to check it autoGroupCol needs to be added / removed
this.autoGroupsNeedBuilding = true;
this.updateGridColumns();
this.updateDisplayedColumns(source);
var event = {
type: events_1.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEvent(event);
};
ColumnController.prototype.getSecondaryPivotColumn = function (pivotKeys, valueColKey) {
if (!this.secondaryColumnsPresent) {
return null;
}
var valueColumnToFind = this.getPrimaryColumn(valueColKey);
var foundColumn = null;
if (this.secondaryColumns) {
this.secondaryColumns.forEach(function (column) {
var thisPivotKeys = column.getColDef().pivotKeys;
var pivotValueColumn = column.getColDef().pivotValueColumn;
var pivotKeyMatches = utils_1._.compareArrays(thisPivotKeys, pivotKeys);
var pivotValueMatches = pivotValueColumn === valueColumnToFind;
if (pivotKeyMatches && pivotValueMatches) {
foundColumn = column;
}
});
}
return foundColumn;
};
ColumnController.prototype.setBeans = function (loggerFactory) {
this.logger = loggerFactory.create('ColumnController');
};
ColumnController.prototype.setFirstRightAndLastLeftPinned = function (source) {
var lastLeft;
var firstRight;
if (this.gridOptionsWrapper.isEnableRtl()) {
lastLeft = this.displayedLeftColumns ? this.displayedLeftColumns[0] : null;
firstRight = this.displayedRightColumns ? utils_1._.last(this.displayedRightColumns) : null;
}
else {
lastLeft = this.displayedLeftColumns ? utils_1._.last(this.displayedLeftColumns) : null;
firstRight = this.displayedRightColumns ? this.displayedRightColumns[0] : null;
}
this.gridColumns.forEach(function (column) {
column.setLastLeftPinned(column === lastLeft, source);
column.setFirstRightPinned(column === firstRight, source);
});
};
ColumnController.prototype.autoSizeColumns = function (keys, source) {
// because of column virtualisation, we can only do this function on columns that are
// actually rendered, as non-rendered columns (outside the viewport and not rendered
// due to column virtualisation) are not present. this can result in all rendered columns
// getting narrowed, which in turn introduces more rendered columns on the RHS which
// did not get autosized in the original run, leaving the visible grid with columns on
// the LHS sized, but RHS no. so we keep looping through teh visible columns until
// no more cols are available (rendered) to be resized
var _this = this;
if (source === void 0) { source = "api"; }
// keep track of which cols we have resized in here
var columnsAutosized = [];
// initialise with anything except 0 so that while loop executes at least once
var changesThisTimeAround = -1;
while (changesThisTimeAround !== 0) {
changesThisTimeAround = 0;
this.actionOnGridColumns(keys, function (column) {
// if already autosized, skip it
if (columnsAutosized.indexOf(column) >= 0) {
return false;
}
// get how wide this col should be
var preferredWidth = _this.autoWidthCalculator.getPreferredWidthForColumn(column);
// preferredWidth = -1 if this col is not on the screen
if (preferredWidth > 0) {
var newWidth = _this.normaliseColumnWidth(column, preferredWidth);
column.setActualWidth(newWidth, source);
columnsAutosized.push(column);
changesThisTimeAround++;
}
return true;
}, source);
}
if (columnsAutosized.length > 0) {
var event_2 = {
type: events_1.Events.EVENT_COLUMN_RESIZED,
columns: columnsAutosized,
column: columnsAutosized.length === 1 ? columnsAutosized[0] : null,
finished: true,
api: this.gridApi,
columnApi: this.columnApi,
source: "autosizeColumns"
};
this.eventService.dispatchEvent(event_2);
}
};
ColumnController.prototype.autoSizeColumn = function (key, source) {
if (source === void 0) { source = "api"; }
if (key) {
this.autoSizeColumns([key], source);
}
};
ColumnController.prototype.autoSizeAllColumns = function (source) {
if (source === void 0) { source = "api"; }
var allDisplayedColumns = this.getAllDisplayedColumns();
this.autoSizeColumns(allDisplayedColumns, source);
};
ColumnController.prototype.getColumnsFromTree = function (rootColumns) {
var result = [];
recursiveFindColumns(rootColumns);
return result;
function recursiveFindColumns(childColumns) {
for (var i = 0; i < childColumns.length; i++) {
var child = childColumns[i];
if (child instanceof column_1.Column) {
result.push(child);
}
else if (child instanceof originalColumnGroup_1.OriginalColumnGroup) {
recursiveFindColumns(child.getChildren());
}
}
}
};
ColumnController.prototype.getAllDisplayedColumnGroups = function () {
if (this.displayedLeftColumnTree && this.displayedRightColumnTree && this.displayedCentreColumnTree) {
return this.displayedLeftColumnTree
.concat(this.displayedCentreColumnTree)
.concat(this.displayedRightColumnTree);
}
else {
return null;
}
};
// + columnSelectPanel
ColumnController.prototype.getPrimaryColumnTree = function () {
return this.primaryColumnTree;
};
// + gridPanel -> for resizing the body and setting top margin
ColumnController.prototype.getHeaderRowCount = function () {
return this.gridHeaderRowCount;
};
// + headerRenderer -> setting pinned body width
ColumnController.prototype.getLeftDisplayedColumnGroups = function () {
return this.displayedLeftColumnTree;
};
// + headerRenderer -> setting pinned body width
ColumnController.prototype.getRightDisplayedColumnGroups = function () {
return this.displayedRightColumnTree;
};
// + headerRenderer -> setting pinned body width
ColumnController.prototype.getCenterDisplayedColumnGroups = function () {
return this.displayedCentreColumnTree;
};
ColumnController.prototype.getDisplayedColumnGroups = function (type) {
switch (type) {
case column_1.Column.PINNED_LEFT:
return this.getLeftDisplayedColumnGroups();
case column_1.Column.PINNED_RIGHT:
return this.getRightDisplayedColumnGroups();
default:
return this.getCenterDisplayedColumnGroups();
}
};
// gridPanel -> ensureColumnVisible
ColumnController.prototype.isColumnDisplayed = function (column) {
return this.getAllDisplayedColumns().indexOf(column) >= 0;
};
// + csvCreator
ColumnController.prototype.getAllDisplayedColumns = function () {
return this.allDisplayedColumns;
};
ColumnController.prototype.getAllDisplayedVirtualColumns = function () {
return this.allDisplayedVirtualColumns;
};
ColumnController.prototype.getDisplayedLeftColumnsForRow = function (rowNode) {
if (!this.colSpanActive) {
return this.displayedLeftColumns;
}
else {
return this.getDisplayedColumnsForRow(rowNode, this.displayedLeftColumns);
}
};
ColumnController.prototype.getDisplayedRightColumnsForRow = function (rowNode) {
if (!this.colSpanActive) {
return this.displayedRightColumns;
}
else {
return this.getDisplayedColumnsForRow(rowNode, this.displayedRightColumns);
}
};
ColumnController.prototype.getDisplayedColumnsForRow = function (rowNode, displayedColumns, filterCallback, emptySpaceBeforeColumn) {
var result = [];
var lastConsideredCol = null;
var _loop_1 = function (i) {
var col = displayedColumns[i];
var maxAllowedColSpan = displayedColumns.length - i;
var colSpan = Math.min(col.getColSpan(rowNode), maxAllowedColSpan);
var columnsToCheckFilter = [col];
if (colSpan > 1) {
var colsToRemove = colSpan - 1;
for (var j = 1; j <= colsToRemove; j++) {
columnsToCheckFilter.push(displayedColumns[i + j]);
}
i += colsToRemove;
}
// see which cols we should take out for column virtualisation
var filterPasses;
if (filterCallback) {
// if user provided a callback, means some columns may not be in the viewport.
// the user will NOT provide a callback if we are talking about pinned areas,
// as pinned areas have no horizontal scroll and do not virtualise the columns.
// if lots of columns, that means column spanning, and we set filterPasses = true
// if one or more of the columns spanned pass the filter.
filterPasses = false;
columnsToCheckFilter.forEach(function (colForFilter) {
if (filterCallback(colForFilter)) {
filterPasses = true;
}
});
}
else {
filterPasses = true;
}
if (filterPasses) {
if (result.length === 0 && lastConsideredCol) {
var gapBeforeColumn = emptySpaceBeforeColumn ? emptySpaceBeforeColumn(col) : false;
if (gapBeforeColumn) {
result.push(lastConsideredCol);
}
}
result.push(col);
}
lastConsideredCol = col;
out_i_1 = i;
};
var out_i_1;
for (var i = 0; i < displayedColumns.length; i++) {
_loop_1(i);
i = out_i_1;
}
return result;
};
// + rowRenderer
// if we are not column spanning, this just returns back the virtual centre columns,
// however if we are column spanning, then different rows can have different virtual
// columns, so we have to work out the list for each individual row.
ColumnController.prototype.getAllDisplayedCenterVirtualColumnsForRow = function (rowNode) {
var _this = this;
if (!this.colSpanActive) {
return this.allDisplayedCenterVirtualColumns;
}
var emptySpaceBeforeColumn = function (col) { return col.getLeft() > _this.viewportLeft; };
// if doing column virtualisation, then we filter based on the viewport.
var filterCallback = this.suppressColumnVirtualisation ? null : this.isColumnInViewport.bind(this);
return this.getDisplayedColumnsForRow(rowNode, this.displayedCenterColumns, filterCallback, emptySpaceBeforeColumn);
};
ColumnController.prototype.isColumnInViewport = function (col) {
var columnLeft = col.getLeft();
var columnRight = col.getLeft() + col.getActualWidth();
// adding 200 for buffer size, so some cols off viewport are rendered.
// this helps horizontal scrolling so user rarely sees white space (unless
// they scroll horizontally fast). however we are conservative, as the more
// buffer the slower the vertical redraw speed
var leftBounds = this.viewportLeft - 200;
var rightBounds = this.viewportRight + 200;
var columnToMuchLeft = columnLeft < leftBounds && columnRight < leftBounds;
var columnToMuchRight = columnLeft > rightBounds && columnRight > rightBounds;
return !columnToMuchLeft && !columnToMuchRight;
};
// used by:
// + angularGrid -> setting pinned body width
// note: this should be cached
ColumnController.prototype.getPinnedLeftContainerWidth = function () {
return this.getWidthOfColsInList(this.displayedLeftColumns);
};
// note: this should be cached
ColumnController.prototype.getPinnedRightContainerWidth = function () {
return this.getWidthOfColsInList(this.displayedRightColumns);
};
ColumnController.prototype.updatePrimaryColumnList = function (keys, masterList, actionIsAdd, columnCallback, eventType, source) {
var _this = this;
if (source === void 0) { source = "api"; }
if (!keys || utils_1._.missingOrEmpty(keys)) {
return;
}
var atLeastOne = false;
keys.forEach(function (key) {
var columnToAdd = _this.getPrimaryColumn(key);
if (!columnToAdd) {
return;
}
if (actionIsAdd) {
if (masterList.indexOf(columnToAdd) >= 0) {
return;
}
masterList.push(columnToAdd);
}
else {
if (masterList.indexOf(columnToAdd) < 0) {
return;
}
utils_1._.removeFromArray(masterList, columnToAdd);
}
columnCallback(columnToAdd);
atLeastOne = true;
});
if (!atLeastOne) {
return;
}
if (this.autoGroupsNeedBuilding) {
this.updateGridColumns();
}
this.updateDisplayedColumns(source);
var event = {
type: eventType,
columns: masterList,
column: masterList.length === 1 ? masterList[0] : null,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event);
};
ColumnController.prototype.setRowGroupColumns = function (colKeys, source) {
if (source === void 0) { source = "api"; }
this.autoGroupsNeedBuilding = true;
this.setPrimaryColumnList(colKeys, this.rowGroupColumns, events_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.setRowGroupActive.bind(this), source);
};
ColumnController.prototype.setRowGroupActive = function (active, column, source) {
if (active === column.isRowGroupActive()) {
return;
}
column.setRowGroupActive(active, source);
if (!active && !this.gridOptionsWrapper.isSuppressMakeColumnVisibleAfterUnGroup()) {
column.setVisible(true, source);
}
};
ColumnController.prototype.addRowGroupColumn = function (key, source) {
if (source === void 0) { source = "api"; }
if (key) {
this.addRowGroupColumns([key], source);
}
};
ColumnController.prototype.addRowGroupColumns = function (keys, source) {
if (source === void 0) { source = "api"; }
this.autoGroupsNeedBuilding = true;
this.updatePrimaryColumnList(keys, this.rowGroupColumns, true, this.setRowGroupActive.bind(this, true), events_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, source);
};
ColumnController.prototype.removeRowGroupColumns = function (keys, source) {
if (source === void 0) { source = "api"; }
this.autoGroupsNeedBuilding = true;
this.updatePrimaryColumnList(keys, this.rowGroupColumns, false, this.setRowGroupActive.bind(this, false), events_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, source);
};
ColumnController.prototype.removeRowGroupColumn = function (key, source) {
if (source === void 0) { source = "api"; }
if (key) {
this.removeRowGroupColumns([key], source);
}
};
ColumnController.prototype.addPivotColumns = function (keys, source) {
if (source === void 0) { source = "api"; }
this.updatePrimaryColumnList(keys, this.pivotColumns, true, function (column) { return column.setPivotActive(true, source); }, events_1.Events.EVENT_COLUMN_PIVOT_CHANGED, source);
};
ColumnController.prototype.setPivotColumns = function (colKeys, source) {
if (source === void 0) { source = "api"; }
this.setPrimaryColumnList(colKeys, this.pivotColumns, events_1.Events.EVENT_COLUMN_PIVOT_CHANGED, function (added, column) {
column.setPivotActive(added, source);
}, source);
};
ColumnController.prototype.addPivotColumn = function (key, source) {
if (source === void 0) { source = "api"; }
this.addPivotColumns([key], source);
};
ColumnController.prototype.removePivotColumns = function (keys, source) {
if (source === void 0) { source = "api"; }
this.updatePrimaryColumnList(keys, this.pivotColumns, false, function (column) { return column.setPivotActive(false, source); }, events_1.Events.EVENT_COLUMN_PIVOT_CHANGED, source);
};
ColumnController.prototype.removePivotColumn = function (key, source) {
if (source === void 0) { source = "api"; }
this.removePivotColumns([key], source);
};
ColumnController.prototype.setPrimaryColumnList = function (colKeys, masterList, eventName, columnCallback, source) {
var _this = this;
masterList.length = 0;
if (utils_1._.exists(colKeys)) {
colKeys.forEach(function (key) {
var column = _this.getPrimaryColumn(key);
if (column) {
masterList.push(column);
}
});
}
this.primaryColumns.forEach(function (column) {
var added = masterList.indexOf(column) >= 0;
columnCallback(added, column);
});
if (this.autoGroupsNeedBuilding) {
this.updateGridColumns();
}
this.updateDisplayedColumns(source);
var event = {
type: eventName,
columns: masterList,
column: masterList.length === 1 ? masterList[0] : null,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event);
};
ColumnController.prototype.setValueColumns = function (colKeys, source) {
if (source === void 0) { source = "api"; }
this.setPrimaryColumnList(colKeys, this.valueColumns, events_1.Events.EVENT_COLUMN_VALUE_CHANGED, this.setValueActive.bind(this), source);
};
ColumnController.prototype.setValueActive = function (active, column, source) {
if (active === column.isValueActive()) {
return;
}
column.setValueActive(active, source);
if (active && !column.getAggFunc()) {
var defaultAggFunc = this.aggFuncService.getDefaultAggFunc(column);
column.setAggFunc(defaultAggFunc);
}
};
ColumnController.prototype.addValueColumns = function (keys, source) {
if (source === void 0) { source = "api"; }
this.updatePrimaryColumnList(keys, this.valueColumns, true, this.setValueActive.bind(this, true), events_1.Events.EVENT_COLUMN_VALUE_CHANGED, source);
};
ColumnController.prototype.addValueColumn = function (colKey, source) {
if (source === void 0) { source = "api"; }
if (colKey) {
this.addValueColumns([colKey], source);
}
};
ColumnController.prototype.removeValueColumn = function (colKey, source) {
if (source === void 0) { source = "api"; }
this.removeValueColumns([colKey], source);
};
ColumnController.prototype.removeValueColumns = function (keys, source) {
if (source === void 0) { source = "api"; }
this.updatePrimaryColumnList(keys, this.valueColumns, false, this.setValueActive.bind(this, false), events_1.Events.EVENT_COLUMN_VALUE_CHANGED, source);
};
// returns the width we can set to this col, taking into consideration min and max widths
ColumnController.prototype.normaliseColumnWidth = function (column, newWidth) {
if (newWidth < column.getMinWidth()) {
newWidth = column.getMinWidth();
}
if (column.isGreaterThanMax(newWidth)) {
newWidth = column.getMaxWidth();
}
return newWidth;
};
ColumnController.prototype.getPrimaryOrGridColumn = function (key) {
var column = this.getPrimaryColumn(key);
if (column) {
return column;
}
else {
return this.getGridColumn(key);
}
};
ColumnController.prototype.setColumnWidth = function (key, // @key - the column who's size we want to change
newWidth, // @newWidth - width in pixels
shiftKey, // @takeFromAdjacent - if user has 'shift' pressed, then pixels are taken from adjacent column
finished, // @finished - ends up in the event, tells the user if more events are to come
source) {
if (source === void 0) { source = "api"; }
var col = this.getPrimaryOrGridColumn(key);
if (!col) {
return;
}
var sets = [];
sets.push({
width: newWidth,
ratios: [1],
columns: [col]
});
// if user wants to do shift resize by default, then we invert the shift operation
var defaultIsShift = this.gridOptionsWrapper.getColResizeDefault() === 'shift';
if (defaultIsShift) {
shiftKey = !shiftKey;
}
if (shiftKey) {
var otherCol = this.getDisplayedColAfter(col);
if (!otherCol) {
return;
}
var widthDiff = col.getActualWidth() - newWidth;
var otherColWidth = otherCol.getActualWidth() + widthDiff;
sets.push({
width: otherColWidth,
ratios: [1],
columns: [otherCol]
});
}
this.resizeColumnSets(sets, finished, source);
};
ColumnController.prototype.checkMinAndMaxWidthsForSet = function (columnResizeSet) {
var columns = columnResizeSet.columns, width = columnResizeSet.width;
// every col has a min width, so sum them all up and see if we have enough room
// for all the min widths
var minWidthAccumulated = 0;
var maxWidthAccumulated = 0;
var maxWidthActive = true;
columns.forEach(function (col) {
minWidthAccumulated += col.getMinWidth();
if (col.getMaxWidth() > 0) {
maxWidthAccumulated += col.getMaxWidth();
}
else {
// if at least one columns has no max width, it means the group of columns
// then has no max width, as at least one column can take as much width as possible
maxWidthActive = false;
}
});
var minWidthPasses = width >= minWidthAccumulated;
var maxWidthPasses = !maxWidthActive || (width <= maxWidthAccumulated);
return minWidthPasses && maxWidthPasses;
};
// method takes sets of columns and resizes them. either all sets will be resized, or nothing
// be resized. this is used for example when user tries to resize a group and holds shift key,
// then both the current group (grows), and the adjacent group (shrinks), will get resized,
// so that's two sets for this method.
ColumnController.prototype.resizeColumnSets = function (resizeSets, finished, source) {
var passMinMaxCheck = utils_1._.every(resizeSets, this.checkMinAndMaxWidthsForSet.bind(this));
if (!passMinMaxCheck) {
// even though we are not going to resize beyond min/max size, we still need to raise event when finished
if (finished) {
var columns = resizeSets && resizeSets.length > 0 ? resizeSets[0].columns : null;
var event_3 = {
type: events_1.Events.EVENT_COLUMN_RESIZED,
columns: columns,
column: columns && columns.length === 1 ? columns[0] : null,
finished: finished,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event_3);
}
return; // don't resize!
}
var changedCols = [];
var allCols = [];
resizeSets.forEach(function (set) {
var width = set.width, columns = set.columns, ratios = set.ratios;
// keep track of pixels used, and last column gets the remaining,
// to cater for rounding errors, and min width adjustments
var newWidths = {};
var finishedCols = {};
columns.forEach(function (col) { return allCols.push(col); });
// the loop below goes through each col. if a col exceeds it's min/max width,
// it then gets set to its min/max width and the column is removed marked as 'finished'
// and the calculation is done again leaving this column out. take for example columns
// {A, width: 50, maxWidth: 100}
// {B, width: 50}
// {C, width: 50}
// and then the set is set to width 600 - on the first pass the grid tries to set each column
// to 200. it checks A and sees 200 > 100 and so sets the width to 100. col A is then marked
// as 'finished' and the calculation is done again with the remaining cols B and C, which end up
// splitting the remaining 500 pixels.
var finishedColsGrew = true;
var loopCount = 0;
var _loop_2 = function () {
loopCount++;
if (loopCount > 1000) {
// this should never happen, but in the future, someone might introduce a bug here,
// so we stop the browser from hanging and report bug properly
console.error('ag-Grid: infinite loop in resizeColumnSets');
return "break";
}
finishedColsGrew = false;
var subsetCols = [];
var subsetRatios = [];
var subsetRatioTotal = 0;
var pixelsToDistribute = width;
columns.forEach(function (col, index) {
var thisColFinished = finishedCols[col.getId()];
if (thisColFinished) {
pixelsToDistribute -= newWidths[col.getId()];
}
else {
subsetCols.push(col);
var ratioThisCol = ratios[index];
subsetRatioTotal += ratioThisCol;
subsetRatios.push(ratioThisCol);
}
});
// because we are not using all of the ratios (cols can be missing),
// we scale the ratio. if all columns are included, then subsetRatioTotal=1,
// and so the ratioScale will be 1.
var ratioScale = 1 / subsetRatioTotal;
subsetCols.forEach(function (col, index) {
var lastCol = index === (subsetCols.length - 1);
var colNewWidth;
if (lastCol) {
colNewWidth = pixelsToDistribute;
}
else {
colNewWidth = Math.round(ratios[index] * width * ratioScale);
pixelsToDistribute -= colNewWidth;
}
if (colNewWidth < col.getMinWidth()) {
colNewWidth = col.getMinWidth();
finishedCols[col.getId()] = true;
finishedColsGrew = true;
}
else if (col.getMaxWidth() > 0 && colNewWidth > col.getMaxWidth()) {
colNewWidth = col.getMaxWidth();
finishedCols[col.getId()] = true;
finishedColsGrew = true;
}
newWidths[col.getId()] = colNewWidth;
});
};
while (finishedColsGrew) {
var state_1 = _loop_2();
if (state_1 === "break")
break;
}
columns.forEach(function (col) {
var newWidth = newWidths[col.getId()];
if (col.getActualWidth() !== newWidth) {
col.setActualWidth(newWidth);
changedCols.push(col);
}
});
});
// if no cols changed, then no need to update more or send event.
var atLeastOneColChanged = changedCols.length > 0;
if (atLeastOneColChanged) {
this.setLeftValues(source);
this.updateBodyWidths();
this.checkDisplayedVirtualColumns();
}
// check for change first, to avoid unnecessary firing of events
// however we always fire 'finished' events. this is important
// when groups are resized, as if the group is changing slowly,
// eg 1 pixel at a time, then each change will fire change events
// in all the columns in the group, but only one with get the pixel.
if (atLeastOneColChanged || finished) {
var event_4 = {
type: events_1.Events.EVENT_COLUMN_RESIZED,
columns: allCols,
column: allCols.length === 1 ? allCols[0] : null,
finished: finished,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event_4);
}
};
ColumnController.prototype.setColumnAggFunc = function (column, aggFunc, source) {
if (source === void 0) { source = "api"; }
if (column) {
column.setAggFunc(aggFunc);
var event_5 = {
type: events_1.Events.EVENT_COLUMN_VALUE_CHANGED,
columns: [column],
column: column,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event_5);
}
};
ColumnController.prototype.moveRowGroupColumn = function (fromIndex, toIndex, source) {
if (source === void 0) { source = "api"; }
var column = this.rowGroupColumns[fromIndex];
this.rowGroupColumns.splice(fromIndex, 1);
this.rowGroupColumns.splice(toIndex, 0, column);
var event = {
type: events_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED,
columns: this.rowGroupColumns,
column: this.rowGroupColumns.length === 1 ? this.rowGroupColumns[0] : null,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event);
};
ColumnController.prototype.moveColumns = function (columnsToMoveKeys, toIndex, source) {
if (source === void 0) { source = "api"; }
this.columnAnimationService.start();
if (toIndex > this.gridColumns.length - columnsToMoveKeys.length) {
console.warn('ag-Grid: tried to insert columns in invalid location, toIndex = ' + toIndex);
console.warn('ag-Grid: remember that you should not count the moving columns when calculating the new index');
return;
}
// we want to pull all the columns out first and put them into an ordered list
var columnsToMove = this.getGridColumns(columnsToMoveKeys);
var failedRules = !this.doesMovePassRules(columnsToMove, toIndex);
if (failedRules) {
return;
}
utils_1._.moveInArray(this.gridColumns, columnsToMove, toIndex);
this.updateDisplayedColumns(source);
var event = {
type: events_1.Events.EVENT_COLUMN_MOVED,
columns: columnsToMove,
column: columnsToMove.length === 1 ? columnsToMove[0] : null,
toIndex: toIndex,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event);
this.columnAnimationService.finish();
};
ColumnController.prototype.doesMovePassRules = function (columnsToMove, toIndex) {
// make a copy of what the grid columns would look like after the move
var proposedColumnOrder = this.gridColumns.slice();
utils_1._.moveInArray(proposedColumnOrder, columnsToMove, toIndex);
// then check that the new proposed order of the columns passes all rules
if (!this.doesMovePassMarryChildren(proposedColumnOrder)) {
return false;
}
if (!this.doesMovePassLockedPositions(proposedColumnOrder)) {
return false;
}
return true;
};
ColumnController.prototype.doesMovePassLockedPositions = function (proposedColumnOrder) {
var foundNonLocked = false;
var rulePassed = true;
// go though the cols, see if any non-locked appear before any locked
proposedColumnOrder.forEach(function (col) {
if (col.getColDef().lockPosition) {
if (foundNonLocked) {
rulePassed = false;
}
}
else {
foundNonLocked = true;
}
});
return rulePassed;
};
ColumnController.prototype.doesMovePassMarryChildren = function (allColumnsCopy) {
var rulePassed = true;
this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (child) {
if (!(child instanceof originalColumnGroup_1.OriginalColumnGroup)) {
return;
}
var columnGroup = child;
var marryChildren = columnGroup.getColGroupDef() && columnGroup.getColGroupDef().marryChildren;
if (!marryChildren) {
return;
}
var newIndexes = [];
columnGroup.getLeafColumns().forEach(function (col) {
var newColIndex = allColumnsCopy.indexOf(col);
newIndexes.push(newColIndex);
});
var maxIndex = Math.max.apply(Math, newIndexes);
var minIndex = Math.min.apply(Math, newIndexes);
// spread is how far the first column in this group is away from the last column
var spread = maxIndex - minIndex;
var maxSpread = columnGroup.getLeafColumns().length - 1;
// if the columns
if (spread > maxSpread) {
rulePassed = false;
}
// console.log(`maxIndex = ${maxIndex}, minIndex = ${minIndex}, spread = ${spread}, maxSpread = ${maxSpread}, fail = ${spread > (count-1)}`)
// console.log(allColumnsCopy.map( col => col.getColDef().field).join(','));
});
return rulePassed;
};
ColumnController.prototype.moveColumn = function (key, toIndex, source) {
if (source === void 0) { source = "api"; }
this.moveColumns([key], toIndex, source);
};
ColumnController.prototype.moveColumnByIndex = function (fromIndex, toIndex, source) {
if (source === void 0) { source = "api"; }
var column = this.gridColumns[fromIndex];
this.moveColumn(column, toIndex, source);
};
// used by:
// + angularGrid -> for setting body width
// + rowController -> setting main row widths (when inserting and resizing)
// need to cache this
ColumnController.prototype.getBodyContainerWidth = function () {
return this.bodyWidth;
};
ColumnController.prototype.getContainerWidth = function (pinned) {
switch (pinned) {
case column_1.Column.PINNED_LEFT:
return this.leftWidth;
case column_1.Column.PINNED_RIGHT:
return this.rightWidth;
default:
return this.bodyWidth;
}
};
// after setColumnWidth or updateGroupsAndDisplayedColumns
ColumnController.prototype.updateBodyWidths = function () {
var newBodyWidth = this.getWidthOfColsInList(this.displayedCenterColumns);
var newLeftWidth = this.getWidthOfColsInList(this.displayedLeftColumns);
var newRightWidth = this.getWidthOfColsInList(this.displayedRightColumns);
// this is used by virtual col calculation, for RTL only, as a change to body width can impact displayed
// columns, due to RTL inverting the y coordinates
this.bodyWidthDirty = this.bodyWidth !== newBodyWidth;
var atLeastOneChanged = this.bodyWidth !== newBodyWidth || this.leftWidth !== newLeftWidth || this.rightWidth !== newRightWidth;
if (atLeastOneChanged) {
this.bodyWidth = newBodyWidth;
this.leftWidth = newLeftWidth;
this.rightWidth = newRightWidth;
// when this fires, it is picked up by the gridPanel, which ends up in
// gridPanel calling setWidthAndScrollPosition(), which in turn calls setVirtualViewportPosition()
var event_6 = {
type: events_1.Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEvent(event_6);
}
};
// + rowController
ColumnController.prototype.getValueColumns = function () {
return this.valueColumns ? this.valueColumns : [];
};
// + rowController
ColumnController.prototype.getPivotColumns = function () {
return this.pivotColumns ? this.pivotColumns : [];
};
// + clientSideRowModel
ColumnController.prototype.isPivotActive = function () {
return this.pivotColumns && this.pivotColumns.length > 0 && this.pivotMode;
};
// + toolPanel
ColumnController.prototype.getRowGroupColumns = function () {
return this.rowGroupColumns ? this.rowGroupColumns : [];
};
// + rowController -> while inserting rows
ColumnController.prototype.getDisplayedCenterColumns = function () {
return this.displayedCenterColumns;
};
// + rowController -> while inserting rows
ColumnController.prototype.getDisplayedLeftColumns = function () {
return this.displayedLeftColumns;
};
ColumnController.prototype.getDisplayedRightColumns = function () {
return this.displayedRightColumns;
};
ColumnController.prototype.getDisplayedColumns = function (type) {
switch (type) {
case column_1.Column.PINNED_LEFT:
return this.getDisplayedLeftColumns();
case column_1.Column.PINNED_RIGHT:
return this.getDisplayedRightColumns();
default:
return this.getDisplayedCenterColumns();
}
};
// used by:
// + clientSideRowController -> sorting, building quick filter text
// + headerRenderer -> sorting (clearing icon)
ColumnController.prototype.getAllPrimaryColumns = function () {
return this.primaryColumns ? this.primaryColumns.slice() : null;
};
ColumnController.prototype.getSecondaryColumns = function () {
return this.secondaryColumns ? this.secondaryColumns.slice() : null;
};
ColumnController.prototype.getAllColumnsForQuickFilter = function () {
return this.columnsForQuickFilter;
};
// + moveColumnController
ColumnController.prototype.getAllGridColumns = function () {
return this.gridColumns;
};
ColumnController.prototype.isEmpty = function () {
return utils_1._.missingOrEmpty(this.gridColumns);
};
ColumnController.prototype.isRowGroupEmpty = function () {
return utils_1._.missingOrEmpty(this.rowGroupColumns);
};
ColumnController.prototype.setColumnVisible = function (key, visible, source) {
if (source === void 0) { source = "api"; }
this.setColumnsVisible([key], visible, source);
};
ColumnController.prototype.setColumnsVisible = function (keys, visible, source) {
var _this = this;
if (source === void 0) { source = "api"; }
this.columnAnimationService.start();
this.actionOnGridColumns(keys, function (column) {
if (column.isVisible() !== visible) {
column.setVisible(visible, source);
return true;
}
else {
return false;
}
}, source, function () {
var event = {
type: events_1.Events.EVENT_COLUMN_VISIBLE,
visible: visible,
column: null,
columns: null,
api: _this.gridApi,
columnApi: _this.columnApi,
source: source
};
return event;
});
this.columnAnimationService.finish();
};
ColumnController.prototype.setColumnPinned = function (key, pinned, source) {
if (source === void 0) { source = "api"; }
if (key) {
this.setColumnsPinned([key], pinned, source);
}
};
ColumnController.prototype.setColumnsPinned = function (keys, pinned, source) {
var _this = this;
if (source === void 0) { source = "api"; }
if (this.gridOptionsWrapper.getDomLayout() === 'print') {
console.warn("Changing the column pinning status is not allowed with domLayout='print'");
return;
}
this.columnAnimationService.start();
var actualPinned;
if (pinned === true || pinned === column_1.Column.PINNED_LEFT) {
actualPinned = column_1.Column.PINNED_LEFT;
}
else if (pinned === column_1.Column.PINNED_RIGHT) {
actualPinned = column_1.Column.PINNED_RIGHT;
}
else {
actualPinned = null;
}
this.actionOnGridColumns(keys, function (col) {
if (col.getPinned() !== actualPinned) {
col.setPinned(actualPinned);
return true;
}
else {
return false;
}
}, source, function () {
var event = {
type: events_1.Events.EVENT_COLUMN_PINNED,
pinned: actualPinned,
column: null,
columns: null,
api: _this.gridApi,
columnApi: _this.columnApi,
source: source
};
return event;
});
this.columnAnimationService.finish();
};
// does an action on a set of columns. provides common functionality for looking up the
// columns based on key, getting a list of effected columns, and then updated the event
// with either one column (if it was just one col) or a list of columns
// used by: autoResize, setVisible, setPinned
ColumnController.prototype.actionOnGridColumns = function (// the column keys this action will be on
keys,
// the action to do - if this returns false, the column was skipped
// and won't be included in the event
action,
// should return back a column event of the right type
source, createEvent) {
var _this = this;
if (utils_1._.missingOrEmpty(keys)) {
return;
}
var updatedColumns = [];
keys.forEach(function (key) {
var column = _this.getGridColumn(key);
if (!column) {
return;
}
// need to check for false with type (ie !== instead of !=)
// as not returning anything (undefined) would also be false
var resultOfAction = action(column);
if (resultOfAction !== false) {
updatedColumns.push(column);
}
});
if (updatedColumns.length === 0) {
return;
}
this.updateDisplayedColumns(source);
if (utils_1._.exists(createEvent) && createEvent) {
var event_7 = createEvent();
event_7.columns = updatedColumns;
event_7.column = updatedColumns.length === 1 ? updatedColumns[0] : null;
this.eventService.dispatchEvent(event_7);
}
};
ColumnController.prototype.getDisplayedColBefore = function (col) {
var allDisplayedColumns = this.getAllDisplayedColumns();
var oldIndex = allDisplayedColumns.indexOf(col);
if (oldIndex > 0) {
return allDisplayedColumns[oldIndex - 1];
}
else {
return null;
}
};
// used by:
// + rowRenderer -> for navigation
ColumnController.prototype.getDisplayedColAfter = function (col) {
var allDisplayedColumns = this.getAllDisplayedColumns();
var oldIndex = allDisplayedColumns.indexOf(col);
if (oldIndex < (allDisplayedColumns.length - 1)) {
return allDisplayedColumns[oldIndex + 1];
}
else {
return null;
}
};
ColumnController.prototype.getDisplayedGroupAfter = function (columnGroup) {
// pick one col in this group at random
var col = columnGroup.getDisplayedLeafColumns()[0];
var requiredLevel = columnGroup.getOriginalColumnGroup().getLevel();
while (true) {
// keep moving to the next col, until we get to another group
col = this.getDisplayedColAfter(col);
// if no col after, means no group after
if (!col) {
return null;
}
// get group at same level as the one we are looking for
var groupPointer = col.getParent();
while (groupPointer.getOriginalColumnGroup().getLevel() !== requiredLevel) {
groupPointer = groupPointer.getParent();
}
if (groupPointer !== columnGroup) {
return groupPointer;
}
}
};
ColumnController.prototype.isPinningLeft = function () {
return this.displayedLeftColumns.length > 0;
};
ColumnController.prototype.isPinningRight = function () {
return this.displayedRightColumns.length > 0;
};
ColumnController.prototype.getPrimaryAndSecondaryAndAutoColumns = function () {
var result = this.primaryColumns ? this.primaryColumns.slice(0) : [];
if (this.groupAutoColumns && utils_1._.exists(this.groupAutoColumns)) {
this.groupAutoColumns.forEach(function (col) { return result.push(col); });
}
if (this.secondaryColumnsPresent && this.secondaryColumns) {
this.secondaryColumns.forEach(function (column) { return result.push(column); });
}
return result;
};
ColumnController.prototype.createStateItemFromColumn = function (column) {
var rowGroupIndex = column.isRowGroupActive() ? this.rowGroupColumns.indexOf(column) : null;
var pivotIndex = column.isPivotActive() ? this.pivotColumns.indexOf(column) : null;
var aggFunc = column.isValueActive() ? column.getAggFunc() : null;
return {
colId: column.getColId(),
hide: !column.isVisible(),
aggFunc: aggFunc,
width: column.getActualWidth(),
pivotIndex: pivotIndex,
pinned: column.getPinned(),
rowGroupIndex: rowGroupIndex
};
};
ColumnController.prototype.getColumnState = function () {
if (utils_1._.missing(this.primaryColumns)) {
return [];
}
var primaryColumnState = this.primaryColumns.map(this.createStateItemFromColumn.bind(this));
var groupAutoColumnState = this.groupAutoColumns
// if groupAutoCols, then include them
? this.groupAutoColumns.map(this.createStateItemFromColumn.bind(this))
// otherwise no
: [];
var columnStateList = groupAutoColumnState.concat(primaryColumnState);
if (!this.pivotMode) {
this.orderColumnStateList(columnStateList);
}
return columnStateList;
};
ColumnController.prototype.orderColumnStateList = function (columnStateList) {
var gridColumnIds = this.gridColumns.map(function (column) { return column.getColId(); });
columnStateList.sort(function (itemA, itemB) {
var posA = gridColumnIds.indexOf(itemA.colId);
var posB = gridColumnIds.indexOf(itemB.colId);
return posA - posB;
});
};
ColumnController.prototype.resetColumnState = function (suppressEverythingEvent, source) {
// NOTE = there is one bug here that no customer has noticed - if a column has colDef.lockPosition,
// this is ignored below when ordering the cols. to work, we should always put lockPosition cols first.
// As a work around, developers should just put lockPosition columns first in their colDef list.
if (suppressEverythingEvent === void 0) { suppressEverythingEvent = false; }
if (source === void 0) { source = "api"; }
// we can't use 'allColumns' as the order might of messed up, so get the primary ordered list
var primaryColumns = this.getColumnsFromTree(this.primaryColumnTree);
var columnStates = [];
// we start at 1000, so if user has mix of rowGroup and group specified, it will work with both.
// eg IF user has ColA.rowGroupIndex=0, ColB.rowGroupIndex=1, ColC.rowGroup=true,
// THEN result will be ColA.rowGroupIndex=0, ColB.rowGroupIndex=1, ColC.rowGroup=1000
var letRowGroupIndex = 1000;
var letPivotIndex = 1000;
if (primaryColumns) {
primaryColumns.forEach(function (column) {
var rowGroupIndex = column.getColDef().rowGroupIndex;
var rowGroup = column.getColDef().rowGroup;
var pivotIndex = column.getColDef().pivotIndex;
var pivot = column.getColDef().pivot;
var stateItem = {
colId: column.getColId(),
aggFunc: column.getColDef().aggFunc,
hide: column.getColDef().hide,
pinned: column.getColDef().pinned,
rowGroupIndex: rowGroupIndex,
pivotIndex: column.getColDef().pivotIndex,
width: column.getColDef().width
};
if (utils_1._.missing(rowGroupIndex) && rowGroup) {
stateItem.rowGroupIndex = letRowGroupIndex++;
}
if (utils_1._.missing(pivotIndex) && pivot) {
stateItem.pivotIndex = letPivotIndex++;
}
columnStates.push(stateItem);
});
}
this.setColumnState(columnStates, suppressEverythingEvent, source);
};
ColumnController.prototype.setColumnState = function (columnStates, suppressEverythingEvent, source) {
var _this = this;
if (suppressEverythingEvent === void 0) { suppressEverythingEvent = false; }
if (source === void 0) { source = "api"; }
if (utils_1._.missingOrEmpty(this.primaryColumns)) {
return false;
}
var columnStateBefore = this.getColumnState();
this.autoGroupsNeedBuilding = true;
// at the end below, this list will have all columns we got no state for
var columnsWithNoState = this.primaryColumns.slice();
this.rowGroupColumns = [];
this.valueColumns = [];
this.pivotColumns = [];
var success = true;
var rowGroupIndexes = {};
var pivotIndexes = {};
var autoGroupColumnStates = [];
if (columnStates) {
columnStates.forEach(function (state) {
// auto group columns are re-created so deferring syncing with ColumnState
if (utils_1._.exists(_this.getAutoColumn(state.colId))) {
autoGroupColumnStates.push(state);
return;
}
var column = _this.getPrimaryColumn(state.colId);
if (!column) {
console.warn('ag-grid: column ' + state.colId + ' not found');
success = false;
}
else {
_this.syncColumnWithStateItem(column, state, rowGroupIndexes, pivotIndexes, source);
utils_1._.removeFromArray(columnsWithNoState, column);
}
});
}
// anything left over, we got no data for, so add in the column as non-value, non-rowGroup and hidden
columnsWithNoState.forEach(this.syncColumnWithNoState.bind(this));
// sort the lists according to the indexes that were provided
this.rowGroupColumns.sort(this.sortColumnListUsingIndexes.bind(this, rowGroupIndexes));
this.pivotColumns.sort(this.sortColumnListUsingIndexes.bind(this, pivotIndexes));
this.updateGridColumns();
// sync newly created auto group columns with ColumnState
autoGroupColumnStates.forEach(function (stateItem) {
var autoCol = _this.getAutoColumn(stateItem.colId);
_this.syncColumnWithStateItem(autoCol, stateItem, rowGroupIndexes, pivotIndexes, source);
});
if (columnStates) {
var orderOfColIds_1 = columnStates.map(function (stateItem) { return stateItem.colId; });
this.gridColumns.sort(function (colA, colB) {
var indexA = orderOfColIds_1.indexOf(colA.getId());
var indexB = orderOfColIds_1.indexOf(colB.getId());
return indexA - indexB;
});
}
// this is already done in updateGridColumns, however we changed the order above (to match the order of the state
// columns) so we need to do it again. we could of put logic into the order above to take into account fixed
// columns, however if we did then we would have logic for updating fixed columns twice. reusing the logic here
// is less sexy for the code here, but it keeps consistency.
this.putFixedColumnsFirst();
this.updateDisplayedColumns(source);
if (!suppressEverythingEvent) {
var event_8 = {
type: events_1.Events.EVENT_COLUMN_EVERYTHING_CHANGED,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event_8);
}
this.raiseColumnEvents(columnStateBefore, source);
return success;
};
ColumnController.prototype.raiseColumnEvents = function (columnStateBefore, source) {
var _this = this;
if (this.gridOptionsWrapper.isSuppressSetColumnStateEvents()) {
return;
}
var columnStateAfter = this.getColumnState();
// raises generic ColumnEvents where all columns are returned rather than what has changed
var raiseEventWithAllColumns = function (eventType, idMapper, columns) {
var unchanged = utils_1._.compareArrays(columnStateBefore.map(idMapper).sort(), columnStateAfter.map(idMapper).sort());
if (unchanged) {
return;
}
// returning all columns rather than what has changed!
var event = {
type: eventType,
columns: columns,
column: columns.length === 1 ? columns[0] : null,
api: _this.gridApi,
columnApi: _this.columnApi,
source: source
};
_this.eventService.dispatchEvent(event);
};
// determines which columns have changed according to supplied predicate
var getChangedColumns = function (changedPredicate) {
var changedColumns = [];
var columnStateBeforeMap = {};
columnStateBefore.forEach(function (col) {
columnStateBeforeMap[col.colId] = col;
});
_this.gridColumns.forEach(function (column) {
var colStateBefore = columnStateBeforeMap[column.getColId()];
if (!colStateBefore || changedPredicate(colStateBefore, column)) {
changedColumns.push(column);
}
});
return changedColumns;
};
// generic ColumnEvents which return current column list
var valueColumnIdMapper = function (cs) { return cs.colId + '-' + cs.aggFunc; };
raiseEventWithAllColumns(events_1.Events.EVENT_COLUMN_VALUE_CHANGED, valueColumnIdMapper, this.valueColumns);
var pivotColumnIdMapper = function (cs) { return cs.colId + '-' + cs.pivotIndex; };
raiseEventWithAllColumns(events_1.Events.EVENT_COLUMN_PIVOT_CHANGED, pivotColumnIdMapper, this.pivotColumns);
var rowGroupColumnIdMapper = function (cs) { return cs.colId + '-' + cs.rowGroupIndex; };
raiseEventWithAllColumns(events_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, rowGroupColumnIdMapper, this.rowGroupColumns);
// specific ColumnEvents which return what's changed
var pinnedChangePredicate = function (cs, c) { return cs.pinned !== c.getPinned(); };
this.raiseColumnPinnedEvent(getChangedColumns(pinnedChangePredicate), source);
var visibilityChangePredicate = function (cs, c) { return cs.hide === c.isVisible(); };
var cols = getChangedColumns(visibilityChangePredicate);
this.raiseColumnVisibleEvent(cols, source);
var resizeChangePredicate = function (cs, c) { return cs.width !== c.getActualWidth(); };
this.raiseColumnResizeEvent(getChangedColumns(resizeChangePredicate), source);
// special handling for moved column events
this.raiseColumnMovedEvent(columnStateBefore, source);
};
ColumnController.prototype.raiseColumnPinnedEvent = function (changedColumns, source) {
if (changedColumns.length > 0) {
var event_9 = {
type: events_1.Events.EVENT_COLUMN_PINNED,
pinned: null,
columns: changedColumns,
column: null,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event_9);
}
};
ColumnController.prototype.raiseColumnVisibleEvent = function (changedColumns, source) {
if (changedColumns.length > 0) {
var event_10 = {
type: events_1.Events.EVENT_COLUMN_VISIBLE,
visible: undefined,
columns: changedColumns,
column: null,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event_10);
}
};
ColumnController.prototype.raiseColumnResizeEvent = function (changedColumns, source) {
if (changedColumns.length > 0) {
var event_11 = {
type: events_1.Events.EVENT_COLUMN_RESIZED,
columns: changedColumns,
column: null,
finished: true,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event_11);
}
};
ColumnController.prototype.raiseColumnMovedEvent = function (columnStateBefore, source) {
var movedColumns = [];
var columnStateAfter = this.getColumnState();
var _loop_3 = function (i) {
var before = columnStateBefore[i];
var after = columnStateAfter[i];
// don't consider column if reintroduced or hidden
if (!before || after.hide) {
return "continue";
}
if (before.colId !== after.colId) {
var predicate = function (column) { return column.getColId() === after.colId; };
var movedColumn = utils_1._.find(this_1.allDisplayedColumns, predicate);
movedColumns.push(movedColumn);
}
};
var this_1 = this;
for (var i = 0; i < columnStateAfter.length; i++) {
_loop_3(i);
}
if (movedColumns.length > 0) {
var event_12 = {
type: events_1.Events.EVENT_COLUMN_MOVED,
columns: movedColumns,
column: null,
toIndex: undefined,
api: this.gridApi,
columnApi: this.columnApi,
source: source
};
this.eventService.dispatchEvent(event_12);
}
};
ColumnController.prototype.sortColumnListUsingIndexes = function (indexes, colA, colB) {
var indexA = indexes[colA.getId()];
var indexB = indexes[colB.getId()];
return indexA - indexB;
};
ColumnController.prototype.syncColumnWithNoState = function (column, source) {
column.setVisible(false, source);
column.setAggFunc(null);
column.setPinned(null);
column.setRowGroupActive(false, source);
column.setPivotActive(false, source);
column.setValueActive(false, source);
};
ColumnController.prototype.syncColumnWithStateItem = function (column, stateItem, rowGroupIndexes, pivotIndexes, source) {
if (!column) {
return;
}
// following ensures we are left with boolean true or false, eg converts (null, undefined, 0) all to true
column.setVisible(!stateItem.hide, source);
// sets pinned to 'left' or 'right'
column.setPinned(stateItem.pinned);
// if width provided and valid, use it, otherwise stick with the old width
var minColWidth = this.gridOptionsWrapper.getMinColWidth();
if (stateItem.width && minColWidth &&
(stateItem.width >= minColWidth)) {
column.setActualWidth(stateItem.width, source);
}
if (typeof stateItem.aggFunc === 'string') {
column.setAggFunc(stateItem.aggFunc);
column.setValueActive(true, source);
this.valueColumns.push(column);
}
else {
if (utils_1._.exists(stateItem.aggFunc)) {
console.warn('ag-Grid: stateItem.aggFunc must be a string. if using your own aggregation ' +
'functions, register the functions first before using them in get/set state. This is because it is' +
'intended for the column state to be stored and retrieved as simple JSON.');
}
column.setAggFunc(null);
column.setValueActive(false, source);
}
if (typeof stateItem.rowGroupIndex === 'number') {
this.rowGroupColumns.push(column);
column.setRowGroupActive(true, source);
rowGroupIndexes[column.getId()] = stateItem.rowGroupIndex;
}
else {
column.setRowGroupActive(false, source);
}
if (typeof stateItem.pivotIndex === 'number') {
this.pivotColumns.push(column);
column.setPivotActive(true, source);
pivotIndexes[column.getId()] = stateItem.pivotIndex;
}
else {
column.setPivotActive(false, source);
}
};
ColumnController.prototype.getGridColumns = function (keys) {
return this.getColumns(keys, this.getGridColumn.bind(this));
};
ColumnController.prototype.getColumns = function (keys, columnLookupCallback) {
var foundColumns = [];
if (keys) {
keys.forEach(function (key) {
var column = columnLookupCallback(key);
if (column) {
foundColumns.push(column);
}
});
}
return foundColumns;
};
// used by growGroupPanel
ColumnController.prototype.getColumnWithValidation = function (key) {
if (key == null) {
return null;
}
var column = this.getGridColumn(key);
if (!column) {
console.warn('ag-Grid: could not find column ' + key);
}
return column;
};
ColumnController.prototype.getPrimaryColumn = function (key) {
return this.getColumn(key, this.primaryColumns);
};
ColumnController.prototype.getGridColumn = function (key) {
return this.getColumn(key, this.gridColumns);
};
ColumnController.prototype.getColumn = function (key, columnList) {
if (!key) {
return null;
}
for (var i = 0; i < columnList.length; i++) {
if (this.columnsMatch(columnList[i], key)) {
return columnList[i];
}
}
return this.getAutoColumn(key);
};
ColumnController.prototype.getAutoColumn = function (key) {
var _this = this;
if (!this.groupAutoColumns || !utils_1._.exists(this.groupAutoColumns) || utils_1._.missing(this.groupAutoColumns)) {
return null;
}
return utils_1._.find(this.groupAutoColumns, function (groupCol) {
return _this.columnsMatch(groupCol, key);
});
};
ColumnController.prototype.columnsMatch = function (column, key) {
var columnMatches = column === key;
var colDefMatches = column.getColDef() === key;
var idMatches = column.getColId() == key;
return columnMatches || colDefMatches || idMatches;
};
ColumnController.prototype.getDisplayNameForColumn = function (column, location, includeAggFunc) {
if (includeAggFunc === void 0) { includeAggFunc = false; }
if (!column) {
return null;
}
var headerName = this.getHeaderName(column.getColDef(), column, null, null, location);
if (includeAggFunc) {
return this.wrapHeaderNameWithAggFunc(column, headerName);
}
else {
return headerName;
}
};
ColumnController.prototype.getDisplayNameForOriginalColumnGroup = function (columnGroup, originalColumnGroup, location) {
var colGroupDef = originalColumnGroup ? originalColumnGroup.getColGroupDef() : null;
if (colGroupDef) {
return this.getHeaderName(colGroupDef, null, columnGroup, originalColumnGroup, location);
}
else {
return null;
}
};
ColumnController.prototype.getDisplayNameForColumnGroup = function (columnGroup, location) {
return this.getDisplayNameForOriginalColumnGroup(columnGroup, columnGroup.getOriginalColumnGroup(), location);
};
// location is where the column is going to appear, ie who is calling us
ColumnController.prototype.getHeaderName = function (colDef, column, columnGroup, originalColumnGroup, location) {
var headerValueGetter = colDef.headerValueGetter;
if (headerValueGetter) {
var params = {
colDef: colDef,
column: column,
columnGroup: columnGroup,
originalColumnGroup: originalColumnGroup,
location: location,
api: this.gridOptionsWrapper.getApi(),
context: this.gridOptionsWrapper.getContext()
};
if (typeof headerValueGetter === 'function') {
// valueGetter is a function, so just call it
return headerValueGetter(params);
}
else if (typeof headerValueGetter === 'string') {
// valueGetter is an expression, so execute the expression
return this.expressionService.evaluate(headerValueGetter, params);
}
else {
console.warn('ag-grid: headerValueGetter must be a function or a string');
return '';
}
}
else if (colDef.headerName != null) {
return colDef.headerName;
}
else if (colDef.field) {
return utils_1._.camelCaseToHumanText(colDef.field);
}
else {
return '';
}
};
/*
private getHeaderGroupName(columnGroup: ColumnGroup): string {
let colGroupDef = columnGroup.getOriginalColumnGroup().getColGroupDef();
let headerValueGetter = colGroupDef.headerValueGetter;
if (headerValueGetter) {
let params = {
columnGroup: columnGroup,
colDef: colGroupDef,
api: this.gridOptionsWrapper.getApi(),
context: this.gridOptionsWrapper.getContext()
};
if (typeof headerValueGetter === 'function') {
// valueGetter is a function, so just call it
return headerValueGetter(params);
} else if (typeof headerValueGetter === 'string') {
// valueGetter is an expression, so execute the expression
return this.expressionService.evaluate(headerValueGetter, params);
} else {
console.warn('ag-grid: headerValueGetter must be a function or a string');
return '';
}
} else {
return colGroupDef.headerName;
}
}
*/
ColumnController.prototype.wrapHeaderNameWithAggFunc = function (column, headerName) {
if (this.gridOptionsWrapper.isSuppressAggFuncInHeader()) {
return headerName;
}
// only columns with aggregation active can have aggregations
var pivotValueColumn = column.getColDef().pivotValueColumn;
var pivotActiveOnThisColumn = utils_1._.exists(pivotValueColumn);
var aggFunc = null;
var aggFuncFound;
// otherwise we have a measure that is active, and we are doing aggregation on it
if (pivotActiveOnThisColumn) {
aggFunc = pivotValueColumn ? pivotValueColumn.getAggFunc() : null;
aggFuncFound = true;
}
else {
var measureActive = column.isValueActive();
var aggregationPresent = this.pivotMode || !this.isRowGroupEmpty();
if (measureActive && aggregationPresent) {
aggFunc = column.getAggFunc();
aggFuncFound = true;
}
else {
aggFuncFound = false;
}
}
if (aggFuncFound) {
var aggFuncString = (typeof aggFunc === 'string') ? aggFunc : 'func';
var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
var aggFuncStringTranslated = localeTextFunc(aggFuncString, aggFuncString);
return aggFuncStringTranslated + "(" + headerName + ")";
}
else {
return headerName;
}
};
// returns the group with matching colId and instanceId. If instanceId is missing,
// matches only on the colId.
ColumnController.prototype.getColumnGroup = function (colId, instanceId) {
if (!colId) {
return null;
}
if (colId instanceof columnGroup_1.ColumnGroup) {
return colId;
}
var allColumnGroups = this.getAllDisplayedColumnGroups();
var checkInstanceId = typeof instanceId === 'number';
var result = null;
this.columnUtils.depthFirstAllColumnTreeSearch(allColumnGroups, function (child) {
if (child instanceof columnGroup_1.ColumnGroup) {
var columnGroup = child;
var matched = void 0;
if (checkInstanceId) {
matched = colId === columnGroup.getGroupId() && instanceId === columnGroup.getInstanceId();
}
else {
matched = colId === columnGroup.getGroupId();
}
if (matched) {
result = columnGroup;
}
}
});
return result;
};
ColumnController.prototype.isReady = function () {
return this.ready;
};
ColumnController.prototype.createValueColumns = function (source, oldPrimaryColumns) {
this.valueColumns = this.extractColumns(oldPrimaryColumns, this.valueColumns, function (col, flag) { return col.setValueActive(flag, source); },
// aggFunc doesn't have index variant, cos order of value cols doesn't matter, so always return null
function () { return null; },
// aggFunc is a string, so return it's existence
function (colDef) { return !!colDef.aggFunc; });
// all new columns added will have aggFunc missing, so set it to what is in the colDef
this.valueColumns.forEach(function (col) {
if (!col.getAggFunc()) {
col.setAggFunc(col.getColDef().aggFunc);
}
});
};
ColumnController.prototype.extractRowGroupColumns = function (source, oldPrimaryColumns) {
this.rowGroupColumns = this.extractColumns(oldPrimaryColumns, this.rowGroupColumns, function (col, flag) { return col.setRowGroupActive(flag, source); }, function (colDef) { return colDef.rowGroupIndex; }, function (colDef) { return colDef.rowGroup; });
};
ColumnController.prototype.extractColumns = function (oldPrimaryColumns, previousCols, setFlagFunc, getIndexFunc, getValueFunc) {
var _this = this;
if (!previousCols) {
previousCols = [];
}
// remove cols that no longer exist
var colPresentInPrimaryFunc = function (col) { return _this.primaryColumns.indexOf(col) >= 0; };
var colMissingFromPrimaryFunc = function (col) { return _this.primaryColumns.indexOf(col) < 0; };
var colNewFunc = function (col) { return !oldPrimaryColumns || oldPrimaryColumns.indexOf(col) < 0; };
var removedCols = previousCols.filter(colMissingFromPrimaryFunc);
var existingCols = previousCols.filter(colPresentInPrimaryFunc);
var newPrimaryCols = this.primaryColumns.filter(colNewFunc);
removedCols.forEach(function (col) { return setFlagFunc(col, false); });
var newCols = [];
// we only want to work on new columns, as old columns already got processed first time around
// pull out items with xxxIndex
newPrimaryCols.forEach(function (col) {
var index = getIndexFunc(col.getColDef());
if (typeof index === 'number') {
newCols.push(col);
}
});
// then sort them
newCols.sort(function (colA, colB) {
var indexA = getIndexFunc(colA.getColDef());
var indexB = getIndexFunc(colB.getColDef());
if (indexA === indexB) {
return 0;
}
else if (indexA < indexB) {
return -1;
}
else {
return 1;
}
});
// now just pull out items xxx (boolean value), they will be added at the end
// after the indexed ones, but in the order the columns appear
newPrimaryCols.forEach(function (col) {
var booleanValue = getValueFunc(col.getColDef());
if (booleanValue) {
// if user already specified xxxIndex then we skip it as this col already included
if (newCols.indexOf(col) >= 0) {
return;
}
newCols.push(col);
}
});
newCols.forEach(function (col) { return setFlagFunc(col, true); });
var res = existingCols.concat(newCols);
return res;
};
ColumnController.prototype.extractPivotColumns = function (source, oldPrimaryColumns) {
this.pivotColumns = this.extractColumns(oldPrimaryColumns, this.pivotColumns, function (col, flag) { return col.setPivotActive(flag, source); }, function (colDef) { return colDef.pivotIndex; }, function (colDef) { return colDef.pivot; });
};
ColumnController.prototype.resetColumnGroupState = function (source) {
if (source === void 0) { source = "api"; }
var stateItems = [];
this.columnUtils.depthFirstOriginalTreeSearch(null, this.primaryColumnTree, function (child) {
if (child instanceof originalColumnGroup_1.OriginalColumnGroup) {
var groupState = {
groupId: child.getGroupId(),
open: child.getColGroupDef().openByDefault
};
stateItems.push(groupState);
}
});
this.setColumnGroupState(stateItems, source);
};
ColumnController.prototype.getColumnGroupState = function () {
var columnGroupState = [];
this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (node) {
if (node instanceof originalColumnGroup_1.OriginalColumnGroup) {
var originalColumnGroup = node;
columnGroupState.push({
groupId: originalColumnGroup.getGroupId(),
open: originalColumnGroup.isExpanded()
});
}
});
return columnGroupState;
};
ColumnController.prototype.setColumnGroupState = function (stateItems, source) {
var _this = this;
if (source === void 0) { source = "api"; }
this.columnAnimationService.start();
var impactedGroups = [];
stateItems.forEach(function (stateItem) {
var groupKey = stateItem.groupId;
var newValue = stateItem.open;
var originalColumnGroup = _this.getOriginalColumnGroup(groupKey);
if (!originalColumnGroup) {
return;
}
if (originalColumnGroup.isExpanded() === newValue) {
return;
}
_this.logger.log('columnGroupOpened(' + originalColumnGroup.getGroupId() + ',' + newValue + ')');
originalColumnGroup.setExpanded(newValue);
impactedGroups.push(originalColumnGroup);
});
this.updateGroupsAndDisplayedColumns(source);
this.setFirstRightAndLastLeftPinned(source);
impactedGroups.forEach(function (originalColumnGroup) {
var event = {
type: events_1.Events.EVENT_COLUMN_GROUP_OPENED,
columnGroup: originalColumnGroup,
api: _this.gridApi,
columnApi: _this.columnApi
};
_this.eventService.dispatchEvent(event);
});
this.columnAnimationService.finish();
};
// called by headerRenderer - when a header is opened or closed
ColumnController.prototype.setColumnGroupOpened = function (key, newValue, source) {
if (source === void 0) { source = "api"; }
var keyAsString;
if (key instanceof originalColumnGroup_1.OriginalColumnGroup) {
keyAsString = key.getId();
}
else {
keyAsString = key;
}
this.setColumnGroupState([{ groupId: keyAsString, open: newValue }], source);
};
ColumnController.prototype.getOriginalColumnGroup = function (key) {
if (key instanceof originalColumnGroup_1.OriginalColumnGroup) {
return key;
}
if (typeof key !== 'string') {
console.error('ag-Grid: group key must be a string');
}
// otherwise, search for the column group by id
var res = null;
this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (node) {
if (node instanceof originalColumnGroup_1.OriginalColumnGroup) {
var originalColumnGroup = node;
if (originalColumnGroup.getId() === key) {
res = originalColumnGroup;
}
}
});
return res;
};
ColumnController.prototype.calculateColumnsForDisplay = function () {
var _this = this;
var columnsForDisplay;
if (this.pivotMode && !this.secondaryColumnsPresent) {
// pivot mode is on, but we are not pivoting, so we only
// show columns we are aggregating on
columnsForDisplay = utils_1._.filter(this.gridColumns, function (column) {
var isAutoGroupCol = _this.groupAutoColumns && _this.groupAutoColumns.indexOf(column) >= 0;
var isValueCol = _this.valueColumns && _this.valueColumns.indexOf(column) >= 0;
return isAutoGroupCol || isValueCol;
});
}
else {
// otherwise continue as normal. this can be working on the primary
// or secondary columns, whatever the gridColumns are set to
columnsForDisplay = utils_1._.filter(this.gridColumns, function (column) {
// keep col if a) it's auto-group or b) it's visible
var isAutoGroupCol = _this.groupAutoColumns && _this.groupAutoColumns.indexOf(column) >= 0;
return isAutoGroupCol || column.isVisible();
});
}
return columnsForDisplay;
};
ColumnController.prototype.checkColSpanActiveInCols = function (columns) {
var result = false;
columns.forEach(function (col) {
if (utils_1._.exists(col.getColDef().colSpan)) {
result = true;
}
});
return result;
};
ColumnController.prototype.calculateColumnsForGroupDisplay = function () {
var _this = this;
this.groupDisplayColumns = [];
var checkFunc = function (col) {
var colDef = col.getColDef();
if (colDef && utils_1._.exists(colDef.showRowGroup)) {
_this.groupDisplayColumns.push(col);
}
};
this.gridColumns.forEach(checkFunc);
if (this.groupAutoColumns) {
this.groupAutoColumns.forEach(checkFunc);
}
};
ColumnController.prototype.getGroupDisplayColumns = function () {
return this.groupDisplayColumns;
};
ColumnController.prototype.updateDisplayedColumns = function (source) {
var columnsForDisplay = this.calculateColumnsForDisplay();
this.buildDisplayedTrees(columnsForDisplay);
this.calculateColumnsForGroupDisplay();
// also called when group opened/closed
this.updateGroupsAndDisplayedColumns(source);
// also called when group opened/closed
this.setFirstRightAndLastLeftPinned(source);
};
ColumnController.prototype.isSecondaryColumnsPresent = function () {
return this.secondaryColumnsPresent;
};
ColumnController.prototype.setSecondaryColumns = function (colDefs, source) {
if (source === void 0) { source = "api"; }
var newColsPresent = colDefs && colDefs.length > 0;
// if not cols passed, and we had to cols anyway, then do nothing
if (!newColsPresent && !this.secondaryColumnsPresent) {
return;
}
if (newColsPresent) {
this.processSecondaryColumnDefinitions(colDefs);
var balancedTreeResult = this.columnFactory.createColumnTree(colDefs, false);
this.secondaryBalancedTree = balancedTreeResult.columnTree;
this.secondaryHeaderRowCount = balancedTreeResult.treeDept + 1;
this.secondaryColumns = this.getColumnsFromTree(this.secondaryBalancedTree);
this.secondaryColumnsPresent = true;
}
else {
this.secondaryBalancedTree = null;
this.secondaryHeaderRowCount = -1;
this.secondaryColumns = null;
this.secondaryColumnsPresent = false;
}
this.updateGridColumns();
this.updateDisplayedColumns(source);
};
ColumnController.prototype.processSecondaryColumnDefinitions = function (colDefs) {
var columnCallback = this.gridOptionsWrapper.getProcessSecondaryColDefFunc();
var groupCallback = this.gridOptionsWrapper.getProcessSecondaryColGroupDefFunc();
if (!columnCallback && !groupCallback) {
return undefined;
}
if (colDefs) {
searchForColDefs(colDefs);
}
function searchForColDefs(colDefs2) {
colDefs2.forEach(function (abstractColDef) {
var isGroup = utils_1._.exists(abstractColDef.children);
if (isGroup) {
var colGroupDef = abstractColDef;
if (groupCallback) {
groupCallback(colGroupDef);
}
searchForColDefs(colGroupDef.children);
}
else {
var colDef = abstractColDef;
if (columnCallback) {
columnCallback(colDef);
}
}
});
}
};
// called from: setColumnState, setColumnDefs, setSecondaryColumns
ColumnController.prototype.updateGridColumns = function () {
if (this.gridColsArePrimary) {
this.lastPrimaryOrder = this.gridColumns;
}
if (this.secondaryColumns && this.secondaryBalancedTree) {
this.gridBalancedTree = this.secondaryBalancedTree.slice();
this.gridHeaderRowCount = this.secondaryHeaderRowCount;
this.gridColumns = this.secondaryColumns.slice();
this.gridColsArePrimary = false;
}
else {
this.gridBalancedTree = this.primaryColumnTree.slice();
this.gridHeaderRowCount = this.primaryHeaderRowCount;
this.gridColumns = this.primaryColumns.slice();
this.gridColsArePrimary = true;
// updateGridColumns gets called after user adds a row group. we want to maintain the order of the columns
// when this happens (eg if user moved a column) rather than revert back to the original column order.
// likewise if changing in/out of pivot mode, we want to maintain the order of the primary cols
this.orderGridColsLikeLastPrimary();
}
this.addAutoGroupToGridColumns();
this.autoRowHeightColumns = this.gridColumns.filter(function (col) { return col.getColDef().autoHeight; });
this.putFixedColumnsFirst();
this.setupQuickFilterColumns();
this.clearDisplayedColumns();
this.colSpanActive = this.checkColSpanActiveInCols(this.gridColumns);
var event = {
type: events_1.Events.EVENT_GRID_COLUMNS_CHANGED,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEvent(event);
};
ColumnController.prototype.orderGridColsLikeLastPrimary = function () {
var _this = this;
if (utils_1._.missing(this.lastPrimaryOrder)) {
return;
}
// only do the sort if at least one column is accounted for. columns will be not accounted for
// if changing from secondary to primary columns
var noColsFound = true;
this.gridColumns.forEach(function (col) {
if (_this.lastPrimaryOrder.indexOf(col) >= 0) {
noColsFound = false;
}
});
if (noColsFound) {
return;
}
// order cols in the same order as before. we need to make sure that all
// cols still exists, so filter out any that no longer exist.
var oldColsOrdered = this.lastPrimaryOrder.filter(function (col) { return _this.gridColumns.indexOf(col) >= 0; });
var newColsOrdered = this.gridColumns.filter(function (col) { return oldColsOrdered.indexOf(col) < 0; });
// add in the new columns, at the end (if no group), or at the end of the group (if a group)
var newGridColumns = oldColsOrdered.slice();
newColsOrdered.forEach(function (newCol) {
var parent = newCol.getOriginalParent();
// if no parent, means we are not grouping, so just add the column to the end
if (!parent) {
newGridColumns.push(newCol);
return;
}
// find the group the column belongs to. if no siblings at the current level (eg col in group on it's
// own) then go up one level and look for siblings there.
var siblings = [];
while (!siblings.length && parent) {
var leafCols = parent.getLeafColumns();
leafCols.forEach(function (leafCol) {
var presentInNewGriColumns = newGridColumns.indexOf(leafCol) >= 0;
var noYetInSiblings = siblings.indexOf(leafCol) < 0;
if (presentInNewGriColumns && noYetInSiblings) {
siblings.push(leafCol);
}
});
parent = parent.getOriginalParent();
}
// if no siblings exist at any level, this means the col is in a group (or parent groups) on it's own
if (!siblings.length) {
newGridColumns.push(newCol);
return;
}
// find index of last column in the group
var indexes = siblings.map(function (col) { return newGridColumns.indexOf(col); });
var lastIndex = Math.max.apply(Math, indexes);
utils_1._.insertIntoArray(newGridColumns, newCol, lastIndex + 1);
});
this.gridColumns = newGridColumns;
};
ColumnController.prototype.isPrimaryColumnGroupsPresent = function () {
return this.primaryHeaderRowCount > 1;
};
// if we are using autoGroupCols, then they should be included for quick filter. this covers the
// following scenarios:
// a) user provides 'field' into autoGroupCol of normal grid, so now because a valid col to filter leafs on
// b) using tree data and user depends on autoGroupCol for first col, and we also want to filter on this
// (tree data is a bit different, as parent rows can be filtered on, unlike row grouping)
ColumnController.prototype.setupQuickFilterColumns = function () {
if (this.groupAutoColumns) {
this.columnsForQuickFilter = this.primaryColumns.concat(this.groupAutoColumns);
}
else {
this.columnsForQuickFilter = this.primaryColumns;
}
};
ColumnController.prototype.putFixedColumnsFirst = function () {
var locked = this.gridColumns.filter(function (c) { return c.getColDef().lockPosition; });
var unlocked = this.gridColumns.filter(function (c) { return !c.getColDef().lockPosition; });
this.gridColumns = locked.concat(unlocked);
};
ColumnController.prototype.addAutoGroupToGridColumns = function () {
// add in auto-group here
this.createGroupAutoColumnsIfNeeded();
if (utils_1._.missing(this.groupAutoColumns)) {
return;
}
this.gridColumns = this.groupAutoColumns ? this.groupAutoColumns.concat(this.gridColumns) : this.gridColumns;
var autoColBalancedTree = this.columnFactory.createForAutoGroups(this.groupAutoColumns, this.gridBalancedTree);
this.gridBalancedTree = autoColBalancedTree.concat(this.gridBalancedTree);
};
// gets called after we copy down grid columns, to make sure any part of the gui
// that tries to draw, eg the header, it will get empty lists of columns rather
// than stale columns. for example, the header will received gridColumnsChanged
// event, so will try and draw, but it will draw successfully when it acts on the
// virtualColumnsChanged event
ColumnController.prototype.clearDisplayedColumns = function () {
this.displayedLeftColumnTree = [];
this.displayedRightColumnTree = [];
this.displayedCentreColumnTree = [];
this.displayedLeftHeaderRows = {};
this.displayedRightHeaderRows = {};
this.displayedCentreHeaderRows = {};
this.displayedLeftColumns = [];
this.displayedRightColumns = [];
this.displayedCenterColumns = [];
this.allDisplayedColumns = [];
this.allDisplayedVirtualColumns = [];
};
ColumnController.prototype.updateGroupsAndDisplayedColumns = function (source) {
this.updateOpenClosedVisibilityInColumnGroups();
this.updateDisplayedColumnsFromTrees(source);
this.updateVirtualSets();
this.updateBodyWidths();
// this event is picked up by the gui, headerRenderer and rowRenderer, to recalculate what columns to display
var event = {
type: events_1.Events.EVENT_DISPLAYED_COLUMNS_CHANGED,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEvent(event);
};
ColumnController.prototype.updateDisplayedColumnsFromTrees = function (source) {
this.addToDisplayedColumns(this.displayedLeftColumnTree, this.displayedLeftColumns);
this.addToDisplayedColumns(this.displayedCentreColumnTree, this.displayedCenterColumns);
this.addToDisplayedColumns(this.displayedRightColumnTree, this.displayedRightColumns);
this.setupAllDisplayedColumns();
this.setLeftValues(source);
};
ColumnController.prototype.setupAllDisplayedColumns = function () {
if (this.gridOptionsWrapper.isEnableRtl()) {
this.allDisplayedColumns = this.displayedRightColumns
.concat(this.displayedCenterColumns)
.concat(this.displayedLeftColumns);
}
else {
this.allDisplayedColumns = this.displayedLeftColumns
.concat(this.displayedCenterColumns)
.concat(this.displayedRightColumns);
}
};
// sets the left pixel position of each column
ColumnController.prototype.setLeftValues = function (source) {
this.setLeftValuesOfColumns(source);
this.setLeftValuesOfGroups();
};
ColumnController.prototype.setLeftValuesOfColumns = function (source) {
var _this = this;
// go through each list of displayed columns
var allColumns = this.primaryColumns.slice(0);
// let totalColumnWidth = this.getWidthOfColsInList()
var doingRtl = this.gridOptionsWrapper.isEnableRtl();
[this.displayedLeftColumns, this.displayedRightColumns, this.displayedCenterColumns].forEach(function (columns) {
if (doingRtl) {
// when doing RTL, we start at the top most pixel (ie RHS) and work backwards
var left_1 = _this.getWidthOfColsInList(columns);
columns.forEach(function (column) {
left_1 -= column.getActualWidth();
column.setLeft(left_1, source);
});
}
else {
// otherwise normal LTR, we start at zero
var left_2 = 0;
columns.forEach(function (column) {
column.setLeft(left_2, source);
left_2 += column.getActualWidth();
});
}
utils_1._.removeAllFromArray(allColumns, columns);
});
// items left in allColumns are columns not displayed, so remove the left position. this is
// important for the rows, as if a col is made visible, then taken out, then made visible again,
// we don't want the animation of the cell floating in from the old position, whatever that was.
allColumns.forEach(function (column) {
column.setLeft(null, source);
});
};
ColumnController.prototype.setLeftValuesOfGroups = function () {
// a groups left value is the lest left value of it's children
[this.displayedLeftColumnTree, this.displayedRightColumnTree, this.displayedCentreColumnTree].forEach(function (columns) {
columns.forEach(function (column) {
if (column instanceof columnGroup_1.ColumnGroup) {
var columnGroup = column;
columnGroup.checkLeft();
}
});
});
};
ColumnController.prototype.addToDisplayedColumns = function (displayedColumnTree, displayedColumns) {
displayedColumns.length = 0;
this.columnUtils.depthFirstDisplayedColumnTreeSearch(displayedColumnTree, function (child) {
if (child instanceof column_1.Column) {
displayedColumns.push(child);
}
});
};
ColumnController.prototype.updateDisplayedCenterVirtualColumns = function () {
if (this.suppressColumnVirtualisation) {
// no virtualisation, so don't filter
this.allDisplayedCenterVirtualColumns = this.displayedCenterColumns;
}
else {
// filter out what should be visible
this.allDisplayedCenterVirtualColumns = this.filterOutColumnsWithinViewport();
}
this.allDisplayedVirtualColumns = this.allDisplayedCenterVirtualColumns
.concat(this.displayedLeftColumns)
.concat(this.displayedRightColumns);
// return map of virtual col id's, for easy lookup when building the groups.
// the map will be colId=>true, ie col id's mapping to 'true'.
var result = {};
this.allDisplayedVirtualColumns.forEach(function (col) {
result[col.getId()] = true;
});
return result;
};
ColumnController.prototype.getVirtualHeaderGroupRow = function (type, dept) {
var result;
switch (type) {
case column_1.Column.PINNED_LEFT:
result = this.displayedLeftHeaderRows[dept];
break;
case column_1.Column.PINNED_RIGHT:
result = this.displayedRightHeaderRows[dept];
break;
default:
result = this.displayedCentreHeaderRows[dept];
break;
}
if (utils_1._.missing(result)) {
result = [];
}
return result;
};
ColumnController.prototype.updateDisplayedVirtualGroups = function (virtualColIds) {
// go through each group, see if any of it's cols are displayed, and if yes,
// then this group is included
this.displayedLeftHeaderRows = {};
this.displayedRightHeaderRows = {};
this.displayedCentreHeaderRows = {};
testGroup(this.displayedLeftColumnTree, this.displayedLeftHeaderRows, 0);
testGroup(this.displayedRightColumnTree, this.displayedRightHeaderRows, 0);
testGroup(this.displayedCentreColumnTree, this.displayedCentreHeaderRows, 0);
function testGroup(children, result, dept) {
var returnValue = false;
for (var i = 0; i < children.length; i++) {
// see if this item is within viewport
var child = children[i];
var addThisItem = void 0;
if (child instanceof column_1.Column) {
// for column, test if column is included
addThisItem = virtualColIds[child.getId()] === true;
}
else {
// if group, base decision on children
var columnGroup = child;
addThisItem = testGroup(columnGroup.getDisplayedChildren(), result, dept + 1);
}
if (addThisItem) {
returnValue = true;
if (!result[dept]) {
result[dept] = [];
}
result[dept].push(child);
}
}
return returnValue;
}
};
ColumnController.prototype.updateVirtualSets = function () {
var virtualColIds = this.updateDisplayedCenterVirtualColumns();
this.updateDisplayedVirtualGroups(virtualColIds);
};
ColumnController.prototype.filterOutColumnsWithinViewport = function () {
return utils_1._.filter(this.displayedCenterColumns, this.isColumnInViewport.bind(this));
};
// called from api
ColumnController.prototype.sizeColumnsToFit = function (gridWidth, source) {
var _this = this;
if (source === void 0) { source = "api"; }
// avoid divide by zero
var allDisplayedColumns = this.getAllDisplayedColumns();
if (gridWidth <= 0 || allDisplayedColumns.length === 0) {
return;
}
var colsToNotSpread = utils_1._.filter(allDisplayedColumns, function (column) {
return column.getColDef().suppressSizeToFit === true;
});
var colsToSpread = utils_1._.filter(allDisplayedColumns, function (column) {
return column.getColDef().suppressSizeToFit !== true;
});
// make a copy of the cols that are going to be resized
var colsToFireEventFor = colsToSpread.slice(0);
var finishedResizing = false;
while (!finishedResizing) {
finishedResizing = true;
var availablePixels = gridWidth - this.getWidthOfColsInList(colsToNotSpread);
if (availablePixels <= 0) {
// no width, set everything to minimum
colsToSpread.forEach(function (column) {
column.setMinimum(source);
});
}
else {
var scale = availablePixels / this.getWidthOfColsInList(colsToSpread);
// we set the pixels for the last col based on what's left, as otherwise
// we could be a pixel or two short or extra because of rounding errors.
var pixelsForLastCol = availablePixels;
// backwards through loop, as we are removing items as we go
for (var i = colsToSpread.length - 1; i >= 0; i--) {
var column = colsToSpread[i];
var newWidth = Math.round(column.getActualWidth() * scale);
if (newWidth < column.getMinWidth()) {
column.setMinimum(source);
moveToNotSpread(column);
finishedResizing = false;
}
else if (column.isGreaterThanMax(newWidth)) {
column.setActualWidth(column.getMaxWidth(), source);
moveToNotSpread(column);
finishedResizing = false;
}
else {
var onLastCol = i === 0;
if (onLastCol) {
column.setActualWidth(pixelsForLastCol, source);
}
else {
column.setActualWidth(newWidth, source);
}
}
pixelsForLastCol -= newWidth;
}
}
}
this.setLeftValues(source);
this.updateBodyWidths();
colsToFireEventFor.forEach(function (column) {
var event = {
type: events_1.Events.EVENT_COLUMN_RESIZED,
column: column,
columns: [column],
finished: true,
api: _this.gridApi,
columnApi: _this.columnApi,
source: "sizeColumnsToFit"
};
_this.eventService.dispatchEvent(event);
});
function moveToNotSpread(column) {
utils_1._.removeFromArray(colsToSpread, column);
colsToNotSpread.push(column);
}
};
ColumnController.prototype.buildDisplayedTrees = function (visibleColumns) {
var leftVisibleColumns = utils_1._.filter(visibleColumns, function (column) {
return column.getPinned() === 'left';
});
var rightVisibleColumns = utils_1._.filter(visibleColumns, function (column) {
return column.getPinned() === 'right';
});
var centerVisibleColumns = utils_1._.filter(visibleColumns, function (column) {
return column.getPinned() !== 'left' && column.getPinned() !== 'right';
});
var groupInstanceIdCreator = new groupInstanceIdCreator_1.GroupInstanceIdCreator();
this.displayedLeftColumnTree = this.displayedGroupCreator.createDisplayedGroups(leftVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, column_1.Column.PINNED_LEFT, this.displayedLeftColumnTree);
this.displayedRightColumnTree = this.displayedGroupCreator.createDisplayedGroups(rightVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, column_1.Column.PINNED_RIGHT, this.displayedRightColumnTree);
this.displayedCentreColumnTree = this.displayedGroupCreator.createDisplayedGroups(centerVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, null, this.displayedCentreColumnTree);
};
ColumnController.prototype.updateOpenClosedVisibilityInColumnGroups = function () {
var allColumnGroups = this.getAllDisplayedColumnGroups();
this.columnUtils.depthFirstAllColumnTreeSearch(allColumnGroups, function (child) {
if (child instanceof columnGroup_1.ColumnGroup) {
var columnGroup = child;
columnGroup.calculateDisplayedColumns();
}
});
};
ColumnController.prototype.getGroupAutoColumns = function () {
return this.groupAutoColumns;
};
ColumnController.prototype.createGroupAutoColumnsIfNeeded = function () {
if (!this.autoGroupsNeedBuilding) {
return;
}
this.autoGroupsNeedBuilding = false;
var groupFullWidthRow = this.gridOptionsWrapper.isGroupUseEntireRow(this.pivotMode);
// we never suppress auto col for pivot mode, as there is no way for user to provide group columns
// in pivot mode. pivot mode has auto group column (provide by grid) and value columns (provided by
// pivot feature in the grid).
var groupSuppressAutoColumn = this.gridOptionsWrapper.isGroupSuppressAutoColumn() && !this.pivotMode;
var groupSuppressRow = this.gridOptionsWrapper.isGroupSuppressRow();
var groupingActive = this.rowGroupColumns.length > 0 || this.usingTreeData;
var needAutoColumns = groupingActive && !groupSuppressAutoColumn && !groupFullWidthRow && !groupSuppressRow;
if (needAutoColumns) {
var newAutoGroupCols = this.autoGroupColService.createAutoGroupColumns(this.rowGroupColumns);
var autoColsDifferent = !this.autoColsEqual(newAutoGroupCols, this.groupAutoColumns);
if (autoColsDifferent) {
this.groupAutoColumns = newAutoGroupCols;
}
}
else {
this.groupAutoColumns = null;
}
};
ColumnController.prototype.autoColsEqual = function (colsA, colsB) {
var bothMissing = !colsA && !colsB;
if (bothMissing) {
return true;
}
var atLeastOneListMissing = !colsA || !colsB;
if (atLeastOneListMissing) {
return false;
}
if (colsA.length !== colsB.length) {
return false;
}
for (var i = 0; i < colsA.length; i++) {
var colA = colsA[i];
var colB = colsB[i];
if (colA.getColId() !== colB.getColId()) {
return false;
}
}
return true;
};
ColumnController.prototype.getWidthOfColsInList = function (columnList) {
var result = 0;
for (var i = 0; i < columnList.length; i++) {
result += columnList[i].getActualWidth();
}
return result;
};
ColumnController.prototype.getGridBalancedTree = function () {
return this.gridBalancedTree;
};
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], ColumnController.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.Autowired('expressionService'),
__metadata("design:type", expressionService_1.ExpressionService)
], ColumnController.prototype, "expressionService", void 0);
__decorate([
context_1.Autowired('columnFactory'),
__metadata("design:type", columnFactory_1.ColumnFactory)
], ColumnController.prototype, "columnFactory", void 0);
__decorate([
context_1.Autowired('displayedGroupCreator'),
__metadata("design:type", displayedGroupCreator_1.DisplayedGroupCreator)
], ColumnController.prototype, "displayedGroupCreator", void 0);
__decorate([
context_1.Autowired('autoWidthCalculator'),
__metadata("design:type", autoWidthCalculator_1.AutoWidthCalculator)
], ColumnController.prototype, "autoWidthCalculator", void 0);
__decorate([
context_1.Autowired('eventService'),
__metadata("design:type", eventService_1.EventService)
], ColumnController.prototype, "eventService", void 0);
__decorate([
context_1.Autowired('columnUtils'),
__metadata("design:type", columnUtils_1.ColumnUtils)
], ColumnController.prototype, "columnUtils", void 0);
__decorate([
context_1.Autowired('context'),
__metadata("design:type", context_1.Context)
], ColumnController.prototype, "context", void 0);
__decorate([
context_1.Autowired('columnAnimationService'),
__metadata("design:type", columnAnimationService_1.ColumnAnimationService)
], ColumnController.prototype, "columnAnimationService", void 0);
__decorate([
context_1.Autowired('autoGroupColService'),
__metadata("design:type", autoGroupColService_1.AutoGroupColService)
], ColumnController.prototype, "autoGroupColService", void 0);
__decorate([
context_1.Optional('aggFuncService'),
__metadata("design:type", Object)
], ColumnController.prototype, "aggFuncService", void 0);
__decorate([
context_1.Optional('valueCache'),
__metadata("design:type", valueCache_1.ValueCache)
], ColumnController.prototype, "valueCache", void 0);
__decorate([
context_1.Autowired('columnApi'),
__metadata("design:type", columnApi_1.ColumnApi)
], ColumnController.prototype, "columnApi", void 0);
__decorate([
context_1.Autowired('gridApi'),
__metadata("design:type", gridApi_1.GridApi)
], ColumnController.prototype, "gridApi", void 0);
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], ColumnController.prototype, "init", null);
__decorate([
__param(0, context_1.Qualifier('loggerFactory')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [logger_1.LoggerFactory]),
__metadata("design:returntype", void 0)
], ColumnController.prototype, "setBeans", null);
ColumnController = __decorate([
context_1.Bean('columnController')
], ColumnController);
return ColumnController;
}());
exports.ColumnController = ColumnController;
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var column_1 = __webpack_require__(23);
var eventService_1 = __webpack_require__(11);
var context_1 = __webpack_require__(13);
var gridOptionsWrapper_1 = __webpack_require__(4);
var utils_1 = __webpack_require__(5);
var ColumnGroup = /** @class */ (function () {
function ColumnGroup(originalColumnGroup, groupId, instanceId, pinned) {
// depends on the open/closed state of the group, only displaying columns are stored here
this.displayedChildren = [];
this.localEventService = new eventService_1.EventService();
this.groupId = groupId;
this.instanceId = instanceId;
this.originalColumnGroup = originalColumnGroup;
this.pinned = pinned;
}
// this is static, a it is used outside of this class
ColumnGroup.createUniqueId = function (groupId, instanceId) {
return groupId + '_' + instanceId;
};
// as the user is adding and removing columns, the groups are recalculated.
// this reset clears out all children, ready for children to be added again
ColumnGroup.prototype.reset = function () {
this.parent = null;
this.children = null;
this.displayedChildren = null;
};
ColumnGroup.prototype.getParent = function () {
return this.parent;
};
ColumnGroup.prototype.setParent = function (parent) {
this.parent = parent;
};
ColumnGroup.prototype.getUniqueId = function () {
return ColumnGroup.createUniqueId(this.groupId, this.instanceId);
};
ColumnGroup.prototype.isEmptyGroup = function () {
return this.displayedChildren.length === 0;
};
ColumnGroup.prototype.isMoving = function () {
var allLeafColumns = this.getOriginalColumnGroup().getLeafColumns();
if (!allLeafColumns || allLeafColumns.length === 0) {
return false;
}
var allMoving = true;
allLeafColumns.forEach(function (col) {
if (!col.isMoving()) {
allMoving = false;
}
});
return allMoving;
};
ColumnGroup.prototype.checkLeft = function () {
// first get all children to setLeft, as it impacts our decision below
this.displayedChildren.forEach(function (child) {
if (child instanceof ColumnGroup) {
child.checkLeft();
}
});
// set our left based on first displayed column
if (this.displayedChildren.length > 0) {
if (this.gridOptionsWrapper.isEnableRtl()) {
var lastChild = utils_1._.last(this.displayedChildren);
var lastChildLeft = lastChild.getLeft();
this.setLeft(lastChildLeft);
}
else {
var firstChildLeft = this.displayedChildren[0].getLeft();
this.setLeft(firstChildLeft);
}
}
else {
// this should never happen, as if we have no displayed columns, then
// this groups should not even exist.
this.setLeft(null);
}
};
ColumnGroup.prototype.getLeft = function () {
return this.left;
};
ColumnGroup.prototype.getOldLeft = function () {
return this.oldLeft;
};
ColumnGroup.prototype.setLeft = function (left) {
this.oldLeft = left;
if (this.left !== left) {
this.left = left;
this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_LEFT_CHANGED));
}
};
ColumnGroup.prototype.getPinned = function () {
return this.pinned;
};
ColumnGroup.prototype.createAgEvent = function (type) {
return {
type: type,
};
};
ColumnGroup.prototype.addEventListener = function (eventType, listener) {
this.localEventService.addEventListener(eventType, listener);
};
ColumnGroup.prototype.removeEventListener = function (eventType, listener) {
this.localEventService.removeEventListener(eventType, listener);
};
ColumnGroup.prototype.getGroupId = function () {
return this.groupId;
};
ColumnGroup.prototype.getInstanceId = function () {
return this.instanceId;
};
ColumnGroup.prototype.isChildInThisGroupDeepSearch = function (wantedChild) {
var result = false;
this.children.forEach(function (foundChild) {
if (wantedChild === foundChild) {
result = true;
}
if (foundChild instanceof ColumnGroup) {
if (foundChild.isChildInThisGroupDeepSearch(wantedChild)) {
result = true;
}
}
});
return result;
};
ColumnGroup.prototype.getActualWidth = function () {
var groupActualWidth = 0;
if (this.displayedChildren) {
this.displayedChildren.forEach(function (child) {
groupActualWidth += child.getActualWidth();
});
}
return groupActualWidth;
};
ColumnGroup.prototype.isResizable = function () {
if (!this.displayedChildren) {
return false;
}
// if at least one child is resizable, then the group is resizable
var result = false;
this.displayedChildren.forEach(function (child) {
if (child.isResizable()) {
result = true;
}
});
return result;
};
ColumnGroup.prototype.getMinWidth = function () {
var result = 0;
this.displayedChildren.forEach(function (groupChild) {
result += groupChild.getMinWidth();
});
return result;
};
ColumnGroup.prototype.addChild = function (child) {
if (!this.children) {
this.children = [];
}
this.children.push(child);
};
ColumnGroup.prototype.getDisplayedChildren = function () {
return this.displayedChildren;
};
ColumnGroup.prototype.getLeafColumns = function () {
var result = [];
this.addLeafColumns(result);
return result;
};
ColumnGroup.prototype.getDisplayedLeafColumns = function () {
var result = [];
this.addDisplayedLeafColumns(result);
return result;
};
// why two methods here doing the same thing?
ColumnGroup.prototype.getDefinition = function () {
return this.originalColumnGroup.getColGroupDef();
};
ColumnGroup.prototype.getColGroupDef = function () {
return this.originalColumnGroup.getColGroupDef();
};
ColumnGroup.prototype.isPadding = function () {
return this.originalColumnGroup.isPadding();
};
ColumnGroup.prototype.isExpandable = function () {
return this.originalColumnGroup.isExpandable();
};
ColumnGroup.prototype.isExpanded = function () {
return this.originalColumnGroup.isExpanded();
};
ColumnGroup.prototype.setExpanded = function (expanded) {
this.originalColumnGroup.setExpanded(expanded);
};
ColumnGroup.prototype.addDisplayedLeafColumns = function (leafColumns) {
this.displayedChildren.forEach(function (child) {
if (child instanceof column_1.Column) {
leafColumns.push(child);
}
else if (child instanceof ColumnGroup) {
child.addDisplayedLeafColumns(leafColumns);
}
});
};
ColumnGroup.prototype.addLeafColumns = function (leafColumns) {
this.children.forEach(function (child) {
if (child instanceof column_1.Column) {
leafColumns.push(child);
}
else if (child instanceof ColumnGroup) {
child.addLeafColumns(leafColumns);
}
});
};
ColumnGroup.prototype.getChildren = function () {
return this.children;
};
ColumnGroup.prototype.getColumnGroupShow = function () {
return this.originalColumnGroup.getColumnGroupShow();
};
ColumnGroup.prototype.getOriginalColumnGroup = function () {
return this.originalColumnGroup;
};
ColumnGroup.prototype.calculateDisplayedColumns = function () {
var _this = this;
// clear out last time we calculated
this.displayedChildren = [];
var topLevelGroup = this;
// find the column group that is controlling expandable. this is relevant when we have padding (empty)
// groups, where the expandable is actually the first parent that is not a padding group.
if (this.isPadding()) {
while (topLevelGroup.getParent() && topLevelGroup.isPadding()) {
topLevelGroup = topLevelGroup.getParent();
}
}
var isExpandable = topLevelGroup.originalColumnGroup.isExpandable();
// it not expandable, everything is visible
if (!isExpandable) {
this.displayedChildren = this.children;
}
else {
// Add cols based on columnGroupShow
// Note - the below also adds padding groups, these are always added because they never have
// colDef.columnGroupShow set.
this.children.forEach(function (abstractColumn) {
var headerGroupShow = abstractColumn.getColumnGroupShow();
switch (headerGroupShow) {
case ColumnGroup.HEADER_GROUP_SHOW_OPEN:
// when set to open, only show col if group is open
if (topLevelGroup.originalColumnGroup.isExpanded()) {
_this.displayedChildren.push(abstractColumn);
}
break;
case ColumnGroup.HEADER_GROUP_SHOW_CLOSED:
// when set to open, only show col if group is open
if (!topLevelGroup.originalColumnGroup.isExpanded()) {
_this.displayedChildren.push(abstractColumn);
}
break;
default:
// default is always show the column
_this.displayedChildren.push(abstractColumn);
break;
}
});
}
this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED));
};
ColumnGroup.HEADER_GROUP_SHOW_OPEN = 'open';
ColumnGroup.HEADER_GROUP_SHOW_CLOSED = 'closed';
ColumnGroup.HEADER_GROUP_PADDING = 'padding';
ColumnGroup.EVENT_LEFT_CHANGED = 'leftChanged';
ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED = 'displayedChildrenChanged';
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], ColumnGroup.prototype, "gridOptionsWrapper", void 0);
return ColumnGroup;
}());
exports.ColumnGroup = ColumnGroup;
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var eventService_1 = __webpack_require__(11);
var utils_1 = __webpack_require__(5);
var context_1 = __webpack_require__(13);
var gridOptionsWrapper_1 = __webpack_require__(4);
var columnUtils_1 = __webpack_require__(24);
var columnApi_1 = __webpack_require__(26);
var gridApi_1 = __webpack_require__(18);
// Wrapper around a user provide column definition. The grid treats the column definition as ready only.
// This class contains all the runtime information about a column, plus some logic (the definition has no logic).
// This class implements both interfaces ColumnGroupChild and OriginalColumnGroupChild as the class can
// appear as a child of either the original tree or the displayed tree. However the relevant group classes
// for each type only implements one, as each group can only appear in it's associated tree (eg OriginalColumnGroup
// can only appear in OriginalColumn tree).
var Column = /** @class */ (function () {
function Column(colDef, userProvidedColDef, colId, primary) {
this.moving = false;
this.menuVisible = false;
this.filterActive = false;
this.eventService = new eventService_1.EventService();
this.rowGroupActive = false;
this.pivotActive = false;
this.aggregationActive = false;
this.colDef = colDef;
this.userProvidedColDef = userProvidedColDef;
this.visible = !colDef.hide;
this.sort = colDef.sort;
this.sortedAt = colDef.sortedAt;
this.colId = colId;
this.primary = primary;
}
// gets called when user provides an alternative colDef, eg
Column.prototype.setColDef = function (colDef, userProvidedColDef) {
this.colDef = colDef;
this.userProvidedColDef = userProvidedColDef;
};
Column.prototype.getUserProvidedColDef = function () {
return this.userProvidedColDef;
};
Column.prototype.setParent = function (parent) {
this.parent = parent;
};
Column.prototype.getParent = function () {
return this.parent;
};
Column.prototype.setOriginalParent = function (originalParent) {
this.originalParent = originalParent;
};
Column.prototype.getOriginalParent = function () {
return this.originalParent;
};
// this is done after constructor as it uses gridOptionsWrapper
Column.prototype.initialise = function () {
this.setPinned(this.colDef.pinned);
var minColWidth = this.gridOptionsWrapper.getMinColWidth();
var maxColWidth = this.gridOptionsWrapper.getMaxColWidth();
if (this.colDef.minWidth) {
this.minWidth = this.colDef.minWidth;
}
else {
this.minWidth = minColWidth;
}
if (this.colDef.maxWidth) {
this.maxWidth = this.colDef.maxWidth;
}
else {
this.maxWidth = maxColWidth;
}
this.actualWidth = this.columnUtils.calculateColInitialWidth(this.colDef);
var suppressDotNotation = this.gridOptionsWrapper.isSuppressFieldDotNotation();
this.fieldContainsDots = utils_1._.exists(this.colDef.field) && this.colDef.field.indexOf('.') >= 0 && !suppressDotNotation;
this.tooltipFieldContainsDots = utils_1._.exists(this.colDef.tooltipField) && this.colDef.tooltipField.indexOf('.') >= 0 && !suppressDotNotation;
this.validate();
};
Column.prototype.isEmptyGroup = function () {
return false;
};
Column.prototype.isRowGroupDisplayed = function (colId) {
if (utils_1._.missing(this.colDef) || utils_1._.missing(this.colDef.showRowGroup)) {
return false;
}
var showingAllGroups = this.colDef.showRowGroup === true;
var showingThisGroup = this.colDef.showRowGroup === colId;
return showingAllGroups || showingThisGroup;
};
Column.prototype.getUniqueId = function () {
return this.getId();
};
Column.prototype.isPrimary = function () {
return this.primary;
};
Column.prototype.isFilterAllowed = function () {
// filter defined means it's a string, class or true.
// if its false, null or undefined then it's false.
var filterDefined = !!this.colDef.filter || !!this.colDef.filterFramework;
return this.primary && filterDefined;
};
Column.prototype.isFieldContainsDots = function () {
return this.fieldContainsDots;
};
Column.prototype.isTooltipFieldContainsDots = function () {
return this.tooltipFieldContainsDots;
};
Column.prototype.validate = function () {
var colDefAny = this.colDef;
if (!this.gridOptionsWrapper.isEnterprise()) {
var itemsNotAllowedWithoutEnterprise = ['enableRowGroup', 'rowGroup', 'rowGroupIndex', 'enablePivot', 'enableValue', 'pivot', 'pivotIndex', 'aggFunc', 'chartDataType'];
itemsNotAllowedWithoutEnterprise.forEach(function (item) {
if (utils_1._.exists(colDefAny[item])) {
console.warn("ag-Grid: " + item + " is only valid in ag-Grid-Enterprise, your column definition should not have " + item);
}
});
}
if (this.gridOptionsWrapper.isTreeData()) {
var itemsNotAllowedWithTreeData = ['rowGroup', 'rowGroupIndex', 'pivot', 'pivotIndex'];
itemsNotAllowedWithTreeData.forEach(function (item) {
if (utils_1._.exists(colDefAny[item])) {
console.warn("ag-Grid: " + item + " is not possible when doing tree data, your column definition should not have " + item);
}
});
}
if (utils_1._.exists(this.colDef.width) && typeof this.colDef.width !== 'number') {
console.warn('ag-Grid: colDef.width should be a number, not ' + typeof this.colDef.width);
}
if (utils_1._.get(this, 'colDef.cellRendererParams.restrictToOneGroup', null)) {
console.warn('ag-Grid: Since ag-grid 11.0.0 cellRendererParams.restrictToOneGroup is deprecated. You should use showRowGroup');
}
if (utils_1._.get(this, 'colDef.cellRendererParams.keyMap', null)) {
console.warn('ag-Grid: Since ag-grid 11.0.0 cellRendererParams.keyMap is deprecated. You should use colDef.keyCreator');
}
if (utils_1._.get(this, 'colDef.cellRendererParams.keyMap', null)) {
console.warn('ag-Grid: Since ag-grid 11.0.0 cellRendererParams.keyMap is deprecated. You should use colDef.keyCreator');
}
if (colDefAny.floatingCellRenderer) {
console.warn('ag-Grid: since v11, floatingCellRenderer is now pinnedRowCellRenderer');
this.colDef.pinnedRowCellRenderer = colDefAny.floatingCellRenderer;
}
if (colDefAny.floatingRendererFramework) {
console.warn('ag-Grid: since v11, floatingRendererFramework is now pinnedRowCellRendererFramework');
this.colDef.pinnedRowCellRendererFramework = colDefAny.floatingRendererFramework;
}
if (colDefAny.floatingRendererParams) {
console.warn('ag-Grid: since v11, floatingRendererParams is now pinnedRowCellRendererParams');
this.colDef.pinnedRowCellRendererParams = colDefAny.floatingRendererParams;
}
if (colDefAny.floatingValueFormatter) {
console.warn('ag-Grid: since v11, floatingValueFormatter is now pinnedRowValueFormatter');
this.colDef.pinnedRowValueFormatter = colDefAny.floatingValueFormatter;
}
if (colDefAny.cellFormatter) {
console.warn('ag-Grid: since v12, cellFormatter is now valueFormatter');
if (utils_1._.missing(this.colDef.valueFormatter)) {
this.colDef.valueFormatter = colDefAny.cellFormatter;
}
}
if (colDefAny.headerCellTemplate) {
console.warn('ag-Grid: since v15, headerCellTemplate is gone, use header component instead.');
}
if (colDefAny.headerCellRenderer) {
console.warn('ag-Grid: since v15, headerCellRenderer is gone, use header component instead.');
}
if (colDefAny.volatile) {
console.warn('ag-Grid: since v16, colDef.volatile is gone, please check refresh docs on how to refresh specific cells.');
}
if (colDefAny.suppressSorting) {
console.warn("ag-Grid: since v20, colDef.suppressSorting is gone, instead use colDef.sortable=false.", this.colDef);
this.colDef.sortable = false;
}
if (colDefAny.suppressFilter) {
console.warn("ag-Grid: since v20, colDef.suppressFilter is gone, instead use colDef.filter=false.", this.colDef);
this.colDef.filter = false;
}
if (colDefAny.suppressResize) {
console.warn("ag-Grid: since v20, colDef.suppressResize is gone, instead use colDef.resizable=false.", this.colDef);
this.colDef.resizable = false;
}
if (colDefAny.tooltip) {
console.warn("ag-Grid: since v20.1, colDef.tooltip is gone, instead use colDef.tooltipValueGetter.", this.colDef);
this.colDef.tooltipValueGetter = colDefAny.tooltip;
}
};
Column.prototype.addEventListener = function (eventType, listener) {
this.eventService.addEventListener(eventType, listener);
};
Column.prototype.removeEventListener = function (eventType, listener) {
this.eventService.removeEventListener(eventType, listener);
};
Column.prototype.createIsColumnFuncParams = function (rowNode) {
return {
node: rowNode,
data: rowNode.data,
column: this,
colDef: this.colDef,
context: this.gridOptionsWrapper.getContext(),
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi()
};
};
Column.prototype.isSuppressNavigable = function (rowNode) {
// if boolean set, then just use it
if (typeof this.colDef.suppressNavigable === 'boolean') {
return this.colDef.suppressNavigable;
}
// if function, then call the function to find out
if (typeof this.colDef.suppressNavigable === 'function') {
var params = this.createIsColumnFuncParams(rowNode);
var userFunc = this.colDef.suppressNavigable;
return userFunc(params);
}
return false;
};
Column.prototype.isCellEditable = function (rowNode) {
// only allow editing of groups if the user has this option enabled
if (rowNode.group && !this.gridOptionsWrapper.isEnableGroupEdit()) {
return false;
}
return this.isColumnFunc(rowNode, this.colDef.editable);
};
Column.prototype.isRowDrag = function (rowNode) {
return this.isColumnFunc(rowNode, this.colDef.rowDrag);
};
Column.prototype.isDndSource = function (rowNode) {
return this.isColumnFunc(rowNode, this.colDef.dndSource);
};
Column.prototype.isCellCheckboxSelection = function (rowNode) {
return this.isColumnFunc(rowNode, this.colDef.checkboxSelection);
};
Column.prototype.isSuppressPaste = function (rowNode) {
return this.isColumnFunc(rowNode, this.colDef ? this.colDef.suppressPaste : null);
};
Column.prototype.isResizable = function () {
return this.colDef.resizable === true;
};
Column.prototype.isColumnFunc = function (rowNode, value) {
// if boolean set, then just use it
if (typeof value === 'boolean') {
return value;
}
// if function, then call the function to find out
if (typeof value === 'function') {
var params = this.createIsColumnFuncParams(rowNode);
var editableFunc = value;
return editableFunc(params);
}
return false;
};
Column.prototype.setMoving = function (moving, source) {
if (source === void 0) { source = "api"; }
this.moving = moving;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_MOVING_CHANGED, source));
};
Column.prototype.createColumnEvent = function (type, source) {
return {
api: this.gridApi,
columnApi: this.columnApi,
type: type,
column: this,
columns: [this],
source: source
};
};
Column.prototype.isMoving = function () {
return this.moving;
};
Column.prototype.getSort = function () {
return this.sort;
};
Column.prototype.setSort = function (sort, source) {
if (source === void 0) { source = "api"; }
if (this.sort !== sort) {
this.sort = sort;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_SORT_CHANGED, source));
}
};
Column.prototype.setMenuVisible = function (visible, source) {
if (source === void 0) { source = "api"; }
if (this.menuVisible !== visible) {
this.menuVisible = visible;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_MENU_VISIBLE_CHANGED, source));
}
};
Column.prototype.isMenuVisible = function () {
return this.menuVisible;
};
Column.prototype.isSortAscending = function () {
return this.sort === Column.SORT_ASC;
};
Column.prototype.isSortDescending = function () {
return this.sort === Column.SORT_DESC;
};
Column.prototype.isSortNone = function () {
return utils_1._.missing(this.sort);
};
Column.prototype.isSorting = function () {
return utils_1._.exists(this.sort);
};
Column.prototype.getSortedAt = function () {
return this.sortedAt;
};
Column.prototype.setSortedAt = function (sortedAt) {
this.sortedAt = sortedAt;
};
Column.prototype.setAggFunc = function (aggFunc) {
this.aggFunc = aggFunc;
};
Column.prototype.getAggFunc = function () {
return this.aggFunc;
};
Column.prototype.getLeft = function () {
return this.left;
};
Column.prototype.getOldLeft = function () {
return this.oldLeft;
};
Column.prototype.getRight = function () {
return this.left + this.actualWidth;
};
Column.prototype.setLeft = function (left, source) {
if (source === void 0) { source = "api"; }
this.oldLeft = this.left;
if (this.left !== left) {
this.left = left;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_LEFT_CHANGED, source));
}
};
Column.prototype.isFilterActive = function () {
return this.filterActive;
};
// additionalEventAttributes is used by provided simple floating filter, so it can add 'floatingFilter=true' to the event
Column.prototype.setFilterActive = function (active, source, additionalEventAttributes) {
if (source === void 0) { source = "api"; }
if (this.filterActive !== active) {
this.filterActive = active;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_FILTER_ACTIVE_CHANGED, source));
}
var filterChangedEvent = this.createColumnEvent(Column.EVENT_FILTER_CHANGED, source);
if (additionalEventAttributes) {
utils_1._.mergeDeep(filterChangedEvent, additionalEventAttributes);
}
this.eventService.dispatchEvent(filterChangedEvent);
};
Column.prototype.setPinned = function (pinned) {
if (pinned === true || pinned === Column.PINNED_LEFT) {
this.pinned = Column.PINNED_LEFT;
}
else if (pinned === Column.PINNED_RIGHT) {
this.pinned = Column.PINNED_RIGHT;
}
else {
this.pinned = null;
}
};
Column.prototype.setFirstRightPinned = function (firstRightPinned, source) {
if (source === void 0) { source = "api"; }
if (this.firstRightPinned !== firstRightPinned) {
this.firstRightPinned = firstRightPinned;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_FIRST_RIGHT_PINNED_CHANGED, source));
}
};
Column.prototype.setLastLeftPinned = function (lastLeftPinned, source) {
if (source === void 0) { source = "api"; }
if (this.lastLeftPinned !== lastLeftPinned) {
this.lastLeftPinned = lastLeftPinned;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_LAST_LEFT_PINNED_CHANGED, source));
}
};
Column.prototype.isFirstRightPinned = function () {
return this.firstRightPinned;
};
Column.prototype.isLastLeftPinned = function () {
return this.lastLeftPinned;
};
Column.prototype.isPinned = function () {
return this.pinned === Column.PINNED_LEFT || this.pinned === Column.PINNED_RIGHT;
};
Column.prototype.isPinnedLeft = function () {
return this.pinned === Column.PINNED_LEFT;
};
Column.prototype.isPinnedRight = function () {
return this.pinned === Column.PINNED_RIGHT;
};
Column.prototype.getPinned = function () {
return this.pinned;
};
Column.prototype.setVisible = function (visible, source) {
if (source === void 0) { source = "api"; }
var newValue = visible === true;
if (this.visible !== newValue) {
this.visible = newValue;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_VISIBLE_CHANGED, source));
}
};
Column.prototype.isVisible = function () {
return this.visible;
};
Column.prototype.getColDef = function () {
return this.colDef;
};
Column.prototype.getColumnGroupShow = function () {
return this.colDef.columnGroupShow;
};
Column.prototype.getColId = function () {
return this.colId;
};
Column.prototype.getId = function () {
return this.getColId();
};
Column.prototype.getDefinition = function () {
return this.colDef;
};
Column.prototype.getActualWidth = function () {
return this.actualWidth;
};
Column.prototype.createBaseColDefParams = function (rowNode) {
var params = {
node: rowNode,
data: rowNode.data,
colDef: this.colDef,
column: this,
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi(),
context: this.gridOptionsWrapper.getContext()
};
return params;
};
Column.prototype.getColSpan = function (rowNode) {
if (utils_1._.missing(this.colDef.colSpan)) {
return 1;
}
var params = this.createBaseColDefParams(rowNode);
var colSpan = this.colDef.colSpan(params);
// colSpan must be number equal to or greater than 1
return Math.max(colSpan, 1);
};
Column.prototype.getRowSpan = function (rowNode) {
if (utils_1._.missing(this.colDef.rowSpan)) {
return 1;
}
var params = this.createBaseColDefParams(rowNode);
var rowSpan = this.colDef.rowSpan(params);
// rowSpan must be number equal to or greater than 1
return Math.max(rowSpan, 1);
};
Column.prototype.setActualWidth = function (actualWidth, source) {
if (source === void 0) { source = "api"; }
if (this.actualWidth !== actualWidth) {
this.actualWidth = actualWidth;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_WIDTH_CHANGED, source));
}
};
Column.prototype.isGreaterThanMax = function (width) {
if (this.maxWidth) {
return width > this.maxWidth;
}
return false;
};
Column.prototype.getMinWidth = function () {
return this.minWidth;
};
Column.prototype.getMaxWidth = function () {
return this.maxWidth;
};
Column.prototype.setMinimum = function (source) {
if (source === void 0) { source = "api"; }
this.setActualWidth(this.minWidth, source);
};
Column.prototype.setRowGroupActive = function (rowGroup, source) {
if (source === void 0) { source = "api"; }
if (this.rowGroupActive !== rowGroup) {
this.rowGroupActive = rowGroup;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_ROW_GROUP_CHANGED, source));
}
};
Column.prototype.isRowGroupActive = function () {
return this.rowGroupActive;
};
Column.prototype.setPivotActive = function (pivot, source) {
if (source === void 0) { source = "api"; }
if (this.pivotActive !== pivot) {
this.pivotActive = pivot;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_PIVOT_CHANGED, source));
}
};
Column.prototype.isPivotActive = function () {
return this.pivotActive;
};
Column.prototype.isAnyFunctionActive = function () {
return this.isPivotActive() || this.isRowGroupActive() || this.isValueActive();
};
Column.prototype.isAnyFunctionAllowed = function () {
return this.isAllowPivot() || this.isAllowRowGroup() || this.isAllowValue();
};
Column.prototype.setValueActive = function (value, source) {
if (source === void 0) { source = "api"; }
if (this.aggregationActive !== value) {
this.aggregationActive = value;
this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_VALUE_CHANGED, source));
}
};
Column.prototype.isValueActive = function () {
return this.aggregationActive;
};
Column.prototype.isAllowPivot = function () {
return this.colDef.enablePivot === true;
};
Column.prototype.isAllowValue = function () {
return this.colDef.enableValue === true;
};
Column.prototype.isAllowRowGroup = function () {
return this.colDef.enableRowGroup === true;
};
Column.prototype.getMenuTabs = function (defaultValues) {
var menuTabs = this.getColDef().menuTabs;
if (menuTabs == null) {
menuTabs = defaultValues;
}
return menuTabs;
};
// this used to be needed, as previous version of ag-grid had lockPosition as column state,
// so couldn't depend on colDef version.
Column.prototype.isLockPosition = function () {
console.warn('ag-Grid: since v21, col.isLockPosition() should not be used, please use col.getColDef().lockPosition instead.');
return this.colDef ? !!this.colDef.lockPosition : false;
};
// this used to be needed, as previous version of ag-grid had lockVisible as column state,
// so couldn't depend on colDef version.
Column.prototype.isLockVisible = function () {
console.warn('ag-Grid: since v21, col.isLockVisible() should not be used, please use col.getColDef().lockVisible instead.');
return this.colDef ? !!this.colDef.lockVisible : false;
};
// this used to be needed, as previous version of ag-grid had lockPinned as column state,
// so couldn't depend on colDef version.
Column.prototype.isLockPinned = function () {
console.warn('ag-Grid: since v21, col.isLockPinned() should not be used, please use col.getColDef().lockPinned instead.');
return this.colDef ? !!this.colDef.lockPinned : false;
};
// + renderedHeaderCell - for making header cell transparent when moving
Column.EVENT_MOVING_CHANGED = 'movingChanged';
// + renderedCell - changing left position
Column.EVENT_LEFT_CHANGED = 'leftChanged';
// + renderedCell - changing width
Column.EVENT_WIDTH_CHANGED = 'widthChanged';
// + renderedCell - for changing pinned classes
Column.EVENT_LAST_LEFT_PINNED_CHANGED = 'lastLeftPinnedChanged';
Column.EVENT_FIRST_RIGHT_PINNED_CHANGED = 'firstRightPinnedChanged';
// + renderedColumn - for changing visibility icon
Column.EVENT_VISIBLE_CHANGED = 'visibleChanged';
// + every time the filter changes, used in the floating filters
Column.EVENT_FILTER_CHANGED = 'filterChanged';
// + renderedHeaderCell - marks the header with filter icon
Column.EVENT_FILTER_ACTIVE_CHANGED = 'filterActiveChanged';
// + renderedHeaderCell - marks the header with sort icon
Column.EVENT_SORT_CHANGED = 'sortChanged';
Column.EVENT_MENU_VISIBLE_CHANGED = 'menuVisibleChanged';
// + toolpanel, for gui updates
Column.EVENT_ROW_GROUP_CHANGED = 'columnRowGroupChanged';
// + toolpanel, for gui updates
Column.EVENT_PIVOT_CHANGED = 'columnPivotChanged';
// + toolpanel, for gui updates
Column.EVENT_VALUE_CHANGED = 'columnValueChanged';
Column.PINNED_RIGHT = 'right';
Column.PINNED_LEFT = 'left';
Column.SORT_ASC = 'asc';
Column.SORT_DESC = 'desc';
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], Column.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.Autowired('columnUtils'),
__metadata("design:type", columnUtils_1.ColumnUtils)
], Column.prototype, "columnUtils", void 0);
__decorate([
context_1.Autowired('columnApi'),
__metadata("design:type", columnApi_1.ColumnApi)
], Column.prototype, "columnApi", void 0);
__decorate([
context_1.Autowired('gridApi'),
__metadata("design:type", gridApi_1.GridApi)
], Column.prototype, "gridApi", void 0);
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], Column.prototype, "initialise", null);
return Column;
}());
exports.Column = Column;
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var gridOptionsWrapper_1 = __webpack_require__(4);
var columnGroup_1 = __webpack_require__(22);
var originalColumnGroup_1 = __webpack_require__(25);
var context_1 = __webpack_require__(13);
var context_2 = __webpack_require__(13);
// takes in a list of columns, as specified by the column definitions, and returns column groups
var ColumnUtils = /** @class */ (function () {
function ColumnUtils() {
}
ColumnUtils.prototype.calculateColInitialWidth = function (colDef) {
if (!colDef.width) {
// if no width defined in colDef, use default
return this.gridOptionsWrapper.getColWidth();
}
else if (colDef.width < this.gridOptionsWrapper.getMinColWidth()) {
// if width in col def to small, set to min width
return this.gridOptionsWrapper.getMinColWidth();
}
else {
// otherwise use the provided width
return colDef.width;
}
};
ColumnUtils.prototype.getOriginalPathForColumn = function (column, originalBalancedTree) {
var result = [];
var found = false;
recursePath(originalBalancedTree, 0);
// we should always find the path, but in case there is a bug somewhere, returning null
// will make it fail rather than provide a 'hard to track down' bug
if (found) {
return result;
}
else {
return null;
}
function recursePath(balancedColumnTree, dept) {
for (var i = 0; i < balancedColumnTree.length; i++) {
if (found) {
// quit the search, so 'result' is kept with the found result
return;
}
var node = balancedColumnTree[i];
if (node instanceof originalColumnGroup_1.OriginalColumnGroup) {
var nextNode = node;
recursePath(nextNode.getChildren(), dept + 1);
result[dept] = node;
}
else {
if (node === column) {
found = true;
}
}
}
}
};
/* public getPathForColumn(column: Column, allDisplayedColumnGroups: ColumnGroupChild[]): ColumnGroup[] {
let result: ColumnGroup[] = [];
let found = false;
recursePath(allDisplayedColumnGroups, 0);
// we should always find the path, but in case there is a bug somewhere, returning null
// will make it fail rather than provide a 'hard to track down' bug
if (found) {
return result;
} else {
return null;
}
function recursePath(balancedColumnTree: ColumnGroupChild[], dept: number): void {
for (let i = 0; i node;
recursePath(nextNode.getChildren(), dept+1);
result[dept] = node;
} else {
if (node === column) {
found = true;
}
}
}
}
}*/
ColumnUtils.prototype.depthFirstOriginalTreeSearch = function (parent, tree, callback) {
var _this = this;
if (!tree) {
return;
}
tree.forEach(function (child) {
if (child instanceof originalColumnGroup_1.OriginalColumnGroup) {
_this.depthFirstOriginalTreeSearch(child, child.getChildren(), callback);
}
callback(child, parent);
});
};
ColumnUtils.prototype.depthFirstAllColumnTreeSearch = function (tree, callback) {
var _this = this;
if (!tree) {
return;
}
tree.forEach(function (child) {
if (child instanceof columnGroup_1.ColumnGroup) {
_this.depthFirstAllColumnTreeSearch(child.getChildren(), callback);
}
callback(child);
});
};
ColumnUtils.prototype.depthFirstDisplayedColumnTreeSearch = function (tree, callback) {
var _this = this;
if (!tree) {
return;
}
tree.forEach(function (child) {
if (child instanceof columnGroup_1.ColumnGroup) {
_this.depthFirstDisplayedColumnTreeSearch(child.getDisplayedChildren(), callback);
}
callback(child);
});
};
__decorate([
context_2.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], ColumnUtils.prototype, "gridOptionsWrapper", void 0);
ColumnUtils = __decorate([
context_1.Bean('columnUtils')
], ColumnUtils);
return ColumnUtils;
}());
exports.ColumnUtils = ColumnUtils;
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var columnGroup_1 = __webpack_require__(22);
var column_1 = __webpack_require__(23);
var eventService_1 = __webpack_require__(11);
var OriginalColumnGroup = /** @class */ (function () {
function OriginalColumnGroup(colGroupDef, groupId, padding, level) {
this.localEventService = new eventService_1.EventService();
this.expandable = false;
this.colGroupDef = colGroupDef;
this.groupId = groupId;
this.expanded = colGroupDef && !!colGroupDef.openByDefault;
this.padding = padding;
this.level = level;
}
OriginalColumnGroup.prototype.setOriginalParent = function (originalParent) {
this.originalParent = this.originalParent;
};
OriginalColumnGroup.prototype.getOriginalParent = function () {
return this.originalParent;
};
OriginalColumnGroup.prototype.getLevel = function () {
return this.level;
};
OriginalColumnGroup.prototype.isVisible = function () {
// return true if at least one child is visible
if (this.children) {
return this.children.some(function (child) { return child.isVisible(); });
}
return false;
};
OriginalColumnGroup.prototype.isPadding = function () {
return this.padding;
};
OriginalColumnGroup.prototype.setExpanded = function (expanded) {
this.expanded = expanded === undefined ? false : expanded;
var event = {
type: OriginalColumnGroup.EVENT_EXPANDED_CHANGED
};
this.localEventService.dispatchEvent(event);
};
OriginalColumnGroup.prototype.isExpandable = function () {
return this.expandable;
};
OriginalColumnGroup.prototype.isExpanded = function () {
return this.expanded;
};
OriginalColumnGroup.prototype.getGroupId = function () {
return this.groupId;
};
OriginalColumnGroup.prototype.getId = function () {
return this.getGroupId();
};
OriginalColumnGroup.prototype.setChildren = function (children) {
this.children = children;
};
OriginalColumnGroup.prototype.getChildren = function () {
return this.children;
};
OriginalColumnGroup.prototype.getColGroupDef = function () {
return this.colGroupDef;
};
OriginalColumnGroup.prototype.getLeafColumns = function () {
var result = [];
this.addLeafColumns(result);
return result;
};
OriginalColumnGroup.prototype.addLeafColumns = function (leafColumns) {
if (!this.children) {
return;
}
this.children.forEach(function (child) {
if (child instanceof column_1.Column) {
leafColumns.push(child);
}
else if (child instanceof OriginalColumnGroup) {
child.addLeafColumns(leafColumns);
}
});
};
OriginalColumnGroup.prototype.getColumnGroupShow = function () {
return this.padding ? columnGroup_1.ColumnGroup.HEADER_GROUP_PADDING : this.colGroupDef.columnGroupShow;
};
// need to check that this group has at least one col showing when both expanded and contracted.
// if not, then we don't allow expanding and contracting on this group
OriginalColumnGroup.prototype.setupExpandable = function () {
var _this = this;
this.setExpandable();
// note - we should be removing this event listener
this.getLeafColumns().forEach(function (col) { return col.addEventListener(column_1.Column.EVENT_VISIBLE_CHANGED, _this.onColumnVisibilityChanged.bind(_this)); });
};
OriginalColumnGroup.prototype.setExpandable = function () {
if (this.isPadding()) {
return;
}
// want to make sure the group doesn't disappear when it's open
var atLeastOneShowingWhenOpen = false;
// want to make sure the group doesn't disappear when it's closed
var atLeastOneShowingWhenClosed = false;
// want to make sure the group has something to show / hide
var atLeastOneChangeable = false;
var children = this.findChildren();
for (var i = 0, j = children.length; i < j; i++) {
var abstractColumn = children[i];
if (!abstractColumn.isVisible()) {
continue;
}
// if the abstractColumn is a grid generated group, there will be no colDef
var headerGroupShow = abstractColumn.getColumnGroupShow();
if (headerGroupShow === columnGroup_1.ColumnGroup.HEADER_GROUP_SHOW_OPEN) {
atLeastOneShowingWhenOpen = true;
atLeastOneChangeable = true;
}
else if (headerGroupShow === columnGroup_1.ColumnGroup.HEADER_GROUP_SHOW_CLOSED) {
atLeastOneShowingWhenClosed = true;
atLeastOneChangeable = true;
}
else {
atLeastOneShowingWhenOpen = true;
atLeastOneShowingWhenClosed = true;
if (headerGroupShow === columnGroup_1.ColumnGroup.HEADER_GROUP_PADDING) {
var column = abstractColumn;
atLeastOneChangeable = column.children.some(function (child) { return child.getColumnGroupShow() !== undefined; });
}
}
}
var expandable = atLeastOneShowingWhenOpen && atLeastOneShowingWhenClosed && atLeastOneChangeable;
if (this.expandable !== expandable) {
this.expandable = expandable;
var event_1 = {
type: OriginalColumnGroup.EVENT_EXPANDABLE_CHANGED
};
this.localEventService.dispatchEvent(event_1);
}
};
OriginalColumnGroup.prototype.findChildren = function () {
var children = this.children;
var firstChild = children[0];
if (firstChild && (!firstChild.isPadding || !firstChild.isPadding())) {
return children;
}
while (children.length === 1 && children[0] instanceof OriginalColumnGroup) {
children = children[0].children;
}
return children;
};
OriginalColumnGroup.prototype.onColumnVisibilityChanged = function () {
this.setExpandable();
};
OriginalColumnGroup.prototype.addEventListener = function (eventType, listener) {
this.localEventService.addEventListener(eventType, listener);
};
OriginalColumnGroup.prototype.removeEventListener = function (eventType, listener) {
this.localEventService.removeEventListener(eventType, listener);
};
OriginalColumnGroup.EVENT_EXPANDED_CHANGED = 'expandedChanged';
OriginalColumnGroup.EVENT_EXPANDABLE_CHANGED = 'expandableChanged';
return OriginalColumnGroup;
}());
exports.OriginalColumnGroup = OriginalColumnGroup;
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var columnController_1 = __webpack_require__(21);
var context_1 = __webpack_require__(13);
var ColumnApi = /** @class */ (function () {
function ColumnApi() {
}
ColumnApi.prototype.sizeColumnsToFit = function (gridWidth) { this.columnController.sizeColumnsToFit(gridWidth, 'api'); };
ColumnApi.prototype.setColumnGroupOpened = function (group, newValue) { this.columnController.setColumnGroupOpened(group, newValue, 'api'); };
ColumnApi.prototype.getColumnGroup = function (name, instanceId) { return this.columnController.getColumnGroup(name, instanceId); };
ColumnApi.prototype.getOriginalColumnGroup = function (name) { return this.columnController.getOriginalColumnGroup(name); };
ColumnApi.prototype.getDisplayNameForColumn = function (column, location) { return this.columnController.getDisplayNameForColumn(column, location); };
ColumnApi.prototype.getDisplayNameForColumnGroup = function (columnGroup, location) { return this.columnController.getDisplayNameForColumnGroup(columnGroup, location); };
ColumnApi.prototype.getColumn = function (key) { return this.columnController.getPrimaryColumn(key); };
ColumnApi.prototype.setColumnState = function (columnState) { return this.columnController.setColumnState(columnState, false, 'api'); };
ColumnApi.prototype.getColumnState = function () { return this.columnController.getColumnState(); };
ColumnApi.prototype.resetColumnState = function () { this.columnController.resetColumnState(false, 'api'); };
ColumnApi.prototype.getColumnGroupState = function () { return this.columnController.getColumnGroupState(); };
ColumnApi.prototype.setColumnGroupState = function (stateItems) { this.columnController.setColumnGroupState(stateItems, 'api'); };
ColumnApi.prototype.resetColumnGroupState = function () { this.columnController.resetColumnGroupState('api'); };
ColumnApi.prototype.isPinning = function () { return this.columnController.isPinningLeft() || this.columnController.isPinningRight(); };
ColumnApi.prototype.isPinningLeft = function () { return this.columnController.isPinningLeft(); };
ColumnApi.prototype.isPinningRight = function () { return this.columnController.isPinningRight(); };
ColumnApi.prototype.getDisplayedColAfter = function (col) { return this.columnController.getDisplayedColAfter(col); };
ColumnApi.prototype.getDisplayedColBefore = function (col) { return this.columnController.getDisplayedColBefore(col); };
ColumnApi.prototype.setColumnVisible = function (key, visible) { this.columnController.setColumnVisible(key, visible, 'api'); };
ColumnApi.prototype.setColumnsVisible = function (keys, visible) { this.columnController.setColumnsVisible(keys, visible, 'api'); };
ColumnApi.prototype.setColumnPinned = function (key, pinned) { this.columnController.setColumnPinned(key, pinned, 'api'); };
ColumnApi.prototype.setColumnsPinned = function (keys, pinned) { this.columnController.setColumnsPinned(keys, pinned, 'api'); };
ColumnApi.prototype.getAllColumns = function () { return this.columnController.getAllPrimaryColumns(); };
ColumnApi.prototype.getAllGridColumns = function () { return this.columnController.getAllGridColumns(); };
ColumnApi.prototype.getDisplayedLeftColumns = function () { return this.columnController.getDisplayedLeftColumns(); };
ColumnApi.prototype.getDisplayedCenterColumns = function () { return this.columnController.getDisplayedCenterColumns(); };
ColumnApi.prototype.getDisplayedRightColumns = function () { return this.columnController.getDisplayedRightColumns(); };
ColumnApi.prototype.getAllDisplayedColumns = function () { return this.columnController.getAllDisplayedColumns(); };
ColumnApi.prototype.getAllDisplayedVirtualColumns = function () { return this.columnController.getAllDisplayedVirtualColumns(); };
ColumnApi.prototype.moveColumn = function (key, toIndex) {
if (typeof key === 'number') {
// moveColumn used to take indexes, so this is advising user who hasn't moved to new method name
console.warn('ag-Grid: you are using moveColumn(fromIndex, toIndex) - moveColumn takes a column key and a destination index, not two indexes, to move with indexes use moveColumnByIndex(from,to) instead');
this.columnController.moveColumnByIndex(key, toIndex, 'api');
}
else {
this.columnController.moveColumn(key, toIndex, 'api');
}
};
ColumnApi.prototype.moveColumnByIndex = function (fromIndex, toIndex) { this.columnController.moveColumnByIndex(fromIndex, toIndex, 'api'); };
ColumnApi.prototype.moveColumns = function (columnsToMoveKeys, toIndex) { this.columnController.moveColumns(columnsToMoveKeys, toIndex, 'api'); };
ColumnApi.prototype.moveRowGroupColumn = function (fromIndex, toIndex) { this.columnController.moveRowGroupColumn(fromIndex, toIndex); };
ColumnApi.prototype.setColumnAggFunc = function (column, aggFunc) { this.columnController.setColumnAggFunc(column, aggFunc); };
ColumnApi.prototype.setColumnWidth = function (key, newWidth, finished) {
if (finished === void 0) { finished = true; }
this.columnController.setColumnWidth(key, newWidth, false, finished);
};
ColumnApi.prototype.setPivotMode = function (pivotMode) { this.columnController.setPivotMode(pivotMode); };
ColumnApi.prototype.isPivotMode = function () { return this.columnController.isPivotMode(); };
ColumnApi.prototype.getSecondaryPivotColumn = function (pivotKeys, valueColKey) { return this.columnController.getSecondaryPivotColumn(pivotKeys, valueColKey); };
ColumnApi.prototype.setValueColumns = function (colKeys) { this.columnController.setValueColumns(colKeys, 'api'); };
ColumnApi.prototype.getValueColumns = function () { return this.columnController.getValueColumns(); };
ColumnApi.prototype.removeValueColumn = function (colKey) { this.columnController.removeValueColumn(colKey, 'api'); };
ColumnApi.prototype.removeValueColumns = function (colKeys) { this.columnController.removeValueColumns(colKeys, 'api'); };
ColumnApi.prototype.addValueColumn = function (colKey) { this.columnController.addValueColumn(colKey, 'api'); };
ColumnApi.prototype.addValueColumns = function (colKeys) { this.columnController.addValueColumns(colKeys, 'api'); };
ColumnApi.prototype.setRowGroupColumns = function (colKeys) { this.columnController.setRowGroupColumns(colKeys, 'api'); };
ColumnApi.prototype.removeRowGroupColumn = function (colKey) { this.columnController.removeRowGroupColumn(colKey, 'api'); };
ColumnApi.prototype.removeRowGroupColumns = function (colKeys) { this.columnController.removeRowGroupColumns(colKeys, 'api'); };
ColumnApi.prototype.addRowGroupColumn = function (colKey) { this.columnController.addRowGroupColumn(colKey, 'api'); };
ColumnApi.prototype.addRowGroupColumns = function (colKeys) { this.columnController.addRowGroupColumns(colKeys, 'api'); };
ColumnApi.prototype.getRowGroupColumns = function () { return this.columnController.getRowGroupColumns(); };
ColumnApi.prototype.setPivotColumns = function (colKeys) { this.columnController.setPivotColumns(colKeys, 'api'); };
ColumnApi.prototype.removePivotColumn = function (colKey) { this.columnController.removePivotColumn(colKey, 'api'); };
ColumnApi.prototype.removePivotColumns = function (colKeys) { this.columnController.removePivotColumns(colKeys, 'api'); };
ColumnApi.prototype.addPivotColumn = function (colKey) { this.columnController.addPivotColumn(colKey, 'api'); };
ColumnApi.prototype.addPivotColumns = function (colKeys) { this.columnController.addPivotColumns(colKeys, 'api'); };
ColumnApi.prototype.getPivotColumns = function () { return this.columnController.getPivotColumns(); };
ColumnApi.prototype.getLeftDisplayedColumnGroups = function () { return this.columnController.getLeftDisplayedColumnGroups(); };
ColumnApi.prototype.getCenterDisplayedColumnGroups = function () { return this.columnController.getCenterDisplayedColumnGroups(); };
ColumnApi.prototype.getRightDisplayedColumnGroups = function () { return this.columnController.getRightDisplayedColumnGroups(); };
ColumnApi.prototype.getAllDisplayedColumnGroups = function () { return this.columnController.getAllDisplayedColumnGroups(); };
ColumnApi.prototype.autoSizeColumn = function (key) { return this.columnController.autoSizeColumn(key, 'api'); };
ColumnApi.prototype.autoSizeColumns = function (keys) { return this.columnController.autoSizeColumns(keys, 'api'); };
ColumnApi.prototype.autoSizeAllColumns = function () { this.columnController.autoSizeAllColumns('api'); };
ColumnApi.prototype.setSecondaryColumns = function (colDefs) { this.columnController.setSecondaryColumns(colDefs, 'api'); };
ColumnApi.prototype.getSecondaryColumns = function () { return this.columnController.getSecondaryColumns(); };
ColumnApi.prototype.getPrimaryColumns = function () { return this.columnController.getAllPrimaryColumns(); };
// below goes through deprecated items, prints message to user, then calls the new version of the same method
ColumnApi.prototype.columnGroupOpened = function (group, newValue) {
console.error('ag-Grid: columnGroupOpened no longer exists, use setColumnGroupOpened');
this.setColumnGroupOpened(group, newValue);
};
ColumnApi.prototype.hideColumns = function (colIds, hide) {
console.error('ag-Grid: hideColumns is deprecated, use setColumnsVisible');
this.columnController.setColumnsVisible(colIds, !hide, 'api');
};
ColumnApi.prototype.hideColumn = function (colId, hide) {
console.error('ag-Grid: hideColumn is deprecated, use setColumnVisible');
this.columnController.setColumnVisible(colId, !hide, 'api');
};
ColumnApi.prototype.setState = function (columnState) {
console.error('ag-Grid: setState is deprecated, use setColumnState');
return this.setColumnState(columnState);
};
ColumnApi.prototype.getState = function () {
console.error('ag-Grid: getState is deprecated, use getColumnState');
return this.getColumnState();
};
ColumnApi.prototype.resetState = function () {
console.error('ag-Grid: resetState is deprecated, use resetColumnState');
this.resetColumnState();
};
ColumnApi.prototype.getAggregationColumns = function () {
console.error('ag-Grid: getAggregationColumns is deprecated, use getValueColumns');
return this.columnController.getValueColumns();
};
ColumnApi.prototype.removeAggregationColumn = function (colKey) {
console.error('ag-Grid: removeAggregationColumn is deprecated, use removeValueColumn');
this.columnController.removeValueColumn(colKey, 'api');
};
ColumnApi.prototype.removeAggregationColumns = function (colKeys) {
console.error('ag-Grid: removeAggregationColumns is deprecated, use removeValueColumns');
this.columnController.removeValueColumns(colKeys, 'api');
};
ColumnApi.prototype.addAggregationColumn = function (colKey) {
console.error('ag-Grid: addAggregationColumn is deprecated, use addValueColumn');
this.columnController.addValueColumn(colKey, 'api');
};
ColumnApi.prototype.addAggregationColumns = function (colKeys) {
console.error('ag-Grid: addAggregationColumns is deprecated, use addValueColumns');
this.columnController.addValueColumns(colKeys, 'api');
};
ColumnApi.prototype.setColumnAggFunction = function (column, aggFunc) {
console.error('ag-Grid: setColumnAggFunction is deprecated, use setColumnAggFunc');
this.columnController.setColumnAggFunc(column, aggFunc, 'api');
};
ColumnApi.prototype.getDisplayNameForCol = function (column) {
console.error('ag-Grid: getDisplayNameForCol is deprecated, use getDisplayNameForColumn');
return this.getDisplayNameForColumn(column, null);
};
__decorate([
context_1.Autowired('columnController'),
__metadata("design:type", columnController_1.ColumnController)
], ColumnApi.prototype, "columnController", void 0);
ColumnApi = __decorate([
context_1.Bean('columnApi')
], ColumnApi);
return ColumnApi;
}());
exports.ColumnApi = ColumnApi;
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
var logger_1 = __webpack_require__(12);
var context_1 = __webpack_require__(13);
var context_2 = __webpack_require__(13);
var ExpressionService = /** @class */ (function () {
function ExpressionService() {
this.expressionToFunctionCache = {};
}
ExpressionService.prototype.setBeans = function (loggerFactory) {
this.logger = loggerFactory.create('ExpressionService');
};
ExpressionService.prototype.evaluate = function (expressionOrFunc, params) {
if (typeof expressionOrFunc === 'function') {
// valueGetter is a function, so just call it
var func = expressionOrFunc;
return func(params);
}
else if (typeof expressionOrFunc === 'string') {
// valueGetter is an expression, so execute the expression
var expression = expressionOrFunc;
return this.evaluateExpression(expression, params);
}
else {
console.error('ag-Grid: value should be either a string or a function', expressionOrFunc);
}
};
ExpressionService.prototype.evaluateExpression = function (expression, params) {
try {
var javaScriptFunction = this.createExpressionFunction(expression);
// the params don't have all these values, rather we add every possible
// value a params can have, which makes whatever is in the params available.
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);
return result;
}
catch (e) {
// the expression failed, which can happen, as it's the client that
// provides the expression. so print a nice message
// tslint:disable-next-line
console.log('Processing of the expression failed');
// tslint:disable-next-line
console.log('Expression = ' + expression);
// tslint:disable-next-line
console.log('Exception = ' + e);
return null;
}
};
ExpressionService.prototype.createExpressionFunction = function (expression) {
// check cache first
if (this.expressionToFunctionCache[expression]) {
return this.expressionToFunctionCache[expression];
}
// if not found in cache, return the function
var functionBody = this.createFunctionBody(expression);
var theFunction = new Function('x, ctx, oldValue, newValue, value, node, data, colDef, rowIndex, api, columnApi, getValue, column, columnGroup', functionBody);
// store in cache
this.expressionToFunctionCache[expression] = theFunction;
return theFunction;
};
ExpressionService.prototype.createFunctionBody = function (expression) {
// if the expression has the 'return' word in it, then use as is,
// if not, then wrap it with return and ';' to make a function
if (expression.indexOf('return') >= 0) {
return expression;
}
else {
return 'return ' + expression + ';';
}
};
__decorate([
__param(0, context_2.Qualifier('loggerFactory')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [logger_1.LoggerFactory]),
__metadata("design:returntype", void 0)
], ExpressionService.prototype, "setBeans", null);
ExpressionService = __decorate([
context_1.Bean('expressionService')
], ExpressionService);
return ExpressionService;
}());
exports.ExpressionService = ExpressionService;
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var context_1 = __webpack_require__(13);
var columnUtils_1 = __webpack_require__(24);
var columnGroup_1 = __webpack_require__(22);
var originalColumnGroup_1 = __webpack_require__(25);
var context_2 = __webpack_require__(13);
var utils_1 = __webpack_require__(5);
// takes in a list of columns, as specified by the column definitions, and returns column groups
var DisplayedGroupCreator = /** @class */ (function () {
function DisplayedGroupCreator() {
}
DisplayedGroupCreator.prototype.createDisplayedGroups = function (
// all displayed columns sorted - this is the columns the grid should show
sortedVisibleColumns,
// the tree of columns, as provided by the users, used to know what groups columns roll up into
balancedColumnTree,
// creates unique id's for the group
groupInstanceIdCreator,
// whether it's left, right or center col
pinned,
// we try to reuse old groups if we can, to allow gui to do animation
oldDisplayedGroups) {
var _this = this;
var result = [];
var previousRealPath;
var previousOriginalPath;
var oldColumnsMapped = this.mapOldGroupsById(oldDisplayedGroups);
// go through each column, then do a bottom up comparison to the previous column, and start
// to share groups if they converge at any point.
sortedVisibleColumns.forEach(function (currentColumn) {
var currentOriginalPath = _this.getOriginalPathForColumn(balancedColumnTree, currentColumn);
var currentRealPath = [];
var firstColumn = !previousOriginalPath;
for (var i = 0; i < currentOriginalPath.length; i++) {
if (firstColumn || currentOriginalPath[i] !== previousOriginalPath[i]) {
// new group needed
var newGroup = _this.createColumnGroup(currentOriginalPath[i], groupInstanceIdCreator, oldColumnsMapped, pinned);
currentRealPath[i] = newGroup;
// if top level, add to result, otherwise add to parent
if (i == 0) {
result.push(newGroup);
}
else {
currentRealPath[i - 1].addChild(newGroup);
}
}
else {
// reuse old group
currentRealPath[i] = previousRealPath[i];
}
}
var noColumnGroups = currentRealPath.length === 0;
if (noColumnGroups) {
// if we are not grouping, then the result of the above is an empty
// path (no groups), and we just add the column to the root list.
result.push(currentColumn);
}
else {
var leafGroup = utils_1._.last(currentRealPath);
leafGroup.addChild(currentColumn);
}
previousRealPath = currentRealPath;
previousOriginalPath = currentOriginalPath;
});
this.setupParentsIntoColumns(result, null);
return result;
};
DisplayedGroupCreator.prototype.createColumnGroup = function (originalGroup, groupInstanceIdCreator, oldColumnsMapped, pinned) {
var groupId = originalGroup.getGroupId();
var instanceId = groupInstanceIdCreator.getInstanceIdForKey(groupId);
var uniqueId = columnGroup_1.ColumnGroup.createUniqueId(groupId, instanceId);
var columnGroup = oldColumnsMapped[uniqueId];
// if the user is setting new colDefs, it is possible that the id's overlap, and we
// would have a false match from above. so we double check we are talking about the
// same original column group.
if (columnGroup && columnGroup.getOriginalColumnGroup() !== originalGroup) {
columnGroup = null;
}
if (utils_1._.exists(columnGroup)) {
// clean out the old column group here, as we will be adding children into it again
columnGroup.reset();
}
else {
columnGroup = new columnGroup_1.ColumnGroup(originalGroup, groupId, instanceId, pinned);
this.context.wireBean(columnGroup);
}
return columnGroup;
};
// returns back a 2d map of ColumnGroup as follows: groupId -> instanceId -> ColumnGroup
DisplayedGroupCreator.prototype.mapOldGroupsById = function (displayedGroups) {
var result = {};
var recursive = function (columnsOrGroups) {
columnsOrGroups.forEach(function (columnOrGroup) {
if (columnOrGroup instanceof columnGroup_1.ColumnGroup) {
var columnGroup = columnOrGroup;
result[columnOrGroup.getUniqueId()] = columnGroup;
recursive(columnGroup.getChildren());
}
});
};
if (displayedGroups) {
recursive(displayedGroups);
}
return result;
};
DisplayedGroupCreator.prototype.setupParentsIntoColumns = function (columnsOrGroups, parent) {
var _this = this;
columnsOrGroups.forEach(function (columnsOrGroup) {
columnsOrGroup.setParent(parent);
if (columnsOrGroup instanceof columnGroup_1.ColumnGroup) {
var columnGroup = columnsOrGroup;
_this.setupParentsIntoColumns(columnGroup.getChildren(), columnGroup);
}
});
};
// private createFakePath(balancedColumnTree: OriginalColumnGroupChild[], column: Column): OriginalColumnGroup[] {
// let fakePath: OriginalColumnGroup[] = [];
// let currentChildren = balancedColumnTree;
// // this while loop does search on the balanced tree, so our result is the right length
// let index = 0;
// while (currentChildren && currentChildren[0] && currentChildren[0] instanceof OriginalColumnGroup) {
// // putting in a deterministic fake id, in case the API in the future needs to reference the col
// let fakeGroup = new OriginalColumnGroup(null, 'FAKE_PATH_' + index, true);
// this.context.wireBean(fakeGroup);
//
// // fakePath.setChildren(children);
//
// fakePath.push(fakeGroup);
// currentChildren = (currentChildren[0]).getChildren();
// index++;
// }
//
// fakePath.forEach( (fakePathGroup: OriginalColumnGroup, i: number) => {
// let lastItemInList = i === fakePath.length-1;
// let child = lastItemInList ? column : fakePath[i+1];
// fakePathGroup.setChildren([child]);
// });
//
// return fakePath;
// }
DisplayedGroupCreator.prototype.getOriginalPathForColumn = function (balancedColumnTree, column) {
var result = [];
var found = false;
recursePath(balancedColumnTree, 0);
// it's possible we didn't find a path. this happens if the column is generated
// by the grid (auto-group), in that the definition didn't come from the client. in this case,
// we create a fake original path.
if (found) {
return result;
}
else {
console.warn('could not get path');
return null;
// return this.createFakePath(balancedColumnTree, column);
}
function recursePath(balancedColumnTree, dept) {
for (var i = 0; i < balancedColumnTree.length; i++) {
if (found) {
// quit the search, so 'result' is kept with the found result
return;
}
var node = balancedColumnTree[i];
if (node instanceof originalColumnGroup_1.OriginalColumnGroup) {
var nextNode = node;
recursePath(nextNode.getChildren(), dept + 1);
result[dept] = node;
}
else {
if (node === column) {
found = true;
}
}
}
}
};
__decorate([
context_1.Autowired('columnUtils'),
__metadata("design:type", columnUtils_1.ColumnUtils)
], DisplayedGroupCreator.prototype, "columnUtils", void 0);
__decorate([
context_1.Autowired('context'),
__metadata("design:type", context_2.Context)
], DisplayedGroupCreator.prototype, "context", void 0);
DisplayedGroupCreator = __decorate([
context_2.Bean('displayedGroupCreator')
], DisplayedGroupCreator);
return DisplayedGroupCreator;
}());
exports.DisplayedGroupCreator = DisplayedGroupCreator;
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var rowRenderer_1 = __webpack_require__(30);
var context_1 = __webpack_require__(13);
var gridOptionsWrapper_1 = __webpack_require__(4);
var headerWrapperComp_1 = __webpack_require__(104);
var AutoWidthCalculator = /** @class */ (function () {
function AutoWidthCalculator() {
}
AutoWidthCalculator.prototype.registerGridComp = function (gridPanel) {
this.gridPanel = gridPanel;
};
AutoWidthCalculator.prototype.registerHeaderRootComp = function (headerRootComp) {
this.headerRootComp = headerRootComp;
};
// this is the trick: we create a dummy container and clone all the cells
// into the dummy, then check the dummy's width. then destroy the dummy
// as we don't need it any more.
// drawback: only the cells visible on the screen are considered
AutoWidthCalculator.prototype.getPreferredWidthForColumn = function (column) {
var eHeaderCell = this.getHeaderCellForColumn(column);
// cell isn't visible
if (!eHeaderCell) {
return -1;
}
var eDummyContainer = document.createElement('span');
// position fixed, so it isn't restricted to the boundaries of the parent
eDummyContainer.style.position = 'fixed';
// we put the dummy into the body container, so it will inherit all the
// css styles that the real cells are inheriting
var eBodyContainer = this.gridPanel.getCenterContainer();
eBodyContainer.appendChild(eDummyContainer);
// get all the cells that are currently displayed (this only brings back
// rendered cells, rows not rendered due to row visualisation will not be here)
this.putRowCellsIntoDummyContainer(column, eDummyContainer);
// also put header cell in
// we only consider the lowest level cell, not the group cell. in 99% of the time, this
// will be enough. if we consider groups, then it gets to complicated for what it's worth,
// as the groups can span columns and this class only considers one column at a time.
this.cloneItemIntoDummy(eHeaderCell, eDummyContainer);
// at this point, all the clones are lined up vertically with natural widths. the dummy
// container will have a width wide enough just to fit the largest.
var dummyContainerWidth = eDummyContainer.offsetWidth;
// we are finished with the dummy container, so get rid of it
eBodyContainer.removeChild(eDummyContainer);
// we add padding as I found sometimes the gui still put '...' after some of the texts. so the
// user can configure the grid to add a few more pixels after the calculated width
var autoSizePadding = this.gridOptionsWrapper.getAutoSizePadding();
return dummyContainerWidth + autoSizePadding;
};
AutoWidthCalculator.prototype.getHeaderCellForColumn = function (column) {
var comp = null;
// find the rendered header cell
this.headerRootComp.forEachHeaderElement(function (headerElement) {
if (headerElement instanceof headerWrapperComp_1.HeaderWrapperComp) {
var headerWrapperComp = headerElement;
if (headerWrapperComp.getColumn() === column) {
comp = headerWrapperComp;
}
}
});
return comp ? comp.getGui() : null;
};
AutoWidthCalculator.prototype.putRowCellsIntoDummyContainer = function (column, eDummyContainer) {
var _this = this;
var eCells = this.rowRenderer.getAllCellsForColumn(column);
eCells.forEach(function (eCell) { return _this.cloneItemIntoDummy(eCell, eDummyContainer); });
};
AutoWidthCalculator.prototype.cloneItemIntoDummy = function (eCell, eDummyContainer) {
// make a deep clone of the cell
var eCellClone = eCell.cloneNode(true);
// the original has a fixed width, we remove this to allow the natural width based on content
eCellClone.style.width = '';
// the original has position = absolute, we need to remove this so it's positioned normally
eCellClone.style.position = 'static';
eCellClone.style.left = '';
// we put the cell into a containing div, as otherwise the cells would just line up
// on the same line, standard flow layout, by putting them into divs, they are laid
// out one per line
var eCloneParent = document.createElement('div');
// table-row, so that each cell is on a row. i also tried display='block', but this
// didn't work in IE
eCloneParent.style.display = 'table-row';
// the twig on the branch, the branch on the tree, the tree in the hole,
// the hole in the bog, the bog in the clone, the clone in the parent,
// the parent in the dummy, and the dummy down in the vall-e-ooo, OOOOOOOOO! Oh row the rattling bog....
eCloneParent.appendChild(eCellClone);
eDummyContainer.appendChild(eCloneParent);
};
__decorate([
context_1.Autowired('rowRenderer'),
__metadata("design:type", rowRenderer_1.RowRenderer)
], AutoWidthCalculator.prototype, "rowRenderer", void 0);
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], AutoWidthCalculator.prototype, "gridOptionsWrapper", void 0);
AutoWidthCalculator = __decorate([
context_1.Bean('autoWidthCalculator')
], AutoWidthCalculator);
return AutoWidthCalculator;
}());
exports.AutoWidthCalculator = AutoWidthCalculator;
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
var gridOptionsWrapper_1 = __webpack_require__(4);
var eventService_1 = __webpack_require__(11);
var rowComp_1 = __webpack_require__(31);
var column_1 = __webpack_require__(23);
var events_1 = __webpack_require__(15);
var constants_1 = __webpack_require__(8);
var cellComp_1 = __webpack_require__(32);
var context_1 = __webpack_require__(13);
var columnApi_1 = __webpack_require__(26);
var columnController_1 = __webpack_require__(21);
var logger_1 = __webpack_require__(12);
var focusedCellController_1 = __webpack_require__(49);
var cellNavigationService_1 = __webpack_require__(50);
var beanStub_1 = __webpack_require__(34);
var paginationProxy_1 = __webpack_require__(52);
var gridApi_1 = __webpack_require__(18);
var pinnedRowModel_1 = __webpack_require__(51);
var beans_1 = __webpack_require__(53);
var animationFrameService_1 = __webpack_require__(98);
var maxDivHeightScaler_1 = __webpack_require__(99);
var utils_1 = __webpack_require__(5);
var rowPosition_1 = __webpack_require__(103);
var RowRenderer = /** @class */ (function (_super) {
__extends(RowRenderer, _super);
function RowRenderer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.destroyFuncsForColumnListeners = [];
// map of row ids to row objects. keeps track of which elements
// are rendered for which rows in the dom.
_this.rowCompsByIndex = {};
_this.floatingTopRowComps = [];
_this.floatingBottomRowComps = [];
// we only allow one refresh at a time, otherwise the internal memory structure here
// will get messed up. this can happen if the user has a cellRenderer, and inside the
// renderer they call an API method that results in another pass of the refresh,
// then it will be trying to draw rows in the middle of a refresh.
_this.refreshInProgress = false;
return _this;
}
RowRenderer.prototype.registerGridCore = function (gridCore) {
this.gridCore = gridCore;
};
RowRenderer.prototype.getGridCore = function () {
return this.gridCore;
};
RowRenderer.prototype.agWire = function (loggerFactory) {
this.logger = loggerFactory.create("RowRenderer");
};
RowRenderer.prototype.registerGridComp = function (gridPanel) {
this.gridPanel = gridPanel;
this.rowContainers = this.gridPanel.getRowContainers();
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_PAGINATION_CHANGED, this.onPageLoaded.bind(this));
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_PINNED_ROW_DATA_CHANGED, this.onPinnedRowDataChanged.bind(this));
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_BODY_SCROLL, this.redrawAfterScroll.bind(this));
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_BODY_HEIGHT_CHANGED, this.redrawAfterScroll.bind(this));
this.addDestroyableEventListener(this.gridOptionsWrapper, gridOptionsWrapper_1.GridOptionsWrapper.PROP_DOM_LAYOUT, this.onDomLayoutChanged.bind(this));
this.registerCellEventListeners();
this.printLayout = this.gridOptionsWrapper.getDomLayout() === constants_1.Constants.DOM_LAYOUT_PRINT;
this.embedFullWidthRows = this.printLayout || this.gridOptionsWrapper.isEmbedFullWidthRows();
this.redrawAfterModelUpdate();
};
// in a clean design, each cell would register for each of these events. however when scrolling, all the cells
// registering and de-registering for events is a performance bottleneck. so we register here once and inform
// all active cells.
RowRenderer.prototype.registerCellEventListeners = function () {
var _this = this;
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_CELL_FOCUSED, function (event) {
_this.forEachCellComp(function (cellComp) { return cellComp.onCellFocused(event); });
});
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_FLASH_CELLS, function (event) {
_this.forEachCellComp(function (cellComp) { return cellComp.onFlashCells(event); });
});
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_COLUMN_HOVER_CHANGED, function () {
_this.forEachCellComp(function (cellComp) { return cellComp.onColumnHover(); });
});
// only for printLayout - because we are rendering all the cells in the same row, regardless of pinned state,
// then changing the width of the containers will impact left position. eg the center cols all have their
// left position adjusted by the width of the left pinned column, so if the pinned left column width changes,
// all the center cols need to be shifted to accommodate this. when in normal layout, the pinned cols are
// in different containers so doesn't impact.
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, function () {
if (_this.printLayout) {
_this.forEachCellComp(function (cellComp) { return cellComp.onLeftChanged(); });
}
});
var rangeSelectionEnabled = this.gridOptionsWrapper.isEnableRangeSelection();
if (rangeSelectionEnabled) {
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_RANGE_SELECTION_CHANGED, function () {
_this.forEachCellComp(function (cellComp) { return cellComp.onRangeSelectionChanged(); });
});
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_COLUMN_MOVED, function () {
_this.forEachCellComp(function (cellComp) { return cellComp.updateRangeBordersIfRangeCount(); });
});
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_COLUMN_PINNED, function () {
_this.forEachCellComp(function (cellComp) { return cellComp.updateRangeBordersIfRangeCount(); });
});
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_COLUMN_VISIBLE, function () {
_this.forEachCellComp(function (cellComp) { return cellComp.updateRangeBordersIfRangeCount(); });
});
}
// add listeners to the grid columns
this.refreshListenersToColumnsForCellComps();
// if the grid columns change, then refresh the listeners again
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_GRID_COLUMNS_CHANGED, this.refreshListenersToColumnsForCellComps.bind(this));
this.addDestroyFunc(this.removeGridColumnListeners.bind(this));
};
// executes all functions in destroyFuncsForColumnListeners and then clears the list
RowRenderer.prototype.removeGridColumnListeners = function () {
this.destroyFuncsForColumnListeners.forEach(function (func) { return func(); });
this.destroyFuncsForColumnListeners.length = 0;
};
// this function adds listeners onto all the grid columns, which are the column that we could have cellComps for.
// when the grid columns change, we add listeners again. in an ideal design, each CellComp would just register to
// the column it belongs to on creation, however this was a bottleneck with the number of cells, so do it here
// once instead.
RowRenderer.prototype.refreshListenersToColumnsForCellComps = function () {
var _this = this;
this.removeGridColumnListeners();
var cols = this.columnController.getAllGridColumns();
if (!cols) {
return;
}
cols.forEach(function (col) {
var forEachCellWithThisCol = function (callback) {
_this.forEachCellComp(function (cellComp) {
if (cellComp.getColumn() === col) {
callback(cellComp);
}
});
};
var leftChangedListener = function () {
forEachCellWithThisCol(function (cellComp) { return cellComp.onLeftChanged(); });
};
var widthChangedListener = function () {
forEachCellWithThisCol(function (cellComp) { return cellComp.onWidthChanged(); });
};
var firstRightPinnedChangedListener = function () {
forEachCellWithThisCol(function (cellComp) { return cellComp.onFirstRightPinnedChanged(); });
};
var lastLeftPinnedChangedListener = function () {
forEachCellWithThisCol(function (cellComp) { return cellComp.onLastLeftPinnedChanged(); });
};
col.addEventListener(column_1.Column.EVENT_LEFT_CHANGED, leftChangedListener);
col.addEventListener(column_1.Column.EVENT_WIDTH_CHANGED, widthChangedListener);
col.addEventListener(column_1.Column.EVENT_FIRST_RIGHT_PINNED_CHANGED, firstRightPinnedChangedListener);
col.addEventListener(column_1.Column.EVENT_LAST_LEFT_PINNED_CHANGED, lastLeftPinnedChangedListener);
_this.destroyFuncsForColumnListeners.push(function () {
col.removeEventListener(column_1.Column.EVENT_LEFT_CHANGED, leftChangedListener);
col.removeEventListener(column_1.Column.EVENT_WIDTH_CHANGED, widthChangedListener);
col.removeEventListener(column_1.Column.EVENT_FIRST_RIGHT_PINNED_CHANGED, firstRightPinnedChangedListener);
col.removeEventListener(column_1.Column.EVENT_LAST_LEFT_PINNED_CHANGED, lastLeftPinnedChangedListener);
});
});
};
RowRenderer.prototype.onDomLayoutChanged = function () {
var printLayout = this.gridOptionsWrapper.getDomLayout() === constants_1.Constants.DOM_LAYOUT_PRINT;
var embedFullWidthRows = printLayout || this.gridOptionsWrapper.isEmbedFullWidthRows();
// if moving towards or away from print layout, means we need to destroy all rows, as rows are not laid
// out using absolute positioning when doing print layout
var destroyRows = embedFullWidthRows !== this.embedFullWidthRows || this.printLayout !== printLayout;
this.printLayout = printLayout;
this.embedFullWidthRows = embedFullWidthRows;
if (destroyRows) {
this.redrawAfterModelUpdate();
}
};
// for row models that have datasources, when we update the datasource, we need to force the rowRenderer
// to redraw all rows. otherwise the old rows from the old datasource will stay displayed.
RowRenderer.prototype.datasourceChanged = function () {
this.firstRenderedRow = 0;
this.lastRenderedRow = -1;
var rowIndexesToRemove = Object.keys(this.rowCompsByIndex);
this.removeRowComps(rowIndexesToRemove);
};
RowRenderer.prototype.onPageLoaded = function (refreshEvent) {
if (utils_1._.missing(refreshEvent)) {
refreshEvent = {
type: events_1.Events.EVENT_MODEL_UPDATED,
api: this.gridApi,
columnApi: this.columnApi,
animate: false,
keepRenderedRows: false,
newData: false,
newPage: false
};
}
this.onModelUpdated(refreshEvent);
};
RowRenderer.prototype.getAllCellsForColumn = function (column) {
var eCells = [];
utils_1._.iterateObject(this.rowCompsByIndex, callback);
utils_1._.iterateObject(this.floatingBottomRowComps, callback);
utils_1._.iterateObject(this.floatingTopRowComps, callback);
function callback(key, rowComp) {
var eCell = rowComp.getCellForCol(column);
if (eCell) {
eCells.push(eCell);
}
}
return eCells;
};
RowRenderer.prototype.refreshFloatingRowComps = function () {
this.refreshFloatingRows(this.floatingTopRowComps, this.pinnedRowModel.getPinnedTopRowData(), this.rowContainers.floatingTopPinnedLeft, this.rowContainers.floatingTopPinnedRight, this.rowContainers.floatingTop, this.rowContainers.floatingTopFullWidth);
this.refreshFloatingRows(this.floatingBottomRowComps, this.pinnedRowModel.getPinnedBottomRowData(), this.rowContainers.floatingBottomPinnedLeft, this.rowContainers.floatingBottomPinnedRight, this.rowContainers.floatingBottom, this.rowContainers.floatingBottomFullWith);
};
RowRenderer.prototype.refreshFloatingRows = function (rowComps, rowNodes, pinnedLeftContainerComp, pinnedRightContainerComp, bodyContainerComp, fullWidthContainerComp) {
var _this = this;
rowComps.forEach(function (row) {
row.destroy();
});
rowComps.length = 0;
if (rowNodes) {
rowNodes.forEach(function (node) {
var rowComp = new rowComp_1.RowComp(_this.$scope, bodyContainerComp, pinnedLeftContainerComp, pinnedRightContainerComp, fullWidthContainerComp, node, _this.beans, false, false, _this.printLayout, _this.embedFullWidthRows);
rowComp.init();
rowComps.push(rowComp);
});
}
this.flushContainers(rowComps);
};
RowRenderer.prototype.onPinnedRowDataChanged = function () {
// recycling rows in order to ensure cell editing is not cancelled
var params = {
recycleRows: true
};
this.redrawAfterModelUpdate(params);
};
RowRenderer.prototype.onModelUpdated = function (refreshEvent) {
var params = {
recycleRows: refreshEvent.keepRenderedRows,
animate: refreshEvent.animate,
newData: refreshEvent.newData,
newPage: refreshEvent.newPage,
// because this is a model updated event (not pinned rows), we
// can skip updating the pinned rows. this is needed so that if user
// is doing transaction updates, the pinned rows are not getting constantly
// trashed - or editing cells in pinned rows are not refreshed and put into read mode
onlyBody: true
};
this.redrawAfterModelUpdate(params);
};
// if the row nodes are not rendered, no index is returned
RowRenderer.prototype.getRenderedIndexesForRowNodes = function (rowNodes) {
var result = [];
if (utils_1._.missing(rowNodes)) {
return result;
}
utils_1._.iterateObject(this.rowCompsByIndex, function (index, renderedRow) {
var rowNode = renderedRow.getRowNode();
if (rowNodes.indexOf(rowNode) >= 0) {
result.push(index);
}
});
return result;
};
RowRenderer.prototype.redrawRows = function (rowNodes) {
if (!rowNodes || rowNodes.length == 0) {
return;
}
// we only need to be worried about rendered rows, as this method is
// called to what's rendered. if the row isn't rendered, we don't care
var indexesToRemove = this.getRenderedIndexesForRowNodes(rowNodes);
// remove the rows
this.removeRowComps(indexesToRemove);
// add draw them again
this.redrawAfterModelUpdate({
recycleRows: true
});
};
RowRenderer.prototype.getCellToRestoreFocusToAfterRefresh = function (params) {
var focusedCell = params.suppressKeepFocus ? null : this.focusedCellController.getFocusCellToUseAfterRefresh();
if (utils_1._.missing(focusedCell)) {
return null;
}
// if the dom is not actually focused on a cell, then we don't try to refocus. the problem this
// solves is with editing - if the user is editing, eg focus is on a text field, and not on the
// cell itself, then the cell can be registered as having focus, however it's the text field that
// has the focus and not the cell div. therefore, when the refresh is finished, the grid will focus
// the cell, and not the textfield. that means if the user is in a text field, and the grid refreshes,
// the focus is lost from the text field. we do not want this.
var activeElement = document.activeElement;
var domData = this.gridOptionsWrapper.getDomData(activeElement, cellComp_1.CellComp.DOM_DATA_KEY_CELL_COMP);
var elementIsNotACellDev = utils_1._.missing(domData);
if (elementIsNotACellDev) {
return null;
}
return focusedCell;
};
// gets called after changes to the model.
RowRenderer.prototype.redrawAfterModelUpdate = function (params) {
if (params === void 0) { params = {}; }
this.getLockOnRefresh();
var focusedCell = this.getCellToRestoreFocusToAfterRefresh(params);
this.sizeContainerToPageHeight();
this.scrollToTopIfNewData(params);
// never recycle rows when print layout, we draw each row again from scratch. this is because print layout
// uses normal dom layout to put cells into dom - it doesn't allow reordering rows.
var recycleRows = !this.printLayout && params.recycleRows;
var animate = params.animate && this.gridOptionsWrapper.isAnimateRows();
var rowsToRecycle = this.binRowComps(recycleRows);
this.redraw(rowsToRecycle, animate);
if (!params.onlyBody) {
this.refreshFloatingRowComps();
}
this.restoreFocusedCell(focusedCell);
this.releaseLockOnRefresh();
};
RowRenderer.prototype.scrollToTopIfNewData = function (params) {
var scrollToTop = params.newData || params.newPage;
var suppressScrollToTop = this.gridOptionsWrapper.isSuppressScrollOnNewData();
if (scrollToTop && !suppressScrollToTop) {
this.gridPanel.scrollToTop();
}
};
RowRenderer.prototype.sizeContainerToPageHeight = function () {
var containers = [
this.rowContainers.body,
this.rowContainers.fullWidth,
this.rowContainers.pinnedLeft,
this.rowContainers.pinnedRight
];
if (this.printLayout) {
containers.forEach(function (container) { return container.setHeight(null); });
return;
}
var containerHeight = this.paginationProxy.getCurrentPageHeight();
// we need at least 1 pixel for the horizontal scroll to work. so if there are now rows,
// we still want the scroll to be present, otherwise there would be no way to scroll the header
// which might be needed us user wants to access columns
// on the RHS - and if that was where the filter was that cause no rows to be presented, there
// is no way to remove the filter.
if (containerHeight === 0) {
containerHeight = 1;
}
this.maxDivHeightScaler.setModelHeight(containerHeight);
var realHeight = this.maxDivHeightScaler.getUiContainerHeight();
containers.forEach(function (container) { return container.setHeight(realHeight); });
};
RowRenderer.prototype.getLockOnRefresh = function () {
if (this.refreshInProgress) {
throw new Error("ag-Grid: cannot get grid to draw rows when it is in the middle of drawing rows. " +
"Your code probably called a grid API method while the grid was in the render stage. To overcome " +
"this, put the API call into a timeout, eg instead of api.refreshView(), " +
"call setTimeout(function(){api.refreshView(),0}). To see what part of your code " +
"that caused the refresh check this stacktrace.");
}
this.refreshInProgress = true;
};
RowRenderer.prototype.releaseLockOnRefresh = function () {
this.refreshInProgress = false;
};
// sets the focus to the provided cell, if the cell is provided. this way, the user can call refresh without
// worry about the focus been lost. this is important when the user is using keyboard navigation to do edits
// and the cellEditor is calling 'refresh' to get other cells to update (as other cells might depend on the
// edited cell).
RowRenderer.prototype.restoreFocusedCell = function (cellPosition) {
if (cellPosition) {
this.focusedCellController.setFocusedCell(cellPosition.rowIndex, cellPosition.column, cellPosition.rowPinned, true);
}
};
RowRenderer.prototype.stopEditing = function (cancel) {
if (cancel === void 0) { cancel = false; }
this.forEachRowComp(function (key, rowComp) {
rowComp.stopEditing(cancel);
});
};
RowRenderer.prototype.forEachCellComp = function (callback) {
this.forEachRowComp(function (key, rowComp) { return rowComp.forEachCellComp(callback); });
};
RowRenderer.prototype.forEachRowComp = function (callback) {
utils_1._.iterateObject(this.rowCompsByIndex, callback);
utils_1._.iterateObject(this.floatingTopRowComps, callback);
utils_1._.iterateObject(this.floatingBottomRowComps, callback);
};
RowRenderer.prototype.addRenderedRowListener = function (eventName, rowIndex, callback) {
var rowComp = this.rowCompsByIndex[rowIndex];
if (rowComp) {
rowComp.addEventListener(eventName, callback);
}
};
RowRenderer.prototype.flashCells = function (params) {
if (params === void 0) { params = {}; }
this.forEachCellCompFiltered(params.rowNodes, params.columns, function (cellComp) { return cellComp.flashCell(); });
};
RowRenderer.prototype.refreshCells = function (params) {
if (params === void 0) { params = {}; }
var refreshCellParams = {
forceRefresh: params.force,
newData: false
};
this.forEachCellCompFiltered(params.rowNodes, params.columns, function (cellComp) { return cellComp.refreshCell(refreshCellParams); });
};
RowRenderer.prototype.getCellRendererInstances = function (params) {
var res = [];
this.forEachCellCompFiltered(params.rowNodes, params.columns, function (cellComp) {
var cellRenderer = cellComp.getCellRenderer();
if (cellRenderer) {
res.push(cellRenderer);
}
});
return res;
};
RowRenderer.prototype.getCellEditorInstances = function (params) {
var res = [];
this.forEachCellCompFiltered(params.rowNodes, params.columns, function (cellComp) {
var cellEditor = cellComp.getCellEditor();
if (cellEditor) {
res.push(cellEditor);
}
});
return res;
};
RowRenderer.prototype.getEditingCells = function () {
var res = [];
this.forEachCellComp(function (cellComp) {
if (cellComp.isEditing()) {
var cellPosition = cellComp.getCellPosition();
res.push(cellPosition);
}
});
return res;
};
// calls the callback for each cellComp that match the provided rowNodes and columns. eg if one row node
// and two columns provided, that identifies 4 cells, so callback gets called 4 times, once for each cell.
RowRenderer.prototype.forEachCellCompFiltered = function (rowNodes, columns, callback) {
var _this = this;
var rowIdsMap;
if (utils_1._.exists(rowNodes)) {
rowIdsMap = {
top: {},
bottom: {},
normal: {}
};
rowNodes.forEach(function (rowNode) {
if (rowNode.rowPinned === constants_1.Constants.PINNED_TOP) {
rowIdsMap.top[rowNode.id] = true;
}
else if (rowNode.rowPinned === constants_1.Constants.PINNED_BOTTOM) {
rowIdsMap.bottom[rowNode.id] = true;
}
else {
rowIdsMap.normal[rowNode.id] = true;
}
});
}
var colIdsMap;
if (utils_1._.exists(columns)) {
colIdsMap = {};
columns.forEach(function (colKey) {
var column = _this.columnController.getGridColumn(colKey);
if (utils_1._.exists(column)) {
colIdsMap[column.getId()] = true;
}
});
}
var processRow = function (rowComp) {
var rowNode = rowComp.getRowNode();
var id = rowNode.id;
var floating = rowNode.rowPinned;
// skip this row if it is missing from the provided list
if (utils_1._.exists(rowIdsMap)) {
if (floating === constants_1.Constants.PINNED_BOTTOM) {
if (!rowIdsMap.bottom[id]) {
return;
}
}
else if (floating === constants_1.Constants.PINNED_TOP) {
if (!rowIdsMap.top[id]) {
return;
}
}
else {
if (!rowIdsMap.normal[id]) {
return;
}
}
}
rowComp.forEachCellComp(function (cellComp) {
var colId = cellComp.getColumn().getId();
var excludeColFromRefresh = colIdsMap && !colIdsMap[colId];
if (excludeColFromRefresh) {
return;
}
callback(cellComp);
});
};
utils_1._.iterateObject(this.rowCompsByIndex, function (index, rowComp) {
processRow(rowComp);
});
if (this.floatingTopRowComps) {
this.floatingTopRowComps.forEach(processRow);
}
if (this.floatingBottomRowComps) {
this.floatingBottomRowComps.forEach(processRow);
}
};
RowRenderer.prototype.destroy = function () {
_super.prototype.destroy.call(this);
var rowIndexesToRemove = Object.keys(this.rowCompsByIndex);
this.removeRowComps(rowIndexesToRemove);
};
RowRenderer.prototype.binRowComps = function (recycleRows) {
var _this = this;
var indexesToRemove;
var rowsToRecycle = {};
if (recycleRows) {
indexesToRemove = [];
utils_1._.iterateObject(this.rowCompsByIndex, function (index, rowComp) {
var rowNode = rowComp.getRowNode();
if (utils_1._.exists(rowNode.id)) {
rowsToRecycle[rowNode.id] = rowComp;
delete _this.rowCompsByIndex[index];
}
else {
indexesToRemove.push(index);
}
});
}
else {
indexesToRemove = Object.keys(this.rowCompsByIndex);
}
this.removeRowComps(indexesToRemove);
return rowsToRecycle;
};
// takes array of row indexes
RowRenderer.prototype.removeRowComps = function (rowsToRemove) {
var _this = this;
// if no fromIndex then set to -1, which will refresh everything
// let realFromIndex = -1;
rowsToRemove.forEach(function (indexToRemove) {
var renderedRow = _this.rowCompsByIndex[indexToRemove];
renderedRow.destroy();
delete _this.rowCompsByIndex[indexToRemove];
});
};
// gets called when rows don't change, but viewport does, so after:
// 1) height of grid body changes, ie number of displayed rows has changed
// 2) grid scrolled to new position
// 3) ensure index visible (which is a scroll)
RowRenderer.prototype.redrawAfterScroll = function () {
this.getLockOnRefresh();
this.redraw(null, false, true);
this.releaseLockOnRefresh();
};
RowRenderer.prototype.removeRowCompsNotToDraw = function (indexesToDraw) {
// for speedy lookup, dump into map
var indexesToDrawMap = {};
indexesToDraw.forEach(function (index) { return (indexesToDrawMap[index] = true); });
var existingIndexes = Object.keys(this.rowCompsByIndex);
var indexesNotToDraw = utils_1._.filter(existingIndexes, function (index) { return !indexesToDrawMap[index]; });
this.removeRowComps(indexesNotToDraw);
};
RowRenderer.prototype.calculateIndexesToDraw = function () {
var _this = this;
// all in all indexes in the viewport
var indexesToDraw = utils_1._.createArrayOfNumbers(this.firstRenderedRow, this.lastRenderedRow);
// add in indexes of rows we want to keep, because they are currently editing
utils_1._.iterateObject(this.rowCompsByIndex, function (indexStr, rowComp) {
var index = Number(indexStr);
if (index < _this.firstRenderedRow || index > _this.lastRenderedRow) {
if (_this.doNotUnVirtualiseRow(rowComp)) {
indexesToDraw.push(index);
}
}
});
indexesToDraw.sort(function (a, b) { return a - b; });
return indexesToDraw;
};
RowRenderer.prototype.redraw = function (rowsToRecycle, animate, afterScroll) {
var _this = this;
if (animate === void 0) { animate = false; }
if (afterScroll === void 0) { afterScroll = false; }
this.maxDivHeightScaler.updateOffset();
this.workOutFirstAndLastRowsToRender();
// the row can already exist and be in the following:
// rowsToRecycle -> if model change, then the index may be different, however row may
// exist here from previous time (mapped by id).
// this.rowCompsByIndex -> if just a scroll, then this will contain what is currently in the viewport
// this is all the indexes we want, including those that already exist, so this method
// will end up going through each index and drawing only if the row doesn't already exist
var indexesToDraw = this.calculateIndexesToDraw();
this.removeRowCompsNotToDraw(indexesToDraw);
// never animate when doing print layout - as we want to get things ready to print as quickly as possible,
// otherwise we risk the printer printing a row that's half faded (half way through fading in)
if (this.printLayout) {
animate = false;
}
// add in new rows
var nextVmTurnFunctions = [];
var rowComps = [];
indexesToDraw.forEach(function (rowIndex) {
var rowComp = _this.createOrUpdateRowComp(rowIndex, rowsToRecycle, animate, afterScroll);
if (utils_1._.exists(rowComp)) {
rowComps.push(rowComp);
utils_1._.pushAll(nextVmTurnFunctions, rowComp.getAndClearNextVMTurnFunctions());
}
});
this.flushContainers(rowComps);
utils_1._.executeNextVMTurn(nextVmTurnFunctions);
var useAnimationFrame = afterScroll && !this.gridOptionsWrapper.isSuppressAnimationFrame() && !this.printLayout;
if (useAnimationFrame) {
this.beans.taskQueue.addP2Task(this.destroyRowComps.bind(this, rowsToRecycle, animate));
}
else {
this.destroyRowComps(rowsToRecycle, animate);
}
this.checkAngularCompile();
this.gridPanel.updateRowCount();
};
RowRenderer.prototype.flushContainers = function (rowComps) {
utils_1._.iterateObject(this.rowContainers, function (key, rowContainerComp) {
if (rowContainerComp) {
rowContainerComp.flushRowTemplates();
}
});
rowComps.forEach(function (rowComp) { return rowComp.afterFlush(); });
};
RowRenderer.prototype.onDisplayedColumnsChanged = function () {
var pinningLeft = this.columnController.isPinningLeft();
var pinningRight = this.columnController.isPinningRight();
var atLeastOneChanged = this.pinningLeft !== pinningLeft || pinningRight !== this.pinningRight;
if (atLeastOneChanged) {
this.pinningLeft = pinningLeft;
this.pinningRight = pinningRight;
if (this.embedFullWidthRows) {
this.redrawFullWidthEmbeddedRows();
}
}
};
// when embedding, what gets showed in each section depends on what is pinned. eg if embedding group expand / collapse,
// then it should go into the pinned left area if pinning left, or the center area if not pinning.
RowRenderer.prototype.redrawFullWidthEmbeddedRows = function () {
// if either of the pinned panels has shown / hidden, then need to redraw the fullWidth bits when
// embedded, as what appears in each section depends on whether we are pinned or not
var rowsToRemove = [];
utils_1._.iterateObject(this.rowCompsByIndex, function (id, rowComp) {
if (rowComp.isFullWidth()) {
var rowIndex = rowComp.getRowNode().rowIndex;
rowsToRemove.push(rowIndex.toString());
}
});
this.refreshFloatingRowComps();
this.removeRowComps(rowsToRemove);
this.redrawAfterScroll();
};
RowRenderer.prototype.refreshFullWidthRows = function () {
var rowsToRemove = [];
utils_1._.iterateObject(this.rowCompsByIndex, function (id, rowComp) {
if (rowComp.isFullWidth()) {
var fullWidthRowsRefreshed = rowComp.refreshFullWidth();
if (!fullWidthRowsRefreshed) {
var rowIndex = rowComp.getRowNode().rowIndex;
rowsToRemove.push(rowIndex.toString());
}
}
});
this.removeRowComps(rowsToRemove);
this.redrawAfterScroll();
};
RowRenderer.prototype.createOrUpdateRowComp = function (rowIndex, rowsToRecycle, animate, afterScroll) {
var rowNode;
var rowComp = this.rowCompsByIndex[rowIndex];
// if no row comp, see if we can get it from the previous rowComps
if (!rowComp) {
rowNode = this.paginationProxy.getRow(rowIndex);
if (utils_1._.exists(rowNode) && utils_1._.exists(rowsToRecycle) && rowsToRecycle[rowNode.id] && rowNode.alreadyRendered) {
rowComp = rowsToRecycle[rowNode.id];
rowsToRecycle[rowNode.id] = null;
}
}
var creatingNewRowComp = !rowComp;
if (creatingNewRowComp) {
// create a new one
if (!rowNode) {
rowNode = this.paginationProxy.getRow(rowIndex);
}
if (utils_1._.exists(rowNode)) {
rowComp = this.createRowComp(rowNode, animate, afterScroll);
}
else {
// this should never happen - if somehow we are trying to create
// a row for a rowNode that does not exist.
return;
}
}
else {
// ensure row comp is in right position in DOM
rowComp.ensureDomOrder();
}
if (rowNode) {
// set node as 'alreadyRendered' to ensure we only recycle rowComps that have been rendered, this ensures
// we don't reuse rowComps that have been removed and then re-added in the same batch transaction.
rowNode.alreadyRendered = true;
}
this.rowCompsByIndex[rowIndex] = rowComp;
return rowComp;
};
RowRenderer.prototype.destroyRowComps = function (rowCompsMap, animate) {
var delayedFuncs = [];
utils_1._.iterateObject(rowCompsMap, function (nodeId, rowComp) {
// if row was used, then it's null
if (!rowComp) {
return;
}
rowComp.destroy(animate);
utils_1._.pushAll(delayedFuncs, rowComp.getAndClearDelayedDestroyFunctions());
});
utils_1._.executeInAWhile(delayedFuncs);
};
RowRenderer.prototype.checkAngularCompile = function () {
var _this = this;
// if we are doing angular compiling, then do digest the scope here
if (this.gridOptionsWrapper.isAngularCompileRows()) {
// we do it in a timeout, in case we are already in an apply
window.setTimeout(function () {
_this.$scope.$apply();
}, 0);
}
};
RowRenderer.prototype.workOutFirstAndLastRowsToRender = function () {
var newFirst;
var newLast;
if (!this.paginationProxy.isRowsToRender()) {
newFirst = 0;
newLast = -1; // setting to -1 means nothing in range
}
else if (this.printLayout) {
newFirst = this.paginationProxy.getPageFirstRow();
newLast = this.paginationProxy.getPageLastRow();
}
else {
var paginationOffset = this.paginationProxy.getPixelOffset();
var maxDivHeightScaler = this.maxDivHeightScaler.getOffset();
var bodyVRange = this.gridPanel.getVScrollPosition();
var bodyTopPixel = bodyVRange.top;
var bodyBottomPixel = bodyVRange.bottom;
var bufferPixels = this.gridOptionsWrapper.getRowBufferInPixels();
var firstPixel = bodyTopPixel + paginationOffset + maxDivHeightScaler - bufferPixels;
var lastPixel = bodyBottomPixel + paginationOffset + maxDivHeightScaler + bufferPixels;
this.ensureAllRowsInRangeHaveHeightsCalculated(firstPixel, lastPixel);
var firstRowIndex = this.paginationProxy.getRowIndexAtPixel(firstPixel);
var lastRowIndex = this.paginationProxy.getRowIndexAtPixel(lastPixel);
var pageFirstRow = this.paginationProxy.getPageFirstRow();
var pageLastRow = this.paginationProxy.getPageLastRow();
// adjust, in case buffer extended actual size
if (firstRowIndex < pageFirstRow) {
firstRowIndex = pageFirstRow;
}
if (lastRowIndex > pageLastRow) {
lastRowIndex = pageLastRow;
}
newFirst = firstRowIndex;
newLast = lastRowIndex;
}
// sometimes user doesn't set CSS right and ends up with grid with no height and grid ends up
// trying to render all the rows, eg 10,000+ rows. this will kill the browser. so instead of
// killing the browser, we limit the number of rows. just in case some use case we didn't think
// of, we also have a property to not do this operation.
var rowLayoutNormal = this.gridOptionsWrapper.getDomLayout() === constants_1.Constants.DOM_LAYOUT_NORMAL;
var suppressRowCountRestriction = this.gridOptionsWrapper.isSuppressMaxRenderedRowRestriction();
var rowBufferMaxSize = Math.max(this.gridOptionsWrapper.getRowBuffer(), 500);
if (rowLayoutNormal && !suppressRowCountRestriction) {
if (newLast - newFirst > rowBufferMaxSize) {
newLast = newFirst + rowBufferMaxSize;
}
}
var firstDiffers = newFirst !== this.firstRenderedRow;
var lastDiffers = newLast !== this.lastRenderedRow;
if (firstDiffers || lastDiffers) {
this.firstRenderedRow = newFirst;
this.lastRenderedRow = newLast;
var event_1 = {
type: events_1.Events.EVENT_VIEWPORT_CHANGED,
firstRow: newFirst,
lastRow: newLast,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEvent(event_1);
}
if (this.paginationProxy.isRowsToRender()) {
var event_2 = {
type: events_1.Events.EVENT_FIRST_DATA_RENDERED,
firstRow: newFirst,
lastRow: newLast,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEventOnce(event_2);
}
};
RowRenderer.prototype.ensureAllRowsInRangeHaveHeightsCalculated = function (topPixel, bottomPixel) {
// ensureRowHeightsVisible only works with CSRM, as it's the only row model that allows lazy row height calcs.
// all the other row models just hard code so the method just returns back false
var rowHeightsChanged = this.paginationProxy.ensureRowHeightsValid(topPixel, bottomPixel, -1, -1);
if (rowHeightsChanged) {
// if row heights have changed, we need to resize the containers the rows sit it
this.sizeContainerToPageHeight();
// we also need to update heightScaler as this has dependency of row container height
this.maxDivHeightScaler.updateOffset();
}
};
RowRenderer.prototype.getFirstVirtualRenderedRow = function () {
return this.firstRenderedRow;
};
RowRenderer.prototype.getLastVirtualRenderedRow = function () {
return this.lastRenderedRow;
};
// check that none of the rows to remove are editing or focused as:
// a) if editing, we want to keep them, otherwise the user will loose the context of the edit,
// eg user starts editing, enters some text, then scrolls down and then up, next time row rendered
// the edit is reset - so we want to keep it rendered.
// b) if focused, we want ot keep keyboard focus, so if user ctrl+c, it goes to clipboard,
// otherwise the user can range select and drag (with focus cell going out of the viewport)
// and then ctrl+c, nothing will happen if cell is removed from dom.
// c) if detail record of master detail, as users complained that the context of detail rows
// was getting lost when detail row out of view. eg user expands to show detail row,
// then manipulates the detail panel (eg sorts the detail grid), then context is lost
// after detail panel is scrolled out of / into view.
RowRenderer.prototype.doNotUnVirtualiseRow = function (rowComp) {
var REMOVE_ROW = false;
var KEEP_ROW = true;
var rowNode = rowComp.getRowNode();
var rowHasFocus = this.focusedCellController.isRowNodeFocused(rowNode);
var rowIsEditing = rowComp.isEditing();
var rowIsDetail = rowNode.detail;
var mightWantToKeepRow = rowHasFocus || rowIsEditing || rowIsDetail;
// if we deffo don't want to keep it,
if (!mightWantToKeepRow) {
return REMOVE_ROW;
}
// editing row, only remove if it is no longer rendered, eg filtered out or new data set.
// the reason we want to keep is if user is scrolling up and down, we don't want to loose
// the context of the editing in process.
var rowNodePresent = this.paginationProxy.isRowPresent(rowNode);
return rowNodePresent ? KEEP_ROW : REMOVE_ROW;
};
RowRenderer.prototype.createRowComp = function (rowNode, animate, afterScroll) {
var suppressAnimationFrame = this.gridOptionsWrapper.isSuppressAnimationFrame();
// we don't use animations frames for printing, so the user can put the grid into print mode
// and immediately print - otherwise the user would have to wait for the rows to draw in the background
// (via the animation frames) which is awkward to do from code.
// we only do the animation frames after scrolling, as this is where we want the smooth user experience.
// having animation frames for other times makes the grid look 'jumpy'.
var useAnimationFrameForCreate = afterScroll && !suppressAnimationFrame && !this.printLayout;
var rowComp = new rowComp_1.RowComp(this.$scope, this.rowContainers.body, this.rowContainers.pinnedLeft, this.rowContainers.pinnedRight, this.rowContainers.fullWidth, rowNode, this.beans, animate, useAnimationFrameForCreate, this.printLayout, this.embedFullWidthRows);
rowComp.init();
return rowComp;
};
RowRenderer.prototype.getRenderedNodes = function () {
var renderedRows = this.rowCompsByIndex;
return Object.keys(renderedRows).map(function (key) {
return renderedRows[key].getRowNode();
});
};
// we use index for rows, but column object for columns, as the next column (by index) might not
// be visible (header grouping) so it's not reliable, so using the column object instead.
RowRenderer.prototype.navigateToNextCell = function (event, key, currentCell, allowUserOverride) {
// we keep searching for a next cell until we find one. this is how the group rows get skipped
var nextCell = currentCell;
var finished = false;
while (!finished) {
// if the current cell is spanning across multiple columns, we need to move
// our current position to be the last cell on the right before finding the
// the next target.
if (this.gridOptionsWrapper.isEnableRtl()) {
if (key === constants_1.Constants.KEY_LEFT) {
nextCell = this.getLastCellOfColSpan(nextCell);
}
}
else if (key === constants_1.Constants.KEY_RIGHT) {
nextCell = this.getLastCellOfColSpan(nextCell);
}
nextCell = this.cellNavigationService.getNextCellToFocus(key, nextCell);
// eg if going down, and nextCell=undefined, means we are gone past the last row
var hitEdgeOfGrid = utils_1._.missing(nextCell);
if (hitEdgeOfGrid) {
finished = true;
continue;
}
var rowNode = this.rowPositionUtils.getRowNode(nextCell);
// we do not allow focusing on full width rows, this includes details rows
if (rowNode.detail) {
continue;
}
// if not a group, then we have a valid row, so quit the search
if (!rowNode.group) {
finished = true;
continue;
}
// full width rows cannot be focused, so if it's a group and using full width rows,
// we need to skip over the row
var pivotMode = this.columnController.isPivotMode();
var usingFullWidthRows = this.gridOptionsWrapper.isGroupUseEntireRow(pivotMode);
if (!usingFullWidthRows) {
finished = true;
}
}
// allow user to override what cell to go to next. when doing normal cell navigation (with keys)
// we allow this, however if processing 'enter after edit' we don't allow override
if (allowUserOverride) {
var userFunc = this.gridOptionsWrapper.getNavigateToNextCellFunc();
if (utils_1._.exists(userFunc)) {
var params = {
key: key,
previousCellPosition: currentCell,
nextCellPosition: nextCell ? nextCell : null,
event: event
};
var userCell = userFunc(params);
if (utils_1._.exists(userCell)) {
if (userCell.floating) {
utils_1._.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');
userCell.rowPinned = userCell.floating;
}
nextCell = {
rowPinned: userCell.rowPinned,
rowIndex: userCell.rowIndex,
column: userCell.column
};
}
else {
nextCell = null;
}
}
}
// no next cell means we have reached a grid boundary, eg left, right, top or bottom of grid
if (!nextCell) {
return;
}
// in case we have col spanning we get the cellComp and use it to
// get the position. This was we always focus the first cell inside
// the spanning.
this.ensureCellVisible(nextCell); // ensureCellVisible first, to make sure nextCell is rendered
var cellComp = this.getComponentForCell(nextCell);
nextCell = cellComp.getCellPosition();
// we call this again, as nextCell can be different to it's previous value due to Column Spanning
// (ie if cursor moving from right to left, and cell is spanning columns, then nextCell was the
// last column in the group, however now it's the first column in the group). if we didn't do
// ensureCellVisible again, then we could only be showing the last portion (last column) of the
// merged cells.
this.ensureCellVisible(nextCell);
this.focusedCellController.setFocusedCell(nextCell.rowIndex, nextCell.column, nextCell.rowPinned, true);
if (this.rangeController) {
this.rangeController.setRangeToCell(nextCell);
}
};
RowRenderer.prototype.getLastCellOfColSpan = function (cell) {
var cellComp = this.getComponentForCell(cell);
if (!cellComp) {
return cell;
}
var colSpanningList = cellComp.getColSpanningList();
if (colSpanningList.length === 1) {
return cell;
}
return {
rowIndex: cell.rowIndex,
column: utils_1._.last(colSpanningList),
rowPinned: cell.rowPinned
};
};
RowRenderer.prototype.ensureCellVisible = function (gridCell) {
// this scrolls the row into view
if (utils_1._.missing(gridCell.rowPinned)) {
this.gridPanel.ensureIndexVisible(gridCell.rowIndex);
}
if (!gridCell.column.isPinned()) {
this.gridPanel.ensureColumnVisible(gridCell.column);
}
// need to nudge the scrolls for the floating items. otherwise when we set focus on a non-visible
// floating cell, the scrolls get out of sync
this.gridPanel.horizontallyScrollHeaderCenterAndFloatingCenter();
// need to flush frames, to make sure the correct cells are rendered
this.animationFrameService.flushAllFrames();
};
RowRenderer.prototype.startEditingCell = function (gridCell, keyPress, charPress) {
var cell = this.getComponentForCell(gridCell);
if (cell) {
cell.startRowOrCellEdit(keyPress, charPress);
}
};
RowRenderer.prototype.getComponentForCell = function (cellPosition) {
var rowComponent;
switch (cellPosition.rowPinned) {
case constants_1.Constants.PINNED_TOP:
rowComponent = this.floatingTopRowComps[cellPosition.rowIndex];
break;
case constants_1.Constants.PINNED_BOTTOM:
rowComponent = this.floatingBottomRowComps[cellPosition.rowIndex];
break;
default:
rowComponent = this.rowCompsByIndex[cellPosition.rowIndex];
break;
}
if (!rowComponent) {
return null;
}
var cellComponent = rowComponent.getRenderedCellForColumn(cellPosition.column);
return cellComponent;
};
RowRenderer.prototype.getRowNode = function (gridRow) {
switch (gridRow.rowPinned) {
case constants_1.Constants.PINNED_TOP:
return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];
case constants_1.Constants.PINNED_BOTTOM:
return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];
default:
return this.rowModel.getRow(gridRow.rowIndex);
}
};
RowRenderer.prototype.onTabKeyDown = function (previousRenderedCell, keyboardEvent) {
var backwards = keyboardEvent.shiftKey;
var success = this.moveToCellAfter(previousRenderedCell, backwards);
if (success) {
keyboardEvent.preventDefault();
}
};
RowRenderer.prototype.tabToNextCell = function (backwards) {
var focusedCell = this.focusedCellController.getFocusedCell();
// if no focus, then cannot navigate
if (utils_1._.missing(focusedCell)) {
return false;
}
var renderedCell = this.getComponentForCell(focusedCell);
// if cell is not rendered, means user has scrolled away from the cell
if (utils_1._.missing(renderedCell)) {
return false;
}
var result = this.moveToCellAfter(renderedCell, backwards);
return result;
};
RowRenderer.prototype.moveToCellAfter = function (previousRenderedCell, backwards) {
var editing = previousRenderedCell.isEditing();
var res;
if (editing) {
if (this.gridOptionsWrapper.isFullRowEdit()) {
res = this.moveToNextEditingRow(previousRenderedCell, backwards);
}
else {
res = this.moveToNextEditingCell(previousRenderedCell, backwards);
}
}
else {
res = this.moveToNextCellNotEditing(previousRenderedCell, backwards);
}
return res;
};
RowRenderer.prototype.moveToNextEditingCell = function (previousRenderedCell, backwards) {
var gridCell = previousRenderedCell.getCellPosition();
// need to do this before getting next cell to edit, in case the next cell
// has editable function (eg colDef.editable=func() ) and it depends on the
// result of this cell, so need to save updates from the first edit, in case
// the value is referenced in the function.
previousRenderedCell.stopEditing();
// find the next cell to start editing
var nextRenderedCell = this.findNextCellToFocusOn(gridCell, backwards, true);
var foundCell = utils_1._.exists(nextRenderedCell);
// only prevent default if we found a cell. so if user is on last cell and hits tab, then we default
// to the normal tabbing so user can exit the grid.
if (foundCell) {
nextRenderedCell.startEditingIfEnabled(null, null, true);
nextRenderedCell.focusCell(false);
}
return foundCell;
};
RowRenderer.prototype.moveToNextEditingRow = function (previousRenderedCell, backwards) {
var gridCell = previousRenderedCell.getCellPosition();
// find the next cell to start editing
var nextRenderedCell = this.findNextCellToFocusOn(gridCell, backwards, true);
var foundCell = utils_1._.exists(nextRenderedCell);
// only prevent default if we found a cell. so if user is on last cell and hits tab, then we default
// to the normal tabbing so user can exit the grid.
if (foundCell) {
this.moveEditToNextCellOrRow(previousRenderedCell, nextRenderedCell);
}
return foundCell;
};
RowRenderer.prototype.moveToNextCellNotEditing = function (previousRenderedCell, backwards) {
var gridCell = previousRenderedCell.getCellPosition();
// find the next cell to start editing
var nextRenderedCell = this.findNextCellToFocusOn(gridCell, backwards, false);
var foundCell = utils_1._.exists(nextRenderedCell);
// only prevent default if we found a cell. so if user is on last cell and hits tab, then we default
// to the normal tabbing so user can exit the grid.
if (foundCell) {
nextRenderedCell.focusCell(true);
}
return foundCell;
};
RowRenderer.prototype.moveEditToNextCellOrRow = function (previousRenderedCell, nextRenderedCell) {
var pGridCell = previousRenderedCell.getCellPosition();
var nGridCell = nextRenderedCell.getCellPosition();
var rowsMatch = pGridCell.rowIndex === nGridCell.rowIndex && pGridCell.rowPinned === nGridCell.rowPinned;
if (rowsMatch) {
// same row, so we don't start / stop editing, we just move the focus along
previousRenderedCell.setFocusOutOnEditor();
nextRenderedCell.setFocusInOnEditor();
}
else {
var pRow = previousRenderedCell.getRenderedRow();
var nRow = nextRenderedCell.getRenderedRow();
previousRenderedCell.setFocusOutOnEditor();
pRow.stopEditing();
nRow.startRowEditing();
nextRenderedCell.setFocusInOnEditor();
}
nextRenderedCell.focusCell();
};
// called by the cell, when tab is pressed while editing.
// @return: RenderedCell when navigation successful, otherwise null
RowRenderer.prototype.findNextCellToFocusOn = function (gridCell, backwards, startEditing) {
var nextCell = gridCell;
while (true) {
if (!backwards) {
nextCell = this.getLastCellOfColSpan(nextCell);
}
nextCell = this.cellNavigationService.getNextTabbedCell(nextCell, backwards);
// allow user to override what cell to go to next
var userFunc = this.gridOptionsWrapper.getTabToNextCellFunc();
if (utils_1._.exists(userFunc)) {
var params = {
backwards: backwards,
editing: startEditing,
previousCellPosition: gridCell,
nextCellPosition: nextCell ? nextCell : null
};
var userCell = userFunc(params);
if (utils_1._.exists(userCell)) {
if (userCell.floating) {
utils_1._.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');
userCell.rowPinned = userCell.floating;
}
nextCell = {
rowIndex: userCell.rowIndex,
column: userCell.column,
rowPinned: userCell.rowPinned
};
}
else {
nextCell = null;
}
}
// if no 'next cell', means we have got to last cell of grid, so nothing to move to,
// so bottom right cell going forwards, or top left going backwards
if (!nextCell) {
return null;
}
// if editing, but cell not editable, skip cell. we do this before we do all of
// the 'ensure index visible' and 'flush all frames', otherwise if we are skipping
// a bunch of cells (eg 10 rows) then all the work on ensuring cell visible is useless
// (except for the last one) which causes grid to stall for a while.
if (startEditing) {
var rowNode = this.lookupRowNodeForCell(nextCell);
var cellIsEditable = nextCell.column.isCellEditable(rowNode);
if (!cellIsEditable) {
continue;
}
}
// this scrolls the row into view
var cellIsNotFloating = utils_1._.missing(nextCell.rowPinned);
if (cellIsNotFloating) {
this.gridPanel.ensureIndexVisible(nextCell.rowIndex);
}
// pinned columns don't scroll, so no need to ensure index visible
if (!nextCell.column.isPinned()) {
this.gridPanel.ensureColumnVisible(nextCell.column);
}
// need to nudge the scrolls for the floating items. otherwise when we set focus on a non-visible
// floating cell, the scrolls get out of sync
this.gridPanel.horizontallyScrollHeaderCenterAndFloatingCenter();
// get the grid panel to flush all animation frames - otherwise the call below to get the cellComp
// could fail, if we just scrolled the grid (to make a cell visible) and the rendering hasn't finished.
this.animationFrameService.flushAllFrames();
// we have to call this after ensureColumnVisible - otherwise it could be a virtual column
// or row that is not currently in view, hence the renderedCell would not exist
var nextCellComp = this.getComponentForCell(nextCell);
// if next cell is fullWidth row, then no rendered cell,
// as fullWidth rows have no cells, so we skip it
if (utils_1._.missing(nextCellComp)) {
continue;
}
if (nextCellComp.isSuppressNavigable()) {
continue;
}
// by default, when we click a cell, it gets selected into a range, so to keep keyboard navigation
// consistent, we set into range here also.
if (this.rangeController) {
this.rangeController.setRangeToCell(nextCell);
}
// we successfully tabbed onto a grid cell, so return true
return nextCellComp;
}
};
RowRenderer.prototype.lookupRowNodeForCell = function (cell) {
if (cell.rowPinned === constants_1.Constants.PINNED_TOP) {
return this.pinnedRowModel.getPinnedTopRow(cell.rowIndex);
}
if (cell.rowPinned === constants_1.Constants.PINNED_BOTTOM) {
return this.pinnedRowModel.getPinnedBottomRow(cell.rowIndex);
}
return this.paginationProxy.getRow(cell.rowIndex);
};
__decorate([
context_1.Autowired("paginationProxy"),
__metadata("design:type", paginationProxy_1.PaginationProxy)
], RowRenderer.prototype, "paginationProxy", void 0);
__decorate([
context_1.Autowired("columnController"),
__metadata("design:type", columnController_1.ColumnController)
], RowRenderer.prototype, "columnController", void 0);
__decorate([
context_1.Autowired("gridOptionsWrapper"),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], RowRenderer.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.Autowired("$scope"),
__metadata("design:type", Object)
], RowRenderer.prototype, "$scope", void 0);
__decorate([
context_1.Autowired("eventService"),
__metadata("design:type", eventService_1.EventService)
], RowRenderer.prototype, "eventService", void 0);
__decorate([
context_1.Autowired("pinnedRowModel"),
__metadata("design:type", pinnedRowModel_1.PinnedRowModel)
], RowRenderer.prototype, "pinnedRowModel", void 0);
__decorate([
context_1.Autowired("rowModel"),
__metadata("design:type", Object)
], RowRenderer.prototype, "rowModel", void 0);
__decorate([
context_1.Autowired("loggerFactory"),
__metadata("design:type", logger_1.LoggerFactory)
], RowRenderer.prototype, "loggerFactory", void 0);
__decorate([
context_1.Autowired("focusedCellController"),
__metadata("design:type", focusedCellController_1.FocusedCellController)
], RowRenderer.prototype, "focusedCellController", void 0);
__decorate([
context_1.Autowired("cellNavigationService"),
__metadata("design:type", cellNavigationService_1.CellNavigationService)
], RowRenderer.prototype, "cellNavigationService", void 0);
__decorate([
context_1.Autowired("columnApi"),
__metadata("design:type", columnApi_1.ColumnApi)
], RowRenderer.prototype, "columnApi", void 0);
__decorate([
context_1.Autowired("gridApi"),
__metadata("design:type", gridApi_1.GridApi)
], RowRenderer.prototype, "gridApi", void 0);
__decorate([
context_1.Autowired("beans"),
__metadata("design:type", beans_1.Beans)
], RowRenderer.prototype, "beans", void 0);
__decorate([
context_1.Autowired("maxDivHeightScaler"),
__metadata("design:type", maxDivHeightScaler_1.MaxDivHeightScaler)
], RowRenderer.prototype, "maxDivHeightScaler", void 0);
__decorate([
context_1.Autowired("animationFrameService"),
__metadata("design:type", animationFrameService_1.AnimationFrameService)
], RowRenderer.prototype, "animationFrameService", void 0);
__decorate([
context_1.Autowired("rowPositionUtils"),
__metadata("design:type", rowPosition_1.RowPositionUtils)
], RowRenderer.prototype, "rowPositionUtils", void 0);
__decorate([
context_1.Optional("rangeController"),
__metadata("design:type", Object)
], RowRenderer.prototype, "rangeController", void 0);
__decorate([
__param(0, context_1.Qualifier("loggerFactory")),
__metadata("design:type", Function),
__metadata("design:paramtypes", [logger_1.LoggerFactory]),
__metadata("design:returntype", void 0)
], RowRenderer.prototype, "agWire", null);
RowRenderer = __decorate([
context_1.Bean("rowRenderer")
], RowRenderer);
return RowRenderer;
}(beanStub_1.BeanStub));
exports.RowRenderer = RowRenderer;
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var cellComp_1 = __webpack_require__(32);
var rowNode_1 = __webpack_require__(36);
var column_1 = __webpack_require__(23);
var events_1 = __webpack_require__(15);
var component_1 = __webpack_require__(33);
var utils_1 = __webpack_require__(5);
var RowComp = /** @class */ (function (_super) {
__extends(RowComp, _super);
function RowComp(parentScope, bodyContainerComp, pinnedLeftContainerComp, pinnedRightContainerComp, fullWidthContainerComp, rowNode, beans, animateIn, useAnimationFrameForCreate, printLayout, embedFullWidth) {
var _this = _super.call(this) || this;
_this.eAllRowContainers = [];
_this.active = true;
_this.rowContainerReadyCount = 0;
_this.refreshNeeded = false;
_this.columnRefreshPending = false;
_this.cellComps = {};
// for animations, there are bits we want done in the next VM turn, to all DOM to update first.
// instead of each row doing a setTimeout(func,0), we put the functions here and the rowRenderer
// executes them all in one timeout
_this.createSecondPassFuncs = [];
// these get called before the row is destroyed - they set up the DOM for the remove animation (ie they
// set the DOM up for the animation), then the delayedDestroyFunctions get called when the animation is
// complete (ie removes from the dom).
_this.removeFirstPassFuncs = [];
// for animations, these functions get called 400ms after the row is cleared, called by the rowRenderer
// so each row isn't setting up it's own timeout
_this.removeSecondPassFuncs = [];
_this.initialised = false;
_this.parentScope = parentScope;
_this.beans = beans;
_this.bodyContainerComp = bodyContainerComp;
_this.pinnedLeftContainerComp = pinnedLeftContainerComp;
_this.pinnedRightContainerComp = pinnedRightContainerComp;
_this.fullWidthContainerComp = fullWidthContainerComp;
_this.rowNode = rowNode;
_this.rowIsEven = _this.rowNode.rowIndex % 2 === 0;
_this.paginationPage = _this.beans.paginationProxy.getCurrentPage();
_this.useAnimationFrameForCreate = useAnimationFrameForCreate;
_this.printLayout = printLayout;
_this.embedFullWidth = embedFullWidth;
_this.setAnimateFlags(animateIn);
return _this;
}
RowComp.prototype.init = function () {
var _this = this;
this.rowFocused = this.beans.focusedCellController.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned);
this.scope = this.createChildScopeOrNull(this.rowNode.data);
this.setupRowContainers();
this.addListeners();
if (this.slideRowIn) {
this.createSecondPassFuncs.push(function () {
_this.onTopChanged();
});
}
if (this.fadeRowIn) {
this.createSecondPassFuncs.push(function () {
_this.eAllRowContainers.forEach(function (eRow) { return utils_1._.removeCssClass(eRow, 'ag-opacity-zero'); });
});
}
};
RowComp.prototype.createTemplate = function (contents, extraCssClass) {
if (extraCssClass === void 0) { extraCssClass = null; }
var templateParts = [];
var rowHeight = this.rowNode.rowHeight;
var rowClasses = this.getInitialRowClasses(extraCssClass).join(' ');
var rowIdSanitised = utils_1._.escape(this.rowNode.id);
var userRowStyles = this.preProcessStylesFromGridOptions();
var businessKey = this.getRowBusinessKey();
var businessKeySanitised = utils_1._.escape(businessKey);
var rowTopStyle = this.getInitialRowTopStyle();
var rowIdx = this.rowNode.getRowIndexString();
var headerRowCount = this.beans.gridPanel.headerRootComp.getHeaderRowCount();
templateParts.push("");
// add in the template for the cells
templateParts.push(contents);
templateParts.push("
");
return templateParts.join('');
};
RowComp.prototype.getCellForCol = function (column) {
var cellComp = this.cellComps[column.getColId()];
return cellComp ? cellComp.getGui() : null;
};
RowComp.prototype.afterFlush = function () {
if (this.initialised) {
return;
}
this.initialised = true;
this.executeProcessRowPostCreateFunc();
};
RowComp.prototype.executeProcessRowPostCreateFunc = function () {
var func = this.beans.gridOptionsWrapper.getProcessRowPostCreateFunc();
if (!func) {
return;
}
var params = {
eRow: this.eBodyRow,
ePinnedLeftRow: this.ePinnedLeftRow,
ePinnedRightRow: this.ePinnedRightRow,
node: this.rowNode,
api: this.beans.gridOptionsWrapper.getApi(),
rowIndex: this.rowNode.rowIndex,
addRenderedRowListener: this.addEventListener.bind(this),
columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
context: this.beans.gridOptionsWrapper.getContext()
};
func(params);
};
RowComp.prototype.getInitialRowTopStyle = function () {
// print layout uses normal flow layout for row positioning
if (this.printLayout) {
return '';
}
// if sliding in, we take the old row top. otherwise we just set the current row top.
var pixels = this.slideRowIn ? this.roundRowTopToBounds(this.rowNode.oldRowTop) : this.rowNode.rowTop;
var afterPaginationPixels = this.applyPaginationOffset(pixels);
var afterScalingPixels = this.beans.maxDivHeightScaler.getRealPixelPosition(afterPaginationPixels);
var isSuppressRowTransform = this.beans.gridOptionsWrapper.isSuppressRowTransform();
return isSuppressRowTransform ? "top: " + afterScalingPixels + "px; " : "transform: translateY(" + afterScalingPixels + "px);";
};
RowComp.prototype.getRowBusinessKey = function () {
var businessKeyForNodeFunc = this.beans.gridOptionsWrapper.getBusinessKeyForNodeFunc();
if (typeof businessKeyForNodeFunc !== 'function') {
return;
}
return businessKeyForNodeFunc(this.rowNode);
};
RowComp.prototype.areAllContainersReady = function () {
return this.rowContainerReadyCount === 3;
};
RowComp.prototype.lazyCreateCells = function (cols, eRow) {
if (!this.active) {
return;
}
var cellTemplatesAndComps = this.createCells(cols);
eRow.innerHTML = cellTemplatesAndComps.template;
this.callAfterRowAttachedOnCells(cellTemplatesAndComps.cellComps, eRow);
this.rowContainerReadyCount++;
if (this.areAllContainersReady() && this.refreshNeeded) {
this.refreshCells();
}
};
RowComp.prototype.createRowContainer = function (rowContainerComp, cols, callback) {
var _this = this;
var useAnimationsFrameForCreate = this.useAnimationFrameForCreate;
var cellTemplatesAndComps = useAnimationsFrameForCreate ? { cellComps: [], template: '' } : this.createCells(cols);
var rowTemplate = this.createTemplate(cellTemplatesAndComps.template);
// the RowRenderer is probably inserting many rows. rather than inserting each template one
// at a time, the grid inserts all rows together - so the callback here is called by the
// rowRenderer when all RowComps are created, then all the HTML is inserted in one go,
// and then all the callbacks are called. this is NOT done in an animation frame.
rowContainerComp.appendRowTemplate(rowTemplate, function () {
var eRow = rowContainerComp.getRowElement(_this.getCompId());
_this.afterRowAttached(rowContainerComp, eRow);
callback(eRow);
if (useAnimationsFrameForCreate) {
_this.beans.taskQueue.addP1Task(_this.lazyCreateCells.bind(_this, cols, eRow), _this.rowNode.rowIndex);
}
else {
_this.callAfterRowAttachedOnCells(cellTemplatesAndComps.cellComps, eRow);
_this.rowContainerReadyCount = 3;
}
});
};
RowComp.prototype.createChildScopeOrNull = function (data) {
var isAngularCompileRows = this.beans.gridOptionsWrapper.isAngularCompileRows();
if (!isAngularCompileRows) {
return null;
}
var newChildScope = this.parentScope.$new();
newChildScope.data = __assign({}, data);
newChildScope.rowNode = this.rowNode;
newChildScope.context = this.beans.gridOptionsWrapper.getContext();
this.addDestroyFunc(function () {
newChildScope.$destroy();
newChildScope.data = null;
newChildScope.rowNode = null;
newChildScope.context = null;
});
return newChildScope;
};
RowComp.prototype.setupRowContainers = function () {
var isFullWidthCellFunc = this.beans.gridOptionsWrapper.getIsFullWidthCellFunc();
var isFullWidthCell = isFullWidthCellFunc ? isFullWidthCellFunc(this.rowNode) : false;
var isDetailCell = this.beans.doingMasterDetail && this.rowNode.detail;
var pivotMode = this.beans.columnController.isPivotMode();
// we only use full width for groups, not footers. it wouldn't make sense to include footers if not looking
// for totals. if users complain about this, then we should introduce a new property 'footerUseEntireRow'
// so each can be set independently (as a customer complained about footers getting full width, hence
// introducing this logic)
var isGroupRow = this.rowNode.group && !this.rowNode.footer;
var isFullWidthGroup = isGroupRow && this.beans.gridOptionsWrapper.isGroupUseEntireRow(pivotMode);
if (this.rowNode.stub) {
this.createFullWidthRows(RowComp.LOADING_CELL_RENDERER, RowComp.LOADING_CELL_RENDERER_COMP_NAME);
}
else if (isDetailCell) {
this.createFullWidthRows(RowComp.DETAIL_CELL_RENDERER, RowComp.DETAIL_CELL_RENDERER_COMP_NAME);
}
else if (isFullWidthCell) {
this.createFullWidthRows(RowComp.FULL_WIDTH_CELL_RENDERER, null);
}
else if (isFullWidthGroup) {
this.createFullWidthRows(RowComp.GROUP_ROW_RENDERER, RowComp.GROUP_ROW_RENDERER_COMP_NAME);
}
else {
this.setupNormalRowContainers();
}
};
RowComp.prototype.setupNormalRowContainers = function () {
var _this = this;
var centerCols;
var leftCols;
var rightCols;
if (this.printLayout) {
centerCols = this.beans.columnController.getAllDisplayedColumns();
leftCols = [];
rightCols = [];
}
else {
centerCols = this.beans.columnController.getAllDisplayedCenterVirtualColumnsForRow(this.rowNode);
leftCols = this.beans.columnController.getDisplayedLeftColumnsForRow(this.rowNode);
rightCols = this.beans.columnController.getDisplayedRightColumnsForRow(this.rowNode);
}
this.createRowContainer(this.bodyContainerComp, centerCols, function (eRow) { return _this.eBodyRow = eRow; });
this.createRowContainer(this.pinnedRightContainerComp, rightCols, function (eRow) { return _this.ePinnedRightRow = eRow; });
this.createRowContainer(this.pinnedLeftContainerComp, leftCols, function (eRow) { return _this.ePinnedLeftRow = eRow; });
};
RowComp.prototype.createFullWidthRows = function (type, name) {
var _this = this;
this.fullWidthRow = true;
if (this.embedFullWidth) {
this.createFullWidthRowContainer(this.bodyContainerComp, null, null, type, name, function (eRow) {
_this.eFullWidthRowBody = eRow;
}, function (cellRenderer) {
_this.fullWidthRowComponentBody = cellRenderer;
});
// printLayout doesn't put components into the pinned sections
if (!this.printLayout) {
this.createFullWidthRowContainer(this.pinnedLeftContainerComp, column_1.Column.PINNED_LEFT, 'ag-cell-last-left-pinned', type, name, function (eRow) {
_this.eFullWidthRowLeft = eRow;
}, function (cellRenderer) {
_this.fullWidthRowComponentLeft = cellRenderer;
});
this.createFullWidthRowContainer(this.pinnedRightContainerComp, column_1.Column.PINNED_RIGHT, 'ag-cell-first-right-pinned', type, name, function (eRow) {
_this.eFullWidthRowRight = eRow;
}, function (cellRenderer) {
_this.fullWidthRowComponentRight = cellRenderer;
});
}
}
else {
// otherwise we add to the fullWidth container as normal
// let previousFullWidth = ensureDomOrder ? this.lastPlacedElements.eFullWidth : null;
this.createFullWidthRowContainer(this.fullWidthContainerComp, null, null, type, name, function (eRow) {
_this.eFullWidthRow = eRow;
}, function (cellRenderer) {
_this.fullWidthRowComponent = cellRenderer;
});
}
};
RowComp.prototype.setAnimateFlags = function (animateIn) {
if (animateIn) {
var oldRowTopExists = utils_1._.exists(this.rowNode.oldRowTop);
// if the row had a previous position, we slide it in (animate row top)
this.slideRowIn = oldRowTopExists;
// if the row had no previous position, we fade it in (animate
this.fadeRowIn = !oldRowTopExists;
}
else {
this.slideRowIn = false;
this.fadeRowIn = false;
}
};
RowComp.prototype.isEditing = function () {
return this.editingRow;
};
RowComp.prototype.stopRowEditing = function (cancel) {
this.stopEditing(cancel);
};
RowComp.prototype.isFullWidth = function () {
return this.fullWidthRow;
};
RowComp.prototype.refreshFullWidth = function () {
var _this = this;
// returns 'true' if refresh succeeded
var tryRefresh = function (eRow, eCellComp, pinned) {
if (!eRow || !eCellComp) {
// no refresh needed
return true;
}
if (!eCellComp.refresh) {
// no refresh method present, so can't refresh, hard refresh needed
return false;
}
var params = _this.createFullWidthParams(eRow, pinned);
var refreshSucceeded = eCellComp.refresh(params);
return refreshSucceeded;
};
var normalSuccess = tryRefresh(this.eFullWidthRow, this.fullWidthRowComponent, null);
var bodySuccess = tryRefresh(this.eFullWidthRowBody, this.fullWidthRowComponentBody, null);
var leftSuccess = tryRefresh(this.eFullWidthRowLeft, this.fullWidthRowComponentLeft, column_1.Column.PINNED_LEFT);
var rightSuccess = tryRefresh(this.eFullWidthRowRight, this.fullWidthRowComponentRight, column_1.Column.PINNED_RIGHT);
var allFullWidthRowsRefreshed = normalSuccess && bodySuccess && leftSuccess && rightSuccess;
return allFullWidthRowsRefreshed;
};
RowComp.prototype.addListeners = function () {
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_HEIGHT_CHANGED, this.onRowHeightChanged.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_ROW_SELECTED, this.onRowSelected.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_ROW_INDEX_CHANGED, this.onRowIndexChanged.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_TOP_CHANGED, this.onTopChanged.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_EXPANDED_CHANGED, this.onExpandedChanged.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_DATA_CHANGED, this.onRowNodeDataChanged.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_CELL_CHANGED, this.onRowNodeCellChanged.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_DRAGGING_CHANGED, this.onRowNodeDraggingChanged.bind(this));
var eventService = this.beans.eventService;
this.addDestroyableEventListener(eventService, events_1.Events.EVENT_HEIGHT_SCALE_CHANGED, this.onTopChanged.bind(this));
this.addDestroyableEventListener(eventService, events_1.Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
this.addDestroyableEventListener(eventService, events_1.Events.EVENT_VIRTUAL_COLUMNS_CHANGED, this.onVirtualColumnsChanged.bind(this));
this.addDestroyableEventListener(eventService, events_1.Events.EVENT_COLUMN_RESIZED, this.onColumnResized.bind(this));
this.addDestroyableEventListener(eventService, events_1.Events.EVENT_CELL_FOCUSED, this.onCellFocusChanged.bind(this));
this.addDestroyableEventListener(eventService, events_1.Events.EVENT_PAGINATION_CHANGED, this.onPaginationChanged.bind(this));
this.addDestroyableEventListener(eventService, events_1.Events.EVENT_GRID_COLUMNS_CHANGED, this.onGridColumnsChanged.bind(this));
this.addDestroyableEventListener(eventService, events_1.Events.EVENT_MODEL_UPDATED, this.onModelUpdated.bind(this));
this.addListenersForCellComps();
};
RowComp.prototype.addListenersForCellComps = function () {
var _this = this;
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_ROW_INDEX_CHANGED, function () {
_this.forEachCellComp(function (cellComp) { return cellComp.onRowIndexChanged(); });
});
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_CELL_CHANGED, function (event) {
_this.forEachCellComp(function (cellComp) { return cellComp.onCellChanged(event); });
});
};
// when grid columns change, then all cells should be cleaned out,
// as the new columns could have same id as the previous columns and may conflict
RowComp.prototype.onGridColumnsChanged = function () {
this.removeRenderedCells(Object.keys(this.cellComps));
};
RowComp.prototype.onRowNodeDataChanged = function (event) {
// if this is an update, we want to refresh, as this will allow the user to put in a transition
// into the cellRenderer refresh method. otherwise this might be completely new data, in which case
// we will want to completely replace the cells
this.forEachCellComp(function (cellComp) {
return cellComp.refreshCell({
suppressFlash: !event.update,
newData: !event.update
});
});
// check for selected also, as this could be after lazy loading of the row data, in which case
// the id might of just gotten set inside the row and the row selected state may of changed
// as a result. this is what happens when selected rows are loaded in virtual pagination.
// - niall note - since moving to the stub component, this may no longer be true, as replacing
// the stub component now replaces the entire row
this.onRowSelected();
// as data has changed, then the style and class needs to be recomputed
this.postProcessCss();
};
RowComp.prototype.onRowNodeCellChanged = function (event) {
// as data has changed, then the style and class needs to be recomputed
this.postProcessCss();
};
RowComp.prototype.postProcessCss = function () {
this.postProcessStylesFromGridOptions();
this.postProcessClassesFromGridOptions();
this.postProcessRowClassRules();
this.postProcessRowDragging();
};
RowComp.prototype.onRowNodeDraggingChanged = function () {
this.postProcessRowDragging();
};
RowComp.prototype.postProcessRowDragging = function () {
var dragging = this.rowNode.dragging;
this.eAllRowContainers.forEach(function (row) { return utils_1._.addOrRemoveCssClass(row, 'ag-row-dragging', dragging); });
};
RowComp.prototype.onExpandedChanged = function () {
var rowNode = this.rowNode;
this.eAllRowContainers.forEach(function (row) { return utils_1._.addOrRemoveCssClass(row, 'ag-row-group-expanded', rowNode.expanded); });
this.eAllRowContainers.forEach(function (row) { return utils_1._.addOrRemoveCssClass(row, 'ag-row-group-contracted', !rowNode.expanded); });
};
RowComp.prototype.onDisplayedColumnsChanged = function () {
if (this.fullWidthRow) {
return;
}
this.refreshCells();
};
RowComp.prototype.destroyFullWidthComponents = function () {
if (this.fullWidthRowComponent) {
this.beans.detailRowCompCache.addOrDestroy(this.rowNode, null, this.fullWidthRowComponent);
this.fullWidthRowComponent = null;
}
if (this.fullWidthRowComponentBody) {
this.beans.detailRowCompCache.addOrDestroy(this.rowNode, null, this.fullWidthRowComponentBody);
this.fullWidthRowComponent = null;
}
if (this.fullWidthRowComponentLeft) {
this.beans.detailRowCompCache.addOrDestroy(this.rowNode, column_1.Column.PINNED_LEFT, this.fullWidthRowComponentLeft);
this.fullWidthRowComponentLeft = null;
}
if (this.fullWidthRowComponentRight) {
this.beans.detailRowCompCache.addOrDestroy(this.rowNode, column_1.Column.PINNED_RIGHT, this.fullWidthRowComponentRight);
this.fullWidthRowComponent = null;
}
};
RowComp.prototype.getContainerForCell = function (pinnedType) {
switch (pinnedType) {
case column_1.Column.PINNED_LEFT: return this.ePinnedLeftRow;
case column_1.Column.PINNED_RIGHT: return this.ePinnedRightRow;
default: return this.eBodyRow;
}
};
RowComp.prototype.onVirtualColumnsChanged = function () {
if (this.fullWidthRow) {
return;
}
this.refreshCells();
};
RowComp.prototype.onColumnResized = function () {
if (this.fullWidthRow) {
return;
}
this.refreshCells();
};
RowComp.prototype.refreshCells = function () {
if (!this.areAllContainersReady()) {
this.refreshNeeded = true;
return;
}
var suppressAnimationFrame = this.beans.gridOptionsWrapper.isSuppressAnimationFrame();
var skipAnimationFrame = suppressAnimationFrame || this.printLayout;
if (skipAnimationFrame) {
this.refreshCellsInAnimationFrame();
}
else {
if (this.columnRefreshPending) {
return;
}
this.beans.taskQueue.addP1Task(this.refreshCellsInAnimationFrame.bind(this), this.rowNode.rowIndex);
}
};
RowComp.prototype.refreshCellsInAnimationFrame = function () {
if (!this.active) {
return;
}
this.columnRefreshPending = false;
var centerCols;
var leftCols;
var rightCols;
if (this.printLayout) {
centerCols = this.beans.columnController.getAllDisplayedColumns();
leftCols = [];
rightCols = [];
}
else {
centerCols = this.beans.columnController.getAllDisplayedCenterVirtualColumnsForRow(this.rowNode);
leftCols = this.beans.columnController.getDisplayedLeftColumnsForRow(this.rowNode);
rightCols = this.beans.columnController.getDisplayedRightColumnsForRow(this.rowNode);
}
this.insertCellsIntoContainer(this.eBodyRow, centerCols);
this.insertCellsIntoContainer(this.ePinnedLeftRow, leftCols);
this.insertCellsIntoContainer(this.ePinnedRightRow, rightCols);
var colIdsToRemove = Object.keys(this.cellComps);
centerCols.forEach(function (col) { return utils_1._.removeFromArray(colIdsToRemove, col.getId()); });
leftCols.forEach(function (col) { return utils_1._.removeFromArray(colIdsToRemove, col.getId()); });
rightCols.forEach(function (col) { return utils_1._.removeFromArray(colIdsToRemove, col.getId()); });
// we never remove editing cells, as this would cause the cells to loose their values while editing
// as the grid is scrolling horizontally.
var eligibleToBeRemoved = utils_1._.filter(colIdsToRemove, this.isCellEligibleToBeRemoved.bind(this));
// remove old cells from gui, but we don't destroy them, we might use them again
this.removeRenderedCells(eligibleToBeRemoved);
};
RowComp.prototype.removeRenderedCells = function (colIds) {
var _this = this;
colIds.forEach(function (key) {
var cellComp = _this.cellComps[key];
// could be old reference, ie removed cell
if (utils_1._.missing(cellComp)) {
return;
}
cellComp.detach();
cellComp.destroy();
_this.cellComps[key] = null;
});
};
RowComp.prototype.isCellEligibleToBeRemoved = function (indexStr) {
var displayedColumns = this.beans.columnController.getAllDisplayedColumns();
var REMOVE_CELL = true;
var KEEP_CELL = false;
var renderedCell = this.cellComps[indexStr];
if (!renderedCell) {
return REMOVE_CELL;
}
// always remove the cell if it's in the wrong pinned location
if (this.isCellInWrongRow(renderedCell)) {
return REMOVE_CELL;
}
// we want to try and keep editing and focused cells
var editing = renderedCell.isEditing();
var focused = this.beans.focusedCellController.isCellFocused(renderedCell.getCellPosition());
var mightWantToKeepCell = editing || focused;
if (mightWantToKeepCell) {
var column = renderedCell.getColumn();
var cellStillDisplayed = displayedColumns.indexOf(column) >= 0;
return cellStillDisplayed ? KEEP_CELL : REMOVE_CELL;
}
return REMOVE_CELL;
};
RowComp.prototype.ensureCellInCorrectContainer = function (cellComp) {
// for print layout, we always put cells into centre, otherwise we put in correct pinned section
if (this.printLayout) {
return;
}
var element = cellComp.getGui();
var column = cellComp.getColumn();
var pinnedType = column.getPinned();
var eContainer = this.getContainerForCell(pinnedType);
// if in wrong container, remove it
var eOldContainer = cellComp.getParentRow();
var inWrongRow = eOldContainer !== eContainer;
if (inWrongRow) {
// take out from old row
if (eOldContainer) {
eOldContainer.removeChild(element);
}
eContainer.appendChild(element);
cellComp.setParentRow(eContainer);
}
};
RowComp.prototype.isCellInWrongRow = function (cellComp) {
var column = cellComp.getColumn();
var rowWeWant = this.getContainerForCell(column.getPinned());
// if in wrong container, remove it
var oldRow = cellComp.getParentRow();
return oldRow !== rowWeWant;
};
RowComp.prototype.insertCellsIntoContainer = function (eRow, cols) {
var _this = this;
if (!eRow) {
return;
}
var cellTemplates = [];
var newCellComps = [];
cols.forEach(function (col) {
var colId = col.getId();
var existingCell = _this.cellComps[colId];
if (existingCell) {
_this.ensureCellInCorrectContainer(existingCell);
}
else {
_this.createNewCell(col, eRow, cellTemplates, newCellComps);
}
});
if (cellTemplates.length > 0) {
utils_1._.appendHtml(eRow, cellTemplates.join(''));
this.callAfterRowAttachedOnCells(newCellComps, eRow);
}
};
RowComp.prototype.addDomData = function (eRowContainer) {
var gow = this.beans.gridOptionsWrapper;
gow.setDomData(eRowContainer, RowComp.DOM_DATA_KEY_RENDERED_ROW, this);
this.addDestroyFunc(function () {
gow.setDomData(eRowContainer, RowComp.DOM_DATA_KEY_RENDERED_ROW, null);
});
};
RowComp.prototype.createNewCell = function (col, eContainer, cellTemplates, newCellComps) {
var newCellComp = new cellComp_1.CellComp(this.scope, this.beans, col, this.rowNode, this, false, this.printLayout);
var cellTemplate = newCellComp.getCreateTemplate();
cellTemplates.push(cellTemplate);
newCellComps.push(newCellComp);
this.cellComps[col.getId()] = newCellComp;
newCellComp.setParentRow(eContainer);
};
RowComp.prototype.onMouseEvent = function (eventName, mouseEvent) {
switch (eventName) {
case 'dblclick':
this.onRowDblClick(mouseEvent);
break;
case 'click':
this.onRowClick(mouseEvent);
break;
}
};
RowComp.prototype.createRowEvent = function (type, domEvent) {
return {
type: type,
node: this.rowNode,
data: this.rowNode.data,
rowIndex: this.rowNode.rowIndex,
rowPinned: this.rowNode.rowPinned,
context: this.beans.gridOptionsWrapper.getContext(),
api: this.beans.gridOptionsWrapper.getApi(),
columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
event: domEvent
};
};
RowComp.prototype.createRowEventWithSource = function (type, domEvent) {
var event = this.createRowEvent(type, domEvent);
// when first developing this, we included the rowComp in the event.
// this seems very weird. so when introducing the event types, i left the 'source'
// out of the type, and just include the source in the two places where this event
// was fired (rowClicked and rowDoubleClicked). it doesn't make sense for any
// users to be using this, as the rowComp isn't an object we expose, so would be
// very surprising if a user was using it.
event.source = this;
return event;
};
RowComp.prototype.onRowDblClick = function (mouseEvent) {
if (utils_1._.isStopPropagationForAgGrid(mouseEvent)) {
return;
}
var agEvent = this.createRowEventWithSource(events_1.Events.EVENT_ROW_DOUBLE_CLICKED, mouseEvent);
this.beans.eventService.dispatchEvent(agEvent);
};
RowComp.prototype.onRowClick = function (mouseEvent) {
var stop = utils_1._.isStopPropagationForAgGrid(mouseEvent);
if (stop) {
return;
}
var agEvent = this.createRowEventWithSource(events_1.Events.EVENT_ROW_CLICKED, mouseEvent);
this.beans.eventService.dispatchEvent(agEvent);
// ctrlKey for windows, metaKey for Apple
var multiSelectKeyPressed = mouseEvent.ctrlKey || mouseEvent.metaKey;
var shiftKeyPressed = mouseEvent.shiftKey;
if (
// we do not allow selecting groups by clicking (as the click here expands the group), or if it's a detail row,
// so return if it's a group row
this.rowNode.group ||
// this is needed so we don't unselect other rows when we click this row, eg if this row is not selectable,
// and we click it, the selection should not change (ie any currently selected row should stay selected)
!this.rowNode.selectable ||
// we also don't allow selection of pinned rows
this.rowNode.rowPinned ||
// if no selection method enabled, do nothing
!this.beans.gridOptionsWrapper.isRowSelection() ||
// if click selection suppressed, do nothing
this.beans.gridOptionsWrapper.isSuppressRowClickSelection()) {
return;
}
var multiSelectOnClick = this.beans.gridOptionsWrapper.isRowMultiSelectWithClick();
var rowDeselectionWithCtrl = this.beans.gridOptionsWrapper.isRowDeselection();
if (this.rowNode.isSelected()) {
if (multiSelectOnClick) {
this.rowNode.setSelectedParams({ newValue: false });
}
else if (multiSelectKeyPressed) {
if (rowDeselectionWithCtrl) {
this.rowNode.setSelectedParams({ newValue: false });
}
}
else {
// selected with no multi key, must make sure anything else is unselected
this.rowNode.setSelectedParams({ newValue: true, clearSelection: true });
}
}
else {
var clearSelection = multiSelectOnClick ? false : !multiSelectKeyPressed;
this.rowNode.setSelectedParams({ newValue: true, clearSelection: clearSelection, rangeSelect: shiftKeyPressed });
}
};
RowComp.prototype.createFullWidthRowContainer = function (rowContainerComp, pinned, extraCssClass, cellRendererType, cellRendererName, eRowCallback, cellRendererCallback) {
var _this = this;
var rowTemplate = this.createTemplate('', extraCssClass);
rowContainerComp.appendRowTemplate(rowTemplate, function () {
var eRow = rowContainerComp.getRowElement(_this.getCompId());
var params = _this.createFullWidthParams(eRow, pinned);
var callback = function (cellRenderer) {
if (_this.isAlive()) {
var gui = cellRenderer.getGui();
eRow.appendChild(gui);
cellRendererCallback(cellRenderer);
}
else {
if (cellRenderer.destroy) {
cellRenderer.destroy();
}
}
};
// if doing master detail, it's possible we have a cached row comp from last time detail was displayed
var cachedRowComp = _this.beans.detailRowCompCache.get(_this.rowNode, pinned);
if (cachedRowComp) {
callback(cachedRowComp);
}
else {
var res = _this.beans.userComponentFactory.newFullWidthCellRenderer(params, cellRendererType, cellRendererName);
if (!res) {
console.error('ag-Grid: fullWidthCellRenderer not defined');
return;
}
res.then(callback);
}
_this.afterRowAttached(rowContainerComp, eRow);
eRowCallback(eRow);
_this.angular1Compile(eRow);
});
};
RowComp.prototype.angular1Compile = function (element) {
if (!this.scope) {
return;
}
this.beans.$compile(element)(this.scope);
};
RowComp.prototype.createFullWidthParams = function (eRow, pinned) {
var params = {
fullWidth: true,
data: this.rowNode.data,
node: this.rowNode,
value: this.rowNode.key,
$scope: this.scope ? this.scope : this.parentScope,
$compile: this.beans.$compile,
rowIndex: this.rowNode.rowIndex,
api: this.beans.gridOptionsWrapper.getApi(),
columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
context: this.beans.gridOptionsWrapper.getContext(),
// these need to be taken out, as part of 'afterAttached' now
eGridCell: eRow,
eParentOfValue: eRow,
pinned: pinned,
addRenderedRowListener: this.addEventListener.bind(this)
};
return params;
};
RowComp.prototype.getInitialRowClasses = function (extraCssClass) {
var classes = [];
var isTreeData = this.beans.gridOptionsWrapper.isTreeData();
var rowNode = this.rowNode;
if (utils_1._.exists(extraCssClass)) {
classes.push(extraCssClass);
}
classes.push('ag-row');
classes.push(this.rowFocused ? 'ag-row-focus' : 'ag-row-no-focus');
if (this.fadeRowIn) {
classes.push('ag-opacity-zero');
}
classes.push(this.rowIsEven ? 'ag-row-even' : 'ag-row-odd');
if (rowNode.isSelected()) {
classes.push('ag-row-selected');
}
if (rowNode.group) {
classes.push('ag-row-group');
// if a group, put the level of the group in
classes.push('ag-row-level-' + rowNode.level);
if (rowNode.footer) {
classes.push('ag-row-footer');
}
}
else {
// if a leaf, and a parent exists, put a level of the parent, else put level of 0 for top level item
classes.push('ag-row-level-' + (rowNode.parent ? (rowNode.parent.level + 1) : '0'));
}
if (rowNode.stub) {
classes.push('ag-row-stub');
}
if (this.fullWidthRow) {
classes.push('ag-full-width-row');
}
var addExpandedClass = isTreeData ?
// if doing tree data, we add the expanded classes if any children, as any node can be a parent
rowNode.allChildrenCount :
// if normal row grouping, we add expanded classes to groups only
rowNode.group && !rowNode.footer;
if (addExpandedClass) {
classes.push(rowNode.expanded ? 'ag-row-group-expanded' : 'ag-row-group-contracted');
}
if (rowNode.dragging) {
classes.push('ag-row-dragging');
}
utils_1._.pushAll(classes, this.processClassesFromGridOptions());
utils_1._.pushAll(classes, this.preProcessRowClassRules());
// we use absolute position unless we are doing print layout
classes.push(this.printLayout ? 'ag-row-position-relative' : 'ag-row-position-absolute');
this.firstRowOnPage = this.isFirstRowOnPage();
this.lastRowOnPage = this.isLastRowOnPage();
if (this.firstRowOnPage) {
classes.push('ag-row-first');
}
if (this.lastRowOnPage) {
classes.push('ag-row-last');
}
return classes;
};
RowComp.prototype.isFirstRowOnPage = function () {
return this.rowNode.rowIndex === this.beans.paginationProxy.getPageFirstRow();
};
RowComp.prototype.isLastRowOnPage = function () {
return this.rowNode.rowIndex === this.beans.paginationProxy.getPageLastRow();
};
RowComp.prototype.onModelUpdated = function () {
var newFirst = this.isFirstRowOnPage();
var newLast = this.isLastRowOnPage();
if (this.firstRowOnPage !== newFirst) {
this.firstRowOnPage = newFirst;
this.eAllRowContainers.forEach(function (row) { return utils_1._.addOrRemoveCssClass(row, 'ag-row-first', newFirst); });
}
if (this.lastRowOnPage !== newLast) {
this.lastRowOnPage = newLast;
this.eAllRowContainers.forEach(function (row) { return utils_1._.addOrRemoveCssClass(row, 'ag-row-last', newLast); });
}
};
RowComp.prototype.preProcessRowClassRules = function () {
var res = [];
this.processRowClassRules(function (className) {
res.push(className);
}, function (className) {
// not catered for, if creating, no need
// to remove class as it was never there
});
return res;
};
RowComp.prototype.processRowClassRules = function (onApplicableClass, onNotApplicableClass) {
this.beans.stylingService.processClassRules(this.beans.gridOptionsWrapper.rowClassRules(), {
value: undefined,
colDef: undefined,
data: this.rowNode.data,
node: this.rowNode,
rowIndex: this.rowNode.rowIndex,
api: this.beans.gridOptionsWrapper.getApi(),
columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
$scope: this.scope,
context: this.beans.gridOptionsWrapper.getContext()
}, onApplicableClass, onNotApplicableClass);
};
RowComp.prototype.stopEditing = function (cancel) {
if (cancel === void 0) { cancel = false; }
this.forEachCellComp(function (renderedCell) {
renderedCell.stopEditing(cancel);
});
if (!this.editingRow) {
return;
}
if (!cancel) {
var event_1 = this.createRowEvent(events_1.Events.EVENT_ROW_VALUE_CHANGED);
this.beans.eventService.dispatchEvent(event_1);
}
this.setEditingRow(false);
};
RowComp.prototype.setEditingRow = function (value) {
this.editingRow = value;
this.eAllRowContainers.forEach(function (row) { return utils_1._.addOrRemoveCssClass(row, 'ag-row-editing', value); });
var event = value ?
this.createRowEvent(events_1.Events.EVENT_ROW_EDITING_STARTED)
: this.createRowEvent(events_1.Events.EVENT_ROW_EDITING_STOPPED);
this.beans.eventService.dispatchEvent(event);
};
RowComp.prototype.startRowEditing = function (keyPress, charPress, sourceRenderedCell) {
if (keyPress === void 0) { keyPress = null; }
if (charPress === void 0) { charPress = null; }
if (sourceRenderedCell === void 0) { sourceRenderedCell = null; }
// don't do it if already editing
if (this.editingRow) {
return;
}
this.forEachCellComp(function (renderedCell) {
var cellStartedEdit = renderedCell === sourceRenderedCell;
if (cellStartedEdit) {
renderedCell.startEditingIfEnabled(keyPress, charPress, cellStartedEdit);
}
else {
renderedCell.startEditingIfEnabled(null, null, cellStartedEdit);
}
});
this.setEditingRow(true);
};
RowComp.prototype.forEachCellComp = function (callback) {
utils_1._.iterateObject(this.cellComps, function (key, cellComp) {
if (!cellComp) {
return;
}
callback(cellComp);
});
};
RowComp.prototype.postProcessClassesFromGridOptions = function () {
var _this = this;
var cssClasses = this.processClassesFromGridOptions();
if (!cssClasses || !cssClasses.length) {
return;
}
cssClasses.forEach(function (classStr) {
_this.eAllRowContainers.forEach(function (row) { return utils_1._.addCssClass(row, classStr); });
});
};
RowComp.prototype.postProcessRowClassRules = function () {
var _this = this;
this.processRowClassRules(function (className) {
_this.eAllRowContainers.forEach(function (row) { return utils_1._.addCssClass(row, className); });
}, function (className) {
_this.eAllRowContainers.forEach(function (row) { return utils_1._.removeCssClass(row, className); });
});
};
RowComp.prototype.processClassesFromGridOptions = function () {
var res = [];
var process = function (rowCls) {
if (typeof rowCls === 'string') {
res.push(rowCls);
}
else if (Array.isArray(rowCls)) {
rowCls.forEach(function (e) { return res.push(e); });
}
};
// part 1 - rowClass
var rowClass = this.beans.gridOptionsWrapper.getRowClass();
if (rowClass) {
if (typeof rowClass === 'function') {
console.warn('ag-Grid: rowClass should not be a function, please use getRowClass instead');
return;
}
process(rowClass);
}
// part 2 - rowClassFunc
var rowClassFunc = this.beans.gridOptionsWrapper.getRowClassFunc();
if (rowClassFunc) {
var params = {
node: this.rowNode,
data: this.rowNode.data,
rowIndex: this.rowNode.rowIndex,
context: this.beans.gridOptionsWrapper.getContext(),
api: this.beans.gridOptionsWrapper.getApi()
};
var rowClassFuncResult = rowClassFunc(params);
process(rowClassFuncResult);
}
return res;
};
RowComp.prototype.preProcessStylesFromGridOptions = function () {
var rowStyles = this.processStylesFromGridOptions();
return utils_1._.cssStyleObjectToMarkup(rowStyles);
};
RowComp.prototype.postProcessStylesFromGridOptions = function () {
var rowStyles = this.processStylesFromGridOptions();
this.eAllRowContainers.forEach(function (row) { return utils_1._.addStylesToElement(row, rowStyles); });
};
RowComp.prototype.processStylesFromGridOptions = function () {
// part 1 - rowStyle
var rowStyle = this.beans.gridOptionsWrapper.getRowStyle();
if (rowStyle && typeof rowStyle === 'function') {
console.warn('ag-Grid: rowStyle should be an object of key/value styles, not be a function, use getRowStyle() instead');
return;
}
// part 1 - rowStyleFunc
var rowStyleFunc = this.beans.gridOptionsWrapper.getRowStyleFunc();
var rowStyleFuncResult;
if (rowStyleFunc) {
var params = {
data: this.rowNode.data,
node: this.rowNode,
api: this.beans.gridOptionsWrapper.getApi(),
context: this.beans.gridOptionsWrapper.getContext(),
$scope: this.scope
};
rowStyleFuncResult = rowStyleFunc(params);
}
return utils_1._.assign({}, rowStyle, rowStyleFuncResult);
};
RowComp.prototype.createCells = function (cols) {
var _this = this;
var templateParts = [];
var newCellComps = [];
cols.forEach(function (col) {
var newCellComp = new cellComp_1.CellComp(_this.scope, _this.beans, col, _this.rowNode, _this, false, _this.printLayout);
var cellTemplate = newCellComp.getCreateTemplate();
templateParts.push(cellTemplate);
newCellComps.push(newCellComp);
_this.cellComps[col.getId()] = newCellComp;
});
var templateAndComps = {
template: templateParts.join(''),
cellComps: newCellComps
};
return templateAndComps;
};
RowComp.prototype.onRowSelected = function () {
var selected = this.rowNode.isSelected();
this.eAllRowContainers.forEach(function (row) { return utils_1._.addOrRemoveCssClass(row, 'ag-row-selected', selected); });
};
// called:
// + after row created for first time
// + after horizontal scroll, so new cells due to column virtualisation
RowComp.prototype.callAfterRowAttachedOnCells = function (newCellComps, eRow) {
var _this = this;
newCellComps.forEach(function (cellComp) {
cellComp.setParentRow(eRow);
cellComp.afterAttached();
// if we are editing the row, then the cell needs to turn
// into edit mode
if (_this.editingRow) {
cellComp.startEditingIfEnabled();
}
});
};
RowComp.prototype.afterRowAttached = function (rowContainerComp, eRow) {
var _this = this;
this.addDomData(eRow);
this.removeSecondPassFuncs.push(function () {
rowContainerComp.removeRowElement(eRow);
});
this.removeFirstPassFuncs.push(function () {
if (utils_1._.exists(_this.rowNode.rowTop)) {
// the row top is updated anyway, however we set it here again
// to something more reasonable for the animation - ie if the
// row top is 10000px away, the row will flash out, so this
// gives it a rounded value, so row animates out more slowly
var rowTop = _this.roundRowTopToBounds(_this.rowNode.rowTop);
_this.setRowTop(rowTop);
}
else {
utils_1._.addCssClass(eRow, 'ag-opacity-zero');
}
});
this.eAllRowContainers.push(eRow);
// adding hover functionality adds listener to this row, so we
// do it lazily in an animation frame
if (this.useAnimationFrameForCreate) {
this.beans.taskQueue.addP2Task(this.addHoverFunctionality.bind(this, eRow));
}
else {
this.addHoverFunctionality(eRow);
}
};
RowComp.prototype.addHoverFunctionality = function (eRow) {
var _this = this;
// because we use animation frames to do this, it's possible the row no longer exists
// by the time we get to add it
if (!this.active) {
return;
}
// because mouseenter and mouseleave do not propagate, we cannot listen on the gridPanel
// like we do for all the other mouse events.
// because of the pinning, we cannot simply add / remove the class based on the eRow. we
// have to check all eRow's (body & pinned). so the trick is if any of the rows gets a
// mouse hover, it sets such in the rowNode, and then all three reflect the change as
// all are listening for event on the row node.
// step 1 - add listener, to set flag on row node
this.addDestroyableEventListener(eRow, 'mouseenter', function () { return _this.rowNode.onMouseEnter(); });
this.addDestroyableEventListener(eRow, 'mouseleave', function () { return _this.rowNode.onMouseLeave(); });
// step 2 - listen for changes on row node (which any eRow can trigger)
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_MOUSE_ENTER, function () {
// if hover turned off, we don't add the class. we do this here so that if the application
// toggles this property mid way, we remove the hover form the last row, but we stop
// adding hovers from that point onwards.
if (!_this.beans.gridOptionsWrapper.isSuppressRowHoverHighlight()) {
utils_1._.addCssClass(eRow, 'ag-row-hover');
}
});
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_MOUSE_LEAVE, function () {
utils_1._.removeCssClass(eRow, 'ag-row-hover');
});
};
// for animation, we don't want to animate entry or exit to a very far away pixel,
// otherwise the row would move so fast, it would appear to disappear. so this method
// moves the row closer to the viewport if it is far away, so the row slide in / out
// at a speed the user can see.
RowComp.prototype.roundRowTopToBounds = function (rowTop) {
var range = this.beans.gridPanel.getVScrollPosition();
var minPixel = this.applyPaginationOffset(range.top, true) - 100;
var maxPixel = this.applyPaginationOffset(range.bottom, true) + 100;
return Math.min(Math.max(minPixel, rowTop), maxPixel);
};
RowComp.prototype.getFrameworkOverrides = function () {
return this.beans.frameworkOverrides;
};
RowComp.prototype.onRowHeightChanged = function () {
// check for exists first - if the user is resetting the row height, then
// it will be null (or undefined) momentarily until the next time the flatten
// stage is called where the row will then update again with a new height
if (utils_1._.exists(this.rowNode.rowHeight)) {
var heightPx_1 = this.rowNode.rowHeight + "px";
this.eAllRowContainers.forEach(function (row) { return row.style.height = heightPx_1; });
}
};
RowComp.prototype.addEventListener = function (eventType, listener) {
if (eventType === 'renderedRowRemoved' || eventType === 'rowRemoved') {
eventType = events_1.Events.EVENT_VIRTUAL_ROW_REMOVED;
console.warn('ag-Grid: Since version 11, event renderedRowRemoved is now called ' + events_1.Events.EVENT_VIRTUAL_ROW_REMOVED);
}
_super.prototype.addEventListener.call(this, eventType, listener);
};
RowComp.prototype.removeEventListener = function (eventType, listener) {
if (eventType === 'renderedRowRemoved' || eventType === 'rowRemoved') {
eventType = events_1.Events.EVENT_VIRTUAL_ROW_REMOVED;
console.warn('ag-Grid: Since version 11, event renderedRowRemoved and rowRemoved is now called ' + events_1.Events.EVENT_VIRTUAL_ROW_REMOVED);
}
_super.prototype.removeEventListener.call(this, eventType, listener);
};
RowComp.prototype.destroy = function (animate) {
if (animate === void 0) { animate = false; }
_super.prototype.destroy.call(this);
this.active = false;
// why do we have this method? shouldn't everything below be added as a destroy func beside
// the corresponding create logic?
this.destroyFullWidthComponents();
if (animate) {
this.removeFirstPassFuncs.forEach(function (func) { return func(); });
this.removeSecondPassFuncs.push(this.destroyContainingCells.bind(this));
}
else {
this.destroyContainingCells();
// we are not animating, so execute the second stage of removal now.
// we call getAndClear, so that they are only called once
var delayedDestroyFunctions = this.getAndClearDelayedDestroyFunctions();
delayedDestroyFunctions.forEach(function (func) { return func(); });
}
var event = this.createRowEvent(events_1.Events.EVENT_VIRTUAL_ROW_REMOVED);
this.dispatchEvent(event);
this.beans.eventService.dispatchEvent(event);
};
RowComp.prototype.destroyContainingCells = function () {
this.forEachCellComp(function (renderedCell) { return renderedCell.destroy(); });
this.destroyFullWidthComponents();
};
// we clear so that the functions are never executed twice
RowComp.prototype.getAndClearDelayedDestroyFunctions = function () {
var result = this.removeSecondPassFuncs;
this.removeSecondPassFuncs = [];
return result;
};
RowComp.prototype.onCellFocusChanged = function () {
var rowFocused = this.beans.focusedCellController.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned);
if (rowFocused !== this.rowFocused) {
this.eAllRowContainers.forEach(function (row) { return utils_1._.addOrRemoveCssClass(row, 'ag-row-focus', rowFocused); });
this.eAllRowContainers.forEach(function (row) { return utils_1._.addOrRemoveCssClass(row, 'ag-row-no-focus', !rowFocused); });
this.rowFocused = rowFocused;
}
// if we are editing, then moving the focus out of a row will stop editing
if (!rowFocused && this.editingRow) {
this.stopEditing(false);
}
};
RowComp.prototype.onPaginationChanged = function () {
var currentPage = this.beans.paginationProxy.getCurrentPage();
// it is possible this row is in the new page, but the page number has changed, which means
// it needs to reposition itself relative to the new page
if (this.paginationPage !== currentPage) {
this.paginationPage = currentPage;
this.onTopChanged();
}
};
RowComp.prototype.onTopChanged = function () {
this.setRowTop(this.rowNode.rowTop);
};
// applies pagination offset, eg if on second page, and page height is 500px, then removes
// 500px from the top position, so a row with rowTop 600px is displayed at location 100px.
// reverse will take the offset away rather than add.
RowComp.prototype.applyPaginationOffset = function (topPx, reverse) {
if (reverse === void 0) { reverse = false; }
if (this.rowNode.isRowPinned()) {
return topPx;
}
var pixelOffset = this.beans.paginationProxy.getPixelOffset();
var multiplier = reverse ? 1 : -1;
return topPx + (pixelOffset * multiplier);
};
RowComp.prototype.setRowTop = function (pixels) {
// print layout uses normal flow layout for row positioning
if (this.printLayout) {
return;
}
// need to make sure rowTop is not null, as this can happen if the node was once
// visible (ie parent group was expanded) but is now not visible
if (utils_1._.exists(pixels)) {
var afterPaginationPixels = this.applyPaginationOffset(pixels);
var afterScalingPixels = this.beans.maxDivHeightScaler.getRealPixelPosition(afterPaginationPixels);
var topPx_1 = afterScalingPixels + "px";
if (this.beans.gridOptionsWrapper.isSuppressRowTransform()) {
this.eAllRowContainers.forEach(function (row) { return row.style.top = topPx_1; });
}
else {
this.eAllRowContainers.forEach(function (row) { return row.style.transform = "translateY(" + topPx_1 + ")"; });
}
}
};
// we clear so that the functions are never executed twice
RowComp.prototype.getAndClearNextVMTurnFunctions = function () {
var result = this.createSecondPassFuncs;
this.createSecondPassFuncs = [];
return result;
};
RowComp.prototype.getRowNode = function () {
return this.rowNode;
};
RowComp.prototype.getRenderedCellForColumn = function (column) {
var _this = this;
var cellComp = this.cellComps[column.getColId()];
if (cellComp) {
return cellComp;
}
var spanList = Object.keys(this.cellComps)
.map(function (name) { return _this.cellComps[name]; })
.filter(function (cmp) { return cmp && cmp.getColSpanningList().indexOf(column) !== -1; });
return spanList.length ? spanList[0] : undefined;
};
RowComp.prototype.onRowIndexChanged = function () {
this.onCellFocusChanged();
this.updateRowIndexes();
};
RowComp.prototype.updateRowIndexes = function () {
var _this = this;
var rowIndexStr = this.rowNode.getRowIndexString();
var rowIsEven = this.rowNode.rowIndex % 2 === 0;
var rowIsEvenChanged = this.rowIsEven !== rowIsEven;
var headerRowCount = this.beans.gridPanel.headerRootComp.getHeaderRowCount();
if (rowIsEvenChanged) {
this.rowIsEven = rowIsEven;
}
this.eAllRowContainers.forEach(function (eRow) {
eRow.setAttribute('row-index', rowIndexStr);
eRow.setAttribute('aria-rowindex', (headerRowCount + _this.rowNode.rowIndex + 1).toString());
if (!rowIsEvenChanged) {
return;
}
utils_1._.addOrRemoveCssClass(eRow, 'ag-row-even', rowIsEven);
utils_1._.addOrRemoveCssClass(eRow, 'ag-row-odd', !rowIsEven);
});
};
RowComp.prototype.ensureDomOrder = function () {
var sides = [
{
el: this.getBodyRowElement(),
ct: this.bodyContainerComp
},
{
el: this.getPinnedLeftRowElement(),
ct: this.pinnedLeftContainerComp
}, {
el: this.getPinnedRightRowElement(),
ct: this.pinnedRightContainerComp
}, {
el: this.getFullWidthRowElement(),
ct: this.fullWidthContainerComp
}
];
sides.forEach(function (side) {
if (!side.el) {
return;
}
side.ct.ensureDomOrder(side.el);
});
};
// returns the pinned left container, either the normal one, or the embedded full with one if exists
RowComp.prototype.getPinnedLeftRowElement = function () {
return this.ePinnedLeftRow ? this.ePinnedLeftRow : this.eFullWidthRowLeft;
};
// returns the pinned right container, either the normal one, or the embedded full with one if exists
RowComp.prototype.getPinnedRightRowElement = function () {
return this.ePinnedRightRow ? this.ePinnedRightRow : this.eFullWidthRowRight;
};
// returns the body container, either the normal one, or the embedded full with one if exists
RowComp.prototype.getBodyRowElement = function () {
return this.eBodyRow ? this.eBodyRow : this.eFullWidthRowBody;
};
// returns the full width container
RowComp.prototype.getFullWidthRowElement = function () {
return this.eFullWidthRow;
};
RowComp.DOM_DATA_KEY_RENDERED_ROW = 'renderedRow';
RowComp.FULL_WIDTH_CELL_RENDERER = 'fullWidthCellRenderer';
RowComp.GROUP_ROW_RENDERER = 'groupRowRenderer';
RowComp.GROUP_ROW_RENDERER_COMP_NAME = 'agGroupRowRenderer';
RowComp.LOADING_CELL_RENDERER = 'loadingCellRenderer';
RowComp.LOADING_CELL_RENDERER_COMP_NAME = 'agLoadingCellRenderer';
RowComp.DETAIL_CELL_RENDERER = 'detailCellRenderer';
RowComp.DETAIL_CELL_RENDERER_COMP_NAME = 'agDetailCellRenderer';
return RowComp;
}(component_1.Component));
exports.RowComp = RowComp;
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var column_1 = __webpack_require__(23);
var constants_1 = __webpack_require__(8);
var events_1 = __webpack_require__(15);
var component_1 = __webpack_require__(33);
var checkboxSelectionComponent_1 = __webpack_require__(35);
var iRangeController_1 = __webpack_require__(41);
var rowDragComp_1 = __webpack_require__(42);
var popupEditorWrapper_1 = __webpack_require__(46);
var utils_1 = __webpack_require__(5);
var dndSourceComp_1 = __webpack_require__(48);
var CellComp = /** @class */ (function (_super) {
__extends(CellComp, _super);
function CellComp(scope, beans, column, rowNode, rowComp, autoHeightCell, printLayout) {
var _this = _super.call(this) || this;
_this.editingCell = false;
_this.suppressRefreshCell = false;
_this.scope = null;
// every time we go into edit mode, or back again, this gets incremented.
// it's the components way of dealing with the async nature of framework components,
// so if a framework component takes a while to be created, we know if the object
// is still relevant when creating is finished. eg we could click edit / un-edit 20
// times before the first React edit component comes back - we should discard
// the first 19.
_this.cellEditorVersion = 0;
_this.cellRendererVersion = 0;
_this.scope = scope;
_this.beans = beans;
_this.column = column;
_this.rowNode = rowNode;
_this.rowComp = rowComp;
_this.autoHeightCell = autoHeightCell;
_this.printLayout = printLayout;
_this.createGridCellVo();
_this.rangeSelectionEnabled = beans.gridOptionsWrapper.isEnableRangeSelection();
_this.cellFocused = _this.beans.focusedCellController.isCellFocused(_this.cellPosition);
_this.firstRightPinned = _this.column.isFirstRightPinned();
_this.lastLeftPinned = _this.column.isLastLeftPinned();
if (_this.rangeSelectionEnabled) {
var rangeController = _this.beans.rangeController;
_this.rangeCount = rangeController.getCellRangeCount(_this.cellPosition);
if (_this.rangeCount) {
_this.hasChartRange = rangeController.getCellRanges().every(function (range) { return utils_1._.exists(range.type); });
}
}
_this.getValueAndFormat();
_this.setUsingWrapper();
_this.chooseCellRenderer();
_this.setupColSpan();
_this.rowSpan = _this.column.getRowSpan(_this.rowNode);
return _this;
}
CellComp.prototype.getCreateTemplate = function () {
var unselectable = !this.beans.gridOptionsWrapper.isEnableCellTextSelection() ? 'unselectable="on"' : '';
var templateParts = [];
var col = this.column;
var width = this.getCellWidth();
var left = this.modifyLeftForPrintLayout(this.getCellLeft());
var valueToRender = this.getInitialValueToRender();
var valueSanitised = utils_1._.get(this.column, 'colDef.template', null) ? valueToRender : utils_1._.escape(valueToRender);
this.tooltip = this.getToolTip();
var tooltipSanitised = utils_1._.escape(this.tooltip);
var colIdSanitised = utils_1._.escape(col.getId());
var wrapperStartTemplate = '';
var wrapperEndTemplate = '';
var stylesFromColDef = this.preProcessStylesFromColDef();
var cssClasses = this.getInitialCssClasses();
var stylesForRowSpanning = this.getStylesForRowSpanning();
if (this.usingWrapper) {
wrapperStartTemplate = "";
wrapperEndTemplate = '
';
}
templateParts.push("");
templateParts.push(wrapperStartTemplate);
if (utils_1._.exists(valueSanitised, true)) {
templateParts.push(valueSanitised);
}
templateParts.push(wrapperEndTemplate);
templateParts.push("
");
return templateParts.join('');
};
CellComp.prototype.getStylesForRowSpanning = function () {
if (this.rowSpan === 1) {
return '';
}
var singleRowHeight = this.beans.gridOptionsWrapper.getRowHeightAsNumber();
var totalRowHeight = singleRowHeight * this.rowSpan;
return "height: " + totalRowHeight + "px; z-index: 1;";
};
CellComp.prototype.afterAttached = function () {
var querySelector = "[comp-id=\"" + this.getCompId() + "\"]";
var eGui = this.eParentRow.querySelector(querySelector);
this.setGui(eGui);
// all of these have dependencies on the eGui, so only do them after eGui is set
this.addDomData();
this.populateTemplate();
this.createCellRendererInstance(true);
this.angular1Compile();
// if not doing enterprise, then range selection service would be missing
// so need to check before trying to use it
if (this.rangeSelectionEnabled) {
if (this.shouldHaveSelectionHandle()) {
this.addSelectionHandle();
}
}
if (utils_1._.exists(this.tooltip) && !this.beans.gridOptionsWrapper.isEnableBrowserTooltips()) {
this.beans.tooltipManager.registerTooltip(this);
}
};
CellComp.prototype.onColumnHover = function () {
var isHovered = this.beans.columnHoverService.isHovered(this.column);
utils_1._.addOrRemoveCssClass(this.getGui(), 'ag-column-hover', isHovered);
};
CellComp.prototype.onCellChanged = function (event) {
var eventImpactsThisCell = event.column === this.column;
if (eventImpactsThisCell) {
this.refreshCell({});
}
};
CellComp.prototype.getCellLeft = function () {
var mostLeftCol;
if (this.beans.gridOptionsWrapper.isEnableRtl() && this.colsSpanning) {
mostLeftCol = utils_1._.last(this.colsSpanning);
}
else {
mostLeftCol = this.column;
}
return mostLeftCol.getLeft();
};
CellComp.prototype.getCellWidth = function () {
if (!this.colsSpanning) {
return this.column.getActualWidth();
}
var result = 0;
this.colsSpanning.forEach(function (col) { return result += col.getActualWidth(); });
return result;
};
CellComp.prototype.onFlashCells = function (event) {
var cellId = this.beans.cellPositionUtils.createId(this.cellPosition);
var shouldFlash = event.cells[cellId];
if (shouldFlash) {
this.animateCell('highlight');
}
};
CellComp.prototype.setupColSpan = function () {
// if no col span is active, then we don't set it up, as it would be wasteful of CPU
if (utils_1._.missing(this.getComponentHolder().colSpan)) {
return;
}
// because we are col spanning, a reorder of the cols can change what cols we are spanning over
this.addDestroyableEventListener(this.beans.eventService, events_1.Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayColumnsChanged.bind(this));
// because we are spanning over multiple cols, we check for width any time any cols width changes.
// this is expensive - really we should be explicitly checking only the cols we are spanning over
// instead of every col, however it would be tricky code to track the cols we are spanning over, so
// because hardly anyone will be using colSpan, am favouring this easier way for more maintainable code.
this.addDestroyableEventListener(this.beans.eventService, events_1.Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onWidthChanged.bind(this));
this.colsSpanning = this.getColSpanningList();
};
CellComp.prototype.getColSpanningList = function () {
var colSpan = this.column.getColSpan(this.rowNode);
var colsSpanning = [];
// if just one col, the col span is just the column we are in
if (colSpan === 1) {
colsSpanning.push(this.column);
}
else {
var pointer = this.column;
var pinned = this.column.getPinned();
for (var i = 0; pointer && i < colSpan; i++) {
colsSpanning.push(pointer);
pointer = this.beans.columnController.getDisplayedColAfter(pointer);
if (!pointer || utils_1._.missing(pointer)) {
break;
}
// we do not allow col spanning to span outside of pinned areas
if (pinned !== pointer.getPinned()) {
break;
}
}
}
return colsSpanning;
};
CellComp.prototype.onDisplayColumnsChanged = function () {
var colsSpanning = this.getColSpanningList();
if (!utils_1._.compareArrays(this.colsSpanning, colsSpanning)) {
this.colsSpanning = colsSpanning;
this.onWidthChanged();
this.onLeftChanged(); // left changes when doing RTL
}
};
CellComp.prototype.getInitialCssClasses = function () {
var cssClasses = ["ag-cell", "ag-cell-not-inline-editing"];
// if we are putting the cell into a dummy container, to work out it's height,
// then we don't put the height css in, as we want cell to fit height in that case.
if (!this.autoHeightCell) {
cssClasses.push('ag-cell-with-height');
}
var doingFocusCss = !this.beans.gridOptionsWrapper.isSuppressCellSelection();
if (doingFocusCss && this.cellFocused) {
// otherwise the class depends on the focus state
cssClasses.push('ag-cell-focus');
}
if (this.firstRightPinned) {
cssClasses.push('ag-cell-first-right-pinned');
}
if (this.lastLeftPinned) {
cssClasses.push('ag-cell-last-left-pinned');
}
if (this.beans.columnHoverService.isHovered(this.column)) {
cssClasses.push('ag-column-hover');
}
utils_1._.pushAll(cssClasses, this.preProcessClassesFromColDef());
utils_1._.pushAll(cssClasses, this.preProcessCellClassRules());
utils_1._.pushAll(cssClasses, this.getInitialRangeClasses());
// if using the wrapper, this class goes on the wrapper instead
if (!this.usingWrapper) {
cssClasses.push('ag-cell-value');
}
return cssClasses;
};
CellComp.prototype.getInitialValueToRender = function () {
// if using a cellRenderer, then render the html from the cell renderer if it exists
if (this.usingCellRenderer) {
if (typeof this.cellRendererGui === 'string') {
return this.cellRendererGui;
}
else {
return '';
}
}
var colDef = this.getComponentHolder();
if (colDef.template) {
// template is really only used for angular 1 - as people using ng1 are used to providing templates with
// bindings in it. in ng2, people will hopefully want to provide components, not templates.
return colDef.template;
}
else if (colDef.templateUrl) {
// likewise for templateUrl - it's for ng1 really - when we move away from ng1, we can take these out.
// niall was pro angular 1 when writing template and templateUrl, if writing from scratch now, would
// not do these, but would follow a pattern that was friendly towards components, not templates.
var template = this.beans.templateService.getTemplate(colDef.templateUrl, this.refreshCell.bind(this, true));
if (template) {
return template;
}
else {
return '';
}
}
else {
return this.getValueToUse();
}
};
CellComp.prototype.getRenderedRow = function () {
return this.rowComp;
};
CellComp.prototype.isSuppressNavigable = function () {
return this.column.isSuppressNavigable(this.rowNode);
};
CellComp.prototype.getCellRenderer = function () {
return this.cellRenderer;
};
CellComp.prototype.getCellEditor = function () {
return this.cellEditor;
};
// + stop editing {forceRefresh: true, suppressFlash: true}
// + event cellChanged {}
// + cellRenderer.params.refresh() {} -> method passes 'as is' to the cellRenderer, so params could be anything
// + rowComp: event dataChanged {animate: update, newData: !update}
// + rowComp: api refreshCells() {animate: true/false}
// + rowRenderer: api softRefreshView() {}
CellComp.prototype.refreshCell = function (params) {
// if we are in the middle of 'stopEditing', then we don't refresh here, as refresh gets called explicitly
if (this.suppressRefreshCell || this.editingCell) {
return;
}
var colDef = this.getComponentHolder();
var newData = params && params.newData;
var suppressFlash = (params && params.suppressFlash) || colDef.suppressCellFlash;
var forceRefresh = params && params.forceRefresh;
var oldValue = this.value;
this.getValueAndFormat();
// for simple values only (not pojo's), see if the value is the same, and if it is, skip the refresh.
// when never allow skipping after an edit, as after editing, we need to put the GUI back to the way
// if was before the edit.
var valuesDifferent = !this.valuesAreEqual(oldValue, this.value);
var dataNeedsUpdating = forceRefresh || valuesDifferent;
if (dataNeedsUpdating) {
// if it's 'new data', then we don't refresh the cellRenderer, even if refresh method is available.
// this is because if the whole data is new (ie we are showing stock price 'BBA' now and not 'SSD')
// then we are not showing a movement in the stock price, rather we are showing different stock.
var cellRendererRefreshed = newData ? false : this.attemptCellRendererRefresh();
// we do the replace if not doing refresh, or if refresh was unsuccessful.
// the refresh can be unsuccessful if we are using a framework (eg ng2 or react) and the framework
// wrapper has the refresh method, but the underlying component doesn't
if (!cellRendererRefreshed) {
this.replaceContentsAfterRefresh();
}
// we don't want to flash the cells when processing a filter change, as otherwise the UI would
// be to busy. see comment in FilterManager with regards processingFilterChange
var processingFilterChange = this.beans.filterManager.isSuppressFlashingCellsBecauseFiltering();
var flashCell = !suppressFlash && !processingFilterChange &&
(this.beans.gridOptionsWrapper.isEnableCellChangeFlash() || colDef.enableCellChangeFlash);
if (flashCell) {
this.flashCell();
}
// need to check rules. note, we ignore colDef classes and styles, these are assumed to be static
this.postProcessStylesFromColDef();
this.postProcessClassesFromColDef();
}
// we can't readily determine if the data in an angularjs template has changed, so here we just update
// and recompile (if applicable)
this.updateAngular1ScopeAndCompile();
this.refreshToolTip();
// we do cellClassRules even if the value has not changed, so that users who have rules that
// look at other parts of the row (where the other part of the row might of changed) will work.
this.postProcessCellClassRules();
};
// user can also call this via API
CellComp.prototype.flashCell = function () {
this.animateCell('data-changed');
};
CellComp.prototype.animateCell = function (cssName) {
var fullName = 'ag-cell-' + cssName;
var animationFullName = 'ag-cell-' + cssName + '-animation';
var element = this.getGui();
// we want to highlight the cells, without any animation
utils_1._.addCssClass(element, fullName);
utils_1._.removeCssClass(element, animationFullName);
// then once that is applied, we remove the highlight with animation
window.setTimeout(function () {
utils_1._.removeCssClass(element, fullName);
utils_1._.addCssClass(element, animationFullName);
window.setTimeout(function () {
// and then to leave things as we got them, we remove the animation
utils_1._.removeCssClass(element, animationFullName);
}, 1000);
}, 500);
};
CellComp.prototype.replaceContentsAfterRefresh = function () {
// otherwise we rip out the cell and replace it
utils_1._.clearElement(this.eParentOfValue);
// remove old renderer component if it exists
if (this.cellRenderer && this.cellRenderer.destroy) {
this.cellRenderer.destroy();
}
this.cellRenderer = null;
this.cellRendererGui = null;
// populate
this.putDataIntoCellAfterRefresh();
this.updateAngular1ScopeAndCompile();
};
CellComp.prototype.updateAngular1ScopeAndCompile = function () {
if (this.beans.gridOptionsWrapper.isAngularCompileRows() && this.scope) {
this.scope.data = __assign({}, this.rowNode.data);
this.angular1Compile();
}
};
CellComp.prototype.angular1Compile = function () {
// if angular compiling, then need to also compile the cell again (angular compiling sucks, please wait...)
if (this.beans.gridOptionsWrapper.isAngularCompileRows()) {
var eGui = this.getGui();
// only compile the node if it hasn't already been done
// this prevents "orphaned" node leaks
if (!eGui.classList.contains('ng-scope') || eGui.childElementCount === 0) {
var compiledElement_1 = this.beans.$compile(eGui)(this.scope);
this.addDestroyFunc(function () {
compiledElement_1.remove();
});
}
}
};
CellComp.prototype.postProcessStylesFromColDef = function () {
var stylesToUse = this.processStylesFromColDef();
if (stylesToUse) {
utils_1._.addStylesToElement(this.getGui(), stylesToUse);
}
};
CellComp.prototype.preProcessStylesFromColDef = function () {
var stylesToUse = this.processStylesFromColDef();
return utils_1._.cssStyleObjectToMarkup(stylesToUse);
};
CellComp.prototype.processStylesFromColDef = function () {
var colDef = this.getComponentHolder();
if (colDef.cellStyle) {
var cssToUse = void 0;
if (typeof colDef.cellStyle === 'function') {
var cellStyleParams = {
value: this.value,
data: this.rowNode.data,
node: this.rowNode,
colDef: colDef,
column: this.column,
$scope: this.scope,
context: this.beans.gridOptionsWrapper.getContext(),
api: this.beans.gridOptionsWrapper.getApi()
};
var cellStyleFunc = colDef.cellStyle;
cssToUse = cellStyleFunc(cellStyleParams);
}
else {
cssToUse = colDef.cellStyle;
}
return cssToUse;
}
};
CellComp.prototype.postProcessClassesFromColDef = function () {
var _this = this;
this.processClassesFromColDef(function (className) { return utils_1._.addCssClass(_this.getGui(), className); });
};
CellComp.prototype.preProcessClassesFromColDef = function () {
var res = [];
this.processClassesFromColDef(function (className) { return res.push(className); });
return res;
};
CellComp.prototype.processClassesFromColDef = function (onApplicableClass) {
var colDef = this.getComponentHolder();
this.beans.stylingService.processStaticCellClasses(colDef, {
value: this.value,
data: this.rowNode.data,
node: this.rowNode,
colDef: colDef,
rowIndex: this.rowNode.rowIndex,
$scope: this.scope,
api: this.beans.gridOptionsWrapper.getApi(),
columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
context: this.beans.gridOptionsWrapper.getContext()
}, onApplicableClass);
};
CellComp.prototype.putDataIntoCellAfterRefresh = function () {
// template gets preference, then cellRenderer, then do it ourselves
var colDef = this.getComponentHolder();
if (colDef.template) {
// template is really only used for angular 1 - as people using ng1 are used to providing templates with
// bindings in it. in ng2, people will hopefully want to provide components, not templates.
this.eParentOfValue.innerHTML = colDef.template;
}
else if (colDef.templateUrl) {
// likewise for templateUrl - it's for ng1 really - when we move away from ng1, we can take these out.
// niall was pro angular 1 when writing template and templateUrl, if writing from scratch now, would
// not do these, but would follow a pattern that was friendly towards components, not templates.
var template = this.beans.templateService.getTemplate(colDef.templateUrl, this.refreshCell.bind(this, true));
if (template) {
this.eParentOfValue.innerHTML = template;
}
}
else {
// we can switch from using a cell renderer back to the default if a user
// is using cellRendererSelect
this.chooseCellRenderer();
if (this.usingCellRenderer) {
this.createCellRendererInstance();
}
else {
var valueToUse = this.getValueToUse();
if (valueToUse !== null && valueToUse !== undefined) {
this.eParentOfValue.innerHTML = utils_1._.escape(valueToUse);
}
}
}
};
CellComp.prototype.attemptCellRendererRefresh = function () {
if (utils_1._.missing(this.cellRenderer) || !this.cellRenderer || utils_1._.missing(this.cellRenderer.refresh)) {
return false;
}
// if the cell renderer has a refresh method, we call this instead of doing a refresh
var params = this.createCellRendererParams();
// take any custom params off of the user
var finalParams = this.beans.userComponentFactory.createFinalParams(this.getComponentHolder(), this.cellRendererType, params);
var result = this.cellRenderer.refresh(finalParams);
// NOTE on undefined: previous version of the cellRenderer.refresh() interface
// returned nothing, if the method existed, we assumed it refreshed. so for
// backwards compatibility, we assume if method exists and returns nothing,
// that it was successful.
return result === true || result === undefined;
};
CellComp.prototype.refreshToolTip = function () {
var newTooltip = this.getToolTip();
if (this.tooltip === newTooltip) {
return;
}
var hasNewTooltip = utils_1._.exists(newTooltip);
var hadTooltip = utils_1._.exists(this.tooltip);
if (hasNewTooltip && this.tooltip === newTooltip.toString()) {
return;
}
this.tooltip = newTooltip;
if (this.beans.gridOptionsWrapper.isEnableBrowserTooltips()) {
if (hasNewTooltip) {
var tooltipSanitised = utils_1._.escape(this.tooltip);
this.eParentOfValue.setAttribute('title', tooltipSanitised);
}
else {
this.eParentOfValue.removeAttribute('title');
}
}
else {
if (hadTooltip) {
if (!hasNewTooltip) {
this.beans.tooltipManager.unregisterTooltip(this);
}
}
else if (hasNewTooltip) {
this.beans.tooltipManager.registerTooltip(this);
}
}
};
CellComp.prototype.valuesAreEqual = function (val1, val2) {
// if the user provided an equals method, use that, otherwise do simple comparison
var colDef = this.getComponentHolder();
var equalsMethod = colDef ? colDef.equals : null;
if (equalsMethod) {
return equalsMethod(val1, val2);
}
return val1 === val2;
};
CellComp.prototype.getToolTip = function () {
var colDef = this.getComponentHolder();
var data = this.rowNode.data;
if (colDef.tooltipField && utils_1._.exists(data)) {
return utils_1._.getValueUsingField(data, colDef.tooltipField, this.column.isTooltipFieldContainsDots());
}
var valueGetter = colDef.tooltipValueGetter || colDef.tooltip;
if (valueGetter) {
return valueGetter({
api: this.beans.gridOptionsWrapper.getApi(),
columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
colDef: colDef,
column: this.getColumn(),
context: this.beans.gridOptionsWrapper.getContext(),
value: this.value,
valueFormatted: this.valueFormatted,
rowIndex: this.cellPosition.rowIndex,
node: this.rowNode,
data: this.rowNode.data,
$scope: this.scope,
});
}
return null;
};
CellComp.prototype.getTooltipText = function (escape) {
if (escape === void 0) { escape = true; }
return escape ? utils_1._.escape(this.tooltip) : this.tooltip;
};
CellComp.prototype.processCellClassRules = function (onApplicableClass, onNotApplicableClass) {
var colDef = this.getComponentHolder();
this.beans.stylingService.processClassRules(colDef.cellClassRules, {
value: this.value,
data: this.rowNode.data,
node: this.rowNode,
colDef: colDef,
rowIndex: this.cellPosition.rowIndex,
api: this.beans.gridOptionsWrapper.getApi(),
columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
$scope: this.scope,
context: this.beans.gridOptionsWrapper.getContext()
}, onApplicableClass, onNotApplicableClass);
};
CellComp.prototype.postProcessCellClassRules = function () {
var _this = this;
this.processCellClassRules(function (className) {
utils_1._.addCssClass(_this.getGui(), className);
}, function (className) {
utils_1._.removeCssClass(_this.getGui(), className);
});
};
CellComp.prototype.preProcessCellClassRules = function () {
var res = [];
this.processCellClassRules(function (className) {
res.push(className);
}, function (className) {
// not catered for, if creating, no need
// to remove class as it was never there
});
return res;
};
// a wrapper is used when we are putting a selection checkbox in the cell with the value
CellComp.prototype.setUsingWrapper = function () {
var colDef = this.getComponentHolder();
// never allow selection or dragging on pinned rows
if (this.rowNode.rowPinned) {
this.usingWrapper = false;
this.includeSelectionComponent = false;
this.includeRowDraggingComponent = false;
this.includeDndSourceComponent = false;
return;
}
var cbSelectionIsFunc = typeof colDef.checkboxSelection === 'function';
var rowDraggableIsFunc = typeof colDef.rowDrag === 'function';
var dndSourceIsFunc = typeof colDef.dndSource === 'function';
this.includeSelectionComponent = cbSelectionIsFunc || colDef.checkboxSelection === true;
this.includeRowDraggingComponent = rowDraggableIsFunc || colDef.rowDrag === true;
this.includeDndSourceComponent = dndSourceIsFunc || colDef.dndSource === true;
this.usingWrapper = this.includeRowDraggingComponent || this.includeSelectionComponent || this.includeDndSourceComponent;
};
CellComp.prototype.chooseCellRenderer = function () {
// template gets preference, then cellRenderer, then do it ourselves
var colDef = this.getComponentHolder();
// templates are for ng1, ideally we wouldn't have these, they are ng1 support
// inside the core which is bad
if (colDef.template || colDef.templateUrl) {
this.usingCellRenderer = false;
return;
}
var params = this.createCellRendererParams();
var cellRenderer = this.beans.userComponentFactory.lookupComponentClassDef(colDef, 'cellRenderer', params);
var pinnedRowCellRenderer = this.beans.userComponentFactory.lookupComponentClassDef(colDef, 'pinnedRowCellRenderer', params);
if (pinnedRowCellRenderer && this.rowNode.rowPinned) {
this.cellRendererType = CellComp.CELL_RENDERER_TYPE_PINNED;
this.usingCellRenderer = true;
}
else if (cellRenderer) {
this.cellRendererType = CellComp.CELL_RENDERER_TYPE_NORMAL;
this.usingCellRenderer = true;
}
else {
this.usingCellRenderer = false;
}
};
CellComp.prototype.createCellRendererInstance = function (useTaskService) {
var _this = this;
if (useTaskService === void 0) { useTaskService = false; }
if (!this.usingCellRenderer) {
return;
}
// never use task service if angularCompileRows=true, as that assume the cell renderers
// are finished when the row is created. also we never use it if animation frame service
// is turned off.
// and lastly we never use it if doing auto-height, as the auto-height service checks the
// row height directly after the cell is created, it doesn't wait around for the tasks to complete
var angularCompileRows = this.beans.gridOptionsWrapper.isAngularCompileRows();
var suppressAnimationFrame = this.beans.gridOptionsWrapper.isSuppressAnimationFrame();
if (angularCompileRows || suppressAnimationFrame || this.autoHeightCell) {
useTaskService = false;
}
var params = this.createCellRendererParams();
this.cellRendererVersion++;
var callback = this.afterCellRendererCreated.bind(this, this.cellRendererVersion);
var cellRendererTypeNormal = this.cellRendererType === CellComp.CELL_RENDERER_TYPE_NORMAL;
var task = function () {
// this can return null in the event that the user has switched from a renderer component to nothing, for example
// when using a cellRendererSelect to return a component or null depending on row data etc
var componentPromise;
if (cellRendererTypeNormal) {
componentPromise = _this.beans.userComponentFactory.newCellRenderer(_this.getComponentHolder(), params);
}
else {
componentPromise = _this.beans.userComponentFactory.newPinnedRowCellRenderer(_this.getComponentHolder(), params);
}
if (componentPromise) {
componentPromise.then(callback);
}
};
if (useTaskService) {
this.beans.taskQueue.addP2Task(task);
}
else {
task();
}
};
CellComp.prototype.afterCellRendererCreated = function (cellRendererVersion, cellRenderer) {
// see if daemon
if (!this.isAlive() || (cellRendererVersion !== this.cellRendererVersion)) {
if (cellRenderer.destroy) {
cellRenderer.destroy();
}
return;
}
this.cellRenderer = cellRenderer;
this.cellRendererGui = this.cellRenderer.getGui();
if (utils_1._.missing(this.cellRendererGui)) {
return;
}
// if async components, then it's possible the user started editing since
// this call was made
if (!this.editingCell) {
this.eParentOfValue.appendChild(this.cellRendererGui);
}
};
CellComp.prototype.createCellRendererParams = function () {
var _this = this;
var params = {
value: this.value,
valueFormatted: this.valueFormatted,
getValue: this.getValue.bind(this),
setValue: function (value) {
_this.beans.valueService.setValue(_this.rowNode, _this.column, value);
},
formatValue: this.formatValue.bind(this),
data: this.rowNode.data,
node: this.rowNode,
colDef: this.getComponentHolder(),
column: this.column,
$scope: this.scope,
rowIndex: this.cellPosition.rowIndex,
api: this.beans.gridOptionsWrapper.getApi(),
columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
context: this.beans.gridOptionsWrapper.getContext(),
refreshCell: this.refreshCell.bind(this),
eGridCell: this.getGui(),
eParentOfValue: this.eParentOfValue,
// these bits are not documented anywhere, so we could drop them?
// it was in the olden days to allow user to register for when rendered
// row was removed (the row comp was removed), however now that the user
// can provide components for cells, the destroy method gets call when this
// happens so no longer need to fire event.
addRowCompListener: this.rowComp ? this.rowComp.addEventListener.bind(this.rowComp) : null,
addRenderedRowListener: function (eventType, listener) {
console.warn('ag-Grid: since ag-Grid .v11, params.addRenderedRowListener() is now params.addRowCompListener()');
if (_this.rowComp) {
_this.rowComp.addEventListener(eventType, listener);
}
}
};
return params;
};
CellComp.prototype.formatValue = function (value) {
var valueFormatted = this.beans.valueFormatterService.formatValue(this.column, this.rowNode, this.scope, value);
var valueFormattedExists = valueFormatted !== null && valueFormatted !== undefined;
return valueFormattedExists ? valueFormatted : value;
};
CellComp.prototype.getValueToUse = function () {
var valueFormattedExists = this.valueFormatted !== null && this.valueFormatted !== undefined;
return valueFormattedExists ? this.valueFormatted : this.value;
};
CellComp.prototype.getValueAndFormat = function () {
this.value = this.getValue();
this.valueFormatted = this.beans.valueFormatterService.formatValue(this.column, this.rowNode, this.scope, this.value);
};
CellComp.prototype.getValue = function () {
// if we don't check this, then the grid will render leaf groups as open even if we are not
// allowing the user to open leaf groups. confused? remember for pivot mode we don't allow
// opening leaf groups, so we have to force leafGroups to be closed in case the user expanded
// them via the API, or user user expanded them in the UI before turning on pivot mode
var lockedClosedGroup = this.rowNode.leafGroup && this.beans.columnController.isPivotMode();
var isOpenGroup = this.rowNode.group && this.rowNode.expanded && !this.rowNode.footer && !lockedClosedGroup;
// are we showing group footers
var groupFootersEnabled = this.beans.gridOptionsWrapper.isGroupIncludeFooter();
// if doing footers, we normally don't show agg data at group level when group is open
var groupAlwaysShowAggData = this.beans.gridOptionsWrapper.isGroupSuppressBlankHeader();
// if doing grouping and footers, we don't want to include the agg value
// in the header when the group is open
var ignoreAggData = (isOpenGroup && groupFootersEnabled) && !groupAlwaysShowAggData;
return this.beans.valueService.getValue(this.column, this.rowNode, false, ignoreAggData);
};
CellComp.prototype.onMouseEvent = function (eventName, mouseEvent) {
if (utils_1._.isStopPropagationForAgGrid(mouseEvent)) {
return;
}
switch (eventName) {
case 'click':
this.onCellClicked(mouseEvent);
break;
case 'mousedown':
this.onMouseDown(mouseEvent);
break;
case 'dblclick':
this.onCellDoubleClicked(mouseEvent);
break;
case 'mouseout':
this.onMouseOut(mouseEvent);
break;
case 'mouseover':
this.onMouseOver(mouseEvent);
break;
}
};
CellComp.prototype.dispatchCellContextMenuEvent = function (event) {
var colDef = this.getComponentHolder();
var cellContextMenuEvent = this.createEvent(event, events_1.Events.EVENT_CELL_CONTEXT_MENU);
this.beans.eventService.dispatchEvent(cellContextMenuEvent);
if (colDef.onCellContextMenu) {
// to make the callback async, do in a timeout
window.setTimeout(function () { return colDef.onCellContextMenu(cellContextMenuEvent); }, 0);
}
};
CellComp.prototype.createEvent = function (domEvent, eventType) {
var event = {
node: this.rowNode,
data: this.rowNode.data,
value: this.value,
column: this.column,
colDef: this.getComponentHolder(),
context: this.beans.gridOptionsWrapper.getContext(),
api: this.beans.gridApi,
columnApi: this.beans.columnApi,
rowPinned: this.rowNode.rowPinned,
event: domEvent,
type: eventType,
rowIndex: this.rowNode.rowIndex
};
// because we are hacking in $scope for angular 1, we have to de-reference
if (this.scope) {
event.$scope = this.scope;
}
return event;
};
CellComp.prototype.onMouseOut = function (mouseEvent) {
var cellMouseOutEvent = this.createEvent(mouseEvent, events_1.Events.EVENT_CELL_MOUSE_OUT);
this.beans.eventService.dispatchEvent(cellMouseOutEvent);
this.beans.columnHoverService.clearMouseOver();
};
CellComp.prototype.onMouseOver = function (mouseEvent) {
var cellMouseOverEvent = this.createEvent(mouseEvent, events_1.Events.EVENT_CELL_MOUSE_OVER);
this.beans.eventService.dispatchEvent(cellMouseOverEvent);
this.beans.columnHoverService.setMouseOver([this.column]);
};
CellComp.prototype.onCellDoubleClicked = function (mouseEvent) {
var colDef = this.getComponentHolder();
// always dispatch event to eventService
var cellDoubleClickedEvent = this.createEvent(mouseEvent, events_1.Events.EVENT_CELL_DOUBLE_CLICKED);
this.beans.eventService.dispatchEvent(cellDoubleClickedEvent);
// check if colDef also wants to handle event
if (typeof colDef.onCellDoubleClicked === 'function') {
// to make the callback async, do in a timeout
window.setTimeout(function () { return colDef.onCellDoubleClicked(cellDoubleClickedEvent); }, 0);
}
var editOnDoubleClick = !this.beans.gridOptionsWrapper.isSingleClickEdit()
&& !this.beans.gridOptionsWrapper.isSuppressClickEdit();
if (editOnDoubleClick) {
this.startRowOrCellEdit();
}
};
// called by rowRenderer when user navigates via tab key
CellComp.prototype.startRowOrCellEdit = function (keyPress, charPress) {
if (this.beans.gridOptionsWrapper.isFullRowEdit()) {
this.rowComp.startRowEditing(keyPress, charPress, this);
}
else {
this.startEditingIfEnabled(keyPress, charPress, true);
}
};
CellComp.prototype.isCellEditable = function () {
return this.column.isCellEditable(this.rowNode);
};
// either called internally if single cell editing, or called by rowRenderer if row editing
CellComp.prototype.startEditingIfEnabled = function (keyPress, charPress, cellStartedEdit) {
if (keyPress === void 0) { keyPress = null; }
if (charPress === void 0) { charPress = null; }
if (cellStartedEdit === void 0) { cellStartedEdit = false; }
// don't do it if not editable
if (!this.isCellEditable()) {
return;
}
// don't do it if already editing
if (this.editingCell) {
return;
}
this.editingCell = true;
this.cellEditorVersion++;
var callback = this.afterCellEditorCreated.bind(this, this.cellEditorVersion);
var params = this.createCellEditorParams(keyPress, charPress, cellStartedEdit);
this.createCellEditor(params).then(callback);
// if we don't do this, and editor component is async, then there will be a period
// when the component isn't present and keyboard navigation won't work - so example
// of user hitting tab quickly (more quickly than renderers getting created) won't work
var cellEditorAsync = utils_1._.missing(this.cellEditor);
if (cellEditorAsync && cellStartedEdit) {
this.focusCell(true);
}
};
CellComp.prototype.createCellEditor = function (params) {
var _this = this;
var cellEditorPromise = this.beans.userComponentFactory.newCellEditor(this.column.getColDef(), params);
return cellEditorPromise.map(function (cellEditor) {
var isPopup = cellEditor.isPopup && cellEditor.isPopup();
if (!isPopup) {
return cellEditor;
}
if (_this.beans.gridOptionsWrapper.isFullRowEdit()) {
console.warn('ag-Grid: popup cellEditor does not work with fullRowEdit - you cannot use them both ' +
'- either turn off fullRowEdit, or stop using popup editors.');
}
// if a popup, then we wrap in a popup editor and return the popup
var popupEditorWrapper = new popupEditorWrapper_1.PopupEditorWrapper(cellEditor);
_this.beans.context.wireBean(popupEditorWrapper);
popupEditorWrapper.init(params);
return popupEditorWrapper;
});
};
CellComp.prototype.afterCellEditorCreated = function (cellEditorVersion, cellEditor) {
// if editingCell=false, means user cancelled the editor before component was ready.
// if versionMismatch, then user cancelled the edit, then started the edit again, and this
// is the first editor which is now stale.
var versionMismatch = cellEditorVersion !== this.cellEditorVersion;
if (versionMismatch || !this.editingCell) {
if (cellEditor.destroy) {
cellEditor.destroy();
}
return;
}
if (cellEditor.isCancelBeforeStart && cellEditor.isCancelBeforeStart()) {
if (cellEditor.destroy) {
cellEditor.destroy();
}
this.editingCell = false;
return;
}
if (!cellEditor.getGui) {
console.warn("ag-Grid: cellEditor for column " + this.column.getId() + " is missing getGui() method");
// no getGui, for React guys, see if they attached a react component directly
if (cellEditor.render) {
console.warn("ag-Grid: we found 'render' on the component, are you trying to set a React renderer but added it as colDef.cellEditor instead of colDef.cellEditorFmk?");
}
if (cellEditor.destroy) {
cellEditor.destroy();
}
this.editingCell = false;
return;
}
this.cellEditor = cellEditor;
this.cellEditorInPopup = cellEditor.isPopup !== undefined && cellEditor.isPopup();
this.setInlineEditingClass();
if (this.cellEditorInPopup) {
this.addPopupCellEditor();
}
else {
this.addInCellEditor();
}
if (cellEditor.afterGuiAttached) {
cellEditor.afterGuiAttached();
}
var event = this.createEvent(null, events_1.Events.EVENT_CELL_EDITING_STARTED);
this.beans.eventService.dispatchEvent(event);
};
CellComp.prototype.addInCellEditor = function () {
utils_1._.clearElement(this.getGui());
if (this.cellEditor) {
this.getGui().appendChild(this.cellEditor.getGui());
}
this.angular1Compile();
};
CellComp.prototype.addPopupCellEditor = function () {
var _this = this;
var ePopupGui = this.cellEditor ? this.cellEditor.getGui() : null;
this.hideEditorPopup = this.beans.popupService.addAsModalPopup(ePopupGui, true,
// callback for when popup disappears
function () {
_this.onPopupEditorClosed();
});
this.beans.popupService.positionPopupOverComponent({
column: this.column,
rowNode: this.rowNode,
type: 'popupCellEditor',
eventSource: this.getGui(),
ePopup: ePopupGui,
keepWithinBounds: true
});
this.angular1Compile();
};
CellComp.prototype.onPopupEditorClosed = function () {
// we only call stopEditing if we are editing, as
// it's possible the popup called 'stop editing'
// before this, eg if 'enter key' was pressed on
// the editor.
if (this.editingCell) {
// note: this only happens when use clicks outside of the grid. if use clicks on another
// cell, then the editing will have already stopped on this cell
this.stopRowOrCellEdit();
// we only focus cell again if this cell is still focused. it is possible
// it is not focused if the user cancelled the edit by clicking on another
// cell outside of this one
if (this.beans.focusedCellController.isCellFocused(this.cellPosition)) {
this.focusCell(true);
}
}
};
// if we are editing inline, then we don't have the padding in the cell (set in the themes)
// to allow the text editor full access to the entire cell
CellComp.prototype.setInlineEditingClass = function () {
// ag-cell-inline-editing - appears when user is inline editing
// ag-cell-not-inline-editing - appears when user is no inline editing
// ag-cell-popup-editing - appears when user is editing cell in popup (appears on the cell, not on the popup)
// note: one of {ag-cell-inline-editing, ag-cell-not-inline-editing} is always present, they toggle.
// however {ag-cell-popup-editing} shows when popup, so you have both {ag-cell-popup-editing}
// and {ag-cell-not-inline-editing} showing at the same time.
var editingInline = this.editingCell && !this.cellEditorInPopup;
var popupEditorShowing = this.editingCell && this.cellEditorInPopup;
utils_1._.addOrRemoveCssClass(this.getGui(), "ag-cell-inline-editing", editingInline);
utils_1._.addOrRemoveCssClass(this.getGui(), "ag-cell-not-inline-editing", !editingInline);
utils_1._.addOrRemoveCssClass(this.getGui(), "ag-cell-popup-editing", popupEditorShowing);
utils_1._.addOrRemoveCssClass(this.getGui().parentNode, "ag-row-inline-editing", editingInline);
utils_1._.addOrRemoveCssClass(this.getGui().parentNode, "ag-row-not-inline-editing", !editingInline);
};
CellComp.prototype.createCellEditorParams = function (keyPress, charPress, cellStartedEdit) {
var params = {
value: this.getValue(),
keyPress: keyPress,
charPress: charPress,
column: this.column,
colDef: this.column.getColDef(),
rowIndex: this.cellPosition.rowIndex,
node: this.rowNode,
data: this.rowNode.data,
api: this.beans.gridOptionsWrapper.getApi(),
cellStartedEdit: cellStartedEdit,
columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
context: this.beans.gridOptionsWrapper.getContext(),
$scope: this.scope,
onKeyDown: this.onKeyDown.bind(this),
stopEditing: this.stopEditingAndFocus.bind(this),
eGridCell: this.getGui(),
parseValue: this.parseValue.bind(this),
formatValue: this.formatValue.bind(this)
};
return params;
};
// cell editors call this, when they want to stop for reasons other
// than what we pick up on. eg selecting from a dropdown ends editing.
CellComp.prototype.stopEditingAndFocus = function (suppressNavigateAfterEdit) {
if (suppressNavigateAfterEdit === void 0) { suppressNavigateAfterEdit = false; }
this.stopRowOrCellEdit();
this.focusCell(true);
if (!suppressNavigateAfterEdit) {
this.navigateAfterEdit();
}
};
CellComp.prototype.parseValue = function (newValue) {
var colDef = this.getComponentHolder();
var params = {
node: this.rowNode,
data: this.rowNode.data,
oldValue: this.value,
newValue: newValue,
colDef: colDef,
column: this.column,
api: this.beans.gridOptionsWrapper.getApi(),
columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
context: this.beans.gridOptionsWrapper.getContext()
};
var valueParser = colDef.valueParser;
return utils_1._.exists(valueParser) ? this.beans.expressionService.evaluate(valueParser, params) : newValue;
};
CellComp.prototype.focusCell = function (forceBrowserFocus) {
if (forceBrowserFocus === void 0) { forceBrowserFocus = false; }
this.beans.focusedCellController.setFocusedCell(this.cellPosition.rowIndex, this.column, this.rowNode.rowPinned, forceBrowserFocus);
};
CellComp.prototype.setFocusInOnEditor = function () {
if (this.editingCell) {
if (this.cellEditor && this.cellEditor.focusIn) {
// if the editor is present, then we just focus it
this.cellEditor.focusIn();
}
else {
// if the editor is not present, it means async cell editor (eg React fibre)
// and we are trying to set focus before the cell editor is present, so we
// focus the cell instead
this.focusCell(true);
}
}
};
CellComp.prototype.isEditing = function () {
return this.editingCell;
};
CellComp.prototype.onKeyDown = function (event) {
var key = event.which || event.keyCode;
switch (key) {
case constants_1.Constants.KEY_ENTER:
this.onEnterKeyDown();
break;
case constants_1.Constants.KEY_F2:
this.onF2KeyDown();
break;
case constants_1.Constants.KEY_ESCAPE:
this.onEscapeKeyDown();
break;
case constants_1.Constants.KEY_TAB:
this.onTabKeyDown(event);
break;
case constants_1.Constants.KEY_BACKSPACE:
case constants_1.Constants.KEY_DELETE:
this.onBackspaceOrDeleteKeyPressed(key);
break;
case constants_1.Constants.KEY_DOWN:
case constants_1.Constants.KEY_UP:
case constants_1.Constants.KEY_RIGHT:
case constants_1.Constants.KEY_LEFT:
this.onNavigationKeyPressed(event, key);
break;
}
};
CellComp.prototype.setFocusOutOnEditor = function () {
if (this.editingCell && this.cellEditor && this.cellEditor.focusOut) {
this.cellEditor.focusOut();
}
};
CellComp.prototype.onNavigationKeyPressed = function (event, key) {
if (this.editingCell) {
return;
}
if (event.shiftKey && this.rangeSelectionEnabled) {
this.onShiftRangeSelect(key);
}
else {
this.beans.rowRenderer.navigateToNextCell(event, key, this.cellPosition, true);
}
// if we don't prevent default, the grid will scroll with the navigation keys
event.preventDefault();
};
CellComp.prototype.onShiftRangeSelect = function (key) {
var endCell = this.beans.rangeController.extendLatestRangeInDirection(key);
if (endCell) {
this.beans.rowRenderer.ensureCellVisible(endCell);
}
};
CellComp.prototype.onTabKeyDown = function (event) {
this.beans.rowRenderer.onTabKeyDown(this, event);
};
CellComp.prototype.onBackspaceOrDeleteKeyPressed = function (key) {
if (!this.editingCell) {
this.startRowOrCellEdit(key);
}
};
CellComp.prototype.onEnterKeyDown = function () {
if (this.editingCell || this.rowComp.isEditing()) {
this.stopEditingAndFocus();
}
else {
if (this.beans.gridOptionsWrapper.isEnterMovesDown()) {
this.beans.rowRenderer.navigateToNextCell(null, constants_1.Constants.KEY_DOWN, this.cellPosition, false);
}
else {
this.startRowOrCellEdit(constants_1.Constants.KEY_ENTER);
}
}
};
CellComp.prototype.navigateAfterEdit = function () {
var fullRowEdit = this.beans.gridOptionsWrapper.isFullRowEdit();
if (fullRowEdit) {
return;
}
var enterMovesDownAfterEdit = this.beans.gridOptionsWrapper.isEnterMovesDownAfterEdit();
if (enterMovesDownAfterEdit) {
this.beans.rowRenderer.navigateToNextCell(null, constants_1.Constants.KEY_DOWN, this.cellPosition, false);
}
};
CellComp.prototype.onF2KeyDown = function () {
if (!this.editingCell) {
this.startRowOrCellEdit(constants_1.Constants.KEY_F2);
}
};
CellComp.prototype.onEscapeKeyDown = function () {
if (this.editingCell) {
this.stopRowOrCellEdit(true);
this.focusCell(true);
}
};
CellComp.prototype.onKeyPress = function (event) {
// check this, in case focus is on a (for example) a text field inside the cell,
// in which cse we should not be listening for these key pressed
var eventTarget = utils_1._.getTarget(event);
var eventOnChildComponent = eventTarget !== this.getGui();
if (eventOnChildComponent || this.editingCell) {
return;
}
var pressedChar = String.fromCharCode(event.charCode);
if (pressedChar === ' ') {
this.onSpaceKeyPressed(event);
}
else {
if (utils_1._.isEventFromPrintableCharacter(event)) {
this.startRowOrCellEdit(null, pressedChar);
// if we don't prevent default, then the keypress also gets applied to the text field
// (at least when doing the default editor), but we need to allow the editor to decide
// what it wants to do. we only do this IF editing was started - otherwise it messes
// up when the use is not doing editing, but using rendering with text fields in cellRenderer
// (as it would block the the user from typing into text fields).
event.preventDefault();
}
}
};
CellComp.prototype.onSpaceKeyPressed = function (event) {
if (!this.editingCell && this.beans.gridOptionsWrapper.isRowSelection()) {
var selected = this.rowNode.isSelected();
this.rowNode.setSelected(!selected);
}
// prevent default as space key, by default, moves browser scroll down
event.preventDefault();
};
CellComp.prototype.onMouseDown = function (mouseEvent) {
// we only need to pass true to focusCell in when the browser is IE
// and we are trying to focus a cell (has ag-cell class), otherwise
// we pass false, as we don't want the cell to focus also get the browser
// focus. if we did, then the cellRenderer could have a text field in it,
// for example, and as the user clicks on the text field, the text field,
// the focus doesn't get to the text field, instead to goes to the div
// behind, making it impossible to select the text field.
var forceBrowserFocus = false;
var button = mouseEvent.button, ctrlKey = mouseEvent.ctrlKey, metaKey = mouseEvent.metaKey, shiftKey = mouseEvent.shiftKey, target = mouseEvent.target;
var _a = this.beans, eventService = _a.eventService, rangeController = _a.rangeController;
if (rangeController) {
var cellInRange = rangeController.isCellInAnyRange(this.getCellPosition());
if (cellInRange && button === 2) {
return;
}
}
if (utils_1._.isBrowserIE()) {
if (target.classList.contains('ag-cell')) {
forceBrowserFocus = true;
}
}
if (!shiftKey || (rangeController && !rangeController.getCellRanges().length)) {
this.focusCell(forceBrowserFocus);
}
else {
// if a range is being changed, we need to make sure the focused cell does not change.
mouseEvent.preventDefault();
}
// if we are clicking on a checkbox, we need to make sure the cell wrapping that checkbox
// is focused but we don't want to change the range selection, so return here.
if (utils_1._.isElementChildOfClass(target, 'ag-selection-checkbox', 3)) {
return;
}
// if it's a right click, then if the cell is already in range,
// don't change the range, however if the cell is not in a range,
// we set a new range
var leftMouseButtonClick = utils_1._.isLeftClick(mouseEvent);
if (leftMouseButtonClick && rangeController) {
var thisCell = this.cellPosition;
if (shiftKey) {
rangeController.extendLatestRangeToCell(thisCell);
}
else {
var ctrlKeyPressed = ctrlKey || metaKey;
rangeController.setRangeToCell(thisCell, ctrlKeyPressed);
}
}
var cellMouseDownEvent = this.createEvent(mouseEvent, events_1.Events.EVENT_CELL_MOUSE_DOWN);
eventService.dispatchEvent(cellMouseDownEvent);
};
// returns true if on iPad and this is second 'click' event in 200ms
CellComp.prototype.isDoubleClickOnIPad = function () {
if (!utils_1._.isUserAgentIPad()) {
return false;
}
var nowMillis = new Date().getTime();
var res = nowMillis - this.lastIPadMouseClickEvent < 200;
this.lastIPadMouseClickEvent = nowMillis;
return res;
};
CellComp.prototype.onCellClicked = function (mouseEvent) {
// iPad doesn't have double click - so we need to mimic it do enable editing for
// iPad.
if (this.isDoubleClickOnIPad()) {
this.onCellDoubleClicked(mouseEvent);
mouseEvent.preventDefault(); // if we don't do this, then iPad zooms in
return;
}
var cellClickedEvent = this.createEvent(mouseEvent, events_1.Events.EVENT_CELL_CLICKED);
this.beans.eventService.dispatchEvent(cellClickedEvent);
var colDef = this.getComponentHolder();
if (colDef.onCellClicked) {
// to make callback async, do in a timeout
window.setTimeout(function () { return colDef.onCellClicked(cellClickedEvent); }, 0);
}
var editOnSingleClick = (this.beans.gridOptionsWrapper.isSingleClickEdit() || colDef.singleClickEdit)
&& !this.beans.gridOptionsWrapper.isSuppressClickEdit();
if (editOnSingleClick) {
this.startRowOrCellEdit();
}
utils_1._.doIeFocusHack(this.getGui());
};
CellComp.prototype.createGridCellVo = function () {
this.cellPosition = {
rowIndex: this.rowNode.rowIndex,
rowPinned: this.rowNode.rowPinned,
column: this.column
};
};
CellComp.prototype.getCellPosition = function () {
return this.cellPosition;
};
CellComp.prototype.getParentRow = function () {
return this.eParentRow;
};
CellComp.prototype.setParentRow = function (eParentRow) {
this.eParentRow = eParentRow;
};
CellComp.prototype.getColumn = function () {
return this.column;
};
CellComp.prototype.getComponentHolder = function () {
return this.column.getColDef();
};
CellComp.prototype.detach = function () {
this.eParentRow.removeChild(this.getGui());
};
// if the row is also getting destroyed, then we don't need to remove from dom,
// as the row will also get removed, so no need to take out the cells from the row
// if the row is going (removing is an expensive operation, so only need to remove
// the top part)
CellComp.prototype.destroy = function () {
_super.prototype.destroy.call(this);
if (this.cellEditor && this.cellEditor.destroy) {
this.cellEditor.destroy();
this.cellEditor = null;
}
if (this.cellRenderer && this.cellRenderer.destroy) {
this.cellRenderer.destroy();
this.cellRenderer = null;
}
if (this.selectionHandle) {
this.selectionHandle.destroy();
}
};
CellComp.prototype.onLeftChanged = function () {
var left = this.modifyLeftForPrintLayout(this.getCellLeft());
this.getGui().style.left = left + 'px';
};
CellComp.prototype.modifyLeftForPrintLayout = function (leftPosition) {
if (!this.printLayout) {
return leftPosition;
}
if (this.column.getPinned() === column_1.Column.PINNED_LEFT) {
return leftPosition;
}
if (this.column.getPinned() === column_1.Column.PINNED_RIGHT) {
var leftWidth_1 = this.beans.columnController.getPinnedLeftContainerWidth();
var bodyWidth = this.beans.columnController.getBodyContainerWidth();
return leftWidth_1 + bodyWidth + leftPosition;
}
// is in body
var leftWidth = this.beans.columnController.getPinnedLeftContainerWidth();
return leftWidth + leftPosition;
};
CellComp.prototype.onWidthChanged = function () {
var width = this.getCellWidth();
this.getGui().style.width = width + 'px';
};
CellComp.prototype.getRangeBorders = function () {
var _this = this;
var isRtl = this.beans.gridOptionsWrapper.isEnableRtl();
var top = false;
var right = false;
var bottom = false;
var left = false;
var thisCol = this.cellPosition.column;
var rangeController = this.beans.rangeController;
var leftCol;
var rightCol;
if (isRtl) {
leftCol = this.beans.columnController.getDisplayedColAfter(thisCol);
rightCol = this.beans.columnController.getDisplayedColBefore(thisCol);
}
else {
leftCol = this.beans.columnController.getDisplayedColBefore(thisCol);
rightCol = this.beans.columnController.getDisplayedColAfter(thisCol);
}
var ranges = rangeController.getCellRanges().filter(function (range) { return rangeController.isCellInSpecificRange(_this.cellPosition, range); });
// this means we are the first column in the grid
if (!leftCol) {
left = true;
}
// this means we are the last column in the grid
if (!rightCol) {
right = true;
}
for (var i = 0; i < ranges.length; i++) {
if (top && right && bottom && left) {
break;
}
var range = ranges[i];
var startRow = rangeController.getRangeStartRow(range);
var endRow = rangeController.getRangeEndRow(range);
if (!top && this.beans.rowPositionUtils.sameRow(startRow, this.cellPosition)) {
top = true;
}
if (!bottom && this.beans.rowPositionUtils.sameRow(endRow, this.cellPosition)) {
bottom = true;
}
if (!left && range.columns.indexOf(leftCol) < 0) {
left = true;
}
if (!right && range.columns.indexOf(rightCol) < 0) {
right = true;
}
}
return { top: top, right: right, bottom: bottom, left: left };
};
CellComp.prototype.getInitialRangeClasses = function () {
var res = [];
if (!this.rangeSelectionEnabled || !this.rangeCount) {
return res;
}
var beans = this.beans;
var rangeController = beans.rangeController;
res.push('ag-cell-range-selected');
if (this.hasChartRange) {
res.push('ag-cell-range-chart');
}
var count = Math.min(this.rangeCount, 4);
res.push("ag-cell-range-selected-" + count);
if (this.rangeCount === 1 && !rangeController.isMoreThanOneCell()) {
res.push('ag-cell-range-single-cell');
}
if (this.rangeCount > 0) {
var borders = this.getRangeBorders();
if (borders.top) {
res.push('ag-cell-range-top');
}
if (borders.right) {
res.push('ag-cell-range-right');
}
if (borders.bottom) {
res.push('ag-cell-range-bottom');
}
if (borders.left) {
res.push('ag-cell-range-left');
}
}
if (!!this.selectionHandle) {
res.push('ag-cell-range-handle');
}
return res;
};
CellComp.prototype.onRowIndexChanged = function () {
// when index changes, this influences items that need the index, so we update the
// grid cell so they are working off the new index.
this.createGridCellVo();
// when the index of the row changes, ie means the cell may have lost or gained focus
this.onCellFocused();
// check range selection
this.onRangeSelectionChanged();
};
CellComp.prototype.onRangeSelectionChanged = function () {
if (!this.beans.enterprise) {
return;
}
var _a = this, beans = _a.beans, cellPosition = _a.cellPosition, rangeCount = _a.rangeCount;
var rangeController = beans.rangeController;
var newRangeCount = rangeController.getCellRangeCount(cellPosition);
var element = this.getGui();
if (rangeCount !== newRangeCount) {
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-selected', newRangeCount !== 0);
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-selected-1', newRangeCount === 1);
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-selected-2', newRangeCount === 2);
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-selected-3', newRangeCount === 3);
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-selected-4', newRangeCount >= 4);
this.rangeCount = newRangeCount;
}
var hasChartRange = this.rangeCount && rangeController.getCellRanges().every(function (range) { return utils_1._.exists(range.type); });
if (this.hasChartRange !== hasChartRange) {
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-chart', hasChartRange);
this.hasChartRange = hasChartRange;
}
this.updateRangeBorders();
var isSingleCell = this.rangeCount === 1 && !rangeController.isMoreThanOneCell();
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-single-cell', isSingleCell);
this.refreshHandle();
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-handle', !!this.selectionHandle);
};
CellComp.prototype.shouldHaveSelectionHandle = function () {
var _a = this.beans, gridOptionsWrapper = _a.gridOptionsWrapper, rangeController = _a.rangeController;
var el = this.getGui();
var cellRanges = rangeController.getCellRanges();
var rangesLen = cellRanges.length;
if (!rangesLen) {
return false;
}
var lastRange = utils_1._.last(cellRanges);
var isFirstRangeCategory = cellRanges[0].type === iRangeController_1.CellRangeType.DIMENSION;
var handlesAllowed = (gridOptionsWrapper.isEnableFillHandle() ||
gridOptionsWrapper.isEnableRangeHandle() ||
this.hasChartRange && !isFirstRangeCategory) && rangesLen === 1;
if (!handlesAllowed && this.hasChartRange) {
var cellPosition = this.getCellPosition();
handlesAllowed =
isFirstRangeCategory &&
rangesLen === 2 &&
rangeController.isCellInSpecificRange(this.getCellPosition(), lastRange);
var isCategory = isFirstRangeCategory &&
rangeController.isCellInSpecificRange(cellPosition, cellRanges[0]);
utils_1._.addOrRemoveCssClass(el, 'ag-cell-range-chart-category', isCategory);
}
return this.rangeCount &&
handlesAllowed &&
lastRange.endRow != null &&
this.beans.rangeController.isContiguousRange(lastRange) &&
(utils_1._.containsClass(el, 'ag-cell-range-single-cell') ||
(utils_1._.containsClass(el, 'ag-cell-range-bottom') && utils_1._.containsClass(el, 'ag-cell-range-right')));
};
CellComp.prototype.addSelectionHandle = function () {
var _a = this.beans, gridOptionsWrapper = _a.gridOptionsWrapper, context = _a.context, rangeController = _a.rangeController;
var cellRangeType = utils_1._.last(rangeController.getCellRanges()).type;
var type = (gridOptionsWrapper.isEnableFillHandle() && utils_1._.missing(cellRangeType)) ? 'fill' : 'range';
if (this.selectionHandle && this.selectionHandle.getType() !== type) {
this.selectionHandle.destroy();
this.selectionHandle = undefined;
}
if (!this.selectionHandle) {
this.selectionHandle = context.createComponentFromElement(document.createElement("ag-" + type + "-handle"));
}
this.selectionHandle.refresh(this);
};
CellComp.prototype.updateRangeBordersIfRangeCount = function () {
// we only need to update range borders if we are in a range
if (this.rangeCount > 0) {
this.updateRangeBorders();
this.refreshHandle();
}
};
CellComp.prototype.refreshHandle = function () {
var shouldHaveSelectionHandle = this.shouldHaveSelectionHandle();
if (this.selectionHandle && !shouldHaveSelectionHandle) {
this.selectionHandle.destroy();
this.selectionHandle = null;
}
if (shouldHaveSelectionHandle) {
this.addSelectionHandle();
}
};
CellComp.prototype.updateRangeBorders = function () {
var rangeBorders = this.getRangeBorders();
var isSingleCell = this.rangeCount === 1 && !this.beans.rangeController.isMoreThanOneCell();
var isTop = !isSingleCell && rangeBorders.top;
var isRight = !isSingleCell && rangeBorders.right;
var isBottom = !isSingleCell && rangeBorders.bottom;
var isLeft = !isSingleCell && rangeBorders.left;
var element = this.getGui();
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-top', isTop);
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-right', isRight);
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-bottom', isBottom);
utils_1._.addOrRemoveCssClass(element, 'ag-cell-range-left', isLeft);
};
CellComp.prototype.onFirstRightPinnedChanged = function () {
var firstRightPinned = this.column.isFirstRightPinned();
if (this.firstRightPinned !== firstRightPinned) {
this.firstRightPinned = firstRightPinned;
utils_1._.addOrRemoveCssClass(this.getGui(), 'ag-cell-first-right-pinned', firstRightPinned);
}
};
CellComp.prototype.onLastLeftPinnedChanged = function () {
var lastLeftPinned = this.column.isLastLeftPinned();
if (this.lastLeftPinned !== lastLeftPinned) {
this.lastLeftPinned = lastLeftPinned;
utils_1._.addOrRemoveCssClass(this.getGui(), 'ag-cell-last-left-pinned', lastLeftPinned);
}
};
CellComp.prototype.populateTemplate = function () {
if (this.usingWrapper) {
this.eParentOfValue = this.getRefElement('eCellValue');
this.eCellWrapper = this.getRefElement('eCellWrapper');
if (this.includeRowDraggingComponent) {
this.addRowDragging();
}
if (this.includeDndSourceComponent) {
this.addDndSource();
}
if (this.includeSelectionComponent) {
this.addSelectionCheckbox();
}
}
else {
this.eParentOfValue = this.getGui();
}
};
CellComp.prototype.getFrameworkOverrides = function () {
return this.beans.frameworkOverrides;
};
CellComp.prototype.addRowDragging = function () {
var pagination = this.beans.gridOptionsWrapper.isPagination();
var rowDragManaged = this.beans.gridOptionsWrapper.isRowDragManaged();
var clientSideRowModelActive = this.beans.gridOptionsWrapper.isRowModelDefault();
if (rowDragManaged) {
// row dragging only available in default row model
if (!clientSideRowModelActive) {
utils_1._.doOnce(function () { return console.warn('ag-Grid: managed row dragging is only allowed in the Client Side Row Model'); }, 'CellComp.addRowDragging');
return;
}
if (pagination) {
utils_1._.doOnce(function () { return console.warn('ag-Grid: managed row dragging is not possible when doing pagination'); }, 'CellComp.addRowDragging');
return;
}
}
var rowDraggingComp = new rowDragComp_1.RowDragComp(this.rowNode, this.column, this.getValueToUse(), this.beans);
this.addFeature(this.beans.context, rowDraggingComp);
// put the checkbox in before the value
this.eCellWrapper.insertBefore(rowDraggingComp.getGui(), this.eParentOfValue);
};
CellComp.prototype.addDndSource = function () {
var dndSourceComp = new dndSourceComp_1.DndSourceComp(this.rowNode, this.column, this.getValueToUse(), this.beans, this.getGui());
this.addFeature(this.beans.context, dndSourceComp);
// put the checkbox in before the value
this.eCellWrapper.insertBefore(dndSourceComp.getGui(), this.eParentOfValue);
};
CellComp.prototype.addSelectionCheckbox = function () {
var cbSelectionComponent = new checkboxSelectionComponent_1.CheckboxSelectionComponent();
this.beans.context.wireBean(cbSelectionComponent);
var visibleFunc = this.getComponentHolder().checkboxSelection;
visibleFunc = typeof visibleFunc === 'function' ? visibleFunc : null;
cbSelectionComponent.init({ rowNode: this.rowNode, column: this.column, visibleFunc: visibleFunc });
this.addDestroyFunc(function () { return cbSelectionComponent.destroy(); });
// put the checkbox in before the value
this.eCellWrapper.insertBefore(cbSelectionComponent.getGui(), this.eParentOfValue);
};
CellComp.prototype.addDomData = function () {
var _this = this;
var element = this.getGui();
this.beans.gridOptionsWrapper.setDomData(element, CellComp.DOM_DATA_KEY_CELL_COMP, this);
this.addDestroyFunc(function () {
return _this.beans.gridOptionsWrapper.setDomData(element, CellComp.DOM_DATA_KEY_CELL_COMP, null);
});
};
CellComp.prototype.onCellFocused = function (event) {
var cellFocused = this.beans.focusedCellController.isCellFocused(this.cellPosition);
// see if we need to change the classes on this cell
if (cellFocused !== this.cellFocused) {
// if we are not doing cell selection, then the focus class does not change
var doingFocusCss = !this.beans.gridOptionsWrapper.isSuppressCellSelection();
if (doingFocusCss) {
utils_1._.addOrRemoveCssClass(this.getGui(), 'ag-cell-focus', cellFocused);
}
this.cellFocused = cellFocused;
}
// if this cell was just focused, see if we need to force browser focus, his can
// happen if focus is programmatically set.
if (cellFocused && event && event.forceBrowserFocus) {
var eGui = this.getGui();
eGui.focus();
utils_1._.doIeFocusHack(eGui);
}
// if another cell was focused, and we are editing, then stop editing
var fullRowEdit = this.beans.gridOptionsWrapper.isFullRowEdit();
if (!cellFocused && !fullRowEdit && this.editingCell) {
this.stopRowOrCellEdit();
}
};
// pass in 'true' to cancel the editing.
CellComp.prototype.stopRowOrCellEdit = function (cancel) {
if (cancel === void 0) { cancel = false; }
if (this.beans.gridOptionsWrapper.isFullRowEdit()) {
this.rowComp.stopRowEditing(cancel);
}
else {
this.stopEditing(cancel);
}
};
CellComp.prototype.stopEditing = function (cancel) {
if (cancel === void 0) { cancel = false; }
if (!this.editingCell) {
return;
}
// if no cell editor, this means due to async, that the cell editor never got initialised,
// so we just carry on regardless as if the editing was never started.
if (!this.cellEditor) {
this.editingCell = false;
return;
}
var newValueExists = false;
var newValue;
if (!cancel) {
// also have another option here to cancel after editing, so for example user could have a popup editor and
// it is closed by user clicking outside the editor. then the editor will close automatically (with false
// passed above) and we need to see if the editor wants to accept the new value.
var userWantsToCancel = this.cellEditor.isCancelAfterEnd && this.cellEditor.isCancelAfterEnd();
if (!userWantsToCancel) {
newValue = this.cellEditor.getValue();
newValueExists = true;
}
}
// it is important we set this after setValue() above, as otherwise the cell will flash
// when editing stops. the 'refresh' method checks editing, and doesn't refresh editing cells.
// thus it will skip the refresh on this cell until the end of this method where we call
// refresh directly and we suppress the flash.
this.editingCell = false;
if (this.cellEditor.destroy) {
this.cellEditor.destroy();
}
// important to clear this out - as parts of the code will check for
// this to see if an async cellEditor has yet to be created
this.cellEditor = null;
if (this.cellEditorInPopup && this.hideEditorPopup) {
this.hideEditorPopup();
this.hideEditorPopup = null;
}
else {
utils_1._.clearElement(this.getGui());
// put the cell back the way it was before editing
if (this.usingWrapper) {
// if wrapper, then put the wrapper back
this.getGui().appendChild(this.eCellWrapper);
}
else {
// if cellRenderer, then put the gui back in. if the renderer has
// a refresh, it will be called. however if it doesn't, then later
// the renderer will be destroyed and a new one will be created.
if (this.cellRenderer) {
// we know it's a dom element (not a string) because we converted
// it after the gui was attached if it was a string.
var eCell = this.cellRendererGui;
// can be null if cell was previously null / contained empty string,
// this will result in new value not being rendered.
if (eCell) {
this.getGui().appendChild(eCell);
}
}
}
}
this.setInlineEditingClass();
if (newValueExists) {
// we suppressRefreshCell because the call to rowNode.setDataValue() results in change detection
// getting triggered, which results in all cells getting refreshed. we do not want this refresh
// to happen on this call as we want to call it explicitly below. otherwise refresh gets called twice.
// if we only did this refresh (and not the one below) then the cell would flash and not be forced.
this.suppressRefreshCell = true;
this.rowNode.setDataValue(this.column, newValue);
this.suppressRefreshCell = false;
}
// we suppress the flash, as it is not correct to flash the cell the user has finished editing,
// the user doesn't need to flash as they were the one who did the edit, the flash is pointless
// (as the flash is meant to draw the user to a change that they didn't manually do themselves).
this.refreshCell({ forceRefresh: true, suppressFlash: true });
var event = this.createEvent(null, events_1.Events.EVENT_CELL_EDITING_STOPPED);
this.beans.eventService.dispatchEvent(event);
};
CellComp.DOM_DATA_KEY_CELL_COMP = 'cellComp';
CellComp.CELL_RENDERER_TYPE_NORMAL = 'cellRenderer';
CellComp.CELL_RENDERER_TYPE_PINNED = 'pinnedRowCellRenderer';
return CellComp;
}(component_1.Component));
exports.CellComp = CellComp;
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var context_1 = __webpack_require__(13);
var beanStub_1 = __webpack_require__(34);
var utils_1 = __webpack_require__(5);
var compIdSequence = new utils_1.NumberSequence();
var Component = /** @class */ (function (_super) {
__extends(Component, _super);
function Component(template) {
var _this = _super.call(this) || this;
_this.childComponents = [];
_this.annotatedEventListeners = [];
// if false, then CSS class "ag-hidden" is applied, which sets "display: none"
_this.displayed = true;
// if false, then CSS class "ag-invisible" is applied, which sets "visibility: hidden"
_this.visible = true;
// unique id for this row component. this is used for getting a reference to the HTML dom.
// we cannot use the RowNode id as this is not unique (due to animation, old rows can be lying
// around as we create a new rowComp instance for the same row node).
_this.compId = compIdSequence.next();
if (template) {
_this.setTemplate(template);
}
return _this;
}
Component.prototype.getCompId = function () {
return this.compId;
};
// for registered components only, eg creates AgCheckbox instance from ag-checkbox HTML tag
Component.prototype.createChildComponentsFromTags = function (parentNode) {
var _this = this;
// we MUST take a copy of the list first, as the 'swapComponentForNode' adds comments into the DOM
// which messes up the traversal order of the children.
var childNodeList = utils_1._.copyNodeList(parentNode.childNodes);
childNodeList.forEach(function (childNode) {
var childComp = _this.getContext().createComponentFromElement(childNode, function (childComp) {
// copy over all attributes, including css classes, so any attributes user put on the tag
// wll be carried across
_this.copyAttributesFromNode(childNode, childComp.getGui());
});
if (childComp) {
if (childComp.addItems && childNode.children.length) {
_this.createChildComponentsFromTags(childNode);
// converting from HTMLCollection to Array
var items = Array.prototype.slice.call(childNode.children);
childComp.addItems(items);
}
// replace the tag (eg ag-checkbox) with the proper HTMLElement (eg 'div') in the dom
_this.swapComponentForNode(childComp, parentNode, childNode);
}
else if (childNode.childNodes) {
_this.createChildComponentsFromTags(childNode);
}
});
};
Component.prototype.copyAttributesFromNode = function (source, dest) {
utils_1._.iterateNamedNodeMap(source.attributes, function (name, value) {
dest.setAttribute(name, value);
});
};
Component.prototype.swapComponentForNode = function (newComponent, parentNode, childNode) {
var eComponent = newComponent.getGui();
parentNode.replaceChild(eComponent, childNode);
parentNode.insertBefore(document.createComment(childNode.nodeName), eComponent);
this.childComponents.push(newComponent);
this.swapInComponentForQuerySelectors(newComponent, childNode);
};
Component.prototype.swapInComponentForQuerySelectors = function (newComponent, childNode) {
var thisProto = Object.getPrototypeOf(this);
var thisNoType = this;
while (thisProto != null) {
var metaData = thisProto.__agComponentMetaData;
var currentProtoName = (thisProto.constructor).name;
if (metaData && metaData[currentProtoName] && metaData[currentProtoName].querySelectors) {
metaData[currentProtoName].querySelectors.forEach(function (querySelector) {
if (thisNoType[querySelector.attributeName] === childNode) {
thisNoType[querySelector.attributeName] = newComponent;
}
});
}
thisProto = Object.getPrototypeOf(thisProto);
}
};
Component.prototype.setTemplate = function (template) {
var eGui = utils_1._.loadTemplate(template);
this.setTemplateFromElement(eGui);
};
Component.prototype.setTemplateFromElement = function (element) {
this.eGui = element;
this.eGui.__agComponent = this;
this.addAnnotatedEventListeners();
this.wireQuerySelectors();
// context will not be available when user sets template in constructor
var contextIsAvailable = !!this.getContext();
if (contextIsAvailable) {
this.createChildComponentsFromTags(this.getGui());
}
};
Component.prototype.createChildComponentsPreConstruct = function () {
// ui exists if user sets template in constructor. when this happens, we have to wait for the context
// to be autoWired first before we can create child components.
var uiExists = !!this.getGui();
if (uiExists) {
this.createChildComponentsFromTags(this.getGui());
}
};
Component.prototype.wireQuerySelectors = function () {
var _this = this;
if (!this.eGui) {
return;
}
var thisProto = Object.getPrototypeOf(this);
var _loop_1 = function () {
var metaData = thisProto.__agComponentMetaData;
var currentProtoName = (thisProto.constructor).name;
if (metaData && metaData[currentProtoName] && metaData[currentProtoName].querySelectors) {
var thisNoType_1 = this_1;
metaData[currentProtoName].querySelectors.forEach(function (querySelector) {
var resultOfQuery = _this.eGui.querySelector(querySelector.querySelector);
if (resultOfQuery) {
var backingComponent = resultOfQuery.__agComponent;
if (backingComponent) {
thisNoType_1[querySelector.attributeName] = backingComponent;
}
else {
thisNoType_1[querySelector.attributeName] = resultOfQuery;
}
}
else {
// put debug msg in here if query selector fails???
}
});
}
thisProto = Object.getPrototypeOf(thisProto);
};
var this_1 = this;
while (thisProto != null) {
_loop_1();
}
};
Component.prototype.addAnnotatedEventListeners = function () {
var _this = this;
this.removeAnnotatedEventListeners();
if (!this.eGui) {
return;
}
var listenerMethods = this.getAgComponentMetaData('listenerMethods');
if (utils_1._.missingOrEmpty(listenerMethods)) {
return;
}
if (!this.annotatedEventListeners) {
this.annotatedEventListeners = [];
}
listenerMethods.forEach(function (eventListener) {
var listener = _this[eventListener.methodName].bind(_this);
_this.eGui.addEventListener(eventListener.eventName, listener);
_this.annotatedEventListeners.push({ eventName: eventListener.eventName, listener: listener });
});
};
Component.prototype.getAgComponentMetaData = function (key) {
var res = [];
var thisProto = Object.getPrototypeOf(this);
while (thisProto != null) {
var metaData = thisProto.__agComponentMetaData;
var currentProtoName = (thisProto.constructor).name;
// IE does not support Function.prototype.name, so we need to extract
// the name using a RegEx
// from: https://matt.scharley.me/2012/03/monkey-patch-name-ie.html
if (currentProtoName === undefined) {
var funcNameRegex = /function\s([^(]{1,})\(/;
var results = funcNameRegex.exec(thisProto.constructor.toString());
if (results && results.length > 1) {
currentProtoName = results[1].trim();
}
}
if (metaData && metaData[currentProtoName] && metaData[currentProtoName][key]) {
res = res.concat(metaData[currentProtoName][key]);
}
thisProto = Object.getPrototypeOf(thisProto);
}
return res;
};
Component.prototype.removeAnnotatedEventListeners = function () {
var _this = this;
if (!this.annotatedEventListeners || !this.eGui) {
return;
}
this.annotatedEventListeners.forEach(function (eventListener) {
_this.eGui.removeEventListener(eventListener.eventName, eventListener.listener);
});
this.annotatedEventListeners = [];
};
Component.prototype.getGui = function () {
return this.eGui;
};
Component.prototype.setParentComponent = function (component) {
this.parentComponent = component;
};
Component.prototype.getParentComponent = function () {
return this.parentComponent;
};
// this method is for older code, that wants to provide the gui element,
// it is not intended for this to be in ag-Stack
Component.prototype.setGui = function (eGui) {
this.eGui = eGui;
};
Component.prototype.queryForHtmlElement = function (cssSelector) {
return this.eGui.querySelector(cssSelector);
};
Component.prototype.queryForHtmlInputElement = function (cssSelector) {
return this.eGui.querySelector(cssSelector);
};
Component.prototype.appendChild = function (newChild) {
if (utils_1._.isNodeOrElement(newChild)) {
this.eGui.appendChild(newChild);
}
else {
var childComponent = newChild;
this.eGui.appendChild(childComponent.getGui());
this.childComponents.push(childComponent);
}
};
Component.prototype.addFeature = function (context, feature) {
context.wireBean(feature);
if (feature.destroy) {
this.addDestroyFunc(feature.destroy.bind(feature));
}
};
Component.prototype.isDisplayed = function () {
return this.displayed;
};
Component.prototype.setVisible = function (visible) {
if (visible !== this.visible) {
this.visible = visible;
utils_1._.setVisible(this.eGui, visible);
}
};
Component.prototype.setDisplayed = function (displayed) {
if (displayed !== this.displayed) {
this.displayed = displayed;
utils_1._.setDisplayed(this.eGui, displayed);
var event_1 = {
type: Component.EVENT_DISPLAYED_CHANGED,
visible: this.displayed
};
this.dispatchEvent(event_1);
}
};
/* public setVisible(visible: boolean, visibilityMode?: 'display' | 'visibility'): void {
const isDisplay = visibilityMode !== 'visibility';
if (visible !== this.visible) {
this.visible = visible;
// ag-hidden: display: none -> setDisplayed();
// ag-invisible: visibility: hidden => setVisible();
_.addOrRemoveCssClass(this.eGui, isDisplay ? 'ag-hidden' : 'ag-invisible', !visible);
const event: VisibleChangedEvent = {
type: Component.EVENT_VISIBLE_CHANGED,
visible: this.visible
};
this.dispatchEvent(event);
}
}*/
Component.prototype.addOrRemoveCssClass = function (className, addOrRemove) {
utils_1._.addOrRemoveCssClass(this.eGui, className, addOrRemove);
};
Component.prototype.destroy = function () {
_super.prototype.destroy.call(this);
this.childComponents.forEach(function (childComponent) {
if (childComponent && childComponent.destroy) {
childComponent.destroy();
}
});
this.childComponents.length = 0;
this.removeAnnotatedEventListeners();
};
Component.prototype.addGuiEventListener = function (event, listener) {
var _this = this;
this.getGui().addEventListener(event, listener);
this.addDestroyFunc(function () { return _this.getGui().removeEventListener(event, listener); });
};
Component.prototype.addCssClass = function (className) {
utils_1._.addCssClass(this.getGui(), className);
};
Component.prototype.removeCssClass = function (className) {
utils_1._.removeCssClass(this.getGui(), className);
};
Component.prototype.getAttribute = function (key) {
var eGui = this.getGui();
return eGui ? eGui.getAttribute(key) : null;
};
Component.prototype.getRefElement = function (refName) {
return this.queryForHtmlElement('[ref="' + refName + '"]');
};
Component.EVENT_DISPLAYED_CHANGED = 'displayedChanged';
__decorate([
context_1.PreConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], Component.prototype, "createChildComponentsPreConstruct", null);
return Component;
}(beanStub_1.BeanStub));
exports.Component = Component;
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var eventService_1 = __webpack_require__(11);
var gridOptionsWrapper_1 = __webpack_require__(4);
var context_1 = __webpack_require__(13);
var utils_1 = __webpack_require__(5);
var BeanStub = /** @class */ (function () {
function BeanStub() {
this.destroyFunctions = [];
this.destroyed = false;
}
// this was a test constructor niall built, when active, it prints after 5 seconds all beans/components that are
// not destroyed. to use, create a new grid, then api.destroy() before 5 seconds. then anything that gets printed
// points to a bean or component that was not properly disposed of.
// constructor() {
// setTimeout(()=> {
// if (this.isAlive()) {
// let prototype: any = Object.getPrototypeOf(this);
// const constructor: any = prototype.constructor;
// const constructorString = constructor.toString();
// const beanName = constructorString.substring(9, constructorString.indexOf("("));
// console.log('is alive ' + beanName);
// }
// }, 5000);
// }
// CellComp and GridComp and override this because they get the FrameworkOverrides from the Beans bean
BeanStub.prototype.getFrameworkOverrides = function () {
return this.frameworkOverrides;
};
BeanStub.prototype.getContext = function () {
return this.context;
};
BeanStub.prototype.destroy = function () {
// let prototype: any = Object.getPrototypeOf(this);
// const constructor: any = prototype.constructor;
// const constructorString = constructor.toString();
// const beanName = constructorString.substring(9, constructorString.indexOf("("));
this.destroyFunctions.forEach(function (func) { return func(); });
this.destroyFunctions.length = 0;
this.destroyed = true;
this.dispatchEvent({ type: BeanStub.EVENT_DESTROYED });
};
BeanStub.prototype.addEventListener = function (eventType, listener) {
if (!this.localEventService) {
this.localEventService = new eventService_1.EventService();
}
this.localEventService.addEventListener(eventType, listener);
};
BeanStub.prototype.removeEventListener = function (eventType, listener) {
if (this.localEventService) {
this.localEventService.removeEventListener(eventType, listener);
}
};
BeanStub.prototype.dispatchEventAsync = function (event) {
var _this = this;
window.setTimeout(function () { return _this.dispatchEvent(event); }, 0);
};
BeanStub.prototype.dispatchEvent = function (event) {
if (this.localEventService) {
this.localEventService.dispatchEvent(event);
}
};
BeanStub.prototype.addDestroyableEventListener = function (eElement, event, listener) {
var _this = this;
if (this.destroyed) {
return;
}
if (eElement instanceof HTMLElement) {
utils_1._.addSafePassiveEventListener(this.getFrameworkOverrides(), eElement, event, listener);
}
else if (eElement instanceof Window) {
eElement.addEventListener(event, listener);
}
else if (eElement instanceof gridOptionsWrapper_1.GridOptionsWrapper) {
eElement.addEventListener(event, listener);
}
else {
eElement.addEventListener(event, listener);
}
var destroyFunc = function () {
if (eElement instanceof HTMLElement) {
eElement.removeEventListener(event, listener);
}
else if (eElement instanceof Window) {
eElement.removeEventListener(event, listener);
}
else if (eElement instanceof gridOptionsWrapper_1.GridOptionsWrapper) {
eElement.removeEventListener(event, listener);
}
else {
eElement.removeEventListener(event, listener);
}
_this.destroyFunctions = _this.destroyFunctions.filter(function (fn) { return fn !== destroyFunc; });
};
this.destroyFunctions.push(destroyFunc);
return destroyFunc;
};
BeanStub.prototype.isAlive = function () {
return !this.destroyed;
};
BeanStub.prototype.addDestroyFunc = function (func) {
// if we are already destroyed, we execute the func now
if (this.isAlive()) {
this.destroyFunctions.push(func);
}
else {
func();
}
};
BeanStub.EVENT_DESTROYED = 'destroyed';
__decorate([
context_1.Autowired('context'),
__metadata("design:type", context_1.Context)
], BeanStub.prototype, "context", void 0);
__decorate([
context_1.Autowired('frameworkOverrides'),
__metadata("design:type", Object)
], BeanStub.prototype, "frameworkOverrides", void 0);
__decorate([
context_1.PreDestroy,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], BeanStub.prototype, "destroy", null);
return BeanStub;
}());
exports.BeanStub = BeanStub;
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = __webpack_require__(33);
var rowNode_1 = __webpack_require__(36);
var context_1 = __webpack_require__(13);
var gridOptionsWrapper_1 = __webpack_require__(4);
var events_1 = __webpack_require__(15);
var eventService_1 = __webpack_require__(11);
var gridApi_1 = __webpack_require__(18);
var columnApi_1 = __webpack_require__(26);
var utils_1 = __webpack_require__(5);
var CheckboxSelectionComponent = /** @class */ (function (_super) {
__extends(CheckboxSelectionComponent, _super);
function CheckboxSelectionComponent() {
return _super.call(this, "") || this;
}
CheckboxSelectionComponent.prototype.createAndAddIcons = function () {
this.eCheckedIcon = utils_1._.createIconNoSpan('checkboxChecked', this.gridOptionsWrapper, this.column);
this.eUncheckedIcon = utils_1._.createIconNoSpan('checkboxUnchecked', this.gridOptionsWrapper, this.column);
this.eIndeterminateIcon = utils_1._.createIconNoSpan('checkboxIndeterminate', this.gridOptionsWrapper, this.column);
var element = this.getGui();
element.appendChild(this.eCheckedIcon);
element.appendChild(this.eUncheckedIcon);
element.appendChild(this.eIndeterminateIcon);
};
CheckboxSelectionComponent.prototype.onDataChanged = function () {
// when rows are loaded for the second time, this can impact the selection, as a row
// could be loaded as already selected (if user scrolls down, and then up again).
this.onSelectionChanged();
};
CheckboxSelectionComponent.prototype.onSelectableChanged = function () {
this.showOrHideSelect();
};
CheckboxSelectionComponent.prototype.onSelectionChanged = function () {
var state = this.rowNode.isSelected();
utils_1._.setDisplayed(this.eCheckedIcon, state === true);
utils_1._.setDisplayed(this.eUncheckedIcon, state === false);
utils_1._.setDisplayed(this.eIndeterminateIcon, typeof state !== 'boolean');
};
CheckboxSelectionComponent.prototype.onCheckedClicked = function () {
var groupSelectsFiltered = this.gridOptionsWrapper.isGroupSelectsFiltered();
var updatedCount = this.rowNode.setSelectedParams({ newValue: false, groupSelectsFiltered: groupSelectsFiltered });
return updatedCount;
};
CheckboxSelectionComponent.prototype.onUncheckedClicked = function (event) {
var groupSelectsFiltered = this.gridOptionsWrapper.isGroupSelectsFiltered();
var updatedCount = this.rowNode.setSelectedParams({ newValue: true, rangeSelect: event.shiftKey, groupSelectsFiltered: groupSelectsFiltered });
return updatedCount;
};
CheckboxSelectionComponent.prototype.onIndeterminateClicked = function (event) {
var result = this.onUncheckedClicked(event);
if (result === 0) {
this.onCheckedClicked();
}
};
CheckboxSelectionComponent.prototype.init = function (params) {
this.rowNode = params.rowNode;
this.column = params.column;
this.createAndAddIcons();
this.onSelectionChanged();
// we don't want the row clicked event to fire when selecting the checkbox, otherwise the row
// would possibly get selected twice
this.addGuiEventListener('click', function (event) { return utils_1._.stopPropagationForAgGrid(event); });
// likewise we don't want double click on this icon to open a group
this.addGuiEventListener('dblclick', function (event) { return utils_1._.stopPropagationForAgGrid(event); });
this.addDestroyableEventListener(this.eCheckedIcon, 'click', this.onCheckedClicked.bind(this));
this.addDestroyableEventListener(this.eUncheckedIcon, 'click', this.onUncheckedClicked.bind(this));
this.addDestroyableEventListener(this.eIndeterminateIcon, 'click', this.onIndeterminateClicked.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_ROW_SELECTED, this.onSelectionChanged.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_DATA_CHANGED, this.onDataChanged.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_SELECTABLE_CHANGED, this.onSelectableChanged.bind(this));
this.isRowSelectableFunc = this.gridOptionsWrapper.getIsRowSelectableFunc();
var checkboxVisibleIsDynamic = this.isRowSelectableFunc || this.checkboxCallbackExists();
if (checkboxVisibleIsDynamic) {
this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.showOrHideSelect.bind(this));
this.showOrHideSelect();
}
};
CheckboxSelectionComponent.prototype.showOrHideSelect = function () {
// if the isRowSelectable() is not provided the row node is selectable by default
var selectable = this.rowNode.selectable;
// checkboxSelection callback is deemed a legacy solution however we will still consider it's result.
// If selectable, then also check the colDef callback. if not selectable, this it short circuits - no need
// to call the colDef callback.
if (selectable && this.checkboxCallbackExists()) {
selectable = this.column.isCellCheckboxSelection(this.rowNode);
}
// show checkbox if both conditions are true
this.setDisplayed(selectable);
};
CheckboxSelectionComponent.prototype.checkboxCallbackExists = function () {
// column will be missing if groupUseEntireRow=true
var colDef = this.column ? this.column.getColDef() : null;
return colDef && typeof colDef.checkboxSelection === 'function';
};
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], CheckboxSelectionComponent.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.Autowired('eventService'),
__metadata("design:type", eventService_1.EventService)
], CheckboxSelectionComponent.prototype, "eventService", void 0);
__decorate([
context_1.Autowired('gridApi'),
__metadata("design:type", gridApi_1.GridApi)
], CheckboxSelectionComponent.prototype, "gridApi", void 0);
__decorate([
context_1.Autowired('columnApi'),
__metadata("design:type", columnApi_1.ColumnApi)
], CheckboxSelectionComponent.prototype, "columnApi", void 0);
return CheckboxSelectionComponent;
}(component_1.Component));
exports.CheckboxSelectionComponent = CheckboxSelectionComponent;
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var eventService_1 = __webpack_require__(11);
var events_1 = __webpack_require__(15);
var gridOptionsWrapper_1 = __webpack_require__(4);
var selectionController_1 = __webpack_require__(37);
var valueService_1 = __webpack_require__(39);
var columnController_1 = __webpack_require__(21);
var columnApi_1 = __webpack_require__(26);
var context_1 = __webpack_require__(13);
var constants_1 = __webpack_require__(8);
var valueCache_1 = __webpack_require__(40);
var gridApi_1 = __webpack_require__(18);
var utils_1 = __webpack_require__(5);
var RowNode = /** @class */ (function () {
function RowNode() {
/** Children mapped by the pivot columns */
this.childrenMapped = {};
/** True by default - can be overridden via gridOptions.isRowSelectable(rowNode) */
this.selectable = true;
/** Used by sorting service - to give deterministic sort to groups. Previously we
* just id for this, however id is a string and had slower sorting compared to numbers. */
this.__objectId = RowNode.OBJECT_ID_SEQUENCE++;
/** True when nodes with the same id are being removed and added as part of the same batch transaction */
this.alreadyRendered = false;
this.selected = false;
}
RowNode.prototype.setData = function (data) {
var oldData = this.data;
this.data = data;
this.valueCache.onDataChanged();
this.updateDataOnDetailNode();
this.checkRowSelectable();
var event = this.createDataChangedEvent(data, oldData, false);
this.dispatchLocalEvent(event);
};
// when we are doing master / detail, the detail node is lazy created, but then kept around.
// so if we show / hide the detail, the same detail rowNode is used. so we need to keep the data
// in sync, otherwise expand/collapse of the detail would still show the old values.
RowNode.prototype.updateDataOnDetailNode = function () {
if (this.detailNode) {
this.detailNode.data = this.data;
}
};
RowNode.prototype.createDataChangedEvent = function (newData, oldData, update) {
return {
type: RowNode.EVENT_DATA_CHANGED,
node: this,
oldData: oldData,
newData: newData,
update: update
};
};
RowNode.prototype.createLocalRowEvent = function (type) {
return {
type: type,
node: this
};
};
// similar to setRowData, however it is expected that the data is the same data item. this
// is intended to be used with Redux type stores, where the whole data can be changed. we are
// guaranteed that the data is the same entity (so grid doesn't need to worry about the id of the
// underlying data changing, hence doesn't need to worry about selection). the grid, upon receiving
// dataChanged event, will refresh the cells rather than rip them all out (so user can show transitions).
RowNode.prototype.updateData = function (data) {
var oldData = this.data;
this.data = data;
this.updateDataOnDetailNode();
this.checkRowSelectable();
this.updateDataOnDetailNode();
var event = this.createDataChangedEvent(data, oldData, true);
this.dispatchLocalEvent(event);
};
RowNode.prototype.getRowIndexString = function () {
if (this.rowPinned === constants_1.Constants.PINNED_TOP) {
return 't-' + this.rowIndex;
}
else if (this.rowPinned === constants_1.Constants.PINNED_BOTTOM) {
return 'b-' + this.rowIndex;
}
else {
return this.rowIndex.toString();
}
};
RowNode.prototype.createDaemonNode = function () {
var oldNode = new RowNode();
this.context.wireBean(oldNode);
// just copy the id and data, this is enough for the node to be used
// in the selection controller (the selection controller is the only
// place where daemon nodes can live).
oldNode.id = this.id;
oldNode.data = this.data;
oldNode.daemon = true;
oldNode.selected = this.selected;
oldNode.level = this.level;
return oldNode;
};
RowNode.prototype.setDataAndId = function (data, id) {
var oldNode = utils_1._.exists(this.id) ? this.createDaemonNode() : null;
var oldData = this.data;
this.data = data;
this.updateDataOnDetailNode();
this.setId(id);
this.selectionController.syncInRowNode(this, oldNode);
this.checkRowSelectable();
var event = this.createDataChangedEvent(data, oldData, false);
this.dispatchLocalEvent(event);
};
RowNode.prototype.checkRowSelectable = function () {
var isRowSelectableFunc = this.gridOptionsWrapper.getIsRowSelectableFunc();
var shouldInvokeIsRowSelectable = isRowSelectableFunc && utils_1._.exists(this);
this.setRowSelectable(shouldInvokeIsRowSelectable ? isRowSelectableFunc(this) : true);
};
RowNode.prototype.setRowSelectable = function (newVal) {
if (this.selectable !== newVal) {
this.selectable = newVal;
if (this.eventService) {
this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_SELECTABLE_CHANGED));
}
}
};
RowNode.prototype.setId = function (id) {
// see if user is providing the id's
var getRowNodeId = this.gridOptionsWrapper.getRowNodeIdFunc();
if (getRowNodeId) {
// if user is providing the id's, then we set the id only after the data has been set.
// this is important for virtual pagination and viewport, where empty rows exist.
if (this.data) {
this.id = getRowNodeId(this.data);
}
else {
// this can happen if user has set blank into the rowNode after the row previously
// having data. this happens in virtual page row model, when data is delete and
// the page is refreshed.
this.id = undefined;
}
}
else {
this.id = id;
}
};
RowNode.prototype.isPixelInRange = function (pixel) {
return pixel >= this.rowTop && pixel < (this.rowTop + this.rowHeight);
};
RowNode.prototype.clearRowTop = function () {
this.oldRowTop = this.rowTop;
this.setRowTop(null);
};
RowNode.prototype.setFirstChild = function (firstChild) {
if (this.firstChild === firstChild) {
return;
}
this.firstChild = firstChild;
if (this.eventService) {
this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_FIRST_CHILD_CHANGED));
}
};
RowNode.prototype.setLastChild = function (lastChild) {
if (this.lastChild === lastChild) {
return;
}
this.lastChild = lastChild;
if (this.eventService) {
this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_LAST_CHILD_CHANGED));
}
};
RowNode.prototype.setChildIndex = function (childIndex) {
if (this.childIndex === childIndex) {
return;
}
this.childIndex = childIndex;
if (this.eventService) {
this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_CHILD_INDEX_CHANGED));
}
};
RowNode.prototype.setRowTop = function (rowTop) {
if (this.rowTop === rowTop) {
return;
}
this.rowTop = rowTop;
if (this.eventService) {
this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_TOP_CHANGED));
}
};
RowNode.prototype.setDragging = function (dragging) {
if (this.dragging === dragging) {
return;
}
this.dragging = dragging;
if (this.eventService) {
this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_DRAGGING_CHANGED));
}
};
RowNode.prototype.setAllChildrenCount = function (allChildrenCount) {
if (this.allChildrenCount === allChildrenCount) {
return;
}
this.allChildrenCount = allChildrenCount;
if (this.eventService) {
this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED));
}
};
RowNode.prototype.setRowHeight = function (rowHeight, estimated) {
if (estimated === void 0) { estimated = false; }
this.rowHeight = rowHeight;
this.rowHeightEstimated = estimated;
if (this.eventService) {
this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HEIGHT_CHANGED));
}
};
RowNode.prototype.setRowIndex = function (rowIndex) {
this.rowIndex = rowIndex;
if (this.eventService) {
this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_ROW_INDEX_CHANGED));
}
};
RowNode.prototype.setUiLevel = function (uiLevel) {
if (this.uiLevel === uiLevel) {
return;
}
this.uiLevel = uiLevel;
if (this.eventService) {
this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_UI_LEVEL_CHANGED));
}
};
RowNode.prototype.setExpanded = function (expanded) {
if (this.expanded === expanded) {
return;
}
this.expanded = expanded;
if (this.eventService) {
this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_EXPANDED_CHANGED));
}
var event = this.createGlobalRowEvent(events_1.Events.EVENT_ROW_GROUP_OPENED);
this.mainEventService.dispatchEvent(event);
if (this.gridOptionsWrapper.isGroupIncludeFooter()) {
this.gridApi.redrawRows({ rowNodes: [this] });
}
};
RowNode.prototype.createGlobalRowEvent = function (type) {
var event = {
type: type,
node: this,
data: this.data,
rowIndex: this.rowIndex,
rowPinned: this.rowPinned,
context: this.gridOptionsWrapper.getContext(),
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi()
};
return event;
};
RowNode.prototype.dispatchLocalEvent = function (event) {
if (this.eventService) {
this.eventService.dispatchEvent(event);
}
};
// we also allow editing the value via the editors. when it is done via
// the editors, no 'cell changed' event gets fired, as it's assumed that
// the cell knows about the change given it's in charge of the editing.
// this method is for the client to call, so the cell listens for the change
// event, and also flashes the cell when the change occurs.
RowNode.prototype.setDataValue = function (colKey, newValue) {
var column = this.columnController.getPrimaryColumn(colKey);
this.valueService.setValue(this, column, newValue);
this.dispatchCellChangedEvent(column, newValue);
};
RowNode.prototype.setGroupValue = function (colKey, newValue) {
var column = this.columnController.getGridColumn(colKey);
if (utils_1._.missing(this.groupData)) {
this.groupData = {};
}
this.groupData[column.getColId()] = newValue;
this.dispatchCellChangedEvent(column, newValue);
};
// sets the data for an aggregation
RowNode.prototype.setAggData = function (newAggData) {
var _this = this;
// find out all keys that could potentially change
var colIds = utils_1._.getAllKeysInObjects([this.aggData, newAggData]);
this.aggData = newAggData;
// if no event service, nobody has registered for events, so no need fire event
if (this.eventService) {
colIds.forEach(function (colId) {
var column = _this.columnController.getGridColumn(colId);
var value = _this.aggData ? _this.aggData[colId] : undefined;
_this.dispatchCellChangedEvent(column, value);
});
}
};
RowNode.prototype.hasChildren = function () {
// we need to return true when this.group=true, as this is used by server side row model
// (as children are lazy loaded and stored in a cache anyway). otherwise we return true
// if children exist.
return this.group || (this.childrenAfterGroup && this.childrenAfterGroup.length > 0);
};
RowNode.prototype.isEmptyRowGroupNode = function () {
return this.group && utils_1._.missingOrEmpty(this.childrenAfterGroup);
};
RowNode.prototype.dispatchCellChangedEvent = function (column, newValue) {
var cellChangedEvent = {
type: RowNode.EVENT_CELL_CHANGED,
node: this,
column: column,
newValue: newValue
};
this.dispatchLocalEvent(cellChangedEvent);
};
RowNode.prototype.resetQuickFilterAggregateText = function () {
this.quickFilterAggregateText = null;
};
RowNode.prototype.isExpandable = function () {
return this.hasChildren() || this.master;
};
RowNode.prototype.isSelected = function () {
// for footers, we just return what our sibling selected state is, as cannot select a footer
if (this.footer) {
return this.sibling.isSelected();
}
return this.selected;
};
RowNode.prototype.depthFirstSearch = function (callback) {
if (this.childrenAfterGroup) {
this.childrenAfterGroup.forEach(function (child) { return child.depthFirstSearch(callback); });
}
callback(this);
};
// + rowController.updateGroupsInSelection()
// + selectionController.calculatedSelectedForAllGroupNodes()
RowNode.prototype.calculateSelectedFromChildren = function () {
var atLeastOneSelected = false;
var atLeastOneDeSelected = false;
var atLeastOneMixed = false;
var newSelectedValue;
if (this.childrenAfterGroup) {
for (var i = 0; i < this.childrenAfterGroup.length; i++) {
var child = this.childrenAfterGroup[i];
// skip non-selectable nodes to prevent inconsistent selection values
if (!child.selectable) {
continue;
}
var childState = child.isSelected();
switch (childState) {
case true:
atLeastOneSelected = true;
break;
case false:
atLeastOneDeSelected = true;
break;
default:
atLeastOneMixed = true;
break;
}
}
}
if (atLeastOneMixed) {
newSelectedValue = undefined;
}
else if (atLeastOneSelected && !atLeastOneDeSelected) {
newSelectedValue = true;
}
else if (!atLeastOneSelected && atLeastOneDeSelected) {
newSelectedValue = false;
}
else {
newSelectedValue = undefined;
}
this.selectThisNode(newSelectedValue);
};
RowNode.prototype.setSelectedInitialValue = function (selected) {
this.selected = selected;
};
RowNode.prototype.setSelected = function (newValue, clearSelection, suppressFinishActions) {
if (clearSelection === void 0) { clearSelection = false; }
if (suppressFinishActions === void 0) { suppressFinishActions = false; }
this.setSelectedParams({
newValue: newValue,
clearSelection: clearSelection,
suppressFinishActions: suppressFinishActions,
rangeSelect: false
});
};
RowNode.prototype.isRowPinned = function () {
return this.rowPinned === constants_1.Constants.PINNED_TOP || this.rowPinned === constants_1.Constants.PINNED_BOTTOM;
};
// to make calling code more readable, this is the same method as setSelected except it takes names parameters
RowNode.prototype.setSelectedParams = function (params) {
var groupSelectsChildren = this.gridOptionsWrapper.isGroupSelectsChildren();
var newValue = params.newValue === true;
var clearSelection = params.clearSelection === true;
var suppressFinishActions = params.suppressFinishActions === true;
var rangeSelect = params.rangeSelect === true;
// groupSelectsFiltered only makes sense when group selects children
var groupSelectsFiltered = groupSelectsChildren && (params.groupSelectsFiltered === true);
if (this.id === undefined) {
console.warn('ag-Grid: cannot select node until id for node is known');
return 0;
}
if (this.rowPinned) {
console.warn('ag-Grid: cannot select pinned rows');
return 0;
}
// if we are a footer, we don't do selection, just pass the info
// to the sibling (the parent of the group)
if (this.footer) {
var count = this.sibling.setSelectedParams(params);
return count;
}
if (rangeSelect) {
var newRowClicked = this.selectionController.getLastSelectedNode() !== this;
var allowMultiSelect = this.gridOptionsWrapper.isRowSelectionMulti();
if (newRowClicked && allowMultiSelect) {
return this.doRowRangeSelection();
}
}
var updatedCount = 0;
// when groupSelectsFiltered, then this node may end up intermediate despite
// trying to set it to true / false. this group will be calculated further on
// down when we call calculatedSelectedForAllGroupNodes(). we need to skip it
// here, otherwise the updatedCount would include it.
var skipThisNode = groupSelectsFiltered && this.group;
if (!skipThisNode) {
var thisNodeWasSelected = this.selectThisNode(newValue);
if (thisNodeWasSelected) {
updatedCount++;
}
}
if (groupSelectsChildren && this.group) {
updatedCount += this.selectChildNodes(newValue, groupSelectsFiltered);
}
// clear other nodes if not doing multi select
if (!suppressFinishActions) {
var clearOtherNodes = newValue && (clearSelection || !this.gridOptionsWrapper.isRowSelectionMulti());
if (clearOtherNodes) {
updatedCount += this.selectionController.clearOtherNodes(this);
}
// only if we selected something, then update groups and fire events
if (updatedCount > 0) {
this.selectionController.updateGroupsFromChildrenSelections();
// this is the very end of the 'action node', so we are finished all the updates,
// include any parent / child changes that this method caused
var event_1 = {
type: events_1.Events.EVENT_SELECTION_CHANGED,
api: this.gridApi,
columnApi: this.columnApi
};
this.mainEventService.dispatchEvent(event_1);
}
// so if user next does shift-select, we know where to start the selection from
if (newValue) {
this.selectionController.setLastSelectedNode(this);
}
}
return updatedCount;
};
// selects all rows between this node and the last selected node (or the top if this is the first selection).
// not to be mixed up with 'cell range selection' where you drag the mouse, this is row range selection, by
// holding down 'shift'.
RowNode.prototype.doRowRangeSelection = function () {
var updatedCount = 0;
var groupsSelectChildren = this.gridOptionsWrapper.isGroupSelectsChildren();
var lastSelectedNode = this.selectionController.getLastSelectedNode();
var nodesToSelect = this.rowModel.getNodesInRangeForSelection(this, lastSelectedNode);
nodesToSelect.forEach(function (rowNode) {
if (rowNode.group && groupsSelectChildren) {
return;
}
var nodeWasSelected = rowNode.selectThisNode(true);
if (nodeWasSelected) {
updatedCount++;
}
});
this.selectionController.updateGroupsFromChildrenSelections();
var event = {
type: events_1.Events.EVENT_SELECTION_CHANGED,
api: this.gridApi,
columnApi: this.columnApi
};
this.mainEventService.dispatchEvent(event);
return updatedCount;
};
RowNode.prototype.isParentOfNode = function (potentialParent) {
var parentNode = this.parent;
while (parentNode) {
if (parentNode === potentialParent) {
return true;
}
parentNode = parentNode.parent;
}
return false;
};
RowNode.prototype.selectThisNode = function (newValue) {
if (!this.selectable || this.selected === newValue) {
return false;
}
this.selected = newValue;
if (this.eventService) {
this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_ROW_SELECTED));
}
var event = this.createGlobalRowEvent(events_1.Events.EVENT_ROW_SELECTED);
this.mainEventService.dispatchEvent(event);
return true;
};
RowNode.prototype.selectChildNodes = function (newValue, groupSelectsFiltered) {
var children = groupSelectsFiltered ? this.childrenAfterFilter : this.childrenAfterGroup;
var updatedCount = 0;
if (utils_1._.missing(children)) {
return;
}
for (var i = 0; i < children.length; i++) {
updatedCount += children[i].setSelectedParams({
newValue: newValue,
clearSelection: false,
suppressFinishActions: true,
groupSelectsFiltered: groupSelectsFiltered
});
}
return updatedCount;
};
RowNode.prototype.addEventListener = function (eventType, listener) {
if (!this.eventService) {
this.eventService = new eventService_1.EventService();
}
this.eventService.addEventListener(eventType, listener);
};
RowNode.prototype.removeEventListener = function (eventType, listener) {
this.eventService.removeEventListener(eventType, listener);
};
RowNode.prototype.onMouseEnter = function () {
this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_MOUSE_ENTER));
};
RowNode.prototype.onMouseLeave = function () {
this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_MOUSE_LEAVE));
};
RowNode.prototype.getFirstChildOfFirstChild = function (rowGroupColumn) {
var currentRowNode = this;
// if we are hiding groups, then if we are the first child, of the first child,
// all the way up to the column we are interested in, then we show the group cell.
var isCandidate = true;
var foundFirstChildPath = false;
var nodeToSwapIn;
while (isCandidate && !foundFirstChildPath) {
var parentRowNode = currentRowNode.parent;
var firstChild = utils_1._.exists(parentRowNode) && currentRowNode.firstChild;
if (firstChild) {
if (parentRowNode.rowGroupColumn === rowGroupColumn) {
foundFirstChildPath = true;
nodeToSwapIn = parentRowNode;
}
}
else {
isCandidate = false;
}
currentRowNode = parentRowNode;
}
return foundFirstChildPath ? nodeToSwapIn : null;
};
RowNode.OBJECT_ID_SEQUENCE = 0;
RowNode.EVENT_ROW_SELECTED = 'rowSelected';
RowNode.EVENT_DATA_CHANGED = 'dataChanged';
RowNode.EVENT_CELL_CHANGED = 'cellChanged';
RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED = 'allChildrenCountChanged';
RowNode.EVENT_MOUSE_ENTER = 'mouseEnter';
RowNode.EVENT_MOUSE_LEAVE = 'mouseLeave';
RowNode.EVENT_HEIGHT_CHANGED = 'heightChanged';
RowNode.EVENT_TOP_CHANGED = 'topChanged';
RowNode.EVENT_FIRST_CHILD_CHANGED = 'firstChildChanged';
RowNode.EVENT_LAST_CHILD_CHANGED = 'lastChildChanged';
RowNode.EVENT_CHILD_INDEX_CHANGED = 'childIndexChanged';
RowNode.EVENT_ROW_INDEX_CHANGED = 'rowIndexChanged';
RowNode.EVENT_EXPANDED_CHANGED = 'expandedChanged';
RowNode.EVENT_SELECTABLE_CHANGED = 'selectableChanged';
RowNode.EVENT_UI_LEVEL_CHANGED = 'uiLevelChanged';
RowNode.EVENT_DRAGGING_CHANGED = 'draggingChanged';
__decorate([
context_1.Autowired('eventService'),
__metadata("design:type", eventService_1.EventService)
], RowNode.prototype, "mainEventService", void 0);
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], RowNode.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.Autowired('selectionController'),
__metadata("design:type", selectionController_1.SelectionController)
], RowNode.prototype, "selectionController", void 0);
__decorate([
context_1.Autowired('columnController'),
__metadata("design:type", columnController_1.ColumnController)
], RowNode.prototype, "columnController", void 0);
__decorate([
context_1.Autowired('valueService'),
__metadata("design:type", valueService_1.ValueService)
], RowNode.prototype, "valueService", void 0);
__decorate([
context_1.Autowired('rowModel'),
__metadata("design:type", Object)
], RowNode.prototype, "rowModel", void 0);
__decorate([
context_1.Autowired('context'),
__metadata("design:type", context_1.Context)
], RowNode.prototype, "context", void 0);
__decorate([
context_1.Autowired('valueCache'),
__metadata("design:type", valueCache_1.ValueCache)
], RowNode.prototype, "valueCache", void 0);
__decorate([
context_1.Autowired('columnApi'),
__metadata("design:type", columnApi_1.ColumnApi)
], RowNode.prototype, "columnApi", void 0);
__decorate([
context_1.Autowired('gridApi'),
__metadata("design:type", gridApi_1.GridApi)
], RowNode.prototype, "gridApi", void 0);
return RowNode;
}());
exports.RowNode = RowNode;
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
var context_1 = __webpack_require__(13);
var context_2 = __webpack_require__(13);
var logger_1 = __webpack_require__(12);
var eventService_1 = __webpack_require__(11);
var events_1 = __webpack_require__(15);
var context_3 = __webpack_require__(13);
var gridOptionsWrapper_1 = __webpack_require__(4);
var context_4 = __webpack_require__(13);
var constants_1 = __webpack_require__(8);
var columnApi_1 = __webpack_require__(26);
var gridApi_1 = __webpack_require__(18);
var utils_1 = __webpack_require__(5);
var changedPath_1 = __webpack_require__(38);
var SelectionController = /** @class */ (function () {
function SelectionController() {
}
SelectionController.prototype.setBeans = function (loggerFactory) {
this.logger = loggerFactory.create('SelectionController');
this.reset();
if (this.gridOptionsWrapper.isRowModelDefault()) {
this.eventService.addEventListener(events_1.Events.EVENT_ROW_DATA_CHANGED, this.reset.bind(this));
}
else {
this.logger.log('dont know what to do here');
}
};
SelectionController.prototype.init = function () {
this.groupSelectsChildren = this.gridOptionsWrapper.isGroupSelectsChildren();
this.eventService.addEventListener(events_1.Events.EVENT_ROW_SELECTED, this.onRowSelected.bind(this));
};
SelectionController.prototype.setLastSelectedNode = function (rowNode) {
this.lastSelectedNode = rowNode;
};
SelectionController.prototype.getLastSelectedNode = function () {
return this.lastSelectedNode;
};
SelectionController.prototype.getSelectedNodes = function () {
var selectedNodes = [];
utils_1._.iterateObject(this.selectedNodes, function (key, rowNode) {
if (rowNode) {
selectedNodes.push(rowNode);
}
});
return selectedNodes;
};
SelectionController.prototype.getSelectedRows = function () {
var selectedRows = [];
utils_1._.iterateObject(this.selectedNodes, function (key, rowNode) {
if (rowNode && rowNode.data) {
selectedRows.push(rowNode.data);
}
});
return selectedRows;
};
SelectionController.prototype.removeGroupsFromSelection = function () {
var _this = this;
utils_1._.iterateObject(this.selectedNodes, function (key, rowNode) {
if (rowNode && rowNode.group) {
_this.selectedNodes[rowNode.id] = undefined;
}
});
};
// should only be called if groupSelectsChildren=true
SelectionController.prototype.updateGroupsFromChildrenSelections = function (changedPath) {
// we only do this when group selection state depends on selected children
if (!this.gridOptionsWrapper.isGroupSelectsChildren()) {
return;
}
// also only do it if CSRM (code should never allow this anyway)
if (this.rowModel.getType() !== constants_1.Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
return;
}
var clientSideRowModel = this.rowModel;
var rootNode = clientSideRowModel.getRootNode();
if (!changedPath) {
changedPath = new changedPath_1.ChangedPath(true, rootNode);
changedPath.setInactive();
}
changedPath.forEachChangedNodeDepthFirst(function (rowNode) {
if (rowNode !== rootNode) {
rowNode.calculateSelectedFromChildren();
}
});
// clientSideRowModel.getTopLevelNodes()!.forEach((rowNode: RowNode) => {
// rowNode.depthFirstSearch((node) => {
// if (node.group) {
// }
// });
// });
};
SelectionController.prototype.getNodeForIdIfSelected = function (id) {
return this.selectedNodes[id];
};
SelectionController.prototype.clearOtherNodes = function (rowNodeToKeepSelected) {
var _this = this;
var groupsToRefresh = {};
var updatedCount = 0;
utils_1._.iterateObject(this.selectedNodes, function (key, otherRowNode) {
if (otherRowNode && otherRowNode.id !== rowNodeToKeepSelected.id) {
var rowNode = _this.selectedNodes[otherRowNode.id];
updatedCount += rowNode.setSelectedParams({
newValue: false,
clearSelection: false,
suppressFinishActions: true
});
if (_this.groupSelectsChildren && otherRowNode.parent) {
groupsToRefresh[otherRowNode.parent.id] = otherRowNode.parent;
}
}
});
utils_1._.iterateObject(groupsToRefresh, function (key, group) {
group.calculateSelectedFromChildren();
});
return updatedCount;
};
SelectionController.prototype.onRowSelected = function (event) {
var rowNode = event.node;
// we do not store the group rows when the groups select children
if (this.groupSelectsChildren && rowNode.group) {
return;
}
if (rowNode.isSelected()) {
this.selectedNodes[rowNode.id] = rowNode;
}
else {
this.selectedNodes[rowNode.id] = undefined;
}
};
SelectionController.prototype.syncInRowNode = function (rowNode, oldNode) {
this.syncInOldRowNode(rowNode, oldNode);
this.syncInNewRowNode(rowNode);
};
// if the id has changed for the node, then this means the rowNode
// is getting used for a different data item, which breaks
// our selectedNodes, as the node now is mapped by the old id
// which is inconsistent. so to keep the old node as selected,
// we swap in the clone (with the old id and old data). this means
// the oldNode is effectively a daemon we keep a reference to,
// so if client calls api.getSelectedNodes(), it gets the daemon
// in the result. when the client un-selects, the reference to the
// daemon is removed. the daemon, because it's an oldNode, is not
// used by the grid for rendering, it's a copy of what the node used
// to be like before the id was changed.
SelectionController.prototype.syncInOldRowNode = function (rowNode, oldNode) {
var oldNodeHasDifferentId = utils_1._.exists(oldNode) && (rowNode.id !== oldNode.id);
if (oldNodeHasDifferentId) {
var oldNodeSelected = utils_1._.exists(this.selectedNodes[oldNode.id]);
if (oldNodeSelected) {
this.selectedNodes[oldNode.id] = oldNode;
}
}
};
SelectionController.prototype.syncInNewRowNode = function (rowNode) {
if (utils_1._.exists(this.selectedNodes[rowNode.id])) {
rowNode.setSelectedInitialValue(true);
this.selectedNodes[rowNode.id] = rowNode;
}
else {
rowNode.setSelectedInitialValue(false);
}
};
SelectionController.prototype.reset = function () {
this.logger.log('reset');
this.selectedNodes = {};
this.lastSelectedNode = null;
};
// returns a list of all nodes at 'best cost' - a feature to be used
// with groups / trees. if a group has all it's children selected,
// then the group appears in the result, but not the children.
// Designed for use with 'children' as the group selection type,
// where groups don't actually appear in the selection normally.
SelectionController.prototype.getBestCostNodeSelection = function () {
if (this.rowModel.getType() !== constants_1.Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
console.warn('getBestCostNodeSelection is only available when using normal row model');
}
var clientSideRowModel = this.rowModel;
var topLevelNodes = clientSideRowModel.getTopLevelNodes();
if (topLevelNodes === null) {
console.warn('selectAll not available doing rowModel=virtual');
return;
}
var result = [];
// recursive function, to find the selected nodes
function traverse(nodes) {
for (var i = 0, l = nodes.length; i < l; i++) {
var node = nodes[i];
if (node.isSelected()) {
result.push(node);
}
else {
// if not selected, then if it's a group, and the group
// has children, continue to search for selections
if (node.group && node.children) {
traverse(node.children);
}
}
}
}
traverse(topLevelNodes);
return result;
};
SelectionController.prototype.setRowModel = function (rowModel) {
this.rowModel = rowModel;
};
SelectionController.prototype.isEmpty = function () {
var count = 0;
utils_1._.iterateObject(this.selectedNodes, function (nodeId, rowNode) {
if (rowNode) {
count++;
}
});
return count === 0;
};
SelectionController.prototype.deselectAllRowNodes = function (justFiltered) {
if (justFiltered === void 0) { justFiltered = false; }
var callback = function (rowNode) { return rowNode.selectThisNode(false); };
var rowModelClientSide = this.rowModel.getType() === constants_1.Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
if (justFiltered) {
if (!rowModelClientSide) {
console.error('ag-Grid: selecting just filtered only works with In Memory Row Model');
return;
}
var clientSideRowModel = this.rowModel;
clientSideRowModel.forEachNodeAfterFilter(callback);
}
else {
utils_1._.iterateObject(this.selectedNodes, function (id, rowNode) {
// remember the reference can be to null, as we never 'delete' from the map
if (rowNode) {
callback(rowNode);
}
});
// this clears down the map (whereas above only sets the items in map to 'undefined')
this.reset();
}
// the above does not clean up the parent rows if they are selected
if (rowModelClientSide && this.groupSelectsChildren) {
this.updateGroupsFromChildrenSelections();
}
var event = {
type: events_1.Events.EVENT_SELECTION_CHANGED,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEvent(event);
};
SelectionController.prototype.selectAllRowNodes = function (justFiltered) {
if (justFiltered === void 0) { justFiltered = false; }
if (this.rowModel.getType() !== constants_1.Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
throw new Error("selectAll only available with normal row model, ie not " + this.rowModel.getType());
}
var clientSideRowModel = this.rowModel;
var callback = function (rowNode) { return rowNode.selectThisNode(true); };
if (justFiltered) {
clientSideRowModel.forEachNodeAfterFilter(callback);
}
else {
clientSideRowModel.forEachNode(callback);
}
// the above does not clean up the parent rows if they are selected
if (this.rowModel.getType() === constants_1.Constants.ROW_MODEL_TYPE_CLIENT_SIDE && this.groupSelectsChildren) {
this.updateGroupsFromChildrenSelections();
}
var event = {
type: events_1.Events.EVENT_SELECTION_CHANGED,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEvent(event);
};
/**
* @method
* @deprecated
*/
SelectionController.prototype.selectNode = function (rowNode, tryMulti) {
if (rowNode) {
rowNode.setSelectedParams({ newValue: true, clearSelection: !tryMulti });
}
};
/**
* @method
* @deprecated
*/
SelectionController.prototype.deselectIndex = function (rowIndex) {
var node = this.rowModel.getRow(rowIndex);
this.deselectNode(node);
};
/**
* @method
* @deprecated
*/
SelectionController.prototype.deselectNode = function (rowNode) {
if (rowNode) {
rowNode.setSelectedParams({ newValue: false, clearSelection: false });
}
};
/**
* @method
* @deprecated
*/
SelectionController.prototype.selectIndex = function (index, tryMulti) {
var node = this.rowModel.getRow(index);
this.selectNode(node, tryMulti);
};
__decorate([
context_3.Autowired('eventService'),
__metadata("design:type", eventService_1.EventService)
], SelectionController.prototype, "eventService", void 0);
__decorate([
context_3.Autowired('rowModel'),
__metadata("design:type", Object)
], SelectionController.prototype, "rowModel", void 0);
__decorate([
context_3.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], SelectionController.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_3.Autowired('columnApi'),
__metadata("design:type", columnApi_1.ColumnApi)
], SelectionController.prototype, "columnApi", void 0);
__decorate([
context_3.Autowired('gridApi'),
__metadata("design:type", gridApi_1.GridApi)
], SelectionController.prototype, "gridApi", void 0);
__decorate([
__param(0, context_2.Qualifier('loggerFactory')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [logger_1.LoggerFactory]),
__metadata("design:returntype", void 0)
], SelectionController.prototype, "setBeans", null);
__decorate([
context_4.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], SelectionController.prototype, "init", null);
SelectionController = __decorate([
context_1.Bean('selectionController')
], SelectionController);
return SelectionController;
}());
exports.SelectionController = SelectionController;
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
// when doing transactions, or change detection, and grouping is present
// in the data, there is no need for the ClientSideRowModel to update each
// group after an update, ony parts that were impacted by the change.
// this class keeps track of all groups that were impacted by a transaction.
// the the different CSRM operations (filter, sort etc) use the forEach method
// to visit each group that was changed.
var ChangedPath = /** @class */ (function () {
function ChangedPath(keepingColumns, rootNode) {
// whether changed path is active of not. it is active when a) doing
// a transaction update or b) doing change detection. if we are doing
// a CSRM refresh for other reasons (after sort or filter, or user calling
// setRowData() without delta mode) then we are not active. we are also
// marked as not active if secondary columns change in pivot (as this impacts
// aggregations)
this.active = true;
// for each node in the change path, we also store which columns need
// to be re-aggregated.
this.nodeIdsToColumns = {};
// for quick lookup, all items in the change path are mapped by nodeId
this.mapToItems = {};
this.keepingColumns = keepingColumns;
this.pathRoot = {
rowNode: rootNode,
children: null
};
this.mapToItems[rootNode.id] = this.pathRoot;
}
// can be set inactive by:
// a) ClientSideRowModel, if no transactions or
// b) PivotService, if secondary columns changed
ChangedPath.prototype.setInactive = function () {
this.active = false;
};
ChangedPath.prototype.isActive = function () {
return this.active;
};
ChangedPath.prototype.depthFirstSearchChangedPath = function (pathItem, callback) {
if (pathItem.children) {
for (var i = 0; i < pathItem.children.length; i++) {
this.depthFirstSearchChangedPath(pathItem.children[i], callback);
}
}
callback(pathItem.rowNode);
};
ChangedPath.prototype.depthFirstSearchEverything = function (rowNode, callback, traverseEverything) {
if (rowNode.childrenAfterGroup) {
for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) {
var childNode = rowNode.childrenAfterGroup[i];
if (childNode.childrenAfterGroup) {
this.depthFirstSearchEverything(rowNode.childrenAfterGroup[i], callback, traverseEverything);
}
else if (traverseEverything) {
callback(childNode);
}
}
}
callback(rowNode);
};
// traverseLeafNodes -> used when NOT doing changed path, ie traversing everything. the callback
// will be called for child nodes in addition to parent nodes.
ChangedPath.prototype.forEachChangedNodeDepthFirst = function (callback, traverseLeafNodes) {
if (traverseLeafNodes === void 0) { traverseLeafNodes = false; }
if (this.active) {
// if we are active, then use the change path to callback
// only for updated groups
this.depthFirstSearchChangedPath(this.pathRoot, callback);
}
else {
// we are not active, so callback for everything, walk the entire path
this.depthFirstSearchEverything(this.pathRoot.rowNode, callback, traverseLeafNodes);
}
};
ChangedPath.prototype.executeFromRootNode = function (callback) {
callback(this.pathRoot.rowNode);
};
ChangedPath.prototype.createPathItems = function (rowNode) {
var pointer = rowNode;
var newEntryCount = 0;
while (!this.mapToItems[pointer.id]) {
var newEntry = {
rowNode: pointer,
children: null
};
this.mapToItems[pointer.id] = newEntry;
newEntryCount++;
pointer = pointer.parent;
}
return newEntryCount;
};
ChangedPath.prototype.populateColumnsMap = function (rowNode, columns) {
var _this = this;
if (!this.keepingColumns || !columns) {
return;
}
var pointer = rowNode;
while (pointer) {
// if columns, add the columns in all the way to parent, merging
// in any other columns that might be there already
if (!this.nodeIdsToColumns[pointer.id]) {
this.nodeIdsToColumns[pointer.id] = {};
}
columns.forEach(function (col) { return _this.nodeIdsToColumns[pointer.id][col.getId()] = true; });
pointer = pointer.parent;
}
};
ChangedPath.prototype.linkPathItems = function (rowNode, newEntryCount) {
var pointer = rowNode;
for (var i = 0; i < newEntryCount; i++) {
var thisItem = this.mapToItems[pointer.id];
var parentItem = this.mapToItems[pointer.parent.id];
if (!parentItem.children) {
parentItem.children = [];
}
parentItem.children.push(thisItem);
pointer = pointer.parent;
}
};
// called by
// 1) change detection (provides cols) and
// 2) groupStage if doing transaction update (doesn't provide cols)
ChangedPath.prototype.addParentNode = function (rowNode, columns) {
// we cannot do both steps below in the same loop as
// the second loop has a dependency on the first loop.
// ie the hierarchy cannot be stitched up yet because
// we don't have it built yet
// create the new PathItem objects.
var newEntryCount = this.createPathItems(rowNode);
// link in the node items
this.linkPathItems(rowNode, newEntryCount);
// update columns
this.populateColumnsMap(rowNode, columns);
};
ChangedPath.prototype.canSkip = function (rowNode) {
return this.active && !this.mapToItems[rowNode.id];
};
ChangedPath.prototype.getValueColumnsForNode = function (rowNode, valueColumns) {
if (!this.keepingColumns) {
return valueColumns;
}
var colsForThisNode = this.nodeIdsToColumns[rowNode.id];
var result = valueColumns.filter(function (col) { return colsForThisNode[col.getId()]; });
return result;
};
ChangedPath.prototype.getNotValueColumnsForNode = function (rowNode, valueColumns) {
if (!this.keepingColumns) {
return null;
}
var colsForThisNode = this.nodeIdsToColumns[rowNode.id];
var result = valueColumns.filter(function (col) { return !colsForThisNode[col.getId()]; });
return result;
};
return ChangedPath;
}());
exports.ChangedPath = ChangedPath;
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var gridOptionsWrapper_1 = __webpack_require__(4);
var expressionService_1 = __webpack_require__(27);
var columnController_1 = __webpack_require__(21);
var context_1 = __webpack_require__(13);
var events_1 = __webpack_require__(15);
var eventService_1 = __webpack_require__(11);
var valueCache_1 = __webpack_require__(40);
var utils_1 = __webpack_require__(5);
var ValueService = /** @class */ (function () {
function ValueService() {
this.initialised = false;
}
ValueService.prototype.init = function () {
this.cellExpressions = this.gridOptionsWrapper.isEnableCellExpressions();
this.initialised = true;
};
ValueService.prototype.getValue = function (column, rowNode, forFilter, ignoreAggData) {
// console.log(`turnActive = ${this.turnActive}`);
if (forFilter === void 0) { forFilter = false; }
if (ignoreAggData === void 0) { ignoreAggData = false; }
// hack - the grid is getting refreshed before this bean gets initialised, race condition.
// really should have a way so they get initialised in the right order???
if (!this.initialised) {
this.init();
}
if (!rowNode) {
return;
}
// pull these out to make code below easier to read
var colDef = column.getColDef();
var field = colDef.field;
var colId = column.getId();
var data = rowNode.data;
var result;
// if there is a value getter, this gets precedence over a field
var groupDataExists = rowNode.groupData && rowNode.groupData[colId] !== undefined;
var aggDataExists = !ignoreAggData && rowNode.aggData && rowNode.aggData[colId] !== undefined;
if (forFilter && colDef.filterValueGetter) {
result = this.executeFilterValueGetter(colDef.filterValueGetter, data, column, rowNode);
}
else if (this.gridOptionsWrapper.isTreeData() && aggDataExists) {
result = rowNode.aggData[colId];
}
else if (this.gridOptionsWrapper.isTreeData() && colDef.valueGetter) {
result = this.executeValueGetter(colDef.valueGetter, data, column, rowNode);
}
else if (this.gridOptionsWrapper.isTreeData() && (field && data)) {
result = utils_1._.getValueUsingField(data, field, column.isFieldContainsDots());
}
else if (groupDataExists) {
result = rowNode.groupData[colId];
}
else if (aggDataExists) {
result = rowNode.aggData[colId];
}
else if (colDef.valueGetter) {
result = this.executeValueGetter(colDef.valueGetter, data, column, rowNode);
}
else if (field && data) {
result = utils_1._.getValueUsingField(data, field, column.isFieldContainsDots());
}
// the result could be an expression itself, if we are allowing cell values to be expressions
if (this.cellExpressions && (typeof result === 'string') && result.indexOf('=') === 0) {
var cellValueGetter = result.substring(1);
result = this.executeValueGetter(cellValueGetter, data, column, rowNode);
}
return result;
};
ValueService.prototype.setValue = function (rowNode, colKey, newValue, suppressCellValueChangedEvent) {
var column = this.columnController.getPrimaryColumn(colKey);
if (!rowNode || !column) {
return;
}
// this will only happen if user is trying to paste into a group row, which doesn't make sense
// the user should not be trying to paste into group rows
var data = rowNode.data;
if (utils_1._.missing(data)) {
rowNode.data = {};
}
// for backwards compatibility we are also retrieving the newValueHandler as well as the valueSetter
var _a = column.getColDef(), field = _a.field, newValueHandler = _a.newValueHandler, valueSetter = _a.valueSetter;
// need either a field or a newValueHandler for this to work
if (utils_1._.missing(field) && utils_1._.missing(newValueHandler) && utils_1._.missing(valueSetter)) {
// we don't tell user about newValueHandler, as that is deprecated
console.warn("ag-Grid: you need either field or valueSetter set on colDef for editing to work");
return;
}
var params = {
node: rowNode,
data: rowNode.data,
oldValue: this.getValue(column, rowNode),
newValue: newValue,
colDef: column.getColDef(),
column: column,
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi(),
context: this.gridOptionsWrapper.getContext()
};
params.newValue = newValue;
var valueWasDifferent;
if (newValueHandler && utils_1._.exists(newValueHandler)) {
valueWasDifferent = newValueHandler(params);
}
else if (utils_1._.exists(valueSetter)) {
valueWasDifferent = this.expressionService.evaluate(valueSetter, params);
}
else {
valueWasDifferent = this.setValueUsingField(data, field, newValue, column.isFieldContainsDots());
}
// in case user forgot to return something (possible if they are not using TypeScript
// and just forgot, or using an old newValueHandler we didn't always expect a return
// value here), we default the return value to true, so we always refresh.
if (valueWasDifferent === undefined) {
valueWasDifferent = true;
}
// if no change to the value, then no need to do the updating, or notifying via events.
// otherwise the user could be tabbing around the grid, and cellValueChange would get called
// all the time.
if (!valueWasDifferent) {
return;
}
// reset quick filter on this row
rowNode.resetQuickFilterAggregateText();
this.valueCache.onDataChanged();
params.newValue = this.getValue(column, rowNode);
var onCellValueChanged = column.getColDef().onCellValueChanged;
if (typeof onCellValueChanged === 'function') {
// to make callback async, do in a timeout
setTimeout(function () { return onCellValueChanged(params); }, 0);
}
if (suppressCellValueChangedEvent) {
return;
}
var event = {
type: events_1.Events.EVENT_CELL_VALUE_CHANGED,
event: null,
rowIndex: rowNode.rowIndex,
rowPinned: rowNode.rowPinned,
column: params.column,
api: params.api,
colDef: params.colDef,
columnApi: params.columnApi,
context: params.context,
data: rowNode.data,
node: rowNode,
oldValue: params.oldValue,
newValue: params.newValue,
value: params.newValue
};
this.eventService.dispatchEvent(event);
};
ValueService.prototype.setValueUsingField = function (data, field, newValue, isFieldContainsDots) {
if (!field) {
return false;
}
// if no '.', then it's not a deep value
var valuesAreSame = false;
if (!isFieldContainsDots) {
data[field] = newValue;
}
else {
// otherwise it is a deep value, so need to dig for it
var fieldPieces = field.split('.');
var currentObject = data;
while (fieldPieces.length > 0 && currentObject) {
var fieldPiece = fieldPieces.shift();
if (fieldPieces.length === 0) {
currentObject[fieldPiece] = newValue;
}
else {
currentObject = currentObject[fieldPiece];
}
}
}
return !valuesAreSame;
};
ValueService.prototype.executeFilterValueGetter = function (valueGetter, data, column, rowNode) {
var params = {
data: data,
node: rowNode,
column: column,
colDef: column.getColDef(),
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi(),
context: this.gridOptionsWrapper.getContext(),
getValue: this.getValueCallback.bind(this, rowNode)
};
return this.expressionService.evaluate(valueGetter, params);
};
ValueService.prototype.executeValueGetter = function (valueGetter, data, column, rowNode) {
var colId = column.getId();
// if inside the same turn, just return back the value we got last time
var valueFromCache = this.valueCache.getValue(rowNode, colId);
if (valueFromCache !== undefined) {
return valueFromCache;
}
var params = {
data: data,
node: rowNode,
column: column,
colDef: column.getColDef(),
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi(),
context: this.gridOptionsWrapper.getContext(),
getValue: this.getValueCallback.bind(this, rowNode)
};
var result = this.expressionService.evaluate(valueGetter, params);
// if a turn is active, store the value in case the grid asks for it again
this.valueCache.setValue(rowNode, colId, result);
return result;
};
ValueService.prototype.getValueCallback = function (node, field) {
var otherColumn = this.columnController.getPrimaryColumn(field);
if (otherColumn) {
return this.getValue(otherColumn, node);
}
return null;
};
// used by row grouping and pivot, to get key for a row. col can be a pivot col or a row grouping col
ValueService.prototype.getKeyForNode = function (col, rowNode) {
var value = this.getValue(col, rowNode);
var keyCreator = col.getColDef().keyCreator;
var result = keyCreator ? keyCreator({ value: value }) : value;
// if already a string, or missing, just return it
if (typeof result === 'string' || result == null) {
return result;
}
result = String(result);
if (result === '[object Object]') {
utils_1._.doOnce(function () {
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');
}, 'getKeyForNode - warn about [object,object]');
}
return result;
};
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], ValueService.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.Autowired('expressionService'),
__metadata("design:type", expressionService_1.ExpressionService)
], ValueService.prototype, "expressionService", void 0);
__decorate([
context_1.Autowired('columnController'),
__metadata("design:type", columnController_1.ColumnController)
], ValueService.prototype, "columnController", void 0);
__decorate([
context_1.Autowired('eventService'),
__metadata("design:type", eventService_1.EventService)
], ValueService.prototype, "eventService", void 0);
__decorate([
context_1.Autowired('valueCache'),
__metadata("design:type", valueCache_1.ValueCache)
], ValueService.prototype, "valueCache", void 0);
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], ValueService.prototype, "init", null);
ValueService = __decorate([
context_1.Bean('valueService')
], ValueService);
return ValueService;
}());
exports.ValueService = ValueService;
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var context_1 = __webpack_require__(13);
var gridOptionsWrapper_1 = __webpack_require__(4);
var ValueCache = /** @class */ (function () {
function ValueCache() {
this.cacheVersion = 0;
}
ValueCache.prototype.init = function () {
this.active = this.gridOptionsWrapper.isValueCache();
this.neverExpires = this.gridOptionsWrapper.isValueCacheNeverExpires();
};
ValueCache.prototype.onDataChanged = function () {
if (this.neverExpires) {
return;
}
this.expire();
};
ValueCache.prototype.expire = function () {
this.cacheVersion++;
};
ValueCache.prototype.setValue = function (rowNode, colId, value) {
if (this.active) {
if (rowNode.__cacheVersion !== this.cacheVersion) {
rowNode.__cacheVersion = this.cacheVersion;
rowNode.__cacheData = {};
}
rowNode.__cacheData[colId] = value;
}
};
ValueCache.prototype.getValue = function (rowNode, colId) {
var valueInCache = this.active
&& rowNode.__cacheVersion === this.cacheVersion
&& rowNode.__cacheData[colId] !== undefined;
if (valueInCache) {
return rowNode.__cacheData[colId];
}
else {
return undefined;
}
};
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], ValueCache.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], ValueCache.prototype, "init", null);
ValueCache = __decorate([
context_1.Bean('valueCache')
], ValueCache);
return ValueCache;
}());
exports.ValueCache = ValueCache;
/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var CellRangeType;
(function (CellRangeType) {
CellRangeType[CellRangeType["VALUE"] = 0] = "VALUE";
CellRangeType[CellRangeType["DIMENSION"] = 1] = "DIMENSION";
})(CellRangeType = exports.CellRangeType || (exports.CellRangeType = {}));
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = __webpack_require__(33);
var context_1 = __webpack_require__(13);
var rowNode_1 = __webpack_require__(36);
var dragAndDropService_1 = __webpack_require__(43);
var eventKeys_1 = __webpack_require__(16);
var beanStub_1 = __webpack_require__(34);
var utils_1 = __webpack_require__(5);
var RowDragComp = /** @class */ (function (_super) {
__extends(RowDragComp, _super);
function RowDragComp(rowNode, column, cellValue, beans) {
var _this = _super.call(this, "") || this;
_this.rowNode = rowNode;
_this.column = column;
_this.cellValue = cellValue;
_this.beans = beans;
return _this;
}
RowDragComp.prototype.postConstruct = function () {
var eGui = this.getGui();
eGui.appendChild(utils_1._.createIconNoSpan('rowDrag', this.beans.gridOptionsWrapper, null));
this.addDragSource();
this.checkCompatibility();
if (this.beans.gridOptionsWrapper.isRowDragManaged()) {
this.addFeature(this.beans.context, new ManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column));
}
else {
this.addFeature(this.beans.context, new NonManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column));
}
};
// returns true if all compatibility items work out
RowDragComp.prototype.checkCompatibility = function () {
var managed = this.beans.gridOptionsWrapper.isRowDragManaged();
var treeData = this.beans.gridOptionsWrapper.isTreeData();
if (treeData && managed) {
utils_1._.doOnce(function () {
return console.warn('ag-Grid: If using row drag with tree data, you cannot have rowDragManaged=true');
}, 'RowDragComp.managedAndTreeData');
}
};
RowDragComp.prototype.addDragSource = function () {
var _this = this;
var dragItem = {
rowNode: this.rowNode
};
var dragSource = {
type: dragAndDropService_1.DragSourceType.RowDrag,
eElement: this.getGui(),
dragItemName: this.cellValue,
dragItemCallback: function () { return dragItem; },
dragStartPixels: 0
};
this.beans.dragAndDropService.addDragSource(dragSource, true);
this.addDestroyFunc(function () { return _this.beans.dragAndDropService.removeDragSource(dragSource); });
};
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], RowDragComp.prototype, "postConstruct", null);
return RowDragComp;
}(component_1.Component));
exports.RowDragComp = RowDragComp;
var VisibilityStrategy = /** @class */ (function (_super) {
__extends(VisibilityStrategy, _super);
function VisibilityStrategy(parent, rowNode, column) {
var _this = _super.call(this) || this;
_this.parent = parent;
_this.column = column;
_this.rowNode = rowNode;
return _this;
}
VisibilityStrategy.prototype.setDisplayedOrVisible = function (neverDisplayed) {
if (neverDisplayed) {
this.parent.setDisplayed(false);
}
else {
var shown = this.column.isRowDrag(this.rowNode);
var isShownSometimes = utils_1._.isFunction(this.column.getColDef().rowDrag);
// if shown sometimes, them some rows can have drag handle while other don't,
// so we use setVisible to keep the handles horizontally aligned (as setVisible
// keeps the empty space, whereas setDisplayed looses the space)
if (isShownSometimes) {
this.parent.setVisible(shown);
}
else {
this.parent.setDisplayed(shown);
}
}
};
return VisibilityStrategy;
}(beanStub_1.BeanStub));
// when non managed, the visibility depends on suppressRowDrag property only
var NonManagedVisibilityStrategy = /** @class */ (function (_super) {
__extends(NonManagedVisibilityStrategy, _super);
function NonManagedVisibilityStrategy(parent, beans, rowNode, column) {
var _this = _super.call(this, parent, rowNode, column) || this;
_this.beans = beans;
return _this;
}
NonManagedVisibilityStrategy.prototype.postConstruct = function () {
this.addDestroyableEventListener(this.beans.gridOptionsWrapper, 'suppressRowDrag', this.onSuppressRowDrag.bind(this));
// in case data changes, then we need to update visibility of drag item
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
this.workOutVisibility();
};
NonManagedVisibilityStrategy.prototype.onSuppressRowDrag = function () {
this.workOutVisibility();
};
NonManagedVisibilityStrategy.prototype.workOutVisibility = function () {
// only show the drag if both sort and filter are not present
var neverDisplayed = this.beans.gridOptionsWrapper.isSuppressRowDrag();
this.setDisplayedOrVisible(neverDisplayed);
};
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], NonManagedVisibilityStrategy.prototype, "postConstruct", null);
return NonManagedVisibilityStrategy;
}(VisibilityStrategy));
// when managed, the visibility depends on sort, filter and row group, as well as suppressRowDrag property
var ManagedVisibilityStrategy = /** @class */ (function (_super) {
__extends(ManagedVisibilityStrategy, _super);
function ManagedVisibilityStrategy(parent, beans, rowNode, column) {
var _this = _super.call(this, parent, rowNode, column) || this;
_this.beans = beans;
return _this;
}
ManagedVisibilityStrategy.prototype.postConstruct = function () {
// we do not show the component if sort, filter or grouping is active
this.addDestroyableEventListener(this.beans.eventService, eventKeys_1.Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
this.addDestroyableEventListener(this.beans.eventService, eventKeys_1.Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
this.addDestroyableEventListener(this.beans.eventService, eventKeys_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.onRowGroupChanged.bind(this));
// in case data changes, then we need to update visibility of drag item
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));
this.addDestroyableEventListener(this.rowNode, rowNode_1.RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
this.addDestroyableEventListener(this.beans.gridOptionsWrapper, 'suppressRowDrag', this.onSuppressRowDrag.bind(this));
this.updateSortActive();
this.updateFilterActive();
this.updateRowGroupActive();
this.workOutVisibility();
};
ManagedVisibilityStrategy.prototype.updateRowGroupActive = function () {
var rowGroups = this.beans.columnController.getRowGroupColumns();
this.rowGroupActive = !utils_1._.missingOrEmpty(rowGroups);
};
ManagedVisibilityStrategy.prototype.onRowGroupChanged = function () {
this.updateRowGroupActive();
this.workOutVisibility();
};
ManagedVisibilityStrategy.prototype.updateSortActive = function () {
var sortModel = this.beans.sortController.getSortModel();
this.sortActive = !utils_1._.missingOrEmpty(sortModel);
};
ManagedVisibilityStrategy.prototype.onSortChanged = function () {
this.updateSortActive();
this.workOutVisibility();
};
ManagedVisibilityStrategy.prototype.updateFilterActive = function () {
this.filterActive = this.beans.filterManager.isAnyFilterPresent();
};
ManagedVisibilityStrategy.prototype.onFilterChanged = function () {
this.updateFilterActive();
this.workOutVisibility();
};
ManagedVisibilityStrategy.prototype.onSuppressRowDrag = function () {
this.workOutVisibility();
};
ManagedVisibilityStrategy.prototype.workOutVisibility = function () {
// only show the drag if both sort and filter are not present
var sortOrFilterOrGroupActive = this.sortActive || this.filterActive || this.rowGroupActive;
var suppressRowDrag = this.beans.gridOptionsWrapper.isSuppressRowDrag();
var neverDisplayed = sortOrFilterOrGroupActive || suppressRowDrag;
this.setDisplayedOrVisible(neverDisplayed);
};
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], ManagedVisibilityStrategy.prototype, "postConstruct", null);
return ManagedVisibilityStrategy;
}(VisibilityStrategy));
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
var logger_1 = __webpack_require__(12);
var context_1 = __webpack_require__(13);
var gridOptionsWrapper_1 = __webpack_require__(4);
var dragService_1 = __webpack_require__(44);
var columnController_1 = __webpack_require__(21);
var environment_1 = __webpack_require__(45);
var utils_1 = __webpack_require__(5);
var DragSourceType;
(function (DragSourceType) {
DragSourceType[DragSourceType["ToolPanel"] = 0] = "ToolPanel";
DragSourceType[DragSourceType["HeaderCell"] = 1] = "HeaderCell";
DragSourceType[DragSourceType["RowDrag"] = 2] = "RowDrag";
})(DragSourceType = exports.DragSourceType || (exports.DragSourceType = {}));
var VDirection;
(function (VDirection) {
VDirection[VDirection["Up"] = 0] = "Up";
VDirection[VDirection["Down"] = 1] = "Down";
})(VDirection = exports.VDirection || (exports.VDirection = {}));
var HDirection;
(function (HDirection) {
HDirection[HDirection["Left"] = 0] = "Left";
HDirection[HDirection["Right"] = 1] = "Right";
})(HDirection = exports.HDirection || (exports.HDirection = {}));
var DragAndDropService = /** @class */ (function () {
function DragAndDropService() {
this.dragSourceAndParamsList = [];
this.dropTargets = [];
}
DragAndDropService_1 = DragAndDropService;
DragAndDropService.prototype.init = function () {
this.ePinnedIcon = utils_1._.createIcon('columnMovePin', this.gridOptionsWrapper, null);
this.ePlusIcon = utils_1._.createIcon('columnMoveAdd', this.gridOptionsWrapper, null);
this.eHiddenIcon = utils_1._.createIcon('columnMoveHide', this.gridOptionsWrapper, null);
this.eMoveIcon = utils_1._.createIcon('columnMoveMove', this.gridOptionsWrapper, null);
this.eLeftIcon = utils_1._.createIcon('columnMoveLeft', this.gridOptionsWrapper, null);
this.eRightIcon = utils_1._.createIcon('columnMoveRight', this.gridOptionsWrapper, null);
this.eGroupIcon = utils_1._.createIcon('columnMoveGroup', this.gridOptionsWrapper, null);
this.eAggregateIcon = utils_1._.createIcon('columnMoveValue', this.gridOptionsWrapper, null);
this.ePivotIcon = utils_1._.createIcon('columnMovePivot', this.gridOptionsWrapper, null);
this.eDropNotAllowedIcon = utils_1._.createIcon('dropNotAllowed', this.gridOptionsWrapper, null);
};
DragAndDropService.prototype.setBeans = function (loggerFactory) {
this.logger = loggerFactory.create('OldToolPanelDragAndDropService');
};
DragAndDropService.prototype.getStringType = function (type) {
switch (type) {
case DragSourceType.RowDrag: return 'row';
case DragSourceType.HeaderCell: return 'headerCell';
case DragSourceType.ToolPanel: return 'toolPanel';
default:
console.warn("ag-Grid: bug - unknown drag type " + type);
return null;
}
};
DragAndDropService.prototype.addDragSource = function (dragSource, allowTouch) {
if (allowTouch === void 0) { allowTouch = false; }
var params = {
eElement: dragSource.eElement,
dragStartPixels: dragSource.dragStartPixels,
onDragStart: this.onDragStart.bind(this, dragSource),
onDragStop: this.onDragStop.bind(this),
onDragging: this.onDragging.bind(this)
};
this.dragSourceAndParamsList.push({ params: params, dragSource: dragSource });
this.dragService.addDragSource(params, allowTouch);
};
DragAndDropService.prototype.removeDragSource = function (dragSource) {
var sourceAndParams = utils_1._.find(this.dragSourceAndParamsList, function (item) { return item.dragSource === dragSource; });
if (sourceAndParams) {
this.dragService.removeDragSource(sourceAndParams.params);
utils_1._.removeFromArray(this.dragSourceAndParamsList, sourceAndParams);
}
};
DragAndDropService.prototype.destroy = function () {
var _this = this;
this.dragSourceAndParamsList.forEach(function (sourceAndParams) {
_this.dragService.removeDragSource(sourceAndParams.params);
});
this.dragSourceAndParamsList.length = 0;
};
DragAndDropService.prototype.nudge = function () {
if (this.dragging) {
this.onDragging(this.eventLastTime, true);
}
};
DragAndDropService.prototype.onDragStart = function (dragSource, mouseEvent) {
this.dragging = true;
this.dragSource = dragSource;
this.eventLastTime = mouseEvent;
this.dragItem = this.dragSource.dragItemCallback();
this.lastDropTarget = this.dragSource.dragSourceDropTarget;
if (this.dragSource.dragStarted) {
this.dragSource.dragStarted();
}
this.createGhost();
};
DragAndDropService.prototype.onDragStop = function (mouseEvent) {
this.eventLastTime = null;
this.dragging = false;
if (this.dragSource.dragStopped) {
this.dragSource.dragStopped();
}
if (this.lastDropTarget && this.lastDropTarget.onDragStop) {
var draggingEvent = this.createDropTargetEvent(this.lastDropTarget, mouseEvent, null, null, false);
this.lastDropTarget.onDragStop(draggingEvent);
}
this.lastDropTarget = null;
this.dragItem = null;
this.removeGhost();
};
DragAndDropService.prototype.onDragging = function (mouseEvent, fromNudge) {
var hDirection = this.workOutHDirection(mouseEvent);
var vDirection = this.workOutVDirection(mouseEvent);
this.eventLastTime = mouseEvent;
this.positionGhost(mouseEvent);
// check if mouseEvent intersects with any of the drop targets
var dropTarget = utils_1._.find(this.dropTargets, this.isMouseOnDropTarget.bind(this, mouseEvent));
if (dropTarget !== this.lastDropTarget) {
this.leaveLastTargetIfExists(mouseEvent, hDirection, vDirection, fromNudge);
this.enterDragTargetIfExists(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
this.lastDropTarget = dropTarget;
}
else if (dropTarget) {
var draggingEvent = this.createDropTargetEvent(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
dropTarget.onDragging(draggingEvent);
}
};
DragAndDropService.prototype.enterDragTargetIfExists = function (dropTarget, mouseEvent, hDirection, vDirection, fromNudge) {
if (!dropTarget) {
return;
}
var dragEnterEvent = this.createDropTargetEvent(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
dropTarget.onDragEnter(dragEnterEvent);
this.setGhostIcon(dropTarget.getIconName ? dropTarget.getIconName() : null);
};
DragAndDropService.prototype.leaveLastTargetIfExists = function (mouseEvent, hDirection, vDirection, fromNudge) {
if (!this.lastDropTarget) {
return;
}
var dragLeaveEvent = this.createDropTargetEvent(this.lastDropTarget, mouseEvent, hDirection, vDirection, fromNudge);
this.lastDropTarget.onDragLeave(dragLeaveEvent);
this.setGhostIcon(null);
};
DragAndDropService.prototype.getAllContainersFromDropTarget = function (dropTarget) {
var containers = [dropTarget.getContainer()];
var secondaryContainers = dropTarget.getSecondaryContainers ? dropTarget.getSecondaryContainers() : null;
if (secondaryContainers) {
containers = containers.concat(secondaryContainers);
}
return containers;
};
// checks if the mouse is on the drop target. it checks eContainer and eSecondaryContainers
DragAndDropService.prototype.isMouseOnDropTarget = function (mouseEvent, dropTarget) {
var allContainers = this.getAllContainersFromDropTarget(dropTarget);
var mouseOverTarget = false;
allContainers.forEach(function (eContainer) {
if (!eContainer) {
return;
} // secondary can be missing
var rect = eContainer.getBoundingClientRect();
// if element is not visible, then width and height are zero
if (rect.width === 0 || rect.height === 0) {
return;
}
var horizontalFit = mouseEvent.clientX >= rect.left && mouseEvent.clientX <= rect.right;
var verticalFit = mouseEvent.clientY >= rect.top && mouseEvent.clientY <= rect.bottom;
//console.log(`rect.width = ${rect.width} || rect.height = ${rect.height} ## verticalFit = ${verticalFit}, horizontalFit = ${horizontalFit}, `);
if (horizontalFit && verticalFit) {
mouseOverTarget = true;
}
});
if (mouseOverTarget) {
var mouseOverTargetAndInterested = dropTarget.isInterestedIn(this.dragSource.type);
return mouseOverTargetAndInterested;
}
else {
return false;
}
};
DragAndDropService.prototype.addDropTarget = function (dropTarget) {
this.dropTargets.push(dropTarget);
};
DragAndDropService.prototype.workOutHDirection = function (event) {
if (this.eventLastTime.clientX > event.clientX) {
return HDirection.Left;
}
else if (this.eventLastTime.clientX < event.clientX) {
return HDirection.Right;
}
else {
return null;
}
};
DragAndDropService.prototype.workOutVDirection = function (event) {
if (this.eventLastTime.clientY > event.clientY) {
return VDirection.Up;
}
else if (this.eventLastTime.clientY < event.clientY) {
return VDirection.Down;
}
else {
return null;
}
};
DragAndDropService.prototype.createDropTargetEvent = function (dropTarget, event, hDirection, vDirection, fromNudge) {
// localise x and y to the target component
var rect = dropTarget.getContainer().getBoundingClientRect();
var x = event.clientX - rect.left;
var y = event.clientY - rect.top;
var dropTargetEvent = {
event: event,
x: x,
y: y,
vDirection: vDirection,
hDirection: hDirection,
dragSource: this.dragSource,
fromNudge: fromNudge,
dragItem: this.dragItem
};
return dropTargetEvent;
};
DragAndDropService.prototype.positionGhost = function (event) {
var ghostRect = this.eGhost.getBoundingClientRect();
var ghostHeight = ghostRect.height;
// for some reason, without the '-2', it still overlapped by 1 or 2 pixels, which
// then brought in scrollbars to the browser. no idea why, but putting in -2 here
// works around it which is good enough for me.
var browserWidth = utils_1._.getBodyWidth() - 2;
var browserHeight = utils_1._.getBodyHeight() - 2;
// put ghost vertically in middle of cursor
var top = event.pageY - (ghostHeight / 2);
// horizontally, place cursor just right of icon
var left = event.pageX - 30;
var usrDocument = this.gridOptionsWrapper.getDocument();
var windowScrollY = window.pageYOffset || usrDocument.documentElement.scrollTop;
var windowScrollX = window.pageXOffset || usrDocument.documentElement.scrollLeft;
// check ghost is not positioned outside of the browser
if (browserWidth > 0) {
if ((left + this.eGhost.clientWidth) > (browserWidth + windowScrollX)) {
left = browserWidth + windowScrollX - this.eGhost.clientWidth;
}
}
if (left < 0) {
left = 0;
}
if (browserHeight > 0) {
if ((top + this.eGhost.clientHeight) > (browserHeight + windowScrollY)) {
top = browserHeight + windowScrollY - this.eGhost.clientHeight;
}
}
if (top < 0) {
top = 0;
}
this.eGhost.style.left = left + 'px';
this.eGhost.style.top = top + 'px';
};
DragAndDropService.prototype.removeGhost = function () {
if (this.eGhost && this.eGhostParent) {
this.eGhostParent.removeChild(this.eGhost);
}
this.eGhost = null;
};
DragAndDropService.prototype.createGhost = function () {
this.eGhost = utils_1._.loadTemplate(DragAndDropService_1.GHOST_TEMPLATE);
var theme = this.environment.getTheme().theme;
if (theme) {
utils_1._.addCssClass(this.eGhost, theme);
}
this.eGhostIcon = this.eGhost.querySelector('.ag-dnd-ghost-icon');
this.setGhostIcon(null);
var eText = this.eGhost.querySelector('.ag-dnd-ghost-label');
eText.innerHTML = utils_1._.escape(this.dragSource.dragItemName);
this.eGhost.style.height = '25px';
this.eGhost.style.top = '20px';
this.eGhost.style.left = '20px';
var usrDocument = this.gridOptionsWrapper.getDocument();
this.eGhostParent = usrDocument.querySelector('body');
if (!this.eGhostParent) {
console.warn('ag-Grid: could not find document body, it is needed for dragging columns');
}
else {
this.eGhostParent.appendChild(this.eGhost);
}
};
DragAndDropService.prototype.setGhostIcon = function (iconName, shake) {
if (shake === void 0) { shake = false; }
utils_1._.clearElement(this.eGhostIcon);
var eIcon;
switch (iconName) {
case DragAndDropService_1.ICON_ADD:
eIcon = this.ePlusIcon;
break;
case DragAndDropService_1.ICON_PINNED:
eIcon = this.ePinnedIcon;
break;
case DragAndDropService_1.ICON_MOVE:
eIcon = this.eMoveIcon;
break;
case DragAndDropService_1.ICON_LEFT:
eIcon = this.eLeftIcon;
break;
case DragAndDropService_1.ICON_RIGHT:
eIcon = this.eRightIcon;
break;
case DragAndDropService_1.ICON_GROUP:
eIcon = this.eGroupIcon;
break;
case DragAndDropService_1.ICON_AGGREGATE:
eIcon = this.eAggregateIcon;
break;
case DragAndDropService_1.ICON_PIVOT:
eIcon = this.ePivotIcon;
break;
case DragAndDropService_1.ICON_NOT_ALLOWED:
eIcon = this.eDropNotAllowedIcon;
break;
default:
eIcon = this.eHiddenIcon;
break;
}
this.eGhostIcon.appendChild(eIcon);
utils_1._.addOrRemoveCssClass(this.eGhostIcon, 'ag-shake-left-to-right', shake);
};
var DragAndDropService_1;
DragAndDropService.ICON_PINNED = 'pinned';
DragAndDropService.ICON_ADD = 'add';
DragAndDropService.ICON_MOVE = 'move';
DragAndDropService.ICON_LEFT = 'left';
DragAndDropService.ICON_RIGHT = 'right';
DragAndDropService.ICON_GROUP = 'group';
DragAndDropService.ICON_AGGREGATE = 'aggregate';
DragAndDropService.ICON_PIVOT = 'pivot';
DragAndDropService.ICON_NOT_ALLOWED = 'notAllowed';
DragAndDropService.GHOST_TEMPLATE = '';
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], DragAndDropService.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.Autowired('dragService'),
__metadata("design:type", dragService_1.DragService)
], DragAndDropService.prototype, "dragService", void 0);
__decorate([
context_1.Autowired('environment'),
__metadata("design:type", environment_1.Environment)
], DragAndDropService.prototype, "environment", void 0);
__decorate([
context_1.Autowired('columnController'),
__metadata("design:type", columnController_1.ColumnController)
], DragAndDropService.prototype, "columnController", void 0);
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], DragAndDropService.prototype, "init", null);
__decorate([
__param(0, context_1.Qualifier('loggerFactory')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [logger_1.LoggerFactory]),
__metadata("design:returntype", void 0)
], DragAndDropService.prototype, "setBeans", null);
__decorate([
context_1.PreDestroy,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], DragAndDropService.prototype, "destroy", null);
DragAndDropService = DragAndDropService_1 = __decorate([
context_1.Bean('dragAndDropService')
], DragAndDropService);
return DragAndDropService;
}());
exports.DragAndDropService = DragAndDropService;
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var context_1 = __webpack_require__(13);
var logger_1 = __webpack_require__(12);
var eventService_1 = __webpack_require__(11);
var events_1 = __webpack_require__(15);
var gridOptionsWrapper_1 = __webpack_require__(4);
var columnApi_1 = __webpack_require__(26);
var gridApi_1 = __webpack_require__(18);
var utils_1 = __webpack_require__(5);
/** Adds drag listening onto an element. In ag-Grid this is used twice, first is resizing columns,
* second is moving the columns and column groups around (ie the 'drag' part of Drag and Drop. */
var DragService = /** @class */ (function () {
function DragService() {
this.onMouseUpListener = this.onMouseUp.bind(this);
this.onMouseMoveListener = this.onMouseMove.bind(this);
this.onTouchEndListener = this.onTouchUp.bind(this);
this.onTouchMoveListener = this.onTouchMove.bind(this);
this.dragEndFunctions = [];
this.dragSources = [];
}
DragService.prototype.init = function () {
this.logger = this.loggerFactory.create('DragService');
};
DragService.prototype.destroy = function () {
this.dragSources.forEach(this.removeListener.bind(this));
this.dragSources.length = 0;
};
DragService.prototype.removeListener = function (dragSourceAndListener) {
var element = dragSourceAndListener.dragSource.eElement;
var mouseDownListener = dragSourceAndListener.mouseDownListener;
element.removeEventListener('mousedown', mouseDownListener);
// remove touch listener only if it exists
if (dragSourceAndListener.touchEnabled) {
var touchStartListener = dragSourceAndListener.touchStartListener;
element.removeEventListener('touchstart', touchStartListener, { passive: true });
}
};
DragService.prototype.removeDragSource = function (params) {
var dragSourceAndListener = utils_1._.find(this.dragSources, function (item) { return item.dragSource === params; });
if (!dragSourceAndListener) {
return;
}
this.removeListener(dragSourceAndListener);
utils_1._.removeFromArray(this.dragSources, dragSourceAndListener);
};
DragService.prototype.setNoSelectToBody = function (noSelect) {
var eDocument = this.gridOptionsWrapper.getDocument();
var eBody = eDocument.querySelector('body');
if (utils_1._.exists(eBody)) {
// when we drag the mouse in ag-Grid, this class gets added / removed from the body, so that
// the mouse isn't selecting text when dragging.
utils_1._.addOrRemoveCssClass(eBody, 'ag-unselectable', noSelect);
}
};
DragService.prototype.addDragSource = function (params, includeTouch) {
if (includeTouch === void 0) { includeTouch = false; }
var mouseListener = this.onMouseDown.bind(this, params);
params.eElement.addEventListener('mousedown', mouseListener);
var touchListener = null;
var suppressTouch = this.gridOptionsWrapper.isSuppressTouch();
if (includeTouch && !suppressTouch) {
touchListener = this.onTouchStart.bind(this, params);
params.eElement.addEventListener('touchstart', touchListener, { passive: false });
}
this.dragSources.push({
dragSource: params,
mouseDownListener: mouseListener,
touchStartListener: touchListener,
touchEnabled: includeTouch
});
};
// gets called whenever mouse down on any drag source
DragService.prototype.onTouchStart = function (params, touchEvent) {
var _this = this;
this.currentDragParams = params;
this.dragging = false;
var touch = touchEvent.touches[0];
this.touchLastTime = touch;
this.touchStart = touch;
touchEvent.preventDefault();
// we temporally add these listeners, for the duration of the drag, they
// are removed in touch end handling.
params.eElement.addEventListener('touchmove', this.onTouchMoveListener, { passive: true });
params.eElement.addEventListener('touchend', this.onTouchEndListener, { passive: true });
params.eElement.addEventListener('touchcancel', this.onTouchEndListener, { passive: true });
this.dragEndFunctions.push(function () {
params.eElement.removeEventListener('touchmove', _this.onTouchMoveListener, { passive: true });
params.eElement.removeEventListener('touchend', _this.onTouchEndListener, { passive: true });
params.eElement.removeEventListener('touchcancel', _this.onTouchEndListener, { passive: true });
});
// see if we want to start dragging straight away
if (params.dragStartPixels === 0) {
this.onCommonMove(touch, this.touchStart);
}
};
// gets called whenever mouse down on any drag source
DragService.prototype.onMouseDown = function (params, mouseEvent) {
var _this = this;
// we ignore when shift key is pressed. this is for the range selection, as when
// user shift-clicks a cell, this should not be interpreted as the start of a drag.
// if (mouseEvent.shiftKey) { return; }
if (params.skipMouseEvent) {
if (params.skipMouseEvent(mouseEvent)) {
return;
}
}
// if there are two elements with parent / child relationship, and both are draggable,
// when we drag the child, we should NOT drag the parent. an example of this is row moving
// and range selection - row moving should get preference when use drags the rowDrag component.
if (mouseEvent._alreadyProcessedByDragService) {
return;
}
mouseEvent._alreadyProcessedByDragService = true;
// only interested in left button clicks
if (mouseEvent.button !== 0) {
return;
}
this.currentDragParams = params;
this.dragging = false;
this.mouseStartEvent = mouseEvent;
var eDocument = this.gridOptionsWrapper.getDocument();
this.setNoSelectToBody(true);
// we temporally add these listeners, for the duration of the drag, they
// are removed in mouseup handling.
eDocument.addEventListener('mousemove', this.onMouseMoveListener);
eDocument.addEventListener('mouseup', this.onMouseUpListener);
this.dragEndFunctions.push(function () {
eDocument.removeEventListener('mousemove', _this.onMouseMoveListener);
eDocument.removeEventListener('mouseup', _this.onMouseUpListener);
});
//see if we want to start dragging straight away
if (params.dragStartPixels === 0) {
this.onMouseMove(mouseEvent);
}
};
// returns true if the event is close to the original event by X pixels either vertically or horizontally.
// we only start dragging after X pixels so this allows us to know if we should start dragging yet.
DragService.prototype.isEventNearStartEvent = function (currentEvent, startEvent) {
// by default, we wait 4 pixels before starting the drag
var dragStartPixels = this.currentDragParams.dragStartPixels;
var requiredPixelDiff = utils_1._.exists(dragStartPixels) ? dragStartPixels : 4;
return utils_1._.areEventsNear(currentEvent, startEvent, requiredPixelDiff);
};
DragService.prototype.getFirstActiveTouch = function (touchList) {
for (var i = 0; i < touchList.length; i++) {
if (touchList[i].identifier === this.touchStart.identifier) {
return touchList[i];
}
}
return null;
};
DragService.prototype.onCommonMove = function (currentEvent, startEvent) {
if (!this.dragging) {
// if mouse hasn't travelled from the start position enough, do nothing
if (!this.dragging && this.isEventNearStartEvent(currentEvent, startEvent)) {
return;
}
this.dragging = true;
var event_1 = {
type: events_1.Events.EVENT_DRAG_STARTED,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEvent(event_1);
this.currentDragParams.onDragStart(startEvent);
}
this.currentDragParams.onDragging(currentEvent);
};
DragService.prototype.onTouchMove = function (touchEvent) {
var touch = this.getFirstActiveTouch(touchEvent.touches);
if (!touch) {
return;
}
// this.___statusPanel.setInfoText(Math.random() + ' onTouchMove preventDefault stopPropagation');
// if we don't preview default, then the browser will try and do it's own touch stuff,
// like do 'back button' (chrome does this) or scroll the page (eg drag column could be confused
// with scroll page in the app)
// touchEvent.preventDefault();
this.onCommonMove(touch, this.touchStart);
};
// only gets called after a mouse down - as this is only added after mouseDown
// and is removed when mouseUp happens
DragService.prototype.onMouseMove = function (mouseEvent) {
this.onCommonMove(mouseEvent, this.mouseStartEvent);
};
DragService.prototype.onTouchUp = function (touchEvent) {
var touch = this.getFirstActiveTouch(touchEvent.changedTouches);
// i haven't worked this out yet, but there is no matching touch
// when we get the touch up event. to get around this, we swap in
// the last touch. this is a hack to 'get it working' while we
// figure out what's going on, why we are not getting a touch in
// current event.
if (!touch) {
touch = this.touchLastTime;
}
// if mouse was left up before we started to move, then this is a tap.
// we check this before onUpCommon as onUpCommon resets the dragging
// let tap = !this.dragging;
// let tapTarget = this.currentDragParams.eElement;
this.onUpCommon(touch);
// if tap, tell user
// console.log(`${Math.random()} tap = ${tap}`);
// if (tap) {
// tapTarget.click();
// }
};
DragService.prototype.onMouseUp = function (mouseEvent) {
this.onUpCommon(mouseEvent);
};
DragService.prototype.onUpCommon = function (eventOrTouch) {
if (this.dragging) {
this.dragging = false;
this.currentDragParams.onDragStop(eventOrTouch);
var event_2 = {
type: events_1.Events.EVENT_DRAG_STOPPED,
api: this.gridApi,
columnApi: this.columnApi
};
this.eventService.dispatchEvent(event_2);
}
this.setNoSelectToBody(false);
this.mouseStartEvent = null;
this.touchStart = null;
this.touchLastTime = null;
this.currentDragParams = null;
this.dragEndFunctions.forEach(function (func) { return func(); });
this.dragEndFunctions.length = 0;
};
__decorate([
context_1.Autowired('loggerFactory'),
__metadata("design:type", logger_1.LoggerFactory)
], DragService.prototype, "loggerFactory", void 0);
__decorate([
context_1.Autowired('eventService'),
__metadata("design:type", eventService_1.EventService)
], DragService.prototype, "eventService", void 0);
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], DragService.prototype, "gridOptionsWrapper", void 0);
__decorate([
context_1.Autowired('columnApi'),
__metadata("design:type", columnApi_1.ColumnApi)
], DragService.prototype, "columnApi", void 0);
__decorate([
context_1.Autowired('gridApi'),
__metadata("design:type", gridApi_1.GridApi)
], DragService.prototype, "gridApi", void 0);
__decorate([
context_1.PostConstruct,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], DragService.prototype, "init", null);
__decorate([
context_1.PreDestroy,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], DragService.prototype, "destroy", null);
DragService = __decorate([
context_1.Bean('dragService')
], DragService);
return DragService;
}());
exports.DragService = DragService;
/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var context_1 = __webpack_require__(13);
var utils_1 = __webpack_require__(5);
var MAT_GRID_SIZE = 8;
var FRESH_GRID_SIZE = 4;
var BALHAM_GRID_SIZE = 4;
var HARD_CODED_SIZES = {
'ag-theme-material': {
headerHeight: MAT_GRID_SIZE * 7,
virtualItemHeight: MAT_GRID_SIZE * 5,
rowHeight: MAT_GRID_SIZE * 6
},
'ag-theme-classic': {
headerHeight: 25,
virtualItemHeight: FRESH_GRID_SIZE * 5,
rowHeight: 25
},
'ag-theme-balham': {
headerHeight: BALHAM_GRID_SIZE * 8,
virtualItemHeight: BALHAM_GRID_SIZE * 7,
rowHeight: BALHAM_GRID_SIZE * 7
}
};
/**
* this object contains a list of Sass variables and an array
* of CSS styles required to get the correct value.
* eg. $virtual-item-height requires a structure, so we can get it's height.
*
*
*/
var SASS_PROPERTY_BUILDER = {
headerHeight: ['ag-header-row'],
virtualItemHeight: ['ag-virtual-list-container', 'ag-virtual-list-item'],
rowHeight: ['ag-row']
};
var CALCULATED_SIZES = {};
var Environment = /** @class */ (function () {
function Environment() {
}
Environment.prototype.getSassVariable = function (theme, key) {
var useTheme = 'ag-theme-' + (theme.match('material') ? 'material' : (theme.match('balham') ? 'balham' : 'classic'));
var defaultValue = HARD_CODED_SIZES[useTheme][key];
var calculatedValue = 0;
if (!CALCULATED_SIZES[theme]) {
CALCULATED_SIZES[theme] = {};
}
if (CALCULATED_SIZES[theme][key]) {
return CALCULATED_SIZES[theme][key];
}
if (SASS_PROPERTY_BUILDER[key]) {
var classList = SASS_PROPERTY_BUILDER[key];
var div = document.createElement('div');
var el = classList.reduce(function (el, currentClass, idx) {
if (idx === 0) {
utils_1._.addCssClass(el, theme);
}
var div = document.createElement('div');
utils_1._.addCssClass(div, currentClass);
el.appendChild(div);
return div;
}, div);
if (document.body) {
document.body.appendChild(div);
calculatedValue = parseInt(window.getComputedStyle(el).height, 10);
document.body.removeChild(div);
}
}
CALCULATED_SIZES[theme][key] = calculatedValue || defaultValue;
return CALCULATED_SIZES[theme][key];
};
Environment.prototype.isThemeDark = function () {
var theme = this.getTheme().theme;
return !!theme && theme.indexOf('dark') >= 0;
};
Environment.prototype.getTheme = function () {
var reg = /\bag-(fresh|dark|blue|material|bootstrap|(?:theme-([\w\-]*)))\b/;
var el = this.eGridDiv;
var themeMatch;
while (el) {
themeMatch = reg.exec(el.className);
if (!themeMatch) {
el = el.parentElement;
}
else {
break;
}
}
if (!themeMatch) {
return {};
}
var theme = themeMatch[0];
var usingOldTheme = themeMatch[2] === undefined;
if (usingOldTheme) {
var newTheme_1 = theme.replace('ag-', 'ag-theme-');
utils_1._.doOnce(function () { return console.warn("ag-Grid: As of v19 old theme are no longer provided. Please replace " + theme + " with " + newTheme_1 + "."); }, 'using-old-theme');
}
return { theme: theme, el: el };
};
__decorate([
context_1.Autowired('eGridDiv'),
__metadata("design:type", HTMLElement)
], Environment.prototype, "eGridDiv", void 0);
Environment = __decorate([
context_1.Bean('environment')
], Environment);
return Environment;
}());
exports.Environment = Environment;
/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v21.2.1
* @link http://www.ag-grid.com/
* @license MIT
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var popupComponent_1 = __webpack_require__(47);
var context_1 = __webpack_require__(13);
var gridOptionsWrapper_1 = __webpack_require__(4);
var utils_1 = __webpack_require__(5);
var PopupEditorWrapper = /** @class */ (function (_super) {
__extends(PopupEditorWrapper, _super);
function PopupEditorWrapper(cellEditor) {
var _this = _super.call(this, "