@adaptabletools/adaptable 22.0.0-canary.5 → 22.0.0-canary.7

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 (122) hide show
  1. package/index.css +0 -3
  2. package/index.css.map +1 -1
  3. package/package.json +1 -1
  4. package/src/AdaptableOptions/CustomSortOptions.d.ts +1 -2
  5. package/src/AdaptableState/AlertState.d.ts +6 -3
  6. package/src/AdaptableState/ChartingState.d.ts +5 -5
  7. package/src/AdaptableState/Common/AdaptableObject.d.ts +4 -9
  8. package/src/AdaptableState/Common/BaseContext.d.ts +2 -0
  9. package/src/AdaptableState/Common/ColumnHighlightInfo.d.ts +18 -0
  10. package/src/AdaptableState/Common/ColumnHighlightInfo.js +1 -0
  11. package/src/AdaptableState/Common/NamedObject.d.ts +10 -0
  12. package/src/AdaptableState/Common/NamedObject.js +1 -0
  13. package/src/AdaptableState/Common/RowSummary.d.ts +1 -1
  14. package/src/AdaptableState/Common/Schedule.d.ts +7 -3
  15. package/src/AdaptableState/Common/SuspendableObject.d.ts +10 -0
  16. package/src/AdaptableState/Common/SuspendableObject.js +1 -0
  17. package/src/AdaptableState/CustomSortState.d.ts +6 -2
  18. package/src/AdaptableState/DashboardState.d.ts +3 -3
  19. package/src/AdaptableState/ExportState.d.ts +3 -3
  20. package/src/AdaptableState/FlashingCellState.d.ts +6 -2
  21. package/src/AdaptableState/FormatColumnState.d.ts +6 -2
  22. package/src/AdaptableState/InternalState.d.ts +2 -0
  23. package/src/AdaptableState/LayoutState.d.ts +3 -3
  24. package/src/AdaptableState/NamedQueryState.d.ts +3 -3
  25. package/src/AdaptableState/PlusMinusState.d.ts +6 -2
  26. package/src/AdaptableState/ShortcutState.d.ts +6 -2
  27. package/src/AdaptableState/StyledColumnState.d.ts +1 -1
  28. package/src/AdaptableState/ThemeState.d.ts +3 -3
  29. package/src/Api/AlertApi.d.ts +6 -0
  30. package/src/Api/CustomSortApi.d.ts +6 -0
  31. package/src/Api/FlashingCellApi.d.ts +6 -0
  32. package/src/Api/FormatColumnApi.d.ts +10 -4
  33. package/src/Api/GridApi.d.ts +18 -3
  34. package/src/Api/Implementation/AlertApiImpl.d.ts +1 -0
  35. package/src/Api/Implementation/AlertApiImpl.js +3 -0
  36. package/src/Api/Implementation/ChartingApiImpl.js +2 -2
  37. package/src/Api/Implementation/CustomSortApiImpl.d.ts +1 -0
  38. package/src/Api/Implementation/CustomSortApiImpl.js +3 -0
  39. package/src/Api/Implementation/FlashingCellApiImpl.d.ts +1 -0
  40. package/src/Api/Implementation/FlashingCellApiImpl.js +3 -0
  41. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +6 -5
  42. package/src/Api/Implementation/FormatColumnApiImpl.js +6 -5
  43. package/src/Api/Implementation/GridApiImpl.d.ts +4 -0
  44. package/src/Api/Implementation/GridApiImpl.js +15 -1
  45. package/src/Api/Implementation/LayoutApiImpl.js +1 -1
  46. package/src/Api/Implementation/NamedQueryApiImpl.js +2 -2
  47. package/src/Api/Implementation/PlusMinusApiImpl.d.ts +1 -0
  48. package/src/Api/Implementation/PlusMinusApiImpl.js +3 -0
  49. package/src/Api/Implementation/ScheduleApiImpl.d.ts +1 -0
  50. package/src/Api/Implementation/ScheduleApiImpl.js +3 -0
  51. package/src/Api/Implementation/ShortcutApiImpl.d.ts +1 -0
  52. package/src/Api/Implementation/ShortcutApiImpl.js +3 -0
  53. package/src/Api/Implementation/SystemStatusApiImpl.js +4 -4
  54. package/src/Api/Internal/CalculatedColumnInternalApi.js +2 -2
  55. package/src/Api/Internal/FreeTextColumnInternalApi.js +2 -2
  56. package/src/Api/Internal/LayoutInternalApi.js +1 -1
  57. package/src/Api/Internal/NamedQueryInternalApi.js +4 -4
  58. package/src/Api/PlusMinusApi.d.ts +6 -0
  59. package/src/Api/ScheduleApi.d.ts +6 -0
  60. package/src/Api/ShortcutApi.d.ts +6 -0
  61. package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +8 -0
  62. package/src/Redux/ActionsReducers/FormatColumnRedux.js +15 -0
  63. package/src/Redux/ActionsReducers/InternalRedux.d.ts +15 -0
  64. package/src/Redux/ActionsReducers/InternalRedux.js +36 -0
  65. package/src/Redux/Store/AdaptableStore.js +39 -16
  66. package/src/Strategy/BulkUpdateModule.js +8 -8
  67. package/src/Strategy/PlusMinusModule.js +1 -1
  68. package/src/Strategy/QuickSearchModule.js +1 -1
  69. package/src/Strategy/SettingsPanelModule.js +11 -7
  70. package/src/Strategy/SmartEditModule.js +10 -10
  71. package/src/Utilities/Services/DataService.js +1 -1
  72. package/src/Utilities/Services/Fdc3Service.js +4 -4
  73. package/src/Utilities/Services/ModuleService.js +1 -3
  74. package/src/Utilities/Services/ThemeService.js +2 -6
  75. package/src/Utilities/Services/ValidationService.js +1 -1
  76. package/src/Utilities/logDeprecation.js +3 -4
  77. package/src/View/Alert/Utilities/getDefaultAlertDefinition.d.ts +2 -2
  78. package/src/View/Alert/Wizard/isValidAlertRules.js +1 -1
  79. package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +2 -2
  80. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +2 -2
  81. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +1 -1
  82. package/src/View/Charting/ChartingWizard/AgChargingWizard/SettingsSection.js +2 -2
  83. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.js +2 -2
  84. package/src/View/Components/CellPopup/index.js +1 -1
  85. package/src/View/Components/ColumnFilter/FloatingFilter.js +41 -3
  86. package/src/View/Components/ColumnFilter/components/ColumnFilterMenu.js +54 -2
  87. package/src/View/Components/EntityRulesEditor/Utilities.js +5 -5
  88. package/src/View/Components/NewScopeComponent.js +3 -3
  89. package/src/View/Components/Popups/AdaptablePopupConfirmation.js +1 -1
  90. package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.js +3 -3
  91. package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +1 -1
  92. package/src/View/FlashingCell/Wizard/isValidFlashingCellRules.js +1 -1
  93. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.d.ts +1 -1
  94. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +3 -3
  95. package/src/View/Layout/LayoutViewPanel.js +1 -1
  96. package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
  97. package/src/View/Layout/Wizard/sections/FilterSection.js +1 -1
  98. package/src/View/Layout/Wizard/sections/GridFilterSection.js +1 -1
  99. package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +3 -3
  100. package/src/View/Layout/Wizard/sections/RowSummarySection.js +1 -1
  101. package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +2 -2
  102. package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +5 -5
  103. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/isSettingsValid.d.ts +1 -1
  104. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/isSettingsValid.js +11 -11
  105. package/src/View/StateManagement/handleExportState.js +1 -1
  106. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +1 -1
  107. package/src/agGrid/AdaptableAgGrid.js +47 -51
  108. package/src/agGrid/AgGridAdapter.js +8 -8
  109. package/src/agGrid/AgGridColumnAdapter.d.ts +1 -0
  110. package/src/agGrid/AgGridColumnAdapter.js +15 -4
  111. package/src/agGrid/AgGridExportAdapter.js +5 -5
  112. package/src/agGrid/AgGridThemeAdapter.js +2 -2
  113. package/src/components/OverlayTrigger/index.js +1 -1
  114. package/src/components/Select/Select.js +78 -15
  115. package/src/env.js +2 -2
  116. package/src/metamodel/adaptable.metamodel.d.ts +25 -18
  117. package/src/metamodel/adaptable.metamodel.js +1 -1
  118. package/src/migration/AdaptableUpgradeHelper.js +2 -2
  119. package/src/migration/VersionUpgrade17.js +4 -4
  120. package/src/migration/VersionUpgrade20.js +4 -4
  121. package/src/types.d.ts +2 -2
  122. package/tsconfig.esm.tsbuildinfo +1 -1
