basesite-shared-grid-lib 0.0.0-watch

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +30 -0
  2. package/basesite-shared-grid-lib-0.0.0-watch+1699364357423.tgz +0 -0
  3. package/esm2020/basesite-shared-grid-lib.mjs +5 -0
  4. package/esm2020/lib/formatters/column-value-formatter.mjs +27 -0
  5. package/esm2020/lib/grid-library.component.mjs +546 -0
  6. package/esm2020/lib/grid-library.module.mjs +47 -0
  7. package/esm2020/lib/grid-library.service.mjs +44 -0
  8. package/esm2020/lib/helpers/index.mjs +3 -0
  9. package/esm2020/lib/helpers/oDataProvider.mjs +787 -0
  10. package/esm2020/lib/helpers/types.mjs +2 -0
  11. package/esm2020/lib/helpers/utils.mjs +7 -0
  12. package/esm2020/lib/renderer/button-renderer/button-renderer.component.mjs +49 -0
  13. package/esm2020/lib/renderer/dropdown-renderer/drop-down-renderer.mjs +52 -0
  14. package/esm2020/lib/renderer/tooltip-renderer/custom-tooltip-renderer.mjs +30 -0
  15. package/esm2020/public-api.mjs +7 -0
  16. package/fesm2015/basesite-shared-grid-lib.mjs +1580 -0
  17. package/fesm2015/basesite-shared-grid-lib.mjs.map +1 -0
  18. package/fesm2020/basesite-shared-grid-lib.mjs +1575 -0
  19. package/fesm2020/basesite-shared-grid-lib.mjs.map +1 -0
  20. package/index.d.ts +5 -0
  21. package/lib/formatters/column-value-formatter.d.ts +10 -0
  22. package/lib/grid-library.component.d.ts +62 -0
  23. package/lib/grid-library.module.d.ts +14 -0
  24. package/lib/grid-library.service.d.ts +15 -0
  25. package/lib/helpers/index.d.ts +2 -0
  26. package/lib/helpers/oDataProvider.d.ts +338 -0
  27. package/lib/helpers/types.d.ts +20 -0
  28. package/lib/helpers/utils.d.ts +2 -0
  29. package/lib/renderer/button-renderer/button-renderer.component.d.ts +12 -0
  30. package/lib/renderer/dropdown-renderer/drop-down-renderer.d.ts +11 -0
  31. package/lib/renderer/tooltip-renderer/custom-tooltip-renderer.d.ts +16 -0
  32. package/package.json +49 -0
  33. package/public-api.d.ts +3 -0
  34. package/src/lib/styles/styles.scss +184 -0
