@adaptabletools/adaptable 20.0.0-canary.16 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "20.0.0-canary.16",
3
+ "version": "20.0.0-canary.17",
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",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@finos/fdc3": "2.1.0",
41
41
  "@infinite-table/infinite-react": "6.2.5",
42
- "date-fns": "^2.28.0",
42
+ "date-fns": "^4.1.0",
43
43
  "lodash": "^4.17.15",
44
44
  "normalize.css": "^8.0.1",
45
45
  "prop-types": "^15.6.2",
@@ -1,16 +1,16 @@
1
- import isAfter from 'date-fns/isAfter';
2
- import isBefore from 'date-fns/isBefore';
3
- import isEqual from 'date-fns/isEqual';
4
- import isFuture from 'date-fns/isFuture';
5
- import isPast from 'date-fns/isPast';
6
- import isSameDay from 'date-fns/isSameDay';
7
- import isThisMonth from 'date-fns/isThisMonth';
8
- import isThisQuarter from 'date-fns/isThisQuarter';
9
- import isThisWeek from 'date-fns/isThisWeek';
10
- import isThisYear from 'date-fns/isThisYear';
11
- import isToday from 'date-fns/isToday';
12
- import isTomorrow from 'date-fns/isTomorrow';
13
- import isYesterday from 'date-fns/isYesterday';
1
+ import { isAfter } from 'date-fns';
2
+ import { isBefore } from 'date-fns';
3
+ import { isEqual } from 'date-fns';
4
+ import { isFuture } from 'date-fns';
5
+ import { isPast } from 'date-fns';
6
+ import { isSameDay } from 'date-fns';
7
+ import { isThisMonth } from 'date-fns';
8
+ import { isThisQuarter } from 'date-fns';
9
+ import { isThisWeek } from 'date-fns';
10
+ import { isThisYear } from 'date-fns';
11
+ import { isToday } from 'date-fns';
12
+ import { isTomorrow } from 'date-fns';
13
+ import { isYesterday } from 'date-fns';
14
14
  import StringExtensions from '../../Utilities/Extensions/StringExtensions';
15
15
  import { parseDateValue } from '../../Utilities/Helpers/DateHelper';
16
16
  import Helper from '../../Utilities/Helpers/Helper';
@@ -1,7 +1,7 @@
1
1
  import * as Redux from 'redux';
2
2
  import * as PluginsRedux from '../ActionsReducers/PluginsRedux';
3
3
  import * as PopupRedux from '../ActionsReducers/PopupRedux';
4
- import { PROGRESS_INDICATOR_HIDE, PROGRESS_INDICATOR_SHOW, } from '../ActionsReducers/PopupRedux';
4
+ import { PROGRESS_INDICATOR_HIDE, PROGRESS_INDICATOR_SHOW } from '../ActionsReducers/PopupRedux';
5
5
  import { createEngine as createEngineLocal } from './AdaptableReduxLocalStorageEngine';
6
6
  import { mergeReducer } from './AdaptableReduxMerger';
7
7
  import { isAdaptableCellChangedAlert, isAdaptableRowChangedAlert, } from '../../PredefinedConfig/Common/AdaptableAlert';
@@ -2,7 +2,7 @@ import { ExpressionEvaluationError } from '../../parser/src/ExpressionEvaluation
2
2
  import { SumArray } from '../Extensions/ArrayExtensions';
3
3
  import { getTypedKeys } from '../Extensions/TypeExtensions';
4
4
  import { extractColumnParameter, extractColumnParameters, extractParameter, getNumericValue, handleColumnFunction, validateColumnType, } from './expressionFunctionUtils';
5
- import isAfter from 'date-fns/isAfter';
5
+ import { isAfter } from 'date-fns';
6
6
  import { parseDateValue } from '../Helpers/DateHelper';
