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