angular-slickgrid 10.11.2 → 11.0.0-beta.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,1663 +1,1829 @@
1
- import { GlobalGridOptions as GlobalGridOptions$1, SlickEventHandler, SlickgridConfig as SlickgridConfig$1, BackendUtilityService, GridEventService, SharedService, CollectionService, ExtensionUtility, FilterFactory, FilterService, ResizerService, SortService, TreeDataService, PaginationService, ExtensionService, GridStateService, GridService, HeaderGroupingService, unsubscribeAll, emptyElement, Constants, SlickGroupItemMetadataProvider, SlickDataView, autoAddEditorFormatterToColumnsWithEditor, SlickGrid, PluginFlagMappings, isColumnDateType } from '@slickgrid-universal/common';
2
- export * from '@slickgrid-universal/common';
3
- import * as i0 from '@angular/core';
4
- import { ViewContainerRef, Injectable, Inject, Optional, EventEmitter, output, Component, ContentChild, Input, Output } from '@angular/core';
5
- import * as i1 from '@ngx-translate/core';
6
- import { NgTemplateOutlet } from '@angular/common';
7
- import { SlickFooterComponent } from '@slickgrid-universal/custom-footer-component';
8
- import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component';
9
- import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
10
- import { SlickPaginationComponent } from '@slickgrid-universal/pagination-component';
11
- import { RxJsResource } from '@slickgrid-universal/rxjs-observable';
12
- import { extend } from '@slickgrid-universal/utils';
13
- import { dequal } from 'dequal/lite';
14
-
15
- class AngularUtilService {
16
- vcr;
17
- constructor(vcr) {
18
- this.vcr = vcr;
19
- }
20
- createInteractiveAngularComponent(component, targetElement, data, createCompOptions) {
21
- // Create a component reference from the component
22
- const componentRef = this.vcr.createComponent(component, createCompOptions);
23
- // user could provide data to assign to the component instance
24
- if (componentRef?.instance && data) {
25
- Object.assign(componentRef.instance, data);
26
- }
27
- // Get DOM element from component
28
- let domElem = null;
29
- const viewRef = componentRef.hostView;
30
- if (viewRef && Array.isArray(viewRef.rootNodes) && viewRef.rootNodes[0]) {
31
- domElem = viewRef.rootNodes[0];
32
- // when user provides the DOM element target, we will move the dynamic component into that target (aka portal-ing it)
33
- if (targetElement && domElem) {
34
- targetElement.replaceChildren(componentRef.location.nativeElement);
35
- }
36
- }
37
- return { componentRef, domElement: domElem };
38
- }
39
- /**
40
- * Dynamically create an Angular component, user could also provide optional arguments for target, data & createComponent options
41
- * @param {Component} component
42
- * @param {HTMLElement} [targetElement]
43
- * @param {*} [data]
44
- * @param {CreateComponentOption} [createCompOptions]
45
- * @returns
46
- */
47
- createAngularComponent(component, targetElement, data, createCompOptions) {
48
- // Create a component reference from the component
49
- const componentRef = this.vcr.createComponent(component, createCompOptions);
50
- // user could provide data to assign to the component instance
51
- if (componentRef?.instance && data) {
52
- Object.assign(componentRef.instance, data);
53
- }
54
- // Get DOM element from component
55
- let domElem = null;
56
- const viewRef = componentRef.hostView;
57
- // get DOM element from the new dynamic Component, make sure this is read after any data
58
- if (viewRef && Array.isArray(viewRef.rootNodes) && viewRef.rootNodes[0]) {
59
- domElem = viewRef.rootNodes[0];
60
- // when user provides the DOM element target, we will read the new Component html and use it to replace the target html
61
- if (targetElement && domElem) {
62
- targetElement.innerHTML =
63
- typeof createCompOptions?.sanitizer === 'function' ? createCompOptions.sanitizer(domElem.innerHTML || '') : domElem.innerHTML;
64
- }
65
- }
66
- return { componentRef, domElement: domElem };
67
- }
68
- /**
69
- * Dynamically create an Angular component and append it to the DOM unless a target element is provided,
70
- * user could also provide other optional arguments for data & createComponent options.
71
- * @param {Component} component
72
- * @param {HTMLElement} [targetElement]
73
- * @param {*} [data]
74
- * @param {CreateComponentOption} [createCompOptions]
75
- * @returns
76
- */
77
- createAngularComponentAppendToDom(component, targetElement, data, createCompOptions) {
78
- const componentOutput = this.createAngularComponent(component, targetElement, data, createCompOptions);
79
- // Append DOM element to the HTML element specified
80
- if (targetElement?.replaceChildren) {
81
- targetElement.replaceChildren(componentOutput.domElement);
82
- }
83
- else {
84
- document.body.appendChild(componentOutput.domElement); // when no target provided, we'll simply add it to the HTML Body
85
- }
86
- return componentOutput;
87
- }
88
- static ɵfac = function AngularUtilService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AngularUtilService)(i0.ɵɵinject(ViewContainerRef)); };
89
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AngularUtilService, factory: AngularUtilService.ɵfac });
90
- }
91
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AngularUtilService, [{
92
- type: Injectable
93
- }], () => [{ type: i0.ViewContainerRef, decorators: [{
94
- type: Inject,
95
- args: [ViewContainerRef]
96
- }] }], null); })();
97
-
98
- class ContainerService {
99
- dependencies = [];
100
- get(key) {
101
- const dependency = this.dependencies.find((dep) => dep.key === key);
102
- if (dependency?.instance) {
103
- return dependency.instance;
104
- }
105
- return null;
106
- }
107
- dispose() {
108
- this.dependencies = [];
109
- }
110
- registerInstance(key, instance) {
111
- const dependency = this.dependencies.some((dep) => dep.key === key);
112
- if (!dependency) {
113
- this.dependencies.push({ key, instance });
114
- }
115
- }
116
- static ɵfac = function ContainerService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ContainerService)(); };
117
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ContainerService, factory: ContainerService.ɵfac, providedIn: 'root' });
118
- }
119
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ContainerService, [{
120
- type: Injectable,
121
- args: [{
122
- providedIn: 'root', // This ensures it can be injected anywhere
123
- }]
124
- }], null, null); })();
125
-
126
- /**
127
- * This is a Translate Service Wrapper for Slickgrid-Universal monorepo lib to work properly,
128
- * it must implement Slickgrid-Universal TranslaterService interface to work properly
129
- */
130
- class TranslaterService {
131
- translateService;
132
- constructor(translateService) {
133
- this.translateService = translateService;
134
- }
135
- /**
136
- * Method to return the current language used by the App
137
- * @return {string} current language
138
- */
139
- getCurrentLanguage() {
140
- return this.translateService?.getCurrentLang?.() ?? '';
141
- }
142
- /**
143
- * Method to set the language to use in the App and Translate Service
144
- * @param {string} language
145
- * @return {Promise} output
146
- */
147
- async use(newLang) {
148
- return this.translateService?.use?.(newLang);
149
- }
150
- /**
151
- * Method which receives a translation key and returns the translated value assigned to that key
152
- * @param {string} translation key
153
- * @return {string} translated value
154
- */
155
- translate(translationKey) {
156
- return this.translateService?.instant?.(translationKey || ' ');
157
- }
158
- static ɵfac = function TranslaterService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TranslaterService)(i0.ɵɵinject(i1.TranslateService, 8)); };
159
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TranslaterService, factory: TranslaterService.ɵfac });
160
- }
161
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TranslaterService, [{
162
- type: Injectable
163
- }], () => [{ type: i1.TranslateService, decorators: [{
164
- type: Optional
165
- }] }], null); })();
166
-
167
- /**
168
- * Unsubscribe all Observables Subscriptions
169
- * It will return an empty array if it all went well
170
- * @param subscriptions
171
- */
1
+ import { BackendUtilityService, CollectionService, Constants, ExtensionService, ExtensionUtility, FilterFactory, FilterService, GlobalGridOptions, GridEventService, GridService, GridStateService, HeaderGroupingService, PaginationService, PluginFlagMappings, ResizerService, SharedService, SlickDataView, SlickEventHandler, SlickGrid, SlickGroupItemMetadataProvider, SlickgridConfig as SlickgridConfig$1, SortService, TreeDataService, autoAddEditorFormatterToColumnsWithEditor, emptyElement, getIconSetOptions, hasStringDateColumns, unsubscribeAll } from "@slickgrid-universal/common";
2
+ import * as i0 from "@angular/core";
3
+ import { Component, ContentChild, EventEmitter, Inject, Injectable, Input, Optional, Output, Service, ViewContainerRef, output } from "@angular/core";
4
+ import * as i1 from "@ngx-translate/core";
5
+ import { NgTemplateOutlet } from "@angular/common";
6
+ import { SlickFooterComponent } from "@slickgrid-universal/custom-footer-component";
7
+ import { SlickEmptyWarningComponent } from "@slickgrid-universal/empty-warning-component";
8
+ import { EventPubSubService } from "@slickgrid-universal/event-pub-sub";
9
+ import { SlickPaginationComponent } from "@slickgrid-universal/pagination-component";
10
+ import { RxJsResource } from "@slickgrid-universal/rxjs-observable";
11
+ import { extend } from "@slickgrid-universal/utils";
12
+ import { dequal } from "dequal/lite";
13
+ export * from "@slickgrid-universal/common";
14
+ var AngularUtilService = class AngularUtilService {
15
+ vcr;
16
+ constructor(vcr) {
17
+ this.vcr = vcr;
18
+ }
19
+ createInteractiveAngularComponent(component, targetElement, data, createCompOptions) {
20
+ const componentRef = this.vcr.createComponent(component, createCompOptions);
21
+ if (componentRef?.instance && data) Object.assign(componentRef.instance, data);
22
+ let domElem = null;
23
+ const viewRef = componentRef.hostView;
24
+ if (viewRef && Array.isArray(viewRef.rootNodes) && viewRef.rootNodes[0]) {
25
+ domElem = viewRef.rootNodes[0];
26
+ if (targetElement && domElem) targetElement.replaceChildren(componentRef.location.nativeElement);
27
+ }
28
+ return {
29
+ componentRef,
30
+ domElement: domElem
31
+ };
32
+ }
33
+ createAngularComponent(component, targetElement, data, createCompOptions) {
34
+ const componentRef = this.vcr.createComponent(component, createCompOptions);
35
+ if (componentRef?.instance && data) Object.assign(componentRef.instance, data);
36
+ let domElem = null;
37
+ const viewRef = componentRef.hostView;
38
+ if (viewRef && Array.isArray(viewRef.rootNodes) && viewRef.rootNodes[0]) {
39
+ domElem = viewRef.rootNodes[0];
40
+ if (targetElement && domElem) targetElement.innerHTML = typeof createCompOptions?.sanitizer === "function" ? createCompOptions.sanitizer(domElem.innerHTML || "") : domElem.innerHTML;
41
+ }
42
+ return {
43
+ componentRef,
44
+ domElement: domElem
45
+ };
46
+ }
47
+ createAngularComponentAppendToDom(component, targetElement, data, createCompOptions) {
48
+ const componentOutput = this.createAngularComponent(component, targetElement, data, createCompOptions);
49
+ if (targetElement?.replaceChildren) targetElement.replaceChildren(componentOutput.domElement);
50
+ else document.body.appendChild(componentOutput.domElement);
51
+ return componentOutput;
52
+ }
53
+ static ɵfac = function AngularUtilService_Factory(__ngFactoryType__) {
54
+ return new (__ngFactoryType__ || AngularUtilService)(i0.ɵɵinject(ViewContainerRef));
55
+ };
56
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({
57
+ token: AngularUtilService,
58
+ factory: AngularUtilService.ɵfac
59
+ });
60
+ };
61
+ (() => {
62
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AngularUtilService, [{ type: Injectable }], () => [{
63
+ type: i0.ViewContainerRef,
64
+ decorators: [{
65
+ type: Inject,
66
+ args: [ViewContainerRef]
67
+ }]
68
+ }], null);
69
+ })();
70
+ var ContainerService = class ContainerService {
71
+ dependencies = [];
72
+ get(key) {
73
+ const dependency = this.dependencies.find((dep) => dep.key === key);
74
+ if (dependency?.instance) return dependency.instance;
75
+ return null;
76
+ }
77
+ dispose() {
78
+ this.dependencies = [];
79
+ }
80
+ registerInstance(key, instance) {
81
+ if (!this.dependencies.some((dep) => dep.key === key)) this.dependencies.push({
82
+ key,
83
+ instance
84
+ });
85
+ }
86
+ static ɵfac = function ContainerService_Factory(__ngFactoryType__) {
87
+ return new (__ngFactoryType__ || ContainerService)();
88
+ };
89
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineService({
90
+ token: ContainerService,
91
+ factory: ContainerService.ɵfac
92
+ });
93
+ };
94
+ (() => {
95
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ContainerService, [{ type: Service }], null, null);
96
+ })();
97
+ var TranslaterService = class TranslaterService {
98
+ translateService;
99
+ constructor(translateService) {
100
+ this.translateService = translateService;
101
+ }
102
+ getCurrentLanguage() {
103
+ return this.translateService?.getCurrentLang?.() ?? "";
104
+ }
105
+ async use(newLang) {
106
+ return this.translateService?.use?.(newLang);
107
+ }
108
+ translate(translationKey) {
109
+ return this.translateService?.instant?.(translationKey || " ");
110
+ }
111
+ static ɵfac = function TranslaterService_Factory(__ngFactoryType__) {
112
+ return new (__ngFactoryType__ || TranslaterService)(i0.ɵɵinject(i1.TranslateService, 8));
113
+ };
114
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({
115
+ token: TranslaterService,
116
+ factory: TranslaterService.ɵfac
117
+ });
118
+ };
119
+ (() => {
120
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TranslaterService, [{ type: Injectable }], () => [{
121
+ type: i1.TranslateService,
122
+ decorators: [{ type: Optional }]
123
+ }], null);
124
+ })();
172
125
  function unsubscribeAllObservables(subscriptions) {
173
- if (Array.isArray(subscriptions)) {
174
- let subscription = subscriptions.pop();
175
- while (subscription) {
176
- if (typeof subscription.unsubscribe === 'function') {
177
- subscription.unsubscribe();
178
- }
179
- subscription = subscriptions.pop();
180
- }
181
- }
126
+ if (Array.isArray(subscriptions)) {
127
+ let subscription = subscriptions.pop();
128
+ while (subscription) {
129
+ if (typeof subscription.unsubscribe === "function") subscription.unsubscribe();
130
+ subscription = subscriptions.pop();
131
+ }
132
+ }
182
133
  }
