@adaptabletools/adaptable-cjs 20.2.1 → 20.2.2

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 (32) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableState/Common/AdaptableColumn.d.ts +4 -0
  3. package/src/AdaptableState/LayoutState.d.ts +16 -2
  4. package/src/AdaptableState/QuickSearchState.d.ts +5 -5
  5. package/src/Api/Implementation/ColumnApiImpl.js +1 -0
  6. package/src/Api/Implementation/LayoutHelpers.d.ts +3 -0
  7. package/src/Api/Implementation/LayoutHelpers.js +80 -41
  8. package/src/Api/Implementation/QuickSearchApiImpl.d.ts +2 -2
  9. package/src/Api/Implementation/QuickSearchApiImpl.js +4 -4
  10. package/src/Api/Internal/FormatColumnInternalApi.d.ts +1 -1
  11. package/src/Api/Internal/FormatColumnInternalApi.js +4 -4
  12. package/src/Api/QuickSearchApi.d.ts +2 -2
  13. package/src/Redux/ActionsReducers/QuickSearchRedux.d.ts +4 -4
  14. package/src/Redux/ActionsReducers/QuickSearchRedux.js +9 -9
  15. package/src/Redux/Store/AdaptableStore.js +1 -1
  16. package/src/View/Components/StyleComponent.d.ts +1 -0
  17. package/src/View/Components/StyleComponent.js +2 -1
  18. package/src/View/Layout/Wizard/sections/ColumnsSection.js +27 -8
  19. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +2 -2
  20. package/src/View/QuickSearch/QuickSearchPopup.d.ts +1 -1
  21. package/src/View/QuickSearch/QuickSearchPopup.js +7 -4
  22. package/src/agGrid/AdaptableAgGrid.js +19 -8
  23. package/src/agGrid/AgGridAdapter.js +6 -1
  24. package/src/agGrid/AgGridColumnAdapter.js +10 -8
  25. package/src/env.js +2 -2
  26. package/src/layout-manager/src/LayoutManagerModel.d.ts +17 -4
  27. package/src/layout-manager/src/index.d.ts +1 -1
  28. package/src/layout-manager/src/index.js +61 -18
  29. package/src/metamodel/adaptable.metamodel.d.ts +10 -0
  30. package/src/metamodel/adaptable.metamodel.js +1 -1
  31. package/src/types.d.ts +1 -1
  32. package/tsconfig.cjs.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-cjs",
3
- "version": "20.2.1",
3
+ "version": "20.2.2",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -155,6 +155,10 @@ export interface AdaptableColumn<TData = any> extends AdaptableColumnBase {
155
155
  * Is Column a generated Row Group Column
156
156
  */
157
157
  isGeneratedRowGroupColumn: boolean;
158
+ /**
159
+ * Is Column a generated Selection Column
160
+ */
161
+ isGeneratedSelectionColumn: boolean;
158
162
  /**
159
163
  * Is Column a generated Pivot Result Column
160
164
  */
@@ -5,6 +5,7 @@ import { ColumnFilter, GridFilter } from '../types';
5
5
  import { TableAggregationColumns, PivotAggregationColumns } from './Common/AggregationColumns';
6
6
  import { RowSummary } from './Common/RowSummary';
7
7
  import { NonEmptyArray } from '../Utilities/Extensions/ArrayExtensions';
8
+ import { XOR } from '../Utilities/Extensions/TypeExtensions';
8
9
  /**
9
10
  * Base Layout Type - Pivot or Table
10
11
  */
@@ -188,11 +189,24 @@ export type RowGroupValuesWithExceptionKeys = {
188
189
  * Default behaviour for Row Groups: 'expanded' or 'collapsed';
189
190
  */
190
191
  RowGroupDefaultBehavior: 'expanded' | 'collapsed';
192
+ } & XOR<{
191
193
  /**
192
- * Keys of Row Groups which are exceptions to default RowGroupDefaultBehavior - these are actual values in Row Grouped Column
194
+ * @deprecated - use GroupKeys instead. Layout.RowGroupValues.GroupKeys[] array allows you
195
+ * to configure the row group expand / collapse behaviour for each combination of row grouped columns.
193
196
  */
194
197
  ExceptionGroupKeys?: any[][];
195
- };
198
+ }, {
199
+ /**
200
+ * Allows you to configure the row group expand / collapse behaviour for each combination of row grouped columns.
201
+ * The default value is configured via RowGroupDefaultBehavior, but exceptions are configured by the GroupKeys array.
202
+ * Each item in the GroupKeys array is a an object with `RowGroupedColumns` and `ExceptionGroupKeys`. Those properties
203
+ * configure the collapse/expand exceptions for the specific row group columns.
204
+ */
205
+ GroupKeys?: {
206
+ RowGroupedColumns: string[];
207
+ ExceptionGroupKeys?: any[][];
208
+ }[];
209
+ }>;
196
210
  /**
197
211
  * Manages Column Group expand / collapse behaviour, including exceptions
198
212
  */
@@ -5,19 +5,19 @@ import { BaseState } from './BaseState';
5
5
  */
