@genesislcap/grid-pro 14.200.1-alpha-e974201.0 → 14.202.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +117 -111
  2. package/dist/custom-elements.json +2750 -840
  3. package/dist/dts/cell-renderers/boolean.renderer.d.ts.map +1 -1
  4. package/dist/dts/datasource/base.datasource.d.ts +22 -6
  5. package/dist/dts/datasource/base.datasource.d.ts.map +1 -1
  6. package/dist/dts/datasource/base.types.d.ts +22 -0
  7. package/dist/dts/datasource/base.types.d.ts.map +1 -0
  8. package/dist/dts/datasource/server-side.datasource.d.ts +27 -83
  9. package/dist/dts/datasource/server-side.datasource.d.ts.map +1 -1
  10. package/dist/dts/datasource/server-side.grid-definitions.d.ts.map +1 -1
  11. package/dist/dts/datasource/server-side.resource-base.d.ts +55 -0
  12. package/dist/dts/datasource/server-side.resource-base.d.ts.map +1 -0
  13. package/dist/dts/datasource/server-side.resource-dataserver.d.ts +20 -0
  14. package/dist/dts/datasource/server-side.resource-dataserver.d.ts.map +1 -0
  15. package/dist/dts/datasource/server-side.resource-reqrep.d.ts +17 -0
  16. package/dist/dts/datasource/server-side.resource-reqrep.d.ts.map +1 -0
  17. package/dist/dts/external/index.d.ts +0 -1
  18. package/dist/dts/external/index.d.ts.map +1 -1
  19. package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts +13 -13
  20. package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts.map +1 -1
  21. package/dist/dts/grid-pro.d.ts +33 -33
  22. package/dist/dts/grid-pro.d.ts.map +1 -1
  23. package/dist/dts/grid-pro.template.d.ts.map +1 -1
  24. package/dist/esm/cell-renderers/boolean.renderer.js +7 -6
  25. package/dist/esm/datasource/base.datasource.js +79 -10
  26. package/dist/esm/datasource/base.types.js +1 -0
  27. package/dist/esm/datasource/client-side.grid-definitions.js +1 -1
  28. package/dist/esm/datasource/server-side.datasource.js +224 -400
  29. package/dist/esm/datasource/server-side.grid-definitions.js +42 -7
  30. package/dist/esm/datasource/server-side.resource-base.js +285 -0
  31. package/dist/esm/datasource/server-side.resource-dataserver.js +132 -0
  32. package/dist/esm/datasource/server-side.resource-reqrep.js +131 -0
  33. package/dist/esm/external/index.js +0 -5
  34. package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource.js +65 -69
  35. package/dist/esm/grid-pro.js +30 -44
  36. package/dist/esm/grid-pro.template.js +2 -1
  37. package/dist/grid-pro.api.json +90 -149
  38. package/dist/grid-pro.d.ts +94 -142
  39. package/docs/api/grid-pro.gridpro.addeventlistener.md +2 -2
  40. package/docs/api/grid-pro.gridpro.aggrid.md +11 -0
  41. package/docs/api/grid-pro.gridpro.applytemplatedefinitions.md +2 -2
  42. package/docs/api/grid-pro.gridpro.columnapi.md +11 -0
  43. package/docs/api/grid-pro.gridpro.gridapi.md +1 -1
  44. package/docs/api/grid-pro.gridpro.md +5 -3
  45. package/docs/api/grid-pro.gridpro.mergeallcolumndefsandstates.md +2 -2
  46. package/docs/api/grid-pro.gridpro.themechanged.md +2 -2
  47. package/docs/api/grid-pro.gridprogenesisdatasource.deinit.md +5 -0
  48. package/docs/api/{grid-pro.gridprogenesisdatasource.auth.md → grid-pro.gridprogenesisdatasource.destroy.md} +9 -3
  49. package/docs/api/grid-pro.gridprogenesisdatasource.handleerrors.md +2 -2
  50. package/docs/api/grid-pro.gridprogenesisdatasource.md +2 -6
  51. package/docs/api/grid-pro.gridprogenesisdatasource.reset.md +1 -1
  52. package/docs/api-report.md +30 -73
  53. package/package.json +16 -16
  54. package/docs/api/grid-pro.gridprogenesisdatasource.datasource.md +0 -11
  55. package/docs/api/grid-pro.gridprogenesisdatasource.disablepolling.md +0 -11
  56. package/docs/api/grid-pro.gridprogenesisdatasource.pollinginterval.md +0 -11
  57. package/docs/api/grid-pro.gridprogenesisdatasource.request.md +0 -11
