@adaptabletools/adaptable-cjs 20.3.0-canary.2 → 20.3.0

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.
Files changed (31) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableOptions/ColumnOptions.d.ts +38 -154
  3. package/src/AdaptableState/Common/CustomWindowConfig.d.ts +11 -11
  4. package/src/AdaptableState/Common/ProgressIndicatorConfig.d.ts +1 -4
  5. package/src/AdaptableState/Common/RowScope.d.ts +1 -1
  6. package/src/AdaptableState/FormatColumnState.d.ts +8 -8
  7. package/src/Api/Internal/ColumnInternalApi.js +2 -2
  8. package/src/Api/Internal/FormatColumnInternalApi.d.ts +4 -2
  9. package/src/Api/Internal/FormatColumnInternalApi.js +32 -3
  10. package/src/Strategy/FormatColumnModule.js +2 -0
  11. package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsTargetItems.d.ts +5 -0
  12. package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsTargetItems.js +16 -0
  13. package/src/Utilities/ObjectFactory.js +1 -0
  14. package/src/Utilities/getScopeViewItems.js +6 -2
  15. package/src/View/Components/NewScopeComponent.js +5 -1
  16. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
  17. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +4 -0
  18. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +0 -39
  19. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +24 -23
  20. package/src/View/FormatColumn/Wizard/FormatColumnTargetWizardSection.d.ts +8 -0
  21. package/src/View/FormatColumn/Wizard/FormatColumnTargetWizardSection.js +37 -0
  22. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +18 -4
  23. package/src/agGrid/AdaptableAgGrid.js +5 -2
  24. package/src/agGrid/AgGridColumnAdapter.d.ts +1 -1
  25. package/src/agGrid/AgGridColumnAdapter.js +5 -4
  26. package/src/agGrid/AgGridExportAdapter.js +1 -1
  27. package/src/env.js +2 -2
  28. package/src/metamodel/adaptable.metamodel.d.ts +102 -1
  29. package/src/metamodel/adaptable.metamodel.js +1 -1
  30. package/src/types.d.ts +1 -1
  31. package/tsconfig.cjs.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-cjs",
3
- "version": "20.3.0-canary.2",
3
+ "version": "20.3.0",
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",
@@ -57,6 +57,9 @@ export interface BaseColumnHeaderContext extends BaseContext {
57
57
  */
58
58
  currentLayout: Layout;
59
59
  }
60
+ /**
61
+ * Context for Columns created automatically by AG Grid when grouping
62
+ */
60
63
  export interface AutoGroupColumnHeaderContext extends BaseColumnHeaderContext {
61
64
  /**
62
65
  * Auto-generated Group Column when GroupDisplayType is `single` column
@@ -71,11 +74,14 @@ export interface AutoGroupColumnHeaderContext extends BaseColumnHeaderContext {
71
74
  */
72
75
  groupedColumnIds: string[];
73
76
  }