6
6
  export interface QuickSearchState extends BaseState {
7
7
  /**
8
- * Last Quick Search that was run (and will run again at start up)
8
+ * Last Quick Search that was run (and will be applied at start-up)
9
9
  */
10
10
  QuickSearchText?: string;
11
11
  /**
12
- * Style to use to highlight matching cells
12
+ * Style used to highlight matching cells
13
13
  */
14
- Style?: AdaptableStyle;
14
+ CellMatchStyle?: Omit<AdaptableStyle, 'ClassName'>;
15
15
  /**
16
- * Style to use to highlight matching text within a cell
16
+ * Style used to highlight matching text within a cell (not availale in SSRM)
17
17
  */
18
18
  TextMatchStyle?: Omit<AdaptableStyle, 'ClassName'>;
19
19
  /**
20
- * Style to use to highlight matching text within current match
20
+ * Style used to highlight matching text within current match (not availale in SSRM)
21
21
  */
22
22
  CurrentTextMatchStyle?: Omit<AdaptableStyle, 'ClassName'>;
23
23
  }
@@ -31,6 +31,7 @@ const ROW_GROUP_COLUMN_DEFAULTS = {
31
31
  isGrouped: true,
32
32
  isGeneratedRowGroupColumn: true,
33
33
  isGeneratedPivotResultColumn: false,
34
+ isGeneratedSelectionColumn: false,
34
35
  isFixed: false,
35
36
  pinned: null,
36
37
  isSparkline: false,
@@ -15,6 +15,9 @@ export declare const normalizeTableLayout: (tableLayout: TableLayout, options?:
15
15
  isTree: boolean;
16
16
  }) => TableLayout;
17
17
  export declare const normalizePivotLayout: (pivotLayout: PivotLayout) => PivotLayout;
18
+ export declare const getLayoutRowGroupValuesExceptionGroupKeys: (layout: TableLayout | PivotLayout) => any[][];
19
+ export declare const toRowGroupValuesForLayoutState: (rowGroupValuesModel: TableLayoutModel['RowGroupValues']) => TableLayout['RowGroupValues'];
20
+ export declare const toRowGroupValuesForLayoutModel: (rowGroupValuesState: TableLayout['RowGroupValues']) => TableLayoutModel['RowGroupValues'];
18
21
  export declare const checkForDuplicateColumns: (layout: TableLayout) => void;
19
22
  export declare const tableLayoutToTableLayoutModel: (tableLayout: TableLayout) => TableLayoutModel;
20
23
  export declare const pivotLayoutToPivotLayoutModel: (pivotLayout: PivotLayout) => PivotLayoutModel;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPivotLayout = exports.pivotLayoutModelToPivotLayout = exports.tableLayoutModelToTableLayout = exports.pivotLayoutToPivotLayoutModel = exports.tableLayoutToTableLayoutModel = exports.checkForDuplicateColumns = exports.normalizePivotLayout = exports.normalizeTableLayout = exports.normalizeLayout = exports.areLayoutsEqual = exports.layoutModelToLayoutState = exports.layoutStateToLayoutModel = void 0;
3
+ exports.isPivotLayout = exports.pivotLayoutModelToPivotLayout = exports.tableLayoutModelToTableLayout = exports.pivotLayoutToPivotLayoutModel = exports.tableLayoutToTableLayoutModel = exports.checkForDuplicateColumns = exports.toRowGroupValuesForLayoutModel = exports.toRowGroupValuesForLayoutState = exports.getLayoutRowGroupValuesExceptionGroupKeys = exports.normalizePivotLayout = exports.normalizeTableLayout = exports.normalizeLayout = exports.areLayoutsEqual = exports.layoutModelToLayoutState = exports.layoutStateToLayoutModel = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
6
6
  const isPivotLayoutModel_1 = require("../../layout-manager/src/isPivotLayoutModel");
@@ -74,6 +74,81 @@ const errorOnce = (message) => {
74
74
  console.error(message);
75
75
  errorOnceMessages.set(message, true);
76
76
  };
