@adaptabletools/adaptable-cjs 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-cjs",
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
  *
@@ -137,6 +137,9 @@ class ConfigApiImpl extends ApiBase_1.ApiBase {
137
137
  adaptable: this.adaptable,
138
138
  adaptableStateKey,
139
139
  predefinedConfig,
140
+ postLoadHook: (state) => {
141
+ return this.adaptable.normalizeAdaptableState(state, this.adaptable.agGridAdapter.getLiveGridOptions());
142
+ },
140
143
  });
141
144
  promise
142
145
  .then(() => {
@@ -530,11 +530,12 @@ class GridApiImpl extends ApiBase_1.ApiBase {
530
530
  return this.getRowCount();
531
531
  }
532
532
  showTransposedView(transposeConfig = {}) {
533
- var _a, _b, _c, _d;
533
+ var _a, _b, _c, _d, _e;
534
534
  const transposedColumnId = (_a = transposeConfig.transposedColumnId) !== null && _a !== void 0 ? _a : this.getAdaptableApi().optionsApi.getPrimaryKey();
535
535
  const hideTransposedColumn = (_b = transposeConfig.hideTransposedColumn) !== null && _b !== void 0 ? _b : true;
536
536
  const visibleColumns = (_c = transposeConfig.visibleColumns) !== null && _c !== void 0 ? _c : false;
537
537
  const visibleRows = (_d = transposeConfig.visibleRows) !== null && _d !== void 0 ? _d : false;
538
+ const autosize = (_e = transposeConfig.autosize) !== null && _e !== void 0 ? _e : true;
538
539
  this.adaptable.api.internalApi.showPopupWindow({
539
540
  id: windowFactory_1.WINDOW_SHOW_TRANSPOSED_VIEW,
540
541
  factoryId: windowFactory_1.WINDOW_SHOW_TRANSPOSED_VIEW,
@@ -545,6 +546,7 @@ class GridApiImpl extends ApiBase_1.ApiBase {
545
546
  hideTransposedColumn,
546
547
  visibleColumns,
547
548
  visibleRows,
549
+ autosize,
548
550
  },
549
551
  });
550
552
  }
@@ -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;
@@ -104,7 +104,7 @@ class ActionRowInternalApi extends ApiBase_1.ApiBase {
104
104
  const eventInfo = type === 'rowCreated'
105
105
  ? {
106
106
  type: 'rowCreated',
107
- formData: context.formData,
107
+ formData: this.prepareCreateData(formFields, context),
108
108
  adaptableApi: context.adaptableApi,
109
109
  userName: this.getOptions().userName,
110
110
  adaptableId: this.getOptions().adaptableId,
@@ -124,6 +124,17 @@ class ActionRowInternalApi extends ApiBase_1.ApiBase {
124
124
  };
125
125
  return [cancelButton, saveButton];
126
126
  }
127
+ // private getNullValueForColumn(column: AdaptableColumn) {}
128
+ prepareCreateData(formFields, context) {
129
+ // when creating we just omit values that are not set
130
+ const dataToSave = Object.assign({}, context.formData);
131
+ for (const formField of formFields) {
132
+ if (dataToSave[formField.name] === '') {
133
+ delete dataToSave[formField.name];
134
+ }
135
+ }
136
+ return dataToSave;
137
+ }
127
138
  prepareEditData(formFields, context) {
128
139
  const dataToSave = Object.assign({}, context.formData);
129
140
  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
  }
@@ -43,6 +43,9 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
43
43
  this.rowSummariesSubscribtions();
44
44
  }
45
45
  rowSummariesSubscribtions() {
46
+ if (this.api.isDestroyed()) {
47
+ return;
48
+ }
46
49
  // ROW SUMMARY
47
50
  this.evaluateRowSummary();
48
51
  this.api.eventApi.on('AdaptableStateReloaded', () => {
@@ -472,6 +475,9 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
472
475
  */
473
476
  evaluateRowSummary(reason) {
474
477
  var _a;
478
+ if (this.api.isDestroyed()) {
479
+ return;
480
+ }
475
481
  const currentLayout = this.api.layoutApi.getCurrentLayout();
476
482
  const rowSummaries = (_a = this.api.layoutApi.getCurrentLayout().RowSummaries) !== null && _a !== void 0 ? _a : [];
477
483
  const rowSummariesResults = rowSummaries.map(({ ColumnsMap, Position }) => {
@@ -10,6 +10,7 @@ const date_fns_1 = require("date-fns");
10
10
  const OverlayTrigger_1 = tslib_1.__importDefault(require("../../../components/OverlayTrigger"));
11
11
  const rebass_1 = require("rebass");
12
12
  const ListBoxFilterForm_1 = require("./ListBoxFilterForm");
13
+ const re_resizable_1 = require("re-resizable");
13
14
  const QuickFilterValues = (props) => {
14
15
  const { api } = props;
15
16
  const currentOverlayVisible = (0, react_1.useRef)(false);
@@ -139,33 +140,48 @@ const QuickFilterValues = (props) => {
139
140
  }
140
141
  }, render: ({ targetWidth }) => {
141
142
  var _a;
142
- return (React.createElement(rebass_1.Flex, { onMouseEnter: () => {
143
- if (showEvent === 'click') {
144
- // For showEvent=mousenter this is not needed.
145
- // When mouseenter is triggered on the overlay, onShowFn is called, the overlay is no longer hidden.
146
- // But in this case because the trigger is click, another show is not triggered.
147
- // The hide event is added direcly on the element so it does not use the React event system.
148
- // But this event does, maybe beause it uses event delegation it is triggered to soon.
149
- requestAnimationFrame(() => {
150
- var _a;
151
- (_a = valuesDropdownRef.current) === null || _a === void 0 ? void 0 : _a.show();
152
- });
153
- }
154
- }, "data-name": "quick-filter-form", flexDirection: "column", style: {
143
+ return (React.createElement(re_resizable_1.Resizable, { style: {
155
144
  fontSize: 'var(--ab-font-size-2)',
156
145
  border: '1px solid var(--ab-color-primarydark)',
157
146
  background: 'var(--ab-color-defaultbackground)',
158
147
  zIndex: 1000,
159
- width: getPopoverWidth(targetWidth),
160
- } },
161
- React.createElement(rebass_1.Flex, { m: 2 },
162
- React.createElement(SimpleButton_1.default, { onClick: () => clearColumnFilter() }, "Clear Filter"),
163
- ((_a = api.optionsApi.getColumnFilterOptions()) === null || _a === void 0 ? void 0 : _a.autoApplyFilter) == false && (React.createElement(SimpleButton_1.default, { ml: 2, onClick: () => {
164
- if (transientColumnFilter) {
165
- props.updateColumnFilter(transientColumnFilter);
166
- }
167
- } }, "Apply Filter"))),
168
- React.createElement(ListBoxFilterForm_1.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) })));
148
+ }, enable: {
149
+ top: false,
150
+ right: true,
151
+ bottom: false,
152
+ left: false,
153
+ topRight: false,
154
+ bottomRight: false,
155
+ bottomLeft: false,
156
+ topLeft: false,
157
+ }, minWidth: getPopoverWidth(targetWidth) },
158
+ React.createElement(rebass_1.Flex, { onMouseEnter: () => {
159
+ if (showEvent === 'click') {
160
+ // For showEvent=mousenter this is not needed.
161
+ // When mouseenter is triggered on the overlay, onShowFn is called, the overlay is no longer hidden.
162
+ // But in this case because the trigger is click, another show is not triggered.
163
+ // The hide event is added direcly on the element so it does not use the React event system.
164
+ // But this event does, maybe beause it uses event delegation it is triggered to soon.
165
+ requestAnimationFrame(() => {
166
+ var _a;
167
+ (_a = valuesDropdownRef.current) === null || _a === void 0 ? void 0 : _a.show();
168
+ });
169
+ }
170
+ }, "data-name": "quick-filter-form", flexDirection: "column", style: {
171
+ // fontSize: 'var(--ab-font-size-2)',
172
+ // border: '1px solid var(--ab-color-primarydark)',
173
+ // background: 'var(--ab-color-defaultbackground)',
174
+ // zIndex: 1000,
175
+ // width: getPopoverWidth(targetWidth),
176
+ } },
177
+ React.createElement(rebass_1.Flex, { m: 2 },
178
+ React.createElement(SimpleButton_1.default, { onClick: () => clearColumnFilter() }, "Clear Filter"),
179
+ ((_a = api.optionsApi.getColumnFilterOptions()) === null || _a === void 0 ? void 0 : _a.autoApplyFilter) == false && (React.createElement(SimpleButton_1.default, { ml: 2, onClick: () => {
180
+ if (transientColumnFilter) {
181
+ props.updateColumnFilter(transientColumnFilter);
182
+ }
183
+ } }, "Apply Filter"))),
184
+ React.createElement(ListBoxFilterForm_1.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) }))));
169
185
  } },
170
186
  React.createElement(SimpleButton_1.default, { "data-name": 'Select Values', style: {
171
187
  flex: 1,
@@ -11,7 +11,7 @@ const ColumnSelector_1 = require("../Components/Selectors/ColumnSelector");
11
11
  const AdaptableAgGrid_1 = require("../../agGrid/AdaptableAgGrid");
12
12
  const TransposedPopup = (props) => {
13
13
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
14
- const { transposedColumnId, hideTransposedColumn, visibleColumns, visibleRows } = props.popupProps;
14
+ const { transposedColumnId, hideTransposedColumn, visibleColumns, visibleRows, autosize } = props.popupProps;
15
15
  const rowNodes = React.useMemo(() => {
16
16
  return props.popupProps.visibleRows
17
17
  ? adaptable.api.gridApi.getVisibleRowNodes()
@@ -100,7 +100,7 @@ const TransposedPopup = (props) => {
100
100
  },
101
101
  layoutOptions: {
102
102
  createDefaultLayout: false,
103
- autoSizeColumnsInLayout: true,
103
+ autoSizeColumnsInLayout: autosize,
104
104
  },
105
105
  predefinedConfig: {
106
106
  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;
@@ -309,15 +309,14 @@ class AdaptableAgGrid {
309
309
  * e.g. adding default Layout, migrating deprecated state, etc.
310
310
  */
311
311
  postLoadHook: (state) => {
312
- if (this.adaptableOptions.autoMigrateState) {
312
+ if (this.adaptableOptions.stateOptions.autoMigrateState) {
313
313
  state = AdaptableUpgradeHelper_1.AdaptableUpgradeHelper.migrateAdaptableState(state, {
314
314
  // version 16 actually includes all versions up until 16
315
315
  fromVersion: 16,
316
316
  logger: this.logger,
317
317
  });
318
318
  }
319
- state = this.normaliseLayoutState(state, config);
320
- state = this.normaliseToolPanelState(state);
319
+ state = this.normalizeAdaptableState(state, config.gridOptions);
321
320
  return state;
322
321
  },
323
322
  });
@@ -392,10 +391,15 @@ class AdaptableAgGrid {
392
391
  perfInitAdaptableAgGrid.end();
393
392
  return Promise.resolve(this.api);
394
393
  }
395
- normaliseLayoutState(state, config) {
394
+ normalizeAdaptableState(state, gridOptions) {
395
+ state = this.normaliseLayoutState(state, gridOptions);
396
+ state = this.normaliseToolPanelState(state);
397
+ return state;
398
+ }
399
+ normaliseLayoutState(state, gridOptions) {
396
400
  var _a, _b, _c, _d, _e, _f;
397
401
  if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
398
- const defaultLayout = this.createDefaultLayout(state, config.gridOptions.columnDefs);
402
+ const defaultLayout = this.createDefaultLayout(state, gridOptions.columnDefs);
399
403
  const layoutState = state.Layout || {};
400
404
  const availableLayouts = layoutState.Layouts || [];
401
405
  availableLayouts.push(defaultLayout);
@@ -431,7 +435,7 @@ class AdaptableAgGrid {
431
435
  * logic where layout is applied, it is easier and
432
436
  * less error prone to just remove it.
433
437
  */
434
- if (config.gridOptions.rowModelType === 'viewport') {
438
+ if (gridOptions.rowModelType === 'viewport') {
435
439
  (_f = state.Layout.Layouts) === null || _f === void 0 ? void 0 : _f.forEach((layout) => {
436
440
  if (layout.RowGroupedColumns) {
437
441
  delete layout.RowGroupedColumns;
@@ -14,7 +14,6 @@ const DefaultAdaptableOptions = {
14
14
  adaptableStateKey: undefined,
15
15
  primaryKey: '',
16
16
  autogeneratePrimaryKey: false,
17
- autoMigrateState: true,
18
17
  userName: GeneralConstants.USER_NAME,
19
18
  predefinedConfig: undefined,
20
19
  alertOptions: {
@@ -248,6 +247,7 @@ const DefaultAdaptableOptions = {
248
247
  loadState: undefined,
249
248
  persistState: undefined,
250
249
  clearState: undefined,
250
+ autoMigrateState: true,
251
251
  },
252
252
  teamSharingOptions: {
253
253
  enableTeamSharing: false,
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  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: 1712070501504 || Date.now(),
6
- VERSION: "18.0.0-canary.20" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1712152040562 || Date.now(),
6
+ VERSION: "18.0.0-canary.21" || '--current-version--',
7
7
  };
@@ -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;