@adaptabletools/adaptable-cjs 20.1.3 → 20.1.5

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.
@@ -928,10 +928,10 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
928
928
  /**
929
929
  * Use Case: Column Filters have changed
930
930
  * Action: Apply Column Filtering and fire associated events
931
+ * Note: For LAYOUT_COLUMN_FILTER_EDIT we do not filter (as it seems to be already handled)
931
932
  */
932
933
  case LayoutRedux.LAYOUT_COLUMN_FILTER_ADD:
933
- // see ref "also-this-handles-the-LAYOUT_COLUMN_FILTER_EDIT-case"
934
- // case LayoutRedux.LAYOUT_COLUMN_FILTER_EDIT:
934
+ case LayoutRedux.LAYOUT_COLUMN_FILTER_EDIT:
935
935
  case LayoutRedux.LAYOUT_COLUMN_FILTER_SET:
936
936
  case LayoutRedux.LAYOUT_COLUMN_FILTER_CLEAR:
937
937
  case LayoutRedux.LAYOUT_COLUMN_FILTER_CLEAR_ALL:
@@ -944,11 +944,12 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
944
944
  const shouldTriggerColumnFiltering = adaptable.api.filterApi.columnFilterApi.internalApi.shouldNewColumnFilterTriggerColumnFiltering(action);
945
945
  const oldLayoutState = middlewareAPI.getState().Layout;
946
946
  returnAction = next(action);
947
- setTimeout(() => {
948
- if (shouldTriggerColumnFiltering) {
947
+ if (shouldTriggerColumnFiltering &&
948
+ action.type !== LayoutRedux.LAYOUT_COLUMN_FILTER_EDIT) {
949
+ setTimeout(() => {
949
950
  adaptable.applyFiltering();
950
- }
951
- }, 50);
951
+ }, 50);
952
+ }
952
953
  adaptable.api.eventApi.internalApi.fireColumnFilterAppliedEvent();
953
954
  adaptable.api.eventApi.internalApi.fireLayoutChangedEvent(action.type, oldLayoutState, middlewareAPI.getState().Layout);
954
955
  return returnAction;
@@ -39,7 +39,6 @@ class DataService {
39
39
  if (cellDataChangedInfo.newValue != cellDataChangedInfo.oldValue) {
40
40
  this.emitter.emitSync('CellDataChanged', cellDataChangedInfo);
41
41
  this.adaptable.api.eventApi.internalApi.fireCellChangedEvent(cellDataChangedInfo);
42
- console.log('cell changed called');
43
42
  const dataChangeLogEntry = this.extractDataChangeLogEntry(cellDataChangedInfo);
44
43
  this.cellDataChangeLogSubject$.next(dataChangeLogEntry);
45
44
  }
@@ -33,7 +33,7 @@ const ColumnValuesSelect = (props) => {
33
33
  minWidth: `var(--ab-cmp-select-column-menu-${column.columnId}__min-width, var(--ab-cmp-select-column-menu__min-width, 160px))`,
34
34
  };
35
35
  }, [column.columnId]);
