angular-slickgrid 6.6.5 → 7.0.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.
@@ -1,4 +1,4 @@
1
- import { unsubscribeAll, SlickRowSelectionModel, castObservableToPromise, addToArrayWhenNotExists, Filters, OperatorType, EventNamingStyle, FileType, DelimiterType, SlickgridConfig as SlickgridConfig$1, BackendUtilityService, GridEventService, SharedService, CollectionService, ExtensionUtility, FilterFactory, FilterService, ResizerService, SortService, TreeDataService, PaginationService, ExtensionService, GridStateService, GridService, GroupingAndColspanService, emptyElement, SlickGroupItemMetadataProvider, autoAddEditorFormatterToColumnsWithEditor, GridStateType, ExtensionName } from '@slickgrid-universal/common';
1
+ import { unsubscribeAll, SlickRowSelectionModel, castObservableToPromise, addToArrayWhenNotExists, Filters, OperatorType, EventNamingStyle, FileType, DelimiterType, SlickEventHandler, SlickgridConfig as SlickgridConfig$1, BackendUtilityService, GridEventService, SharedService, CollectionService, ExtensionUtility, FilterFactory, FilterService, ResizerService, SortService, TreeDataService, PaginationService, ExtensionService, GridStateService, GridService, GroupingAndColspanService, emptyElement, SlickGroupItemMetadataProvider, SlickDataView, autoAddEditorFormatterToColumnsWithEditor, SlickGrid, GridStateType, Utils, ExtensionName } from '@slickgrid-universal/common';
2
2
  export * from '@slickgrid-universal/common';
3
3
  import * as i0 from '@angular/core';
4
4
  import { Injectable, Optional, EventEmitter, ApplicationRef, Component, Inject, Input, Output, NgModule } from '@angular/core';
@@ -7,10 +7,6 @@ import { TranslateModule } from '@ngx-translate/core';
7
7
  import { SlickRowDetailView as SlickRowDetailView$1 } from '@slickgrid-universal/row-detail-view-plugin';
8
8
  import { Observable } from 'rxjs';
9
9
  import * as DOMPurify from 'dompurify';
10
- import 'slickgrid/slick.core';
11
- import 'slickgrid/slick.interactions';
12
- import 'slickgrid/slick.grid';
13
- import 'slickgrid/slick.dataview';
14
10
  import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
15
11
  import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component';
16
12
  import { SlickFooterComponent } from '@slickgrid-universal/custom-footer-component';
@@ -95,12 +91,12 @@ class AngularUtilService {
95
91
  }
96
92
  return componentOutput;
97
93
  }
98
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AngularUtilService, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Injectable });
99
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AngularUtilService });
94
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AngularUtilService, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Injectable });
95
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AngularUtilService });
100
96
  }
101
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AngularUtilService, decorators: [{
97
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AngularUtilService, decorators: [{
102
98
  type: Injectable
103
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });
99
+ }], ctorParameters: () => [{ type: i0.ViewContainerRef }] });
104
100
 
105
101
  class ContainerService {
106
102
  dependencies = [];
@@ -120,10 +116,10 @@ class ContainerService {
120
116
  this.dependencies.push({ key, instance });
121
117
  }
122
118
  }
123
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ContainerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
124
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ContainerService });
119
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: ContainerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
120
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: ContainerService });
125
121
  }
126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ContainerService, decorators: [{
122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: ContainerService, decorators: [{
127
123
  type: Injectable
128
124
  }] });
129
125
 
@@ -159,14 +155,14 @@ class TranslaterService {
159
155
  translate(translationKey) {
160
156
  return this.translateService?.instant?.(translationKey || ' ');
161
157
  }
162
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslaterService, deps: [{ token: i1.TranslateService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
163
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslaterService });
158
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: TranslaterService, deps: [{ token: i1.TranslateService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
159
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: TranslaterService });
164
160
  }
165
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslaterService, decorators: [{
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: TranslaterService, decorators: [{
166
162
  type: Injectable
167
- }], ctorParameters: function () { return [{ type: i1.TranslateService, decorators: [{
163
+ }], ctorParameters: () => [{ type: i1.TranslateService, decorators: [{
168
164
  type: Optional
169
- }] }]; } });
165
+ }] }] });
170
166
 
171
167
  /**
172
168
  * Unsubscribe all Observables Subscriptions
@@ -423,7 +419,7 @@ class SlickRowDetailView extends SlickRowDetailView$1 {
423
419
  */
424
420
  notifyTemplate(item) {
425
421
  if (this.onAsyncResponse) {
426
- this.onAsyncResponse.notify({ item }, undefined, this);
422
+ this.onAsyncResponse.notify({ item, itemDetail: item }, undefined, this);
427
423
  }
428
424
  }
