@adaptabletools/adaptable 21.0.0-canary.8 → 21.0.1

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": "21.0.0-canary.8",
3
+ "version": "21.0.1",
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",
@@ -20,7 +20,7 @@ export interface LayoutOptions {
20
20
  /**
21
21
  * Default properties to apply when creating a new Layout (Table or Pivot)
22
22
  */
23
- defaultLayoutProperties?: DefaultLayoutProperties | ((context: DefaultLayoutPropertiesContext) => DefaultTableLayoutProperties | DefaultPivotLayoutProperties);
23
+ layoutCreationDefaultProperties?: LayoutCreationDefaultProperties | ((context: LayoutCreationDefaultPropertiesContext) => TableLayoutCreationDefaultProperties | PivotLayoutCreationDefaultProperties);
24
24
  }
25
25
  /**
26
26
  * Options for managing Tags in Layouts (used to enhance Layouts)
@@ -100,28 +100,28 @@ export interface PivotPreviewColumnsContext extends BaseContext {
100
100
  /**
101
101
  * Default properties to apply when creating a new Table Layout
102
102
  */
103
- export type DefaultTableLayoutProperties = Partial<Omit<TableLayout, 'Name'>>;
103
+ export type TableLayoutCreationDefaultProperties = Partial<Omit<TableLayout, 'Name'>>;
104
104
  /**
105
105
  * Default properties to apply when creating a new Pivot Layout
106
106
  */
107
- export type DefaultPivotLayoutProperties = Partial<Omit<PivotLayout, 'Name'>>;
107
+ export type PivotLayoutCreationDefaultProperties = Partial<Omit<PivotLayout, 'Name'>>;
108
108
  /**
109
109
  * Default properties to apply when creating a new Layout (Table or Pivot)
110
110
  */
