@adaptabletools/adaptable 22.0.0-canary.12 → 22.0.0-canary.14

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 (53) hide show
  1. package/index.css +9 -6
  2. package/index.css.map +1 -1
  3. package/index.d.ts +8 -8
  4. package/index.js +8 -8
  5. package/package.json +1 -1
  6. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +2 -2
  7. package/src/AdaptableState/Common/AdaptableColumn.d.ts +3 -3
  8. package/src/AdaptableState/Common/AggregationColumns.d.ts +1 -0
  9. package/src/AdaptableState/Common/AggregationColumns.js +1 -0
  10. package/src/AdaptableState/Common/TransposeConfig.d.ts +0 -5
  11. package/src/AdaptableState/InitialState.d.ts +1 -1
  12. package/src/Api/ColumnApi.d.ts +1 -1
  13. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -1
  14. package/src/Api/Implementation/ColumnApiImpl.js +4 -4
  15. package/src/Api/Implementation/GridApiImpl.js +0 -2
  16. package/src/Api/Internal/ColumnInternalApi.d.ts +1 -1
  17. package/src/Api/Internal/ColumnInternalApi.js +4 -2
  18. package/src/Strategy/FormatColumnModule.js +2 -2
  19. package/src/Strategy/StyledColumnModule.js +14 -6
  20. package/src/Strategy/Utilities/FormatColumn/{getFormatColumnSettingsTargetItems.d.ts → getFormatColumnRowTargetItems.d.ts} +1 -1
  21. package/src/Strategy/Utilities/FormatColumn/getFormatColumnRowTargetItems.js +22 -0
  22. package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsViewItems.js +5 -13
  23. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +1 -1
  24. package/src/Utilities/getScopeViewItems.js +1 -1
  25. package/src/Utilities/only.d.ts +15 -0
  26. package/src/Utilities/only.js +54 -0
  27. package/src/View/Components/ValueSelector/index.js +7 -2
  28. package/src/View/Export/Wizard/NewReportWizard.js +8 -8
  29. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +19 -10
  30. package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +1 -1
  31. package/src/View/FormatColumn/Wizard/FormatColumnRowScopeWizardSection.d.ts +8 -0
  32. package/src/View/FormatColumn/Wizard/FormatColumnRowScopeWizardSection.js +80 -0
  33. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +22 -61
  34. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +22 -8
  35. package/src/View/Layout/TransposedPopup.js +0 -1
  36. package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
  37. package/src/View/StyledColumn/Wizard/StyledColumnBadgeRowsSection.d.ts +8 -0
  38. package/src/View/StyledColumn/Wizard/{StyledColumnWizardSettingsSection.js → StyledColumnBadgeRowsSection.js} +19 -19
  39. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +10 -11
  40. package/src/agGrid/AdaptableAgGrid.js +17 -1
  41. package/src/agGrid/AgGridAdapter.js +4 -4
  42. package/src/agGrid/AgGridExportAdapter.d.ts +2 -2
  43. package/src/agGrid/AgGridExportAdapter.js +7 -6
  44. package/src/env.js +2 -2
  45. package/src/metamodel/adaptable.metamodel.js +1 -1
  46. package/src/migration/VersionUpgrade22.js +8 -0
  47. package/tsconfig.esm.tsbuildinfo +1 -1
  48. package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsTargetItems.js +0 -12
  49. package/src/View/FormatColumn/Wizard/FormatColumnTargetWizardSection.d.ts +0 -8
  50. package/src/View/FormatColumn/Wizard/FormatColumnTargetWizardSection.js +0 -31
  51. package/src/View/StyledColumn/Wizard/StyledColumnWizardSettingsSection.d.ts +0 -8
  52. /package/src/View/FormatColumn/Wizard/{FormatColumnScopeWizardSection.d.ts → FormatColumnColumnScopeWizardSection.d.ts} +0 -0
  53. /package/src/View/FormatColumn/Wizard/{FormatColumnScopeWizardSection.js → FormatColumnColumnScopeWizardSection.js} +0 -0
@@ -32,6 +32,6 @@ export declare class ColumnInternalApi extends ApiBase {
32
32
  private buildColumnHeaderContext;
33
33
  hasArrayDataType(column: AdaptableColumn): boolean;
34
34
  getQueryableColumnsForUIEditor(): AdaptableColumn[];
35
- isAlwaysHiddenColumn(columnIdentifier: string | ColDef): boolean;
35
+ isColumnUIHidden(columnIdentifier: string | ColDef): boolean;
36
36
  getColumnDateTypes(): AdaptableColumnDataType[];
37
37
  }
