@adaptabletools/adaptable 11.0.4 → 11.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "11.0.4",
3
+ "version": "11.0.5",
4
4
  "description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
5
5
  "keywords": [
6
6
  "web-components",
@@ -1,2 +1,2 @@
1
- declare const _default: 1646846997369;
1
+ declare const _default: 1647181545760;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1646846997369;
3
+ exports.default = 1647181545760;
@@ -167,6 +167,7 @@ export interface IAdaptable {
167
167
  cancelEdit(): any;
168
168
  isCellEditable(rowNode: RowNode, column: Column): boolean;
169
169
  getFirstRowNode(): RowNode;
170
+ getFirstDisplayedRowNode(): RowNode;
170
171
  forAllRowNodesDo(func: (rowNode: RowNode) => void): void;
171
172
  forAllVisibleRowNodesDo(func: (rowNode: RowNode) => void): void;
172
173
  getVisibleRowNodes(): RowNode[];
@@ -191,6 +191,10 @@ export interface GridApi {
191
191
  * Retrieves the first Row Node in AdapTable
192
192
  */
193
193
  getFirstRowNode(): RowNode;
194
+ /**
195
+ * Retrieves the first Displayed Row Node in AdapTable
196
+ */
197
+ getFirstDisplayedRowNode(): RowNode;
194
198
  /**
195
199
  * Retrieves all Row Nodes currently in the Grid (i.e. filtered)
196
200
  */
@@ -54,6 +54,7 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
54
54
  selectColumn(columnId: string): void;
55
55
  selectColumns(columnIds: string[]): void;
56
56
  getFirstRowNode(): RowNode;
57
+ getFirstDisplayedRowNode(): RowNode;
57
58
  getVisibleRowNodes(): RowNode[];
58
59
  getGridCellFromRowNode(rowwNode: RowNode, columnId: string): GridCell | undefined;
59
60
  getRawValueFromRowNode(rowwNode: RowNode, columnId: string): any | undefined;
@@ -187,6 +187,9 @@ class GridApiImpl extends ApiBase_1.ApiBase {
187
187
  getFirstRowNode() {
188
188
  return this.adaptable.getFirstRowNode();
189
189
  }
190
+ getFirstDisplayedRowNode() {
191
+ return this.adaptable.getFirstDisplayedRowNode();
192
+ }
190
193
  getVisibleRowNodes() {
191
194
  return this.adaptable.getVisibleRowNodes();
192
195
  }
@@ -341,6 +344,10 @@ class GridApiImpl extends ApiBase_1.ApiBase {
341
344
  }
342
345
  areCellsEditable(gridCells) {
343
346
  for (let gridCell of gridCells) {
347
+ if (!gridCell.column) {
348
+ // GridCell.column may be undefined for cells from synthetic columns created by AG Grid (ex. autoGroup columns)
349
+ return false;
350
+ }
344
351
  if (gridCell.column.readOnly) {
345
352
  return false;
346
353
  }
@@ -7,11 +7,11 @@ export declare type AdaptableMessageType =
7
7
  */
8
8
  'Success'
9
9
  /**
10
- * A success message - shows in blue
10
+ * An info message - shows in blue
11
11
  */
12
12
  | 'Info'
13
13
  /**
14
- * A success message - shows in yellow
14
+ * A warning message - shows in orange
15
15
  */
16
16
  | 'Warning'
17
17
  /**
@@ -5,7 +5,7 @@ import { AdaptableColumn } from '../Common/AdaptableColumn';
5
5
  */
6
6
  export interface GridCell {
7
7
  /**
8
- * Column in which cell is situtated
8
+ * Column in which cell is situated
9
9
  */
10
10
  column: AdaptableColumn;
11
11
  /**
@@ -178,7 +178,7 @@ class AlertModule extends AdaptableModuleBase_1.AdaptableModuleBase {
178
178
  toView(alert) {
179
179
  return {
180
180
  items: [
181
- getScopeViewItems_1.getScopeViewItems(alert.Scope),
181
+ getScopeViewItems_1.getScopeViewItems(alert.Scope, this.api),
182
182
  getRuleViewItems_1.getRuleViewItems(alert.Rule, this.api),
183
183
  getAlertBehaviourViewItems_1.getAlertBehaviourViewItems(),
184
184
  getAlertPreviewViewItems_1.getAlertPreviewViewItems(alert, this.api),
@@ -45,6 +45,10 @@ class CellSummaryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
45
45
  selectedCellInfo.gridCells.forEach((selectedCell) => {
46
46
  let value = selectedCell.rawValue;
47
47
  allValues.push(value);
48
+ if (!selectedCell.column) {
49
+ // GridCell.column may be undefined for cells from synthetic columns created by AG Grid (ex. autoGroup columns)
50
+ return;
51
+ }
48
52
  if (ArrayExtensions_1.ArrayExtensions.ContainsItem(numericColumns, selectedCell.column.columnId)) {
49
53
  let valueAsNumber = Number(value);
50
54
  // possible that its not a number despite it being a numeric column
@@ -188,7 +188,7 @@ class ConditionalStyleModule extends AdaptableModuleBase_1.AdaptableModuleBase {
188
188
  toView(conditionalStyle) {
189
189
  return {
190
190
  items: [
191
- getScopeViewItems_1.getScopeViewItems(conditionalStyle.Scope),
191
+ getScopeViewItems_1.getScopeViewItems(conditionalStyle.Scope, this.api),
192
192
  getStyleViewItems_1.getStyleViewItems(),
193
193
  getRuleViewItems_1.getRuleViewItems(conditionalStyle.Rule, this.api),
194
194
  {
@@ -209,7 +209,7 @@ class FlashingCellModule extends AdaptableModuleBase_1.AdaptableModuleBase {
209
209
  toView(flashingCell) {
210
210
  return {
211
211
  items: [
212
- Object.assign(Object.assign({}, getScopeViewItems_1.getScopeViewItems(flashingCell.Scope)), { label: 'Trigger' }),
212
+ Object.assign(Object.assign({}, getScopeViewItems_1.getScopeViewItems(flashingCell.Scope, this.api)), { label: 'Trigger' }),
213
213
  Object.assign(Object.assign({}, getRuleViewItems_1.getRuleViewItems(flashingCell.Rule, this.api)), { label: 'Rule', name: 'Rule' }),
214
214
  getFlashingCellDurationViewItems_1.getFlashingCellDurationViewItems(flashingCell),
215
215
  getFlashingTargetViewItems_1.getFlashingTargetViewItems(flashingCell),
@@ -237,7 +237,7 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
237
237
  return {
238
238
  abObject: formatColumn,
239
239
  items: [
240
- getScopeViewItems_1.getScopeViewItems(formatColumn.Scope),
240
+ getScopeViewItems_1.getScopeViewItems(formatColumn.Scope, this.api),
241
241
  {
242
242
  name: 'Style',
243
243
  view: () => getFormatColumnStyleViewItems_1.getFormatColumnStyleViewItems(formatColumn, this.api),
@@ -186,7 +186,7 @@ class PlusMinusModule extends AdaptableModuleBase_1.AdaptableModuleBase {
186
186
  return {
187
187
  abObject: plusMinus,
188
188
  items: [
189
- Object.assign({ name: 'Target' }, getScopeViewItems_1.getScopeViewItems(plusMinus.Scope)),
189
+ Object.assign({ name: 'Target' }, getScopeViewItems_1.getScopeViewItems(plusMinus.Scope, this.api)),
190
190
  plusMinus.Rule && {
191
191
  name: 'Settings',
192
192
  label: 'Rule',
@@ -74,7 +74,7 @@ class ShortcutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
74
74
  toView(shortcut) {
75
75
  return {
76
76
  abObject: shortcut,
77
- items: [getScopeViewItems_1.getScopeViewItems(shortcut.Scope), getShortcutSettingsViewItems_1.getShortcutSettingsViewItems(shortcut)],
77
+ items: [getScopeViewItems_1.getScopeViewItems(shortcut.Scope, this.api), getShortcutSettingsViewItems_1.getShortcutSettingsViewItems(shortcut)],
78
78
  };
79
79
  }
80
80
  toViewAll() {
@@ -1,19 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getExportColumnsViewItems = void 0;
4
- const getScopeViewItems_1 = require("./getScopeViewItems");
5
- const getValues = (report) => {
6
- switch (report.ReportColumnScope) {
7
- case 'AllColumns':
8
- return ['All Columns'];
9
- case 'VisibleColumns':
10
- return ['Visible Columns'];
11
- case 'ScopeColumns':
12
- return getScopeViewItems_1.getScopeViewItems(report.Scope).values;
13
- default:
14
- return [''];
15
- }
16
- };
17
4
  exports.getExportColumnsViewItems = (report, api) => {
18
5
  return {
19
6
  name: 'Columns',
@@ -1,3 +1,3 @@
1
- import { AdaptableScope } from '../../../types';
1
+ import { AdaptableApi, AdaptableScope } from '../../../types';
2
2
  import { AdaptableObjectItemView } from '../Interface/IModule';
3
- export declare const getScopeViewItems: (scope: AdaptableScope) => AdaptableObjectItemView;
3
+ export declare const getScopeViewItems: (scope: AdaptableScope, api: AdaptableApi) => AdaptableObjectItemView;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getScopeViewItems = void 0;
4
- exports.getScopeViewItems = (scope) => {
4
+ exports.getScopeViewItems = (scope, api) => {
5
5
  let values = [];
6
- if ('ColumnIds' in scope) {
6
+ if ('ColumnIds' in scope && Array.isArray(scope.ColumnIds)) {
7
7
  values = scope.ColumnIds;
8
+ values = scope.ColumnIds.map((columnId) => api.columnApi.getFriendlyNameFromColumnId(columnId)).filter(Boolean);
8
9
  }
9
10
  if ('DataTypes' in scope) {
10
11
  values = scope.DataTypes;
@@ -47,7 +47,7 @@ const ConfigurationDialog = (props) => {
47
47
  padding: 0,
48
48
  style: { overflow: 'auto', display: 'flex', flexFlow: 'column' },
49
49
  }, borderRadius: "none", style: { fontSize: 16, flex: 1 } },
50
- React.createElement(Panel_1.default, { border: "none" },
50
+ React.createElement(Panel_1.default, { style: { minHeight: 50 }, border: "none" },
51
51
  React.createElement(FormLayout_1.default, null,
52
52
  React.createElement(FormLayout_1.FormRow, { label: "AdaptableId" },
53
53
  React.createElement(Input_1.default, { value: abOptions.adaptableId, onChange: onadaptableIdChange, style: { minWidth: '20rem' } })))),
@@ -231,6 +231,7 @@ export declare class Adaptable implements IAdaptable {
231
231
  getGroupedColDefs(): ColDef[];
232
232
  getColumnDefsWithCorrectVisibility: () => ColDef[];
233
233
  getFirstRowNode(): RowNode;
234
+ getFirstDisplayedRowNode(): RowNode;
234
235
  destroy(config?: {
235
236
  unmount: boolean;
236
237
  destroyApi?: boolean;
@@ -312,6 +313,7 @@ export declare class Adaptable implements IAdaptable {
312
313
  deleteRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<RowNode[]>;
313
314
  getFirstGroupedColumn(): AdaptableColumn | undefined;
314
315
  private checkColumnsDataTypeSet;
316
+ private updateColumnDataTypeIfRowDataIsEmpty;
315
317
  private runAdaptableComparerFunction;
316
318
  isGridSelectable(): boolean;
317
319
  isGridGroupable(): boolean;
@@ -2217,11 +2217,16 @@ class Adaptable {
2217
2217
  if (!foundNode) {
2218
2218
  if (!node.group) {
2219
2219
  rowNode = node;
2220
+ foundNode = true;
2220
2221
  }
2221
2222
  }
2222
2223
  });
2223
2224
  return rowNode;
2224
2225
  }
2226
+ getFirstDisplayedRowNode() {
2227
+ const firstDisplayedRowIndex = this.gridOptions.api.getFirstDisplayedRow();
2228
+ return this.gridOptions.api.getDisplayedRowAtIndex(firstDisplayedRowIndex);
2229
+ }
2225
2230
  destroy(config) {
2226
2231
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
2227
2232
  if (this.gridOptions && this.gridOptions.api) {
@@ -3556,6 +3561,7 @@ class Adaptable {
3556
3561
  this.addSyntheticPrimaryKey(dataSource);
3557
3562
  }
3558
3563
  this.gridOptions.api.setRowData(dataSource);
3564
+ this.updateColumnDataTypeIfRowDataIsEmpty();
3559
3565
  }
3560
3566
  getGridData() {
3561
3567
  var _a;
@@ -3621,11 +3627,13 @@ class Adaptable {
3621
3627
  dataUpdateConfig.callback(transaction);
3622
3628
  }
3623
3629
  resolve(transaction === null || transaction === void 0 ? void 0 : transaction.add);
3630
+ this.updateColumnDataTypeIfRowDataIsEmpty();
3624
3631
  });
3625
3632
  });
3626
3633
  }
3627
3634
  else {
3628
3635
  const transaction = this.gridOptions.api.applyTransaction(newData);
3636
+ this.updateColumnDataTypeIfRowDataIsEmpty();
3629
3637
  return Promise.resolve(transaction === null || transaction === void 0 ? void 0 : transaction.add);
3630
3638
  }
3631
3639
  }
@@ -3657,11 +3665,24 @@ class Adaptable {
3657
3665
  }
3658
3666
  checkColumnsDataTypeSet() {
3659
3667
  // check that we have no unknown columns - if we do then ok
3660
- const firstCol = this.api.columnApi.getColumns()[0];
3661
- if (firstCol && firstCol.dataType == Enums_1.DataType.Unknown) {
3668
+ const colDefs = this.api.columnApi.getColumns();
3669
+ if (colDefs.some((colDef) => colDef.dataType === Enums_1.DataType.Unknown)) {
3662
3670
  this.updateColumnsIntoStore();
3663
3671
  }
3664
3672
  }
3673
+ updateColumnDataTypeIfRowDataIsEmpty() {
3674
+ var _a, _b;
3675
+ // gridOptions?.rowData is not updated when setting data via the api
3676
+ if (!((_b = (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.rowData) === null || _b === void 0 ? void 0 : _b.length)) {
3677
+ // the columns dataType is based on the rawData, when type is not set on the column
3678
+ // when data is loaded async, the dataType initially is dataType=unknown
3679
+ // to fix this, we need to update the columnDefs when we data is loaded
3680
+ this.checkColumnsDataTypeSet();
3681
+ // this influences the floating filter
3682
+ // need to trigger header redraw, if not, the columnDef update is not picked-up
3683
+ this.redrawHeader();
3684
+ }
3685
+ }
3665
3686
  runAdaptableComparerFunction(columnId, columnValues) {
3666
3687
  let adaptable = this;
3667
3688
  return function compareItemsOfCustomSort(valueA, valueB, nodeA, nodeB) {
@@ -7046,6 +7046,12 @@ exports.ADAPTABLE_METAMODEL = {
7046
7046
  "description": "Retrieves filtered data from the grid",
7047
7047
  "uiLabel": "Get Filtered Data"
7048
7048
  },
7049
+ {
7050
+ "name": "getFirstDisplayedRowNode",
7051
+ "kind": "function",
7052
+ "description": "Retrieves the first Displayed Row Node in AdapTable",
7053
+ "uiLabel": "Get First Displayed Row Node"
7054
+ },
7049
7055
  {
7050
7056
  "name": "getFirstRowNode",
7051
7057
  "kind": "function",
@@ -7386,7 +7392,7 @@ exports.ADAPTABLE_METAMODEL = {
7386
7392
  {
7387
7393
  "name": "column",
7388
7394
  "kind": "REFERENCE",
7389
- "description": "Column in which cell is situtated",
7395
+ "description": "Column in which cell is situated",
7390
7396
  "uiLabel": "Column",
7391
7397
  "reference": "AdaptableColumn"
7392
7398
  },
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "11.0.4";
1
+ declare const _default: "11.0.5";
2
2
  export default _default;
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '11.0.4'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version
3
+ exports.default = '11.0.5'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version