7
7
  export const aggregatedExpressionFunctions = [
8
8
  'SUM',
@@ -1,6 +1,6 @@
1
- import isAfter from 'date-fns/isAfter';
2
- import isBefore from 'date-fns/isBefore';
3
- import isEqual from 'date-fns/isEqual';
1
+ import { isAfter } from 'date-fns';
2
+ import { isBefore } from 'date-fns';
3
+ import { isEqual } from 'date-fns';
4
4
  import { ExpressionEvaluationError } from '../../parser/src/ExpressionEvaluationError';
5
5
  import { getStringValue, getStringValues } from './expressionFunctionUtils';
6
6
  import { getTypedKeys } from '../Extensions/TypeExtensions';
@@ -1,17 +1,17 @@
1
1
  import { ExpressionEvaluationError } from '../../parser/src/ExpressionEvaluationError';
2
- import parseISO from 'date-fns/parseISO';
3
- import startOfDay from 'date-fns/startOfDay';
4
- import startOfWeek from 'date-fns/startOfWeek';
5
- import startOfMonth from 'date-fns/startOfMonth';
6
- import startOfYear from 'date-fns/startOfYear';
7
- import addDays from 'date-fns/addDays';
8
- import addWeeks from 'date-fns/addWeeks';
9
- import addMonths from 'date-fns/addMonths';
10
- import addYears from 'date-fns/addYears';
11
- import differenceInDays from 'date-fns/differenceInDays';
12
- import differenceInWeeks from 'date-fns/differenceInWeeks';
13
- import differenceInMonths from 'date-fns/differenceInMonths';
14
- import differenceInYears from 'date-fns/differenceInYears';
2
+ import { parseISO } from 'date-fns';
3
+ import { startOfDay } from 'date-fns';
4
+ import { startOfWeek } from 'date-fns';
5
+ import { startOfMonth } from 'date-fns';
6
+ import { startOfYear } from 'date-fns';
7
+ import { addDays } from 'date-fns';
8
+ import { addWeeks } from 'date-fns';
9
+ import { addMonths } from 'date-fns';
10
+ import { addYears } from 'date-fns';
11
+ import { differenceInDays } from 'date-fns';
12
+ import { differenceInWeeks } from 'date-fns';
13
+ import { differenceInMonths } from 'date-fns';
14
+ import { differenceInYears } from 'date-fns';
15
15
  import { evaluateExpressionNode, getNumericValue, isTextSearchCaseInsensitive, } from './expressionFunctionUtils';
16
16
  import { normalizeDateParams } from './dateUtils';
17
17
  import StringExtensions from '../Extensions/StringExtensions';
@@ -1,5 +1,4 @@
1
- import parseISO from 'date-fns/parseISO';
2
- import parse from 'date-fns/parse';
1
+ import { parseISO, parse } from 'date-fns';
3
2
  import { DateFormatter } from './FormatHelper';
4
3
  import { AdaptableLogger } from '../../agGrid/AdaptableLogger';
5
4
  export const isValidDate = (date) => {
@@ -1,6 +1,5 @@
1
1
  // TODO inspect why the following is erroring on angular build
2
- // import dateFnsFormat from 'date-fns/format';
3
- import dateFnsFormat from 'date-fns/format';
2
+ import { format as dateFnsFormat } from 'date-fns';
4
3
  import { sentenceCase } from 'sentence-case';
5
4
  import { DEFAULT_DATE_FORMAT_PATTERN } from '../Constants/GeneralConstants';
6
5
  import Helper from './Helper';
@@ -8,7 +8,7 @@ import * as CommentsRedux from '../../Redux/ActionsReducers/CommentsRedux';
8
8
  import { CommentsAndNotesSelector } from '../../Redux/ActionsReducers/InternalRedux';
9
9
  import { useAdaptable } from '../AdaptableContext';
10
10
  import AdaptableInput from '../Components/AdaptableInput';
11
- import dateFnsFormat from 'date-fns/format';
11
+ import FormatHelper from '../../Utilities/Helpers/FormatHelper';
12
12
  // Edit Mode
13
13
  // [author] [edit, delete]
14
14
  // [text-editor] * this is different
@@ -48,6 +48,9 @@ export const CommentsEditor = (props) => {
48
48
  if (!commentThread) {
49
49
  return null;
50
50
  }
51
+ const formatDate = (date, format) => {
52
+ return FormatHelper.DateFormatter(date, { Pattern: format });
53
+ };
51
54
  return (React.createElement(Panel, { color: "var(--ab-color-text-on-primary)", onClick: () => props.enableEditMode(), minWidth: 250, className: "ab-CommentPopup", onKeyDown: (event) => {
52
55
  if (event.key === 'Escape') {
53
56
  api.commentApi.hideCommentsPopup();
@@ -75,7 +78,7 @@ export const CommentsEditor = (props) => {
75
78
  React.createElement(Flex, { mb: 2, alignItems: "center" },
76
79
  React.createElement(Box, null,
77
80
  React.createElement(Box, { "data-name": "comment-username", fontSize: 3, fontWeight: "bold" }, comment?.Author?.UserName),
78
- comment.Timestamp && (React.createElement(Box, { "data-name": "comment-timestamp", fontSize: 2 }, dateFnsFormat(comment.Timestamp, api.commentApi.internalApi.getCommentsDateFormat())))),
81
+ comment.Timestamp && (React.createElement(Box, { "data-name": "comment-timestamp", fontSize: 2 }, formatDate(comment.Timestamp, api.commentApi.internalApi.getCommentsDateFormat())))),
79
82
  React.createElement(Box, { flex: 1 }),
80
83
  React.createElement(SimpleButton, { variant: "text", icon: "edit", disabled: !isOwnComment || isReadOnlyModule, onClick: () => setActiveEditingComment(comment.Uuid) }),
81
84
  React.createElement(SimpleButton, { variant: "text", icon: "delete", disabled: !isOwnComment || isReadOnlyModule, onClick: () => {
@@ -3,10 +3,10 @@ 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 dateFnsFormat from 'date-fns/format';
7
6
  import { useAdaptable } from '../AdaptableContext';
8
7
  import { PopupPanel } from '../Components/Popups/AdaptablePopup/PopupPanel';
9
8
  import { AdaptableButtonComponent } from '../Components/AdaptableButton';
9
+ import FormatHelper from '../../Utilities/Helpers/FormatHelper';
10
10
  const tableDOMProps = {
11
11
  style: {
12
12
  minHeight: 160,
@@ -16,6 +16,9 @@ const tableDOMProps = {
16
16
  const CellComments = (props) => {
17
17
  const adaptable = useAdaptable();
18
18
  const isReadOnlyModule = adaptable.api.entitlementApi.getEntitlementAccessLevelForModule('Comment') === 'ReadOnly';
19
+ const formatDate = (date, format) => {
20
+ return FormatHelper.DateFormatter(date, { Pattern: format });
21
+ };
19
22
  const columnsMap = React.useMemo(() => {
20
23
  const columns = {
21
24
  author: {
@@ -27,7 +30,7 @@ const CellComments = (props) => {
27
30
  field: 'Timestamp',
28
31
  maxWidth: 150,
29
32
  valueGetter: (params) => {
30
- return dateFnsFormat(params.data.Timestamp, adaptable.api.commentApi.internalApi.getCommentsDateFormat());
33
+ return formatDate(params.data.Timestamp, adaptable.api.commentApi.internalApi.getCommentsDateFormat());
31
34
  },
32
35
  },
33
36
  text: {
@@ -67,7 +67,7 @@ export const qlPredicateToString = (qlPredicate, predicateDefs) => {
67
67
  return str;
68
68
  };
69
69
  export const isPredicateEmpty = (predicate, predicateDef) => {
70
- if (!predicateDef.inputs || predicateDef.inputs.length === 0) {
70
+ if (!predicateDef?.inputs || predicateDef.inputs.length === 0) {
71
71
  return false;
72
72
  }
73
73
  return (!predicate ||
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { StringExtensions } from '../../../Utilities/Extensions/StringExtensions';
3
- import isDatesEqual from 'date-fns/isEqual';
3
+ import { isEqual } from 'date-fns';
4
4
  import { parseDateValue } from '../../../Utilities/Helpers/DateHelper';
5
5
  import join from '../../../components/utils/join';
6
6
  import { Select } from '../../../components/Select';
@@ -13,7 +13,7 @@ export const ColumnValuesSelect = (props) => {
13
13
  let isActive = selectedColumnValues.indexOf(distinctValue.value) >= 0;
14
14
  // special case for date objects, need to check against string values
15
15
  if (!isActive && distinctValue.value && distinctValue.value instanceof Date) {
16
- isActive = selectedColumnValues.some((dateStr) => isDatesEqual(parseDateValue(dateStr), parseDateValue(distinctValue.value)));
16
+ isActive = selectedColumnValues.some((dateStr) => isEqual(parseDateValue(dateStr), parseDateValue(distinctValue.value)));
17
17
  }
18
18
  const columnLabel = distinctValue.label;
19
19
  if (StringExtensions.IsNullOrEmpty(columnLabel)) {
@@ -2,11 +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';
6
5
  import { useAdaptable } from '../AdaptableContext';
7
6
  import { AdaptableButtonComponent } from '../Components/AdaptableButton';
8
7
  import { PopupPanel } from '../Components/Popups/AdaptablePopup/PopupPanel';
9
8
  import StringExtensions from '../../Utilities/Extensions/StringExtensions';
9
+ import FormatHelper from '../../Utilities/Helpers/FormatHelper';
10
10
  const tableDOMProps = {
11
11
  style: {
12
12
  height: '100%',
@@ -21,6 +21,9 @@ export const NotePopup = (props) => {
21
21
  : StringExtensions.Humanize(adaptable.adaptableOptions.primaryKey);
22
22
  const allNotes = useSelector((state) => GetAllNotesSelector(state.Note));
23
23
  const isReadOnlyModule = adaptable.api.entitlementApi.getEntitlementAccessLevelForModule('Note') === 'ReadOnly';
24
+ const formatDate = (date, format) => {
25
+ return FormatHelper.DateFormatter(date, { Pattern: format });
26
+ };
24
27
  const columnsMap = React.useMemo(() => {
25
28
  const columns = {
26
29
  primaryKey: {
@@ -43,7 +46,7 @@ export const NotePopup = (props) => {
43
46
  timestamp: {
44
47
  field: 'Timestamp',
45
48
  valueGetter: (params) => {
46
- return dateFnsFormat(params.data.Timestamp, adaptable.api.noteApi.internalApi.getNotesDateFormat());
49
+ return formatDate(params.data.Timestamp, adaptable.api.noteApi.internalApi.getNotesDateFormat());
47
50
  },
48
51
  },
49
52
  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 {};
@@ -96,6 +96,7 @@ import { isPivotLayoutModel } from '../layout-manager/src/isPivotLayoutModel';
96
96
  import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, } from '../PredefinedConfig/Common/AdaptableColumn';
97
97
  import { agGridDataTypeDefinitions } from './agGridDataTypeDefinitions';
98
98
  import { AgGridThemeAdapter } from './AgGridThemeAdapter';
99
+ import { mapOldTypeToDataType } from '../migration/VersionUpgrade20';
99
100
  const LocalEventService_Prototype = LocalEventService.prototype;
100
101
  const LocalEventService_dispatchEvent = LocalEventService_Prototype.dispatchEvent;
101
102
  LocalEventService_Prototype.dispatchEvent = function (event) {
@@ -356,6 +357,7 @@ export class AdaptableAgGrid {
356
357
  // AG Grid evaluates early on the floatingFilter params, so we need to "suppres" the floating filter temporarily
357
358
  // we will reset it once Adaptable is ready
358
359
  this.agGridColumnAdapter.setupColumnFloatingFilterTemporarily(gridOptions);
360
+ this.validateColumnDefTypes(gridOptions.columnDefs);
359
361
  const agGridApi = await this.initializeAgGrid(gridOptions, config.modules, config.renderAgGridFrameworkComponent);
360
362
  if (agGridApi === false) {
361
363
  this.midwayDestroy();
@@ -3288,4 +3290,24 @@ You need to define at least one Layout!`);
3288
3290
  this.__prevLayoutForOnChange = layout;
3289
3291
  this.api.layoutApi.createOrUpdateLayout(layout);
3290
3292
  }
3293
+ validateColumnDefTypes(columnDefs) {
3294
+ // in Adaptable version 20 we switched from colDef.type to colDef.cellDataType
3295
+ // 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
3296
+ columnDefs.forEach((colDef) => {
3297
+ if (colDef.children?.length) {
3298
+ this.validateColumnDefTypes(colDef.children);
3299
+ }
3300
+ const columnDefinition = colDef;
3301
+ const colDefType = columnDefinition.type;
3302
+ const colDefTypes = typeof colDefType === 'string' ? [colDefType] : colDefType || [];
3303
+ colDefTypes
3304
+ .filter((colType) => colType.startsWith('abColDef'))
3305
+ .forEach((colType) => {
3306
+ const newValidCellDataType = mapOldTypeToDataType(colType);
3307
+ if (newValidCellDataType) {
3308
+ 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}` : ''}`);
3309
+ }
3310
+ });
3311
+ });
3312
+ }
3291
3313
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import parseISO from 'date-fns/parseISO';
2
+ import { parseISO } from 'date-fns';
3
3
  import useProperty from '../../../components/utils/useProperty';
4
4
  import AdaptableInput from '../../../View/Components/AdaptableInput';
5
5
  import { DatepickerContext } from '../../../components/Datepicker/DatepickerContext';
@@ -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;
@@ -9,7 +9,7 @@ import { DateFormatter } from '../../Utilities/Helpers/FormatHelper';
9
9
  import { useDatepickerContext } from './DatepickerContext';
10
10
  import { DayPicker } from 'react-day-picker';
11
11
  import { AdaptableDateInlineInput } from '../../View/Components/AdaptableInput/AdaptableDateInlineInput';
12
- import { isValid, addYears, endOfYear, startOfYear, addDays, addBusinessDays } from 'date-fns';
12
+ import { isValid, addYears, endOfYear, startOfYear, addDays, addBusinessDays, } from 'date-fns';
13
13
  const DatepickerOverlay = ({ onHide, children, onKeyDown, onMouseDown, }) => {
14
14
  const domRef = React.useRef(null);
15
15
  return (React.createElement("div", { className: "ab-Datepicker-Overlay", ref: domRef, onKeyDown: onKeyDown, onMouseDown: onMouseDown, onBlur: (e) => {
@@ -35,7 +35,7 @@ const INFINITE_COLUMNS_WITH_CHECKBOX = {
35
35
  renderHeader: (headerParams) => {
36
36
  return (React.createElement(React.Fragment, null,
37
37
  headerParams.renderBag.selectionCheckBox,
38
- headerParams.allRowsSelected ? 'Deselect All' : 'Select All'));
38
+ headerParams.allRowsSelected ? '(Deselect All)' : '(Select All)'));
39
39
  },
40
40
  renderMenuIcon: false,
41
41
  },
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  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" || '',
3
- PUBLISH_TIMESTAMP: 1741870286789 || Date.now(),
4
- VERSION: "20.0.0-canary.16" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1741946418887 || Date.now(),
4
+ VERSION: "20.0.0-canary.17" || '--current-version--',
5
5
  };
@@ -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;
@@ -2,7 +2,7 @@ import { VersionUpgrade } from './VersionUpgrade';
2
2
  import { ALL_ADAPTABLE_DATA_TYPES } from '../agGrid/agGridDataTypeDefinitions';
3
3
  function transition_pre_20(layout) {
4
4
  const l = layout;
5
- if (l.Columns) {
5
+ if (l.Columns && !l.EnablePivot) {
6
6
  layout.TableColumns = l.Columns;
7
7
  delete l.Columns;
8
8
  delete layout.PivotColumns;
@@ -21,6 +21,7 @@ function transition_pre_20(layout) {
21
21
  }
22
22
  if (l.EnablePivot) {
23
23
  layout.PivotColumns = l.PivotColumns || [];
24
+ delete l.Columns;
24
25
  delete layout.TableColumns;
25
26
  delete l.EnablePivot;
26
27
  if (l.AggregationColumns) {
@@ -95,7 +96,7 @@ function transition_pre_20(layout) {
95
96
  function hasUpToDateDataType(dataType) {
96
97
  return ALL_ADAPTABLE_DATA_TYPES.includes(dataType);
97
98
  }
98
- function mapOldTypeToDataType(previousType) {
99
+ export function mapOldTypeToDataType(previousType) {
99
100
  if (ALL_ADAPTABLE_DATA_TYPES.includes(previousType)) {
100
101
  return previousType;
101
102
  }