@@ -277,9 +277,11 @@ export class ColumnInternalApi extends ApiBase {
277
277
  getQueryableColumnsForUIEditor() {
278
278
  return this.getColumnApi()
279
279
  .getQueryableColumns()
280
- .filter((column) => !column.isGeneratedPivotResultColumn && !column.isGeneratedRowGroupColumn && !column.isGeneratedSelectionColumn);
280
+ .filter((column) => !column.isGeneratedPivotResultColumn &&
281
+ !column.isGeneratedRowGroupColumn &&
282
+ !column.isGeneratedSelectionColumn);
281
283
  }
282
- isAlwaysHiddenColumn(columnIdentifier) {
284
+ isColumnUIHidden(columnIdentifier) {
283
285
  return this.getColumnApi().hasColumnType(columnIdentifier, HIDDEN_COLUMN_TYPE);
284
286
  }
285
287
  getColumnDateTypes() {
@@ -9,7 +9,7 @@ import { MoveFormatColumn } from '../View/FormatColumn/MoveFormatColumn';
9
9
  import { getObjectTagsViewItems } from '../Utilities/getObjectTagsViewItems';
10
10
  import { getRuleViewItems } from '../Utilities/getRuleViewItems';
11
11
  import { getScopeViewItems } from '../Utilities/getScopeViewItems';
12
- import { getFormatColumnSettingsTargetItems } from './Utilities/FormatColumn/getFormatColumnSettingsTargetItems';
12
+ import { getFormatColumnRowTargetItems } from './Utilities/FormatColumn/getFormatColumnRowTargetItems';
13
13
  import { renderFormatColumnStyleSummary } from '../View/FormatColumn/Wizard/FormatColumnStyleWizardSection';
14
14
  export class FormatColumnModule extends AdaptableModuleBase {
15
15
  constructor(api) {
@@ -87,7 +87,7 @@ export class FormatColumnModule extends AdaptableModuleBase {
87
87
  values: [formatColumn.Name],
88
88
  },
89
89
  getScopeViewItems(formatColumn.Scope, this.api),
90
- getFormatColumnSettingsTargetItems(formatColumn),
90
+ getFormatColumnRowTargetItems(formatColumn),
91
91
  formatColumn.Rule && getRuleViewItems(formatColumn.Rule, this.api),
92
92
  {
93
93
  name: 'Style',
@@ -187,14 +187,22 @@ export class StyledColumnModule extends AdaptableModuleBase {
187
187
  });
188
188
  }
189
189
  if (styledColumn.BadgeStyle) {
190
+ let rowTypes = [];
191
+ if (!styledColumn.BadgeStyle?.RowScope?.ExcludeDataRows) {
192
+ rowTypes.push('Data');
193
+ }
194
+ if (!styledColumn.BadgeStyle?.RowScope?.ExcludeGroupRows) {
195
+ rowTypes.push('Group');
196
+ }
197
+ if (!styledColumn.BadgeStyle?.RowScope?.ExcludeSummaryRows) {
198
+ rowTypes.push('Summary');
199
+ }
200
+ if (!styledColumn.BadgeStyle?.RowScope?.ExcludeTotalRows) {
201
+ rowTypes.push('Total');
202
+ }
190
203
  specificTypeItems.push({
191
204
  name: 'Rows',
192
- values: [
193
- `Data Rows: ${styledColumn.BadgeStyle?.RowScope?.ExcludeDataRows ? 'No' : 'Yes'}`,
194
- `Group Rows: ${styledColumn.BadgeStyle?.RowScope?.ExcludeGroupRows ? 'No' : 'Yes'}`,
195
- `Summary Rows: ${styledColumn.BadgeStyle?.RowScope?.ExcludeSummaryRows ? 'No' : 'Yes'}`,
196
- `Total Rows: ${styledColumn.BadgeStyle?.RowScope?.ExcludeTotalRows ? 'No' : 'Yes'}`,
197
- ],
205
+ values: rowTypes
198
206
  });
199
207
  }
200
208
  if (styledColumn.BadgeStyle) {
@@ -1,5 +1,5 @@
1
1
  import { FormatColumn } from '../../../AdaptableState/FormatColumnState';
2
- export declare const getFormatColumnSettingsTargetItems: (formatColumn: FormatColumn) => {
2
+ export declare const getFormatColumnRowTargetItems: (formatColumn: FormatColumn) => {
3
3
  name: string;
4
4
  values: string[];
5
5
  };
@@ -0,0 +1,22 @@
1
+ export const getFormatColumnRowTargetItems = (formatColumn) => {
2
+ let values = [];
3
+ if (formatColumn.RowScope) {
4
+ if (!formatColumn.RowScope.ExcludeDataRows) {
5
+ values.push('Data');
6
+ }
7
+ if (!formatColumn.RowScope.ExcludeGroupRows) {
8
+ values.push('Group');
9
+ }
10
+ if (!formatColumn.RowScope.ExcludeSummaryRows) {
11
+ values.push('Summary');
12
+ }
13
+ if (!formatColumn.RowScope.ExcludeTotalRows) {
14
+ values.push('Total');
15
+ }
16
+ }
17
+ values = values.filter(Boolean);
18
+ return {
19
+ name: 'Rows',
20
+ values: values.length > 0 ? values : ['-'],
21
+ };
22
+ };
@@ -1,18 +1,10 @@
1
1
  export const getFormatColumnSettingsViewItems = (formatColumn) => {
2
2
  let values = [];
3
- if (formatColumn.RowScope) {
4
- if (formatColumn.RowScope.ExcludeDataRows) {
5
- values.push('Exclude Data Rows');
6
- }
7
- if (formatColumn.RowScope.ExcludeGroupRows) {
8
- values.push('Exclude Group Rows');
9
- }
10
- if (formatColumn.RowScope.ExcludeSummaryRows) {
11
- values.push('Exclude Summary Rows');
12
- }
13
- if (formatColumn.RowScope.ExcludeTotalRows) {
14
- values.push('Exclude Total Rows');
15
- }
3
+ if (!formatColumn.Target || formatColumn.Target === 'cell') {
4
+ values.push('Target: Column Cells');
5
+ }
6
+ else {
7
+ values.push('Target: Column Header');
16
8
  }
17
9
  if (formatColumn.ColumnGroupScope) {
18
10
  values.push(`Column Groups: ${formatColumn.ColumnGroupScope === 'Both' ? 'Always' : formatColumn.ColumnGroupScope}`);
@@ -451,7 +451,7 @@ export const aggregatedScalarExpressionFunctions = {
451
451
  handler(args, context) {
452
452
  const distinctColumnParameter = extractColumnParameter('ONLY', args);
453
453
  const onlyColumnName = distinctColumnParameter.value;
454
- const columnType = validateColumnType(onlyColumnName, ['number'], 'ONLY', context.adaptableApi);
454
+ const columnType = validateColumnType(onlyColumnName, ['number', 'text'], 'ONLY', context.adaptableApi);
455
455
  const groupByParameter = extractParameter('ONLY', 'operand', ['GROUP_BY'], args, {
456
456
  isOptional: true,
457
457
  });
@@ -17,7 +17,7 @@ export const getScopeViewItems = (scope, api) => {
17
17
  values = scope.ColumnTypes;
18
18
  }
19
19
  return {
20
- label: 'Scope',
20
+ label: 'Columns',
21
21
  name: 'Target',
22
22
  values,
23
23
  };
@@ -0,0 +1,15 @@
1
+ import { IAggFuncParams } from 'ag-grid-enterprise';
2
+ interface OnlyAggResult {
3
+ distinctValues: Set<number | string>;
4
+ value: number | string | null;
5
+ toString(): string;
6
+ }
7
+ /**
8
+ * AG Grid aggFunc that returns the column value only when all rows in the group
9
+ * share the same value. Returns null when values differ (or when there are no values).
10
+ *
11
+ * Supports multiple group levels: leaf groups aggregate raw cell values while
12
+ * parent groups merge the metadata objects returned by child groups.
13
+ */
14
+ export declare const only: (params: IAggFuncParams, columnId: string) => OnlyAggResult;
15
+ export {};
@@ -0,0 +1,54 @@
1
+ function createOnlyResult(distinctValues) {
2
+ const value = distinctValues.size === 1 ? distinctValues.values().next().value : null;
3
+ return {
4
+ distinctValues,
5
+ value,
6
+ toString() {
7
+ return value != null ? String(value) : '';
8
+ },
9
+ };
10
+ }
11
+ /**
12
+ * AG Grid aggFunc that returns the column value only when all rows in the group
13
+ * share the same value. Returns null when values differ (or when there are no values).
14
+ *
15
+ * Supports multiple group levels: leaf groups aggregate raw cell values while
16
+ * parent groups merge the metadata objects returned by child groups.
17
+ */
18
+ export const only = (params, columnId) => {
19
+ const { api: gridApi, rowNode: groupRowNode, values } = params;
20
+ // Leaf group: the lowest-level group whose children are actual data rows.
21
+ // We read raw cell values and collect distinct ones, bailing out early
22
+ // as soon as we see a second distinct value (the result would be null anyway).
23
+ if (groupRowNode.leafGroup) {
24
+ const filteredOnly = !gridApi.getGridOption('suppressAggFilteredOnly');
25
+ const childNodes = (filteredOnly ? groupRowNode.childrenAfterFilter : groupRowNode.childrenAfterGroup) ?? [];
26
+ const distinctValues = new Set();
27
+ for (const rowNode of childNodes) {
28
+ const rawValue = gridApi.getCellValue({ colKey: columnId, rowNode });
29
+ if (typeof rawValue === 'number' || typeof rawValue === 'string') {
30
+ distinctValues.add(rawValue);
31
+ if (distinctValues.size > 1) {
32
+ return createOnlyResult(distinctValues);
33
+ }
34
+ }
35
+ }
36
+ return createOnlyResult(distinctValues);
37
+ }
38
+ // Non-leaf group: children are other groups, not data rows.
39
+ // AG Grid has already called this aggFunc on each child group, so
40
+ // `params.values` contains the OnlyAggResult objects they returned.
41
+ // We merge their distinctValues sets instead of re-traversing leaf rows.
42
+ const mergedDistinctValues = new Set();
43
+ for (const childResult of values) {
44
+ if (childResult && typeof childResult === 'object' && 'distinctValues' in childResult) {
45
+ for (const val of childResult.distinctValues) {
46
+ mergedDistinctValues.add(val);
47
+ if (mergedDistinctValues.size > 1) {
48
+ return createOnlyResult(mergedDistinctValues);
49
+ }
50
+ }
51
+ }
52
+ }
53
+ return createOnlyResult(mergedDistinctValues);
54
+ };
@@ -159,7 +159,12 @@ export const renderSelectionSection = (props) => {
159
159
  const { value, options, disabled, singleSelect, toLabel, toIdentifier, } = props;
160
160
  const selectionBox = (React.createElement(Box, { className: "twa:flex twa:flex-col twa:gap-2 twa:py-2" },
161
161
  React.createElement(Box, { className: clsx('twa:flex twa:flex-row', 'twa:border-b twa:border-primarydark/30 twa:rounded-standard') },
162
- React.createElement(CheckBox, { className: "twa:ml-0.5 twa:font-bold", checked: !value.length ? false : value.length === options.length ? true : null, onChange: (checked) => {
162
+ singleSelect ? (React.createElement(Box, { className: "twa:flex twa:flex-row twa:text-3 twa:font-normal" },
163
+ "(",
164
+ value.length,
165
+ " of ",
166
+ options.length,
167
+ " selected)")) : (React.createElement(CheckBox, { className: "twa:ml-0.5 twa:font-bold", checked: !value.length ? false : value.length === options.length ? true : null, onChange: (checked) => {
163
168
  if (checked) {
164
169
  props.onSelectAll();
165
170
  }
@@ -174,7 +179,7 @@ export const renderSelectionSection = (props) => {
174
179
  value.length,
175
180
  " of ",
176
181
  options.length,
177
- " selected)"))),
182
+ " selected)")))),
178
183
  React.createElement("div", { className: "twa:flex-1" }),
179
184
  React.createElement(Box, { className: "twa:mr-2 twa:text-2 twa:font-normal" }, props.showOnlySelectedCheckbox))));
180
185
  return React.createElement(Box, { className: clsx(`${baseClassName}__header `) }, selectionBox);
@@ -35,6 +35,14 @@ export const NewReportWizard = (props) => {
35
35
  props.onFinishWizard(report);
36
36
  };
37
37
  return (React.createElement(OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: report, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
38
+ {
39
+ title: 'Name',
40
+ details: 'Enter the name of the Report',
41
+ isValid: isValidReportName,
42
+ renderSummary: renderReportNameSummary,
43
+ render: () => (React.createElement(Box, { className: "twa:p-2" },
44
+ React.createElement(ReportNameWizardSection, { onChange: setReport }))),
45
+ },
38
46
  {
39
47
  title: 'Columns',
40
48
  details: 'Choose the Columns you want to include in the Report',
@@ -48,14 +56,6 @@ export const NewReportWizard = (props) => {
48
56
  renderSummary: renderReportRowsSummary,
49
57
  render: () => React.createElement(ReportRowsWizardSection, { onChange: setReport }),
50
58
  },
51
- {
52
- title: 'Name',
53
- details: 'Enter the name of the Report',
54
- isValid: isValidReportName,
55
- renderSummary: renderReportNameSummary,
56
- render: () => (React.createElement(Box, { className: "twa:p-2" },
57
- React.createElement(ReportNameWizardSection, { onChange: setReport }))),
58
- },
59
59
  {
60
60
  details: 'Select Report Tags',
61
61
  title: 'Tags',
@@ -80,15 +80,12 @@ export const FlashingAlertSettingsWizardSection = (props) => {
80
80
  React.createElement(Tabs.Content, null,
81
81
  React.createElement(FormLayout, null,
82
82
  React.createElement(FormRow, { label: "Name" },
83
- React.createElement(Input, { "data-name": "flashing-cell-name", className: "twa:flex-1 twa:mr-3", onChange: handleNameChange, placeholder: "Enter Name", value: flashingCell.Name ?? '' })),
84
- React.createElement(FormRow, { label: "Flash Target" },
85
- React.createElement(CheckBox, { "data-name": "flashing-target", onChange: (checked) => handleTargetChange('cell', checked), className: "twa:mr-3", checked: flashingCell?.FlashTarget === 'cell' ||
86
- flashingCell?.FlashTarget?.includes?.('cell'), tabIndex: -1 }, "Cell"),
87
- React.createElement(CheckBox, { "data-name": "flashing-target-row", className: "twa:mr-3", onChange: (checked) => handleTargetChange('row', checked), checked: flashingCell?.FlashTarget === 'row' ||
88
- flashingCell?.FlashTarget?.includes?.('row'), tabIndex: -1 }, "Row"),
89
- React.createElement(CheckBox, { "data-name": "flashing-target-aggFuncCell", onChange: (checked) => handleTargetChange('aggFuncCell', checked), checked: flashingCell?.FlashTarget === 'aggFuncCell' ||
90
- flashingCell?.FlashTarget?.includes?.('aggFuncCell'), tabIndex: -1 }, "Aggregated Function Cell")),
91
- React.createElement(FormRow, { label: "Duration" },
83
+ React.createElement(Input, { "data-name": "flashing-cell-name", className: "twa:flex-1 twa:mr-3", onChange: handleNameChange, placeholder: "Enter Name", value: flashingCell.Name ?? '' }))))),
84
+ React.createElement(Tabs, { autoFocus: false, className: "twa:p-2" },
85
+ React.createElement(Tabs.Tab, null, "Flash Duration"),
86
+ React.createElement(Tabs.Content, null,
87
+ React.createElement(FormLayout, null,
88
+ React.createElement(FormRow, { label: "" },
92
89
  React.createElement(Flex, { alignItems: "center" },
93
90
  React.createElement(CheckBox, { "data-name": "duration-always", checked: duration === 'always', onChange: (checked) => handleTypeChange(checked ? 'always' : 'number'), className: "twa:mr-4", tabIndex: -1 }, "Always"),
94
91
  duration !== 'always' && (React.createElement(React.Fragment, null,
@@ -96,5 +93,17 @@ export const FlashingAlertSettingsWizardSection = (props) => {
96
93
  const value = event.target.value;
97
94
  setDuration(isNaN(Number(value)) ? 500 : Number(value));
98
95
  } }),
99
- React.createElement(Box, { className: "twa:text-2" }, "ms"))))))))));
96
+ React.createElement(Box, { className: "twa:text-2" }, "ms")))))))),
97
+ ' ',
98
+ React.createElement(Tabs, { autoFocus: false, className: "twa:p-2" },
99
+ React.createElement(Tabs.Tab, null, "Flash Target"),
100
+ React.createElement(Tabs.Content, null,
101
+ React.createElement(FormLayout, null,
102
+ React.createElement(FormRow, { label: "" },
103
+ React.createElement(CheckBox, { "data-name": "flashing-target", onChange: (checked) => handleTargetChange('cell', checked), className: "twa:mr-3", checked: flashingCell?.FlashTarget === 'cell' ||
104
+ flashingCell?.FlashTarget?.includes?.('cell'), tabIndex: -1 }, "Cell"),
105
+ React.createElement(CheckBox, { "data-name": "flashing-target-row", className: "twa:mr-3", onChange: (checked) => handleTargetChange('row', checked), checked: flashingCell?.FlashTarget === 'row' ||
106
+ flashingCell?.FlashTarget?.includes?.('row'), tabIndex: -1 }, "Row"),
107
+ React.createElement(CheckBox, { "data-name": "flashing-target-aggFuncCell", onChange: (checked) => handleTargetChange('aggFuncCell', checked), checked: flashingCell?.FlashTarget === 'aggFuncCell' ||
108
+ flashingCell?.FlashTarget?.includes?.('aggFuncCell'), tabIndex: -1 }, "Aggregated Function Cell")))))));
100
109
  };
@@ -73,7 +73,7 @@ export const FlashingCellWizard = (props) => {
73
73
  isValid: isScopeValid,
74
74
  render: () => React.createElement(FlashingAlertScopeWizardSection, { onChange: setFlashingCell }),
75
75
  renderSummary: renderScopeSummary,
76
- title: 'Scope',
76
+ title: 'Columns',
77
77
  },
78
78
  {
79
79
  details: 'Build the Rules for when Cells should Flash',
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import { FormatColumn } from '../../../AdaptableState/FormatColumnState';
3
+ type FormatColumnRowScopeWizardSectionProps = {
4
+ onChange: (data: FormatColumn) => void;
5
+ };
6
+ export declare const renderFormatColumnRowScopeSummary: (data: FormatColumn) => React.JSX.Element;
7
+ export declare const FormatColumnRowScopeWizardSection: (props: FormatColumnRowScopeWizardSectionProps) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,80 @@
1
+ import * as React from 'react';
2
+ import FormLayout, { FormRow } from '../../../components/FormLayout';
3
+ import { CheckBox } from '../../../components/CheckBox';
4
+ import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard';
5
+ import { Tag } from '../../../components/Tag';
6
+ import { Box, Flex } from '../../../components/Flex';
7
+ import { Tabs } from '../../../components/Tabs';
8
+ export const renderFormatColumnRowScopeSummary = (data) => {
9
+ return (React.createElement(Box, { className: "twa:p-2" },
10
+ React.createElement(Box, { className: "twa:mt-3" },
11
+ "Data Rows ",
12
+ React.createElement(Tag, null, data.RowScope?.ExcludeDataRows ? 'no' : 'yes')),
13
+ ' ',
14
+ React.createElement(Box, { className: "twa:mt-3" },
15
+ "Group Rows ",
16
+ React.createElement(Tag, null, data.RowScope?.ExcludeGroupRows ? 'no' : 'yes')),
17
+ React.createElement(Box, { className: "twa:mt-3" },
18
+ "Summary Rows ",
19
+ React.createElement(Tag, null, data.RowScope?.ExcludeSummaryRows ? 'no' : 'yes')),
20
+ React.createElement(Box, { className: "twa:mt-3" },
21
+ "Total Rows ",
22
+ React.createElement(Tag, null, data.RowScope?.ExcludeTotalRows ? 'no' : 'yes'))));
23
+ };
24
+ export const FormatColumnRowScopeWizardSection = (props) => {
25
+ const { data } = useOnePageAdaptableWizardContext();
26
+ const onExcludeDataRowsChanged = (includeDataRows) => {
27
+ props.onChange({
28
+ ...data,
29
+ RowScope: {
30
+ ...data.RowScope,
31
+ ExcludeDataRows: !includeDataRows,
32
+ },
33
+ });
34
+ };
35
+ const onExcludeGroupedRowsChanged = (includeGroupedRows) => {
36
+ props.onChange({
37
+ ...data,
38
+ RowScope: {
39
+ ...data.RowScope,
40
+ ExcludeGroupRows: !includeGroupedRows,
41
+ },
42
+ });
43
+ };
44
+ const onExcludeSummaryRowsChanged = (includeSummaryRows) => {
45
+ props.onChange({
46
+ ...data,
47
+ RowScope: {
48
+ ...data.RowScope,
49
+ ExcludeSummaryRows: !includeSummaryRows,
50
+ },
51
+ });
52
+ };
53
+ const onExcludeTotalRowsChanged = (includeTotalRows) => {
54
+ props.onChange({
55
+ ...data,
56
+ RowScope: {
57
+ ...data.RowScope,
58
+ ExcludeTotalRows: !includeTotalRows,
59
+ },
60
+ });
61
+ };
62
+ return (React.createElement(Flex, { flexDirection: "column", style: { height: '100%' } },
63
+ React.createElement(Tabs, { className: "twa:mb-3" },
64
+ React.createElement(Tabs.Tab, null, "Row Types"),
65
+ React.createElement(Tabs.Content, null,
66
+ React.createElement(Flex, { flexDirection: "row" },
67
+ React.createElement(FormLayout, null, data.Target === 'cell' && (React.createElement(React.Fragment, null,
68
+ React.createElement(FormRow, { label: "Data (leaf) Rows:" },
69
+ React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
70
+ React.createElement(CheckBox, { "data-name": "include-data-rows-checkbox", checked: !data.RowScope?.ExcludeDataRows, onChange: onExcludeDataRowsChanged, className: "twa:mr-2" }))),
71
+ React.createElement(FormRow, { label: "Group Rows:" },
72
+ React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
73
+ React.createElement(CheckBox, { "data-name": "include-grouped-rows-checkbox", checked: !data.RowScope?.ExcludeGroupRows, onChange: onExcludeGroupedRowsChanged, className: "twa:mr-2" }))),
74
+ React.createElement(FormRow, { label: "Summary Rows:" },
75
+ React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
76
+ React.createElement(CheckBox, { "data-name": "include-summary-rows-checkbox", checked: !data.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged, className: "twa:mr-2" }))),
77
+ React.createElement(FormRow, { label: "Total Rows:" },
78
+ React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
79
+ React.createElement(CheckBox, { "data-name": "include-total-rows-checkbox", checked: !data.RowScope?.ExcludeTotalRows, onChange: onExcludeTotalRowsChanged, className: "twa:mr-2" })))))))))));
80
+ };
@@ -1,30 +1,22 @@
1
1
  import * as React from 'react';
