@adaptabletools/adaptable-cjs 20.1.3 → 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.
@@ -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
@@ -47,5 +47,6 @@ export type SelectProps<SelectValue extends unknown, IsMulti extends boolean = f
47
47
  size?: 'small' | 'normal';
48
48
  isCreatable?: boolean;
49
49
  menuPortalTarget?: HTMLElement;
50
+ onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
50
51
  };
51
52
  export declare const Select: <SelectValue extends unknown, IsMulti extends boolean = false>(props: SelectProps<SelectValue, IsMulti>) => React.JSX.Element;
@@ -369,7 +369,7 @@ const Select = function (props) {
369
369
  setInputValue(value);
370
370
  props.onInputChange?.(value);
371
371
  }, [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',
372
+ 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
373
  // This needed so the menu is not clipped by overflow: hidden
374
374
  menuPortalTarget: props.menuPortalTarget === undefined ? document.body : null, isClearable: props.isClearable, closeMenuOnSelect: props.closeMenuOnSelect, onChange: (option) => {
375
375
  if (isMulti) {
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: 1747747722676 || Date.now(),
6
+ VERSION: "20.1.4" || '--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;