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

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": "18.0.0-canary.20",
3
+ "version": "18.0.0-canary.21",
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",
@@ -10,7 +10,7 @@ import { SelectedCellInfo } from '../PredefinedConfig/Selection/SelectedCellInfo
10
10
  import { AdaptableTheme } from '../PredefinedConfig/ThemeState';
11
11
  import { IAdaptableStore } from '../Redux/Store/Interface/IAdaptableStore';
12
12
  import { IModuleCollection } from '../Strategy/Interface/IModule';
13
- import { AdaptableMenuItem, AdaptableOptions, AdaptablePlugin, ChartDefinition, SelectedRowInfo } from '../types';
13
+ import { AdaptableMenuItem, AdaptableOptions, AdaptablePlugin, AdaptableState, ChartDefinition, SelectedRowInfo } from '../types';
14
14
  import { ICalculatedColumnExpressionService } from '../Utilities/Services/Interface/ICalculatedColumnExpressionService';
15
15
  import { IDataService } from '../Utilities/Services/Interface/IDataService';
16
16
  import { CellPopupService } from '../Utilities/Services/CellPopupService';
@@ -265,4 +265,5 @@ export interface IAdaptable {
265
265
  canExportToExcel(): boolean;
266
266
  exportToExcel(reportData: ReportData, fileName: string): void;
267
267
  exportVisualDataToExcel(): void;
268
+ normalizeAdaptableState(state: AdaptableState, gridOptions: GridOptions): AdaptableState;
268
269
  }
