basesite-shared-grid-lib 0.0.1

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