2
2
  import FormLayout, { FormRow } from '../../../components/FormLayout';
3
- import { CheckBox } from '../../../components/CheckBox';
4
3
  import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard';
5
4
  import { Tag } from '../../../components/Tag';
6
5
  import Radio, { RadioGroup } from '../../../components/Radio';
7
6
  import { Box, Flex } from '../../../components/Flex';
8
7
  import { Tabs } from '../../../components/Tabs';
9
8
  import Input from '../../../components/Input';
9
+ import { TypeRadio } from '../../Wizard/TypeRadio';
10
10
  export const renderFormatColumnSettingsSummary = (data) => {
11
11
  return (React.createElement(Box, { className: "twa:p-2" },
12
12
  React.createElement(Box, { className: "twa:mt-3" },
13
13
  "Name ",
14
14
  React.createElement(Tag, null, data.Name)),
15
15
  React.createElement(Box, { className: "twa:mt-3" },
16
- "Data Rows ",
17
- React.createElement(Tag, null, data.RowScope?.ExcludeDataRows ? 'no' : 'yes')),
16
+ "Target",
17
+ ' ',
18
+ React.createElement(Tag, null, !data.Target || data.Target === 'cell' ? 'Column Cells' : 'Column Header')),
18
19
  ' ',
19
- React.createElement(Box, { className: "twa:mt-3" },
20
- "Group Rows ",
21
- React.createElement(Tag, null, data.RowScope?.ExcludeGroupRows ? 'no' : 'yes')),
22
- React.createElement(Box, { className: "twa:mt-3" },
23
- "Summary Rows ",
24
- React.createElement(Tag, null, data.RowScope?.ExcludeSummaryRows ? 'no' : 'yes')),
25
- React.createElement(Box, { className: "twa:mt-3" },
26
- "Total Rows ",
27
- React.createElement(Tag, null, data.RowScope?.ExcludeTotalRows ? 'no' : 'yes')),
28
20
  React.createElement(Box, { className: "twa:mt-3" },
29
21
  "Apply on Column Groups:",
30
22
  ' ',
@@ -33,49 +25,22 @@ export const renderFormatColumnSettingsSummary = (data) => {
33
25
  : data.ColumnGroupScope))));