36
- const component = (React.createElement(Select_1.Select, { isMulti: true, showHeaderSelectionCheckbox: true, searchable: true, closeMenuOnSelect: false, menuStyle: menuStyle, ...props.selectProps, options: options, value: value, isLoading: props.isLoading, onChange: props.onChange }));
36
+ const component = (React.createElement(Select_1.Select, { key: "select", isMulti: true, resizable: true, showHeaderSelectionCheckbox: true, searchable: true, closeMenuOnSelect: false, menuStyle: menuStyle, ...props.selectProps, options: options, value: value, isLoading: props.isLoading, onChange: props.onChange }));
37
37
  return (React.createElement("div", { className: (0, join_1.default)(baseClassName, props.isLoading && `${baseClassName}--loading`, !value.length && `${baseClassName}--empty`), onKeyDownCapture: (e) => {
38
38
  const event = e.nativeEvent || e;
39
39
  event.stopPropagation = () => {
@@ -1357,8 +1357,8 @@ You need to define at least one Layout!`);
1357
1357
  * Action2: Set Selected Cells (on a debounce)
1358
1358
  */
1359
1359
  this.agGridAdapter.getAgGridApi().addEventListener('sortChanged', (this.listenerSortChanged = () => {
1360
- this.api.eventApi.internalApi.fireGridSortedEvent();
1361
1360
  this.debouncedSetSelectedCells();
1361
+ this.api.eventApi.internalApi.fireGridSortedEvent();
1362
1362
  }));
1363
1363
  /**
1364
1364
  * Use Case: Charts have been created or destroyed, Chart ranges selected or Chart options changed
@@ -1561,8 +1561,11 @@ You need to define at least one Layout!`);
1561
1561
  if (isPivot) {
1562
1562
  // let's also support the pivot result columns
1563
1563
  const pivotResultColumns = gridApi.getPivotResultColumns() || [];
1564
+ const autoGroupColumns = gridApi
1565
+ .getAllGridColumns()
1566
+ .filter((column) => this.api.columnApi.isAutoRowGroupColumn(column.getColId()));
1564
1567
  if (pivotResultColumns.length) {
1565
- agGridCols = [...agGridCols, ...pivotResultColumns];
1568
+ agGridCols = [...agGridCols, ...pivotResultColumns, ...autoGroupColumns];
1566
1569
  }
1567
1570
  }
1568
1571
  const columnGroupChildren = gridApi
@@ -3046,7 +3049,7 @@ You need to define at least one Layout!`);
3046
3049
  // and is specific to Adaptable, therefore we need to refresh it manually
3047
3050
  this.refreshHeader();
3048
3051
  const layoutModel = (0, LayoutHelpers_1.layoutStateToLayoutModel)(layout);
3049
- this.layoutManager?.setLayout(layoutModel, {
3052
+ const layoutChanged = this.layoutManager?.setLayout(layoutModel, {
3050
3053
  skipApplyRowGroupsExpandedState: !shouldUpdateExpandState,
3051
3054
  });
3052
3055
  if (layout.AutoSizeColumns) {
@@ -3069,6 +3072,15 @@ You need to define at least one Layout!`);
3069
3072
  plugin.afterSetLayout(this, layout);
3070
3073
  }
3071
3074
  });
3075
+ if (!layoutChanged) {
3076
+ // we won't get an onLayoutChange event
3077
+ // most likely only filters have changed (column or grid filters)
3078
+ // and because filters are not part of the layout manager
3079
+ // there will be no change to the layout
3080
+ // so we need to manually trigger the onLayoutChange event
3081
+ // for other layout-related updates
3082
+ this.onLayoutChange(layout, { skipRefresh: true });
3083
+ }
3072
3084
  perfSetLayout.end();
3073
3085
  }
