@adaptabletools/adaptable 18.0.3 → 18.0.4

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": "18.0.3",
3
+ "version": "18.0.4",
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;
@@ -351,6 +351,10 @@ export class AdaptableInternalApi extends ApiBase {
351
351
  var _a;
352
352
  return (_a = SystemRedux.SystemPreviousGroupedColumnsSelector(this.getAdaptableState().System)) === null || _a === void 0 ? void 0 : _a[layoutId];
353
353
  }
354
+ /**
355
+ * Gets a value from a rowData object using a field name.
356
+ * Supports deep values (e.g. fieldName = 'address.street')
357
+ */
354
358
  // "borrowed" from https://github.com/ag-grid/ag-grid/blob/v28.2.1/community-modules/core/src/ts/utils/object.ts#L205
355
359
  getValueUsingField(rowData, fieldName) {
356
360
  if (!rowData || !(fieldName === null || fieldName === void 0 ? void 0 : fieldName.length)) {
@@ -372,6 +376,10 @@ export class AdaptableInternalApi extends ApiBase {
372
376
  }
373
377
  return currentObject;
374
378
  }
379
+ /**
380
+ * Sets a value in a rowData object using a field name.
381
+ * Supports deep values (e.g. fieldName = 'address.street')
382
+ */
375
383
  // "borrowed" from https://github.com/ag-grid/ag-grid/blob/v28.2.1/community-modules/core/src/ts/valueService/valueService.ts#L236
376
384
  setValueUsingField(rowData, fieldName, newValue) {
377
385
  if (!rowData || !(fieldName === null || fieldName === void 0 ? void 0 : fieldName.length)) {
@@ -400,6 +408,10 @@ export class AdaptableInternalApi extends ApiBase {
400
408
  }
401
409
  }
402
410
  else {
411
+ // 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)
412
+ if (currentObject[fieldPiece] == null) {
413
+ currentObject[fieldPiece] = {};
414
+ }
403
415
  currentObject = currentObject[fieldPiece];
404
416
  }
405
417
  }
@@ -6,6 +6,7 @@ import NumberExtensions from '../../Utilities/Extensions/NumberExtensions';
6
6
  import { convertAdaptableStyleToCSS } from '../../Utilities/Helpers/StyleHelper';
7
7
  import UIHelper from '../../View/UIHelper';
8
8
  import { createBaseContext } from '../../Utilities/ObjectFactory';
9
+ import { BLANK_DISTINCT_COLUMN_VALUE } from '../../Utilities/Constants/GeneralConstants';
9
10
  export class GridInternalApi extends ApiBase {
10
11
  /**
11
12
  * Fires Grid Sorted Event
@@ -64,7 +65,7 @@ export class GridInternalApi extends ApiBase {
64
65
  * @param columnFilter Current applied filter
65
66
  */
66
67
  async getDistinctFilterDisplayValuesForColumn(columnId, filter, showFilteredRowsOnly) {
67
- var _a;
68
+ var _a, _b;
68
69
  const abColumn = this.getColumnApi().getColumnWithColumnId(columnId);
69
70
  if (abColumn == undefined) {
70
71
  return {
@@ -72,8 +73,10 @@ export class GridInternalApi extends ApiBase {
72
73
  suppressClientSideFilter: false,
73
74
  };
74
75
  }
76
+ const addBlankValue = this.getColumnFilterOptions().valuesFilterOptions.includeBlankFilterValues;
75
77
  const distinctValuesParams = {
76
78
  visibleRowsOnly: showFilteredRowsOnly,
79
+ addBlankValue: addBlankValue,
77
80
  };
78
81
  const { gridCells, suppressClientSideFilter } = await this.getDistinctFilterListValuesForColumn(abColumn, filter, distinctValuesParams);
79
82
  const sortedDistinctValues = this.sortDistinctValues(gridCells, abColumn);
@@ -84,12 +87,19 @@ export class GridInternalApi extends ApiBase {
84
87
  shouldShowValuesCount = showValuesCountFunction(columnFilterContext);
85
88
  }
86
89
  if (shouldShowValuesCount) {
87
- const allColumnDisplayValues = (_a = this.adaptable
88
- .getGridCellsForColumn(columnId)) === null || _a === void 0 ? void 0 : _a.map((gc) => {
89
- return gc.displayValue;
90
- });
90
+ const allColumnDisplayValues = addBlankValue
91
+ ? (_a = this.adaptable.getGridCellsForColumn(columnId, true)) === null || _a === void 0 ? void 0 : _a.map((gc) => {
92
+ var _a;
93
+ return (_a = gc.displayValue) !== null && _a !== void 0 ? _a : BLANK_DISTINCT_COLUMN_VALUE;
94
+ })
95
+ : (_b = this.adaptable.getGridCellsForColumn(columnId)) === null || _b === void 0 ? void 0 : _b.map((gc) => {
96
+ return gc.displayValue;
97
+ });
98
+ const newsortedDistinctValues = addBlankValue
99
+ ? sortedDistinctValues
100
+ : sortedDistinctValues.filter((gc) => gc.displayValue !== undefined);
91
101
  return {
92
- values: sortedDistinctValues.map((cv) => {
102
+ values: newsortedDistinctValues.map((cv) => {
93
103
  const label = cv.displayValue +
94
104
  NumberExtensions.WrapInParentheses(ArrayExtensions.getOccurrence(allColumnDisplayValues, cv.displayValue));
95
105
  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
@@ -98,6 +98,10 @@ export class RowSummaryService {
98
98
  return {
99
99
  Position,
100
100
  RowData: Object.entries(ColumnsMap !== null && ColumnsMap !== void 0 ? ColumnsMap : {}).reduce((acc, [columnId, expression]) => {
101
+ var _a, _b;
102
+ if (columnId === 'Uuid' || columnId === 'Source') {
103
+ return acc;
104
+ }
101
105
  const key = `${columnId}-${expression}`;
102
106
  let expressionLiveValue = this.cachedCellSummary.get(key);
103
107
  if (expressionLiveValue) {
@@ -139,7 +143,9 @@ export class RowSummaryService {
139
143
  value = Helper.roundNumber(value, 2);
140
144
  }
141
145
  }
142
- acc[columnId] = value;
146
+ const column = this.api.columnApi.getColumnWithColumnId(columnId);
147
+ 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;
148
+ acc = this.api.internalApi.setValueUsingField(acc, fieldName, value);
143
149
  return acc;
144
150
  }, {
145
151
  [ROW_SUMMARY_ROW_ID]: true,
@@ -12,6 +12,7 @@ export const ExternalRenderer = (_a) => {
12
12
  if (render) {
13
13
  const html = render({
14
14
  visible: true,
15
+ phase: 'onMount',
15
16
  element,
16
17
  adaptableApi,
17
18
  userName: adaptableApi.optionsApi.getUserName(),
@@ -26,6 +27,7 @@ export const ExternalRenderer = (_a) => {
26
27
  if (render) {
27
28
  render({
28
29
  visible: false,
30
+ phase: 'onDestroy',
29
31
  element: element,
30
32
  adaptableApi,
31
33
  userName: adaptableApi.optionsApi.getUserName(),
@@ -17,6 +17,7 @@ export const CustomToolPanelContent = (props) => {
17
17
  if (hasCustomRenderFn(customToolPanel)) {
18
18
  const customRenderContext = {
19
19
  visible: true,
20
+ phase: 'onMount',
20
21
  element,
21
22
  adaptableApi: api,
22
23
  userName: api.optionsApi.getUserName(),
@@ -32,6 +33,7 @@ export const CustomToolPanelContent = (props) => {
32
33
  if (hasCustomRenderFn(customToolPanel)) {
33
34
  customToolPanel.render({
34
35
  visible: false,
36
+ phase: 'onDestroy',
35
37
  element,
36
38
  adaptableApi: api,
37
39
  userName: api.optionsApi.getUserName(),
@@ -19,6 +19,7 @@ export const CustomToolbarCmp = (props) => {
19
19
  if (props.customToolbar.render) {
20
20
  const html = props.customToolbar.render({
21
21
  visible: true,
22
+ phase: 'onMount',
22
23
  element,
23
24
  adaptableApi,
24
25
  userName: adaptableApi.optionsApi.getUserName(),
@@ -35,6 +36,7 @@ export const CustomToolbarCmp = (props) => {
35
36
  if (props.customToolbar.render) {
36
37
  props.customToolbar.render({
37
38
  visible: false,
39
+ phase: 'onDestroy',
38
40
  element,
39
41
  adaptableApi,
40
42
  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[];
@@ -540,7 +540,7 @@ export class AdaptableAgGrid {
540
540
  */
541
541
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'context', (original_context) => {
542
542
  const userContext = original_context || {};
543
- return Object.assign(Object.assign({}, userContext), { __adaptable: this });
543
+ return Object.assign(Object.assign({}, userContext), { __adaptable: this, adaptableApi: this.api });
544
544
  });
545
545
  /**
546
546
  * `gridId`
@@ -2271,9 +2271,10 @@ export class AdaptableAgGrid {
2271
2271
  if (distinctValuesParams.visibleRowsOnly) {
2272
2272
  this.agGridAdapter.getAgGridApi().forEachNodeAfterFilter((rowNode) => {
2273
2273
  const gridCell = this.addDistinctColumnValue(rowNode, column.columnId);
2274
- if (gridCell &&
2275
- gridCell.rawValue != undefined &&
2276
- gridCell.rowNode !== distinctValuesParams.skipRowNode) {
2274
+ if (gridCell && gridCell.rowNode !== distinctValuesParams.skipRowNode) {
2275
+ if (gridCell.rawValue == undefined && distinctValuesParams.addBlankValue) {
2276
+ this.addBlankValueToGridCell(gridCell);
2277
+ }
2277
2278
  gridCells.push(gridCell);
2278
2279
  }
2279
2280
  });
@@ -2282,11 +2283,8 @@ export class AdaptableAgGrid {
2282
2283
  this.agGridAdapter.getAgGridApi().forEachNode((rowNode) => {
2283
2284
  const gridCell = this.addDistinctColumnValue(rowNode, column.columnId);
2284
2285
  if (gridCell && gridCell.rowNode !== distinctValuesParams.skipRowNode) {
2285
- if (gridCell.rawValue == undefined &&
2286
- this.adaptableOptions.columnFilterOptions.valuesFilterOptions.includeBlankFilterValues) {
2287
- gridCell.rawValue = BLANK_DISTINCT_COLUMN_VALUE;
2288
- gridCell.displayValue = BLANK_DISTINCT_COLUMN_VALUE;
2289
- gridCell.normalisedValue = BLANK_DISTINCT_COLUMN_VALUE;
2286
+ if (gridCell.rawValue == undefined && distinctValuesParams.addBlankValue) {
2287
+ this.addBlankValueToGridCell(gridCell);
2290
2288
  }
2291
2289
  gridCells.push(gridCell);
2292
2290
  }
@@ -2294,6 +2292,11 @@ export class AdaptableAgGrid {
2294
2292
  }
2295
2293
  return gridCells;
2296
2294
  }
2295
+ addBlankValueToGridCell(gridCell) {
2296
+ gridCell.rawValue = BLANK_DISTINCT_COLUMN_VALUE;
2297
+ gridCell.displayValue = BLANK_DISTINCT_COLUMN_VALUE;
2298
+ gridCell.normalisedValue = BLANK_DISTINCT_COLUMN_VALUE;
2299
+ }
2297
2300
  addDistinctColumnValue(rowNode, columnId) {
2298
2301
  // we do not return the values of the aggregates when in grouping mode
2299
2302
  // otherwise they would appear in the filter dropdown etc....
@@ -2320,12 +2323,19 @@ export class AdaptableAgGrid {
2320
2323
  }
2321
2324
  return uniqueVals.slice(0, this.api.columnFilterApi.internalApi.getFilterValuesMaxNumberOfItems(column));
2322
2325
  }
2323
- getGridCellsForColumn(columnId) {
2326
+ getGridCellsForColumn(columnId, includeBlanks = false) {
2324
2327
  let returnValues = [];
2325
2328
  this.agGridAdapter.getAgGridApi().forEachNode((rowNode) => {
2326
2329
  const gridCell = this.getGridCellFromRowNode(rowNode, columnId);
2327
- if (gridCell && gridCell.rawValue != undefined) {
2328
- returnValues.push(gridCell);
2330
+ if (gridCell) {
2331
+ if (gridCell.rawValue == undefined || gridCell.rawValue == null) {
2332
+ if (includeBlanks) {
2333
+ returnValues.push(gridCell);
2334
+ }
2335
+ }
2336
+ else {
2337
+ returnValues.push(gridCell);
2338
+ }
2329
2339
  }
2330
2340
  });
2331
2341
  return returnValues;
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  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" || '',
3
- PUBLISH_TIMESTAMP: 1713539968514 || Date.now(),
4
- VERSION: "18.0.3" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1713957370862 || Date.now(),
4
+ VERSION: "18.0.4" || '--current-version--',
5
5
  };
@@ -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;