@genesislcap/grid-pro 14.20.1 → 14.20.2-alpha-97d057d.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 (75) hide show
  1. package/dist/custom-elements.json +77 -22
  2. package/dist/dts/cell-renderers/action.renderer.d.ts +1 -1
  3. package/dist/dts/cell-renderers/actions-menu.renderer.d.ts +1 -1
  4. package/dist/dts/cell-renderers/boolean.renderer.d.ts +1 -1
  5. package/dist/dts/cell-renderers/select.renderer.d.ts +1 -1
  6. package/dist/dts/cell-renderers/text-field.renderer.d.ts +1 -1
  7. package/dist/dts/cell-renderers/text.renderer.d.ts +2 -2
  8. package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource-next.d.ts +15 -0
  9. package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource-next.d.ts.map +1 -1
  10. package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts +18 -2
  11. package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts.map +1 -1
  12. package/dist/dts/grid-pro.d.ts +37 -6
  13. package/dist/dts/grid-pro.d.ts.map +1 -1
  14. package/dist/dts/style/colors.d.ts +2 -2
  15. package/dist/esm/cell-renderers/action.renderer.js +1 -1
  16. package/dist/esm/cell-renderers/actions-menu.renderer.js +1 -1
  17. package/dist/esm/cell-renderers/boolean.renderer.js +1 -1
  18. package/dist/esm/cell-renderers/select.renderer.js +1 -1
  19. package/dist/esm/cell-renderers/text-field.renderer.js +1 -1
  20. package/dist/esm/cell-renderers/text.renderer.js +2 -2
  21. package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource-next.js +9 -0
  22. package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource.js +18 -2
  23. package/dist/esm/grid-pro.js +52 -19
  24. package/dist/esm/style/colors.js +2 -2
  25. package/dist/grid-pro.api.json +216 -1038
  26. package/dist/grid-pro.d.ts +80 -17
  27. package/docs/api/grid-pro.defaultgridproconfig.md +2 -0
  28. package/docs/api/grid-pro.foundationagbooleanrenderer.md +1 -1
  29. package/docs/api/grid-pro.foundationagselectrenderer.md +1 -1
  30. package/docs/api/grid-pro.foundationagtextfieldrenderer.md +1 -1
  31. package/docs/api/grid-pro.foundationagtextrenderer.md +1 -1
  32. package/docs/api/grid-pro.foundationgridpro.md +1 -1
  33. package/docs/api/grid-pro.foundationgridproactionrenderer.md +1 -1
  34. package/docs/api/grid-pro.foundationgridproactionsmenurenderer.md +1 -1
  35. package/docs/api/grid-pro.foundationgridproshadowoptions.md +7 -0
  36. package/docs/api/grid-pro.gridpro.agattributes.md +1 -1
  37. package/docs/api/grid-pro.gridpro.agpropertiesmap.md +1 -1
  38. package/docs/api/grid-pro.gridpro.gridoptions.md +3 -0
  39. package/docs/api/grid-pro.gridpro.md +9 -2
  40. package/docs/api/grid-pro.gridpro.savedcolumnstate.md +18 -0
  41. package/docs/api/grid-pro.gridprogenesisdatasource.deinit.md +1 -0
  42. package/docs/api/grid-pro.gridprogenesisdatasource.init.md +6 -0
  43. package/docs/api/grid-pro.gridprogenesisdatasource.md +10 -4
  44. package/docs/api/grid-pro.gridprogenesisdatasource.reset.md +2 -1
  45. package/docs/api/grid-pro.gridprogenesisdatasource.restart.md +2 -0
  46. package/docs/api/grid-pro.hypenateandlowercase.md +13 -0
  47. package/docs/api/grid-pro.md +12 -14
  48. package/docs/api-report.md +14 -12
  49. package/package.json +8 -8
  50. package/docs/api/grid-pro.gridprogenesisdatasourcenext.connect.md +0 -11
  51. package/docs/api/grid-pro.gridprogenesisdatasourcenext.connectedcallback.md +0 -15
  52. package/docs/api/grid-pro.gridprogenesisdatasourcenext.criteria.md +0 -11
  53. package/docs/api/grid-pro.gridprogenesisdatasourcenext.disconnectedcallback.md +0 -15
  54. package/docs/api/grid-pro.gridprogenesisdatasourcenext.fields.md +0 -11
  55. package/docs/api/grid-pro.gridprogenesisdatasourcenext.init.md +0 -15
  56. package/docs/api/grid-pro.gridprogenesisdatasourcenext.issnapshot.md +0 -11
  57. package/docs/api/grid-pro.gridprogenesisdatasourcenext.maxrows.md +0 -11
  58. package/docs/api/grid-pro.gridprogenesisdatasourcenext.maxview.md +0 -11
  59. package/docs/api/grid-pro.gridprogenesisdatasourcenext.md +0 -40
  60. package/docs/api/grid-pro.gridprogenesisdatasourcenext.orderby.md +0 -11
  61. package/docs/api/grid-pro.gridprogenesisdatasourcenext.pagination.md +0 -11
  62. package/docs/api/grid-pro.gridprogenesisdatasourcenext.params.md +0 -11
  63. package/docs/api/grid-pro.gridprogenesisdatasourcenext.reset.md +0 -15
  64. package/docs/api/grid-pro.gridprogenesisdatasourcenext.resourcename.md +0 -11
  65. package/docs/api/grid-pro.gridprogenesisdatasourcenext.resourcenamechanged.md +0 -23
  66. package/docs/api/grid-pro.gridprogenesisdatasourcenext.restart.md +0 -15
  67. package/docs/api/grid-pro.gridprogenesisdatasourcenext.reverse.md +0 -11
  68. package/docs/api/grid-pro.streamdatasource._constructor_.md +0 -20
  69. package/docs/api/grid-pro.streamdatasource.connect.md +0 -11
  70. package/docs/api/grid-pro.streamdatasource.dataserverstream.md +0 -11
  71. package/docs/api/grid-pro.streamdatasource.getrows.md +0 -22
  72. package/docs/api/grid-pro.streamdatasource.md +0 -34
  73. package/docs/api/grid-pro.streamdatasource.resourceparams.md +0 -11
  74. package/docs/api/grid-pro.streamdatasource.streamsourceref.md +0 -11
  75. package/docs/api/grid-pro.streamdatasourceoptions.md +0 -20