@@ -1,15 +1,14 @@
1
1
  import { __awaiter, __decorate } from "tslib";
2
- import { Auth, Datasource, DatasourceDefaults, MessageType, dataServerResultFilter, normaliseCriteria, } from '@genesislcap/foundation-comms';
2
+ import { Events, } from '@ag-grid-community/core';
3
+ import { MessageType, dataServerResultFilter, normaliseCriteria, } from '@genesislcap/foundation-comms';
3
4
  import { LifecycleMixin } from '@genesislcap/foundation-utils';
4
- import { DOM, attr, customElement, observable } from '@microsoft/fast-element';
5
+ import { DOM, attr, customElement } from '@microsoft/fast-element';
5
6
  import { BehaviorSubject, EMPTY } from 'rxjs';
6
7
  import { catchError, debounceTime, skip, tap } from 'rxjs/operators';
7
- import { GridProBaseDatasource } from '../datasource/base.datasource';
8
+ import { criteriaDelimiter, GridProBaseDatasource } from '../datasource/base.datasource';
8
9
  import { getClientSideFilterParamsByFieldType } from '../datasource/client-side.grid-definitions';
9
10
  import { logger } from '../utils/logger';
10
11
  import { gridProGenesisDatasourceEventNames } from './grid-pro-genesis-datasource.config';
11
- const criteriaDelimiter = ';';
12
- const criteriaJoin = ' && ';
13
12
  const withoutFullInit = null;
14
13
  const withoutColumnDefs = null;
15
14
  /**
@@ -22,13 +21,9 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
22
21
  super(...arguments);
23
22
  this.applyFuncName = 'applyTransaction';
24
23
  this.applyAsyncFuncName = 'applyTransactionAsync';
25
- this.pollingInterval = DatasourceDefaults.REQ_REP_POLLING_INTERVAL_MS;
26
- this.disablePolling = false;
27
24
  this.restartOnReconnection = false;
28
25
  this.keepColDefsOnClearRowData = false;
29
26
  this.requiresFullRowDataAndColDefs = true;
30
- this.criteriaFromFilters = new Map();
31
- this.update = new BehaviorSubject(new Map());
32
27
  }
33
28
  // DatasourceOptions
34
29
  criteriaChanged(oldCriteria, newCriteria) {
@@ -75,7 +70,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
75
70
  DOM.queueUpdate(() => {
76
71
  if (!shouldRunDisconnect)
77
72
  return;
78
- this.deinit();
73
+ this.destroy();
79
74
  });
80
75
  }
81
76
  deepClone() {
@@ -122,12 +117,13 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
122
117
  */
