angular-slickgrid 3.0.4 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +192 -181
  3. package/angular-slickgrid.metadata.json +1 -1
  4. package/app/modules/angular-slickgrid/components/angular-slickgrid.component.d.ts +11 -3
  5. package/app/modules/angular-slickgrid/index.d.ts +0 -1
  6. package/bundles/angular-slickgrid.umd.js +99 -248
  7. package/bundles/angular-slickgrid.umd.js.map +1 -1
  8. package/esm2015/app/modules/angular-slickgrid/components/angular-slickgrid.component.js +89 -70
  9. package/esm2015/app/modules/angular-slickgrid/constants.js +1 -1
  10. package/esm2015/app/modules/angular-slickgrid/extensions/index.js +1 -1
  11. package/esm2015/app/modules/angular-slickgrid/extensions/rowDetailViewExtension.js +2 -2
  12. package/esm2015/app/modules/angular-slickgrid/global-grid-options.js +4 -3
  13. package/esm2015/app/modules/angular-slickgrid/index.js +1 -2
  14. package/esm2015/app/modules/angular-slickgrid/models/angularComponentOutput.interface.js +1 -1
  15. package/esm2015/app/modules/angular-slickgrid/models/angularGridInstance.interface.js +1 -1
  16. package/esm2015/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.js +1 -1
  17. package/esm2015/app/modules/angular-slickgrid/models/gridOption.interface.js +1 -1
  18. package/esm2015/app/modules/angular-slickgrid/models/index.js +1 -1
  19. package/esm2015/app/modules/angular-slickgrid/models/rowDetailView.interface.js +1 -1
  20. package/esm2015/app/modules/angular-slickgrid/models/slickGrid.interface.js +1 -1
  21. package/esm2015/app/modules/angular-slickgrid/modules/angular-slickgrid.module.js +1 -4
  22. package/esm2015/app/modules/angular-slickgrid/services/angularUtil.service.js +1 -1
  23. package/esm2015/app/modules/angular-slickgrid/services/bsDropdown.service.js +1 -1
  24. package/esm2015/app/modules/angular-slickgrid/services/container.service.js +1 -1
  25. package/esm2015/app/modules/angular-slickgrid/services/index.js +1 -1
  26. package/esm2015/app/modules/angular-slickgrid/services/translater.service.js +1 -1
  27. package/esm2015/app/modules/angular-slickgrid/services/utilities.js +1 -1
  28. package/esm2015/app/modules/angular-slickgrid/slickgrid-config.js +1 -1
  29. package/esm2015/public_api.js +1 -1
  30. package/fesm2015/angular-slickgrid.js +95 -209
  31. package/fesm2015/angular-slickgrid.js.map +1 -1
  32. package/i18n/en.json +89 -89
  33. package/i18n/fr.json +90 -90
  34. package/package.json +11 -10
  35. package/app/modules/angular-slickgrid/components/slick-pagination.component.d.ts +0 -42
  36. package/esm2015/app/modules/angular-slickgrid/components/slick-pagination.component.js +0 -137
@@ -1,6 +1,6 @@
1
- import { castObservableToPromise, addToArrayWhenNotExists, SharedService, RxJsFacade, Filters, OperatorType, EventNamingStyle, FileType, DelimiterType, getTranslationPrefix, SlickgridConfig as SlickgridConfig$1, BackendUtilityService, GridEventService, CollectionService, ExtensionUtility, FilterFactory, FilterService, ResizerService, SortService, TreeDataService, PaginationService, AutoTooltipExtension, CellExternalCopyManagerExtension, CellMenuExtension, ContextMenuExtension, ColumnPickerExtension, CheckboxSelectorExtension, DraggableGroupingExtension, GridMenuExtension, GroupItemMetaProviderExtension, HeaderButtonExtension, HeaderMenuExtension, RowMoveManagerExtension, RowSelectionExtension, ExtensionService, GridStateService, GridService, GroupingAndColspanService, emptyElement, autoAddEditorFormatterToColumnsWithEditor, GridStateType } from '@slickgrid-universal/common';
1
+ import { castObservableToPromise, addToArrayWhenNotExists, SharedService, RxJsFacade, Filters, OperatorType, EventNamingStyle, FileType, DelimiterType, SlickgridConfig as SlickgridConfig$1, BackendUtilityService, GridEventService, CollectionService, ExtensionUtility, FilterFactory, FilterService, ResizerService, SortService, TreeDataService, PaginationService, AutoTooltipExtension, CellExternalCopyManagerExtension, CellMenuExtension, ContextMenuExtension, ColumnPickerExtension, CheckboxSelectorExtension, DraggableGroupingExtension, GridMenuExtension, GroupItemMetaProviderExtension, HeaderButtonExtension, HeaderMenuExtension, RowMoveManagerExtension, RowSelectionExtension, ExtensionService, GridStateService, GridService, GroupingAndColspanService, emptyElement, autoAddEditorFormatterToColumnsWithEditor, GridStateType } from '@slickgrid-universal/common';
2
2
  export * from '@slickgrid-universal/common';
3
- import { Injectable, ComponentFactoryResolver, ApplicationRef, Injector, Optional, Component, Input, ChangeDetectorRef, ElementRef, Inject, NgModule } from '@angular/core';
3
+ import { Injectable, ComponentFactoryResolver, ApplicationRef, Injector, Optional, Component, ChangeDetectorRef, ElementRef, Inject, Input, NgModule } from '@angular/core';
4
4
  import { __awaiter } from 'tslib';
5
5
  import { TranslateService, TranslateModule } from '@ngx-translate/core';
6
6
  import 'slickgrid/plugins/slick.rowdetailview';
@@ -17,8 +17,9 @@ import 'slickgrid/slick.core';
17
17
  import 'slickgrid/slick.grid';
18
18
  import 'slickgrid/slick.dataview';
19
19
  import 'slickgrid/slick.groupitemmetadataprovider';
