@adaptabletools/adaptable-cjs 18.0.3 → 18.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-cjs",
3
- "version": "18.0.3",
3
+ "version": "18.0.5",
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",
@@ -48,6 +48,7 @@ export interface DistinctValuesParams {
48
48
  visibleRowsOnly?: boolean;
49
49
  skipRowNode?: IRowNode;
50
50
  permittedValues?: any[];
51
+ addBlankValue?: boolean;
51
52
  }
52
53
  export type AdaptableVariant = 'vanilla' | 'react' | 'angular';
53
54
  /**
@@ -177,7 +178,7 @@ export interface IAdaptable {
177
178
  getDisplayValueFromRowNode(rowNode: IRowNode, columnId: string): string | undefined;
178
179
  getDisplayValueFromRawValue(rowNode: IRowNode, columnId: string, rawValue: any): string | undefined;
179
180
  getNormalisedValueFromRawValue(rawValue: any, column: AdaptableColumn): string | number | boolean | Date | unknown;
180
- getGridCellsForColumn(columnId: string): GridCell[] | undefined;
181
+ getGridCellsForColumn(columnId: string, includeBlanks?: boolean): GridCell[] | undefined;
181
182
  getRowNodesForPrimaryKeys(primaryKeyValues: any[]): IRowNode[];
182
183
  getRowNodeForPrimaryKey(primaryKeyValue: any): IRowNode;
183
184
  getRowNodeByIndex(index: number): IRowNode;
@@ -36,15 +36,27 @@ export type ReactFrameworkComponent = ({ adaptableApi, }: {
36
36
  */
37
37
  export interface CustomRenderContext extends BaseContext {
38
38
  /**
39
- * Whether Tool Panel is currently visible
39
+ * Whether Custom Component is visible
40
+ *
41
+ * @deprecated Use `phase` instead
40
42
  */
41
43
  visible: boolean;
42
44
  /**
43
- * Current Div Element
45
+ * Phase of DOM Element lifecycle
46
+ */
47
+ phase: 'onMount' | 'onDestroy';
48
+ /**
49
+ * Container Div Element
44
50
  */
45
51
  element: HTMLDivElement;
46
52
  }
53
+ /**
54
+ * Function which is called when rendering/destroying a custom framework-agnostic component
55
+ */
47
56
  export interface CustomRenderFunction {
57
+ /**
58
+ * Function to provide bespoke content when NOT using a Framework wrapper
59
+ */
48
60
  (customRenderContext: CustomRenderContext): string | null;
49
61
  }
50
62
  /**
@@ -104,7 +104,15 @@ export declare class AdaptableInternalApi extends ApiBase {
104
104
  getPreviousGroupedColumnsIndex(layoutId: string): {
105
105
  [key: string]: number;
106
106
  };
107
+ /**
108
+ * Gets a value from a rowData object using a field name.
109
+ * Supports deep values (e.g. fieldName = 'address.street')
110
+ */
107
111
  getValueUsingField(rowData: Record<string, any>, fieldName: string): any;
112
+ /**
113
+ * Sets a value in a rowData object using a field name.
114
+ * Supports deep values (e.g. fieldName = 'address.street')
115
+ */
108
116
  setValueUsingField(rowData: Record<string, any>, fieldName: string, newValue: any): Record<string, any>;
109
117
  findAdaptableObjectsByLookupCriteria<T extends AdaptableObjectWithScope>({ scope, tag, ids }: AdaptableObjectLookupCriteria, specificAdaptableObjects: T[]): T[];
110
118
  buildBaseContext(): BaseContext;
@@ -355,6 +355,10 @@ class AdaptableInternalApi extends ApiBase_1.ApiBase {
355
355
  var _a;
356
356
  return (_a = SystemRedux.SystemPreviousGroupedColumnsSelector(this.getAdaptableState().System)) === null || _a === void 0 ? void 0 : _a[layoutId];
357
357
  }
