@adaptabletools/adaptable-cjs 22.1.0-canary.0 → 22.1.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/index.css +0 -14
- 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 +15 -0
- package/src/Strategy/SmartEditModule.js +1 -1
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +30 -18
- 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.cjs.tsbuildinfo +1 -1
|
@@ -137,26 +137,29 @@ const ColumnsSectionSummary = () => {
|
|
|
137
137
|
React.createElement(InfiniteTable_1.InfiniteTableGrid, { columnTypes: columnTypes, rowHeight: rowHeight, columnHeaderHeight: headerHeight, domProps: tableDOMProps, columns: columns })));
|
|
138
138
|
};
|
|
139
139
|
exports.ColumnsSectionSummary = ColumnsSectionSummary;
|
|
140
|
+
const isSelectionColumn = (columnId) => columnId === GeneralConstants_1.AG_GRID_SELECTION_COLUMN;
|
|
140
141
|
const isColumnVisible = (options) => {
|
|
141
142
|
const { columnId, layout } = options;
|
|
142
143
|
const isRowGroupColumn = (0, ColumnApiImpl_1.isAutoRowGroupColumn)(columnId);
|
|
143
144
|
const visible = (!(0, isPivotLayout_1.isPivotLayout)(layout) &&
|
|
144
145
|
layout.TableColumns.includes(columnId) &&
|
|
145
146
|
layout.ColumnVisibility?.[columnId] !== false) ||
|
|
146
|
-
isRowGroupColumn
|
|
147
|
+
isRowGroupColumn ||
|
|
148
|
+
isSelectionColumn(columnId);
|
|
147
149
|
return visible;
|
|
148
150
|
};
|
|
149
151
|
const ColumnRow = (props) => {
|
|
150
152
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
151
153
|
const initialHeader = adaptable.api.columnApi.getFriendlyNameForColumnId(props.column.columnId, props.layout);
|
|
152
154
|
const isRowGroupColumn = (0, ColumnApiImpl_1.isAutoRowGroupColumn)(props.column.columnId);
|
|
155
|
+
const isSelectionCol = isSelectionColumn(props.column.columnId);
|
|
153
156
|
const { column } = props;
|
|
154
157
|
const visible = isColumnVisible({ columnId: column.columnId, layout: props.layout });
|
|
155
158
|
return (React.createElement(Flex_1.Box, { "data-name": props.column.columnId, className: "twa:flex-1" },
|
|
156
159
|
React.createElement(Flex_1.Flex, { className: "ab-Layout-Wizard__ColumnRow__Header twa:my-1" },
|
|
157
160
|
React.createElement(CheckBox_1.CheckBox, { "data-name": column.columnId, onChange: (checked) => {
|
|
158
161
|
props.onColumnVisibilityChange(column.columnId, checked);
|
|
159
|
-
}, disabled: column.hideable === false || isRowGroupColumn, onClick: (event) => {
|
|
162
|
+
}, disabled: column.hideable === false || isRowGroupColumn || isSelectionCol, onClick: (event) => {
|
|
160
163
|
event.stopPropagation();
|
|
161
164
|
}, checked: visible }),
|
|
162
165
|
React.createElement(Flex_1.Flex, { className: "twa:mx-2", alignItems: "center", "data-name": "column-label" }, initialHeader),
|
|
@@ -169,7 +172,12 @@ const ColumnsSection = (props) => {
|
|
|
169
172
|
const { data: layout } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
170
173
|
const [searchInputValue, setSearchInputValue] = React.useState('');
|
|
171
174
|
const [selectedColumnId, setSelectedColumnId] = React.useState(null);
|
|
172
|
-
|
|
175
|
+
// the selection column is a special column managed by AG Grid - it is not
|
|
176
|
+
// returned by `getUIAvailableColumns`, but we still want to expose it in the
|
|
177
|
+
// column list (similar to auto row group columns) so users can reorder/pin it
|
|
178
|
+
const hasSelectionColumn = adaptable.api.columnApi
|
|
179
|
+
.getColumns()
|
|
180
|
+
.some((col) => col.isGeneratedSelectionColumn);
|
|
173
181
|
const allColumns = adaptable.api.columnApi
|
|
174
182
|
.getUIAvailableColumns()
|
|
175
183
|
.filter((col) => {
|
|
@@ -180,14 +188,9 @@ const ColumnsSection = (props) => {
|
|
|
180
188
|
})
|
|
181
189
|
// if the current Layout is a PivotLayout, then we also filter out current Pivot Result Columns
|
|
182
190
|
.filter((col) => !col.isGeneratedPivotResultColumn)
|
|
183
|
-
//
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (!result) {
|
|
187
|
-
hasSelectionColumn = true;
|
|
188
|
-
}
|
|
189
|
-
return result;
|
|
190
|
-
});
|
|
191
|
+
// selection columns are not returned by `getUIAvailableColumns` but guard
|
|
192
|
+
// against any future change
|
|
193
|
+
.filter((col) => !col.isGeneratedSelectionColumn);
|
|
191
194
|
const onChange = (data) => {
|
|
192
195
|
if (hasSelectionColumn &&
|
|
193
196
|
Array.isArray(data.TableColumns) &&
|
|
@@ -214,13 +217,22 @@ const ColumnsSection = (props) => {
|
|
|
214
217
|
!allColumns.find((col) => col.columnId === GeneralConstants_1.AG_GRID_GROUPED_COLUMN)) {
|
|
215
218
|
allColumns.unshift((0, ColumnApiImpl_1.generateAutoTreeSingleColumn)());
|
|
216
219
|
}
|
|
220
|
+
if (hasSelectionColumn) {
|
|
221
|
+
allColumns.unshift((0, ColumnApiImpl_1.generateSelectionColumn)());
|
|
222
|
+
}
|
|
217
223
|
const colIdToCol = allColumns.reduce((acc, col) => {
|
|
218
224
|
if (col) {
|
|
219
225
|
acc[col.columnId] = col;
|
|
220
226
|
}
|
|
221
227
|
return acc;
|
|
222
228
|
}, {});
|
|
223
|
-
|
|
229
|
+
let TableColumns = layout.TableColumns;
|
|
230
|
+
// when the selection column exists but is not explicitly listed in
|
|
231
|
+
// TableColumns, `sortArrayWithOrder` would push it to the end - instead we
|
|
232
|
+
// want it at the start (consistent with AG Grid's default position for it)
|
|
233
|
+
if (hasSelectionColumn && !TableColumns.includes(GeneralConstants_1.AG_GRID_SELECTION_COLUMN)) {
|
|
234
|
+
TableColumns = [GeneralConstants_1.AG_GRID_SELECTION_COLUMN, ...TableColumns];
|
|
235
|
+
}
|
|
224
236
|
const ColumnOrderAllColumns = ArrayExtensions_1.default.sortArrayWithOrder(allColumns.map((col) => col.columnId), TableColumns, { sortUnorderedItems: false }).map((colId) => colIdToCol[colId]);
|
|
225
237
|
const currentOrder = searchInputValue
|
|
226
238
|
? ColumnOrderAllColumns.filter((col) => {
|
|
@@ -264,7 +276,7 @@ const ColumnsSection = (props) => {
|
|
|
264
276
|
const columnIdArray = Array.isArray(columnId) ? columnId : [columnId];
|
|
265
277
|
const columnIdSet = new Set(columnIdArray);
|
|
266
278
|
const ColumnVisibility = { ...layout.ColumnVisibility };
|
|
267
|
-
let
|
|
279
|
+
let newTableColumns = [...TableColumns];
|
|
268
280
|
if (visible) {
|
|
269
281
|
columnIdArray.forEach((colId) => {
|
|
270
282
|
delete ColumnVisibility[colId];
|
|
@@ -277,11 +289,11 @@ const ColumnsSection = (props) => {
|
|
|
277
289
|
}
|
|
278
290
|
const columnIds = ColumnOrderAllColumns.map((col) => col.columnId);
|
|
279
291
|
const idsToIndexes = new Map(columnIds.map((colId, index) => [colId, index]));
|
|
280
|
-
const columnOrderSet = new Set(
|
|
292
|
+
const columnOrderSet = new Set(newTableColumns);
|
|
281
293
|
const currentColumnIdsAreIncluded = columnIdArray.every((colId) => columnOrderSet.has(colId));
|
|
282
294
|
if (!currentColumnIdsAreIncluded) {
|
|
283
295
|
const biggestIndex = Math.max(...columnIdArray.map((colId) => idsToIndexes.get(colId)));
|
|
284
|
-
|
|
296
|
+
newTableColumns = columnIds.filter((colId) => {
|
|
285
297
|
const isCurrent = columnOrderSet.has(colId);
|
|
286
298
|
if (isCurrent) {
|
|
287
299
|
return true;
|
|
@@ -303,7 +315,7 @@ const ColumnsSection = (props) => {
|
|
|
303
315
|
}
|
|
304
316
|
onChange({
|
|
305
317
|
...layout,
|
|
306
|
-
TableColumns:
|
|
318
|
+
TableColumns: newTableColumns,
|
|
307
319
|
ColumnVisibility,
|
|
308
320
|
});
|
|
309
321
|
};
|
|
@@ -457,7 +469,7 @@ const ColumnsSection = (props) => {
|
|
|
457
469
|
return (React.createElement(ColumnRow, { onColumnNameChange: handleColumnNameChange, onColumnWidthChange: handleColumnWidthChange, onColumnFlexChange: handleColumnFlexChange, onColumnMinWidthChange: handleColumnMinWidthChange, onColumnMaxWidthChange: handleColumnMaxWidthChange, onColumnVisibilityChange: handleColumnVisibilityChange, onPinChange: handlePinChange, layout: layout, column: option }));
|
|
458
470
|
}, onChange: handleColumnsChange }))),
|
|
459
471
|
currentOrderIds.length ? (React.createElement(ColumnPropertiesEditor, { column: selectedColumnId && currentOrderIds.includes(selectedColumnId)
|
|
460
|
-
?
|
|
472
|
+
? colIdToCol[selectedColumnId] ?? null
|
|
461
473
|
: null, layout: layout, onPinChange: handlePinChange, onColumnNameChange: handleColumnNameChange, onColumnWidthChange: handleColumnWidthChange, onColumnFlexChange: handleColumnFlexChange, onColumnMinWidthChange: handleColumnMinWidthChange, onColumnMaxWidthChange: handleColumnMaxWidthChange, onColumnVisibilityChange: handleColumnVisibilityChange })) : null))));
|
|
462
474
|
};
|
|
463
475
|
exports.ColumnsSection = ColumnsSection;
|
|
@@ -500,7 +512,7 @@ const ColumnPropertiesEditor = (props) => {
|
|
|
500
512
|
React.createElement(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-3 twa:mt-3" },
|
|
501
513
|
React.createElement(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-1" },
|
|
502
514
|
"Header",
|
|
503
|
-
React.createElement(Input_1.default, { "data-name": "column-header", className: "ab-Layout-Wizard__ColumnPropertiesEditor__Input twa:w-full", placeholder: "Custom name (optional)", onChange: () => {
|
|
515
|
+
React.createElement(Input_1.default, { "data-name": "column-header", className: "ab-Layout-Wizard__ColumnPropertiesEditor__Input twa:w-full", placeholder: "Custom name (optional)", disabled: props.column.isGeneratedSelectionColumn, onChange: () => {
|
|
504
516
|
props.onColumnNameChange(props.column.columnId, event.target.value);
|
|
505
517
|
}, value: customHeader })),
|
|
506
518
|
React.createElement(Flex_1.Box, { className: "twa:grid twa:grid-cols-[1fr_1fr] twa:gap-2" },
|
|
@@ -97,7 +97,7 @@ const RowGroupingSection = (props) => {
|
|
|
97
97
|
onChange(newLayout);
|
|
98
98
|
} },
|
|
99
99
|
React.createElement(TypeRadio_1.TypeRadio, { value: "single", text: "Single Column", description: "All Row Grouped Columns display in one hierarchical Column" }),
|
|
100
|
-
React.createElement(TypeRadio_1.TypeRadio, { value: "multi", text: "Multiple Columns", description: "Each Row Grouped
|
|
100
|
+
React.createElement(TypeRadio_1.TypeRadio, { value: "multi", text: "Multiple Columns", description: "Each Row Grouped Column displays in its own, separate, Column" }))))),
|
|
101
101
|
React.createElement(Tabs_1.Tabs, { className: "twa:mt-2" },
|
|
102
102
|
React.createElement(Tabs_1.Tabs.Tab, null, "Row Grouped Columns"),
|
|
103
103
|
React.createElement(Tabs_1.Tabs.Tab, null, rowGroupsText),
|
|
@@ -12,6 +12,7 @@ const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard
|
|
|
12
12
|
const Flex_1 = require("../../../../components/Flex");
|
|
13
13
|
const twMerge_1 = require("../../../../twMerge");
|
|
14
14
|
const HelpBlock_1 = tslib_1.__importDefault(require("../../../../components/HelpBlock"));
|
|
15
|
+
const isPivotLayout_1 = require("../../../../Utilities/isPivotLayout");
|
|
15
16
|
const GeneralConstants_1 = require("../../../../Utilities/Constants/GeneralConstants");
|
|
16
17
|
const RowSelectionSectionSummary = () => {
|
|
17
18
|
const { data: layout } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
@@ -57,6 +58,7 @@ function getMode(layout) {
|
|
|
57
58
|
const RowSelectionSection = (props) => {
|
|
58
59
|
const { data: layout } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
59
60
|
const mode = getMode(layout);
|
|
61
|
+
const isPivot = (0, isPivotLayout_1.isPivotLayout)(layout);
|
|
60
62
|
const rowSelection = layout.RowSelection ?? false;
|
|
61
63
|
const handleModeChange = (newMode) => {
|
|
62
64
|
if (newMode === false) {
|
|
@@ -97,51 +99,48 @@ const RowSelectionSection = (props) => {
|
|
|
97
99
|
};
|
|
98
100
|
return (React.createElement(React.Fragment, null,
|
|
99
101
|
React.createElement(Tabs_1.Tabs, null,
|
|
100
|
-
React.createElement(Tabs_1.Tabs.Tab, null, "Selection Mode"),
|
|
102
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Row Selection Mode"),
|
|
101
103
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
102
104
|
React.createElement(Flex_1.Flex, { flexDirection: "column" },
|
|
103
105
|
React.createElement(Radio_2.RadioGroup, { orientation: "horizontal", variant: "text-only", className: (0, twMerge_1.twMerge)(Radio_1.radioGroupStyling.horizontalTextOnly, 'twa:gap-2 twa:max-w-[500px] twa:bg-defaultbackground twa:p-2'), value: mode, name: "rowSelectionMode", onRadioChange: handleModeChange },
|
|
104
106
|
React.createElement(Radio_1.default, { value: false }, "Disabled"),
|
|
105
107
|
React.createElement(Radio_1.default, { value: "singleRow" }, "Single Row"),
|
|
106
108
|
React.createElement(Radio_1.default, { value: "multiRow" }, "Multi Row"))))),
|
|
109
|
+
!rowSelection && React.createElement(HelpBlock_1.default, null, "There is no Row Selection configured for this Layout"),
|
|
107
110
|
rowSelection && (React.createElement(React.Fragment, null,
|
|
108
111
|
React.createElement(Tabs_1.Tabs, { className: "twa:mt-2" },
|
|
109
|
-
React.createElement(Tabs_1.Tabs.Tab, null, "
|
|
112
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Row Selection Column"),
|
|
110
113
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
111
114
|
React.createElement(Flex_1.Flex, { flexDirection: "row", className: "twa:gap-6" },
|
|
112
|
-
React.createElement(CheckBox_1.CheckBox, { className: "twa:flex-1", checked: rowSelection.Checkboxes ?? true, onChange: (checked) => updateRowSelection({ Checkboxes: checked }) }, "Show
|
|
113
|
-
mode === 'multiRow' && (React.createElement(CheckBox_1.CheckBox, { className: "twa:flex-1", checked: rowSelection.HeaderCheckbox ?? true, onChange: (checked) => updateRowSelection({ HeaderCheckbox: checked }) }, "Show
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
React.createElement(CheckBox_1.CheckBox, { className: "twa:flex-1", checked: rowSelection.Checkboxes ?? true, onChange: (checked) => updateRowSelection({ Checkboxes: checked }) }, "Show Row Selection Checkboxes"),
|
|
116
|
+
mode === 'multiRow' && (React.createElement(CheckBox_1.CheckBox, { className: "twa:flex-1", checked: rowSelection.HeaderCheckbox ?? true, onChange: (checked) => updateRowSelection({ HeaderCheckbox: checked }) }, "Show Header Checkbox (to enable Select All)"))))),
|
|
117
|
+
(rowSelection.Checkboxes ?? true) && (React.createElement(Tabs_1.Tabs, { className: "twa:mt-2" },
|
|
118
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Row Grouping"),
|
|
119
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
120
|
+
React.createElement(Radio_2.RadioGroup, { orientation: "vertical", value: rowSelection.CheckboxInGroupColumn ?? false, name: "checkboxLocation", onRadioChange: (value) => updateRowSelection({ CheckboxInGroupColumn: value }) },
|
|
121
|
+
React.createElement(Radio_1.default, { value: false }, "Show Row Selection Checkbox in dedicated Selection Column"),
|
|
122
|
+
React.createElement(Radio_1.default, { value: true }, "Show Row Selection Checkbox in Row Grouped Column"))))),
|
|
119
123
|
React.createElement(Tabs_1.Tabs, { className: "twa:mt-2" },
|
|
120
|
-
React.createElement(Tabs_1.Tabs.Tab, null, "Row Click Selection"),
|
|
124
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Row Click Selection (when user clicks on Row outside of Selection Checkbox)"),
|
|
121
125
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
122
|
-
React.createElement(HelpBlock_1.default, { className: "twa:bg-primarydark/30 twa:text-text-on-primarydark twa:p-2 twa:rounded-standard twa:mb-2" },
|
|
123
|
-
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."),
|
|
124
|
-
React.createElement("p", null, "Should a click outside the checkbox select the row?")),
|
|
125
126
|
React.createElement(Radio_2.RadioGroup, { orientation: "vertical", value: rowSelection.EnableClickSelection ?? false, name: "clickSelection", onRadioChange: (value) => updateRowSelection({ EnableClickSelection: value }) },
|
|
126
|
-
React.createElement(Radio_1.default, { value: false }, "Disabled"),
|
|
127
|
-
React.createElement(Radio_1.default, { value: true }, "Enable selection and deselection"),
|
|
128
|
-
React.createElement(Radio_1.default, { value: 'enableSelection' }, "Enable selection
|
|
129
|
-
React.createElement(Radio_1.default, { value: 'enableDeselection' }, "Enable deselection
|
|
127
|
+
React.createElement(Radio_1.default, { value: false }, "Disabled (Cannot select or deselect by clicking in Row)"),
|
|
128
|
+
React.createElement(Radio_1.default, { value: true }, "Full (Enable selection by clicking in Row and deselection by Ctrl+clicking in Row)"),
|
|
129
|
+
React.createElement(Radio_1.default, { value: 'enableSelection' }, "Selection Only (Enable selection by clicking in Row)"),
|
|
130
|
+
React.createElement(Radio_1.default, { value: 'enableDeselection' }, "Deselection Only (Enable deselection by Ctrl+clicking in Row)")))),
|
|
131
|
+
mode === 'multiRow' && !isPivot && (React.createElement(Tabs_1.Tabs, { className: "twa:mt-2" },
|
|
132
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Grouped Row Selection Behaviour"),
|
|
133
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
134
|
+
React.createElement(Radio_2.RadioGroup, { orientation: "vertical", value: rowSelection.GroupSelectMode ?? 'self', name: "groupSelectMode", onRadioChange: (value) => updateRowSelection({ GroupSelectMode: value }) },
|
|
135
|
+
React.createElement(Radio_1.default, { value: 'self' }, "Select Grouped Row Only (no cascade)"),
|
|
136
|
+
React.createElement(Radio_1.default, { value: 'descendants' }, "Select Grouped Row and all descendants"),
|
|
137
|
+
React.createElement(Radio_1.default, { value: 'filteredDescendants' }, "Select Grouped Row and only filtered descendants"))))),
|
|
130
138
|
mode === 'multiRow' && (React.createElement(Tabs_1.Tabs, { className: "twa:mt-2" },
|
|
131
|
-
React.createElement(Tabs_1.Tabs.Tab, null, "
|
|
139
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Select All (in Header) Behaviour"),
|
|
132
140
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
133
|
-
React.createElement(
|
|
134
|
-
React.createElement(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
React.createElement(Radio_1.default, { value: 'self' }, "Only select group row (no cascade)"),
|
|
138
|
-
React.createElement(Radio_1.default, { value: 'descendants' }, "Select group row and all descendants"),
|
|
139
|
-
React.createElement(Radio_1.default, { value: 'filteredDescendants' }, "Select group row and filtered descendants"))),
|
|
140
|
-
React.createElement(Flex_1.Flex, { flexDirection: "row", className: "twa:ml-6 twa:flex-1" },
|
|
141
|
-
React.createElement(Flex_1.Box, { className: "twa:self-center twa:mr-3" }, "Select All"),
|
|
142
|
-
React.createElement(Radio_2.RadioGroup, { orientation: "vertical", value: rowSelection.SelectAllMode ?? 'all', name: "selectAllMode", onRadioChange: (value) => updateRowSelection({ SelectAllMode: value }) },
|
|
143
|
-
React.createElement(Radio_1.default, { value: 'all' }, "All rows"),
|
|
144
|
-
React.createElement(Radio_1.default, { value: 'filtered' }, "Filtered rows only"),
|
|
145
|
-
React.createElement(Radio_1.default, { value: 'currentPage' }, "Current page only")))))))))));
|
|
141
|
+
React.createElement(Radio_2.RadioGroup, { orientation: "vertical", value: rowSelection.SelectAllMode ?? 'all', name: "selectAllMode", onRadioChange: (value) => updateRowSelection({ SelectAllMode: value }) },
|
|
142
|
+
React.createElement(Radio_1.default, { value: 'all' }, "All rows"),
|
|
143
|
+
React.createElement(Radio_1.default, { value: 'filtered' }, "Filtered rows only"),
|
|
144
|
+
React.createElement(Radio_1.default, { value: 'currentPage' }, "Current page only")))))))));
|
|
146
145
|
};
|
|
147
146
|
exports.RowSelectionSection = RowSelectionSection;
|
|
@@ -466,7 +466,7 @@ class AdaptableAgGrid {
|
|
|
466
466
|
// fixes issue #3053
|
|
467
467
|
gridOptions.suppressAggFuncInHeader = !!layoutModel.SuppressAggFuncInHeader;
|
|
468
468
|
if (!(0, isPivotLayoutModel_1.isPivotLayoutModel)(layoutModel) &&
|
|
469
|
-
src_1.LayoutManager.
|
|
469
|
+
src_1.LayoutManager.shouldUnlockSelectionColumnPosition(layoutModel)) {
|
|
470
470
|
gridOptions.selectionColumnDef = {
|
|
471
471
|
...gridOptions.selectionColumnDef,
|
|
472
472
|
lockPosition: false,
|
package/src/env.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = {
|
|
4
4
|
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" || '',
|
|
5
|
-
PUBLISH_TIMESTAMP:
|
|
6
|
-
VERSION: "22.1.0-canary.
|
|
5
|
+
PUBLISH_TIMESTAMP: 1776672498444 || Date.now(),
|
|
6
|
+
VERSION: "22.1.0-canary.1" || '--current-version--',
|
|
7
7
|
};
|
|
@@ -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;
|
|
@@ -141,6 +141,19 @@ function getDefaultColumnSizeStateForColDef(colId, colDef, options) {
|
|
|
141
141
|
}
|
|
142
142
|
return undefined;
|
|
143
143
|
}
|
|
144
|
+
function adjustColumnIdsForSelection(columnIds, layout) {
|
|
145
|
+
const selectionColPinning = layout.ColumnPinning?.[LayoutManager.SELECTION_COLUMN_ID];
|
|
146
|
+
if ((layout.RowSelection || selectionColPinning) &&
|
|
147
|
+
!columnIds.includes(LayoutManager.SELECTION_COLUMN_ID)) {
|
|
148
|
+
if (selectionColPinning === 'right') {
|
|
149
|
+
columnIds = [...columnIds, LayoutManager.SELECTION_COLUMN_ID];
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
columnIds = [LayoutManager.SELECTION_COLUMN_ID, ...columnIds];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return columnIds;
|
|
156
|
+
}
|
|
144
157
|
class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
145
158
|
gridApi;
|
|
146
159
|
fieldsToIds = {};
|
|
@@ -812,7 +825,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
812
825
|
layout.TableColumns = layout.TableColumns.filter((colId) => colId != undefined);
|
|
813
826
|
layout = (0, normalizeLayoutModel_1.normalizeTableLayoutModel)(layout, { isTree: _options?.isTree ?? false });
|
|
814
827
|
const agGridState = {};
|
|
815
|
-
const columnIds = getColumnOrderIdsForAllColDefs(layout.TableColumns, colDefs);
|
|
828
|
+
const columnIds = adjustColumnIdsForSelection(getColumnOrderIdsForAllColDefs(layout.TableColumns, colDefs), layout);
|
|
816
829
|
agGridState.columnOrder = {
|
|
817
830
|
orderedColIds: columnIds,
|
|
818
831
|
};
|
|
@@ -1211,8 +1224,23 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
1211
1224
|
const index = tableColumns.indexOf(LayoutManager.SELECTION_COLUMN_ID);
|
|
1212
1225
|
return index > 0;
|
|
1213
1226
|
}
|
|
1227
|
+
static shouldUnlockSelectionColumnPosition(layout) {
|
|
1228
|
+
const tableColumns = layout.TableColumns;
|
|
1229
|
+
if (!tableColumns) {
|
|
1230
|
+
return false;
|
|
1231
|
+
}
|
|
1232
|
+
const index = tableColumns.indexOf(LayoutManager.SELECTION_COLUMN_ID);
|
|
1233
|
+
if (index > 0) {
|
|
1234
|
+
return true;
|
|
1235
|
+
}
|
|
1236
|
+
const columnPinning = layout.ColumnPinning;
|
|
1237
|
+
if (columnPinning && columnPinning[LayoutManager.SELECTION_COLUMN_ID]) {
|
|
1238
|
+
return true;
|
|
1239
|
+
}
|
|
1240
|
+
return false;
|
|
1241
|
+
}
|
|
1214
1242
|
ensureSelectionColumnPositionUnlocked(layout) {
|
|
1215
|
-
if (LayoutManager.
|
|
1243
|
+
if (LayoutManager.shouldUnlockSelectionColumnPosition(layout)) {
|
|
1216
1244
|
const current = this.gridApi.getGridOption('selectionColumnDef');
|
|
1217
1245
|
if (!current || current.lockPosition !== false) {
|
|
1218
1246
|
this.gridApi.setGridOption('selectionColumnDef', {
|
|
@@ -1254,7 +1282,25 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
1254
1282
|
}
|
|
1255
1283
|
applyRowSelection(layout) {
|
|
1256
1284
|
const rowSelection = LayoutManager.getGridOptionForRowSelectionFromLayout(layout.RowSelection, this.initialRowSelection);
|
|
1285
|
+
const prevRowSelection = this.gridApi.getGridOption('rowSelection');
|
|
1257
1286
|
this.gridApi.setGridOption('rowSelection', rowSelection);
|
|
1287
|
+
// AG Grid does not always refresh already-rendered cells in the selection
|
|
1288
|
+
// column when `rowSelection.checkboxes` is changed at runtime via setGridOption
|
|
1289
|
+
// (e.g. toggling `checkboxes` or `headerCheckbox`).
|
|
1290
|
+
// In the React wrapper this is masked by React-driven re-renders, but in the vanilla integration
|
|
1291
|
+
// the selection column keeps showing stale content until a manual
|
|
1292
|
+
// `refreshCells` is triggered. We force the refresh here so
|
|
1293
|
+
// all integrations behave consistently.
|
|
1294
|
+
if (typeof prevRowSelection === 'object' &&
|
|
1295
|
+
typeof rowSelection === 'object' &&
|
|
1296
|
+
rowSelection.checkboxes !== prevRowSelection.checkboxes) {
|
|
1297
|
+
const selectionColumn = this.gridApi.getColumn(LayoutManager.SELECTION_COLUMN_ID);
|
|
1298
|
+
if (selectionColumn) {
|
|
1299
|
+
this.gridApi.refreshCells({
|
|
1300
|
+
columns: [LayoutManager.SELECTION_COLUMN_ID],
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1258
1304
|
}
|
|
1259
1305
|
applyTableLayout(layout, options) {
|
|
1260
1306
|
this.withSuppressColumnAnimation(() => {
|
|
@@ -1576,10 +1622,20 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
1576
1622
|
computeColumnOrderAndVisibility(layout, columnState) {
|
|
1577
1623
|
const visibility = layout.ColumnVisibility || {};
|
|
1578
1624
|
const columnOrderSet = new Set(layout.TableColumns);
|
|
1579
|
-
const isColHidden = (colId) =>
|
|
1625
|
+
const isColHidden = (colId) => {
|
|
1626
|
+
if (visibility[colId] === false) {
|
|
1627
|
+
return true;
|
|
1628
|
+
}
|
|
1629
|
+
// for the selection column, return true even
|
|
1630
|
+
// if not explicitly listed in the TableColumns
|
|
1631
|
+
if (colId === LayoutManager.SELECTION_COLUMN_ID && layout.RowSelection) {
|
|
1632
|
+
return false;
|
|
1633
|
+
}
|
|
1634
|
+
return !columnOrderSet.has(colId);
|
|
1635
|
+
};
|
|
1580
1636
|
columnState = columnState ?? {};
|
|
1581
1637
|
columnState.applyOrder = true;
|
|
1582
|
-
const columnIds = getColumnOrderIdsForAllColDefs(layout.TableColumns, this.gridApi.getColumnDefs());
|
|
1638
|
+
const columnIds = adjustColumnIdsForSelection(getColumnOrderIdsForAllColDefs(layout.TableColumns, this.gridApi.getColumnDefs()), layout);
|
|
1583
1639
|
columnState.state = columnIds.map((columnId) => {
|
|
1584
1640
|
return {
|
|
1585
1641
|
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: ({
|