@adaptabletools/adaptable 20.0.12 → 20.0.13

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": "20.0.12",
3
+ "version": "20.0.13",
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,6 +1,7 @@
1
1
  /**
2
2
  * Defines which Columns in a Layout display Aggregated values when Row-Grouped
3
3
  */
4
+ import { PivotTotalPosition } from '../LayoutState';
4
5
  export type AggregationColumnValue = string | true | WeightedAverageAggregation;
5
6
  /**
6
7
  * Defines an Aggregated Column in a Table Layout
@@ -24,9 +25,9 @@ export type PivotAggregationColumns = {
24
25
  /**
25
26
  * Whether to show the total for this column; it can be also customized for specific Pivot Columns
26
27
  */
27
- Total?: boolean | 'before' | 'after' | {
28
+ Total?: PivotTotalPosition | {
28
29
  PivotColumnId: string;
29
- ShowTotal?: boolean | 'before' | 'after';
30
+ ShowTotal?: PivotTotalPosition;
30
31
  }[];
31
32
  }[];
32
33
  export declare const WEIGHTED_AVERAGE_AGG_FN_NAME = "weightedAvg";
@@ -1,6 +1,3 @@
1
- /**
2
- * Defines which Columns in a Layout display Aggregated values when Row-Grouped
3
- */
4
1
  export const WEIGHTED_AVERAGE_AGG_FN_NAME = 'weightedAvg';
5
2
  export const isWeightedAverageAggFuncName = (aggFunc) => {
6
3
  return aggFunc === WEIGHTED_AVERAGE_AGG_FN_NAME;
@@ -155,12 +155,16 @@ export interface PivotLayout extends LayoutBase {
155
155
  /**
156
156
  * Display automatically calculated Totals of all Pivot Columns, in the position specified
157
157
  */
158
- PivotGrandTotal?: 'before' | 'after' | boolean;
158
+ PivotGrandTotal?: PivotTotalPosition;
159
159
  /**
160
160
  * Display automatically calculated Totals within EACH Pivot Column Group, in the position specified
161
161
  */
162
- PivotColumnTotal?: 'before' | 'after' | boolean;
162
+ PivotColumnTotal?: PivotTotalPosition;
163
163
  }
164
+ /**
165
+ * Defines the position of Pivot Total position - 'before' or 'after' the Value Column(s)
166
+ */
167
+ export type PivotTotalPosition = 'before' | 'after' | boolean;
164
168
  /**
165
169
  * Manages how (and which) Row Group values are stored
166
170
  */
@@ -179,7 +179,7 @@ const PivotColumnRow = (props) => {
179
179
  ' ',
180
180
  React.createElement(DropdownButton, { columns: ['label'], items: numericColumnsOptions, ml: 2 }, weightName))),
181
181
  aggValue && (React.createElement(Flex, { backgroundColor: "primary", ml: 3, alignItems: "center" },
182
- React.createElement(Text, null, "Total Column"),
182
+ React.createElement(Text, null, "Total"),
183
183
  ' ',
184
184
  React.createElement(DropdownButton, { columns: ['label'], items: totalOptions, ml: 2 }, currentTotal)))),
185
185
  hasPivotSpecificTotals && (React.createElement(Flex, { ml: 2, pl: 2, flexWrap: "wrap", flex: "1 1 auto", alignItems: "center", style: {
@@ -333,7 +333,7 @@ export const PivotAggregationsSection = (props) => {
333
333
  GrandTotalRow: value,
334
334
  });
335
335
  }, isClearable: true })),
