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