@adaptabletools/adaptable-cjs 22.0.11 → 22.1.0-canary.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.
Files changed (68) hide show
  1. package/index.css +33 -1
  2. package/index.css.map +1 -1
  3. package/package.json +3 -4
  4. package/src/AdaptableState/Common/AdaptablePredicate.js +1 -1
  5. package/src/AdaptableState/InitialState.d.ts +2 -2
  6. package/src/AdaptableState/LayoutState.d.ts +47 -0
  7. package/src/Api/CalendarApi.d.ts +15 -0
  8. package/src/Api/ColumnScopeApi.d.ts +5 -0
  9. package/src/Api/Implementation/CalendarApiImpl.d.ts +3 -0
  10. package/src/Api/Implementation/CalendarApiImpl.js +10 -0
  11. package/src/Api/Implementation/ColumnScopeApiImpl.d.ts +1 -0
  12. package/src/Api/Implementation/ColumnScopeApiImpl.js +12 -0
  13. package/src/Api/Implementation/LayoutHelpers.js +12 -0
  14. package/src/Api/Internal/AlertInternalApi.js +4 -1
  15. package/src/Api/Internal/FormatColumnInternalApi.js +3 -3
  16. package/src/Strategy/FlashingCellModule.js +1 -0
  17. package/src/Strategy/PlusMinusModule.js +3 -3
  18. package/src/Utilities/Constants/GeneralConstants.js +2 -1
  19. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.d.ts +1 -1
  20. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +41 -2
  21. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +1 -1
  22. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +31 -2
  23. package/src/Utilities/Helpers/AdaptableHelper.js +30 -4
  24. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +1 -0
  25. package/src/Utilities/Services/MetamodelService.js +18 -18
  26. package/src/Utilities/Services/QueryLanguageService.d.ts +2 -0
  27. package/src/Utilities/Services/QueryLanguageService.js +20 -8
  28. package/src/Utilities/Services/ValidationService.js +3 -1
  29. package/src/View/Components/EntityRulesEditor/index.js +1 -1
  30. package/src/View/Components/ModuleValueSelector/index.js +9 -1
  31. package/src/View/Components/ReorderDraggable/index.js +21 -35
  32. package/src/View/Components/ValueSelector/index.js +45 -49
  33. package/src/View/Dashboard/PinnedToolbarsSelector.js +1 -1
  34. package/src/View/Layout/Wizard/LayoutWizard.js +16 -1
  35. package/src/View/Layout/Wizard/sections/RowSelectionSection.d.ts +8 -0
  36. package/src/View/Layout/Wizard/sections/RowSelectionSection.js +147 -0
  37. package/src/View/NamedQuery/Wizard/NamedQuerySettingsWizardSection.js +0 -1
  38. package/src/agGrid/AdaptableAgGrid.js +10 -0
  39. package/src/components/Dashboard/Dashboard.js +1 -1
  40. package/src/components/DragAndDropContext/ModuleManager.d.ts +1 -0
  41. package/src/components/DragAndDropContext/ModuleManager.js +11 -36
  42. package/src/components/DragAndDropContext/TabList.d.ts +11 -6
  43. package/src/components/DragAndDropContext/TabList.js +77 -35
  44. package/src/components/DragAndDropContext/UnusedPanel.js +9 -20
  45. package/src/components/ExpressionEditor/BaseEditorInput.d.ts +2 -0
  46. package/src/components/ExpressionEditor/BaseEditorInput.js +4 -0
  47. package/src/components/ExpressionEditor/EditorInput.d.ts +3 -1
  48. package/src/components/ExpressionEditor/EditorInput.js +20 -9
  49. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +2 -1
  50. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +1 -10
  51. package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +16 -18
  52. package/src/components/ExpressionEditor/index.d.ts +2 -1
  53. package/src/components/ExpressionEditor/index.js +1 -1
  54. package/src/components/Tree/TreeDropdown/index.js +37 -26
  55. package/src/components/dnd/index.d.ts +3 -13
  56. package/src/components/dnd/index.js +11 -59
  57. package/src/env.js +2 -2
  58. package/src/layout-manager/src/LayoutManagerModel.d.ts +2 -1
  59. package/src/layout-manager/src/index.d.ts +9 -0
  60. package/src/layout-manager/src/index.js +97 -1
  61. package/src/layout-manager/src/normalizeLayoutModel.js +8 -0
  62. package/src/layout-manager/src/simplifyLayoutModel.js +6 -0
  63. package/src/metamodel/adaptable-metamodel-model.d.ts +22 -13
  64. package/src/metamodel/adaptable.metamodel.d.ts +3773 -5143
  65. package/src/metamodel/adaptable.metamodel.js +1 -1
  66. package/src/parser/src/parser.js +55 -1218
  67. package/src/parser/src/types.d.ts +5 -0
  68. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -10,7 +10,6 @@ const CheckBox_1 = require("../../../components/CheckBox");