358
+ /**
359
+ * Gets a value from a rowData object using a field name.
360
+ * Supports deep values (e.g. fieldName = 'address.street')
361
+ */
358
362
  // "borrowed" from https://github.com/ag-grid/ag-grid/blob/v28.2.1/community-modules/core/src/ts/utils/object.ts#L205
359
363
  getValueUsingField(rowData, fieldName) {
360
364
  if (!rowData || !(fieldName === null || fieldName === void 0 ? void 0 : fieldName.length)) {
@@ -376,6 +380,10 @@ class AdaptableInternalApi extends ApiBase_1.ApiBase {
376
380
  }
377
381
  return currentObject;
378
382
  }
383
+ /**
384
+ * Sets a value in a rowData object using a field name.
385
+ * Supports deep values (e.g. fieldName = 'address.street')
386
+ */
379
387
  // "borrowed" from https://github.com/ag-grid/ag-grid/blob/v28.2.1/community-modules/core/src/ts/valueService/valueService.ts#L236
380
388
  setValueUsingField(rowData, fieldName, newValue) {
381
389
  if (!rowData || !(fieldName === null || fieldName === void 0 ? void 0 : fieldName.length)) {
@@ -404,6 +412,10 @@ class AdaptableInternalApi extends ApiBase_1.ApiBase {
404
412
  }
405
413
  }
406
414
  else {
415
+ // NOTE AFL: this was NOT in the original AG Grid code, but we need it to handle inserting deep values (the original implementation only handled updating)
416
+ if (currentObject[fieldPiece] == null) {
417
+ currentObject[fieldPiece] = {};
418
+ }
407
419
  currentObject = currentObject[fieldPiece];
408
420
  }
409
421
  }
@@ -10,6 +10,7 @@ const NumberExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Exte
10
10
  const StyleHelper_1 = require("../../Utilities/Helpers/StyleHelper");
11
11
  const UIHelper_1 = tslib_1.__importDefault(require("../../View/UIHelper"));
12
12
  const ObjectFactory_1 = require("../../Utilities/ObjectFactory");
13
+ const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
13
14
  class GridInternalApi extends ApiBase_1.ApiBase {
14
15
  /**
15
16
  * Fires Grid Sorted Event
@@ -68,7 +69,7 @@ class GridInternalApi extends ApiBase_1.ApiBase {
68
69
  * @param columnFilter Current applied filter
69
70
  */
70
71
  async getDistinctFilterDisplayValuesForColumn(columnId, filter, showFilteredRowsOnly) {
71
- var _a;
72
+ var _a, _b;
72
73
  const abColumn = this.getColumnApi().getColumnWithColumnId(columnId);
73
74
  if (abColumn == undefined) {
74
75
  return {
@@ -76,8 +77,10 @@ class GridInternalApi extends ApiBase_1.ApiBase {
76
77
  suppressClientSideFilter: false,
77
78
  };
78
79
  }
80
+ const addBlankValue = this.getColumnFilterOptions().valuesFilterOptions.includeBlankFilterValues;
79
81
  const distinctValuesParams = {
80
82
  visibleRowsOnly: showFilteredRowsOnly,
83
+ addBlankValue: addBlankValue,
81
84
  };
82
85
  const { gridCells, suppressClientSideFilter } = await this.getDistinctFilterListValuesForColumn(abColumn, filter, distinctValuesParams);
83
86
  const sortedDistinctValues = this.sortDistinctValues(gridCells, abColumn);
@@ -88,12 +91,19 @@ class GridInternalApi extends ApiBase_1.ApiBase {
88
91
  shouldShowValuesCount = showValuesCountFunction(columnFilterContext);
89
92
  }
90
93
  if (shouldShowValuesCount) {
91
- const allColumnDisplayValues = (_a = this.adaptable
92
- .getGridCellsForColumn(columnId)) === null || _a === void 0 ? void 0 : _a.map((gc) => {
93
- return gc.displayValue;
94
- });
94
+ const allColumnDisplayValues = addBlankValue
95
+ ? (_a = this.adaptable.getGridCellsForColumn(columnId, true)) === null || _a === void 0 ? void 0 : _a.map((gc) => {
96
+ var _a;
97
+ return (_a = gc.displayValue) !== null && _a !== void 0 ? _a : GeneralConstants_1.BLANK_DISTINCT_COLUMN_VALUE;
98
+ })
99
+ : (_b = this.adaptable.getGridCellsForColumn(columnId)) === null || _b === void 0 ? void 0 : _b.map((gc) => {
100
+ return gc.displayValue;
101
+ });
102
+ const newsortedDistinctValues = addBlankValue
103
+ ? sortedDistinctValues
104
+ : sortedDistinctValues.filter((gc) => gc.displayValue !== undefined);
95
105
  return {
96
- values: sortedDistinctValues.map((cv) => {
106
+ values: newsortedDistinctValues.map((cv) => {
97
107
  const label = cv.displayValue +
98
108
  NumberExtensions_1.default.WrapInParentheses(ArrayExtensions_1.default.getOccurrence(allColumnDisplayValues, cv.displayValue));
99
109
  return {
@@ -81,8 +81,11 @@ export interface UserInterfaceApi {
81
81
  */
82
82
  hideLoadingScreen(): void;
83
83
  /**
84
- *
85
- * @param config
84
+ * Displays a progress indicator
85
+ * @param config.progressText - text to display in the progress indicator
86
+ * @param config.render - render function for a custom progress indicator (if not using a framework component)
87
+ * @param config.frameworkComponent - the framework (React/Angular) component to render as progress indicator
88
+ * @param config.delay - delay before showing the progress indicator (in milliseconds)
86
89
  */
87
90
  showProgressIndicator(config: {
88
91
  text?: string;
@@ -90,6 +93,9 @@ export interface UserInterfaceApi {
90
93
  frameworkComponent?: AdaptableFrameworkComponent;
91
94
  delay?: number;
92
95
  }): void;
96
+ /**
97
+ * Hides the progress indicator
98
+ */
93
99
  hideProgressIndicator(): void;
94
100
  /**
95
101
  * Opens window with custom content
@@ -102,6 +102,10 @@ class RowSummaryService {
102
102
  return {
103
103
  Position,
104
104
  RowData: Object.entries(ColumnsMap !== null && ColumnsMap !== void 0 ? ColumnsMap : {}).reduce((acc, [columnId, expression]) => {
105
+ var _a, _b;
106
+ if (columnId === 'Uuid' || columnId === 'Source') {
107
+ return acc;
108
+ }
105
109
  const key = `${columnId}-${expression}`;
106
110
  let expressionLiveValue = this.cachedCellSummary.get(key);
107
111
  if (expressionLiveValue) {
@@ -143,7 +147,9 @@ class RowSummaryService {
143
147
  value = Helper_1.default.roundNumber(value, 2);
144
148
  }
145
149
  }
146
- acc[columnId] = value;
150
+ const column = this.api.columnApi.getColumnWithColumnId(columnId);
151
+ const fieldName = (_b = (_a = column === null || column === void 0 ? void 0 : column.field) !== null && _a !== void 0 ? _a : column === null || column === void 0 ? void 0 : column.columnId) !== null && _b !== void 0 ? _b : columnId;
152
+ acc = this.api.internalApi.setValueUsingField(acc, fieldName, value);
147
153
  return acc;
148
154
  }, {
149
155
  [RowSummary_1.ROW_SUMMARY_ROW_ID]: true,
@@ -15,6 +15,7 @@ const ExternalRenderer = (_a) => {
15
15
  if (render) {
16
16
  const html = render({
17
17
  visible: true,
18
+ phase: 'onMount',
18
19
  element,
19
20
  adaptableApi,
20
21
  userName: adaptableApi.optionsApi.getUserName(),
@@ -29,6 +30,7 @@ const ExternalRenderer = (_a) => {
29
30
  if (render) {
30
31
  render({
31
32
  visible: false,
33
+ phase: 'onDestroy',
32
34
  element: element,
33
35
  adaptableApi,
34
36
  userName: adaptableApi.optionsApi.getUserName(),
@@ -21,6 +21,7 @@ const CustomToolPanelContent = (props) => {
21
21
  if (hasCustomRenderFn(customToolPanel)) {
22
22
  const customRenderContext = {
23
23
  visible: true,
24
+ phase: 'onMount',
24
25
  element,
25
26
  adaptableApi: api,
26
27
  userName: api.optionsApi.getUserName(),
@@ -36,6 +37,7 @@ const CustomToolPanelContent = (props) => {
36
37
  if (hasCustomRenderFn(customToolPanel)) {
37
38
  customToolPanel.render({
38
39
  visible: false,
40
+ phase: 'onDestroy',
39
41
  element,
40
42
  adaptableApi: api,
41
43
  userName: api.optionsApi.getUserName(),
@@ -23,6 +23,7 @@ const CustomToolbarCmp = (props) => {
23
23
  if (props.customToolbar.render) {
24
24
  const html = props.customToolbar.render({
25
25
  visible: true,
26
+ phase: 'onMount',
26
27
  element,
27
28
  adaptableApi,
28
29
  userName: adaptableApi.optionsApi.getUserName(),
@@ -39,6 +40,7 @@ const CustomToolbarCmp = (props) => {
39
40
  if (props.customToolbar.render) {
40
41
  props.customToolbar.render({
41
42
  visible: false,
43
+ phase: 'onDestroy',
42
44
  element,
43
45
  adaptableApi,
44
46
  userName: adaptableApi.optionsApi.getUserName(),
@@ -241,9 +241,10 @@ export declare class AdaptableAgGrid implements IAdaptable {
241
241
  getDistinctValuesForColumn(column: AdaptableColumn, distinctValuesParams: DistinctValuesParams): GridCell[];
242
242
  private getGridCellsForPermittedValues;
243
243
  private getDistinctGridCellsForColumn;
244
+ addBlankValueToGridCell(gridCell: GridCell): void;
244
245
  private addDistinctColumnValue;
245
246
  private getUniqueGridCells;
246
- getGridCellsForColumn(columnId: string): GridCell[] | undefined;
247
+ getGridCellsForColumn(columnId: string, includeBlanks?: boolean): GridCell[] | undefined;
247
248
  getRowNodesForPrimaryKeys(primaryKeyValues: any[]): any[];
248
249
  getRowNodeByIndex(index: number): IRowNode;
249
250
  getAgGridStatusPanels(): import("@ag-grid-community/core").StatusPanelDef[];
@@ -544,7 +544,7 @@ class AdaptableAgGrid {
544
544
  */
545
545
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'context', (original_context) => {
546
546
  const userContext = original_context || {};
547
- return Object.assign(Object.assign({}, userContext), { __adaptable: this });
547
+ return Object.assign(Object.assign({}, userContext), { __adaptable: this, adaptableApi: this.api });
548
548
  });
549
549
  /**
550
550
  * `gridId`
@@ -2275,9 +2275,10 @@ class AdaptableAgGrid {
2275
2275
  if (distinctValuesParams.visibleRowsOnly) {
2276
2276
  this.agGridAdapter.getAgGridApi().forEachNodeAfterFilter((rowNode) => {
2277
2277
  const gridCell = this.addDistinctColumnValue(rowNode, column.columnId);
2278
- if (gridCell &&
2279
- gridCell.rawValue != undefined &&
2280
- gridCell.rowNode !== distinctValuesParams.skipRowNode) {
2278
+ if (gridCell && gridCell.rowNode !== distinctValuesParams.skipRowNode) {
2279
+ if (gridCell.rawValue == undefined && distinctValuesParams.addBlankValue) {
2280
+ this.addBlankValueToGridCell(gridCell);
2281
+ }
2281
2282
  gridCells.push(gridCell);
2282
2283
  }
2283
2284
  });
@@ -2286,11 +2287,8 @@ class AdaptableAgGrid {
2286
2287
  this.agGridAdapter.getAgGridApi().forEachNode((rowNode) => {
2287
2288
  const gridCell = this.addDistinctColumnValue(rowNode, column.columnId);
2288
2289
  if (gridCell && gridCell.rowNode !== distinctValuesParams.skipRowNode) {
2289
- if (gridCell.rawValue == undefined &&
2290
- this.adaptableOptions.columnFilterOptions.valuesFilterOptions.includeBlankFilterValues) {
2291
- gridCell.rawValue = GeneralConstants_1.BLANK_DISTINCT_COLUMN_VALUE;
2292
- gridCell.displayValue = GeneralConstants_1.BLANK_DISTINCT_COLUMN_VALUE;
2293
- gridCell.normalisedValue = GeneralConstants_1.BLANK_DISTINCT_COLUMN_VALUE;
2290
+ if (gridCell.rawValue == undefined && distinctValuesParams.addBlankValue) {
2291
+ this.addBlankValueToGridCell(gridCell);
2294
2292
  }
2295
2293
  gridCells.push(gridCell);
2296
2294
  }
@@ -2298,6 +2296,11 @@ class AdaptableAgGrid {
2298
2296
  }
2299
2297
  return gridCells;
2300
2298
  }
2299
+ addBlankValueToGridCell(gridCell) {
2300
+ gridCell.rawValue = GeneralConstants_1.BLANK_DISTINCT_COLUMN_VALUE;
2301
+ gridCell.displayValue = GeneralConstants_1.BLANK_DISTINCT_COLUMN_VALUE;
2302
+ gridCell.normalisedValue = GeneralConstants_1.BLANK_DISTINCT_COLUMN_VALUE;
2303
+ }
2301
2304
  addDistinctColumnValue(rowNode, columnId) {
2302
2305
  // we do not return the values of the aggregates when in grouping mode
2303
2306
  // otherwise they would appear in the filter dropdown etc....
@@ -2324,12 +2327,19 @@ class AdaptableAgGrid {
2324
2327
  }
2325
2328
  return uniqueVals.slice(0, this.api.columnFilterApi.internalApi.getFilterValuesMaxNumberOfItems(column));
2326
2329
  }
2327
- getGridCellsForColumn(columnId) {
2330
+ getGridCellsForColumn(columnId, includeBlanks = false) {
2328
2331
  let returnValues = [];
2329
2332
  this.agGridAdapter.getAgGridApi().forEachNode((rowNode) => {
2330
2333
  const gridCell = this.getGridCellFromRowNode(rowNode, columnId);
2331
- if (gridCell && gridCell.rawValue != undefined) {
2332
- returnValues.push(gridCell);
2334
+ if (gridCell) {
2335
+ if (gridCell.rawValue == undefined || gridCell.rawValue == null) {
2336
+ if (includeBlanks) {
2337
+ returnValues.push(gridCell);
2338
+ }
2339
+ }
2340
+ else {
2341
+ returnValues.push(gridCell);
2342
+ }
2333
2343
  }
2334
2344
  });
2335
2345
  return returnValues;
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
5
- PUBLISH_TIMESTAMP: 1713539999695 || Date.now(),
6
- VERSION: "18.0.3" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1714137352466 || Date.now(),
6
+ VERSION: "18.0.5" || '--current-version--',
7
7
  };
@@ -2292,6 +2292,16 @@ export declare const ADAPTABLE_METAMODEL: {
2292
2292
  ref?: undefined;
2293
2293
  })[];
2294
2294
  };
2295
+ CustomRenderFunction: {
2296
+ name: string;
2297
+ kind: string;
2298
+ desc: string;
2299
+ props: {
2300
+ name: string;
2301
+ kind: string;
2302
+ desc: string;
2303
+ }[];
2304
+ };
2295
2305
  CustomSettingsPanel: {
2296
2306
  name: string;
2297
2307
  kind: string;