@adaptabletools/adaptable 20.2.11 → 20.3.0-canary.1
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/agGrid.d.ts +4 -0
- package/agGrid.js +5 -1
- package/base.css +6 -6
- package/base.css.map +1 -1
- package/index.css +6 -6
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
- package/src/AdaptableOptions/ColumnOptions.d.ts +3 -2
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +1 -0
- package/src/AdaptableOptions/PredicateOptions.d.ts +2 -1
- package/src/AdaptableState/Common/AdaptableColumn.d.ts +5 -3
- package/src/AdaptableState/Common/AdaptableColumn.js +7 -0
- package/src/AdaptableState/Common/AdaptableFormat.d.ts +4 -0
- package/src/AdaptableState/Common/AdaptableObject.d.ts +3 -3
- package/src/AdaptableState/Common/AdaptablePredicate.d.ts +4 -0
- package/src/AdaptableState/Common/AdaptablePredicate.js +32 -3
- package/src/AdaptableState/Common/ColumnScope.d.ts +1 -1
- package/src/AdaptableState/Common/CustomWindowConfig.d.ts +40 -0
- package/src/AdaptableState/Common/ProgressIndicatorConfig.d.ts +8 -1
- package/src/AdaptableState/Common/RowScope.d.ts +4 -0
- package/src/AdaptableState/FormatColumnState.d.ts +10 -0
- package/src/AdaptableState/StyledColumnState.d.ts +4 -0
- package/src/Api/ColumnApi.d.ts +6 -0
- package/src/Api/GridApi.d.ts +8 -3
- package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -1
- package/src/Api/Implementation/ColumnApiImpl.js +17 -0
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
- package/src/Api/Implementation/GridApiImpl.js +3 -0
- package/src/Api/Implementation/PredicateApiImpl.d.ts +1 -1
- package/src/Api/Implementation/PredicateApiImpl.js +25 -1
- package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +3 -1
- package/src/Api/Implementation/UserInterfaceApiImpl.js +6 -0
- package/src/Api/Internal/ColumnInternalApi.d.ts +3 -1
- package/src/Api/Internal/ColumnInternalApi.js +7 -0
- package/src/Api/Internal/FormatColumnInternalApi.d.ts +13 -4
- package/src/Api/Internal/FormatColumnInternalApi.js +33 -6
- package/src/Api/UserInterfaceApi.d.ts +16 -4
- package/src/Redux/ActionsReducers/LayoutRedux.d.ts +7 -3
- package/src/Redux/ActionsReducers/PopupRedux.js +1 -0
- package/src/Strategy/StyledColumnModule.js +8 -3
- package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsViewItems.js +6 -0
- package/src/Utilities/Constants/GeneralConstants.d.ts +1 -0
- package/src/Utilities/Constants/GeneralConstants.js +1 -0
- package/src/Utilities/Helpers/FormatHelper.js +3 -0
- package/src/Utilities/Services/ModuleService.js +2 -2
- package/src/Utilities/getScopeViewItems.js +1 -1
- package/src/View/Components/ColumnFilter/utils.js +9 -4
- package/src/View/Components/Popups/AdaptablePopupConfirmation.js +3 -4
- package/src/View/Components/Popups/AdaptablePopupPrompt.js +3 -4
- package/src/View/Components/Popups/WindowPopups/WindowPopups.js +1 -5
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -0
- package/src/View/Export/Wizard/ReportColumnsWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +16 -1
- package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +67 -23
- package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +34 -2
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +1 -1
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -1
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +18 -21
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardSettingsSection.js +22 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.js +6 -13
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings.js +29 -0
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -0
- package/src/agGrid/AdaptableAgGrid.js +30 -3
- package/src/agGrid/AgGridAdapter.js +2 -6
- package/src/agGrid/AgGridColumnAdapter.d.ts +4 -1
- package/src/agGrid/AgGridColumnAdapter.js +111 -10
- package/src/agGrid/cellRenderers/ActionColumnRenderer.js +14 -2
- package/src/agGrid/cellRenderers/BadgeRenderer.js +27 -13
- package/src/components/ProgressIndicator/ProgressIndicator.js +18 -4
- package/src/env.js +2 -2
- package/src/layout-manager/src/index.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +43 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +2 -2
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -20,6 +20,7 @@ import { DEFAULT_DOUBLE_DISPLAY_VALUE, DEFAULT_STRING_DISPLAY_VALUE, } from '../
|
|
|
20
20
|
import Textarea from '../../../components/Textarea';
|
|
21
21
|
import { ButtonInfo } from '../../Components/Buttons/ButtonInfo';
|
|
22
22
|
import { FormatColumnPlaceholderDocsLink } from '../../../Utilities/Constants/DocumentationLinkConstants';
|
|
23
|
+
import { PIVOT_AGGREGATION_TOTAL_COLUMN_TYPE, PIVOT_ANY_TOTAL_COLUMN_TYPE, PIVOT_COLUMN_TOTAL_COLUMN_TYPE, PIVOT_GRAND_TOTAL_COLUMN_TYPE, } from '../../../AdaptableState/Common/AdaptableColumn';
|
|
23
24
|
const DOLLAR_OPTIONS = {
|
|
24
25
|
FractionDigits: 2,
|
|
25
26
|
FractionSeparator: '.',
|
|
@@ -143,6 +144,18 @@ export const getFormatDisplayTypeForScope = (scope, api) => {
|
|
|
143
144
|
return 'text';
|
|
144
145
|
}
|
|
145
146
|
if ('ColumnTypes' in scope && scope.ColumnTypes.length) {
|
|
147
|
+
// if a Pivot Total Column Type is specified, we can safely assume that the data type is number
|
|
148
|
+
const pivotTotalTypes = [
|
|
149
|
+
PIVOT_ANY_TOTAL_COLUMN_TYPE,
|
|
150
|
+
PIVOT_GRAND_TOTAL_COLUMN_TYPE,
|
|
151
|
+
PIVOT_COLUMN_TOTAL_COLUMN_TYPE,
|
|
152
|
+
PIVOT_AGGREGATION_TOTAL_COLUMN_TYPE,
|
|
153
|
+
];
|
|
154
|
+
// if all column types are pivot total types, we can safely assume that the data type is number
|
|
155
|
+
if (scope.ColumnTypes.length > 0 &&
|
|
156
|
+
scope.ColumnTypes.every((type) => pivotTotalTypes.includes(type))) {
|
|
157
|
+
return 'number';
|
|
158
|
+
}
|
|
146
159
|
// need to check if all column with this column type has the same data type and return that particular one
|
|
147
160
|
const columns = scope.ColumnTypes.flatMap((columnType) => {
|
|
148
161
|
return api.columnApi.getColumnsByColumnType(columnType);
|
|
@@ -295,7 +308,9 @@ const renderNumberFormat = (data, onChange, setFormatOption, scopedCustomFormatt
|
|
|
295
308
|
React.createElement(FormRow, { label: "Floor" },
|
|
296
309
|
React.createElement(CheckBox, { "data-name": "floor-checkbox", checked: data.DisplayFormat.Options.Floor, onChange: (checked) => setFormatOption('Floor', checked) })),
|
|
297
310
|
React.createElement(FormRow, { label: "Round" },
|
|
298
|
-
React.createElement(CheckBox, { "data-name": "round-checkbox", checked: data.DisplayFormat.Options.Round, onChange: (checked) => setFormatOption('Round', checked) }))
|
|
311
|
+
React.createElement(CheckBox, { "data-name": "round-checkbox", checked: data.DisplayFormat.Options.Round, onChange: (checked) => setFormatOption('Round', checked) })),
|
|
312
|
+
React.createElement(FormRow, { label: "Empty" },
|
|
313
|
+
React.createElement(CheckBox, { "data-name": "empty-checkbox", checked: data.DisplayFormat.Options.Empty, onChange: (checked) => setFormatOption('Empty', checked) })))))),
|
|
299
314
|
scopedCustomFormatters.length > 0 && (React.createElement(Tabs, { marginTop: 2, keyboardNavigation: false },
|
|
300
315
|
React.createElement(Tabs.Tab, null, "Custom Formats"),
|
|
301
316
|
React.createElement(Tabs.Content, null,
|
|
@@ -2,6 +2,11 @@ import * as React from 'react';
|
|
|
2
2
|
import { NewScopeComponent, renderScopeSummary } from '../../Components/NewScopeComponent';
|
|
3
3
|
import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard';
|
|
4
4
|
import { DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN } from './constants';
|
|
5
|
+
import { Tabs } from '../../../components/Tabs';
|
|
6
|
+
import { Box, Flex } from 'rebass';
|
|
7
|
+
import FormLayout, { FormRow } from '../../../components/FormLayout';
|
|
8
|
+
import { CheckBox } from '../../../components/CheckBox';
|
|
9
|
+
import HelpBlock from '../../../components/HelpBlock';
|
|
5
10
|
export const renderFormatColumnScopeSummary = (data) => {
|
|
6
11
|
return renderScopeSummary(data.Scope, {
|
|
7
12
|
scopeWholeRow: 'Matching rows will be formatted',
|
|
@@ -11,28 +16,67 @@ export const renderFormatColumnScopeSummary = (data) => {
|
|
|
11
16
|
};
|
|
12
17
|
export const FormatColumnScopeWizardSection = (props) => {
|
|
13
18
|
const { data, api } = useOnePageAdaptableWizardContext();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
const currentTargets = data.Target?.length ? data.Target : ['cell'];
|
|
20
|
+
const handleTargetChange = (target, checked) => {
|
|
21
|
+
let newTargets;
|
|
22
|
+
if (checked) {
|
|
23
|
+
// Add the target if it's not already included
|
|
24
|
+
newTargets = [...new Set([...currentTargets, target])];
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// Remove the target
|
|
28
|
+
newTargets = currentTargets.filter((t) => t !== target);
|
|
29
|
+
}
|
|
30
|
+
// If all checkboxes are unchecked, default to ['cell']
|
|
31
|
+
if (newTargets.length === 0) {
|
|
32
|
+
newTargets = ['cell'];
|
|
33
|
+
}
|
|
34
|
+
// Update the formatColumn object
|
|
35
|
+
props.onChange({
|
|
36
|
+
...data,
|
|
37
|
+
Target: newTargets,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
return (React.createElement(React.Fragment, null,
|
|
41
|
+
React.createElement(Tabs, { mb: 3 },
|
|
42
|
+
React.createElement(Tabs.Tab, null, "Target"),
|
|
43
|
+
React.createElement(Tabs.Content, null,
|
|
44
|
+
React.createElement(Flex, { flexDirection: "column" },
|
|
45
|
+
React.createElement(FormLayout, { width: "100%" },
|
|
46
|
+
React.createElement(FormRow, { label: "Target Column Elements: ", tooltip: "The visual elements where formatting will be applied" },
|
|
47
|
+
React.createElement(CheckBox, { "data-name": "target-cell", checked: currentTargets.includes('cell'), onChange: (target) => {
|
|
48
|
+
handleTargetChange('cell', target);
|
|
49
|
+
}, ml: 2 }, "Data Cells"),
|
|
50
|
+
React.createElement(CheckBox, { "data-name": "target-column-header", checked: currentTargets.includes('columnHeader'), onChange: (target) => {
|
|
51
|
+
handleTargetChange('columnHeader', target);
|
|
52
|
+
}, ml: 4 }, "Column Headers"))),
|
|
53
|
+
React.createElement(HelpBlock, { fontSize: 2 }, 'At least one target element must be selected (defaults to Data Cells).' +
|
|
54
|
+
' Conditional formatting rules only apply to Data Cells, not to Headers.')))),
|
|
55
|
+
React.createElement(Box, { "data-name": 'scope-heading', style: {
|
|
56
|
+
borderRadius: `var(--ab__border-radius)`,
|
|
57
|
+
}, padding: 2, backgroundColor: `var(--ab-color-primarylight)` }, "Scope"),
|
|
58
|
+
React.createElement(NewScopeComponent, { descriptions: {
|
|
59
|
+
rowScope: 'Format all columns in the row',
|
|
60
|
+
columnScope: 'Select columns to format',
|
|
61
|
+
}, scope: data.Scope, updateScope: (Scope) => {
|
|
62
|
+
const newData = { ...data, Scope };
|
|
63
|
+
const wholeRow = api.columnScopeApi.scopeIsAll(Scope);
|
|
64
|
+
if (newData.Rule?.Predicates?.length) {
|
|
65
|
+
if (wholeRow) {
|
|
66
|
+
// if scope is whole row, a predicate cannot be present, so we set the rule
|
|
67
|
+
// to be a boolean expression
|
|
68
|
+
delete newData.Rule.Predicates;
|
|
69
|
+
newData.Rule.BooleanExpression = '';
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// if scope is not whole row, if you have a predicate, reset it
|
|
73
|
+
newData.Rule.Predicates = [
|
|
74
|
+
{
|
|
75
|
+
PredicateId: DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN,
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
}
|
|
26
79
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
newData.Rule.Predicates = [
|
|
30
|
-
{
|
|
31
|
-
PredicateId: DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN,
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
props.onChange(newData);
|
|
37
|
-
} }));
|
|
80
|
+
props.onChange(newData);
|
|
81
|
+
} })));
|
|
38
82
|
};
|
|
@@ -7,6 +7,7 @@ import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableW
|
|
|
7
7
|
import { Tag } from '../../../components/Tag';
|
|
8
8
|
import { ToggleGroup } from '../../../components/Toggle/ToggleGroup';
|
|
9
9
|
import { Toggle } from '../../../components/Toggle/Toggle';
|
|
10
|
+
import Radio, { RadioGroup } from '../../../components/Radio';
|
|
10
11
|
export const renderFormatColumnSettingsSummary = (data) => {
|
|
11
12
|
return (React.createElement(Box, { padding: 2 },
|
|
12
13
|
React.createElement(Text, null,
|
|
@@ -21,7 +22,16 @@ export const renderFormatColumnSettingsSummary = (data) => {
|
|
|
21
22
|
React.createElement(Tag, null, data.RowScope?.ExcludeGroupRows ? 'no' : 'yes')),
|
|
22
23
|
React.createElement(Text, { mt: 3 },
|
|
23
24
|
"Summary Rows ",
|
|
24
|
-
React.createElement(Tag, null, data.RowScope?.ExcludeSummaryRows ? 'no' : 'yes'))
|
|
25
|
+
React.createElement(Tag, null, data.RowScope?.ExcludeSummaryRows ? 'no' : 'yes')),
|
|
26
|
+
React.createElement(Text, { mt: 3 },
|
|
27
|
+
"Total Rows ",
|
|
28
|
+
React.createElement(Tag, null, data.RowScope?.ExcludeTotalRows ? 'no' : 'yes')),
|
|
29
|
+
React.createElement(Text, { mt: 3 },
|
|
30
|
+
"Apply on Column Groups:",
|
|
31
|
+
' ',
|
|
32
|
+
React.createElement(Tag, null, !data.ColumnGroupScope || data.ColumnGroupScope === 'Both'
|
|
33
|
+
? 'Always'
|
|
34
|
+
: data.ColumnGroupScope))));
|
|
25
35
|
};
|
|
26
36
|
export const FormatColumnSettingsWizardSection = (props) => {
|
|
27
37
|
const { data } = useOnePageAdaptableWizardContext();
|
|
@@ -59,6 +69,15 @@ export const FormatColumnSettingsWizardSection = (props) => {
|
|
|
59
69
|
},
|
|
60
70
|
});
|
|
61
71
|
};
|
|
72
|
+
const onExcludeTotalRowsChanged = (ExcludeTotalRows) => {
|
|
73
|
+
props.onChange({
|
|
74
|
+
...data,
|
|
75
|
+
RowScope: {
|
|
76
|
+
...data.RowScope,
|
|
77
|
+
ExcludeTotalRows,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
};
|
|
62
81
|
return (React.createElement(Tabs, null,
|
|
63
82
|
React.createElement(Tabs.Tab, null, "Settings"),
|
|
64
83
|
React.createElement(Tabs.Content, null,
|
|
@@ -83,5 +102,18 @@ export const FormatColumnSettingsWizardSection = (props) => {
|
|
|
83
102
|
React.createElement(CheckBox, { "data-name": "exclude-grouped-rows-checkbox", checked: data.RowScope?.ExcludeGroupRows, onChange: onExcludeGroupedRowsChanged, mr: 2 }))),
|
|
84
103
|
React.createElement(FormRow, { label: "Exclude Row Summaries:" },
|
|
85
104
|
React.createElement(Flex, { alignItems: "center", marginLeft: 2 },
|
|
86
|
-
React.createElement(CheckBox, { "data-name": "exclude-summary-rows-checkbox", checked: data.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged, mr: 2 })))
|
|
105
|
+
React.createElement(CheckBox, { "data-name": "exclude-summary-rows-checkbox", checked: data.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged, mr: 2 }))),
|
|
106
|
+
React.createElement(FormRow, { label: "Exclude Total Rows:" },
|
|
107
|
+
React.createElement(Flex, { alignItems: "center", marginLeft: 2 },
|
|
108
|
+
React.createElement(CheckBox, { "data-name": "exclude-total-rows-checkbox", checked: data.RowScope?.ExcludeTotalRows, onChange: onExcludeTotalRowsChanged, mr: 2 }))),
|
|
109
|
+
React.createElement(FormRow, { label: "Apply on Column Group:" },
|
|
110
|
+
React.createElement(RadioGroup, { value: data.ColumnGroupScope || 'Both', name: "columnGroupScope", orientation: "horizontal", onRadioChange: (columnGroupScope) => {
|
|
111
|
+
props.onChange({
|
|
112
|
+
...data,
|
|
113
|
+
ColumnGroupScope: columnGroupScope,
|
|
114
|
+
});
|
|
115
|
+
} },
|
|
116
|
+
React.createElement(Radio, { marginLeft: 1, value: "Both" }, "Always"),
|
|
117
|
+
React.createElement(Radio, { marginLeft: 4, value: "Expanded" }, "Expanded"),
|
|
118
|
+
React.createElement(Radio, { marginLeft: 4, value: "Collapsed" }, "Collapsed"))))))));
|
|
87
119
|
};
|
|
@@ -88,7 +88,7 @@ export function FormatColumnWizard(props) {
|
|
|
88
88
|
};
|
|
89
89
|
return (React.createElement(OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: formatColumn, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
|
|
90
90
|
{
|
|
91
|
-
title: 'Scope',
|
|
91
|
+
title: 'Scope & Target',
|
|
92
92
|
details: 'Select which Columns will be formatted',
|
|
93
93
|
isValid: isScopeValid,
|
|
94
94
|
renderSummary: renderFormatColumnScopeSummary,
|
|
@@ -355,7 +355,8 @@ export const ColumnsSection = (props) => {
|
|
|
355
355
|
};
|
|
356
356
|
const visibleIds = layout.TableColumns.filter((colId) => {
|
|
357
357
|
return (layout.ColumnVisibility?.[colId] !== false &&
|
|
358
|
-
adaptable.api.columnApi.isSelectionColumn(colId) === false
|
|
358
|
+
adaptable.api.columnApi.isSelectionColumn(colId) === false &&
|
|
359
|
+
!adaptable.api.columnApi.internalApi.isAlwaysHiddenColumn(colId));
|
|
359
360
|
});
|
|
360
361
|
const toLabel = (colId) => adaptable.api.columnApi.getFriendlyNameForColumnId(colId, layout);
|
|
361
362
|
const toIdentifier = (colId) => colId;
|
|
@@ -16,6 +16,7 @@ import { Badge } from '../../Components/Badge';
|
|
|
16
16
|
import { AdaptableIconComponent } from '../../Components/AdaptableIconComponent';
|
|
17
17
|
import { DEFAULT_INTEGER_DISPLAY_VALUE, DEFAULT_STRING_DISPLAY_VALUE, } from '../../../Utilities/Constants/GeneralConstants';
|
|
18
18
|
import { Accordion } from '../../../components/Accordion';
|
|
19
|
+
import { CheckBox } from '../../../components/CheckBox';
|
|
19
20
|
const BadgeEditor = (props) => {
|
|
20
21
|
const { api } = useOnePageAdaptableWizardContext();
|
|
21
22
|
const { badge, columnId, onChange } = props;
|
|
@@ -25,9 +26,7 @@ const BadgeEditor = (props) => {
|
|
|
25
26
|
const previewValue = dataType === 'number' || dataType == 'numberArray'
|
|
26
27
|
? DEFAULT_INTEGER_DISPLAY_VALUE
|
|
27
28
|
: DEFAULT_STRING_DISPLAY_VALUE;
|
|
28
|
-
return (React.createElement(
|
|
29
|
-
Flex,
|
|
30
|
-
{ className: "ab-Badge-Definition-Editor", mb: 15, p: 3 },
|
|
29
|
+
return (React.createElement(Flex, { className: "ab-Badge-Definition-Editor", mb: 15, p: 3 },
|
|
31
30
|
React.createElement(Box, { flex: 1 },
|
|
32
31
|
React.createElement(FormLayout, null,
|
|
33
32
|
React.createElement(FormRow, { label: "Preview" },
|
|
@@ -42,22 +41,17 @@ const BadgeEditor = (props) => {
|
|
|
42
41
|
Style,
|
|
43
42
|
});
|
|
44
43
|
} }))),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
columnId ? (React.createElement(React.Fragment, null,
|
|
50
|
-
React.createElement(HelpBlock, { fontSize: 2, mb: 1, mt: 2 }, "Create (optional) Rule for when the Badge is displayed; if no Rule provided Badge will always display (unless overriden by another Rule)"),
|
|
51
|
-
React.createElement(PredicateEditor, { columnId: columnId, predicate: badge.Predicate, predicateDefs: predicateDefs, placeholder: "No Predicate Selected", onChange: (predicate) => {
|
|
52
|
-
onChange({
|
|
53
|
-
...badge,
|
|
54
|
-
Predicate: predicate,
|
|
55
|
-
});
|
|
56
|
-
}, onClear: () => onChange({
|
|
44
|
+
React.createElement(FormRow, { label: 'Predicate' }, columnId ? (React.createElement(React.Fragment, null,
|
|
45
|
+
React.createElement(HelpBlock, { fontSize: 2, mb: 1, mt: 2 }, "Create (optional) Rule for when the Badge is displayed; if no Rule provided Badge will always display (unless overriden by another Rule)"),
|
|
46
|
+
React.createElement(PredicateEditor, { columnId: columnId, predicate: badge.Predicate, predicateDefs: predicateDefs, placeholder: "No Predicate Selected", onChange: (predicate) => {
|
|
47
|
+
onChange({
|
|
57
48
|
...badge,
|
|
58
|
-
Predicate:
|
|
59
|
-
})
|
|
60
|
-
|
|
49
|
+
Predicate: predicate,
|
|
50
|
+
});
|
|
51
|
+
}, onClear: () => onChange({
|
|
52
|
+
...badge,
|
|
53
|
+
Predicate: undefined,
|
|
54
|
+
}) }))) : (React.createElement(ErrorBox, null, "Select a column first"))),
|
|
61
55
|
React.createElement(FormRow, { label: "Icon" },
|
|
62
56
|
React.createElement(HelpBlock, { fontSize: 2, mb: 1, mt: 2 }, "Select (optional) Icon (and Icon position) to display in the Badge"),
|
|
63
57
|
' ',
|
|
@@ -88,10 +82,13 @@ const BadgeEditor = (props) => {
|
|
|
88
82
|
label: 'End',
|
|
89
83
|
onClick: () => onChange({ ...badge, IconPosition: 'End' }),
|
|
90
84
|
},
|
|
91
|
-
] }, badge.IconPosition ?? 'Start')))
|
|
85
|
+
] }, badge.IconPosition ?? 'Start'))),
|
|
86
|
+
badge.Icon && (React.createElement(FormRow, { label: "Show Icon Only" },
|
|
87
|
+
React.createElement(CheckBox, { checked: badge.IconOnly,
|
|
88
|
+
// onClick=()=> onChange({ ...badge, IconPosition: 'End' })
|
|
89
|
+
onClick: () => onChange({ ...badge, IconOnly: !badge.IconOnly }) }))))),
|
|
92
90
|
React.createElement(Box, { justifyContent: "end" },
|
|
93
|
-
React.createElement(SimpleButton, { icon: "delete", onClick: props.onDelete }))
|
|
94
|
-
));
|
|
91
|
+
React.createElement(SimpleButton, { icon: "delete", onClick: props.onDelete }))));
|
|
95
92
|
};
|
|
96
93
|
export const renderBadgeSummary = (styledColumn) => {
|
|
97
94
|
return React.createElement(StyledColumnBadgePreview, { data: styledColumn });
|
|
@@ -100,7 +100,7 @@ export const StyledColumnWizard = (props) => {
|
|
|
100
100
|
if (styledColumn.BadgeStyle.Badges?.length === 0) {
|
|
101
101
|
return 'Define at least one Badge';
|
|
102
102
|
}
|
|
103
|
-
const badgesWithNoRules = styledColumn.BadgeStyle.Badges.filter((b) => b.Expression == undefined
|
|
103
|
+
const badgesWithNoRules = styledColumn.BadgeStyle.Badges.filter((b) => b.Expression == undefined && b.Predicate == undefined);
|
|
104
104
|
if (badgesWithNoRules.length > 1) {
|
|
105
105
|
return 'Only one Badge can have no Rule';
|
|
106
106
|
}
|
|
@@ -17,7 +17,10 @@ export const renderStyledColumnWizardSettingsSummary = (data) => {
|
|
|
17
17
|
React.createElement(Tag, null, badgeStyle.RowScope?.ExcludeGroupRows ? 'no' : 'yes')),
|
|
18
18
|
React.createElement(Text, { mt: 3 },
|
|
19
19
|
"Summary Rows ",
|
|
20
|
-
React.createElement(Tag, null, badgeStyle.RowScope?.ExcludeSummaryRows ? 'no' : 'yes'))
|
|
20
|
+
React.createElement(Tag, null, badgeStyle.RowScope?.ExcludeSummaryRows ? 'no' : 'yes')),
|
|
21
|
+
React.createElement(Text, { mt: 3 },
|
|
22
|
+
"Total Rows ",
|
|
23
|
+
React.createElement(Tag, null, badgeStyle.RowScope?.ExcludeTotalRows ? 'no' : 'yes'))));
|
|
21
24
|
};
|
|
22
25
|
export const StyledColumnWizardSettingsSection = (props) => {
|
|
23
26
|
const { data } = useOnePageAdaptableWizardContext();
|
|
@@ -57,6 +60,18 @@ export const StyledColumnWizardSettingsSection = (props) => {
|
|
|
57
60
|
},
|
|
58
61
|
});
|
|
59
62
|
};
|
|
63
|
+
const onExcludeTotalRowsChanged = (ExcludeTotalRows) => {
|
|
64
|
+
props.onChange({
|
|
65
|
+
...data,
|
|
66
|
+
BadgeStyle: {
|
|
67
|
+
...data.BadgeStyle,
|
|
68
|
+
RowScope: {
|
|
69
|
+
...data.BadgeStyle.RowScope,
|
|
70
|
+
ExcludeTotalRows,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
};
|
|
60
75
|
return (React.createElement(Tabs, null,
|
|
61
76
|
React.createElement(Tabs.Tab, null, "Settings"),
|
|
62
77
|
React.createElement(Tabs.Content, null,
|
|
@@ -77,5 +92,10 @@ export const StyledColumnWizardSettingsSection = (props) => {
|
|
|
77
92
|
React.createElement(CheckBox, { "data-name": "exclude-summary-rows-checkbox", checked:
|
|
78
93
|
// @ts-ignore
|
|
79
94
|
data.BadgeStyle.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged, mr: 2 }))),
|
|
80
|
-
' '
|
|
95
|
+
' ',
|
|
96
|
+
React.createElement(FormRow, { label: "Exclude Total Rows:" },
|
|
97
|
+
React.createElement(Flex, { alignItems: "center", marginLeft: 2 },
|
|
98
|
+
React.createElement(CheckBox, { "data-name": "exclude-total-rows-checkbox", checked:
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
data.BadgeStyle.RowScope?.ExcludeTotalRows, onChange: onExcludeTotalRowsChanged, mr: 2 }))))))));
|
|
81
101
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Box, Flex } from 'rebass';
|
|
3
|
-
import { Tag } from '../../../../../components/Tag';
|
|
4
3
|
import { DEFAULT_INTEGER_DISPLAY_VALUE, DEFAULT_STRING_DISPLAY_VALUE, } from '../../../../../Utilities/Constants/GeneralConstants';
|
|
5
4
|
import { useAdaptable } from '../../../../AdaptableContext';
|
|
6
5
|
import { Badge } from '../../../../Components/Badge';
|
|
@@ -10,19 +9,13 @@ export const StyledColumnBadgePreview = ({ data }) => {
|
|
|
10
9
|
if (!badgeStyle || badgeStyle.Badges.length === 0) {
|
|
11
10
|
return React.createElement("div", null, "No Badges Defined");
|
|
12
11
|
}
|
|
13
|
-
const value = adaptable.api.columnApi.getColumnDataTypeForColumnId(data.ColumnId) === 'number'
|
|
14
|
-
? DEFAULT_INTEGER_DISPLAY_VALUE
|
|
15
|
-
: DEFAULT_STRING_DISPLAY_VALUE;
|
|
16
12
|
return (React.createElement(Flex, { flexDirection: "column" }, badgeStyle.Badges.map((badge, index) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
ruleString = badge.Expression.BooleanExpression;
|
|
23
|
-
}
|
|
13
|
+
const badgeValue = badge.IconOnly
|
|
14
|
+
? ''
|
|
15
|
+
: adaptable.api.columnApi.getColumnDataTypeForColumnId(data.ColumnId) === 'number'
|
|
16
|
+
? DEFAULT_INTEGER_DISPLAY_VALUE
|
|
17
|
+
: DEFAULT_STRING_DISPLAY_VALUE;
|
|
24
18
|
return (React.createElement(Box, { mb: 1, key: index },
|
|
25
|
-
React.createElement(Badge, { icon: badge.Icon, adaptableStyle: badge.Style, iconPosition: badge.IconPosition },
|
|
26
|
-
React.createElement(Tag, { ml: 2 }, ruleString)));
|
|
19
|
+
React.createElement(Badge, { icon: badge.Icon, adaptableStyle: badge.Style, iconPosition: badge.IconPosition }, badgeValue)));
|
|
27
20
|
})));
|
|
28
21
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Box, Flex } from 'rebass';
|
|
3
|
+
import { Tag } from '../../../../../components/Tag';
|
|
4
|
+
import { useAdaptable } from '../../../../AdaptableContext';
|
|
5
|
+
export const StyledColumnBadgeSettings = ({ data }) => {
|
|
6
|
+
const adaptable = useAdaptable();
|
|
7
|
+
const badgeStyle = data.BadgeStyle;
|
|
8
|
+
if (!badgeStyle || badgeStyle.Badges.length === 0) {
|
|
9
|
+
return React.createElement("div", null, "No Badges Defined");
|
|
10
|
+
}
|
|
11
|
+
return (React.createElement(Flex, { flexDirection: "column" }, badgeStyle.Badges.map((badge, index) => {
|
|
12
|
+
let ruleString = 'No Rule';
|
|
13
|
+
if (badge.Predicate) {
|
|
14
|
+
ruleString = adaptable.api.predicateApi.predicateToString(badge.Predicate);
|
|
15
|
+
}
|
|
16
|
+
if (badge.Expression) {
|
|
17
|
+
ruleString = badge.Expression.BooleanExpression;
|
|
18
|
+
}
|
|
19
|
+
const iconOnly = badge.Icon && badge.IconOnly;
|
|
20
|
+
const hasIconPosition = badge.Icon && badge.IconPosition;
|
|
21
|
+
const iconPosition = hasIconPosition ? 'Icon Position: ' + badge.IconPosition : '';
|
|
22
|
+
return (React.createElement(Box, { mt: 2, mb: 2, key: index },
|
|
23
|
+
React.createElement(Tag, null, ruleString),
|
|
24
|
+
iconOnly && React.createElement(Tag, { ml: 2 }, 'Icon Only'),
|
|
25
|
+
' ',
|
|
26
|
+
hasIconPosition && React.createElement(Tag, { ml: 2 }, iconPosition),
|
|
27
|
+
' '));
|
|
28
|
+
})));
|
|
29
|
+
};
|
|
@@ -223,6 +223,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
223
223
|
getFirstRowNode(): IRowNode | undefined;
|
|
224
224
|
updateRowGroupsAndColumnGroupsExpandedState(layout?: Layout): void;
|
|
225
225
|
isGroupRowNode(rowNode: IRowNode): boolean;
|
|
226
|
+
isGrandTotalRowNode(rowNode: IRowNode): boolean;
|
|
226
227
|
getFilteredData(): any[];
|
|
227
228
|
/**
|
|
228
229
|
* This method internally differentiates between server-side and client-side row model
|
|
@@ -8,7 +8,7 @@ import Emitter from '../Utilities/Emitter';
|
|
|
8
8
|
import { applyDefaultAdaptableOptions } from '../AdaptableOptions/DefaultAdaptableOptions';
|
|
9
9
|
import { AgGridAdapter } from './AgGridAdapter';
|
|
10
10
|
import * as GeneralConstants from '../Utilities/Constants/GeneralConstants';
|
|
11
|
-
import { AUTOGENERATED_PK_COLUMN, ERROR_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, QUARTER_SECOND, } from '../Utilities/Constants/GeneralConstants';
|
|
11
|
+
import { AG_GRID_GRAND_TOTAL_ROW_ID, AUTOGENERATED_PK_COLUMN, ERROR_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, QUARTER_SECOND, } from '../Utilities/Constants/GeneralConstants';
|
|
12
12
|
import { DataService } from '../Utilities/Services/DataService';
|
|
13
13
|
import { AdaptableStore } from '../Redux/Store/AdaptableStore';
|
|
14
14
|
import { AdaptableApiImpl } from '../Api/Implementation/AdaptableApiImpl';
|
|
@@ -93,7 +93,7 @@ import { AgGridExportAdapter } from './AgGridExportAdapter';
|
|
|
93
93
|
import { checkForDuplicateColumns, getLayoutRowGroupValuesExceptionGroupKeys, 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, PIVOT_AGGREGATION_TOTAL_COLUMN_TYPE, PIVOT_ANY_TOTAL_COLUMN_TYPE, PIVOT_COLUMN_TOTAL_COLUMN_TYPE, PIVOT_GRAND_TOTAL_COLUMN_TYPE, } from '../AdaptableState/Common/AdaptableColumn';
|
|
96
|
+
import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, HIDDEN_COLUMN_TYPE, hiddenColDefConfig, 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';
|
|
@@ -1090,6 +1090,7 @@ You need to define at least one Layout!`);
|
|
|
1090
1090
|
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'columnTypes', (original_columnTypes) => {
|
|
1091
1091
|
const providedColumnTypes = original_columnTypes || {};
|
|
1092
1092
|
const adaptableSpecialColumnTypes = {
|
|
1093
|
+
[HIDDEN_COLUMN_TYPE]: hiddenColDefConfig,
|
|
1093
1094
|
[CALCULATED_COLUMN_TYPE]: {},
|
|
1094
1095
|
[FREE_TEXT_COLUMN_TYPE]: {},
|
|
1095
1096
|
[ACTION_COLUMN_TYPE]: {},
|
|
@@ -2027,6 +2028,12 @@ You need to define at least one Layout!`);
|
|
|
2027
2028
|
}
|
|
2028
2029
|
return false;
|
|
2029
2030
|
}
|
|
2031
|
+
isGrandTotalRowNode(rowNode) {
|
|
2032
|
+
if (!rowNode) {
|
|
2033
|
+
return false;
|
|
2034
|
+
}
|
|
2035
|
+
return rowNode.id === AG_GRID_GRAND_TOTAL_ROW_ID;
|
|
2036
|
+
}
|
|
2030
2037
|
getFilteredData() {
|
|
2031
2038
|
const data = [];
|
|
2032
2039
|
this.agGridAdapter.getAgGridApi().forEachNodeAfterFilter((rowNode) => {
|
|
@@ -2408,6 +2415,7 @@ You need to define at least one Layout!`);
|
|
|
2408
2415
|
}
|
|
2409
2416
|
}
|
|
2410
2417
|
getUniqueGridCells(column, gridCells) {
|
|
2418
|
+
let gridCellsToUse = gridCells;
|
|
2411
2419
|
const cache = new Map();
|
|
2412
2420
|
const lowercase = this.api.predicateApi.useCaseSensitivity();
|
|
2413
2421
|
const getter = (dataItem) => {
|
|
@@ -2421,13 +2429,32 @@ You need to define at least one Layout!`);
|
|
|
2421
2429
|
return value;
|
|
2422
2430
|
};
|
|
2423
2431
|
const self = this;
|
|
2432
|
+
// handle the special case where GridCells have arrays as values
|
|
2433
|
+
// in this case we want to treat each value in the array as a separate value
|
|
2434
|
+
if (this.api.columnApi.internalApi.hasArrayDataType(column)) {
|
|
2435
|
+
gridCellsToUse = gridCellsToUse.flatMap((gridCell) => {
|
|
2436
|
+
const rawValueArray = gridCell.rawValue;
|
|
2437
|
+
if (Array.isArray(rawValueArray)) {
|
|
2438
|
+
return rawValueArray.map((rawValue) => ({
|
|
2439
|
+
...gridCell,
|
|
2440
|
+
// for now just map the rawValue
|
|
2441
|
+
// extracting displayValue and normalisedValue is possible
|
|
2442
|
+
// but it could have a significant performance impact
|
|
2443
|
+
rawValue: rawValue,
|
|
2444
|
+
displayValue: rawValue,
|
|
2445
|
+
normalisedValue: rawValue,
|
|
2446
|
+
}));
|
|
2447
|
+
}
|
|
2448
|
+
return [gridCell];
|
|
2449
|
+
});
|
|
2450
|
+
}
|
|
2424
2451
|
// those are grid cells unique per primary key - so cells corresponding to this column
|
|
2425
2452
|
// by for every row in the grid
|
|
2426
2453
|
// but here we want to collapse them down to values/cells unique by the
|
|
2427
2454
|
// value of this column: eg - if this is country column and we have multiple rownodes
|
|
2428
2455
|
// in the grid with country: UK, and multiple with country: France, then the end result
|
|
2429
2456
|
// of the current function should be 2 cells: one for UK and one for France
|
|
2430
|
-
|
|
2457
|
+
gridCellsToUse.forEach((dataItem) => {
|
|
2431
2458
|
const value = getter(dataItem);
|
|
2432
2459
|
if (!cache.has(value)) {
|
|
2433
2460
|
cache.set(value, {
|
|
@@ -459,12 +459,8 @@ export class AgGridAdapter {
|
|
|
459
459
|
? 'number'
|
|
460
460
|
: this.deriveAdaptableColumnDataType(agGridColumn, false);
|
|
461
461
|
const isTreeColumn = this.isTreeColumn(isGeneratedRowGroupColumn);
|
|
462
|
-
const
|
|
463
|
-
const
|
|
464
|
-
!isTreeColumn &&
|
|
465
|
-
colDef.lockVisible === true &&
|
|
466
|
-
colDef.suppressColumnsToolPanel === true &&
|
|
467
|
-
colDef.suppressFiltersToolPanel === true;
|
|
462
|
+
const alwaysHidden = this.adaptableApi.columnApi.internalApi.isAlwaysHiddenColumn(colDef);
|
|
463
|
+
const visible = !alwaysHidden || agGridColumn.isVisible();
|
|
468
464
|
const isGenerated = isGeneratedRowGroupColumn || isGeneratedPivotResultColumn || isGeneratedSelectionColumn;
|
|
469
465
|
const abColumn = {
|
|
470
466
|
Uuid: createUuid(),
|
|
@@ -19,7 +19,9 @@ export declare class AgGridColumnAdapter {
|
|
|
19
19
|
setupColumns(): void;
|
|
20
20
|
private setupColumnValueGetter;
|
|
21
21
|
private setupColumnCellClass;
|
|
22
|
+
private setupColumnHeaderClass;
|
|
22
23
|
private setupColumnCellStyle;
|
|
24
|
+
private setupColumnHeaderStyle;
|
|
23
25
|
private setupColumnCellEditor;
|
|
24
26
|
private setupColumnCellRenderer;
|
|
25
27
|
private setupColumnTooltipValueGetter;
|
|
@@ -55,9 +57,10 @@ export declare class AgGridColumnAdapter {
|
|
|
55
57
|
private getEditedCellStyle;
|
|
56
58
|
/**
|
|
57
59
|
* The combination of styled column and format cells
|
|
58
|
-
* This
|
|
60
|
+
* This function decides when the two can be merged.
|
|
59
61
|
*/
|
|
60
62
|
private getFormatColumnAndStyledColumnCellStyle;
|
|
63
|
+
private getFormatColumnHeaderStyle;
|
|
61
64
|
private getStyledColumnStyle;
|
|
62
65
|
private getFormatColumnCellStyle;
|
|
63
66
|
private getFormatColumnAdaptableStyle;
|