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