angular-slickgrid 3.1.0 → 3.3.2

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.
@@ -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';
@@ -255,7 +256,7 @@ function unsubscribeAllObservables(subscriptions) {
255
256
  return subscriptions;
256
257
  }
257
258
 
258
- const DOMPurify = DOMPurify_; // patch to fix rollup to work
259
+ const DOMPurify = DOMPurify_['default'] || DOMPurify_; // patch to fix rollup to work
259
260
  const ROW_DETAIL_CONTAINER_PREFIX = 'container_';
260
261
  const PRELOAD_CONTAINER_PREFIX = 'container_loading';
261
262
  class RowDetailViewExtension {
@@ -929,138 +930,6 @@ Constants.VALIDATION_EDITOR_TEXT_MAX_LENGTH_INCLUSIVE = 'Please make sure your t
929
930
  Constants.VALIDATION_EDITOR_TEXT_MIN_LENGTH = 'Please make sure your text is more than {{minLength}} character(s)';
930
931
  Constants.VALIDATION_EDITOR_TEXT_MIN_LENGTH_INCLUSIVE = 'Please make sure your text is at least {{minLength}} character(s)';
931
932
 
932
- class SlickPaginationComponent {
933
- /** Constructor */
934
- constructor(translate) {
935
- this.translate = translate;
936
- this.subscriptions = [];
937
- this._enableTranslate = false;
938
- // text translations (handled by ngx-translate or by custom locale)
939
- this.textItemsPerPage = 'items per page';
940
- this.textItems = 'items';
941
- this.textOf = 'of';
942
- this.textPage = 'Page';
943
- }
944
- get availablePageSizes() {
945
- return this.paginationService.availablePageSizes;
946
- }
947
- get dataFrom() {
948
- return this.paginationService.dataFrom;
949
- }
950
- get dataTo() {
951
- return this.paginationService.dataTo;
952
- }
953
- /** is the left side pagination disabled? */
954
- get isLeftPaginationDisabled() {
955
- return this.pageNumber === 1 || this.totalItems === 0;
956
- }
957
- /** is the right side pagination disabled? */
958
- get isRightPaginationDisabled() {
959
- return this.pageNumber === this.pageCount || this.totalItems === 0;
960
- }
961
- get itemsPerPage() {
962
- return this.paginationService.itemsPerPage;
963
- }
964
- get pageCount() {
965
- return this.paginationService.pageCount;
966
- }
967
- get pageNumber() {
968
- return this.paginationService.pageNumber;
969
- }
970
- set pageNumber(page) {
971
- // 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
972
- }
973
- get totalItems() {
974
- return this.paginationService.totalItems;
975
- }
976
- ngOnDestroy() {
977
- this.dispose();
978
- }
979
- ngOnInit() {
980
- this._gridOptions = this.gridOptions || {};
981
- this._enableTranslate = this._gridOptions && this._gridOptions.enableTranslate || false;
982
- this._locales = this._gridOptions && this._gridOptions.locales || Constants.locales;
983
- if (this._enableTranslate && !this.translate) {
984
- throw new Error('[Angular-Slickgrid] requires "ngx-translate" to be installed and configured when the grid option "enableTranslate" is enabled.');
985
- }
986
- this.translateAllUiTexts(this._locales);
987
- // translate all the text using ngx-translate or custom locales
988
- if (this._enableTranslate && this.translate && this.translate.onLangChange) {
989
- this.subscriptions.push(this.translate.onLangChange.subscribe(() => this.translateAllUiTexts(this._locales)));
990
- }
991
- }
992
- changeToFirstPage(event) {
993
- if (!this.isLeftPaginationDisabled) {
994
- this.paginationService.goToFirstPage(event);
995
- }
996
- }
997
- changeToLastPage(event) {
998
- if (!this.isRightPaginationDisabled) {
999
- this.paginationService.goToLastPage(event);
1000
- }
1001
- }
1002
- changeToNextPage(event) {
1003
- if (!this.isRightPaginationDisabled) {
1004
- this.paginationService.goToNextPage(event);
1005
- }
1006
- }
1007
- changeToPreviousPage(event) {
1008
- if (!this.isLeftPaginationDisabled) {
1009
- this.paginationService.goToPreviousPage(event);
1010
- }
1011
- }
1012
- changeToCurrentPage(event) {
1013
- let pageNumber = 1;
1014
- if (event && event.currentTarget && event.currentTarget.value) {
1015
- pageNumber = +(event.currentTarget.value);
1016
- }
1017
- this.paginationService.goToPageNumber(pageNumber, event);
1018
- }
1019
- changeItemPerPage(event) {
1020
- let itemsPerPage = 1;
1021
- if (event && event.currentTarget && event.currentTarget.value) {
1022
- itemsPerPage = +(event.currentTarget.value);
1023
- }
1024
- this.paginationService.changeItemPerPage(itemsPerPage, event);
1025
- }
1026
- dispose() {
1027
- // also unsubscribe all Angular Subscriptions
1028
- this.subscriptions = unsubscribeAllObservables(this.subscriptions);
1029
- }
1030
- // --
1031
- // private functions
1032
- // --------------------
1033
- /** Translate all the texts shown in the UI, use ngx-translate service when available or custom locales when service is null */
1034
- translateAllUiTexts(locales) {
1035
- if (this._enableTranslate && this.translate && this.translate.instant && this.translate.currentLang) {
1036
- const translationPrefix = getTranslationPrefix(this._gridOptions);
1037
- this.textItemsPerPage = this.translate.instant(`${translationPrefix}ITEMS_PER_PAGE`);
1038
- this.textItems = this.translate.instant(`${translationPrefix}ITEMS`);
1039
- this.textOf = this.translate.instant(`${translationPrefix}OF`);
1040
- this.textPage = this.translate.instant(`${translationPrefix}PAGE`);
1041
- }
1042
- else if (locales) {
1043
- this.textItemsPerPage = locales.TEXT_ITEMS_PER_PAGE || 'TEXT_ITEMS_PER_PAGE';
1044
- this.textItems = locales.TEXT_ITEMS || 'TEXT_ITEMS';
1045
- this.textOf = locales.TEXT_OF || 'TEXT_OF';
1046
- this.textPage = locales.TEXT_PAGE || 'TEXT_PAGE';
1047
- }
1048
- }
1049
- }
1050
- SlickPaginationComponent.decorators = [
1051
- { type: Component, args: [{
1052
- selector: 'slick-pagination',
1053
- template: "<div class=\"slick-pagination\">\r\n <div class=\"slick-pagination-nav\">\r\n <nav aria-label=\"Page navigation\">\r\n <ul class=\"pagination\">\r\n <li class=\"page-item\" [ngClass]=\"isLeftPaginationDisabled ? 'disabled' : ''\">\r\n <a class=\"page-link icon-seek-first fa fa-angle-double-left\" aria-label=\"First\"\r\n (click)=\"changeToFirstPage($event)\">\r\n </a>\r\n </li>\r\n <li class=\"page-item\" [ngClass]=\"isLeftPaginationDisabled ? 'disabled' : ''\">\r\n <a class=\"page-link icon-seek-prev fa fa-angle-left\" aria-label=\"Previous\"\r\n (click)=\"changeToPreviousPage($event)\">\r\n </a>\r\n </li>\r\n </ul>\r\n </nav>\r\n\r\n <div class=\"slick-page-number\">\r\n <span>{{textPage}}</span>\r\n <input type=\"text\" class=\"form-control\" data-test=\"page-number-input\" [value]=\"pageNumber\" size=\"1\"\r\n [readOnly]=\"totalItems === 0\" (change)=\"changeToCurrentPage($event)\">\r\n <span>{{textOf}}</span><span data-test=\"page-count\"> {{pageCount}}</span>\r\n </div>\r\n\r\n <nav aria-label=\"Page navigation\">\r\n <ul class=\"pagination\">\r\n <li class=\"page-item\" [ngClass]=\"isRightPaginationDisabled ? 'disabled' : ''\">\r\n <a class=\"page-link icon-seek-next text-center fa fa-lg fa-angle-right\" aria-label=\"Next\"\r\n (click)=\"changeToNextPage($event)\">\r\n </a>\r\n </li>\r\n <li class=\"page-item\" [ngClass]=\"isRightPaginationDisabled ? 'disabled' : ''\">\r\n <a class=\"page-link icon-seek-end fa fa-lg fa-angle-double-right\" aria-label=\"Last\"\r\n (click)=\"changeToLastPage($event)\">\r\n </a>\r\n </li>\r\n </ul>\r\n </nav>\r\n </div>\r\n <span class=\"slick-pagination-settings\">\r\n <select id=\"items-per-page-label\" (change)=\"changeItemPerPage($event)\">\r\n <option value=\"{{pageSize}}\" [selected]=\"pageSize === itemsPerPage\" *ngFor=\"let pageSize of availablePageSizes\">{{pageSize}}</option>\r\n </select>\r\n <span>{{textItemsPerPage}}</span>,\r\n <span class=\"slick-pagination-count\">\r\n <span *ngIf=\"totalItems\">\r\n <span class=\"page-info-from-to\">\r\n <span data-test=\"item-from\">{{dataFrom}}</span>-<span data-test=\"item-to\">{{dataTo}}</span>\r\n {{textOf}}\r\n </span>\r\n </span>\r\n <span class=\"page-info-total-items\">\r\n <span data-test=\"total-items\">{{totalItems}}</span> {{textItems}}\r\n </span>\r\n </span>\r\n </span>\r\n</div>\r\n"
1054
- },] }
1055
- ];
1056
- SlickPaginationComponent.ctorParameters = () => [
1057
- { type: TranslateService, decorators: [{ type: Optional }] }
1058
- ];
1059
- SlickPaginationComponent.propDecorators = {
1060
- gridOptions: [{ type: Input }],
1061
- paginationService: [{ type: Input }]
1062
- };
1063
-
1064
933
  // import 3rd party vendor libs
1065
934
  class AngularSlickgridComponent {
1066
935
  constructor(angularUtilService, appRef, cd, containerService, elm, translate, translaterService, forRootConfig, externalServices) {
@@ -1111,7 +980,7 @@ class AngularSlickgridComponent {
1111
980
  const columnPickerExtension = new ColumnPickerExtension(this.extensionUtility, this.sharedService);
1112
981
  const checkboxExtension = new CheckboxSelectorExtension(this.sharedService);
1113
982
  const draggableGroupingExtension = new DraggableGroupingExtension(this.extensionUtility, this._eventPubSubService, this.sharedService);
1114
- const gridMenuExtension = new GridMenuExtension(this.extensionUtility, this.filterService, this.sharedService, this.sortService, this.backendUtilityService, this.translaterService);
983
+ const gridMenuExtension = new GridMenuExtension(this.extensionUtility, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.backendUtilityService, this.translaterService);
1115
984
  const groupItemMetaProviderExtension = new GroupItemMetaProviderExtension(this.sharedService);
1116
985
  const headerButtonExtension = new HeaderButtonExtension(this.extensionUtility, this.sharedService);
1117
986
  const headerMenuExtension = new HeaderMenuExtension(this.extensionUtility, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.translaterService);
@@ -1205,7 +1074,7 @@ class AngularSlickgridComponent {
1205
1074
  return this.sharedService.hierarchicalDataset;
1206
1075
  }
1207
1076
  set datasetHierarchical(newHierarchicalDataset) {
1208
- var _a, _b, _c, _d;
1077
+ var _a, _b, _c, _d, _f;
1209
1078
  const isDatasetEqual = dequal(newHierarchicalDataset, (_b = (_a = this.sharedService) === null || _a === void 0 ? void 0 : _a.hierarchicalDataset) !== null && _b !== void 0 ? _b : []);
1210
1079
  const prevFlatDatasetLn = this._currentDatasetLength;
1211
1080
  this.sharedService.hierarchicalDataset = newHierarchicalDataset;
@@ -1214,9 +1083,8 @@ class AngularSlickgridComponent {
1214
1083
  }
1215
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
1216
1085
  if (newHierarchicalDataset && this.slickGrid && ((_d = this.sortService) === null || _d === void 0 ? void 0 : _d.processTreeDataInitialSort)) {
1217
- this.dataView.setItems([], this.gridOptions.datasetIdPropertyName);
1086
+ this.dataView.setItems([], (_f = this.gridOptions.datasetIdPropertyName) !== null && _f !== void 0 ? _f : 'id');
1218
1087
  this.sortService.processTreeDataInitialSort();
1219
- this.sortTreeDataset([]);
1220
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
1221
1089
  // however we need 1 cpu cycle before having the DataView refreshed, so we need to wrap this check in a setTimeout
1222
1090
  setTimeout(() => {
@@ -1225,8 +1093,8 @@ class AngularSlickgridComponent {
1225
1093
  this.filterService.refreshTreeDataFilters();
1226
1094
  }
1227
1095
  });
1096
+ this._isDatasetHierarchicalInitialized = true;
1228
1097
  }
1229
- this._isDatasetHierarchicalInitialized = true;
1230
1098
  }
1231
1099
  get elementRef() {
1232
1100
  return this.elm;
@@ -1245,6 +1113,9 @@ class AngularSlickgridComponent {
1245
1113
  set isDatasetInitialized(isInitialized) {
1246
1114
  this._isDatasetInitialized = isInitialized;
1247
1115
  }
1116
+ set isDatasetHierarchicalInitialized(isInitialized) {
1117
+ this._isDatasetHierarchicalInitialized = isInitialized;
1118
+ }
1248
1119
  get registeredResources() {
1249
1120
  return this._registeredResources;
1250
1121
  }
@@ -1263,7 +1134,7 @@ class AngularSlickgridComponent {
1263
1134
  this._eventPubSubService.publish('onAfterGridDestroyed', true);
1264
1135
  }
1265
1136
  destroy(shouldEmptyDomElementContainer = false) {
1266
- var _a, _b, _c, _d, _f, _g;
1137
+ var _a, _b, _c, _d, _f, _g, _h;
1267
1138
  // dispose of all Services
1268
1139
  this.serviceList.forEach((service) => {
1269
1140
  if (service && service.dispose) {
@@ -1282,21 +1153,22 @@ class AngularSlickgridComponent {
1282
1153
  this._registeredResources = [];
1283
1154
  }
1284
1155
  // dispose the Components
1285
- (_a = this.slickFooter) === null || _a === void 0 ? void 0 : _a.dispose();
1286
- (_b = this.slickEmptyWarning) === null || _b === void 0 ? void 0 : _b.dispose();
1287
- 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) {
1288
1160
  this._eventHandler.unsubscribeAll();
1289
1161
  }
1290
- (_d = this._eventPubSubService) === null || _d === void 0 ? void 0 : _d.unsubscribeAll();
1162
+ (_f = this._eventPubSubService) === null || _f === void 0 ? void 0 : _f.unsubscribeAll();
1291
1163
  if (this.dataView) {
1292
- 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) {
1293
1165
  this.dataView.setItems([]);
1294
1166
  }
1295
1167
  if (this.dataView.destroy) {
1296
1168
  this.dataView.destroy();
1297
1169
  }
1298
1170
  }
1299
- 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) {
1300
1172
  this.slickGrid.destroy(shouldEmptyDomElementContainer);
1301
1173
  }
1302
1174
  if (this.backendServiceApi) {
@@ -1350,7 +1222,7 @@ class AngularSlickgridComponent {
1350
1222
  }
1351
1223
  }
1352
1224
  initialization(eventHandler) {
1353
- 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;
1354
1226
  this.gridOptions.translater = this.translaterService;
1355
1227
  this._eventHandler = eventHandler;
1356
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
@@ -1420,13 +1292,14 @@ class AngularSlickgridComponent {
1420
1292
  }
1421
1293
  // user could show a custom footer with the data metrics (dataset length and last updated timestamp)
1422
1294
  if (!this.gridOptions.enablePagination && this.gridOptions.showCustomFooter && this.gridOptions.customFooterOptions && this.gridContainerElement) {
1423
- 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);
1424
1296
  this.slickFooter.renderFooter(this.gridContainerElement);
1425
1297
  }
1426
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)
1427
1300
  const initialDataset = ((_j = this.gridOptions) === null || _j === void 0 ? void 0 : _j.enableTreeData) ? this.sortTreeDataset(this._dataset) : this._dataset;
1428
1301
  this.dataView.beginUpdate();
1429
- this.dataView.setItems(initialDataset || [], this.gridOptions.datasetIdPropertyName);
1302
+ this.dataView.setItems(initialDataset || [], (_k = this.gridOptions.datasetIdPropertyName) !== null && _k !== void 0 ? _k : 'id');
1430
1303
  this.dataView.endUpdate();
1431
1304
  // if you don't want the items that are not visible (due to being filtered out or being on a different page)
1432
1305
  // to stay selected, pass 'false' to the second arg
@@ -1476,13 +1349,13 @@ class AngularSlickgridComponent {
1476
1349
  this.bindResizeHook(this.slickGrid, this.gridOptions);
1477
1350
  // bind the Backend Service API callback functions only after the grid is initialized
1478
1351
  // because the preProcess() and onInit() might get triggered
1479
- 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) {
1480
1353
  this.bindBackendCallbackFunctions(this.gridOptions);
1481
1354
  }
1482
1355
  // local grid, check if we need to show the Pagination
1483
1356
  // if so then also check if there's any presets and finally initialize the PaginationService
1484
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
1485
- 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) {
1486
1359
  this.showPagination = true;
1487
1360
  this.loadLocalGridPagination(this.dataset);
1488
1361
  }
@@ -1490,11 +1363,11 @@ class AngularSlickgridComponent {
1490
1363
  // Slick Grid & DataView objects
1491
1364
  dataView: this.dataView,
1492
1365
  slickGrid: this.slickGrid,
1493
- 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,
1494
1367
  // public methods
1495
1368
  destroy: this.destroy.bind(this),
1496
1369
  // return all available Services (non-singleton)
1497
- 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,
1498
1371
  filterService: this.filterService,
1499
1372
  gridEventService: this.gridEventService,
1500
1373
  gridStateService: this.gridStateService,
@@ -1536,13 +1409,13 @@ class AngularSlickgridComponent {
1536
1409
  * @param dataset
1537
1410
  */
1538
1411
  refreshGridData(dataset, totalCount) {
1539
- var _a, _b, _c, _d, _f;
1412
+ var _a, _b, _c, _d, _f, _g;
1540
1413
  if (this.gridOptions && this.gridOptions.enableEmptyDataWarningMessage && Array.isArray(dataset)) {
1541
1414
  const finalTotalCount = totalCount || dataset.length;
1542
1415
  this.displayEmptyDataWarning(finalTotalCount < 1);
1543
1416
  }
1544
1417
  if (Array.isArray(dataset) && this.slickGrid && ((_a = this.dataView) === null || _a === void 0 ? void 0 : _a.setItems)) {
1545
- this.dataView.setItems(dataset, this.gridOptions.datasetIdPropertyName);
1418
+ this.dataView.setItems(dataset, (_b = this.gridOptions.datasetIdPropertyName) !== null && _b !== void 0 ? _b : 'id');
1546
1419
  if (!this.gridOptions.backendServiceApi && !this.gridOptions.enableTreeData) {
1547
1420
  this.dataView.reSort();
1548
1421
  }
@@ -1560,11 +1433,11 @@ class AngularSlickgridComponent {
1560
1433
  }
1561
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
1562
1435
  this.showPagination = (this.gridOptions && (this.gridOptions.enablePagination || (this.gridOptions.backendServiceApi && this.gridOptions.enablePagination === undefined))) ? true : false;
1563
- 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)) {
1564
1437
  const paginationOptions = this.setPaginationOptionsWhenPresetDefined(this.gridOptions, this._paginationOptions);
1565
1438
  // when we have a totalCount use it, else we'll take it from the pagination object
1566
1439
  // only update the total items if it's different to avoid refreshing the UI
1567
- 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);
1568
1441
  if (totalRecords !== undefined && totalRecords !== this.totalItems) {
1569
1442
  this.totalItems = +totalRecords;
1570
1443
  }
@@ -1651,9 +1524,10 @@ class AngularSlickgridComponent {
1651
1524
  if (gridOptions.enableTranslate) {
1652
1525
  this.translateColumnHeaderTitleKeys();
1653
1526
  this.translateColumnGroupKeys();
1654
- this.translateCustomFooterTexts();
1655
1527
  }
1656
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');
1657
1531
  if (gridOptions.enableTranslate) {
1658
1532
  this.extensionService.translateCellMenu();
1659
1533
  this.extensionService.translateColumnHeaders();
@@ -1661,7 +1535,6 @@ class AngularSlickgridComponent {
1661
1535
  this.extensionService.translateContextMenu();
1662
1536
  this.extensionService.translateGridMenu();
1663
1537
  this.extensionService.translateHeaderMenu();
1664
- this.translateCustomFooterTexts();
1665
1538
  this.translateColumnHeaderTitleKeys();
1666
1539
  this.translateColumnGroupKeys();
1667
1540
  if (gridOptions.createPreHeaderPanel && !gridOptions.enableDraggableGrouping) {
@@ -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\">\r\n <div attr.id='{{gridId}}' class=\"slickgrid-container\" style=\"width: 100%\">\r\n </div>\r\n\r\n <!-- Pagination section under the grid -->\r\n <slick-pagination id=\"slickPagingContainer-{{gridId}}\" *ngIf=\"showPagination\"\r\n [gridOptions]=\"gridOptions\"\r\n [paginationService]=\"paginationService\">\r\n </slick-pagination>\r\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