336
- React.createElement(FormRow, { label: 'Grand Total Column' },
336
+ React.createElement(FormRow, { label: 'Pivot Grand Total' },
337
337
  React.createElement(Select, { style: { width: 120 }, options: ['before', 'after'].map((position) => {
338
338
  return {
339
339
  label: StringExtensions.CapitaliseFirstLetter(position),
@@ -345,7 +345,7 @@ export const PivotAggregationsSection = (props) => {
345
345
  PivotGrandTotal: value,
346
346
  });
347
347
  }, isClearable: true })),
348
- React.createElement(FormRow, { label: 'Pivot Group Total Column' }, isPivotColumnTotalEnabled === true ? (React.createElement(Select, { style: { width: 120 }, options: ['before', 'after'].map((position) => {
348
+ React.createElement(FormRow, { label: 'Pivot Column Total' }, isPivotColumnTotalEnabled === true ? (React.createElement(Select, { style: { width: 120 }, options: ['before', 'after'].map((position) => {
349
349
  return {
350
350
  label: StringExtensions.CapitaliseFirstLetter(position),
351
351
  value: position,
@@ -93,7 +93,7 @@ import { AgGridExportAdapter } from './AgGridExportAdapter';
93
93
  import { checkForDuplicateColumns, isPivotLayout, layoutModelToLayoutState, layoutStateToLayoutModel, normalizeLayout, } from '../Api/Implementation/LayoutHelpers';
94
94
  import { LayoutManager } from '../layout-manager/src';
95
95
  import { isPivotLayoutModel } from '../layout-manager/src/isPivotLayoutModel';
96
- import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, } from '../AdaptableState/Common/AdaptableColumn';
96
+ import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, PIVOT_AGGREGATION_TOTAL_COLUMN_TYPE, PIVOT_ANY_TOTAL_COLUMN_TYPE, PIVOT_COLUMN_TOTAL_COLUMN_TYPE, PIVOT_GRAND_TOTAL_COLUMN_TYPE, } from '../AdaptableState/Common/AdaptableColumn';
97
97
  import { agGridDataTypeDefinitions } from './agGridDataTypeDefinitions';
98
98
  import { AgGridThemeAdapter } from './AgGridThemeAdapter';
99
99
  import { mapOldTypeToDataType } from '../migration/VersionUpgrade20';
@@ -1076,6 +1076,10 @@ You need to define at least one Layout!`);
1076
1076
  [FREE_TEXT_COLUMN_TYPE]: {},
1077
1077
  [ACTION_COLUMN_TYPE]: {},
1078
1078
  [FDC3_COLUMN_TYPE]: {},
1079
+ [PIVOT_ANY_TOTAL_COLUMN_TYPE]: {},
1080
+ [PIVOT_GRAND_TOTAL_COLUMN_TYPE]: {},
1081
+ [PIVOT_COLUMN_TOTAL_COLUMN_TYPE]: {},
1082
+ [PIVOT_AGGREGATION_TOTAL_COLUMN_TYPE]: {},
1079
1083
  };
1080
1084
  const patchedColumnTypes = Object.assign({}, providedColumnTypes, adaptableSpecialColumnTypes);
1081
1085
  const customColumnTypes = this.api.columnApi.getColumnTypes() ?? [];
@@ -202,14 +202,32 @@ export class AgGridColumnAdapter {
202
202
  const quickSearchStyle = this.getQuickSearchCellStyle();
203
203
  const hasQuickSearchStyle = quickSearchStyle != undefined;
204
204
  const cellStyle = (params) => {
205
- const gridCell = this.adaptableApi.gridApi.getGridCellFromRowNode(params.node, abColumn.columnId);
205
+ const columnId = params.column.getColId();
206
+ const gridCell = this.adaptableApi.gridApi.getGridCellFromRowNode(params.node, columnId);
206
207
  if (!gridCell || !gridCell.column) {
207
208
  return {};
208
209
  }
209
210
  const isQuickSearchActive = hasQuickSearchStyle && this.isQuickSearchActive(gridCell, params);
210
- const userDefined = typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle;
211
+ let baseStyles = {};
212
+ // this is required because otherwise, when AG Grid filters, it refershed the pivotResultColDef and the base styles get lost
213
+ // if pivot result col: inherit styles from base column
214
+ if (this.adaptableApi.columnApi.isPivotResultColumn(columnId)) {
215
+ const baseColumn = params.column.getColDef()?.pivotValueColumn;
216
+ if (baseColumn) {
217
+ const baseColDefCellStyle = baseColumn?.getColDef()?.cellStyle;
218
+ const baseColParams = { ...params, column: baseColumn };
219
+ baseStyles =
220
+ typeof baseColDefCellStyle === 'function'
221
+ ? baseColDefCellStyle(baseColParams)
222
+ : baseColDefCellStyle;
223
+ }
224
+ }
225
+ else {
226
+ // inherit styles from user provided colDef property
227
+ baseStyles = typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle;
228
+ }
211
229
  const result = {
212
- ...userDefined,
230
+ ...baseStyles,
213
231
  ...this.getReadOnlyCellStyle(gridCell, params),
214
232
  ...this.getEditableCellStyle(gridCell, params),
215
233
  ...this.getEditedCellStyle(gridCell, params),
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: 1746136567034 || Date.now(),
4
- VERSION: "20.0.12" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1746196666403 || Date.now(),
4
+ VERSION: "20.0.13" || '--current-version--',
5
5
  };
@@ -4382,18 +4382,18 @@ export declare const ADAPTABLE_METAMODEL: {
4382
4382
  kind: string;
4383
4383
  desc: string;
4384
4384
  isOpt: boolean;
4385
- ref?: undefined;
4385
+ ref: string;
4386
4386
  } | {
4387
4387
  name: string;
4388
4388
  kind: string;
4389
4389
  desc: string;
4390
- isOpt: boolean;
4391
- ref: string;
4390
+ isOpt?: undefined;
4391
+ ref?: undefined;
4392
4392
  } | {
4393
4393
  name: string;
4394
4394
  kind: string;
4395
4395
  desc: string;
4396
- isOpt?: undefined;
4396
+ isOpt: boolean;
4397
4397
  ref?: undefined;
4398
4398
  })[];
4399
4399
  };