77
+ /**
78
+ * Context for Columns created when Row Grouping
79
+ */
74
80
  export interface RowGroupColumnHeaderContext extends BaseColumnHeaderContext {
75
81
  /**
76
- * Group Columns - see `TableLayout.RowGroupedColumns` or `PivotLayout.PivotGroupedColumns`
82
+ * A Row Grouped Column - see `TableLayout.RowGroupedColumns` or `PivotLayout.PivotGroupedColumns`
77
83
  */
78
- columnType: 'groupColumn';
84
+ columnType: 'rowGroupColumn';
79
85
  /**
80
86
  * Technical ID of the Column
81
87
  */
@@ -85,6 +91,9 @@ export interface RowGroupColumnHeaderContext extends BaseColumnHeaderContext {
85
91
  */
86
92
  groupColumnId: string;
87
93
  }
94
+ /**
95
+ * Context for standard Table Layout Columns
96
+ */
88
97
  export interface TableColumnHeaderContext extends BaseColumnHeaderContext {
89
98
  /**
90
99
  * Table Column - see `TableLayout.TableColumns`
@@ -99,9 +108,12 @@ export interface TableColumnHeaderContext extends BaseColumnHeaderContext {
99
108
  */
100
109
  aggregation?: string;
101
110
  }
111
+ /**
112
+ * Context for Column Group headers
113
+ */
102
114
  export interface TableColumnGroupHeaderContext extends BaseColumnHeaderContext {
103
115
  /**
104
- * Column Group - see https://www.ag-grid.com/javascript-data-grid/column-groups/
116
+ * Column Group (used when Column Grouping)
105
117
  */
106
118
  columnType: 'tableColumnGroup';
107
119
  /**
@@ -117,9 +129,12 @@ export interface TableColumnGroupHeaderContext extends BaseColumnHeaderContext {
117
129
  */
118
130
  state: 'expanded' | 'collapsed';
119
131
  }
132
+ /**
133
+ * Context for Pivot Column Groups
134
+ */
120
135
  export interface PivotColumnGroupHeaderContext extends BaseColumnHeaderContext {
121
136
  /**
122
- * Pivot Column - see `PivotLayout.PivotColumns`
137
+ * Pivot Column Column - created by `PivotLayout.PivotColumns`
123
138
  */
124
139
  columnType: 'pivotColumnGroup';
125
140
  /**
@@ -135,11 +150,14 @@ export interface PivotColumnGroupHeaderContext extends BaseColumnHeaderContext {
135
150
  */
136
151
  state: 'expanded' | 'collapsed';
137
152
  }
138
- export interface PivotAggregationColumnHeaderContext extends BaseColumnHeaderContext {
153
+ /**
154
+ * Context for Pivot Result Columns
155
+ */
156
+ export interface PivotResultColumnHeaderContext extends BaseColumnHeaderContext {
139
157
  /**
140
- * Pivot Aggregation Column - see `PivotLayout.PivotAggregationColumns`
158
+ * Pivot Result Column - intersecton of `PivotLayout.PivotAggregationColumns` and `PivotLayout.PivotColumns`
141
159
  */
142
- columnType: 'pivotAggregationColumn';
160
+ columnType: 'pivotResultColumn';
143
161
  /**
144
162
  * Technical ID of the generated Column
145
163
  */
@@ -157,6 +175,9 @@ export interface PivotAggregationColumnHeaderContext extends BaseColumnHeaderCon
157
175
  */
158
176
  aggregation: string;
159
177
  }
178
+ /**
179
+ * Context for Pivot Grand Total Columns
180
+ */
160
181
  export interface PivotGrandTotalHeaderContext extends BaseColumnHeaderContext {
161
182
  /**
162
183
  * Pivot Grand Total - see `PivotLayout.PivotGrandTotal`
@@ -171,6 +192,9 @@ export interface PivotGrandTotalHeaderContext extends BaseColumnHeaderContext {
171
192
  */
172
193
  aggregation: string;
173
194
  }
195
+ /**
196
+ * Context for Pivot Total Columns
197
+ */
174
198
  export interface PivotColumnTotalHeaderContext extends BaseColumnHeaderContext {
175
199
  /**
176
200
  * Pivot Column Total - see `PivotLayout.PivotColumnTotal`
@@ -189,6 +213,9 @@ export interface PivotColumnTotalHeaderContext extends BaseColumnHeaderContext {
189
213
  */
190
214
  aggregation: string;
191
215
  }
216
+ /**
217
+ * Context for Pivot Aggregation Totals
218
+ */
192
219
  export interface PivotAggregationTotalHeaderContext extends BaseColumnHeaderContext {
193
220
  /**
194
221
  * Pivot Aggregation Total Column - see `PivotLayout.PivotAggregationColumns.TotalColumn`
@@ -211,153 +238,10 @@ export interface PivotAggregationTotalHeaderContext extends BaseColumnHeaderCont
211
238
  */
212
239
  pivotKey: string;
213
240
  }
214
- export type ColumnHeaderContext = TableColumnHeaderContext | TableColumnGroupHeaderContext | AutoGroupColumnHeaderContext | RowGroupColumnHeaderContext | PivotColumnGroupHeaderContext | PivotAggregationColumnHeaderContext | PivotGrandTotalHeaderContext | PivotColumnTotalHeaderContext | PivotAggregationTotalHeaderContext;
215
- export type ColumnHeaderContextOld = BaseColumnHeaderContext & ({
216
- /**
217
- * Auto-generated Group Column when GroupDisplayType is `single` column
218
- */
219
- columnType: 'autoGroupColumn';
220
- /**
221
- * Technical ID of the Column
222
- */
223
- columnId: string;
224
- /**
225
- * IDs of the Columns that are grouped
226
- */
227
- groupedColumnIds: string[];
228
- } | {
229
- /**
230
- * Group Columns - see `TableLayout.RowGroupedColumns` or `PivotLayout.PivotGroupedColumns`
231
- */
232
- columnType: 'groupColumn';
233
- /**
234
- * Technical ID of the Column
235
- */
236
- columnId: string;
237
- /**
238
- * ID of the grouped Column
239
- */
240
- groupColumnId: string;
241
- } | {
242
- /**
243
- * Table Column - see `TableLayout.TableColumns`
244
- */
245
- columnType: 'tableColumn';
246
- /**
247
- * Technical ID of the Column
248
- */
249
- columnId: string;
250
- /**
251
- * Optional Aggregation function of the Column - see `TableLayout.TableAggregationColumns`
252
- */
253
- aggregation?: string;
254
- } | {
255
- /**
256
- * Column Group - see https://www.ag-grid.com/javascript-data-grid/column-groups/
257
- */
258
- columnType: 'tableColumnGroup';
259
- /**
260
- * Technical ID of the Column Group - see `ColGroupDef.groupId`
261
- */
262
- groupId: string;
263
- /**
264
- * IDs of the Column Group children - see `ColGroupDef.children`
265
- */
266
- childrenColumnIds: string[];
267
- /**
268
- * State of the Column Group
269
- */
270
- state: 'expanded' | 'collapsed';
271
- } | {
272
- /**
273
- * Pivot Column - see `PivotLayout.PivotColumns`
274
- */
275
- columnType: 'pivotColumnGroup';
276
- /**
277
- * Technical ID of the generated Column Group
278
- */
279
- groupId: string;
280
- /**
281
- * Pivot Keys for the current Column Group
282
- */
283
- pivotKeys: string[];
284
- /**
285
- * State of the Column Group
286
- */
287
- state: 'expanded' | 'collapsed';
288
- } | {
289
- /**
290
- * Pivot Aggregation Column - see `PivotLayout.PivotAggregationColumns`
291
- */
292
- columnType: 'pivotAggregationColumn';
293
- /**
294
- * Technical ID of the generated Column
295
- */
296
- columnId: string;
297
- /**
298
- * Current Pivot Keys
299
- */
300
- pivotKeys: string[];
301
- /**
302
- * ID of the Aggregated Column - see `PivotLayout.PivotAggregationColumns`
303
- */
304
- aggregatedColumnId: string;
305
- /**
306
- * Aggregation function of the Column - see `PivotLayout.PivotAggregationColumns.AggregationColumnValue`
307
- */
308
- aggregation: string;
309
- } | {
310
- /**
311
- * Pivot Grand Total - see `PivotLayout.PivotGrandTotal`
312
- */
313
- columnType: 'pivotGrandTotal';
314
- /**
315
- * ID of the Aggregated Column - see `PivotLayout.PivotAggregationColumns`
316
- */
317
- aggregatedColumnId: string;
318
- /**
319
- * Aggregation function of the Column - see `PivotLayout.PivotAggregationColumns.AggregationColumnValue`
320
- */
321
- aggregation: string;
322
- } | {
323
- /**
324
- * Pivot Column Total - see `PivotLayout.PivotColumnTotal`
325
- */
326
- columnType: 'pivotColumnTotal';
327
- /**
328
- * Current Pivot Keys
329
- */
330
- pivotKey: string;
331
- /**
332
- * ID of the Pivot Column - see `PivotLayout.PivotColumns`
333
- */
334
- pivotColumnId: string;
335
- /**
336
- * Aggregation function of the Column - see `PivotLayout.PivotAggregationColumns.AggregationColumnValue`
337
- */
338
- aggregation: string;
339
- } | {
340
- /**
341
- * Pivot Aggregation Total Column - see `PivotLayout.PivotAggregationColumns.TotalColumn`
342
- */
343
- columnType: 'pivotAggregationTotal';
344
- /**
345
- * ID of the Aggregated Column - see `PivotLayout.PivotAggregationColumns`
346
- */
347
- aggregatedColumnId: string;
348
- /**
349
- * Aggregation function of the Column - see `PivotLayout.PivotAggregationColumns.AggregationColumnValue`
350
- */
351
- aggregation: string;
352
- /**
353
- * ID of the Pivot Column - see `PivotLayout.PivotColumns`
354
- */
355
- pivotColumnId: string;
356
- /**
357
- * Current Pivot Keys
358
- */
359
- pivotKey: string;
360
- });
241
+ /**
242
+ * Context provided to columnHeader function custom Headers to be provided for any type of AG Grid Column
243
+ */
244
+ export type ColumnHeaderContext = TableColumnHeaderContext | TableColumnGroupHeaderContext | AutoGroupColumnHeaderContext | RowGroupColumnHeaderContext | PivotColumnGroupHeaderContext | PivotResultColumnHeaderContext | PivotGrandTotalHeaderContext | PivotColumnTotalHeaderContext | PivotAggregationTotalHeaderContext;
361
245
  /**
362
246
  * Context used when setting a Column Friendly Name
363
247
  */
@@ -1,51 +1,51 @@
1
1
  import { AdaptableSystemIconName } from '../../types';
2
2
  import { CustomRenderContext, AdaptableFrameworkComponent } from '../../agGrid/AdaptableFrameworkComponent';
3
3
  /**
4
- * Config used to open a custom window
4
+ * Config used to open a Custom Window
5
5
  */
6
6
  export interface CustomWindowConfig {
7
7
  /**
8
- * Unique identifier for the custom window.
8
+ * Unique identifier for Custom Window
9
9
  */
10
10
  id: string;
11
11
  /**
12
- * Title of the custom window.
12
+ * Title of Custom Window
13
13
  */
14
14
  title?: string;
15
15
  /**
16
- * Icon to display in the custom window heading.
16
+ * Icon to display in Custom Window header
17
17
  */
18
18
  icon?: AdaptableSystemIconName;
19
19
  /**
20
- * Render function to display custom content in the window (if not using a framework component).
20
+ * Render function to display content in Custom Window(if not using a framework component)
21
21
  */
22
22
  render?: (customRenderContext: CustomRenderContext) => string | null;
23
23
  /**
24
- * A React, Angular or Vue Framework component to use for the custom window content.
24
+ * React, Angular or Vue Framework component to use for Custom Window content
25
25
  */
26
26
  frameworkComponent?: AdaptableFrameworkComponent;
27
27
  /**
28
- * Callback function to be called when the framework component is destroyed.
28
+ * Callback function to be called when the framework component is destroyed
29
29
  */
30
30
  onFrameworkComponentDestroyed?: () => void;
31
31
  /**
32
- * Window position in pixels.
32
+ * Size of window in pixels (provided as width, height)
33
33
  */
34
34
  size?: WindowSize;
35
35
  /**
36
- * Position of the window in pixels.
36
+ * Position of window in pixels (provided as x, y)
37
37
  */
38
38
  position?: WindowPosition;
39
39
  }
40
40
  /**
41
- * Defines size of a custom window
41
+ * Defines size of a Custom Window
42
42
  */
43
43
  export interface WindowSize {
44
44
  width: number;
45
45
  height: number;
46
46
  }
47
47
  /**
48
- * Defines position of a custom window
48
+ * Defines position of a Custom Window
49
49
  */
50
50
  export interface WindowPosition {
51
51
  x: number;
@@ -17,10 +17,7 @@ export interface ProgressIndicatorConfig {
17
17
  */
18
18
  frameworkComponent?: AdaptableFrameworkComponent;
19
19
  /**
20
- * Determines how the custom component is rendered:
21
- * - "content" (default): Inside the default Dialog with spinner
22
- * - "dialog": As a complete replacement for the Dialog
23
- * Applies to both frameworkComponent and render parameters.
20
+ * Determines whether custom component is rendered as "content" (inside window) or "dialog" (replacing window)
24
21
  */
25
22
  renderMode?: 'content' | 'dialog';
26
23
  /**
@@ -15,7 +15,7 @@ export interface RowScope {
15
15
  */
16
16
  ExcludeSummaryRows?: boolean;
17
17
  /**
18
- * Exclude Grand Total Rows
18
+ * Exclude Grand Total Rows (used in Aggregations)
19
19
  */
20
20
  ExcludeTotalRows?: boolean;
21
21
  }
@@ -26,17 +26,17 @@ export interface FormatColumn extends SuspendableObject {
26
26
  */
27
27
  Scope: ColumnScope;
28
28
  /**
29
- * Which part of the Column to apply Format to: `cell`, `column header`
29
+ * Where in Column to apply Format (`cell` or `columnHeader`)
30
30
  *
31
- * @defaultValue ['cell']
31
+ * @defaultValue 'cell'
32
32
  */
33
- Target?: FormatColumnTarget[];
33
+ Target?: FormatColumnTarget;
34
34
  /**
35
35
  * Rule to decide whether to apply Format; if undefined Format is always applied
36
36
  */
37
37
  Rule?: FormatColumnRule;
38
38
  /**
39
- * Style to apply
39
+ * AdapTable Style to apply
40
40
  */
41
41
  Style?: AdaptableStyle;
42
42
  /**
@@ -44,21 +44,21 @@ export interface FormatColumn extends SuspendableObject {
44
44
  */
45
45
  DisplayFormat?: AdaptableFormat;
46
46
  /**
47
- * Aligns cells 'Left' or 'Right' or 'Center'
47
+ * Align cells 'Left' or 'Right' or 'Center'
48
48
  */
49
49
  CellAlignment?: CellAlignment;
50
50
  /**
51
- * Which types of Rows should be formatted (data, grouped, summary)
51
+ * Which types of Rows to apply format (data, grouped, summary, total)
52
52
  */
53
53
  RowScope?: RowScope;
54
54
  /**
55
- * When to format Columns in Column Groups ('Expanded', 'Collapsed' or 'Both')
55
+ * When to format Columns in Column Groups ('Expanded', 'Collapsed', 'Both')
56
56
  *
57
57
  */
58
58
  ColumnGroupScope?: ColumnGroupScope;
59
59
  }
60
60
  /**
61
- * Target for Format Column: Specifies which visual elements of the column receive formatting
61
+ * Specifies whether Column's cells or header is formatted
62
62
  */
63
63
  export type FormatColumnTarget = 'cell' | 'columnHeader';
64
64
  /**
@@ -146,7 +146,7 @@ class ColumnInternalApi extends ApiBase_1.ApiBase {
146
146
  };
147
147
  }
148
148
  if (params.column?.getColId().startsWith(`${GeneralConstants_1.AG_GRID_GROUPED_COLUMN}-`)) {
149
- const columnType = 'groupColumn';
149
+ const columnType = 'rowGroupColumn';
150
150
  const columnId = params.column.getColId();
151
151
  // remove `${AG_GRID_GROUPED_COLUMN}-` from beginning of columnId
152
152
  const groupColumnId = columnId.substring(`${GeneralConstants_1.AG_GRID_GROUPED_COLUMN}-`.length);
@@ -266,7 +266,7 @@ class ColumnInternalApi extends ApiBase_1.ApiBase {
266
266
  };
267
267
  }
268
268
  if ((0, ColumnApiImpl_1.isPivotResultColumn)(columnId)) {
269
- const columnType = 'pivotAggregationColumn';
269
+ const columnType = 'pivotResultColumn';
270
270
  const pivotValueCol = params.colDef.pivotValueColumn;
271
271
  const aggregatedColumnId = pivotValueCol?.getColId();
272
272
  const currentLayoutAggCols = currentPivotLayout.PivotAggregationColumns?.map((col) => col.ColumnId);
@@ -1,4 +1,4 @@
1
- import { IRowNode } from 'ag-grid-enterprise';
1
+ import { HeaderValueGetterParams, IRowNode } from 'ag-grid-enterprise';
2
2
  import { AdaptableColumn, AdaptableFormat, AdaptablePredicateDef, ColumnScope, FormatColumn, FormatColumnTarget, StringFormatterOptions } from '../../types';
3
3
  import { ApiBase } from '../Implementation/ApiBase';
4
4
  export declare class FormatColumnInternalApi extends ApiBase {
@@ -49,7 +49,8 @@ export declare class FormatColumnInternalApi extends ApiBase {
49
49
  * @param config
50
50
  * @returns list of FormatColumn
51
51
  */
52
- getFormatColumnsWithDisplayFormatForColumn(column: AdaptableColumn, config?: {
52
+ getFormatColumnsWithDisplayFormatForColumn(column: AdaptableColumn, config: {
53
+ target: FormatColumnTarget;
53
54
  includeSuspended?: boolean;
54
55
  }): FormatColumn[];
55
56
  /**
@@ -129,4 +130,5 @@ export declare class FormatColumnInternalApi extends ApiBase {
129
130
  * Retrieves the columns that need rerendering based on format column predicates.
130
131
  */
131
132
  getFormatColumnColumnsDependentOnColumnChange(column: AdaptableColumn): string[];
133
+ formatColumnHeaderName(headerName: string, params: HeaderValueGetterParams): string;
132
134
  }
@@ -82,8 +82,8 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
82
82
  const formatColumns = this.getAllFormatColumnWithStyleAndCellAlignment()
83
83
  .filter((formatColumn) => {
84
84
  // FormatColumn default target is 'cell', so if no target is specified, we assume 'cell'
85
- const fcTarget = formatColumn.Target ?? ['cell'];
86
- return fcTarget.includes(config.target);
85
+ const fcTarget = formatColumn.Target ?? 'cell';
86
+ return fcTarget === config.target;
87
87
  })
88
88
  .filter((formatColumn) => config?.includeSuspended || !formatColumn.IsSuspended);
89
89
  return this.getFormatColumnWithColumnInScope(formatColumns, column);
@@ -120,7 +120,13 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
120
120
  * @returns list of FormatColumn
121
121
  */
122
122
  getFormatColumnsWithDisplayFormatForColumn(column, config) {
123
- const formatColumns = this.getAllFormatColumnWithDisplayFormat().filter((formatColumn) => config?.includeSuspended || !formatColumn.IsSuspended);
123
+ const formatColumns = this.getAllFormatColumnWithDisplayFormat()
124
+ .filter((formatColumn) => {
125
+ // FormatColumn default target is 'cell', so if no target is specified, we assume 'cell'
126
+ const fcTarget = formatColumn.Target ?? 'cell';
127
+ return fcTarget === config.target;
128
+ })
129
+ .filter((formatColumn) => config?.includeSuspended || !formatColumn.IsSuspended);
124
130
  return this.getFormatColumnWithColumnInScope(formatColumns, column);
125
131
  }
126
132
  /**
@@ -360,5 +366,28 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
360
366
  });
361
367
  return [...columnsThatNeedRefresh];
362
368
  }
369
+ formatColumnHeaderName(headerName, params) {
370
+ // currently we only format the header name for normal columns (NOT column groups)
371
+ if (!params.column) {
372
+ return headerName;
373
+ }
374
+ const abColumn = this.getColumnApi().getColumnWithColumnId(params.column.getColId());
375
+ const activeFormatColumnsWithDisplayFormat = this.getFormatColumnApi().internalApi.getFormatColumnsWithDisplayFormatForColumn(abColumn, {
376
+ target: 'columnHeader',
377
+ });
378
+ if (!activeFormatColumnsWithDisplayFormat.length) {
379
+ return headerName;
380
+ }
381
+ const mostRelevantFormatColumn = activeFormatColumnsWithDisplayFormat.find((formatColumn) => this.formatColumnShouldRenderInHeader(formatColumn, abColumn));
382
+ if (!mostRelevantFormatColumn) {
383
+ return headerName;
384
+ }
385
+ if (mostRelevantFormatColumn.DisplayFormat?.Formatter !== 'StringFormatter') {
386
+ // headers are always strings, so we can only use StringFormatter
387
+ return headerName;
388
+ }
389
+ const formattedHeaderName = this.getFormatColumnApi().internalApi.getStringFormattedValue(headerName, null, abColumn, mostRelevantFormatColumn.DisplayFormat.Options);
390
+ return formattedHeaderName;
391
+ }
363
392
  }
364
393
  exports.FormatColumnInternalApi = FormatColumnInternalApi;
@@ -14,6 +14,7 @@ const MoveFormatColumn_1 = require("../View/FormatColumn/MoveFormatColumn");
14
14
  const getObjectTagsViewItems_1 = require("../Utilities/getObjectTagsViewItems");
15
15
  const getRuleViewItems_1 = require("../Utilities/getRuleViewItems");
16
16
  const getScopeViewItems_1 = require("../Utilities/getScopeViewItems");
17
+ const getFormatColumnSettingsTargetItems_1 = require("./Utilities/FormatColumn/getFormatColumnSettingsTargetItems");
17
18
  class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
18
19
  constructor(api) {
19
20
  super(ModuleConstants.FormatColumnModuleId, ModuleConstants.FormatColumnFriendlyName, 'color-palette', 'FormatColumnPopup', 'Create a column style, display format or cell alignment', api);
@@ -86,6 +87,7 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
86
87
  abObject: formatColumn,
87
88
  items: [
88
89
  (0, getScopeViewItems_1.getScopeViewItems)(formatColumn.Scope, this.api),
90
+ (0, getFormatColumnSettingsTargetItems_1.getFormatColumnSettingsTargetItems)(formatColumn),
89
91
  formatColumn.Rule && (0, getRuleViewItems_1.getRuleViewItems)(formatColumn.Rule, this.api),
90
92
  {
91
93
  name: 'Style',
@@ -0,0 +1,5 @@
1
+ import { FormatColumn } from '../../../AdaptableState/FormatColumnState';
2
+ export declare const getFormatColumnSettingsTargetItems: (formatColumn: FormatColumn) => {
3
+ name: string;
4
+ values: string[];
5
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFormatColumnSettingsTargetItems = void 0;
4
+ const getFormatColumnSettingsTargetItems = (formatColumn) => {
5
+ if (!formatColumn.Target || formatColumn.Target === 'cell') {
6
+ return {
7
+ name: 'Target',
8
+ values: ['Column Cells'],
9
+ };
10
+ }
11
+ return {
12
+ name: 'Target',
13
+ values: ['Column Header'],
14
+ };
15
+ };
16
+ exports.getFormatColumnSettingsTargetItems = getFormatColumnSettingsTargetItems;
@@ -256,6 +256,7 @@ function CreateEmptyFormatColumn() {
256
256
  DisplayFormat: undefined,
257
257
  CellAlignment: undefined,
258
258
  RowScope: undefined,
259
+ Target: 'cell'
259
260
  };
260
261
  }
261
262
  exports.CreateEmptyFormatColumn = CreateEmptyFormatColumn;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getScopeViewItems = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const StringExtensions_1 = tslib_1.__importDefault(require("./Extensions/StringExtensions"));
4
6
  const getScopeViewItems = (scope, api) => {
5
7
  let values = [];
6
8
  if ('ColumnIds' in scope && Array.isArray(scope.ColumnIds)) {
@@ -8,7 +10,9 @@ const getScopeViewItems = (scope, api) => {
8
10
  values = scope.ColumnIds.map((columnId) => api.columnApi.getFriendlyNameForColumnId(columnId)).filter(Boolean);
9
11
  }
10
12
  if ('DataTypes' in scope) {
11
- values = scope.DataTypes;
13
+ values = scope.DataTypes.map((d) => {
14
+ return 'Data Type: ' + StringExtensions_1.default.CapitaliseFirstLetter(d);
15
+ });
12
16
  }
13
17
  if ('All' in scope) {
14
18
  values = ['All Columns'];
@@ -17,7 +21,7 @@ const getScopeViewItems = (scope, api) => {
17
21
  values = scope.ColumnTypes;
18
22
  }
19
23
  return {
20
- label: 'Scope & Target',
24
+ label: 'Scope',
21
25
  name: 'Target',
22
26
  values,
23
27
  };
@@ -14,6 +14,7 @@ const AdaptableFormControlTextClear_1 = require("./Forms/AdaptableFormControlTex
14
14
  const AdaptableContext_1 = require("../AdaptableContext");
15
15
  const ValueSelector_1 = require("./ValueSelector");
16
16
  const AdaptableColumn_1 = require("../../AdaptableState/Common/AdaptableColumn");
17
+ const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
17
18
  const isScopeValid = ({ Scope }) => {
18
19
  const result = [];
19
20
  if (!Scope) {
@@ -46,6 +47,9 @@ const DATA_TYPES_MAP = {
46
47
  value: 'boolean',
47
48
  },
48
49
  };
50
+ const renderDataTypeLabel = (c) => {
51
+ return 'DataType: ' + StringExtensions_1.default.CapitaliseFirstLetter(c);
52
+ };
49
53
  const renderScopeSummary = (scope, labels) => {
50
54
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
51
55
  const scopeApi = adaptable.api.columnScopeApi;
@@ -58,7 +62,7 @@ const renderScopeSummary = (scope, labels) => {
58
62
  columnsInScope.length ? (React.createElement(ValueSelector_1.ValueOptionsTags, { options: columnsInScope, value: columnsInScope.map((c) => c.columnId), toLabel: (c) => c.friendlyName, allowWrap: true, readOnly: true, renderLabel: (c) => React.createElement(OnePageAdaptableWizard_1.SummaryText, { mb: 0 }, c), toIdentifier: (c) => c.columnId })) : null)) : null),
59
63
  React.createElement(rebass_1.Box, null, 'DataTypes' in scope ? (React.createElement(React.Fragment, null,
60
64
  React.createElement(rebass_1.Text, { fontSize: 2, mb: 2 }, labels.scopeDataTypes),
61
- React.createElement(ValueSelector_1.ValueOptionsTags, { readOnly: true, options: scope.DataTypes, value: scope.DataTypes, toLabel: (c) => c, allowWrap: true, renderLabel: (c) => React.createElement(rebass_1.Text, { fontSize: 2 }, `DataType: ${c}`), toIdentifier: (c) => c }))) : null)));
65
+ React.createElement(ValueSelector_1.ValueOptionsTags, { readOnly: true, options: scope.DataTypes, value: scope.DataTypes, toLabel: (c) => c, allowWrap: true, renderLabel: (c) => React.createElement(rebass_1.Text, { fontSize: 2 }, renderDataTypeLabel(c)), toIdentifier: (c) => c }))) : null)));
62
66
  };
63
67
  exports.renderScopeSummary = renderScopeSummary;
64
68
  const DATA_TYPES_OPTIONS = Object.values(DATA_TYPES_MAP);
@@ -460,6 +460,6 @@ const FormatColumnFormatWizardSection = (props) => {
460
460
  return (React.createElement(HelpBlock_1.default, { margin: 3 },
461
461
  "Setting a Display Format is only possible if ",
462
462
  React.createElement("b", null, "all"),
463
- " the columns in Scope are Numeric, String or Date."));
463
+ " the columns in Scope are Numeric, String or Date"));
464
464
  };
465
465
  exports.FormatColumnFormatWizardSection = FormatColumnFormatWizardSection;
@@ -5,8 +5,12 @@ const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
7
7
  const EntityRulesEditor_1 = require("../../Components/EntityRulesEditor");
8
+ const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlock"));
8
9
  function FormatColumnRuleWizardSection(props) {
9
10
  const { data, api, moduleInfo } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
11
+ if (data.Target && data.Target === 'columnHeader') {
12
+ return (React.createElement(HelpBlock_1.default, { margin: 3 }, "Conditions cannot be applied if the Target of the Format Column is Column Header"));
13
+ }
10
14
  return (React.createElement(EntityRulesEditor_1.EntityRulesEditor, { module: moduleInfo.ModuleName, defaultPredicateId: props.defaultPredicateId,
11
15
  // TODO see what is this
12
16
  predicateDefs: api.formatColumnApi.internalApi.getFormatColumnDefsForScope(data.Scope), getPredicateDefsForColId: (colId) => api.formatColumnApi.internalApi.getFormatColumnDefsForScope({ ColumnIds: [colId] }), showNoRule: true, showBoolean: true, showAggregation: false, showObservable: false, showQueryBuilder: true, showPredicate: !api.columnScopeApi.scopeIsAll(data.Scope), data: data, onChange: (formatColumn) => props.onChange(formatColumn), descriptions: {