@adaptabletools/adaptable 21.0.0-canary.4 → 21.0.0-canary.6

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": "21.0.0-canary.4",
3
+ "version": "21.0.0-canary.6",
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",
@@ -149,7 +149,7 @@ const DefaultAdaptableOptions = {
149
149
  showDatePicker: true,
150
150
  columnFilterOptions: {
151
151
  indicateFilteredColumns: true,
152
- autoApplyColumnFilter: true,
152
+ manuallyApplyColumnFilter: false,
153
153
  defaultNumericColumnFilter: 'Equals',
154
154
  defaultTextColumnFilter: 'Contains',
155
155
  defaultDateColumnFilter: 'On',
@@ -79,13 +79,13 @@ export interface ColumnFilterOptions<TData = any> {
79
79
  */
80
80
  indicateFilteredColumns?: boolean;
81
81
  /**
82
- * Apply Column Filters immediately; if false an Apply Filter button is displayed and Quick Filter is disabled
82
+ * Manually apply Column Filters; an Apply Filter button is displayed and Quick Filter is disabled
83
83
  *
84
- * @defaultValue true
84
+ * @defaultValue false
85
85
  * @gridInfoItem
86
86
  * @noCodeItem
87
87
  */
88
- autoApplyColumnFilter?: boolean | ((context: AdaptableColumnContext) => boolean);
88
+ manuallyApplyColumnFilter?: boolean | ((context: AdaptableColumnContext) => boolean);
89
89
  /**
90
90
  * Default filter type for numeric Columns
91
91
  *
@@ -260,7 +260,7 @@ export interface CustomInFilterValuesContext<TData = any> extends AdaptableColum
260
260
  */
261
261
  currentSearchValue: string;
262
262
  /**
263
- * Previous filter result; avoids expensive recomputations (e.g for async op or server-side filtering)
263
+ * Last filter result; avoids expensive recomputations (eg if async or server-side filtering)
264
264
  */
265
265
  previousFilterResult?: InFilterValueResult;
266
266
  }
@@ -258,7 +258,7 @@ export type ColumnDirectionMap = {
258
258
  [columnId: string]: 'left' | 'right';
259
259
  };
260
260
  /**
261
- * State & behaviour for sizing a column (must set `width` or `flex` property, but not both); all other props optional
261
+ * State & behaviour for column sizing (must set `width` or `flex` but not both); all other props optional
262
262
  */
263
263
  export type ColumnSizingDefinition = ({
264
264
  Width?: number;
@@ -525,7 +525,7 @@ export class AlertInternalApi extends ApiBase {
525
525
  isValidExpression &&
526
526
  this.getAdaptableApi()
527
527
  .internalApi.getQueryLanguageService()
528
- .evaluateBooleanExpression(expression, 'Alert', rowNode, dataChangedEvent);
528
+ .evaluateBooleanExpression(expression, 'Alert', rowNode, { dataChangedEvent });
529
529
  }
530
530
  catch (error) {
531
531
  isSatisfiedExpression = false;
@@ -54,7 +54,7 @@ export declare class ColumnFilterInternalApi extends ApiBase {
54
54
  columnId: string;
55
55
  currentSearchValue: string;
56
56
  }): Promise<InFilterValueResult>;
57
- shouldAutoApplyColumnFilter(columnId: string): boolean;
57
+ shouldManuallyApplyColumnFilter(columnId: string): boolean;
58
58
  getAdaptableFilterHandler(columnId: string): AdaptableFilterHandler | undefined;
59
59
  getAllAdaptableFilterHandlers(): AdaptableFilterHandler[];
60
60
  }
@@ -263,21 +263,21 @@ export class ColumnFilterInternalApi extends ApiBase {
263
263
  }
264
264
  return columnFilterHandler.getFromCacheOrFetchFilterDisplayValues(newOptions);
265
265
  }
266
- shouldAutoApplyColumnFilter(columnId) {
267
- const autoApplyColumnFilterOpt = this.getOptionsApi().getFilterOptions().columnFilterOptions?.autoApplyColumnFilter;
268
- if (typeof autoApplyColumnFilterOpt === 'boolean') {
269
- return autoApplyColumnFilterOpt;
266
+ shouldManuallyApplyColumnFilter(columnId) {
267
+ const manuallyApplyColumnFilterOpt = this.getOptionsApi().getFilterOptions().columnFilterOptions?.manuallyApplyColumnFilter;
268
+ if (typeof manuallyApplyColumnFilterOpt === 'boolean') {
269
+ return manuallyApplyColumnFilterOpt;
270
270
  }
271
- if (typeof autoApplyColumnFilterOpt === 'function') {
271
+ if (typeof manuallyApplyColumnFilterOpt === 'function') {
272
272
  const column = this.getColumnApi().getColumnWithColumnId(columnId);
273
273
  const context = {
274
274
  column,
275
275
  ...this.getAdaptableApi().internalApi.buildBaseContext(),
276
276
  };
277
- return autoApplyColumnFilterOpt(context);
277
+ return manuallyApplyColumnFilterOpt(context);
278
278
  }
279
279
  // fallback, should never happen
280
- return true;
280
+ return false;
281
281
  }
282
282
  getAdaptableFilterHandler(columnId) {
283
283
  return this.getAgGridApi().getColumnFilterHandler(columnId);
@@ -1,4 +1,4 @@
1
- import { HeaderValueGetterParams, IRowNode } from 'ag-grid-enterprise';
1
+ import { Column, HeaderValueGetterParams, IRowNode } from 'ag-grid-enterprise';
2
2
  import { AdaptableColumn, AdaptableFormat, AdaptablePredicateDef, ColumnScope, FormatColumn, FormatColumnConfig, FormatColumnTarget, StringFormatterOptions } from '../../types';
3
3
  import { ApiBase } from '../Implementation/ApiBase';
4
4
  export declare class FormatColumnInternalApi extends ApiBase {
@@ -85,7 +85,7 @@ export declare class FormatColumnInternalApi extends ApiBase {
85
85
  * @param column
86
86
  * @param params
87
87
  */
88
- formatColumnShouldRenderInCell(formatColumn: FormatColumn, column: AdaptableColumn, rowNode: IRowNode, cellValue: any): boolean;
88
+ formatColumnShouldRenderInCell(formatColumn: FormatColumn, column: AdaptableColumn, rowNode: IRowNode, cellValue: any, pivotResultColumn?: Column): boolean;
89
89
  /**
90
90
  * Checks if format column is relevant for a given Column Header
91
91
  *
@@ -95,17 +95,6 @@ export declare class FormatColumnInternalApi extends ApiBase {
95
95
  formatColumnShouldRenderInHeader(formatColumn: FormatColumn, column: AdaptableColumn): boolean;
96
96
  private evaluatePredicate;
97
97
  private evaluateExpression;
98
- /**
99
- * Extract from the given FormatColumns only the ones which are relevant for a given cell (intersection of given AdaptableColumn and RowNode)
100
- *
101
- * @param formatColumns
102
- * @param column
103
- * @param params
104
- */
105
- getFormatColumnsRelevantForColumn(formatColumns: FormatColumn[], column: AdaptableColumn, params: {
106
- node: IRowNode;
107
- value: any;
108
- }): FormatColumn[];
109
98
  /**
110
99
  * Extract from the given FormatColumns the one which is the most relevant for a given cell (intersection of given AdaptableColumn and RowNode)
111
100
  *
@@ -222,7 +222,7 @@ export class FormatColumnInternalApi extends ApiBase {
222
222
  * @param column
223
223
  * @param params
224
224
  */
225
- formatColumnShouldRenderInCell(formatColumn, column, rowNode, cellValue) {
225
+ formatColumnShouldRenderInCell(formatColumn, column, rowNode, cellValue, pivotResultColumn) {
226
226
  // suspended is important to be first
227
227
  if (formatColumn.IsSuspended) {
228
228
  return false;
@@ -270,7 +270,7 @@ export class FormatColumnInternalApi extends ApiBase {
270
270
  return this.evaluatePredicate(formatColumn, predicateDefHandlerContext);
271
271
  } // then run the Expression
272
272
  else if (formatColumn.Rule.BooleanExpression) {
273
- return this.evaluateExpression(formatColumn, rowNode);
273
+ return this.evaluateExpression(formatColumn, rowNode, pivotResultColumn);
274
274
  }
275
275
  // nothing has passed then return false
276
276
  return false;
@@ -294,29 +294,19 @@ export class FormatColumnInternalApi extends ApiBase {
294
294
  evaluatePredicate(formatColumn, predicateDefHandlerContext) {
295
295
  return this.getPredicateApi().handleColumnPredicates(formatColumn.Rule?.Predicates, predicateDefHandlerContext, false);
296
296
  }
297
- evaluateExpression(formatColumn, node) {
297
+ evaluateExpression(formatColumn, node, pivotResultColumn) {
298
298
  const isValidExpression = this.getExpressionApi().isValidBooleanExpression(formatColumn.Rule.BooleanExpression, ModuleConstants.FormatColumnModuleId, `Invalid format column rule '${formatColumn.Rule.BooleanExpression}'`);
299
299
  try {
300
300
  return (isValidExpression &&
301
301
  this.getAdaptableApi()
302
302
  .internalApi.getQueryLanguageService()
303
- .evaluateBooleanExpression(formatColumn.Rule.BooleanExpression, ModuleConstants.FormatColumnModuleId, node));
303
+ .evaluateBooleanExpression(formatColumn.Rule.BooleanExpression, ModuleConstants.FormatColumnModuleId, node, { pivotResultColumn }));
304
304
  }
305
305
  catch (error) {
306
306
  errorOnce(error.message);
307
307
  return false;
308
308
  }
309
309
  }
310
- /**
311
- * Extract from the given FormatColumns only the ones which are relevant for a given cell (intersection of given AdaptableColumn and RowNode)
312
- *
313
- * @param formatColumns
314
- * @param column
315
- * @param params
316
- */
317
- getFormatColumnsRelevantForColumn(formatColumns, column, params) {
318
- return formatColumns.filter((formatColumn) => this.formatColumnShouldRenderInCell(formatColumn, column, params.node, params.value));
319
- }
320
310
  /**
321
311
  * Extract from the given FormatColumns the one which is the most relevant for a given cell (intersection of given AdaptableColumn and RowNode)
322
312
  *
@@ -85,7 +85,9 @@ export class FlashingCellModule extends AdaptableModuleBase {
85
85
  isValidExpression &&
86
86
  this.api.internalApi
87
87
  .getQueryLanguageService()
88
- .evaluateBooleanExpression(expression, this.moduleInfo.ModuleName, rowNode, cellDataChangedInfo);
88
+ .evaluateBooleanExpression(expression, this.moduleInfo.ModuleName, rowNode, {
89
+ dataChangedEvent: cellDataChangedInfo,
90
+ });
89
91
  }
90
92
  catch (error) {
91
93
  isSatisfiedExpression = false;
@@ -60,6 +60,14 @@ export const scalarExpressionFunctions = {
60
60
  if (!column.queryable) {
61
61
  throw new ExpressionEvaluationError('COL', `Column name "${columnId}" is not queryable`);
62
62
  }
63
+ // see #derived_pivot_cell_style
64
+ if (context.pivotResultColumn) {
65
+ const baseColumnId = context.pivotResultColumn.getColDef()?.pivotValueColumn?.getColId();
66
+ if (baseColumnId === columnId) {
67
+ // we evaluate the pivot result column instead of the base column
68
+ return context.adaptableApi?.gridApi.getNormalisedValueFromRowNode(context.node, context.pivotResultColumn.getColId());
69
+ }
70
+ }
63
71
  return context.adaptableApi?.gridApi.getNormalisedValueFromRowNode(context.node, columnId);
64
72
  },
65
73
  description: 'Returns the value of a Column',
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { IAdaptableService } from './IAdaptableService';
3
- import { IRowNode } from 'ag-grid-enterprise';
3
+ import { Column, IRowNode } from 'ag-grid-enterprise';
4
4
  import { CellDataChangedInfo } from '../../../AdaptableState/Common/CellDataChangedInfo';
5
5
  import { RowDataChangedInfo } from '../../../AdaptableState/Common/RowDataChangedInfo';
6
6
  import { AdaptableModule } from '../../../AdaptableState/Common/Types';
@@ -11,7 +11,10 @@ import { ScalarFunctionName } from '../../ExpressionFunctions/scalarExpressionFu
11
11
  import { ObservableFunctionName } from '../../ExpressionFunctions/observableExpressionFunctions';
12
12
  import { ExpressionFunctionMap } from '../../../parser/src/types';
13
13
  export interface IQueryLanguageService extends IAdaptableService {
14
- evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: IRowNode, dataChangedEvent?: CellDataChangedInfo): boolean;
14
+ evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: IRowNode, evalContext?: {
15
+ dataChangedEvent?: CellDataChangedInfo;
16
+ pivotResultColumn?: Column;
17
+ }): boolean;
15
18
  evaluateScalarExpression(expression: string, module: AdaptableModule, rowNode: IRowNode): any;
16
19
  evaluateObservableExpression(expression: string, module: AdaptableModule): Observable<CellDataChangedInfo | RowDataChangedInfo>;
17
20
  evaluateAggregatedBooleanExpression(expression: string, module: AdaptableModule): BooleanAggregationParameter;
@@ -1,4 +1,4 @@
1
- import { IRowNode } from 'ag-grid-enterprise';
1
+ import { Column, IRowNode } from 'ag-grid-enterprise';
2
2
  import { Observable } from 'rxjs';
3
3
  import { AdaptableApi, RowDataChangedInfo } from '../../../types';
4
4
  import { GlobalExpressionFunctionsContext } from '../../AdaptableOptions/ExpressionOptions';
@@ -16,7 +16,10 @@ export declare class QueryLanguageService implements IQueryLanguageService {
16
16
  private cacheAggregatedScalarValidation;
17
17
  private cacheModuleSpecificExpressionFunctions;
18
18
  constructor(adaptableApi: AdaptableApi);
19
- evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: any, dataChangedEvent?: CellDataChangedInfo): any;
19
+ evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: any, evalContext?: {
20
+ dataChangedEvent?: CellDataChangedInfo;
21
+ pivotResultColumn?: Column;
22
+ }): any;
20
23
  evaluateScalarExpression(expression: string, module: AdaptableModule, rowNode: IRowNode): any;
21
24
  evaluateAggregatedScalarExpression(expression: string, module: AdaptableModule, getRowNodes?: () => IRowNode[]): ScalarAggregationParameter;
22
25
  evaluateObservableExpression(reactiveExpression: string, module: AdaptableModule): Observable<CellDataChangedInfo | RowDataChangedInfo>;
@@ -17,7 +17,7 @@ export class QueryLanguageService {
17
17
  this.cacheAggregatedScalarValidation = new Map();
18
18
  this.cacheModuleSpecificExpressionFunctions = new Map();
19
19
  }
20
- evaluateBooleanExpression(expression, module, rowNode, dataChangedEvent) {
20
+ evaluateBooleanExpression(expression, module, rowNode, evalContext) {
21
21
  if (expression == undefined) {
22
22
  // should never happen, but just in case
23
23
  this.adaptableApi.logError('QueryLanguageService.evaluateBooleanExpression was called with an undefined expression');
@@ -29,7 +29,8 @@ export class QueryLanguageService {
29
29
  node: rowNode,
30
30
  functions: booleanAndScalarFunctions,
31
31
  evaluateCustomQueryVariable: this.evaluateCustomQueryVariable,
32
- dataChangedEvent,
32
+ dataChangedEvent: evalContext?.dataChangedEvent,
33
+ pivotResultColumn: evalContext?.pivotResultColumn,
33
34
  ...this.adaptableApi.internalApi.buildBaseContext(),
34
35
  });
35
36
  }
@@ -121,7 +122,7 @@ export class QueryLanguageService {
121
122
  newValue: 100,
122
123
  oldValue: 150,
123
124
  };
124
- this.evaluateBooleanExpression(expression, module, firstRowNode, dataChangedEvent);
125
+ this.evaluateBooleanExpression(expression, module, firstRowNode, { dataChangedEvent });
125
126
  const result = {
126
127
  isValid: true,
127
128
  errorMessage: '',
@@ -62,16 +62,16 @@ const AndOrInput = (props) => {
62
62
  };
63
63
  export const ColumnFilterComponent = (props) => {
64
64
  const adaptable = useAdaptable();
65
- const autoApplyColumnFilter = adaptable.api.filterApi.columnFilterApi.internalApi.shouldAutoApplyColumnFilter(props.columnId);
65
+ const manuallyApplyColumnFilter = adaptable.api.filterApi.columnFilterApi.internalApi.shouldManuallyApplyColumnFilter(props.columnId);
66
66
  const [predicateNotYetApplied, setPredicateNotYetApplied] = React.useState(props.predicate);
67
67
  const applyFilter = () => {
68
68
  props.onPredicateChange(currentPredicateRef.current);
69
69
  setPredicateNotYetApplied(undefined);
70
70
  };
71
71
  const onPredicateChange = (predicate) => {
72
- // even if autoApplyColumnFilter is false, when we explicitly clear the filter
72
+ // even if manuallyApplyColumnFilter is false, when we explicitly clear the filter
73
73
  // we want to apply the filter immediately
74
- if (autoApplyColumnFilter || !predicate) {
74
+ if (!manuallyApplyColumnFilter || !predicate) {
75
75
  props.onPredicateChange(predicate);
76
76
  }
77
77
  else {
@@ -95,7 +95,7 @@ export const ColumnFilterComponent = (props) => {
95
95
  };
96
96
  onPredicateChange(newPredicate);
97
97
  };
98
- const currentPredicate = autoApplyColumnFilter
98
+ const currentPredicate = !manuallyApplyColumnFilter
99
99
  ? props.predicate
100
100
  : predicateNotYetApplied ?? props.predicate;
101
101
  const currentPredicateRef = React.useRef(currentPredicate);
@@ -141,7 +141,7 @@ export const ColumnFilterComponent = (props) => {
141
141
  } }));
142
142
  }),
143
143
  isLastPredicateValid && filterPredicateDropdown),
144
- !autoApplyColumnFilter ? (React.createElement(React.Fragment, null,
144
+ manuallyApplyColumnFilter ? (React.createElement(React.Fragment, null,
145
145
  React.createElement(Box, { flex: 1, "data-name": "spacer" }),
146
146
  React.createElement(Flex, { pt: 2, className: "ab-ColumnFilter-actions", justifyContent: "space-between" },
147
147
  React.createElement(Box, { className: "ab-ColumnFilter-action-apply" },
@@ -14,7 +14,7 @@ export const FloatingFilter = (props) => {
14
14
  * The wrapper is in charge of constructing the correct column filter.
15
15
  */
16
16
  const isMultiple = props.predicate?.args?.length > 1;
17
- const isManualApply = !adaptable.api.filterApi.columnFilterApi.internalApi.shouldAutoApplyColumnFilter(props.columnId);
17
+ const isManualApply = adaptable.api.filterApi.columnFilterApi.internalApi.shouldManuallyApplyColumnFilter(props.columnId);
18
18
  const isInlineEditable = !isMultiple && !isManualApply;
19
19
  // only used when there is only one filter selected
20
20
  let singleFilterPredicateDef = null;
@@ -314,7 +314,13 @@ export class AgGridColumnAdapter {
314
314
  const baseColumn = params.column.getColDef()?.pivotValueColumn;
315
315
  if (baseColumn) {
316
316
  const baseColDefCellStyle = baseColumn?.getColDef()?.cellStyle;
317
- const baseColParams = { ...params, column: baseColumn };
317
+ const baseColParams = {
318
+ ...params,
319
+ column: baseColumn,
320
+ // @ts-ignore
321
+ // #derived_pivot_cell_style
322
+ __pivotResultColumn: params.column,
323
+ };
318
324
  baseStyles =
319
325
  typeof baseColDefCellStyle === 'function'
320
326
  ? baseColDefCellStyle(baseColParams)
@@ -1139,7 +1145,9 @@ export class AgGridColumnAdapter {
1139
1145
  return {};
1140
1146
  }
1141
1147
  const relevantFormatColumnsWithStyle = activeFormatColumnsWithStyle.filter((formatColumn) => {
1142
- return this.adaptableApi.formatColumnApi.internalApi.formatColumnShouldRenderInCell(formatColumn, abColumn, params.node, params.value);
1148
+ return this.adaptableApi.formatColumnApi.internalApi.formatColumnShouldRenderInCell(formatColumn, abColumn, params.node, params.value,
1149
+ // @ts-ignore see #derived_pivot_cell_style
1150
+ params.__pivotResultColumn);
1143
1151
  });
1144
1152
  return this.getFormatColumnAdaptableStyle(relevantFormatColumnsWithStyle);
1145
1153
  }
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  NEXT_PUBLIC_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: 1757087858380 || Date.now(),
4
- VERSION: "21.0.0-canary.4" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1757310399525 || Date.now(),
4
+ VERSION: "21.0.0-canary.6" || '--current-version--',
5
5
  };
@@ -1953,32 +1953,32 @@ export declare const ADAPTABLE_METAMODEL: {
1953
1953
  desc: string;
1954
1954
  isOpt: boolean;
1955
1955
  gridInfo: string;
1956
- noCode: string;
1957
1956
  defVal: string;
1957
+ noCode?: undefined;
1958
1958
  } | {
1959
1959
  name: string;
1960
1960
  kind: string;
1961
1961
  desc: string;
1962
1962
  isOpt: boolean;
1963
- gridInfo: string;
1964
1963
  defVal: string;
1964
+ gridInfo?: undefined;
1965
1965
  noCode?: undefined;
1966
1966
  } | {
1967
1967
  name: string;
1968
1968
  kind: string;
1969
1969
  desc: string;
1970
1970
  isOpt: boolean;
1971
+ gridInfo: string;
1972
+ noCode: string;
1971
1973
  defVal: string;
1972
- gridInfo?: undefined;
1973
- noCode?: undefined;
1974
1974
  } | {
1975
1975
  name: string;
1976
1976
  kind: string;
1977
1977
  desc: string;
1978
1978
  isOpt: boolean;
1979
1979
  gridInfo?: undefined;
1980
- noCode?: undefined;
1981
1980
  defVal?: undefined;
1981
+ noCode?: undefined;
1982
1982
  } | {
1983
1983
  name: string;
1984
1984
  kind: string;