@adaptabletools/adaptable 16.2.0-canary.1 → 16.2.0-canary.2

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": "16.2.0-canary.1",
3
+ "version": "16.2.0-canary.2",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -1,2 +1,2 @@
1
- declare const _default: 1700058069186;
1
+ declare const _default: 1700505989891;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1700058069186;
3
+ exports.default = 1700505989891;
@@ -20,7 +20,7 @@ export interface DataImportOptions<T = Record<string, unknown>> {
20
20
  */
21
21
  applyImport?: (context: DataImportApplyImportContext<T>) => void;
22
22
  /**
23
- * Function to pre-process the data before it is Imported
23
+ * Function to pre-process the data before it is imported
24
24
  */
25
25
  preprocessData?: (context: PreprocessDataContext<T>) => Record<string, unknown>[];
26
26
  /**
@@ -1,22 +1,19 @@
1
+ import { IRowNode } from '@ag-grid-community/core';
1
2
  import { BaseEventInfo } from './BaseEventInfo';
2
3
  /**
3
4
  * Object returned by the `DataImported` event
4
5
  */
5
6
  export interface DataImportedInfo extends BaseEventInfo {
6
7
  /**
7
- * Rows which were inserted into grid
8
- */
9
- gridDataRows: any[];
10
- /**
11
- * Actual data that was imported
8
+ * Raw data that was imported
12
9
  */
13
10
  importData: any[];
14
11
  /**
15
- * Number of new Rows added
12
+ * Rows that were added
16
13
  */
17
- newRowCount: number;
14
+ addedRows: IRowNode[];
18
15
  /**
19
- * Number of existing rows updated
16
+ * Rows that were updated
20
17
  */
21
- updatedRowCount: number;
18
+ updatedRows: IRowNode[];
22
19
  }
@@ -1,9 +1,10 @@
1
1
  import { ApiBase } from '../Implementation/ApiBase';
2
+ import { IRowNode } from '@ag-grid-community/core';
2
3
  export declare class DataImportInternalApi extends ApiBase {
3
4
  importData(partialRows: any[]): Promise<void>;
4
5
  /**
5
6
  * Publishes an event when Data has been imported
6
7
  * @param gridDataRows Rows that were imported
7
8
  */
8
- publishDataImportedEvent(gridDataRows: any[], importData: any[], newRowCount: number, updatedRowCount: number): void;
9
+ publishDataImportedEvent(importData: any[], addedRows: IRowNode[], updatedRows: IRowNode[]): void;
9
10
  }
@@ -28,7 +28,7 @@ class DataImportInternalApi extends ApiBase_1.ApiBase {
28
28
  updatedRowCount += 1;
29
29
  return Object.assign(Object.assign({}, node === null || node === void 0 ? void 0 : node.data), dataRow);
30
30
  });
31
- await gridApi.addOrUpdateGridData(preparedDataRows);
31
+ const { addedRows, updatedRows } = await gridApi.addOrUpdateGridData(preparedDataRows);
32
32
  let message = '';
33
33
  if (newRowCount && updatedRowCount) {
34
34
  message = `Added: ${newRowCount} new Row${newRowCount > 1 ? 's' : ''}; Updated: ${updatedRowCount} existing Row${updatedRowCount > 1 ? 's' : ''}`;
@@ -48,20 +48,19 @@ class DataImportInternalApi extends ApiBase_1.ApiBase {
48
48
  } }),
49
49
  };
50
50
  this.getAlertApi().showAdaptableAlert(alert);
51
- this.publishDataImportedEvent(preparedDataRows, importData, newRowCount, updatedRowCount);
51
+ this.publishDataImportedEvent(importData, addedRows, updatedRows);
52
52
  }
53
53
  /**
54
54
  * Publishes an event when Data has been imported
55
55
  * @param gridDataRows Rows that were imported
56
56
  */
57
- publishDataImportedEvent(gridDataRows, importData, newRowCount, updatedRowCount) {
57
+ publishDataImportedEvent(importData, addedRows, updatedRows) {
58
58
  const adaptableApi = this.getAdaptableApi();
59
59
  const dataImportedInfo = {
60
60
  adaptableApi: adaptableApi,
61
- gridDataRows,
62
61
  importData,
63
- newRowCount,
64
- updatedRowCount,
62
+ addedRows,
63
+ updatedRows,
65
64
  userName: adaptableApi.optionsApi.getUserName(),
66
65
  adaptableId: adaptableApi.optionsApi.getAdaptableId(),
67
66
  };
@@ -28,6 +28,7 @@ class Fdc3Module extends AdaptableModuleBase_1.AdaptableModuleBase {
28
28
  .forEach((broadcastConfig) => {
29
29
  contextMenuItems.push(this.buildBroadcastMenuItem(broadcastConfig, currentRowNode));
30
30
  });
31
+ contextMenuItems.sort((a, b) => a.label.localeCompare(b.label));
31
32
  if (contextMenuItems.length > 1) {
32
33
  const groupMenuItem = {
33
34
  module: this.moduleInfo.ModuleName,
@@ -25,8 +25,9 @@ const DataImportWizard = (props) => {
25
25
  // - new data is loaded
26
26
  const [importType, setImportType] = React.useState('file');
27
27
  const primaryKey = adaptable.api.optionsApi.getPrimaryKey();
28
+ const hasDynamicallyAddedPrimaryKey = typeof dataImportOptions.getPrimaryKeyValue === 'function';
28
29
  const getPrimaryKeyValue = (rowData) => {
29
- if (typeof dataImportOptions.getPrimaryKeyValue === 'function') {
30
+ if (hasDynamicallyAddedPrimaryKey) {
30
31
  return dataImportOptions.getPrimaryKeyValue(Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(adaptable.api)), { rowData }));
31
32
  }
32
33
  return rowData[primaryKey];
@@ -215,7 +216,8 @@ const DataImportWizard = (props) => {
215
216
  if (columnsErrors && Object.keys(columnsErrors).length > 0) {
216
217
  return 'Some fields do not have a corresponding column.';
217
218
  }
218
- if (!(columnsMap === null || columnsMap === void 0 ? void 0 : columnsMap.some((map) => { var _a; return ((_a = map === null || map === void 0 ? void 0 : map.abColumn) === null || _a === void 0 ? void 0 : _a.field) === primaryKey; }))) {
219
+ if (!hasDynamicallyAddedPrimaryKey &&
220
+ !(columnsMap === null || columnsMap === void 0 ? void 0 : columnsMap.some((map) => { var _a; return ((_a = map === null || map === void 0 ? void 0 : map.abColumn) === null || _a === void 0 ? void 0 : _a.field) === primaryKey; }))) {
219
221
  return 'You need to select a column for the primary key.';
220
222
  }
221
223
  return true;