@@ -65,12 +65,6 @@ export interface AdaptableOptions<TData = any> {
65
65
  * Commercial license key. If the license is not provided or is expired, various visual information notes will be displayed and some functionality may be limited.
66
66
  */
67
67
  licenseKey?: string;
68
- /**
69
- * Automatically migrate the state from the previous version of Adaptable to the current version.
70
- *
71
- * @defaultValue true
72
- */
73
- autoMigrateState?: boolean;
74
68
  /**
75
69
  * User State set at design-time and shipped with AdapTable for first use; can be `PredefinedConfig` object or url to file containing config
76
70
  *
@@ -12,7 +12,7 @@ export interface CommentOptions<TData = any> {
12
12
  */
13
13
  loadCommentThreads?(commentLoadContext: CommentLoadContext): Promise<CommentThread[]>;
14
14
  /**
15
- * Called when Comments change and need to be saved
15
+ * Saves changed Comments
16
16
  * @param commentThreads
17
17
  */
18
18
  persistCommentThreads?(commentThreads: CommentThread[]): void;
@@ -33,6 +33,12 @@ export interface StateOptions {
33
33
  * @defaultValue 400
34
34
  */
35
35
  debounceStateDelay?: number;
36
+ /**
37
+ * Automatically migrate the state from the previous version of Adaptable to the current version.
38
+ *
39
+ * @defaultValue true
40
+ */
41
+ autoMigrateState?: boolean;
36
42
  }
37
43
  /**
38
44
  * State Function Config object passed into all State Options functions (except 'applyState')
@@ -8,9 +8,9 @@ export interface CommentApi {
8
8
  * Add a Comment to a Comment Thread
9
9
  *
10
10
  * @param comment comment
11
- * @param address where the comment should be added
11
+ * @param cellAddress cell where comment is added
12
12
  */
13
- addComment(commentText: string, address: CellAddress): void;
13
+ addComment(commentText: string, cellAddress: CellAddress): void;
14
14
  /**
15
15
  * Edit a Comment
16
16
  *
@@ -133,6 +133,9 @@ export class ConfigApiImpl extends ApiBase {
133
133
  adaptable: this.adaptable,
134
134
  adaptableStateKey,
135
135
  predefinedConfig,
136
+ postLoadHook: (state) => {
137
+ return this.adaptable.normalizeAdaptableState(state, this.adaptable.agGridAdapter.getLiveGridOptions());
138
+ },
136
139
  });
137
140
  promise
138
141
  .then(() => {
@@ -526,11 +526,12 @@ export class GridApiImpl extends ApiBase {
526
526
  return this.getRowCount();
527
527
  }
528
528
  showTransposedView(transposeConfig = {}) {
529
- var _a, _b, _c, _d;
529
+ var _a, _b, _c, _d, _e;
530
530
  const transposedColumnId = (_a = transposeConfig.transposedColumnId) !== null && _a !== void 0 ? _a : this.getAdaptableApi().optionsApi.getPrimaryKey();
531
531
  const hideTransposedColumn = (_b = transposeConfig.hideTransposedColumn) !== null && _b !== void 0 ? _b : true;
532
532
  const visibleColumns = (_c = transposeConfig.visibleColumns) !== null && _c !== void 0 ? _c : false;
533
533
  const visibleRows = (_d = transposeConfig.visibleRows) !== null && _d !== void 0 ? _d : false;
534
+ const autosize = (_e = transposeConfig.autosize) !== null && _e !== void 0 ? _e : true;
534
535
  this.adaptable.api.internalApi.showPopupWindow({
535
536
  id: WINDOW_SHOW_TRANSPOSED_VIEW,
536
537
  factoryId: WINDOW_SHOW_TRANSPOSED_VIEW,
@@ -541,6 +542,7 @@ export class GridApiImpl extends ApiBase {
541
542
  hideTransposedColumn,
542
543
  visibleColumns,
543
544
  visibleRows,
545
+ autosize,
544
546
  },
545
547
  });
546
548
  }
@@ -16,6 +16,7 @@ export declare class ActionRowInternalApi extends ApiBase {
16
16
  private buildActionRowFields;
17
17
  private showColumnInActionRowForm;
18
18
  private buidActionRowButtons;
19
+ private prepareCreateData;
19
20
  private prepareEditData;
20
21
  private isColumnEditable;
21
22
  private buildFormField;
@@ -100,7 +100,7 @@ export class ActionRowInternalApi extends ApiBase {
100
100
  const eventInfo = type === 'rowCreated'
101
101
  ? {
102
102
  type: 'rowCreated',
103
- formData: context.formData,
103
+ formData: this.prepareCreateData(formFields, context),
104
104
  adaptableApi: context.adaptableApi,
105
105
  userName: this.getOptions().userName,
106
106
  adaptableId: this.getOptions().adaptableId,
@@ -120,6 +120,17 @@ export class ActionRowInternalApi extends ApiBase {
120
120
  };
121
121
  return [cancelButton, saveButton];
122
122
  }
123
+ // private getNullValueForColumn(column: AdaptableColumn) {}
124
+ prepareCreateData(formFields, context) {
125
+ // when creating we just omit values that are not set
126
+ const dataToSave = Object.assign({}, context.formData);
127
+ for (const formField of formFields) {
128
+ if (dataToSave[formField.name] === '') {
129
+ delete dataToSave[formField.name];
130
+ }
131
+ }
132
+ return dataToSave;
133
+ }
123
134
  prepareEditData(formFields, context) {
124
135
  const dataToSave = Object.assign({}, context.formData);
125
136
  for (const formField of formFields) {
@@ -22,4 +22,9 @@ export interface TransposeConfig {
22
22
  * @defaultValue false
23
23
  */
24
24
  visibleRows?: boolean;
25
+ /**
26
+ * Autosize columns in transposed view
27
+ * @defaultValue true
28
+ */
29
+ autosize?: boolean;
25
30
  }
@@ -39,6 +39,9 @@ export class LayoutModule extends AdaptableModuleBase {
39
39
  this.rowSummariesSubscribtions();
40
40
  }