429
425
  /**
@@ -481,7 +477,7 @@ class SlickRowDetailView extends SlickRowDetailView$1 {
481
477
  }
482
478
  }
483
479
  /** When Row comes back to Viewport Range, we need to redraw the View */
484
- handleOnRowBackToViewportRange(e, args) {
480
+ handleOnRowBackToViewportRange(_e, args) {
485
481
  if (args?.item) {
486
482
  this.redrawAllViewComponents();
487
483
  }
@@ -507,7 +503,6 @@ const GlobalGridOptions = {
507
503
  cssClass: 'slick-cell-checkboxsel'
508
504
  },
509
505
  columnPicker: {
510
- fadeSpeed: 0,
511
506
  hideForceFitButton: false,
512
507
  hideSyncResizeButton: true,
513
508
  headerColumnValueExtractor: pickerHeaderColumnValueExtractor
@@ -836,7 +831,6 @@ class Constants {
836
831
  static VALIDATION_EDITOR_TEXT_MIN_LENGTH_INCLUSIVE = 'Please make sure your text is at least {{minLength}} character(s)';
837
832
  }
838
833
 
839
- // import 3rd party vendor libs
840
834
  class AngularSlickgridComponent {
841
835
  angularUtilService;
842
836
  appRef;
@@ -849,7 +843,7 @@ class AngularSlickgridComponent {
849
843
  _dataset;
850
844
  _columnDefinitions;
851
845
  _currentDatasetLength = 0;
852
- _eventHandler = new Slick.EventHandler();
846
+ _eventHandler = new SlickEventHandler();
853
847
  _eventPubSubService;
854
848
  _angularGridInstances;
855
849
  _hideHeaderRowAfterPageLoad = false;
@@ -1058,11 +1052,7 @@ class AngularSlickgridComponent {
1058
1052
  }
1059
1053
  // save resource refs to register before the grid options are merged and possibly deep copied
1060
1054
  // since a deep copy of grid options would lose original resource refs but we want to keep them as singleton
1061
- this._registeredResources = this.gridOptions?.externalResources || this.gridOptions?.registerExternalResources || [];
1062
- /* istanbul ignore if */
1063
- if (this.gridOptions?.registerExternalResources) {
1064
- console.warn('[Angular-Slickgrid] Please note that the grid option `registerExternalResources` was deprecated and will be removed in next major, please use `externalResources` instead.');
1065
- }
1055
+ this._registeredResources = this.gridOptions?.externalResources || [];
1066
1056
  this.initialization(this._eventHandler);
1067
1057
  this._isGridInitialized = true;
1068
1058
  // recheck the empty warning message after grid is shown so that it works in every use case
@@ -1180,14 +1170,14 @@ class AngularSlickgridComponent {
1180
1170
  this._isLocalGrid = !this.backendServiceApi; // considered a local grid if it doesn't have a backend service set
1181
1171
  this.createBackendApiInternalPostProcessCallback(this.gridOptions);
1182
1172
  if (!this.customDataView) {
1183
- const dataviewInlineFilters = this.gridOptions.dataView && this.gridOptions.dataView.inlineFilters || false;
1184
- let dataViewOptions = { inlineFilters: dataviewInlineFilters };
1173
+ const dataviewInlineFilters = this.gridOptions?.dataView?.inlineFilters ?? false;
1174
+ let dataViewOptions = { ...this.gridOptions.dataView, inlineFilters: dataviewInlineFilters };
1185
1175
  if (this.gridOptions.draggableGrouping || this.gridOptions.enableGrouping) {
1186
1176
  this.groupItemMetadataProvider = new SlickGroupItemMetadataProvider();
1187
1177
  this.sharedService.groupItemMetadataProvider = this.groupItemMetadataProvider;
1188
1178
  dataViewOptions = { ...dataViewOptions, groupItemMetadataProvider: this.groupItemMetadataProvider };
1189
1179
  }
1190
- this.dataView = new Slick.Data.DataView(dataViewOptions);
1180
+ this.dataView = new SlickDataView(dataViewOptions, this._eventPubSubService);
1191
1181
  this._eventPubSubService.publish('onDataviewCreated', this.dataView);
1192
1182
  }
1193
1183
  // get any possible Services that user want to register which don't require SlickGrid to be instantiated
@@ -1219,10 +1209,13 @@ class AngularSlickgridComponent {
1219
1209
  this.gridOptions = { ...this.gridOptions, ...this.gridOptions.presets.pinning };
1220
1210
  }
1221
1211
  // build SlickGrid Grid, also user might optionally pass a custom dataview (e.g. remote model)
1222
- this.slickGrid = new Slick.Grid(`#${this.gridId}`, this.customDataView || this.dataView, this._columnDefinitions, this.gridOptions);
1212
+ this.slickGrid = new SlickGrid(`#${this.gridId}`, this.customDataView || this.dataView, this._columnDefinitions, this.gridOptions, this._eventPubSubService);
1223
1213
  this.sharedService.dataView = this.dataView;
1224
1214
  this.sharedService.slickGrid = this.slickGrid;
1225
1215
  this.sharedService.gridContainerElement = this.elm.nativeElement;
1216
+ if (this.groupItemMetadataProvider) {
1217
+ this.slickGrid.registerPlugin(this.groupItemMetadataProvider); // register GroupItemMetadataProvider when Grouping is enabled
1218
+ }
1226
1219
  this.extensionService.bindDifferentExtensions();
1227
1220
  this.bindDifferentHooks(this.slickGrid, this.gridOptions, this.dataView);
1228
1221
  // when it's a frozen grid, we need to keep the frozen column id for reference if we ever show/hide column from ColumnPicker/GridMenu afterward
@@ -1441,7 +1434,7 @@ class AngularSlickgridComponent {
1441
1434
  * @param showing
1442
1435
  */
1443
1436
  showHeaderRow(showing = true) {
1444
- this.slickGrid.setHeaderRowVisibility(showing, false);
1437
+ this.slickGrid.setHeaderRowVisibility(showing);
1445
1438
  if (showing === true && this._isGridInitialized) {
1446
1439
  this.slickGrid.setColumns(this.columnDefinitions);
1447
1440
  }
@@ -1490,25 +1483,6 @@ class AngularSlickgridComponent {
1490
1483
  }
1491
1484
  }
1492
1485
  if (dataView && grid) {
1493
- const slickgridEventPrefix = this.gridOptions?.defaultSlickgridEventPrefix ?? '';
1494
- // expose all Slick Grid Events through dispatch
1495
- for (const prop in grid) {
1496
- if (grid.hasOwnProperty(prop) && prop.startsWith('on')) {
1497
- const gridEventName = this._eventPubSubService.getEventNameByNamingConvention(prop, slickgridEventPrefix);
1498
- this._eventHandler.subscribe(grid[prop], (event, args) => {
1499
- return this._eventPubSubService.dispatchCustomEvent(gridEventName, { eventData: event, args });
1500
- });
1501
- }
1502
- }
1503
- // expose all Slick DataView Events through dispatch
1504
- for (const prop in dataView) {
1505
- if (dataView.hasOwnProperty(prop) && prop.startsWith('on')) {
1506
- this._eventHandler.subscribe(dataView[prop], (event, args) => {
1507
- const dataViewEventName = this._eventPubSubService.getEventNameByNamingConvention(prop, slickgridEventPrefix);
1508
- return this._eventPubSubService.dispatchCustomEvent(dataViewEventName, { eventData: event, args });
1509
- });
1510
- }
1511
- }
1512
1486
  // on cell click, mainly used with the columnDef.action callback
1513
1487
  this.gridEventService.bindOnCellChange(grid);
1514
1488
  this.gridEventService.bindOnClick(grid);
@@ -1830,7 +1804,7 @@ class AngularSlickgridComponent {
1830
1804
  // if we have a backendServiceApi and the enablePagination is undefined, we'll assume that we do want to see it, else get that defined value
1831
1805
  gridOptions.enablePagination = ((gridOptions.backendServiceApi && gridOptions.enablePagination === undefined) ? true : gridOptions.enablePagination) || false;
1832
1806
  // use extend to deep merge & copy to avoid immutable properties being changed in GlobalGridOptions after a route change
1833
- const options = Slick.Utils.extend(true, {}, GlobalGridOptions, this.forRootConfig, gridOptions);
1807
+ const options = Utils.extend(true, {}, GlobalGridOptions, this.forRootConfig, gridOptions);
1834
1808
  // using copy extend to do a deep clone has an unwanted side on objects and pageSizes but ES6 spread has other worst side effects
1835
1809
  // so we will just overwrite the pageSizes when needed, this is the only one causing issues so far.
1836
1810
  // On a deep extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not.
@@ -2025,15 +1999,15 @@ class AngularSlickgridComponent {
2025
1999
  currentEditor.renderDomElement(newCollection);
2026
2000
  }
2027
2001
  }
2028
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AngularSlickgridComponent, deps: [{ token: AngularUtilService }, { token: i0.ApplicationRef }, { token: i0.ChangeDetectorRef }, { token: ContainerService }, { token: i0.ElementRef }, { token: i1.TranslateService, optional: true }, { token: TranslaterService, optional: true }, { token: 'config' }, { token: 'externalService' }], target: i0.ɵɵFactoryTarget.Component });
2029
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AngularSlickgridComponent, selector: "angular-slickgrid", inputs: { customDataView: "customDataView", gridId: "gridId", gridOptions: "gridOptions", paginationOptions: "paginationOptions", columnDefinitions: "columnDefinitions", dataset: "dataset", datasetHierarchical: "datasetHierarchical" }, outputs: { columnDefinitionsChange: "columnDefinitionsChange" }, providers: [
2002
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AngularSlickgridComponent, deps: [{ token: AngularUtilService }, { token: i0.ApplicationRef }, { token: i0.ChangeDetectorRef }, { token: ContainerService }, { token: i0.ElementRef }, { token: i1.TranslateService, optional: true }, { token: TranslaterService, optional: true }, { token: 'config' }, { token: 'externalService' }], target: i0.ɵɵFactoryTarget.Component });
2003
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: AngularSlickgridComponent, selector: "angular-slickgrid", inputs: { customDataView: "customDataView", gridId: "gridId", gridOptions: "gridOptions", paginationOptions: "paginationOptions", columnDefinitions: "columnDefinitions", dataset: "dataset", datasetHierarchical: "datasetHierarchical" }, outputs: { columnDefinitionsChange: "columnDefinitionsChange" }, providers: [
2030
2004
  // make everything transient (non-singleton)
2031
2005
  AngularUtilService,
2032
2006
  ApplicationRef,
2033
2007
  TranslaterService,
2034
2008
  ], ngImport: i0, template: "<div id=\"slickGridContainer-{{gridId}}\" class=\"gridPane\">\n <div attr.id='{{gridId}}' class=\"slickgrid-container\" style=\"width: 100%\">\n </div>\n</div>" });
2035
2009
  }
2036
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AngularSlickgridComponent, decorators: [{
2010
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AngularSlickgridComponent, decorators: [{
2037
2011
  type: Component,
2038
2012
  args: [{ selector: 'angular-slickgrid', providers: [
2039
2013
  // make everything transient (non-singleton)
@@ -2041,7 +2015,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
2041
2015
  ApplicationRef,
2042
2016
  TranslaterService,
2043
2017
  ], template: "<div id=\"slickGridContainer-{{gridId}}\" class=\"gridPane\">\n <div attr.id='{{gridId}}' class=\"slickgrid-container\" style=\"width: 100%\">\n </div>\n</div>" }]
2044
- }], ctorParameters: function () { return [{ type: AngularUtilService }, { type: i0.ApplicationRef }, { type: i0.ChangeDetectorRef }, { type: ContainerService }, { type: i0.ElementRef }, { type: i1.TranslateService, decorators: [{
2018
+ }], ctorParameters: () => [{ type: AngularUtilService }, { type: i0.ApplicationRef }, { type: i0.ChangeDetectorRef }, { type: ContainerService }, { type: i0.ElementRef }, { type: i1.TranslateService, decorators: [{
2045
2019
  type: Optional
2046
2020
  }] }, { type: TranslaterService, decorators: [{
2047
2021
  type: Optional
@@ -2051,7 +2025,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
2051
2025
  }] }, { type: undefined, decorators: [{
2052
2026
  type: Inject,
2053
2027
  args: ['externalService']
2054
- }] }]; }, propDecorators: { customDataView: [{
2028
+ }] }], propDecorators: { customDataView: [{
2055
2029
  type: Input
2056
2030
  }], gridId: [{
2057
2031
  type: Input
@@ -2081,13 +2055,13 @@ class AngularSlickgridModule {
2081
2055
  ]
2082
2056
  };
2083
2057
  }
2084
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AngularSlickgridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2085
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AngularSlickgridModule, declarations: [AngularSlickgridComponent], imports: [CommonModule,
2058
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AngularSlickgridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2059
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.7", ngImport: i0, type: AngularSlickgridModule, declarations: [AngularSlickgridComponent], imports: [CommonModule,
2086
2060
  TranslateModule], exports: [AngularSlickgridComponent] });
2087
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AngularSlickgridModule, imports: [CommonModule,
2061
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AngularSlickgridModule, imports: [CommonModule,
2088
2062
  TranslateModule] });
2089
2063
  }
2090
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AngularSlickgridModule, decorators: [{
2064
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AngularSlickgridModule, decorators: [{
2091
2065
  type: NgModule,
2092
2066
  args: [{
2093
2067
  imports: [