@@ -4,7 +4,7 @@ import ReactSelect, { components, } from 'react-select';
4
4
  import CreatableSelect from 'react-select/creatable';
5
5
  import { Icon } from '../icons';
6
6
  import { DataSource, InfiniteTable, } from '@infinite-table/infinite-react';
7
- import { useCallback, useMemo, useState } from 'react';
7
+ import { useCallback, useId, useMemo, useState } from 'react';
8
8
  import { Resizable } from 're-resizable';
9
9
  import Tooltip from '../Tooltip';
10
10
  import { ensurePortalElement } from '../OverlayTrigger';
@@ -115,6 +115,7 @@ const doesOptionMatchValue = function (value) {
115
115
  };
116
116
  export const Select = function (props) {
117
117
  let maxLabelLength = 0;
118
+ const inputId = useId();
118
119
  const computedCSSVars = useAdaptableComputedCSSVars();
119
120
  const CSS_VARS_VALUES = {
120
121
  '--ab-cmp-select-menu__max-width': computedCSSVars['--ab-cmp-select-menu__max-width'] || '60vw',
@@ -126,14 +127,15 @@ export const Select = function (props) {
126
127
  // relevant for menulist search only
127
128
  const menulistInputRef = React.useRef(null);
128
129
  const [isSelectMenuOpen, setIsSelectMenuOpen] = useState(false);
129
- const openSelectMenu = () => {
130
+ const propsOnMenuOpen = props.onMenuOpen;
131
+ const openSelectMenu = React.useCallback(() => {
130
132
  setIsSelectMenuOpen(true);
131
133
  // it's a react-select bug, onMenuOpen is not called with controlled menuIsOpen
132
- props.onMenuOpen?.();
133
- };
134
- const closeSelectMenu = () => {
134
+ propsOnMenuOpen?.();
135
+ }, [propsOnMenuOpen]);
136
+ const closeSelectMenu = React.useCallback(() => {
135
137
  setIsSelectMenuOpen(false);
136
- };
138
+ }, []);
137
139
  const ref = React.useRef(null);
138
140
  const valueToOptionMap = new Map((props.options || []).map((opt) => {
139
141
  let label = opt.label;
@@ -199,6 +201,18 @@ export const Select = function (props) {
199
201
  /**
200
202
  * If on each render a new reference is passed, the menu will not open using the keyboard.
201
203
  */
204
+ /**
205
+ * Use refs for isSelectMenuOpen, openSelectMenu, and closeSelectMenu so that
206
+ * SelectContainer is stable across re-renders. If SelectContainer gets a new
207
+ * reference when menu opens/closes, react-select recreates its internal
208
+ * component tree, the DummyInput is removed from DOM, and focus is lost.
209
+ */
210
+ const isSelectMenuOpenRef = React.useRef(isSelectMenuOpen);
211
+ isSelectMenuOpenRef.current = isSelectMenuOpen;
212
+ const openSelectMenuRef = React.useRef(openSelectMenu);
213
+ openSelectMenuRef.current = openSelectMenu;
214
+ const closeSelectMenuRef = React.useRef(closeSelectMenu);
215
+ closeSelectMenuRef.current = closeSelectMenu;
202
216
  const SelectContainer = React.useMemo(() => {
203
217
  return (selectContainerProps) => {
204
218
  return (React.createElement(components.SelectContainer, { ...selectContainerProps, innerProps: {
@@ -211,15 +225,50 @@ export const Select = function (props) {
211
225
  if (!searchableInMenulist) {
212
226
  return;
213
227
  }
214
- if (!isSelectMenuOpen) {
215
- openSelectMenu();
228
+ if (!isSelectMenuOpenRef.current) {
229
+ openSelectMenuRef.current();
216
230
  e.stopPropagation();
217
231
  e.preventDefault();
218
232
  }
219
233
  },
234
+ onKeyDownCapture: (e) => {
235
+ if (!searchableInMenulist) {
236
+ return;
237
+ }
238
+ if (isSelectMenuOpenRef.current) {
239
+ if (e.key === 'Escape') {
240
+ closeSelectMenuRef.current();
241
+ e.stopPropagation();
242
+ e.preventDefault();
243
+ e.nativeEvent.stopImmediatePropagation();
244
+ // we do this because the focus is lost when the menu is closed
245
+ // and document.body is set as the active element
246
+ requestAnimationFrame(() => {
247
+ document.getElementById(inputId)?.focus();
248
+ // we need to do it again
249
+ // also don't store a ref to the input element
250
+ // but query the DOM again
251
+ // as the old ref is no longer in the DOM
252
+ // because of a react-select bug I presume
253
+ requestAnimationFrame(() => {
254
+ document.getElementById(inputId)?.focus();
255
+ });
256
+ });
257
+ }
258
+ }
259
+ else {
260
+ // open the menu
261
+ if (e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowDown') {
262
+ openSelectMenuRef.current();
263
+ e.stopPropagation();
264
+ e.preventDefault();
265
+ e.nativeEvent.stopImmediatePropagation();
266
+ }
267
+ }
268
+ },
220
269
  } }));
221
270
  };
222
- }, [isSelectMenuOpen]);
271
+ }, [searchableInMenulist]);
223
272
  const resizable = props.resizable ?? false;
224
273
  const ValueContainer = React.useMemo(() => {
225
274
  return (props) => {
@@ -521,11 +570,25 @@ export const Select = function (props) {
521
570
  setInputValue(value);
522
571
  props.onInputChange?.(value);
523
572
  }, [props.onInputChange, isMulti]);
524
- const SingleValue = React.useCallback((singleValueProps) => {
525
- return (React.createElement(components.SingleValue, { ...singleValueProps }, props.renderSingleValue
526
- ? props.renderSingleValue(selectedOption)
527
- : singleValueProps.children));
528
- }, [selectedOption]);
573
+ /**
574
+ * Use refs for selectedOption and renderSingleValue so that the
575
+ * SingleValue component function is stable across re-renders.
576
+ * If SingleValue gets a new reference on each render, selectComponents changes,
577
+ * react-select recreates its internal component tree, the DummyInput is removed
578
+ * from DOM, and focus is lost (the keyboard stops working).
579
+ * See the comment above SelectContainer about this exact issue.
580
+ */
581
+ const selectedOptionRef = React.useRef(selectedOption);
582
+ selectedOptionRef.current = selectedOption;
583
+ const renderSingleValueRef = React.useRef(props.renderSingleValue);
584
+ renderSingleValueRef.current = props.renderSingleValue;
585
+ const SingleValue = React.useMemo(() => {
586
+ return (singleValueProps) => {
587
+ return (React.createElement(components.SingleValue, { ...singleValueProps }, renderSingleValueRef.current
588
+ ? renderSingleValueRef.current(selectedOptionRef.current)
589
+ : singleValueProps.children));
590
+ };
591
+ }, []);
529
592
  const selectComponents = useMemo(() => {
530
593
  return {
531
594
  SelectContainer,
@@ -546,7 +609,7 @@ export const Select = function (props) {
546
609
  MenuList,
547
610
  ]);
548
611
  return (React.createElement(React.Fragment, null,
549
- React.createElement(SelectComponent, { ref: ref, openMenuOnClick: searchableInMenulist ? false : undefined, openMenuOnFocus: searchableInMenulist ? false : undefined, menuIsOpen: searchableInMenulist ? isSelectMenuOpen : undefined, isSearchable: searchableInline, "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: clsx(props.className, 'ab-Select'), isDisabled: disabled, menuPlacement: props.menuPlacement ?? 'auto', hideSelectedOptions: false, isMulti: isMulti, value: selectedOption, blurInputOnSelect: false, menuPosition: props.menuPosition ?? 'absolute',
612
+ React.createElement(SelectComponent, { ref: ref, openMenuOnClick: searchableInMenulist ? false : undefined, openMenuOnFocus: searchableInMenulist ? false : undefined, menuIsOpen: searchableInMenulist ? isSelectMenuOpen : undefined, isSearchable: searchableInline, "aria-label": props['aria-label'], onKeyDown: props.onKeyDown, inputValue: inputValue, inputId: inputId, onInputChange: onInputChange, onFocus: onFocus, onBlur: onBlur, onMenuOpen: props.onMenuOpen, isLoading: props.isLoading, options: props.options, className: clsx(props.className, 'ab-Select'), isDisabled: disabled, menuPlacement: props.menuPlacement ?? 'auto', hideSelectedOptions: false, isMulti: isMulti, value: selectedOption, blurInputOnSelect: false, menuPosition: props.menuPosition ?? 'absolute',
550
613
  // This needed so the menu is not clipped by overflow: hidden
551
614
  menuPortalTarget: ensurePortalElement(), isClearable: props.isClearable, closeMenuOnSelect: props.closeMenuOnSelect, onChange: (option) => {
552
615
  if (isMulti) {
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: 1770330484844 || Date.now(),
4
- VERSION: "22.0.0-canary.5" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1770740667502 || Date.now(),
4
+ VERSION: "22.0.0-canary.7" || '--current-version--',
5
5
  };
@@ -1094,6 +1094,11 @@ export declare const ADAPTABLE_METAMODEL: {
1094
1094
  defVal: string;
1095
1095
  })[];
1096
1096
  };
1097
+ AdaptableTransientState: {
1098
+ name: string;
1099
+ kind: string;
1100
+ desc: string;
1101
+ };
1097
1102
  AdaptableVersion: {
1098
1103
  name: string;
1099
1104
  kind: string;
@@ -1290,6 +1295,12 @@ export declare const ADAPTABLE_METAMODEL: {
1290
1295
  desc: string;
1291
1296
  ref: string;
1292
1297
  isOpt?: undefined;
1298
+ } | {
1299
+ name: string;
1300
+ kind: string;
1301
+ desc: string;
1302
+ isOpt?: undefined;
1303
+ ref?: undefined;
1293
1304
  })[];
1294
1305
  };
1295
1306
  AlertDefinitionPredicate: {
@@ -2157,20 +2168,12 @@ export declare const ADAPTABLE_METAMODEL: {
2157
2168
  name: string;
2158
2169
  kind: string;
2159
2170
  desc: string;
2160
- isOpt?: undefined;
2161
- ref?: undefined;
2162
- } | {
2163
- name: string;
2164
- kind: string;
2165
- desc: string;
2166
- isOpt: boolean;
2167
2171
  ref?: undefined;
2168
2172
  } | {
2169
2173
  name: string;
2170
2174
  kind: string;
2171
2175
  desc: string;
2172
2176
  ref: string;
2173
- isOpt?: undefined;
2174
2177
  })[];
2175
2178
  };
2176
2179
  CommandHandler: {
@@ -3669,6 +3672,13 @@ export declare const ADAPTABLE_METAMODEL: {
3669
3672
  isOpt: boolean;
3670
3673
  defVal: string;
3671
3674
  ref?: undefined;
3675
+ } | {
3676
+ name: string;
3677
+ kind: string;
3678
+ desc: string;
3679
+ isOpt?: undefined;
3680
+ defVal?: undefined;
3681
+ ref?: undefined;
3672
3682
  } | {
3673
3683
  name: string;
3674
3684
  kind: string;
@@ -3725,6 +3735,13 @@ export declare const ADAPTABLE_METAMODEL: {
3725
3735
  isOpt: boolean;
3726
3736
  ref: string;
3727
3737
  defVal?: undefined;
3738
+ } | {
3739
+ name: string;
3740
+ kind: string;
3741
+ desc: string;
3742
+ isOpt?: undefined;
3743
+ ref?: undefined;
3744
+ defVal?: undefined;
3728
3745
  } | {
3729
3746
  name: string;
3730
3747
  kind: string;
@@ -4477,16 +4494,6 @@ export declare const ADAPTABLE_METAMODEL: {
4477
4494
  kind: string;
4478
4495
  desc: string;
4479
4496
  };
4480
- NamedObject: {
4481
- name: string;
4482
- kind: string;
4483
- desc: string;
4484
- props: {
4485
- name: string;
4486
- kind: string;
4487
- desc: string;
4488
- }[];
4489
- };
4490
4497
  NamedQuery: {
4491
4498
  name: string;
4492
4499
  kind: string;