34
26
  };
35
27
  export const FormatColumnSettingsWizardSection = (props) => {
36
- const { data } = useOnePageAdaptableWizardContext();
37
- const onNameChange = (event) => {
38
- props.onChange({
39
- ...data,
40
- Name: event.target.value,
41
- });
42
- };
43
- const onExcludeDataRowsChanged = (ExcludeDataRows) => {
44
- props.onChange({
45
- ...data,
46
- RowScope: {
47
- ...data.RowScope,
48
- ExcludeDataRows,
49
- },
50
- });
51
- };
52
- const onExcludeGroupedRowsChanged = (ExcludeGroupedRows) => {
28
+ const { data, api } = useOnePageAdaptableWizardContext();
29
+ const currentTarget = data.Target ? data.Target : 'cell';
30
+ const handleTargetChange = (target) => {
31
+ // Update the formatColumn object
53
32
  props.onChange({
54
33
  ...data,
55
- RowScope: {
56
- ...data.RowScope,
57
- ExcludeGroupRows: ExcludeGroupedRows,
58
- },
34
+ Target: target,
59
35
  });
60
36
  };
61
- const onExcludeSummaryRowsChanged = (ExcludeSummaryRows) => {
62
- props.onChange({
63
- ...data,
64
- RowScope: {
65
- ...data.RowScope,
66
- ExcludeSummaryRows,
67
- },
68
- });
69
- };
70
- const onExcludeTotalRowsChanged = (ExcludeTotalRows) => {
37
+ const onNameChange = (event) => {
71
38
  props.onChange({
72
39
  ...data,
73
- RowScope: {
74
- ...data.RowScope,
75
- ExcludeTotalRows,
76
- },
40
+ Name: event.target.value,
77
41
  });
78
42
  };
43
+ const behaviourSpellingVariant = api.internalApi.getCorrectEnglishVariant('Behaviour');
79
44
  return (React.createElement(Flex, { flexDirection: "column", style: { height: '100%' } },
80
45
  React.createElement(Tabs, { className: "twa:mb-3" },
81
46
  React.createElement(Tabs.Tab, null, "Settings"),
@@ -84,24 +49,20 @@ export const FormatColumnSettingsWizardSection = (props) => {
84
49
  React.createElement(FormLayout, { className: "twa:max-w-[300px] twa:w-full" },
85
50
  React.createElement(FormRow, { label: "Name" },
86
51
  React.createElement(Input, { className: "twa:w-full", "data-name": "format-column-name", onChange: onNameChange, value: data?.Name ?? '' })))))),
52
+ React.createElement(Tabs, { className: "twa:mb-3" },
53
+ React.createElement(Tabs.Tab, null, "Target"),
54
+ React.createElement(Tabs.Content, null,
55
+ React.createElement(Flex, { flexDirection: "column" },
56
+ React.createElement(TypeRadio, { "data-name": "target-column-cell", text: 'Column Cells', description: "Column Cells are styled and formatted", checked: currentTarget === 'cell', onClick: () => handleTargetChange('cell') }),
57
+ React.createElement(TypeRadio, { "data-name": "target-column-header", text: 'Column Header', description: "The Column Header is styled (Note: Conditions are not available for Column Headers)", checked: currentTarget === 'columnHeader', onClick: () => handleTargetChange('columnHeader') })))),
87
58
  React.createElement(Tabs, null,
88
- React.createElement(Tabs.Tab, null, "Configuration"),
59
+ React.createElement(Tabs.Tab, null,
60
+ "Column Group ",
61
+ behaviourSpellingVariant,
62
+ " "),
89
63
  React.createElement(Tabs.Content, null,
90
64
  React.createElement(Flex, { flexDirection: "row" },
91
65
  React.createElement(FormLayout, null,
92
- data.Target === 'cell' && (React.createElement(React.Fragment, null,
93
- React.createElement(FormRow, { label: "Exclude Data Rows:" },
94
- React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
95
- React.createElement(CheckBox, { "data-name": "exclude-data-rows-checkbox", checked: data.RowScope?.ExcludeDataRows, onChange: onExcludeDataRowsChanged, className: "twa:mr-2" }))),
96
- React.createElement(FormRow, { label: "Exclude Group Rows:" },
97
- React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
98
- React.createElement(CheckBox, { "data-name": "exclude-grouped-rows-checkbox", checked: data.RowScope?.ExcludeGroupRows, onChange: onExcludeGroupedRowsChanged, className: "twa:mr-2" }))),
99
- React.createElement(FormRow, { label: "Exclude Row Summaries:" },
100
- React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
101
- React.createElement(CheckBox, { "data-name": "exclude-summary-rows-checkbox", checked: data.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged, className: "twa:mr-2" }))),
102
- React.createElement(FormRow, { label: "Exclude Total Rows:" },
103
- React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
104
- React.createElement(CheckBox, { "data-name": "exclude-total-rows-checkbox", checked: data.RowScope?.ExcludeTotalRows, onChange: onExcludeTotalRowsChanged, className: "twa:mr-2" }))))),
105
66
  React.createElement(FormRow, { label: "Apply on Column Group:" },
106
67
  React.createElement(RadioGroup, { value: data.ColumnGroupScope || 'Both', name: "columnGroupScope", orientation: "horizontal", onRadioChange: (columnGroupScope) => {
107
68
  props.onChange({
@@ -2,7 +2,10 @@ import * as React from 'react';
2
2
  import { useState } from 'react';
3
3
  import { OnePageAdaptableWizard, OnePageWizardSummary } from '../../Wizard/OnePageAdaptableWizard';
4
4
  import { cloneObject } from '../../../Utilities/Helpers/Helper';
5
- import { FormatColumnScopeWizardSection, renderFormatColumnScopeSummary, } from './FormatColumnScopeWizardSection';
5
+ import { FormatColumnScopeWizardSection, renderFormatColumnScopeSummary, } from './FormatColumnColumnScopeWizardSection';
6
+ import { FormatColumnRowScopeWizardSection, renderFormatColumnRowScopeSummary,
7
+ // renderFormatColumnRowScopeSummary,
8
+ } from './FormatColumnRowScopeWizardSection';
6
9
  import { FormatColumnStyleWizardSection, isFormatColumnStyleValid, renderFormatColumnStyleWizardSummary, } from './FormatColumnStyleWizardSection';
7
10
  import { FormatColumnFormatWizardSection, getFormatDisplayTypeForScope, renderFormatColumnFormatSummary, } from './FormatColumnFormatWizardSection';
8
11
  import { useAdaptable } from '../../AdaptableContext';
@@ -17,11 +20,22 @@ import { isAdaptableRuleValid } from '../../Components/EntityRulesEditor/Utiliti
17
20
  import { FormatColumnRuleWizardSection } from './FormatColumnRuleWizardSection';
18
21
  import { DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN } from './constants';
19
22
  import { isObjectEmpty } from '../../../Utilities/Extensions/ObjectExtensions';
20
- import { FormatColumnTargetWizardSection, renderFormatColumnTargetSummary, } from './FormatColumnTargetWizardSection';
21
23
  import { Box, Flex } from '../../../components/Flex';
22
24
  const adjustDisplayFormat = (fc, api) => {
23
25
  const formatColumn = { ...fc };
24
26
  let formatDataType = getFormatDisplayTypeForScope(formatColumn.Scope, api);
27
+ // Add RowScope and Target defaults for Format Columns that have been created in Initial State
28
+ if (!formatColumn.RowScope) {
29
+ formatColumn.RowScope = {
30
+ ExcludeDataRows: false,
31
+ ExcludeGroupRows: false,
32
+ ExcludeSummaryRows: false,
33
+ ExcludeTotalRows: false,
34
+ };
35
+ }
36
+ if (!formatColumn.Target) {
37
+ formatColumn.Target = 'cell';
38
+ }
25
39
  if (formatColumn.Target === 'columnHeader') {
26
40
  // Column Headers are always text
27
41
  formatDataType = 'text';
@@ -96,7 +110,7 @@ export function FormatColumnWizard(props) {
96
110
  return (React.createElement(OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, modal: props.modal, data: formatColumn, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
97
111
  {
98
112
  title: 'Settings',
99
- details: 'Enter Name and set Additional Properties',
113
+ details: 'Enter Name and other Properties',
100
114
  isValid: (formatColumnData) => {
101
115
  if (!formatColumnData.Name) {
102
116
  return 'Format Column Name cannot be blank';
@@ -113,7 +127,7 @@ export function FormatColumnWizard(props) {
113
127
  },
114
128
  },
115
129
  {
116
- title: 'Scope',
130
+ title: 'Columns',
117
131
  details: 'Select which Columns will be formatted',
118
132
  isValid: isScopeValid,
119
133
  renderSummary: renderFormatColumnScopeSummary,
@@ -123,12 +137,12 @@ export function FormatColumnWizard(props) {
123
137
  },
124
138
  },
125
139
  {
126
- title: 'Target',
127
- details: 'Select which Columns Elements will be formatted',
128
- renderSummary: renderFormatColumnTargetSummary,
140
+ title: 'Rows',
141
+ details: 'Select which Rows will be formatted',
142
+ renderSummary: renderFormatColumnRowScopeSummary,
129
143
  render: () => {
130
144
  return (React.createElement(Flex, { flexDirection: "column", className: "twa:p-2 twa:h-full" },
131
- React.createElement(FormatColumnTargetWizardSection, { onChange: setFormatColumn })));
145
+ React.createElement(FormatColumnRowScopeWizardSection, { onChange: setFormatColumn })));
132
146
  },
133
147
  },
134
148
  {
@@ -80,7 +80,6 @@ export const TransposedPopup = (props) => {
80
80
  const transposeConfig = {
81
81
  transposedColumnId: rawConfig.transposedColumnId ?? primaryKey,
82
82
  hideTransposedColumn: rawConfig.hideTransposedColumn ?? true,
83
- autosize: rawConfig.autosize ?? true,
84
83
  columnsToTranspose: rawConfig.columnsToTranspose,
85
84
  rowsToTranspose: rawConfig.rowsToTranspose,
86
85
  };