20
- import { SlickFooterComponent } from '@slickgrid-universal/custom-footer-component';
21
20
  import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component';
21
+ import { SlickFooterComponent } from '@slickgrid-universal/custom-footer-component';
22
+ import { SlickPaginationComponent } from '@slickgrid-universal/pagination-component';
22
23
  import { RxJsResource } from '@slickgrid-universal/rxjs-observable';
23
24
  import { dequal } from 'dequal/lite';
24
25
  import { CommonModule } from '@angular/common';
@@ -527,7 +528,7 @@ class RowDetailViewExtension {
527
528
  awaitedItemDetail = yield castObservableToPromise(this.rxjs, response); // from Angular-http-client
528
529
  }
529
530
  if (!awaitedItemDetail || !awaitedItemDetail.hasOwnProperty(this.datasetIdPropName)) {
530
- throw new Error(`[Angular-Slickgrid] could not process the Row Detail, you must make sure that your "process" callback
531
+ throw new Error(`[Angular-Slickgrid] could not process the Row Detail, you must make sure that your "process" callback
531
532
  (a Promise or an HttpClient call returning an Observable) returns an item object that has an "${this.datasetIdPropName}" property`);
532
533
  }
533
534
  // notify the plugin with the new item details
@@ -661,10 +662,9 @@ const GlobalGridOptions = {
661
662
  syncGridSelectionWithBackendService: false, // but disable it when using backend services
662
663
  },
663
664
  datasetIdPropertyName: 'id',
664
- defaultColumnSortFieldId: 'id',
665
665
  defaultFilter: Filters.input,
666
666
  defaultBackendServiceFilterTypingDebounce: 500,
667
- enableFilterTrimWhiteSpace: false,
667
+ defaultColumnSortFieldId: 'id',
668
668
  defaultFilterPlaceholder: '🔎︎',
669
669
  defaultFilterRangeOperator: OperatorType.rangeInclusive,
670
670
  editable: false,
@@ -677,6 +677,7 @@ const GlobalGridOptions = {
677
677
  enableContextMenu: true,
678
678
  enableExcelExport: true,
679
679
  enableExport: false,
680
+ enableFilterTrimWhiteSpace: false,
680
681
  enableGridMenu: true,
681
682
  enableHeaderMenu: true,
682
683
  enableEmptyDataWarningMessage: true,
@@ -799,6 +800,7 @@ const GlobalGridOptions = {
799
800
  rowHeight: 35,
800
801
  topPanelHeight: 35,
801
802
  translationNamespaceSeparator: ':',
803
+ resetFilterSearchValueAfterOnBeforeCancellation: true,
802
804
  resizeByContentOnlyOnFirstLoad: true,
803
805
  resizeByContentOptions: {
804
806
  alwaysRecalculateColumnWidth: false,
@@ -928,138 +930,6 @@ Constants.VALIDATION_EDITOR_TEXT_MAX_LENGTH_INCLUSIVE = 'Please make sure your t
928
930
  Constants.VALIDATION_EDITOR_TEXT_MIN_LENGTH = 'Please make sure your text is more than {{minLength}} character(s)';
929
931
  Constants.VALIDATION_EDITOR_TEXT_MIN_LENGTH_INCLUSIVE = 'Please make sure your text is at least {{minLength}} character(s)';
930
932
 
931
- class SlickPaginationComponent {
932
- /** Constructor */
933
- constructor(translate) {
934
- this.translate = translate;
935
- this.subscriptions = [];
936
- this._enableTranslate = false;
937
- // text translations (handled by ngx-translate or by custom locale)
938
- this.textItemsPerPage = 'items per page';
939
- this.textItems = 'items';
940
- this.textOf = 'of';
941
- this.textPage = 'Page';
942
- }
943
- get availablePageSizes() {
944
- return this.paginationService.availablePageSizes;
945
- }
946
- get dataFrom() {
947
- return this.paginationService.dataFrom;
948
- }
949
- get dataTo() {
950
- return this.paginationService.dataTo;
951
- }
952
- /** is the left side pagination disabled? */
953
- get isLeftPaginationDisabled() {
954
- return this.pageNumber === 1 || this.totalItems === 0;
955
- }
956
- /** is the right side pagination disabled? */
957
- get isRightPaginationDisabled() {
958
- return this.pageNumber === this.pageCount || this.totalItems === 0;
959
- }
960
- get itemsPerPage() {
961
- return this.paginationService.itemsPerPage;
962
- }
963
- get pageCount() {
964
- return this.paginationService.pageCount;
965
- }
966
- get pageNumber() {
967
- return this.paginationService.pageNumber;
968
- }
969
- set pageNumber(page) {
970
- // the setter has to be declared but we won't use it, instead we will use the "changeToCurrentPage()" to only update the value after ENTER keydown event
971
- }
972
- get totalItems() {
973
- return this.paginationService.totalItems;
974
- }
975
- ngOnDestroy() {
976
- this.dispose();
977
- }
978
- ngOnInit() {
979
- this._gridOptions = this.gridOptions || {};
980
- this._enableTranslate = this._gridOptions && this._gridOptions.enableTranslate || false;
981
- this._locales = this._gridOptions && this._gridOptions.locales || Constants.locales;
982
- if (this._enableTranslate && !this.translate) {
983
- throw new Error('[Angular-Slickgrid] requires "ngx-translate" to be installed and configured when the grid option "enableTranslate" is enabled.');
984
- }
985
- this.translateAllUiTexts(this._locales);
986
- // translate all the text using ngx-translate or custom locales
987
- if (this._enableTranslate && this.translate && this.translate.onLangChange) {
988
- this.subscriptions.push(this.translate.onLangChange.subscribe(() => this.translateAllUiTexts(this._locales)));
989
- }
990
- }
991
- changeToFirstPage(event) {
992
- if (!this.isLeftPaginationDisabled) {
993
- this.paginationService.goToFirstPage(event);
994
- }
995
- }
996
- changeToLastPage(event) {
997
- if (!this.isRightPaginationDisabled) {
998
- this.paginationService.goToLastPage(event);
999
- }
1000
- }
1001
- changeToNextPage(event) {
1002
- if (!this.isRightPaginationDisabled) {
1003
- this.paginationService.goToNextPage(event);
1004
- }
1005
- }
1006
- changeToPreviousPage(event) {
1007
- if (!this.isLeftPaginationDisabled) {
1008
- this.paginationService.goToPreviousPage(event);
1009
- }
1010
- }
1011
- changeToCurrentPage(event) {
1012
- let pageNumber = 1;
1013
- if (event && event.currentTarget && event.currentTarget.value) {
1014
- pageNumber = +(event.currentTarget.value);
1015
- }
1016
- this.paginationService.goToPageNumber(pageNumber, event);
1017
- }
1018
- changeItemPerPage(event) {
1019
- let itemsPerPage = 1;
1020
- if (event && event.currentTarget && event.currentTarget.value) {
1021
- itemsPerPage = +(event.currentTarget.value);
1022
- }
1023
- this.paginationService.changeItemPerPage(itemsPerPage, event);
1024
- }
1025
- dispose() {
1026
- // also unsubscribe all Angular Subscriptions
1027
- this.subscriptions = unsubscribeAllObservables(this.subscriptions);
1028
- }
1029
- // --
1030
- // private functions
1031
- // --------------------
1032
- /** Translate all the texts shown in the UI, use ngx-translate service when available or custom locales when service is null */
1033
- translateAllUiTexts(locales) {
1034
- if (this._enableTranslate && this.translate && this.translate.instant && this.translate.currentLang) {
1035
- const translationPrefix = getTranslationPrefix(this._gridOptions);
1036
- this.textItemsPerPage = this.translate.instant(`${translationPrefix}ITEMS_PER_PAGE`);
1037
- this.textItems = this.translate.instant(`${translationPrefix}ITEMS`);
1038
- this.textOf = this.translate.instant(`${translationPrefix}OF`);
1039
- this.textPage = this.translate.instant(`${translationPrefix}PAGE`);
1040
- }
1041
- else if (locales) {
1042
- this.textItemsPerPage = locales.TEXT_ITEMS_PER_PAGE || 'TEXT_ITEMS_PER_PAGE';
1043
- this.textItems = locales.TEXT_ITEMS || 'TEXT_ITEMS';
1044
- this.textOf = locales.TEXT_OF || 'TEXT_OF';
1045
- this.textPage = locales.TEXT_PAGE || 'TEXT_PAGE';
1046
- }
1047
- }
1048
- }
1049
- SlickPaginationComponent.decorators = [
1050
- { type: Component, args: [{
1051
- selector: 'slick-pagination',
1052
- template: "<div class=\"slick-pagination\">\n <div class=\"slick-pagination-nav\">\n <nav aria-label=\"Page navigation\">\n <ul class=\"pagination\">\n <li class=\"page-item\" [ngClass]=\"isLeftPaginationDisabled ? 'disabled' : ''\">\n <a class=\"page-link icon-seek-first fa fa-angle-double-left\" aria-label=\"First\"\n (click)=\"changeToFirstPage($event)\">\n </a>\n </li>\n <li class=\"page-item\" [ngClass]=\"isLeftPaginationDisabled ? 'disabled' : ''\">\n <a class=\"page-link icon-seek-prev fa fa-angle-left\" aria-label=\"Previous\"\n (click)=\"changeToPreviousPage($event)\">\n </a>\n </li>\n </ul>\n </nav>\n\n <div class=\"slick-page-number\">\n <span>{{textPage}}</span>\n <input type=\"text\" class=\"form-control\" data-test=\"page-number-input\" [value]=\"pageNumber\" size=\"1\"\n [readOnly]=\"totalItems === 0\" (change)=\"changeToCurrentPage($event)\">\n <span>{{textOf}}</span><span data-test=\"page-count\"> {{pageCount}}</span>\n </div>\n\n <nav aria-label=\"Page navigation\">\n <ul class=\"pagination\">\n <li class=\"page-item\" [ngClass]=\"isRightPaginationDisabled ? 'disabled' : ''\">\n <a class=\"page-link icon-seek-next text-center fa fa-lg fa-angle-right\" aria-label=\"Next\"\n (click)=\"changeToNextPage($event)\">\n </a>\n </li>\n <li class=\"page-item\" [ngClass]=\"isRightPaginationDisabled ? 'disabled' : ''\">\n <a class=\"page-link icon-seek-end fa fa-lg fa-angle-double-right\" aria-label=\"Last\"\n (click)=\"changeToLastPage($event)\">\n </a>\n </li>\n </ul>\n </nav>\n </div>\n <span class=\"slick-pagination-settings\">\n <select id=\"items-per-page-label\" (change)=\"changeItemPerPage($event)\">\n <option value=\"{{pageSize}}\" [selected]=\"pageSize === itemsPerPage\" *ngFor=\"let pageSize of availablePageSizes\">{{pageSize}}</option>\n </select>\n <span>{{textItemsPerPage}}</span>,\n <span class=\"slick-pagination-count\">\n <span *ngIf=\"totalItems\">\n <span class=\"page-info-from-to\">\n <span data-test=\"item-from\">{{dataFrom}}</span>-<span data-test=\"item-to\">{{dataTo}}</span>\n {{textOf}}\n </span>\n </span>\n <span class=\"page-info-total-items\">\n <span data-test=\"total-items\">{{totalItems}}</span> {{textItems}}\n </span>\n </span>\n </span>\n</div>\n"
1053
- },] }
1054
- ];
1055
- SlickPaginationComponent.ctorParameters = () => [
1056
- { type: TranslateService, decorators: [{ type: Optional }] }
1057
- ];
1058
- SlickPaginationComponent.propDecorators = {
1059
- gridOptions: [{ type: Input }],
1060
- paginationService: [{ type: Input }]
1061
- };
1062
-
1063
933
  // import 3rd party vendor libs
1064
934
  class AngularSlickgridComponent {
1065
935
  constructor(angularUtilService, appRef, cd, containerService, elm, translate, translaterService, forRootConfig, externalServices) {
@@ -1106,10 +976,10 @@ class AngularSlickgridComponent {
1106
976
  const autoTooltipExtension = new AutoTooltipExtension(this.sharedService);
1107
977
  const cellExternalCopyManagerExtension = new CellExternalCopyManagerExtension(this.extensionUtility, this.sharedService);
1108
978
  const cellMenuExtension = new CellMenuExtension(this.extensionUtility, this.sharedService, this.translaterService);
1109
- const contextMenuExtension = new ContextMenuExtension(this.extensionUtility, this.sharedService, this.treeDataService, this.translaterService);
979
+ const contextMenuExtension = new ContextMenuExtension(this.extensionUtility, this._eventPubSubService, this.sharedService, this.treeDataService, this.translaterService);
1110
980
  const columnPickerExtension = new ColumnPickerExtension(this.extensionUtility, this.sharedService);
1111
981
  const checkboxExtension = new CheckboxSelectorExtension(this.sharedService);
1112
- const draggableGroupingExtension = new DraggableGroupingExtension(this.extensionUtility, this.sharedService);
982
+ const draggableGroupingExtension = new DraggableGroupingExtension(this.extensionUtility, this._eventPubSubService, this.sharedService);
1113
983
  const gridMenuExtension = new GridMenuExtension(this.extensionUtility, this.filterService, this.sharedService, this.sortService, this.backendUtilityService, this.translaterService);
1114
984
  const groupItemMetaProviderExtension = new GroupItemMetaProviderExtension(this.sharedService);
1115
985
  const headerButtonExtension = new HeaderButtonExtension(this.extensionUtility, this.sharedService);
@@ -1155,15 +1025,15 @@ class AngularSlickgridComponent {
1155
1025
  return this._paginationOptions;
1156
1026
  }
1157
1027
  set paginationOptions(newPaginationOptions) {
1158
- var _a;
1028
+ var _a, _b, _c;
1159
1029
  if (newPaginationOptions && this._paginationOptions) {
1160
- this._paginationOptions = Object.assign(Object.assign({}, this._paginationOptions), newPaginationOptions);
1030
+ this._paginationOptions = Object.assign(Object.assign(Object.assign({}, this.gridOptions.pagination), this._paginationOptions), newPaginationOptions);
1161
1031
  }
1162
1032
  else {
1163
1033
  this._paginationOptions = newPaginationOptions;
1164
1034
  }
1165
- this.gridOptions.pagination = this._paginationOptions;
1166
- this.paginationService.updateTotalItems((_a = newPaginationOptions === null || newPaginationOptions === void 0 ? void 0 : newPaginationOptions.totalItems) !== null && _a !== void 0 ? _a : 0, true);
1035
+ this.gridOptions.pagination = (_a = this._paginationOptions) !== null && _a !== void 0 ? _a : this.gridOptions.pagination;
1036
+ this.paginationService.updateTotalItems((_c = (_b = this.gridOptions.pagination) === null || _b === void 0 ? void 0 : _b.totalItems) !== null && _c !== void 0 ? _c : 0, true);
1167
1037
  }
1168
1038
  set columnDefinitions(columnDefinitions) {
1169
1039
  this._columnDefinitions = columnDefinitions;
@@ -1204,7 +1074,7 @@ class AngularSlickgridComponent {
1204
1074
  return this.sharedService.hierarchicalDataset;
1205
1075
  }
1206
1076
  set datasetHierarchical(newHierarchicalDataset) {
1207
- var _a, _b, _c, _d;
1077
+ var _a, _b, _c, _d, _f;
1208
1078
  const isDatasetEqual = dequal(newHierarchicalDataset, (_b = (_a = this.sharedService) === null || _a === void 0 ? void 0 : _a.hierarchicalDataset) !== null && _b !== void 0 ? _b : []);
1209
1079
  const prevFlatDatasetLn = this._currentDatasetLength;
1210
1080
  this.sharedService.hierarchicalDataset = newHierarchicalDataset;
@@ -1213,9 +1083,8 @@ class AngularSlickgridComponent {
1213
1083
  }
1214
1084
  // when a hierarchical dataset is set afterward, we can reset the flat dataset and call a tree data sort that will overwrite the flat dataset
1215
1085
  if (newHierarchicalDataset && this.slickGrid && ((_d = this.sortService) === null || _d === void 0 ? void 0 : _d.processTreeDataInitialSort)) {
1216
- this.dataView.setItems([], this.gridOptions.datasetIdPropertyName);
1086
+ this.dataView.setItems([], (_f = this.gridOptions.datasetIdPropertyName) !== null && _f !== void 0 ? _f : 'id');
1217
1087
  this.sortService.processTreeDataInitialSort();
1218
- this.sortTreeDataset([]);
1219
1088
  // we also need to reset/refresh the Tree Data filters because if we inserted new item(s) then it might not show up without doing this refresh
1220
1089
  // however we need 1 cpu cycle before having the DataView refreshed, so we need to wrap this check in a setTimeout
1221
1090
  setTimeout(() => {
@@ -1224,8 +1093,8 @@ class AngularSlickgridComponent {
1224
1093
  this.filterService.refreshTreeDataFilters();
1225
1094
  }
1226
1095
  });
1096
+ this._isDatasetHierarchicalInitialized = true;
1227
1097
  }
1228
- this._isDatasetHierarchicalInitialized = true;
1229
1098
  }
1230
1099
  get elementRef() {
1231
1100
  return this.elm;
@@ -1244,6 +1113,9 @@ class AngularSlickgridComponent {
1244
1113
  set isDatasetInitialized(isInitialized) {
1245
1114
  this._isDatasetInitialized = isInitialized;
1246
1115
  }
1116
+ set isDatasetHierarchicalInitialized(isInitialized) {
1117
+ this._isDatasetHierarchicalInitialized = isInitialized;
1118
+ }
1247
1119
  get registeredResources() {
1248
1120
  return this._registeredResources;
1249
1121
  }
@@ -1262,7 +1134,7 @@ class AngularSlickgridComponent {
1262
1134
  this._eventPubSubService.publish('onAfterGridDestroyed', true);
1263
1135
  }
1264
1136
  destroy(shouldEmptyDomElementContainer = false) {
1265
- var _a, _b, _c, _d, _f, _g;
1137
+ var _a, _b, _c, _d, _f, _g, _h;
1266
1138
  // dispose of all Services
1267
1139
  this.serviceList.forEach((service) => {
1268
1140
  if (service && service.dispose) {
@@ -1281,21 +1153,22 @@ class AngularSlickgridComponent {
1281
1153
  this._registeredResources = [];
1282
1154
  }
1283
1155
  // dispose the Components
1284
- (_a = this.slickFooter) === null || _a === void 0 ? void 0 : _a.dispose();
1285
- (_b = this.slickEmptyWarning) === null || _b === void 0 ? void 0 : _b.dispose();
1286
- if ((_c = this._eventHandler) === null || _c === void 0 ? void 0 : _c.unsubscribeAll) {
1156
+ (_a = this.slickEmptyWarning) === null || _a === void 0 ? void 0 : _a.dispose();
1157
+ (_b = this.slickFooter) === null || _b === void 0 ? void 0 : _b.dispose();
1158
+ (_c = this.slickPagination) === null || _c === void 0 ? void 0 : _c.dispose();
1159
+ if ((_d = this._eventHandler) === null || _d === void 0 ? void 0 : _d.unsubscribeAll) {
1287
1160
  this._eventHandler.unsubscribeAll();
1288
1161
  }
1289
- (_d = this._eventPubSubService) === null || _d === void 0 ? void 0 : _d.unsubscribeAll();
1162
+ (_f = this._eventPubSubService) === null || _f === void 0 ? void 0 : _f.unsubscribeAll();
1290
1163
  if (this.dataView) {
1291
- if ((_f = this.dataView) === null || _f === void 0 ? void 0 : _f.setItems) {
1164
+ if ((_g = this.dataView) === null || _g === void 0 ? void 0 : _g.setItems) {
1292
1165
  this.dataView.setItems([]);
1293
1166
  }
1294
1167
  if (this.dataView.destroy) {
1295
1168
  this.dataView.destroy();
1296
1169
  }
1297
1170
  }
1298
- if ((_g = this.slickGrid) === null || _g === void 0 ? void 0 : _g.destroy) {
1171
+ if ((_h = this.slickGrid) === null || _h === void 0 ? void 0 : _h.destroy) {
1299
1172
  this.slickGrid.destroy(shouldEmptyDomElementContainer);
1300
1173
  }
1301
1174
  if (this.backendServiceApi) {
@@ -1349,7 +1222,7 @@ class AngularSlickgridComponent {
1349
1222
  }
1350
1223
  }
1351
1224
  initialization(eventHandler) {
1352
- var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1225
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
1353
1226
  this.gridOptions.translater = this.translaterService;
1354
1227
  this._eventHandler = eventHandler;
1355
1228
  // when detecting a frozen grid, we'll automatically enable the mousewheel scroll handler so that we can scroll from both left/right frozen containers
@@ -1419,13 +1292,14 @@ class AngularSlickgridComponent {
1419
1292
  }
1420
1293
  // user could show a custom footer with the data metrics (dataset length and last updated timestamp)
1421
1294
  if (!this.gridOptions.enablePagination && this.gridOptions.showCustomFooter && this.gridOptions.customFooterOptions && this.gridContainerElement) {
1422
- this.slickFooter = new SlickFooterComponent(this.slickGrid, this.gridOptions.customFooterOptions, this.translaterService);
1295
+ this.slickFooter = new SlickFooterComponent(this.slickGrid, this.gridOptions.customFooterOptions, this._eventPubSubService, this.translaterService);
1423
1296
  this.slickFooter.renderFooter(this.gridContainerElement);
1424
1297
  }
1425
1298
  if (!this.customDataView && this.dataView) {
1299
+ // load the data in the DataView (unless it's a hierarchical dataset, if so it will be loaded after the initial tree sort)
1426
1300
  const initialDataset = ((_j = this.gridOptions) === null || _j === void 0 ? void 0 : _j.enableTreeData) ? this.sortTreeDataset(this._dataset) : this._dataset;
1427
1301
  this.dataView.beginUpdate();
1428
- this.dataView.setItems(initialDataset || [], this.gridOptions.datasetIdPropertyName);
1302
+ this.dataView.setItems(initialDataset || [], (_k = this.gridOptions.datasetIdPropertyName) !== null && _k !== void 0 ? _k : 'id');
1429
1303
  this.dataView.endUpdate();
1430
1304
  // if you don't want the items that are not visible (due to being filtered out or being on a different page)
1431
1305
  // to stay selected, pass 'false' to the second arg
@@ -1475,13 +1349,13 @@ class AngularSlickgridComponent {
1475
1349
  this.bindResizeHook(this.slickGrid, this.gridOptions);
1476
1350
  // bind the Backend Service API callback functions only after the grid is initialized
1477
1351
  // because the preProcess() and onInit() might get triggered
1478
- if ((_k = this.gridOptions) === null || _k === void 0 ? void 0 : _k.backendServiceApi) {
1352
+ if ((_l = this.gridOptions) === null || _l === void 0 ? void 0 : _l.backendServiceApi) {
1479
1353
  this.bindBackendCallbackFunctions(this.gridOptions);
1480
1354
  }
1481
1355
  // local grid, check if we need to show the Pagination
1482
1356
  // if so then also check if there's any presets and finally initialize the PaginationService
1483
1357
  // a local grid with Pagination presets will potentially have a different total of items, we'll need to get it from the DataView and update our total
1484
- if (((_l = this.gridOptions) === null || _l === void 0 ? void 0 : _l.enablePagination) && this._isLocalGrid) {
1358
+ if (((_m = this.gridOptions) === null || _m === void 0 ? void 0 : _m.enablePagination) && this._isLocalGrid) {
1485
1359
  this.showPagination = true;
1486
1360
  this.loadLocalGridPagination(this.dataset);
1487
1361
  }
@@ -1489,11 +1363,11 @@ class AngularSlickgridComponent {
1489
1363
  // Slick Grid & DataView objects
1490
1364
  dataView: this.dataView,
1491
1365
  slickGrid: this.slickGrid,
1492
- extensions: (_m = this.extensionService) === null || _m === void 0 ? void 0 : _m.extensionList,
1366
+ extensions: (_o = this.extensionService) === null || _o === void 0 ? void 0 : _o.extensionList,
1493
1367
  // public methods
1494
1368
  destroy: this.destroy.bind(this),
1495
1369
  // return all available Services (non-singleton)
1496
- backendService: (_p = (_o = this.gridOptions) === null || _o === void 0 ? void 0 : _o.backendServiceApi) === null || _p === void 0 ? void 0 : _p.service,
1370
+ backendService: (_q = (_p = this.gridOptions) === null || _p === void 0 ? void 0 : _p.backendServiceApi) === null || _q === void 0 ? void 0 : _q.service,
1497
1371
  filterService: this.filterService,
1498
1372
  gridEventService: this.gridEventService,
1499
1373
  gridStateService: this.gridStateService,
@@ -1535,13 +1409,13 @@ class AngularSlickgridComponent {
1535
1409
  * @param dataset
1536
1410
  */
1537
1411
  refreshGridData(dataset, totalCount) {
1538
- var _a, _b, _c, _d, _f;
1412
+ var _a, _b, _c, _d, _f, _g;
1539
1413
  if (this.gridOptions && this.gridOptions.enableEmptyDataWarningMessage && Array.isArray(dataset)) {
1540
1414
  const finalTotalCount = totalCount || dataset.length;
1541
1415
  this.displayEmptyDataWarning(finalTotalCount < 1);
1542
1416
  }
1543
1417
  if (Array.isArray(dataset) && this.slickGrid && ((_a = this.dataView) === null || _a === void 0 ? void 0 : _a.setItems)) {
1544
- this.dataView.setItems(dataset, this.gridOptions.datasetIdPropertyName);
1418
+ this.dataView.setItems(dataset, (_b = this.gridOptions.datasetIdPropertyName) !== null && _b !== void 0 ? _b : 'id');
1545
1419
  if (!this.gridOptions.backendServiceApi && !this.gridOptions.enableTreeData) {
1546
1420
  this.dataView.reSort();
1547
1421
  }
@@ -1559,11 +1433,11 @@ class AngularSlickgridComponent {
1559
1433
  }
1560
1434
  // display the Pagination component only after calling this refresh data first, we call it here so that if we preset pagination page number it will be shown correctly
1561
1435
  this.showPagination = (this.gridOptions && (this.gridOptions.enablePagination || (this.gridOptions.backendServiceApi && this.gridOptions.enablePagination === undefined))) ? true : false;
1562
- if (this._paginationOptions && ((_b = this.gridOptions) === null || _b === void 0 ? void 0 : _b.pagination) && ((_c = this.gridOptions) === null || _c === void 0 ? void 0 : _c.backendServiceApi)) {
1436
+ if (this._paginationOptions && ((_c = this.gridOptions) === null || _c === void 0 ? void 0 : _c.pagination) && ((_d = this.gridOptions) === null || _d === void 0 ? void 0 : _d.backendServiceApi)) {
1563
1437
  const paginationOptions = this.setPaginationOptionsWhenPresetDefined(this.gridOptions, this._paginationOptions);
1564
1438
  // when we have a totalCount use it, else we'll take it from the pagination object
1565
1439
  // only update the total items if it's different to avoid refreshing the UI
1566
- const totalRecords = (totalCount !== undefined) ? totalCount : ((_f = (_d = this.gridOptions) === null || _d === void 0 ? void 0 : _d.pagination) === null || _f === void 0 ? void 0 : _f.totalItems);
1440
+ const totalRecords = (totalCount !== undefined) ? totalCount : ((_g = (_f = this.gridOptions) === null || _f === void 0 ? void 0 : _f.pagination) === null || _g === void 0 ? void 0 : _g.totalItems);
1567
1441
  if (totalRecords !== undefined && totalRecords !== this.totalItems) {
1568
1442
  this.totalItems = +totalRecords;
1569
1443
  }
@@ -1650,9 +1524,10 @@ class AngularSlickgridComponent {
1650
1524
  if (gridOptions.enableTranslate) {
1651
1525
  this.translateColumnHeaderTitleKeys();
1652
1526
  this.translateColumnGroupKeys();
1653
- this.translateCustomFooterTexts();
1654
1527
  }
1655
1528
  this.subscriptions.push(this.translate.onLangChange.subscribe(() => {
1529
+ // publish event of the same name that Slickgrid-Universal uses on a language change event
1530
+ this._eventPubSubService.publish('onLanguageChange');
1656
1531
  if (gridOptions.enableTranslate) {
1657
1532
  this.extensionService.translateCellMenu();
1658
1533
  this.extensionService.translateColumnHeaders();
@@ -1660,7 +1535,6 @@ class AngularSlickgridComponent {
1660
1535
  this.extensionService.translateContextMenu();
1661
1536
  this.extensionService.translateGridMenu();
1662
1537
  this.extensionService.translateHeaderMenu();
1663
- this.translateCustomFooterTexts();
1664
1538
  this.translateColumnHeaderTitleKeys();
1665
1539
  this.translateColumnGroupKeys();
1666
1540
  if (gridOptions.createPreHeaderPanel && !gridOptions.enableDraggableGrouping) {
@@ -1669,32 +1543,6 @@ class AngularSlickgridComponent {
1669
1543
  }
1670
1544
  }));
1671
1545
  }
1672
- if (!this.customDataView) {
1673
- // bind external sorting (backend) when available or default onSort (dataView)
1674
- if (gridOptions.enableSorting) {
1675
- // bind external sorting (backend) unless specified to use the local one
1676
- if (gridOptions.backendServiceApi && !gridOptions.backendServiceApi.useLocalSorting) {
1677
- this.sortService.bindBackendOnSort(grid);
1678
- }
1679
- else {
1680
- this.sortService.bindLocalOnSort(grid);
1681
- }
1682
- }
1683
- // bind external filter (backend) when available or default onFilter (dataView)
1684
- if (gridOptions.enableFiltering) {
1685
- this.filterService.init(grid);
1686
- // bind external filter (backend) unless specified to use the local one
1687
- if (gridOptions.backendServiceApi && !gridOptions.backendServiceApi.useLocalFiltering) {
1688
- this.filterService.bindBackendOnFilter(grid);
1689
- }
1690
- else {
1691
- this.filterService.bindLocalOnFilter(grid);
1692
- }
1693
- }
1694
- // load any presets if any (after dataset is initialized)
1695
- this.loadColumnPresetsWhenDatasetInitialized();
1696
- this.loadFilterPresetsWhenDatasetInitialized();
1697
- }
1698
1546
  // if user set an onInit Backend, we'll run it right away (and if so, we also need to run preProcess, internalPostProcess & postProcess)
1699
1547
  if (gridOptions.backendServiceApi) {
1700
1548
  const backendApi = gridOptions.backendServiceApi;
@@ -1728,16 +1576,41 @@ class AngularSlickgridComponent {
1728
1576
  this.gridEventService.bindOnCellChange(grid);
1729
1577
  this.gridEventService.bindOnClick(grid);
1730
1578
  if (dataView && grid) {
1579
+ // bind external sorting (backend) when available or default onSort (dataView)
1580
+ if (gridOptions.enableSorting) {
1581
+ // bind external sorting (backend) unless specified to use the local one
1582
+ if (gridOptions.backendServiceApi && !gridOptions.backendServiceApi.useLocalSorting) {
1583
+ this.sortService.bindBackendOnSort(grid);
1584
+ }
1585
+ else {
1586
+ this.sortService.bindLocalOnSort(grid);
1587
+ }
1588
+ }
1589
+ // bind external filter (backend) when available or default onFilter (dataView)
1590
+ if (gridOptions.enableFiltering) {
1591
+ this.filterService.init(grid);
1592
+ // bind external filter (backend) unless specified to use the local one
1593
+ if (gridOptions.backendServiceApi && !gridOptions.backendServiceApi.useLocalFiltering) {
1594
+ this.filterService.bindBackendOnFilter(grid);
1595
+ }
1596
+ else {
1597
+ this.filterService.bindLocalOnFilter(grid);
1598
+ }
1599
+ }
1600
+ // load any presets if any (after dataset is initialized)
1601
+ this.loadColumnPresetsWhenDatasetInitialized();
1602
+ this.loadFilterPresetsWhenDatasetInitialized();
1731
1603
  // When data changes in the DataView, we need to refresh the metrics and/or display a warning if the dataset is empty
1732
1604
  const onRowCountChangedHandler = dataView.onRowCountChanged;
1733
1605
  this._eventHandler.subscribe(onRowCountChangedHandler, (_e, args) => {
1734
1606
  grid.invalidate();
1735
- this.handleOnItemCountChanged(args.current || 0, dataView.getItemCount());
1607
+ this.handleOnItemCountChanged(this.dataView.getFilteredItemCount() || 0, dataView.getItemCount());
1736
1608
  });
1737
1609
  const onSetItemsCalledHandler = dataView.onSetItemsCalled;
1738
1610
  this._eventHandler.subscribe(onSetItemsCalledHandler, (_e, args) => {
1739
1611
  var _a;
1740
- this.handleOnItemCountChanged(dataView.getLength(), args.itemCount);
1612
+ grid.invalidate();
1613
+ this.handleOnItemCountChanged(this.dataView.getFilteredItemCount(), args.itemCount);
1741
1614
  // when user has resize by content enabled, we'll force a full width calculation since we change our entire dataset
1742
1615
  if (args.itemCount > 0 && (this.gridOptions.autosizeColumnsByCellContentOnFirstLoad || this.gridOptions.enableAutoResizeColumnsByCellContent)) {
1743
1616
  this.resizerService.resizeColumnsByCellContent(!((_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.resizeByContentOnlyOnFirstLoad));
@@ -1757,7 +1630,7 @@ class AngularSlickgridComponent {
1757
1630
  });
1758
1631
  }
1759
1632
  }
1760
- // does the user have a colspan callback?
1633
+ // did the user add a colspan callback? If so, hook it into the DataView getItemMetadata
1761
1634
  if (gridOptions && gridOptions.colspanCallback && dataView && dataView.getItem && dataView.getItemMetadata) {
1762
1635
  dataView.getItemMetadata = (rowNumber) => {
1763
1636
  let callbackResult = null;
@@ -1847,7 +1720,6 @@ class AngularSlickgridComponent {
1847
1720
  this.resizerService.resizeGrid();
1848
1721
  }
1849
1722
  if (options.enableAutoResize) {
1850
- this.resizerService.bindAutoResizeDataGrid();
1851
1723
  if (grid && options.autoFitColumnsOnFirstLoad && options.enableAutoSizeColumns) {
1852
1724
  grid.autosizeColumns();
1853
1725
  }
@@ -1898,7 +1770,10 @@ class AngularSlickgridComponent {
1898
1770
  if ((_b = this.gridOptions) === null || _b === void 0 ? void 0 : _b.backendServiceApi) {
1899
1771
  (_c = this.backendUtilityService) === null || _c === void 0 ? void 0 : _c.refreshBackendDataset(this.gridOptions);
1900
1772
  }
1773
+ this.renderPagination(this.showPagination);
1901
1774
  }));
1775
+ // also initialize (render) the pagination component
1776
+ this.renderPagination();
1902
1777
  this._isPaginationInitialized = true;
1903
1778
  }
1904
1779
  this.cd.detectChanges();
@@ -2081,6 +1956,26 @@ class AngularSlickgridComponent {
2081
1956
  this.paginationService.addRxJsResource(this.rxjs);
2082
1957
  this.containerService.registerInstance('RxJsResource', this.rxjs);
2083
1958
  }
1959
+ /**
1960
+ * Render (or dispose) the Pagination Component, user can optionally provide False (to not show it) which will in term dispose of the Pagination,
1961
+ * also while disposing we can choose to omit the disposable of the Pagination Service (if we are simply toggling the Pagination, we want to keep the Service alive)
1962
+ * @param {Boolean} showPagination - show (new render) or not (dispose) the Pagination
1963
+ * @param {Boolean} shouldDisposePaginationService - when disposing the Pagination, do we also want to dispose of the Pagination Service? (defaults to True)
1964
+ */
1965
+ renderPagination(showPagination = true) {
1966
+ var _a;
1967
+ if (((_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.enablePagination) && !this._isPaginationInitialized && showPagination) {
1968
+ this.slickPagination = new SlickPaginationComponent(this.paginationService, this._eventPubSubService, this.sharedService, this.translaterService);
1969
+ this.slickPagination.renderPagination(this.gridContainerElement);
1970
+ this._isPaginationInitialized = true;
1971
+ }
1972
+ else if (!showPagination) {
1973
+ if (this.slickPagination) {
1974
+ this.slickPagination.dispose();
1975
+ }
1976
+ this._isPaginationInitialized = false;
1977
+ }
1978
+ }
2084
1979
  /**
2085
1980
  * Takes a flat dataset with parent/child relationship, sort it (via its tree structure) and return the sorted flat array
2086
1981
  * @param {Array<Object>} flatDatasetInput - flat dataset input
@@ -2135,13 +2030,6 @@ class AngularSlickgridComponent {
2135
2030
  return Object.assign(Object.assign({}, column), { editor: column.editor && column.editor.model, internalColumnEditor: Object.assign({}, column.editor) });
2136
2031
  });
2137
2032
  }
2138
- /** Translate all Custom Footer Texts (footer with metrics) */
2139
- translateCustomFooterTexts() {
2140
- var _a, _b;
2141
- if (this.slickFooter && ((_a = this.translaterService) === null || _a === void 0 ? void 0 : _a.translate)) {
2142
- (_b = this.slickFooter) === null || _b === void 0 ? void 0 : _b.translateCustomFooterTexts();
2143
- }
2144
- }
2145
2033
  translateColumnHeaderTitleKeys() {
2146
2034
  // translate all columns (including hidden columns)
2147
2035
  this.extensionUtility.translateItems(this.sharedService.allColumns, 'nameKey', 'name');
@@ -2178,7 +2066,7 @@ class AngularSlickgridComponent {
2178
2066
  AngularSlickgridComponent.decorators = [
2179
2067
  { type: Component, args: [{
2180
2068
  selector: 'angular-slickgrid',
2181
- template: "<div id=\"slickGridContainer-{{gridId}}\" class=\"gridPane\">\n <div attr.id='{{gridId}}' class=\"slickgrid-container\" style=\"width: 100%\">\n </div>\n\n <!-- Pagination section under the grid -->\n <slick-pagination id=\"slickPagingContainer-{{gridId}}\" *ngIf=\"showPagination\"\n [gridOptions]=\"gridOptions\"\n [paginationService]=\"paginationService\">\n </slick-pagination>\n</div>",
2069
+ template: "<div id=\"slickGridContainer-{{gridId}}\" class=\"gridPane\">\r\n <div attr.id='{{gridId}}' class=\"slickgrid-container\" style=\"width: 100%\">\r\n </div>\r\n</div>",
2182
2070
  providers: [
2183
2071
  // make everything transient (non-singleton)
2184
2072
  AngularUtilService,
@@ -2231,11 +2119,9 @@ AngularSlickgridModule.decorators = [
2231
2119
  ],
2232
2120
  declarations: [
2233
2121
  AngularSlickgridComponent,
2234
- SlickPaginationComponent
2235
2122
  ],
2236
2123
  exports: [
2237
2124
  AngularSlickgridComponent,
2238
- SlickPaginationComponent
2239
2125
  ],
2240
2126
  entryComponents: [AngularSlickgridComponent]
2241
2127
  },] }
@@ -2245,5 +2131,5 @@ AngularSlickgridModule.decorators = [
2245
2131
  * Generated bundle index. Do not edit.
2246
2132
  */
2247
2133
 
2248
- export { AngularSlickgridComponent, AngularSlickgridModule, AngularUtilService, BsDropDownService, RowDetailViewExtension, SlickPaginationComponent, SlickgridConfig, unsubscribeAllObservables, ContainerService as ɵb, TranslaterService as ɵc };
2134
+ export { AngularSlickgridComponent, AngularSlickgridModule, AngularUtilService, BsDropDownService, RowDetailViewExtension, SlickgridConfig, unsubscribeAllObservables, ContainerService as ɵb, TranslaterService as ɵc };
2249
2135
  //# sourceMappingURL=angular-slickgrid.js.map