@adaptabletools/adaptable 18.0.0-canary.21 → 18.0.0-canary.22

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/AdaptableOptions/CommentOptions.d.ts +6 -0
  3. package/src/AdaptableOptions/GroupingOptions.d.ts +0 -4
  4. package/src/AdaptableOptions/NoteOptions.d.ts +8 -2
  5. package/src/Api/ColumnApi.d.ts +5 -0
  6. package/src/Api/Implementation/ColumnApiImpl.d.ts +3 -0
  7. package/src/Api/Implementation/ColumnApiImpl.js +19 -6
  8. package/src/Api/Implementation/ScopeApiImpl.js +34 -1
  9. package/src/Api/Internal/ColumnInternalApi.d.ts +2 -0
  10. package/src/Api/Internal/ColumnInternalApi.js +7 -1
  11. package/src/Utilities/Constants/GeneralConstants.d.ts +1 -0
  12. package/src/Utilities/Constants/GeneralConstants.js +1 -0
  13. package/src/View/Comments/CommentsPopup.js +5 -2
  14. package/src/View/Components/CellPopup/index.js +1 -1
  15. package/src/View/DataImport/DataImportWizard/DataImportWizard.js +1 -1
  16. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +19 -6
  17. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +0 -5
  18. package/src/View/Note/NotePopup.js +5 -2
  19. package/src/agGrid/AdaptableAgGrid.js +19 -60
  20. package/src/agGrid/AgGridAdapter.d.ts +1 -0
  21. package/src/agGrid/AgGridAdapter.js +4 -0
  22. package/src/agGrid/AgGridColumnAdapter.d.ts +0 -2
  23. package/src/agGrid/AgGridColumnAdapter.js +0 -43
  24. package/src/agGrid/buildSortedColumnStateForLayout.d.ts +7 -0
  25. package/src/agGrid/buildSortedColumnStateForLayout.js +120 -0
  26. package/src/agGrid/defaultAdaptableOptions.js +0 -1
  27. package/src/agGrid/sortColumnStateForVisibleColumns.d.ts +12 -0
  28. package/src/agGrid/sortColumnStateForVisibleColumns.js +46 -0
  29. package/src/env.js +2 -2
  30. package/src/metamodel/adaptable.metamodel.d.ts +18 -12
  31. package/src/metamodel/adaptable.metamodel.js +1 -1
  32. package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "18.0.0-canary.21",
3
+ "version": "18.0.0-canary.22",
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",
@@ -16,6 +16,12 @@ export interface CommentOptions<TData = any> {
16
16
  * @param commentThreads
17
17
  */
18
18
  persistCommentThreads?(commentThreads: CommentThread[]): void;
19
+ /**
20
+ * Format string for formatting in the Comments Popup
21
+ *
22
+ * @defaultValue 'dd-MM-yyyy HH:mm:ss'
23
+ */
24
+ dateFormat?: string;
19
25
  }
20
26
  /**
21
27
  * Context used when determining if a cell can show Comments
@@ -4,10 +4,6 @@ import { KeyCreatorParams } from '@ag-grid-community/core';
4
4
  * Options for managing Row and Column Groups in AdapTable
5
5
  */
6
6
  export interface GroupingOptions<TData = any> {
7
- /**
8
- * Value to use for 'Balanced Groups' (string columns only)
9
- */
10
- balancedGroupsKey?: string | ((context: BalancedGroupsKeyContext<TData>) => string);
11
7
  /**
12
8
  * Places ungrouped columns at pre-grouping indexed position
13
9
  * @defaultValue false
@@ -7,13 +7,19 @@ export interface NoteOptions<TData = any> {
7
7
  * Whether a cell can contain Notes
8
8
  */
9
9
  isCellNotable?: (context: NotableCellContext) => boolean;
10
+ /**
11
+ * Format string for formatting in the Notes Popup
12
+ *
13
+ * @defaultValue 'dd-MM-yyyy HH:mm:ss'
14
+ */
15
+ dateFormat?: string;
10
16
  }
11
17
  /**
12
18
  * Context used when determining if a Note can be added to a Cell
13
19
  */
14
20
  export interface NotableCellContext extends BaseContext {
15
21
  /**
16
- * Grid Cell in AdapTable which has been clicked
17
- */
22
+ * Grid Cell in AdapTable which has been clicked
23
+ */
18
24
  gridCell: GridCell;
19
25
  }
@@ -266,4 +266,9 @@ export interface ColumnApi {
266
266
  * Returns available columns types defined under columnOptions.columnTypes
267
267
  */
268
268
  getColumnTypes(): string[];
269
+ /**
270
+ * Returns all columns of a given columnType
271
+ * @param columnType the columnType to filter by
272
+ */
273
+ getColumnsByColumnType(columnType: string): AdaptableColumn[];
269
274
  }
