@adaptabletools/adaptable 20.1.4 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "20.1.4",
3
+ "version": "20.1.5",
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",
@@ -8,7 +8,7 @@ export interface AdaptableFilterState {
8
8
  */
9
9
  gridFilter: string | undefined;
10
10
  /**
11
- * AST for Grid Filter
11
+ * AST for Current Grid Filter
12
12
  */
13
13
  gridFilterAST: any;
14
14
  /**
@@ -1,15 +1,20 @@
1
+ import { ColumnValuesComparer } from '../../AdaptableOptions/CustomSortOptions';
1
2
  import { CustomSort } from '../CustomSortState';
2
3
  import { ColumnSort } from './ColumnSort';
3
4
  /**
4
- * Overview of current sorting state in the grid
5
+ * Overview of current, live, sorting state in grid
5
6
  */
6
7
  export interface AdaptableSortState {
7
8
  /**
8
- * Which columns have sorting applied and,if so, which direction
9
+ * Columns currently being sorted (with direction)
9
10
  */
10
11
  columnSorts: ColumnSort[];
11
12
  /**
12
- * All active Custom Sorts in State
13
+ * Custom Sorts which are currently applied
13
14
  */
14
15
  customSorts: CustomSort[];
16
+ /**
17
+ * Custom Sort Comparers which are currently applied
18
+ */
19
+ customSortComparers: ColumnValuesComparer[];
15
20
  }
@@ -1,3 +1,4 @@
1
+ import { ColumnValuesComparer } from '../AdaptableOptions/CustomSortOptions';
1
2
  import { CustomSortState, CustomSort } from '../AdaptableState/CustomSortState';
2
3
  /**
3
4
  * Provides run-time access to the Custom Sort function
@@ -16,19 +17,28 @@ export interface CustomSortApi {
16
17
  /**
17
18
  * Retrieves Custom Sort by the technical ID (from `CustomSortState`)
18
19
  * @param id Custom Sort technical id
19
- * @returns sort column
20
+ * @returns Custom Sort
20
21
  */
21
22
  getCustomSortById(id: CustomSort['Uuid']): CustomSort;
23
+ /**
24
+ * Retrieves all Custom Sorts in Adaptable State that are currently applied
25
+ * @returns Custom Sorts
26
+ */
27
+ getLiveCustomSorts(): CustomSort[];
28
+ /**
29
+ * Returns all Custom Sort Comparers in Custom Sort Options that are currently applied
30
+ */
31
+ getLiveCustomSortComparers(): ColumnValuesComparer[];
22
32
  /**
23
33
  * Retrieves all Custom Sorts that are active (not-suspended) in Adaptable State
24
- * @returns sort columns
34
+ * @returns Custom Sorts
25
35
  */
26
36
  getActiveCustomSorts(config?: {
27
37
  includeLayoutNotAssociatedObjects?: boolean;
28
38
  }): CustomSort[];
29
39
  /**
30
40
  * Retrieves all Custom Sorts that are suspended in Adaptable State
31
- * @returns sort columns
41
+ * @returns Custom Sorts
32
42
  */
33
43
  getSuspendedCustomSorts(config?: {
34
44
  includeLayoutNotAssociatedObjects?: boolean;
@@ -36,27 +46,27 @@ export interface CustomSortApi {
36
46
  /**
37
47
  * Retrieves Custom Sort from Adaptable State for Column with given ColumnId
38
48
  * @param columnId Id of Column to retrieve Custom Sort for
39
- * @returns sort column
49
+ * @returns Custom Sort
40
50
  */
41
51
  getCustomSortForColumn(columnId: string): CustomSort | undefined;
42
52
  /**
43
53
  * Adds a Custom Sort to Custom Sort collection in Adaptable State
44
54
  * @param customSort Custom Sort to add
45
- * @returns sort column
55
+ * @returns Custom Sort
46
56
  */
47
57
  addCustomSort(customSort: CustomSort): CustomSort;
48
58
  /**
49
59
  * Creates new Custom Sort based on given values
50
60
  * @param columnId Id of Column to which to apply Custom Sort
51
61
  * @param values Custom Sort values to apply
52
- * @returns sort column
62
+ * @returns Custom Sort
53
63
  */
54
64
  createCustomSort(columnId: string, values: string[]): CustomSort;
55
65
  /**
56
66
  * Updates existing Custom Sort with new set of Sorted Values
57
67
  * @param columnId Id of Column on which to edit the Custom Sort
58
68
  * @param values Custom Sort values to use (replaces what was previously used)
59
- * @returns sort column
69
+ * @returns Custom Sort
60
70
  */
61
71
  editCustomSort(columnId: string, values: string[]): CustomSort;
62
72
  /**
@@ -67,7 +77,7 @@ export interface CustomSortApi {
67
77
  /**
68
78
  * Suspends Custom Sort
69
79
  * @param customSort Custom Sort to suspend
70
- * @returns sort column
80
+ * @returns Custom Sort
71
81
  */
72
82
  suspendCustomSort(customSort: CustomSort): CustomSort;
73
83
  /**
@@ -81,7 +91,7 @@ export interface CustomSortApi {
81
91
  /**
82
92
  * Un-suspends or activates a suspended Custom Sort
83
93
  * @param customSort Custom Sort to suspend
84
- * @returns sort column
94
+ * @returns Custom Sort
85
95
  */
86
96
  unSuspendCustomSort(customSort: CustomSort): CustomSort;
87
97
  /**
@@ -3,6 +3,7 @@ import { CustomSortApi } from '../CustomSortApi';
3
3
  import { CustomSort, CustomSortState } from '../../AdaptableState/CustomSortState';
4
4
  import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
5
5
  import { CustomSortInternalApi } from '../Internal/CustomSortInternalApi';
6
+ import { ColumnValuesComparer } from '../../AdaptableOptions/CustomSortOptions';
6
7
  export declare class CustomSortApiImpl extends ApiBase implements CustomSortApi {
7
8
  internalApi: CustomSortInternalApi;
8
9
  constructor(_adaptable: IAdaptable);
@@ -11,6 +12,8 @@ export declare class CustomSortApiImpl extends ApiBase implements CustomSortApi
11
12
  includeLayoutNotAssociatedObjects?: boolean;
12
13
  }): CustomSort[];
13
14
  getCustomSortById(id: CustomSort['Uuid']): CustomSort;
15
+ getLiveCustomSorts(): CustomSort[];
16
+ getLiveCustomSortComparers(): ColumnValuesComparer[];
14
17
  getActiveCustomSorts(config?: {
15
18
  includeLayoutNotAssociatedObjects?: boolean;
16
19
  }): CustomSort[];
@@ -16,6 +16,42 @@ export class CustomSortApiImpl extends ApiBase {
16
16
  getCustomSortById(id) {
17
17
  return this.getCustomSorts().find((customSort) => customSort.Uuid === id);
18
18
  }
19
+ getLiveCustomSorts() {
20
+ let returnVals = [];
21
+ const sortedColIds = this.getGridApi()
22
+ .getColumnSorts()
23
+ .map((c) => c.ColumnId);
24
+ const activeCustomSorts = this.getActiveCustomSorts();
25
+ if (sortedColIds == undefined || activeCustomSorts == undefined) {
26
+ return returnVals;
27
+ }
28
+ sortedColIds.forEach((columnId) => {
29
+ const customSort = activeCustomSorts.find((c) => c.ColumnId == columnId);
30
+ if (customSort) {
31
+ returnVals.push(customSort);
32
+ }
33
+ });
34
+ return returnVals;
35
+ }
36
+ getLiveCustomSortComparers() {
37
+ let returnComparers = [];
38
+ const sortedColIds = this.getGridApi()
39
+ .getColumnSorts()
40
+ .map((c) => c.ColumnId);
41
+ const sortedCols = this.getColumnApi().getColumnsWithColumnIds(sortedColIds);
42
+ const customSortComparers = this.getCustomSortOptions().customSortComparers;
43
+ if (sortedColIds == undefined || customSortComparers == undefined) {
44
+ return returnComparers;
45
+ }
46
+ const scopeApi = this.getColumnScopeApi();
47
+ sortedCols.forEach((column) => {
48
+ const comparer = customSortComparers.find((acs) => scopeApi.isColumnInScope(column, acs.scope));
49
+ if (comparer && !returnComparers.includes(comparer)) {
50
+ returnComparers.push(comparer);
51
+ }
52
+ });
53
+ return returnComparers;
54
+ }
19
55
  getActiveCustomSorts(config) {
20
56
  return this.getCustomSorts(config).filter((customSort) => !customSort.IsSuspended);
21
57
  }
@@ -17,7 +17,7 @@ import { FreeTextColumnState } from '../../AdaptableState/FreeTextColumnState';
17
17
  import { ToolPanelState } from '../../AdaptableState/ToolPanelState';
18
18
  import { StateApi } from '../StateApi';
19
19
  import { AdaptableModule, AdaptableStateKey } from '../../AdaptableState/Common/Types';
20
- import { AdaptableOptions, AdaptableFilterState, AdaptableSortState, FlashingCellState, InitialState, NamedQueryState, ScheduleState, StatusBarState, StyledColumnState } from '../../types';
20
+ import { AdaptableFilterState, AdaptableSortState, FlashingCellState, InitialState, NamedQueryState, ScheduleState, StatusBarState, StyledColumnState } from '../../types';
21
21
  import { PredefinedConfig } from '../../AdaptableState/InitialState';
22
22
  import { ChartingState } from '../../AdaptableState/ChartingState';
23
23
  import { NoteState } from '../../AdaptableState/NoteState';
@@ -35,7 +35,6 @@ export declare class StateApiImpl extends ApiBase implements StateApi {
35
35
  loadUserState(state: InitialState): void;
36
36
  getAdaptableFilterState(): AdaptableFilterState;
37
37
  getAdaptableSortState(): AdaptableSortState;
38
- getAdaptableOptions(): Readonly<AdaptableOptions>;
39
38
  setAdaptableStateKey(adaptableStateKey: string, config?: {
40
39
  initialState?: InitialState;
41
40
  flushCurrentState?: boolean;
@@ -109,13 +109,11 @@ export class StateApiImpl extends ApiBase {
109
109
  getAdaptableSortState() {
110
110
  const adaptableSortState = {
111
111
  columnSorts: this.getGridApi().getColumnSorts(),
112
- customSorts: this.getCustomSortApi().getActiveCustomSorts(),
112
+ customSorts: this.getCustomSortApi().getLiveCustomSorts(),
113
+ customSortComparers: this.getCustomSortApi().getLiveCustomSortComparers(),
113
114
  };
114
115
  return adaptableSortState;
115
116
  }
116
- getAdaptableOptions() {
117
- return undefined;
118
- }
119
117
  setAdaptableStateKey(adaptableStateKey, config) {
120
118
  return new Promise((resolve, reject) => {
121
119
  this.getAdaptableInternalApi().executeWithProgressIndicator(config?.progressIndicatorLabel ?? `Initialising...`, () => {
@@ -3,12 +3,14 @@ import isEqual from 'lodash/isEqual';
3
3
  export class EventInternalApi extends ApiBase {
4
4
  fireGridSortedEvent() {
5
5
  if (this.isAdapTableReady()) {
6
- const adaptableSortState = this.getStateApi().getAdaptableSortState();
7
- const gridSortedInfo = {
8
- adaptableSortState,
9
- ...this.getAdaptableInternalApi().buildBaseContext(),
10
- };
11
- this.getEventApi().emit('GridSorted', gridSortedInfo);
6
+ setTimeout(() => {
7
+ const adaptableSortState = this.getStateApi().getAdaptableSortState();
8
+ const gridSortedInfo = {
9
+ adaptableSortState,
10
+ ...this.getAdaptableInternalApi().buildBaseContext(),
11
+ };
12
+ this.getEventApi().emit('GridSorted', gridSortedInfo);
13
+ }, 50);
12
14
  }
13
15
  }
14
16
  fireCellChangedEvent(cellDataChangedInfo) {
@@ -29,7 +29,7 @@ export const ColumnValuesSelect = (props) => {
29
29
  minWidth: `var(--ab-cmp-select-column-menu-${column.columnId}__min-width, var(--ab-cmp-select-column-menu__min-width, 160px))`,
30
30
  };
31
31
  }, [column.columnId]);
32
- const component = (React.createElement(Select, { isMulti: true, showHeaderSelectionCheckbox: true, searchable: true, closeMenuOnSelect: false, menuStyle: menuStyle, ...props.selectProps, options: options, value: value, isLoading: props.isLoading, onChange: props.onChange }));
32
+ const component = (React.createElement(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 }));
33
33
  return (React.createElement("div", { className: join(baseClassName, props.isLoading && `${baseClassName}--loading`, !value.length && `${baseClassName}--empty`), onKeyDownCapture: (e) => {
34
34
  const event = e.nativeEvent || e;
35
35
  event.stopPropagation = () => {
@@ -1353,8 +1353,8 @@ You need to define at least one Layout!`);
1353
1353
  * Action2: Set Selected Cells (on a debounce)
1354
1354
  */
1355
1355
  this.agGridAdapter.getAgGridApi().addEventListener('sortChanged', (this.listenerSortChanged = () => {
1356
- this.api.eventApi.internalApi.fireGridSortedEvent();
1357
1356
  this.debouncedSetSelectedCells();
1357
+ this.api.eventApi.internalApi.fireGridSortedEvent();
1358
1358
  }));
1359
1359
  /**
1360
1360
  * Use Case: Charts have been created or destroyed, Chart ranges selected or Chart options changed
@@ -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;
@@ -5,8 +5,17 @@ import CreatableSelect from 'react-select/creatable';
5
5
  import { Icon } from '../icons';
6
6
  import { Box } from 'rebass';
7
7
  import { DataSource, InfiniteTable, } from '@infinite-table/infinite-react';
8
- import { useMemo } from 'react';
8
+ import { useCallback, useMemo } from 'react';
9
9
  import join from '../utils/join';
10
+ import { Resizable } from 're-resizable';
11
+ const resizableDirections = {
12
+ right: true,
13
+ bottom: true,
14
+ bottomRight: true,
15
+ };
16
+ const defaultResizableSize = {
17
+ width: '100%',
18
+ };
10
19
  const checkboxStyle = {
11
20
  position: 'relative',
12
21
  top: 1,
@@ -15,7 +24,7 @@ const INFINITE_DOM_PROPS = {
15
24
  style: {
16
25
  height: '100%',
17
26
  minHeight: `var(--ab-cmp-select-menu__min-height, 25rem)`,
18
- maxHeight: '50vh',
27
+ // maxHeight: '50vh',
19
28
  width: '100%',
20
29
  },
21
30
  };
@@ -148,6 +157,7 @@ export const Select = function (props) {
148
157
  } }));
149
158
  };
150
159
  }, []);
160
+ const resizable = props.resizable ?? false;
151
161
  const ValueContainer = React.useMemo(() => {
152
162
  return (props) => {
153
163
  let { children, ...inputProps } = props;
@@ -176,24 +186,33 @@ export const Select = function (props) {
176
186
  } }, children));
177
187
  };
178
188
  }, [renderMultipleValues, props.placeholder]);
189
+ const sizeRef = React.useRef({ ...defaultResizableSize });
179
190
  const MenuComponent = React.useMemo(() => {
180
191
  return (inputProps) => {
181
192
  const { isLoading } = inputProps;
193
+ const theChildren = (React.createElement(React.Fragment, null,
194
+ inputProps.children,
195
+ React.createElement("div", { style: {
196
+ display: isLoading ? 'block' : 'none',
197
+ position: 'absolute',
198
+ inset: 0,
199
+ background: `var(--ab-cmp-select-loading__background)`,
200
+ zIndex: 1,
201
+ } })));
202
+ const onResizeStop = useCallback((_e, _direction, ref) => {
203
+ const newSize = {
204
+ width: ref.style.width,
205
+ height: ref.style.height,
206
+ };
207
+ sizeRef.current = newSize;
208
+ }, []);
182
209
  return (React.createElement(React.Fragment, null,
183
210
  React.createElement(components.Menu, { ...inputProps, innerProps: {
184
211
  'data-name': 'menu-container',
185
212
  ...inputProps.innerProps,
186
- } },
187
- inputProps.children,
188
- React.createElement("div", { style: {
189
- display: isLoading ? 'block' : 'none',
190
- position: 'absolute',
191
- inset: 0,
192
- background: `var(--ab-cmp-select-loading__background)`,
193
- zIndex: 1,
194
- } }))));
213
+ } }, resizable ? (React.createElement(Resizable, { enable: resizableDirections, minWidth: '100%', maxHeight: '60vh', maxWidth: '60vw', defaultSize: sizeRef.current, onResizeStop: onResizeStop }, theChildren)) : (theChildren))));
195
214
  };
196
- }, []);
215
+ }, [resizable]);
197
216
  const SelectComponent = props.isCreatable ? CreatableSelect : ReactSelect;
198
217
  const ClearIndicator = React.useMemo(() => {
199
218
  return (clearIndicatorProps) => {
@@ -425,7 +444,7 @@ export const Select = function (props) {
425
444
  zIndex: 999999,
426
445
  boxShadow: 'var(--ab-cmp-select-menu__box-shadow)',
427
446
  minWidth: `var(--ab-cmp-select-menu__min-width)`,
428
- width: `${Math.max(maxLabelLength, 10)}ch`,
447
+ width: resizable ? '100%' : `${Math.max(maxLabelLength, 10)}ch`,
429
448
  '--ab-cmp-select-menu__min-height': `min(${(props.options || []).length + (showHeaderSelectionCheckbox ? 1 : 0)} * var(--ab-grid-row-height), 20rem)`,
430
449
  maxHeight: 'var(--ab-cmp-select-menu__max-height)',
431
450
  maxWidth: 'var(--ab-cmp-select-menu__max-width)',
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: 1747747693470 || Date.now(),
4
- VERSION: "20.1.4" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1748008314697 || Date.now(),
4
+ VERSION: "20.1.5" || '--current-version--',
5
5
  };