@adaptabletools/adaptable-cjs 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-cjs",
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",
@@ -153,7 +153,7 @@ const DefaultAdaptableOptions = {
153
153
  showDatePicker: true,
154
154
  columnFilterOptions: {
155
155
  indicateFilteredColumns: true,
156
- autoApplyColumnFilter: true,
156
+ manuallyApplyColumnFilter: false,
157
157
  defaultNumericColumnFilter: 'Equals',
158
158
  defaultTextColumnFilter: 'Contains',
159
159
  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;
@@ -529,7 +529,7 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
529
529
  isValidExpression &&
530
530
  this.getAdaptableApi()
531
531
  .internalApi.getQueryLanguageService()
532
- .evaluateBooleanExpression(expression, 'Alert', rowNode, dataChangedEvent);
532
+ .evaluateBooleanExpression(expression, 'Alert', rowNode, { dataChangedEvent });
533
533
  }
534
534
  catch (error) {
535
535
  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
  }
@@ -267,21 +267,21 @@ class ColumnFilterInternalApi extends ApiBase_1.ApiBase {
267
267
  }
268
268
  return columnFilterHandler.getFromCacheOrFetchFilterDisplayValues(newOptions);
269
269
  }
270
- shouldAutoApplyColumnFilter(columnId) {
271
- const autoApplyColumnFilterOpt = this.getOptionsApi().getFilterOptions().columnFilterOptions?.autoApplyColumnFilter;
272
- if (typeof autoApplyColumnFilterOpt === 'boolean') {
273
- return autoApplyColumnFilterOpt;
270
+ shouldManuallyApplyColumnFilter(columnId) {
271
+ const manuallyApplyColumnFilterOpt = this.getOptionsApi().getFilterOptions().columnFilterOptions?.manuallyApplyColumnFilter;
272
+ if (typeof manuallyApplyColumnFilterOpt === 'boolean') {
273
+ return manuallyApplyColumnFilterOpt;
274
274
  }
275
- if (typeof autoApplyColumnFilterOpt === 'function') {
275
+ if (typeof manuallyApplyColumnFilterOpt === 'function') {
276
276
  const column = this.getColumnApi().getColumnWithColumnId(columnId);
277
277
  const context = {
278
278
  column,
279
279
  ...this.getAdaptableApi().internalApi.buildBaseContext(),
280
280
  };
281
- return autoApplyColumnFilterOpt(context);
281
+ return manuallyApplyColumnFilterOpt(context);
282
282
  }
283
283
  // fallback, should never happen
284
- return true;
284
+ return false;
285
285
  }
286
286
  getAdaptableFilterHandler(columnId) {
287
287
  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
  *
@@ -226,7 +226,7 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
226
226
  * @param column
227
227
  * @param params
228
228
  */
229
- formatColumnShouldRenderInCell(formatColumn, column, rowNode, cellValue) {
229
+ formatColumnShouldRenderInCell(formatColumn, column, rowNode, cellValue, pivotResultColumn) {
230
230
  // suspended is important to be first
231
231
  if (formatColumn.IsSuspended) {
232
232
  return false;
@@ -274,7 +274,7 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
274
274
  return this.evaluatePredicate(formatColumn, predicateDefHandlerContext);
275
275
  } // then run the Expression
276
276
  else if (formatColumn.Rule.BooleanExpression) {
277
- return this.evaluateExpression(formatColumn, rowNode);
277
+ return this.evaluateExpression(formatColumn, rowNode, pivotResultColumn);
278
278
  }
279
279
  // nothing has passed then return false
280
280
  return false;
@@ -298,29 +298,19 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
298
298
  evaluatePredicate(formatColumn, predicateDefHandlerContext) {
299
299
  return this.getPredicateApi().handleColumnPredicates(formatColumn.Rule?.Predicates, predicateDefHandlerContext, false);
300
300
  }
301
- evaluateExpression(formatColumn, node) {
301
+ evaluateExpression(formatColumn, node, pivotResultColumn) {
302
302
  const isValidExpression = this.getExpressionApi().isValidBooleanExpression(formatColumn.Rule.BooleanExpression, ModuleConstants.FormatColumnModuleId, `Invalid format column rule '${formatColumn.Rule.BooleanExpression}'`);
303
303
  try {
304
304
  return (isValidExpression &&
305
305
  this.getAdaptableApi()
306
306
  .internalApi.getQueryLanguageService()
307
- .evaluateBooleanExpression(formatColumn.Rule.BooleanExpression, ModuleConstants.FormatColumnModuleId, node));
307
+ .evaluateBooleanExpression(formatColumn.Rule.BooleanExpression, ModuleConstants.FormatColumnModuleId, node, { pivotResultColumn }));
308
308
  }
309
309
  catch (error) {
310
310
  (0, AdaptableLogger_1.errorOnce)(error.message);
311
311
  return false;
312
312
  }
313
313
  }
314
- /**
315
- * Extract from the given FormatColumns only the ones which are relevant for a given cell (intersection of given AdaptableColumn and RowNode)
316
- *
317
- * @param formatColumns
318
- * @param column
319
- * @param params
320
- */
321
- getFormatColumnsRelevantForColumn(formatColumns, column, params) {
322
- return formatColumns.filter((formatColumn) => this.formatColumnShouldRenderInCell(formatColumn, column, params.node, params.value));
323
- }
324
314
  /**
325
315
  * Extract from the given FormatColumns the one which is the most relevant for a given cell (intersection of given AdaptableColumn and RowNode)
326
316
  *
@@ -89,7 +89,9 @@ class FlashingCellModule extends AdaptableModuleBase_1.AdaptableModuleBase {
89
89
  isValidExpression &&
90
90
  this.api.internalApi
91
91
  .getQueryLanguageService()
92
- .evaluateBooleanExpression(expression, this.moduleInfo.ModuleName, rowNode, cellDataChangedInfo);
92
+ .evaluateBooleanExpression(expression, this.moduleInfo.ModuleName, rowNode, {
93
+ dataChangedEvent: cellDataChangedInfo,
94
+ });
93
95
  }
94
96
  catch (error) {
95
97
  isSatisfiedExpression = false;
@@ -64,6 +64,14 @@ exports.scalarExpressionFunctions = {
64
64
  if (!column.queryable) {
65
65
  throw new ExpressionEvaluationError_1.ExpressionEvaluationError('COL', `Column name "${columnId}" is not queryable`);
66
66
  }
67
+ // see #derived_pivot_cell_style
68
+ if (context.pivotResultColumn) {
69
+ const baseColumnId = context.pivotResultColumn.getColDef()?.pivotValueColumn?.getColId();
70
+ if (baseColumnId === columnId) {
71
+ // we evaluate the pivot result column instead of the base column
72
+ return context.adaptableApi?.gridApi.getNormalisedValueFromRowNode(context.node, context.pivotResultColumn.getColId());
73
+ }
74
+ }
67
75
  return context.adaptableApi?.gridApi.getNormalisedValueFromRowNode(context.node, columnId);
68
76
  },
69
77
  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>;
@@ -21,7 +21,7 @@ class QueryLanguageService {
21
21
  this.cacheAggregatedScalarValidation = new Map();
22
22
  this.cacheModuleSpecificExpressionFunctions = new Map();
23
23
  }
24
- evaluateBooleanExpression(expression, module, rowNode, dataChangedEvent) {
24
+ evaluateBooleanExpression(expression, module, rowNode, evalContext) {
25
25
  if (expression == undefined) {
26
26
  // should never happen, but just in case
27
27
  this.adaptableApi.logError('QueryLanguageService.evaluateBooleanExpression was called with an undefined expression');
@@ -33,7 +33,8 @@ class QueryLanguageService {
33
33
  node: rowNode,
34
34
  functions: booleanAndScalarFunctions,
35
35
  evaluateCustomQueryVariable: this.evaluateCustomQueryVariable,
36
- dataChangedEvent,
36
+ dataChangedEvent: evalContext?.dataChangedEvent,
37
+ pivotResultColumn: evalContext?.pivotResultColumn,
37
38
  ...this.adaptableApi.internalApi.buildBaseContext(),
38
39
  });
39
40
  }
@@ -125,7 +126,7 @@ class QueryLanguageService {
125
126
  newValue: 100,
126
127
  oldValue: 150,
127
128
  };
128
- this.evaluateBooleanExpression(expression, module, firstRowNode, dataChangedEvent);
129
+ this.evaluateBooleanExpression(expression, module, firstRowNode, { dataChangedEvent });
129
130
  const result = {
130
131
  isValid: true,
131
132
  errorMessage: '',
@@ -66,16 +66,16 @@ const AndOrInput = (props) => {
66
66
  };
67
67
  const ColumnFilterComponent = (props) => {
68
68
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
69
- const autoApplyColumnFilter = adaptable.api.filterApi.columnFilterApi.internalApi.shouldAutoApplyColumnFilter(props.columnId);
69
+ const manuallyApplyColumnFilter = adaptable.api.filterApi.columnFilterApi.internalApi.shouldManuallyApplyColumnFilter(props.columnId);
70
70
  const [predicateNotYetApplied, setPredicateNotYetApplied] = React.useState(props.predicate);
71
71
  const applyFilter = () => {
72
72
  props.onPredicateChange(currentPredicateRef.current);
73
73
  setPredicateNotYetApplied(undefined);
74
74
  };
75
75
  const onPredicateChange = (predicate) => {
76
- // even if autoApplyColumnFilter is false, when we explicitly clear the filter
76
+ // even if manuallyApplyColumnFilter is false, when we explicitly clear the filter
77
77
  // we want to apply the filter immediately
78
- if (autoApplyColumnFilter || !predicate) {
78
+ if (!manuallyApplyColumnFilter || !predicate) {
79
79
  props.onPredicateChange(predicate);
80
80
  }
81
81
  else {
@@ -99,7 +99,7 @@ const ColumnFilterComponent = (props) => {
99
99
  };
100
100
  onPredicateChange(newPredicate);
101
101
  };
102
- const currentPredicate = autoApplyColumnFilter
102
+ const currentPredicate = !manuallyApplyColumnFilter
103
103
  ? props.predicate
104
104
  : predicateNotYetApplied ?? props.predicate;
105
105
  const currentPredicateRef = React.useRef(currentPredicate);
@@ -145,7 +145,7 @@ const ColumnFilterComponent = (props) => {
145
145
  } }));
146
146
  }),
147
147
  isLastPredicateValid && filterPredicateDropdown),
148
- !autoApplyColumnFilter ? (React.createElement(React.Fragment, null,
148
+ manuallyApplyColumnFilter ? (React.createElement(React.Fragment, null,
149
149
  React.createElement(rebass_1.Box, { flex: 1, "data-name": "spacer" }),
150
150
  React.createElement(rebass_1.Flex, { pt: 2, className: "ab-ColumnFilter-actions", justifyContent: "space-between" },
151
151
  React.createElement(rebass_1.Box, { className: "ab-ColumnFilter-action-apply" },
@@ -18,7 +18,7 @@ const FloatingFilter = (props) => {
18
18
  * The wrapper is in charge of constructing the correct column filter.
19
19
  */
20
20
  const isMultiple = props.predicate?.args?.length > 1;
21
- const isManualApply = !adaptable.api.filterApi.columnFilterApi.internalApi.shouldAutoApplyColumnFilter(props.columnId);
21
+ const isManualApply = adaptable.api.filterApi.columnFilterApi.internalApi.shouldManuallyApplyColumnFilter(props.columnId);
22
22
  const isInlineEditable = !isMultiple && !isManualApply;
23
23
  // only used when there is only one filter selected
24
24
  let singleFilterPredicateDef = null;
@@ -319,7 +319,13 @@ class AgGridColumnAdapter {
319
319
  const baseColumn = params.column.getColDef()?.pivotValueColumn;
320
320
  if (baseColumn) {
321
321
  const baseColDefCellStyle = baseColumn?.getColDef()?.cellStyle;
322
- const baseColParams = { ...params, column: baseColumn };
322
+ const baseColParams = {
323
+ ...params,
324
+ column: baseColumn,
325
+ // @ts-ignore
326
+ // #derived_pivot_cell_style
327
+ __pivotResultColumn: params.column,
328
+ };
323
329
  baseStyles =
324
330
  typeof baseColDefCellStyle === 'function'
325
331
  ? baseColDefCellStyle(baseColParams)
@@ -1144,7 +1150,9 @@ class AgGridColumnAdapter {
1144
1150
  return {};
1145
1151
  }
1146
1152
  const relevantFormatColumnsWithStyle = activeFormatColumnsWithStyle.filter((formatColumn) => {
1147
- return this.adaptableApi.formatColumnApi.internalApi.formatColumnShouldRenderInCell(formatColumn, abColumn, params.node, params.value);
1153
+ return this.adaptableApi.formatColumnApi.internalApi.formatColumnShouldRenderInCell(formatColumn, abColumn, params.node, params.value,
1154
+ // @ts-ignore see #derived_pivot_cell_style
1155
+ params.__pivotResultColumn);
1148
1156
  });
1149
1157
  return this.getFormatColumnAdaptableStyle(relevantFormatColumnsWithStyle);
1150
1158
  }
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  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" || '',
5
- PUBLISH_TIMESTAMP: 1757087891356 || Date.now(),
6
- VERSION: "21.0.0-canary.4" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1757310431328 || Date.now(),
6
+ VERSION: "21.0.0-canary.6" || '--current-version--',
7
7
  };
@@ -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;