@@ -3,6 +3,8 @@ import { AdaptableColumn, AdaptableColumnDataType } from '../../PredefinedConfig
3
3
  import { ColumnApi } from '../ColumnApi';
4
4
  import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
5
5
  import { ColumnInternalApi } from '../Internal/ColumnInternalApi';
6
+ export declare function isAutoRowGroupColumn(columnId: string): boolean;
7
+ export declare function isAutoPivotColumn(columnId: string): boolean;
6
8
  export declare class ColumnApiImpl extends ApiBase implements ColumnApi {
7
9
  internalApi: ColumnInternalApi;
8
10
  constructor(adaptable: IAdaptable);
@@ -64,4 +66,5 @@ export declare class ColumnApiImpl extends ApiBase implements ColumnApi {
64
66
  isSpecialColumn(columnId: string): boolean;
65
67
  openColumnInfoSettingsPanel(): void;
66
68
  getColumnTypes(): string[];
69
+ getColumnsByColumnType(columnType: string): AdaptableColumn[];
67
70
  }
@@ -4,6 +4,16 @@ import * as ModuleConstants from '../../Utilities/Constants/ModuleConstants';
4
4
  import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
5
5
  import { ColumnInternalApi } from '../Internal/ColumnInternalApi';
6
6
  import { createBaseContext } from '../../Utilities/ObjectFactory';
7
+ export function isAutoRowGroupColumn(columnId) {
8
+ // put this here as there might be other indicators we are not aware of
9
+ // perhaps with non auto groups ?
10
+ //https://www.ag-grid.com/javascript-grid-grouping/
11
+ return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_GROUPED_COLUMN);
12
+ }
13
+ export function isAutoPivotColumn(columnId) {
14
+ // put this here as there might be other indicators we are not aware of?
15
+ return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_PIVOT_COLUMN);
16
+ }
7
17
  export class ColumnApiImpl extends ApiBase {
8
18
  constructor(adaptable) {
9
19
  super(adaptable);
@@ -52,14 +62,10 @@ export class ColumnApiImpl extends ApiBase {
52
62
  this.adaptable.showColumn(columnId);
53
63
  }
54
64
  isAutoRowGroupColumn(columnId) {
55
- // put this here as there might be other indicators we are not aware of
56
- // perhaps with non auto groups ?
57
- //https://www.ag-grid.com/javascript-grid-grouping/
58
- return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_GROUPED_COLUMN);
65
+ return isAutoRowGroupColumn(columnId);
59
66
  }
60
67
  isAutoPivotColumn(columnId) {
61
- // put this here as there might be other indicators we are not aware of?
62
- return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_PIVOT_COLUMN);
68
+ return isAutoPivotColumn(columnId);
63
69
  }
64
70
  isCalculatedColumn(columnId) {
65
71
  return (this.adaptable.api.calculatedColumnApi
@@ -343,4 +349,11 @@ export class ColumnApiImpl extends ApiBase {
343
349
  return columnTypes;
344
350
  }
345
351
  }
352
+ getColumnsByColumnType(columnType) {
353
+ const abColumns = this.getColumns();
354
+ return abColumns.filter((c) => {
355
+ var _a;
356
+ return ((_a = c.columnTypes) !== null && _a !== void 0 ? _a : []).includes(columnType);
357
+ });
358
+ }
346
359
  }
@@ -43,7 +43,9 @@ export class ScopeApiImpl extends ApiBase {
43
43
  return 'Columns: All';
44
44
  }
45
45
  if ('ColumnTypes' in scope) {
46
- return ((scope.ColumnTypes.length > 0 ? 'ColumnTypes' : 'ColumnType') + ': ' + scope.ColumnTypes.join(', '));
46
+ return ((scope.ColumnTypes.length > 0 ? 'ColumnTypes' : 'ColumnType') +
47
+ ': ' +
48
+ scope.ColumnTypes.join(', '));
47
49
  }