111
- export interface DefaultLayoutProperties {
111
+ export interface LayoutCreationDefaultProperties {
112
112
  /**
113
113
  * Default properties to apply when creating a new Table Layout
114
114
  */
115
- tableLayout?: DefaultTableLayoutProperties;
115
+ tableLayout?: TableLayoutCreationDefaultProperties;
116
116
  /**
117
117
  * Default properties to apply when creating a new Pivot Layout
118
118
  */
119
- pivotLayout?: DefaultPivotLayoutProperties;
119
+ pivotLayout?: PivotLayoutCreationDefaultProperties;
120
120
  }
121
121
  /**
122
- * Context for `LayoutOptions.defaultLayoutProperties` function
122
+ * Context for `LayoutOptions.layoutCreationDefaultProperties` function
123
123
  */
124
- export interface DefaultLayoutPropertiesContext extends BaseContext {
124
+ export interface LayoutCreationDefaultPropertiesContext extends BaseContext {
125
125
  /**
126
126
  * Type of Layout ('table' | 'pivot')
127
127
  */
@@ -26,13 +26,21 @@ export const SystemPredicateDefs = [
26
26
  moduleScope: ['columnFilter', 'flashingcell', 'formatColumn', 'alert', 'badgeStyle'],
27
27
  handler: (context) => {
28
28
  const { inputs = [], column, value, adaptableApi } = context;
29
- const predicateInputs = (context.inputs || []).reduce((acc, input) => {
30
- const predicate = adaptableApi.predicateApi.getPredicateDefById(input);
31
- if (predicate) {
32
- acc.push(predicate);
29
+ const predicateInputs = (context.inputs || [])
30
+ .map((input) => {
31
+ const predicateInput = adaptableApi.predicateApi.getPredicateDefById(input);
32
+ if (!predicateInput) {
33
+ return;
33
34
  }
34
- return acc;
35
- }, []);
35
+ if (adaptableApi.columnScopeApi.isScopeInScope(predicateInput.columnScope,
36
+ // 'In' ColumnScope
37
+ {
38
+ DataTypes: ['text', 'number', 'date', 'textArray', 'numberArray'],
39
+ })) {
40
+ return predicateInput;
41
+ }
42
+ })
43
+ .filter(Boolean);
36
44
  if (predicateInputs.length) {
37
45
  const nestedContext = { ...context };
38
46
  delete nestedContext.inputs;
@@ -99,13 +107,21 @@ export const SystemPredicateDefs = [
99
107
  moduleScope: ['columnFilter', 'flashingcell', 'formatColumn', 'alert', 'badgeStyle'],
100
108
  handler: (context) => {
101
109
  const { inputs, column, value, adaptableApi } = context;
102
- const predicateInputs = context.inputs.reduce((acc, input) => {
103
- const predicate = adaptableApi.predicateApi.getPredicateDefById(input);
104
- if (predicate) {
105
- acc.push(predicate);
110
+ const predicateInputs = (context.inputs || [])
111
+ .map((input) => {
112
+ const predicateInput = adaptableApi.predicateApi.getPredicateDefById(input);
113
+ if (!predicateInput) {
114
+ return;
115
+ }
116
+ if (adaptableApi.columnScopeApi.isScopeInScope(predicateInput.columnScope,
117
+ // 'NotIn' ColumnScope
118
+ {
119
+ DataTypes: ['text', 'number', 'date', 'textArray', 'numberArray'],
120
+ })) {
121
+ return predicateInput;
106
122
  }
107
- return acc;
108
- }, []);
123
+ })
124
+ .filter(Boolean);
109
125
  if (predicateInputs.length) {
110
126
  const nestedContext = { ...context };
111
127
  delete nestedContext.inputs;
@@ -89,7 +89,7 @@ export interface LayoutBase extends AdaptableObject {
89
89
  */
90
90
  export interface TableLayout extends LayoutBase {
91
91
  /**
92
- * Names of Columns to include in the Table Layout
92
+ * List of Column Ids to include in Table Layout
93
93
  */
94
94
  TableColumns: string[];
95
95
  /**
@@ -97,7 +97,7 @@ export interface TableLayout extends LayoutBase {
97
97
  */
98
98
  ColumnVisibility?: ColumnBooleanFalseMap;
99
99
  /**
100
- * Row Summaries - Pinned Rows that display Aggregation Info for a whole column
100
+ * Pinned Rows that display Aggregation Info for a whole Column
101
101
  */
102
102
  RowSummaries?: RowSummary[];
103
103
  /**
@@ -133,7 +133,7 @@ export class PredicateApiImpl extends ApiBase {
133
133
  });
134
134
  }
135
135
  catch (error) {
136
- console.error(`Error in predicate ${predicateDef.label}`, error);
136
+ this.logError(`Error in predicate ${predicateDef.label}`, error);
137
137
  return false;
138
138
  }
139
139
  }
@@ -1,10 +1,7 @@
1
- import { Layout, LayoutBase, PivotLayout, TableLayout } from '../../AdaptableState/LayoutState';
1
+ import { Layout, LayoutBase } from '../../AdaptableState/LayoutState';
2
2
  import { ApiBase } from '../Implementation/ApiBase';
3
- import { ColDef, ColGroupDef } from 'ag-grid-enterprise';
4
3
  import { LayoutExtensionObject, LayoutExtensionModule } from '../../types';
5
4
  export declare class LayoutInternalApi extends ApiBase {
6
- getNormalizedLayout(layout: TableLayout | PivotLayout): TableLayout | PivotLayout;
7
- sortColumnDefsByPivotAggregationOrder(columnDefs: (ColDef | ColGroupDef)[], pivotAggregationColumns: PivotLayout['PivotAggregationColumns']): (ColDef | ColGroupDef)[];
8
5
  /**
9
6
  * Compares 2 Layouts for equality
10
7
  * @param layout1 First Layout
@@ -35,6 +32,6 @@ export declare class LayoutInternalApi extends ApiBase {
35
32
  buildInitialLayout(providedLayout: Partial<Layout> & {
36
33
  Name: string;
37
34
  }, type?: 'table' | 'pivot'): Layout;
38
- private getDefaultLayoutProperties;
35
+ private getLayoutCreationDefaultProperties;
39
36
  cloneLayout(layoutToClone: Layout): Omit<Layout, 'Name'>;
40
37
  }
@@ -1,74 +1,11 @@
1
1
  import { ColumnFilterModuleId, GridFilterModuleId, } from '../../Utilities/Constants/ModuleConstants';
2
2
  import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
3
3
  import { ApiBase } from '../Implementation/ApiBase';
4
- import { areLayoutsEqual, isPivotLayout, normalizeLayout } from '../Implementation/LayoutHelpers';
4
+ import { areLayoutsEqual, isPivotLayout } from '../Implementation/LayoutHelpers';
5
5
  import ObjectFactory from '../../Utilities/ObjectFactory';
6
6
  import Helper from '../../Utilities/Helpers/Helper';
7
7
  import AdaptableHelper from '../../Utilities/Helpers/AdaptableHelper';
8
8
  export class LayoutInternalApi extends ApiBase {
9
- getNormalizedLayout(layout) {
10
- return normalizeLayout(layout);
11
- }
12
- sortColumnDefsByPivotAggregationOrder(columnDefs, pivotAggregationColumns) {
13
- if (!pivotAggregationColumns.length) {
14
- return columnDefs;
15
- }
16
- let sortPivotAggColsToIndexes = null;
17
- let sortPivotAggColsIndexToColId = null;
18
- // because aggrid does not respect the aggregation order provided by the layout
19
- // we have to sort the coldefs
20
- // see the test at #keep-initial-aggregation-order
21
- sortPivotAggColsIndexToColId = {};
22
- sortPivotAggColsToIndexes = pivotAggregationColumns.reduce((acc, colDef, index) => {
23
- acc[colDef.ColumnId] = index;
24
- sortPivotAggColsIndexToColId[index] = colDef.ColumnId;
25
- return acc;
26
- }, {});
27
- let currentColIndex = 0;
28
- const colIdsToIndexes = {};
29
- function colIdToIndex(colDef) {
30
- if (colDef.children) {
31
- colDef.children.forEach(colIdToIndex);
32
- }
33
- else {
34
- colIdsToIndexes[colDef.colId] = currentColIndex;
35
- currentColIndex++;
36
- }
37
- }
38
- columnDefs.forEach(colIdToIndex);
39
- const initialColIdsToIndexes = { ...colIdsToIndexes };
40
- let currentAggIndex = 0;
41
- Object.keys(colIdsToIndexes).forEach((colId) => {
42
- if (sortPivotAggColsToIndexes[colId] !== undefined) {
43
- // this column is used in aggregation
44
- // assume we have cols: a,b,X,c,Y - X and Y are used in the pivot aggregation - but the agg order is Y,X
45
- // so the current indexes are 0 1 2 3 4 - but we should have
46
- // 0 1 4 2 3 - because we want to swap X and Y so they are in the order in which they are used in the pivot aggregation
47
- const columnAtCurrentAggIndex = sortPivotAggColsIndexToColId[currentAggIndex];
48
- const newIndex = initialColIdsToIndexes[columnAtCurrentAggIndex];
49
- colIdsToIndexes[colId] = newIndex;
50
- currentAggIndex++;
51
- }
52
- });
53
- const sortFn = (colDefA, colDefB) => {
54
- if (colDefA.children || colDefB.children) {
55
- if (colDefA.children) {
56
- colDefA.children.sort(sortFn);
57
- }
58
- if (colDefB.children) {
59
- colDefB.children.sort(sortFn);
60
- }
61
- return 0;
62
- }
63
- const defA = colDefA;
64
- const defB = colDefB;
65
- const indexA = colIdsToIndexes[defA.colId];
66
- const indexB = colIdsToIndexes[defB.colId];
67
- return indexA - indexB;
68
- };
69
- columnDefs.sort(sortFn);
70
- return columnDefs;
71
- }
72
9
  /**
73
10
  * Compares 2 Layouts for equality
74
11
  * @param layout1 First Layout
@@ -216,27 +153,27 @@ export class LayoutInternalApi extends ApiBase {
216
153
  const initialEmptyLayout = layoutType === 'pivot'
217
154
  ? ObjectFactory.CreateEmptyPivotLayout({ ...providedPivotLayout })
218
155
  : ObjectFactory.CreateEmptyTableLayout({ ...providedTableLayout });
219
- const defaultLayoutProperties = this.getDefaultLayoutProperties(layoutType);
156
+ const defaultLayoutProperties = this.getLayoutCreationDefaultProperties(layoutType);
220
157
  const initialLayout = {
221
158
  ...initialEmptyLayout,
222
159
  ...defaultLayoutProperties,
223
160
  };
224
161
  return initialLayout;
225
162
  }
226
- getDefaultLayoutProperties(layoutType) {
227
- const defaultLayoutPropertiesOption = this.getLayoutOptions().defaultLayoutProperties;
228
- if (typeof defaultLayoutPropertiesOption === 'object') {
163
+ getLayoutCreationDefaultProperties(layoutType) {
164
+ const layoutCreationDefPropsOption = this.getLayoutOptions().layoutCreationDefaultProperties;
165
+ if (typeof layoutCreationDefPropsOption === 'object') {
229
166
  const initialProps = layoutType === 'table'
230
- ? defaultLayoutPropertiesOption.tableLayout
231
- : defaultLayoutPropertiesOption.pivotLayout;
167
+ ? layoutCreationDefPropsOption.tableLayout
168
+ : layoutCreationDefPropsOption.pivotLayout;
232
169
  return initialProps;
233
170
  }
234
- if (typeof defaultLayoutPropertiesOption === 'function') {
171
+ if (typeof layoutCreationDefPropsOption === 'function') {
235
172
  const context = {
236
173
  layoutType,
237
174
  ...this.getAdaptableInternalApi().buildBaseContext(),
238
175
  };
239
- return defaultLayoutPropertiesOption(context);
176
+ return layoutCreationDefPropsOption(context);
240
177
  }
241
178
  return {};
242
179
  }
@@ -46,6 +46,11 @@ export interface PredicateApi {
46
46
  * @param predicate Predicate Definition to stringify
47
47
  */
48
48
  predicateToString(predicate: AdaptablePredicate): string;
49
+ /**
50
+ * Stringifies a list of Predicate Definitions, using the given logical operator (AND/OR)
51
+ * @param predicates List of Predicate Definitions to stringify
52
+ * @param logicalOperator Logical operator to use to join the stringified Predicates (default AND)
53
+ */
49
54
  predicatesToString(predicates: AdaptablePredicate[], logicalOperator?: string): string;
50
55
  /**
51
56
  * Checks whether a given Predicate Definition is valid
@@ -97,9 +97,10 @@ export function DateFormatter(input, options, strictFormatting = false) {
97
97
  return undefined;
98
98
  }
99
99
  try {
100
- // not sure if this is right if using a custom formatter...
101
100
  if (typeof input === 'string') {
102
- input = new Date(input);
101
+ // Remove timezone info (e.g., Z or +02:00) using regex
102
+ const cleanDateString = input.replace(/([+-]\d{2}:\d{2}|Z)$/, '');
103
+ input = new Date(cleanDateString);
103
104
  }
104
105
  return dateFnsFormat(input, options?.Pattern || DEFAULT_DATE_FORMAT_PATTERN);
105
106
  }
@@ -22,6 +22,11 @@ export class ModuleService {
22
22
  logMissingAgGridDepsInfos() {
23
23
  // log missing core (required) AG Grid dependencies
24
24
  const agGridModulesAdapter = this.adaptableApi.internalApi.getAgGridModulesAdapter();
25
+ if (agGridModulesAdapter.isAgGridModuleRegistered('AllEnterpriseModule')) {
26
+ // no need to check further if AllEnterprise is registered
27
+ // it may even trigger false positives (e.g. when using SSRM)
28
+ return;
29
+ }
25
30
  const mandatoryAgGridModuleNames = agGridModulesAdapter.getMandatoryAgGridModuleNames();
26
31
  const registeredAgGridModuleNames = agGridModulesAdapter.getAgGridRegisteredModuleNames();
27
32
  const missingAgGridModuleNames = mandatoryAgGridModuleNames.filter((moduleName) => !registeredAgGridModuleNames.includes(moduleName));
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: 1757350937288 || Date.now(),
4
- VERSION: "21.0.0-canary.8" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1758028360767 || Date.now(),
4
+ VERSION: "21.0.1" || '--current-version--',
5
5
  };
@@ -3021,33 +3021,6 @@ export declare const ADAPTABLE_METAMODEL: {
3021
3021
  kind: string;
3022
3022
  desc: string;
3023
3023
  };
3024
- DefaultLayoutProperties: {
3025
- name: string;
3026
- kind: string;
3027
- desc: string;
3028
- props: {
3029
- name: string;
3030
- kind: string;
3031
- desc: string;
3032
- isOpt: boolean;
3033
- ref: string;
3034
- }[];
3035
- };
3036
- DefaultLayoutPropertiesContext: {
3037
- name: string;
3038
- kind: string;
3039
- desc: string;
3040
- props: {
3041
- name: string;
3042
- kind: string;
3043
- desc: string;
3044
- }[];
3045
- };
3046
- DefaultPivotLayoutProperties: {
3047
- name: string;
3048
- kind: string;
3049
- desc: string;
3050
- };
3051
3024
  DefaultPredicateFilterContext: {
3052
3025
  name: string;
3053
3026
  kind: string;
@@ -3064,11 +3037,6 @@ export declare const ADAPTABLE_METAMODEL: {
3064
3037
  ref: string;
3065
3038
  })[];
3066
3039
  };
3067
- DefaultTableLayoutProperties: {
3068
- name: string;
3069
- kind: string;
3070
- desc: string;
3071
- };
3072
3040
  DetailInitContext: {
3073
3041
  name: string;
3074
3042
  kind: string;
@@ -4249,6 +4217,28 @@ export declare const ADAPTABLE_METAMODEL: {
4249
4217
  ref?: undefined;
4250
4218
  })[];
4251
4219
  };
4220
+ LayoutCreationDefaultProperties: {
4221
+ name: string;
4222
+ kind: string;
4223
+ desc: string;
4224
+ props: {
4225
+ name: string;
4226
+ kind: string;
4227
+ desc: string;
4228
+ isOpt: boolean;
4229
+ ref: string;
4230
+ }[];
4231
+ };
4232
+ LayoutCreationDefaultPropertiesContext: {
4233
+ name: string;
4234
+ kind: string;
4235
+ desc: string;
4236
+ props: {
4237
+ name: string;
4238
+ kind: string;
4239
+ desc: string;
4240
+ }[];
4241
+ };
4252
4242
  LayoutExtendedConfig: {
4253
4243
  name: string;
4254
4244
  kind: string;
@@ -4707,6 +4697,11 @@ export declare const ADAPTABLE_METAMODEL: {
4707
4697
  ref?: undefined;
4708
4698
  })[];
4709
4699
  };
4700
+ PivotLayoutCreationDefaultProperties: {
4701
+ name: string;
4702
+ kind: string;
4703
+ desc: string;
4704
+ };
4710
4705
  PivotPreviewColumnsContext: {
4711
4706
  name: string;
4712
4707
  kind: string;
@@ -5895,6 +5890,11 @@ export declare const ADAPTABLE_METAMODEL: {
5895
5890
  ref?: undefined;
5896
5891
  })[];
5897
5892
  };
5893
+ TableLayoutCreationDefaultProperties: {
5894
+ name: string;
5895
+ kind: string;
5896
+ desc: string;
5897
+ };
5898
5898
  TeamSharingOptions: {
5899
5899
  name: string;
5900
5900
  kind: string;