@@ -11,6 +11,11 @@ import { logger } from '../utils/logger';
11
11
  const criteriaDelimiter = ';';
12
12
  const criteriaJoin = ' && ';
13
13
  const withoutFullInit = null;
14
+ /**
15
+ * The Genesis Datasource element, for CSRM-compatible data fetching and used exclusively by the GridPro element.
16
+ * @remarks Only supports Client-Side Row Model.
17
+ * @public
18
+ */
14
19
  let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleMixin(FoundationElement) {
15
20
  constructor() {
16
21
  super(...arguments);
@@ -69,6 +74,11 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
69
74
  return this.parentElement;
70
75
  }
71
76
  // Genesis Specific
77
+ /**
78
+ * Initializes the datasource.
79
+ * @public
80
+ * @remarks This method is called automatically when the element is connected to the DOM.
81
+ */
72
82
  init() {
73
83
  if (this.agGrid && this.resourceName && this.connect.isConnected) {
74
84
  const gridOptions = Object.assign({ getRowId: (params) => params.data[this.rowId] }, this.deferredGridOptions);
@@ -87,14 +97,16 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
87
97
  logger.warn(`Application not connected, falling back to local columnDefs/rowData`);
88
98
  }
89
99
  /**
100
+ * Deinitialises the datasource, resetting it to its initial state.
90
101
  * @public
91
102
  */
92
103
  deinit() {
93
104
  this.reset();
94
105
  }
95
106
  /**
96
- * Use {@link @genesislcap/grid-pro#GridProGenesisDatasource#deinit} instead
97
- * @deprecated
107
+ * Resets the datasource to its initial state.
108
+ * @public
109
+ * @deprecated Use `deinit` instead
98
110
  */
99
111
  reset() {
100
112
  if (this.dataSub) {
@@ -119,6 +131,10 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
119
131
  this.criteriaFromFilters = new Map();
120
132
  this.update = new BehaviorSubject(new Map());
121
133
  }
134
+ /**
135
+ * Restarts the datasource, uses `deinit` and `init` in sequence.
136
+ * @public
137
+ */
122
138
  restart() {
123
139
  this.deinit();
124
140
  this.init();
@@ -21,8 +21,17 @@ GridProGenesisDatasourceNext;
21
21
  GridProCell;
22
22
  GridColumn;
23
23
  ModuleRegistry.registerModules([CsvExportModule, ClientSideRowModelModule]);
24
- const hypenateAndLowercase = (property) => property.replace('/([a-z])([A-Z])/g', '$1-$2').toLowerCase();
25
24
  /**
25
+ * A function to convert string values from 'camelCase' to 'hypenated-lowercase'.
26
+ * @param value - The value to hypenate and lowercase.
27
+ * @returns The hypenated and lowercased result.
28
+ * @public
29
+ */
30
+ export const hypenateAndLowercase = (value) => value.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
31
+ /**
32
+ * The Grid Pro element.
33
+ * @remarks Grid Pro is a Web Component wrapper around the AG Grid Community library.
34
+ * @public
26
35
  * @tagname %%prefix%%-grid-pro
27
36
  */
28
37
  export class GridPro extends LifecycleMixin(FoundationElement) {
@@ -78,7 +87,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
78
87
  ComponentUtil.ALL_PROPERTIES.forEach((key) => {
79
88
  Object.defineProperty(this, key, {
80
89
  set: (v) => {
81
- this.agAttributeChangedCallback(key.toLowerCase(), undefined, v);
90
+ this.agAttributeChangedCallback(hypenateAndLowercase(key), undefined, v);
82
91
  },
83
92
  enumerable: true,
84
93
  configurable: true,
@@ -125,16 +134,16 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
125
134
  }, DEBOUNCED_RESIZE_TIME);
126
135
  }
127
136
  /**
128
- * If {@link @genesislcap/grid-pro#GridPro#gridAutosizingEnabled} is true, will remove the widths from the column states.
137
+ * If {@link @genesislcap/grid-pro#GridPro.gridAutosizingEnabled} is true, will remove the widths from the column states.
129
138
  * @internal
130
139
  */
131
140
  removeConfigWidthsToAutosize(colState) {
132
141
  return colState.map((col) => (Object.assign(Object.assign({}, col), { width: null })));
133
142
  }
134
- serialiseStoreTableConfig() {
143
+ saveColumnState() {
135
144
  if (this.rehydrationAttempted && this.statePersistanceEnabled()) {
136
145
  const existingOptions = JSON.parse(this.session.getLocalStorageItem('gridOptions') || '{}');
137
- let colState = this.agGridOptions.columnApi.getColumnState();
146
+ let colState = this.gridApi.getColumnDefs();
138
147
  colState = this.gridAutosizingEnabled
139
148
  ? this.removeConfigWidthsToAutosize(colState)
140
149
  : colState;
@@ -142,25 +151,40 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
142
151
  this.session.setLocalStorageItem('gridOptions', JSON.stringify(existingOptions));
143
152
  }
144
153
  }
145
- rehydrateTableConfig() {
146
- this.rehydrationAttempted = true;
147
- if (this.statePersistanceEnabled() && this.session.getLocalStorageItem('gridOptions')) {
148
- const allGridOptions = JSON.parse(this.session.getLocalStorageItem('gridOptions'));
154
+ /**
155
+ * Gets the saved grid ColDefs from local storage
156
+ * @remarks This is used to restore the grid state when the grid is rehydrated
157
+ * @privateRemarks Not using `columnApi.get|setColumnState()` for these flows as it doesn't work setting new columnDefs vs different ordering.
158
+ * @public
159
+ */
160
+ get savedColumnState() {
161
+ const localStorageGridOptions = this.session.getLocalStorageItem('gridOptions');
162
+ if (this.statePersistanceEnabled() && localStorageGridOptions) {
163
+ const allGridOptions = JSON.parse(localStorageGridOptions);
149
164
  if (this.persistColumnStateKey in allGridOptions) {
150
- this.agGridOptions.columnApi.applyColumnState({
151
- state: JSON.parse(allGridOptions[this.persistColumnStateKey]),
152
- applyOrder: true,
153
- });
165
+ return JSON.parse(allGridOptions[this.persistColumnStateKey]);
154
166
  }
155
167
  }
168
+ return [];
169
+ }
170
+ restoreColumnState() {
171
+ this.rehydrationAttempted = true;
172
+ if (this.savedColumnState.length > 0) {
173
+ this.gridApi.setColumnDefs(this.savedColumnState);
174
+ }
175
+ }
176
+ /**
177
+ * @public
178
+ */
179
+ get gridOptions() {
180
+ return this.agGridOptions;
156
181
  }
157
182
  set gridOptions(options) {
158
183
  const globalEventListener = this.globalEventListener.bind(this);
159
184
  const gridOnChangeCallback = () => {
160
- this.serialiseStoreTableConfig.bind(this)();
185
+ this.saveColumnState.bind(this)();
161
186
  this.debouncedColumnAutosize.bind(this)();
162
187
  };
163
- const rehydrateTableConfig = this.rehydrateTableConfig.bind(this);
164
188
  Array.from(this.attributes).forEach((attribute) => {
165
189
  const attrName = this.agPropertiesMap[attribute.name];
166
190
  if (!attrName)
@@ -183,10 +207,10 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
183
207
  params,
184
208
  gridId: this.id,
185
209
  });
186
- rehydrateTableConfig();
210
+ this.restoreColumnState.bind(this)();
187
211
  this.debouncedColumnAutosize.bind(this)();
188
212
  }, onFirstDataRendered: () => {
189
- this.enableFlashingRows.bind(this);
213
+ this.enableFlashingRows.bind(this)();
190
214
  }, onColumnPinned: gridOnChangeCallback, onColumnResized: gridOnChangeCallback, onColumnMoved: gridOnChangeCallback, onDisplayedColumnsChanged: gridOnChangeCallback, onFilterChanged: gridOnChangeCallback, onGridSizeChanged: gridOnChangeCallback, onSortChanged: gridOnChangeCallback }), rest);
191
215
  this.agGridOptions = Object.assign(Object.assign({}, this.agGridOptions), ComponentUtil.copyAttributesToGridOptions(derivedOptions, this.agAttributes));
192
216
  const gridParams = {
@@ -353,13 +377,22 @@ __decorate([
353
377
  __decorate([
354
378
  observable
355
379
  ], GridPro.prototype, "gridComponents", void 0);
356
- // explicitly declaring for extensibility
380
+ /**
381
+ * GridPro shadow root options.
382
+ * @public
383
+ * @remarks
384
+ * For extensibility, this can be used to set the shadow root mode and delegatesFocus
385
+ */
357
386
  export const foundationGridProShadowOptions = undefined;
387
+ /**
388
+ * Grid Pro default configuration.
389
+ * @public
390
+ */
358
391
  export const defaultGridProConfig = {
359
392
  shadowOptions: undefined,
360
393
  };
361
394
  /**
362
- * The Foundation AgGrid
395
+ * A function that returns a Foundation Grid Pro registration for configuring the component with a DesignSystem.
363
396
  *
364
397
  * @public
365
398
  * @remarks
@@ -2,13 +2,13 @@ import { parseColorHexRGB } from '@microsoft/fast-colors';
2
2
  import { SwatchRGB } from '@microsoft/fast-components';
3
3
  /**
4
4
  * The background color swatch.
5
- * @deprecated - only used in the deprecated ag-theme-material theme
6
5
  * @internal
6
+ * @deprecated - only used in the deprecated ag-theme-material theme
7
7
  */
8
8
  export const backgroundSwatch = SwatchRGB.from(parseColorHexRGB('#4c4c4c'));
9
9
  /**
10
10
  * The foreground color swatch.
11
- * @deprecated - only used in the deprecated ag-theme-material theme
12
11
  * @internal
12
+ * @deprecated - only used in the deprecated ag-theme-material theme
13
13
  */
14
14
  export const foregroundSwatch = SwatchRGB.from(parseColorHexRGB('#c01754'));