123
118
  init(columnDefinitions, columnStates) {
124
119
  return __awaiter(this, void 0, void 0, function* () {
125
- if (this.agGrid && this.datasource.validResourceName(this.resourceName)) {
126
- this.agGrid.gridOptions = Object.assign(Object.assign(Object.assign({ getRowId: (params) => params.data[this.rowId] }, (columnDefinitions && { columnDefs: columnDefinitions })), this.agGrid['agGridOptions']), this.deferredGridOptions);
120
+ if (this.agGrid) {
121
+ const gridOptions = Object.assign(Object.assign(Object.assign({ getRowId: (params) => params.data[this.rowId] }, (columnDefinitions && { columnDefs: columnDefinitions })), this.agGrid['agGridOptions']), this.deferredGridOptions);
122
+ this.agGrid.gridOptions = Object.assign({}, gridOptions);
127
123
  this.agGrid['initGrid']();
128
- this.agGrid.addEventListener('onGridReady', () => __awaiter(this, void 0, void 0, function* () {
124
+ this.agGrid.addEventListener(Events.EVENT_GRID_READY, () => __awaiter(this, void 0, void 0, function* () {
129
125
  if (columnStates) {
130
- this.agGrid.gridApi.applyColumnState({ state: columnStates });
126
+ this.agGrid.columnApi.applyColumnState({ state: columnStates });
131
127
  }
132
128
  yield this.loadResourceData();
133
129
  }), { once: true });
@@ -142,8 +138,16 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
142
138
  this.handleErrors('Application not connected or invalid resource name, datasource will not work. Falling back to local columnDefs/rowData.');
143
139
  });
144
140
  }
141
+ /**
142
+ * Destroys the datasource, resetting it to its initial state.
143
+ * @public
144
+ */
145
+ destroy() {
146
+ this.reset();
147
+ }
145
148
  /**
146
149
  * Deinitialises the datasource, resetting it to its initial state.
150
+ * @deprecated Use `destroy` instead
147
151
  * @public
148
152
  */
149
153
  deinit() {
@@ -152,7 +156,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
152
156
  /**
153
157
  * Resets the datasource to its initial state.
154
158
  * @public
155
- * @deprecated Use `deinit` instead
159
+ * @deprecated Use `destroy` instead
156
160
  */
157
161
  reset() {
158
162
  var _a;
@@ -170,7 +174,6 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
170
174
  this.connectionSub = undefined;
171
175
  }
172
176
  this.clearRowData();
173
- this.isRequestServer = false;
174
177
  this.requiresFullRowDataAndColDefs = true;
175
178
  this.dataSubWasLoggedOff = false;
176
179
  this.criteriaFromFilters = new Map();
@@ -178,7 +181,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
178
181
  this.update = new BehaviorSubject(new Map());
179
182
  this.agGrid.removeAttribute('ds-disconnected');
180
183
  // TODO: There may need to be a full destroy path. Datasources need some love!
181
- this.datasource.deinit();
184
+ this.datasource.destroy();
182
185
  }
183
186
  /**
184
187
  * Restarts the datasource, uses `deinit` and `init` in sequence.
@@ -189,9 +192,9 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
189
192
  let columnStates;
190
193
  if (this.keepColDefsOnClearRowData) {
191
194
  columnDefinitions = this.agGrid.gridApi.getColumnDefs();
192
- columnStates = this.agGrid.gridApi.getColumnState();
195
+ columnStates = this.agGrid.columnApi.getColumnState();
193
196
  }
194
- this.deinit();
197
+ this.destroy();
195
198
  this.init(columnDefinitions, columnStates);
196
199
  }
197
200
  /**
@@ -207,12 +210,13 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
207
210
  * @internal
208
211
  */
209
212
  clearRowData(withColumnDefs = true) {
213
+ var _a, _b, _c, _d;
210
214
  this.rowData = new Map();
211
215
  this.agTransaction = undefined;
212
216
  if (withColumnDefs && !this.keepColDefsOnClearRowData) {
213
- this.agGrid.gridApi.updateGridOptions({ columnDefs: [] });
217
+ (_b = (_a = this.agGrid) === null || _a === void 0 ? void 0 : _a.gridApi) === null || _b === void 0 ? void 0 : _b.setColumnDefs([]);
214
218
  }
215
- this.agGrid.gridApi.updateGridOptions({ rowData: [] });
219
+ (_d = (_c = this.agGrid) === null || _c === void 0 ? void 0 : _c.gridApi) === null || _d === void 0 ? void 0 : _d.setRowData([]);
216
220
  }
217
221
  /**
218
222
  * Sets the columnDefs and rowData for the grid.
@@ -237,13 +241,12 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
237
241
  col.pivot = null;
238
242
  }
239
243
  });
240
- this.agGrid.gridApi.updateGridOptions({ columnDefs: agColumnDefs });
244
+ this.agGrid.gridApi.setColumnDefs(agColumnDefs);
241
245
  }
242
246
  }
243
247
  const data = this.rowDataMapper ? this.rowDataMapper(rowData) : rowData;
244
248
  this.agGrid.restoreCachedFilterConfig();
245
- this.agTransaction = { add: [...data], remove: [], update: [], addIndex: 0 };
246
- // this.agGrid.gridApi.setGridOption('rowData', data);
249
+ this.agTransaction = { add: data ? [...data] : [], remove: [], update: [], addIndex: 0 };
247
250
  this.applyAllAgTransactions();
248
251
  this.requiresFullRowDataAndColDefs = false;
249
252
  });
@@ -255,6 +258,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
255
258
  * @internal
256
259
  */
257
260
  reloadResourceData() {
261
+ var _a, _b;
258
262
  return __awaiter(this, void 0, void 0, function* () {
259
263
  logger.debug('GridProGenesisDatasource.reloadResourceData()', this.resourceName);
260
264
  if (this.dataSub) {
@@ -262,7 +266,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
262
266
  this.dataSub = undefined;
263
267
  }
264
268
  this.clearRowData(withoutColumnDefs);
265
- this.agGrid.gridApi.setGridOption('loading', true);
269
+ (_b = (_a = this.agGrid) === null || _a === void 0 ? void 0 : _a.gridApi) === null || _b === void 0 ? void 0 : _b.showLoadingOverlay();
266
270
  this.agGrid.removeAttribute('ds-disconnected');
267
271
  this.loadResourceData(withoutFullInit);
268
272
  });
@@ -297,12 +301,12 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
297
301
  this.dataSub = this.datasource.stream
298
302
  .pipe(catchError((err) => {
299
303
  var _a;
300
- this.handleErrors((_a = err === null || err === void 0 ? void 0 : err.receivedMessage) === null || _a === void 0 ? void 0 : _a.ERROR.join(', '));
304
+ this.handleErrors((_a = err === null || err === void 0 ? void 0 : err.receivedMessage) === null || _a === void 0 ? void 0 : _a.ERROR);
301
305
  return EMPTY;
302
306
  }))
303
307
  .subscribe((result) => {
304
308
  if (result === null || result === void 0 ? void 0 : result.ERROR) {
305
- this.handleErrors(result.ERROR.join(', '));
309
+ this.handleErrors(result.ERROR);
306
310
  }
307
311
  const messageType = result.MESSAGE_TYPE;
308
312
  if (messageType && messageType === MessageType.LOGOFF_ACK) {
@@ -341,31 +345,30 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
341
345
  }
342
346
  return result.inserts;
343
347
  }
344
- handleErrors(message) {
348
+ handleErrors(errors) {
349
+ let message;
350
+ if (Array.isArray(errors)) {
351
+ const stringArray = errors.map((item) => {
352
+ if (typeof item === 'string') {
353
+ return item;
354
+ }
355
+ else if (typeof item === 'object' && item !== null && 'TEXT' in item) {
356
+ return item.TEXT;
357
+ }
358
+ else {
359
+ throw new Error('Array contains invalid elements');
360
+ }
361
+ });
362
+ message = stringArray.join(', ');
363
+ }
345
364
  if (this.agGrid) {
346
365
  this.agGrid.setAttribute('ds-disconnected', 'ds-disconnected');
347
366
  }
348
367
  if (message) {
349
- logger.warn(message);
368
+ logger.error(message);
350
369
  this.$emit(gridProGenesisDatasourceEventNames.error, { message });
351
370
  }
352
371
  }
353
- datasourceOptions() {
354
- return {
355
- criteria: this.buildCriteria(),
356
- fields: this.fields,
357
- isSnapshot: this.isSnapshot,
358
- maxRows: this.maxRows,
359
- maxView: this.maxView,
360
- movingView: this.movingView,
361
- orderBy: this.orderBy,
362
- pollingInterval: this.pollingInterval,
363
- disablePolling: this.disablePolling,
364
- request: this.request,
365
- resourceName: this.resourceName,
366
- reverse: this.reverse,
367
- };
368
- }
369
372
  handleStreamResult(result) {
370
373
  if (!result)
371
374
  return;
@@ -386,9 +389,23 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
386
389
  return;
387
390
  }
388
391
  if (this.requiresFullRowDataAndColDefs) {
389
- requestServerData === null || requestServerData === void 0 ? void 0 : requestServerData.forEach((insertData) => {
390
- this.rowData.set(insertData[this.rowId], insertData);
391
- });
392
+ let noRowIdError = false;
393
+ for (const insertData of requestServerData || []) {
394
+ const insertDataRowId = insertData[this.rowId];
395
+ if (!insertDataRowId) {
396
+ if (!noRowIdError) {
397
+ const noRowIdMessage = `The specified rowId (${this.rowId}) is not present in the data. Since this is not a snapshot (isSnapshot=false), the data will not be loaded. Please provide a valid 'row-id' attribute.`;
398
+ logger.error(noRowIdMessage);
399
+ noRowIdError = true;
400
+ }
401
+ break;
402
+ }
403
+ this.rowData.set(insertDataRowId, insertData);
404
+ }
405
+ if (noRowIdError) {
406
+ this.destroy();
407
+ return;
408
+ }
392
409
  const rowData = this.rowData.size > 0 ? Array.from(this.rowData.values()) : requestServerData;
393
410
  this.handleSizeChanged(previousSize, this.rowData.size);
394
411
  this.setRowData(rowData);
@@ -438,12 +455,6 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
438
455
  return colDefsMergedWithTemplateDefs;
439
456
  });
440
457
  }
441
- buildCriteria() {
442
- var _a;
443
- const initialCriteria = ((_a = this.criteria) === null || _a === void 0 ? void 0 : _a.split(criteriaDelimiter)) || [];
444
- const criteria = initialCriteria.concat(Array.from(this.criteriaFromFilters.values()));
445
- return normaliseCriteria(criteria.join(criteriaJoin), criteriaDelimiter);
446
- }
447
458
  setFilter(fieldName, newFilter) {
448
459
  this.criteriaFromFilters.set(fieldName, newFilter);
449
460
  this.update.next(this.criteriaFromFilters);
@@ -467,21 +478,6 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
467
478
  });
468
479
  }
469
480
  };
470
- __decorate([
471
- Auth
472
- ], GridProGenesisDatasource.prototype, "auth", void 0);
473
- __decorate([
474
- Datasource
475
- ], GridProGenesisDatasource.prototype, "datasource", void 0);
476
- __decorate([
477
- attr({ attribute: 'polling-interval' })
478
- ], GridProGenesisDatasource.prototype, "pollingInterval", void 0);
479
- __decorate([
480
- attr({ mode: 'boolean', attribute: 'disable-polling' })
481
- ], GridProGenesisDatasource.prototype, "disablePolling", void 0);
482
- __decorate([
483
- observable
484
- ], GridProGenesisDatasource.prototype, "request", void 0);
485
481
  __decorate([
486
482
  attr({ mode: 'boolean', attribute: 'restart-on-reconnection' })
487
483
  ], GridProGenesisDatasource.prototype, "restartOnReconnection", void 0);
@@ -1,9 +1,9 @@
1
1
  import { __awaiter, __decorate, __rest } from "tslib";
2
2
  import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
3
- import { _combineAttributesAndGridOptions, createGrid, ComponentUtil, ModuleRegistry, } from '@ag-grid-community/core';
3
+ import { ComponentUtil, Grid, ModuleRegistry } from '@ag-grid-community/core';
4
4
  import { CsvExportModule } from '@ag-grid-community/csv-export';
5
5
  import { insertDocumentCSSRule, LifecycleMixin, respondToVisibility, } from '@genesislcap/foundation-utils';
6
- import { attr, DOM, observable, volatile } from '@microsoft/fast-element';
6
+ import { attr, DOM, observable } from '@microsoft/fast-element';
7
7
  import { FoundationElement } from '@microsoft/fast-foundation';
8
8
  import { classNames } from '@microsoft/fast-web-utilities';
9
9
  import * as changeCase from 'change-case';
@@ -42,38 +42,12 @@ export const AG_PROPERTIES = ComponentUtil.ALL_PROPERTIES.filter((p) => p !== 'r
42
42
  * @tagname %%prefix%%-grid-pro
43
43
  */
44
44
  export class GridPro extends LifecycleMixin(FoundationElement) {
45
- get gridApi() {
46
- if (!this.initialised) {
47
- // Return a proxy object to intercept property accesses
48
- return new Proxy({}, {
49
- get: () => {
50
- return () => {
51
- return {
52
- destroy: () => {
53
- // do nothing
54
- },
55
- // updateGridOptions: () => {
56
- // // do nothing
57
- // },
58
- // applyTransaction: () => {
59
- // // do nothing
60
- // },
61
- // applyTransactionAsync: () => {
62
- // // do nothing
63
- // },
64
- };
65
- };
66
- },
67
- });
68
- }
69
- return this._gridApi;
70
- }
71
45
  rowDataChanged(_, rowData) {
72
46
  if (this.initialised) {
73
- this.gridApi.setGridOption('rowData', rowData);
47
+ this.gridApi.setRowData(rowData);
74
48
  }
75
49
  }
76
- themeChanged(_oldValue, newValue) {
50
+ themeChanged(oldValue, newValue) {
77
51
  if (!newValue) {
78
52
  this.classNames = '';
79
53
  this.destroyFontFace();
@@ -164,7 +138,10 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
164
138
  action: this.handleError.bind(this, gridProErrorNames.datasource),
165
139
  });
166
140
  }
167
- addEventListener(type, listener, options) {
141
+ addEventListener(eventType, listener, options) {
142
+ const type = eventType.startsWith('on')
143
+ ? eventType
144
+ : `on${eventType.charAt(0).toUpperCase() + eventType.slice(1)}`;
168
145
  super.addEventListener(type, listener, options);
169
146
  if (ComponentUtil.PUBLIC_EVENTS.includes(type)) {
170
147
  if (this.gridApi) {
@@ -175,9 +152,9 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
175
152
  }
176
153
  }
177
154
  }
178
- addGridEventListener(type) {
179
- this.gridApi.addEventListener(type, (e) => {
180
- this.$emit(type, e);
155
+ addGridEventListener(eventType) {
156
+ this.gridApi.addEventListener(eventType, (e) => {
157
+ this.$emit(eventType, e);
181
158
  });
182
159
  }
183
160
  handleError(type, event) {
@@ -273,7 +250,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
273
250
  saveColumnState() {
274
251
  return __awaiter(this, void 0, void 0, function* () {
275
252
  if (this.rehydrationAttempted && this.statePersistanceEnabled()) {
276
- let colState = this.gridApi.getColumnState();
253
+ let colState = this.columnApi.getColumnState();
277
254
  colState = this.gridAutosizingEnabled
278
255
  ? this.removeConfigWidthsToAutosize(colState)
279
256
  : colState;
@@ -286,7 +263,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
286
263
  /**
287
264
  * Gets the saved grid ColumnState[] from storage
288
265
  * @remarks This is used to restore the grid state when the grid is rehydrated
289
- * @privateRemarks Not using `gridApi.get|setColumnState()` for these flows as it doesn't work setting new columnDefs vs different ordering.
266
+ * @privateRemarks Not using `columnApi.get|setColumnState()` for these flows as it doesn't work setting new columnDefs vs different ordering.
290
267
  * @public
291
268
  */
292
269
  getSavedColumnState() {
@@ -304,7 +281,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
304
281
  this.rehydrationAttempted = true;
305
282
  const colState = yield this.getSavedColumnState();
306
283
  if (colState && colState.length > 0) {
307
- (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.applyColumnState({
284
+ (_a = this.columnApi) === null || _a === void 0 ? void 0 : _a.applyColumnState({
308
285
  state: colState,
309
286
  applyOrder: true,
310
287
  });
@@ -364,13 +341,16 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
364
341
  });
365
342
  const { columnDefs, components, defaultColDef, getRowId, onGridReady, onFilterChanged } = options, rest = __rest(options, ["columnDefs", "components", "defaultColDef", "getRowId", "onGridReady", "onFilterChanged"]);
366
343
  const derivedOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.gridOptionsConfig), { defaultColDef: Object.assign({ enableCellChangeFlash: this.enableCellFlashing, filter: true, resizable: true, sortable: true }, defaultColDef), components: this.combineAllGridComponents(components), suppressDragLeaveHidesColumns: true }), this.eventsAndCallbacks), { onGridReady: (event) => {
344
+ var _a, _b;
345
+ this.gridApi = (_a = options.api) !== null && _a !== void 0 ? _a : event.api;
346
+ this.columnApi = (_b = options.columnApi) !== null && _b !== void 0 ? _b : event.columnApi;
367
347
  if (this.gridEventsQueue.length) {
368
348
  this.gridEventsQueue.forEach((type) => {
369
349
  this.addGridEventListener(type);
370
350
  });
371
351
  }
372
352
  if (this.rowData) {
373
- this.gridApi.setGridOption('rowData', this.rowData);
353
+ this.gridApi.setRowData(this.rowData);
374
354
  }
375
355
  if (onGridReady) {
376
356
  onGridReady(event);
@@ -402,7 +382,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
402
382
  }
403
383
  }
404
384
  setLocalGridOptions(derivedOptions) {
405
- this.agGridOptions = Object.assign(Object.assign({}, this.agGridOptions), _combineAttributesAndGridOptions(derivedOptions, this.agAttributes));
385
+ this.agGridOptions = Object.assign(Object.assign({}, this.agGridOptions), ComponentUtil.copyAttributesToGridOptions(derivedOptions, this.agAttributes));
406
386
  }
407
387
  initGrid() {
408
388
  DOM.queueUpdate(() => {
@@ -413,7 +393,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
413
393
  this.gridSlot.removeChild(this.gridSlot.firstChild);
414
394
  }
415
395
  }
416
- this._gridApi = createGrid(this.gridSlot, this.agGridOptions);
396
+ this.agGrid = new Grid(this.gridSlot, this.agGridOptions, this.gridParams);
417
397
  this.initialised = true;
418
398
  });
419
399
  }
@@ -527,7 +507,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
527
507
  // for subsequent (post gridOptions) changes
528
508
  const changeObject = {};
529
509
  changeObject[gridPropertyName] = { currentValue: newValue };
530
- // ComponentUtil.processOnChange(changeObject, this.gridApi);
510
+ ComponentUtil.processOnChange(changeObject, this.gridApi);
531
511
  }
532
512
  }
533
513
  }
@@ -559,15 +539,18 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
559
539
  }
560
540
  }
561
541
  }
542
+ __decorate([
543
+ observable
544
+ ], GridPro.prototype, "columnApi", void 0);
545
+ __decorate([
546
+ observable
547
+ ], GridPro.prototype, "gridApi", void 0);
562
548
  __decorate([
563
549
  observable
564
550
  ], GridPro.prototype, "gridErrorItems", void 0);
565
551
  __decorate([
566
552
  StatePersistence
567
553
  ], GridPro.prototype, "statePersistence", void 0);
568
- __decorate([
569
- volatile
570
- ], GridPro.prototype, "gridApi", null);
571
554
  __decorate([
572
555
  attr({ attribute: 'auto-cell-renderer-by-type', mode: 'boolean' })
573
556
  ], GridPro.prototype, "autoCellRendererByType", void 0);
@@ -631,6 +614,9 @@ __decorate([
631
614
  __decorate([
632
615
  observable
633
616
  ], GridPro.prototype, "classNames", void 0);
617
+ __decorate([
618
+ observable
619
+ ], GridPro.prototype, "agGrid", void 0);
634
620
  __decorate([
635
621
  observable
636
622
  ], GridPro.prototype, "gridSlot", void 0);
@@ -9,7 +9,8 @@ import { gridProErrorNames } from './grid-pro.definitions';
9
9
  export const getGridProTemplate = (prefix = 'foundation') => html `
10
10
  <template>
11
11
  <span part="grid" class="${(x) => x.classNames}">
12
- <div ${ref('gridSlot')} style="width: 100%; height: 100%">
12
+ <slot name="grid" ${ref('gridSlot')}></slot>
13
+ <slot></slot>
13
14
  </span>
14
15
  <slot
15
16
  name="grid-datasource-error"