77
+ const getLayoutRowGroupValuesExceptionGroupKeys = (layout) => {
78
+ if (!layout.RowGroupValues) {
79
+ return [];
80
+ }
81
+ if (layout.RowGroupValues?.RowGroupDefaultBehavior === 'always-collapsed') {
82
+ return [];
83
+ }
84
+ if (layout.RowGroupValues?.RowGroupDefaultBehavior === 'always-expanded') {
85
+ return [];
86
+ }
87
+ if (Array.isArray(layout.RowGroupValues?.GroupKeys)) {
88
+ const currentGroupedColumns = (layout.RowGroupedColumns || []).join(',');
89
+ const matchingGroupKeys = layout.RowGroupValues.GroupKeys.find(({ RowGroupedColumns }) => {
90
+ return RowGroupedColumns.join(',') === currentGroupedColumns;
91
+ });
92
+ if (matchingGroupKeys) {
93
+ return matchingGroupKeys.ExceptionGroupKeys;
94
+ }
95
+ }
96
+ return layout.RowGroupValues.ExceptionGroupKeys || [];
97
+ };
98
+ exports.getLayoutRowGroupValuesExceptionGroupKeys = getLayoutRowGroupValuesExceptionGroupKeys;
99
+ const toRowGroupValuesForLayoutState = (rowGroupValuesModel) => {
100
+ if (!rowGroupValuesModel) {
101
+ return undefined;
102
+ }
103
+ const rowGroupValuesState = {
104
+ RowGroupDefaultBehavior: rowGroupValuesModel.RowGroupDisplay,
105
+ };
106
+ if (rowGroupValuesModel.RowGroupDisplay === 'collapsed' ||
107
+ rowGroupValuesModel.RowGroupDisplay === 'expanded') {
108
+ if (rowGroupValuesModel.GroupKeys) {
109
+ rowGroupValuesState.GroupKeys =
110
+ rowGroupValuesModel.GroupKeys.map(({ RowGroupedColumns, Values }) => {
111
+ return {
112
+ RowGroupedColumns,
113
+ ExceptionGroupKeys: Values,
114
+ };
115
+ });
116
+ }
117
+ else {
118
+ rowGroupValuesState.ExceptionGroupKeys =
119
+ rowGroupValuesModel.Values;
120
+ }
121
+ }
122
+ return rowGroupValuesState;
123
+ };
124
+ exports.toRowGroupValuesForLayoutState = toRowGroupValuesForLayoutState;
125
+ const toRowGroupValuesForLayoutModel = (rowGroupValuesState) => {
126
+ if (!rowGroupValuesState) {
127
+ return undefined;
128
+ }
129
+ if (rowGroupValuesState.RowGroupDefaultBehavior === 'always-collapsed' ||
130
+ rowGroupValuesState.RowGroupDefaultBehavior === 'always-expanded') {
131
+ return {
132
+ RowGroupDisplay: rowGroupValuesState.RowGroupDefaultBehavior,
133
+ };
134
+ }
135
+ if (rowGroupValuesState.GroupKeys) {
136
+ return {
137
+ RowGroupDisplay: rowGroupValuesState.RowGroupDefaultBehavior,
138
+ GroupKeys: rowGroupValuesState.GroupKeys.map(({ RowGroupedColumns, ExceptionGroupKeys }) => {
139
+ return {
140
+ RowGroupedColumns,
141
+ Values: ExceptionGroupKeys,
142
+ };
143
+ }),
144
+ };
145
+ }
146
+ return {
147
+ RowGroupDisplay: rowGroupValuesState.RowGroupDefaultBehavior,
148
+ Values: rowGroupValuesState.ExceptionGroupKeys || [],
149
+ };
150
+ };
151
+ exports.toRowGroupValuesForLayoutModel = toRowGroupValuesForLayoutModel;
77
152
  const checkForDuplicateColumns = (layout) => {
78
153
  if (layout.TableColumns) {
79
154
  const set = new Set(layout.TableColumns);
@@ -108,17 +183,7 @@ const tableLayoutToTableLayoutModel = (tableLayout) => {
108
183
  ColumnSorts: tableLayout.ColumnSorts,
109
184
  RowGroupedColumns: tableLayout.RowGroupedColumns,
110
185
  ColumnPinning: tableLayout.ColumnPinning,
111
- RowGroupValues: tableLayout.RowGroupValues
112
- ? tableLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-collapsed' ||
113
- tableLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-expanded'
114
- ? {
115
- RowGroupDisplay: tableLayout.RowGroupValues.RowGroupDefaultBehavior,
116
- }
117
- : {
118
- RowGroupDisplay: tableLayout.RowGroupValues.RowGroupDefaultBehavior,
119
- Values: tableLayout.RowGroupValues.ExceptionGroupKeys || [],
120
- }
121
- : undefined,
186
+ RowGroupValues: (0, exports.toRowGroupValuesForLayoutModel)(tableLayout.RowGroupValues),
122
187
  ColumnGroupValues: tableLayout.ColumnGroupValues
123
188
  ? tableLayout.ColumnGroupValues.ColumnGroupDefaultBehavior === 'always-expanded' ||
124
189
  tableLayout.ColumnGroupValues.ColumnGroupDefaultBehavior === 'always-collapsed'
@@ -192,17 +257,7 @@ const pivotLayoutToPivotLayoutModel = (pivotLayout) => {
192
257
  GrandTotalRow: pivotLayout.GrandTotalRow,
193
258
  PivotGrandTotal: pivotLayout.PivotGrandTotal,
194
259
  PivotColumnTotal: pivotLayout.PivotColumnTotal,
195
- RowGroupValues: pivotLayout.RowGroupValues
196
- ? pivotLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-collapsed' ||
197
- pivotLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-expanded'
198
- ? {
199
- RowGroupDisplay: pivotLayout.RowGroupValues.RowGroupDefaultBehavior,
200
- }
201
- : {
202
- RowGroupDisplay: pivotLayout.RowGroupValues.RowGroupDefaultBehavior,
203
- Values: pivotLayout.RowGroupValues.ExceptionGroupKeys || [],
204
- }
205
- : undefined,
260
+ RowGroupValues: (0, exports.toRowGroupValuesForLayoutModel)(pivotLayout.RowGroupValues),
206
261
  ColumnGroupValues: pivotLayout.ColumnGroupValues
207
262
  ? pivotLayout.ColumnGroupValues.ColumnGroupDefaultBehavior === 'always-expanded' ||
208
263
  pivotLayout.ColumnGroupValues.ColumnGroupDefaultBehavior === 'always-collapsed'
@@ -308,15 +363,7 @@ const tableLayoutModelToTableLayout = (layoutModel) => {
308
363
  delete tableLayout.ColumnPinning;
309
364
  }
310
365
  if (layoutModel.RowGroupValues) {
311
- tableLayout.RowGroupValues = {
312
- RowGroupDefaultBehavior: layoutModel.RowGroupValues.RowGroupDisplay,
313
- };
314
- if ((layoutModel.RowGroupValues.RowGroupDisplay === 'collapsed' ||
315
- layoutModel.RowGroupValues.RowGroupDisplay === 'expanded') &&
316
- layoutModel.RowGroupValues.Values) {
317
- // @ts-ignore
318
- tableLayout.RowGroupValues.ExceptionGroupKeys = layoutModel.RowGroupValues.Values;
319
- }
366
+ tableLayout.RowGroupValues = (0, exports.toRowGroupValuesForLayoutState)(layoutModel.RowGroupValues);
320
367
  }
321
368
  else {
322
369
  delete tableLayout.RowGroupValues;
@@ -411,15 +458,7 @@ const pivotLayoutModelToPivotLayout = (layoutModel) => {
411
458
  delete pivotLayout.PivotGroupedColumns;
412
459
  }
413
460
  if (layoutModel.RowGroupValues) {
414
- pivotLayout.RowGroupValues = {
415
- RowGroupDefaultBehavior: layoutModel.RowGroupValues.RowGroupDisplay,
416
- };
417
- if ((layoutModel.RowGroupValues.RowGroupDisplay === 'collapsed' ||
418
- layoutModel.RowGroupValues.RowGroupDisplay === 'expanded') &&
419
- layoutModel.RowGroupValues.Values) {
420
- // @ts-ignore
421
- pivotLayout.RowGroupValues.ExceptionGroupKeys = layoutModel.RowGroupValues.Values;
422
- }
461
+ pivotLayout.RowGroupValues = (0, exports.toRowGroupValuesForLayoutState)(layoutModel.RowGroupValues);
423
462
  }
424
463
  else {
425
464
  delete pivotLayout.RowGroupValues;
@@ -9,10 +9,10 @@ export declare class QuickSearchApiImpl extends ApiBase implements QuickSearchAp
9
9
  gotoNextMatch(): void;
10
10
  gotoPreviousMatch(): void;
11
11
  getQuickSearchValue(): string;
12
- getQuickSearchStyle(): AdaptableStyle;
12
+ getQuickSearchCellMatchStyle(): AdaptableStyle;
13
13
  getQuickSearchTextMatchStyle(): AdaptableStyle | undefined;
14
14
  getQuickSearchCurrentTextMatchStyle(): AdaptableStyle | undefined;
15
- setQuickSearchStyle(style: AdaptableStyle): void;
15
+ setQuickSearchCellMatchStyle(style: AdaptableStyle): void;
16
16
  openQuickSearchSettingsPanel(): void;
17
17
  showFloatingQuickSearch(): void;
18
18
  hideFloatingQuickSearch(): void;
@@ -25,8 +25,8 @@ class QuickSearchApiImpl extends ApiBase_1.ApiBase {
25
25
  getQuickSearchValue() {
26
26
  return this.getQuickSearchState().QuickSearchText;
27
27
  }
28
- getQuickSearchStyle() {
29
- return this.getQuickSearchState().Style;
28
+ getQuickSearchCellMatchStyle() {
29
+ return this.getQuickSearchState().CellMatchStyle;
30
30
  }
31
31
  getQuickSearchTextMatchStyle() {
32
32
  return this.getQuickSearchState().TextMatchStyle;
@@ -34,8 +34,8 @@ class QuickSearchApiImpl extends ApiBase_1.ApiBase {
34
34
  getQuickSearchCurrentTextMatchStyle() {
35
35
  return this.getQuickSearchState().CurrentTextMatchStyle;
36
36
  }
37
- setQuickSearchStyle(style) {
38
- this.dispatchAction(QuickSearchRedux.QuickSearchSetStyle(style));
37
+ setQuickSearchCellMatchStyle(style) {
38
+ this.dispatchAction(QuickSearchRedux.QuickSearchSetCellMatchingStyle(style));
39
39
  }
40
40
  openQuickSearchSettingsPanel() {
41
41
  this.showModulePopup(ModuleConstants.QuickSearchModuleId);
@@ -77,7 +77,7 @@ export declare class FormatColumnInternalApi extends ApiBase {
77
77
  * @param scope Scope to check
78
78
  */
79
79
  getFormatColumnDefsForScope(scope: ColumnScope): AdaptablePredicateDef[];
80
- formatColumnWithColumnGroupStateShouldRender(formatColumn: FormatColumn, column: AdaptableColumn): boolean;
80
+ formatColumnWithColumnGroupScopeShouldRender(formatColumn: FormatColumn, column: AdaptableColumn): boolean;
81
81
  /**
82
82
  * Checks if format column is relevant for a given cell (intersection of given AdaptableColumn and RowNode)
83
83
  *
@@ -176,7 +176,7 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
176
176
  .predicateApi.internalApi.getFormatColumnPredicateDefs(scope)
177
177
  .filter((predicateDef) => this.getColumnScopeApi().isScopeInScope(scope, predicateDef.columnScope));
178
178
  }
179
- formatColumnWithColumnGroupStateShouldRender(formatColumn, column) {
179
+ formatColumnWithColumnGroupScopeShouldRender(formatColumn, column) {
180
180
  if (!formatColumn.ColumnGroupScope) {
181
181
  return true;
182
182
  }
@@ -191,7 +191,7 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
191
191
  if (!columnGroupParentForCurrentColumn) {
192
192
  return false;
193
193
  }
194
- const columnGroupState = columnGroupParentForCurrentColumn.isExpanded()
194
+ const columnGroupScope = columnGroupParentForCurrentColumn.isExpanded()
195
195
  ? 'Expanded'
196
196
  : 'Collapsed';
197
197
  const columnGroupLeafColumns = columnGroupParentForCurrentColumn.getLeafColumns();
@@ -205,7 +205,7 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
205
205
  if (formatColumn.ColumnGroupScope === 'Both') {
206
206
  return true;
207
207
  }
208
- return formatColumn.ColumnGroupScope === columnGroupState;
208
+ return formatColumn.ColumnGroupScope === columnGroupScope;
209
209
  }
210
210
  /**
211
211
  * Checks if format column is relevant for a given cell (intersection of given AdaptableColumn and RowNode)
@@ -238,7 +238,7 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
238
238
  }
239
239
  }
240
240
  if (formatColumn.ColumnGroupScope &&
241
- !this.formatColumnWithColumnGroupStateShouldRender(formatColumn, column)) {
241
+ !this.formatColumnWithColumnGroupScopeShouldRender(formatColumn, column)) {
242
242
  return false;
243
243
  }
244
244
  if (!formatColumn.Rule) {
@@ -32,7 +32,7 @@ export interface QuickSearchApi {
32
32
  /**
33
33
  * Retrieves current Quick Search style
34
34
  */
35
- getQuickSearchStyle(): AdaptableStyle;
35
+ getQuickSearchCellMatchStyle(): AdaptableStyle;
36
36
  /**
37
37
  * Retrieves the style for the text match in the Quick Search
38
38
  */
@@ -45,7 +45,7 @@ export interface QuickSearchApi {
45
45
  * Sets style for Quick Search; can be name of (a provided) css style
46
46
  * @param style the style to use
47
47
  */
48
- setQuickSearchStyle(style: AdaptableStyle): void;
48
+ setQuickSearchCellMatchStyle(style: AdaptableStyle): void;
49
49
  /**
50
50
  * Opens Settings Panel with Quick Search section selected and visible
51
51
  */
@@ -8,7 +8,7 @@ export declare const QUICK_SEARCH_RUN = "QUICK_SEARCH_RUN";
8
8
  /**
9
9
  * @ReduxAction Sets Quick Search style
10
10
  */
11
- export declare const QUICK_SEARCH_SET_STYLE = "QUICK_SEARCH_SET_STYLE";
11
+ export declare const QUICK_SEARCH_SET_CELL_MATCHING_STYLE = "QUICK_SEARCH_SET_CELL_MATCHING_STYLE";
12
12
  /**
13
13
  * @ReduxAction Quick Search Module is ready
14
14
  */
@@ -16,13 +16,13 @@ export declare const QUICK_SEARCH_READY = "QUICK_SEARCH_READY";
16
16
  export interface QuickSearchRunAction extends Redux.Action {
17
17
  quickSearchText: string;
18
18
  }
19
- export interface QuickSearchSetStyleAction extends Redux.Action {
20
- style: AdaptableStyle;
19
+ export interface QuickSearchSetMatchingCellStyleAction extends Redux.Action {
20
+ matchingCellStyle: AdaptableStyle;
21
21
  }
22
22
  export interface QuickSearchReadyAction extends Redux.Action {
23
23
  quickSearchState: QuickSearchState;
24
24
  }
25
25
  export declare const QuickSearchRun: (quickSearchText: string) => QuickSearchRunAction;
26
- export declare const QuickSearchSetStyle: (style: AdaptableStyle) => QuickSearchSetStyleAction;
26
+ export declare const QuickSearchSetCellMatchingStyle: (matchingCellStyle: AdaptableStyle) => QuickSearchSetMatchingCellStyleAction;
27
27
  export declare const QuickSearchReady: (quickSearchState: QuickSearchState) => QuickSearchReadyAction;
28
28
  export declare const QuickSearchReducer: Redux.Reducer<QuickSearchState>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuickSearchReducer = exports.QuickSearchReady = exports.QuickSearchSetStyle = exports.QuickSearchRun = exports.QUICK_SEARCH_READY = exports.QUICK_SEARCH_SET_STYLE = exports.QUICK_SEARCH_RUN = void 0;
3
+ exports.QuickSearchReducer = exports.QuickSearchReady = exports.QuickSearchSetCellMatchingStyle = exports.QuickSearchRun = exports.QUICK_SEARCH_READY = exports.QUICK_SEARCH_SET_CELL_MATCHING_STYLE = exports.QUICK_SEARCH_RUN = void 0;
4
4
  const ReduxConstants_1 = require("../../Utilities/Constants/ReduxConstants");
5
5
  const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
6
6
  /**
@@ -10,7 +10,7 @@ exports.QUICK_SEARCH_RUN = 'QUICK_SEARCH_RUN';
10
10
  /**
11
11
  * @ReduxAction Sets Quick Search style
12
12
  */
13
- exports.QUICK_SEARCH_SET_STYLE = 'QUICK_SEARCH_SET_STYLE';
13
+ exports.QUICK_SEARCH_SET_CELL_MATCHING_STYLE = 'QUICK_SEARCH_SET_CELL_MATCHING_STYLE';
14
14
  /**
15
15
  * @ReduxAction Quick Search Module is ready
16
16
  */
@@ -20,11 +20,11 @@ const QuickSearchRun = (quickSearchText) => ({
20
20
  quickSearchText,
21
21
  });
22
22
  exports.QuickSearchRun = QuickSearchRun;
23
- const QuickSearchSetStyle = (style) => ({
24
- type: exports.QUICK_SEARCH_SET_STYLE,
25
- style,
23
+ const QuickSearchSetCellMatchingStyle = (matchingCellStyle) => ({
24
+ type: exports.QUICK_SEARCH_SET_CELL_MATCHING_STYLE,
25
+ matchingCellStyle: matchingCellStyle,
26
26
  });
27
- exports.QuickSearchSetStyle = QuickSearchSetStyle;
27
+ exports.QuickSearchSetCellMatchingStyle = QuickSearchSetCellMatchingStyle;
28
28
  const QuickSearchReady = (quickSearchState) => ({
29
29
  type: exports.QUICK_SEARCH_READY,
30
30
  quickSearchState,
@@ -32,7 +32,7 @@ const QuickSearchReady = (quickSearchState) => ({
32
32
  exports.QuickSearchReady = QuickSearchReady;
33
33
  const initialState = {
34
34
  QuickSearchText: GeneralConstants_1.EMPTY_STRING,
35
- Style: {
35
+ CellMatchStyle: {
36
36
  BackColor: ReduxConstants_1.QUICK_SEARCH_DEFAULT_BACK_COLOR,
37
37
  ForeColor: ReduxConstants_1.QUICK_SEARCH_DEFAULT_FORE_COLOR,
38
38
  },
@@ -43,9 +43,9 @@ const QuickSearchReducer = (state = initialState, action) => {
43
43
  return Object.assign({}, state, {
44
44
  QuickSearchText: action.quickSearchText,
45
45
  });
46
- case exports.QUICK_SEARCH_SET_STYLE:
46
+ case exports.QUICK_SEARCH_SET_CELL_MATCHING_STYLE:
47
47
  return Object.assign({}, state, {
48
- Style: action.style,
48
+ CellMatchStyle: action.matchingCellStyle,
49
49
  });
50
50
  default:
51
51
  return state;
@@ -473,7 +473,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
473
473
  * Use Case: We have updated an AdapTable Module that affects rendering
474
474
  * Action: We set up all columns again
475
475
  */
476
- case QuickSearchRedux.QUICK_SEARCH_SET_STYLE:
476
+ case QuickSearchRedux.QUICK_SEARCH_SET_CELL_MATCHING_STYLE:
477
477
  case FormatColumnRedux.FORMAT_COLUMN_ADD:
478
478
  case FormatColumnRedux.FORMAT_COLUMN_EDIT:
479
479
  case FormatColumnRedux.FORMAT_COLUMN_DELETE:
@@ -8,6 +8,7 @@ export interface StyleComponentProps extends React.ClassAttributes<StyleComponen
8
8
  api: AdaptableApi;
9
9
  headless?: boolean;
10
10
  hidePreview?: boolean;
11
+ headerText?: string;
11
12
  Style: AdaptableStyle;
12
13
  showFontSizeAs?: 'radio' | 'dropdown';
13
14
  UpdateStyle: (style: AdaptableStyle) => void;
@@ -48,10 +48,11 @@ class StyleComponent extends React.Component {
48
48
  }
49
49
  render() {
50
50
  const Cmp = this.props.headless ? rebass_1.Box : Panel_1.default;
51
+ const headerText = this.props.headerText ?? 'Style';
51
52
  const cmpProps = this.props.headless
52
53
  ? {}
53
54
  : {
54
- header: 'Style',
55
+ header: headerText,
55
56
  margin: 2,
56
57
  'data-name': 'style-component',
57
58
  };
@@ -26,6 +26,7 @@ const ReorderDraggable_1 = require("../../../Components/ReorderDraggable");
26
26
  const AdaptableFormControlTextClear_1 = require("../../../Components/Forms/AdaptableFormControlTextClear");
27
27
  const sortColumnIdsByOrder_1 = require("../../../../layout-manager/src/sortColumnIdsByOrder");
28
28
  const HelpBlock_1 = tslib_1.__importDefault(require("../../../../components/HelpBlock"));
29
+ const GeneralConstants_1 = require("../../../../Utilities/Constants/GeneralConstants");
29
30
  const PropertyOrderText = (props) => (React.createElement(rebass_1.Text, { fontWeight: 600, fontSize: 2 }, props.children));
30
31
  const columnTypes = {
31
32
  default: {
@@ -200,6 +201,7 @@ const ColumnsSection = (props) => {
200
201
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
201
202
  const { data: layout } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
202
203
  const [searchInputValue, setSearchInputValue] = React.useState('');
204
+ let hasSelectionColumn = false;
203
205
  const allColumns = adaptable.api.columnApi
204
206
  .getUIAvailableColumns()
205
207
  .filter((col) => {
@@ -209,7 +211,23 @@ const ColumnsSection = (props) => {
209
211
  return !col.isGeneratedRowGroupColumn;
210
212
  })
211
213
  // if the current Layout is a PivotLayout, then we also filter out current Pivot Result Columns
212
- .filter((col) => !col.isGeneratedPivotResultColumn);
214
+ .filter((col) => !col.isGeneratedPivotResultColumn)
215
+ // also we need to filter out selection column
216
+ .filter((col) => {
217
+ const result = !col.isGeneratedSelectionColumn;
218
+ if (!result) {
219
+ hasSelectionColumn = true;
220
+ }
221
+ return result;
222
+ });
223
+ const onChange = (data) => {
224
+ if (hasSelectionColumn &&
225
+ Array.isArray(data.TableColumns) &&
226
+ !data.TableColumns.includes(GeneralConstants_1.AG_GRID_SELECTION_COLUMN)) {
227
+ data.TableColumns.unshift(GeneralConstants_1.AG_GRID_SELECTION_COLUMN);
228
+ }
229
+ props.onChange(data);
230
+ };
213
231
  // however, changes in RowGroupedColumns done in the previous step
214
232
  // are reflected into the layout, so we use the latest layout.RowGroupedColumns
215
233
  // to create new columns
@@ -266,7 +284,7 @@ const ColumnsSection = (props) => {
266
284
  ColumnVisibility[colId] = false;
267
285
  }
268
286
  });
269
- props.onChange({
287
+ onChange({
270
288
  ...layout,
271
289
  TableColumns: columnIds,
272
290
  ColumnVisibility,
@@ -305,14 +323,14 @@ const ColumnsSection = (props) => {
305
323
  return shouldInclude;
306
324
  });
307
325
  }
308
- props.onChange({
326
+ onChange({
309
327
  ...layout,
310
328
  TableColumns: TableColumns,
311
329
  ColumnVisibility,
312
330
  });
313
331
  };
314
332
  const handlePinChange = (columnId, pinning) => {
315
- props.onChange({
333
+ onChange({
316
334
  ...layout,
317
335
  ColumnPinning: {
318
336
  ...layout.ColumnPinning,
@@ -321,7 +339,7 @@ const ColumnsSection = (props) => {
321
339
  });
322
340
  };
323
341
  const handleColumnNameChange = (columnId, headerName) => {
324
- props.onChange({
342
+ onChange({
325
343
  ...layout,
326
344
  ColumnHeaders: {
327
345
  ...layout.ColumnHeaders,
@@ -330,7 +348,7 @@ const ColumnsSection = (props) => {
330
348
  });
331
349
  };
332
350
  const handleColumnWidthChange = (columnId, width) => {
333
- props.onChange({
351
+ onChange({
334
352
  ...layout,
335
353
  ColumnWidths: {
336
354
  ...layout.ColumnWidths,
@@ -339,7 +357,8 @@ const ColumnsSection = (props) => {
339
357
  });
340
358
  };
341
359
  const visibleIds = layout.TableColumns.filter((colId) => {
342
- return layout.ColumnVisibility?.[colId] !== false;
360
+ return (layout.ColumnVisibility?.[colId] !== false &&
361
+ adaptable.api.columnApi.isSelectionColumn(colId) === false);
343
362
  });
344
363
  const toLabel = (colId) => adaptable.api.columnApi.getFriendlyNameForColumnId(colId, layout);
345
364
  const toIdentifier = (colId) => colId;
@@ -378,7 +397,7 @@ const ColumnsSection = (props) => {
378
397
  noSelectionLabel: `No Columns Selected`,
379
398
  onChange: handleColumnsChange,
380
399
  onSelectAll: () => {
381
- props.onChange({
400
+ onChange({
382
401
  ...layout,
383
402
  ColumnVisibility: {},
384
403
  TableColumns: ColumnOrderAllColumns.map((col) => col.columnId),
@@ -44,8 +44,8 @@ const RowGroupBehaviorSection = (props) => {
44
44
  }
45
45
  onChange(newLayout);
46
46
  } },
47
- React.createElement(TypeRadio_1.TypeRadio, { value: "always-collapsed", text: "All Collapsed", description: "Always open Layout with all Grouped Rows collapsed" }),
48
- React.createElement(TypeRadio_1.TypeRadio, { value: "always-expanded", text: "All Expanded", description: "Always open Layout with all Grouped Rows expanded" }),
47
+ React.createElement(TypeRadio_1.TypeRadio, { value: "always-collapsed", text: "All Collapsed", description: "Layout opens with all Grouped Rows always collapsed" }),
48
+ React.createElement(TypeRadio_1.TypeRadio, { value: "always-expanded", text: "All Expanded", description: "Layout opens with all Grouped Rows always expanded" }),
49
49
  React.createElement(TypeRadio_1.TypeRadio, { value: "expanded", text: "Mostly Expanded", description: "Layout opens with all Grouped rows expanded, other than those collapsed when Layout last displayed" }),
50
50
  React.createElement(TypeRadio_1.TypeRadio, { value: "collapsed", text: "Mostly Collapsed", description: "Layout opens with all Grouped rows collapsed, other than those expanded when Layout last displayed" }))));
51
51
  };
@@ -6,7 +6,7 @@ interface QuickSearchPopupProps extends ModuleViewPopupProps<any> {
6
6
  QuickSearchText: string;
7
7
  QuickSearchStyle: AdaptableStyle;
8
8
  onRunQuickSearch: (quickSearchText: string) => QuickSearchRedux.QuickSearchRunAction;
9
- onSetStyle: (style: AdaptableStyle) => QuickSearchRedux.QuickSearchSetStyleAction;
9
+ onSetMatchingCellStyle: (style: AdaptableStyle) => QuickSearchRedux.QuickSearchSetMatchingCellStyleAction;
10
10
  }
11
11
  export declare const QuickSearchPopup: import("react-redux").ConnectedComponent<(props: QuickSearchPopupProps) => React.JSX.Element, {
12
12
  [x: string]: any;
@@ -15,6 +15,7 @@ const CheckBox_1 = require("../../components/CheckBox");
15
15
  const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
16
16
  const useQuickSearchDebounced_1 = require("./useQuickSearchDebounced");
17
17
  const QuickSearchInput_1 = require("./QuickSearchInput");
18
+ const HelpBlock_1 = tslib_1.__importDefault(require("../../components/HelpBlock"));
18
19
  const QuickSearchPopupComponent = (props) => {
19
20
  const [searchText, search] = (0, useQuickSearchDebounced_1.useQuickSearchDebounced)(props);
20
21
  const [state, setState] = (0, react_1.useState)({
@@ -23,7 +24,7 @@ const QuickSearchPopupComponent = (props) => {
23
24
  });
24
25
  const onUpdateStyle = (style) => {
25
26
  setState({ ...state, EditedStyle: style });
26
- props.onSetStyle(style);
27
+ props.onSetMatchingCellStyle(style);
27
28
  };
28
29
  const onQuickSearchBehaviourChange = (checked) => {
29
30
  setState({ ...state, RunQueryAfterQuickSearch: checked });
@@ -37,21 +38,23 @@ const QuickSearchPopupComponent = (props) => {
37
38
  React.createElement(Panel_1.default, { header: props.api.internalApi.getCorrectEnglishVariant('Behaviour'), style: { height: 'auto' }, variant: "default", borderRadius: "none", marginTop: 3, marginLeft: 2, marginRight: 2 },
38
39
  ' ',
39
40
  React.createElement(rebass_1.Flex, { flexDirection: "column" },
41
+ React.createElement(HelpBlock_1.default, { fontSize: 2, marginTop: 2, marginBottom: 2 }, "Filters the Grid to only show rows with matching cells; use with care as can cause performance issues"),
42
+ ' ',
40
43
  React.createElement(FormLayout_1.default, { columns: [1, 2] },
41
44
  React.createElement(FormLayout_1.FormRow, null,
42
45
  React.createElement(CheckBox_1.CheckBox, { "data-name": "filter-quick-search-results", value: "existing", marginLeft: 1, marginRight: 3, checked: state.RunQueryAfterQuickSearch, disabled: StringExtensions_1.default.IsNotNullOrEmpty(searchText), onChange: onQuickSearchBehaviourChange }, "Filter using Quick Search Results"))))),
43
- React.createElement(StyleComponent_1.StyleComponent, { style: { height: '100%' }, api: props.api, Style: props.QuickSearchStyle, UpdateStyle: onUpdateStyle })));
46
+ React.createElement(StyleComponent_1.StyleComponent, { style: { height: '100%' }, headerText: 'Cell Matching Style', api: props.api, Style: props.QuickSearchStyle, UpdateStyle: onUpdateStyle })));
44
47
  };
45
48
  function mapStateToProps(state, ownProps) {
46
49
  return {
47
50
  QuickSearchText: state.QuickSearch.QuickSearchText,
48
- QuickSearchStyle: state.QuickSearch.Style,
51
+ QuickSearchStyle: state.QuickSearch.CellMatchStyle,
49
52
  };
50
53
  }
51
54
  function mapDispatchToProps(dispatch) {
52
55
  return {
53
56
  onRunQuickSearch: (quickSearchText) => dispatch(QuickSearchRedux.QuickSearchRun(quickSearchText)),
54
- onSetStyle: (style) => dispatch(QuickSearchRedux.QuickSearchSetStyle(style)),
57
+ onSetMatchingCellStyle: (style) => dispatch(QuickSearchRedux.QuickSearchSetCellMatchingStyle(style)),
55
58
  };
56
59
  }
57
60
  exports.QuickSearchPopup = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(QuickSearchPopupComponent);