10
10
  const icons_1 = require("../../../components/icons");
11
11
  const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
12
12
  const AdaptableFormControlTextClear_1 = require("../Forms/AdaptableFormControlTextClear");
13
- const ArrayExtensions_1 = tslib_1.__importDefault(require("../../../Utilities/Extensions/ArrayExtensions"));
14
13
  const Flex_1 = require("../../../components/Flex");
15
14
  const clsx_1 = tslib_1.__importDefault(require("clsx"));
16
15
  function useValuesMap({ options, value, toIdentifier, selectedMap, }) {
@@ -62,13 +61,14 @@ function ValueSelector(props) {
62
61
  const identifier = toIdentifier(option);
63
62
  const label = !allowReorder ? preparedToLabel(option) : null;
64
63
  const reorderable = typeof allowReorder === 'function' ? allowReorder(option) : allowReorder;
65
- const renderNode = (props, dragHandleProps) => {
66
- return (React.createElement(Flex_1.Flex, { alignItems: "center", key: identifier ?? index, "data-index": index, "data-id": identifier, "data-name": "option", ...props, className: (0, clsx_1.default)(`twa:bg-primary twa:text-text-on-primary twa:rounded-standard twa:p-2`, {
64
+ return (React.createElement(dnd_1.DragList.DraggableItem, { key: identifier, id: `${identifier}` }, (itemDomProps) => {
65
+ const { onPointerDown, ...restDomProps } = itemDomProps;
66
+ return (React.createElement(Flex_1.Flex, { alignItems: "center", "data-index": index, "data-id": identifier, "data-name": "option", ...restDomProps, className: (0, clsx_1.default)('twa:bg-primary twa:text-text-on-primary twa:rounded-standard twa:p-2', {
67
67
  'twa:mt-1': index,
68
68
  'twa:mt-0': !index,
69
- }, props.className, `${baseClassName}__option`) },
69
+ }, restDomProps.className, `${baseClassName}__option`) },
70
70
  React.createElement(Flex_1.Flex, { flexDirection: "row", alignItems: "center", className: "twa:flex-1" },
71
- reorderable ? (React.createElement(Flex_1.Box, { ...dragHandleProps, className: (0, clsx_1.default)('twa:mr-3', dragHandleProps?.className) },
71
+ reorderable ? (React.createElement(Flex_1.Box, { onPointerDown: onPointerDown, className: "twa:mr-3" },
72
72
  React.createElement(icons_1.Icon, { name: "drag", style: { cursor: 'grab' } }))) : null,
73
73
  singleSelect ? (React.createElement(Radio_1.default, { checked: selectedMap.has(identifier), "data-name": identifier, onChange: (checked) => {
74
74
  if (checked) {
@@ -89,13 +89,6 @@ function ValueSelector(props) {
89
89
  notifyChange();
90
90
  }, checked: selectedMap.has(identifier) }, label)),
91
91
  React.createElement(Flex_1.Box, { className: "twa:ml-2 twa:flex-1" }, allowReorder ? preparedToLabel(option) : null))));
92
- };
93
- return (React.createElement(dnd_1.Draggable, { key: identifier, index: index, draggableId: `${identifier}`, isDragDisabled: !reorderable }, (draggableProvided) => {
94
- return renderNode({
95
- ref: draggableProvided.innerRef,
96
- ...draggableProvided.draggableProps,
97
- style: draggableProvided.draggableProps.style,
98
- }, draggableProvided.dragHandleProps);
99
92
  }));
100
93
  };
101
94
  const showOnlySelectedCheckbox = (React.createElement(CheckBox_1.CheckBox, { disabled: !value.length, checked: selectedOnly, onChange: setSelectedOnly }, showSelectedOnlyLabel ?? 'Show Selected Only'));
@@ -120,45 +113,48 @@ function ValueSelector(props) {
120
113
  return (React.createElement(Flex_1.Flex, { style: props.style, className: (0, clsx_1.default)('twa:flex-1', baseClassName), flexDirection: "column" },
121
114
  React.createElement(Flex_1.Flex, { className: "twa:mb-1" }, showFilterInput && filter ? (React.createElement(AdaptableFormControlTextClear_1.AdaptableFormControlTextClear, { value: searchInputValue, OnTextChange: setSearchInputValue, placeholder: "Type to search", className: "twa:flex-1 twa:border-0 twa:m-[3px]" })) : (React.createElement(Flex_1.Box, { className: "twa:flex-1" }))),
122
115
  (0, exports.renderSelectionSection)(selectionSectionProps),
123
- React.createElement(dnd_1.DragDropContext, { onDragEnd: (result) => {
124
- const { source, destination } = result;
125
- const selection = [];
126
- const extraKeys = [];
127
- for (let [key, value] of selectedMap) {
128
- if (value != null) {
129
- selection.push(key);
130
- }
131
- else {
132
- // null/non-existent keys have to be stored separately
133
- extraKeys.push(key);
134
- }
135
- }
136
- const clone = new Map(selectedMap);
137
- const newSelection = ArrayExtensions_1.default.reorderArray(selection, source.index, destination.index);
138
- // and then pushed back in the new order, at the end
139
- newSelection.push(...extraKeys);
140
- selectedMap.clear();
141
- newSelection.forEach((key) => {
142
- selectedMap.set(key, clone.get(key));
143
- });
144
- notifyChange();
145
- } },
116
+ React.createElement(dnd_1.DragDropProvider, null,
146
117
  React.createElement(Flex_1.Flex, { className: `${baseClassName}__body twa:flex-1 twa:overflow-auto`, flexDirection: "column" },
147
- React.createElement(dnd_1.Droppable, { droppableId: "droppable" }, (droppableProvided) => {
148
- return (React.createElement("div", { ref: droppableProvided.innerRef, ...droppableProvided.droppableProps },
149
- options
150
- .filter((option) => {
151
- let result = true;
152
- if (filter) {
153
- result = filter(option, searchInputValue);
118
+ React.createElement(dnd_1.DragList, { dragListId: "value-selector", orientation: "vertical", onDragProxyMove: dnd_1.defaultDragProxyMove, onDragProxySetup: ({ proxyElement }) => {
119
+ proxyElement.classList.add('twa:shadow-md');
120
+ }, onDrop: (_sortedIndexes) => {
121
+ const selection = [];
122
+ const extraKeys = [];
123
+ for (const [key, value] of selectedMap) {
124
+ if (value != null) {
125
+ selection.push(key);
154
126
  }
155
- result =
156
- result && (selectedOnly ? selectedMap.has(toIdentifier(option)) : true);
157
- return result;
158
- })
159
- .map(renderOption),
160
- droppableProvided.placeholder));
161
- })))));
127
+ else {
128
+ // null/non-existent keys have to be stored separately
129
+ extraKeys.push(key);
130
+ }
131
+ }
132
+ const clone = new Map(selectedMap);
133
+ // const newSelection: ID_TYPE[] = ArrayExtensions.reorderArray(
134
+ // selection,
135
+ // dragIndex,
136
+ // dropIndex
137
+ // );
138
+ const newSelection = _sortedIndexes
139
+ .map((index) => selection[index])
140
+ .filter((x) => x != null);
141
+ newSelection.push(...extraKeys);
142
+ selectedMap.clear();
143
+ newSelection.forEach((key) => {
144
+ selectedMap.set(key, clone.get(key));
145
+ });
146
+ notifyChange();
147
+ } }, (listDomProps) => (React.createElement("div", { ...listDomProps }, options
148
+ .filter((option) => {
149
+ let result = true;
150
+ if (filter) {
151
+ result = filter(option, searchInputValue);
152
+ }
153
+ result =
154
+ result && (selectedOnly ? selectedMap.has(toIdentifier(option)) : true);
155
+ return result;
156
+ })
157
+ .map(renderOption))))))));
162
158
  }
163
159
  const renderSelectionSection = (props) => {
164
160
  const { value, options, disabled, singleSelect, toLabel, toIdentifier, } = props;
@@ -41,6 +41,6 @@ const PinnedToolbarsSelector = (props) => {
41
41
  editTabName: false,
42
42
  }, onTabsChange: (tabs) => {
43
43
  dispatch((0, DashboardRedux_1.DashboardSetPinnedToolbars)(tabs[0].Items));
44
- }, disabled: isDashboardDisabled, tabs: tabs, availableItems: toolbars, tabsTitle: 'Pinned Toolbars', unusedPanelTitle: "Available Pinned Toolbars", dragItemText: "Drag into the Panel below" }));
44
+ }, disabled: isDashboardDisabled, tabs: tabs, availableItems: toolbars, filterOutSelectedItems: true, tabsTitle: 'Pinned Toolbars', unusedPanelTitle: "Available Pinned Toolbars", dragItemText: "Drag into the Panel below" }));
45
45
  };
46
46
  exports.PinnedToolbarsSelector = PinnedToolbarsSelector;
@@ -17,6 +17,7 @@ const SortSection_1 = require("./sections/SortSection");
17
17
  const FilterSection_1 = require("./sections/FilterSection");
18
18
  const GridFilterSection_1 = require("./sections/GridFilterSection");
19
19
  const RowSummarySection_1 = require("./sections/RowSummarySection");
20
+ const RowSelectionSection_1 = require("./sections/RowSelectionSection");
20
21
  const RowSummary_1 = require("../../../AdaptableState/Common/RowSummary");
21
22
  const isPivotLayout_1 = require("../../../Utilities/isPivotLayout");
22
23
  const PivotRowGroupingSection_1 = require("./sections/PivotRowGroupingSection");
@@ -118,7 +119,7 @@ const LayoutWizard = (props) => {
118
119
  isValid: (data) => (0, PivotAggregationsSection_1.isPivotAggregationsSectionValid)(data),
119
120
  render: () => (React.createElement(Flex_1.Box, { className: "twa:p-2 twa:h-full" },
120
121
  React.createElement(PivotAggregationsSection_1.PivotAggregationsSection, { onChange: (layout) => {
121
- let newLayout = (0, Helper_1.cloneObject)(layout);
122
+ const newLayout = (0, Helper_1.cloneObject)(layout);
122
123
  setLayout(newLayout);
123
124
  } }))),
124
125
  },
@@ -148,6 +149,13 @@ const LayoutWizard = (props) => {
148
149
  render: () => (React.createElement(Flex_1.Box, { className: "twa:p-2 twa:h-full" },
149
150
  React.createElement(GridFilterSection_1.GridFilterSection, { onChange: (newLayout) => setLayout(newLayout) }))),
150
151
  },
152
+ {
153
+ title: 'Row Selection',
154
+ details: 'Configure Row Selection',
155
+ renderSummary: () => React.createElement(RowSelectionSection_1.RowSelectionSectionSummary, null),
156
+ render: () => (React.createElement(Flex_1.Box, { className: "twa:p-2" },
157
+ React.createElement(RowSelectionSection_1.RowSelectionSection, { onChange: (newLayout) => setLayout(newLayout) }))),
158
+ },
151
159
  '-',
152
160
  {
153
161
  details: 'Review your Pivot Layout',
@@ -261,6 +269,13 @@ const LayoutWizard = (props) => {
261
269
  render: () => (React.createElement(Flex_1.Box, { className: "twa:p-2 twa:h-full" },
262
270
  React.createElement(GridFilterSection_1.GridFilterSection, { onChange: (newLayout) => setLayout(newLayout) }))),
263
271
  },
272
+ {
273
+ title: 'Row Selection',
274
+ details: 'Configure Row Selection',
275
+ renderSummary: () => React.createElement(RowSelectionSection_1.RowSelectionSectionSummary, null),
276
+ render: () => (React.createElement(Flex_1.Box, { className: "twa:p-2" },
277
+ React.createElement(RowSelectionSection_1.RowSelectionSection, { onChange: (newLayout) => setLayout(newLayout) }))),
278
+ },
264
279
  '-',
265
280
  {
266
281
  details: 'Review your Table Layout',
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import { Layout } from '../../../../../types';
3
+ export declare const RowSelectionSectionSummary: React.FunctionComponent;
4
+ interface RowSelectionSectionProps {
5
+ onChange: (data: Layout) => void;
6
+ }
7
+ export declare const RowSelectionSection: React.FunctionComponent<RowSelectionSectionProps>;
8
+ export {};
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RowSelectionSection = exports.RowSelectionSectionSummary = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const CheckBox_1 = require("../../../../components/CheckBox");
7
+ const Radio_1 = tslib_1.__importStar(require("../../../../components/Radio"));
8
+ const Radio_2 = require("../../../../components/Radio");
9
+ const Tabs_1 = require("../../../../components/Tabs");
10
+ const Tag_1 = require("../../../../components/Tag");
11
+ const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
12
+ const Flex_1 = require("../../../../components/Flex");
13
+ const twMerge_1 = require("../../../../twMerge");
14
+ const HelpBlock_1 = tslib_1.__importDefault(require("../../../../components/HelpBlock"));
15
+ const GeneralConstants_1 = require("../../../../Utilities/Constants/GeneralConstants");
16
+ const RowSelectionSectionSummary = () => {
17
+ const { data: layout } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
18
+ if (layout.RowSelection === false) {
19
+ return (React.createElement(Flex_1.Box, null,
20
+ React.createElement(Tag_1.Tag, null, "Row Selection Disabled")));
21
+ }
22
+ if (!layout.RowSelection) {
23
+ return (React.createElement(Flex_1.Box, null,
24
+ React.createElement(Tag_1.Tag, null, "Default (from Grid Options)")));
25
+ }
26
+ const rs = layout.RowSelection;
27
+ return (React.createElement(Flex_1.Box, null,
28
+ React.createElement(Tag_1.Tag, { className: "twa:mr-2" },
29
+ "Mode: ",
30
+ rs.Mode === 'multiRow' ? 'Multi Row' : 'Single Row'),
31
+ rs.Checkboxes != null && (React.createElement(Tag_1.Tag, { className: "twa:mr-2" },
32
+ "Checkboxes: ",
33
+ rs.Checkboxes ? 'Yes' : 'No')),
34
+ rs.HeaderCheckbox != null && (React.createElement(Tag_1.Tag, { className: "twa:mr-2" },
35
+ "Header Checkbox: ",
36
+ rs.HeaderCheckbox ? 'Yes' : 'No')),
37
+ rs.EnableClickSelection != null && (React.createElement(Tag_1.Tag, { className: "twa:mr-2" },
38
+ "Click Selection: ",
39
+ String(rs.EnableClickSelection))),
40
+ rs.CheckboxInGroupColumn != null && (React.createElement(Tag_1.Tag, { className: "twa:mr-2" },
41
+ "Checkbox Location: ",
42
+ rs.CheckboxInGroupColumn ? 'Group Column' : 'Selection Column')),
43
+ rs.GroupSelectMode != null && (React.createElement(Tag_1.Tag, { className: "twa:mr-2" },
44
+ "Group Select Mode: ",
45
+ rs.GroupSelectMode)),
46
+ rs.SelectAllMode != null && (React.createElement(Tag_1.Tag, { className: "twa:mr-2" },
47
+ "Select All Mode: ",
48
+ rs.SelectAllMode))));
49
+ };
50
+ exports.RowSelectionSectionSummary = RowSelectionSectionSummary;
51
+ function getMode(layout) {
52
+ if (!layout.RowSelection) {
53
+ return false;
54
+ }
55
+ return layout.RowSelection.Mode;
56
+ }
57
+ const RowSelectionSection = (props) => {
58
+ const { data: layout } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
59
+ const mode = getMode(layout);
60
+ const rowSelection = layout.RowSelection ?? false;
61
+ const handleModeChange = (newMode) => {
62
+ if (newMode === false) {
63
+ props.onChange({ ...layout, RowSelection: false });
64
+ return;
65
+ }
66
+ const base = rowSelection
67
+ ? { ...rowSelection, Mode: newMode }
68
+ : { Mode: newMode };
69
+ if (newMode === 'singleRow') {
70
+ delete base.HeaderCheckbox;
71
+ delete base.GroupSelectMode;
72
+ delete base.SelectAllMode;
73
+ }
74
+ props.onChange({ ...layout, RowSelection: base });
75
+ };
76
+ const updateRowSelection = (patch) => {
77
+ if (!rowSelection) {
78
+ return;
79
+ }
80
+ const newLayout = {
81
+ ...layout,
82
+ RowSelection: { ...rowSelection, ...patch },
83
+ };
84
+ if (newLayout.RowSelection && !newLayout.RowSelection.CheckboxInGroupColumn) {
85
+ if (newLayout.TableColumns) {
86
+ if (!newLayout.TableColumns.includes(GeneralConstants_1.AG_GRID_SELECTION_COLUMN)) {
87
+ newLayout.TableColumns = [GeneralConstants_1.AG_GRID_SELECTION_COLUMN, ...(newLayout.TableColumns ?? [])];
88
+ }
89
+ }
90
+ else if (newLayout.PivotColumns) {
91
+ if (!newLayout.PivotColumns.includes(GeneralConstants_1.AG_GRID_SELECTION_COLUMN)) {
92
+ newLayout.PivotColumns = [GeneralConstants_1.AG_GRID_SELECTION_COLUMN, ...(newLayout.PivotColumns ?? [])];
93
+ }
94
+ }
95
+ }
96
+ props.onChange(newLayout);
97
+ };
98
+ return (React.createElement(React.Fragment, null,
99
+ React.createElement(Tabs_1.Tabs, null,
100
+ React.createElement(Tabs_1.Tabs.Tab, null, "Selection Mode"),
101
+ React.createElement(Tabs_1.Tabs.Content, null,
102
+ React.createElement(Flex_1.Flex, { flexDirection: "column" },
103
+ 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
+ React.createElement(Radio_1.default, { value: false }, "Disabled"),
105
+ React.createElement(Radio_1.default, { value: "singleRow" }, "Single Row"),
106
+ React.createElement(Radio_1.default, { value: "multiRow" }, "Multi Row"))))),
107
+ rowSelection && (React.createElement(React.Fragment, null,
108
+ React.createElement(Tabs_1.Tabs, { className: "twa:mt-2" },
109
+ React.createElement(Tabs_1.Tabs.Tab, null, "Options"),
110
+ React.createElement(Tabs_1.Tabs.Content, null,
111
+ 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 selection checkboxes"),
113
+ mode === 'multiRow' && (React.createElement(CheckBox_1.CheckBox, { className: "twa:flex-1", checked: rowSelection.HeaderCheckbox ?? true, onChange: (checked) => updateRowSelection({ HeaderCheckbox: checked }) }, "Show header checkbox for select all"))),
114
+ (rowSelection.Checkboxes ?? true) && (React.createElement(Flex_1.Flex, { flexDirection: "column", className: "twa:mt-3" },
115
+ React.createElement(Flex_1.Box, { className: "twa:my-3" }, "Checkbox Location"),
116
+ React.createElement(Radio_2.RadioGroup, { orientation: "vertical", value: rowSelection.CheckboxInGroupColumn ?? false, name: "checkboxLocation", onRadioChange: (value) => updateRowSelection({ CheckboxInGroupColumn: value }) },
117
+ React.createElement(Radio_1.default, { value: false }, "Show selection checkbox in dedicated selection column"),
118
+ React.createElement(Radio_1.default, { value: true }, "Show selection checkbox in group column")))))),
119
+ React.createElement(Tabs_1.Tabs, { className: "twa:mt-2" },
120
+ React.createElement(Tabs_1.Tabs.Tab, null, "Row Click Selection"),
121
+ 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
+ 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 only"),
129
+ React.createElement(Radio_1.default, { value: 'enableDeselection' }, "Enable deselection only")))),
130
+ mode === 'multiRow' && (React.createElement(Tabs_1.Tabs, { className: "twa:mt-2" },
131
+ React.createElement(Tabs_1.Tabs.Tab, null, "Group & Bulk Selection"),
132
+ React.createElement(Tabs_1.Tabs.Content, null,
133
+ React.createElement(Flex_1.Flex, { flexDirection: "row", className: "twa:gap-6" },
134
+ React.createElement(Flex_1.Flex, { flexDirection: "row" },
135
+ React.createElement(Flex_1.Box, { className: "twa:self-center twa:mr-3" }, "Group Select"),
136
+ React.createElement(Radio_2.RadioGroup, { orientation: "vertical", value: rowSelection.GroupSelectMode ?? 'self', name: "groupSelectMode", onRadioChange: (value) => updateRowSelection({ GroupSelectMode: value }) },
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")))))))))));
146
+ };
147
+ exports.RowSelectionSection = RowSelectionSection;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NamedQuerySettingsWizardSection = exports.renderNamedQuerySettingsSummary = exports.isValidNamedQuerySettings = void 0;
4
4
  const tslib_1 = require("tslib");
5
- // TODO: move to named query
6
5
  const React = tslib_1.__importStar(require("react"));
7
6
  const WizardPanel_1 = tslib_1.__importDefault(require("../../../components/WizardPanel"));
8
7
  const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
@@ -456,6 +456,7 @@ class AdaptableAgGrid {
456
456
  columnDefs = src_1.LayoutManager.getColumnDefsChangesForLayout(layoutModel, columnDefs) ?? columnDefs;
457
457
  gridOptions.columnDefs = columnDefs;
458
458
  gridOptions.initialState = initialGridState;
459
+ const initialRowSelection = gridOptions.rowSelection;
459
460
  if (layoutModel) {
460
461
  if ((0, isPivotLayoutModel_1.isPivotLayoutModel)(layoutModel)) {
461
462
  gridOptions.pivotDefaultExpanded = layoutModel.PivotExpandLevel;
@@ -464,6 +465,14 @@ class AdaptableAgGrid {
464
465
  layoutModel.RowGroupDisplayType === 'multi' ? 'multipleColumns' : 'singleColumn';
465
466
  // fixes issue #3053
466
467
  gridOptions.suppressAggFuncInHeader = !!layoutModel.SuppressAggFuncInHeader;
468
+ if (!(0, isPivotLayoutModel_1.isPivotLayoutModel)(layoutModel) &&
469
+ src_1.LayoutManager.isSelectionColumnInNonFirstPosition(layoutModel.TableColumns)) {
470
+ gridOptions.selectionColumnDef = {
471
+ ...gridOptions.selectionColumnDef,
472
+ lockPosition: false,
473
+ };
474
+ }
475
+ gridOptions.rowSelection = src_1.LayoutManager.getGridOptionForRowSelectionFromLayout(layoutModel.RowSelection, gridOptions.rowSelection);
467
476
  }
468
477
  this.lifecycleState = 'initAgGrid';
469
478
  this.agGridAdapter.initialGridOptions = gridOptions;
@@ -479,6 +488,7 @@ class AdaptableAgGrid {
479
488
  this.layoutManager = new src_1.LayoutManager({
480
489
  gridApi: agGridApi,
481
490
  debugId: this.adaptableOptions.adaptableId,
491
+ initialRowSelection,
482
492
  });
483
493
  this.silentUpdateCurrentLayoutModel(layoutModel);
484
494
  // this shouldn't be needed
@@ -31,7 +31,7 @@ function Dashboard(props) {
31
31
  left: position.x,
32
32
  top: position.y,
33
33
  };
34
- const renderTabs = () => (React.createElement("div", { className: "ab-Dashboard__tabs" }, children &&
34
+ const renderTabs = () => (React.createElement("div", { className: "ab-Dashboard__tabs twa:whitespace-nowrap" }, children &&
35
35
  React.Children.map(children, (child, index) => (React.createElement("button", { type: "button", className: (0, join_1.default)('ab-Dashboard__tab', !collapsed && activeTabIndex === index ? 'ab-Dashboard__tab--active' : ''), key: index, onClick: () => {
36
36
  if (activeTabIndex === index) {
37
37
  setCollapsed(!collapsed);
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { BaseModuleTab, ModuleDraggableItem } from './types';
3
3
  export interface ModuleManagerProps {
4
4
  availableItems: ModuleDraggableItem[];
5
+ filterOutSelectedItems?: boolean;
5
6
  className?: string;
6
7
  disabled: boolean;
7
8
  onTabsChange: (tabs: BaseModuleTab[]) => void;
@@ -18,7 +18,6 @@ const ModuleManager = (props) => {
18
18
  editTabName: true,
19
19
  dragAndDropTab: true,
20
20
  deleteTab: true,
21
- // override default permitted actions
22
21
  ...permittedActions,
23
22
  };
24
23
  return {
@@ -26,34 +25,15 @@ const ModuleManager = (props) => {
26
25
  availableItems: props.availableItems,
27
26
  };
28
27
  }, [props.availableItems, props.permittedActions]);
29
- const unusedItems = React.useMemo(() => availableItems
30
- .map((t) => t.Id)
31
- .filter((item) => {
32
- return !tabs.some((tab) => tab.Items?.includes(item));
33
- }), [tabs, availableItems]);
34
- const handleToolbarDragEnd = (result) => {
35
- const { source, destination, draggableId } = result;
36
- if (!source || !destination) {
37
- return;
28
+ const allowedItems = React.useMemo(() => {
29
+ let result = availableItems.map((t) => t.Id);
30
+ if (props.filterOutSelectedItems) {
31
+ result = result.filter((item) => {
32
+ return !tabs.some((tab) => tab.Items?.includes(item));
33
+ });
38
34
  }
39
- if (source.droppableId !== 'UNUSED') {
40
- const sourceTabToolbars = tabs[Number(source.droppableId)].Items;
41
- sourceTabToolbars.splice(source.index, 1);
42
- }
43
- if (destination.droppableId !== 'UNUSED') {
44
- const destinationTabToolbars = tabs[Number(destination.droppableId)].Items;
45
- destinationTabToolbars.splice(destination.index, 0, draggableId);
46
- }
47
- onTabsChange([...tabs]);
48
- };
49
- const handleTabDragEnd = (result) => {
50
- const { source, destination } = result;
51
- if (!source || !destination)
52
- return;
53
- const [removed] = tabs.splice(source.index, 1);
54
- tabs.splice(destination.index, 0, removed);
55
- onTabsChange([...tabs]);
56
- };
35
+ return result;
36
+ }, [tabs, availableItems]);
57
37
  const handleRemoveTab = (tabIndex) => {
58
38
  onTabsChange(tabs.filter((_, index) => index !== tabIndex));
59
39
  };
@@ -80,18 +60,13 @@ const ModuleManager = (props) => {
80
60
  };
81
61
  }));
82
62
  };
83
- return (React.createElement(dnd_1.DragDropContext, { onDragEnd: (result) => {
84
- if (result.type === 'TAB')
85
- handleTabDragEnd(result);
86
- if (result.type === 'TOOLBAR')
87
- handleToolbarDragEnd(result);
88
- } },
63
+ return (React.createElement(dnd_1.DragDropProvider, null,
89
64
  React.createElement(DragAndDropContext_1.DragAndDropContext.Provider, { value: contextValue },
90
65
  React.createElement(Flex_1.Flex, { flexDirection: "column", className: (0, clsx_1.default)('ab-ModuleSelector twa:flex-1', className) },
91
- React.createElement(UnusedPanel_1.UnusedPanel, { title: unusedPanelTitle, disabled: disabled, items: unusedItems, dragItemText: dragItemText }),
66
+ React.createElement(UnusedPanel_1.UnusedPanel, { title: unusedPanelTitle, disabled: disabled, items: allowedItems, dragItemText: dragItemText }),
92
67
  React.createElement(Card_1.Card, { className: "twa:flex-1 twa:m-2 ab-ModuleSelector-UsedPanel" },
93
68
  React.createElement(Card_1.Card.Title, { border: false }, tabsTitle),
94
69
  React.createElement(Card_1.Card.Body, { className: "twa:px-2" },
95
- React.createElement(TabList_1.TabList, { disabled: disabled, tabs: tabs, onRemoveTab: handleRemoveTab, onRemoveToolbar: handleRemoveToolbar, onChangeTabName: handleChangeTabName, onNewTab: contextValue.permittedActions.createTab ? handleTabAdd : undefined })))))));
70
+ React.createElement(TabList_1.TabList, { disabled: disabled, tabs: tabs, onTabsChange: onTabsChange, onRemoveTab: handleRemoveTab, onRemoveToolbar: handleRemoveToolbar, onChangeTabName: handleChangeTabName, onNewTab: contextValue.permittedActions.createTab ? handleTabAdd : undefined })))))));
96
71
  };
97
72
  exports.ModuleManager = ModuleManager;
@@ -1,30 +1,35 @@
1
1
  import * as React from 'react';
2
2
  import { BaseModuleTab } from './types';
3
- export declare function TabList({ tabs, onRemoveTab, onRemoveToolbar, onChangeTabName, disabled, onNewTab, }: {
3
+ export declare function TabList({ tabs, onTabsChange, onRemoveTab, onRemoveToolbar, onChangeTabName, disabled, onNewTab, }: {
4
4
  disabled: boolean;
5
5
  tabs: BaseModuleTab[];
6
+ onTabsChange: (tabs: BaseModuleTab[]) => void;
6
7
  onRemoveTab: (tabIndex: number) => void;
7
8
  onRemoveToolbar: (tabIndex: number, toolbarIndex: number) => void;
8
9
  onChangeTabName: (tabIndex: number, tabName: string) => void;
9
10
  onNewTab?: () => void;
10
11
  }): React.JSX.Element;
11
- export declare function TabItem({ tab, tabIndex, onRemove, onRemoveToolbar, onChangeTabName, disabled, }: {
12
+ export declare function TabItem({ tab, tabId, tabIndex, tabs, onTabsChange, onRemove, onRemoveToolbar, onChangeTabName, disabled, }: {
12
13
  tab: BaseModuleTab;
14
+ tabId: string;
13
15
  tabIndex: number;
16
+ tabs: BaseModuleTab[];
17
+ onTabsChange: (tabs: BaseModuleTab[]) => void;
14
18
  disabled: boolean;
15
19
  onRemove: () => void;
16
20
  onRemoveToolbar: (toolbarIndex: number) => void;
17
21
  onChangeTabName: (tabName: string) => void;
18
22
  }): React.JSX.Element;
19
- export declare function ToolbarList({ toolbars, droppableId, onRemove, disabled, }: {
23
+ export declare function ToolbarList({ toolbars, tabIndex, tabs, onTabsChange, onRemove, disabled, }: {
20
24
  toolbars: string[];
21
- droppableId: string;
25
+ tabIndex: number;
26
+ tabs: BaseModuleTab[];
27
+ onTabsChange: (tabs: BaseModuleTab[]) => void;
22
28
  disabled: boolean;
23
29
  onRemove: (toolbarIndex: number) => void;
24
30
  }): React.JSX.Element;
25
- export declare function ToolbarItem({ toolbar, toolbarIndex, onRemove, disabled, }: {
31
+ export declare function ToolbarItem({ toolbar, onRemove, disabled, }: {
26
32
  disabled: boolean;
27
33
  toolbar: string;
28
- toolbarIndex: number;
29
34
  onRemove: () => void;
30
35
  }): React.JSX.Element;