183
-
184
- /** Global Grid Options Defaults */
185
- const GlobalGridOptions = {
186
- ...GlobalGridOptions$1,
187
- eventNamingStyle: 'camelCase',
188
- // technically speaking the Row Detail requires the process & viewComponent but we'll ignore it just to set certain options
189
- rowDetailView: {
190
- collapseAllOnSort: true,
191
- cssClass: 'detail-view-toggle',
192
- panelRows: 1,
193
- keyPrefix: '__',
194
- useRowClick: false,
195
- saveDetailViewOnScroll: false,
196
- },
134
+ const GlobalGridOptions$1 = {
135
+ ...GlobalGridOptions,
136
+ eventNamingStyle: "camelCase",
137
+ rowDetailView: {
138
+ collapseAllOnSort: true,
139
+ cssClass: "detail-view-toggle",
140
+ panelRows: 1,
141
+ keyPrefix: "__",
142
+ useRowClick: false,
143
+ saveDetailViewOnScroll: false
144
+ }
145
+ };
146
+ var SlickgridConfig = class {
147
+ options;
148
+ constructor() {
149
+ this.options = GlobalGridOptions$1;
150
+ }
197
151
  };
198
-
199
- class SlickgridConfig {
200
- options;
201
- constructor() {
202
- this.options = GlobalGridOptions;
203
- }
204
- }
205
-
206
152
  const _c0 = ["slickgridHeader"];
207
153
  const _c1 = ["slickgridFooter"];
208
- function AngularSlickgridComponent_ng_container_3_Template(rf, ctx) { if (rf & 1) {
209
- i0.ɵɵelementContainer(0);
210
- } }
211
- function AngularSlickgridComponent_ng_container_7_Template(rf, ctx) { if (rf & 1) {
212
- i0.ɵɵelementContainer(0);
213
- } }
214
- const WARN_NO_PREPARSE_DATE_SIZE = 10000; // data size to warn user when pre-parse isn't enabled
215
- class AngularSlickgridComponent {
216
- angularUtilService;
217
- appRef;
218
- containerService;
219
- elm;
220
- translate;
221
- translaterService;
222
- forRootConfig;
223
- _dataset;
224
- _columns;
225
- _currentDatasetLength = 0;
226
- _darkMode = false;
227
- _eventHandler = new SlickEventHandler();
228
- _eventPubSubService;
229
- _angularGridInstances;
230
- _hideHeaderRowAfterPageLoad = false;
231
- _isAutosizeColsCalled = false;
232
- _isGridInitialized = false;
233
- _isDatasetInitialized = false;
234
- _isDatasetHierarchicalInitialized = false;
235
- _isPaginationInitialized = false;
236
- _isLocalGrid = true;
237
- _paginationOptions;
238
- _registeredResources = [];
239
- _scrollEndCalled = false;
240
- dataView;
241
- slickGrid;
242
- groupingDefinition = {};
243
- groupItemMetadataProvider;
244
- backendServiceApi;
245
- locales;
246
- metrics;
247
- showPagination = false;
248
- serviceList = [];
249
- totalItems = 0;
250
- paginationData;
251
- subscriptions = [];
252
- // components / plugins
253
- slickEmptyWarning;
254
- slickFooter;
255
- slickPagination;
256
- paginationComponent;
257
- slickRowDetailView;
258
- // services
259
- backendUtilityService;
260
- collectionService;
261
- extensionService;
262
- extensionUtility;
263
- filterFactory;
264
- filterService;
265
- gridEventService;
266
- gridService;
267
- gridStateService;
268
- headerGroupingService;
269
- paginationService;
270
- resizerService;
271
- rxjs;
272
- sharedService;
273
- sortService;
274
- treeDataService;
275
- customDataView;
276
- gridId = '';
277
- options = {};
278
- containerClasses = undefined;
279
- get paginationOptions() {
280
- return this._paginationOptions;
281
- }
282
- set paginationOptions(newPaginationOptions) {
283
- if (newPaginationOptions && this._paginationOptions) {
284
- this._paginationOptions = { ...this.options.pagination, ...this._paginationOptions, ...newPaginationOptions };
285
- }
286
- else {
287
- this._paginationOptions = newPaginationOptions;
288
- }
289
- this.options.pagination = this._paginationOptions ?? this.options.pagination;
290
- this.paginationService.updateTotalItems(this.options.pagination?.totalItems ?? 0, true);
291
- }
292
- get columns() {
293
- return this._columns;
294
- }
295
- set columns(columns) {
296
- this._columns = columns;
297
- if (this._isGridInitialized) {
298
- this.updateColumnDefinitionsList(columns);
299
- }
300
- if (columns.length > 0) {
301
- this.copyColumnWidthsReference(columns);
302
- }
303
- }
304
- // make the columnDefinitions a 2-way binding so that plugin adding cols
305
- // are synched on user's side as well (RowMove, RowDetail, RowSelections)
306
- columnsChange = new EventEmitter(true);
307
- // SlickGrid events
308
- onActiveCellChanged = output();
309
- onActiveCellPositionChanged = output();
310
- onAddNewRow = output();
311
- onAutosizeColumns = output();
312
- onBeforeAppendCell = output();
313
- onBeforeCellEditorDestroy = output();
314
- onBeforeColumnsResize = output();
315
- onBeforeDestroy = output();
316
- onBeforeEditCell = output();
317
- onBeforeHeaderCellDestroy = output();
318
- onBeforeHeaderRowCellDestroy = output();
319
- onBeforeFooterRowCellDestroy = output();
320
- onBeforeSetColumns = output();
321
- onBeforeSort = output();
322
- onCellChange = output();
323
- onCellCssStylesChanged = output();
324
- onClick = output();
325
- onColumnsDrag = output();
326
- onColumnsReordered = output();
327
- onColumnsResized = output();
328
- onColumnsResizeDblClick = output();
329
- onCompositeEditorChange = output();
330
- onContextMenu = output();
331
- onDrag = output();
332
- onDragEnd = output();
333
- onDragInit = output();
334
- onDragStart = output();
335
- onDragReplaceCells = output();
336
- onDblClick = output();
337
- onFooterContextMenu = output();
338
- onFooterRowCellRendered = output();
339
- onHeaderCellRendered = output();
340
- onFooterClick = output();
341
- onHeaderClick = output();
342
- onHeaderContextMenu = output();
343
- onHeaderMouseEnter = output();
344
- onHeaderMouseLeave = output();
345
- onHeaderRowCellRendered = output();
346
- onHeaderRowMouseEnter = output();
347
- onHeaderRowMouseLeave = output();
348
- onKeyDown = output();
349
- onMouseEnter = output();
350
- onMouseLeave = output();
351
- onValidationError = output();
352
- onViewportChanged = output();
353
- onRendered = output();
354
- onSelectedRowsChanged = output();
355
- onSetOptions = output();
356
- onScroll = output();
357
- onSort = output();
358
- // DataView events
359
- onBeforePagingInfoChanged = output();
360
- onGroupExpanded = output();
361
- onGroupCollapsed = output();
362
- onPagingInfoChanged = output();
363
- onRowCountChanged = output();
364
- onRowsChanged = output();
365
- onRowsOrCountChanged = output();
366
- onSelectedRowIdsChanged = output();
367
- onSetItemsCalled = output();
368
- // other Slick Events
369
- onAfterMenuShow = output();
370
- onBeforeMenuClose = output();
371
- onBeforeMenuShow = output();
372
- onColumnsChanged = output();
373
- onCommand = output();
374
- onGridMenuColumnsChanged = output();
375
- onMenuClose = output();
376
- onCopyCells = output();
377
- onCopyCancelled = output();
378
- onPasteCells = output();
379
- onBeforePasteCell = output();
380
- // Slickgrid-Universal events
381
- onAfterExportToExcel = output();
382
- onBeforeExportToExcel = output();
383
- onBeforeFilterChange = output();
384
- onBeforeFilterClear = output();
385
- onBeforeSearchChange = output();
386
- onBeforeSortChange = output();
387
- onContextMenuClearGrouping = output();
388
- onContextMenuCollapseAllGroups = output();
389
- onContextMenuExpandAllGroups = output();
390
- onOptionSelected = output();
391
- onColumnPickerColumnsChanged = output();
392
- onGridMenuMenuClose = output();
393
- onGridMenuBeforeMenuShow = output();
394
- onGridMenuAfterMenuShow = output();
395
- onGridMenuClearAllPinning = output();
396
- onGridMenuClearAllFilters = output();
397
- onGridMenuClearAllSorting = output();
398
- onGridMenuCommand = output();
399
- onHeaderButtonCommand = output();
400
- onHeaderMenuCommand = output();
401
- onHeaderMenuColumnResizeByContent = output();
402
- onHeaderMenuBeforeMenuShow = output();
403
- onHeaderMenuAfterMenuShow = output();
404
- onHideColumns = output();
405
- onItemsAdded = output();
406
- onItemsDeleted = output();
407
- onItemsUpdated = output();
408
- onItemsUpserted = output();
409
- onFullResizeByContentRequested = output();
410
- onGridStateChanged = output();
411
- onBeforePaginationChange = output();
412
- onPaginationChanged = output();
413
- onPaginationRefreshed = output();
414
- onPaginationVisibilityChanged = output();
415
- onPaginationSetCursorBased = output();
416
- onGridBeforeResize = output();
417
- onGridAfterResize = output();
418
- onBeforeResizeByContent = output();
419
- onAfterResizeByContent = output();
420
- onSortCleared = output();
421
- onFilterChanged = output();
422
- onFilterCleared = output();
423
- onSortChanged = output();
424
- onTreeItemToggled = output();
425
- onTreeFullToggleEnd = output();
426
- onTreeFullToggleStart = output();
427
- // Angular-Slickgrid specific events
428
- onBeforeGridCreate = output();
429
- onGridCreated = output();
430
- onDataviewCreated = output();
431
- onAngularGridCreated = output();
432
- onBeforeGridDestroy = output();
433
- onLanguageChange = output();
434
- get dataset() {
435
- return (this.customDataView ? this.slickGrid?.getData?.() : this.dataView?.getItems()) || [];
436
- }
437
- set dataset(newDataset) {
438
- const prevDatasetLn = this._currentDatasetLength;
439
- const isDatasetEqual = dequal(newDataset, this._dataset || []);
440
- let data = newDataset;
441
- // when Tree Data is enabled and we don't yet have the hierarchical dataset filled, we can force a convert+sort of the array
442
- if (this.slickGrid &&
443
- this.options?.enableTreeData &&
444
- Array.isArray(newDataset) &&
445
- (newDataset.length > 0 || newDataset.length !== prevDatasetLn || !isDatasetEqual)) {
446
- this._isDatasetHierarchicalInitialized = false;
447
- data = this.sortTreeDataset(newDataset, !isDatasetEqual); // if dataset changed, then force a refresh anyway
448
- }
449
- this._dataset = data;
450
- this.refreshGridData(data || []);
451
- this._currentDatasetLength = (newDataset || []).length;
452
- // expand/autofit columns on first page load
453
- // we can assume that if the prevDataset was empty then we are on first load
454
- if (this.slickGrid && this.options?.autoFitColumnsOnFirstLoad && prevDatasetLn === 0 && !this._isAutosizeColsCalled) {
455
- this.slickGrid.autosizeColumns();
456
- this._isAutosizeColsCalled = true;
457
- }
458
- this.suggestDateParsingWhenHelpful();
459
- }
460
- get datasetHierarchical() {
461
- return this.sharedService.hierarchicalDataset;
462
- }
463
- set datasetHierarchical(newHierarchicalDataset) {
464
- const isDatasetEqual = dequal(newHierarchicalDataset, this.sharedService?.hierarchicalDataset ?? []);
465
- const prevFlatDatasetLn = this._currentDatasetLength;
466
- this.sharedService.hierarchicalDataset = newHierarchicalDataset;
467
- if (newHierarchicalDataset && this.columns && this.filterService?.clearFilters) {
468
- this.filterService.clearFilters();
469
- }
470
- // 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
471
- if (newHierarchicalDataset && this.slickGrid && this.sortService?.processTreeDataInitialSort) {
472
- this.sortService.processTreeDataInitialSort();
473
- this.treeDataService.initHierarchicalTree();
474
- // 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
475
- // however we need to queue our process until the flat dataset is ready, so we can queue a microtask to execute the DataView refresh only after everything is ready
476
- queueMicrotask(() => {
477
- const flatDatasetLn = this.dataView.getItemCount();
478
- if (flatDatasetLn > 0 && (flatDatasetLn !== prevFlatDatasetLn || !isDatasetEqual)) {
479
- this.filterService.refreshTreeDataFilters();
480
- }
481
- });
482
- this._isDatasetHierarchicalInitialized = true;
483
- }
484
- }
485
- get elementRef() {
486
- return this.elm;
487
- }
488
- get backendService() {
489
- return this.options?.backendServiceApi?.service;
490
- }
491
- get eventHandler() {
492
- return this._eventHandler;
493
- }
494
- get gridContainerElement() {
495
- return document.querySelector(`#${this.options.gridContainerId || ''}`);
496
- }
497
- /** GETTER to know if dataset was initialized or not */
498
- get isDatasetInitialized() {
499
- return this._isDatasetInitialized;
500
- }
501
- /** SETTER to change if dataset was initialized or not (stringly used for unit testing purposes) */
502
- set isDatasetInitialized(isInitialized) {
503
- this._isDatasetInitialized = isInitialized;
504
- }
505
- set isDatasetHierarchicalInitialized(isInitialized) {
506
- this._isDatasetHierarchicalInitialized = isInitialized;
507
- }
508
- get registeredResources() {
509
- return this._registeredResources;
510
- }
511
- slickgridHeader = null;
512
- slickgridFooter = null;
513
- constructor(angularUtilService, appRef, containerService, elm, translate, translaterService, forRootConfig, externalServices) {
514
- this.angularUtilService = angularUtilService;
515
- this.appRef = appRef;
516
- this.containerService = containerService;
517
- this.elm = elm;
518
- this.translate = translate;
519
- this.translaterService = translaterService;
520
- this.forRootConfig = forRootConfig;
521
- const slickgridConfig = new SlickgridConfig$1();
522
- // initialize and assign all Service Dependencies
523
- this._eventPubSubService = externalServices?.eventPubSubService ?? new EventPubSubService(this.elm.nativeElement);
524
- this._eventPubSubService.eventNamingStyle = 'camelCase';
525
- this.backendUtilityService = externalServices?.backendUtilityService ?? new BackendUtilityService();
526
- this.gridEventService = externalServices?.gridEventService ?? new GridEventService();
527
- this.sharedService = externalServices?.sharedService ?? new SharedService();
528
- this.collectionService = externalServices?.collectionService ?? new CollectionService(this.translaterService);
529
- // prettier-ignore
530
- this.extensionUtility = externalServices?.extensionUtility ?? new ExtensionUtility(this.sharedService, this.backendUtilityService, this.translaterService);
531
- this.filterFactory = new FilterFactory(slickgridConfig, this.translaterService, this.collectionService);
532
- // prettier-ignore
533
- this.filterService = externalServices?.filterService ?? new FilterService(this.filterFactory, this._eventPubSubService, this.sharedService, this.backendUtilityService);
534
- this.resizerService = externalServices?.resizerService ?? new ResizerService(this._eventPubSubService);
535
- // prettier-ignore
536
- this.sortService = externalServices?.sortService ?? new SortService(this.collectionService, this.sharedService, this._eventPubSubService, this.backendUtilityService);
537
- // prettier-ignore
538
- this.treeDataService = externalServices?.treeDataService ?? new TreeDataService(this._eventPubSubService, this.filterService, this.sharedService, this.sortService);
539
- // prettier-ignore
540
- this.paginationService = externalServices?.paginationService ?? new PaginationService(this._eventPubSubService, this.sharedService, this.backendUtilityService);
541
- this.extensionService =
542
- externalServices?.extensionService ??
543
- new ExtensionService(this.extensionUtility, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.treeDataService, this.translaterService, () => this.gridService);
544
- // prettier-ignore
545
- /* v8 ignore next 8 */
546
- this.gridStateService = externalServices?.gridStateService ?? new GridStateService(this.extensionService, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.treeDataService);
547
- // prettier-ignore
548
- /* v8 ignore next 9 */
549
- this.gridService = externalServices?.gridService ?? new GridService(this.gridStateService, this.filterService, this._eventPubSubService, this.paginationService, this.sharedService, this.sortService, this.treeDataService);
550
- this.headerGroupingService = externalServices?.headerGroupingService ?? new HeaderGroupingService(this.extensionUtility);
551
- this.serviceList = [
552
- this.containerService,
553
- this.extensionService,
554
- this.filterService,
555
- this.gridEventService,
556
- this.gridService,
557
- this.gridStateService,
558
- this.headerGroupingService,
559
- this.paginationService,
560
- this.resizerService,
561
- this.sortService,
562
- this.treeDataService,
563
- ];
564
- // register all Service instances in the container
565
- this.containerService.registerInstance('ExtensionUtility', this.extensionUtility);
566
- this.containerService.registerInstance('FilterService', this.filterService);
567
- this.containerService.registerInstance('CollectionService', this.collectionService);
568
- this.containerService.registerInstance('ExtensionService', this.extensionService);
569
- this.containerService.registerInstance('GridEventService', this.gridEventService);
570
- this.containerService.registerInstance('GridService', this.gridService);
571
- this.containerService.registerInstance('GridStateService', this.gridStateService);
572
- this.containerService.registerInstance('HeaderGroupingService', this.headerGroupingService);
573
- this.containerService.registerInstance('PaginationService', this.paginationService);
574
- this.containerService.registerInstance('ResizerService', this.resizerService);
575
- this.containerService.registerInstance('SharedService', this.sharedService);
576
- this.containerService.registerInstance('SortService', this.sortService);
577
- this.containerService.registerInstance('EventPubSubService', this._eventPubSubService);
578
- this.containerService.registerInstance('PubSubService', this._eventPubSubService);
579
- this.containerService.registerInstance('TranslaterService', this.translaterService);
580
- this.containerService.registerInstance('TreeDataService', this.treeDataService);
581
- }
582
- ngAfterViewInit() {
583
- if (!this.columns) {
584
- throw new Error('Using `<angular-slickgrid>` requires [columns], it seems that you might have forgot to provide the missing bindable input.');
585
- }
586
- this.initialization(this._eventHandler);
587
- this._isGridInitialized = true;
588
- // recheck the empty warning message after grid is shown so that it works in every use case
589
- if (this.options?.enableEmptyDataWarningMessage && Array.isArray(this.dataset)) {
590
- const finalTotalCount = this.dataset.length;
591
- this.displayEmptyDataWarning(finalTotalCount < 1);
592
- }
593
- // add dark mode CSS class when enabled
594
- if (this.options.darkMode) {
595
- this.setDarkMode(true);
596
- }
597
- this.suggestDateParsingWhenHelpful();
598
- }
599
- ngOnDestroy() {
600
- this._eventPubSubService.publish('onBeforeGridDestroy', this.slickGrid);
601
- this.destroy();
602
- }
603
- destroy(shouldEmptyDomElementContainer = false) {
604
- // dispose of all Services
605
- this.serviceList.forEach((service) => {
606
- if (typeof service?.dispose === 'function') {
607
- service.dispose();
608
- }
609
- });
610
- this.serviceList.length = 0;
611
- this._eventPubSubService?.unsubscribeAll();
612
- // dispose backend service when defined and a dispose method exists
613
- this.backendService?.dispose?.();
614
- // dispose all registered external resources
615
- this.disposeExternalResources();
616
- // dispose the Components
617
- this.slickEmptyWarning?.dispose();
618
- this.slickFooter?.dispose();
619
- this.slickPagination?.dispose();
620
- if (this._eventHandler?.unsubscribeAll) {
621
- this._eventHandler.unsubscribeAll();
622
- }
623
- if (this.dataView) {
624
- this.dataView.setItems([]);
625
- this.dataView.destroy();
626
- }
627
- if (this.slickGrid?.destroy) {
628
- this.slickGrid.destroy(shouldEmptyDomElementContainer);
629
- }
630
- if (this.backendServiceApi) {
631
- for (const prop of Object.keys(this.backendServiceApi)) {
632
- delete this.backendServiceApi[prop];
633
- }
634
- this.backendServiceApi = undefined;
635
- }
636
- for (const prop of Object.keys(this.sharedService)) {
637
- this.sharedService[prop] = null;
638
- }
639
- // also unsubscribe all RxJS subscriptions
640
- this.subscriptions = unsubscribeAll(this.subscriptions);
641
- this._dataset = null;
642
- this.datasetHierarchical = undefined;
643
- this._columns = [];
644
- this._angularGridInstances = undefined;
645
- this.slickGrid = undefined;
646
- // we could optionally also empty the content of the grid container DOM element
647
- if (shouldEmptyDomElementContainer) {
648
- this.emptyGridContainerElm();
649
- }
650
- }
651
- disposeExternalResources() {
652
- if (Array.isArray(this._registeredResources)) {
653
- while (this._registeredResources.length > 0) {
654
- const res = this._registeredResources.pop();
655
- if (typeof res?.dispose === 'function') {
656
- res.dispose();
657
- }
658
- }
659
- }
660
- this._registeredResources = [];
661
- }
662
- emptyGridContainerElm() {
663
- const gridContainerId = this.options?.gridContainerId || 'grid1';
664
- const gridContainerElm = document.querySelector(`#${gridContainerId}`);
665
- emptyElement(gridContainerElm);
666
- }
667
- /**
668
- * Define our internal Post Process callback, it will execute internally after we get back result from the Process backend call
669
- * Currently ONLY available with the GraphQL Backend Service.
670
- * The behavior is to refresh the Dataset & Pagination without requiring the user to create his own PostProcess every time
671
- */
672
- createBackendApiInternalPostProcessCallback(gridOptions) {
673
- const backendApi = gridOptions?.backendServiceApi;
674
- if (backendApi?.service) {
675
- const backendApiService = backendApi.service;
676
- // internalPostProcess only works (for now) with a GraphQL Service, so make sure it is of that type
677
- if (typeof backendApiService.getDatasetName === 'function') {
678
- backendApi.internalPostProcess = (processResult) => {
679
- // prettier-ignore
680
- const datasetName = backendApi && backendApiService && typeof backendApiService.getDatasetName === 'function' ? backendApiService.getDatasetName() : '';
681
- if (!Array.isArray(processResult) && processResult?.data[datasetName]) {
682
- const data = 'nodes' in processResult.data[datasetName]
683
- ? processResult.data[datasetName].nodes
684
- : processResult.data[datasetName];
685
- const totalCount = 'totalCount' in processResult.data[datasetName]
686
- ? processResult.data[datasetName].totalCount
687
- : processResult.data[datasetName].length;
688
- this.refreshGridData(data, totalCount || 0);
689
- }
690
- };
691
- }
692
- }
693
- }
694
- initialization(eventHandler) {
695
- this.options.translater = this.translaterService;
696
- this._eventHandler = eventHandler;
697
- this._isAutosizeColsCalled = false;
698
- // when detecting a frozen grid, we'll automatically enable the mousewheel scroll handler so that we can scroll from both left/right frozen containers
699
- if (this.options &&
700
- ((this.options.frozenRow !== undefined && this.options.frozenRow >= 0) ||
701
- (this.options.frozenColumn !== undefined && this.options.frozenColumn >= 0)) &&
702
- this.options.enableMouseWheelScrollHandler === undefined) {
703
- this.options.enableMouseWheelScrollHandler = true;
704
- }
705
- this._eventPubSubService.eventNamingStyle = this.options?.eventNamingStyle ?? 'camelCase';
706
- this._eventPubSubService.publish('onBeforeGridCreate', true);
707
- // make sure the dataset is initialized (if not it will throw an error that it cannot getLength of null)
708
- this._dataset ||= [];
709
- this.options = this.mergeGridOptions(this.options);
710
- this._paginationOptions = this.options?.pagination;
711
- this.locales = this.options?.locales ?? Constants.locales;
712
- this.backendServiceApi = this.options?.backendServiceApi;
713
- this._isLocalGrid = !this.backendServiceApi; // considered a local grid if it doesn't have a backend service set
714
- // unless specified, we'll create an internal postProcess callback (currently only available for GraphQL)
715
- if (this.options.backendServiceApi && !this.options.backendServiceApi?.disableInternalPostProcess) {
716
- this.createBackendApiInternalPostProcessCallback(this.options);
717
- }
718
- if (!this.customDataView) {
719
- const dataviewInlineFilters = this.options?.dataView?.inlineFilters ?? false;
720
- let dataViewOptions = { ...this.options.dataView, inlineFilters: dataviewInlineFilters };
721
- if (this.options.draggableGrouping || this.options.enableGrouping) {
722
- this.groupItemMetadataProvider = new SlickGroupItemMetadataProvider(this.options.groupItemMetadataOption);
723
- this.sharedService.groupItemMetadataProvider = this.groupItemMetadataProvider;
724
- dataViewOptions = { ...dataViewOptions, groupItemMetadataProvider: this.groupItemMetadataProvider };
725
- }
726
- this.dataView = new SlickDataView(dataViewOptions, this._eventPubSubService);
727
- this._eventPubSubService.publish('onDataviewCreated', this.dataView);
728
- }
729
- // get any possible Services that user want to register which don't require SlickGrid to be instantiated
730
- // RxJS Resource is in this lot because it has to be registered before anything else and doesn't require SlickGrid to be initialized
731
- this.preRegisterResources();
732
- // prepare and load all SlickGrid editors, if an async editor is found then we'll also execute it.
733
- this._columns = this.gridStateService.loadSlickGridEditors(this._columns || []);
734
- // if the user wants to automatically add a Custom Editor Formatter, we need to call the auto add function again
735
- if (this.options.autoAddCustomEditorFormatter) {
736
- autoAddEditorFormatterToColumnsWithEditor(this._columns, this.options.autoAddCustomEditorFormatter);
737
- }
738
- // save reference for all columns before they optionally become hidden/visible
739
- this.sharedService.allColumns = this._columns;
740
- // certain extensions/plugins add extra columns not created by the user itself (RowMove, RowDetail, RowSelections),
741
- // we notify the user via the `columns` 2-way binding so they always get the full column defs array including extra cols.
742
- // NOTE: assign the private field directly, going through the `columns` setter would re-run the column
743
- // arrangement pipeline mid-init and conflict with Grid State & Presets.
744
- this.subscriptions.push(this._eventPubSubService.subscribe('onPluginColumnsChanged', (data) => {
745
- this._columns = data.columns;
746
- this.columnsChange.emit(this._columns);
747
- }));
748
- // create optional extensions (RowMove, RowDetail, RowSelections), they splice their extra columns
749
- // directly into the array below, which also triggers the `onPluginColumnsChanged` subscription above
750
- this.extensionService.createExtensionsBeforeGridCreation(this._columns, this.options);
751
- // if user entered some Pinning/Frozen "presets", we need to apply them in the grid options
752
- if (this.options.presets?.pinning) {
753
- this.options = { ...this.options, ...this.options.presets.pinning };
754
- }
755
- // build SlickGrid Grid, also user might optionally pass a custom dataview (e.g. remote model)
756
- this.slickGrid = new SlickGrid(`#${this.gridId}`, this.customDataView || this.dataView, this._columns, this.options, this._eventPubSubService);
757
- if (typeof this.dataView.setGrid === 'function') {
758
- this.dataView.setGrid(this.slickGrid);
759
- }
760
- this.sharedService.dataView = this.dataView;
761
- this.sharedService.slickGrid = this.slickGrid;
762
- this.sharedService.gridContainerElement = this.elm.nativeElement;
763
- if (this.groupItemMetadataProvider) {
764
- this.slickGrid.registerPlugin(this.groupItemMetadataProvider); // register GroupItemMetadataProvider when Grouping is enabled
765
- }
766
- // get any possible Services that user want to register
767
- this.registerResources();
768
- this.extensionService.bindDifferentExtensions();
769
- this.bindDifferentHooks(this.slickGrid, this.options, this.dataView);
770
- // 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
771
- this.sharedService.frozenVisibleColumnId = this.slickGrid.getFrozenColumnId();
772
- // initialize the SlickGrid grid
773
- this.slickGrid.init();
774
- // initialized the resizer service only after SlickGrid is initialized
775
- // if we don't we end up binding our resize to a grid element that doesn't yet exist in the DOM and the resizer service will fail silently (because it has a try/catch that unbinds the resize without throwing back)
776
- if (this.gridContainerElement) {
777
- this.resizerService.init(this.slickGrid, this.gridContainerElement);
778
- }
779
- // user could show a custom footer with the data metrics (dataset length and last updated timestamp)
780
- if (!this.options.enablePagination && this.options.showCustomFooter && this.options.customFooterOptions && this.gridContainerElement) {
781
- this.slickFooter = new SlickFooterComponent(this.slickGrid, this.options.customFooterOptions, this._eventPubSubService, this.translaterService);
782
- this.slickFooter.renderFooter(this.gridContainerElement);
783
- }
784
- if (!this.customDataView && this.dataView) {
785
- // load the data in the DataView (unless it's a hierarchical dataset, if so it will be loaded after the initial tree sort)
786
- const initialDataset = this.options?.enableTreeData ? this.sortTreeDataset(this._dataset) : this._dataset;
787
- this.dataView.beginUpdate();
788
- this.dataView.setItems(initialDataset || [], this.options.datasetIdPropertyName ?? 'id');
789
- this.dataView.endUpdate();
790
- // if you don't want the items that are not visible (due to being filtered out or being on a different page)
791
- // to stay selected, pass 'false' to the second arg
792
- if (this.slickGrid?.getSelectionModel() && this.options?.dataView && 'syncGridSelection' in this.options.dataView) {
793
- // if we are using a Backend Service, we will do an extra flag check, the reason is because it might have some unintended behaviors
794
- // with the BackendServiceApi because technically the data in the page changes the DataView on every page change.
795
- let preservedRowSelectionWithBackend = false;
796
- if (this.options.backendServiceApi && 'syncGridSelectionWithBackendService' in this.options.dataView) {
797
- preservedRowSelectionWithBackend = this.options.dataView.syncGridSelectionWithBackendService;
798
- }
799
- const syncGridSelection = this.options.dataView.syncGridSelection;
800
- if (typeof syncGridSelection === 'boolean') {
801
- let preservedRowSelection = syncGridSelection;
802
- if (!this._isLocalGrid) {
803
- // when using BackendServiceApi, we'll be using the "syncGridSelectionWithBackendService" flag BUT "syncGridSelection" must also be set to True
804
- preservedRowSelection = syncGridSelection && preservedRowSelectionWithBackend;
805
- }
806
- this.dataView.syncGridSelection(this.slickGrid, preservedRowSelection);
807
- }
808
- else if (typeof syncGridSelection === 'object') {
809
- this.dataView.syncGridSelection(this.slickGrid, syncGridSelection.preserveHidden, syncGridSelection.preserveHiddenOnSelectionChange);
810
- }
811
- }
812
- const datasetLn = this.dataView.getLength() || this._dataset?.length || 0;
813
- if (datasetLn > 0) {
814
- if (!this._isDatasetInitialized && (this.options.enableCheckboxSelector || this.options.enableSelection)) {
815
- this.loadRowSelectionPresetWhenExists();
816
- }
817
- this.loadFilterPresetsWhenDatasetInitialized();
818
- this._isDatasetInitialized = true;
819
- }
820
- }
821
- // user might want to hide the header row on page load but still have `enableFiltering: true`
822
- // if that is the case, we need to hide the headerRow ONLY AFTER all filters got created & dataView exist
823
- if (this._hideHeaderRowAfterPageLoad) {
824
- this.showHeaderRow(false);
825
- this.sharedService.hideHeaderRowAfterPageLoad = this._hideHeaderRowAfterPageLoad;
826
- }
827
- // publish & dispatch certain events
828
- this._eventPubSubService.publish('onGridCreated', this.slickGrid);
829
- // after the DataView is created & updated execute some processes
830
- if (!this.customDataView) {
831
- this.executeAfterDataviewCreated(this.slickGrid, this.options);
832
- }
833
- // bind resize ONLY after the dataView is ready
834
- this.bindResizeHook(this.slickGrid, this.options);
835
- // bind the Backend Service API callback functions only after the grid is initialized
836
- // because the preProcess() and onInit() might get triggered
837
- if (this.options?.backendServiceApi) {
838
- this.bindBackendCallbackFunctions(this.options);
839
- }
840
- // local grid, check if we need to show the Pagination
841
- // if so then also check if there's any presets and finally initialize the PaginationService
842
- // 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
843
- if (this.options?.enablePagination && this._isLocalGrid) {
844
- this.showPagination = true;
845
- this.loadLocalGridPagination(this.dataset);
846
- }
847
- this._angularGridInstances = {
848
- // Slick Grid & DataView objects
849
- dataView: this.dataView,
850
- slickGrid: this.slickGrid,
851
- extensions: this.extensionService?.extensionList,
852
- // public methods
853
- destroy: this.destroy.bind(this),
854
- // return all available Services (non-singleton)
855
- backendService: this.backendService,
856
- eventPubSubService: this._eventPubSubService,
857
- filterService: this.filterService,
858
- gridEventService: this.gridEventService,
859
- gridStateService: this.gridStateService,
860
- gridService: this.gridService,
861
- headerGroupingService: this.headerGroupingService,
862
- extensionService: this.extensionService,
863
- paginationComponent: this.slickPagination,
864
- paginationService: this.paginationService,
865
- resizerService: this.resizerService,
866
- sortService: this.sortService,
867
- treeDataService: this.treeDataService,
868
- };
869
- // all instances (SlickGrid, DataView & all Services)
870
- this._eventPubSubService.publish('onAngularGridCreated', this._angularGridInstances);
871
- }
872
- /**
873
- * On a Pagination changed, we will trigger a Grid State changed with the new pagination info
874
- * Also if we use Row Selection or the Checkbox Selector with a Backend Service (Odata, GraphQL), we need to reset any selection
875
- */
876
- paginationChanged(pagination) {
877
- const isSyncGridSelectionEnabled = this.gridStateService?.needToPreserveRowSelection() ?? false;
878
- if (this.slickGrid &&
879
- !isSyncGridSelectionEnabled &&
880
- this.options?.backendServiceApi &&
881
- (this.options.enableSelection || this.options.enableCheckboxSelector)) {
882
- this.slickGrid.setSelectedRows([]);
883
- }
884
- const { pageNumber, pageSize } = pagination;
885
- if (this.sharedService) {
886
- if (pageSize !== undefined && pageNumber !== undefined) {
887
- this.sharedService.currentPagination = { pageNumber, pageSize };
888
- }
889
- }
890
- this._eventPubSubService.publish('onGridStateChanged', {
891
- change: { newValues: { pageNumber, pageSize }, type: 'pagination' },
892
- gridState: this.gridStateService.getCurrentGridState(),
893
- });
894
- }
895
- /**
896
- * When dataset changes, we need to refresh the entire grid UI & possibly resize it as well
897
- * @param dataset
898
- */
899
- refreshGridData(dataset, totalCount) {
900
- if (this.options?.enableEmptyDataWarningMessage && Array.isArray(dataset)) {
901
- const finalTotalCount = totalCount || dataset.length;
902
- this.displayEmptyDataWarning(finalTotalCount < 1);
903
- }
904
- if (Array.isArray(dataset) && this.slickGrid && this.dataView?.setItems) {
905
- this.dataView.setItems(dataset, this.options.datasetIdPropertyName ?? 'id');
906
- if (!this.options.backendServiceApi && !this.options.enableTreeData) {
907
- this.dataView.reSort();
908
- }
909
- if (dataset.length > 0) {
910
- if (!this._isDatasetInitialized) {
911
- this.loadFilterPresetsWhenDatasetInitialized();
912
- if (this.options.enableCheckboxSelector) {
913
- this.loadRowSelectionPresetWhenExists();
914
- }
915
- }
916
- this._isDatasetInitialized = true;
917
- }
918
- if (dataset) {
919
- this.slickGrid.invalidate();
920
- }
921
- // 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
922
- this.showPagination = !!(this.options &&
923
- (this.options.enablePagination || (this.options.backendServiceApi && this.options.enablePagination === undefined)));
924
- if (this._paginationOptions && this.options?.pagination && this.options?.backendServiceApi) {
925
- const paginationOptions = this.setPaginationOptionsWhenPresetDefined(this.options, this._paginationOptions);
926
- // when we have a totalCount use it, else we'll take it from the pagination object
927
- // only update the total items if it's different to avoid refreshing the UI
928
- const totalRecords = totalCount !== undefined ? totalCount : this.options?.pagination?.totalItems;
929
- if (totalRecords !== undefined && totalRecords !== this.totalItems) {
930
- this.totalItems = +totalRecords;
931
- }
932
- // initialize the Pagination Service with new pagination options (which might have presets)
933
- if (!this._isPaginationInitialized) {
934
- this.initializePaginationService(paginationOptions);
935
- }
936
- else {
937
- // update the pagination service with the new total
938
- this.paginationService.updateTotalItems(this.totalItems);
939
- }
940
- }
941
- // resize the grid inside a slight timeout, in case other DOM element changed prior to the resize (like a filter/pagination changed)
942
- if (this.slickGrid && this.options.enableAutoResize) {
943
- const delay = this.options.autoResize && this.options.autoResize.delay;
944
- this.resizerService.resizeGrid(delay || 10);
945
- }
946
- }
947
- }
948
- setData(data, shouldAutosizeColumns = false) {
949
- if (shouldAutosizeColumns) {
950
- this._isAutosizeColsCalled = false;
951
- this._currentDatasetLength = 0;
952
- }
953
- this.dataset = data || [];
954
- }
955
- /**
956
- * Check if there's any Pagination Presets defined in the Grid Options,
957
- * if there are then load them in the paginationOptions object
958
- */
959
- setPaginationOptionsWhenPresetDefined(gridOptions, paginationOptions) {
960
- if (gridOptions.presets?.pagination && paginationOptions && !this._isPaginationInitialized) {
961
- if (this.hasBackendInfiniteScroll()) {
962
- console.warn('[Angular-Slickgrid] `presets.pagination` is not supported with Infinite Scroll, reverting to first page.');
963
- }
964
- else {
965
- paginationOptions.pageSize = gridOptions.presets.pagination.pageSize;
966
- paginationOptions.pageNumber = gridOptions.presets.pagination.pageNumber;
967
- }
968
- }
969
- return paginationOptions;
970
- }
971
- setDarkMode(dark = false) {
972
- this.sharedService.gridContainerElement?.classList.toggle('slick-dark-mode', dark);
973
- }
974
- /**
975
- * Dynamically change or update the column definitions list.
976
- * We will re-render the grid so that the new header and data shows up correctly.
977
- * If using i18n, we also need to trigger a re-translate of the column headers
978
- */
979
- updateColumnDefinitionsList(newColumns) {
980
- // map the Editor model to editorClass and load editor collectionAsync
981
- const updatedColumns = this.gridStateService.syncPluginColumns(newColumns, [...(this.sharedService.allColumns || []), ...newColumns]);
982
- if (this.options.enableTranslate) {
983
- this.extensionService.translateColumnHeaders(undefined, updatedColumns);
984
- }
985
- this.extensionService.renderColumnHeaders(updatedColumns, true);
986
- if (this.options?.enableAutoSizeColumns) {
987
- this.slickGrid.autosizeColumns();
988
- }
989
- else if (this.options?.enableAutoResizeColumnsByCellContent && this.resizerService?.resizeColumnsByCellContent) {
990
- this.resizerService.resizeColumnsByCellContent();
991
- }
992
- }
993
- /**
994
- * Show the filter row displayed on first row, we can optionally pass false to hide it.
995
- * @param showing
996
- */
997
- showHeaderRow(showing = true) {
998
- this.slickGrid.setHeaderRowVisibility(showing);
999
- if (showing === true && this._isGridInitialized) {
1000
- this.slickGrid.setColumns(this.columns);
1001
- }
1002
- return showing;
1003
- }
1004
- /**
1005
- * Toggle the empty data warning message visibility.
1006
- * @param showWarning
1007
- */
1008
- displayEmptyDataWarning(showWarning = true) {
1009
- this.slickEmptyWarning?.showEmptyDataMessage(showWarning);
1010
- }
1011
- //
1012
- // protected functions
1013
- // ------------------
1014
- /**
1015
- * Loop through all column definitions and copy the original optional `width` properties optionally provided by the user.
1016
- * We will use this when doing a resize by cell content, if user provided a `width` it won't override it.
1017
- */
1018
- copyColumnWidthsReference(columns) {
1019
- columns.forEach((col) => (col.originalWidth = col.width));
1020
- }
1021
- bindDifferentHooks(grid, gridOptions, dataView) {
1022
- // on locale change, we have to manually translate the Headers, GridMenu
1023
- if (this.translate?.onLangChange) {
1024
- // translate some of them on first load, then on each language change
1025
- if (gridOptions.enableTranslate) {
1026
- this.extensionService.translateAllExtensions();
1027
- }
1028
- this.subscriptions.push(this.translate.onLangChange.subscribe(({ lang }) => {
1029
- // publish event of the same name that Slickgrid-Universal uses on a language change event
1030
- this._eventPubSubService.publish('onLanguageChange', lang);
1031
- if (gridOptions.enableTranslate) {
1032
- this.extensionService.translateAllExtensions(lang);
1033
- if ((gridOptions.createPreHeaderPanel && gridOptions.createTopHeaderPanel) ||
1034
- (gridOptions.createPreHeaderPanel && !gridOptions.enableDraggableGrouping)) {
1035
- this.headerGroupingService.translateHeaderGrouping();
1036
- }
1037
- }
1038
- }));
1039
- }
1040
- // if user set an onInit Backend, we'll run it right away (and if so, we also need to run preProcess, internalPostProcess & postProcess)
1041
- if (gridOptions.backendServiceApi) {
1042
- const backendApi = gridOptions.backendServiceApi;
1043
- if (backendApi?.service?.init) {
1044
- backendApi.service.init(backendApi.options, gridOptions.pagination, this.slickGrid, this.sharedService);
1045
- }
1046
- }
1047
- if (dataView && grid) {
1048
- // on cell click, mainly used with the columnDef.action callback
1049
- this.gridEventService.bindOnCellChange(grid);
1050
- this.gridEventService.bindOnClick(grid);
1051
- // bind external sorting (backend) when available or default onSort (dataView)
1052
- if (gridOptions.enableSorting) {
1053
- // bind external sorting (backend) unless specified to use the local one
1054
- if (gridOptions.backendServiceApi && !gridOptions.backendServiceApi.useLocalSorting) {
1055
- this.sortService.bindBackendOnSort(grid);
1056
- }
1057
- else {
1058
- this.sortService.bindLocalOnSort(grid);
1059
- }
1060
- }
1061
- // bind external filter (backend) when available or default onFilter (dataView)
1062
- if (gridOptions.enableFiltering) {
1063
- this.filterService.init(grid);
1064
- // bind external filter (backend) unless specified to use the local one
1065
- if (gridOptions.backendServiceApi && !gridOptions.backendServiceApi.useLocalFiltering) {
1066
- this.filterService.bindBackendOnFilter(grid);
1067
- }
1068
- else {
1069
- this.filterService.bindLocalOnFilter(grid);
1070
- }
1071
- }
1072
- // when column are reordered, we need to update SharedService flag
1073
- this._eventHandler.subscribe(grid.onColumnsReordered, () => {
1074
- this.sharedService.hasColumnsReordered = true;
1075
- });
1076
- this._eventHandler.subscribe(grid.onSetOptions, (_e, args) => {
1077
- // add/remove dark mode CSS class when enabled
1078
- if (args.optionsBefore.darkMode !== args.optionsAfter.darkMode && this.gridContainerElement) {
1079
- this.setDarkMode(args.optionsAfter.darkMode);
1080
- }
1081
- });
1082
- // load any presets if any (after dataset is initialized)
1083
- this.loadColumnPresetsWhenDatasetInitialized();
1084
- this.loadFilterPresetsWhenDatasetInitialized();
1085
- // When data changes in the DataView, we need to refresh the metrics and/or display a warning if the dataset is empty
1086
- this._eventHandler.subscribe(dataView.onRowCountChanged, (_e, args) => {
1087
- if (!gridOptions.enableRowDetailView || !Array.isArray(args.changedRows) || args.changedRows.length === args.itemCount) {
1088
- grid.invalidate();
1089
- }
1090
- else {
1091
- grid.invalidateRows(args.changedRows);
1092
- grid.render();
1093
- }
1094
- this.handleOnItemCountChanged(dataView.getFilteredItemCount() || 0, dataView.getItemCount() || 0);
1095
- });
1096
- this._eventHandler.subscribe(dataView.onSetItemsCalled, (_e, args) => {
1097
- this.sharedService.isItemsDateParsed = false;
1098
- this.handleOnItemCountChanged(dataView.getFilteredItemCount() || 0, args.itemCount);
1099
- // when user has resize by content enabled, we'll force a full width calculation since we change our entire dataset
1100
- if (args.itemCount > 0 &&
1101
- (this.options.autosizeColumnsByCellContentOnFirstLoad || this.options.enableAutoResizeColumnsByCellContent)) {
1102
- this.resizerService.resizeColumnsByCellContent(!this.options?.resizeByContentOnlyOnFirstLoad);
1103
- }
1104
- });
1105
- if (gridOptions?.enableFiltering && !gridOptions.enableRowDetailView) {
1106
- this._eventHandler.subscribe(dataView.onRowsChanged, (_e, { calledOnRowCountChanged, rows }) => {
1107
- // filtering data with local dataset will not always show correctly unless we call this updateRow/render
1108
- // also don't use "invalidateRows" since it destroys the entire row and as bad user experience when updating a row
1109
- // see commit: https://github.com/ghiscoding/aurelia-slickgrid/commit/8c503a4d45fba11cbd8d8cc467fae8d177cc4f60
1110
- if (!calledOnRowCountChanged && Array.isArray(rows)) {
1111
- const ranges = grid.getRenderedRange();
1112
- rows.filter((row) => row >= ranges.top && row <= ranges.bottom).forEach((row) => grid.updateRow(row));
1113
- grid.render();
1114
- }
1115
- });
1116
- }
1117
- }
1118
- }
1119
- bindBackendCallbackFunctions(gridOptions) {
1120
- const backendApi = gridOptions.backendServiceApi;
1121
- const backendApiService = backendApi?.service;
1122
- const serviceOptions = backendApiService?.options ?? {};
1123
- // prettier-ignore
1124
- const isExecuteCommandOnInit = (!serviceOptions) ? false : ((serviceOptions && 'executeProcessCommandOnInit' in serviceOptions) ? serviceOptions['executeProcessCommandOnInit'] : true);
1125
- if (backendApiService) {
1126
- // update backend filters (if need be) BEFORE the query runs (via the onInit command a few lines below)
1127
- // if user entered some any "presets", we need to reflect them all in the grid
1128
- if (gridOptions?.presets) {
1129
- // Filters "presets"
1130
- if (backendApiService.updateFilters && Array.isArray(gridOptions.presets.filters) && gridOptions.presets.filters.length > 0) {
1131
- backendApiService.updateFilters(gridOptions.presets.filters, true);
1132
- }
1133
- // Sorters "presets"
1134
- if (backendApiService.updateSorters && Array.isArray(gridOptions.presets.sorters) && gridOptions.presets.sorters.length > 0) {
1135
- // when using multi-column sort, we can have multiple but on single sort then only grab the first sort provided
1136
- const sortColumns = this.options.multiColumnSort ? gridOptions.presets.sorters : gridOptions.presets.sorters.slice(0, 1);
1137
- backendApiService.updateSorters(undefined, sortColumns);
1138
- }
1139
- // Pagination "presets"
1140
- if (backendApiService.updatePagination && gridOptions.presets.pagination && !this.hasBackendInfiniteScroll()) {
1141
- const { pageNumber, pageSize } = gridOptions.presets.pagination;
1142
- backendApiService.updatePagination(pageNumber, pageSize);
1143
- }
1144
- }
1145
- else {
1146
- const columnFilters = this.filterService.getColumnFilters();
1147
- if (columnFilters && backendApiService.updateFilters) {
1148
- backendApiService.updateFilters(columnFilters, false);
1149
- }
1150
- }
1151
- // execute onInit command when necessary
1152
- if (backendApi && backendApiService && (backendApi.onInit || isExecuteCommandOnInit)) {
1153
- const query = typeof backendApiService.buildQuery === 'function' ? backendApiService.buildQuery() : '';
1154
- // prettier-ignore
1155
- const process = (isExecuteCommandOnInit) ? (backendApi.process && backendApi.process(query) || null) : (backendApi.onInit && backendApi.onInit(query) || null);
1156
- // wrap this inside a microtask to be executed at the end of the task and avoid timing issue since the gridOptions needs to be ready before running this onInit
1157
- queueMicrotask(() => {
1158
- const backendUtilityService = this.backendUtilityService;
1159
- // keep start time & end timestamps & return it after process execution
1160
- const startTime = new Date();
1161
- // run any pre-process, if defined, for example a spinner
1162
- if (backendApi.preProcess) {
1163
- backendApi.preProcess();
1164
- }
1165
- // the processes can be a Promise (like Http)
1166
- const totalItems = this.options?.pagination?.totalItems ?? 0;
1167
- if (process instanceof Promise) {
1168
- process
1169
- .then((processResult) => backendUtilityService.executeBackendProcessesCallback(startTime, processResult, backendApi, totalItems))
1170
- .catch((error) => backendUtilityService.onBackendError(error, backendApi));
1171
- }
1172
- else if (process && this.rxjs?.isObservable(process)) {
1173
- this.subscriptions.push(process.subscribe({
1174
- next: (processResult) => backendUtilityService.executeBackendProcessesCallback(startTime, processResult, backendApi, totalItems),
1175
- error: (error) => backendUtilityService.onBackendError(error, backendApi),
1176
- }));
1177
- }
1178
- });
1179
- }
1180
- // when user enables Infinite Scroll
1181
- if (backendApi.service.options?.infiniteScroll) {
1182
- this.addBackendInfiniteScrollCallback();
1183
- }
1184
- }
1185
- }
1186
- addBackendInfiniteScrollCallback() {
1187
- if (this.slickGrid &&
1188
- this.options.backendServiceApi &&
1189
- this.hasBackendInfiniteScroll() &&
1190
- !this.options.backendServiceApi?.onScrollEnd) {
1191
- const onScrollEnd = () => {
1192
- this.backendUtilityService.setInfiniteScrollBottomHit(true);
1193
- // even if we're not showing pagination, we still use pagination service behind the scene
1194
- // to keep track of the scroll position and fetch next set of data (aka next page)
1195
- // we also need a flag to know if we reached the of the dataset or not (no more pages)
1196
- this.paginationService.goToNextPage().then((hasNext) => {
1197
- if (!hasNext) {
1198
- this.backendUtilityService.setInfiniteScrollBottomHit(false);
1199
- }
1200
- });
1201
- };
1202
- this.options.backendServiceApi.onScrollEnd = onScrollEnd;
1203
- // subscribe to SlickGrid onScroll to determine when reaching the end of the scroll bottom position
1204
- // run onScrollEnd() method when that happens
1205
- this._eventHandler.subscribe(this.slickGrid.onScroll, (_e, args) => {
1206
- const viewportElm = args.grid.getViewportNode();
1207
- if (['mousewheel', 'scroll'].includes(args.triggeredBy || '') &&
1208
- this.paginationService?.totalItems &&
1209
- args.scrollTop > 0 &&
1210
- Math.ceil(viewportElm.offsetHeight + args.scrollTop) >= args.scrollHeight) {
1211
- if (!this._scrollEndCalled) {
1212
- onScrollEnd();
1213
- this._scrollEndCalled = true;
1214
- }
1215
- }
1216
- });
1217
- // use postProcess to identify when scrollEnd process is finished to avoid calling the scrollEnd multiple times
1218
- // we also need to keep a ref of the user's postProcess and call it after our own postProcess
1219
- const orgPostProcess = this.options.backendServiceApi.postProcess;
1220
- this.options.backendServiceApi.postProcess = (processResult) => {
1221
- this._scrollEndCalled = false;
1222
- if (orgPostProcess) {
1223
- orgPostProcess(processResult);
1224
- }
1225
- };
1226
- }
1227
- }
1228
- bindResizeHook(grid, options) {
1229
- if ((options.autoFitColumnsOnFirstLoad && options.autosizeColumnsByCellContentOnFirstLoad) ||
1230
- (options.enableAutoSizeColumns && options.enableAutoResizeColumnsByCellContent)) {
1231
- throw new Error(`[Angular-Slickgrid] You cannot enable both autosize/fit viewport & resize by content, you must choose which resize technique to use. You can enable these 2 options ("autoFitColumnsOnFirstLoad" and "enableAutoSizeColumns") OR these other 2 options ("autosizeColumnsByCellContentOnFirstLoad" and "enableAutoResizeColumnsByCellContent").`);
1232
- }
1233
- // auto-resize grid on browser resize
1234
- if (options.gridHeight || options.gridWidth) {
1235
- this.resizerService.resizeGrid(0, { height: options.gridHeight, width: options.gridWidth });
1236
- }
1237
- else {
1238
- this.resizerService.resizeGrid();
1239
- }
1240
- // expand/autofit columns on first page load
1241
- if (grid &&
1242
- options?.enableAutoResize &&
1243
- options.autoFitColumnsOnFirstLoad &&
1244
- options.enableAutoSizeColumns &&
1245
- !this._isAutosizeColsCalled) {
1246
- grid.autosizeColumns();
1247
- this._isAutosizeColsCalled = true;
1248
- }
1249
- }
1250
- executeAfterDataviewCreated(_grid, gridOptions) {
1251
- // if user entered some Sort "presets", we need to reflect them all in the DOM
1252
- if (gridOptions.enableSorting && Array.isArray(gridOptions.presets?.sorters)) {
1253
- // when using multi-column sort, we can have multiple but on single sort then only grab the first sort provided
1254
- const sortColumns = this.options.multiColumnSort ? gridOptions.presets.sorters : gridOptions.presets.sorters.slice(0, 1);
1255
- this.sortService.loadGridSorters(sortColumns);
1256
- }
1257
- }
1258
- /** When data changes in the DataView, we'll refresh the metrics and/or display a warning if the dataset is empty */
1259
- handleOnItemCountChanged(currentPageRowItemCount, totalItemCount) {
1260
- this._currentDatasetLength = totalItemCount;
1261
- this.metrics = {
1262
- startTime: new Date(),
1263
- endTime: new Date(),
1264
- itemCount: currentPageRowItemCount,
1265
- totalItemCount,
1266
- };
1267
- // if custom footer is enabled, then we'll update its metrics
1268
- if (this.slickFooter) {
1269
- this.slickFooter.metrics = this.metrics;
1270
- }
1271
- // when using local (in-memory) dataset, we'll display a warning message when filtered data is empty
1272
- if (this._isLocalGrid && this.options?.enableEmptyDataWarningMessage) {
1273
- this.displayEmptyDataWarning(currentPageRowItemCount === 0);
1274
- }
1275
- // when autoResize.autoHeight is enabled, we'll want to call a resize
1276
- if (this.options.enableAutoResize && this.resizerService.isAutoHeightEnabled && currentPageRowItemCount > 0) {
1277
- this.resizerService.resizeGrid();
1278
- }
1279
- }
1280
- initializePaginationService(paginationOptions) {
1281
- if (this.options) {
1282
- this.paginationData = {
1283
- gridOptions: this.options,
1284
- paginationService: this.paginationService,
1285
- };
1286
- this.paginationService.totalItems = this.totalItems;
1287
- this.paginationService.init(this.slickGrid, paginationOptions, this.backendServiceApi);
1288
- this.subscriptions.push(this._eventPubSubService.subscribe('onPaginationChanged', (paginationChanges) => {
1289
- this.paginationChanged(paginationChanges);
1290
- }), this._eventPubSubService.subscribe('onPaginationVisibilityChanged', (visibility) => {
1291
- this.showPagination = visibility?.visible ?? false;
1292
- if (this.options?.backendServiceApi) {
1293
- this.backendUtilityService?.refreshBackendDataset(this.options);
1294
- }
1295
- this.renderPagination(this.showPagination);
1296
- }));
1297
- // also initialize (render) the pagination component
1298
- this.renderPagination();
1299
- this._isPaginationInitialized = true;
1300
- }
1301
- }
1302
- /** Load any possible Columns Grid Presets */
1303
- loadColumnPresetsWhenDatasetInitialized() {
1304
- // if user entered some Columns "presets", we need to reflect them all in the grid
1305
- if (Array.isArray(this.options.presets?.columns) && this.options.presets.columns.length > 0) {
1306
- // delegate to GridStateService for centralized column arrangement logic
1307
- // we pass `false` for triggerAutoSizeColumns to maintain original behavior on preset load
1308
- this.gridStateService.applyColumnLayout(this.options.presets.columns, false);
1309
- }
1310
- }
1311
- /** Load any possible Filters Grid Presets */
1312
- loadFilterPresetsWhenDatasetInitialized() {
1313
- if (this.options && !this.customDataView) {
1314
- // if user entered some Filter "presets", we need to reflect them all in the DOM
1315
- // also note that a presets of Tree Data Toggling will also call this method because Tree Data toggling does work with data filtering
1316
- // (collapsing a parent will basically use Filter for hidding (aka collapsing) away the child underneat it)
1317
- if (Array.isArray(this.options.presets?.filters) || Array.isArray(this.options.presets?.treeData?.toggledItems)) {
1318
- this.filterService.populateColumnFilterSearchTermPresets(this.options.presets?.filters || []);
1319
- }
1320
- }
1321
- }
1322
- /**
1323
- * local grid, check if we need to show the Pagination
1324
- * if so then also check if there's any presets and finally initialize the PaginationService
1325
- * 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
1326
- */
1327
- loadLocalGridPagination(dataset) {
1328
- if (this.options && this._paginationOptions) {
1329
- this.totalItems = Array.isArray(dataset) ? dataset.length : 0;
1330
- if (this._paginationOptions && this.dataView?.getPagingInfo) {
1331
- const slickPagingInfo = this.dataView.getPagingInfo();
1332
- if (slickPagingInfo && 'totalRows' in slickPagingInfo && this._paginationOptions.totalItems !== slickPagingInfo.totalRows) {
1333
- this.totalItems = slickPagingInfo.totalRows || 0;
1334
- }
1335
- }
1336
- this._paginationOptions.totalItems = this.totalItems;
1337
- const paginationOptions = this.setPaginationOptionsWhenPresetDefined(this.options, this._paginationOptions);
1338
- this.initializePaginationService(paginationOptions);
1339
- }
1340
- }
1341
- /** Load any Row Selections into the DataView that were presets by the user */
1342
- loadRowSelectionPresetWhenExists() {
1343
- // if user entered some Row Selections "presets"
1344
- const presets = this.options?.presets;
1345
- const enableRowSelection = this.options && (this.options.enableCheckboxSelector || this.options.enableSelection);
1346
- if (enableRowSelection &&
1347
- this.slickGrid?.getSelectionModel() &&
1348
- presets?.rowSelection &&
1349
- (Array.isArray(presets.rowSelection.gridRowIndexes) || Array.isArray(presets.rowSelection.dataContextIds))) {
1350
- let dataContextIds = presets.rowSelection.dataContextIds;
1351
- let gridRowIndexes = presets.rowSelection.gridRowIndexes;
1352
- // maps the IDs to the Grid Rows and vice versa, the "dataContextIds" has precedence over the other
1353
- if (Array.isArray(dataContextIds) && dataContextIds.length > 0) {
1354
- gridRowIndexes = this.dataView.mapIdsToRows(dataContextIds) || [];
1355
- }
1356
- else if (Array.isArray(gridRowIndexes) && gridRowIndexes.length > 0) {
1357
- dataContextIds = this.dataView.mapRowsToIds(gridRowIndexes) || [];
1358
- }
1359
- // apply row selection when defined as grid presets
1360
- if (this.slickGrid && Array.isArray(gridRowIndexes)) {
1361
- this.slickGrid.setSelectedRows(gridRowIndexes);
1362
- this.dataView.setSelectedIds(dataContextIds || [], {
1363
- isRowBeingAdded: true,
1364
- shouldTriggerEvent: false, // do not trigger when presetting the grid
1365
- applyRowSelectionToGrid: true,
1366
- });
1367
- }
1368
- }
1369
- }
1370
- hasBackendInfiniteScroll(gridOptions) {
1371
- return !!(gridOptions || this.options).backendServiceApi?.service.options?.infiniteScroll;
1372
- }
1373
- mergeGridOptions(gridOptions) {
1374
- gridOptions.gridId = this.gridId;
1375
- gridOptions.gridContainerId = `slickGridContainer-${this.gridId}`;
1376
- // use extend to deep merge & copy to avoid immutable properties being changed in GlobalGridOptions after a route change
1377
- const options = extend(true, {}, GlobalGridOptions, this.forRootConfig, gridOptions);
1378
- // 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
1379
- if (!this.hasBackendInfiniteScroll(gridOptions)) {
1380
- gridOptions.enablePagination = !!(gridOptions.backendServiceApi && gridOptions.enablePagination === undefined
1381
- ? true
1382
- : gridOptions.enablePagination);
1383
- }
1384
- // using copy extend to do a deep clone has an unwanted side on objects and pageSizes but ES6 spread has other worst side effects
1385
- // so we will just overwrite the pageSizes when needed, this is the only one causing issues so far.
1386
- // On a deep extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not.
1387
- if (options?.pagination &&
1388
- (gridOptions.enablePagination || gridOptions.backendServiceApi) &&
1389
- (this.forRootConfig?.pagination || gridOptions.pagination)) {
1390
- options.pagination.pageSize =
1391
- gridOptions.pagination?.pageSize ?? this.forRootConfig?.pagination?.pageSize ?? GlobalGridOptions.pagination.pageSize;
1392
- options.pagination.pageSizes =
1393
- gridOptions.pagination?.pageSizes ?? this.forRootConfig?.pagination?.pageSizes ?? GlobalGridOptions.pagination.pageSizes;
1394
- }
1395
- // also make sure to show the header row if user have enabled filtering
1396
- this._hideHeaderRowAfterPageLoad = options.showHeaderRow === false;
1397
- if (options.enableFiltering && !options.showHeaderRow) {
1398
- options.showHeaderRow = options.enableFiltering;
1399
- }
1400
- // when we use Pagination on Local Grid, it doesn't seem to work without enableFiltering
1401
- // so we'll enable the filtering but we'll keep the header row hidden
1402
- if (options && !options.enableFiltering && options.enablePagination && this._isLocalGrid) {
1403
- options.enableFiltering = true;
1404
- options.showHeaderRow = false;
1405
- this._hideHeaderRowAfterPageLoad = true;
1406
- if (this.sharedService) {
1407
- this.sharedService.hideHeaderRowAfterPageLoad = true;
1408
- }
1409
- }
1410
- return options;
1411
- }
1412
- /** Add a register of a new external resource, user could also optional dispose all previous resources before pushing any new resources to the resources array list. */
1413
- registerExternalResources(resources, disposePreviousResources = false) {
1414
- if (disposePreviousResources) {
1415
- this.disposeExternalResources();
1416
- }
1417
- resources.forEach((res) => this._registeredResources.push(res));
1418
- this.initializeExternalResources(resources);
1419
- }
1420
- resetExternalResources() {
1421
- this._registeredResources = [];
1422
- }
1423
- /** Pre-Register any Resource that don't require SlickGrid to be instantiated (for example RxJS Resource & RowDetail) */
1424
- preRegisterResources() {
1425
- this._registeredResources = this.options?.externalResources || [];
1426
- // Angular-Slickgrid requires RxJS, so we'll register it as the first resource
1427
- this.registerRxJsResource(new RxJsResource());
1428
- if (this.options.enableRowDetailView) {
1429
- const RowDetailClass = this._registeredResources.find((res) => res.pluginName === 'AngularRowDetailView');
1430
- if (!RowDetailClass) {
1431
- throw new Error('[Angular-Slickgrid] You enabled the Row Detail View feature but you did not provide the "AngularRowDetailView" class as an external resource.');
1432
- }
1433
- if (RowDetailClass) {
1434
- const rowDetailInstance = new RowDetailClass(this.angularUtilService, this.appRef, this._eventPubSubService, this.elm.nativeElement, this.rxjs);
1435
- this.slickRowDetailView = rowDetailInstance;
1436
- rowDetailInstance.create(this.columns, this.options);
1437
- this.extensionService.addExtensionToList('rowDetailView', {
1438
- name: 'rowDetailView',
1439
- instance: this.slickRowDetailView,
1440
- });
1441
- }
1442
- }
1443
- }
1444
- /** initialized & auto-enable external registered resources, e.g. if user registers `ExcelExportService` then let's auto-enable `enableExcelExport:true` */
1445
- autoEnableInitializedResources(resource) {
1446
- if (this.slickGrid && typeof resource.init === 'function') {
1447
- resource.init(this.slickGrid, this.containerService);
1448
- }
1449
- // auto-enable unless the flag was specifically disabled by the end user
1450
- if ('pluginName' in resource) {
1451
- const pluginFlagName = PluginFlagMappings.get(resource.pluginName);
1452
- if (pluginFlagName && this.options[pluginFlagName] !== false) {
1453
- this.options[pluginFlagName] = true;
1454
- this.slickGrid?.setOptions({ [pluginFlagName]: true });
1455
- }
1456
- }
1457
- }
1458
- initializeExternalResources(resources) {
1459
- PluginFlagMappings.set('AngularRowDetailView', 'enableRowDetailView'); // map the external Row Detail View resource to its flag
1460
- if (Array.isArray(resources)) {
1461
- for (const resource of resources) {
1462
- this.autoEnableInitializedResources(resource);
1463
- }
1464
- }
1465
- }
1466
- registerResources() {
1467
- // at this point, we consider all the registered services as external services, anything else registered afterward aren't external
1468
- if (Array.isArray(this._registeredResources)) {
1469
- this.sharedService.externalRegisteredResources = this._registeredResources;
1470
- }
1471
- // push all other Services that we want to be registered
1472
- this._registeredResources.push(this.gridService, this.gridStateService);
1473
- // when using Grouping/DraggableGrouping/Colspan register its Service
1474
- if ((this.options.createPreHeaderPanel && this.options.createTopHeaderPanel) ||
1475
- (this.options.createPreHeaderPanel && !this.options.enableDraggableGrouping)) {
1476
- this._registeredResources.push(this.headerGroupingService);
1477
- }
1478
- // when using Tree Data View, register its Service
1479
- if (this.options.enableTreeData) {
1480
- this._registeredResources.push(this.treeDataService);
1481
- }
1482
- // when user enables translation, we need to translate Headers on first pass & subsequently in the bindDifferentHooks
1483
- if (this.options.enableTranslate) {
1484
- this.extensionService.translateColumnHeaders();
1485
- }
1486
- // also initialize (render) the empty warning component
1487
- this.slickEmptyWarning = new SlickEmptyWarningComponent();
1488
- this._registeredResources.push(this.slickEmptyWarning);
1489
- // bind & initialize all Components/Services that were tagged as enabled
1490
- // register all services by executing their init method and providing them with the Grid object
1491
- this.initializeExternalResources(this._registeredResources);
1492
- // initialize RowDetail separately since we already added it to the ExtensionList via `addExtensionToList()` but not in external resources,
1493
- // because we don't want to dispose the extension/resource more than once (because externalResources/extensionList are both looping through their list to dispose of them)
1494
- if (this.options.enableRowDetailView && this.slickRowDetailView) {
1495
- this.slickRowDetailView.init(this.slickGrid);
1496
- }
1497
- }
1498
- /** Register the RxJS Resource in all necessary services which uses */
1499
- registerRxJsResource(resource) {
1500
- this.rxjs = resource;
1501
- this.backendUtilityService.addRxJsResource(this.rxjs);
1502
- this.filterFactory.addRxJsResource(this.rxjs);
1503
- this.filterService.addRxJsResource(this.rxjs);
1504
- this.gridStateService.addRxJsResource(this.rxjs);
1505
- this.sortService.addRxJsResource(this.rxjs);
1506
- this.paginationService.addRxJsResource(this.rxjs);
1507
- this.containerService.registerInstance('RxJsResource', this.rxjs);
1508
- }
1509
- /**
1510
- * Render (or dispose) the Pagination Component, user can optionally provide False (to not show it) which will in term dispose of the Pagination,
1511
- * 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)
1512
- * @param {Boolean} showPagination - show (new render) or not (dispose) the Pagination
1513
- * @param {Boolean} shouldDisposePaginationService - when disposing the Pagination, do we also want to dispose of the Pagination Service? (defaults to True)
1514
- */
1515
- renderPagination(showPagination = true) {
1516
- if (this.slickGrid && this.options?.enablePagination && !this._isPaginationInitialized && showPagination) {
1517
- if (this.options.customPaginationComponent) {
1518
- const paginationComp = this.angularUtilService.createAngularComponent(this.options.customPaginationComponent);
1519
- this.slickPagination = paginationComp.componentRef.instance;
1520
- }
1521
- else {
1522
- this.slickPagination = new SlickPaginationComponent();
1523
- }
1524
- if (this.slickPagination) {
1525
- this.slickPagination.init(this.slickGrid, this.paginationService, this._eventPubSubService, this.translaterService);
1526
- this.slickPagination.renderPagination(this.gridContainerElement);
1527
- this._isPaginationInitialized = true;
1528
- }
1529
- }
1530
- else if (!showPagination) {
1531
- this.slickPagination?.dispose();
1532
- this._isPaginationInitialized = false;
1533
- }
1534
- }
1535
- /**
1536
- * Takes a flat dataset with parent/child relationship, sort it (via its tree structure) and return the sorted flat array
1537
- * @param {Array<Object>} flatDatasetInput - flat dataset input
1538
- * @param {Boolean} forceGridRefresh - optionally force a full grid refresh
1539
- * @returns {Array<Object>} sort flat parent/child dataset
1540
- */
1541
- sortTreeDataset(flatDatasetInput, forceGridRefresh = false) {
1542
- const prevDatasetLn = this._currentDatasetLength;
1543
- let sortedDatasetResult;
1544
- let flatDatasetOutput = [];
1545
- // if the hierarchical dataset was already initialized then no need to re-convert it, we can use it directly from the shared service ref
1546
- if (this._isDatasetHierarchicalInitialized && this.datasetHierarchical) {
1547
- sortedDatasetResult = this.treeDataService.sortHierarchicalDataset(this.datasetHierarchical);
1548
- flatDatasetOutput = sortedDatasetResult.flat;
1549
- }
1550
- else if (Array.isArray(flatDatasetInput) && flatDatasetInput.length > 0) {
1551
- // we need to first convert the flat dataset to a hierarchical dataset and then sort it
1552
- // we'll also add props, by mutation, required by the TreeDataService on the flat array like `__hasChildren`, `parentId` and anything else to work properly
1553
- sortedDatasetResult = this.treeDataService.convertFlatParentChildToTreeDatasetAndSort(flatDatasetInput, this._columns, this.options);
1554
- this.sharedService.hierarchicalDataset = sortedDatasetResult.hierarchical;
1555
- flatDatasetOutput = sortedDatasetResult.flat;
1556
- }
1557
- // if we add/remove item(s) from the dataset, we need to also refresh our tree data filters
1558
- if (flatDatasetInput.length > 0 && (forceGridRefresh || flatDatasetInput.length !== prevDatasetLn)) {
1559
- this.filterService.refreshTreeDataFilters(flatDatasetOutput);
1560
- }
1561
- return flatDatasetOutput;
1562
- }
1563
- suggestDateParsingWhenHelpful() {
1564
- if (this.dataView?.getItemCount() > WARN_NO_PREPARSE_DATE_SIZE &&
1565
- !this.options.silenceWarnings &&
1566
- !this.options.preParseDateColumns &&
1567
- this.slickGrid.getColumns().some((c) => isColumnDateType(c.type))) {
1568
- console.warn('[Slickgrid-Universal] For getting better perf, we suggest you enable the `preParseDateColumns` grid option, ' +
1569
- 'for more info visit => https://ghiscoding.gitbook.io/angular-slickgrid/column-functionalities/sorting#pre-parse-date-columns-for-better-perf');
1570
- }
1571
- }
1572
- static ɵfac = function AngularSlickgridComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AngularSlickgridComponent)(i0.ɵɵdirectiveInject(AngularUtilService), i0.ɵɵdirectiveInject(i0.ApplicationRef), i0.ɵɵdirectiveInject(ContainerService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1.TranslateService, 8), i0.ɵɵdirectiveInject(TranslaterService, 8), i0.ɵɵdirectiveInject('defaultGridOption', 8), i0.ɵɵdirectiveInject('externalService', 8)); };
1573
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AngularSlickgridComponent, selectors: [["angular-slickgrid"]], contentQueries: function AngularSlickgridComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
1574
- i0.ɵɵcontentQuery(dirIndex, _c0, 7)(dirIndex, _c1, 7);
1575
- } if (rf & 2) {
1576
- let _t;
1577
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.slickgridHeader = _t.first);
1578
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.slickgridFooter = _t.first);
1579
- } }, inputs: { customDataView: "customDataView", gridId: "gridId", options: "options", containerClasses: "containerClasses", paginationOptions: "paginationOptions", columns: "columns", dataset: "dataset", datasetHierarchical: "datasetHierarchical" }, outputs: { columnsChange: "columnsChange", onActiveCellChanged: "onActiveCellChanged", onActiveCellPositionChanged: "onActiveCellPositionChanged", onAddNewRow: "onAddNewRow", onAutosizeColumns: "onAutosizeColumns", onBeforeAppendCell: "onBeforeAppendCell", onBeforeCellEditorDestroy: "onBeforeCellEditorDestroy", onBeforeColumnsResize: "onBeforeColumnsResize", onBeforeDestroy: "onBeforeDestroy", onBeforeEditCell: "onBeforeEditCell", onBeforeHeaderCellDestroy: "onBeforeHeaderCellDestroy", onBeforeHeaderRowCellDestroy: "onBeforeHeaderRowCellDestroy", onBeforeFooterRowCellDestroy: "onBeforeFooterRowCellDestroy", onBeforeSetColumns: "onBeforeSetColumns", onBeforeSort: "onBeforeSort", onCellChange: "onCellChange", onCellCssStylesChanged: "onCellCssStylesChanged", onClick: "onClick", onColumnsDrag: "onColumnsDrag", onColumnsReordered: "onColumnsReordered", onColumnsResized: "onColumnsResized", onColumnsResizeDblClick: "onColumnsResizeDblClick", onCompositeEditorChange: "onCompositeEditorChange", onContextMenu: "onContextMenu", onDrag: "onDrag", onDragEnd: "onDragEnd", onDragInit: "onDragInit", onDragStart: "onDragStart", onDragReplaceCells: "onDragReplaceCells", onDblClick: "onDblClick", onFooterContextMenu: "onFooterContextMenu", onFooterRowCellRendered: "onFooterRowCellRendered", onHeaderCellRendered: "onHeaderCellRendered", onFooterClick: "onFooterClick", onHeaderClick: "onHeaderClick", onHeaderContextMenu: "onHeaderContextMenu", onHeaderMouseEnter: "onHeaderMouseEnter", onHeaderMouseLeave: "onHeaderMouseLeave", onHeaderRowCellRendered: "onHeaderRowCellRendered", onHeaderRowMouseEnter: "onHeaderRowMouseEnter", onHeaderRowMouseLeave: "onHeaderRowMouseLeave", onKeyDown: "onKeyDown", onMouseEnter: "onMouseEnter", onMouseLeave: "onMouseLeave", onValidationError: "onValidationError", onViewportChanged: "onViewportChanged", onRendered: "onRendered", onSelectedRowsChanged: "onSelectedRowsChanged", onSetOptions: "onSetOptions", onScroll: "onScroll", onSort: "onSort", onBeforePagingInfoChanged: "onBeforePagingInfoChanged", onGroupExpanded: "onGroupExpanded", onGroupCollapsed: "onGroupCollapsed", onPagingInfoChanged: "onPagingInfoChanged", onRowCountChanged: "onRowCountChanged", onRowsChanged: "onRowsChanged", onRowsOrCountChanged: "onRowsOrCountChanged", onSelectedRowIdsChanged: "onSelectedRowIdsChanged", onSetItemsCalled: "onSetItemsCalled", onAfterMenuShow: "onAfterMenuShow", onBeforeMenuClose: "onBeforeMenuClose", onBeforeMenuShow: "onBeforeMenuShow", onColumnsChanged: "onColumnsChanged", onCommand: "onCommand", onGridMenuColumnsChanged: "onGridMenuColumnsChanged", onMenuClose: "onMenuClose", onCopyCells: "onCopyCells", onCopyCancelled: "onCopyCancelled", onPasteCells: "onPasteCells", onBeforePasteCell: "onBeforePasteCell", onAfterExportToExcel: "onAfterExportToExcel", onBeforeExportToExcel: "onBeforeExportToExcel", onBeforeFilterChange: "onBeforeFilterChange", onBeforeFilterClear: "onBeforeFilterClear", onBeforeSearchChange: "onBeforeSearchChange", onBeforeSortChange: "onBeforeSortChange", onContextMenuClearGrouping: "onContextMenuClearGrouping", onContextMenuCollapseAllGroups: "onContextMenuCollapseAllGroups", onContextMenuExpandAllGroups: "onContextMenuExpandAllGroups", onOptionSelected: "onOptionSelected", onColumnPickerColumnsChanged: "onColumnPickerColumnsChanged", onGridMenuMenuClose: "onGridMenuMenuClose", onGridMenuBeforeMenuShow: "onGridMenuBeforeMenuShow", onGridMenuAfterMenuShow: "onGridMenuAfterMenuShow", onGridMenuClearAllPinning: "onGridMenuClearAllPinning", onGridMenuClearAllFilters: "onGridMenuClearAllFilters", onGridMenuClearAllSorting: "onGridMenuClearAllSorting", onGridMenuCommand: "onGridMenuCommand", onHeaderButtonCommand: "onHeaderButtonCommand", onHeaderMenuCommand: "onHeaderMenuCommand", onHeaderMenuColumnResizeByContent: "onHeaderMenuColumnResizeByContent", onHeaderMenuBeforeMenuShow: "onHeaderMenuBeforeMenuShow", onHeaderMenuAfterMenuShow: "onHeaderMenuAfterMenuShow", onHideColumns: "onHideColumns", onItemsAdded: "onItemsAdded", onItemsDeleted: "onItemsDeleted", onItemsUpdated: "onItemsUpdated", onItemsUpserted: "onItemsUpserted", onFullResizeByContentRequested: "onFullResizeByContentRequested", onGridStateChanged: "onGridStateChanged", onBeforePaginationChange: "onBeforePaginationChange", onPaginationChanged: "onPaginationChanged", onPaginationRefreshed: "onPaginationRefreshed", onPaginationVisibilityChanged: "onPaginationVisibilityChanged", onPaginationSetCursorBased: "onPaginationSetCursorBased", onGridBeforeResize: "onGridBeforeResize", onGridAfterResize: "onGridAfterResize", onBeforeResizeByContent: "onBeforeResizeByContent", onAfterResizeByContent: "onAfterResizeByContent", onSortCleared: "onSortCleared", onFilterChanged: "onFilterChanged", onFilterCleared: "onFilterCleared", onSortChanged: "onSortChanged", onTreeItemToggled: "onTreeItemToggled", onTreeFullToggleEnd: "onTreeFullToggleEnd", onTreeFullToggleStart: "onTreeFullToggleStart", onBeforeGridCreate: "onBeforeGridCreate", onGridCreated: "onGridCreated", onDataviewCreated: "onDataviewCreated", onAngularGridCreated: "onAngularGridCreated", onBeforeGridDestroy: "onBeforeGridDestroy", onLanguageChange: "onLanguageChange" }, features: [i0.ɵɵProvidersFeature([AngularUtilService, TranslaterService])], decls: 10, vars: 7, consts: [[1, "gridPane", "grid-pane", 3, "id"], [4, "ngTemplateOutlet"], [1, "slickgrid-container"]], template: function AngularSlickgridComponent_Template(rf, ctx) { if (rf & 1) {
1580
- i0.ɵɵtext(0, "\n ");
1581
- i0.ɵɵelementStart(1, "div", 0);
1582
- i0.ɵɵtext(2, "\n ");
1583
- i0.ɵɵtemplate(3, AngularSlickgridComponent_ng_container_3_Template, 1, 0, "ng-container", 1);
1584
- i0.ɵɵtext(4, "\n ");
1585
- i0.ɵɵelement(5, "div", 2);
1586
- i0.ɵɵtext(6, "\n ");
1587
- i0.ɵɵtemplate(7, AngularSlickgridComponent_ng_container_7_Template, 1, 0, "ng-container", 1);
1588
- i0.ɵɵtext(8, "\n ");
1589
- i0.ɵɵelementEnd();
1590
- i0.ɵɵtext(9, "\n ");
1591
- } if (rf & 2) {
1592
- i0.ɵɵadvance();
1593
- i0.ɵɵclassMap(ctx.containerClasses);
1594
- i0.ɵɵproperty("id", i0.ɵɵinterpolate1("slickGridContainer-", ctx.gridId));
1595
- i0.ɵɵadvance(2);
1596
- i0.ɵɵproperty("ngTemplateOutlet", ctx.slickgridHeader);
1597
- i0.ɵɵadvance(2);
1598
- i0.ɵɵattribute("id", ctx.gridId);
1599
- i0.ɵɵadvance(2);
1600
- i0.ɵɵproperty("ngTemplateOutlet", ctx.slickgridFooter);
1601
- } }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
154
+ function AngularSlickgridComponent_ng_container_3_Template(rf, ctx) {
155
+ if (rf & 1) i0.ɵɵelementContainer(0);
1602
156
  }
