diff --git a/dist/angular-slickgrid.d.ts b/dist/angular-slickgrid.d.ts
index 12cd71388..54c3d25d0 100644
--- a/dist/angular-slickgrid.d.ts
+++ b/dist/angular-slickgrid.d.ts
@@ -35,10 +35,11 @@ export { hyperlinkFormatter as ɵbd } from './src/app/modules/angular-slickgrid/
export { percentCompleteBarFormatter as ɵbf } from './src/app/modules/angular-slickgrid/formatters/percentCompleteBarFormatter';
export { percentCompleteFormatter as ɵbe } from './src/app/modules/angular-slickgrid/formatters/percentCompleteFormatter';
export { progressBarFormatter as ɵbg } from './src/app/modules/angular-slickgrid/formatters/progressBarFormatter';
-export { yesNoFormatter as ɵbh } from './src/app/modules/angular-slickgrid/formatters/yesNoFormatter';
-export { dateIsoSorter as ɵbj } from './src/app/modules/angular-slickgrid/sorters/dateIsoSorter';
-export { dateSorter as ɵbi } from './src/app/modules/angular-slickgrid/sorters/dateSorter';
-export { dateUsShortSorter as ɵbl } from './src/app/modules/angular-slickgrid/sorters/dateUsShortSorter';
-export { dateUsSorter as ɵbk } from './src/app/modules/angular-slickgrid/sorters/dateUsSorter';
-export { numericSorter as ɵbm } from './src/app/modules/angular-slickgrid/sorters/numericSorter';
-export { stringSorter as ɵbn } from './src/app/modules/angular-slickgrid/sorters/stringSorter';
+export { translateFormatter as ɵbh } from './src/app/modules/angular-slickgrid/formatters/translateFormatter';
+export { yesNoFormatter as ɵbi } from './src/app/modules/angular-slickgrid/formatters/yesNoFormatter';
+export { dateIsoSorter as ɵbk } from './src/app/modules/angular-slickgrid/sorters/dateIsoSorter';
+export { dateSorter as ɵbj } from './src/app/modules/angular-slickgrid/sorters/dateSorter';
+export { dateUsShortSorter as ɵbm } from './src/app/modules/angular-slickgrid/sorters/dateUsShortSorter';
+export { dateUsSorter as ɵbl } from './src/app/modules/angular-slickgrid/sorters/dateUsSorter';
+export { numericSorter as ɵbn } from './src/app/modules/angular-slickgrid/sorters/numericSorter';
+export { stringSorter as ɵbo } from './src/app/modules/angular-slickgrid/sorters/stringSorter';
diff --git a/dist/angular-slickgrid.es5.js b/dist/angular-slickgrid.es5.js
index 9489618c1..59f2ec96d 100644
--- a/dist/angular-slickgrid.es5.js
+++ b/dist/angular-slickgrid.es5.js
@@ -29,6 +29,7 @@ import { Observable as Observable$1 } from 'rxjs/Observable';
import 'rxjs/add/operator/first';
import 'rxjs/add/operator/take';
import 'rxjs/add/operator/toPromise';
+import { TranslateService } from '@ngx-translate/core';
import { Component, EventEmitter, Injectable, Input, NgModule, Output } from '@angular/core';
import { CommonModule } from '@angular/common';
var CaseType = {};
@@ -9733,6 +9734,13 @@ var progressBarFormatter = function (row, cell, value, columnDef, dataContext) {
}
return "
\n
\n " + value + "%\n
\n
";
};
+var translateFormatter = function (row, cell, value, columnDef, dataContext) {
+ var /** @type {?} */ params = columnDef.params || {};
+ if (!params.i18n || !(params.i18n instanceof TranslateService)) {
+ throw new Error("The translate formatter requires the ngx-translate \"TranslateService\" to be provided as a column params.\n For example: this.columnDefinitions = [{ id: title, field: title, formatter: Formatters.translate, params: { i18n: this.translateService }");
+ }
+ return params.i18n.instant(value);
+};
var yesNoFormatter = function (row, cell, value, columnDef, dataContext) { return value ? 'Yes' : 'No'; };
// import { Group, GroupTotals } from '../core'
// import { Item } from '../dataview'
@@ -9761,6 +9769,7 @@ var Formatters = {
percentComplete: percentCompleteFormatter,
percentCompleteBar: percentCompleteBarFormatter,
progressBar: progressBarFormatter,
+ translate: translateFormatter,
yesNo: yesNoFormatter
};
var moment$11 = moment_min || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
@@ -10581,7 +10590,8 @@ var GraphqlService = /** @class */ (function () {
datasetQb.filter(datasetFilters);
queryQb.find(datasetQb);
var /** @type {?} */ enumSearchProperties = ['direction:', 'field:', 'operator:'];
- return this.trimDoubleQuotesOnEnumField(queryQb.toString(), enumSearchProperties);
+ var /** @type {?} */ output = this.trimDoubleQuotesOnEnumField(queryQb.toString(), enumSearchProperties);
+ return output.replace('\\', '\\\\').replace('\/', '\/\/'); // also escape slashes
};
/**
* From an input array of strings, we want to build a GraphQL query string.
@@ -10891,6 +10901,15 @@ var GridExtraService = /** @class */ (function () {
GridExtraService.prototype.setSelectedRows = function (rowIndexes) {
this._grid.setSelectedRows(rowIndexes);
};
+ /**
+ * @return {?}
+ */
+ GridExtraService.prototype.renderGrid = function () {
+ if (this._grid && typeof this._grid.invalidate === 'function') {
+ this._grid.invalidate();
+ this._grid.render();
+ }
+ };
/**
* Add an item (data item) to the datagrid
* @param {?} item
@@ -11588,10 +11607,12 @@ var ControlAndPluginService = /** @class */ (function () {
/**
* @param {?} filterService
* @param {?} gridExtraService
+ * @param {?} translate
*/
- function ControlAndPluginService(filterService, gridExtraService) {
+ function ControlAndPluginService(filterService, gridExtraService, translate) {
this.filterService = filterService;
this.gridExtraService = gridExtraService;
+ this.translate = translate;
}
/**
* Attach/Create different Controls or Plugins after the Grid is created
@@ -11602,35 +11623,16 @@ var ControlAndPluginService = /** @class */ (function () {
* @return {?}
*/
ControlAndPluginService.prototype.attachDifferentControlOrPlugins = function (grid, columnDefinitions, options, dataView) {
- var _this = this;
this._grid = grid;
+ this._gridOptions = options;
this._dataView = dataView;
- this._visibleColumns = columnDefinitions;
+ this._columnDefinitions = columnDefinitions;
+ this.visibleColumns = columnDefinitions;
if (options.enableColumnPicker) {
this.columnPickerControl = new Slick.Controls.ColumnPicker(columnDefinitions, grid, options);
}
if (options.enableGridMenu) {
- this.prepareGridMenu(grid, options);
- this.gridMenuControl = new Slick.Controls.GridMenu(columnDefinitions, grid, options);
- if (options.gridMenu) {
- this.gridMenuControl.onBeforeMenuShow.subscribe(function (e, args) {
- if (options.gridMenu && typeof options.gridMenu.onBeforeMenuShow === 'function') {
- options.gridMenu.onBeforeMenuShow(e, args);
- }
- });
- this.gridMenuControl.onCommand.subscribe(function (e, args) {
- if (options.gridMenu && typeof options.gridMenu.onCommand === 'function') {
- options.gridMenu.onCommand(e, args);
- }
- });
- this.gridMenuControl.onMenuClose.subscribe(function (e, args) {
- if (options.gridMenu && typeof options.gridMenu.onMenuClose === 'function') {
- options.gridMenu.onMenuClose(e, args);
- }
- // we also want to resize the columns if the user decided to hide certain column(s)
- _this._grid.autosizeColumns();
- });
- }
+ this.gridMenuControl = this.createGridMenu(grid, columnDefinitions, options);
}
if (options.enableAutoTooltip) {
this.autoTooltipPlugin = new Slick.AutoTooltips(options.autoTooltipOptions || {});
@@ -11684,15 +11686,64 @@ var ControlAndPluginService = /** @class */ (function () {
}
}
};
+ /**
+ * @param {?} grid
+ * @param {?} columnDefinitions
+ * @param {?} options
+ * @return {?}
+ */
+ ControlAndPluginService.prototype.createGridMenu = function (grid, columnDefinitions, options) {
+ var _this = this;
+ this.prepareGridMenu(grid, options);
+ var /** @type {?} */ gridMenuControl = new Slick.Controls.GridMenu(columnDefinitions, grid, options);
+ if (options.gridMenu) {
+ gridMenuControl.onBeforeMenuShow.subscribe(function (e, args) {
+ if (options.gridMenu && typeof options.gridMenu.onBeforeMenuShow === 'function') {
+ options.gridMenu.onBeforeMenuShow(e, args);
+ }
+ else {
+ // when using i18n with Grid Menu, we have a problem with the last 2 checkbox
+ // they are written in plain English within the SlickGrid Controls
+ // and so we don't have access directly to their text, however with a jQuery hack,
+ // we can somehow change the text with jQuery but it's very patchy
+ if (options.enableTranslate) {
+ setTimeout(function () {
+ var /** @type {?} */ forceFitElm = jquery("label:contains('Force fit columns')");
+ var /** @type {?} */ syncResizeElm = jquery("label:contains('Synchronous resize')");
+ if (forceFitElm && forceFitElm[0] && forceFitElm[0].lastChild && forceFitElm[0].lastChild.textContent) {
+ forceFitElm[0].lastChild.textContent = _this.translate.instant('FORCE_FIT_COLUMNS');
+ }
+ if (syncResizeElm && syncResizeElm[0] && syncResizeElm[0].lastChild && syncResizeElm[0].lastChild.textContent) {
+ syncResizeElm[0].lastChild.textContent = _this.translate.instant('SYNCHRONOUS_RESIZE');
+ }
+ }, 10);
+ }
+ }
+ });
+ gridMenuControl.onCommand.subscribe(function (e, args) {
+ if (options.gridMenu && typeof options.gridMenu.onCommand === 'function') {
+ options.gridMenu.onCommand(e, args);
+ }
+ });
+ gridMenuControl.onMenuClose.subscribe(function (e, args) {
+ if (options.gridMenu && typeof options.gridMenu.onMenuClose === 'function') {
+ options.gridMenu.onMenuClose(e, args);
+ }
+ // we also want to resize the columns if the user decided to hide certain column(s)
+ _this._grid.autosizeColumns();
+ });
+ }
+ return gridMenuControl;
+ };
/**
* @param {?} column
* @return {?}
*/
ControlAndPluginService.prototype.hideColumn = function (column) {
- if (this._grid && this._visibleColumns) {
+ if (this._grid && this.visibleColumns) {
var /** @type {?} */ columnIndex = this._grid.getColumnIndex(column.id);
- this._visibleColumns = this.removeColumnByIndex(this._visibleColumns, columnIndex);
- this._grid.setColumns(this._visibleColumns);
+ this.visibleColumns = this.removeColumnByIndex(this.visibleColumns, columnIndex);
+ this._grid.setColumns(this.visibleColumns);
}
};
/**
@@ -11717,7 +11768,7 @@ var ControlAndPluginService = /** @class */ (function () {
ControlAndPluginService.prototype.destroy = function () {
this._grid = null;
this._dataView = null;
- this._visibleColumns = [];
+ this.visibleColumns = [];
if (this.columnPickerControl) {
this.columnPickerControl.destroy();
this.columnPickerControl = null;
@@ -11758,7 +11809,7 @@ var ControlAndPluginService = /** @class */ (function () {
if (options && options.gridMenu && options.gridMenu.customItems && options.gridMenu.customItems.filter(function (item) { return item.command === 'clear-filter'; }).length === 0) {
options.gridMenu.customItems.push({
iconCssClass: 'fa fa-filter text-danger',
- title: 'Clear All Filters',
+ title: options.enableTranslate ? this.translate.instant('CLEAR_ALL_FILTERS') : 'Clear All Filters',
disabled: false,
command: 'clear-filter'
});
@@ -11766,7 +11817,7 @@ var ControlAndPluginService = /** @class */ (function () {
if (options && options.gridMenu && options.gridMenu.customItems && options.gridMenu.customItems.filter(function (item) { return item.command === 'toggle-filter'; }).length === 0) {
options.gridMenu.customItems.push({
iconCssClass: 'fa fa-random',
- title: 'Toggle Filter Row',
+ title: options.enableTranslate ? this.translate.instant('TOGGLE_FILTER_ROW') : 'Toggle Filter Row',
disabled: false,
command: 'toggle-filter'
});
@@ -11789,9 +11840,10 @@ var ControlAndPluginService = /** @class */ (function () {
};
}
}
- // remove the custom command title if there's no command
+ // add the custom command title if there's no command
if (options && options.gridMenu && options.gridMenu.customItems && options.gridMenu.customItems.length > 0) {
- options.gridMenu.customTitle = options.gridMenu.customTitle || 'Commands';
+ var /** @type {?} */ customTitle = options.enableTranslate ? this.translate.instant('COMMANDS') : 'Commands';
+ options.gridMenu.customTitle = options.gridMenu.customTitle || customTitle;
}
};
/**
@@ -11800,8 +11852,9 @@ var ControlAndPluginService = /** @class */ (function () {
* @return {?}
*/
ControlAndPluginService.prototype.prepareGridMenu = function (grid, options) {
+ var /** @type {?} */ columnTitle = options.enableTranslate ? this.translate.instant('COLUMNS') : 'Columns';
options.gridMenu = options.gridMenu || {};
- options.gridMenu.columnTitle = options.gridMenu.columnTitle || 'Columns';
+ options.gridMenu.columnTitle = options.gridMenu.columnTitle || columnTitle;
options.gridMenu.iconCssClass = options.gridMenu.iconCssClass || 'fa fa-bars';
options.gridMenu.menuWidth = options.gridMenu.menuWidth || 18;
options.gridMenu.customTitle = options.gridMenu.customTitle || undefined;
@@ -11809,6 +11862,37 @@ var ControlAndPluginService = /** @class */ (function () {
this.addGridMenuCustomCommands(grid, options);
// options.gridMenu.resizeOnShowHeaderRow = options.showHeaderRow;
};
+ /**
+ * Translate the Grid Menu ColumnTitle and CustomTitle.
+ * Note that the only way that seems to work is to destroy and re-create the Grid Menu
+ * Changing only the gridMenu.columnTitle with i18n translate was not enough.
+ * @return {?}
+ */
+ ControlAndPluginService.prototype.translateGridMenu = function () {
+ // destroy and re-create the Grid Menu which seems to be the only way to translate properly
+ this.gridMenuControl.destroy();
+ this._gridOptions.gridMenu = undefined;
+ this.createGridMenu(this._grid, this.visibleColumns, this._gridOptions);
+ };
+ /**
+ * Translate manually the header titles.
+ * We could optionally pass a locale (that will change currently loaded locale), else it will use current locale
+ * @param {?=} locale
+ * @return {?}
+ */
+ ControlAndPluginService.prototype.translateHeaders = function (locale) {
+ if (locale) {
+ this.translate.use(locale);
+ }
+ for (var _g = 0, _h = this._columnDefinitions; _g < _h.length; _g++) {
+ var column = _h[_g];
+ if (column.headerKey) {
+ column.name = this.translate.instant(column.headerKey);
+ }
+ }
+ // calling setColumns() will trigger a grid re-render
+ this._grid.setColumns(this._columnDefinitions);
+ };
/**
* Attach/Create different plugins before the Grid creation.
* For example the multi-select have to be added to the column definition before the grid is created to work properly
@@ -11833,6 +11917,7 @@ ControlAndPluginService.decorators = [
ControlAndPluginService.ctorParameters = function () { return [
{ type: FilterService, },
{ type: GridExtraService, },
+ { type: TranslateService, },
]; };
var __awaiter$2 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
@@ -33267,14 +33352,16 @@ var AngularSlickgridComponent = /** @class */ (function () {
* @param {?} gridEventService
* @param {?} resizer
* @param {?} controlAndPluginService
+ * @param {?} translate
*/
- function AngularSlickgridComponent(filterService, sortService, gridExtraService, gridEventService, resizer, controlAndPluginService) {
+ function AngularSlickgridComponent(filterService, sortService, gridExtraService, gridEventService, resizer, controlAndPluginService, translate) {
this.filterService = filterService;
this.sortService = sortService;
this.gridExtraService = gridExtraService;
this.gridEventService = gridEventService;
this.resizer = resizer;
this.controlAndPluginService = controlAndPluginService;
+ this.translate = translate;
this.showPagination = false;
this.dataviewChanged = new EventEmitter();
this.gridChanged = new EventEmitter();
@@ -33339,6 +33426,10 @@ var AngularSlickgridComponent = /** @class */ (function () {
this.attachResizeHook(this.grid, this._gridOptions);
// attach grid extra service
var /** @type {?} */ gridExtraService = this.gridExtraService.init(this.grid, this.columnDefinitions, this._gridOptions, this._dataView);
+ // when user enables translation, we need to translate Headers on first pass & subsequently in the attachDifferentHooks
+ if (this._gridOptions.enableTranslate) {
+ this.controlAndPluginService.translateHeaders();
+ }
};
/**
* @param {?} grid
@@ -33348,6 +33439,13 @@ var AngularSlickgridComponent = /** @class */ (function () {
*/
AngularSlickgridComponent.prototype.attachDifferentHooks = function (grid, options, dataView) {
var _this = this;
+ // on locale change, we have to manually translate the Headers, GridMenu
+ this.translate.onLangChange.subscribe(function (event) {
+ if (options.enableTranslate) {
+ _this.controlAndPluginService.translateHeaders();
+ _this.controlAndPluginService.translateGridMenu();
+ }
+ });
// attach external sorting (backend) when available or default onSort (dataView)
if (options.enableSorting) {
(options.onBackendEventApi) ? this.sortService.attachBackendOnSort(grid, options) : this.sortService.attachLocalOnSort(grid, options, this._dataView);
@@ -33484,6 +33582,7 @@ AngularSlickgridComponent.ctorParameters = function () { return [
{ type: GridEventService, },
{ type: ResizerService, },
{ type: ControlAndPluginService, },
+ { type: TranslateService, },
]; };
AngularSlickgridComponent.propDecorators = {
'dataviewChanged': [{ type: Output },],
@@ -33532,5 +33631,5 @@ AngularSlickgridModule.ctorParameters = function () { return []; };
/**
* Generated bundle index. Do not edit.
*/
-export { CaseType, FieldType, FormElementType, KeyCode, OperatorType, SortDirection, Editors, FilterConditions, FilterTemplates, Formatters, Sorters, FilterService, SortService, GridEventService, GraphqlService, GridExtraService, GridExtraUtils, GridOdataService, OdataService, ResizerService, ControlAndPluginService, SlickPaginationComponent, AngularSlickgridComponent, AngularSlickgridModule, CheckboxEditor as ɵa, DateEditor as ɵb, FloatEditor as ɵc, IntegerEditor as ɵd, LongTextEditor as ɵe, TextEditor as ɵf, booleanFilterCondition as ɵh, dateFilterCondition as ɵi, dateIsoFilterCondition as ɵj, dateUsFilterCondition as ɵl, dateUsShortFilterCondition as ɵm, dateUtcFilterCondition as ɵk, executeMappedCondition as ɵg, testFilterCondition as ɵp, numberFilterCondition as ɵn, stringFilterCondition as ɵo, inputFilterTemplate as ɵq, selectFilterTemplate as ɵr, arrayToCsvFormatter as ɵs, checkboxFormatter as ɵt, checkmarkFormatter as ɵu, complexObjectFormatter as ɵv, dateIsoFormatter as ɵw, dateTimeIsoAmPmFormatter as ɵx, dateTimeUsAmPmFormatter as ɵba, dateTimeUsFormatter as ɵz, dateUsFormatter as ɵy, deleteIconFormatter as ɵbb, editIconFormatter as ɵbc, hyperlinkFormatter as ɵbd, percentCompleteBarFormatter as ɵbf, percentCompleteFormatter as ɵbe, progressBarFormatter as ɵbg, yesNoFormatter as ɵbh, dateIsoSorter as ɵbj, dateSorter as ɵbi, dateUsShortSorter as ɵbl, dateUsSorter as ɵbk, numericSorter as ɵbm, stringSorter as ɵbn };
+export { CaseType, FieldType, FormElementType, KeyCode, OperatorType, SortDirection, Editors, FilterConditions, FilterTemplates, Formatters, Sorters, FilterService, SortService, GridEventService, GraphqlService, GridExtraService, GridExtraUtils, GridOdataService, OdataService, ResizerService, ControlAndPluginService, SlickPaginationComponent, AngularSlickgridComponent, AngularSlickgridModule, CheckboxEditor as ɵa, DateEditor as ɵb, FloatEditor as ɵc, IntegerEditor as ɵd, LongTextEditor as ɵe, TextEditor as ɵf, booleanFilterCondition as ɵh, dateFilterCondition as ɵi, dateIsoFilterCondition as ɵj, dateUsFilterCondition as ɵl, dateUsShortFilterCondition as ɵm, dateUtcFilterCondition as ɵk, executeMappedCondition as ɵg, testFilterCondition as ɵp, numberFilterCondition as ɵn, stringFilterCondition as ɵo, inputFilterTemplate as ɵq, selectFilterTemplate as ɵr, arrayToCsvFormatter as ɵs, checkboxFormatter as ɵt, checkmarkFormatter as ɵu, complexObjectFormatter as ɵv, dateIsoFormatter as ɵw, dateTimeIsoAmPmFormatter as ɵx, dateTimeUsAmPmFormatter as ɵba, dateTimeUsFormatter as ɵz, dateUsFormatter as ɵy, deleteIconFormatter as ɵbb, editIconFormatter as ɵbc, hyperlinkFormatter as ɵbd, percentCompleteBarFormatter as ɵbf, percentCompleteFormatter as ɵbe, progressBarFormatter as ɵbg, translateFormatter as ɵbh, yesNoFormatter as ɵbi, dateIsoSorter as ɵbk, dateSorter as ɵbj, dateUsShortSorter as ɵbm, dateUsSorter as ɵbl, numericSorter as ɵbn, stringSorter as ɵbo };
//# sourceMappingURL=angular-slickgrid.es5.js.map
diff --git a/dist/angular-slickgrid.es5.js.map b/dist/angular-slickgrid.es5.js.map
index 4301f903f..a21db063c 100644
--- a/dist/angular-slickgrid.es5.js.map
+++ b/dist/angular-slickgrid.es5.js.map
@@ -1 +1 @@
-{"version":3,"file":"angular-slickgrid.es5.js","sources":["ts/angular-slickgrid.ts","ts/src/app/modules/angular-slickgrid/modules/angular-slickgrid.module.ts","ts/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts","ts/src/app/modules/angular-slickgrid/global-grid-options.ts","../../node_modules/slickgrid/plugins/slick.rowselectionmodel.js","../../node_modules/slickgrid/plugins/slick.rowmovemanager.js","../../node_modules/slickgrid/plugins/slick.headermenu.js","../../node_modules/slickgrid/plugins/slick.headerbuttons.js","../../node_modules/slickgrid/plugins/slick.checkboxselectcolumn.js","../../node_modules/slickgrid/plugins/slick.cellselectionmodel.js","../../node_modules/slickgrid/plugins/slick.cellrangeselector.js","../../node_modules/slickgrid/plugins/slick.cellrangedecorator.js","../../node_modules/slickgrid/plugins/slick.cellexternalcopymanager.js","../../node_modules/slickgrid/plugins/slick.cellcopymanager.js","../../node_modules/slickgrid/plugins/slick.autotooltips.js","../../node_modules/slickgrid/controls/slick.pager.js","../../node_modules/slickgrid/controls/slick.gridmenu.js","../../node_modules/slickgrid/controls/slick.columnpicker.js","../../node_modules/slickgrid/slick.grid.js","../../node_modules/slickgrid/slick.dataview.js","../../node_modules/slickgrid/slick.core.js","../../node_modules/slickgrid/lib/jquery.event.drag-2.3.0.js","../../node_modules/slickgrid/lib/jquery-ui-1.11.3.js","ts/src/app/modules/angular-slickgrid/components/slick-pagination.component.ts","ts/src/app/modules/angular-slickgrid/services/controlAndPlugin.service.ts","ts/src/app/modules/angular-slickgrid/services/resizer.service.ts","ts/src/app/modules/angular-slickgrid/services/grid-odata.service.ts","ts/src/app/modules/angular-slickgrid/services/odata.service.ts","ts/src/app/modules/angular-slickgrid/services/global-utilities.ts","ts/src/app/modules/angular-slickgrid/services/gridExtraUtils.ts","ts/src/app/modules/angular-slickgrid/services/gridExtra.service.ts","ts/src/app/modules/angular-slickgrid/services/graphql.service.ts","ts/src/app/modules/angular-slickgrid/services/graphqlQueryBuilder.ts","ts/src/app/modules/angular-slickgrid/services/gridEvent.service.ts","ts/src/app/modules/angular-slickgrid/services/sort.service.ts","ts/src/app/modules/angular-slickgrid/services/filter.service.ts","ts/src/app/modules/angular-slickgrid/sorters/index.ts","ts/src/app/modules/angular-slickgrid/sorters/stringSorter.ts","ts/src/app/modules/angular-slickgrid/sorters/numericSorter.ts","ts/src/app/modules/angular-slickgrid/sorters/dateUsSorter.ts","ts/src/app/modules/angular-slickgrid/sorters/dateIsoSorter.ts","ts/src/app/modules/angular-slickgrid/sorters/dateSorter.ts","ts/src/app/modules/angular-slickgrid/sorters/dateUsShortSorter.ts","ts/src/app/modules/angular-slickgrid/formatters/index.ts","ts/src/app/modules/angular-slickgrid/formatters/yesNoFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/progressBarFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/percentCompleteBarFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/percentCompleteFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/editIconFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/hyperlinkFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/deleteIconFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/dateUsFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/dateTimeUsFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/dateTimeUsAmPmFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/dateTimeIsoAmPmFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/dateIsoFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/complexObjectFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/checkmarkFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/checkboxFormatter.ts","ts/src/app/modules/angular-slickgrid/formatters/arrayToCsvFormatter.ts","ts/src/app/modules/angular-slickgrid/filter-templates/index.ts","ts/src/app/modules/angular-slickgrid/filter-templates/selectFilterTemplate.ts","ts/src/app/modules/angular-slickgrid/filter-templates/inputFilterTemplate.ts","ts/src/app/modules/angular-slickgrid/filter-conditions/index.ts","ts/src/app/modules/angular-slickgrid/filter-conditions/executeMappedCondition.ts","ts/src/app/modules/angular-slickgrid/filter-conditions/stringFilterCondition.ts","ts/src/app/modules/angular-slickgrid/filter-conditions/numberFilterCondition.ts","ts/src/app/modules/angular-slickgrid/filter-conditions/dateUtcFilterCondition.ts","ts/src/app/modules/angular-slickgrid/filter-conditions/dateUsShortFilterCondition.ts","ts/src/app/modules/angular-slickgrid/filter-conditions/dateUsFilterCondition.ts","ts/src/app/modules/angular-slickgrid/filter-conditions/dateIsoFilterCondition.ts","ts/src/app/modules/angular-slickgrid/filter-conditions/dateFilterCondition.ts","ts/src/app/modules/angular-slickgrid/filter-conditions/filterUtilities.ts","ts/src/app/modules/angular-slickgrid/filter-conditions/booleanFilterCondition.ts","ts/src/app/modules/angular-slickgrid/editors/index.ts","ts/src/app/modules/angular-slickgrid/editors/textEditor.ts","ts/src/app/modules/angular-slickgrid/editors/longTextEditor.ts","ts/src/app/modules/angular-slickgrid/editors/integerEditor.ts","ts/src/app/modules/angular-slickgrid/editors/floatEditor.ts","ts/src/app/modules/angular-slickgrid/editors/dateEditor.ts","ts/src/app/modules/angular-slickgrid/services/utilities.ts","../../node_modules/moment-mini/moment.min.js","ts/src/app/modules/angular-slickgrid/editors/checkboxEditor.ts","../../node_modules/jquery/dist/jquery.js","ts/src/app/modules/angular-slickgrid/models/sortDirection.ts","ts/src/app/modules/angular-slickgrid/models/operatorType.ts","ts/src/app/modules/angular-slickgrid/models/keyCode.enum.ts","ts/src/app/modules/angular-slickgrid/models/formElementType.ts","ts/src/app/modules/angular-slickgrid/models/fieldType.ts","ts/src/app/modules/angular-slickgrid/models/caseType.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport {AutoResizeOption,BackendService,BackendEventChanged,BackendServiceOption,CaseType,CellArgs,Column,ColumnFilter,ColumnFilters,Editor,FieldType,Filter,FilterChangedArgs,FilterCondition,FilterConditionOption,Formatter,FormElementType,GraphqlDatasetFilter,GraphqlCursorPaginationOption,GraphqlFilteringOption,GraphqlPaginationOption,GraphqlServiceOption,GraphqlSortingOption,HtmlElementPosition,KeyCode,GridOption,OdataOption,OnEventArgs,OperatorType,Pagination,PaginationChangedArgs,SlickEvent,SortChangedArgs,SortDirection,Sorter,Editors,FilterConditions,FilterTemplates,Formatters,Sorters,FilterService,SortService,GridEventService,GraphqlService,GridExtraService,GridExtraUtils,GridOdataService,OdataService,ResizerService,ControlAndPluginService,SlickPaginationComponent,AngularSlickgridComponent,AngularSlickgridModule} from './public_api';\n\nexport {CheckboxEditor as ɵa} from './src/app/modules/angular-slickgrid/editors/checkboxEditor';\nexport {DateEditor as ɵb} from './src/app/modules/angular-slickgrid/editors/dateEditor';\nexport {FloatEditor as ɵc} from './src/app/modules/angular-slickgrid/editors/floatEditor';\nexport {IntegerEditor as ɵd} from './src/app/modules/angular-slickgrid/editors/integerEditor';\nexport {LongTextEditor as ɵe} from './src/app/modules/angular-slickgrid/editors/longTextEditor';\nexport {TextEditor as ɵf} from './src/app/modules/angular-slickgrid/editors/textEditor';\nexport {booleanFilterCondition as ɵh} from './src/app/modules/angular-slickgrid/filter-conditions/booleanFilterCondition';\nexport {dateFilterCondition as ɵi} from './src/app/modules/angular-slickgrid/filter-conditions/dateFilterCondition';\nexport {dateIsoFilterCondition as ɵj} from './src/app/modules/angular-slickgrid/filter-conditions/dateIsoFilterCondition';\nexport {dateUsFilterCondition as ɵl} from './src/app/modules/angular-slickgrid/filter-conditions/dateUsFilterCondition';\nexport {dateUsShortFilterCondition as ɵm} from './src/app/modules/angular-slickgrid/filter-conditions/dateUsShortFilterCondition';\nexport {dateUtcFilterCondition as ɵk} from './src/app/modules/angular-slickgrid/filter-conditions/dateUtcFilterCondition';\nexport {executeMappedCondition as ɵg} from './src/app/modules/angular-slickgrid/filter-conditions/executeMappedCondition';\nexport {testFilterCondition as ɵp} from './src/app/modules/angular-slickgrid/filter-conditions/filterUtilities';\nexport {numberFilterCondition as ɵn} from './src/app/modules/angular-slickgrid/filter-conditions/numberFilterCondition';\nexport {stringFilterCondition as ɵo} from './src/app/modules/angular-slickgrid/filter-conditions/stringFilterCondition';\nexport {inputFilterTemplate as ɵq} from './src/app/modules/angular-slickgrid/filter-templates/inputFilterTemplate';\nexport {selectFilterTemplate as ɵr} from './src/app/modules/angular-slickgrid/filter-templates/selectFilterTemplate';\nexport {arrayToCsvFormatter as ɵs} from './src/app/modules/angular-slickgrid/formatters/arrayToCsvFormatter';\nexport {checkboxFormatter as ɵt} from './src/app/modules/angular-slickgrid/formatters/checkboxFormatter';\nexport {checkmarkFormatter as ɵu} from './src/app/modules/angular-slickgrid/formatters/checkmarkFormatter';\nexport {complexObjectFormatter as ɵv} from './src/app/modules/angular-slickgrid/formatters/complexObjectFormatter';\nexport {dateIsoFormatter as ɵw} from './src/app/modules/angular-slickgrid/formatters/dateIsoFormatter';\nexport {dateTimeIsoAmPmFormatter as ɵx} from './src/app/modules/angular-slickgrid/formatters/dateTimeIsoAmPmFormatter';\nexport {dateTimeUsAmPmFormatter as ɵba} from './src/app/modules/angular-slickgrid/formatters/dateTimeUsAmPmFormatter';\nexport {dateTimeUsFormatter as ɵz} from './src/app/modules/angular-slickgrid/formatters/dateTimeUsFormatter';\nexport {dateUsFormatter as ɵy} from './src/app/modules/angular-slickgrid/formatters/dateUsFormatter';\nexport {deleteIconFormatter as ɵbb} from './src/app/modules/angular-slickgrid/formatters/deleteIconFormatter';\nexport {editIconFormatter as ɵbc} from './src/app/modules/angular-slickgrid/formatters/editIconFormatter';\nexport {hyperlinkFormatter as ɵbd} from './src/app/modules/angular-slickgrid/formatters/hyperlinkFormatter';\nexport {percentCompleteBarFormatter as ɵbf} from './src/app/modules/angular-slickgrid/formatters/percentCompleteBarFormatter';\nexport {percentCompleteFormatter as ɵbe} from './src/app/modules/angular-slickgrid/formatters/percentCompleteFormatter';\nexport {progressBarFormatter as ɵbg} from './src/app/modules/angular-slickgrid/formatters/progressBarFormatter';\nexport {yesNoFormatter as ɵbh} from './src/app/modules/angular-slickgrid/formatters/yesNoFormatter';\nexport {dateIsoSorter as ɵbj} from './src/app/modules/angular-slickgrid/sorters/dateIsoSorter';\nexport {dateSorter as ɵbi} from './src/app/modules/angular-slickgrid/sorters/dateSorter';\nexport {dateUsShortSorter as ɵbl} from './src/app/modules/angular-slickgrid/sorters/dateUsShortSorter';\nexport {dateUsSorter as ɵbk} from './src/app/modules/angular-slickgrid/sorters/dateUsSorter';\nexport {numericSorter as ɵbm} from './src/app/modules/angular-slickgrid/sorters/numericSorter';\nexport {stringSorter as ɵbn} from './src/app/modules/angular-slickgrid/sorters/stringSorter';","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AngularSlickgridComponent } from './../components/angular-slickgrid.component';\nimport { ControlAndPluginService } from '../services/controlAndPlugin.service';\nimport { Formatters } from './../formatters';\nimport { FilterService } from './../services/filter.service';\nimport { GridEventService } from './../services/gridEvent.service';\nimport { GridExtraService } from '../services/gridExtra.service';\nimport { GraphqlService } from './../services/graphql.service';\nimport { OdataService } from './../services/odata.service';\nimport { ResizerService } from './../services/resizer.service';\nimport { SlickPaginationComponent } from './../components/slick-pagination.component';\nimport { SortService } from './../services/sort.service';\nexport class AngularSlickgridModule { static decorators: DecoratorInvocation[] = [\n{ type: NgModule, args: [{\n imports: [\n CommonModule\n ],\n declarations: [\n AngularSlickgridComponent,\n SlickPaginationComponent\n ],\n exports: [\n AngularSlickgridComponent,\n SlickPaginationComponent\n ],\n providers: [\n ControlAndPluginService,\n GraphqlService,\n GridEventService,\n GridExtraService,\n OdataService,\n FilterService,\n SortService,\n ResizerService\n ]\n}, ] },\n];\n/**\n * @nocollapse\n */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n];\n}\n\nfunction AngularSlickgridModule_tsickle_Closure_declarations() {\n/** @type {?} */\nAngularSlickgridModule.decorators;\n/**\n * @nocollapse\n * @type {?}\n */\nAngularSlickgridModule.ctorParameters;\n}\n\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n","// import 3rd party vendor libs\n\nimport'slickgrid/lib/jquery-ui-1.11.3';\nimport'slickgrid/lib/jquery.event.drag-2.3.0';\nimport'slickgrid/slick.core';\nimport'slickgrid/slick.dataview';\nimport'slickgrid/slick.grid';\nimport'slickgrid/slick.dataview';\nimport'slickgrid/controls/slick.columnpicker';\nimport'slickgrid/controls/slick.gridmenu';\nimport'slickgrid/controls/slick.pager';\nimport'slickgrid/plugins/slick.autotooltips';\nimport'slickgrid/plugins/slick.cellcopymanager';\nimport'slickgrid/plugins/slick.cellexternalcopymanager';\nimport'slickgrid/plugins/slick.cellrangedecorator';\nimport'slickgrid/plugins/slick.cellrangeselector';\nimport'slickgrid/plugins/slick.cellselectionmodel';\nimport'slickgrid/plugins/slick.checkboxselectcolumn';\nimport'slickgrid/plugins/slick.headerbuttons';\nimport'slickgrid/plugins/slick.headermenu';\nimport'slickgrid/plugins/slick.rowmovemanager';\nimport'slickgrid/plugins/slick.rowselectionmodel';\nimport { AfterViewInit, Component, EventEmitter, Injectable, Input, Output, OnDestroy, OnInit } from '@angular/core';\nimport { castToPromise } from './../services/utilities';\nimport { GlobalGridOptions } from './../global-grid-options';\nimport { CellArgs, Column, FormElementType, GridOption } from './../models';\nimport { ControlAndPluginService } from './../services/controlAndPlugin.service';\nimport { FilterService } from './../services/filter.service';\nimport { GridEventService } from './../services/gridEvent.service';\nimport { GridExtraService } from './../services/gridExtra.service';\nimport { ResizerService } from './../services/resizer.service';\nimport { SortService } from './../services/sort.service';\n\nimport $ from 'jquery';\n\n// using external js modules in Angular\ndeclare var Slick: any;\nexport class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnInit {\nprivate _dataset: any[];\nprivate _dataView: any;\nprivate _gridOptions: GridOption;\n grid: any;\n gridPaginationOptions: GridOption;\n gridHeightString: string;\n gridWidthString: string;\n showPagination = false;\n\n dataviewChanged = new EventEmitter();\n gridChanged = new EventEmitter();\n gridId: string;\n columnDefinitions: Column[];\n gridOptions: GridOption;\n gridHeight = 100;\n gridWidth = 600;\n/**\n * @param {?} dataset\n * @return {?}\n */\nset dataset(dataset: any[]) {\n this._dataset = dataset;\n this.refreshGridData(dataset);\n }\n/**\n * @return {?}\n */\nget dataset(): any[] {\n return this._dataView.getItems();\n }\n/**\n * @param {?} filterService\n * @param {?} sortService\n * @param {?} gridExtraService\n * @param {?} gridEventService\n * @param {?} resizer\n * @param {?} controlAndPluginService\n */\nconstructor(\nprivate filterService: FilterService,\nprivate sortService: SortService,\nprivate gridExtraService: GridExtraService,\nprivate gridEventService: GridEventService,\nprivate resizer: ResizerService,\nprivate controlAndPluginService: ControlAndPluginService\n ) {}\n/**\n * @return {?}\n */\nngOnInit(): void {\n this.gridHeightString = `${this.gridHeight}px`;\n this.gridWidthString = `${this.gridWidth}px`;\n }\n/**\n * @return {?}\n */\nngOnDestroy(): void {\n this._dataView = [];\n this.controlAndPluginService.destroy();\n this.filterService.clearFilters();\n this.resizer.destroy();\n this.grid.destroy();\n }\n/**\n * @return {?}\n */\nngAfterViewInit() {\n // make sure the dataset is initialized (if not it will throw an error that it cannot getLength of null)\n this._dataset = this._dataset || [];\n this._gridOptions = this.mergeGridOptions();\n\n this._dataView = new Slick.Data.DataView();\n this.controlAndPluginService.createPluginBeforeGridCreation(this.columnDefinitions, this._gridOptions);\n this.grid = new Slick.Grid(`#${this.gridId}`, this._dataView, this.columnDefinitions, this._gridOptions);\n\n this.controlAndPluginService.attachDifferentControlOrPlugins(this.grid, this.columnDefinitions, this._gridOptions, this._dataView);\n this.attachDifferentHooks(this.grid, this._gridOptions, this._dataView);\n\n // emit the Grid & DataView object to make them available in parent component\n this.gridChanged.emit(this.grid);\n this.dataviewChanged.emit(this._dataView);\n\n this.grid.init();\n this._dataView.beginUpdate();\n this._dataView.setItems(this._dataset);\n this._dataView.endUpdate();\n\n // attach resize ONLY after the dataView is ready\n this.attachResizeHook(this.grid, this._gridOptions);\n\n // attach grid extra service\n const /** @type {?} */ gridExtraService = this.gridExtraService.init(this.grid, this.columnDefinitions, this._gridOptions, this._dataView);\n }\n/**\n * @param {?} grid\n * @param {?} options\n * @param {?} dataView\n * @return {?}\n */\nattachDifferentHooks(grid: any, options: GridOption, dataView: any) {\n // attach external sorting (backend) when available or default onSort (dataView)\n if (options.enableSorting) {\n (options.onBackendEventApi) ? this.sortService.attachBackendOnSort(grid, options) : this.sortService.attachLocalOnSort(grid, options, this._dataView);\n }\n\n // attach external filter (backend) when available or default onFilter (dataView)\n if (options.enableFiltering) {\n this.filterService.init(grid, options, this.columnDefinitions);\n (options.onBackendEventApi) ? this.filterService.attachBackendOnFilter(grid, options) : this.filterService.attachLocalOnFilter(grid, options, this._dataView);\n }\n\n if (options.onBackendEventApi && options.onBackendEventApi.onInit) {\n const /** @type {?} */ backendApi = options.onBackendEventApi;\n const /** @type {?} */ query = backendApi.service.buildQuery();\n\n // wrap this inside a setTimeout to avoid timing issue since the gridOptions needs to be ready before running this onInit\n setTimeout(async () => {\n // the process could be an Observable (like HttpClient) or a Promise\n // in any case, we need to have a Promise so that we can await on it (if an Observable, convert it to Promise)\n const /** @type {?} */ observableOrPromise = options.onBackendEventApi.onInit(query);\n const /** @type {?} */ responseProcess = await castToPromise(observableOrPromise);\n\n // send the response process to the postProcess callback\n if (backendApi.postProcess) {\n backendApi.postProcess(responseProcess);\n }\n });\n }\n\n // on cell click, mainly used with the columnDef.action callback\n this.gridEventService.attachOnCellChange(grid, this._gridOptions, dataView);\n this.gridEventService.attachOnClick(grid, this._gridOptions, dataView);\n\n dataView.onRowCountChanged.subscribe((e: any, args: any) => {\n grid.updateRowCount();\n grid.render();\n });\n dataView.onRowsChanged.subscribe((e: any, args: any) => {\n grid.invalidateRows(args.rows);\n grid.render();\n });\n }\n/**\n * @param {?} grid\n * @param {?} options\n * @return {?}\n */\nattachResizeHook(grid: any, options: GridOption) {\n // expand/autofit columns on first page load\n if (this._gridOptions.autoFitColumnsOnFirstLoad) {\n this.grid.autosizeColumns();\n }\n\n // auto-resize grid on browser resize\n this.resizer.init(grid, options);\n if (options.enableAutoResize) {\n this.resizer.attachAutoResizeDataGrid();\n if (options.autoFitColumnsOnFirstLoad) {\n grid.autosizeColumns();\n }\n } else {\n this.resizer.resizeGrid(0, { height: this.gridHeight, width: this.gridWidth });\n }\n }\n/**\n * @return {?}\n */\nmergeGridOptions(): GridOption {\n this.gridOptions.gridId = this.gridId;\n this.gridOptions.gridContainerId = `slickGridContainer-${this.gridId}`;\n if (this.gridOptions.enableFiltering) {\n this.gridOptions.showHeaderRow = true;\n }\n // use jquery extend to deep merge and avoid immutable properties changed in GlobalGridOptions after route change\n return $.extend(true, {}, GlobalGridOptions, this.gridOptions);\n }\n/**\n * When dataset changes, we need to refresh the entire grid UI & possibly resize it as well\n * @param {?} dataset\n * @return {?}\n */\nrefreshGridData(dataset: any[]) {\n if (dataset && this.grid) {\n this._dataView.setItems(dataset);\n\n // this.grid.setData(dataset);\n this.grid.invalidate();\n this.grid.render();\n\n if (this._gridOptions.enablePagination) {\n this.showPagination = true;\n this.gridPaginationOptions = this.mergeGridOptions();\n }\n if (this._gridOptions.enableAutoResize) {\n // resize the grid inside a slight timeout, in case other DOM element changed prior to the resize (like a filter/pagination changed)\n this.resizer.resizeGrid(10);\n // this.grid.autosizeColumns();\n }\n }\n }\n/**\n * Toggle the filter row displayed on first row\n * @param {?} isShowing\n * @return {?}\n */\nshowHeaderRow(isShowing: boolean) {\n this.grid.setHeaderRowVisibility(isShowing);\n return isShowing;\n }\n/**\n * Toggle the filter row displayed on first row\n * @return {?}\n */\ntoggleHeaderRow() {\n const /** @type {?} */ isShowing = !this.grid.getOptions().showHeaderRow;\n this.grid.setHeaderRowVisibility(isShowing);\n return isShowing;\n }\nstatic decorators: DecoratorInvocation[] = [\n{ type: Injectable },\n{ type: Component, args: [{\n selector: 'angular-slickgrid',\n template: `\n
\n
\n
\n\n \n
\n `\n}, ] },\n];\n/**\n * @nocollapse\n */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n{type: FilterService, },\n{type: SortService, },\n{type: GridExtraService, },\n{type: GridEventService, },\n{type: ResizerService, },\n{type: ControlAndPluginService, },\n];\nstatic propDecorators: {[key: string]: DecoratorInvocation[]} = {\n'dataviewChanged': [{ type: Output },],\n'gridChanged': [{ type: Output },],\n'gridId': [{ type: Input },],\n'columnDefinitions': [{ type: Input },],\n'gridOptions': [{ type: Input },],\n'gridHeight': [{ type: Input },],\n'gridWidth': [{ type: Input },],\n'dataset': [{ type: Input },],\n};\n}\n\nfunction AngularSlickgridComponent_tsickle_Closure_declarations() {\n/** @type {?} */\nAngularSlickgridComponent.decorators;\n/**\n * @nocollapse\n * @type {?}\n */\nAngularSlickgridComponent.ctorParameters;\n/** @type {?} */\nAngularSlickgridComponent.propDecorators;\n/** @type {?} */\nAngularSlickgridComponent.prototype._dataset;\n/** @type {?} */\nAngularSlickgridComponent.prototype._dataView;\n/** @type {?} */\nAngularSlickgridComponent.prototype._gridOptions;\n/** @type {?} */\nAngularSlickgridComponent.prototype.grid;\n/** @type {?} */\nAngularSlickgridComponent.prototype.gridPaginationOptions;\n/** @type {?} */\nAngularSlickgridComponent.prototype.gridHeightString;\n/** @type {?} */\nAngularSlickgridComponent.prototype.gridWidthString;\n/** @type {?} */\nAngularSlickgridComponent.prototype.showPagination;\n/** @type {?} */\nAngularSlickgridComponent.prototype.dataviewChanged;\n/** @type {?} */\nAngularSlickgridComponent.prototype.gridChanged;\n/** @type {?} */\nAngularSlickgridComponent.prototype.gridId;\n/** @type {?} */\nAngularSlickgridComponent.prototype.columnDefinitions;\n/** @type {?} */\nAngularSlickgridComponent.prototype.gridOptions;\n/** @type {?} */\nAngularSlickgridComponent.prototype.gridHeight;\n/** @type {?} */\nAngularSlickgridComponent.prototype.gridWidth;\n/** @type {?} */\nAngularSlickgridComponent.prototype.filterService;\n/** @type {?} */\nAngularSlickgridComponent.prototype.sortService;\n/** @type {?} */\nAngularSlickgridComponent.prototype.gridExtraService;\n/** @type {?} */\nAngularSlickgridComponent.prototype.gridEventService;\n/** @type {?} */\nAngularSlickgridComponent.prototype.resizer;\n/** @type {?} */\nAngularSlickgridComponent.prototype.controlAndPluginService;\n}\n\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n","import { GridOption } from './models';\n/**\n * Options that can be passed to the Bootstrap-Datetimepicker directly\n */\nexport const GlobalGridOptions: GridOption = {\n autoEdit: false,\n asyncEditorLoading: false,\n autoFitColumnsOnFirstLoad: true,\n autoResize: {\n bottomPadding: 20,\n minHeight: 180,\n minWidth: 300,\n sidePadding: 0\n },\n cellHighlightCssClass: 'slick-cell-modified',\n checkboxSelector: {\n cssClass: 'slick-cell-checkboxsel'\n },\n editable: false,\n enableAutoResize: true,\n enableCellNavigation: false,\n enableColumnPicker: true,\n enableColumnReorder: true,\n enableGridMenu: true,\n enableMouseHoverHighlightRow: true,\n enablePagination: false,\n enableSorting: true,\n enableTextSelectionOnCells: true,\n explicitInitialization: true,\n forceFitColumns: false,\n gridMenu: {\n columnTitle: 'Columns',\n iconCssClass: 'fa fa-bars',\n menuWidth: 16,\n resizeOnShowHeaderRow: false\n },\n headerRowHeight: 35,\n locale: 'en',\n multiColumnSort: true,\n pagination: {\n pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],\n pageSize: 25,\n totalItems: 0\n },\n rowHeight: 35,\n showHeaderRow: false,\n topPanelHeight: 35\n};\n","(function ($) {\r\n // register namespace\r\n $.extend(true, window, {\r\n \"Slick\": {\r\n \"RowSelectionModel\": RowSelectionModel\r\n }\r\n });\r\n\r\n function RowSelectionModel(options) {\r\n var _grid;\r\n var _ranges = [];\r\n var _self = this;\r\n var _handler = new Slick.EventHandler();\r\n var _inHandler;\r\n var _options;\r\n var _defaults = {\r\n selectActiveRow: true\r\n };\r\n\r\n function init(grid) {\r\n _options = $.extend(true, {}, _defaults, options);\r\n _grid = grid;\r\n _handler.subscribe(_grid.onActiveCellChanged,\r\n wrapHandler(handleActiveCellChange));\r\n _handler.subscribe(_grid.onKeyDown,\r\n wrapHandler(handleKeyDown));\r\n _handler.subscribe(_grid.onClick,\r\n wrapHandler(handleClick));\r\n }\r\n\r\n function destroy() {\r\n _handler.unsubscribeAll();\r\n }\r\n\r\n function wrapHandler(handler) {\r\n return function () {\r\n if (!_inHandler) {\r\n _inHandler = true;\r\n handler.apply(this, arguments);\r\n _inHandler = false;\r\n }\r\n };\r\n }\r\n\r\n function rangesToRows(ranges) {\r\n var rows = [];\r\n for (var i = 0; i < ranges.length; i++) {\r\n for (var j = ranges[i].fromRow; j <= ranges[i].toRow; j++) {\r\n rows.push(j);\r\n }\r\n }\r\n return rows;\r\n }\r\n\r\n function rowsToRanges(rows) {\r\n var ranges = [];\r\n var lastCell = _grid.getColumns().length - 1;\r\n for (var i = 0; i < rows.length; i++) {\r\n ranges.push(new Slick.Range(rows[i], 0, rows[i], lastCell));\r\n }\r\n return ranges;\r\n }\r\n\r\n function getRowsRange(from, to) {\r\n var i, rows = [];\r\n for (i = from; i <= to; i++) {\r\n rows.push(i);\r\n }\r\n for (i = to; i < from; i++) {\r\n rows.push(i);\r\n }\r\n return rows;\r\n }\r\n\r\n function getSelectedRows() {\r\n return rangesToRows(_ranges);\r\n }\r\n\r\n function setSelectedRows(rows) {\r\n setSelectedRanges(rowsToRanges(rows));\r\n }\r\n\r\n function setSelectedRanges(ranges) {\r\n // simle check for: empty selection didn't change, prevent firing onSelectedRangesChanged\r\n if ((!_ranges || _ranges.length === 0) && (!ranges || ranges.length === 0)) { return; }\r\n _ranges = ranges;\r\n _self.onSelectedRangesChanged.notify(_ranges);\r\n }\r\n\r\n function getSelectedRanges() {\r\n return _ranges;\r\n }\r\n\r\n function handleActiveCellChange(e, data) {\r\n if (_options.selectActiveRow && data.row != null) {\r\n setSelectedRanges([new Slick.Range(data.row, 0, data.row, _grid.getColumns().length - 1)]);\r\n }\r\n }\r\n\r\n function handleKeyDown(e) {\r\n var activeRow = _grid.getActiveCell();\r\n if (activeRow && e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey && (e.which == 38 || e.which == 40)) {\r\n var selectedRows = getSelectedRows();\r\n selectedRows.sort(function (x, y) {\r\n return x - y\r\n });\r\n\r\n if (!selectedRows.length) {\r\n selectedRows = [activeRow.row];\r\n }\r\n\r\n var top = selectedRows[0];\r\n var bottom = selectedRows[selectedRows.length - 1];\r\n var active;\r\n\r\n if (e.which == 40) {\r\n active = activeRow.row < bottom || top == bottom ? ++bottom : ++top;\r\n } else {\r\n active = activeRow.row < bottom ? --bottom : --top;\r\n }\r\n\r\n if (active >= 0 && active < _grid.getDataLength()) {\r\n _grid.scrollRowIntoView(active);\r\n var tempRanges = rowsToRanges(getRowsRange(top, bottom));\r\n setSelectedRanges(tempRanges);\r\n }\r\n\r\n e.preventDefault();\r\n e.stopPropagation();\r\n }\r\n }\r\n\r\n function handleClick(e) {\r\n var cell = _grid.getCellFromEvent(e);\r\n if (!cell || !_grid.canCellBeActive(cell.row, cell.cell)) {\r\n return false;\r\n }\r\n\r\n if (!_grid.getOptions().multiSelect || (\r\n !e.ctrlKey && !e.shiftKey && !e.metaKey)) {\r\n return false;\r\n }\r\n\r\n var selection = rangesToRows(_ranges);\r\n var idx = $.inArray(cell.row, selection);\r\n\r\n if (idx === -1 && (e.ctrlKey || e.metaKey)) {\r\n selection.push(cell.row);\r\n _grid.setActiveCell(cell.row, cell.cell);\r\n } else if (idx !== -1 && (e.ctrlKey || e.metaKey)) {\r\n selection = $.grep(selection, function (o, i) {\r\n return (o !== cell.row);\r\n });\r\n _grid.setActiveCell(cell.row, cell.cell);\r\n } else if (selection.length && e.shiftKey) {\r\n var last = selection.pop();\r\n var from = Math.min(cell.row, last);\r\n var to = Math.max(cell.row, last);\r\n selection = [];\r\n for (var i = from; i <= to; i++) {\r\n if (i !== last) {\r\n selection.push(i);\r\n }\r\n }\r\n selection.push(last);\r\n _grid.setActiveCell(cell.row, cell.cell);\r\n }\r\n\r\n var tempRanges = rowsToRanges(selection);\r\n setSelectedRanges(tempRanges);\r\n e.stopImmediatePropagation();\r\n\r\n return true;\r\n }\r\n\r\n $.extend(this, {\r\n \"getSelectedRows\": getSelectedRows,\r\n \"setSelectedRows\": setSelectedRows,\r\n\r\n \"getSelectedRanges\": getSelectedRanges,\r\n \"setSelectedRanges\": setSelectedRanges,\r\n\r\n \"init\": init,\r\n \"destroy\": destroy,\r\n\r\n \"onSelectedRangesChanged\": new Slick.Event()\r\n });\r\n }\r\n})(jQuery);","(function ($) {\r\n // register namespace\r\n $.extend(true, window, {\r\n \"Slick\": {\r\n \"RowMoveManager\": RowMoveManager\r\n }\r\n });\r\n\r\n function RowMoveManager(options) {\r\n var _grid;\r\n var _canvas;\r\n var _dragging;\r\n var _self = this;\r\n var _handler = new Slick.EventHandler();\r\n var _defaults = {\r\n cancelEditOnDrag: false\r\n };\r\n\r\n function init(grid) {\r\n options = $.extend(true, {}, _defaults, options);\r\n _grid = grid;\r\n _canvas = _grid.getCanvasNode();\r\n _handler\r\n .subscribe(_grid.onDragInit, handleDragInit)\r\n .subscribe(_grid.onDragStart, handleDragStart)\r\n .subscribe(_grid.onDrag, handleDrag)\r\n .subscribe(_grid.onDragEnd, handleDragEnd);\r\n }\r\n\r\n function destroy() {\r\n _handler.unsubscribeAll();\r\n }\r\n\r\n function handleDragInit(e, dd) {\r\n // prevent the grid from cancelling drag'n'drop by default\r\n e.stopImmediatePropagation();\r\n }\r\n\r\n function handleDragStart(e, dd) {\r\n var cell = _grid.getCellFromEvent(e);\r\n\r\n if (options.cancelEditOnDrag && _grid.getEditorLock().isActive()) {\r\n _grid.getEditorLock().cancelCurrentEdit();\r\n }\r\n\r\n if (_grid.getEditorLock().isActive() || !/move|selectAndMove/.test(_grid.getColumns()[cell.cell].behavior)) {\r\n return false;\r\n }\r\n\r\n _dragging = true;\r\n e.stopImmediatePropagation();\r\n\r\n var selectedRows = _grid.getSelectedRows();\r\n\r\n if (selectedRows.length == 0 || $.inArray(cell.row, selectedRows) == -1) {\r\n selectedRows = [cell.row];\r\n _grid.setSelectedRows(selectedRows);\r\n }\r\n\r\n var rowHeight = _grid.getOptions().rowHeight;\r\n\r\n dd.selectedRows = selectedRows;\r\n\r\n dd.selectionProxy = $(\"\")\r\n .css(\"position\", \"absolute\")\r\n .css(\"zIndex\", \"99999\")\r\n .css(\"width\", $(_canvas).innerWidth())\r\n .css(\"height\", rowHeight * selectedRows.length)\r\n .appendTo(_canvas);\r\n\r\n dd.guide = $(\"\")\r\n .css(\"position\", \"absolute\")\r\n .css(\"zIndex\", \"99998\")\r\n .css(\"width\", $(_canvas).innerWidth())\r\n .css(\"top\", -1000)\r\n .appendTo(_canvas);\r\n\r\n dd.insertBefore = -1;\r\n }\r\n\r\n function handleDrag(e, dd) {\r\n if (!_dragging) {\r\n return;\r\n }\r\n\r\n e.stopImmediatePropagation();\r\n\r\n var top = e.pageY - $(_canvas).offset().top;\r\n dd.selectionProxy.css(\"top\", top - 5);\r\n\r\n var insertBefore = Math.max(0, Math.min(Math.round(top / _grid.getOptions().rowHeight), _grid.getDataLength()));\r\n if (insertBefore !== dd.insertBefore) {\r\n var eventData = {\r\n \"rows\": dd.selectedRows,\r\n \"insertBefore\": insertBefore\r\n };\r\n\r\n if (_self.onBeforeMoveRows.notify(eventData) === false) {\r\n dd.guide.css(\"top\", -1000);\r\n dd.canMove = false;\r\n } else {\r\n dd.guide.css(\"top\", insertBefore * _grid.getOptions().rowHeight);\r\n dd.canMove = true;\r\n }\r\n\r\n dd.insertBefore = insertBefore;\r\n }\r\n }\r\n\r\n function handleDragEnd(e, dd) {\r\n if (!_dragging) {\r\n return;\r\n }\r\n _dragging = false;\r\n e.stopImmediatePropagation();\r\n\r\n dd.guide.remove();\r\n dd.selectionProxy.remove();\r\n\r\n if (dd.canMove) {\r\n var eventData = {\r\n \"rows\": dd.selectedRows,\r\n \"insertBefore\": dd.insertBefore\r\n };\r\n // TODO: _grid.remapCellCssClasses ?\r\n _self.onMoveRows.notify(eventData);\r\n }\r\n }\r\n\r\n $.extend(this, {\r\n \"onBeforeMoveRows\": new Slick.Event(),\r\n \"onMoveRows\": new Slick.Event(),\r\n\r\n \"init\": init,\r\n \"destroy\": destroy\r\n });\r\n }\r\n})(jQuery);","(function ($) {\r\n // register namespace\r\n $.extend(true, window, {\r\n \"Slick\": {\r\n \"Plugins\": {\r\n \"HeaderMenu\": HeaderMenu\r\n }\r\n }\r\n });\r\n\r\n\r\n /***\r\n * A plugin to add drop-down menus to column headers.\r\n *\r\n * USAGE:\r\n *\r\n * Add the plugin .js & .css files and register it with the grid.\r\n *\r\n * To specify a menu in a column header, extend the column definition like so:\r\n *\r\n * var columns = [\r\n * {\r\n * id: 'myColumn',\r\n * name: 'My column',\r\n *\r\n * // This is the relevant part\r\n * header: {\r\n * menu: {\r\n * items: [\r\n * {\r\n * // menu item options\r\n * },\r\n * {\r\n * // menu item options\r\n * }\r\n * ]\r\n * }\r\n * }\r\n * }\r\n * ];\r\n *\r\n *\r\n * Available menu options:\r\n * tooltip: Menu button tooltip.\r\n *\r\n *\r\n * Available menu item options:\r\n * title: Menu item text.\r\n * disabled: Whether the item is disabled.\r\n * tooltip: Item tooltip.\r\n * command: A command identifier to be passed to the onCommand event handlers.\r\n * iconCssClass: A CSS class to be added to the menu item icon.\r\n * iconImage: A url to the icon image.\r\n *\r\n *\r\n * The plugin exposes the following events:\r\n * onBeforeMenuShow: Fired before the menu is shown. You can customize the menu or dismiss it by returning false.\r\n * Event args:\r\n * grid: Reference to the grid.\r\n * column: Column definition.\r\n * menu: Menu options. Note that you can change the menu items here.\r\n *\r\n * onCommand: Fired on menu item click for buttons with 'command' specified.\r\n * Event args:\r\n * grid: Reference to the grid.\r\n * column: Column definition.\r\n * command: Button command identified.\r\n * button: Button options. Note that you can change the button options in your\r\n * event handler, and the column header will be automatically updated to\r\n * reflect them. This is useful if you want to implement something like a\r\n * toggle button.\r\n *\r\n *\r\n * @param options {Object} Options:\r\n * buttonCssClass: an extra CSS class to add to the menu button\r\n * buttonImage: a url to the menu button image (default '../images/down.gif')\r\n * @class Slick.Plugins.HeaderButtons\r\n * @constructor\r\n */\r\n function HeaderMenu(options) {\r\n var _grid;\r\n var _self = this;\r\n var _handler = new Slick.EventHandler();\r\n var _defaults = {\r\n buttonCssClass: null,\r\n buttonImage: null\r\n };\r\n var $menu;\r\n var $activeHeaderColumn;\r\n\r\n\r\n function init(grid) {\r\n options = $.extend(true, {}, _defaults, options);\r\n _grid = grid;\r\n _handler\r\n .subscribe(_grid.onHeaderCellRendered, handleHeaderCellRendered)\r\n .subscribe(_grid.onBeforeHeaderCellDestroy, handleBeforeHeaderCellDestroy);\r\n\r\n // Force the grid to re-render the header now that the events are hooked up.\r\n _grid.setColumns(_grid.getColumns());\r\n\r\n // Hide the menu on outside click.\r\n $(document.body).on(\"mousedown\", handleBodyMouseDown);\r\n }\r\n\r\n\r\n function destroy() {\r\n _handler.unsubscribeAll();\r\n $(document.body).off(\"mousedown\", handleBodyMouseDown);\r\n }\r\n\r\n\r\n function handleBodyMouseDown(e) {\r\n if ($menu && $menu[0] != e.target && !$.contains($menu[0], e.target)) {\r\n hideMenu();\r\n }\r\n }\r\n\r\n\r\n function hideMenu() {\r\n if ($menu) {\r\n $menu.remove();\r\n $menu = null;\r\n $activeHeaderColumn\r\n .removeClass(\"slick-header-column-active\");\r\n }\r\n }\r\n\r\n function handleHeaderCellRendered(e, args) {\r\n var column = args.column;\r\n var menu = column.header && column.header.menu;\r\n\r\n if (menu) {\r\n var $el = $(\"\")\r\n .addClass(\"slick-header-menubutton\")\r\n .data(\"column\", column)\r\n .data(\"menu\", menu);\r\n\r\n if (options.buttonCssClass) {\r\n $el.addClass(options.buttonCssClass);\r\n }\r\n\r\n if (options.buttonImage) {\r\n $el.css(\"background-image\", \"url(\" + options.buttonImage + \")\");\r\n }\r\n\r\n if (menu.tooltip) {\r\n $el.attr(\"title\", menu.tooltip);\r\n }\r\n\r\n $el\r\n .on(\"click\", showMenu)\r\n .appendTo(args.node);\r\n }\r\n }\r\n\r\n\r\n function handleBeforeHeaderCellDestroy(e, args) {\r\n var column = args.column;\r\n\r\n if (column.header && column.header.menu) {\r\n $(args.node).find(\".slick-header-menubutton\").remove();\r\n }\r\n }\r\n\r\n\r\n function showMenu(e) {\r\n var $menuButton = $(this);\r\n var menu = $menuButton.data(\"menu\");\r\n var columnDef = $menuButton.data(\"column\");\r\n\r\n // Let the user modify the menu or cancel altogether,\r\n // or provide alternative menu implementation.\r\n if (_self.onBeforeMenuShow.notify({\r\n \"grid\": _grid,\r\n \"column\": columnDef,\r\n \"menu\": menu\r\n }, e, _self) == false) {\r\n return;\r\n }\r\n\r\n\r\n if (!$menu) {\r\n $menu = $(\"\")\r\n .appendTo(_grid.getContainerNode());\r\n }\r\n $menu.empty();\r\n\r\n\r\n // Construct the menu items.\r\n for (var i = 0; i < menu.items.length; i++) {\r\n var item = menu.items[i];\r\n\r\n var $li = $(\"\")\r\n .data(\"command\", item.command || '')\r\n .data(\"column\", columnDef)\r\n .data(\"item\", item)\r\n .on(\"click\", handleMenuItemClick)\r\n .appendTo($menu);\r\n\r\n if (item.disabled) {\r\n $li.addClass(\"slick-header-menuitem-disabled\");\r\n }\r\n\r\n if (item.tooltip) {\r\n $li.attr(\"title\", item.tooltip);\r\n }\r\n\r\n var $icon = $(\"\")\r\n .appendTo($li);\r\n\r\n if (item.iconCssClass) {\r\n $icon.addClass(item.iconCssClass);\r\n }\r\n\r\n if (item.iconImage) {\r\n $icon.css(\"background-image\", \"url(\" + item.iconImage + \")\");\r\n }\r\n\r\n $(\"\")\r\n .text(item.title)\r\n .appendTo($li);\r\n }\r\n\r\n\r\n // Position the menu.\r\n $menu\r\n .offset({ top: $(this).offset().top + $(this).height(), left: $(this).offset().left });\r\n\r\n\r\n // Mark the header as active to keep the highlighting.\r\n $activeHeaderColumn = $menuButton.closest(\".slick-header-column\");\r\n $activeHeaderColumn\r\n .addClass(\"slick-header-column-active\");\r\n\r\n // Stop propagation so that it doesn't register as a header click event.\r\n e.preventDefault();\r\n e.stopPropagation();\r\n }\r\n\r\n\r\n function handleMenuItemClick(e) {\r\n var command = $(this).data(\"command\");\r\n var columnDef = $(this).data(\"column\");\r\n var item = $(this).data(\"item\");\r\n\r\n if (item.disabled) {\r\n return;\r\n }\r\n\r\n hideMenu();\r\n\r\n if (command != null && command != '') {\r\n _self.onCommand.notify({\r\n \"grid\": _grid,\r\n \"column\": columnDef,\r\n \"command\": command,\r\n \"item\": item\r\n }, e, _self);\r\n }\r\n\r\n // Stop propagation so that it doesn't register as a header click event.\r\n e.preventDefault();\r\n e.stopPropagation();\r\n }\r\n\r\n $.extend(this, {\r\n \"init\": init,\r\n \"destroy\": destroy,\r\n\r\n \"onBeforeMenuShow\": new Slick.Event(),\r\n \"onCommand\": new Slick.Event()\r\n });\r\n }\r\n})(jQuery);\r\n","(function ($) {\r\n // register namespace\r\n $.extend(true, window, {\r\n \"Slick\": {\r\n \"Plugins\": {\r\n \"HeaderButtons\": HeaderButtons\r\n }\r\n }\r\n });\r\n\r\n\r\n /***\r\n * A plugin to add custom buttons to column headers.\r\n *\r\n * USAGE:\r\n *\r\n * Add the plugin .js & .css files and register it with the grid.\r\n *\r\n * To specify a custom button in a column header, extend the column definition like so:\r\n *\r\n * var columns = [\r\n * {\r\n * id: 'myColumn',\r\n * name: 'My column',\r\n *\r\n * // This is the relevant part\r\n * header: {\r\n * buttons: [\r\n * {\r\n * // button options\r\n * },\r\n * {\r\n * // button options\r\n * }\r\n * ]\r\n * }\r\n * }\r\n * ];\r\n *\r\n * Available button options:\r\n * cssClass: CSS class to add to the button.\r\n * image: Relative button image path.\r\n * tooltip: Button tooltip.\r\n * showOnHover: Only show the button on hover.\r\n * handler: Button click handler.\r\n * command: A command identifier to be passed to the onCommand event handlers.\r\n *\r\n * The plugin exposes the following events:\r\n * onCommand: Fired on button click for buttons with 'command' specified.\r\n * Event args:\r\n * grid: Reference to the grid.\r\n * column: Column definition.\r\n * command: Button command identified.\r\n * button: Button options. Note that you can change the button options in your\r\n * event handler, and the column header will be automatically updated to\r\n * reflect them. This is useful if you want to implement something like a\r\n * toggle button.\r\n *\r\n *\r\n * @param options {Object} Options:\r\n * buttonCssClass: a CSS class to use for buttons (default 'slick-header-button')\r\n * @class Slick.Plugins.HeaderButtons\r\n * @constructor\r\n */\r\n function HeaderButtons(options) {\r\n var _grid;\r\n var _self = this;\r\n var _handler = new Slick.EventHandler();\r\n var _defaults = {\r\n buttonCssClass: \"slick-header-button\"\r\n };\r\n\r\n\r\n function init(grid) {\r\n options = $.extend(true, {}, _defaults, options);\r\n _grid = grid;\r\n _handler\r\n .subscribe(_grid.onHeaderCellRendered, handleHeaderCellRendered)\r\n .subscribe(_grid.onBeforeHeaderCellDestroy, handleBeforeHeaderCellDestroy);\r\n\r\n // Force the grid to re-render the header now that the events are hooked up.\r\n _grid.setColumns(_grid.getColumns());\r\n }\r\n\r\n\r\n function destroy() {\r\n _handler.unsubscribeAll();\r\n }\r\n\r\n\r\n function handleHeaderCellRendered(e, args) {\r\n var column = args.column;\r\n\r\n if (column.header && column.header.buttons) {\r\n // Append buttons in reverse order since they are floated to the right.\r\n var i = column.header.buttons.length;\r\n while (i--) {\r\n var button = column.header.buttons[i];\r\n var btn = $(\"\")\r\n .addClass(options.buttonCssClass)\r\n .data(\"column\", column)\r\n .data(\"button\", button);\r\n\r\n if (button.showOnHover) {\r\n btn.addClass(\"slick-header-button-hidden\");\r\n }\r\n\r\n if (button.image) {\r\n btn.css(\"backgroundImage\", \"url(\" + button.image + \")\");\r\n }\r\n\r\n if (button.cssClass) {\r\n btn.addClass(button.cssClass);\r\n }\r\n\r\n if (button.tooltip) {\r\n btn.attr(\"title\", button.tooltip);\r\n }\r\n\r\n if (button.command) {\r\n btn.data(\"command\", button.command);\r\n }\r\n\r\n if (button.handler) {\r\n btn.on(\"click\", button.handler);\r\n }\r\n\r\n btn\r\n .on(\"click\", handleButtonClick)\r\n .appendTo(args.node);\r\n }\r\n }\r\n }\r\n\r\n\r\n function handleBeforeHeaderCellDestroy(e, args) {\r\n var column = args.column;\r\n\r\n if (column.header && column.header.buttons) {\r\n // Removing buttons via jQuery will also clean up any event handlers and data.\r\n // NOTE: If you attach event handlers directly or using a different framework,\r\n // you must also clean them up here to avoid memory leaks.\r\n $(args.node).find(\".\" + options.buttonCssClass).remove();\r\n }\r\n }\r\n\r\n\r\n function handleButtonClick(e) {\r\n var command = $(this).data(\"command\");\r\n var columnDef = $(this).data(\"column\");\r\n var button = $(this).data(\"button\");\r\n\r\n if (command != null) {\r\n _self.onCommand.notify({\r\n \"grid\": _grid,\r\n \"column\": columnDef,\r\n \"command\": command,\r\n \"button\": button\r\n }, e, _self);\r\n\r\n // Update the header in case the user updated the button definition in the handler.\r\n _grid.updateColumnHeader(columnDef.id);\r\n }\r\n\r\n // Stop propagation so that it doesn't register as a header click event.\r\n e.preventDefault();\r\n e.stopPropagation();\r\n }\r\n\r\n $.extend(this, {\r\n \"init\": init,\r\n \"destroy\": destroy,\r\n\r\n \"onCommand\": new Slick.Event()\r\n });\r\n }\r\n})(jQuery);\r\n","(function ($) {\r\n // register namespace\r\n $.extend(true, window, {\r\n \"Slick\": {\r\n \"CheckboxSelectColumn\": CheckboxSelectColumn\r\n }\r\n });\r\n\r\n\r\n function CheckboxSelectColumn(options) {\r\n var _grid;\r\n var _self = this;\r\n var _handler = new Slick.EventHandler();\r\n var _selectedRowsLookup = {};\r\n var _defaults = {\r\n columnId: \"_checkbox_selector\",\r\n cssClass: null,\r\n toolTip: \"Select/Deselect All\",\r\n width: 30\r\n };\r\n\r\n var _options = $.extend(true, {}, _defaults, options);\r\n\r\n function init(grid) {\r\n _grid = grid;\r\n _handler\r\n .subscribe(_grid.onSelectedRowsChanged, handleSelectedRowsChanged)\r\n .subscribe(_grid.onClick, handleClick)\r\n .subscribe(_grid.onHeaderClick, handleHeaderClick)\r\n .subscribe(_grid.onKeyDown, handleKeyDown);\r\n }\r\n\r\n function destroy() {\r\n _handler.unsubscribeAll();\r\n }\r\n\r\n function handleSelectedRowsChanged(e, args) {\r\n var selectedRows = _grid.getSelectedRows();\r\n var lookup = {}, row, i;\r\n for (i = 0; i < selectedRows.length; i++) {\r\n row = selectedRows[i];\r\n lookup[row] = true;\r\n if (lookup[row] !== _selectedRowsLookup[row]) {\r\n _grid.invalidateRow(row);\r\n delete _selectedRowsLookup[row];\r\n }\r\n }\r\n for (i in _selectedRowsLookup) {\r\n _grid.invalidateRow(i);\r\n }\r\n _selectedRowsLookup = lookup;\r\n _grid.render();\r\n\r\n if (selectedRows.length && selectedRows.length == _grid.getDataLength()) {\r\n _grid.updateColumnHeader(_options.columnId, \"\", _options.toolTip);\r\n } else {\r\n _grid.updateColumnHeader(_options.columnId, \"\", _options.toolTip);\r\n }\r\n }\r\n\r\n function handleKeyDown(e, args) {\r\n if (e.which == 32) {\r\n if (_grid.getColumns()[args.cell].id === _options.columnId) {\r\n // if editing, try to commit\r\n if (!_grid.getEditorLock().isActive() || _grid.getEditorLock().commitCurrentEdit()) {\r\n toggleRowSelection(args.row);\r\n }\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n }\r\n }\r\n }\r\n\r\n function handleClick(e, args) {\r\n // clicking on a row select checkbox\r\n if (_grid.getColumns()[args.cell].id === _options.columnId && $(e.target).is(\":checkbox\")) {\r\n // if editing, try to commit\r\n if (_grid.getEditorLock().isActive() && !_grid.getEditorLock().commitCurrentEdit()) {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n return;\r\n }\r\n\r\n toggleRowSelection(args.row);\r\n e.stopPropagation();\r\n e.stopImmediatePropagation();\r\n }\r\n }\r\n\r\n function toggleRowSelection(row) {\r\n if (_selectedRowsLookup[row]) {\r\n _grid.setSelectedRows($.grep(_grid.getSelectedRows(), function (n) {\r\n return n != row\r\n }));\r\n } else {\r\n _grid.setSelectedRows(_grid.getSelectedRows().concat(row));\r\n }\r\n _grid.setActiveCell(row, getCheckboxColumnCellIndex());\r\n _grid.focus();\r\n }\r\n\r\n function selectRows(rowArray) {\r\n var i, l=rowArray.length, addRows = [];\r\n for(i=0; i\",\r\n toolTip: _options.toolTip,\r\n field: \"sel\",\r\n width: _options.width,\r\n resizable: false,\r\n sortable: false,\r\n cssClass: _options.cssClass,\r\n formatter: checkboxSelectionFormatter\r\n };\r\n }\r\n\r\n function checkboxSelectionFormatter(row, cell, value, columnDef, dataContext) {\r\n if (dataContext) {\r\n return _selectedRowsLookup[row]\r\n ? \"\"\r\n : \"\";\r\n }\r\n return null;\r\n }\r\n\r\n $.extend(this, {\r\n \"init\": init,\r\n \"destroy\": destroy,\r\n \"deSelectRows\": deSelectRows,\r\n \"selectRows\": selectRows,\r\n \"getColumnDefinition\": getColumnDefinition\r\n });\r\n }\r\n})(jQuery);","(function ($) {\r\n // register namespace\r\n $.extend(true, window, {\r\n \"Slick\": {\r\n \"CellSelectionModel\": CellSelectionModel\r\n }\r\n });\r\n\r\n function CellSelectionModel(options) {\r\n var _grid;\r\n var _canvas;\r\n var _ranges = [];\r\n var _self = this;\r\n var _selector;\r\n\r\n if (typeof options === \"undefined\" || typeof options.cellRangeSelector === \"undefined\") { \r\n _selector = new Slick.CellRangeSelector({\r\n \"selectionCss\": {\r\n \"border\": \"2px solid black\"\r\n }\r\n });\r\n } else {\r\n _selector = options.cellRangeSelector;\r\n }\r\n\r\n var _options;\r\n var _defaults = {\r\n selectActiveCell: true\r\n };\r\n\r\n function init(grid) {\r\n _options = $.extend(true, {}, _defaults, options);\r\n _grid = grid;\r\n _canvas = _grid.getCanvasNode();\r\n _grid.onActiveCellChanged.subscribe(handleActiveCellChange);\r\n _grid.onKeyDown.subscribe(handleKeyDown);\r\n grid.registerPlugin(_selector);\r\n _selector.onCellRangeSelected.subscribe(handleCellRangeSelected);\r\n _selector.onBeforeCellRangeSelected.subscribe(handleBeforeCellRangeSelected);\r\n }\r\n\r\n function destroy() {\r\n _grid.onActiveCellChanged.unsubscribe(handleActiveCellChange);\r\n _grid.onKeyDown.unsubscribe(handleKeyDown);\r\n _selector.onCellRangeSelected.unsubscribe(handleCellRangeSelected);\r\n _selector.onBeforeCellRangeSelected.unsubscribe(handleBeforeCellRangeSelected);\r\n _grid.unregisterPlugin(_selector);\r\n }\r\n\r\n function removeInvalidRanges(ranges) {\r\n var result = [];\r\n\r\n for (var i = 0; i < ranges.length; i++) {\r\n var r = ranges[i];\r\n if (_grid.canCellBeSelected(r.fromRow, r.fromCell) && _grid.canCellBeSelected(r.toRow, r.toCell)) {\r\n result.push(r);\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n function setSelectedRanges(ranges) {\r\n // simple check for: empty selection didn't change, prevent firing onSelectedRangesChanged\r\n if ((!_ranges || _ranges.length === 0) && (!ranges || ranges.length === 0)) { return; }\r\n\r\n _ranges = removeInvalidRanges(ranges);\r\n _self.onSelectedRangesChanged.notify(_ranges);\r\n }\r\n\r\n function getSelectedRanges() {\r\n return _ranges;\r\n }\r\n\r\n function handleBeforeCellRangeSelected(e, args) {\r\n if (_grid.getEditorLock().isActive()) {\r\n e.stopPropagation();\r\n return false;\r\n }\r\n }\r\n\r\n function handleCellRangeSelected(e, args) {\r\n _grid.setActiveCell(args.range.fromRow, args.range.fromCell, false, false, true);\r\n setSelectedRanges([args.range]);\r\n }\r\n\r\n function handleActiveCellChange(e, args) {\r\n if (_options.selectActiveCell && args.row != null && args.cell != null) {\r\n setSelectedRanges([new Slick.Range(args.row, args.cell)]);\r\n }\r\n }\r\n\r\n function handleKeyDown(e) {\r\n /***\r\n * Кey codes\r\n * 37 left\r\n * 38 up\r\n * 39 right\r\n * 40 down\r\n */\r\n var ranges, last;\r\n var active = _grid.getActiveCell();\r\n var metaKey = e.ctrlKey || e.metaKey;\r\n\r\n if (active && e.shiftKey && !metaKey && !e.altKey &&\r\n (e.which == 37 || e.which == 39 || e.which == 38 || e.which == 40)) {\r\n\r\n ranges = getSelectedRanges();\r\n if (!ranges.length)\r\n ranges.push(new Slick.Range(active.row, active.cell));\r\n\r\n // keyboard can work with last range only \r\n last = ranges.pop();\r\n\r\n // can't handle selection out of active cell\r\n if (!last.contains(active.row, active.cell))\r\n last = new Slick.Range(active.row, active.cell);\r\n\r\n var dRow = last.toRow - last.fromRow,\r\n dCell = last.toCell - last.fromCell,\r\n // walking direction\r\n dirRow = active.row == last.fromRow ? 1 : -1,\r\n dirCell = active.cell == last.fromCell ? 1 : -1;\r\n\r\n if (e.which == 37) {\r\n dCell -= dirCell;\r\n } else if (e.which == 39) {\r\n dCell += dirCell;\r\n } else if (e.which == 38) {\r\n dRow -= dirRow;\r\n } else if (e.which == 40) {\r\n dRow += dirRow;\r\n }\r\n\r\n // define new selection range \r\n var new_last = new Slick.Range(active.row, active.cell, active.row + dirRow * dRow, active.cell + dirCell * dCell);\r\n if (removeInvalidRanges([new_last]).length) {\r\n ranges.push(new_last);\r\n var viewRow = dirRow > 0 ? new_last.toRow : new_last.fromRow;\r\n var viewCell = dirCell > 0 ? new_last.toCell : new_last.fromCell;\r\n _grid.scrollRowIntoView(viewRow);\r\n _grid.scrollCellIntoView(viewRow, viewCell);\r\n }\r\n else\r\n ranges.push(last);\r\n\r\n setSelectedRanges(ranges);\r\n\r\n e.preventDefault();\r\n e.stopPropagation();\r\n }\r\n }\r\n\r\n $.extend(this, {\r\n \"getSelectedRanges\": getSelectedRanges,\r\n \"setSelectedRanges\": setSelectedRanges,\r\n\r\n \"init\": init,\r\n \"destroy\": destroy,\r\n\r\n \"onSelectedRangesChanged\": new Slick.Event()\r\n });\r\n }\r\n})(jQuery);\r\n","(function ($) {\r\n // register namespace\r\n $.extend(true, window, {\r\n \"Slick\": {\r\n \"CellRangeSelector\": CellRangeSelector\r\n }\r\n });\r\n\r\n function CellRangeSelector(options) {\r\n var _grid;\r\n var _currentlySelectedRange;\r\n var _canvas;\r\n var _dragging;\r\n var _decorator;\r\n var _self = this;\r\n var _handler = new Slick.EventHandler();\r\n var _defaults = {\r\n selectionCss: {\r\n \"border\": \"2px dashed blue\"\r\n }\r\n };\r\n\r\n function init(grid) {\r\n options = $.extend(true, {}, _defaults, options);\r\n _decorator = options.cellDecorator || new Slick.CellRangeDecorator(grid, options);\r\n _grid = grid;\r\n _canvas = _grid.getCanvasNode();\r\n _handler\r\n .subscribe(_grid.onDragInit, handleDragInit)\r\n .subscribe(_grid.onDragStart, handleDragStart)\r\n .subscribe(_grid.onDrag, handleDrag)\r\n .subscribe(_grid.onDragEnd, handleDragEnd);\r\n }\r\n\r\n function destroy() {\r\n _handler.unsubscribeAll();\r\n }\r\n\r\n function getCellDecorator() {\r\n return _decorator;\r\n }\r\n\r\n function handleDragInit(e, dd) {\r\n // prevent the grid from cancelling drag'n'drop by default\r\n e.stopImmediatePropagation();\r\n }\r\n\r\n function handleDragStart(e, dd) {\r\n var cell = _grid.getCellFromEvent(e);\r\n if (_self.onBeforeCellRangeSelected.notify(cell) !== false) {\r\n if (_grid.canCellBeSelected(cell.row, cell.cell)) {\r\n _dragging = true;\r\n e.stopImmediatePropagation();\r\n }\r\n }\r\n if (!_dragging) {\r\n return;\r\n }\r\n\r\n _grid.focus();\r\n\r\n var start = _grid.getCellFromPoint(\r\n dd.startX - $(_canvas).offset().left,\r\n dd.startY - $(_canvas).offset().top);\r\n\r\n dd.range = {start: start, end: {}};\r\n _currentlySelectedRange = dd.range;\r\n return _decorator.show(new Slick.Range(start.row, start.cell));\r\n }\r\n\r\n function handleDrag(e, dd) {\r\n if (!_dragging) {\r\n return;\r\n }\r\n e.stopImmediatePropagation();\r\n\r\n var end = _grid.getCellFromPoint(\r\n e.pageX - $(_canvas).offset().left,\r\n e.pageY - $(_canvas).offset().top);\r\n\r\n if (!_grid.canCellBeSelected(end.row, end.cell)) {\r\n return;\r\n }\r\n\r\n dd.range.end = end;\r\n _currentlySelectedRange = dd.range;\r\n _decorator.show(new Slick.Range(dd.range.start.row, dd.range.start.cell, end.row, end.cell));\r\n }\r\n\r\n function handleDragEnd(e, dd) {\r\n if (!_dragging) {\r\n return;\r\n }\r\n\r\n _dragging = false;\r\n e.stopImmediatePropagation();\r\n\r\n _decorator.hide();\r\n _self.onCellRangeSelected.notify({\r\n range: new Slick.Range(\r\n dd.range.start.row,\r\n dd.range.start.cell,\r\n dd.range.end.row,\r\n dd.range.end.cell\r\n )\r\n });\r\n }\r\n\r\n function getCurrentRange() {\r\n return _currentlySelectedRange;\r\n }\r\n\r\n $.extend(this, {\r\n \"init\": init,\r\n \"destroy\": destroy,\r\n \"getCellDecorator\": getCellDecorator,\r\n \"getCurrentRange\": getCurrentRange,\r\n\r\n \"onBeforeCellRangeSelected\": new Slick.Event(),\r\n \"onCellRangeSelected\": new Slick.Event()\r\n });\r\n }\r\n})(jQuery);\r\n","(function ($) {\r\n // register namespace\r\n $.extend(true, window, {\r\n \"Slick\": {\r\n \"CellRangeDecorator\": CellRangeDecorator\r\n }\r\n });\r\n\r\n /***\r\n * Displays an overlay on top of a given cell range.\r\n *\r\n * TODO:\r\n * Currently, it blocks mouse events to DOM nodes behind it.\r\n * Use FF and WebKit-specific \"pointer-events\" CSS style, or some kind of event forwarding.\r\n * Could also construct the borders separately using 4 individual DIVs.\r\n *\r\n * @param {Grid} grid\r\n * @param {Object} options\r\n */\r\n function CellRangeDecorator(grid, options) {\r\n var _elem;\r\n var _defaults = {\r\n selectionCssClass: 'slick-range-decorator',\r\n selectionCss: {\r\n \"zIndex\": \"9999\",\r\n \"border\": \"2px dashed red\"\r\n },\r\n offset: {\r\n top: -1,\r\n left: -1,\r\n height: -2,\r\n width: -2\r\n }\r\n };\r\n\r\n options = $.extend(true, {}, _defaults, options);\r\n\r\n\r\n function show(range) {\r\n if (!_elem) {\r\n _elem = $(\"\", {css: options.selectionCss})\r\n .addClass(options.selectionCssClass)\r\n .css(\"position\", \"absolute\")\r\n .appendTo(grid.getCanvasNode());\r\n }\r\n\r\n var from = grid.getCellNodeBox(range.fromRow, range.fromCell);\r\n var to = grid.getCellNodeBox(range.toRow, range.toCell);\r\n\r\n _elem.css({\r\n top: from.top + options.offset.top,\r\n left: from.left + options.offset.left,\r\n height: to.bottom - from.top + options.offset.height,\r\n width: to.right - from.left + options.offset.width\r\n });\r\n\r\n return _elem;\r\n }\r\n\r\n function hide() {\r\n if (_elem) {\r\n _elem.remove();\r\n _elem = null;\r\n }\r\n }\r\n\r\n $.extend(this, {\r\n \"show\": show,\r\n \"hide\": hide\r\n });\r\n }\r\n})(jQuery);\r\n","(function ($) {\r\n // register namespace\r\n $.extend(true, window, {\r\n \"Slick\": {\r\n \"CellExternalCopyManager\": CellExternalCopyManager\r\n }\r\n });\r\n\r\n\r\n function CellExternalCopyManager(options) {\r\n /*\r\n This manager enables users to copy/paste data from/to an external Spreadsheet application\r\n such as MS-Excel® or OpenOffice-Spreadsheet.\r\n \r\n Since it is not possible to access directly the clipboard in javascript, the plugin uses\r\n a trick to do it's job. After detecting the keystroke, we dynamically create a textarea\r\n where the browser copies/pastes the serialized data. \r\n \r\n options:\r\n copiedCellStyle : sets the css className used for copied cells. default : \"copied\"\r\n copiedCellStyleLayerKey : sets the layer key for setting css values of copied cells. default : \"copy-manager\"\r\n dataItemColumnValueExtractor : option to specify a custom column value extractor function\r\n dataItemColumnValueSetter : option to specify a custom column value setter function\r\n clipboardCommandHandler : option to specify a custom handler for paste actions\r\n includeHeaderWhenCopying : set to true and the plugin will take the name property from each column (which is usually what appears in your header) and put that as the first row of the text that's copied to the clipboard\r\n bodyElement: option to specify a custom DOM element which to will be added the hidden textbox. It's useful if the grid is inside a modal dialog.\r\n onCopyInit: optional handler to run when copy action initializes\r\n onCopySuccess: optional handler to run when copy action is complete\r\n newRowCreator: function to add rows to table if paste overflows bottom of table\r\n readOnlyMode: suppresses paste\r\n */\r\n var _grid;\r\n var _self = this;\r\n var _copiedRanges;\r\n var _options = options || {};\r\n var _copiedCellStyleLayerKey = _options.copiedCellStyleLayerKey || \"copy-manager\";\r\n var _copiedCellStyle = _options.copiedCellStyle || \"copied\";\r\n var _clearCopyTI = 0;\r\n var _bodyElement = _options.bodyElement || document.body;\r\n var _onCopyInit = _options.onCopyInit || null;\r\n var _onCopySuccess = _options.onCopySuccess || null;\r\n \r\n var keyCodes = {\r\n 'C': 67,\r\n 'V': 86,\r\n 'ESC': 27,\r\n 'INSERT': 45\r\n };\r\n\r\n function init(grid) {\r\n _grid = grid;\r\n _grid.onKeyDown.subscribe(handleKeyDown);\r\n \r\n // we need a cell selection model\r\n var cellSelectionModel = grid.getSelectionModel();\r\n if (!cellSelectionModel){\r\n throw new Error(\"Selection model is mandatory for this plugin. Please set a selection model on the grid before adding this plugin: grid.setSelectionModel(new Slick.CellSelectionModel())\");\r\n }\r\n // we give focus on the grid when a selection is done on it.\r\n // without this, if the user selects a range of cell without giving focus on a particular cell, the grid doesn't get the focus and key stroke handles (ctrl+c) don't work\r\n cellSelectionModel.onSelectedRangesChanged.subscribe(function(e, args){\r\n _grid.focus();\r\n });\r\n }\r\n\r\n function destroy() {\r\n _grid.onKeyDown.unsubscribe(handleKeyDown);\r\n }\r\n \r\n function getDataItemValueForColumn(item, columnDef) {\r\n if (_options.dataItemColumnValueExtractor) {\r\n var dataItemColumnValueExtractorValue = _options.dataItemColumnValueExtractor(item, columnDef);\r\n\r\n if (dataItemColumnValueExtractorValue)\r\n return dataItemColumnValueExtractorValue;\r\n }\r\n\r\n var retVal = '';\r\n\r\n // if a custom getter is not defined, we call serializeValue of the editor to serialize\r\n if (columnDef.editor){\r\n var editorArgs = {\r\n 'container':$(\"
\"), // a dummy container\r\n 'column':columnDef,\r\n 'position':{'top':0, 'left':0}, // a dummy position required by some editors\r\n 'grid':_grid\r\n };\r\n var editor = new columnDef.editor(editorArgs);\r\n editor.loadValue(item);\r\n retVal = editor.serializeValue();\r\n editor.destroy();\r\n } else {\r\n retVal = item[columnDef.field];\r\n }\r\n\r\n return retVal;\r\n }\r\n \r\n function setDataItemValueForColumn(item, columnDef, value) {\r\n if (_options.dataItemColumnValueSetter) {\r\n return _options.dataItemColumnValueSetter(item, columnDef, value);\r\n }\r\n\r\n // if a custom setter is not defined, we call applyValue of the editor to unserialize\r\n if (columnDef.editor){\r\n var editorArgs = {\r\n 'container':$(\"body\"), // a dummy container\r\n 'column':columnDef,\r\n 'position':{'top':0, 'left':0}, // a dummy position required by some editors\r\n 'grid':_grid\r\n };\r\n var editor = new columnDef.editor(editorArgs);\r\n editor.loadValue(item);\r\n editor.applyValue(item, value);\r\n editor.destroy();\r\n } else {\r\n item[columnDef.field] = value;\r\n }\r\n }\r\n \r\n \r\n function _createTextBox(innerText){\r\n var ta = document.createElement('textarea');\r\n ta.style.position = 'absolute';\r\n ta.style.left = '-1000px';\r\n ta.style.top = document.body.scrollTop + 'px';\r\n ta.value = innerText;\r\n _bodyElement.appendChild(ta);\r\n ta.select();\r\n \r\n return ta;\r\n }\r\n \r\n function _decodeTabularData(_grid, ta){\r\n var columns = _grid.getColumns();\r\n var clipText = ta.value;\r\n var clipRows = clipText.split(/[\\n\\f\\r]/);\r\n // trim trailing CR if present\r\n if (clipRows[clipRows.length - 1]==\"\") { clipRows.pop(); }\r\n \r\n var clippedRange = [];\r\n var j = 0;\r\n \r\n _bodyElement.removeChild(ta);\r\n for (var i=0; i _grid.getDataLength();\r\n\r\n if (_options.newRowCreator && overflowsBottomOfGrid) {\r\n\r\n var newRowsNeeded = activeRow + destH - _grid.getDataLength();\r\n\r\n _options.newRowCreator(newRowsNeeded);\r\n\r\n }\r\n\r\n var clipCommand = {\r\n\r\n isClipboardCommand: true,\r\n clippedRange: clippedRange,\r\n oldValues: [],\r\n cellExternalCopyManager: _self,\r\n _options: _options,\r\n setDataItemValueForColumn: setDataItemValueForColumn,\r\n markCopySelection: markCopySelection,\r\n oneCellToMultiple: oneCellToMultiple,\r\n activeRow: activeRow,\r\n activeCell: activeCell,\r\n destH: destH,\r\n destW: destW,\r\n maxDestY: _grid.getDataLength(),\r\n maxDestX: _grid.getColumns().length,\r\n h: 0,\r\n w: 0,\r\n \r\n execute: function() {\r\n this.h=0;\r\n for (var y = 0; y < this.destH; y++){\r\n this.oldValues[y] = [];\r\n this.w=0;\r\n this.h++;\r\n for (var x = 0; x < this.destW; x++){\r\n this.w++;\r\n var desty = activeRow + y;\r\n var destx = activeCell + x;\r\n \r\n if (desty < this.maxDestY && destx < this.maxDestX ) {\r\n var nd = _grid.getCellNode(desty, destx);\r\n var dt = _grid.getDataItem(desty);\r\n this.oldValues[y][x] = dt[columns[destx]['field']];\r\n if (oneCellToMultiple)\r\n this.setDataItemValueForColumn(dt, columns[destx], clippedRange[0][0]);\r\n else\r\n this.setDataItemValueForColumn(dt, columns[destx], clippedRange[y] ? clippedRange[y][x] : '');\r\n _grid.updateCell(desty, destx);\r\n _grid.onCellChange.notify({\r\n row: desty,\r\n cell: destx,\r\n item: dt,\r\n grid: _grid\r\n });\r\n\r\n }\r\n }\r\n }\r\n \r\n var bRange = {\r\n 'fromCell': activeCell,\r\n 'fromRow': activeRow,\r\n 'toCell': activeCell+this.w-1,\r\n 'toRow': activeRow+this.h-1\r\n }\r\n\r\n this.markCopySelection([bRange]);\r\n _grid.getSelectionModel().setSelectedRanges([bRange]);\r\n this.cellExternalCopyManager.onPasteCells.notify({ranges: [bRange]});\r\n },\r\n\r\n undo: function() {\r\n for (var y = 0; y < this.destH; y++){\r\n for (var x = 0; x < this.destW; x++){\r\n var desty = activeRow + y;\r\n var destx = activeCell + x;\r\n \r\n if (desty < this.maxDestY && destx < this.maxDestX ) {\r\n var nd = _grid.getCellNode(desty, destx);\r\n var dt = _grid.getDataItem(desty);\r\n if (oneCellToMultiple)\r\n this.setDataItemValueForColumn(dt, columns[destx], this.oldValues[0][0]);\r\n else\r\n this.setDataItemValueForColumn(dt, columns[destx], this.oldValues[y][x]);\r\n _grid.updateCell(desty, destx);\r\n _grid.onCellChange.notify({\r\n row: desty,\r\n cell: destx,\r\n item: dt,\r\n grid: _grid\r\n });\r\n }\r\n }\r\n }\r\n \r\n var bRange = {\r\n 'fromCell': activeCell,\r\n 'fromRow': activeRow,\r\n 'toCell': activeCell+this.w-1,\r\n 'toRow': activeRow+this.h-1\r\n }\r\n\r\n this.markCopySelection([bRange]);\r\n _grid.getSelectionModel().setSelectedRanges([bRange]);\r\n this.cellExternalCopyManager.onPasteCells.notify({ranges: [bRange]});\r\n \r\n if(addRows > 1){ \r\n var d = _grid.getData();\r\n for(; addRows > 1; addRows--)\r\n d.splice(d.length - 1, 1);\r\n _grid.setData(d);\r\n _grid.render();\r\n }\r\n }\r\n };\r\n\r\n if(_options.clipboardCommandHandler) {\r\n _options.clipboardCommandHandler(clipCommand);\r\n }\r\n else {\r\n clipCommand.execute();\r\n }\r\n }\r\n \r\n \r\n function handleKeyDown(e, args) {\r\n var ranges;\r\n if (!_grid.getEditorLock().isActive() || _grid.getOptions().autoEdit) {\r\n if (e.which == keyCodes.ESC) {\r\n if (_copiedRanges) {\r\n e.preventDefault();\r\n clearCopySelection();\r\n _self.onCopyCancelled.notify({ranges: _copiedRanges});\r\n _copiedRanges = null;\r\n }\r\n }\r\n\r\n if ((e.which === keyCodes.C || e.which === keyCodes.INSERT) && (e.ctrlKey || e.metaKey) && !e.shiftKey) { // CTRL+C or CTRL+INS\r\n if (_onCopyInit) {\r\n _onCopyInit.call();\r\n }\r\n ranges = _grid.getSelectionModel().getSelectedRanges();\r\n if (ranges.length != 0) {\r\n _copiedRanges = ranges;\r\n markCopySelection(ranges);\r\n _self.onCopyCells.notify({ranges: ranges});\r\n \r\n var columns = _grid.getColumns();\r\n var clipText = \"\";\r\n\r\n for (var rg = 0; rg < ranges.length; rg++){\r\n var range = ranges[rg];\r\n var clipTextRows = [];\r\n for (var i=range.fromRow; i< range.toRow+1 ; i++){\r\n var clipTextCells = [];\r\n var dt = _grid.getDataItem(i);\r\n \r\n if (clipTextRows == \"\" && _options.includeHeaderWhenCopying) {\r\n var clipTextHeaders = [];\r\n for (var j = range.fromCell; j < range.toCell + 1 ; j++) {\r\n if (columns[j].name.length > 0)\r\n clipTextHeaders.push(columns[j].name);\r\n }\r\n clipTextRows.push(clipTextHeaders.join(\"\\t\"));\r\n }\r\n\r\n for (var j=range.fromCell; j< range.toCell+1 ; j++){\r\n clipTextCells.push(getDataItemValueForColumn(dt, columns[j]));\r\n }\r\n clipTextRows.push(clipTextCells.join(\"\\t\"));\r\n }\r\n clipText += clipTextRows.join(\"\\r\\n\") + \"\\r\\n\";\r\n }\r\n \r\n if(window.clipboardData) {\r\n window.clipboardData.setData(\"Text\", clipText);\r\n return true;\r\n }\r\n else {\r\n var focusEl = document.activeElement;\r\n\r\n var ta = _createTextBox(clipText);\r\n\r\n ta.focus();\r\n \r\n setTimeout(function(){\r\n _bodyElement.removeChild(ta);\r\n // restore focus\r\n if (focusEl)\r\n focusEl.focus();\r\n else\r\n console.log(\"Not element to restore focus to after copy?\");\r\n\r\n }, 100);\r\n\r\n if (_onCopySuccess) {\r\n var rowCount = 0;\r\n // If it's cell selection, use the toRow/fromRow fields\r\n if (ranges.length === 1) {\r\n rowCount = (ranges[0].toRow + 1) - ranges[0].fromRow;\r\n }\r\n else {\r\n rowCount = ranges.length;\r\n }\r\n _onCopySuccess.call(this, rowCount);\r\n }\r\n\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n if (!_options.readOnlyMode && (\r\n (e.which === keyCodes.V && (e.ctrlKey || e.metaKey) && !e.shiftKey)\r\n || (e.which === keyCodes.INSERT && e.shiftKey && !e.ctrlKey)\r\n )) { // CTRL+V or Shift+INS\r\n var ta = _createTextBox('');\r\n \r\n setTimeout(function(){\r\n _decodeTabularData(_grid, ta);\r\n }, 100);\r\n \r\n return false;\r\n }\r\n }\r\n }\r\n\r\n function markCopySelection(ranges) {\r\n clearCopySelection();\r\n \r\n var columns = _grid.getColumns();\r\n var hash = {};\r\n for (var i = 0; i < ranges.length; i++) {\r\n for (var j = ranges[i].fromRow; j <= ranges[i].toRow; j++) {\r\n hash[j] = {};\r\n for (var k = ranges[i].fromCell; k <= ranges[i].toCell && k options.maxToolTipLength) {\r\n text = text.substr(0, options.maxToolTipLength - 3) + \"...\";\r\n }\r\n } else {\r\n text = \"\";\r\n }\r\n $node.attr(\"title\", text);\r\n }\r\n }\r\n \r\n /**\r\n * Handle mouse entering header cell to add/remove tooltip.\r\n * @param {jQuery.Event} e - The event\r\n * @param {object} args.column - The column definition\r\n */\r\n function handleHeaderMouseEnter(e, args) {\r\n var column = args.column,\r\n $node = $(e.target).closest(\".slick-header-column\");\r\n if (column && !column.toolTip) {\r\n $node.attr(\"title\", ($node.innerWidth() < $node[0].scrollWidth) ? column.name : \"\");\r\n }\r\n }\r\n \r\n // Public API\r\n $.extend(this, {\r\n \"init\": init,\r\n \"destroy\": destroy\r\n });\r\n }\r\n})(jQuery);","(function ($) {\r\n function SlickGridPager(dataView, grid, $container) {\r\n var $status;\r\n\r\n function init() {\r\n dataView.onPagingInfoChanged.subscribe(function (e, pagingInfo) {\r\n updatePager(pagingInfo);\r\n });\r\n\r\n constructPagerUI();\r\n updatePager(dataView.getPagingInfo());\r\n }\r\n\r\n function getNavState() {\r\n var cannotLeaveEditMode = !Slick.GlobalEditorLock.commitCurrentEdit();\r\n var pagingInfo = dataView.getPagingInfo();\r\n var lastPage = pagingInfo.totalPages - 1;\r\n\r\n return {\r\n canGotoFirst: !cannotLeaveEditMode && pagingInfo.pageSize != 0 && pagingInfo.pageNum > 0,\r\n canGotoLast: !cannotLeaveEditMode && pagingInfo.pageSize != 0 && pagingInfo.pageNum != lastPage,\r\n canGotoPrev: !cannotLeaveEditMode && pagingInfo.pageSize != 0 && pagingInfo.pageNum > 0,\r\n canGotoNext: !cannotLeaveEditMode && pagingInfo.pageSize != 0 && pagingInfo.pageNum < lastPage,\r\n pagingInfo: pagingInfo\r\n }\r\n }\r\n\r\n function setPageSize(n) {\r\n dataView.setRefreshHints({\r\n isFilterUnchanged: true\r\n });\r\n dataView.setPagingOptions({pageSize: n});\r\n }\r\n\r\n function gotoFirst() {\r\n if (getNavState().canGotoFirst) {\r\n dataView.setPagingOptions({pageNum: 0});\r\n }\r\n }\r\n\r\n function gotoLast() {\r\n var state = getNavState();\r\n if (state.canGotoLast) {\r\n dataView.setPagingOptions({pageNum: state.pagingInfo.totalPages - 1});\r\n }\r\n }\r\n\r\n function gotoPrev() {\r\n var state = getNavState();\r\n if (state.canGotoPrev) {\r\n dataView.setPagingOptions({pageNum: state.pagingInfo.pageNum - 1});\r\n }\r\n }\r\n\r\n function gotoNext() {\r\n var state = getNavState();\r\n if (state.canGotoNext) {\r\n dataView.setPagingOptions({pageNum: state.pagingInfo.pageNum + 1});\r\n }\r\n }\r\n\r\n function constructPagerUI() {\r\n $container.empty();\r\n\r\n var $nav = $(\"\").appendTo($container);\r\n var $settings = $(\"\").appendTo($container);\r\n $status = $(\"\").appendTo($container);\r\n\r\n $settings\r\n .append(\"Show: AllAuto2550100\");\r\n\r\n $settings.find(\"a[data]\").click(function (e) {\r\n var pagesize = $(e.target).attr(\"data\");\r\n if (pagesize != undefined) {\r\n if (pagesize == -1) {\r\n var vp = grid.getViewport();\r\n setPageSize(vp.bottom - vp.top);\r\n } else {\r\n setPageSize(parseInt(pagesize));\r\n }\r\n }\r\n });\r\n\r\n var icon_prefix = \"\";\r\n\r\n $(icon_prefix + \"ui-icon-lightbulb\" + icon_suffix)\r\n .click(function () {\r\n $(\".slick-pager-settings-expanded\").toggle()\r\n })\r\n .appendTo($settings);\r\n\r\n $(icon_prefix + \"ui-icon-seek-first\" + icon_suffix)\r\n .click(gotoFirst)\r\n .appendTo($nav);\r\n\r\n $(icon_prefix + \"ui-icon-seek-prev\" + icon_suffix)\r\n .click(gotoPrev)\r\n .appendTo($nav);\r\n\r\n $(icon_prefix + \"ui-icon-seek-next\" + icon_suffix)\r\n .click(gotoNext)\r\n .appendTo($nav);\r\n\r\n $(icon_prefix + \"ui-icon-seek-end\" + icon_suffix)\r\n .click(gotoLast)\r\n .appendTo($nav);\r\n\r\n $container.find(\".ui-icon-container\")\r\n .hover(function () {\r\n $(this).toggleClass(\"ui-state-hover\");\r\n });\r\n\r\n $container.children().wrapAll(\"\");\r\n }\r\n\r\n\r\n function updatePager(pagingInfo) {\r\n var state = getNavState();\r\n\r\n $container.find(\".slick-pager-nav span\").removeClass(\"ui-state-disabled\");\r\n if (!state.canGotoFirst) {\r\n $container.find(\".ui-icon-seek-first\").addClass(\"ui-state-disabled\");\r\n }\r\n if (!state.canGotoLast) {\r\n $container.find(\".ui-icon-seek-end\").addClass(\"ui-state-disabled\");\r\n }\r\n if (!state.canGotoNext) {\r\n $container.find(\".ui-icon-seek-next\").addClass(\"ui-state-disabled\");\r\n }\r\n if (!state.canGotoPrev) {\r\n $container.find(\".ui-icon-seek-prev\").addClass(\"ui-state-disabled\");\r\n }\r\n\r\n if (pagingInfo.pageSize == 0) {\r\n $status.text(\"Showing all \" + pagingInfo.totalRows + \" rows\");\r\n } else {\r\n $status.text(\"Showing page \" + (pagingInfo.pageNum + 1) + \" of \" + pagingInfo.totalPages);\r\n }\r\n }\r\n\r\n init();\r\n }\r\n\r\n // Slick.Controls.Pager\r\n $.extend(true, window, { Slick:{ Controls:{ Pager:SlickGridPager }}});\r\n})(jQuery);\r\n"," /***\r\n * A control to add a Grid Menu (hambuger menu on top-right of the grid)\r\n *\r\n * USAGE:\r\n *\r\n * Add the slick.gridmenu.(js|css) files and register it with the grid.\r\n *\r\n * To specify a menu in a column header, extend the column definition like so:\r\n * var gridMenuControl = new Slick.Controls.GridMenu(columns, grid, options);\r\n *\r\n * Available grid options, by defining a gridMenu object:\r\n *\r\n * var options = {\r\n * enableCellNavigation: true,\r\n * gridMenu: {\r\n * customTitle: \"Custom Menus\",\r\n * columnTitle: \"Columns\",\r\n * iconImage: \"../images/drag-handle.png\", // this is the Grid Menu icon (hamburger icon)\r\n * iconCssClass: \"fa fa-bars\", // you can provide iconImage OR iconCssClass\r\n * leaveOpen: false, // do we want to leave the Grid Menu open after a command execution? (false by default)\r\n * menuWidth: 18, // width that will be use to resize the column header container (18 by default)\r\n * resizeOnShowHeaderRow: true, // true by default\r\n * customItems: [\r\n * {\r\n * // custom menu item options\r\n * },\r\n * {\r\n * // custom menu item options\r\n * }\r\n * ]\r\n * }\r\n * };\r\n *\r\n *\r\n * Available custom menu item options:\r\n * title: Menu item text.\r\n * disabled: Whether the item is disabled.\r\n * tooltip: Item tooltip.\r\n * command: A command identifier to be passed to the onCommand event handlers.\r\n * iconCssClass: A CSS class to be added to the menu item icon.\r\n * iconImage: A url to the icon image.\r\n *\r\n *\r\n * The plugin exposes the following events:\r\n * onBeforeMenuShow: Fired before the menu is shown. You can customize the menu or dismiss it by returning false.\r\n * * ONLY works with a jQuery event (as per slick.core code), so we cannot notify when it's a button event (when grid menu is attached to an external button, not the hamburger menu)\r\n * Event args:\r\n * grid: Reference to the grid.\r\n * column: Column definition.\r\n * menu: Menu options. Note that you can change the menu items here.\r\n *\r\n * onMenuClose: Fired when the menu is closing.\r\n * Event args:\r\n * grid: Reference to the grid.\r\n * column: Column definition.\r\n * menu: Menu options. Note that you can change the menu items here.\r\n *\r\n * onCommand: Fired on menu item click for buttons with 'command' specified.\r\n * Event args:\r\n * grid: Reference to the grid.\r\n * column: Column definition.\r\n * command: Button command identified.\r\n * button: Button options. Note that you can change the button options in your\r\n * event handler, and the column header will be automatically updated to\r\n * reflect them. This is useful if you want to implement something like a\r\n * toggle button.\r\n *\r\n *\r\n * @param options {Object} Options:\r\n * buttonCssClass: an extra CSS class to add to the menu button\r\n * buttonImage: a url to the menu button image (default '../images/down.gif')\r\n * @class Slick.Controls.GridMenu\r\n * @constructor\r\n */\r\n\r\n 'use strict';\r\n\r\n (function ($) {\r\n // register namespace\r\n $.extend(true, window, {\r\n \"Slick\": {\r\n \"Controls\": {\r\n \"GridMenu\": SlickGridMenu\r\n }\r\n }\r\n });\r\n\r\n function SlickGridMenu(columns, grid, options) {\r\n var _grid = grid;\r\n var _isMenuOpen = false;\r\n var _options = options;\r\n var _self = this;\r\n var $list;\r\n var $menu;\r\n var columnCheckboxes;\r\n var _defaults = {\r\n fadeSpeed: 250,\r\n menuWidth: 18,\r\n resizeOnShowHeaderRow: false\r\n };\r\n\r\n function init(grid) {\r\n var gridMenuWidth = (_options.gridMenu && _options.gridMenu.menuWidth) || _defaults.menuWidth;\r\n var $header = $('.slick-header');\r\n $header.attr('style', 'width: calc(100% - ' + gridMenuWidth +'px)');\r\n\r\n // if header row is enabled, we need to resize it's width also\r\n var enableResizeHeaderRow = (_options.gridMenu && _options.gridMenu.resizeOnShowHeaderRow != undefined) ? _options.gridMenu.resizeOnShowHeaderRow : _defaults.resizeOnShowHeaderRow;\r\n if(enableResizeHeaderRow) {\r\n var $headerrow = $('.slick-headerrow');\r\n $headerrow.attr('style', 'width: calc(100% - ' + gridMenuWidth +'px)');\r\n }\r\n\r\n var $button = $('