@adaptabletools/adaptable 22.0.0-canary.6 → 22.0.0-canary.8
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/index.css +63 -74
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +6 -6
- package/src/AdaptableOptions/ContainerOptions.d.ts +55 -15
- package/src/AdaptableState/AdaptableState.d.ts +2 -0
- package/src/AdaptableState/AlertState.d.ts +1 -2
- package/src/AdaptableState/Common/AdaptableColumnContext.d.ts +9 -0
- package/src/AdaptableState/Common/AdaptableObject.d.ts +4 -0
- package/src/AdaptableState/Common/AdaptableRowContext.d.ts +11 -0
- package/src/AdaptableState/Common/AdaptableRowContext.js +1 -0
- package/src/AdaptableState/Common/BaseContext.d.ts +2 -0
- package/src/AdaptableState/Common/DataUpdateConfig.d.ts +7 -0
- package/src/AdaptableState/Common/NamedObject.d.ts +10 -0
- package/src/AdaptableState/Common/NamedObject.js +1 -0
- package/src/AdaptableState/Common/RowSummary.d.ts +1 -1
- package/src/AdaptableState/Common/Schedule.d.ts +2 -2
- package/src/AdaptableState/Common/SuspendableObject.d.ts +10 -0
- package/src/AdaptableState/Common/SuspendableObject.js +1 -0
- package/src/AdaptableState/Common/TransposeConfig.d.ts +11 -9
- package/src/AdaptableState/CustomSortState.d.ts +1 -1
- package/src/AdaptableState/FormatColumnState.d.ts +1 -1
- package/src/AdaptableState/InitialState.d.ts +9 -0
- package/src/AdaptableState/LayoutState.d.ts +2 -3
- package/src/AdaptableState/PlusMinusState.d.ts +1 -1
- package/src/AdaptableState/ShortcutState.d.ts +1 -1
- package/src/AdaptableState/StyledColumnState.d.ts +1 -1
- package/src/AdaptableState/UserInterfaceState.d.ts +14 -0
- package/src/AdaptableState/UserInterfaceState.js +1 -0
- package/src/Api/AlertApi.d.ts +6 -0
- package/src/Api/CustomSortApi.d.ts +6 -0
- package/src/Api/FlashingCellApi.d.ts +6 -0
- package/src/Api/FormatColumnApi.d.ts +10 -4
- package/src/Api/GridApi.d.ts +5 -9
- package/src/Api/Implementation/AlertApiImpl.d.ts +1 -0
- package/src/Api/Implementation/AlertApiImpl.js +5 -6
- package/src/Api/Implementation/ChartingApiImpl.js +2 -2
- package/src/Api/Implementation/CustomSortApiImpl.d.ts +1 -0
- package/src/Api/Implementation/CustomSortApiImpl.js +3 -0
- package/src/Api/Implementation/FlashingCellApiImpl.d.ts +1 -0
- package/src/Api/Implementation/FlashingCellApiImpl.js +3 -0
- package/src/Api/Implementation/FormatColumnApiImpl.d.ts +6 -5
- package/src/Api/Implementation/FormatColumnApiImpl.js +6 -5
- package/src/Api/Implementation/GridApiImpl.d.ts +2 -6
- package/src/Api/Implementation/GridApiImpl.js +9 -9
- package/src/Api/Implementation/LayoutApiImpl.d.ts +1 -0
- package/src/Api/Implementation/LayoutApiImpl.js +4 -1
- package/src/Api/Implementation/NamedQueryApiImpl.js +2 -2
- package/src/Api/Implementation/PlusMinusApiImpl.d.ts +1 -0
- package/src/Api/Implementation/PlusMinusApiImpl.js +3 -0
- package/src/Api/Implementation/ScheduleApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ScheduleApiImpl.js +3 -0
- package/src/Api/Implementation/ShortcutApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ShortcutApiImpl.js +3 -0
- package/src/Api/Implementation/SystemStatusApiImpl.js +6 -9
- package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +5 -0
- package/src/Api/Implementation/UserInterfaceApiImpl.js +13 -0
- package/src/Api/Internal/CalculatedColumnInternalApi.js +2 -2
- package/src/Api/Internal/FreeTextColumnInternalApi.js +2 -2
- package/src/Api/Internal/LayoutInternalApi.js +1 -1
- package/src/Api/Internal/NamedQueryInternalApi.js +4 -4
- package/src/Api/LayoutApi.d.ts +6 -0
- package/src/Api/PlusMinusApi.d.ts +6 -0
- package/src/Api/ScheduleApi.d.ts +6 -0
- package/src/Api/ShortcutApi.d.ts +6 -0
- package/src/Api/UserInterfaceApi.d.ts +17 -0
- package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +8 -0
- package/src/Redux/ActionsReducers/FormatColumnRedux.js +15 -0
- package/src/Redux/ActionsReducers/UserInterfaceRedux.d.ts +11 -0
- package/src/Redux/ActionsReducers/UserInterfaceRedux.js +21 -0
- package/src/Redux/Store/AdaptableStore.js +45 -16
- package/src/Strategy/BulkUpdateModule.js +8 -8
- package/src/Strategy/PlusMinusModule.js +1 -1
- package/src/Strategy/QuickSearchModule.js +1 -1
- package/src/Strategy/SettingsPanelModule.js +11 -7
- package/src/Strategy/SmartEditModule.js +10 -10
- package/src/Utilities/Services/DataService.js +1 -1
- package/src/Utilities/Services/Fdc3Service.js +4 -4
- package/src/Utilities/Services/ModuleService.js +1 -3
- package/src/Utilities/Services/ThemeService.js +2 -6
- package/src/Utilities/Services/ValidationService.js +1 -1
- package/src/Utilities/logDeprecation.js +3 -4
- package/src/Utilities/resolveContainerElement.d.ts +23 -0
- package/src/Utilities/resolveContainerElement.js +44 -0
- package/src/View/Alert/Wizard/isValidAlertRules.js +1 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +2 -2
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +2 -2
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +1 -1
- package/src/View/Charting/ChartingWizard/AgChargingWizard/SettingsSection.js +2 -2
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.js +2 -2
- package/src/View/Components/CellPopup/index.js +1 -1
- package/src/View/Components/ColumnFilter/components/ColumnFilterInput.js +1 -1
- package/src/View/Components/EntityRulesEditor/Utilities.js +5 -5
- package/src/View/Components/NewScopeComponent.js +3 -3
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +2 -1
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupBody.js +1 -1
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.d.ts +1 -1
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.js +1 -8
- package/src/View/Components/Popups/AdaptablePopupConfirmation.js +1 -1
- package/src/View/Components/Popups/WindowPopups/WindowPopups.js +36 -1
- package/src/View/Components/WizardSummaryPage.js +1 -1
- package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.js +3 -3
- package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +1 -1
- package/src/View/Dashboard/CustomToolbar.js +1 -1
- package/src/View/DataChangeHistory/DataChangeHistoryViewPanel.js +1 -1
- package/src/View/FlashingCell/Wizard/isValidFlashingCellRules.js +1 -1
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.d.ts +1 -1
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +3 -3
- package/src/View/Layout/LayoutViewPanel.js +1 -1
- package/src/View/Layout/TransposedPopup.js +144 -138
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
- package/src/View/Layout/Wizard/sections/FilterSection.js +1 -1
- package/src/View/Layout/Wizard/sections/GridFilterSection.js +1 -1
- package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +3 -3
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +1 -1
- package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +2 -2
- package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +5 -5
- package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReminder.js +1 -1
- package/src/View/Schedule/Wizard/ScheduleSettingsWizard/isSettingsValid.d.ts +1 -1
- package/src/View/Schedule/Wizard/ScheduleSettingsWizard/isSettingsValid.js +11 -11
- package/src/View/StateManagement/handleExportState.js +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +1 -1
- package/src/View/UIHelper.d.ts +2 -1
- package/src/View/UIHelper.js +8 -14
- package/src/agGrid/Adaptable.js +11 -11
- package/src/agGrid/AdaptableAgGrid.d.ts +12 -8
- package/src/agGrid/AdaptableAgGrid.js +150 -82
- package/src/agGrid/AgGridAdapter.js +8 -8
- package/src/agGrid/AgGridColumnAdapter.js +1 -1
- package/src/agGrid/AgGridExportAdapter.js +5 -5
- package/src/agGrid/AgGridFloatingFilterAdapter.js +1 -1
- package/src/agGrid/AgGridMenuAdapter.js +9 -1
- package/src/agGrid/AgGridThemeAdapter.js +2 -2
- package/src/components/CheckBox/index.js +1 -1
- package/src/components/Dropdown/Arrows.js +1 -1
- package/src/components/ExpressionEditor/DataTableEditor.js +3 -3
- package/src/components/FormLayout/index.js +1 -1
- package/src/components/OverlayTrigger/index.js +1 -1
- package/src/components/Select/Select.js +1 -1
- package/src/components/Tree/TreeDropdown/index.js +1 -1
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +62 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/migration/AdaptableUpgradeHelper.js +2 -2
- package/src/migration/VersionUpgrade17.js +4 -4
- package/src/migration/VersionUpgrade20.js +4 -4
- package/src/types.d.ts +5 -2
- package/themes/dark.css +30 -29
- package/themes/light.css +4 -2
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -5,72 +5,153 @@ import { useAdaptable } from '../AdaptableContext';
|
|
|
5
5
|
import { ColumnSelector } from '../Components/Selectors/ColumnSelector';
|
|
6
6
|
import { AdaptableAgGrid } from '../../agGrid/AdaptableAgGrid';
|
|
7
7
|
import { Box, Flex } from '../../components/Flex';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { ExportModuleId } from '../../Utilities/Constants/ModuleConstants';
|
|
9
|
+
import StringExtensions from '../../Utilities/Extensions/StringExtensions';
|
|
10
|
+
const ADAPTABLE_CONTAINER_ID = 'transposed-adaptable-container';
|
|
11
|
+
const AG_GRID_CONTAINER_ID = 'transposed-adaptable-ag-grid-container';
|
|
12
|
+
/** Field used for the first column in transposed grid (hidden, holds column id). */
|
|
13
|
+
const TRANSPOSED_FIRST_COLUMN_FIELD = '_transposed_column_value';
|
|
14
|
+
/** Header used for the first visible column in transposed grid (shows friendly name). */
|
|
15
|
+
const TRANSPOSED_FIRST_COLUMN_HEADER = '_transposed_column_header';
|
|
16
|
+
function buildTransposedAdaptableOptions({ hostOptions, transposedRowsAndColumns, currentTheme, }) {
|
|
17
|
+
return {
|
|
18
|
+
primaryKey: TRANSPOSED_FIRST_COLUMN_FIELD,
|
|
19
|
+
licenseKey: hostOptions.licenseKey,
|
|
20
|
+
userName: `${hostOptions.userName}`,
|
|
21
|
+
adaptableId: `${hostOptions.adaptableId}::TransposedView`,
|
|
22
|
+
containerOptions: {
|
|
23
|
+
adaptableContainer: ADAPTABLE_CONTAINER_ID,
|
|
24
|
+
agGridContainer: AG_GRID_CONTAINER_ID,
|
|
25
|
+
},
|
|
26
|
+
entitlementOptions: { defaultAccessLevel: 'Hidden' },
|
|
27
|
+
initialState: {
|
|
28
|
+
Layout: {
|
|
29
|
+
Revision: Date.now(),
|
|
30
|
+
CurrentLayout: 'TransposedView',
|
|
31
|
+
Layouts: [
|
|
32
|
+
{
|
|
33
|
+
Name: 'TransposedView',
|
|
34
|
+
TableColumns: [
|
|
35
|
+
TRANSPOSED_FIRST_COLUMN_HEADER,
|
|
36
|
+
...transposedRowsAndColumns.transposedColumns.map((c) => c.colId),
|
|
37
|
+
],
|
|
38
|
+
ColumnPinning: { [TRANSPOSED_FIRST_COLUMN_HEADER]: 'left' },
|
|
39
|
+
AutoSizeColumns: true,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
Theme: { CurrentTheme: currentTheme },
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function buildTransposedGridOptions({ transposedRowsAndColumns, elevatedColumnId, adaptableApi, }) {
|
|
48
|
+
const firstColumn = {
|
|
49
|
+
field: TRANSPOSED_FIRST_COLUMN_HEADER,
|
|
50
|
+
headerName: adaptableApi.columnApi.getFriendlyNameForColumnId(elevatedColumnId),
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
loading: false,
|
|
54
|
+
defaultColDef: {
|
|
55
|
+
floatingFilter: false,
|
|
56
|
+
filter: false,
|
|
57
|
+
sortable: true,
|
|
58
|
+
resizable: true,
|
|
59
|
+
enableRowGroup: false,
|
|
60
|
+
editable: false,
|
|
61
|
+
enablePivot: false,
|
|
62
|
+
enableValue: false,
|
|
63
|
+
lockPinned: true,
|
|
64
|
+
menuTabs: [],
|
|
65
|
+
width: 120,
|
|
66
|
+
},
|
|
67
|
+
columnDefs: [
|
|
68
|
+
{ field: TRANSPOSED_FIRST_COLUMN_FIELD, hide: true },
|
|
69
|
+
firstColumn,
|
|
70
|
+
...transposedRowsAndColumns.transposedColumns.map((col) => ({ field: col.colId, headerName: col.header })),
|
|
71
|
+
],
|
|
72
|
+
rowData: transposedRowsAndColumns.transposedRows,
|
|
73
|
+
sideBar: false,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
10
76
|
export const TransposedPopup = (props) => {
|
|
11
77
|
const adaptable = useAdaptable();
|
|
12
|
-
const { transposedColumnId, hideTransposedColumn, visibleColumns, visibleRows, autosize } = props.popupProps;
|
|
13
|
-
const rowNodes = React.useMemo(() => {
|
|
14
|
-
return props.popupProps.visibleRows
|
|
15
|
-
? adaptable.api.gridApi.getVisibleRowNodes()
|
|
16
|
-
: adaptable.api.gridApi.getAllRowNodes();
|
|
17
|
-
}, [
|
|
18
|
-
// can be later triggered by tickng data
|
|
19
|
-
]);
|
|
20
78
|
const primaryKey = adaptable.api.optionsApi.getPrimaryKey();
|
|
21
|
-
const
|
|
22
|
-
const
|
|
79
|
+
const rawConfig = (props.popupProps ?? {});
|
|
80
|
+
const transposeConfig = {
|
|
81
|
+
transposedColumnId: rawConfig.transposedColumnId ?? primaryKey,
|
|
82
|
+
hideTransposedColumn: rawConfig.hideTransposedColumn ?? true,
|
|
83
|
+
autosize: rawConfig.autosize ?? true,
|
|
84
|
+
columnsToTranspose: rawConfig.columnsToTranspose,
|
|
85
|
+
rowsToTranspose: rawConfig.rowsToTranspose,
|
|
86
|
+
};
|
|
87
|
+
const rowNodes = React.useMemo(() => {
|
|
88
|
+
let transposableRowNodes = [];
|
|
89
|
+
const rowsToTranspose = transposeConfig.rowsToTranspose;
|
|
90
|
+
if (rowsToTranspose === 'VisibleOnly') {
|
|
91
|
+
return adaptable.api.gridApi.getVisibleRowNodes();
|
|
92
|
+
}
|
|
93
|
+
if (rowsToTranspose === 'All') {
|
|
94
|
+
return adaptable.api.gridApi.getAllRowNodes();
|
|
95
|
+
}
|
|
96
|
+
if (StringExtensions.IsNotNullOrEmpty(rowsToTranspose)) {
|
|
97
|
+
adaptable.api.gridApi.getAllRowNodes().forEach((rn) => {
|
|
98
|
+
const shouldTransposeRow = adaptable.api.internalApi
|
|
99
|
+
.getQueryLanguageService()
|
|
100
|
+
.evaluateBooleanExpression(rowsToTranspose, ExportModuleId, rn);
|
|
101
|
+
if (shouldTransposeRow) {
|
|
102
|
+
transposableRowNodes.push(rn);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return transposableRowNodes;
|
|
106
|
+
}
|
|
107
|
+
return adaptable.api.gridApi.getAllRowNodes();
|
|
108
|
+
}, [transposeConfig.rowsToTranspose, adaptable.api]);
|
|
109
|
+
const [elevatedColumnId, setElevatedColumnIdState] = React.useState(() => transposeConfig.transposedColumnId ?? primaryKey);
|
|
110
|
+
const setElevatedColumnId = (newElevatedColumnId) => {
|
|
23
111
|
transposedAdaptableApiRef.current?.destroy({ unmount: true, destroyAgGrid: true });
|
|
24
|
-
|
|
112
|
+
setElevatedColumnIdState(newElevatedColumnId);
|
|
25
113
|
};
|
|
26
114
|
const transposedAdaptableApiRef = React.useRef(null);
|
|
27
115
|
const columns = React.useMemo(() => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
116
|
+
const allUIColumns = adaptable.api.columnApi.getUIAvailableColumns();
|
|
117
|
+
const columnsToTranspose = transposeConfig.columnsToTranspose;
|
|
118
|
+
if (!columnsToTranspose) {
|
|
119
|
+
return allUIColumns;
|
|
120
|
+
}
|
|
121
|
+
const columnIds = typeof columnsToTranspose === 'function'
|
|
122
|
+
? columnsToTranspose({
|
|
123
|
+
...adaptable.api.internalApi.buildBaseContext(),
|
|
124
|
+
columns: allUIColumns,
|
|
125
|
+
})
|
|
126
|
+
: columnsToTranspose;
|
|
127
|
+
return columnIds
|
|
128
|
+
.map((c) => adaptable.api.columnApi.getColumnWithColumnId(c))
|
|
129
|
+
.filter((col) => col != null);
|
|
130
|
+
}, [transposeConfig.columnsToTranspose, adaptable.api]);
|
|
33
131
|
/**
|
|
34
|
-
*
|
|
132
|
+
* Build transposed structure: original rows become columns (colId = primaryKey value),
|
|
133
|
+
* original columns become rows. Each transposed row has the column id/header plus
|
|
134
|
+
* one cell per original row keyed by primaryKey value.
|
|
35
135
|
*/
|
|
36
|
-
const transposedFirstColumnField = '_transposed_column_value';
|
|
37
|
-
const transposedFirstColumnHeader = '_transposed_column_header';
|
|
38
136
|
const transposedRowsAndColumns = React.useMemo(() => {
|
|
39
|
-
/**
|
|
40
|
-
* transposed column values become primaryKey of the new tarnsposed rows
|
|
41
|
-
* we build row by row, might be easer
|
|
42
|
-
*/
|
|
43
137
|
const transposedColumns = [];
|
|
44
138
|
const transposedRows = [];
|
|
45
139
|
for (const row of rowNodes) {
|
|
46
|
-
// we force the col-ids to be strings, easer to work with
|
|
47
|
-
//row[transposeByColumnId] + '';
|
|
48
140
|
const colId = adaptable.api.gridApi.getNormalisedValueFromRowNode(row, primaryKey) + '';
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
'';
|
|
52
|
-
transposedColumns.push({
|
|
53
|
-
colId,
|
|
54
|
-
header,
|
|
55
|
-
});
|
|
141
|
+
const header = adaptable.api.gridApi.getNormalisedValueFromRowNode(row, elevatedColumnId) + '';
|
|
142
|
+
transposedColumns.push({ colId, header });
|
|
56
143
|
}
|
|
57
144
|
for (const column of columns) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*/
|
|
61
|
-
if (hideTransposedColumn && column.columnId === syntheticTransposedByColumnId) {
|
|
145
|
+
if (transposeConfig.hideTransposedColumn &&
|
|
146
|
+
column.columnId === elevatedColumnId) {
|
|
62
147
|
continue;
|
|
63
148
|
}
|
|
64
149
|
const transposedRow = {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
[transposedFirstColumnField]: column.columnId,
|
|
68
|
-
[transposedFirstColumnHeader]: column.friendlyName,
|
|
150
|
+
[TRANSPOSED_FIRST_COLUMN_FIELD]: column.columnId,
|
|
151
|
+
[TRANSPOSED_FIRST_COLUMN_HEADER]: column.friendlyName,
|
|
69
152
|
};
|
|
70
|
-
for (
|
|
71
|
-
// [transposed-by-column-value[n]]: [other column value[n]]
|
|
153
|
+
for (const row of rowNodes) {
|
|
72
154
|
const key = adaptable.api.gridApi.getNormalisedValueFromRowNode(row, primaryKey);
|
|
73
|
-
// row[column.field]
|
|
74
155
|
let value = adaptable.api.gridApi.getDisplayValueFromRowNode(row, column.columnId);
|
|
75
156
|
if (value instanceof Date) {
|
|
76
157
|
value = value.toLocaleString();
|
|
@@ -79,90 +160,25 @@ export const TransposedPopup = (props) => {
|
|
|
79
160
|
}
|
|
80
161
|
transposedRows.push(transposedRow);
|
|
81
162
|
}
|
|
82
|
-
return {
|
|
83
|
-
|
|
84
|
-
transposedRows,
|
|
85
|
-
};
|
|
86
|
-
}, [rowNodes, primaryKey, syntheticTransposedByColumnId]);
|
|
163
|
+
return { transposedColumns, transposedRows };
|
|
164
|
+
}, [rowNodes, primaryKey, elevatedColumnId, columns, transposeConfig.hideTransposedColumn, adaptable.api]);
|
|
87
165
|
React.useEffect(() => {
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
entitlementOptions: {
|
|
100
|
-
defaultAccessLevel: 'Hidden',
|
|
101
|
-
},
|
|
102
|
-
initialState: {
|
|
103
|
-
Layout: {
|
|
104
|
-
Revision: Date.now(),
|
|
105
|
-
CurrentLayout: 'TransposedView',
|
|
106
|
-
Layouts: [
|
|
107
|
-
{
|
|
108
|
-
Name: 'TransposedView',
|
|
109
|
-
TableColumns: [
|
|
110
|
-
transposedFirstColumnHeader,
|
|
111
|
-
...transposedRowsAndColumns.transposedColumns.map((c) => c.colId),
|
|
112
|
-
],
|
|
113
|
-
ColumnPinning: {
|
|
114
|
-
[transposedFirstColumnHeader]: 'left',
|
|
115
|
-
},
|
|
116
|
-
AutoSizeColumns: true,
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
Theme: {
|
|
121
|
-
CurrentTheme: adaptable.api.themeApi.getCurrentTheme(),
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
const firstColumn = {
|
|
126
|
-
field: transposedFirstColumnHeader, // use the column friendly name
|
|
127
|
-
headerName: adaptable.api.columnApi.getFriendlyNameForColumnId(syntheticTransposedByColumnId),
|
|
128
|
-
};
|
|
129
|
-
const agGridOptions = {
|
|
130
|
-
loading: false,
|
|
131
|
-
defaultColDef: {
|
|
132
|
-
floatingFilter: false,
|
|
133
|
-
filter: false,
|
|
134
|
-
sortable: true,
|
|
135
|
-
resizable: true,
|
|
136
|
-
enableRowGroup: false,
|
|
137
|
-
editable: false,
|
|
138
|
-
enablePivot: false,
|
|
139
|
-
enableValue: false,
|
|
140
|
-
lockPinned: true,
|
|
141
|
-
menuTabs: [],
|
|
142
|
-
width: 120,
|
|
143
|
-
},
|
|
144
|
-
columnDefs: [
|
|
145
|
-
{
|
|
146
|
-
field: transposedFirstColumnField,
|
|
147
|
-
hide: true,
|
|
148
|
-
},
|
|
149
|
-
firstColumn,
|
|
150
|
-
...transposedRowsAndColumns.transposedColumns.map((col) => {
|
|
151
|
-
return {
|
|
152
|
-
field: col.colId,
|
|
153
|
-
type: null,
|
|
154
|
-
headerName: col.header,
|
|
155
|
-
};
|
|
156
|
-
}),
|
|
157
|
-
],
|
|
158
|
-
rowData: transposedRowsAndColumns.transposedRows,
|
|
159
|
-
sideBar: false,
|
|
160
|
-
};
|
|
166
|
+
const hostOptions = adaptable.adaptableOptions;
|
|
167
|
+
const adaptableOptions = buildTransposedAdaptableOptions({
|
|
168
|
+
hostOptions,
|
|
169
|
+
transposedRowsAndColumns,
|
|
170
|
+
currentTheme: adaptable.api.themeApi.getCurrentTheme(),
|
|
171
|
+
});
|
|
172
|
+
const gridOptions = buildTransposedGridOptions({
|
|
173
|
+
transposedRowsAndColumns,
|
|
174
|
+
elevatedColumnId,
|
|
175
|
+
adaptableApi: adaptable.api,
|
|
176
|
+
});
|
|
161
177
|
const modules = adaptable.agGridModulesAdapter.getAgGridRegisteredModules();
|
|
162
178
|
AdaptableAgGrid._initInternal({
|
|
163
179
|
variant: 'vanilla',
|
|
164
180
|
adaptableOptions,
|
|
165
|
-
gridOptions
|
|
181
|
+
gridOptions,
|
|
166
182
|
modules,
|
|
167
183
|
}).then((adaptableApi) => {
|
|
168
184
|
transposedAdaptableApiRef.current = adaptableApi;
|
|
@@ -170,30 +186,20 @@ export const TransposedPopup = (props) => {
|
|
|
170
186
|
transposedAdaptableApiRef.current?.themeApi.loadTheme(typeof event.theme === 'object' ? event.theme.Name : event.theme);
|
|
171
187
|
});
|
|
172
188
|
});
|
|
173
|
-
}, [
|
|
189
|
+
}, [elevatedColumnId, adaptable]);
|
|
174
190
|
React.useEffect(() => {
|
|
175
|
-
// destroy when closing the popup
|
|
176
191
|
return () => {
|
|
177
192
|
requestAnimationFrame(() => {
|
|
178
193
|
transposedAdaptableApiRef.current?.destroy({ unmount: true, destroyAgGrid: true });
|
|
179
194
|
});
|
|
180
195
|
};
|
|
181
196
|
}, []);
|
|
182
|
-
/**
|
|
183
|
-
* Need to get all data, manualy pivot the grid using the primary key.
|
|
184
|
-
*
|
|
185
|
-
* 1. get the data, and pivot using the primary key
|
|
186
|
-
* 2. create the col definitios, a col definition for each row
|
|
187
|
-
* 3. create the grid
|
|
188
|
-
*/
|
|
189
197
|
return (React.createElement(Flex, { flexDirection: "column", className: "twa:w-full twa:h-full" },
|
|
190
198
|
React.createElement(Panel, null,
|
|
191
199
|
React.createElement(FormLayout, null,
|
|
192
200
|
React.createElement(FormRow, { label: "Elevated Column" },
|
|
193
|
-
React.createElement(ColumnSelector, { value:
|
|
194
|
-
setSyntheticTransposedByColumnId(colId);
|
|
195
|
-
} })))),
|
|
201
|
+
React.createElement(ColumnSelector, { value: elevatedColumnId, onChange: setElevatedColumnId })))),
|
|
196
202
|
React.createElement(Flex, { className: "twa:h-full" },
|
|
197
|
-
React.createElement(Box, { id:
|
|
198
|
-
React.createElement(Box, { className: "twa:h-full twa:w-full", id:
|
|
203
|
+
React.createElement(Box, { id: ADAPTABLE_CONTAINER_ID }),
|
|
204
|
+
React.createElement(Box, { className: "twa:h-full twa:w-full", id: AG_GRID_CONTAINER_ID }))));
|
|
199
205
|
};
|
|
@@ -19,7 +19,7 @@ export const isAggregationsSectionValid = (data) => {
|
|
|
19
19
|
AggFunc.type === 'weightedAverage')?.AggFunc
|
|
20
20
|
: null;
|
|
21
21
|
if (weightedAvg && !weightedAvg.weightedColumnId) {
|
|
22
|
-
return '
|
|
22
|
+
return 'Weighted Average requires a weight column to be selected.';
|
|
23
23
|
}
|
|
24
24
|
return true;
|
|
25
25
|
};
|
|
@@ -13,7 +13,7 @@ import { Box } from '../../../../components/Flex';
|
|
|
13
13
|
export const isColumnFiltersValid = (layout) => {
|
|
14
14
|
const invalidColumnFilters = (layout.ColumnFilters ?? [])?.filter((columnFilter) => !columnFilter?.Predicates[0]?.PredicateId);
|
|
15
15
|
if (invalidColumnFilters.length > 0) {
|
|
16
|
-
return 'Please select a
|
|
16
|
+
return 'Please select a predicate for each column filter.';
|
|
17
17
|
}
|
|
18
18
|
return true;
|
|
19
19
|
};
|
|
@@ -13,7 +13,7 @@ export const isGridFiltersValid = (layout, api) => {
|
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
15
15
|
return (api.internalApi.getQueryLanguageService().validateBoolean(expression, GridFilterModuleId)
|
|
16
|
-
.isValid || '
|
|
16
|
+
.isValid || 'The expression is not valid.');
|
|
17
17
|
};
|
|
18
18
|
export const GridFilterSectionSummary = () => {
|
|
19
19
|
const { data: layout } = useOnePageAdaptableWizardContext();
|
|
@@ -216,7 +216,7 @@ export const isPivotAggregationsSectionValid = (data) => {
|
|
|
216
216
|
.find((agg) => typeof agg === 'object' && agg.type === 'weightedAverage')
|
|
217
217
|
: null;
|
|
218
218
|
if (weightedAvg && !weightedAvg.weightedColumnId) {
|
|
219
|
-
return '
|
|
219
|
+
return 'Weighted Average requires a weight column to be selected.';
|
|
220
220
|
}
|
|
221
221
|
return true;
|
|
222
222
|
};
|
|
@@ -303,12 +303,12 @@ export const PivotAggregationsSection = (props) => {
|
|
|
303
303
|
}
|
|
304
304
|
const firstAggFuncName = getAggFuncName(aggregationColumns[0].AggFunc);
|
|
305
305
|
if (layout.PivotAggregationColumns?.some((aggCol) => getAggFuncName(aggCol.AggFunc) !== firstAggFuncName)) {
|
|
306
|
-
return '
|
|
306
|
+
return 'All columns must use the same aggregation function.';
|
|
307
307
|
}
|
|
308
308
|
// check that no Aggregation Total Column is enabled
|
|
309
309
|
const hasAggregationTotalColumn = aggregationColumns.some((aggCol) => aggCol.Total !== false && aggCol.Total != null);
|
|
310
310
|
if (hasAggregationTotalColumn) {
|
|
311
|
-
return '
|
|
311
|
+
return 'This option is not available when an Aggregation Total Column is present.';
|
|
312
312
|
}
|
|
313
313
|
return true;
|
|
314
314
|
};
|
|
@@ -24,7 +24,7 @@ export const areSummaryRowsValid = (layout) => {
|
|
|
24
24
|
layout.RowSummaries?.find((rowSummary) => {
|
|
25
25
|
for (const [_, fn] of Object.entries(rowSummary.ColumnsMap ?? {})) {
|
|
26
26
|
if (!fn) {
|
|
27
|
-
valid = '
|
|
27
|
+
valid = 'Each row summary column requires an aggregation function.';
|
|
28
28
|
return true;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -7,11 +7,11 @@ import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableW
|
|
|
7
7
|
import { Box } from '../../../components/Flex';
|
|
8
8
|
export const isValidNamedQueryExpression = (data, api) => {
|
|
9
9
|
if (!data.BooleanExpression) {
|
|
10
|
-
return '
|
|
10
|
+
return 'An expression is required.';
|
|
11
11
|
}
|
|
12
12
|
const valid = api.expressionApi.isValidBooleanExpression(data.BooleanExpression, NamedQueryModuleId);
|
|
13
13
|
if (!valid) {
|
|
14
|
-
return '
|
|
14
|
+
return 'The query is not a valid Boolean expression.';
|
|
15
15
|
}
|
|
16
16
|
return valid;
|
|
17
17
|
};
|
|
@@ -24,16 +24,16 @@ export const PlusMinusSettingsSummary = (props) => {
|
|
|
24
24
|
};
|
|
25
25
|
export const isSettingsValid = (hasCondition) => (data, api, context) => {
|
|
26
26
|
if (!data.Name?.trim()) {
|
|
27
|
-
return '
|
|
27
|
+
return 'A name is required.';
|
|
28
28
|
}
|
|
29
29
|
const allPlusMinusNudges = api.plusMinusApi.getAllPlusMinus();
|
|
30
30
|
const isDuplicateName = allPlusMinusNudges.some((nudge) => nudge.Name === data.Name && nudge.Uuid !== data.Uuid);
|
|
31
31
|
if (isDuplicateName) {
|
|
32
|
-
return 'A Plus
|
|
32
|
+
return 'A Plus/Minus Nudge with this name already exists.';
|
|
33
33
|
}
|
|
34
34
|
if (hasCondition) {
|
|
35
35
|
if (!data?.Rule?.BooleanExpression) {
|
|
36
|
-
return '
|
|
36
|
+
return 'A valid rule is required.';
|
|
37
37
|
}
|
|
38
38
|
const ruleValidation = isAdaptableRuleValid(data, api, context);
|
|
39
39
|
if (typeof ruleValidation === 'string') {
|
|
@@ -41,10 +41,10 @@ export const isSettingsValid = (hasCondition) => (data, api, context) => {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
if (typeof data.NudgeValue !== 'number') {
|
|
44
|
-
return '
|
|
44
|
+
return 'A nudge value is required.';
|
|
45
45
|
}
|
|
46
46
|
if (data.NudgeValue === 0) {
|
|
47
|
-
return 'Nudge value must be
|
|
47
|
+
return 'Nudge value must not be zero.';
|
|
48
48
|
}
|
|
49
49
|
return true;
|
|
50
50
|
};
|
|
@@ -53,7 +53,7 @@ export const ScheduleSettingsReminder = (props) => {
|
|
|
53
53
|
React.createElement(Tabs.Content, null,
|
|
54
54
|
React.createElement(FormLayout, null,
|
|
55
55
|
React.createElement(FormRow, { label: "Name" },
|
|
56
|
-
React.createElement(Input, { "data-name": "schedule-name", className: "twa:w-[300px]", onChange: handleNameChange, placeholder: "Enter
|
|
56
|
+
React.createElement(Input, { "data-name": "schedule-name", className: "twa:w-[300px]", onChange: handleNameChange, placeholder: "Enter Reminder Name", type: "string", value: props.reminderSchedule?.Name ?? '' })),
|
|
57
57
|
React.createElement(FormRow, { label: "" },
|
|
58
58
|
React.createElement(Box, { className: "twa:h-2" })),
|
|
59
59
|
React.createElement(FormRow, { label: "Header" },
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AdaptableApi } from '../../../../Api/AdaptableApi';
|
|
2
2
|
import { BaseSchedule } from '../../../../AdaptableState/Common/Schedule';
|
|
3
|
-
export declare const isSettingsValid: (schedule: BaseSchedule, api: AdaptableApi) => true | "
|
|
3
|
+
export declare const isSettingsValid: (schedule: BaseSchedule, api: AdaptableApi) => true | "A name is required." | "A Schedule with this name already exists." | "Please select a message type." | "A reminder header is required." | "A reminder message is required." | "Please select a report." | "Please select a report format." | "Please select a report folder." | "Please select a report page.";
|
|
@@ -3,50 +3,50 @@ import StringExtensions from '../../../../Utilities/Extensions/StringExtensions'
|
|
|
3
3
|
export const isSettingsValid = (schedule, api) => {
|
|
4
4
|
// Validate Name - mandatory and unique
|
|
5
5
|
if (!schedule.Name?.trim()) {
|
|
6
|
-
return '
|
|
6
|
+
return 'A name is required.';
|
|
7
7
|
}
|
|
8
8
|
const allSchedules = api.scheduleApi.getSchedules();
|
|
9
9
|
const isDuplicateName = allSchedules.some((s) => s.Name === schedule.Name && s.Uuid !== schedule.Uuid);
|
|
10
10
|
if (isDuplicateName) {
|
|
11
|
-
return 'A Schedule with this name already exists';
|
|
11
|
+
return 'A Schedule with this name already exists.';
|
|
12
12
|
}
|
|
13
13
|
if (schedule.ScheduleType === ScheduleType.Reminder) {
|
|
14
14
|
const reminder = schedule;
|
|
15
15
|
if (!reminder.MessageType) {
|
|
16
|
-
return '
|
|
16
|
+
return 'Please select a message type.';
|
|
17
17
|
}
|
|
18
18
|
if (StringExtensions.IsNullOrEmpty(reminder?.Header)) {
|
|
19
|
-
return '
|
|
19
|
+
return 'A reminder header is required.';
|
|
20
20
|
}
|
|
21
21
|
if (StringExtensions.IsNullOrEmpty(reminder?.Message)) {
|
|
22
|
-
return '
|
|
22
|
+
return 'A reminder message is required.';
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
if (schedule.ScheduleType === ScheduleType.Report) {
|
|
26
26
|
const report = schedule;
|
|
27
27
|
if (StringExtensions.IsNullOrEmpty(report?.ReportName)) {
|
|
28
|
-
return '
|
|
28
|
+
return 'Please select a report.';
|
|
29
29
|
}
|
|
30
30
|
if (StringExtensions.IsNullOrEmpty(report?.ReportFormat)) {
|
|
31
|
-
return '
|
|
31
|
+
return 'Please select a report format.';
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
if (schedule.ScheduleType === ScheduleType.ipushpull) {
|
|
35
35
|
const ipushpull = schedule;
|
|
36
36
|
if (StringExtensions.IsNullOrEmpty(ipushpull?.IPushPullReport?.ReportName)) {
|
|
37
|
-
return '
|
|
37
|
+
return 'Please select a report.';
|
|
38
38
|
}
|
|
39
39
|
if (StringExtensions.IsNullOrEmpty(ipushpull?.IPushPullReport?.Folder)) {
|
|
40
|
-
return '
|
|
40
|
+
return 'Please select a report folder.';
|
|
41
41
|
}
|
|
42
42
|
if (StringExtensions.IsNullOrEmpty(ipushpull?.IPushPullReport?.Page)) {
|
|
43
|
-
return '
|
|
43
|
+
return 'Please select a report page.';
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
if (schedule.ScheduleType === ScheduleType.OpenFin) {
|
|
47
47
|
const openfin = schedule;
|
|
48
48
|
if (StringExtensions.IsNullOrEmpty(openfin?.OpenFinReport?.ReportName)) {
|
|
49
|
-
return '
|
|
49
|
+
return 'Please select a report.';
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
return true;
|
|
@@ -6,7 +6,7 @@ export const handleExportState = (type, name, state, api) => {
|
|
|
6
6
|
Helper.copyToClipboard(stringifiedState);
|
|
7
7
|
break;
|
|
8
8
|
case 'Console':
|
|
9
|
-
api.consoleLog('Adaptable
|
|
9
|
+
api.consoleLog('Adaptable state:', state);
|
|
10
10
|
break;
|
|
11
11
|
case 'JSON':
|
|
12
12
|
const jsonFileName = name + '.json';
|
|
@@ -15,7 +15,7 @@ export const renderStyledColumnColumnSummary = (data) => {
|
|
|
15
15
|
};
|
|
16
16
|
export const isValidStyledColumnColumn = (data) => {
|
|
17
17
|
if (!data.ColumnId) {
|
|
18
|
-
return '
|
|
18
|
+
return 'Please select a column for the Styled Column.';
|
|
19
19
|
}
|
|
20
20
|
return true;
|
|
21
21
|
};
|
package/src/View/UIHelper.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { Schedule, Weekday } from '../AdaptableState/Common/Schedule';
|
|
|
6
6
|
import { AdaptableColumnDataType, AdaptableSystemIconName, AdaptableOptions } from '../types';
|
|
7
7
|
import { AdaptableAlert } from '../AdaptableState/Common/AdaptableAlert';
|
|
8
8
|
import { AdaptableMessageType } from '../AdaptableState/Common/AdaptableMessageType';
|
|
9
|
+
import type { ContainerContext } from '../AdaptableOptions/ContainerOptions';
|
|
9
10
|
export declare const BLACK: string;
|
|
10
11
|
export declare const WHITE: string;
|
|
11
12
|
export declare const LIGHT_GRAY: string;
|
|
@@ -31,7 +32,7 @@ export declare function getDefaultColors(): string[];
|
|
|
31
32
|
export declare function getEmptyConfigState(): EditableConfigEntityState;
|
|
32
33
|
export declare function getDescriptionForDataType(dataType: AdaptableColumnDataType): "text" | "number" | "date";
|
|
33
34
|
export declare function getPlaceholderForDataType(dataType: AdaptableColumnDataType): "Enter Value" | "Enter Number" | "Enter Date";
|
|
34
|
-
export declare function getModalContainer(adaptableOptions: AdaptableOptions, document: Document): HTMLElement;
|
|
35
|
+
export declare function getModalContainer(adaptableOptions: AdaptableOptions, document: Document, context?: ContainerContext): HTMLElement;
|
|
35
36
|
export declare function IsEmptyStyle(style: AdaptableStyle): boolean;
|
|
36
37
|
export declare function IsNotEmptyStyle(style: AdaptableStyle): boolean;
|
|
37
38
|
export declare function getMessageTypeByStatusColour(statusColour: StatusColour): AdaptableMessageType;
|
package/src/View/UIHelper.js
CHANGED
|
@@ -2,6 +2,7 @@ import { WizardStatus, } from './Components/SharedProps/EditableConfigEntityStat
|
|
|
2
2
|
import { FontWeight, FontStyle, StatusColour } from '../AdaptableState/Common/Enums';
|
|
3
3
|
import { StringExtensions } from '../Utilities/Extensions/StringExtensions';
|
|
4
4
|
import ArrayExtensions from '../Utilities/Extensions/ArrayExtensions';
|
|
5
|
+
import { resolveContainerElement } from '../Utilities/resolveContainerElement';
|
|
5
6
|
export const BLACK = 'Black';
|
|
6
7
|
export const WHITE = 'White';
|
|
7
8
|
export const LIGHT_GRAY = 'LightGray';
|
|
@@ -120,19 +121,12 @@ export function getPlaceholderForDataType(dataType) {
|
|
|
120
121
|
return 'Enter Date';
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
export function getModalContainer(adaptableOptions, document) {
|
|
124
|
-
let modalContainer;
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
modalContainer
|
|
128
|
-
|
|
129
|
-
? document.getElementById(adaptableOptions.containerOptions.modalContainer)
|
|
130
|
-
: adaptableOptions.containerOptions.modalContainer;
|
|
131
|
-
if (modalContainer) {
|
|
132
|
-
const modalContainerClassName = ' modal-container';
|
|
133
|
-
if (!modalContainer.className.includes(modalContainerClassName)) {
|
|
134
|
-
modalContainer.className += modalContainerClassName;
|
|
135
|
-
}
|
|
124
|
+
export function getModalContainer(adaptableOptions, document, context) {
|
|
125
|
+
let modalContainer = resolveContainerElement(adaptableOptions.containerOptions.modalContainer, context, document);
|
|
126
|
+
if (modalContainer) {
|
|
127
|
+
const modalContainerClassName = ' modal-container';
|
|
128
|
+
if (!modalContainer.className.includes(modalContainerClassName)) {
|
|
129
|
+
modalContainer.className += modalContainerClassName;
|
|
136
130
|
}
|
|
137
131
|
}
|
|
138
132
|
if (!modalContainer) {
|
|
@@ -423,7 +417,7 @@ export function getAdaptableToolPanelWidth() {
|
|
|
423
417
|
return getNumericCSSVariableValue(getCSSVariableValue('--ab-cmp-toolpanel__width'), 200);
|
|
424
418
|
}
|
|
425
419
|
export function getSimpleButtonPaddingWidth() {
|
|
426
|
-
return getNumericCSSVariableValue(getCSSVariableValue('--ab-space
|
|
420
|
+
return getNumericCSSVariableValue(getCSSVariableValue('--ab-base-space'), 4);
|
|
427
421
|
}
|
|
428
422
|
export function getCSSVariableValue(cssVariable) {
|
|
429
423
|
if (!isBrowserDocumentAvailable()) {
|