@@ -0,0 +1,1580 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, EventEmitter, Input, Output, ViewChild, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/common/http';
4
+ import { HttpClientModule } from '@angular/common/http';
5
+ import { __awaiter } from 'tslib';
6
+ import * as i1$1 from '@angular/common';
7
+ import { CommonModule, DatePipe } from '@angular/common';
8
+ import { takeUntil } from 'rxjs/operators';
9
+ import { Subject } from 'rxjs';
10
+ import * as i3 from 'ag-grid-angular';
11
+ import { AgGridModule } from 'ag-grid-angular';
12
+ import { LicenseManager } from 'ag-grid-enterprise';
13
+
14
+ class GridLibraryService {
15
+ constructor(httpClient) {
16
+ this.httpClient = httpClient;
17
+ this.baseUrl = 'https://localhost:8075/api';
18
+ }
19
+ setBaseUrl(environment) {
20
+ if (environment === 'test') {
21
+ this.baseUrl = 'https://fcesharedgridtest.intel.com/api';
22
+ }
23
+ else if (environment == 'uat') {
24
+ this.baseUrl = 'https://fcesharedgriduat.intel.com/api';
25
+ }
26
+ else if (environment == 'production') {
27
+ this.baseUrl = 'https://fcesharedgrid.intel.com/api';
28
+ }
29
+ else {
30
+ this.baseUrl = 'https://localhost:8075/api';
31
+ }
32
+ }
33
+ getColDef(gridId) {
34
+ return this.httpClient.get(`${this.baseUrl}/GridConfiguration/${gridId}`);
35
+ }
36
+ saveColumnConfig(columnConfig) {
37
+ return this.httpClient.post(`${this.baseUrl}/GridConfiguration/saveUIUserGridConfiguration`, columnConfig);
38
+ }
39
+ getGridState(gridId, loggedInUserId) {
40
+ return this.httpClient.get(`${this.baseUrl}/GridConfiguration?gridId=${gridId}&userId=${loggedInUserId}`);
41
+ }
42
+ getDataForExport(serverUrl) {
43
+ return this.httpClient.get(`${serverUrl}`);
44
+ }
45
+ }
46
+ GridLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: GridLibraryService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
47
+ GridLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: GridLibraryService, providedIn: 'root' });
48
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: GridLibraryService, decorators: [{
49
+ type: Injectable,
50
+ args: [{
51
+ providedIn: 'root',
52
+ }]
53
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
54
+
55
+ var types$1 = /*#__PURE__*/Object.freeze({
56
+ __proto__: null
57
+ });
58
+
59
+ function escapeRegExp(string) {
60
+ return string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
61
+ }
62
+ function replaceAll(str, search, replacement) {
63
+ return str.replace(new RegExp(escapeRegExp(search), "g"), replacement);
64
+ }
65
+
66
+ class OdataProvider {
67
+ constructor(options) {
68
+ /**
69
+ * Name of field contain count of record results in grouping odata query
70
+ * @default childCount
71
+ */
72
+ this.groupCountFieldName = 'childCount';
73
+ /**
74
+ * Use in odata build query
75
+ * @default false
76
+ */
77
+ this.isCaseSensitiveStringFilter = false;
78
+ /**Creator a cancelable Promise */
79
+ this.createCancelablePromise = () => {
80
+ let cancel;
81
+ const pr = new Promise((_, reject) => {
82
+ cancel = reject;
83
+ }).catch(() => { });
84
+ return {
85
+ promise: pr,
86
+ cancel,
87
+ };
88
+ };
89
+ /**Odata query operations */
90
+ this.odataOperator = {
91
+ // Logical
92
+ equals: (col, value1) => `${col} eq ${value1}`,
93
+ blank: (col, value1) => `${col} eq ${value1}`,
94
+ notBlank: (col, value1) => `${col} ne ${value1}`,
95
+ notEqual: (col, value1) => `${col} ne ${value1}`,
96
+ lessThan: (col, value1) => `${col} lt ${value1}`,
97
+ lessThanOrEqual: (col, value1) => `${col} le ${value1}`,
98
+ greaterThan: (col, value1) => `${col} gt ${value1}`,
99
+ greaterThanOrEqual: (col, value1) => `${col} ge ${value1}`,
100
+ inRange: (col, value1, value2) => `(${col} ge ${value1} and ${col} le ${value2})`,
101
+ // String
102
+ equalsStr: (col, value1, isCaseSensitiveStringFilter) => `${this.ifTolowerCol(col, isCaseSensitiveStringFilter)} eq ${this.ifTolower(value1, isCaseSensitiveStringFilter)}`,
103
+ notEqualStr: (col, value1, isCaseSensitiveStringFilter) => `${this.ifTolowerCol(col, isCaseSensitiveStringFilter)} ne ${this.ifTolower(value1, isCaseSensitiveStringFilter)}`,
104
+ contains: (col, value1, isCaseSensitiveStringFilter) => `contains(${this.ifTolowerCol(col, isCaseSensitiveStringFilter)},${this.ifTolower(value1, isCaseSensitiveStringFilter)})`,
105
+ notContains: (col, value1, isCaseSensitiveStringFilter) => `contains(${this.ifTolowerCol(col, isCaseSensitiveStringFilter)},${this.ifTolower(value1, isCaseSensitiveStringFilter)}) eq false`,
106
+ startsWith: (col, value1, isCaseSensitiveStringFilter) => `startswith(${this.ifTolowerCol(col, isCaseSensitiveStringFilter)},${this.ifTolower(value1, isCaseSensitiveStringFilter)}) eq true`,
107
+ endsWith: (col, value1, isCaseSensitiveStringFilter) => `endswith(${this.ifTolowerCol(col, isCaseSensitiveStringFilter)},${this.ifTolower(value1, isCaseSensitiveStringFilter)}) eq true`,
108
+ inStr: (col, values, isCaseSensitiveStringFilter) => `${this.ifTolowerCol(col, isCaseSensitiveStringFilter)} in (${values
109
+ .map((x) => `'${this.ifTolower(this.encode(x), isCaseSensitiveStringFilter)}'`)
110
+ .join()})`,
111
+ in: (col, values) => `${col} in (${values.map((x) => `${this.encode(x)}`).join()})`,
112
+ notIn: (col, values) => `not (${col} in (${values.map((x) => `${x}`).join()}))`,
113
+ // Date
114
+ trunc: (col) => `date(${col})`,
115
+ };
116
+ /**
117
+ * Apply tolower for column in odata syntax
118
+ * @param col column name
119
+ * @param isCaseSensitiveStringFilter need apply tolower
120
+ */
121
+ this.ifTolowerCol = (col, isCaseSensitiveStringFilter) => isCaseSensitiveStringFilter ? col : `tolower(${col})`;
122
+ /**
123
+ *
124
+ * @param value string value
125
+ * @param isCaseSensitiveStringFilter need apply tolower
126
+ */
127
+ this.ifTolower = (value, isCaseSensitiveStringFilter) => isCaseSensitiveStringFilter ? value : value ? value.toLowerCase() : value;
128
+ /**
129
+ * Odata aggregation operations
130
+ */
131
+ this.odataAggregation = {
132
+ // Logical
133
+ sum: (col, asField) => `${col} with sum as ${col || asField}`,
134
+ min: (col, asField) => `${col} with min as ${col || asField}`,
135
+ max: (col, asField) => `${col} with max as ${col || asField}`,
136
+ avg: (col, asField) => `${col} with average as ${col || asField}`,
137
+ count: (col, asField) => `$count as ${col || asField}`,
138
+ };
139
+ /**
140
+ * Odata query builder
141
+ * @param options parameter for odata query
142
+ */
143
+ this.toQuery = (options) => {
144
+ let path = [];
145
+ if (options) {
146
+ path.push('$count=true');
147
+ }
148
+ if (options.skip) {
149
+ path.push(`$skip=${options.skip}`);
150
+ }
151
+ if (options.top) {
152
+ path.push(`$top=${options.top}`);
153
+ }
154
+ if (options.sort && options.sort.length > 0) {
155
+ path.push('$orderby=' + options.sort.join(','));
156
+ }
157
+ if (options.filter && options.filter.length > 0) {
158
+ path.push('$filter=' + options.filter.join(' and '));
159
+ }
160
+ if (options.apply && options.apply.length > 0) {
161
+ path.push('$apply=' + options.apply.join('/'));
162
+ }
163
+ if (options.expand && options.expand.length > 0) {
164
+ path.push('$expand=' + options.expand.join(','));
165
+ }
166
+ if (options.select && options.select.length > 0) {
167
+ path.push('$select=' + options.select.join(','));
168
+ }
169
+ let query = '';
170
+ if (path.length > 0) {
171
+ var defaultFilters = path.filter((x) => {
172
+ if (x.indexOf('$count') >= 0 ||
173
+ x.indexOf('$top') >= 0 ||
174
+ x.indexOf('$orderby') >= 0 ||
175
+ x.indexOf('$apply') >= 0 ||
176
+ x.indexOf('$expand') >= 0 ||
177
+ x.indexOf('$select') >= 0) {
178
+ return x;
179
+ }
180
+ });
181
+ if (defaultFilters && defaultFilters.length > 0) {
182
+ query = '?' + defaultFilters.join('&');
183
+ }
184
+ var customFilters = path.filter(function (obj) {
185
+ return defaultFilters.indexOf(obj) == -1;
186
+ });
187
+ if (customFilters && customFilters.length > 0) {
188
+ if (customFilters.length == 1)
189
+ query = query + '&' + customFilters;
190
+ else
191
+ query = query + customFilters.join('and');
192
+ }
193
+ }
194
+ query = query.replace('and$filter=', '&filter=');
195
+ return query;
196
+ };
197
+ /**
198
+ * Add quotes for string value
199
+ * @param value string value
200
+ */
201
+ this.encode = (value) => this.isStrVal(value) ? replaceAll(value, "'", "''") : value;
202
+ /**
203
+ * Conctat to date a time for create datetime format for odata query
204
+ * @param value date string
205
+ */
206
+ this.toDateTime = (value) => {
207
+ const dt = new Date(value);
208
+ if (isNaN(dt.getTime()))
209
+ return null;
210
+ const dt1 = new Date(Date.UTC(dt.getFullYear(), dt.getMonth(), dt.getDate()));
211
+ return dt1.toISOString();
212
+ };
213
+ /**
214
+ *
215
+ * @param colName columnName
216
+ * @returns is CaseSensitive for column
217
+ */
218
+ this.getIsNeedCaseSensitive = (colName) => {
219
+ if (!this.isCaseSensitiveStringFilter &&
220
+ this.caseSensitiveColumns &&
221
+ this.caseSensitiveColumns.length > 0) {
222
+ return this.caseSensitiveColumns.indexOf(colName) >= 0;
223
+ }
224
+ return this.isCaseSensitiveStringFilter;
225
+ };
226
+ /**
227
+ * Convert ag-grid column filter to odata query
228
+ * @param colName columnName
229
+ * @param col ag-grid column
230
+ */
231
+ this.getFilterOdata = (colName, col) => {
232
+ const me = this;
233
+ const isCaseSensitiveStringFilter = me.getIsNeedCaseSensitive(colName);
234
+ const customFilter = me.customFilters && me.customFilters[colName];
235
+ colName = replaceAll(colName, '.', '/');
236
+ colName = me.getWrapColumnName(colName);
237
+ if (customFilter) {
238
+ return customFilter(colName, col, isCaseSensitiveStringFilter, me);
239
+ }
240
+ else {
241
+ switch (col.filterType) {
242
+ case 'number':
243
+ return me.odataOperator[col.type](colName, col.filter, col.filterTo);
244
+ case 'text': {
245
+ let operatorName = col.type;
246
+ const filter = me.encode(col.filter) || '';
247
+ // let filterTo = me.encode(col.filterTo);
248
+ if ((operatorName === 'equals' || operatorName === 'notEqual') &&
249
+ !isCaseSensitiveStringFilter) {
250
+ operatorName += 'Str';
251
+ }
252
+ return me.odataOperator[operatorName](colName, `'${filter}'`, isCaseSensitiveStringFilter);
253
+ }
254
+ case 'date':
255
+ if (col.dateFrom != null &&
256
+ me.toDateTime(col.dateFrom) != null &&
257
+ (col.dateTo == null ||
258
+ (col.dateTo != null && me.toDateTime(col.dateTo) != null))) {
259
+ return me.odataOperator[col.type](colName, `${me.toDateTime(col.dateFrom)}`, `${me.toDateTime(col.dateTo)}`);
260
+ }
261
+ break;
262
+ case 'set':
263
+ return col.values.length > 0
264
+ ? me.odataOperator.inStr(colName, col.values, isCaseSensitiveStringFilter)
265
+ : '';
266
+ default:
267
+ break;
268
+ }
269
+ }
270
+ return '';
271
+ };
272
+ /**
273
+ * Caclulate pivot data for ag-grid from odata
274
+ * @param pivotCols pivot columns
275
+ * @param rowGroupCols row group columns
276
+ * @param valueCols value columns
277
+ * @param data odata result
278
+ * @param countField count field name
279
+ */
280
+ this.getPivot = (pivotCols, rowGroupCols, valueCols, data, countField) => {
281
+ // assume 1 pivot col and 1 value col for this example
282
+ const me = this;
283
+ const pivotData = [];
284
+ const aggColsList = [];
285
+ const colKeyExistsMap = {};
286
+ const secondaryColDefs = [];
287
+ const secondaryColDefsMap = {};
288
+ data.forEach(function (item) {
289
+ var pivotValues = [];
290
+ pivotCols.forEach(function (pivotCol) {
291
+ var pivotField = pivotCol.id;
292
+ var pivotValue = me.getValue(pivotField, item);
293
+ if (pivotValue !== null &&
294
+ pivotValue !== undefined &&
295
+ pivotValue.toString) {
296
+ pivotValues.push(pivotValue.toString());
297
+ }
298
+ else {
299
+ pivotValues.push('-');
300
+ }
301
+ });
302
+ // var pivotValue = item[pivotField].toString();
303
+ var pivotItem = {};
304
+ valueCols.forEach(function (valueCol) {
305
+ var valField = valueCol.id;
306
+ var colKey = createColKey(pivotValues, valField);
307
+ var value = me.getValue(valField, item);
308
+ pivotItem[colKey] = value;
309
+ if (!colKeyExistsMap[colKey]) {
310
+ addNewAggCol(colKey, valueCol);
311
+ addNewSecondaryColDef(colKey, pivotValues, valueCol);
312
+ colKeyExistsMap[colKey] = true;
313
+ }
314
+ });
315
+ if (countField) {
316
+ pivotItem[countField] = me.getValue(countField, item);
317
+ }
318
+ rowGroupCols.forEach(function (rowGroupCol) {
319
+ var rowGroupField = rowGroupCol.id.split('.')[0];
320
+ pivotItem[rowGroupField] = item[rowGroupField];
321
+ });
322
+ pivotData.push(pivotItem);
323
+ });
324
+ function addNewAggCol(colKey, valueCol) {
325
+ var newCol = {
326
+ id: colKey,
327
+ field: colKey,
328
+ aggFunc: valueCol.aggFunc,
329
+ };
330
+ aggColsList.push(newCol);
331
+ }
332
+ function addNewSecondaryColDef(colKey, pivotValues, valueCol) {
333
+ var parentGroup = null;
334
+ var keyParts = [];
335
+ pivotValues.forEach(function (pivotValue) {
336
+ keyParts.push(pivotValue);
337
+ var colKey = createColKey(keyParts);
338
+ var groupColDef = secondaryColDefsMap[colKey];
339
+ if (!groupColDef) {
340
+ groupColDef = {
341
+ groupId: colKey,
342
+ headerName: pivotValue,
343
+ children: [],
344
+ };
345
+ secondaryColDefsMap[colKey] = groupColDef;
346
+ if (parentGroup) {
347
+ parentGroup.children.push(groupColDef);
348
+ }
349
+ else {
350
+ secondaryColDefs.push(groupColDef);
351
+ }
352
+ }
353
+ parentGroup = groupColDef;
354
+ });
355
+ parentGroup.children.push({
356
+ colId: colKey,
357
+ headerName: valueCol.aggFunc + '(' + valueCol.displayName + ')',
358
+ field: colKey,
359
+ suppressMenu: true,
360
+ sortable: false,
361
+ });
362
+ }
363
+ function createColKey(pivotValues, valueField) {
364
+ var result = pivotValues.join('|');
365
+ if (valueField !== undefined) {
366
+ result += '|' + valueField;
367
+ }
368
+ result = replaceAll(result, '.', '*');
369
+ return result;
370
+ }
371
+ return {
372
+ data: pivotData,
373
+ aggCols: aggColsList,
374
+ secondaryColDefs: secondaryColDefs,
375
+ };
376
+ };
377
+ /**
378
+ *
379
+ * @param rowData array odata result
380
+ * @param rowGroupCols row group columns
381
+ * @param groupKeys what groups the user is viewing
382
+ * @param countField count field name
383
+ */
384
+ this.buildGroupsFromData = (rowData, rowGroupCols, groupKeys, countField) => {
385
+ const me = this;
386
+ let rowGroupCol = rowGroupCols[groupKeys.length];
387
+ let field = rowGroupCol.id;
388
+ let mappedRowData = me.groupBy(rowData, field);
389
+ let groups = [];
390
+ me.iterateObject(mappedRowData, function (key, rowData) {
391
+ var groupItem = me.aggregateList(rowData, countField);
392
+ groupItem[field] = key;
393
+ groups.push(groupItem);
394
+ });
395
+ return groups;
396
+ };
397
+ /**
398
+ * Internal function for execute callback function for each property of object
399
+ * @param object object contained odata grouped result
400
+ * @param callback function do somthing
401
+ */
402
+ this.iterateObject = (object, callback) => {
403
+ if (!object) {
404
+ return;
405
+ }
406
+ const keys = Object.keys(object);
407
+ for (let i = 0; i < keys.length; i++) {
408
+ const key = keys[i];
409
+ const value = object[key];
410
+ callback(key, value);
411
+ }
412
+ };
413
+ /**
414
+ * Prepeare grouped data
415
+ * @param rowData array odata result
416
+ * @param field grouping field
417
+ */
418
+ this.groupBy = (rowData, field) => {
419
+ var result = {};
420
+ const me = this;
421
+ rowData.forEach(function (item) {
422
+ var key = me.getValue(field, item);
423
+ var listForThisKey = result[key];
424
+ if (!listForThisKey) {
425
+ listForThisKey = [];
426
+ result[key] = listForThisKey;
427
+ }
428
+ listForThisKey.push(item);
429
+ });
430
+ return result;
431
+ };
432
+ /**
433
+ * Calculate total count records in group
434
+ * @param rowData array odata result data
435
+ * @param countField field contained count of all records
436
+ */
437
+ this.aggregateList = (rowData, countField) => {
438
+ var result = {};
439
+ rowData.forEach((row) => {
440
+ if (countField && row[countField] != null) {
441
+ const totalCount = (result[countField] || 0) + (row[countField] || 0);
442
+ delete row[countField];
443
+ result[countField] = totalCount;
444
+ }
445
+ result = Object.assign(result, row);
446
+ });
447
+ return result;
448
+ };
449
+ /**
450
+ * Calculate distinct values for input field from Odata api
451
+ * @param field The field of the row to get the cells data from
452
+ * @param callback The function for return distinct values for input field
453
+ * @param beforeRequest The function for customize request
454
+ * @example
455
+ * <pre><code>
456
+ * const setFilterValuesFuncParams = params => {
457
+ * const me = this
458
+ * const col = params.colDef.field
459
+ * const storeName = me.getStoreName(col)
460
+ * const callback = data => {
461
+ * if (data) {
462
+ * me.setState({ [storeName]: data })
463
+ * params.success(data)
464
+ * }
465
+ * }
466
+ * odataProviderInstance.getFilterValuesParams(params.colDef.field, callback)
467
+ * }
468
+ *
469
+ * ///....
470
+ * <AgGridColumn
471
+ field="product"
472
+ headerName={'PRODUCT'}
473
+ filter="agSetColumnFilter"
474
+ // rowGroup
475
+ // enablePivot
476
+ enableRowGroup
477
+ filterParams={{
478
+ values: setFilterValuesFuncParams,
479
+ newRowsAction: 'keep'
480
+ }}
481
+ // filterParams={{caseSensitive: true}}
482
+ />
483
+ * </code></pre>
484
+ */
485
+ this.getFilterValuesParams = (field, callback, beforeRequest) => {
486
+ const me = this;
487
+ const options = {
488
+ apply: [`groupby((${me.getWrapColumnName(field)}))`],
489
+ };
490
+ if (beforeRequest) {
491
+ beforeRequest(options);
492
+ }
493
+ me.callApi(me.toQuery(options)).then((x) => {
494
+ if (x) {
495
+ let values = me.getOdataResult(x);
496
+ callback(values.map((y) => y[field]));
497
+ }
498
+ });
499
+ };
500
+ /**
501
+ * Detect is string value
502
+ * @param value
503
+ */
504
+ this.isStrVal = (value) => typeof value === 'string';
505
+ /**
506
+ * Extartc values from odata response
507
+ * @param response
508
+ */
509
+ this.getOdataResult = (response) => Array.isArray(response) ? response : response.value;
510
+ /**
511
+ * Endocing column name to odata notation
512
+ * @param colName column name
513
+ */
514
+ this.getWrapColumnName = (colName) => colName ? replaceAll(colName, '.', '/') : '';
515
+ /**
516
+ * Set result
517
+ * @param params ag-grid details for the request
518
+ * @param isServerMode detect type of params
519
+ * @param rowsThisBlock data of the request
520
+ * @param rowCount count of total result
521
+ */
522
+ this.setResult = (params, isServerMode, rowsThisBlock, rowCount) => {
523
+ if (isServerMode) {
524
+ params.success({
525
+ rowData: rowsThisBlock,
526
+ rowCount: rowCount,
527
+ });
528
+ }
529
+ else {
530
+ params.successCallback(rowsThisBlock, rowCount);
531
+ }
532
+ };
533
+ /**
534
+ * Generate odata options for build query from ag-grid request
535
+ * @param params ag-grid details for the request
536
+ */
537
+ this.getOdataOptions = (params) => {
538
+ const me = this;
539
+ const options = {};
540
+ const isServerMode = 'request' in params;
541
+ const request = isServerMode
542
+ ? params.request
543
+ : params;
544
+ const childCount = me.groupCountFieldName;
545
+ if (this.beforeRequest) {
546
+ this.beforeRequest(options, this, request);
547
+ }
548
+ if (request.sortModel.length > 0) {
549
+ const sort = options.sort || [];
550
+ for (let i = 0; i < request.sortModel.length; i++) {
551
+ const col = request.sortModel[i];
552
+ let colName = me.getWrapColumnName(col.colId);
553
+ if (col.sort !== 'asc') {
554
+ colName += ' desc';
555
+ }
556
+ sort.push(colName);
557
+ }
558
+ options.sort = sort;
559
+ }
560
+ const filter = options.filter || [];
561
+ for (const colName in request.filterModel) {
562
+ if (request.filterModel.hasOwnProperty(colName)) {
563
+ const col = request.filterModel[colName];
564
+ let colFilter = '';
565
+ if (!col.operator) {
566
+ colFilter = me.getFilterOdata(colName, col);
567
+ if (colFilter) {
568
+ filter.push(colFilter);
569
+ }
570
+ }
571
+ else {
572
+ const condition1 = me.getFilterOdata(colName, col.condition1);
573
+ const condition2 = me.getFilterOdata(colName, col.condition2);
574
+ if (condition1 && condition2) {
575
+ colFilter = `(${condition1} ${col.operator.toLowerCase()} ${condition2})`;
576
+ filter.push(colFilter);
577
+ }
578
+ }
579
+ }
580
+ }
581
+ let pivotActive = false;
582
+ const apply = options.apply || [];
583
+ if (isServerMode) {
584
+ const requestSrv = request;
585
+ pivotActive =
586
+ requestSrv.pivotMode &&
587
+ requestSrv.pivotCols.length > 0 &&
588
+ requestSrv.valueCols.length > 0;
589
+ if (requestSrv.rowGroupCols.length > 0) {
590
+ const filterGroupBy = [];
591
+ if (requestSrv.groupKeys.length < requestSrv.rowGroupCols.length) {
592
+ // If request only groups
593
+ for (let idx = 0; idx < requestSrv.groupKeys.length; idx++) {
594
+ const colValue = requestSrv.groupKeys[idx];
595
+ const condition = `${me.getWrapColumnName(requestSrv.rowGroupCols[idx].field)} eq ${(me.isStrVal(colValue) ? "'" : '') +
596
+ me.encode(colValue) +
597
+ (me.isStrVal(colValue) ? "'" : '')}`;
598
+ filterGroupBy.push(condition);
599
+ }
600
+ if (filterGroupBy.length > 0 || filter.length > 0) {
601
+ // Filters must by first
602
+ apply.push(`filter(${filterGroupBy.concat(filter).join(' and ')})`);
603
+ }
604
+ const aggregate = [];
605
+ if (childCount) {
606
+ aggregate.push(me.odataAggregation.count(childCount));
607
+ }
608
+ if (requestSrv.valueCols.length > 0) {
609
+ for (let idx = 0; idx < requestSrv.valueCols.length; idx++) {
610
+ const colValue = requestSrv.valueCols[idx];
611
+ colValue.aggFunc &&
612
+ aggregate.push(me.odataAggregation[colValue.aggFunc](me.getWrapColumnName(colValue.field)));
613
+ }
614
+ }
615
+ let groups = [
616
+ me.getWrapColumnName(requestSrv.rowGroupCols[requestSrv.groupKeys.length].field),
617
+ ];
618
+ const sort = options.sort || [];
619
+ const sortColOnly = sort.map((x) => x.split(' ')[0]);
620
+ if (pivotActive) {
621
+ groups = groups.concat(requestSrv.pivotCols.map((x) => me.getWrapColumnName(x.field)));
622
+ groups.forEach((x) => {
623
+ if (sortColOnly.indexOf(x) < 0) {
624
+ sort.push(x);
625
+ }
626
+ });
627
+ }
628
+ options.sort = sort;
629
+ apply.push(`groupby((${groups.join(',')})${aggregate.length > 0 ? `,aggregate(${aggregate.join(',')})` : ''})`);
630
+ options.apply = apply;
631
+ if (options.sort && options.sort.length > 0) {
632
+ options.sort = options.sort.filter((x) => groups.indexOf(x.split(' ')[0]) >= 0);
633
+ }
634
+ // delete options.sort;
635
+ }
636
+ else {
637
+ // If request rowData by group filter
638
+ for (let idx = 0; idx < requestSrv.groupKeys.length; idx++) {
639
+ const colValue = requestSrv.groupKeys[idx];
640
+ const condition = `${me.getWrapColumnName(requestSrv.rowGroupCols[idx].field)} eq ${(me.isStrVal(colValue) ? "'" : '') +
641
+ me.encode(colValue) +
642
+ (me.isStrVal(colValue) ? "'" : '')}`;
643
+ filter.push(condition);
644
+ }
645
+ }
646
+ }
647
+ }
648
+ if (filter.length > 0) {
649
+ options.filter = filter;
650
+ }
651
+ if (apply.length > 0) {
652
+ options.apply = apply;
653
+ delete options.filter;
654
+ delete options.expand;
655
+ delete options.select;
656
+ // options.sort = null;
657
+ }
658
+ options.skip = request.startRow;
659
+ options.top = (request.endRow || 0) - (request.startRow || 0);
660
+ if (!options.apply && options.skip === 0) {
661
+ options.count = true;
662
+ }
663
+ return options;
664
+ };
665
+ /**
666
+ * Generate odata query from ag-grid request
667
+ * @param params ag-grid details for the request
668
+ */
669
+ this.getOdataQuery = (params) => this.toQuery(this.getOdataOptions(params));
670
+ Object.assign(this, options);
671
+ if (this.callApi == null) {
672
+ throw new Error('callApi must be specified');
673
+ }
674
+ if (typeof this.callApi !== 'function') {
675
+ throw new Error('callApi must be a function');
676
+ }
677
+ if (this.beforeRequest != null &&
678
+ typeof this.beforeRequest !== 'function') {
679
+ throw new Error('beforeRequest must be a function');
680
+ }
681
+ if (this.afterLoadData != null &&
682
+ typeof this.afterLoadData !== 'function') {
683
+ throw new Error('afterLoadData must be a function');
684
+ }
685
+ if (this.setError != null && typeof this.setError !== 'function') {
686
+ throw new Error('setError must be a function');
687
+ }
688
+ this.cancelPromice = this.createCancelablePromise();
689
+ }
690
+ /**
691
+ * Extract value from record by path to field
692
+ * @param field path to column value
693
+ * @param obj record
694
+ */
695
+ getValue(field, obj) {
696
+ const paths = field.split('.');
697
+ if (paths.length === 1) {
698
+ return obj[field];
699
+ }
700
+ else {
701
+ return paths.reduce((object, path) => {
702
+ return (object || {})[path]; // Oliver Steele's pattern
703
+ }, obj);
704
+ }
705
+ }
706
+ /**
707
+ * grid calls this to get rows for IServerSideDatasource
708
+ * @param params ag-grid details for the request
709
+ */
710
+ /**
711
+ * grid calls this to get rows implement
712
+ * @param params ag-grid details for the request
713
+ */
714
+ getRows(params) {
715
+ const me = this;
716
+ const childCount = me.groupCountFieldName;
717
+ const isServerMode = 'request' in params;
718
+ const request = isServerMode
719
+ ? params.request
720
+ : params;
721
+ const requestSrv = request;
722
+ const pivotActive = !isServerMode
723
+ ? false
724
+ : requestSrv.pivotMode &&
725
+ requestSrv.pivotCols.length > 0 &&
726
+ requestSrv.valueCols.length > 0;
727
+ if (!pivotActive) {
728
+ let fn = params.columnApi.setPivotResultColumns;
729
+ if (fn != null) {
730
+ // if ((params as any).columnApi.isPivotMode()) {
731
+ params.columnApi.setPivotResultColumns([]);
732
+ // }
733
+ }
734
+ else {
735
+ params.columnApi.setSecondaryColumns([]);
736
+ }
737
+ }
738
+ const options = me.getOdataOptions(params);
739
+ const query = me.toQuery(options);
740
+ if (options.skip === 0 &&
741
+ (!isServerMode ||
742
+ (isServerMode &&
743
+ params.parentNode.level === -1))) {
744
+ me.cancelPromice.cancel();
745
+ me.cancelPromice = me.createCancelablePromise();
746
+ }
747
+ Promise.race([me.cancelPromice.promise, me.callApi(query)]).then((x) => __awaiter(this, void 0, void 0, function* () {
748
+ var _a, _b;
749
+ if (!x) {
750
+ params.failCallback();
751
+ }
752
+ else {
753
+ const values = me.getOdataResult(x);
754
+ if (!pivotActive) {
755
+ if (!options.apply) {
756
+ me.setResult(params, isServerMode, values, x['@odata.count'] || ((_a = x[0]) === null || _a === void 0 ? void 0 : _a.totalCount));
757
+ if (this.afterLoadData) {
758
+ this.afterLoadData(options, values, x['@odata.count'] || ((_b = x[0]) === null || _b === void 0 ? void 0 : _b.totalCount));
759
+ }
760
+ }
761
+ else {
762
+ let count = values.length;
763
+ if (count === options.top && options.skip === 0) {
764
+ // If received grouped count of value large than requested then request total count of values
765
+ me.callApi(query + '/aggregate($count as count)').then((y) => {
766
+ count = me.getOdataResult(y)[0].count;
767
+ me.setResult(params, isServerMode, values, count);
768
+ });
769
+ }
770
+ else {
771
+ if (options.skip != null && options.skip > 0) {
772
+ count = null;
773
+ }
774
+ me.setResult(params, isServerMode, values, count);
775
+ if (this.afterLoadData) {
776
+ this.afterLoadData(options, values, count);
777
+ }
778
+ }
779
+ }
780
+ }
781
+ else {
782
+ let rowData = me.getOdataResult(x);
783
+ // Check count
784
+ if (rowData.length === options.top &&
785
+ options.skip === 0 &&
786
+ requestSrv.groupKeys.length === 0) {
787
+ let eof = false;
788
+ while (!eof) {
789
+ options.skip += options.top || 0;
790
+ const subQuery = me.toQuery(options);
791
+ const newRowData = yield me.callApi(subQuery);
792
+ if (!newRowData) {
793
+ params.failCallback();
794
+ return;
795
+ }
796
+ eof = newRowData.length !== options.top;
797
+ rowData = rowData.concat(newRowData);
798
+ }
799
+ }
800
+ const pivotResult = me.getPivot(requestSrv.pivotCols, requestSrv.rowGroupCols, requestSrv.valueCols, rowData, childCount);
801
+ rowData = pivotResult.data;
802
+ const secondaryColDefs = pivotResult.secondaryColDefs;
803
+ rowData = me.buildGroupsFromData(rowData, requestSrv.rowGroupCols, requestSrv.groupKeys, childCount);
804
+ const totalCount = requestSrv.groupKeys.length === 0
805
+ ? rowData.length
806
+ : rowData.length === options.top
807
+ ? null
808
+ : rowData.length;
809
+ // if (totalCount > (options.top || 0)) {
810
+ // const serverSideBlock = (params as any).parentNode.rowModel
811
+ // .rowNodeBlockLoader.blocks[0];
812
+ // serverSideBlock.rowNodeCacheParams.blockSize = totalCount;
813
+ // serverSideBlock.endRow = serverSideBlock.startRow + totalCount;
814
+ // serverSideBlock.createRowNodes();
815
+ // }
816
+ me.setResult(params, isServerMode, rowData, totalCount);
817
+ if (this.afterLoadData) {
818
+ this.afterLoadData(options, rowData, totalCount);
819
+ }
820
+ if (requestSrv.groupKeys.length === 0) {
821
+ if (this.beforeSetSecondaryColumns) {
822
+ this.beforeSetSecondaryColumns(secondaryColDefs);
823
+ }
824
+ let fn = params.columnApi.setPivotResultColumns;
825
+ if (fn) {
826
+ params.columnApi.setPivotResultColumns(secondaryColDefs);
827
+ }
828
+ else {
829
+ params.columnApi.setSecondaryColumns(secondaryColDefs);
830
+ }
831
+ }
832
+ }
833
+ }
834
+ }), (err) => {
835
+ me.setResult(params, isServerMode, [], 0);
836
+ if (this.setError) {
837
+ this.setError(err, params);
838
+ }
839
+ });
840
+ }
841
+ }
842
+ class OdataProviderClient extends OdataProvider {
843
+ getRows(params) {
844
+ super.getRows(params);
845
+ }
846
+ }
847
+ class OdataServerSideProvider extends OdataProvider {
848
+ getRows(params) {
849
+ super.getRows(params);
850
+ }
851
+ }
852
+
853
+ class ButtonRendererComponent {
854
+ agInit(params) {
855
+ this.params = params;
856
+ this.label = this.params.label || null;
857
+ this.icon = this.params.icon;
858
+ }
859
+ refresh(params) {
860
+ return false;
861
+ }
862
+ onClick($event) {
863
+ if (this.params.onClick instanceof Function) {
864
+ // put anything into params u want pass into parents component
865
+ const params = {
866
+ event: $event,
867
+ rowData: Object.assign({}, this.params.node.data, {
868
+ buttonName: this.params.buttonName,
869
+ buttonText: this.params.label,
870
+ buttonIcon: this.params.icon,
871
+ }),
872
+ };
873
+ this.params.onClick(params);
874
+ }
875
+ }
876
+ }
877
+ ButtonRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: ButtonRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
878
+ ButtonRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.6", type: ButtonRendererComponent, selector: "lib-button-renderer", ngImport: i0, template: `
879
+ <button class="btn-actions" type="button" (click)="onClick($event)" [attr.data-title]="params.tooltip">
880
+ <span *ngIf="icon && !label"> <i class="{{ icon }}"></i> </span>
881
+ <span *ngIf="!icon && label">{{ label }}</span>
882
+ <span *ngIf="icon && label"><i class="{{ icon }}"></i> {{ label }}</span>
883
+ </button>
884
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
885
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: ButtonRendererComponent, decorators: [{
886
+ type: Component,
887
+ args: [{
888
+ selector: 'lib-button-renderer',
889
+ template: `
890
+ <button class="btn-actions" type="button" (click)="onClick($event)" [attr.data-title]="params.tooltip">
891
+ <span *ngIf="icon && !label"> <i class="{{ icon }}"></i> </span>
892
+ <span *ngIf="!icon && label">{{ label }}</span>
893
+ <span *ngIf="icon && label"><i class="{{ icon }}"></i> {{ label }}</span>
894
+ </button>
895
+ `,
896
+ }]
897
+ }] });
898
+
899
+ class CustomTooltip {
900
+ constructor(datePipe) {
901
+ this.datePipe = datePipe;
902
+ }
903
+ agInit(params) {
904
+ this.params = params;
905
+ params.value = params.valueFormatted;
906
+ }
907
+ }
908
+ CustomTooltip.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: CustomTooltip, deps: [{ token: i1$1.DatePipe }], target: i0.ɵɵFactoryTarget.Component });
909
+ CustomTooltip.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.6", type: CustomTooltip, selector: "tooltip-component", ngImport: i0, template: ` <div class="custom-tooltip">
910
+ <p>
911
+ <span>{{ params.value }}</span>
912
+ </p>
913
+ </div>`, isInline: true });
914
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: CustomTooltip, decorators: [{
915
+ type: Component,
916
+ args: [{
917
+ selector: 'tooltip-component',
918
+ template: ` <div class="custom-tooltip">
919
+ <p>
920
+ <span>{{ params.value }}</span>
921
+ </p>
922
+ </div>`,
923
+ }]
924
+ }], ctorParameters: function () { return [{ type: i1$1.DatePipe }]; } });
925
+
926
+ class DropdownRenderer {
927
+ agInit(params) {
928
+ this.params = params;
929
+ this.dropDownData = this.params.dropDownData ? this.params.dropDownData.split(',') : [];
930
+ }
931
+ refresh(params) {
932
+ return false;
933
+ }
934
+ onClick($event) {
935
+ if (this.params.onClick instanceof Function) {
936
+ const params = {
937
+ event: $event,
938
+ rowData: Object.assign({}, this.params.node.data, {
939
+ buttonName: $event.target.innerText,
940
+ }),
941
+ };
942
+ console.log('Hit', params);
943
+ this.params.onClick(params);
944
+ }
945
+ }
946
+ }
947
+ DropdownRenderer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: DropdownRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component });
948
+ DropdownRenderer.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.6", type: DropdownRenderer, selector: "lib-dropdown-renderer", ngImport: i0, template: `
949
+ <div class="dropdown">
950
+ <button type="button" class="btn btn-white" data-toggle="dropdown">
951
+ <i class="fa fa-ellipsis-v"></i>
952
+ </button>
953
+ <div class="dropdown-menu">
954
+ <span *ngFor='let data of dropDownData' class="dropdown-item" (click)="onClick($event)">{{data}}</span>
955
+ </div>
956
+ </div>
957
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
958
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: DropdownRenderer, decorators: [{
959
+ type: Component,
960
+ args: [{
961
+ selector: 'lib-dropdown-renderer',
962
+ template: `
963
+ <div class="dropdown">
964
+ <button type="button" class="btn btn-white" data-toggle="dropdown">
965
+ <i class="fa fa-ellipsis-v"></i>
966
+ </button>
967
+ <div class="dropdown-menu">
968
+ <span *ngFor='let data of dropDownData' class="dropdown-item" (click)="onClick($event)">{{data}}</span>
969
+ </div>
970
+ </div>
971
+ `,
972
+ }]
973
+ }] });
974
+
975
+ class ColumnValueFormatter {
976
+ constructor(datePipe) {
977
+ this.datePipe = datePipe;
978
+ }
979
+ colValueFormatter(params, colType) {
980
+ if (isNaN(+params.value)) {
981
+ var dateWrapper = new Date(params.value);
982
+ let isValidDate = !isNaN(dateWrapper.getDate());
983
+ if (isValidDate && colType == 'date') {
984
+ return this.datePipe.transform(params.value, 'MM-dd-yyyy');
985
+ }
986
+ else {
987
+ return params.value;
988
+ }
989
+ }
990
+ return params.value;
991
+ }
992
+ }
993
+ ColumnValueFormatter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: ColumnValueFormatter, deps: [{ token: i1$1.DatePipe }], target: i0.ɵɵFactoryTarget.Injectable });
994
+ ColumnValueFormatter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: ColumnValueFormatter });
995
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: ColumnValueFormatter, decorators: [{
996
+ type: Injectable
997
+ }], ctorParameters: function () { return [{ type: i1$1.DatePipe }]; } });
998
+
999
+ class GridLibraryComponent {
1000
+ constructor(gridService, formatterService) {
1001
+ this.gridService = gridService;
1002
+ this.formatterService = formatterService;
1003
+ this.pageSize = 20;
1004
+ this.rowSelection = 'multiple';
1005
+ this.enableServerSidePaging = false;
1006
+ this.cacheBlockSize = 0;
1007
+ this.rowMultiSelectWithClick = false;
1008
+ this.floatingFilter = false;
1009
+ this.paginationAutoPageSize = false;
1010
+ //event emitters
1011
+ this.btnClickHandler = new EventEmitter();
1012
+ this.firstDataRendered = new EventEmitter();
1013
+ this.filterChanged = new EventEmitter();
1014
+ this.selectionChanged = new EventEmitter();
1015
+ //paramters
1016
+ this.rowDataHidden = [];
1017
+ this.exportColumnsList = [];
1018
+ this.tooltipShowDelay = 0;
1019
+ this.tooltipHideDelay = 2000;
1020
+ this.rowModelType = 'clientSide';
1021
+ this.gridPageSize = 0;
1022
+ //unsubscribe subject
1023
+ this.unsubscribe$ = new Subject();
1024
+ this.defaultColDef = {
1025
+ sortable: true,
1026
+ filter: true,
1027
+ tooltipComponent: CustomTooltip,
1028
+ };
1029
+ this.paginationNumberFormatter = (params) => {
1030
+ return '[' + params.value.toLocaleString() + ']';
1031
+ };
1032
+ this.getRowById = (params) => {
1033
+ var _a;
1034
+ var data = params.data;
1035
+ return (_a = data.id) !== null && _a !== void 0 ? _a : 0;
1036
+ };
1037
+ // Custom right click Context Menu to support custom excel exports
1038
+ this.getContextMenuItems = (params) => {
1039
+ let res = [
1040
+ 'cut',
1041
+ 'copy',
1042
+ 'copyWithHeaders',
1043
+ 'copyWithGroupHeaders',
1044
+ 'paste',
1045
+ {
1046
+ name: 'Export',
1047
+ subMenu: [
1048
+ {
1049
+ name: 'CSV Export',
1050
+ action: () => {
1051
+ this.exportFile('csv');
1052
+ },
1053
+ },
1054
+ {
1055
+ name: 'Excel Export',
1056
+ action: () => {
1057
+ this.exportFile('xlsx');
1058
+ },
1059
+ },
1060
+ ],
1061
+ },
1062
+ ];
1063
+ return res;
1064
+ };
1065
+ }
1066
+ onSortChangedEvent() {
1067
+ this.gridColumnState = this.agGrid.columnApi.getColumnState();
1068
+ }
1069
+ ngOnInit() {
1070
+ this.gridPageSize = this.pageSize;
1071
+ this.cacheBlockSize = this.cacheBlockSize = 0
1072
+ ? this.pageSize
1073
+ : this.cacheBlockSize;
1074
+ this.gridService.setBaseUrl(this.environment);
1075
+ this.getGridState();
1076
+ this.getColDef();
1077
+ if (this.enableServerSidePaging == true) {
1078
+ this.rowModelType = 'serverSide';
1079
+ this.rowData = '';
1080
+ }
1081
+ else {
1082
+ this.rowModelType = 'clientSide';
1083
+ }
1084
+ }
1085
+ onModelUpdated() {
1086
+ this.setGridState();
1087
+ }
1088
+ getColDef() {
1089
+ if (this.gridId && this.loggedInUser) {
1090
+ this.gridService.getColDef(this.gridId).pipe(takeUntil(this.unsubscribe$)).subscribe((response) => {
1091
+ var _a, _b;
1092
+ if (response.status == 1) {
1093
+ let coldef = response.list.map((res) => {
1094
+ if (res.isButton === false) {
1095
+ if (res.columnType === 'checkbox') {
1096
+ return {
1097
+ field: res.field,
1098
+ headerName: res.title,
1099
+ sortable: false,
1100
+ tooltipField: res.field,
1101
+ resizable: true,
1102
+ headerCheckboxSelection: false,
1103
+ filterable: false,
1104
+ checkboxSelection: true,
1105
+ showDisabledCheckboxes: true,
1106
+ suppressFilter: true,
1107
+ suppressSorting: true,
1108
+ suppressMenu: true,
1109
+ width: 55,
1110
+ };
1111
+ }
1112
+ else if (res.columnType === 'dropdown') {
1113
+ return {
1114
+ field: res.field,
1115
+ headerName: res.title,
1116
+ resizable: true,
1117
+ sortable: false,
1118
+ suppressFilter: true,
1119
+ suppressSorting: true,
1120
+ suppressMenu: true,
1121
+ tooltipField: res.field,
1122
+ cellRenderer: DropdownRenderer,
1123
+ cellRendererParams: {
1124
+ onClick: this.onBtnClick.bind(this),
1125
+ tooltip: res.tooltip,
1126
+ dropDownData: res.dropDownData,
1127
+ },
1128
+ onCellClicked: (e) => {
1129
+ e.node.setSelected(false);
1130
+ },
1131
+ width: 40,
1132
+ pinned: res.pinPosition,
1133
+ lockPinned: true,
1134
+ };
1135
+ }
1136
+ else {
1137
+ return {
1138
+ field: res.field,
1139
+ headerName: res.title,
1140
+ resizable: true,
1141
+ hide: !res.visible,
1142
+ sortable: true,
1143
+ tooltipField: res.field,
1144
+ floatingFilter: this.floatingFilter,
1145
+ valueFormatter: (params) => this.formatterService.colValueFormatter(params, res.columnType),
1146
+ filterable: res.filterable,
1147
+ filter: res.columnType == 'string'
1148
+ ? 'agTextColumnFilter'
1149
+ : res.columnType == 'number'
1150
+ ? 'agNumberColumnFilter'
1151
+ : 'agDateColumnFilter',
1152
+ filterParams: {
1153
+ comparator: (filterLocalDateAtMidnight, cellValue) => {
1154
+ const dateAsString = cellValue;
1155
+ if (dateAsString == null) {
1156
+ return 0;
1157
+ }
1158
+ if (res.columnType == 'date') {
1159
+ const cellDate = new Date(dateAsString);
1160
+ if (cellDate < filterLocalDateAtMidnight) {
1161
+ return -1;
1162
+ }
1163
+ else if (cellDate > filterLocalDateAtMidnight) {
1164
+ return 1;
1165
+ }
1166
+ }
1167
+ return 0;
1168
+ },
1169
+ buttons: ['reset']
1170
+ },
1171
+ };
1172
+ }
1173
+ }
1174
+ else {
1175
+ return {
1176
+ field: res.field,
1177
+ headerName: res.title,
1178
+ resizable: true,
1179
+ sortable: false,
1180
+ hide: !res.visible,
1181
+ suppressFilter: true,
1182
+ suppressSorting: true,
1183
+ suppressMenu: true,
1184
+ tooltipField: res.field,
1185
+ cellRenderer: ButtonRendererComponent,
1186
+ cellRendererParams: {
1187
+ onClick: this.onBtnClick.bind(this),
1188
+ label: res.label,
1189
+ icon: res.icon,
1190
+ buttonName: res.buttonName,
1191
+ tooltip: res.tooltip,
1192
+ },
1193
+ valueGetter: (params) => {
1194
+ return res.tooltip || res.title;
1195
+ },
1196
+ minWidth: 20,
1197
+ cellClass: 'action-button',
1198
+ pinned: res.pinPosition,
1199
+ lockPinned: true,
1200
+ width: res.label ? 100 : 40,
1201
+ };
1202
+ }
1203
+ });
1204
+ this.exportColumnsList = response.list;
1205
+ this.columnDefs = coldef;
1206
+ (_b = (_a = this.agGrid.gridOptions) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.setColumnDefs(coldef);
1207
+ this.getGridState();
1208
+ }
1209
+ else {
1210
+ console.log('ColDef Read Error=>', response.message);
1211
+ }
1212
+ });
1213
+ }
1214
+ else {
1215
+ console.log('Please pass valid GridId and loggedIn user Id');
1216
+ }
1217
+ }
1218
+ setExternalFilters(options) {
1219
+ var serverUrl = '';
1220
+ if (this.serverDataUrl.indexOf('filter') >= 0 &&
1221
+ options.indexOf('filter') >= 0) {
1222
+ let slug = this.serverDataUrl.split('?$filter=');
1223
+ if (slug && slug.length > 0) {
1224
+ options = options + ' and ' + slug[1];
1225
+ serverUrl = slug[0];
1226
+ }
1227
+ }
1228
+ else if (this.serverDataUrl.indexOf('?') >= 0) {
1229
+ serverUrl = this.serverDataUrl;
1230
+ options = options.replace('?', '&');
1231
+ }
1232
+ return `${serverUrl}${options}`;
1233
+ }
1234
+ onGridReady(params) {
1235
+ this.gridPageSize = this.pageSize;
1236
+ if (this.enableServerSidePaging == true) {
1237
+ params.api.setServerSideDatasource(new OdataServerSideProvider({
1238
+ isCaseSensitiveStringFilter: false,
1239
+ callApi: (options) => fetch(`${this.setExternalFilters(options)}`, {
1240
+ headers: {
1241
+ 'Content-type': 'application/json',
1242
+ Accept: 'application/json',
1243
+ },
1244
+ }).then((response) => response.json()),
1245
+ afterLoadData: (options, rowData, totalCount) => {
1246
+ if (!rowData || rowData.length <= 0) {
1247
+ this.agGrid.api.showNoRowsOverlay();
1248
+ }
1249
+ else {
1250
+ this.agGrid.api.hideOverlay();
1251
+ }
1252
+ },
1253
+ }));
1254
+ }
1255
+ }
1256
+ setGridState() {
1257
+ if (this.gridColumnState) {
1258
+ this.agGrid.columnApi.applyColumnState({
1259
+ state: this.gridColumnState,
1260
+ applyOrder: true,
1261
+ });
1262
+ }
1263
+ else {
1264
+ var columns = this.agGrid.columnApi.getColumns();
1265
+ if (columns && columns.length > 0) {
1266
+ if (columns.length > 15) {
1267
+ const allColumnIds = [];
1268
+ this.agGrid.columnApi.getColumns().forEach((column) => {
1269
+ allColumnIds.push(column.getId());
1270
+ });
1271
+ this.agGrid.columnApi.autoSizeColumns(allColumnIds, false);
1272
+ }
1273
+ else {
1274
+ this.agGrid.api.sizeColumnsToFit();
1275
+ }
1276
+ }
1277
+ }
1278
+ }
1279
+ getGridState() {
1280
+ if (this.gridId && this.loggedInUser) {
1281
+ this.gridService
1282
+ .getGridState(this.gridId, this.loggedInUser)
1283
+ .pipe(takeUntil(this.unsubscribe$))
1284
+ .subscribe((response) => {
1285
+ if (response.status == 1 &&
1286
+ response.object &&
1287
+ response.object.gridConfig) {
1288
+ this.gridColumnState = JSON.parse(response.object.gridConfig);
1289
+ this.setGridState();
1290
+ }
1291
+ else {
1292
+ console.log('Error while loading grid state');
1293
+ }
1294
+ });
1295
+ }
1296
+ }
1297
+ onBtnClick(e) {
1298
+ console.log('btn click=>', e);
1299
+ this.btnClickHandler.emit(e.rowData);
1300
+ }
1301
+ onSaveGridColumnState(event) {
1302
+ var _a;
1303
+ let columnState = (_a = this.agGrid.columnApi) === null || _a === void 0 ? void 0 : _a.getColumnState();
1304
+ let columnData = {
1305
+ gridConfig: JSON.stringify(columnState),
1306
+ uiGridId: this.gridId,
1307
+ userId: this.loggedInUser,
1308
+ };
1309
+ if (event.finished == true || event.type === 'columnPinned') {
1310
+ this.gridColumnState = columnState;
1311
+ this.gridService.saveColumnConfig(columnData)
1312
+ .pipe(takeUntil(this.unsubscribe$))
1313
+ .subscribe((res) => {
1314
+ this.setGridState();
1315
+ if (res.status == 0) {
1316
+ console.log('Error while saving column configuration:', res.message);
1317
+ }
1318
+ });
1319
+ }
1320
+ }
1321
+ //custom export method
1322
+ exportFile(type) {
1323
+ this.getDataForExcelExport(type);
1324
+ }
1325
+ //Generate only those columns for export which are visible and are not of other types that are not required for export
1326
+ generateColumnsForExcel() {
1327
+ let columnsToBeDisplayedForExcel = [];
1328
+ this.exportColumnsList.forEach((column) => {
1329
+ if (column.visible == true &&
1330
+ column.columnType != 'checkbox' &&
1331
+ column.columnType != 'dropdown' &&
1332
+ column.columnType != '') {
1333
+ columnsToBeDisplayedForExcel.push(column.field);
1334
+ }
1335
+ });
1336
+ return columnsToBeDisplayedForExcel;
1337
+ }
1338
+ //Get data from server without paging so that whole data can be exported to excel
1339
+ // and also check for server side and client side rendering of data for export.
1340
+ getDataForExcelExport(type) {
1341
+ this.agGrid.api.showLoadingOverlay();
1342
+ if (this.enableServerSidePaging) {
1343
+ this.gridService
1344
+ .getDataForExport(this.serverDataUrl)
1345
+ .pipe(takeUntil(this.unsubscribe$))
1346
+ .subscribe((response) => {
1347
+ this.agGrid.api.hideOverlay();
1348
+ if (response && response.value.length > 0) {
1349
+ this.excelAPI.setRowData(response.value);
1350
+ this.excelAPI.sizeColumnsToFit();
1351
+ if (type == 'csv') {
1352
+ this.excelAPI.exportDataAsCsv({
1353
+ columnKeys: this.generateColumnsForExcel(),
1354
+ });
1355
+ }
1356
+ else {
1357
+ this.excelAPI.exportDataAsExcel({
1358
+ columnKeys: this.generateColumnsForExcel(),
1359
+ });
1360
+ }
1361
+ }
1362
+ else {
1363
+ console.log('Error while fetching data for excel/csv export');
1364
+ }
1365
+ });
1366
+ }
1367
+ else {
1368
+ this.agGrid.api.hideOverlay();
1369
+ if (type == 'csv') {
1370
+ this.agGrid.api.exportDataAsCsv({
1371
+ columnKeys: this.generateColumnsForExcel(),
1372
+ });
1373
+ }
1374
+ else {
1375
+ this.agGrid.api.exportDataAsExcel({
1376
+ columnKeys: this.generateColumnsForExcel(),
1377
+ });
1378
+ }
1379
+ }
1380
+ }
1381
+ onSelectionChanged(e) {
1382
+ this.selectionChanged.emit(e);
1383
+ }
1384
+ onFilterChanged(e) {
1385
+ this.filterChanged.emit(e);
1386
+ }
1387
+ onFirstDataRendered(e) {
1388
+ this.firstDataRendered.emit(e);
1389
+ }
1390
+ onGridReadyExcel(params) {
1391
+ this.excelAPI = params.api;
1392
+ }
1393
+ //destroy all associated subscriptions on component destroy
1394
+ ngOnDestroy() {
1395
+ this.unsubscribe$.next();
1396
+ this.unsubscribe$.complete();
1397
+ }
1398
+ }
1399
+ GridLibraryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: GridLibraryComponent, deps: [{ token: GridLibraryService }, { token: ColumnValueFormatter }], target: i0.ɵɵFactoryTarget.Component });
1400
+ GridLibraryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.6", type: GridLibraryComponent, selector: "lib-basesite-shared-grid-lib", inputs: { columnDefs: "columnDefs", rowData: "rowData", pageSize: "pageSize", rowSelection: "rowSelection", gridId: "gridId", loggedInUser: "loggedInUser", enableServerSidePaging: "enableServerSidePaging", serverDataUrl: "serverDataUrl", environment: "environment", cacheBlockSize: "cacheBlockSize", rowMultiSelectWithClick: "rowMultiSelectWithClick", floatingFilter: "floatingFilter", paginationAutoPageSize: "paginationAutoPageSize" }, outputs: { btnClickHandler: "btnClickHandler", firstDataRendered: "firstDataRendered", filterChanged: "filterChanged", selectionChanged: "selectionChanged" }, viewQueries: [{ propertyName: "agGrid", first: true, predicate: ["agGrid"], descendants: true }], ngImport: i0, template: `
1401
+ <ag-grid-angular #agGrid
1402
+ style="width: 100%;height:98.2vh"
1403
+ class="ag-theme-balham shared-grid-lib"
1404
+ [columnDefs]="columnDefs"
1405
+ [defaultColDef]="defaultColDef"
1406
+ [rowData]="rowData"
1407
+ [rowSelection]="rowSelection"
1408
+ [animateRows]="true"
1409
+ (gridReady)="onGridReady($event)"
1410
+ [pagination]="true"
1411
+ [paginationPageSize]="gridPageSize"
1412
+ [paginationNumberFormatter]="paginationNumberFormatter"
1413
+ (modelUpdated)="onModelUpdated()"
1414
+ [tooltipShowDelay]="tooltipShowDelay"
1415
+ [tooltipHideDelay]="tooltipHideDelay"
1416
+ [rowModelType]="rowModelType"
1417
+ [cacheBlockSize]="cacheBlockSize"
1418
+ [maxConcurrentDatasourceRequests]="1"
1419
+ [blockLoadDebounceMillis]="100"
1420
+ [paginationAutoPageSize]="paginationAutoPageSize"
1421
+ (columnVisible)="onSaveGridColumnState($event)"
1422
+ (columnPinned)="onSaveGridColumnState($event)"
1423
+ (columnResized)="onSaveGridColumnState($event)"
1424
+ (columnMoved)="onSaveGridColumnState($event)"
1425
+ (sortChanged)="onSortChangedEvent()"
1426
+ [rowMultiSelectWithClick]="rowMultiSelectWithClick"
1427
+ [getContextMenuItems]="getContextMenuItems"
1428
+ (selectionChanged)="onSelectionChanged($event)"
1429
+ (filterChanged)="onFilterChanged($event)"
1430
+ (firstDataRendered)="onFirstDataRendered($event)"
1431
+ >
1432
+ </ag-grid-angular>
1433
+ <ag-grid-angular
1434
+ #agGridHidden
1435
+ style="height:100vh; width:100%;display:none"
1436
+ class="ag-theme-balham"
1437
+ [rowData]="rowDataHidden"
1438
+ [columnDefs]="columnDefs"
1439
+ [defaultColDef]="defaultColDef"
1440
+ [animateRows]="false"
1441
+ [rowSelection]="'multiple'"
1442
+ (gridReady)="onGridReadyExcel($event)"
1443
+ [suppressScrollOnNewData]="true"
1444
+ [cacheQuickFilter]="false"
1445
+ >
1446
+ </ag-grid-angular>
1447
+ `, isInline: true, dependencies: [{ kind: "component", type: i3.AgGridAngular, selector: "ag-grid-angular", inputs: ["gridOptions", "modules", "statusBar", "sideBar", "suppressContextMenu", "preventDefaultOnContextMenu", "allowContextMenuWithControlKey", "suppressMenuHide", "enableBrowserTooltips", "tooltipShowDelay", "tooltipHideDelay", "tooltipMouseTrack", "popupParent", "copyHeadersToClipboard", "copyGroupHeadersToClipboard", "clipboardDelimiter", "suppressCopyRowsToClipboard", "suppressCopySingleCellRanges", "suppressLastEmptyLineOnPaste", "suppressClipboardPaste", "suppressClipboardApi", "suppressCutToClipboard", "columnDefs", "defaultColDef", "defaultColGroupDef", "columnTypes", "maintainColumnOrder", "suppressFieldDotNotation", "headerHeight", "groupHeaderHeight", "floatingFiltersHeight", "pivotHeaderHeight", "pivotGroupHeaderHeight", "allowDragFromColumnsToolPanel", "suppressMovableColumns", "suppressColumnMoveAnimation", "suppressDragLeaveHidesColumns", "suppressRowGroupHidesColumns", "colResizeDefault", "suppressAutoSize", "autoSizePadding", "skipHeaderOnAutoSize", "components", "frameworkComponents", "editType", "singleClickEdit", "suppressClickEdit", "readOnlyEdit", "stopEditingWhenCellsLoseFocus", "enterMovesDown", "enterMovesDownAfterEdit", "enableCellEditingOnBackspace", "undoRedoCellEditing", "undoRedoCellEditingLimit", "defaultCsvExportParams", "suppressCsvExport", "defaultExcelExportParams", "suppressExcelExport", "excelStyles", "quickFilterText", "cacheQuickFilter", "excludeHiddenColumnsFromQuickFilter", "excludeChildrenWhenTreeDataFiltering", "enableCharts", "chartThemes", "customChartThemes", "chartThemeOverrides", "enableChartToolPanelsButton", "suppressChartToolPanelsButton", "chartToolPanelsDef", "loadingCellRenderer", "loadingCellRendererFramework", "loadingCellRendererParams", "loadingCellRendererSelector", "localeText", "masterDetail", "keepDetailRows", "keepDetailRowsCount", "detailCellRenderer", "detailCellRendererFramework", "detailCellRendererParams", "detailRowHeight", "detailRowAutoHeight", "context", "alignedGrids", "tabIndex", "rowBuffer", "valueCache", "valueCacheNeverExpires", "enableCellExpressions", "suppressParentsInRowNodes", "suppressTouch", "suppressFocusAfterRefresh", "suppressAsyncEvents", "suppressBrowserResizeObserver", "suppressPropertyNamesCheck", "suppressChangeDetection", "debug", "overlayLoadingTemplate", "loadingOverlayComponent", "loadingOverlayComponentFramework", "loadingOverlayComponentParams", "suppressLoadingOverlay", "overlayNoRowsTemplate", "noRowsOverlayComponent", "noRowsOverlayComponentFramework", "noRowsOverlayComponentParams", "suppressNoRowsOverlay", "pagination", "paginationPageSize", "paginationAutoPageSize", "paginateChildRows", "suppressPaginationPanel", "pivotMode", "pivotPanelShow", "pivotColumnGroupTotals", "pivotRowTotals", "pivotSuppressAutoColumn", "suppressExpandablePivotGroups", "functionsReadOnly", "aggFuncs", "suppressAggFuncInHeader", "suppressAggAtRootLevel", "aggregateOnlyChangedColumns", "suppressAggFilteredOnly", "removePivotHeaderRowWhenSingleValueColumn", "animateRows", "enableCellChangeFlash", "cellFlashDelay", "cellFadeDelay", "allowShowChangeAfterFilter", "domLayout", "ensureDomOrder", "enableRtl", "suppressColumnVirtualisation", "suppressMaxRenderedRowRestriction", "suppressRowVirtualisation", "rowDragManaged", "suppressRowDrag", "suppressMoveWhenRowDragging", "rowDragEntireRow", "rowDragMultiRow", "rowDragText", "fullWidthCellRenderer", "fullWidthCellRendererFramework", "fullWidthCellRendererParams", "embedFullWidthRows", "groupDisplayType", "groupDefaultExpanded", "autoGroupColumnDef", "groupMaintainOrder", "groupSelectsChildren", "groupAggFiltering", "groupIncludeFooter", "groupIncludeTotalFooter", "groupSuppressBlankHeader", "groupSelectsFiltered", "showOpenedGroup", "groupRemoveSingleChildren", "groupRemoveLowestSingleChildren", "groupHideOpenParents", "groupAllowUnbalanced", "rowGroupPanelShow", "groupRowRenderer", "groupRowRendererFramework", "groupRowRendererParams", "suppressMakeColumnVisibleAfterUnGroup", "treeData", "rowGroupPanelSuppressSort", "groupRowsSticky", "rememberGroupStateWhenNewData", "pinnedTopRowData", "pinnedBottomRowData", "rowModelType", "rowData", "immutableData", "asyncTransactionWaitMillis", "suppressModelUpdateAfterUpdateTransaction", "datasource", "cacheOverflowSize", "infiniteInitialRowCount", "serverSideInitialRowCount", "serverSideStoreType", "suppressServerSideInfiniteScroll", "cacheBlockSize", "maxBlocksInCache", "maxConcurrentDatasourceRequests", "blockLoadDebounceMillis", "purgeClosedRowNodes", "serverSideDatasource", "serverSideSortAllLevels", "serverSideFilterAllLevels", "serverSideSortOnServer", "serverSideFilterOnServer", "serverSideSortingAlwaysResets", "serverSideFilteringAlwaysResets", "viewportDatasource", "viewportRowModelPageSize", "viewportRowModelBufferSize", "alwaysShowHorizontalScroll", "alwaysShowVerticalScroll", "debounceVerticalScrollbar", "suppressHorizontalScroll", "suppressScrollOnNewData", "suppressScrollWhenPopupsAreOpen", "suppressAnimationFrame", "suppressMiddleClickScrolls", "suppressPreventDefaultOnMouseWheel", "scrollbarWidth", "rowSelection", "rowMultiSelectWithClick", "suppressRowDeselection", "suppressRowClickSelection", "suppressCellSelection", "suppressCellFocus", "suppressMultiRangeSelection", "enableCellTextSelection", "enableRangeSelection", "enableRangeHandle", "enableFillHandle", "fillHandleDirection", "suppressClearOnFillReduction", "sortingOrder", "accentedSort", "unSortIcon", "suppressMultiSort", "alwaysMultiSort", "multiSortKey", "suppressMaintainUnsortedOrder", "icons", "rowHeight", "rowStyle", "rowClass", "rowClassRules", "suppressRowHoverHighlight", "suppressRowTransform", "columnHoverHighlight", "deltaSort", "treeDataDisplayType", "functionsPassive", "enableGroupEdit", "getContextMenuItems", "getMainMenuItems", "postProcessPopup", "processCellForClipboard", "processHeaderForClipboard", "processGroupHeaderForClipboard", "processCellFromClipboard", "sendToClipboard", "processDataFromClipboard", "isExternalFilterPresent", "doesExternalFilterPass", "getChartToolbarItems", "createChartContainer", "navigateToNextHeader", "tabToNextHeader", "navigateToNextCell", "tabToNextCell", "localeTextFunc", "getLocaleText", "getDocument", "paginationNumberFormatter", "groupRowAggNodes", "getGroupRowAgg", "isGroupOpenByDefault", "initialGroupOrderComparator", "defaultGroupOrderComparator", "processSecondaryColDef", "processSecondaryColGroupDef", "processPivotResultColDef", "processPivotResultColGroupDef", "getDataPath", "getChildCount", "getServerSideGroupLevelParams", "getServerSideStoreParams", "isServerSideGroupOpenByDefault", "isApplyServerSideTransaction", "isServerSideGroup", "getServerSideGroupKey", "getBusinessKeyForNode", "getRowNodeId", "getRowId", "resetRowDataOnUpdate", "processRowPostCreate", "isRowSelectable", "isRowMaster", "fillOperation", "postSort", "postSortRows", "getRowStyle", "getRowClass", "getRowHeight", "isFullWidthCell", "isFullWidthRow"], outputs: ["toolPanelVisibleChanged", "toolPanelSizeChanged", "pasteStart", "pasteEnd", "columnVisible", "columnPinned", "columnResized", "columnMoved", "columnValueChanged", "columnPivotModeChanged", "columnPivotChanged", "columnGroupOpened", "newColumnsLoaded", "gridColumnsChanged", "displayedColumnsChanged", "virtualColumnsChanged", "columnEverythingChanged", "componentStateChanged", "cellValueChanged", "cellEditRequest", "rowValueChanged", "cellEditingStarted", "cellEditingStopped", "rowEditingStarted", "rowEditingStopped", "undoStarted", "undoEnded", "redoStarted", "redoEnded", "filterOpened", "filterChanged", "filterModified", "chartCreated", "chartRangeSelectionChanged", "chartOptionsChanged", "chartDestroyed", "cellKeyDown", "cellKeyPress", "gridReady", "firstDataRendered", "gridSizeChanged", "modelUpdated", "virtualRowRemoved", "viewportChanged", "bodyScroll", "bodyScrollEnd", "dragStarted", "dragStopped", "paginationChanged", "rowDragEnter", "rowDragMove", "rowDragLeave", "rowDragEnd", "columnRowGroupChanged", "rowGroupOpened", "expandOrCollapseAll", "pinnedRowDataChanged", "rowDataChanged", "rowDataUpdated", "asyncTransactionsFlushed", "cellClicked", "cellDoubleClicked", "cellFocused", "cellMouseOver", "cellMouseOut", "cellMouseDown", "rowClicked", "rowDoubleClicked", "rowSelected", "selectionChanged", "cellContextMenu", "rangeSelectionChanged", "sortChanged", "columnRowGroupChangeRequest", "columnPivotChangeRequest", "columnValueChangeRequest", "columnAggFuncChangeRequest"] }] });
1448
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: GridLibraryComponent, decorators: [{
1449
+ type: Component,
1450
+ args: [{ selector: 'lib-basesite-shared-grid-lib', template: `
1451
+ <ag-grid-angular #agGrid
1452
+ style="width: 100%;height:98.2vh"
1453
+ class="ag-theme-balham shared-grid-lib"
1454
+ [columnDefs]="columnDefs"
1455
+ [defaultColDef]="defaultColDef"
1456
+ [rowData]="rowData"
1457
+ [rowSelection]="rowSelection"
1458
+ [animateRows]="true"
1459
+ (gridReady)="onGridReady($event)"
1460
+ [pagination]="true"
1461
+ [paginationPageSize]="gridPageSize"
1462
+ [paginationNumberFormatter]="paginationNumberFormatter"
1463
+ (modelUpdated)="onModelUpdated()"
1464
+ [tooltipShowDelay]="tooltipShowDelay"
1465
+ [tooltipHideDelay]="tooltipHideDelay"
1466
+ [rowModelType]="rowModelType"
1467
+ [cacheBlockSize]="cacheBlockSize"
1468
+ [maxConcurrentDatasourceRequests]="1"
1469
+ [blockLoadDebounceMillis]="100"
1470
+ [paginationAutoPageSize]="paginationAutoPageSize"
1471
+ (columnVisible)="onSaveGridColumnState($event)"
1472
+ (columnPinned)="onSaveGridColumnState($event)"
1473
+ (columnResized)="onSaveGridColumnState($event)"
1474
+ (columnMoved)="onSaveGridColumnState($event)"
1475
+ (sortChanged)="onSortChangedEvent()"
1476
+ [rowMultiSelectWithClick]="rowMultiSelectWithClick"
1477
+ [getContextMenuItems]="getContextMenuItems"
1478
+ (selectionChanged)="onSelectionChanged($event)"
1479
+ (filterChanged)="onFilterChanged($event)"
1480
+ (firstDataRendered)="onFirstDataRendered($event)"
1481
+ >
1482
+ </ag-grid-angular>
1483
+ <ag-grid-angular
1484
+ #agGridHidden
1485
+ style="height:100vh; width:100%;display:none"
1486
+ class="ag-theme-balham"
1487
+ [rowData]="rowDataHidden"
1488
+ [columnDefs]="columnDefs"
1489
+ [defaultColDef]="defaultColDef"
1490
+ [animateRows]="false"
1491
+ [rowSelection]="'multiple'"
1492
+ (gridReady)="onGridReadyExcel($event)"
1493
+ [suppressScrollOnNewData]="true"
1494
+ [cacheQuickFilter]="false"
1495
+ >
1496
+ </ag-grid-angular>
1497
+ ` }]
1498
+ }], ctorParameters: function () { return [{ type: GridLibraryService }, { type: ColumnValueFormatter }]; }, propDecorators: { columnDefs: [{
1499
+ type: Input
1500
+ }], rowData: [{
1501
+ type: Input
1502
+ }], pageSize: [{
1503
+ type: Input
1504
+ }], rowSelection: [{
1505
+ type: Input
1506
+ }], gridId: [{
1507
+ type: Input
1508
+ }], loggedInUser: [{
1509
+ type: Input
1510
+ }], enableServerSidePaging: [{
1511
+ type: Input
1512
+ }], serverDataUrl: [{
1513
+ type: Input
1514
+ }], environment: [{
1515
+ type: Input
1516
+ }], cacheBlockSize: [{
1517
+ type: Input
1518
+ }], rowMultiSelectWithClick: [{
1519
+ type: Input
1520
+ }], floatingFilter: [{
1521
+ type: Input
1522
+ }], paginationAutoPageSize: [{
1523
+ type: Input
1524
+ }], btnClickHandler: [{
1525
+ type: Output
1526
+ }], firstDataRendered: [{
1527
+ type: Output
1528
+ }], filterChanged: [{
1529
+ type: Output
1530
+ }], selectionChanged: [{
1531
+ type: Output
1532
+ }], agGrid: [{
1533
+ type: ViewChild,
1534
+ args: ['agGrid']
1535
+ }] } });
1536
+
1537
+ LicenseManager.setLicenseKey("CompanyName=Basesite,LicensedGroup=Basesite,LicenseType=MultipleApplications,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=2,AssetReference=AG-028469,ExpiryDate=19_May_2023_[v2]_MTY4NDQ1MDgwMDAwMA==ed6f437ea331cf602f669128db7b5387");
1538
+ class GridLibraryModule {
1539
+ }
1540
+ GridLibraryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: GridLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1541
+ GridLibraryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.6", ngImport: i0, type: GridLibraryModule, declarations: [GridLibraryComponent,
1542
+ ButtonRendererComponent,
1543
+ CustomTooltip,
1544
+ DropdownRenderer], imports: [AgGridModule,
1545
+ HttpClientModule,
1546
+ CommonModule], exports: [GridLibraryComponent] });
1547
+ GridLibraryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: GridLibraryModule, providers: [DatePipe, GridLibraryService, ColumnValueFormatter], imports: [AgGridModule,
1548
+ HttpClientModule,
1549
+ CommonModule] });
1550
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: GridLibraryModule, decorators: [{
1551
+ type: NgModule,
1552
+ args: [{
1553
+ declarations: [
1554
+ GridLibraryComponent,
1555
+ ButtonRendererComponent,
1556
+ CustomTooltip,
1557
+ DropdownRenderer
1558
+ ],
1559
+ imports: [
1560
+ AgGridModule,
1561
+ HttpClientModule,
1562
+ CommonModule,
1563
+ ],
1564
+ exports: [
1565
+ GridLibraryComponent
1566
+ ],
1567
+ providers: [DatePipe, GridLibraryService, ColumnValueFormatter]
1568
+ }]
1569
+ }] });
1570
+
1571
+ /*
1572
+ * Public API Surface of basesite-shared-grid-lib
1573
+ */
1574
+
1575
+ /**
1576
+ * Generated bundle index. Do not edit.
1577
+ */
1578
+
1579
+ export { GridLibraryComponent, GridLibraryModule, GridLibraryService };
1580
+ //# sourceMappingURL=basesite-shared-grid-lib.mjs.map