@adaptabletools/adaptable 20.1.2 → 20.1.4

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.
Files changed (62) hide show
  1. package/base.css +1 -0
  2. package/base.css.map +1 -1
  3. package/index.css +1 -0
  4. package/index.css.map +1 -1
  5. package/package.json +1 -1
  6. package/src/AdaptableState/Common/{AdaptableSearchState.d.ts → AdaptableFilterState.d.ts} +7 -7
  7. package/src/AdaptableState/Common/AdaptableSortState.d.ts +1 -1
  8. package/src/Api/Implementation/StateApiImpl.d.ts +2 -2
  9. package/src/Api/Implementation/StateApiImpl.js +5 -5
  10. package/src/Api/Internal/EventInternalApi.js +1 -1
  11. package/src/Api/Internal/ExportInternalApi.js +1 -1
  12. package/src/Api/StateApi.d.ts +3 -3
  13. package/src/Redux/Store/AdaptableStore.js +7 -6
  14. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.js +2 -2
  15. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.js +2 -2
  16. package/src/View/CellSummary/CellSummaryDetails.js +2 -2
  17. package/src/View/CellSummary/CellSummaryViewPanel.js +2 -2
  18. package/src/View/ColumnInfo/ColumnInfo.js +2 -2
  19. package/src/View/Comments/CommentsPopup.js +2 -2
  20. package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +7 -1
  21. package/src/View/Components/Forms/AdaptableFormControlTextClear.js +1 -1
  22. package/src/View/Components/PreviewResultsPanel.js +2 -2
  23. package/src/View/Components/Selectors/BulkUpdateValueSelector.js +2 -2
  24. package/src/View/Components/Selectors/PermittedValuesSelector.js +1 -1
  25. package/src/View/Components/WizardSummaryPage.js +2 -2
  26. package/src/View/Dashboard/CustomDashboardButton.js +1 -1
  27. package/src/View/Dashboard/Dashboard.js +2 -2
  28. package/src/View/Dashboard/DashboardToolbarFactory.js +1 -1
  29. package/src/View/DataChangeHistory/DataChangeHistoryViewPanel.js +8 -9
  30. package/src/View/DataImport/DataImportWizard/sections/ColumnsSection.js +2 -2
  31. package/src/View/DataImport/DataImportWizard/sections/DataPreview.js +2 -2
  32. package/src/View/DataSet/DataSetViewPanel.js +1 -1
  33. package/src/View/Export/ReportFormatSelector.js +1 -1
  34. package/src/View/Export/ReportNameSelector.js +1 -1
  35. package/src/View/Filter/FilterViewPanel.js +2 -2
  36. package/src/View/GridFilter/GridFilterViewPanel.js +1 -1
  37. package/src/View/Layout/LayoutViewPanel.js +1 -1
  38. package/src/View/Layout/PivotDetailsPopoup.js +2 -2
  39. package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -2
  40. package/src/View/Note/NotePopup.js +2 -2
  41. package/src/View/SmartEdit/SmartEditViewPanel.js +1 -1
  42. package/src/View/StateManagement/components/LoadButton.js +1 -1
  43. package/src/View/Theme/ThemeSelector.js +1 -1
  44. package/src/agGrid/AdaptableAgGrid.d.ts +10 -0
  45. package/src/agGrid/AdaptableAgGrid.js +66 -28
  46. package/src/agGrid/AgGridExportAdapter.js +1 -1
  47. package/src/components/Dashboard/DashboardToolbar.js +2 -2
  48. package/src/components/Datepicker/index.js +50 -5
  49. package/src/components/Icon/index.js +1 -1
  50. package/src/components/InfiniteTable/index.d.ts +2 -2
  51. package/src/components/InfiniteTable/index.js +2 -2
  52. package/src/components/List/GridList/index.js +2 -2
  53. package/src/components/Select/Select.d.ts +2 -0
  54. package/src/components/Select/Select.js +1 -1
  55. package/src/components/SimpleButton/index.js +5 -1
  56. package/src/env.js +2 -2
  57. package/src/layout-manager/src/index.js +32 -3
  58. package/src/metamodel/adaptable.metamodel.d.ts +10 -10
  59. package/src/metamodel/adaptable.metamodel.js +1 -1
  60. package/src/types.d.ts +1 -1
  61. package/tsconfig.esm.tsbuildinfo +1 -1
  62. /package/src/AdaptableState/Common/{AdaptableSearchState.js → AdaptableFilterState.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import OverlayTrigger from '../OverlayTrigger';
3
- import { useEffect, useState } from 'react';
3
+ import { useCallback, useEffect, useRef, useState } from 'react';
4
4
  import useProperty from '../utils/useProperty';
5
5
  import FieldWrap from '../FieldWrap';
6
6
  import SimpleButton from '../SimpleButton';
@@ -10,9 +10,45 @@ import { useDatepickerContext } from './DatepickerContext';
10
10
  import { DayPicker } from 'react-day-picker';
11
11
  import { AdaptableDateInlineInput } from '../../View/Components/AdaptableInput/AdaptableDateInlineInput';
12
12
  import { isValid, addYears, endOfYear, startOfYear, addDays, addBusinessDays, } from 'date-fns';
13
- const DatepickerOverlay = ({ onHide, children, onKeyDown, onMouseDown, }) => {
13
+ import { Select } from '../Select';
14
+ const onDatePickerDropdownKeyDown = (e) => {
15
+ if (e.key === 'Escape' || e.key === 'Enter') {
16
+ e.stopPropagation();
17
+ }
18
+ };
19
+ const DatePickerComponents = {
20
+ YearsDropdown: (props) => {
21
+ const onChange = useCallback((value) => {
22
+ props.onChange?.({
23
+ target: {
24
+ value,
25
+ },
26
+ });
27
+ }, [props.onChange]);
28
+ return (React.createElement(Select, { onKeyDown: onDatePickerDropdownKeyDown, value: props.value, onChange: onChange, options: props.options }));
29
+ },
30
+ MonthsDropdown: (props) => {
31
+ const onChange = useCallback((value) => {
32
+ props.onChange?.({
33
+ target: {
34
+ value,
35
+ },
36
+ });
37
+ }, [props.onChange]);
38
+ return (React.createElement(Select, { onKeyDown: onDatePickerDropdownKeyDown, value: `${props.value}`, onChange: onChange, options: props.options.map((option) => {
39
+ return {
40
+ label: option.label,
41
+ value: `${option.value}`,
42
+ };
43
+ }) }));
44
+ },
45
+ };
46
+ const DatepickerOverlay = ({ onHide, children, onKeyDown, onMouseDown, overlayDOMRef, }) => {
14
47
  const domRef = React.useRef(null);
15
- return (React.createElement("div", { className: "ab-Datepicker-Overlay", ref: domRef, onKeyDown: onKeyDown, onMouseDown: onMouseDown, onBlur: (e) => {
48
+ return (React.createElement("div", { className: "ab-Datepicker-Overlay", tabIndex: -1, ref: (el) => {
49
+ domRef.current = el;
50
+ overlayDOMRef.current = el;
51
+ }, onKeyDown: onKeyDown, onMouseDown: onMouseDown, onBlur: (e) => {
16
52
  const { relatedTarget } = e;
17
53
  const node = domRef.current;
18
54
  // relatedTarget is the newly focused element as a result of this blur event
@@ -74,13 +110,14 @@ export const Datepicker = React.forwardRef((props, ref) => {
74
110
  clearValue();
75
111
  }, accessLevel: 'Full' })) : null;
76
112
  const calendarButton = (React.createElement(SimpleButton, { disabled: disabled, variant: "text", icon: "calendar", tooltip: "Date", iconSize: 20, px: 0, py: 0, onClick: () => setVisible(true) }));
113
+ const overlayDOMRef = useRef(null);
77
114
  return (React.createElement(Flex, null,
78
- React.createElement(OverlayTrigger, { visible: visible, render: () => (React.createElement(DatepickerOverlay, { onMouseDown: props.onMouseDown, onHide: () => setVisible(false), onKeyDown: (e) => {
115
+ React.createElement(OverlayTrigger, { visible: visible, render: () => (React.createElement(DatepickerOverlay, { overlayDOMRef: overlayDOMRef, onMouseDown: props.onMouseDown, onHide: () => setVisible(false), onKeyDown: (e) => {
79
116
  if (e.key === 'Escape' || e.key === 'Enter') {
80
117
  setVisible(false, e.key);
81
118
  }
82
119
  } },
83
- React.createElement(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(Flex, { justifyContent: "space-between", mt: 2, flexWrap: 'wrap' }, footerButtons) }))) },
120
+ React.createElement(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(Flex, { justifyContent: "space-between", mt: 2, flexWrap: 'wrap' }, footerButtons) }))) },
84
121
  React.createElement(FieldWrap, { ...boxProps, style: {
85
122
  borderRadius: style?.borderRadius,
86
123
  width: style?.width,
@@ -90,6 +127,14 @@ export const Datepicker = React.forwardRef((props, ref) => {
90
127
  if (!visible) {
91
128
  setVisible(true);
92
129
  }
130
+ }, onBlur: (e) => {
131
+ const { relatedTarget } = e;
132
+ const overlayDOMNode = overlayDOMRef.current;
133
+ if ((overlayDOMNode && relatedTarget == overlayDOMNode) ||
134
+ overlayDOMNode?.contains(relatedTarget)) {
135
+ return;
136
+ }
137
+ setVisible(false);
93
138
  } },
94
139
  React.createElement(AdaptableDateInlineInput, { ref: ref, value: inputValue,
95
140
  // We do not want to show the format when the date-picker is visible
@@ -34,7 +34,7 @@ export const IconComponent = (props) => {
34
34
  };
35
35
  }, [icon]);
36
36
  if (isAdaptableSystemIcon(icon) && icon.name in allIcons) {
37
- return (React.createElement(Icon, { name: icon.name, size: icon.size, style: icon.style, className: className }));
37
+ return (React.createElement(Icon, { "aria-hidden": "true", name: icon.name, size: icon.size, style: icon.style, className: className }));
38
38
  }
39
39
  if (isAdaptableCustomIcon(icon)) {
40
40
  let width = icon.style?.width ?? 'var(--ab-cmp-icon__width)';
@@ -1,5 +1,5 @@
1
1
  import { InfiniteTableProps } from '@infinite-table/infinite-react';
2
2
  export * from '@infinite-table/infinite-react';
3
3
  import * as React from 'react';
4
- declare function InfiniteTable<T = any>(props: InfiniteTableProps<T>): React.JSX.Element;
5
- export { InfiniteTable };
4
+ declare function InfiniteTableGrid<T = any>(props: InfiniteTableProps<T>): React.JSX.Element;
5
+ export { InfiniteTableGrid };
@@ -2,8 +2,8 @@ import { InfiniteTable as InfiniteTableComponent, } from '@infinite-table/infini
2
2
  export * from '@infinite-table/infinite-react';
3
3
  import { INFINITE_TABLE_LICENSE_KEY } from '../../EnvVars';
4
4
  import * as React from 'react';
5
- function InfiniteTable(props) {
5
+ function InfiniteTableGrid(props) {
6
6
  return (React.createElement(InfiniteTableComponent, { sortable: false, rowHeight: '--ab-grid-row-height', draggableColumns: false, keyboardNavigation: false, ...props, licenseKey: INFINITE_TABLE_LICENSE_KEY }));
7
7
  }
8
8
  InfiniteTableComponent.licenseKey = INFINITE_TABLE_LICENSE_KEY;
9
- export { InfiniteTable };
9
+ export { InfiniteTableGrid };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { DataSource, InfiniteTable } from '../../../components/InfiniteTable';
2
+ import { DataSource, InfiniteTableGrid, } from '../../../components/InfiniteTable';
3
3
  import join from '../../utils/join';
4
4
  const baseClassName = 'ab-GridList';
5
5
  const columnsMap = {
@@ -13,7 +13,7 @@ const GridList = (props) => {
13
13
  };
14
14
  }).filter((data) => !!data.item);
15
15
  return (React.createElement(DataSource, { data: data, primaryKey: "id" },
16
- React.createElement(InfiniteTable, { header: false, showZebraRows: props.showZebraRows, rowHeight: props.rowHeight ?? '--ab-grid-row-height', domProps: {
16
+ React.createElement(InfiniteTableGrid, { header: false, showZebraRows: props.showZebraRows, rowHeight: props.rowHeight ?? '--ab-grid-row-height', domProps: {
17
17
  className: join(baseClassName, props.className),
18
18
  style: {
19
19
  minHeight: '15rem',
@@ -43,8 +43,10 @@ export type SelectProps<SelectValue extends unknown, IsMulti extends boolean = f
43
43
  };
44
44
  onInputChange?: (value: string) => void;
45
45
  onMenuOpen?: VoidFunction;
46
+ 'aria-label'?: string;
46
47
  size?: 'small' | 'normal';
47
48
  isCreatable?: boolean;
48
49
  menuPortalTarget?: HTMLElement;
50
+ onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
49
51
  };
50
52
  export declare const Select: <SelectValue extends unknown, IsMulti extends boolean = false>(props: SelectProps<SelectValue, IsMulti>) => React.JSX.Element;
@@ -365,7 +365,7 @@ export const Select = function (props) {
365
365
  setInputValue(value);
366
366
  props.onInputChange?.(value);
367
367
  }, [props.onInputChange, isMulti]);
368
- return (React.createElement(SelectComponent, { ref: ref, inputValue: inputValue, onInputChange: onInputChange, onFocus: onFocus, onBlur: onBlur, onMenuOpen: props.onMenuOpen, isLoading: props.isLoading, options: props.options, className: join(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',
368
+ 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: join(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',
369
369
  // This needed so the menu is not clipped by overflow: hidden
370
370
  menuPortalTarget: props.menuPortalTarget === undefined ? document.body : null, isClearable: props.isClearable, closeMenuOnSelect: props.closeMenuOnSelect, onChange: (option) => {
371
371
  if (isMulti) {
@@ -81,7 +81,11 @@ const SimpleButton = React.forwardRef((givenProps, theRef) => {
81
81
  const fontWeight = buttonProps.fontWeight
82
82
  ? theme[buttonProps.fontWeight] ?? buttonProps.fontWeight ?? 'normal'
83
83
  : 'normal';
84
- const btn = (React.createElement(Button, { ...buttonProps, disabled: disabled, className: join(className, baseClassName, disabled ? `${baseClassName}--disabled` : '', fontWeight ? `${baseClassName}--font-weight=${fontWeight}` : '', `${baseClassName}--variant-${variant}`, `${baseClassName}--tone-${tone}`), ref: theRef }, children));
84
+ const btn = (React.createElement(Button, { ...buttonProps, "aria-label": buttonProps['aria-label'] ||
85
+ buttonProps.label ||
86
+ tooltip ||
87
+ buttonProps.title ||
88
+ `${buttonProps.key}`, disabled: disabled, className: join(className, baseClassName, disabled ? `${baseClassName}--disabled` : '', fontWeight ? `${baseClassName}--font-weight=${fontWeight}` : '', `${baseClassName}--variant-${variant}`, `${baseClassName}--tone-${tone}`), ref: theRef }, children));
85
89
  return tooltip ? React.createElement(Tooltip, { label: tooltip }, btn) : btn;
86
90
  });
87
91
  export default SimpleButton;
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: 1746687651579 || Date.now(),
4
- VERSION: "20.1.2" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1747747693470 || Date.now(),
4
+ VERSION: "20.1.4" || '--current-version--',
5
5
  };
@@ -242,19 +242,28 @@ export class LayoutManager extends LMEmitter {
242
242
  : this.getTableLayoutModelFromGrid();
243
243
  }
244
244
  getPivotLayoutModelFromGrid() {
245
- const pivotResultColumnsSet = new Set((this.gridApi.getPivotResultColumns() || []).map((col) => col.getColId()));
245
+ const pivotResultColumns = this.gridApi.getPivotResultColumns() || [];
246
+ const pivotResultColumnsSet = new Set(pivotResultColumns.map((col) => col.getColId()));
246
247
  const prevLayout = this.currentLayout;
247
248
  const columnState = this.gridApi
248
249
  .getColumnState()
249
250
  .filter((col) => !pivotResultColumnsSet.has(col.colId));
250
251
  let PivotColumns = this.gridApi.getPivotColumns().map((col) => col.getColId());
251
252
  const layout = this.getUndecidedLayoutModelFromGrid(columnState);
253
+ let ColumnWidths = layout.ColumnWidths || {};
254
+ //let's also include the column widths of the pivotResult columns
255
+ pivotResultColumns.forEach((col) => {
256
+ ColumnWidths[col.getColId()] = col.getActualWidth();
257
+ });
258
+ if (!Object.keys(ColumnWidths).length) {
259
+ ColumnWidths = undefined;
260
+ }
252
261
  delete layout.TableColumns;
253
262
  const pivotLayout = {
254
263
  PivotColumns,
255
264
  ColumnPinning: layout.ColumnPinning,
256
265
  ColumnSorts: layout.ColumnSorts,
257
- ColumnWidths: layout.ColumnWidths,
266
+ ColumnWidths,
258
267
  ColumnVisibility: layout.ColumnVisibility,
259
268
  RowGroupValues: layout.RowGroupValues,
260
269
  PivotGroupedColumns: layout.RowGroupedColumns,
@@ -821,7 +830,10 @@ export class LayoutManager extends LMEmitter {
821
830
  return acc;
822
831
  }, {});
823
832
  columnState.applyOrder = true;
824
- const columnIds = getColumnOrderIdsForAllColDefs([...layout.PivotColumns, ...layout.PivotAggregationColumns.map((col) => col.ColumnId)], this.gridApi.getColumnDefs());
833
+ const columnIds = getColumnOrderIdsForAllColDefs([
834
+ ...layout.PivotColumns,
835
+ ...(layout.PivotAggregationColumns || []).map((col) => col.ColumnId),
836
+ ], this.gridApi.getColumnDefs());
825
837
  const pivotAggsToIndexes = layout.PivotAggregationColumns.reduce((acc, { ColumnId }, index) => {
826
838
  acc[ColumnId] = index;
827
839
  return acc;
@@ -1036,6 +1048,23 @@ export class LayoutManager extends LMEmitter {
1036
1048
  // now recompute and apply the last one
1037
1049
  this.computePivotAggregations(layout, columnState);
1038
1050
  this.gridApi.applyColumnState(columnState);
1051
+ // let's also include the column widths of the pivotResult columns
1052
+ // we can't simply include those in the columnState because the columnState will also apply order
1053
+ // but we don't want to affect the order of the pivotResult columns
1054
+ // so we'll do it manually, and apply the widths after the columnState
1055
+ // by using the gridApi.setColumnWidths method
1056
+ if (layout.ColumnWidths) {
1057
+ const colWidthForPivotResultColumns = [];
1058
+ (this.gridApi.getPivotResultColumns() || []).forEach((col) => {
1059
+ const colId = col.getColId();
1060
+ if (layout.ColumnWidths[colId]) {
1061
+ colWidthForPivotResultColumns.push({ key: colId, newWidth: layout.ColumnWidths[colId] });
1062
+ }
1063
+ });
1064
+ if (colWidthForPivotResultColumns.length) {
1065
+ this.gridApi.setColumnWidths(colWidthForPivotResultColumns);
1066
+ }
1067
+ }
1039
1068
  this.applyPivotExpandLevel(layout);
1040
1069
  const hasGroupedColumns = layout.PivotGroupedColumns && layout.PivotGroupedColumns.length;
1041
1070
  // but also let's not forget to apply the row group values
@@ -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;