@adaptabletools/adaptable-cjs 20.0.0-canary.15 → 20.0.0-canary.17

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.
@@ -6,11 +6,11 @@ const React = tslib_1.__importStar(require("react"));
6
6
  const react_redux_1 = require("react-redux");
7
7
  const InfiniteTable_1 = require("../../components/InfiniteTable");
8
8
  const NoteRedux_1 = require("../../Redux/ActionsReducers/NoteRedux");
9
- const format_1 = tslib_1.__importDefault(require("date-fns/format"));
10
9
  const AdaptableContext_1 = require("../AdaptableContext");
11
10
  const AdaptableButton_1 = require("../Components/AdaptableButton");
12
11
  const PopupPanel_1 = require("../Components/Popups/AdaptablePopup/PopupPanel");
13
12
  const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
13
+ const FormatHelper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/FormatHelper"));
14
14
  const tableDOMProps = {
15
15
  style: {
16
16
  height: '100%',
@@ -25,6 +25,9 @@ const NotePopup = (props) => {
25
25
  : StringExtensions_1.default.Humanize(adaptable.adaptableOptions.primaryKey);
26
26
  const allNotes = (0, react_redux_1.useSelector)((state) => (0, NoteRedux_1.GetAllNotesSelector)(state.Note));
27
27
  const isReadOnlyModule = adaptable.api.entitlementApi.getEntitlementAccessLevelForModule('Note') === 'ReadOnly';
28
+ const formatDate = (date, format) => {
29
+ return FormatHelper_1.default.DateFormatter(date, { Pattern: format });
30
+ };
28
31
  const columnsMap = React.useMemo(() => {
29
32
  const columns = {
30
33
  primaryKey: {
@@ -47,7 +50,7 @@ const NotePopup = (props) => {
47
50
  timestamp: {
48
51
  field: 'Timestamp',
49
52
  valueGetter: (params) => {
50
- return (0, format_1.default)(params.data.Timestamp, adaptable.api.noteApi.internalApi.getNotesDateFormat());
53
+ return formatDate(params.data.Timestamp, adaptable.api.noteApi.internalApi.getNotesDateFormat());
51
54
  },
52
55
  },
53
56
  delete: {
@@ -333,5 +333,6 @@ export declare class AdaptableAgGrid implements IAdaptable {
333
333
  refreshLayout(): void;
334
334
  private isRowGroupDifferentInLayout;
335
335
  private onLayoutChange;
336
+ private validateColumnDefTypes;
336
337
  }
337
338
  export {};
@@ -100,6 +100,7 @@ const isPivotLayoutModel_1 = require("../layout-manager/src/isPivotLayoutModel")
100
100
  const AdaptableColumn_1 = require("../PredefinedConfig/Common/AdaptableColumn");
101
101
  const agGridDataTypeDefinitions_1 = require("./agGridDataTypeDefinitions");
102
102
  const AgGridThemeAdapter_1 = require("./AgGridThemeAdapter");
103
+ const VersionUpgrade20_1 = require("../migration/VersionUpgrade20");
103
104
  const LocalEventService_Prototype = ag_grid_enterprise_1.LocalEventService.prototype;
104
105
  const LocalEventService_dispatchEvent = LocalEventService_Prototype.dispatchEvent;
105
106
  LocalEventService_Prototype.dispatchEvent = function (event) {
@@ -360,6 +361,7 @@ class AdaptableAgGrid {
360
361
  // AG Grid evaluates early on the floatingFilter params, so we need to "suppres" the floating filter temporarily
361
362
  // we will reset it once Adaptable is ready
362
363
  this.agGridColumnAdapter.setupColumnFloatingFilterTemporarily(gridOptions);
364
+ this.validateColumnDefTypes(gridOptions.columnDefs);
363
365
  const agGridApi = await this.initializeAgGrid(gridOptions, config.modules, config.renderAgGridFrameworkComponent);
364
366
  if (agGridApi === false) {
365
367
  this.midwayDestroy();
@@ -3292,5 +3294,25 @@ You need to define at least one Layout!`);
3292
3294
  this.__prevLayoutForOnChange = layout;
3293
3295
  this.api.layoutApi.createOrUpdateLayout(layout);
3294
3296
  }
3297
+ validateColumnDefTypes(columnDefs) {
3298
+ // in Adaptable version 20 we switched from colDef.type to colDef.cellDataType
3299
+ // although we documented this change and try to infer the correct cellDataTypes, it's best to also check if the client dev forgot to adjust his colDefs
3300
+ columnDefs.forEach((colDef) => {
3301
+ if (colDef.children?.length) {
3302
+ this.validateColumnDefTypes(colDef.children);
3303
+ }
3304
+ const columnDefinition = colDef;
3305
+ const colDefType = columnDefinition.type;
3306
+ const colDefTypes = typeof colDefType === 'string' ? [colDefType] : colDefType || [];
3307
+ colDefTypes
3308
+ .filter((colType) => colType.startsWith('abColDef'))
3309
+ .forEach((colType) => {
3310
+ const newValidCellDataType = (0, VersionUpgrade20_1.mapOldTypeToDataType)(colType);
3311
+ if (newValidCellDataType) {
3312
+ this.logger.consoleWarn(`Column ${columnDefinition.colId ?? columnDefinition.field} has a type of ${colType} which is no longer in use${newValidCellDataType !== 'unknown' ? `. Please use 'colDef.cellDataType' instead: ${newValidCellDataType}` : ''}`);
3313
+ }
3314
+ });
3315
+ });
3316
+ }
3295
3317
  }
3296
3318
  exports.AdaptableAgGrid = AdaptableAgGrid;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InternalAdaptableDateEditor = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
- const parseISO_1 = tslib_1.__importDefault(require("date-fns/parseISO"));
6
+ const date_fns_1 = require("date-fns");
7
7
  const useProperty_1 = tslib_1.__importDefault(require("../../../components/utils/useProperty"));
8
8
  const AdaptableInput_1 = tslib_1.__importDefault(require("../../../View/Components/AdaptableInput"));
9
9
  const DatepickerContext_1 = require("../../../components/Datepicker/DatepickerContext");
@@ -42,7 +42,7 @@ exports.InternalAdaptableDateEditor = React.forwardRef((props, ref) => {
42
42
  props.onValueChange?.(null);
43
43
  }
44
44
  else {
45
- const date = typeof value === 'string' ? (0, parseISO_1.default)(value) : new Date(value);
45
+ const date = typeof value === 'string' ? (0, date_fns_1.parseISO)(value) : new Date(value);
46
46
  props.onValueChange?.(date);
47
47
  }
48
48
  },
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { Locale } from 'date-fns';
2
3
  export declare const DatepickerContext: React.Context<{
3
4
  onHide?: (keyboardEventKey?: string) => void;
4
5
  onShow?: VoidFunction;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { BoxProps } from 'rebass';
3
3
  import { DatepickerButton } from '../../AdaptableOptions/DateInputOptions';
4
+ import { Locale } from 'date-fns';
4
5
  export type DatepickerProps = Omit<BoxProps, 'value' | 'onChange' | 'defaultValue'> & {
5
6
  value: Date | undefined;
6
7
  defaultValue?: Date | undefined;
@@ -39,7 +39,7 @@ const INFINITE_COLUMNS_WITH_CHECKBOX = {
39
39
  renderHeader: (headerParams) => {
40
40
  return (React.createElement(React.Fragment, null,
41
41
  headerParams.renderBag.selectionCheckBox,
42
- headerParams.allRowsSelected ? 'Deselect All' : 'Select All'));
42
+ headerParams.allRowsSelected ? '(Deselect All)' : '(Select All)'));
43
43
  },
44
44
  renderMenuIcon: false,
45
45
  },
@@ -99,7 +99,7 @@ const Select = function (props) {
99
99
  };
100
100
  const renderMultipleValues = props.renderMultipleValues;
101
101
  const isMulti = props.isMulti ?? Array.isArray(props.value);
102
- const showHeaderSelectionCheckbox = props.showHeaderSelectionCheckbox ?? false;
102
+ const showHeaderSelectionCheckbox = isMulti && (props.showHeaderSelectionCheckbox ?? false);
103
103
  let selectedOption = null;
104
104
  if (isMulti) {
105
105
  selectedOption =
@@ -339,7 +339,7 @@ const Select = function (props) {
339
339
  zIndex: 999999,
340
340
  boxShadow: 'var(--ab-cmp-select-menu__box-shadow)',
341
341
  minWidth: `var(--ab-cmp-select-menu__min-width)`,
342
- '--ab-cmp-select-menu__min-height': `min(${(props.options || []).length * ROW_HEIGHT}px, 20rem)`,
342
+ '--ab-cmp-select-menu__min-height': `min(${((props.options || []).length + (showHeaderSelectionCheckbox ? 1 : 0)) * ROW_HEIGHT}px, 20rem)`,
343
343
  ...commonStyles(state),
344
344
  ...props.menuStyle,
345
345
  };
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
5
- PUBLISH_TIMESTAMP: 1741795405265 || Date.now(),
6
- VERSION: "20.0.0-canary.15" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1741946447730 || Date.now(),
6
+ VERSION: "20.0.0-canary.17" || '--current-version--',
7
7
  };
@@ -1,5 +1,7 @@
1
1
  import { VersionUpgrade } from './VersionUpgrade';
2
2
  import { AdaptableState } from '../PredefinedConfig/AdaptableState';
3
+ import { AdaptableColumnDataType } from '../PredefinedConfig/Common/AdaptableColumn';
4
+ export declare function mapOldTypeToDataType(previousType: string): AdaptableColumnDataType;
3
5
  export declare class VersionUpgrade20 extends VersionUpgrade {
4
6
  migrateState(state: AdaptableState): AdaptableState;
5
7
  private migrateLayoutState;
@@ -1,25 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VersionUpgrade20 = void 0;
3
+ exports.VersionUpgrade20 = exports.mapOldTypeToDataType = void 0;
4
4
  const VersionUpgrade_1 = require("./VersionUpgrade");
5
5
  const agGridDataTypeDefinitions_1 = require("../agGrid/agGridDataTypeDefinitions");
6
6
  function transition_pre_20(layout) {
7
7
  const l = layout;
8
- if (l.AggregationColumns && !Array.isArray(l.AggregationColumns)) {
9
- const oldAggs = l.AggregationColumns || {};
10
- const newAggs = Object.entries(oldAggs).map(([colId, aggFunc]) => ({
11
- ColumnId: colId,
12
- AggFunc: aggFunc,
13
- }));
14
- layout.TableAggregationColumns = newAggs;
15
- }
16
- if (l.Columns) {
8
+ if (l.Columns && !l.EnablePivot) {
17
9
  layout.TableColumns = l.Columns;
18
10
  delete l.Columns;
19
11
  delete layout.PivotColumns;
20
12
  }
21
13
  if (l.PinnedColumnsMap) {
22
- layout.ColumnPinning = l.PinnedColumnsMap;
14
+ layout.ColumnPinning = { ...l.PinnedColumnsMap };
23
15
  delete l.PinnedColumnsMap;
24
16
  }
25
17
  if (l.ColumnHeadersMap) {
@@ -32,11 +24,42 @@ function transition_pre_20(layout) {
32
24
  }
33
25
  if (l.EnablePivot) {
34
26
  layout.PivotColumns = l.PivotColumns || [];
27
+ delete l.Columns;
35
28
  delete layout.TableColumns;
29
+ delete l.EnablePivot;
36
30
  if (l.AggregationColumns) {
37
- layout.PivotAggregationColumns = layout.TableAggregationColumns;
31
+ layout.PivotAggregationColumns = (Object.entries(l.AggregationColumns) || []).map(([ColumnId, AggFunc]) => {
32
+ return {
33
+ ColumnId,
34
+ AggFunc,
35
+ };
36
+ });
37
+ delete layout.TableAggregationColumns;
38
+ delete l.AggregationColumns;
39
+ }
40
+ if (l.RowGroupedColumns) {
41
+ layout.PivotGroupedColumns = l.RowGroupedColumns;
42
+ delete l.RowGroupedColumns;
38
43
  }
39
44
  }
45
+ else {
46
+ if (l.AggregationColumns && !Array.isArray(l.AggregationColumns)) {
47
+ const oldAggs = l.AggregationColumns || {};
48
+ const newAggs = Object.entries(oldAggs).map(([ColumnId, AggFunc]) => ({
49
+ ColumnId,
50
+ AggFunc,
51
+ }));
52
+ layout.TableAggregationColumns = newAggs;
53
+ delete l.AggregationColumns;
54
+ }
55
+ }
56
+ if (l.ExpandedRowGroupValues) {
57
+ layout.RowGroupValues = {
58
+ RowGroupDefaultBehavior: 'collapsed',
59
+ ExceptionGroupKeys: l.ExpandedRowGroupValues,
60
+ };
61
+ delete l.ExpandedRowGroupValues;
62
+ }
40
63
  if (Array.isArray(l.ColumnFilters)) {
41
64
  layout.ColumnFilters = l.ColumnFilters.map((columnFilter) => {
42
65
  const filter = {
@@ -112,6 +135,7 @@ function mapOldTypeToDataType(previousType) {
112
135
  return 'unknown';
113
136
  }
114
137
  }
138
+ exports.mapOldTypeToDataType = mapOldTypeToDataType;
115
139
  class VersionUpgrade20 extends VersionUpgrade_1.VersionUpgrade {
116
140
  migrateState(state) {
117
141
  this.migrateLayoutState(state);