@adaptabletools/adaptable-cjs 20.0.0-canary.16 → 20.0.0-canary.18

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
  },
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: 1741870315145 || Date.now(),
6
- VERSION: "20.0.0-canary.16" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1741974531964 || Date.now(),
6
+ VERSION: "20.0.0-canary.18" || '--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,11 +1,11 @@
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.Columns) {
8
+ if (l.Columns && !l.EnablePivot) {
9
9
  layout.TableColumns = l.Columns;
10
10
  delete l.Columns;
11
11
  delete layout.PivotColumns;
@@ -24,6 +24,7 @@ function transition_pre_20(layout) {
24
24
  }
25
25
  if (l.EnablePivot) {
26
26
  layout.PivotColumns = l.PivotColumns || [];
27
+ delete l.Columns;
27
28
  delete layout.TableColumns;
28
29
  delete l.EnablePivot;
29
30
  if (l.AggregationColumns) {
@@ -134,6 +135,7 @@ function mapOldTypeToDataType(previousType) {
134
135
  return 'unknown';
135
136
  }
136
137
  }
138
+ exports.mapOldTypeToDataType = mapOldTypeToDataType;
137
139
  class VersionUpgrade20 extends VersionUpgrade_1.VersionUpgrade {
138
140
  migrateState(state) {
139
141
  this.migrateLayoutState(state);