@genesislcap/grid-pro 14.70.4-es2021.1 → 14.70.4-test.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/dist/custom-elements.json +4 -1405
- package/dist/esm/cell-renderers/action.renderer.js +12 -8
- package/dist/esm/cell-renderers/actions-menu.renderer.js +1 -1
- package/dist/esm/cell-renderers/boolean.renderer.js +3 -3
- package/dist/esm/cell-renderers/select.renderer.js +2 -1
- package/dist/esm/cell-renderers/text-field.renderer.js +2 -1
- package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource-next.js +105 -103
- package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource.js +85 -76
- package/dist/esm/grid-pro.definitions.js +1 -1
- package/dist/esm/grid-pro.js +28 -48
- package/dist/esm/utils/array.js +2 -2
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { Auth, Connect, dataServerResultFilter, Datasource, DatasourceDefaults, FieldTypeEnum, MessageType, normaliseCriteria, ResourceType, } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { LifecycleMixin } from '@genesislcap/foundation-utils';
|
|
4
4
|
import { attr, customElement, DOM, observable } from '@microsoft/fast-element';
|
|
@@ -64,7 +64,8 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
64
64
|
this.init();
|
|
65
65
|
});
|
|
66
66
|
this.connectionSub = this.connect.isConnected$.subscribe((isConnected) => {
|
|
67
|
-
|
|
67
|
+
var _a;
|
|
68
|
+
if (isConnected && ((_a = this.agGrid) === null || _a === void 0 ? void 0 : _a.attributes['ds-disconnected'])) {
|
|
68
69
|
this.agGrid.removeAttribute('ds-disconnected');
|
|
69
70
|
if (this.restartOnReconnection) {
|
|
70
71
|
this.reloadResourceData();
|
|
@@ -111,29 +112,28 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
111
112
|
* @public
|
|
112
113
|
* @remarks This method is called automatically when the element is connected to the DOM.
|
|
113
114
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
getRowId: (params) => params.data[this.rowId],
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
logger.warn(`Application not connected, falling back to local columnDefs/rowData`);
|
|
115
|
+
init() {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
if (this.agGrid &&
|
|
118
|
+
this.datasource.validResourceName(this.resourceName) &&
|
|
119
|
+
this.connect.isConnected) {
|
|
120
|
+
const meta = yield this.connect.getMetadata(this.resourceName);
|
|
121
|
+
this.isRequestServer = meta.TYPE === ResourceType.REQUEST_SERVER;
|
|
122
|
+
const gridOptions = Object.assign({ getRowId: (params) => params.data[this.rowId] }, this.deferredGridOptions);
|
|
123
|
+
this.agGrid.gridOptions = Object.assign({}, gridOptions);
|
|
124
|
+
this.agGrid.addEventListener('onGridReady', () => __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
yield this.loadResourceData();
|
|
126
|
+
}), { once: true });
|
|
127
|
+
const filterDebounceTime = 600;
|
|
128
|
+
this.updateSub = this.update
|
|
129
|
+
.pipe(skip(1), debounceTime(filterDebounceTime), tap((f) => logger.debug('filters (debounced): ', f)))
|
|
130
|
+
.subscribe((_) => {
|
|
131
|
+
this.reloadResourceData();
|
|
132
|
+
});
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
logger.warn(`Application not connected, falling back to local columnDefs/rowData`);
|
|
136
|
+
});
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Deinitialises the datasource, resetting it to its initial state.
|
|
@@ -202,12 +202,13 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
202
202
|
* @internal
|
|
203
203
|
*/
|
|
204
204
|
clearRowData(withColumnDefs = true) {
|
|
205
|
+
var _a, _b, _c, _d;
|
|
205
206
|
this.rows = new Map();
|
|
206
207
|
this.agTransaction = undefined;
|
|
207
208
|
if (withColumnDefs) {
|
|
208
|
-
this.agGrid
|
|
209
|
+
(_b = (_a = this.agGrid) === null || _a === void 0 ? void 0 : _a.gridApi) === null || _b === void 0 ? void 0 : _b.setColumnDefs([]);
|
|
209
210
|
}
|
|
210
|
-
this.agGrid
|
|
211
|
+
(_d = (_c = this.agGrid) === null || _c === void 0 ? void 0 : _c.gridApi) === null || _d === void 0 ? void 0 : _d.setRowData([]);
|
|
211
212
|
}
|
|
212
213
|
/**
|
|
213
214
|
* Sets the columnDefs and rowData for the grid.
|
|
@@ -229,14 +230,16 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
229
230
|
* @remarks This is used when the grid is already initialized and we want to reload the data due to a criteria/filter change.
|
|
230
231
|
* @internal
|
|
231
232
|
*/
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
this.dataSub
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
233
|
+
reloadResourceData() {
|
|
234
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
+
if (this.dataSub) {
|
|
236
|
+
this.dataSub.unsubscribe();
|
|
237
|
+
this.dataSub = undefined;
|
|
238
|
+
}
|
|
239
|
+
this.dataLogoff();
|
|
240
|
+
this.clearRowData(withoutColumnDefs);
|
|
241
|
+
this.loadResourceData(withoutFullInit);
|
|
242
|
+
});
|
|
240
243
|
}
|
|
241
244
|
/**
|
|
242
245
|
* Initializes the datasource and loads the data for the grid.
|
|
@@ -245,38 +248,40 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
245
248
|
* @param withFullInit - if true, will call datasource.init() with requiresMetadataFetch = true, fetching fresh metadata
|
|
246
249
|
* @internal
|
|
247
250
|
*/
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
if (this.isSnapshot) {
|
|
257
|
-
const result = await this.datasource.snapshot();
|
|
258
|
-
if (result) {
|
|
259
|
-
const rowData = this.handleSnapshot(result);
|
|
260
|
-
this.setRowData(rowData);
|
|
261
|
-
}
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
logger.debug(`requesting stream for ${this.resourceName}`);
|
|
265
|
-
this.dataSub = this.datasource.stream.subscribe((result) => {
|
|
266
|
-
this.sourceRef = result.SOURCE_REF;
|
|
267
|
-
const messageType = result.MESSAGE_TYPE;
|
|
268
|
-
if (messageType && messageType === MessageType.LOGOFF_ACK) {
|
|
269
|
-
this.dataSubWasLoggedOff = true;
|
|
251
|
+
loadResourceData(withFullInit = true) {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
253
|
+
const requiresMetadataFetch = withFullInit || !this.datasource.initialized;
|
|
254
|
+
const initOK = yield this.datasource.init(this.datasourceOptions(), requiresMetadataFetch);
|
|
255
|
+
if (!initOK) {
|
|
256
|
+
logger.debug(`Genesis Datasource init failed for ${this.resourceName}`);
|
|
257
|
+
this.clearRowData();
|
|
270
258
|
return;
|
|
271
259
|
}
|
|
272
|
-
this.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
260
|
+
if (this.isSnapshot) {
|
|
261
|
+
const result = yield this.datasource.snapshot();
|
|
262
|
+
if (result) {
|
|
263
|
+
const rowData = this.handleSnapshot(result);
|
|
264
|
+
this.setRowData(rowData);
|
|
265
|
+
}
|
|
266
|
+
return;
|
|
279
267
|
}
|
|
268
|
+
logger.debug(`requesting stream for ${this.resourceName}`);
|
|
269
|
+
this.dataSub = this.datasource.stream.subscribe((result) => {
|
|
270
|
+
this.sourceRef = result.SOURCE_REF;
|
|
271
|
+
const messageType = result.MESSAGE_TYPE;
|
|
272
|
+
if (messageType && messageType === MessageType.LOGOFF_ACK) {
|
|
273
|
+
this.dataSubWasLoggedOff = true;
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
this.dataSubWasLoggedOff = false;
|
|
277
|
+
if (result.ROW) {
|
|
278
|
+
const nextMessage = dataServerResultFilter(result);
|
|
279
|
+
this.handleStreamResult(nextMessage);
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
this.handleStreamResult(result);
|
|
283
|
+
}
|
|
284
|
+
});
|
|
280
285
|
});
|
|
281
286
|
}
|
|
282
287
|
handleSnapshot(result) {
|
|
@@ -316,14 +321,15 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
316
321
|
}
|
|
317
322
|
}
|
|
318
323
|
applyRequestServerData(requestServerResult) {
|
|
324
|
+
var _a;
|
|
319
325
|
const requestServerData = requestServerResult.REPLY;
|
|
320
326
|
if (!Array.isArray(requestServerData) ||
|
|
321
|
-
!requestServerResult.MESSAGE_TYPE
|
|
327
|
+
!((_a = requestServerResult.MESSAGE_TYPE) === null || _a === void 0 ? void 0 : _a.startsWith('REP_'))) {
|
|
322
328
|
logger.error('received invalid RequestServerResult', requestServerResult);
|
|
323
329
|
return;
|
|
324
330
|
}
|
|
325
331
|
if (this.requiresFullRowDataAndColDefs) {
|
|
326
|
-
requestServerData
|
|
332
|
+
requestServerData === null || requestServerData === void 0 ? void 0 : requestServerData.forEach((insertData) => {
|
|
327
333
|
this.rows.set(insertData[this.rowId], insertData);
|
|
328
334
|
});
|
|
329
335
|
const rowData = this.rows.size > 0 ? Array.from(this.rows.values()) : requestServerData;
|
|
@@ -349,8 +355,9 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
349
355
|
this.agGrid.gridApi.applyTransactionAsync(this.mapTransaction(this.agTransaction, [OperationType.Update]));
|
|
350
356
|
}
|
|
351
357
|
applyDataserverData(dataServerResult) {
|
|
358
|
+
var _a;
|
|
352
359
|
if (this.requiresFullRowDataAndColDefs) {
|
|
353
|
-
dataServerResult.inserts
|
|
360
|
+
(_a = dataServerResult.inserts) === null || _a === void 0 ? void 0 : _a.forEach((insertData) => {
|
|
354
361
|
this.rows.set(insertData[this.rowId], insertData);
|
|
355
362
|
});
|
|
356
363
|
const rowData = Array.from(this.rows.values());
|
|
@@ -388,10 +395,10 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
388
395
|
return mappedTransaction;
|
|
389
396
|
}
|
|
390
397
|
handleStreamInserts(insertedRows) {
|
|
391
|
-
insertedRows
|
|
398
|
+
insertedRows === null || insertedRows === void 0 ? void 0 : insertedRows.forEach((insertData) => {
|
|
392
399
|
if (this.rows.has(insertData[this.rowId]) || this.dataSubWasLoggedOff) {
|
|
393
400
|
const rowToBeUpdated = this.rows.get(insertData[this.rowId]);
|
|
394
|
-
const updatedRow = {
|
|
401
|
+
const updatedRow = Object.assign(Object.assign({}, rowToBeUpdated), insertData);
|
|
395
402
|
this.agTransaction.update.push(updatedRow);
|
|
396
403
|
}
|
|
397
404
|
else {
|
|
@@ -402,22 +409,23 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
402
409
|
});
|
|
403
410
|
}
|
|
404
411
|
handleStreamDeletes(deletedRows) {
|
|
405
|
-
deletedRows
|
|
412
|
+
deletedRows === null || deletedRows === void 0 ? void 0 : deletedRows.forEach((deleteData) => {
|
|
406
413
|
this.agTransaction.remove.push({ [this.rowId]: deleteData[this.rowId] });
|
|
407
414
|
this.rows.delete(deleteData[this.rowId]);
|
|
408
415
|
});
|
|
409
416
|
}
|
|
410
417
|
handleStreamUpdates(updatedRows) {
|
|
411
|
-
updatedRows
|
|
418
|
+
updatedRows === null || updatedRows === void 0 ? void 0 : updatedRows.forEach((updateData) => {
|
|
412
419
|
const rowToBeUpdated = this.rows.get(updateData[this.rowId]);
|
|
413
|
-
const updatedRow = {
|
|
420
|
+
const updatedRow = Object.assign(Object.assign({}, rowToBeUpdated), updateData);
|
|
414
421
|
this.agTransaction.update.push(updatedRow);
|
|
415
422
|
this.rows.set(updateData[this.rowId], updatedRow);
|
|
416
423
|
});
|
|
417
424
|
}
|
|
418
425
|
// FUTURE: Work with the field types vs ag grid column def types!
|
|
419
426
|
getAgColumnDefs(fieldsMetadata) {
|
|
420
|
-
const colDefsFromGenesisData = fieldsMetadata
|
|
427
|
+
const colDefsFromGenesisData = fieldsMetadata === null || fieldsMetadata === void 0 ? void 0 : fieldsMetadata.flatMap((field) => {
|
|
428
|
+
var _a;
|
|
421
429
|
const cellConfigs = {};
|
|
422
430
|
cellConfigs.filterParams = getFilterParamsByFieldType(field.type);
|
|
423
431
|
switch (field.type) {
|
|
@@ -435,20 +443,21 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
435
443
|
default:
|
|
436
444
|
break;
|
|
437
445
|
}
|
|
438
|
-
const templateColDef = this.agGrid.gridApi
|
|
446
|
+
const templateColDef = (_a = this.agGrid.gridApi) === null || _a === void 0 ? void 0 : _a.getColumnDef(field.name);
|
|
439
447
|
if (this.agGrid.onlyTemplateColDefs && !templateColDef) {
|
|
440
448
|
return [];
|
|
441
449
|
}
|
|
442
450
|
if (this.fields && !this.fields.includes(field.name)) {
|
|
443
451
|
return [];
|
|
444
452
|
}
|
|
445
|
-
return { field: field.name,
|
|
453
|
+
return Object.assign(Object.assign({ field: field.name }, cellConfigs), templateColDef);
|
|
446
454
|
});
|
|
447
455
|
const colDefsMergedWithTemplateDefs = this.agGrid.applyTemplateDefinitions(colDefsFromGenesisData, true);
|
|
448
456
|
return colDefsMergedWithTemplateDefs;
|
|
449
457
|
}
|
|
450
458
|
buildCriteria() {
|
|
451
|
-
|
|
459
|
+
var _a;
|
|
460
|
+
const initialCriteria = ((_a = this.criteria) === null || _a === void 0 ? void 0 : _a.split(criteriaDelimiter)) || [];
|
|
452
461
|
const criteria = initialCriteria.concat(Array.from(this.criteriaFromFilters.values()));
|
|
453
462
|
return normaliseCriteria(criteria.join(criteriaJoin), criteriaDelimiter);
|
|
454
463
|
}
|
|
@@ -29,7 +29,7 @@ export function getFilterByFieldType(type) {
|
|
|
29
29
|
* @alpha
|
|
30
30
|
*/
|
|
31
31
|
export function getColumnType(metadataType) {
|
|
32
|
-
switch (metadataType
|
|
32
|
+
switch (metadataType === null || metadataType === void 0 ? void 0 : metadataType.toLowerCase()) {
|
|
33
33
|
case 'int':
|
|
34
34
|
case 'long':
|
|
35
35
|
case 'double':
|
package/dist/esm/grid-pro.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __rest } from "tslib";
|
|
2
2
|
import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
|
|
3
3
|
import { ComponentUtil, Events, Grid, ModuleRegistry, } from '@ag-grid-community/core';
|
|
4
4
|
import { CsvExportModule } from '@ag-grid-community/csv-export';
|
|
@@ -97,12 +97,13 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
disconnectedCallback() {
|
|
100
|
+
var _a;
|
|
100
101
|
this.cacheFilterConfig();
|
|
101
102
|
super.disconnectedCallback();
|
|
102
103
|
this.rehydrationAttempted = false;
|
|
103
104
|
if (!this.shouldRunDisconnect)
|
|
104
105
|
return;
|
|
105
|
-
this.gridApi
|
|
106
|
+
(_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
106
107
|
}
|
|
107
108
|
combineAllGridComponents(gridOptionsComponents) {
|
|
108
109
|
const defaultFoundationAgComponents = {
|
|
@@ -110,11 +111,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
110
111
|
[GridProRendererTypes.actionsMenu]: ActionsMenuRenderer,
|
|
111
112
|
[GridProRendererTypes.boolean]: BooleanRenderer,
|
|
112
113
|
};
|
|
113
|
-
return {
|
|
114
|
-
...defaultFoundationAgComponents,
|
|
115
|
-
...gridOptionsComponents,
|
|
116
|
-
...this.gridComponents, // This allows custom grid comp replacements (or entirely new ones)
|
|
117
|
-
};
|
|
114
|
+
return Object.assign(Object.assign(Object.assign({}, defaultFoundationAgComponents), gridOptionsComponents), this.gridComponents);
|
|
118
115
|
}
|
|
119
116
|
statePersistanceEnabled() {
|
|
120
117
|
if (!this.persistColumnStateKey || this.persistColumnStateKey.length === 0) {
|
|
@@ -135,7 +132,8 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
135
132
|
this.debounced = null;
|
|
136
133
|
}
|
|
137
134
|
this.debounced = setTimeout(() => {
|
|
138
|
-
|
|
135
|
+
var _a;
|
|
136
|
+
(_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.sizeColumnsToFit();
|
|
139
137
|
}, DEBOUNCED_RESIZE_TIME);
|
|
140
138
|
}
|
|
141
139
|
/**
|
|
@@ -143,7 +141,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
143
141
|
* @internal
|
|
144
142
|
*/
|
|
145
143
|
removeConfigWidthsToAutosize(colState) {
|
|
146
|
-
return colState.map((col) => ({
|
|
144
|
+
return colState.map((col) => (Object.assign(Object.assign({}, col), { width: null })));
|
|
147
145
|
}
|
|
148
146
|
saveColumnState() {
|
|
149
147
|
if (this.rehydrationAttempted && this.statePersistanceEnabled()) {
|
|
@@ -175,22 +173,25 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
175
173
|
return [];
|
|
176
174
|
}
|
|
177
175
|
restoreColumnState() {
|
|
176
|
+
var _a;
|
|
178
177
|
this.rehydrationAttempted = true;
|
|
179
178
|
const colState = this.getSavedColumnState();
|
|
180
179
|
if (colState && colState.length > 0) {
|
|
181
|
-
this.columnApi
|
|
180
|
+
(_a = this.columnApi) === null || _a === void 0 ? void 0 : _a.applyColumnState({
|
|
182
181
|
state: colState,
|
|
183
182
|
applyOrder: true,
|
|
184
183
|
});
|
|
185
184
|
}
|
|
186
185
|
}
|
|
187
186
|
cacheFilterConfig() {
|
|
188
|
-
|
|
187
|
+
var _a;
|
|
188
|
+
this.filterConfig = ((_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getFilterModel()) || undefined;
|
|
189
189
|
}
|
|
190
190
|
restoreCachedFilterConfig() {
|
|
191
|
+
var _a, _b;
|
|
191
192
|
if (typeof this.filterConfig !== 'undefined') {
|
|
192
|
-
this.gridApi
|
|
193
|
-
this.gridApi
|
|
193
|
+
(_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.setFilterModel(this.filterConfig);
|
|
194
|
+
(_b = this.gridApi) === null || _b === void 0 ? void 0 : _b.onFilterChanged();
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
/**
|
|
@@ -214,19 +215,15 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
214
215
|
return;
|
|
215
216
|
this.agAttributes[attrName] = attribute.value;
|
|
216
217
|
});
|
|
217
|
-
const { columnDefs, components, onGridReady, onFirstDataRendered,
|
|
218
|
-
const derivedOptions = {
|
|
219
|
-
defaultColDef: {
|
|
218
|
+
const { columnDefs, components, onGridReady, onFirstDataRendered } = options, rest = __rest(options, ["columnDefs", "components", "onGridReady", "onFirstDataRendered"]);
|
|
219
|
+
const derivedOptions = Object.assign(Object.assign(Object.assign({ defaultColDef: {
|
|
220
220
|
filter: true,
|
|
221
221
|
resizable: true,
|
|
222
222
|
sortable: true,
|
|
223
|
-
},
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
onGridReady: (event) => {
|
|
228
|
-
this.gridApi = options.api ?? event.api;
|
|
229
|
-
this.columnApi = options.columnApi ?? event.columnApi;
|
|
223
|
+
}, components: this.combineAllGridComponents(components), suppressDragLeaveHidesColumns: true }, this.eventsAndCallbacks), { onGridReady: (event) => {
|
|
224
|
+
var _a, _b;
|
|
225
|
+
this.gridApi = (_a = options.api) !== null && _a !== void 0 ? _a : event.api;
|
|
226
|
+
this.columnApi = (_b = options.columnApi) !== null && _b !== void 0 ? _b : event.columnApi;
|
|
230
227
|
if (onGridReady) {
|
|
231
228
|
onGridReady(event);
|
|
232
229
|
}
|
|
@@ -236,30 +233,17 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
236
233
|
});
|
|
237
234
|
this.restoreColumnState.bind(this)();
|
|
238
235
|
this.debouncedColumnAutosize.bind(this)();
|
|
239
|
-
},
|
|
240
|
-
onFirstDataRendered: (event) => {
|
|
236
|
+
}, onFirstDataRendered: (event) => {
|
|
241
237
|
this.enableFlashingRows.bind(this);
|
|
242
238
|
this.restoreCachedFilterConfig.bind(this)();
|
|
243
239
|
if (onFirstDataRendered) {
|
|
244
240
|
onFirstDataRendered(event);
|
|
245
241
|
}
|
|
246
|
-
},
|
|
247
|
-
onColumnPinned: gridOnChangeCallback,
|
|
248
|
-
onColumnResized: gridOnChangeCallback,
|
|
249
|
-
onColumnMoved: gridOnChangeCallback,
|
|
250
|
-
onDisplayedColumnsChanged: gridOnChangeCallback,
|
|
251
|
-
onFilterChanged: gridOnChangeCallback,
|
|
252
|
-
onGridSizeChanged: gridOnChangeCallback,
|
|
253
|
-
onSortChanged: gridOnChangeCallback,
|
|
254
|
-
...rest,
|
|
255
|
-
};
|
|
242
|
+
}, onColumnPinned: gridOnChangeCallback, onColumnResized: gridOnChangeCallback, onColumnMoved: gridOnChangeCallback, onDisplayedColumnsChanged: gridOnChangeCallback, onFilterChanged: gridOnChangeCallback, onGridSizeChanged: gridOnChangeCallback, onSortChanged: gridOnChangeCallback }), rest);
|
|
256
243
|
if (!this.gridProGenesisDatasource) {
|
|
257
244
|
derivedOptions.columnDefs = this.applyTemplateDefinitions(columnDefs);
|
|
258
245
|
}
|
|
259
|
-
this.agGridOptions = {
|
|
260
|
-
...this.agGridOptions,
|
|
261
|
-
...ComponentUtil.copyAttributesToGridOptions(derivedOptions, this.agAttributes),
|
|
262
|
-
};
|
|
246
|
+
this.agGridOptions = Object.assign(Object.assign({}, this.agGridOptions), ComponentUtil.copyAttributesToGridOptions(derivedOptions, this.agAttributes));
|
|
263
247
|
const gridParams = {
|
|
264
248
|
globalEventListener: globalEventListener,
|
|
265
249
|
};
|
|
@@ -291,7 +275,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
291
275
|
applyTemplateDefinitions(columnDefs, deferredColumnDefs = false) {
|
|
292
276
|
const columnDefinitions = columnDefs || [];
|
|
293
277
|
const agColumnNodes = this.querySelectorAll(this.columnComponentName);
|
|
294
|
-
const overrides = Array.from(agColumnNodes).map((x) => x.definition
|
|
278
|
+
const overrides = Array.from(agColumnNodes).map((x) => { var _a; return (_a = x.definition) === null || _a === void 0 ? void 0 : _a.field; });
|
|
295
279
|
let colDefsToReturn = [];
|
|
296
280
|
if (agColumnNodes.length === 0) {
|
|
297
281
|
colDefsToReturn = columnDefinitions;
|
|
@@ -300,6 +284,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
300
284
|
colDefsToReturn = [
|
|
301
285
|
...columnDefinitions.filter((g) => !overrides.includes(g.field)),
|
|
302
286
|
...Array.from(agColumnNodes).map((x) => {
|
|
287
|
+
var _a;
|
|
303
288
|
if (this.enableCellFlashing && x.definition.enableCellChangeFlash === undefined) {
|
|
304
289
|
x.definition.enableCellChangeFlash = true;
|
|
305
290
|
}
|
|
@@ -308,7 +293,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
308
293
|
if (!this.autoCellRendererByType || x.definition.valueFormatter) {
|
|
309
294
|
return x.definition;
|
|
310
295
|
}
|
|
311
|
-
const typeValueFormatter = columnDefinitions.find((colDef) => x.definition.field === colDef.field)
|
|
296
|
+
const typeValueFormatter = (_a = columnDefinitions.find((colDef) => x.definition.field === colDef.field)) === null || _a === void 0 ? void 0 : _a.valueFormatter;
|
|
312
297
|
if (typeValueFormatter) {
|
|
313
298
|
x.definition.valueFormatter = typeValueFormatter;
|
|
314
299
|
}
|
|
@@ -455,10 +440,5 @@ export const defaultGridProConfig = {
|
|
|
455
440
|
* @remarks
|
|
456
441
|
* HTML Element: \<foundation-grid-pro\>
|
|
457
442
|
*/
|
|
458
|
-
export const foundationGridPro = GridPro.compose({
|
|
459
|
-
|
|
460
|
-
styles,
|
|
461
|
-
template,
|
|
462
|
-
shadowOptions: foundationGridProShadowOptions,
|
|
463
|
-
...defaultGridProConfig,
|
|
464
|
-
});
|
|
443
|
+
export const foundationGridPro = GridPro.compose(Object.assign({ baseName: 'grid-pro', styles,
|
|
444
|
+
template, shadowOptions: foundationGridProShadowOptions }, defaultGridProConfig));
|
package/dist/esm/utils/array.js
CHANGED
|
@@ -13,14 +13,14 @@ export function mergeAndDedupColDefWithColumnState(colDefs, columnStates) {
|
|
|
13
13
|
const matchingColDef = colDefs.find((item) => item[fieldProp] === state[colIdProp] ||
|
|
14
14
|
(item[colIdProp] && item[colIdProp] === state[colIdProp]));
|
|
15
15
|
if (matchingColDef) {
|
|
16
|
-
const colDefStateMerge = {
|
|
16
|
+
const colDefStateMerge = Object.assign(Object.assign({}, matchingColDef), state);
|
|
17
17
|
merged[matchingColDef[fieldProp]] = colDefStateMerge;
|
|
18
18
|
deduplicated.push(colDefStateMerge);
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
colDefs.forEach((def) => {
|
|
22
22
|
if (!merged.hasOwnProperty(def[fieldProp])) {
|
|
23
|
-
const newObj = {
|
|
23
|
+
const newObj = Object.assign({}, def);
|
|
24
24
|
merged[def[fieldProp]] = newObj;
|
|
25
25
|
deduplicated.push(newObj);
|
|
26
26
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/grid-pro",
|
|
3
3
|
"description": "Genesis Foundation AG Grid",
|
|
4
|
-
"version": "14.70.4-
|
|
4
|
+
"version": "14.70.4-test.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"test:debug": "genx test --debug"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@genesislcap/foundation-testing": "14.70.4-
|
|
32
|
-
"@genesislcap/genx": "14.70.4-
|
|
31
|
+
"@genesislcap/foundation-testing": "14.70.4-test.1",
|
|
32
|
+
"@genesislcap/genx": "14.70.4-test.1",
|
|
33
33
|
"rimraf": "^3.0.2"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@genesislcap/foundation-comms": "14.70.4-
|
|
37
|
-
"@genesislcap/foundation-ui": "14.70.4-
|
|
38
|
-
"@genesislcap/foundation-utils": "14.70.4-
|
|
36
|
+
"@genesislcap/foundation-comms": "14.70.4-test.1",
|
|
37
|
+
"@genesislcap/foundation-ui": "14.70.4-test.1",
|
|
38
|
+
"@genesislcap/foundation-utils": "14.70.4-test.1",
|
|
39
39
|
"@microsoft/fast-colors": "^5.1.4",
|
|
40
40
|
"@microsoft/fast-components": "^2.21.3",
|
|
41
41
|
"@microsoft/fast-element": "^1.7.0",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"customElements": "dist/custom-elements.json",
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "2414c66a7a84c61343d756e240cb4140d82f1311"
|
|
62
62
|
}
|