41
41
  rowSummariesSubscribtions() {
42
+ if (this.api.isDestroyed()) {
43
+ return;
44
+ }
42
45
  // ROW SUMMARY
43
46
  this.evaluateRowSummary();
44
47
  this.api.eventApi.on('AdaptableStateReloaded', () => {
@@ -468,6 +471,9 @@ export class LayoutModule extends AdaptableModuleBase {
468
471
  */
469
472
  evaluateRowSummary(reason) {
470
473
  var _a;
474
+ if (this.api.isDestroyed()) {
475
+ return;
476
+ }
471
477
  const currentLayout = this.api.layoutApi.getCurrentLayout();
472
478
  const rowSummaries = (_a = this.api.layoutApi.getCurrentLayout().RowSummaries) !== null && _a !== void 0 ? _a : [];
473
479
  const rowSummariesResults = rowSummaries.map(({ ColumnsMap, Position }) => {
@@ -6,6 +6,7 @@ import { isSameDay } from 'date-fns';
6
6
  import OverlayTrigger from '../../../components/OverlayTrigger';
7
7
  import { Flex } from 'rebass';
8
8
  import { ListBoxFilterForm } from './ListBoxFilterForm';
9
+ import { Resizable } from 're-resizable';
9
10
  export const QuickFilterValues = (props) => {
10
11
  const { api } = props;
11
12
  const currentOverlayVisible = useRef(false);
@@ -135,33 +136,48 @@ export const QuickFilterValues = (props) => {
135
136
  }
136
137
  }, render: ({ targetWidth }) => {
137
138
  var _a;
138
- return (React.createElement(Flex, { onMouseEnter: () => {
139
- if (showEvent === 'click') {
140
- // For showEvent=mousenter this is not needed.
141
- // When mouseenter is triggered on the overlay, onShowFn is called, the overlay is no longer hidden.
142
- // But in this case because the trigger is click, another show is not triggered.
143
- // The hide event is added direcly on the element so it does not use the React event system.
144
- // But this event does, maybe beause it uses event delegation it is triggered to soon.
145
- requestAnimationFrame(() => {
146
- var _a;
147
- (_a = valuesDropdownRef.current) === null || _a === void 0 ? void 0 : _a.show();
148
- });
149
- }
150
- }, "data-name": "quick-filter-form", flexDirection: "column", style: {
139
+ return (React.createElement(Resizable, { style: {
151
140
  fontSize: 'var(--ab-font-size-2)',
152
141
  border: '1px solid var(--ab-color-primarydark)',
153
142
  background: 'var(--ab-color-defaultbackground)',
154
143
  zIndex: 1000,
155
- width: getPopoverWidth(targetWidth),
156
- } },
157
- React.createElement(Flex, { m: 2 },
158
- React.createElement(SimpleButton, { onClick: () => clearColumnFilter() }, "Clear Filter"),
159
- ((_a = api.optionsApi.getColumnFilterOptions()) === null || _a === void 0 ? void 0 : _a.autoApplyFilter) == false && (React.createElement(SimpleButton, { ml: 2, onClick: () => {
160
- if (transientColumnFilter) {
161
- props.updateColumnFilter(transientColumnFilter);
162
- }
163
- } }, "Apply Filter"))),
164
- React.createElement(ListBoxFilterForm, { disabled: props.isFilterDisabled, suppressClientSideFilter: quickFilterValues.suppressClientSideFilter, isLoading: isDistinctColumnValuesLoading, onFilterChange: handleFilterChange, currentColumn: props.currentColumn, columns: [], columnDistinctValues: quickFilterValues.values, dataType: props.currentColumn.dataType, uiSelectedColumnValues: props.columnFilter.Predicate.Inputs.filter((input) => input !== ''), useAgGridStyle: true, onColumnValueSelectedChange: (list) => onColumnValueSelectedChange(list) })));
144
+ }, enable: {
145
+ top: false,
146
+ right: true,
147
+ bottom: false,
148
+ left: false,
149
+ topRight: false,
150
+ bottomRight: false,
151
+ bottomLeft: false,
152
+ topLeft: false,
153
+ }, minWidth: getPopoverWidth(targetWidth) },
154
+ React.createElement(Flex, { onMouseEnter: () => {
155
+ if (showEvent === 'click') {
156
+ // For showEvent=mousenter this is not needed.
157
+ // When mouseenter is triggered on the overlay, onShowFn is called, the overlay is no longer hidden.
158
+ // But in this case because the trigger is click, another show is not triggered.
159
+ // The hide event is added direcly on the element so it does not use the React event system.
160
+ // But this event does, maybe beause it uses event delegation it is triggered to soon.
161
+ requestAnimationFrame(() => {
162
+ var _a;
163
+ (_a = valuesDropdownRef.current) === null || _a === void 0 ? void 0 : _a.show();
164
+ });
165
+ }
166
+ }, "data-name": "quick-filter-form", flexDirection: "column", style: {
167
+ // fontSize: 'var(--ab-font-size-2)',
168
+ // border: '1px solid var(--ab-color-primarydark)',
169
+ // background: 'var(--ab-color-defaultbackground)',
170
+ // zIndex: 1000,
171
+ // width: getPopoverWidth(targetWidth),
172
+ } },
173
+ React.createElement(Flex, { m: 2 },
174
+ React.createElement(SimpleButton, { onClick: () => clearColumnFilter() }, "Clear Filter"),
175
+ ((_a = api.optionsApi.getColumnFilterOptions()) === null || _a === void 0 ? void 0 : _a.autoApplyFilter) == false && (React.createElement(SimpleButton, { ml: 2, onClick: () => {
176
+ if (transientColumnFilter) {
177
+ props.updateColumnFilter(transientColumnFilter);
178
+ }
179
+ } }, "Apply Filter"))),
180
+ React.createElement(ListBoxFilterForm, { disabled: props.isFilterDisabled, suppressClientSideFilter: quickFilterValues.suppressClientSideFilter, isLoading: isDistinctColumnValuesLoading, onFilterChange: handleFilterChange, currentColumn: props.currentColumn, columns: [], columnDistinctValues: quickFilterValues.values, dataType: props.currentColumn.dataType, uiSelectedColumnValues: props.columnFilter.Predicate.Inputs.filter((input) => input !== ''), useAgGridStyle: true, onColumnValueSelectedChange: (list) => onColumnValueSelectedChange(list) }))));
165
181
  } },
166
182
  React.createElement(SimpleButton, { "data-name": 'Select Values', style: {
167
183
  flex: 1,
@@ -7,7 +7,7 @@ import { ColumnSelector } from '../Components/Selectors/ColumnSelector';
7
7
  import { AdaptableAgGrid } from '../../agGrid/AdaptableAgGrid';
8
8
  export const TransposedPopup = (props) => {
9
9
  const adaptable = useAdaptable();
10
- const { transposedColumnId, hideTransposedColumn, visibleColumns, visibleRows } = props.popupProps;
10
+ const { transposedColumnId, hideTransposedColumn, visibleColumns, visibleRows, autosize } = props.popupProps;
11
11
  const rowNodes = React.useMemo(() => {
12
12
  return props.popupProps.visibleRows
13
13
  ? adaptable.api.gridApi.getVisibleRowNodes()
@@ -96,7 +96,7 @@ export const TransposedPopup = (props) => {
96
96
  },
97
97
  layoutOptions: {
98
98
  createDefaultLayout: false,
99
- autoSizeColumnsInLayout: true,
99
+ autoSizeColumnsInLayout: autosize,
100
100
  },
101
101
  predefinedConfig: {
102
102
  Layout: {
@@ -7,6 +7,7 @@ import { EmitterCallback } from '../Utilities/Emitter';
7
7
  import { AdaptablePlugin } from '../AdaptableOptions/AdaptablePlugin';
8
8
  import { AgGridAdapter } from './AgGridAdapter';
9
9
  import { IDataService } from '../Utilities/Services/Interface/IDataService';
10
+ import { AdaptableState } from '../PredefinedConfig/AdaptableState';
10
11
  import { IAdaptableStore } from '../Redux/Store/Interface/IAdaptableStore';
11
12
  import { ICalculatedColumnExpressionService } from '../Utilities/Services/Interface/ICalculatedColumnExpressionService';
12
13
  import { IEntitlementService } from '../Utilities/Services/Interface/IEntitlementService';
@@ -134,6 +135,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
134
135
  */
135
136
  static _initInternal(config: AdaptableInitInternalConfig): Promise<AdaptableApi>;
136
137
  private _initAdaptableAgGrid;
138
+ normalizeAdaptableState(state: AdaptableState, gridOptions: GridOptions): AdaptableState;
137
139
  private normaliseLayoutState;
138
140
  private normaliseToolPanelState;
139
141
  refreshQuickFilter(): void;
@@ -305,15 +305,14 @@ export class AdaptableAgGrid {
305
305
  * e.g. adding default Layout, migrating deprecated state, etc.
306
306
  */
307
307
  postLoadHook: (state) => {
308
- if (this.adaptableOptions.autoMigrateState) {
308
+ if (this.adaptableOptions.stateOptions.autoMigrateState) {
309
309
  state = AdaptableUpgradeHelper.migrateAdaptableState(state, {
310
310
  // version 16 actually includes all versions up until 16
311
311
  fromVersion: 16,
312
312
  logger: this.logger,
313
313
  });
314
314
  }
315
- state = this.normaliseLayoutState(state, config);
316
- state = this.normaliseToolPanelState(state);
315
+ state = this.normalizeAdaptableState(state, config.gridOptions);
317
316
  return state;
318
317
  },
319
318
  });
@@ -388,10 +387,15 @@ export class AdaptableAgGrid {
388
387
  perfInitAdaptableAgGrid.end();
389
388
  return Promise.resolve(this.api);
390
389
  }
391
- normaliseLayoutState(state, config) {
390
+ normalizeAdaptableState(state, gridOptions) {
391
+ state = this.normaliseLayoutState(state, gridOptions);
392
+ state = this.normaliseToolPanelState(state);
393
+ return state;
394
+ }
395
+ normaliseLayoutState(state, gridOptions) {
392
396
  var _a, _b, _c, _d, _e, _f;
393
397
  if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
394
- const defaultLayout = this.createDefaultLayout(state, config.gridOptions.columnDefs);
398
+ const defaultLayout = this.createDefaultLayout(state, gridOptions.columnDefs);
395
399
  const layoutState = state.Layout || {};
396
400
  const availableLayouts = layoutState.Layouts || [];
397
401
  availableLayouts.push(defaultLayout);
@@ -427,7 +431,7 @@ export class AdaptableAgGrid {
427
431
  * logic where layout is applied, it is easier and
428
432
  * less error prone to just remove it.
429
433
  */
430
- if (config.gridOptions.rowModelType === 'viewport') {
434
+ if (gridOptions.rowModelType === 'viewport') {
431
435
  (_f = state.Layout.Layouts) === null || _f === void 0 ? void 0 : _f.forEach((layout) => {
432
436
  if (layout.RowGroupedColumns) {
433
437
  delete layout.RowGroupedColumns;
@@ -10,7 +10,6 @@ const DefaultAdaptableOptions = {
10
10
  adaptableStateKey: undefined,
11
11
  primaryKey: '',
12
12
  autogeneratePrimaryKey: false,
13
- autoMigrateState: true,
14
13
  userName: GeneralConstants.USER_NAME,
15
14
  predefinedConfig: undefined,
16
15
  alertOptions: {
@@ -244,6 +243,7 @@ const DefaultAdaptableOptions = {
244
243
  loadState: undefined,
245
244
  persistState: undefined,
246
245
  clearState: undefined,
246
+ autoMigrateState: true,
247
247
  },
248
248
  teamSharingOptions: {
249
249
  enableTeamSharing: false,
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  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: 1712070469439 || Date.now(),
4
- VERSION: "18.0.0-canary.20" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1712152010975 || Date.now(),
4
+ VERSION: "18.0.0-canary.21" || '--current-version--',
5
5
  };
@@ -703,15 +703,6 @@ export declare const ADAPTABLE_METAMODEL: {
703
703
  noCode: string;
704
704
  defVal?: undefined;
705
705
  ref?: undefined;
706
- } | {
707
- name: string;
708
- kind: string;
709
- desc: string;
710
- isOpt: boolean;
711
- defVal: string;
712
- gridInfo?: undefined;
713
- noCode?: undefined;
714
- ref?: undefined;
715
706
  } | {
716
707
  name: string;
717
708
  kind: string;
@@ -766,6 +757,15 @@ export declare const ADAPTABLE_METAMODEL: {
766
757
  gridInfo?: undefined;
767
758
  defVal?: undefined;
768
759
  ref?: undefined;
760
+ } | {
761
+ name: string;
762
+ kind: string;
763
+ desc: string;
764
+ isOpt: boolean;
765
+ defVal: string;
766
+ gridInfo?: undefined;
767
+ noCode?: undefined;
768
+ ref?: undefined;
769
769
  } | {
770
770
  name: string;
771
771
  kind: string;
@@ -5040,14 +5040,14 @@ export declare const ADAPTABLE_METAMODEL: {
5040
5040
  desc: string;
5041
5041
  isOpt: boolean;
5042
5042
  defVal: string;
5043
- ref: string;
5043
+ ref?: undefined;
5044
5044
  } | {
5045
5045
  name: string;
5046
5046
  kind: string;
5047
5047
  desc: string;
5048
5048
  isOpt: boolean;
5049
5049
  defVal: string;
5050
- ref?: undefined;
5050
+ ref: string;
5051
5051
  } | {
5052
5052
  name: string;
5053
5053
  kind: string;