@adaptabletools/adaptable-cjs 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-cjs",
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[];
@@ -20,6 +20,42 @@ class CustomSortApiImpl extends ApiBase_1.ApiBase {
20
20
  getCustomSortById(id) {
21
21
  return this.getCustomSorts().find((customSort) => customSort.Uuid === id);
22
22
  }
23
+ getLiveCustomSorts() {
24
+ let returnVals = [];
25
+ const sortedColIds = this.getGridApi()
26
+ .getColumnSorts()
27
+ .map((c) => c.ColumnId);
28
+ const activeCustomSorts = this.getActiveCustomSorts();
29
+ if (sortedColIds == undefined || activeCustomSorts == undefined) {
30
+ return returnVals;
31
+ }
32
+ sortedColIds.forEach((columnId) => {
33
+ const customSort = activeCustomSorts.find((c) => c.ColumnId == columnId);
34
+ if (customSort) {
35
+ returnVals.push(customSort);
36
+ }
37
+ });
38
+ return returnVals;
39
+ }
40
+ getLiveCustomSortComparers() {
41
+ let returnComparers = [];
42
+ const sortedColIds = this.getGridApi()
43
+ .getColumnSorts()
44
+ .map((c) => c.ColumnId);
45
+ const sortedCols = this.getColumnApi().getColumnsWithColumnIds(sortedColIds);
46
+ const customSortComparers = this.getCustomSortOptions().customSortComparers;
47
+ if (sortedColIds == undefined || customSortComparers == undefined) {
48
+ return returnComparers;
49
+ }
50
+ const scopeApi = this.getColumnScopeApi();
51
+ sortedCols.forEach((column) => {
52
+ const comparer = customSortComparers.find((acs) => scopeApi.isColumnInScope(column, acs.scope));
53
+ if (comparer && !returnComparers.includes(comparer)) {
54
+ returnComparers.push(comparer);
55
+ }
56
+ });
57
+ return returnComparers;
58
+ }
23
59
  getActiveCustomSorts(config) {
24
60
  return this.getCustomSorts(config).filter((customSort) => !customSort.IsSuspended);
25
61
  }
@@ -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;
@@ -113,13 +113,11 @@ class StateApiImpl extends ApiBase_1.ApiBase {
113
113
  getAdaptableSortState() {
114
114
  const adaptableSortState = {
115
115
  columnSorts: this.getGridApi().getColumnSorts(),
116
- customSorts: this.getCustomSortApi().getActiveCustomSorts(),
116
+ customSorts: this.getCustomSortApi().getLiveCustomSorts(),
117
+ customSortComparers: this.getCustomSortApi().getLiveCustomSortComparers(),
117
118
  };
118
119
  return adaptableSortState;
119
120
  }
120
- getAdaptableOptions() {
121
- return undefined;
122
- }
123
121
  setAdaptableStateKey(adaptableStateKey, config) {
124
122
  return new Promise((resolve, reject) => {
125
123
  this.getAdaptableInternalApi().executeWithProgressIndicator(config?.progressIndicatorLabel ?? `Initialising...`, () => {
@@ -7,12 +7,14 @@ const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
7
7
  class EventInternalApi extends ApiBase_1.ApiBase {
8
8
  fireGridSortedEvent() {
9
9
  if (this.isAdapTableReady()) {
10
- const adaptableSortState = this.getStateApi().getAdaptableSortState();
11
- const gridSortedInfo = {
12
- adaptableSortState,
13
- ...this.getAdaptableInternalApi().buildBaseContext(),
14
- };
15
- this.getEventApi().emit('GridSorted', gridSortedInfo);
10
+ setTimeout(() => {
11
+ const adaptableSortState = this.getStateApi().getAdaptableSortState();
12
+ const gridSortedInfo = {
13
+ adaptableSortState,
14
+ ...this.getAdaptableInternalApi().buildBaseContext(),
15
+ };
16
+ this.getEventApi().emit('GridSorted', gridSortedInfo);
17
+ }, 50);
16
18
  }
17
19
  }
18
20
  fireCellChangedEvent(cellDataChangedInfo) {
@@ -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
@@ -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;
@@ -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) => {
@@ -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: 1747747722676 || Date.now(),
6
- VERSION: "20.1.4" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1748008344094 || Date.now(),
6
+ VERSION: "20.1.5" || '--current-version--',
7
7
  };