3074
3086
  getActiveAdaptableAggFuncForCol(columnId) {
@@ -3377,18 +3389,21 @@ You need to define at least one Layout!`);
3377
3389
  };
3378
3390
  return hasPivotTotals(one) || hasPivotTotals(other);
3379
3391
  }
3380
- onLayoutChange(layout) {
3392
+ onLayoutChange(layout, options) {
3381
3393
  this.logger.info('onLayoutChange()');
3382
- const prevOnChangeLayout = this.__prevLayoutForOnChange || this.api.layoutApi.getCurrentLayout();
3383
- // see #on-regroup-expect-group-column-to-be-recomputed-and-setup-properly
3384
- const rowGroupsChanged = this.isRowGroupDifferentInLayout(prevOnChangeLayout, layout);
3385
- const hasPivotTotalsInLayout = this.hasPivotTotalsInLayout(prevOnChangeLayout, layout);
3386
- const pivotColsChanged = JSON.stringify(layout.PivotColumns) !== JSON.stringify(prevOnChangeLayout.PivotColumns);
3387
- if (rowGroupsChanged || pivotColsChanged || hasPivotTotalsInLayout) {
3388
- this.updateColumnModelAndRefreshGrid();
3389
- }
3390
- else {
3391
- this.deriveAdaptableColumnStateFromAgGrid();
3394
+ const skipRefresh = options?.skipRefresh;
3395
+ if (!skipRefresh) {
3396
+ const prevOnChangeLayout = this.__prevLayoutForOnChange || this.api.layoutApi.getCurrentLayout();
3397
+ // see #on-regroup-expect-group-column-to-be-recomputed-and-setup-properly
3398
+ const rowGroupsChanged = this.isRowGroupDifferentInLayout(prevOnChangeLayout, layout);
3399
+ const hasPivotTotalsInLayout = this.hasPivotTotalsInLayout(prevOnChangeLayout, layout);
3400
+ const pivotColsChanged = JSON.stringify(layout.PivotColumns) !== JSON.stringify(prevOnChangeLayout.PivotColumns);
3401
+ if (rowGroupsChanged || pivotColsChanged || hasPivotTotalsInLayout) {
3402
+ this.updateColumnModelAndRefreshGrid();
3403
+ }
3404
+ else {
3405
+ this.deriveAdaptableColumnStateFromAgGrid();
3406
+ }
3392
3407
  }
3393
3408
  this.__prevLayoutForOnChange = layout;
3394
3409
  this.api.layoutApi.createOrUpdateLayout(layout);
@@ -112,7 +112,7 @@ class AgGridExportAdapter {
112
112
  };
113
113
  }
114
114
  catch (error) {
115
- this.logger.consoleError(`Error exporting ${report.Name} in ${format} format to ${config.destination}`, error);
115
+ this.logger.consoleError(`Error exporting ${report.Name} in ${format} format to ${config.destination}`, error.message);
116
116
  }
117
117
  finally {
118
118
  /**
@@ -14,9 +14,45 @@ const DatepickerContext_1 = require("./DatepickerContext");
14
14
  const react_day_picker_1 = require("react-day-picker");
15
15
  const AdaptableDateInlineInput_1 = require("../../View/Components/AdaptableInput/AdaptableDateInlineInput");
16
16
  const date_fns_1 = require("date-fns");
17
- const DatepickerOverlay = ({ onHide, children, onKeyDown, onMouseDown, }) => {
17
+ const Select_1 = require("../Select");
18
+ const onDatePickerDropdownKeyDown = (e) => {
19
+ if (e.key === 'Escape' || e.key === 'Enter') {
20
+ e.stopPropagation();
21
+ }
22
+ };
23
+ const DatePickerComponents = {
24
+ YearsDropdown: (props) => {
25
+ const onChange = (0, react_1.useCallback)((value) => {
26
+ props.onChange?.({
27
+ target: {
28
+ value,
29
+ },
30
+ });
31
+ }, [props.onChange]);
32
+ return (React.createElement(Select_1.Select, { onKeyDown: onDatePickerDropdownKeyDown, value: props.value, onChange: onChange, options: props.options }));
33
+ },
34
+ MonthsDropdown: (props) => {
35
+ const onChange = (0, react_1.useCallback)((value) => {
36
+ props.onChange?.({
37
+ target: {
38
+ value,
39
+ },
40
+ });
41
+ }, [props.onChange]);
42
+ return (React.createElement(Select_1.Select, { onKeyDown: onDatePickerDropdownKeyDown, value: `${props.value}`, onChange: onChange, options: props.options.map((option) => {
43
+ return {
44
+ label: option.label,
45
+ value: `${option.value}`,
46
+ };
47
+ }) }));
48
+ },
49
+ };
50
+ const DatepickerOverlay = ({ onHide, children, onKeyDown, onMouseDown, overlayDOMRef, }) => {
18
51
  const domRef = React.useRef(null);
19
- return (React.createElement("div", { className: "ab-Datepicker-Overlay", ref: domRef, onKeyDown: onKeyDown, onMouseDown: onMouseDown, onBlur: (e) => {
52
+ return (React.createElement("div", { className: "ab-Datepicker-Overlay", tabIndex: -1, ref: (el) => {
53
+ domRef.current = el;
54
+ overlayDOMRef.current = el;
55
+ }, onKeyDown: onKeyDown, onMouseDown: onMouseDown, onBlur: (e) => {
20
56
  const { relatedTarget } = e;
21
57
  const node = domRef.current;
22
58
  // relatedTarget is the newly focused element as a result of this blur event
@@ -78,13 +114,14 @@ exports.Datepicker = React.forwardRef((props, ref) => {
78
114
  clearValue();
79
115
  }, accessLevel: 'Full' })) : null;
80
116
  const calendarButton = (React.createElement(SimpleButton_1.default, { disabled: disabled, variant: "text", icon: "calendar", tooltip: "Date", iconSize: 20, px: 0, py: 0, onClick: () => setVisible(true) }));
117
+ const overlayDOMRef = (0, react_1.useRef)(null);
81
118
  return (React.createElement(rebass_1.Flex, null,
82
- React.createElement(OverlayTrigger_1.default, { visible: visible, render: () => (React.createElement(DatepickerOverlay, { onMouseDown: props.onMouseDown, onHide: () => setVisible(false), onKeyDown: (e) => {
119
+ React.createElement(OverlayTrigger_1.default, { visible: visible, render: () => (React.createElement(DatepickerOverlay, { overlayDOMRef: overlayDOMRef, onMouseDown: props.onMouseDown, onHide: () => setVisible(false), onKeyDown: (e) => {
83
120
  if (e.key === 'Escape' || e.key === 'Enter') {
84
121
  setVisible(false, e.key);
85
122
  }
86
123
  } },
87
- React.createElement(react_day_picker_1.DayPicker, { fixedWeeks: true, autoFocus: autoFocus ?? true, showWeekNumber: showWeekNumber, showOutsideDays: showOutsideDays, mode: "single", captionLayout: "dropdown", month: isNaN(+month) ? new Date() : month, selected: value, onMonthChange: setMonth, onSelect: updateValue, startMonth: START_MONTH, endMonth: END_MONTH, footer: React.createElement(rebass_1.Flex, { justifyContent: "space-between", mt: 2, flexWrap: 'wrap' }, footerButtons) }))) },
124
+ React.createElement(react_day_picker_1.DayPicker, { fixedWeeks: true, autoFocus: autoFocus ?? true, showWeekNumber: showWeekNumber, showOutsideDays: showOutsideDays, mode: "single", captionLayout: "dropdown", month: isNaN(+month) ? new Date() : month, selected: value, onMonthChange: setMonth, onSelect: updateValue, startMonth: START_MONTH, endMonth: END_MONTH, components: DatePickerComponents, footer: React.createElement(rebass_1.Flex, { justifyContent: "space-between", mt: 2, flexWrap: 'wrap' }, footerButtons) }))) },
88
125
  React.createElement(FieldWrap_1.default, { ...boxProps, style: {
89
126
  borderRadius: style?.borderRadius,
90
127
  width: style?.width,
@@ -94,6 +131,14 @@ exports.Datepicker = React.forwardRef((props, ref) => {
94
131
  if (!visible) {
95
132
  setVisible(true);
96
133
  }
134
+ }, onBlur: (e) => {
135
+ const { relatedTarget } = e;
136
+ const overlayDOMNode = overlayDOMRef.current;
137
+ if ((overlayDOMNode && relatedTarget == overlayDOMNode) ||
138
+ overlayDOMNode?.contains(relatedTarget)) {
139
+ return;
140
+ }
141
+ setVisible(false);
97
142
  } },
98
143
  React.createElement(AdaptableDateInlineInput_1.AdaptableDateInlineInput, { ref: ref, value: inputValue,
99
144
  // We do not want to show the format when the date-picker is visible
@@ -14,6 +14,7 @@ export type SelectProps<SelectValue extends unknown, IsMulti extends boolean = f
14
14
  menuStyle?: React.CSSProperties;
15
15
  menuMinWidth?: string | number;
16
16
  searchable?: boolean;
17
+ resizable?: boolean;
17
18
  isClearable?: boolean;
18
19
  closeMenuOnSelect?: boolean;
19
20
  hideSelectedOptions?: boolean;
@@ -47,5 +48,6 @@ export type SelectProps<SelectValue extends unknown, IsMulti extends boolean = f
47
48
  size?: 'small' | 'normal';
48
49
  isCreatable?: boolean;
49
50
  menuPortalTarget?: HTMLElement;
51
+ onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
50
52
  };
51
53
  export declare const Select: <SelectValue extends unknown, IsMulti extends boolean = false>(props: SelectProps<SelectValue, IsMulti>) => React.JSX.Element;
@@ -11,6 +11,15 @@ const rebass_1 = require("rebass");
11
11
  const infinite_react_1 = require("@infinite-table/infinite-react");
12
12
  const react_1 = require("react");
13
13
  const join_1 = tslib_1.__importDefault(require("../utils/join"));
14
+ const re_resizable_1 = require("re-resizable");
15
+ const resizableDirections = {
16
+ right: true,
17
+ bottom: true,
18
+ bottomRight: true,
19
+ };
20
+ const defaultResizableSize = {
21
+ width: '100%',
22
+ };
14
23
  const checkboxStyle = {
15
24
  position: 'relative',
16
25
  top: 1,
@@ -19,7 +28,7 @@ const INFINITE_DOM_PROPS = {
19
28
  style: {
20
29
  height: '100%',
21
30
  minHeight: `var(--ab-cmp-select-menu__min-height, 25rem)`,
22
- maxHeight: '50vh',
31
+ // maxHeight: '50vh',
23
32
  width: '100%',
24
33
  },
25
34
  };
@@ -152,6 +161,7 @@ const Select = function (props) {
152
161
  } }));
153
162
  };
154
163
  }, []);
164
+ const resizable = props.resizable ?? false;
155
165
  const ValueContainer = React.useMemo(() => {
156
166
  return (props) => {
157
167
  let { children, ...inputProps } = props;
@@ -180,24 +190,33 @@ const Select = function (props) {
180
190
  } }, children));
181
191
  };
182
192
  }, [renderMultipleValues, props.placeholder]);
193
+ const sizeRef = React.useRef({ ...defaultResizableSize });
183
194
  const MenuComponent = React.useMemo(() => {
184
195
  return (inputProps) => {
185
196
  const { isLoading } = inputProps;
197
+ const theChildren = (React.createElement(React.Fragment, null,
198
+ inputProps.children,
199
+ React.createElement("div", { style: {
200
+ display: isLoading ? 'block' : 'none',
201
+ position: 'absolute',
202
+ inset: 0,
203
+ background: `var(--ab-cmp-select-loading__background)`,
204
+ zIndex: 1,
205
+ } })));
206
+ const onResizeStop = (0, react_1.useCallback)((_e, _direction, ref) => {
207
+ const newSize = {
208
+ width: ref.style.width,
209
+ height: ref.style.height,
210
+ };
211
+ sizeRef.current = newSize;
212
+ }, []);
186
213
  return (React.createElement(React.Fragment, null,
187
214
  React.createElement(react_select_1.components.Menu, { ...inputProps, innerProps: {
188
215
  'data-name': 'menu-container',
189
216
  ...inputProps.innerProps,
190
- } },
191
- inputProps.children,
192
- React.createElement("div", { style: {
193
- display: isLoading ? 'block' : 'none',
194
- position: 'absolute',
195
- inset: 0,
196
- background: `var(--ab-cmp-select-loading__background)`,
197
- zIndex: 1,
198
- } }))));
217
+ } }, resizable ? (React.createElement(re_resizable_1.Resizable, { enable: resizableDirections, minWidth: '100%', maxHeight: '60vh', maxWidth: '60vw', defaultSize: sizeRef.current, onResizeStop: onResizeStop }, theChildren)) : (theChildren))));
199
218
  };
200
- }, []);
219
+ }, [resizable]);
201
220
  const SelectComponent = props.isCreatable ? creatable_1.default : react_select_1.default;
202
221
  const ClearIndicator = React.useMemo(() => {
203
222
  return (clearIndicatorProps) => {
@@ -369,7 +388,7 @@ const Select = function (props) {
369
388
  setInputValue(value);
370
389
  props.onInputChange?.(value);
371
390
  }, [props.onInputChange, isMulti]);
372
- return (React.createElement(SelectComponent, { ref: ref, "aria-label": props['aria-label'], inputValue: inputValue, onInputChange: onInputChange, onFocus: onFocus, onBlur: onBlur, onMenuOpen: props.onMenuOpen, isLoading: props.isLoading, options: props.options, className: (0, join_1.default)(props.className, 'ab-Select'), isDisabled: disabled, menuPlacement: props.menuPlacement ?? 'auto', isSearchable: props.searchable, hideSelectedOptions: false, isMulti: isMulti, value: selectedOption, blurInputOnSelect: false, menuPosition: props.menuPosition ?? 'absolute',
391
+ return (React.createElement(SelectComponent, { ref: ref, "aria-label": props['aria-label'], onKeyDown: props.onKeyDown, inputValue: inputValue, onInputChange: onInputChange, onFocus: onFocus, onBlur: onBlur, onMenuOpen: props.onMenuOpen, isLoading: props.isLoading, options: props.options, className: (0, join_1.default)(props.className, 'ab-Select'), isDisabled: disabled, menuPlacement: props.menuPlacement ?? 'auto', isSearchable: props.searchable, hideSelectedOptions: false, isMulti: isMulti, value: selectedOption, blurInputOnSelect: false, menuPosition: props.menuPosition ?? 'absolute',
373
392
  // This needed so the menu is not clipped by overflow: hidden
374
393
  menuPortalTarget: props.menuPortalTarget === undefined ? document.body : null, isClearable: props.isClearable, closeMenuOnSelect: props.closeMenuOnSelect, onChange: (option) => {
375
394
  if (isMulti) {
@@ -429,7 +448,7 @@ const Select = function (props) {
429
448
  zIndex: 999999,
430
449
  boxShadow: 'var(--ab-cmp-select-menu__box-shadow)',
431
450
  minWidth: `var(--ab-cmp-select-menu__min-width)`,
432
- width: `${Math.max(maxLabelLength, 10)}ch`,
451
+ width: resizable ? '100%' : `${Math.max(maxLabelLength, 10)}ch`,
433
452
  '--ab-cmp-select-menu__min-height': `min(${(props.options || []).length + (showHeaderSelectionCheckbox ? 1 : 0)} * var(--ab-grid-row-height), 20rem)`,
434
453
  maxHeight: 'var(--ab-cmp-select-menu__max-height)',
435
454
  maxWidth: 'var(--ab-cmp-select-menu__max-width)',
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: 1747299023006 || Date.now(),
6
- VERSION: "20.1.3" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1748008344094 || Date.now(),
6
+ VERSION: "20.1.5" || '--current-version--',
7
7
  };
@@ -443,6 +443,16 @@ export declare const ADAPTABLE_METAMODEL: {
443
443
  kind: string;
444
444
  desc: string;
445
445
  };
446
+ AdaptableFilterState: {
447
+ name: string;
448
+ kind: string;
449
+ desc: string;
450
+ props: {
451
+ name: string;
452
+ kind: string;
453
+ desc: string;
454
+ }[];
455
+ };
446
456
  AdaptableFlashingCell: {
447
457
  name: string;
448
458
  kind: string;
@@ -879,16 +889,6 @@ export declare const ADAPTABLE_METAMODEL: {
879
889
  desc: string;
880
890
  }[];
881
891
  };
882
- AdaptableSearchState: {
883
- name: string;
884
- kind: string;
885
- desc: string;
886
- props: {
887
- name: string;
888
- kind: string;
889
- desc: string;
890
- }[];
891
- };
892
892
  AdaptableSettingsPanel: {
893
893
  name: string;
894
894
  kind: string;