@adaptabletools/adaptable 22.1.0-canary.0 → 22.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.css +1 -15
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/AdaptableOptions/DashboardOptions.d.ts +2 -2
- package/src/AdaptableState/LayoutState.d.ts +42 -45
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +14 -0
- package/src/Strategy/ColumnFilterModule.js +5 -2
- package/src/Strategy/SmartEditModule.js +1 -1
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +31 -19
- package/src/View/Layout/Wizard/sections/RowGroupingSection.js +1 -1
- package/src/View/Layout/Wizard/sections/RowSelectionSection.js +30 -31
- package/src/agGrid/AdaptableAgGrid.js +1 -1
- package/src/env.js +2 -2
- package/src/layout-manager/src/index.d.ts +1 -0
- package/src/layout-manager/src/index.js +60 -4
- package/src/metamodel/adaptable.metamodel.d.ts +19 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -10,7 +10,7 @@ import { Icon, NaturallySizedIcon } from '../../../../components/icons';
|
|
|
10
10
|
import { CheckBox } from '../../../../components/CheckBox';
|
|
11
11
|
import { clamp } from '../../../../Utilities/Helpers/Helper';
|
|
12
12
|
import ArrayExtensions from '../../../../Utilities/Extensions/ArrayExtensions';
|
|
13
|
-
import { generateAutoRowGroupColumnForColumn, generateAutoRowGroupSingleColumn, generateAutoTreeSingleColumn, isAutoRowGroupColumn, } from '../../../../Api/Implementation/ColumnApiImpl';
|
|
13
|
+
import { generateAutoRowGroupColumnForColumn, generateAutoRowGroupSingleColumn, generateAutoTreeSingleColumn, generateSelectionColumn, isAutoRowGroupColumn, } from '../../../../Api/Implementation/ColumnApiImpl';
|
|
14
14
|
import { ReorderDraggable } from '../../../Components/ReorderDraggable';
|
|
15
15
|
import { AdaptableFormControlTextClear } from '../../../Components/Forms/AdaptableFormControlTextClear';
|
|
16
16
|
import { sortColumnIdsByOrder } from '../../../../layout-manager/src/sortColumnIdsByOrder';
|
|
@@ -132,26 +132,29 @@ export const ColumnsSectionSummary = () => {
|
|
|
132
132
|
return (React.createElement(DataSource, { data: data, primaryKey: "columnId" },
|
|
133
133
|
React.createElement(InfiniteTableGrid, { columnTypes: columnTypes, rowHeight: rowHeight, columnHeaderHeight: headerHeight, domProps: tableDOMProps, columns: columns })));
|
|
134
134
|
};
|
|
135
|
+
const isSelectionColumn = (columnId) => columnId === AG_GRID_SELECTION_COLUMN;
|
|
135
136
|
const isColumnVisible = (options) => {
|
|
136
137
|
const { columnId, layout } = options;
|
|
137
138
|
const isRowGroupColumn = isAutoRowGroupColumn(columnId);
|
|
138
139
|
const visible = (!isPivotLayout(layout) &&
|
|
139
140
|
layout.TableColumns.includes(columnId) &&
|
|
140
141
|
layout.ColumnVisibility?.[columnId] !== false) ||
|
|
141
|
-
isRowGroupColumn
|
|
142
|
+
isRowGroupColumn ||
|
|
143
|
+
isSelectionColumn(columnId);
|
|
142
144
|
return visible;
|
|
143
145
|
};
|
|
144
146
|
const ColumnRow = (props) => {
|
|
145
147
|
const adaptable = useAdaptable();
|
|
146
148
|
const initialHeader = adaptable.api.columnApi.getFriendlyNameForColumnId(props.column.columnId, props.layout);
|
|
147
149
|
const isRowGroupColumn = isAutoRowGroupColumn(props.column.columnId);
|
|
150
|
+
const isSelectionCol = isSelectionColumn(props.column.columnId);
|
|
148
151
|
const { column } = props;
|
|
149
152
|
const visible = isColumnVisible({ columnId: column.columnId, layout: props.layout });
|
|
150
153
|
return (React.createElement(Box, { "data-name": props.column.columnId, className: "twa:flex-1" },
|
|
151
154
|
React.createElement(Flex, { className: "ab-Layout-Wizard__ColumnRow__Header twa:my-1" },
|
|
152
155
|
React.createElement(CheckBox, { "data-name": column.columnId, onChange: (checked) => {
|
|
153
156
|
props.onColumnVisibilityChange(column.columnId, checked);
|
|
154
|
-
}, disabled: column.hideable === false || isRowGroupColumn, onClick: (event) => {
|
|
157
|
+
}, disabled: column.hideable === false || isRowGroupColumn || isSelectionCol, onClick: (event) => {
|
|
155
158
|
event.stopPropagation();
|
|
156
159
|
}, checked: visible }),
|
|
157
160
|
React.createElement(Flex, { className: "twa:mx-2", alignItems: "center", "data-name": "column-label" }, initialHeader),
|
|
@@ -164,7 +167,12 @@ export const ColumnsSection = (props) => {
|
|
|
164
167
|
const { data: layout } = useOnePageAdaptableWizardContext();
|
|
165
168
|
const [searchInputValue, setSearchInputValue] = React.useState('');
|
|
166
169
|
const [selectedColumnId, setSelectedColumnId] = React.useState(null);
|
|
167
|
-
|
|
170
|
+
// the selection column is a special column managed by AG Grid - it is not
|
|
171
|
+
// returned by `getUIAvailableColumns`, but we still want to expose it in the
|
|
172
|
+
// column list (similar to auto row group columns) so users can reorder/pin it
|
|
173
|
+
const hasSelectionColumn = adaptable.api.columnApi
|
|
174
|
+
.getColumns()
|
|
175
|
+
.some((col) => col.isGeneratedSelectionColumn);
|
|
168
176
|
const allColumns = adaptable.api.columnApi
|
|
169
177
|
.getUIAvailableColumns()
|
|
170
178
|
.filter((col) => {
|
|
@@ -175,14 +183,9 @@ export const ColumnsSection = (props) => {
|
|
|
175
183
|
})
|
|
176
184
|
// if the current Layout is a PivotLayout, then we also filter out current Pivot Result Columns
|
|
177
185
|
.filter((col) => !col.isGeneratedPivotResultColumn)
|
|
178
|
-
//
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (!result) {
|
|
182
|
-
hasSelectionColumn = true;
|
|
183
|
-
}
|
|
184
|
-
return result;
|
|
185
|
-
});
|
|
186
|
+
// selection columns are not returned by `getUIAvailableColumns` but guard
|
|
187
|
+
// against any future change
|
|
188
|
+
.filter((col) => !col.isGeneratedSelectionColumn);
|
|
186
189
|
const onChange = (data) => {
|
|
187
190
|
if (hasSelectionColumn &&
|
|
188
191
|
Array.isArray(data.TableColumns) &&
|
|
@@ -209,13 +212,22 @@ export const ColumnsSection = (props) => {
|
|
|
209
212
|
!allColumns.find((col) => col.columnId === AG_GRID_GROUPED_COLUMN)) {
|
|
210
213
|
allColumns.unshift(generateAutoTreeSingleColumn());
|
|
211
214
|
}
|
|
215
|
+
if (hasSelectionColumn) {
|
|
216
|
+
allColumns.unshift(generateSelectionColumn());
|
|
217
|
+
}
|
|
212
218
|
const colIdToCol = allColumns.reduce((acc, col) => {
|
|
213
219
|
if (col) {
|
|
214
220
|
acc[col.columnId] = col;
|
|
215
221
|
}
|
|
216
222
|
return acc;
|
|
217
223
|
}, {});
|
|
218
|
-
|
|
224
|
+
let TableColumns = layout.TableColumns;
|
|
225
|
+
// when the selection column exists but is not explicitly listed in
|
|
226
|
+
// TableColumns, `sortArrayWithOrder` would push it to the end - instead we
|
|
227
|
+
// want it at the start (consistent with AG Grid's default position for it)
|
|
228
|
+
if (hasSelectionColumn && !TableColumns.includes(AG_GRID_SELECTION_COLUMN)) {
|
|
229
|
+
TableColumns = [AG_GRID_SELECTION_COLUMN, ...TableColumns];
|
|
230
|
+
}
|
|
219
231
|
const ColumnOrderAllColumns = ArrayExtensions.sortArrayWithOrder(allColumns.map((col) => col.columnId), TableColumns, { sortUnorderedItems: false }).map((colId) => colIdToCol[colId]);
|
|
220
232
|
const currentOrder = searchInputValue
|
|
221
233
|
? ColumnOrderAllColumns.filter((col) => {
|
|
@@ -259,7 +271,7 @@ export const ColumnsSection = (props) => {
|
|
|
259
271
|
const columnIdArray = Array.isArray(columnId) ? columnId : [columnId];
|
|
260
272
|
const columnIdSet = new Set(columnIdArray);
|
|
261
273
|
const ColumnVisibility = { ...layout.ColumnVisibility };
|
|
262
|
-
let
|
|
274
|
+
let newTableColumns = [...TableColumns];
|
|
263
275
|
if (visible) {
|
|
264
276
|
columnIdArray.forEach((colId) => {
|
|
265
277
|
delete ColumnVisibility[colId];
|
|
@@ -272,11 +284,11 @@ export const ColumnsSection = (props) => {
|
|
|
272
284
|
}
|
|
273
285
|
const columnIds = ColumnOrderAllColumns.map((col) => col.columnId);
|
|
274
286
|
const idsToIndexes = new Map(columnIds.map((colId, index) => [colId, index]));
|
|
275
|
-
const columnOrderSet = new Set(
|
|
287
|
+
const columnOrderSet = new Set(newTableColumns);
|
|
276
288
|
const currentColumnIdsAreIncluded = columnIdArray.every((colId) => columnOrderSet.has(colId));
|
|
277
289
|
if (!currentColumnIdsAreIncluded) {
|
|
278
290
|
const biggestIndex = Math.max(...columnIdArray.map((colId) => idsToIndexes.get(colId)));
|
|
279
|
-
|
|
291
|
+
newTableColumns = columnIds.filter((colId) => {
|
|
280
292
|
const isCurrent = columnOrderSet.has(colId);
|
|
281
293
|
if (isCurrent) {
|
|
282
294
|
return true;
|
|
@@ -298,7 +310,7 @@ export const ColumnsSection = (props) => {
|
|
|
298
310
|
}
|
|
299
311
|
onChange({
|
|
300
312
|
...layout,
|
|
301
|
-
TableColumns:
|
|
313
|
+
TableColumns: newTableColumns,
|
|
302
314
|
ColumnVisibility,
|
|
303
315
|
});
|
|
304
316
|
};
|
|
@@ -452,7 +464,7 @@ export const ColumnsSection = (props) => {
|
|
|
452
464
|
return (React.createElement(ColumnRow, { onColumnNameChange: handleColumnNameChange, onColumnWidthChange: handleColumnWidthChange, onColumnFlexChange: handleColumnFlexChange, onColumnMinWidthChange: handleColumnMinWidthChange, onColumnMaxWidthChange: handleColumnMaxWidthChange, onColumnVisibilityChange: handleColumnVisibilityChange, onPinChange: handlePinChange, layout: layout, column: option }));
|
|
453
465
|
}, onChange: handleColumnsChange }))),
|
|
454
466
|
currentOrderIds.length ? (React.createElement(ColumnPropertiesEditor, { column: selectedColumnId && currentOrderIds.includes(selectedColumnId)
|
|
455
|
-
?
|
|
467
|
+
? colIdToCol[selectedColumnId] ?? null
|
|
456
468
|
: null, layout: layout, onPinChange: handlePinChange, onColumnNameChange: handleColumnNameChange, onColumnWidthChange: handleColumnWidthChange, onColumnFlexChange: handleColumnFlexChange, onColumnMinWidthChange: handleColumnMinWidthChange, onColumnMaxWidthChange: handleColumnMaxWidthChange, onColumnVisibilityChange: handleColumnVisibilityChange })) : null))));
|
|
457
469
|
};
|
|
458
470
|
const hr = (React.createElement("hr", { className: "twa:my-3 twa:mb-0 twa:w-full twa:h-[0.5px] twa:bg-inputborder/50 twa:border-none" }));
|
|
@@ -494,7 +506,7 @@ const ColumnPropertiesEditor = (props) => {
|
|
|
494
506
|
React.createElement(Flex, { flexDirection: "column", className: "twa:gap-3 twa:mt-3" },
|
|
495
507
|
React.createElement(Flex, { flexDirection: "column", className: "twa:gap-1" },
|
|
496
508
|
"Header",
|
|
497
|
-
React.createElement(Input, { "data-name": "column-header", className: "ab-Layout-Wizard__ColumnPropertiesEditor__Input twa:w-full", placeholder: "Custom name (optional)", onChange: () => {
|
|
509
|
+
React.createElement(Input, { "data-name": "column-header", className: "ab-Layout-Wizard__ColumnPropertiesEditor__Input twa:w-full", placeholder: "Custom name (optional)", disabled: props.column.isGeneratedSelectionColumn, onChange: () => {
|
|
498
510
|
props.onColumnNameChange(props.column.columnId, event.target.value);
|
|
499
511
|
}, value: customHeader })),
|
|
500
512
|
React.createElement(Box, { className: "twa:grid twa:grid-cols-[1fr_1fr] twa:gap-2" },
|
|
@@ -91,7 +91,7 @@ export const RowGroupingSection = (props) => {
|
|
|
91
91
|
onChange(newLayout);
|
|
92
92
|
} },
|
|
93
93
|
React.createElement(TypeRadio, { value: "single", text: "Single Column", description: "All Row Grouped Columns display in one hierarchical Column" }),
|
|
94
|
-
React.createElement(TypeRadio, { value: "multi", text: "Multiple Columns", description: "Each Row Grouped
|
|
94
|
+
React.createElement(TypeRadio, { value: "multi", text: "Multiple Columns", description: "Each Row Grouped Column displays in its own, separate, Column" }))))),
|
|
95
95
|
React.createElement(Tabs, { className: "twa:mt-2" },
|
|
96
96
|
React.createElement(Tabs.Tab, null, "Row Grouped Columns"),
|
|
97
97
|
React.createElement(Tabs.Tab, null, rowGroupsText),
|
|
@@ -8,6 +8,7 @@ import { useOnePageAdaptableWizardContext } from '../../../Wizard/OnePageAdaptab
|
|
|
8
8
|
import { Box, Flex } from '../../../../components/Flex';
|
|
9
9
|
import { twMerge } from '../../../../twMerge';
|
|
10
10
|
import HelpBlock from '../../../../components/HelpBlock';
|
|
11
|
+
import { isPivotLayout } from '../../../../Utilities/isPivotLayout';
|
|
11
12
|
import { AG_GRID_SELECTION_COLUMN } from '../../../../Utilities/Constants/GeneralConstants';
|
|
12
13
|
export const RowSelectionSectionSummary = () => {
|
|
13
14
|
const { data: layout } = useOnePageAdaptableWizardContext();
|
|
@@ -52,6 +53,7 @@ function getMode(layout) {
|
|
|
52
53
|
export const RowSelectionSection = (props) => {
|
|
53
54
|
const { data: layout } = useOnePageAdaptableWizardContext();
|
|
54
55
|
const mode = getMode(layout);
|
|
56
|
+
const isPivot = isPivotLayout(layout);
|
|
55
57
|
const rowSelection = layout.RowSelection ?? false;
|
|
56
58
|
const handleModeChange = (newMode) => {
|
|
57
59
|
if (newMode === false) {
|
|
@@ -92,50 +94,47 @@ export const RowSelectionSection = (props) => {
|
|
|
92
94
|
};
|
|
93
95
|
return (React.createElement(React.Fragment, null,
|
|
94
96
|
React.createElement(Tabs, null,
|
|
95
|
-
React.createElement(Tabs.Tab, null, "Selection Mode"),
|
|
97
|
+
React.createElement(Tabs.Tab, null, "Row Selection Mode"),
|
|
96
98
|
React.createElement(Tabs.Content, null,
|
|
97
99
|
React.createElement(Flex, { flexDirection: "column" },
|
|
98
100
|
React.createElement(RadioGroup, { orientation: "horizontal", variant: "text-only", className: twMerge(radioGroupStyling.horizontalTextOnly, 'twa:gap-2 twa:max-w-[500px] twa:bg-defaultbackground twa:p-2'), value: mode, name: "rowSelectionMode", onRadioChange: handleModeChange },
|
|
99
101
|
React.createElement(Radio, { value: false }, "Disabled"),
|
|
100
102
|
React.createElement(Radio, { value: "singleRow" }, "Single Row"),
|
|
101
103
|
React.createElement(Radio, { value: "multiRow" }, "Multi Row"))))),
|
|
104
|
+
!rowSelection && React.createElement(HelpBlock, null, "There is no Row Selection configured for this Layout"),
|
|
102
105
|
rowSelection && (React.createElement(React.Fragment, null,
|
|
103
106
|
React.createElement(Tabs, { className: "twa:mt-2" },
|
|
104
|
-
React.createElement(Tabs.Tab, null, "
|
|
107
|
+
React.createElement(Tabs.Tab, null, "Row Selection Column Checkboxes"),
|
|
105
108
|
React.createElement(Tabs.Content, null,
|
|
106
109
|
React.createElement(Flex, { flexDirection: "row", className: "twa:gap-6" },
|
|
107
|
-
React.createElement(CheckBox, { className: "twa:flex-1", checked: rowSelection.Checkboxes ?? true, onChange: (checked) => updateRowSelection({ Checkboxes: checked }) }, "
|
|
108
|
-
mode === 'multiRow' && (React.createElement(CheckBox, { className: "twa:flex-1", checked: rowSelection.HeaderCheckbox ?? true, onChange: (checked) => updateRowSelection({ HeaderCheckbox: checked }) }, "
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
React.createElement(CheckBox, { className: "twa:flex-1", checked: rowSelection.Checkboxes ?? true, onChange: (checked) => updateRowSelection({ Checkboxes: checked }) }, "Checkboxes in Column Cells"),
|
|
111
|
+
mode === 'multiRow' && (React.createElement(CheckBox, { className: "twa:flex-1", checked: rowSelection.HeaderCheckbox ?? true, onChange: (checked) => updateRowSelection({ HeaderCheckbox: checked }) }, "Checkbox in Column Header (to enable Select All)"))))),
|
|
112
|
+
(rowSelection.Checkboxes ?? true) && (React.createElement(Tabs, { className: "twa:mt-2" },
|
|
113
|
+
React.createElement(Tabs.Tab, null, "Row Grouping Selection Checkboxes"),
|
|
114
|
+
React.createElement(Tabs.Content, null,
|
|
115
|
+
React.createElement(RadioGroup, { orientation: "vertical", value: rowSelection.CheckboxInGroupColumn ?? false, name: "checkboxLocation", onRadioChange: (value) => updateRowSelection({ CheckboxInGroupColumn: value }) },
|
|
116
|
+
React.createElement(Radio, { value: false }, "Display in dedicated Selection Column"),
|
|
117
|
+
React.createElement(Radio, { value: true }, "Display in Row Grouped Column"))))),
|
|
114
118
|
React.createElement(Tabs, { className: "twa:mt-2" },
|
|
115
|
-
React.createElement(Tabs.Tab, null, "Row Click Selection"),
|
|
119
|
+
React.createElement(Tabs.Tab, null, "Row Click Selection (when user clicks on Row outside of Selection Checkbox)"),
|
|
116
120
|
React.createElement(Tabs.Content, null,
|
|
117
|
-
React.createElement(HelpBlock, { className: "twa:bg-primarydark/30 twa:text-text-on-primarydark twa:p-2 twa:rounded-standard twa:mb-2" },
|
|
118
|
-
React.createElement("p", null, "This describes the behaviour of the row selection when the user clicks on a row, but outside the row selection checkbox."),
|
|
119
|
-
React.createElement("p", null, "Should a click outside the checkbox select the row?")),
|
|
120
121
|
React.createElement(RadioGroup, { orientation: "vertical", value: rowSelection.EnableClickSelection ?? false, name: "clickSelection", onRadioChange: (value) => updateRowSelection({ EnableClickSelection: value }) },
|
|
121
|
-
React.createElement(Radio, { value: false }, "Disabled"),
|
|
122
|
-
React.createElement(Radio, { value: true }, "Enable selection and deselection"),
|
|
123
|
-
React.createElement(Radio, { value: 'enableSelection' }, "Enable selection
|
|
124
|
-
React.createElement(Radio, { value: 'enableDeselection' }, "Enable deselection
|
|
122
|
+
React.createElement(Radio, { value: false }, "Disabled (Cannot select or deselect by clicking in Row)"),
|
|
123
|
+
React.createElement(Radio, { value: true }, "Full (Enable selection by clicking in Row and deselection by Ctrl+clicking in Row)"),
|
|
124
|
+
React.createElement(Radio, { value: 'enableSelection' }, "Selection Only (Enable selection by clicking in Row)"),
|
|
125
|
+
React.createElement(Radio, { value: 'enableDeselection' }, "Deselection Only (Enable deselection by Ctrl+clicking in Row)")))),
|
|
126
|
+
mode === 'multiRow' && !isPivot && (React.createElement(Tabs, { className: "twa:mt-2" },
|
|
127
|
+
React.createElement(Tabs.Tab, null, "Grouped Row Selection Behaviour"),
|
|
128
|
+
React.createElement(Tabs.Content, null,
|
|
129
|
+
React.createElement(RadioGroup, { orientation: "vertical", value: rowSelection.GroupSelectMode ?? 'self', name: "groupSelectMode", onRadioChange: (value) => updateRowSelection({ GroupSelectMode: value }) },
|
|
130
|
+
React.createElement(Radio, { value: 'self' }, "Select Grouped Row Only (no cascade)"),
|
|
131
|
+
React.createElement(Radio, { value: 'descendants' }, "Select Grouped Row and all descendants"),
|
|
132
|
+
React.createElement(Radio, { value: 'filteredDescendants' }, "Select Grouped Row and only filtered descendants"))))),
|
|
125
133
|
mode === 'multiRow' && (React.createElement(Tabs, { className: "twa:mt-2" },
|
|
126
|
-
React.createElement(Tabs.Tab, null, "
|
|
134
|
+
React.createElement(Tabs.Tab, null, "Select All (in Header) Behaviour"),
|
|
127
135
|
React.createElement(Tabs.Content, null,
|
|
128
|
-
React.createElement(
|
|
129
|
-
React.createElement(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
React.createElement(Radio, { value: 'self' }, "Only select group row (no cascade)"),
|
|
133
|
-
React.createElement(Radio, { value: 'descendants' }, "Select group row and all descendants"),
|
|
134
|
-
React.createElement(Radio, { value: 'filteredDescendants' }, "Select group row and filtered descendants"))),
|
|
135
|
-
React.createElement(Flex, { flexDirection: "row", className: "twa:ml-6 twa:flex-1" },
|
|
136
|
-
React.createElement(Box, { className: "twa:self-center twa:mr-3" }, "Select All"),
|
|
137
|
-
React.createElement(RadioGroup, { orientation: "vertical", value: rowSelection.SelectAllMode ?? 'all', name: "selectAllMode", onRadioChange: (value) => updateRowSelection({ SelectAllMode: value }) },
|
|
138
|
-
React.createElement(Radio, { value: 'all' }, "All rows"),
|
|
139
|
-
React.createElement(Radio, { value: 'filtered' }, "Filtered rows only"),
|
|
140
|
-
React.createElement(Radio, { value: 'currentPage' }, "Current page only")))))))))));
|
|
136
|
+
React.createElement(RadioGroup, { orientation: "vertical", value: rowSelection.SelectAllMode ?? 'all', name: "selectAllMode", onRadioChange: (value) => updateRowSelection({ SelectAllMode: value }) },
|
|
137
|
+
React.createElement(Radio, { value: 'all' }, "All rows"),
|
|
138
|
+
React.createElement(Radio, { value: 'filtered' }, "Filtered rows only"),
|
|
139
|
+
React.createElement(Radio, { value: 'currentPage' }, "Current page only")))))))));
|
|
141
140
|
};
|
|
@@ -462,7 +462,7 @@ export class AdaptableAgGrid {
|
|
|
462
462
|
// fixes issue #3053
|
|
463
463
|
gridOptions.suppressAggFuncInHeader = !!layoutModel.SuppressAggFuncInHeader;
|
|
464
464
|
if (!isPivotLayoutModel(layoutModel) &&
|
|
465
|
-
LayoutManager.
|
|
465
|
+
LayoutManager.shouldUnlockSelectionColumnPosition(layoutModel)) {
|
|
466
466
|
gridOptions.selectionColumnDef = {
|
|
467
467
|
...gridOptions.selectionColumnDef,
|
|
468
468
|
lockPosition: false,
|
package/src/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
3
|
-
PUBLISH_TIMESTAMP:
|
|
4
|
-
VERSION: "22.1.0
|
|
3
|
+
PUBLISH_TIMESTAMP: 1776765136447 || Date.now(),
|
|
4
|
+
VERSION: "22.1.0" || '--current-version--',
|
|
5
5
|
};
|
|
@@ -75,6 +75,7 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
|
|
|
75
75
|
static readonly SELECTION_COLUMN_ID = "ag-Grid-SelectionColumn";
|
|
76
76
|
static getGridOptionForRowSelectionFromLayout(layoutRowSelection: LayoutRowSelection | false | undefined, baseGridRowSelection: GridOptions['rowSelection']): GridOptions['rowSelection'] | undefined;
|
|
77
77
|
static isSelectionColumnInNonFirstPosition(tableColumns: string[] | undefined): boolean;
|
|
78
|
+
static shouldUnlockSelectionColumnPosition(layout: TableLayoutModel): boolean;
|
|
78
79
|
private ensureSelectionColumnPositionUnlocked;
|
|
79
80
|
private getRowSelectionFromGrid;
|
|
80
81
|
private applyRowSelection;
|
|
@@ -138,6 +138,19 @@ function getDefaultColumnSizeStateForColDef(colId, colDef, options) {
|
|
|
138
138
|
}
|
|
139
139
|
return undefined;
|
|
140
140
|
}
|
|
141
|
+
function adjustColumnIdsForSelection(columnIds, layout) {
|
|
142
|
+
const selectionColPinning = layout.ColumnPinning?.[LayoutManager.SELECTION_COLUMN_ID];
|
|
143
|
+
if ((layout.RowSelection || selectionColPinning) &&
|
|
144
|
+
!columnIds.includes(LayoutManager.SELECTION_COLUMN_ID)) {
|
|
145
|
+
if (selectionColPinning === 'right') {
|
|
146
|
+
columnIds = [...columnIds, LayoutManager.SELECTION_COLUMN_ID];
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
columnIds = [LayoutManager.SELECTION_COLUMN_ID, ...columnIds];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return columnIds;
|
|
153
|
+
}
|
|
141
154
|
export class LayoutManager extends LMEmitter {
|
|
142
155
|
gridApi;
|
|
143
156
|
fieldsToIds = {};
|
|
@@ -809,7 +822,7 @@ export class LayoutManager extends LMEmitter {
|
|
|
809
822
|
layout.TableColumns = layout.TableColumns.filter((colId) => colId != undefined);
|
|
810
823
|
layout = normalizeTableLayoutModel(layout, { isTree: _options?.isTree ?? false });
|
|
811
824
|
const agGridState = {};
|
|
812
|
-
const columnIds = getColumnOrderIdsForAllColDefs(layout.TableColumns, colDefs);
|
|
825
|
+
const columnIds = adjustColumnIdsForSelection(getColumnOrderIdsForAllColDefs(layout.TableColumns, colDefs), layout);
|
|
813
826
|
agGridState.columnOrder = {
|
|
814
827
|
orderedColIds: columnIds,
|
|
815
828
|
};
|
|
@@ -1208,8 +1221,23 @@ export class LayoutManager extends LMEmitter {
|
|
|
1208
1221
|
const index = tableColumns.indexOf(LayoutManager.SELECTION_COLUMN_ID);
|
|
1209
1222
|
return index > 0;
|
|
1210
1223
|
}
|
|
1224
|
+
static shouldUnlockSelectionColumnPosition(layout) {
|
|
1225
|
+
const tableColumns = layout.TableColumns;
|
|
1226
|
+
if (!tableColumns) {
|
|
1227
|
+
return false;
|
|
1228
|
+
}
|
|
1229
|
+
const index = tableColumns.indexOf(LayoutManager.SELECTION_COLUMN_ID);
|
|
1230
|
+
if (index > 0) {
|
|
1231
|
+
return true;
|
|
1232
|
+
}
|
|
1233
|
+
const columnPinning = layout.ColumnPinning;
|
|
1234
|
+
if (columnPinning && columnPinning[LayoutManager.SELECTION_COLUMN_ID]) {
|
|
1235
|
+
return true;
|
|
1236
|
+
}
|
|
1237
|
+
return false;
|
|
1238
|
+
}
|
|
1211
1239
|
ensureSelectionColumnPositionUnlocked(layout) {
|
|
1212
|
-
if (LayoutManager.
|
|
1240
|
+
if (LayoutManager.shouldUnlockSelectionColumnPosition(layout)) {
|
|
1213
1241
|
const current = this.gridApi.getGridOption('selectionColumnDef');
|
|
1214
1242
|
if (!current || current.lockPosition !== false) {
|
|
1215
1243
|
this.gridApi.setGridOption('selectionColumnDef', {
|
|
@@ -1251,7 +1279,25 @@ export class LayoutManager extends LMEmitter {
|
|
|
1251
1279
|
}
|
|
1252
1280
|
applyRowSelection(layout) {
|
|
1253
1281
|
const rowSelection = LayoutManager.getGridOptionForRowSelectionFromLayout(layout.RowSelection, this.initialRowSelection);
|
|
1282
|
+
const prevRowSelection = this.gridApi.getGridOption('rowSelection');
|
|
1254
1283
|
this.gridApi.setGridOption('rowSelection', rowSelection);
|
|
1284
|
+
// AG Grid does not always refresh already-rendered cells in the selection
|
|
1285
|
+
// column when `rowSelection.checkboxes` is changed at runtime via setGridOption
|
|
1286
|
+
// (e.g. toggling `checkboxes` or `headerCheckbox`).
|
|
1287
|
+
// In the React wrapper this is masked by React-driven re-renders, but in the vanilla integration
|
|
1288
|
+
// the selection column keeps showing stale content until a manual
|
|
1289
|
+
// `refreshCells` is triggered. We force the refresh here so
|
|
1290
|
+
// all integrations behave consistently.
|
|
1291
|
+
if (typeof prevRowSelection === 'object' &&
|
|
1292
|
+
typeof rowSelection === 'object' &&
|
|
1293
|
+
rowSelection.checkboxes !== prevRowSelection.checkboxes) {
|
|
1294
|
+
const selectionColumn = this.gridApi.getColumn(LayoutManager.SELECTION_COLUMN_ID);
|
|
1295
|
+
if (selectionColumn) {
|
|
1296
|
+
this.gridApi.refreshCells({
|
|
1297
|
+
columns: [LayoutManager.SELECTION_COLUMN_ID],
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1255
1301
|
}
|
|
1256
1302
|
applyTableLayout(layout, options) {
|
|
1257
1303
|
this.withSuppressColumnAnimation(() => {
|
|
@@ -1573,10 +1619,20 @@ export class LayoutManager extends LMEmitter {
|
|
|
1573
1619
|
computeColumnOrderAndVisibility(layout, columnState) {
|
|
1574
1620
|
const visibility = layout.ColumnVisibility || {};
|
|
1575
1621
|
const columnOrderSet = new Set(layout.TableColumns);
|
|
1576
|
-
const isColHidden = (colId) =>
|
|
1622
|
+
const isColHidden = (colId) => {
|
|
1623
|
+
if (visibility[colId] === false) {
|
|
1624
|
+
return true;
|
|
1625
|
+
}
|
|
1626
|
+
// for the selection column, return true even
|
|
1627
|
+
// if not explicitly listed in the TableColumns
|
|
1628
|
+
if (colId === LayoutManager.SELECTION_COLUMN_ID && layout.RowSelection) {
|
|
1629
|
+
return false;
|
|
1630
|
+
}
|
|
1631
|
+
return !columnOrderSet.has(colId);
|
|
1632
|
+
};
|
|
1577
1633
|
columnState = columnState ?? {};
|
|
1578
1634
|
columnState.applyOrder = true;
|
|
1579
|
-
const columnIds = getColumnOrderIdsForAllColDefs(layout.TableColumns, this.gridApi.getColumnDefs());
|
|
1635
|
+
const columnIds = adjustColumnIdsForSelection(getColumnOrderIdsForAllColDefs(layout.TableColumns, this.gridApi.getColumnDefs()), layout);
|
|
1580
1636
|
columnState.state = columnIds.map((columnId) => {
|
|
1581
1637
|
return {
|
|
1582
1638
|
colId: columnId,
|
|
@@ -3560,6 +3560,25 @@ export declare const ADAPTABLE_METAMODEL: {
|
|
|
3560
3560
|
r: string;
|
|
3561
3561
|
})[];
|
|
3562
3562
|
};
|
|
3563
|
+
LayoutRowSelection: {
|
|
3564
|
+
k: string;
|
|
3565
|
+
p: ({
|
|
3566
|
+
n: string;
|
|
3567
|
+
k: string;
|
|
3568
|
+
o: boolean;
|
|
3569
|
+
r?: undefined;
|
|
3570
|
+
} | {
|
|
3571
|
+
n: string;
|
|
3572
|
+
k: string;
|
|
3573
|
+
o: boolean;
|
|
3574
|
+
r: string;
|
|
3575
|
+
} | {
|
|
3576
|
+
n: string;
|
|
3577
|
+
k: string;
|
|
3578
|
+
o?: undefined;
|
|
3579
|
+
r?: undefined;
|
|
3580
|
+
})[];
|
|
3581
|
+
};
|
|
3563
3582
|
LayoutState: {
|
|
3564
3583
|
k: string;
|
|
3565
3584
|
p: ({
|