48
50
  if ('DataTypes' in scope) {
49
51
  return ((scope.DataTypes.length > 0 ? 'DataTypes' : 'DataType') + ': ' + scope.DataTypes.join(', '));
@@ -160,6 +162,7 @@ export class ScopeApiImpl extends ApiBase {
160
162
  return undefined;
161
163
  }
162
164
  isColumnInNumericScope(column, scope) {
165
+ var _a, _b;
163
166
  // if column is not even numeric then return false
164
167
  if (column == null || column == undefined || column.dataType !== 'Number') {
165
168
  return false;
@@ -176,9 +179,14 @@ export class ScopeApiImpl extends ApiBase {
176
179
  if ('DataTypes' in scope && scope.DataTypes.includes('Number')) {
177
180
  return true;
178
181
  }
182
+ if ('ColumnTypes' in scope &&
183
+ ((_b = (_a = scope.ColumnTypes) === null || _a === void 0 ? void 0 : _a.some) === null || _b === void 0 ? void 0 : _b.call(_a, (scopeColumnType) => { var _a, _b; return (_b = (_a = column.columnTypes) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, scopeColumnType); }))) {
184
+ return true;
185
+ }
179
186
  return false;
180
187
  }
181
188
  isColumnInStringsScope(column, scope) {
189
+ var _a, _b;
182
190
  // if column is not even string then return false
183
191
  if (column == null || column == undefined || column.dataType !== 'String') {
184
192
  return false;
@@ -195,9 +203,14 @@ export class ScopeApiImpl extends ApiBase {
195
203
  if ('DataTypes' in scope && scope.DataTypes.includes('String')) {
196
204
  return true;
197
205
  }
206
+ if ('ColumnTypes' in scope &&
207
+ ((_b = (_a = scope.ColumnTypes) === null || _a === void 0 ? void 0 : _a.some) === null || _b === void 0 ? void 0 : _b.call(_a, (scopeColumnType) => { var _a, _b; return (_b = (_a = column.columnTypes) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, scopeColumnType); }))) {
208
+ return true;
209
+ }
198
210
  return false;
199
211
  }
200
212
  isColumnInDateScope(column, scope) {
213
+ var _a, _b;
201
214
  // if column is not even numeric then return false
202
215
  if (column == null || column == undefined || column.dataType !== 'Date') {
203
216
  return false;
@@ -214,6 +227,10 @@ export class ScopeApiImpl extends ApiBase {
214
227
  if ('DataTypes' in scope && scope.DataTypes.includes('Date')) {
215
228
  return true;
216
229
  }
230
+ if ('ColumnTypes' in scope &&
231
+ ((_b = (_a = scope.ColumnTypes) === null || _a === void 0 ? void 0 : _a.some) === null || _b === void 0 ? void 0 : _b.call(_a, (scopeColumnType) => { var _a, _b; return (_b = (_a = column.columnTypes) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, scopeColumnType); }))) {
232
+ return true;
233
+ }
217
234
  return false;
218
235
  }
219
236
  isScopeInScope(a, b) {
@@ -240,6 +257,22 @@ export class ScopeApiImpl extends ApiBase {
240
257
  })) {
241
258
  return true;
242
259
  }
260
+ if ('ColumnTypes' in a &&
261
+ 'ColumnTypes' in b &&
262
+ a.ColumnTypes.every((columnType) => b.ColumnTypes.includes(columnType))) {
263
+ return true;
264
+ }
265
+ // check if each colum in a has column types in b
266
+ if ('ColumnIds' in a && 'ColumnTypes' in b) {
267
+ const inScope = a.ColumnIds.every((columnId) => {
268
+ const column = this.adaptable.api.columnApi.getColumnWithColumnId(columnId);
269
+ // check if at least one column-type is in scope
270
+ return column.columnTypes.some((columnColumnType) => b.ColumnTypes.includes(columnColumnType));
271
+ });
272
+ if (inScope) {
273
+ return true;
274
+ }
275
+ }
243
276
  return false;
244
277
  }
245
278
  createCellColorRangesForScope(scope) {
@@ -2,6 +2,7 @@ import { ApiBase } from '../Implementation/ApiBase';
2
2
  import { Column, IRowNode } from '@ag-grid-community/core';
3
3
  import { CustomSort } from '../../PredefinedConfig/CustomSortState';
4
4
  import { ColumnValuesComparer } from '../../AdaptableOptions/CustomSortOptions';
5
+ export declare function getAutoRowGroupColumnIdFor(columnId: string): string;
5
6
  export declare class ColumnInternalApi extends ApiBase {
6
7
  /**
7
8
  * Retrieves 'ColumnType' property for a given Column
@@ -15,6 +16,7 @@ export declare class ColumnInternalApi extends ApiBase {
15
16
  * Retrieves a list providing the Friendly Name / Caption for all columns
16
17
  */
17
18
  getAllColumnFriendlyNames(): string[];
19
+ getAutoRowGroupColumnIdFor(columnId: string): string;
18
20
  /**
19
21
  * Retrieves AG Grid's field property for the column
20
22
  * @param columnId columnId to look up
@@ -1,5 +1,8 @@
1
1
  import { ApiBase } from '../Implementation/ApiBase';
2
- import { ADAPTABLE_ROW_ACTION_BUTTONS } from '../../Utilities/Constants/GeneralConstants';
2
+ import { ADAPTABLE_ROW_ACTION_BUTTONS, AG_GRID_GROUPED_COLUMN, } from '../../Utilities/Constants/GeneralConstants';
3
+ export function getAutoRowGroupColumnIdFor(columnId) {
4
+ return `${AG_GRID_GROUPED_COLUMN}-${columnId}`;
5
+ }
3
6
  export class ColumnInternalApi extends ApiBase {
4
7
  /**
5
8
  * Retrieves 'ColumnType' property for a given Column
@@ -21,6 +24,9 @@ export class ColumnInternalApi extends ApiBase {
21
24
  return c.friendlyName;
22
25
  });
23
26
  }
27
+ getAutoRowGroupColumnIdFor(columnId) {
28
+ return getAutoRowGroupColumnIdFor(columnId);
29
+ }
24
30
  /**
25
31
  * Retrieves AG Grid's field property for the column
26
32
  * @param columnId columnId to look up
@@ -35,6 +35,7 @@ export declare const ADAPTABLE_ROW_ACTION_BUTTONS = "adaptableRowActionButtons";
35
35
  export declare const ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME = "(ActionRowButtons)";
36
36
  export declare const ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = "(FDC3ActionColumn)";
37
37
  export declare const DEFAULT_DATE_FORMAT_PATTERN = "dd-MM-yyyy";
38
+ export declare const DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME = "dd-MM-yyyy HH:mm:ss";
38
39
  export declare const BLANK_DISTINCT_COLUMN_VALUE = "[BLANKS]";
39
40
  export declare const DEFAULT_STRING_DISPLAY_VALUE = "Hello World";
40
41
  export declare const DEFAULT_INTEGER_DISPLAY_VALUE = 12345;
@@ -34,6 +34,7 @@ export const ADAPTABLE_ROW_ACTION_BUTTONS = 'adaptableRowActionButtons';
34
34
  export const ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME = '(ActionRowButtons)';
35
35
  export const ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = '(FDC3ActionColumn)';
36
36
  export const DEFAULT_DATE_FORMAT_PATTERN = 'dd-MM-yyyy';
37
+ export const DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME = 'dd-MM-yyyy HH:mm:ss';
37
38
  export const BLANK_DISTINCT_COLUMN_VALUE = '[BLANKS]';
38
39
  export const DEFAULT_STRING_DISPLAY_VALUE = 'Hello World';
39
40
  export const DEFAULT_INTEGER_DISPLAY_VALUE = 12345;
@@ -3,10 +3,11 @@ import { useSelector } from 'react-redux';
3
3
  import { DataSource, InfiniteTable } from '../../components/InfiniteTable';
4
4
  import Panel from '../../components/Panel';
5
5
  import { Box, Flex } from 'rebass';
6
- import { formatDate } from '../../Utilities/ExpressionFunctions/dateUtils';
6
+ import dateFnsFormat from 'date-fns/format';
7
7
  import { useAdaptable } from '../AdaptableContext';
8
8
  import { PopupPanel } from '../Components/Popups/AdaptablePopup/PopupPanel';
9
9
  import { AdaptableButtonComponent } from '../Components/AdaptableButton';
10
+ import { DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME } from '../../Utilities/Constants/GeneralConstants';
10
11
  const tableDOMProps = {
11
12
  style: {
12
13
  minHeight: 160,
@@ -14,7 +15,9 @@ const tableDOMProps = {
14
15
  },
15
16
  };
16
17
  const CellComments = (props) => {
18
+ var _a;
17
19
  const adaptable = useAdaptable();
20
+ const dateFormat = (_a = adaptable.api.optionsApi.getCommentOptions().dateFormat) !== null && _a !== void 0 ? _a : DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME;
18
21
  const isReadOnlyModule = adaptable.api.entitlementApi.getEntitlementAccessLevelForModule('Comment') === 'ReadOnly';
19
22
  const columnsMap = React.useMemo(() => {
20
23
  const columns = {
@@ -27,7 +30,7 @@ const CellComments = (props) => {
27
30
  field: 'Timestamp',
28
31
  maxWidth: 150,
29
32
  valueGetter: (params) => {
30
- return formatDate(params.data.Timestamp, 'MM.DD.YYYY HH:mm');
33
+ return dateFnsFormat(params.data.Timestamp, dateFormat);
31
34
  },
32
35
  },
33
36
  text: {
@@ -13,7 +13,7 @@ const ensurePortalElement = (className) => {
13
13
  }
14
14
  portalElement = document.createElement('div');
15
15
  portalElement.style.position = 'absolute';
16
- portalElement.style.zIndex = '999';
16
+ portalElement.style.zIndex = '4'; // under the context menu
17
17
  portalElement.style.top = '0px';
18
18
  portalElement.style.left = '0px';
19
19
  if (className) {
@@ -132,7 +132,7 @@ export const DataImportWizard = (props) => {
132
132
  return [...userDefinedHandlers, ...systemFileHandlers];
133
133
  }, []);
134
134
  const supportedFileFormats = React.useMemo(() => {
135
- return fileHandlers.map((h) => h.fileExtension).join(', ');
135
+ return [...new Set(fileHandlers.map((h) => h.fileExtension)).values()].join(', ');
136
136
  }, [fileHandlers]);
137
137
  const readFile = React.useCallback(async (file) => {
138
138
  var _a, _b;
@@ -143,6 +143,19 @@ export const getFormatDisplayTypeForScope = (scope, api) => {
143
143
  if ('DataTypes' in scope && scope.DataTypes.length == 1 && scope.DataTypes[0] == 'String') {
144
144
  return 'String';
145
145
  }
146
+ if ('ColumnTypes' in scope && scope.ColumnTypes.length) {
147
+ // need to check if all column with this column type has the same data type and return that particular one
148
+ const columns = scope.ColumnTypes.flatMap((columnType) => {
149
+ return api.columnApi.getColumnsByColumnType(columnType);
150
+ });
151
+ // check if all have the same type
152
+ if (columns.length &&
153
+ columns.every((column) => column.dataType === columns[0].dataType) &&
154
+ // supported data types
155
+ ['Number', 'Date', 'String'].includes(columns[0].dataType)) {
156
+ return columns[0].dataType;
157
+ }
158
+ }
146
159
  return undefined;
147
160
  };
148
161
  const renderDateFormat = (data, _onChange, setFormatOption, scopedCustomFormatters) => {
@@ -189,7 +202,7 @@ const renderDateFormat = (data, _onChange, setFormatOption, scopedCustomFormatte
189
202
  ] })))))));
190
203
  };
191
204
  const renderNumberFormat = (data, onChange, setFormatOption, scopedCustomFormatters, formatColumnApi) => {
192
- var _a, _b, _c;
205
+ var _a, _b, _c, _d, _e;
193
206
  if (data.DisplayFormat.Formatter !== 'NumberFormatter') {
194
207
  return null;
195
208
  }
@@ -248,13 +261,13 @@ const renderNumberFormat = (data, onChange, setFormatOption, scopedCustomFormatt
248
261
  React.createElement(Flex, { flexDirection: "row" },
249
262
  React.createElement(FormLayout, { mr: 3 },
250
263
  React.createElement(FormRow, { label: "Fraction Separator" },
251
- React.createElement(Input, { "data-name": "fraction-separator", value: data.DisplayFormat.Options.FractionSeparator, onChange: (e) => setFormatOption('FractionSeparator', e.currentTarget.value) })),
264
+ React.createElement(Input, { "data-name": "fraction-separator", value: (_a = data.DisplayFormat.Options.FractionSeparator) !== null && _a !== void 0 ? _a : '', onChange: (e) => setFormatOption('FractionSeparator', e.currentTarget.value) })),
252
265
  React.createElement(FormRow, { label: "Integer Separator" },
253
- React.createElement(Input, { "data-name": "integer-separator", value: data.DisplayFormat.Options.IntegerSeparator, onChange: (e) => setFormatOption('IntegerSeparator', e.currentTarget.value) })),
266
+ React.createElement(Input, { "data-name": "integer-separator", value: (_b = data.DisplayFormat.Options.IntegerSeparator) !== null && _b !== void 0 ? _b : '', onChange: (e) => setFormatOption('IntegerSeparator', e.currentTarget.value) })),
254
267
  React.createElement(FormRow, { label: "Prefix" },
255
- React.createElement(Input, { "data-name": "prefix", value: (_a = data.DisplayFormat.Options.Prefix) !== null && _a !== void 0 ? _a : '', onChange: (e) => setFormatOption('Prefix', e.currentTarget.value) })),
268
+ React.createElement(Input, { "data-name": "prefix", value: (_c = data.DisplayFormat.Options.Prefix) !== null && _c !== void 0 ? _c : '', onChange: (e) => setFormatOption('Prefix', e.currentTarget.value) })),
256
269
  React.createElement(FormRow, { label: "Suffix" },
257
- React.createElement(Input, { "data-name": "suffix", value: (_b = data.DisplayFormat.Options.Suffix) !== null && _b !== void 0 ? _b : '', onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })),
270
+ React.createElement(Input, { "data-name": "suffix", value: (_d = data.DisplayFormat.Options.Suffix) !== null && _d !== void 0 ? _d : '', onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })),
258
271
  React.createElement(FormRow, { label: "Truncate" },
259
272
  React.createElement(CheckBox, { "data-name": "truncate-checkbox", checked: data.DisplayFormat.Options.Truncate, onChange: (checked) => setFormatOption('Truncate', checked) })),
260
273
  React.createElement(FormRow, { label: "Ceiling" },
@@ -279,7 +292,7 @@ const renderNumberFormat = (data, onChange, setFormatOption, scopedCustomFormatt
279
292
  React.createElement(Input, { "data-name": "multiplier", type: "number", value: data.DisplayFormat.Options.Multiplier, onChange: (e) => setFormatOption('Multiplier', Number(e.currentTarget.value)) })),
280
293
  ' ',
281
294
  React.createElement(FormRow, { label: "Content" },
282
- React.createElement(Input, { "data-name": "content", value: (_c = data.DisplayFormat.Options.Content) !== null && _c !== void 0 ? _c : '', onChange: (e) => setFormatOption('Content', e.currentTarget.value) })),
295
+ React.createElement(Input, { "data-name": "content", value: (_e = data.DisplayFormat.Options.Content) !== null && _e !== void 0 ? _e : '', onChange: (e) => setFormatOption('Content', e.currentTarget.value) })),
283
296
  ' ',
284
297
  React.createElement(FormRow, { label: "Parentheses" },
285
298
  React.createElement(CheckBox, { "data-name": "parentheses-checkbox", checked: data.DisplayFormat.Options.Parentheses, onChange: (checked) => setFormatOption('Parentheses', checked) })),
@@ -7,11 +7,6 @@ import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableW
7
7
  import { Tag } from '../../../components/Tag';
8
8
  import { ToggleGroup } from '../../../components/Toggle/ToggleGroup';
9
9
  import { Toggle } from '../../../components/Toggle/Toggle';
10
- let alignmentOptions = [
11
- { value: 'Left', label: 'Left' },
12
- { value: 'Right', label: 'Right' },
13
- { value: 'Center', label: 'Center' },
14
- ];
15
10
  export const renderFormatColumnSettingsSummary = (data) => {
16
11
  var _a;
17
12
  return (React.createElement(Box, { padding: 2 },
@@ -2,9 +2,11 @@ import * as React from 'react';
2
2
  import { useSelector } from 'react-redux';
3
3
  import { DataSource, InfiniteTable } from '../../components/InfiniteTable';
4
4
  import { GetAllNotesSelector } from '../../Redux/ActionsReducers/NoteRedux';
5
+ import dateFnsFormat from 'date-fns/format';
5
6
  import { useAdaptable } from '../AdaptableContext';
6
7
  import { AdaptableButtonComponent } from '../Components/AdaptableButton';
7
8
  import { PopupPanel } from '../Components/Popups/AdaptablePopup/PopupPanel';
9
+ import { DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME } from '../../Utilities/Constants/GeneralConstants';
8
10
  const tableDOMProps = {
9
11
  style: {
10
12
  height: '100%',
@@ -13,8 +15,10 @@ const tableDOMProps = {
13
15
  },
14
16
  };
15
17
  export const NotePopup = (props) => {
18
+ var _a;
16
19
  const adaptable = useAdaptable();
17
20
  const primaryKeyHeader = adaptable.api.columnApi.getFriendlyNameForColumnId(adaptable.api.columnApi.getPrimaryKeyColumn().columnId);
21
+ const dateFormat = (_a = adaptable.api.optionsApi.getNoteOptions().dateFormat) !== null && _a !== void 0 ? _a : DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME;
18
22
  const allNotes = useSelector((state) => GetAllNotesSelector(state.Note));
19
23
  const isReadOnlyModule = adaptable.api.entitlementApi.getEntitlementAccessLevelForModule('Note') === 'ReadOnly';
20
24
  const columnsMap = React.useMemo(() => {
@@ -39,8 +43,7 @@ export const NotePopup = (props) => {
39
43
  timestamp: {
40
44
  field: 'Timestamp',
41
45
  valueGetter: (params) => {
42
- var _a;
43
- return (_a = new Date(params.data.Timestamp)) === null || _a === void 0 ? void 0 : _a.toDateString();
46
+ return dateFnsFormat(params.data.Timestamp, dateFormat);
44
47
  },
45
48
  },
46
49
  delete: {
@@ -96,6 +96,7 @@ import { ensurePortalElement } from '../components/Modal';
96
96
  import { AdaptableLoadingScreen } from '../View/Components/Popups/AdaptableLoadingScreen';
97
97
  import { createElement } from 'react';
98
98
  import { removeUuidAndSource } from '../Utilities/Helpers/AdaptableHelper';
99
+ import { buildSortedColumnStateForLayout } from './buildSortedColumnStateForLayout';
99
100
  const RowNodeProto = RowNode.prototype;
100
101
  const RowNode_dispatchLocalEvent = RowNodeProto.dispatchLocalEvent;
101
102
  /**
@@ -2203,53 +2204,20 @@ export class AdaptableAgGrid {
2203
2204
  });
2204
2205
  this.deriveAdaptableColumnStateFromAgGrid();
2205
2206
  }
2206
- getSortedColumnStateForVisibleColumns(visibleColumnList, columnState, isPivot) {
2207
+ getSortedColumnStateForVisibleColumns(visibleColumnList, columnState, layout) {
2208
+ layout = layout || this.api.layoutApi.getCurrentLayout();
2209
+ visibleColumnList = visibleColumnList || layout.Columns;
2207
2210
  columnState = columnState || this.agGridAdapter.getAgGridApi().getColumnState();
2208
- const pivotMode = isPivot !== null && isPivot !== void 0 ? isPivot : this.api.layoutApi.isCurrentLayoutPivot();
2209
- const NewVisibleColumnIdsMap = visibleColumnList.reduce((acc, colId, index) => {
2210
- acc[colId] = index;
2211
- return acc;
2212
- }, {});
2213
- const columnsStateIndexes = columnState.reduce((acc, colState, index) => {
2214
- acc[colState.colId] = index;
2215
- return acc;
2216
- }, {});
2217
- const newVisibleColumnsMap = visibleColumnList.reduce((acc, colId, index) => {
2218
- acc[colId] = index;
2219
- return acc;
2220
- }, {});
2221
- const result = [...columnState]
2222
- .sort((colState1, colState2) => {
2223
- const colId1 = colState1.colId;
2224
- const colId2 = colState2.colId;
2225
- const originalIndex1 = columnsStateIndexes[colId1];
2226
- const originalIndex2 = columnsStateIndexes[colId2];
2227
- if (pivotMode) {
2228
- const isRowGroup1 = this.api.columnApi.isAutoRowGroupColumn(colId1);
2229
- const isRowGroup2 = this.api.columnApi.isAutoRowGroupColumn(colId2);
2230
- if (isRowGroup1 && isRowGroup2) {
2231
- return 1;
2232
- }
2233
- if (isRowGroup1) {
2234
- return -1;
2235
- }
2236
- if (isRowGroup2) {
2237
- return 1;
2238
- }
2239
- }
2240
- if (newVisibleColumnsMap[colId1] != null && newVisibleColumnsMap[colId2] == null) {
2241
- return -1;
2242
- }
2243
- if (newVisibleColumnsMap[colId1] == null && newVisibleColumnsMap[colId2] != null) {
2244
- return 1;
2245
- }
2246
- if (newVisibleColumnsMap[colId1] == null && newVisibleColumnsMap[colId2] == null) {
2247
- return originalIndex1 - originalIndex2;
2248
- }
2249
- return newVisibleColumnsMap[colState1.colId] - newVisibleColumnsMap[colState2.colId];
2250
- })
2251
- .map((colState) => (Object.assign(Object.assign({}, colState), { hide: NewVisibleColumnIdsMap[colState.colId] == null })));
2252
- return result;
2211
+ return buildSortedColumnStateForLayout({
2212
+ columnState: columnState.map((colState) => {
2213
+ return {
2214
+ colId: colState.colId,
2215
+ hide: colState.hide,
2216
+ };
2217
+ }),
2218
+ layout: Object.assign(Object.assign({}, layout), { Columns: visibleColumnList }),
2219
+ gridOptions: this.agGridAdapter.getLiveGridOptions(),
2220
+ });
2253
2221
  }
2254
2222
  getDistinctValuesForColumn(column, distinctValuesParams) {
2255
2223
  let gridCells = this.getGridCellsForPermittedValues(column, distinctValuesParams);
@@ -3190,10 +3158,6 @@ export class AdaptableAgGrid {
3190
3158
  layout.PinnedColumnsMap = layout.PinnedColumnsMap || {};
3191
3159
  layout.PinnedColumnsMap[actionRowColumn.colId] = actionRowColumn.pinned;
3192
3160
  }
3193
- const layoutColumnsMap = layout.Columns.reduce((acc, colId) => {
3194
- acc[colId] = true;
3195
- return acc;
3196
- }, {});
3197
3161
  const columnsState = this.agGridAdapter.getAgGridApi().getColumnState();
3198
3162
  const columnsStateIndexes = {};
3199
3163
  const columnsStateMap = columnsState.reduce((acc, colState, index) => {
@@ -3225,20 +3189,19 @@ export class AdaptableAgGrid {
3225
3189
  .getPivotResultColumns()) === null || _b === void 0 ? void 0 : _b.map((column) => column.getColId())) || [];
3226
3190
  let isChanged = false;
3227
3191
  const colsToAutoSize = {};
3228
- let newColumnsState = this.getSortedColumnStateForVisibleColumns(columnsToShow, columnsState, !!layout.EnablePivot);
3192
+ let newColumnsState = this.getSortedColumnStateForVisibleColumns(columnsToShow, columnsState, layout);
3229
3193
  newColumnsState = newColumnsState
3230
3194
  .map((colState) => {
3231
3195
  var _a, _b, _c;
3232
3196
  const { colId } = colState;
3233
3197
  const oldColState = columnsStateMap[colId];
3234
- const hide = this.api.columnApi.isAutoPivotColumn(colId)
3235
- ? colState.hide
3236
- : !layoutColumnsMap[colId];
3237
- const newColState = Object.assign(Object.assign({}, oldColState), { hide });
3198
+ // it's important to have width here, so it's not inherited from the existing colState
3199
+ // which could be from a different layout
3200
+ const newColState = Object.assign(Object.assign(Object.assign({}, oldColState), { width: null }), colState);
3238
3201
  if (layout.ColumnWidthMap && layout.ColumnWidthMap[colId] != null) {
3239
3202
  newColState.width = layout.ColumnWidthMap[colId];
3240
3203
  }
3241
- else if (!hide) {
3204
+ else if (!colState.hide) {
3242
3205
  // autosize only the columns which are part of the selected layout
3243
3206
  colsToAutoSize[colId] = true;
3244
3207
  }
@@ -3247,11 +3210,7 @@ export class AdaptableAgGrid {
3247
3210
  }
3248
3211
  newColState.rowGroupIndex =
3249
3212
  groupedColumnsIndexesMap[colId] != null ? groupedColumnsIndexesMap[colId] : null;
3250
- const previousRowGroup = newColState.rowGroup;
3251
3213
  newColState.rowGroup = newColState.rowGroupIndex != null;
3252
- if (!previousRowGroup && newColState.rowGroup) {
3253
- this.agGridColumnAdapter.triggerSetupColumnKeyCreator(colId);
3254
- }
3255
3214
  const normalizePinned = (pinnedValue) => {
3256
3215
  if (typeof pinnedValue === 'string') {
3257
3216
  return pinnedValue;
@@ -24,6 +24,7 @@ export declare class AgGridAdapter {
24
24
  grabAgGridApiOnTheFly(args: unknown): void;
25
25
  getLiveGridOptions(): GridOptions | undefined;
26
26
  updateGridOptions(options: ManagedGridOptions): void;
27
+ getGridOption<Key extends keyof GridOptions>(key: Key): GridOptions[Key];
27
28
  setGridOption<Key extends ManagedGridOptionKey>(key: Key, value: GridOptions[Key]): void;
28
29
  getUserGridOptionsProperty<T extends keyof GridOptions>(propertyName: T): GridOptions[T];
29
30
  updateColumnFilterActiveState(): void;
@@ -60,6 +60,10 @@ export class AgGridAdapter {
60
60
  var _a;
61
61
  (_a = this.getAgGridApi()) === null || _a === void 0 ? void 0 : _a.updateGridOptions(options);
62
62
  }
63
+ getGridOption(key) {
64
+ var _a;
65
+ return (_a = this.getAgGridApi()) === null || _a === void 0 ? void 0 : _a.getGridOption(key);
66
+ }
63
67
  setGridOption(key, value) {
64
68
  var _a;
65
69
  (_a = this.getAgGridApi()) === null || _a === void 0 ? void 0 : _a.setGridOption(key, value);
@@ -12,7 +12,6 @@ export declare class AgGridColumnAdapter {
12
12
  setColDefProperty<T extends keyof ColDef>(col: Column, propertyName: T, propertyGetter: (userPropertyValue: ColDef[T]) => ColDef[T] | undefined): void;
13
13
  getUserColDefProperty<T extends keyof ColDef>(columnId: string, propertyName: T): ColDef[T] | undefined;
14
14
  setupColumns(): void;
15
- triggerSetupColumnKeyCreator(colId: string): void;
16
15
  private setupColumnValueGetter;
17
16
  private setupColumnCellClass;
18
17
  private setupColumnCellStyle;
@@ -21,7 +20,6 @@ export declare class AgGridColumnAdapter {
21
20
  private setupColumnTooltipValueGetter;
22
21
  private setupColumnQuickFilerText;
23
22
  private setupColumnAllowedAggFuncs;
24
- private setupColumnKeyCreator;
25
23
  private setupColumnCellDataType;
26
24
  setupColumnHeader({ col, abColumn }: ColumnSetupInfo): boolean;
27
25
  private setupColumnFilter;