1603
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AngularSlickgridComponent, [{
1604
- type: Component,
1605
- args: [{
1606
- selector: 'angular-slickgrid',
1607
- template: `
157
+ function AngularSlickgridComponent_ng_container_7_Template(rf, ctx) {
158
+ if (rf & 1) i0.ɵɵelementContainer(0);
159
+ }
160
+ const WARN_NO_PREPARSE_DATE_SIZE = 1e4;
161
+ var AngularSlickgridComponent = class AngularSlickgridComponent {
162
+ angularUtilService;
163
+ appRef;
164
+ containerService;
165
+ elm;
166
+ translate;
167
+ translaterService;
168
+ forRootConfig;
169
+ _dataset;
170
+ _columns;
171
+ _currentDatasetLength = 0;
172
+ _darkMode = false;
173
+ _eventHandler = new SlickEventHandler();
174
+ _eventPubSubService;
175
+ _angularGridInstances;
176
+ _hideHeaderRowAfterPageLoad = false;
177
+ _isAutosizeColsCalled = false;
178
+ _isGridInitialized = false;
179
+ _isDatasetInitialized = false;
180
+ _isDatasetHierarchicalInitialized = false;
181
+ _isPaginationInitialized = false;
182
+ _isLocalGrid = true;
183
+ _paginationOptions;
184
+ _registeredResources = [];
185
+ _scrollEndCalled = false;
186
+ dataView;
187
+ slickGrid;
188
+ groupingDefinition = {};
189
+ groupItemMetadataProvider;
190
+ backendServiceApi;
191
+ locales;
192
+ metrics;
193
+ showPagination = false;
194
+ serviceList = [];
195
+ totalItems = 0;
196
+ paginationData;
197
+ subscriptions = [];
198
+ slickEmptyWarning;
199
+ slickFooter;
200
+ slickPagination;
201
+ paginationComponent;
202
+ slickRowDetailView;
203
+ backendUtilityService;
204
+ collectionService;
205
+ extensionService;
206
+ extensionUtility;
207
+ filterFactory;
208
+ filterService;
209
+ gridEventService;
210
+ gridService;
211
+ gridStateService;
212
+ headerGroupingService;
213
+ paginationService;
214
+ resizerService;
215
+ rxjs;
216
+ sharedService;
217
+ sortService;
218
+ treeDataService;
219
+ customDataView;
220
+ gridId = "";
221
+ options = {};
222
+ containerClasses = void 0;
223
+ get paginationOptions() {
224
+ return this._paginationOptions;
225
+ }
226
+ set paginationOptions(newPaginationOptions) {
227
+ if (newPaginationOptions && this._paginationOptions) this._paginationOptions = {
228
+ ...this.options.pagination,
229
+ ...this._paginationOptions,
230
+ ...newPaginationOptions
231
+ };
232
+ else this._paginationOptions = newPaginationOptions;
233
+ this.options.pagination = this._paginationOptions ?? this.options.pagination;
234
+ this.paginationService.updateTotalItems(this.options.pagination?.totalItems ?? 0, true);
235
+ }
236
+ get columns() {
237
+ return this._columns;
238
+ }
239
+ set columns(columns) {
240
+ this._columns = columns;
241
+ if (this._isGridInitialized) this.updateColumnDefinitionsList(columns);
242
+ if (columns.length > 0) this.copyColumnWidthsReference(columns);
243
+ }
244
+ columnsChange = new EventEmitter(true);
245
+ onActiveCellChanged = output();
246
+ onActiveCellPositionChanged = output();
247
+ onAddNewRow = output();
248
+ onAutosizeColumns = output();
249
+ onBeforeCellEditorDestroy = output();
250
+ onBeforeColumnsResize = output();
251
+ onBeforeDestroy = output();
252
+ onBeforeEditCell = output();
253
+ onBeforeHeaderCellDestroy = output();
254
+ onBeforeHeaderRowCellDestroy = output();
255
+ onBeforeFooterRowCellDestroy = output();
256
+ onBeforeSetColumns = output();
257
+ onBeforeSort = output();
258
+ onCellChange = output();
259
+ onCellCssStylesChanged = output();
260
+ onClick = output();
261
+ onColumnsDrag = output();
262
+ onColumnsReordered = output();
263
+ onColumnsResized = output();
264
+ onColumnsResizeDblClick = output();
265
+ onCompositeEditorChange = output();
266
+ onContextMenu = output();
267
+ onDrag = output();
268
+ onDragEnd = output();
269
+ onDragInit = output();
270
+ onDragStart = output();
271
+ onDragReplaceCells = output();
272
+ onDblClick = output();
273
+ onFooterContextMenu = output();
274
+ onFooterRowCellRendered = output();
275
+ onHeaderCellRendered = output();
276
+ onFooterClick = output();
277
+ onHeaderClick = output();
278
+ onHeaderContextMenu = output();
279
+ onHeaderMouseEnter = output();
280
+ onHeaderMouseLeave = output();
281
+ onHeaderRowCellRendered = output();
282
+ onHeaderRowMouseEnter = output();
283
+ onHeaderRowMouseLeave = output();
284
+ onKeyDown = output();
285
+ onMouseEnter = output();
286
+ onMouseLeave = output();
287
+ onValidationError = output();
288
+ onViewportChanged = output();
289
+ onRendered = output();
290
+ onSelectedRowsChanged = output();
291
+ onSetOptions = output();
292
+ onScroll = output();
293
+ onSort = output();
294
+ onBeforePagingInfoChanged = output();
295
+ onGroupExpanded = output();
296
+ onGroupCollapsed = output();
297
+ onPagingInfoChanged = output();
298
+ onRowCountChanged = output();
299
+ onRowsChanged = output();
300
+ onRowsOrCountChanged = output();
301
+ onSelectedRowIdsChanged = output();
302
+ onSetItemsCalled = output();
303
+ onAfterMenuShow = output();
304
+ onBeforeMenuClose = output();
305
+ onBeforeMenuShow = output();
306
+ onColumnsChanged = output();
307
+ onCommand = output();
308
+ onGridMenuColumnsChanged = output();
309
+ onMenuClose = output();
310
+ onCopyCells = output();
311
+ onCopyCancelled = output();
312
+ onPasteCells = output();
313
+ onBeforePasteCell = output();
314
+ onAfterExportToExcel = output();
315
+ onBeforeExportToExcel = output();
316
+ onBeforeFilterChange = output();
317
+ onBeforeFilterClear = output();
318
+ onBeforeSearchChange = output();
319
+ onBeforeSortChange = output();
320
+ onContextMenuClearGrouping = output();
321
+ onContextMenuCollapseAllGroups = output();
322
+ onContextMenuExpandAllGroups = output();
323
+ onColumnPickerColumnsChanged = output();
324
+ onGridMenuMenuClose = output();
325
+ onGridMenuBeforeMenuShow = output();
326
+ onGridMenuAfterMenuShow = output();
327
+ onGridMenuClearAllPinning = output();
328
+ onGridMenuClearAllFilters = output();
329
+ onGridMenuClearAllSorting = output();
330
+ onGridMenuCommand = output();
331
+ onHeaderButtonCommand = output();
332
+ onHeaderMenuCommand = output();
333
+ onHeaderMenuColumnResizeByContent = output();
334
+ onHeaderMenuBeforeMenuShow = output();
335
+ onHeaderMenuAfterMenuShow = output();
336
+ onHideColumns = output();
337
+ onItemsAdded = output();
338
+ onItemsDeleted = output();
339
+ onItemsUpdated = output();
340
+ onItemsUpserted = output();
341
+ onFullResizeByContentRequested = output();
342
+ onGridStateChanged = output();
343
+ onBeforePaginationChange = output();
344
+ onPaginationChanged = output();
345
+ onPaginationRefreshed = output();
346
+ onPaginationVisibilityChanged = output();
347
+ onPaginationSetCursorBased = output();
348
+ onGridBeforeResize = output();
349
+ onGridAfterResize = output();
350
+ onBeforeResizeByContent = output();
351
+ onAfterResizeByContent = output();
352
+ onSortCleared = output();
353
+ onFilterChanged = output();
354
+ onFilterCleared = output();
355
+ onSortChanged = output();
356
+ onTreeItemToggled = output();
357
+ onTreeFullToggleEnd = output();
358
+ onTreeFullToggleStart = output();
359
+ onBeforeGridCreate = output();
360
+ onGridCreated = output();
361
+ onDataviewCreated = output();
362
+ onAngularGridCreated = output();
363
+ onBeforeGridDestroy = output();
364
+ onLanguageChange = output();
365
+ get dataset() {
366
+ return (this.customDataView ? this.slickGrid?.getData?.() : this.dataView?.getItems()) || [];
367
+ }
368
+ set dataset(newDataset) {
369
+ const prevDatasetLn = this._currentDatasetLength;
370
+ const isDatasetEqual = dequal(newDataset, this._dataset || []);
371
+ let data = newDataset;
372
+ if (this.slickGrid && this.options?.enableTreeData && Array.isArray(newDataset) && (newDataset.length > 0 || newDataset.length !== prevDatasetLn || !isDatasetEqual)) {
373
+ this._isDatasetHierarchicalInitialized = false;
374
+ data = this.sortTreeDataset(newDataset, !isDatasetEqual);
375
+ }
376
+ this._dataset = data;
377
+ this.refreshGridData(data || []);
378
+ this._currentDatasetLength = (newDataset || []).length;
379
+ if (this.slickGrid && this.options?.autoFitColumnsOnFirstLoad && prevDatasetLn === 0 && !this._isAutosizeColsCalled) {
380
+ this.slickGrid.autosizeColumns();
381
+ this._isAutosizeColsCalled = true;
382
+ }
383
+ this.suggestDateParsingWhenHelpful();
384
+ }
385
+ get datasetHierarchical() {
386
+ return this.sharedService.hierarchicalDataset;
387
+ }
388
+ set datasetHierarchical(newHierarchicalDataset) {
389
+ const isDatasetEqual = dequal(newHierarchicalDataset, this.sharedService?.hierarchicalDataset ?? []);
390
+ const prevFlatDatasetLn = this._currentDatasetLength;
391
+ this.sharedService.hierarchicalDataset = newHierarchicalDataset;
392
+ if (newHierarchicalDataset && this.columns && this.filterService?.clearFilters) this.filterService.clearFilters();
393
+ if (newHierarchicalDataset && this.slickGrid && this.sortService?.processTreeDataInitialSort) {
394
+ this.sortService.processTreeDataInitialSort();
395
+ this.treeDataService.initHierarchicalTree();
396
+ queueMicrotask(() => {
397
+ const flatDatasetLn = this.dataView.getItemCount();
398
+ if (flatDatasetLn > 0 && (flatDatasetLn !== prevFlatDatasetLn || !isDatasetEqual)) this.filterService.refreshTreeDataFilters();
399
+ });
400
+ this._isDatasetHierarchicalInitialized = true;
401
+ }
402
+ }
403
+ get elementRef() {
404
+ return this.elm;
405
+ }
406
+ get backendService() {
407
+ return this.options?.backendServiceApi?.service;
408
+ }
409
+ get eventHandler() {
410
+ return this._eventHandler;
411
+ }
412
+ get gridContainerElement() {
413
+ return document.querySelector(`#${this.options.gridContainerId || ""}`);
414
+ }
415
+ get isDatasetInitialized() {
416
+ return this._isDatasetInitialized;
417
+ }
418
+ set isDatasetInitialized(isInitialized) {
419
+ this._isDatasetInitialized = isInitialized;
420
+ }
421
+ set isDatasetHierarchicalInitialized(isInitialized) {
422
+ this._isDatasetHierarchicalInitialized = isInitialized;
423
+ }
424
+ get registeredResources() {
425
+ return this._registeredResources;
426
+ }
427
+ slickgridHeader = null;
428
+ slickgridFooter = null;
429
+ constructor(angularUtilService, appRef, containerService, elm, translate, translaterService, forRootConfig, externalServices) {
430
+ this.angularUtilService = angularUtilService;
431
+ this.appRef = appRef;
432
+ this.containerService = containerService;
433
+ this.elm = elm;
434
+ this.translate = translate;
435
+ this.translaterService = translaterService;
436
+ this.forRootConfig = forRootConfig;
437
+ const slickgridConfig = new SlickgridConfig$1();
438
+ this._eventPubSubService = externalServices?.eventPubSubService ?? new EventPubSubService(this.elm.nativeElement);
439
+ this._eventPubSubService.eventNamingStyle = "camelCase";
440
+ this.backendUtilityService = externalServices?.backendUtilityService ?? new BackendUtilityService();
441
+ this.gridEventService = externalServices?.gridEventService ?? new GridEventService();
442
+ this.sharedService = externalServices?.sharedService ?? new SharedService();
443
+ this.collectionService = externalServices?.collectionService ?? new CollectionService(this.translaterService);
444
+ this.extensionUtility = externalServices?.extensionUtility ?? new ExtensionUtility(this.sharedService, this.backendUtilityService, this.translaterService);
445
+ this.filterFactory = new FilterFactory(slickgridConfig, this.translaterService, this.collectionService);
446
+ this.filterService = externalServices?.filterService ?? new FilterService(this.filterFactory, this._eventPubSubService, this.sharedService, this.backendUtilityService);
447
+ this.resizerService = externalServices?.resizerService ?? new ResizerService(this._eventPubSubService);
448
+ this.sortService = externalServices?.sortService ?? new SortService(this.collectionService, this.sharedService, this._eventPubSubService, this.backendUtilityService);
449
+ this.treeDataService = externalServices?.treeDataService ?? new TreeDataService(this._eventPubSubService, this.filterService, this.sharedService, this.sortService);
450
+ this.paginationService = externalServices?.paginationService ?? new PaginationService(this._eventPubSubService, this.sharedService, this.backendUtilityService);
451
+ this.extensionService = externalServices?.extensionService ?? new ExtensionService(this.extensionUtility, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.treeDataService, this.translaterService, () => this.gridService);
452
+ /* v8 ignore next 8 */
453
+ this.gridStateService = externalServices?.gridStateService ?? new GridStateService(this.extensionService, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.treeDataService);
454
+ /* v8 ignore next 9 */
455
+ this.gridService = externalServices?.gridService ?? new GridService(this.gridStateService, this.filterService, this._eventPubSubService, this.paginationService, this.sharedService, this.sortService, this.treeDataService);
456
+ this.headerGroupingService = externalServices?.headerGroupingService ?? new HeaderGroupingService(this.extensionUtility);
457
+ this.serviceList = [
458
+ this.containerService,
459
+ this.extensionService,
460
+ this.filterService,
461
+ this.gridEventService,
462
+ this.gridService,
463
+ this.gridStateService,
464
+ this.headerGroupingService,
465
+ this.paginationService,
466
+ this.resizerService,
467
+ this.sortService,
468
+ this.treeDataService
469
+ ];
470
+ this.containerService.registerInstance("ExtensionUtility", this.extensionUtility);
471
+ this.containerService.registerInstance("FilterService", this.filterService);
472
+ this.containerService.registerInstance("CollectionService", this.collectionService);
473
+ this.containerService.registerInstance("ExtensionService", this.extensionService);
474
+ this.containerService.registerInstance("GridEventService", this.gridEventService);
475
+ this.containerService.registerInstance("GridService", this.gridService);
476
+ this.containerService.registerInstance("GridStateService", this.gridStateService);
477
+ this.containerService.registerInstance("HeaderGroupingService", this.headerGroupingService);
478
+ this.containerService.registerInstance("PaginationService", this.paginationService);
479
+ this.containerService.registerInstance("ResizerService", this.resizerService);
480
+ this.containerService.registerInstance("SharedService", this.sharedService);
481
+ this.containerService.registerInstance("SortService", this.sortService);
482
+ this.containerService.registerInstance("EventPubSubService", this._eventPubSubService);
483
+ this.containerService.registerInstance("PubSubService", this._eventPubSubService);
484
+ this.containerService.registerInstance("TranslaterService", this.translaterService);
485
+ this.containerService.registerInstance("TreeDataService", this.treeDataService);
486
+ }
487
+ ngAfterViewInit() {
488
+ if (!this.columns) throw new Error("Using `<angular-slickgrid>` requires [columns], it seems that you might have forgot to provide the missing bindable input.");
489
+ this.initialization(this._eventHandler);
490
+ this._isGridInitialized = true;
491
+ if (this.options?.enableEmptyDataWarningMessage && Array.isArray(this.dataset)) {
492
+ const finalTotalCount = this.dataset.length;
493
+ this.displayEmptyDataWarning(finalTotalCount < 1);
494
+ }
495
+ if (this.options.darkMode) this.setDarkMode(true);
496
+ this.suggestDateParsingWhenHelpful();
497
+ }
498
+ ngOnDestroy() {
499
+ this._eventPubSubService.publish("onBeforeGridDestroy", this.slickGrid);
500
+ this.destroy();
501
+ }
502
+ destroy(shouldEmptyDomElementContainer = false) {
503
+ this.serviceList.forEach((service) => {
504
+ if (typeof service?.dispose === "function") service.dispose();
505
+ });
506
+ this.serviceList.length = 0;
507
+ this._eventPubSubService?.unsubscribeAll();
508
+ this.backendService?.dispose?.();
509
+ this.disposeExternalResources();
510
+ this.slickEmptyWarning?.dispose();
511
+ this.slickFooter?.dispose();
512
+ this.slickPagination?.dispose();
513
+ if (this._eventHandler?.unsubscribeAll) this._eventHandler.unsubscribeAll();
514
+ if (this.dataView) {
515
+ this.dataView.setItems([]);
516
+ this.dataView.destroy();
517
+ }
518
+ if (this.slickGrid?.destroy) this.slickGrid.destroy(shouldEmptyDomElementContainer);
519
+ if (this.backendServiceApi) {
520
+ for (const prop of Object.keys(this.backendServiceApi)) delete this.backendServiceApi[prop];
521
+ this.backendServiceApi = void 0;
522
+ }
523
+ for (const prop of Object.keys(this.sharedService)) this.sharedService[prop] = null;
524
+ this.subscriptions = unsubscribeAll(this.subscriptions);
525
+ this._dataset = null;
526
+ this.datasetHierarchical = void 0;
527
+ this._columns = [];
528
+ this._angularGridInstances = void 0;
529
+ this.slickGrid = void 0;
530
+ if (shouldEmptyDomElementContainer) this.emptyGridContainerElm();
531
+ }
532
+ disposeExternalResources() {
533
+ if (Array.isArray(this._registeredResources)) while (this._registeredResources.length > 0) {
534
+ const res = this._registeredResources.pop();
535
+ if (typeof res?.dispose === "function") res.dispose();
536
+ }
537
+ this._registeredResources = [];
538
+ }
539
+ emptyGridContainerElm() {
540
+ const gridContainerId = this.options?.gridContainerId || "grid1";
541
+ const gridContainerElm = document.querySelector(`#${gridContainerId}`);
542
+ emptyElement(gridContainerElm);
543
+ }
544
+ createBackendApiInternalPostProcessCallback(gridOptions) {
545
+ const backendApi = gridOptions?.backendServiceApi;
546
+ if (backendApi?.service) {
547
+ const backendApiService = backendApi.service;
548
+ if (typeof backendApiService.getDatasetName === "function") backendApi.internalPostProcess = (processResult) => {
549
+ const datasetName = backendApi && backendApiService && typeof backendApiService.getDatasetName === "function" ? backendApiService.getDatasetName() : "";
550
+ if (!Array.isArray(processResult) && processResult?.data[datasetName]) {
551
+ const data = "nodes" in processResult.data[datasetName] ? processResult.data[datasetName].nodes : processResult.data[datasetName];
552
+ const totalCount = "totalCount" in processResult.data[datasetName] ? processResult.data[datasetName].totalCount : processResult.data[datasetName].length;
553
+ this.refreshGridData(data, totalCount || 0);
554
+ }
555
+ };
556
+ }
557
+ }
558
+ initialization(eventHandler) {
559
+ this.options.translater = this.translaterService;
560
+ this._eventHandler = eventHandler;
561
+ this._isAutosizeColsCalled = false;
562
+ this._eventPubSubService.eventNamingStyle = this.options?.eventNamingStyle ?? "camelCase";
563
+ this._eventPubSubService.publish("onBeforeGridCreate", true);
564
+ this._dataset ||= [];
565
+ this.options = this.mergeGridOptions(this.options);
566
+ this._paginationOptions = this.options?.pagination;
567
+ this.locales = this.options?.locales ?? Constants.locales;
568
+ this.backendServiceApi = this.options?.backendServiceApi;
569
+ this._isLocalGrid = !this.backendServiceApi;
570
+ if (this.options.backendServiceApi && !this.options.backendServiceApi?.disableInternalPostProcess) this.createBackendApiInternalPostProcessCallback(this.options);
571
+ if (!this.customDataView) {
572
+ let dataViewOptions = { ...this.options.dataView };
573
+ if (this.options.draggableGrouping || this.options.enableGrouping) {
574
+ this.groupItemMetadataProvider = new SlickGroupItemMetadataProvider(this.options.groupItemMetadataOption);
575
+ this.sharedService.groupItemMetadataProvider = this.groupItemMetadataProvider;
576
+ dataViewOptions = {
577
+ ...dataViewOptions,
578
+ groupItemMetadataProvider: this.groupItemMetadataProvider
579
+ };
580
+ }
581
+ this.dataView = new SlickDataView(dataViewOptions, this._eventPubSubService);
582
+ this._eventPubSubService.publish("onDataviewCreated", this.dataView);
583
+ }
584
+ this.preRegisterResources();
585
+ this._columns = this.gridStateService.loadSlickGridEditors(this._columns || []);
586
+ if (this.options.autoAddCustomEditorFormatter) autoAddEditorFormatterToColumnsWithEditor(this._columns, this.options.autoAddCustomEditorFormatter);
587
+ this.sharedService.allColumns = this._columns;
588
+ this.subscriptions.push(this._eventPubSubService.subscribe("onPluginColumnsChanged", (data) => {
589
+ this._columns = data.columns;
590
+ this.columnsChange.emit(this._columns);
591
+ }));
592
+ this.extensionService.createExtensionsBeforeGridCreation(this._columns, this.options);
593
+ if (this.options.presets?.pinning) this.options = {
594
+ ...this.options,
595
+ pinning: this.options.presets.pinning
596
+ };
597
+ this.slickGrid = new SlickGrid(`#${this.gridId}`, this.customDataView || this.dataView, this._columns, this.options, this._eventPubSubService);
598
+ if (typeof this.dataView.setGrid === "function") this.dataView.setGrid(this.slickGrid);
599
+ this.sharedService.dataView = this.dataView;
600
+ this.sharedService.slickGrid = this.slickGrid;
601
+ this.sharedService.gridContainerElement = this.elm.nativeElement;
602
+ if (this.groupItemMetadataProvider) this.slickGrid.registerPlugin(this.groupItemMetadataProvider);
603
+ this.registerResources();
604
+ this.extensionService.bindDifferentExtensions();
605
+ this.bindDifferentHooks(this.slickGrid, this.options, this.dataView);
606
+ this.slickGrid.init();
607
+ if (this.gridContainerElement) this.resizerService.init(this.slickGrid, this.gridContainerElement);
608
+ if (!this.options.enablePagination && this.options.showCustomFooter && this.options.customFooterOptions && this.gridContainerElement) {
609
+ this.slickFooter = new SlickFooterComponent(this.slickGrid, this.options.customFooterOptions, this._eventPubSubService, this.translaterService);
610
+ this.slickFooter.renderFooter(this.gridContainerElement);
611
+ }
612
+ if (!this.customDataView && this.dataView) {
613
+ const initialDataset = this.options?.enableTreeData ? this.sortTreeDataset(this._dataset) : this._dataset;
614
+ this.dataView.beginUpdate();
615
+ this.dataView.setItems(initialDataset || [], this.options.datasetIdPropertyName ?? "id");
616
+ this.dataView.endUpdate();
617
+ if (this.slickGrid?.getSelectionModel() && this.options?.dataView && "syncGridSelection" in this.options.dataView) {
618
+ let preservedRowSelectionWithBackend = false;
619
+ if (this.options.backendServiceApi && "syncGridSelectionWithBackendService" in this.options.dataView) preservedRowSelectionWithBackend = this.options.dataView.syncGridSelectionWithBackendService;
620
+ const syncGridSelection = this.options.dataView.syncGridSelection;
621
+ if (typeof syncGridSelection === "boolean") {
622
+ let preservedRowSelection = syncGridSelection;
623
+ if (!this._isLocalGrid) preservedRowSelection = syncGridSelection && preservedRowSelectionWithBackend;
624
+ this.dataView.syncGridSelection(this.slickGrid, preservedRowSelection);
625
+ } else if (typeof syncGridSelection === "object") this.dataView.syncGridSelection(this.slickGrid, syncGridSelection.preserveHidden, syncGridSelection.preserveHiddenOnSelectionChange);
626
+ }
627
+ if ((this.dataView.getLength() || this._dataset?.length || 0) > 0) {
628
+ if (!this._isDatasetInitialized && (this.options.enableCheckboxSelector || this.options.enableSelection)) this.loadRowSelectionPresetWhenExists();
629
+ this.loadFilterPresetsWhenDatasetInitialized();
630
+ this._isDatasetInitialized = true;
631
+ }
632
+ }
633
+ if (this._hideHeaderRowAfterPageLoad) {
634
+ this.showHeaderRow(false);
635
+ this.sharedService.hideHeaderRowAfterPageLoad = this._hideHeaderRowAfterPageLoad;
636
+ }
637
+ this._eventPubSubService.publish("onGridCreated", this.slickGrid);
638
+ if (!this.customDataView) this.executeAfterDataviewCreated(this.slickGrid, this.options);
639
+ this.bindResizeHook(this.slickGrid, this.options);
640
+ if (this.options?.backendServiceApi) this.bindBackendCallbackFunctions(this.options);
641
+ if (this.options?.enablePagination && this._isLocalGrid) {
642
+ this.showPagination = true;
643
+ this.loadLocalGridPagination(this.dataset);
644
+ }
645
+ this._angularGridInstances = {
646
+ dataView: this.dataView,
647
+ slickGrid: this.slickGrid,
648
+ extensions: this.extensionService?.extensionList,
649
+ destroy: this.destroy.bind(this),
650
+ backendService: this.backendService,
651
+ eventPubSubService: this._eventPubSubService,
652
+ filterService: this.filterService,
653
+ gridEventService: this.gridEventService,
654
+ gridStateService: this.gridStateService,
655
+ gridService: this.gridService,
656
+ headerGroupingService: this.headerGroupingService,
657
+ extensionService: this.extensionService,
658
+ paginationComponent: this.slickPagination,
659
+ paginationService: this.paginationService,
660
+ resizerService: this.resizerService,
661
+ sortService: this.sortService,
662
+ treeDataService: this.treeDataService
663
+ };
664
+ this._eventPubSubService.publish("onAngularGridCreated", this._angularGridInstances);
665
+ }
666
+ paginationChanged(pagination) {
667
+ const isSyncGridSelectionEnabled = this.gridStateService?.needToPreserveRowSelection() ?? false;
668
+ if (this.slickGrid && !isSyncGridSelectionEnabled && this.options?.backendServiceApi && (this.options.enableSelection || this.options.enableCheckboxSelector)) this.slickGrid.setSelectedRows([]);
669
+ const { pageNumber, pageSize } = pagination;
670
+ if (this.sharedService) {
671
+ if (pageSize !== void 0 && pageNumber !== void 0) this.sharedService.currentPagination = {
672
+ pageNumber,
673
+ pageSize
674
+ };
675
+ }
676
+ this._eventPubSubService.publish("onGridStateChanged", {
677
+ change: {
678
+ newValues: {
679
+ pageNumber,
680
+ pageSize
681
+ },
682
+ type: "pagination"
683
+ },
684
+ gridState: this.gridStateService.getCurrentGridState()
685
+ });
686
+ }
687
+ refreshGridData(dataset, totalCount) {
688
+ if (this.options?.enableEmptyDataWarningMessage && Array.isArray(dataset)) {
689
+ const finalTotalCount = totalCount || dataset.length;
690
+ this.displayEmptyDataWarning(finalTotalCount < 1);
691
+ }
692
+ if (Array.isArray(dataset) && this.slickGrid && this.dataView?.setItems) {
693
+ this.dataView.setItems(dataset, this.options.datasetIdPropertyName ?? "id");
694
+ if (!this.options.backendServiceApi && !this.options.enableTreeData) this.dataView.reSort();
695
+ if (dataset.length > 0) {
696
+ if (!this._isDatasetInitialized) {
697
+ this.loadFilterPresetsWhenDatasetInitialized();
698
+ if (this.options.enableCheckboxSelector) this.loadRowSelectionPresetWhenExists();
699
+ }
700
+ this._isDatasetInitialized = true;
701
+ }
702
+ if (dataset) this.slickGrid.invalidate();
703
+ this.showPagination = !!(this.options && (this.options.enablePagination || this.options.backendServiceApi && this.options.enablePagination === void 0));
704
+ if (this._paginationOptions && this.options?.pagination && this.options?.backendServiceApi) {
705
+ const paginationOptions = this.setPaginationOptionsWhenPresetDefined(this.options, this._paginationOptions);
706
+ const totalRecords = totalCount !== void 0 ? totalCount : this.options?.pagination?.totalItems;
707
+ if (totalRecords !== void 0 && totalRecords !== this.totalItems) this.totalItems = +totalRecords;
708
+ if (!this._isPaginationInitialized) this.initializePaginationService(paginationOptions);
709
+ else this.paginationService.updateTotalItems(this.totalItems);
710
+ }
711
+ if (this.slickGrid && this.options.enableAutoResize) {
712
+ const delay = this.options.autoResize && this.options.autoResize.delay;
713
+ this.resizerService.resizeGrid(delay || 10);
714
+ }
715
+ }
716
+ }
717
+ setData(data, shouldAutosizeColumns = false) {
718
+ if (shouldAutosizeColumns) {
719
+ this._isAutosizeColsCalled = false;
720
+ this._currentDatasetLength = 0;
721
+ }
722
+ this.dataset = data || [];
723
+ }
724
+ setPaginationOptionsWhenPresetDefined(gridOptions, paginationOptions) {
725
+ if (gridOptions.presets?.pagination && paginationOptions && !this._isPaginationInitialized) {
726
+ if (this.hasBackendInfiniteScroll()) console.warn("[Angular-Slickgrid] `presets.pagination` is not supported with Infinite Scroll, reverting to first page.");
727
+ else {
728
+ paginationOptions.pageSize = gridOptions.presets.pagination.pageSize;
729
+ paginationOptions.pageNumber = gridOptions.presets.pagination.pageNumber;
730
+ }
731
+ }
732
+ return paginationOptions;
733
+ }
734
+ setDarkMode(dark = false) {
735
+ this.sharedService.gridContainerElement?.classList.toggle("slick-dark-mode", dark);
736
+ }
737
+ updateColumnDefinitionsList(newColumns) {
738
+ const updatedColumns = this.gridStateService.syncPluginColumns(newColumns, [...this.sharedService.allColumns || [], ...newColumns]);
739
+ if (this.options.enableTranslate) this.extensionService.translateColumnHeaders(void 0, updatedColumns);
740
+ this.extensionService.renderColumnHeaders(updatedColumns, true);
741
+ if (this.options?.enableAutoSizeColumns) this.slickGrid.autosizeColumns();
742
+ else if (this.options?.enableAutoResizeColumnsByCellContent && this.resizerService?.resizeColumnsByCellContent) this.resizerService.resizeColumnsByCellContent();
743
+ }
744
+ showHeaderRow(showing = true) {
745
+ this.slickGrid.setHeaderRowVisibility(showing);
746
+ if (showing === true && this._isGridInitialized) this.slickGrid.setColumns(this.columns);
747
+ return showing;
748
+ }
749
+ displayEmptyDataWarning(showWarning = true) {
750
+ this.slickEmptyWarning?.showEmptyDataMessage(showWarning);
751
+ }
752
+ copyColumnWidthsReference(columns) {
753
+ columns.forEach((col) => col.originalWidth = col.width);
754
+ }
755
+ bindDifferentHooks(grid, gridOptions, dataView) {
756
+ if (this.translate?.onLangChange) {
757
+ if (gridOptions.enableTranslate) this.extensionService.translateAllExtensions();
758
+ this.subscriptions.push(this.translate.onLangChange.subscribe(({ lang }) => {
759
+ this._eventPubSubService.publish("onLanguageChange", lang);
760
+ if (gridOptions.enableTranslate) {
761
+ this.extensionService.translateAllExtensions(lang);
762
+ if (gridOptions.createPreHeaderPanel && gridOptions.createTopHeaderPanel || gridOptions.createPreHeaderPanel && !gridOptions.enableDraggableGrouping) this.headerGroupingService.translateHeaderGrouping();
763
+ }
764
+ }));
765
+ }
766
+ if (gridOptions.backendServiceApi) {
767
+ const backendApi = gridOptions.backendServiceApi;
768
+ if (backendApi?.service?.init) backendApi.service.init(backendApi.options, gridOptions.pagination, this.slickGrid, this.sharedService);
769
+ }
770
+ if (dataView && grid) {
771
+ this.gridEventService.bindOnCellChange(grid);
772
+ this.gridEventService.bindOnClick(grid);
773
+ if (gridOptions.enableSorting) {
774
+ if (gridOptions.backendServiceApi && !gridOptions.backendServiceApi.useLocalSorting) this.sortService.bindBackendOnSort(grid);
775
+ else this.sortService.bindLocalOnSort(grid);
776
+ }
777
+ if (gridOptions.enableFiltering) {
778
+ this.filterService.init(grid);
779
+ if (gridOptions.backendServiceApi && !gridOptions.backendServiceApi.useLocalFiltering) this.filterService.bindBackendOnFilter(grid);
780
+ else this.filterService.bindLocalOnFilter(grid);
781
+ }
782
+ this._eventHandler.subscribe(grid.onColumnsReordered, () => {
783
+ this.sharedService.hasColumnsReordered = true;
784
+ });
785
+ this._eventHandler.subscribe(grid.onSetOptions, (_e, args) => {
786
+ if (args.optionsBefore.darkMode !== args.optionsAfter.darkMode && this.gridContainerElement) this.setDarkMode(args.optionsAfter.darkMode);
787
+ });
788
+ this.loadColumnPresetsWhenDatasetInitialized();
789
+ this.loadFilterPresetsWhenDatasetInitialized();
790
+ this._eventHandler.subscribe(dataView.onRowCountChanged, (_e, args) => {
791
+ if (!gridOptions.enableRowDetailView || !Array.isArray(args.changedRows) || args.changedRows.length === args.itemCount) grid.invalidate();
792
+ else {
793
+ grid.invalidateRows(args.changedRows);
794
+ grid.render();
795
+ }
796
+ this.handleOnItemCountChanged(dataView.getFilteredItemCount() || 0, dataView.getItemCount() || 0);
797
+ });
798
+ this._eventHandler.subscribe(dataView.onSetItemsCalled, (_e, args) => {
799
+ this.sharedService.isItemsDateParsed = false;
800
+ this.handleOnItemCountChanged(dataView.getFilteredItemCount() || 0, args.itemCount);
801
+ if (args.itemCount > 0 && (this.options.autosizeColumnsByCellContentOnFirstLoad || this.options.enableAutoResizeColumnsByCellContent)) this.resizerService.resizeColumnsByCellContent(!this.options?.resizeByContentOnlyOnFirstLoad);
802
+ });
803
+ if (gridOptions?.enableFiltering && !gridOptions.enableRowDetailView) this._eventHandler.subscribe(dataView.onRowsChanged, (_e, { calledOnRowCountChanged, rows }) => {
804
+ if (!calledOnRowCountChanged && Array.isArray(rows)) {
805
+ const ranges = grid.getRenderedRange();
806
+ rows.filter((row) => row >= ranges.top && row <= ranges.bottom).forEach((row) => grid.updateRow(row));
807
+ grid.render();
808
+ }
809
+ });
810
+ }
811
+ }
812
+ bindBackendCallbackFunctions(gridOptions) {
813
+ const backendApi = gridOptions.backendServiceApi;
814
+ const backendApiService = backendApi?.service;
815
+ const serviceOptions = backendApiService?.options ?? {};
816
+ const isExecuteCommandOnInit = !serviceOptions ? false : serviceOptions && "executeProcessCommandOnInit" in serviceOptions ? serviceOptions["executeProcessCommandOnInit"] : true;
817
+ if (backendApiService) {
818
+ if (gridOptions?.presets) {
819
+ if (backendApiService.updateFilters && Array.isArray(gridOptions.presets.filters) && gridOptions.presets.filters.length > 0) backendApiService.updateFilters(gridOptions.presets.filters, true);
820
+ if (backendApiService.updateSorters && Array.isArray(gridOptions.presets.sorters) && gridOptions.presets.sorters.length > 0) {
821
+ const sortColumns = this.options.multiColumnSort ? gridOptions.presets.sorters : gridOptions.presets.sorters.slice(0, 1);
822
+ backendApiService.updateSorters(void 0, sortColumns);
823
+ }
824
+ if (backendApiService.updatePagination && gridOptions.presets.pagination && !this.hasBackendInfiniteScroll()) {
825
+ const { pageNumber, pageSize } = gridOptions.presets.pagination;
826
+ backendApiService.updatePagination(pageNumber, pageSize);
827
+ }
828
+ } else {
829
+ const columnFilters = this.filterService.getColumnFilters();
830
+ if (columnFilters && backendApiService.updateFilters) backendApiService.updateFilters(columnFilters, false);
831
+ }
832
+ if (backendApi && backendApiService && (backendApi.onInit || isExecuteCommandOnInit)) {
833
+ const query = typeof backendApiService.buildQuery === "function" ? backendApiService.buildQuery() : "";
834
+ const process = isExecuteCommandOnInit ? backendApi.process && backendApi.process(query) || null : backendApi.onInit && backendApi.onInit(query) || null;
835
+ queueMicrotask(() => {
836
+ const backendUtilityService = this.backendUtilityService;
837
+ const startTime = /* @__PURE__ */ new Date();
838
+ if (backendApi.preProcess) backendApi.preProcess();
839
+ const totalItems = this.options?.pagination?.totalItems ?? 0;
840
+ if (process instanceof Promise) process.then((processResult) => backendUtilityService.executeBackendProcessesCallback(startTime, processResult, backendApi, totalItems)).catch((error) => backendUtilityService.onBackendError(error, backendApi));
841
+ else if (process && this.rxjs?.isObservable(process)) this.subscriptions.push(process.subscribe({
842
+ next: (processResult) => backendUtilityService.executeBackendProcessesCallback(startTime, processResult, backendApi, totalItems),
843
+ error: (error) => backendUtilityService.onBackendError(error, backendApi)
844
+ }));
845
+ });
846
+ }
847
+ if (backendApi.service.options?.infiniteScroll) this.addBackendInfiniteScrollCallback();
848
+ }
849
+ }
850
+ addBackendInfiniteScrollCallback() {
851
+ if (this.slickGrid && this.options.backendServiceApi && this.hasBackendInfiniteScroll() && !this.options.backendServiceApi?.onScrollEnd) {
852
+ const onScrollEnd = () => {
853
+ this.backendUtilityService.setInfiniteScrollBottomHit(true);
854
+ this.paginationService.goToNextPage().then((hasNext) => {
855
+ if (!hasNext) this.backendUtilityService.setInfiniteScrollBottomHit(false);
856
+ });
857
+ };
858
+ this.options.backendServiceApi.onScrollEnd = onScrollEnd;
859
+ this._eventHandler.subscribe(this.slickGrid.onScroll, (_e, args) => {
860
+ const viewportElm = args.grid.getViewportNode();
861
+ if (["mousewheel", "scroll"].includes(args.triggeredBy || "") && this.paginationService?.totalItems && args.scrollTop > 0 && Math.ceil(viewportElm.offsetHeight + args.scrollTop) >= args.scrollHeight) {
862
+ if (!this._scrollEndCalled) {
863
+ onScrollEnd();
864
+ this._scrollEndCalled = true;
865
+ }
866
+ }
867
+ });
868
+ const orgPostProcess = this.options.backendServiceApi.postProcess;
869
+ this.options.backendServiceApi.postProcess = (processResult) => {
870
+ this._scrollEndCalled = false;
871
+ if (orgPostProcess) orgPostProcess(processResult);
872
+ };
873
+ }
874
+ }
875
+ bindResizeHook(grid, options) {
876
+ if (options.autoFitColumnsOnFirstLoad && options.autosizeColumnsByCellContentOnFirstLoad || options.enableAutoSizeColumns && options.enableAutoResizeColumnsByCellContent) throw new Error(`[Angular-Slickgrid] You cannot enable both autosize/fit viewport & resize by content, you must choose which resize technique to use. You can enable these 2 options ("autoFitColumnsOnFirstLoad" and "enableAutoSizeColumns") OR these other 2 options ("autosizeColumnsByCellContentOnFirstLoad" and "enableAutoResizeColumnsByCellContent").`);
877
+ if (options.gridHeight || options.gridWidth) this.resizerService.resizeGrid(0, {
878
+ height: options.gridHeight,
879
+ width: options.gridWidth
880
+ });
881
+ else this.resizerService.resizeGrid();
882
+ if (grid && options?.enableAutoResize && options.autoFitColumnsOnFirstLoad && options.enableAutoSizeColumns && !this._isAutosizeColsCalled) {
883
+ grid.autosizeColumns();
884
+ this._isAutosizeColsCalled = true;
885
+ }
886
+ }
887
+ executeAfterDataviewCreated(_grid, gridOptions) {
888
+ if (gridOptions.enableSorting && Array.isArray(gridOptions.presets?.sorters)) {
889
+ const sortColumns = this.options.multiColumnSort ? gridOptions.presets.sorters : gridOptions.presets.sorters.slice(0, 1);
890
+ this.sortService.loadGridSorters(sortColumns);
891
+ }
892
+ }
893
+ handleOnItemCountChanged(currentPageRowItemCount, totalItemCount) {
894
+ this._currentDatasetLength = totalItemCount;
895
+ this.metrics = {
896
+ startTime: /* @__PURE__ */ new Date(),
897
+ endTime: /* @__PURE__ */ new Date(),
898
+ itemCount: currentPageRowItemCount,
899
+ totalItemCount
900
+ };
901
+ if (this.slickFooter) this.slickFooter.metrics = this.metrics;
902
+ if (this._isLocalGrid && this.options?.enableEmptyDataWarningMessage) this.displayEmptyDataWarning(currentPageRowItemCount === 0);
903
+ if (this.options.enableAutoResize && this.resizerService.isAutoHeightEnabled && currentPageRowItemCount > 0) this.resizerService.resizeGrid();
904
+ }
905
+ initializePaginationService(paginationOptions) {
906
+ if (this.options) {
907
+ this.paginationData = {
908
+ gridOptions: this.options,
909
+ paginationService: this.paginationService
910
+ };
911
+ this.paginationService.totalItems = this.totalItems;
912
+ this.paginationService.init(this.slickGrid, paginationOptions, this.backendServiceApi);
913
+ this.subscriptions.push(this._eventPubSubService.subscribe("onPaginationChanged", (paginationChanges) => {
914
+ this.paginationChanged(paginationChanges);
915
+ }), this._eventPubSubService.subscribe("onPaginationVisibilityChanged", (visibility) => {
916
+ this.showPagination = visibility?.visible ?? false;
917
+ if (this.options?.backendServiceApi) this.backendUtilityService?.refreshBackendDataset(this.options);
918
+ this.renderPagination(this.showPagination);
919
+ }));
920
+ this.renderPagination();
921
+ this._isPaginationInitialized = true;
922
+ }
923
+ }
924
+ loadColumnPresetsWhenDatasetInitialized() {
925
+ if (Array.isArray(this.options.presets?.columns) && this.options.presets.columns.length > 0) this.gridStateService.applyColumnLayout(this.options.presets.columns, false);
926
+ }
927
+ loadFilterPresetsWhenDatasetInitialized() {
928
+ if (this.options && !this.customDataView) {
929
+ if (Array.isArray(this.options.presets?.filters) || Array.isArray(this.options.presets?.treeData?.toggledItems)) this.filterService.populateColumnFilterSearchTermPresets(this.options.presets?.filters || []);
930
+ }
931
+ }
932
+ loadLocalGridPagination(dataset) {
933
+ if (this.options && this._paginationOptions) {
934
+ this.totalItems = Array.isArray(dataset) ? dataset.length : 0;
935
+ if (this._paginationOptions && this.dataView?.getPagingInfo) {
936
+ const slickPagingInfo = this.dataView.getPagingInfo();
937
+ if (slickPagingInfo && "totalRows" in slickPagingInfo && this._paginationOptions.totalItems !== slickPagingInfo.totalRows) this.totalItems = slickPagingInfo.totalRows || 0;
938
+ }
939
+ this._paginationOptions.totalItems = this.totalItems;
940
+ const paginationOptions = this.setPaginationOptionsWhenPresetDefined(this.options, this._paginationOptions);
941
+ this.initializePaginationService(paginationOptions);
942
+ }
943
+ }
944
+ loadRowSelectionPresetWhenExists() {
945
+ const presets = this.options?.presets;
946
+ if (this.options && (this.options.enableCheckboxSelector || this.options.enableSelection) && this.slickGrid?.getSelectionModel() && presets?.rowSelection && (Array.isArray(presets.rowSelection.gridRowIndexes) || Array.isArray(presets.rowSelection.dataContextIds))) {
947
+ let dataContextIds = presets.rowSelection.dataContextIds;
948
+ let gridRowIndexes = presets.rowSelection.gridRowIndexes;
949
+ if (Array.isArray(dataContextIds) && dataContextIds.length > 0) gridRowIndexes = this.dataView.mapIdsToRows(dataContextIds) || [];
950
+ else if (Array.isArray(gridRowIndexes) && gridRowIndexes.length > 0) dataContextIds = this.dataView.mapRowsToIds(gridRowIndexes) || [];
951
+ if (this.slickGrid && Array.isArray(gridRowIndexes)) {
952
+ this.slickGrid.setSelectedRows(gridRowIndexes);
953
+ this.dataView.setSelectedIds(dataContextIds || [], {
954
+ isRowBeingAdded: true,
955
+ shouldTriggerEvent: false,
956
+ applyRowSelectionToGrid: true
957
+ });
958
+ }
959
+ }
960
+ }
961
+ hasBackendInfiniteScroll(gridOptions) {
962
+ return !!(gridOptions || this.options).backendServiceApi?.service.options?.infiniteScroll;
963
+ }
964
+ mergeGridOptions(gridOptions) {
965
+ gridOptions.gridId = this.gridId;
966
+ gridOptions.gridContainerId = `slickGridContainer-${this.gridId}`;
967
+ const options = extend(true, {}, getIconSetOptions(gridOptions.iconSet ?? this.forRootConfig?.iconSet ?? GlobalGridOptions$1.iconSet), GlobalGridOptions$1, this.forRootConfig, gridOptions);
968
+ for (const menu of [
969
+ "gridMenu",
970
+ "contextMenu",
971
+ "headerMenu"
972
+ ]) {
973
+ const commands = gridOptions[menu]?.hideCommands ?? this.forRootConfig?.[menu]?.hideCommands;
974
+ if (commands && options[menu]) Object.assign(options[menu], { hideCommands: [...commands] });
975
+ }
976
+ const menuFormats = gridOptions.textExportOptions?.menuFormats ?? this.forRootConfig?.textExportOptions?.menuFormats;
977
+ if (menuFormats && options.textExportOptions) options.textExportOptions.menuFormats = [...menuFormats];
978
+ if (!this.hasBackendInfiniteScroll(gridOptions)) gridOptions.enablePagination = !!(gridOptions.backendServiceApi && gridOptions.enablePagination === void 0 ? true : gridOptions.enablePagination);
979
+ if (options?.pagination && (gridOptions.enablePagination || gridOptions.backendServiceApi) && (this.forRootConfig?.pagination || gridOptions.pagination)) {
980
+ options.pagination.pageSize = gridOptions.pagination?.pageSize ?? this.forRootConfig?.pagination?.pageSize ?? GlobalGridOptions$1.pagination.pageSize;
981
+ options.pagination.pageSizes = gridOptions.pagination?.pageSizes ?? this.forRootConfig?.pagination?.pageSizes ?? GlobalGridOptions$1.pagination.pageSizes;
982
+ }
983
+ this._hideHeaderRowAfterPageLoad = options.showHeaderRow === false;
984
+ if (options.enableFiltering && !options.showHeaderRow) options.showHeaderRow = options.enableFiltering;
985
+ if (options && !options.enableFiltering && options.enablePagination && this._isLocalGrid) {
986
+ options.enableFiltering = true;
987
+ options.showHeaderRow = false;
988
+ this._hideHeaderRowAfterPageLoad = true;
989
+ if (this.sharedService) this.sharedService.hideHeaderRowAfterPageLoad = true;
990
+ }
991
+ return options;
992
+ }
993
+ registerExternalResources(resources, disposePreviousResources = false) {
994
+ if (disposePreviousResources) this.disposeExternalResources();
995
+ resources.forEach((res) => this._registeredResources.push(res));
996
+ this.initializeExternalResources(resources);
997
+ }
998
+ resetExternalResources() {
999
+ this._registeredResources = [];
1000
+ }
1001
+ preRegisterResources() {
1002
+ this._registeredResources = this.options?.externalResources || [];
1003
+ this.registerRxJsResource(new RxJsResource());
1004
+ if (this.options.enableRowDetailView) {
1005
+ const RowDetailClass = this._registeredResources.find((res) => res.pluginName === "AngularRowDetailView");
1006
+ if (!RowDetailClass) throw new Error("[Angular-Slickgrid] You enabled the Row Detail View feature but you did not provide the \"AngularRowDetailView\" class as an external resource.");
1007
+ if (RowDetailClass) {
1008
+ const rowDetailInstance = new RowDetailClass(this.angularUtilService, this.appRef, this._eventPubSubService, this.elm.nativeElement, this.rxjs);
1009
+ this.slickRowDetailView = rowDetailInstance;
1010
+ rowDetailInstance.create(this.columns, this.options);
1011
+ this.extensionService.addExtensionToList("rowDetailView", {
1012
+ name: "rowDetailView",
1013
+ instance: this.slickRowDetailView
1014
+ });
1015
+ }
1016
+ }
1017
+ }
1018
+ autoEnableInitializedResources(resource) {
1019
+ if (this.slickGrid && typeof resource.init === "function") resource.init(this.slickGrid, this.containerService);
1020
+ if ("pluginName" in resource) {
1021
+ const pluginFlagName = PluginFlagMappings.get(resource.pluginName);
1022
+ if (pluginFlagName && this.options[pluginFlagName] !== false) {
1023
+ this.options[pluginFlagName] = true;
1024
+ this.slickGrid?.setOptions({ [pluginFlagName]: true });
1025
+ }
1026
+ }
1027
+ }
1028
+ initializeExternalResources(resources) {
1029
+ PluginFlagMappings.set("AngularRowDetailView", "enableRowDetailView");
1030
+ if (Array.isArray(resources)) for (const resource of resources) this.autoEnableInitializedResources(resource);
1031
+ }
1032
+ registerResources() {
1033
+ if (Array.isArray(this._registeredResources)) this.sharedService.externalRegisteredResources = this._registeredResources;
1034
+ this._registeredResources.push(this.gridService, this.gridStateService);
1035
+ if (this.options.createPreHeaderPanel && this.options.createTopHeaderPanel || this.options.createPreHeaderPanel && !this.options.enableDraggableGrouping) this._registeredResources.push(this.headerGroupingService);
1036
+ if (this.options.enableTreeData) this._registeredResources.push(this.treeDataService);
1037
+ if (this.options.enableTranslate) this.extensionService.translateColumnHeaders();
1038
+ this.slickEmptyWarning = new SlickEmptyWarningComponent();
1039
+ this._registeredResources.push(this.slickEmptyWarning);
1040
+ this.initializeExternalResources(this._registeredResources);
1041
+ if (this.options.enableRowDetailView && this.slickRowDetailView) this.slickRowDetailView.init(this.slickGrid);
1042
+ }
1043
+ registerRxJsResource(resource) {
1044
+ this.rxjs = resource;
1045
+ this.backendUtilityService.addRxJsResource(this.rxjs);
1046
+ this.filterFactory.addRxJsResource(this.rxjs);
1047
+ this.filterService.addRxJsResource(this.rxjs);
1048
+ this.gridStateService.addRxJsResource(this.rxjs);
1049
+ this.sortService.addRxJsResource(this.rxjs);
1050
+ this.paginationService.addRxJsResource(this.rxjs);
1051
+ this.containerService.registerInstance("RxJsResource", this.rxjs);
1052
+ }
1053
+ renderPagination(showPagination = true) {
1054
+ if (this.slickGrid && this.options?.enablePagination && !this._isPaginationInitialized && showPagination) {
1055
+ if (this.options.customPaginationComponent) {
1056
+ const paginationComp = this.angularUtilService.createAngularComponent(this.options.customPaginationComponent);
1057
+ this.slickPagination = paginationComp.componentRef.instance;
1058
+ } else this.slickPagination = new SlickPaginationComponent();
1059
+ if (this.slickPagination) {
1060
+ this.slickPagination.init(this.slickGrid, this.paginationService, this._eventPubSubService, this.translaterService);
1061
+ this.slickPagination.renderPagination(this.gridContainerElement);
1062
+ this._isPaginationInitialized = true;
1063
+ }
1064
+ } else if (!showPagination) {
1065
+ this.slickPagination?.dispose();
1066
+ this._isPaginationInitialized = false;
1067
+ }
1068
+ }
1069
+ sortTreeDataset(flatDatasetInput, forceGridRefresh = false) {
1070
+ const prevDatasetLn = this._currentDatasetLength;
1071
+ let sortedDatasetResult;
1072
+ let flatDatasetOutput = [];
1073
+ if (this._isDatasetHierarchicalInitialized && this.datasetHierarchical) {
1074
+ sortedDatasetResult = this.treeDataService.sortHierarchicalDataset(this.datasetHierarchical);
1075
+ flatDatasetOutput = sortedDatasetResult.flat;
1076
+ } else if (Array.isArray(flatDatasetInput) && flatDatasetInput.length > 0) {
1077
+ sortedDatasetResult = this.treeDataService.convertFlatParentChildToTreeDatasetAndSort(flatDatasetInput, this._columns, this.options);
1078
+ this.sharedService.hierarchicalDataset = sortedDatasetResult.hierarchical;
1079
+ flatDatasetOutput = sortedDatasetResult.flat;
1080
+ }
1081
+ if (flatDatasetInput.length > 0 && (forceGridRefresh || flatDatasetInput.length !== prevDatasetLn)) this.filterService.refreshTreeDataFilters(flatDatasetOutput);
1082
+ return flatDatasetOutput;
1083
+ }
1084
+ suggestDateParsingWhenHelpful() {
1085
+ if (this.dataView?.getItemCount() > WARN_NO_PREPARSE_DATE_SIZE && !this.options.silenceWarnings && !this.options.preParseDateColumns && hasStringDateColumns(this.slickGrid.getColumns(), this.dataView.getItems())) console.warn("[Slickgrid-Universal] For getting better perf, we suggest you enable the `preParseDateColumns` grid option, for more info visit => https://ghiscoding.gitbook.io/angular-slickgrid/column-functionalities/sorting#pre-parse-date-columns-for-better-perf");
1086
+ }
1087
+ static ɵfac = function AngularSlickgridComponent_Factory(__ngFactoryType__) {
1088
+ return new (__ngFactoryType__ || AngularSlickgridComponent)(i0.ɵɵdirectiveInject(AngularUtilService), i0.ɵɵdirectiveInject(i0.ApplicationRef), i0.ɵɵdirectiveInject(ContainerService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1.TranslateService, 8), i0.ɵɵdirectiveInject(TranslaterService, 8), i0.ɵɵdirectiveInject("defaultGridOption", 8), i0.ɵɵdirectiveInject("externalService", 8));
1089
+ };
1090
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({
1091
+ type: AngularSlickgridComponent,
1092
+ selectors: [["angular-slickgrid"]],
1093
+ contentQueries: function AngularSlickgridComponent_ContentQueries(rf, ctx, dirIndex) {
1094
+ if (rf & 1) i0.ɵɵcontentQuery(dirIndex, _c0, 7)(dirIndex, _c1, 7);
1095
+ if (rf & 2) {
1096
+ let _t;
1097
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.slickgridHeader = _t.first);
1098
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.slickgridFooter = _t.first);
1099
+ }
1100
+ },
1101
+ inputs: {
1102
+ customDataView: "customDataView",
1103
+ gridId: "gridId",
1104
+ options: "options",
1105
+ containerClasses: "containerClasses",
1106
+ paginationOptions: "paginationOptions",
1107
+ columns: "columns",
1108
+ dataset: "dataset",
1109
+ datasetHierarchical: "datasetHierarchical"
1110
+ },
1111
+ outputs: {
1112
+ columnsChange: "columnsChange",
1113
+ onActiveCellChanged: "onActiveCellChanged",
1114
+ onActiveCellPositionChanged: "onActiveCellPositionChanged",
1115
+ onAddNewRow: "onAddNewRow",
1116
+ onAutosizeColumns: "onAutosizeColumns",
1117
+ onBeforeCellEditorDestroy: "onBeforeCellEditorDestroy",
1118
+ onBeforeColumnsResize: "onBeforeColumnsResize",
1119
+ onBeforeDestroy: "onBeforeDestroy",
1120
+ onBeforeEditCell: "onBeforeEditCell",
1121
+ onBeforeHeaderCellDestroy: "onBeforeHeaderCellDestroy",
1122
+ onBeforeHeaderRowCellDestroy: "onBeforeHeaderRowCellDestroy",
1123
+ onBeforeFooterRowCellDestroy: "onBeforeFooterRowCellDestroy",
1124
+ onBeforeSetColumns: "onBeforeSetColumns",
1125
+ onBeforeSort: "onBeforeSort",
1126
+ onCellChange: "onCellChange",
1127
+ onCellCssStylesChanged: "onCellCssStylesChanged",
1128
+ onClick: "onClick",
1129
+ onColumnsDrag: "onColumnsDrag",
1130
+ onColumnsReordered: "onColumnsReordered",
1131
+ onColumnsResized: "onColumnsResized",
1132
+ onColumnsResizeDblClick: "onColumnsResizeDblClick",
1133
+ onCompositeEditorChange: "onCompositeEditorChange",
1134
+ onContextMenu: "onContextMenu",
1135
+ onDrag: "onDrag",
1136
+ onDragEnd: "onDragEnd",
1137
+ onDragInit: "onDragInit",
1138
+ onDragStart: "onDragStart",
1139
+ onDragReplaceCells: "onDragReplaceCells",
1140
+ onDblClick: "onDblClick",
1141
+ onFooterContextMenu: "onFooterContextMenu",
1142
+ onFooterRowCellRendered: "onFooterRowCellRendered",
1143
+ onHeaderCellRendered: "onHeaderCellRendered",
1144
+ onFooterClick: "onFooterClick",
1145
+ onHeaderClick: "onHeaderClick",
1146
+ onHeaderContextMenu: "onHeaderContextMenu",
1147
+ onHeaderMouseEnter: "onHeaderMouseEnter",
1148
+ onHeaderMouseLeave: "onHeaderMouseLeave",
1149
+ onHeaderRowCellRendered: "onHeaderRowCellRendered",
1150
+ onHeaderRowMouseEnter: "onHeaderRowMouseEnter",
1151
+ onHeaderRowMouseLeave: "onHeaderRowMouseLeave",
1152
+ onKeyDown: "onKeyDown",
1153
+ onMouseEnter: "onMouseEnter",
1154
+ onMouseLeave: "onMouseLeave",
1155
+ onValidationError: "onValidationError",
1156
+ onViewportChanged: "onViewportChanged",
1157
+ onRendered: "onRendered",
1158
+ onSelectedRowsChanged: "onSelectedRowsChanged",
1159
+ onSetOptions: "onSetOptions",
1160
+ onScroll: "onScroll",
1161
+ onSort: "onSort",
1162
+ onBeforePagingInfoChanged: "onBeforePagingInfoChanged",
1163
+ onGroupExpanded: "onGroupExpanded",
1164
+ onGroupCollapsed: "onGroupCollapsed",
1165
+ onPagingInfoChanged: "onPagingInfoChanged",
1166
+ onRowCountChanged: "onRowCountChanged",
1167
+ onRowsChanged: "onRowsChanged",
1168
+ onRowsOrCountChanged: "onRowsOrCountChanged",
1169
+ onSelectedRowIdsChanged: "onSelectedRowIdsChanged",
1170
+ onSetItemsCalled: "onSetItemsCalled",
1171
+ onAfterMenuShow: "onAfterMenuShow",
1172
+ onBeforeMenuClose: "onBeforeMenuClose",
1173
+ onBeforeMenuShow: "onBeforeMenuShow",
1174
+ onColumnsChanged: "onColumnsChanged",
1175
+ onCommand: "onCommand",
1176
+ onGridMenuColumnsChanged: "onGridMenuColumnsChanged",
1177
+ onMenuClose: "onMenuClose",
1178
+ onCopyCells: "onCopyCells",
1179
+ onCopyCancelled: "onCopyCancelled",
1180
+ onPasteCells: "onPasteCells",
1181
+ onBeforePasteCell: "onBeforePasteCell",
1182
+ onAfterExportToExcel: "onAfterExportToExcel",
1183
+ onBeforeExportToExcel: "onBeforeExportToExcel",
1184
+ onBeforeFilterChange: "onBeforeFilterChange",
1185
+ onBeforeFilterClear: "onBeforeFilterClear",
1186
+ onBeforeSearchChange: "onBeforeSearchChange",
1187
+ onBeforeSortChange: "onBeforeSortChange",
1188
+ onContextMenuClearGrouping: "onContextMenuClearGrouping",
1189
+ onContextMenuCollapseAllGroups: "onContextMenuCollapseAllGroups",
1190
+ onContextMenuExpandAllGroups: "onContextMenuExpandAllGroups",
1191
+ onColumnPickerColumnsChanged: "onColumnPickerColumnsChanged",
1192
+ onGridMenuMenuClose: "onGridMenuMenuClose",
1193
+ onGridMenuBeforeMenuShow: "onGridMenuBeforeMenuShow",
1194
+ onGridMenuAfterMenuShow: "onGridMenuAfterMenuShow",
1195
+ onGridMenuClearAllPinning: "onGridMenuClearAllPinning",
1196
+ onGridMenuClearAllFilters: "onGridMenuClearAllFilters",
1197
+ onGridMenuClearAllSorting: "onGridMenuClearAllSorting",
1198
+ onGridMenuCommand: "onGridMenuCommand",
1199
+ onHeaderButtonCommand: "onHeaderButtonCommand",
1200
+ onHeaderMenuCommand: "onHeaderMenuCommand",
1201
+ onHeaderMenuColumnResizeByContent: "onHeaderMenuColumnResizeByContent",
1202
+ onHeaderMenuBeforeMenuShow: "onHeaderMenuBeforeMenuShow",
1203
+ onHeaderMenuAfterMenuShow: "onHeaderMenuAfterMenuShow",
1204
+ onHideColumns: "onHideColumns",
1205
+ onItemsAdded: "onItemsAdded",
1206
+ onItemsDeleted: "onItemsDeleted",
1207
+ onItemsUpdated: "onItemsUpdated",
1208
+ onItemsUpserted: "onItemsUpserted",
1209
+ onFullResizeByContentRequested: "onFullResizeByContentRequested",
1210
+ onGridStateChanged: "onGridStateChanged",
1211
+ onBeforePaginationChange: "onBeforePaginationChange",
1212
+ onPaginationChanged: "onPaginationChanged",
1213
+ onPaginationRefreshed: "onPaginationRefreshed",
1214
+ onPaginationVisibilityChanged: "onPaginationVisibilityChanged",
1215
+ onPaginationSetCursorBased: "onPaginationSetCursorBased",
1216
+ onGridBeforeResize: "onGridBeforeResize",
1217
+ onGridAfterResize: "onGridAfterResize",
1218
+ onBeforeResizeByContent: "onBeforeResizeByContent",
1219
+ onAfterResizeByContent: "onAfterResizeByContent",
1220
+ onSortCleared: "onSortCleared",
1221
+ onFilterChanged: "onFilterChanged",
1222
+ onFilterCleared: "onFilterCleared",
1223
+ onSortChanged: "onSortChanged",
1224
+ onTreeItemToggled: "onTreeItemToggled",
1225
+ onTreeFullToggleEnd: "onTreeFullToggleEnd",
1226
+ onTreeFullToggleStart: "onTreeFullToggleStart",
1227
+ onBeforeGridCreate: "onBeforeGridCreate",
1228
+ onGridCreated: "onGridCreated",
1229
+ onDataviewCreated: "onDataviewCreated",
1230
+ onAngularGridCreated: "onAngularGridCreated",
1231
+ onBeforeGridDestroy: "onBeforeGridDestroy",
1232
+ onLanguageChange: "onLanguageChange"
1233
+ },
1234
+ features: [i0.ɵɵProvidersFeature([AngularUtilService, TranslaterService])],
1235
+ decls: 10,
1236
+ vars: 7,
1237
+ consts: [
1238
+ [
1239
+ 1,
1240
+ "gridPane",
1241
+ "grid-pane",
1242
+ 3,
1243
+ "id"
1244
+ ],
1245
+ [4, "ngTemplateOutlet"],
1246
+ [1, "slickgrid-container"]
1247
+ ],
1248
+ template: function AngularSlickgridComponent_Template(rf, ctx) {
1249
+ if (rf & 1) {
1250
+ i0.ɵɵtext(0, "\n ");
1251
+ i0.ɵɵelementStart(1, "div", 0);
1252
+ i0.ɵɵtext(2, "\n ");
1253
+ i0.ɵɵtemplate(3, AngularSlickgridComponent_ng_container_3_Template, 1, 0, "ng-container", 1);
1254
+ i0.ɵɵtext(4, "\n ");
1255
+ i0.ɵɵelement(5, "div", 2);
1256
+ i0.ɵɵtext(6, "\n ");
1257
+ i0.ɵɵtemplate(7, AngularSlickgridComponent_ng_container_7_Template, 1, 0, "ng-container", 1);
1258
+ i0.ɵɵtext(8, "\n ");
1259
+ i0.ɵɵelementEnd();
1260
+ i0.ɵɵtext(9, "\n ");
1261
+ }
1262
+ if (rf & 2) {
1263
+ i0.ɵɵadvance();
1264
+ i0.ɵɵclassMap(ctx.containerClasses);
1265
+ i0.ɵɵproperty("id", i0.ɵɵinterpolate1("slickGridContainer-", ctx.gridId));
1266
+ i0.ɵɵadvance(2);
1267
+ i0.ɵɵproperty("ngTemplateOutlet", ctx.slickgridHeader);
1268
+ i0.ɵɵadvance(2);
1269
+ i0.ɵɵattribute("id", ctx.gridId);
1270
+ i0.ɵɵadvance(2);
1271
+ i0.ɵɵproperty("ngTemplateOutlet", ctx.slickgridFooter);
1272
+ }
1273
+ },
1274
+ dependencies: [NgTemplateOutlet],
1275
+ encapsulation: 2
1276
+ });
1277
+ };
1278
+ (() => {
1279
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AngularSlickgridComponent, [{
1280
+ type: Component,
1281
+ args: [{
1282
+ selector: "angular-slickgrid",
1283
+ template: `
1608
1284
  <div id="slickGridContainer-{{ gridId }}" class="gridPane grid-pane" [class]="containerClasses">
1609
1285
  <ng-container *ngTemplateOutlet="slickgridHeader"></ng-container>
1610
1286
  <div [attr.id]="gridId" class="slickgrid-container"></div>
1611
1287
  <ng-container *ngTemplateOutlet="slickgridFooter"></ng-container>
1612
1288
  </div>
1613
1289
  `,
1614
- providers: [AngularUtilService, TranslaterService], // make everything transient (non-singleton)
1615
- imports: [NgTemplateOutlet],
1616
- }]
1617
- }], () => [{ type: AngularUtilService }, { type: i0.ApplicationRef }, { type: ContainerService }, { type: i0.ElementRef }, { type: i1.TranslateService, decorators: [{
1618
- type: Optional
1619
- }] }, { type: TranslaterService, decorators: [{
1620
- type: Optional
1621
- }] }, { type: undefined, decorators: [{
1622
- type: Optional
1623
- }, {
1624
- type: Inject,
1625
- args: ['defaultGridOption']
1626
- }] }, { type: undefined, decorators: [{
1627
- type: Optional
1628
- }, {
1629
- type: Inject,
1630
- args: ['externalService']
1631
- }] }], { customDataView: [{
1632
- type: Input
1633
- }], gridId: [{
1634
- type: Input
1635
- }], options: [{
1636
- type: Input
1637
- }], containerClasses: [{
1638
- type: Input
1639
- }], paginationOptions: [{
1640
- type: Input
1641
- }], columns: [{
1642
- type: Input
1643
- }], columnsChange: [{
1644
- type: Output
1645
- }], onActiveCellChanged: [{ type: i0.Output, args: ["onActiveCellChanged"] }], onActiveCellPositionChanged: [{ type: i0.Output, args: ["onActiveCellPositionChanged"] }], onAddNewRow: [{ type: i0.Output, args: ["onAddNewRow"] }], onAutosizeColumns: [{ type: i0.Output, args: ["onAutosizeColumns"] }], onBeforeAppendCell: [{ type: i0.Output, args: ["onBeforeAppendCell"] }], onBeforeCellEditorDestroy: [{ type: i0.Output, args: ["onBeforeCellEditorDestroy"] }], onBeforeColumnsResize: [{ type: i0.Output, args: ["onBeforeColumnsResize"] }], onBeforeDestroy: [{ type: i0.Output, args: ["onBeforeDestroy"] }], onBeforeEditCell: [{ type: i0.Output, args: ["onBeforeEditCell"] }], onBeforeHeaderCellDestroy: [{ type: i0.Output, args: ["onBeforeHeaderCellDestroy"] }], onBeforeHeaderRowCellDestroy: [{ type: i0.Output, args: ["onBeforeHeaderRowCellDestroy"] }], onBeforeFooterRowCellDestroy: [{ type: i0.Output, args: ["onBeforeFooterRowCellDestroy"] }], onBeforeSetColumns: [{ type: i0.Output, args: ["onBeforeSetColumns"] }], onBeforeSort: [{ type: i0.Output, args: ["onBeforeSort"] }], onCellChange: [{ type: i0.Output, args: ["onCellChange"] }], onCellCssStylesChanged: [{ type: i0.Output, args: ["onCellCssStylesChanged"] }], onClick: [{ type: i0.Output, args: ["onClick"] }], onColumnsDrag: [{ type: i0.Output, args: ["onColumnsDrag"] }], onColumnsReordered: [{ type: i0.Output, args: ["onColumnsReordered"] }], onColumnsResized: [{ type: i0.Output, args: ["onColumnsResized"] }], onColumnsResizeDblClick: [{ type: i0.Output, args: ["onColumnsResizeDblClick"] }], onCompositeEditorChange: [{ type: i0.Output, args: ["onCompositeEditorChange"] }], onContextMenu: [{ type: i0.Output, args: ["onContextMenu"] }], onDrag: [{ type: i0.Output, args: ["onDrag"] }], onDragEnd: [{ type: i0.Output, args: ["onDragEnd"] }], onDragInit: [{ type: i0.Output, args: ["onDragInit"] }], onDragStart: [{ type: i0.Output, args: ["onDragStart"] }], onDragReplaceCells: [{ type: i0.Output, args: ["onDragReplaceCells"] }], onDblClick: [{ type: i0.Output, args: ["onDblClick"] }], onFooterContextMenu: [{ type: i0.Output, args: ["onFooterContextMenu"] }], onFooterRowCellRendered: [{ type: i0.Output, args: ["onFooterRowCellRendered"] }], onHeaderCellRendered: [{ type: i0.Output, args: ["onHeaderCellRendered"] }], onFooterClick: [{ type: i0.Output, args: ["onFooterClick"] }], onHeaderClick: [{ type: i0.Output, args: ["onHeaderClick"] }], onHeaderContextMenu: [{ type: i0.Output, args: ["onHeaderContextMenu"] }], onHeaderMouseEnter: [{ type: i0.Output, args: ["onHeaderMouseEnter"] }], onHeaderMouseLeave: [{ type: i0.Output, args: ["onHeaderMouseLeave"] }], onHeaderRowCellRendered: [{ type: i0.Output, args: ["onHeaderRowCellRendered"] }], onHeaderRowMouseEnter: [{ type: i0.Output, args: ["onHeaderRowMouseEnter"] }], onHeaderRowMouseLeave: [{ type: i0.Output, args: ["onHeaderRowMouseLeave"] }], onKeyDown: [{ type: i0.Output, args: ["onKeyDown"] }], onMouseEnter: [{ type: i0.Output, args: ["onMouseEnter"] }], onMouseLeave: [{ type: i0.Output, args: ["onMouseLeave"] }], onValidationError: [{ type: i0.Output, args: ["onValidationError"] }], onViewportChanged: [{ type: i0.Output, args: ["onViewportChanged"] }], onRendered: [{ type: i0.Output, args: ["onRendered"] }], onSelectedRowsChanged: [{ type: i0.Output, args: ["onSelectedRowsChanged"] }], onSetOptions: [{ type: i0.Output, args: ["onSetOptions"] }], onScroll: [{ type: i0.Output, args: ["onScroll"] }], onSort: [{ type: i0.Output, args: ["onSort"] }], onBeforePagingInfoChanged: [{ type: i0.Output, args: ["onBeforePagingInfoChanged"] }], onGroupExpanded: [{ type: i0.Output, args: ["onGroupExpanded"] }], onGroupCollapsed: [{ type: i0.Output, args: ["onGroupCollapsed"] }], onPagingInfoChanged: [{ type: i0.Output, args: ["onPagingInfoChanged"] }], onRowCountChanged: [{ type: i0.Output, args: ["onRowCountChanged"] }], onRowsChanged: [{ type: i0.Output, args: ["onRowsChanged"] }], onRowsOrCountChanged: [{ type: i0.Output, args: ["onRowsOrCountChanged"] }], onSelectedRowIdsChanged: [{ type: i0.Output, args: ["onSelectedRowIdsChanged"] }], onSetItemsCalled: [{ type: i0.Output, args: ["onSetItemsCalled"] }], onAfterMenuShow: [{ type: i0.Output, args: ["onAfterMenuShow"] }], onBeforeMenuClose: [{ type: i0.Output, args: ["onBeforeMenuClose"] }], onBeforeMenuShow: [{ type: i0.Output, args: ["onBeforeMenuShow"] }], onColumnsChanged: [{ type: i0.Output, args: ["onColumnsChanged"] }], onCommand: [{ type: i0.Output, args: ["onCommand"] }], onGridMenuColumnsChanged: [{ type: i0.Output, args: ["onGridMenuColumnsChanged"] }], onMenuClose: [{ type: i0.Output, args: ["onMenuClose"] }], onCopyCells: [{ type: i0.Output, args: ["onCopyCells"] }], onCopyCancelled: [{ type: i0.Output, args: ["onCopyCancelled"] }], onPasteCells: [{ type: i0.Output, args: ["onPasteCells"] }], onBeforePasteCell: [{ type: i0.Output, args: ["onBeforePasteCell"] }], onAfterExportToExcel: [{ type: i0.Output, args: ["onAfterExportToExcel"] }], onBeforeExportToExcel: [{ type: i0.Output, args: ["onBeforeExportToExcel"] }], onBeforeFilterChange: [{ type: i0.Output, args: ["onBeforeFilterChange"] }], onBeforeFilterClear: [{ type: i0.Output, args: ["onBeforeFilterClear"] }], onBeforeSearchChange: [{ type: i0.Output, args: ["onBeforeSearchChange"] }], onBeforeSortChange: [{ type: i0.Output, args: ["onBeforeSortChange"] }], onContextMenuClearGrouping: [{ type: i0.Output, args: ["onContextMenuClearGrouping"] }], onContextMenuCollapseAllGroups: [{ type: i0.Output, args: ["onContextMenuCollapseAllGroups"] }], onContextMenuExpandAllGroups: [{ type: i0.Output, args: ["onContextMenuExpandAllGroups"] }], onOptionSelected: [{ type: i0.Output, args: ["onOptionSelected"] }], onColumnPickerColumnsChanged: [{ type: i0.Output, args: ["onColumnPickerColumnsChanged"] }], onGridMenuMenuClose: [{ type: i0.Output, args: ["onGridMenuMenuClose"] }], onGridMenuBeforeMenuShow: [{ type: i0.Output, args: ["onGridMenuBeforeMenuShow"] }], onGridMenuAfterMenuShow: [{ type: i0.Output, args: ["onGridMenuAfterMenuShow"] }], onGridMenuClearAllPinning: [{ type: i0.Output, args: ["onGridMenuClearAllPinning"] }], onGridMenuClearAllFilters: [{ type: i0.Output, args: ["onGridMenuClearAllFilters"] }], onGridMenuClearAllSorting: [{ type: i0.Output, args: ["onGridMenuClearAllSorting"] }], onGridMenuCommand: [{ type: i0.Output, args: ["onGridMenuCommand"] }], onHeaderButtonCommand: [{ type: i0.Output, args: ["onHeaderButtonCommand"] }], onHeaderMenuCommand: [{ type: i0.Output, args: ["onHeaderMenuCommand"] }], onHeaderMenuColumnResizeByContent: [{ type: i0.Output, args: ["onHeaderMenuColumnResizeByContent"] }], onHeaderMenuBeforeMenuShow: [{ type: i0.Output, args: ["onHeaderMenuBeforeMenuShow"] }], onHeaderMenuAfterMenuShow: [{ type: i0.Output, args: ["onHeaderMenuAfterMenuShow"] }], onHideColumns: [{ type: i0.Output, args: ["onHideColumns"] }], onItemsAdded: [{ type: i0.Output, args: ["onItemsAdded"] }], onItemsDeleted: [{ type: i0.Output, args: ["onItemsDeleted"] }], onItemsUpdated: [{ type: i0.Output, args: ["onItemsUpdated"] }], onItemsUpserted: [{ type: i0.Output, args: ["onItemsUpserted"] }], onFullResizeByContentRequested: [{ type: i0.Output, args: ["onFullResizeByContentRequested"] }], onGridStateChanged: [{ type: i0.Output, args: ["onGridStateChanged"] }], onBeforePaginationChange: [{ type: i0.Output, args: ["onBeforePaginationChange"] }], onPaginationChanged: [{ type: i0.Output, args: ["onPaginationChanged"] }], onPaginationRefreshed: [{ type: i0.Output, args: ["onPaginationRefreshed"] }], onPaginationVisibilityChanged: [{ type: i0.Output, args: ["onPaginationVisibilityChanged"] }], onPaginationSetCursorBased: [{ type: i0.Output, args: ["onPaginationSetCursorBased"] }], onGridBeforeResize: [{ type: i0.Output, args: ["onGridBeforeResize"] }], onGridAfterResize: [{ type: i0.Output, args: ["onGridAfterResize"] }], onBeforeResizeByContent: [{ type: i0.Output, args: ["onBeforeResizeByContent"] }], onAfterResizeByContent: [{ type: i0.Output, args: ["onAfterResizeByContent"] }], onSortCleared: [{ type: i0.Output, args: ["onSortCleared"] }], onFilterChanged: [{ type: i0.Output, args: ["onFilterChanged"] }], onFilterCleared: [{ type: i0.Output, args: ["onFilterCleared"] }], onSortChanged: [{ type: i0.Output, args: ["onSortChanged"] }], onTreeItemToggled: [{ type: i0.Output, args: ["onTreeItemToggled"] }], onTreeFullToggleEnd: [{ type: i0.Output, args: ["onTreeFullToggleEnd"] }], onTreeFullToggleStart: [{ type: i0.Output, args: ["onTreeFullToggleStart"] }], onBeforeGridCreate: [{ type: i0.Output, args: ["onBeforeGridCreate"] }], onGridCreated: [{ type: i0.Output, args: ["onGridCreated"] }], onDataviewCreated: [{ type: i0.Output, args: ["onDataviewCreated"] }], onAngularGridCreated: [{ type: i0.Output, args: ["onAngularGridCreated"] }], onBeforeGridDestroy: [{ type: i0.Output, args: ["onBeforeGridDestroy"] }], onLanguageChange: [{ type: i0.Output, args: ["onLanguageChange"] }], dataset: [{
1646
- type: Input
1647
- }], datasetHierarchical: [{
1648
- type: Input
1649
- }], slickgridHeader: [{
1650
- type: ContentChild,
1651
- args: ['slickgridHeader', { static: true }]
1652
- }], slickgridFooter: [{
1653
- type: ContentChild,
1654
- args: ['slickgridFooter', { static: true }]
1655
- }] }); })();
1656
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AngularSlickgridComponent, { className: "AngularSlickgridComponent", filePath: "library/components/angular-slickgrid.component.ts", lineNumber: 95 }); })();
1657
-
1658
- /**
1659
- * Generated bundle index. Do not edit.
1660
- */
1661
-
1290
+ providers: [AngularUtilService, TranslaterService],
1291
+ imports: [NgTemplateOutlet]
1292
+ }]
1293
+ }], () => [
1294
+ { type: AngularUtilService },
1295
+ { type: i0.ApplicationRef },
1296
+ { type: ContainerService },
1297
+ { type: i0.ElementRef },
1298
+ {
1299
+ type: i1.TranslateService,
1300
+ decorators: [{ type: Optional }]
1301
+ },
1302
+ {
1303
+ type: TranslaterService,
1304
+ decorators: [{ type: Optional }]
1305
+ },
1306
+ {
1307
+ type: void 0,
1308
+ decorators: [{ type: Optional }, {
1309
+ type: Inject,
1310
+ args: ["defaultGridOption"]
1311
+ }]
1312
+ },
1313
+ {
1314
+ type: void 0,
1315
+ decorators: [{ type: Optional }, {
1316
+ type: Inject,
1317
+ args: ["externalService"]
1318
+ }]
1319
+ }
1320
+ ], {
1321
+ customDataView: [{ type: Input }],
1322
+ gridId: [{ type: Input }],
1323
+ options: [{ type: Input }],
1324
+ containerClasses: [{ type: Input }],
1325
+ paginationOptions: [{ type: Input }],
1326
+ columns: [{ type: Input }],
1327
+ columnsChange: [{ type: Output }],
1328
+ onActiveCellChanged: [{
1329
+ type: i0.Output,
1330
+ args: ["onActiveCellChanged"]
1331
+ }],
1332
+ onActiveCellPositionChanged: [{
1333
+ type: i0.Output,
1334
+ args: ["onActiveCellPositionChanged"]
1335
+ }],
1336
+ onAddNewRow: [{
1337
+ type: i0.Output,
1338
+ args: ["onAddNewRow"]
1339
+ }],
1340
+ onAutosizeColumns: [{
1341
+ type: i0.Output,
1342
+ args: ["onAutosizeColumns"]
1343
+ }],
1344
+ onBeforeCellEditorDestroy: [{
1345
+ type: i0.Output,
1346
+ args: ["onBeforeCellEditorDestroy"]
1347
+ }],
1348
+ onBeforeColumnsResize: [{
1349
+ type: i0.Output,
1350
+ args: ["onBeforeColumnsResize"]
1351
+ }],
1352
+ onBeforeDestroy: [{
1353
+ type: i0.Output,
1354
+ args: ["onBeforeDestroy"]
1355
+ }],
1356
+ onBeforeEditCell: [{
1357
+ type: i0.Output,
1358
+ args: ["onBeforeEditCell"]
1359
+ }],
1360
+ onBeforeHeaderCellDestroy: [{
1361
+ type: i0.Output,
1362
+ args: ["onBeforeHeaderCellDestroy"]
1363
+ }],
1364
+ onBeforeHeaderRowCellDestroy: [{
1365
+ type: i0.Output,
1366
+ args: ["onBeforeHeaderRowCellDestroy"]
1367
+ }],
1368
+ onBeforeFooterRowCellDestroy: [{
1369
+ type: i0.Output,
1370
+ args: ["onBeforeFooterRowCellDestroy"]
1371
+ }],
1372
+ onBeforeSetColumns: [{
1373
+ type: i0.Output,
1374
+ args: ["onBeforeSetColumns"]
1375
+ }],
1376
+ onBeforeSort: [{
1377
+ type: i0.Output,
1378
+ args: ["onBeforeSort"]
1379
+ }],
1380
+ onCellChange: [{
1381
+ type: i0.Output,
1382
+ args: ["onCellChange"]
1383
+ }],
1384
+ onCellCssStylesChanged: [{
1385
+ type: i0.Output,
1386
+ args: ["onCellCssStylesChanged"]
1387
+ }],
1388
+ onClick: [{
1389
+ type: i0.Output,
1390
+ args: ["onClick"]
1391
+ }],
1392
+ onColumnsDrag: [{
1393
+ type: i0.Output,
1394
+ args: ["onColumnsDrag"]
1395
+ }],
1396
+ onColumnsReordered: [{
1397
+ type: i0.Output,
1398
+ args: ["onColumnsReordered"]
1399
+ }],
1400
+ onColumnsResized: [{
1401
+ type: i0.Output,
1402
+ args: ["onColumnsResized"]
1403
+ }],
1404
+ onColumnsResizeDblClick: [{
1405
+ type: i0.Output,
1406
+ args: ["onColumnsResizeDblClick"]
1407
+ }],
1408
+ onCompositeEditorChange: [{
1409
+ type: i0.Output,
1410
+ args: ["onCompositeEditorChange"]
1411
+ }],
1412
+ onContextMenu: [{
1413
+ type: i0.Output,
1414
+ args: ["onContextMenu"]
1415
+ }],
1416
+ onDrag: [{
1417
+ type: i0.Output,
1418
+ args: ["onDrag"]
1419
+ }],
1420
+ onDragEnd: [{
1421
+ type: i0.Output,
1422
+ args: ["onDragEnd"]
1423
+ }],
1424
+ onDragInit: [{
1425
+ type: i0.Output,
1426
+ args: ["onDragInit"]
1427
+ }],
1428
+ onDragStart: [{
1429
+ type: i0.Output,
1430
+ args: ["onDragStart"]
1431
+ }],
1432
+ onDragReplaceCells: [{
1433
+ type: i0.Output,
1434
+ args: ["onDragReplaceCells"]
1435
+ }],
1436
+ onDblClick: [{
1437
+ type: i0.Output,
1438
+ args: ["onDblClick"]
1439
+ }],
1440
+ onFooterContextMenu: [{
1441
+ type: i0.Output,
1442
+ args: ["onFooterContextMenu"]
1443
+ }],
1444
+ onFooterRowCellRendered: [{
1445
+ type: i0.Output,
1446
+ args: ["onFooterRowCellRendered"]
1447
+ }],
1448
+ onHeaderCellRendered: [{
1449
+ type: i0.Output,
1450
+ args: ["onHeaderCellRendered"]
1451
+ }],
1452
+ onFooterClick: [{
1453
+ type: i0.Output,
1454
+ args: ["onFooterClick"]
1455
+ }],
1456
+ onHeaderClick: [{
1457
+ type: i0.Output,
1458
+ args: ["onHeaderClick"]
1459
+ }],
1460
+ onHeaderContextMenu: [{
1461
+ type: i0.Output,
1462
+ args: ["onHeaderContextMenu"]
1463
+ }],
1464
+ onHeaderMouseEnter: [{
1465
+ type: i0.Output,
1466
+ args: ["onHeaderMouseEnter"]
1467
+ }],
1468
+ onHeaderMouseLeave: [{
1469
+ type: i0.Output,
1470
+ args: ["onHeaderMouseLeave"]
1471
+ }],
1472
+ onHeaderRowCellRendered: [{
1473
+ type: i0.Output,
1474
+ args: ["onHeaderRowCellRendered"]
1475
+ }],
1476
+ onHeaderRowMouseEnter: [{
1477
+ type: i0.Output,
1478
+ args: ["onHeaderRowMouseEnter"]
1479
+ }],
1480
+ onHeaderRowMouseLeave: [{
1481
+ type: i0.Output,
1482
+ args: ["onHeaderRowMouseLeave"]
1483
+ }],
1484
+ onKeyDown: [{
1485
+ type: i0.Output,
1486
+ args: ["onKeyDown"]
1487
+ }],
1488
+ onMouseEnter: [{
1489
+ type: i0.Output,
1490
+ args: ["onMouseEnter"]
1491
+ }],
1492
+ onMouseLeave: [{
1493
+ type: i0.Output,
1494
+ args: ["onMouseLeave"]
1495
+ }],
1496
+ onValidationError: [{
1497
+ type: i0.Output,
1498
+ args: ["onValidationError"]
1499
+ }],
1500
+ onViewportChanged: [{
1501
+ type: i0.Output,
1502
+ args: ["onViewportChanged"]
1503
+ }],
1504
+ onRendered: [{
1505
+ type: i0.Output,
1506
+ args: ["onRendered"]
1507
+ }],
1508
+ onSelectedRowsChanged: [{
1509
+ type: i0.Output,
1510
+ args: ["onSelectedRowsChanged"]
1511
+ }],
1512
+ onSetOptions: [{
1513
+ type: i0.Output,
1514
+ args: ["onSetOptions"]
1515
+ }],
1516
+ onScroll: [{
1517
+ type: i0.Output,
1518
+ args: ["onScroll"]
1519
+ }],
1520
+ onSort: [{
1521
+ type: i0.Output,
1522
+ args: ["onSort"]
1523
+ }],
1524
+ onBeforePagingInfoChanged: [{
1525
+ type: i0.Output,
1526
+ args: ["onBeforePagingInfoChanged"]
1527
+ }],
1528
+ onGroupExpanded: [{
1529
+ type: i0.Output,
1530
+ args: ["onGroupExpanded"]
1531
+ }],
1532
+ onGroupCollapsed: [{
1533
+ type: i0.Output,
1534
+ args: ["onGroupCollapsed"]
1535
+ }],
1536
+ onPagingInfoChanged: [{
1537
+ type: i0.Output,
1538
+ args: ["onPagingInfoChanged"]
1539
+ }],
1540
+ onRowCountChanged: [{
1541
+ type: i0.Output,
1542
+ args: ["onRowCountChanged"]
1543
+ }],
1544
+ onRowsChanged: [{
1545
+ type: i0.Output,
1546
+ args: ["onRowsChanged"]
1547
+ }],
1548
+ onRowsOrCountChanged: [{
1549
+ type: i0.Output,
1550
+ args: ["onRowsOrCountChanged"]
1551
+ }],
1552
+ onSelectedRowIdsChanged: [{
1553
+ type: i0.Output,
1554
+ args: ["onSelectedRowIdsChanged"]
1555
+ }],
1556
+ onSetItemsCalled: [{
1557
+ type: i0.Output,
1558
+ args: ["onSetItemsCalled"]
1559
+ }],
1560
+ onAfterMenuShow: [{
1561
+ type: i0.Output,
1562
+ args: ["onAfterMenuShow"]
1563
+ }],
1564
+ onBeforeMenuClose: [{
1565
+ type: i0.Output,
1566
+ args: ["onBeforeMenuClose"]
1567
+ }],
1568
+ onBeforeMenuShow: [{
1569
+ type: i0.Output,
1570
+ args: ["onBeforeMenuShow"]
1571
+ }],
1572
+ onColumnsChanged: [{
1573
+ type: i0.Output,
1574
+ args: ["onColumnsChanged"]
1575
+ }],
1576
+ onCommand: [{
1577
+ type: i0.Output,
1578
+ args: ["onCommand"]
1579
+ }],
1580
+ onGridMenuColumnsChanged: [{
1581
+ type: i0.Output,
1582
+ args: ["onGridMenuColumnsChanged"]
1583
+ }],
1584
+ onMenuClose: [{
1585
+ type: i0.Output,
1586
+ args: ["onMenuClose"]
1587
+ }],
1588
+ onCopyCells: [{
1589
+ type: i0.Output,
1590
+ args: ["onCopyCells"]
1591
+ }],
1592
+ onCopyCancelled: [{
1593
+ type: i0.Output,
1594
+ args: ["onCopyCancelled"]
1595
+ }],
1596
+ onPasteCells: [{
1597
+ type: i0.Output,
1598
+ args: ["onPasteCells"]
1599
+ }],
1600
+ onBeforePasteCell: [{
1601
+ type: i0.Output,
1602
+ args: ["onBeforePasteCell"]
1603
+ }],
1604
+ onAfterExportToExcel: [{
1605
+ type: i0.Output,
1606
+ args: ["onAfterExportToExcel"]
1607
+ }],
1608
+ onBeforeExportToExcel: [{
1609
+ type: i0.Output,
1610
+ args: ["onBeforeExportToExcel"]
1611
+ }],
1612
+ onBeforeFilterChange: [{
1613
+ type: i0.Output,
1614
+ args: ["onBeforeFilterChange"]
1615
+ }],
1616
+ onBeforeFilterClear: [{
1617
+ type: i0.Output,
1618
+ args: ["onBeforeFilterClear"]
1619
+ }],
1620
+ onBeforeSearchChange: [{
1621
+ type: i0.Output,
1622
+ args: ["onBeforeSearchChange"]
1623
+ }],
1624
+ onBeforeSortChange: [{
1625
+ type: i0.Output,
1626
+ args: ["onBeforeSortChange"]
1627
+ }],
1628
+ onContextMenuClearGrouping: [{
1629
+ type: i0.Output,
1630
+ args: ["onContextMenuClearGrouping"]
1631
+ }],
1632
+ onContextMenuCollapseAllGroups: [{
1633
+ type: i0.Output,
1634
+ args: ["onContextMenuCollapseAllGroups"]
1635
+ }],
1636
+ onContextMenuExpandAllGroups: [{
1637
+ type: i0.Output,
1638
+ args: ["onContextMenuExpandAllGroups"]
1639
+ }],
1640
+ onColumnPickerColumnsChanged: [{
1641
+ type: i0.Output,
1642
+ args: ["onColumnPickerColumnsChanged"]
1643
+ }],
1644
+ onGridMenuMenuClose: [{
1645
+ type: i0.Output,
1646
+ args: ["onGridMenuMenuClose"]
1647
+ }],
1648
+ onGridMenuBeforeMenuShow: [{
1649
+ type: i0.Output,
1650
+ args: ["onGridMenuBeforeMenuShow"]
1651
+ }],
1652
+ onGridMenuAfterMenuShow: [{
1653
+ type: i0.Output,
1654
+ args: ["onGridMenuAfterMenuShow"]
1655
+ }],
1656
+ onGridMenuClearAllPinning: [{
1657
+ type: i0.Output,
1658
+ args: ["onGridMenuClearAllPinning"]
1659
+ }],
1660
+ onGridMenuClearAllFilters: [{
1661
+ type: i0.Output,
1662
+ args: ["onGridMenuClearAllFilters"]
1663
+ }],
1664
+ onGridMenuClearAllSorting: [{
1665
+ type: i0.Output,
1666
+ args: ["onGridMenuClearAllSorting"]
1667
+ }],
1668
+ onGridMenuCommand: [{
1669
+ type: i0.Output,
1670
+ args: ["onGridMenuCommand"]
1671
+ }],
1672
+ onHeaderButtonCommand: [{
1673
+ type: i0.Output,
1674
+ args: ["onHeaderButtonCommand"]
1675
+ }],
1676
+ onHeaderMenuCommand: [{
1677
+ type: i0.Output,
1678
+ args: ["onHeaderMenuCommand"]
1679
+ }],
1680
+ onHeaderMenuColumnResizeByContent: [{
1681
+ type: i0.Output,
1682
+ args: ["onHeaderMenuColumnResizeByContent"]
1683
+ }],
1684
+ onHeaderMenuBeforeMenuShow: [{
1685
+ type: i0.Output,
1686
+ args: ["onHeaderMenuBeforeMenuShow"]
1687
+ }],
1688
+ onHeaderMenuAfterMenuShow: [{
1689
+ type: i0.Output,
1690
+ args: ["onHeaderMenuAfterMenuShow"]
1691
+ }],
1692
+ onHideColumns: [{
1693
+ type: i0.Output,
1694
+ args: ["onHideColumns"]
1695
+ }],
1696
+ onItemsAdded: [{
1697
+ type: i0.Output,
1698
+ args: ["onItemsAdded"]
1699
+ }],
1700
+ onItemsDeleted: [{
1701
+ type: i0.Output,
1702
+ args: ["onItemsDeleted"]
1703
+ }],
1704
+ onItemsUpdated: [{
1705
+ type: i0.Output,
1706
+ args: ["onItemsUpdated"]
1707
+ }],
1708
+ onItemsUpserted: [{
1709
+ type: i0.Output,
1710
+ args: ["onItemsUpserted"]
1711
+ }],
1712
+ onFullResizeByContentRequested: [{
1713
+ type: i0.Output,
1714
+ args: ["onFullResizeByContentRequested"]
1715
+ }],
1716
+ onGridStateChanged: [{
1717
+ type: i0.Output,
1718
+ args: ["onGridStateChanged"]
1719
+ }],
1720
+ onBeforePaginationChange: [{
1721
+ type: i0.Output,
1722
+ args: ["onBeforePaginationChange"]
1723
+ }],
1724
+ onPaginationChanged: [{
1725
+ type: i0.Output,
1726
+ args: ["onPaginationChanged"]
1727
+ }],
1728
+ onPaginationRefreshed: [{
1729
+ type: i0.Output,
1730
+ args: ["onPaginationRefreshed"]
1731
+ }],
1732
+ onPaginationVisibilityChanged: [{
1733
+ type: i0.Output,
1734
+ args: ["onPaginationVisibilityChanged"]
1735
+ }],
1736
+ onPaginationSetCursorBased: [{
1737
+ type: i0.Output,
1738
+ args: ["onPaginationSetCursorBased"]
1739
+ }],
1740
+ onGridBeforeResize: [{
1741
+ type: i0.Output,
1742
+ args: ["onGridBeforeResize"]
1743
+ }],
1744
+ onGridAfterResize: [{
1745
+ type: i0.Output,
1746
+ args: ["onGridAfterResize"]
1747
+ }],
1748
+ onBeforeResizeByContent: [{
1749
+ type: i0.Output,
1750
+ args: ["onBeforeResizeByContent"]
1751
+ }],
1752
+ onAfterResizeByContent: [{
1753
+ type: i0.Output,
1754
+ args: ["onAfterResizeByContent"]
1755
+ }],
1756
+ onSortCleared: [{
1757
+ type: i0.Output,
1758
+ args: ["onSortCleared"]
1759
+ }],
1760
+ onFilterChanged: [{
1761
+ type: i0.Output,
1762
+ args: ["onFilterChanged"]
1763
+ }],
1764
+ onFilterCleared: [{
1765
+ type: i0.Output,
1766
+ args: ["onFilterCleared"]
1767
+ }],
1768
+ onSortChanged: [{
1769
+ type: i0.Output,
1770
+ args: ["onSortChanged"]
1771
+ }],
1772
+ onTreeItemToggled: [{
1773
+ type: i0.Output,
1774
+ args: ["onTreeItemToggled"]
1775
+ }],
1776
+ onTreeFullToggleEnd: [{
1777
+ type: i0.Output,
1778
+ args: ["onTreeFullToggleEnd"]
1779
+ }],
1780
+ onTreeFullToggleStart: [{
1781
+ type: i0.Output,
1782
+ args: ["onTreeFullToggleStart"]
1783
+ }],
1784
+ onBeforeGridCreate: [{
1785
+ type: i0.Output,
1786
+ args: ["onBeforeGridCreate"]
1787
+ }],
1788
+ onGridCreated: [{
1789
+ type: i0.Output,
1790
+ args: ["onGridCreated"]
1791
+ }],
1792
+ onDataviewCreated: [{
1793
+ type: i0.Output,
1794
+ args: ["onDataviewCreated"]
1795
+ }],
1796
+ onAngularGridCreated: [{
1797
+ type: i0.Output,
1798
+ args: ["onAngularGridCreated"]
1799
+ }],
1800
+ onBeforeGridDestroy: [{
1801
+ type: i0.Output,
1802
+ args: ["onBeforeGridDestroy"]
1803
+ }],
1804
+ onLanguageChange: [{
1805
+ type: i0.Output,
1806
+ args: ["onLanguageChange"]
1807
+ }],
1808
+ dataset: [{ type: Input }],
1809
+ datasetHierarchical: [{ type: Input }],
1810
+ slickgridHeader: [{
1811
+ type: ContentChild,
1812
+ args: ["slickgridHeader", { static: true }]
1813
+ }],
1814
+ slickgridFooter: [{
1815
+ type: ContentChild,
1816
+ args: ["slickgridFooter", { static: true }]
1817
+ }]
1818
+ });
1819
+ })();
1820
+ (() => {
1821
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AngularSlickgridComponent, {
1822
+ className: "AngularSlickgridComponent",
1823
+ filePath: "library/components/angular-slickgrid.component.ts",
1824
+ lineNumber: 96
1825
+ });
1826
+ })();
1662
1827
  export { AngularSlickgridComponent, AngularUtilService, SlickgridConfig, unsubscribeAllObservables };
1663
- //# sourceMappingURL=angular-slickgrid.mjs.map
1828
+
1829
+ //# sourceMappingURL=angular-slickgrid.mjs.map