@synerise/ds-factors 0.20.3 → 0.20.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.20.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.20.3...@synerise/ds-factors@0.20.4) (2023-10-02)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-factors
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.20.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.20.2...@synerise/ds-factors@0.20.3) (2023-09-26)
7
15
 
8
16
  **Note:** Version bump only for package @synerise/ds-factors
@@ -32,7 +32,12 @@ var DynamicKey = function DynamicKey(_ref) {
32
32
  localError = _React$useState2[0],
33
33
  setLocalError = _React$useState2[1];
34
34
 
35
- var onChangeDebounce = React.useCallback(debounce(onChange, 300), [onChange]);
35
+ var onChangeDebounce = React.useRef(debounce(onChange, 300)).current;
36
+ React.useEffect(function () {
37
+ return function () {
38
+ onChangeDebounce.cancel();
39
+ };
40
+ }, [onChangeDebounce]);
36
41
 
37
42
  var handleChange = function handleChange(event) {
38
43
  var newValue = _objectSpread({}, value);
@@ -15,13 +15,18 @@ var NumberInput = function NumberInput(_ref) {
15
15
  localValue = _React$useState[0],
16
16
  setLocalValue = _React$useState[1];
17
17
 
18
- var onChangeValueDebounce = React.useCallback(debounce(onChange, 300), [onChange]);
18
+ var onChangeValueDebounce = React.useRef(debounce(onChange, 300)).current;
19
19
 
20
20
  var handleChange = function handleChange(val) {
21
21
  setLocalValue(val);
22
22
  onChangeValueDebounce(val);
23
23
  };
24
24
 
25
+ React.useEffect(function () {
26
+ return function () {
27
+ onChangeValueDebounce.cancel();
28
+ };
29
+ }, [onChangeValueDebounce]);
25
30
  React.useEffect(function () {
26
31
  setLocalValue(value);
27
32
  }, [value]);
@@ -36,7 +36,6 @@ var ParameterInput = function ParameterInput(_ref) {
36
36
  error = _ref.error,
37
37
  getMenuEntryProps = _ref.getMenuEntryProps;
38
38
 
39
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
40
39
  // @ts-ignore
41
40
  var buttonIcon = parameters.buttonIcon,
42
41
  buttonLabel = parameters.buttonLabel,
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ParameterGroup, ParameterItem } from '../../Factors.types';
3
- export declare type DropdownItem = {
3
+ export type DropdownItem = {
4
4
  item: ParameterItem | ParameterGroup;
5
5
  searchQuery: string;
6
6
  clearSearch?: () => void;
@@ -52,13 +52,14 @@ var TextInput = function TextInput(_ref) {
52
52
  useEffect(function () {
53
53
  onChangeRef.current = onChange;
54
54
  }, [localValue, onChange]);
55
- var debouncedOnChange = useMemo(function () {
56
- var persistentOnChange = function persistentOnChange(inputValue) {
57
- onChangeRef.current && onChangeRef.current(inputValue);
55
+ var debouncedOnChange = useRef(debounce(function (inputValue) {
56
+ onChangeRef.current && onChangeRef.current(inputValue);
57
+ }, 300)).current;
58
+ React.useEffect(function () {
59
+ return function () {
60
+ debouncedOnChange.cancel();
58
61
  };
59
-
60
- return debounce(persistentOnChange, 300);
61
- }, []);
62
+ }, [debouncedOnChange]);
62
63
  var handleChange = useCallback(function (event) {
63
64
  setLocalValue(event.target.value);
64
65
  debouncedOnChange(event.target.value);
@@ -3,17 +3,17 @@ import { DateFilter } from '@synerise/ds-date-range-picker/dist/date.types';
3
3
  import { Texts as DateRangeTexts } from '@synerise/ds-date-range-picker/dist/DateRangePicker.types';
4
4
  import type { MenuItemProps } from '@synerise/ds-menu';
5
5
  export declare const ALL_FACTOR_TYPES: readonly ["text", "number", "parameter", "contextParameter", "dynamicKey", "formula", "array", "date", "dateRange"];
6
- export declare type FactorType = typeof ALL_FACTOR_TYPES[number] | string;
7
- export declare type DefinedFactorTypes = typeof ALL_FACTOR_TYPES[number];
8
- export declare type DynamicKeyValueType = {
6
+ export type FactorType = typeof ALL_FACTOR_TYPES[number] | string;
7
+ export type DefinedFactorTypes = typeof ALL_FACTOR_TYPES[number];
8
+ export type DynamicKeyValueType = {
9
9
  key: React.ReactText;
10
10
  value: React.ReactText;
11
11
  };
12
- export declare type FormulaValueType = {
12
+ export type FormulaValueType = {
13
13
  name: string;
14
14
  value: string;
15
15
  };
16
- export declare type ParameterValueType = {
16
+ export type ParameterValueType = {
17
17
  type: string;
18
18
  icon: React.ReactNode;
19
19
  name: string;
@@ -21,27 +21,27 @@ export declare type ParameterValueType = {
21
21
  groupId?: React.ReactText;
22
22
  description?: string;
23
23
  };
24
- export declare type ParameterGroup = {
24
+ export type ParameterGroup = {
25
25
  id: React.ReactText;
26
26
  name: string;
27
27
  defaultGroup?: boolean;
28
28
  icon?: React.ReactNode;
29
29
  subGroups?: ParameterGroup[];
30
30
  };
31
- export declare type ParameterItem = {
31
+ export type ParameterItem = {
32
32
  id: React.ReactText;
33
33
  name: string;
34
34
  groupId: React.ReactText;
35
35
  icon?: React.ReactNode;
36
36
  disabled?: boolean;
37
37
  };
38
- export declare type FactorValueType = string | number | Date | undefined | DynamicKeyValueType | FormulaValueType | ParameterValueType | Partial<DateFilter>;
39
- export declare type SelectedFactorType = {
38
+ export type FactorValueType = string | number | Date | undefined | DynamicKeyValueType | FormulaValueType | ParameterValueType | Partial<DateFilter>;
39
+ export type SelectedFactorType = {
40
40
  name: string;
41
41
  icon: React.ReactNode;
42
42
  input: React.ElementType;
43
43
  };
44
- export declare type FactorsTexts = {
44
+ export type FactorsTexts = {
45
45
  dateRangePicker: DateRangeTexts;
46
46
  datePicker: {
47
47
  apply: string;
@@ -70,7 +70,7 @@ export declare type FactorsTexts = {
70
70
  [k in DefinedFactorTypes]: string;
71
71
  };
72
72
  };
73
- export declare type FactorsProps = {
73
+ export type FactorsProps = {
74
74
  factorKey?: React.ReactText;
75
75
  error?: boolean;
76
76
  errorText?: React.ReactNode | string;
@@ -111,18 +111,18 @@ export declare type FactorsProps = {
111
111
  readOnly?: boolean;
112
112
  getMenuEntryProps?: (arg?: ParameterValueType) => MenuItemProps;
113
113
  };
114
- export declare type FactorTypeSelectorProps = Pick<FactorsProps, 'unavailableFactorTypes' | 'availableFactorTypes' | 'selectedFactorType' | 'readOnly'> & {
114
+ export type FactorTypeSelectorProps = Pick<FactorsProps, 'unavailableFactorTypes' | 'availableFactorTypes' | 'selectedFactorType' | 'readOnly'> & {
115
115
  setSelectedFactorType: (factor: FactorType) => void;
116
116
  selectedFactor: SelectedFactorType;
117
117
  texts: {
118
118
  [k in DefinedFactorTypes]: string;
119
119
  };
120
120
  };
121
- export declare type FactorValueProps = Pick<FactorsProps, 'onChangeValue' | 'onParamsClick' | 'value' | 'selectedFactorType' | 'parameters' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'formulaEditor' | 'opened' | 'loading' | 'factorKey' | 'preventAutoloadData' | 'getPopupContainerOverride' | 'onActivate' | 'onDeactivate' | 'error' | 'inputProps' | 'autoResize' | 'readOnly' | 'getMenuEntryProps'> & {
121
+ export type FactorValueProps = Pick<FactorsProps, 'onChangeValue' | 'onParamsClick' | 'value' | 'selectedFactorType' | 'parameters' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'formulaEditor' | 'opened' | 'loading' | 'factorKey' | 'preventAutoloadData' | 'getPopupContainerOverride' | 'onActivate' | 'onDeactivate' | 'error' | 'inputProps' | 'autoResize' | 'readOnly' | 'getMenuEntryProps'> & {
122
122
  texts: FactorsTexts;
123
123
  selectedFactor: SelectedFactorType;
124
124
  };
125
- export declare type InputProps = Pick<FactorsProps, 'value' | 'parameters' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'opened' | 'getPopupContainerOverride' | 'onActivate' | 'onDeactivate' | 'error' | 'inputProps' | 'autoResize' | 'readOnly' | 'getMenuEntryProps'> & {
125
+ export type InputProps = Pick<FactorsProps, 'value' | 'parameters' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'opened' | 'getPopupContainerOverride' | 'onActivate' | 'onDeactivate' | 'error' | 'inputProps' | 'autoResize' | 'readOnly' | 'getMenuEntryProps'> & {
126
126
  texts: FactorsTexts;
127
127
  onChange: (value: FactorValueType) => void;
128
128
  factorType: FactorType;
@@ -131,14 +131,14 @@ export declare type InputProps = Pick<FactorsProps, 'value' | 'parameters' | 'au
131
131
  loading?: boolean;
132
132
  preventAutoloadData?: boolean;
133
133
  };
134
- export declare type TextModalProps = {
134
+ export type TextModalProps = {
135
135
  value: string;
136
136
  onApply: (value: string) => void;
137
137
  visible: boolean;
138
138
  onCancel: () => void;
139
139
  texts: FactorsTexts;
140
140
  };
141
- export declare type ParameterDropdownProps = {
141
+ export type ParameterDropdownProps = {
142
142
  setDropdownVisible: (show: boolean) => void;
143
143
  setSelected: (val: ParameterItem) => void;
144
144
  groups?: ParameterGroup[];
@@ -148,7 +148,7 @@ export declare type ParameterDropdownProps = {
148
148
  onFetchData?: () => void;
149
149
  hasMoreItems?: boolean;
150
150
  };
151
- export declare type FormulaModalProps = {
151
+ export type FormulaModalProps = {
152
152
  value: FormulaValueType;
153
153
  onApply: (value: FormulaValueType) => void;
154
154
  visible: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Group: import("styled-components").StyledComponent<({ children, label, errors, description, resetMargin, tooltip, ...antdInputGroupProps }: import("@synerise/ds-input/dist/InputGroup.types").Props) => JSX.Element, any, {
3
2
  withoutTypeSelector: boolean;
4
3
  }, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-factors",
3
- "version": "0.20.3",
3
+ "version": "0.20.4",
4
4
  "description": "Factors UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -32,25 +32,25 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-autocomplete": "^0.5.2",
36
- "@synerise/ds-badge": "^0.6.37",
37
- "@synerise/ds-button": "^0.18.2",
38
- "@synerise/ds-date-picker": "^0.10.17",
39
- "@synerise/ds-date-range-picker": "^0.24.7",
40
- "@synerise/ds-dropdown": "^0.17.80",
41
- "@synerise/ds-icon": "^0.58.2",
42
- "@synerise/ds-information-card": "^0.3.38",
43
- "@synerise/ds-inline-edit": "^0.6.80",
44
- "@synerise/ds-input": "^0.19.2",
45
- "@synerise/ds-input-number": "^0.8.24",
46
- "@synerise/ds-loader": "^0.2.44",
47
- "@synerise/ds-menu": "^0.17.19",
48
- "@synerise/ds-modal": "^0.17.5",
49
- "@synerise/ds-result": "^0.6.31",
50
- "@synerise/ds-scrollbar": "^0.6.7",
51
- "@synerise/ds-tabs": "^0.13.78",
52
- "@synerise/ds-tooltip": "^0.14.4",
53
- "@synerise/ds-utils": "^0.24.16",
35
+ "@synerise/ds-autocomplete": "^0.5.3",
36
+ "@synerise/ds-badge": "^0.6.38",
37
+ "@synerise/ds-button": "^0.18.3",
38
+ "@synerise/ds-date-picker": "^0.10.18",
39
+ "@synerise/ds-date-range-picker": "^0.24.8",
40
+ "@synerise/ds-dropdown": "^0.17.81",
41
+ "@synerise/ds-icon": "^0.58.3",
42
+ "@synerise/ds-information-card": "^0.3.39",
43
+ "@synerise/ds-inline-edit": "^0.6.81",
44
+ "@synerise/ds-input": "^0.19.3",
45
+ "@synerise/ds-input-number": "^0.8.25",
46
+ "@synerise/ds-loader": "^0.2.45",
47
+ "@synerise/ds-menu": "^0.17.20",
48
+ "@synerise/ds-modal": "^0.17.6",
49
+ "@synerise/ds-result": "^0.6.32",
50
+ "@synerise/ds-scrollbar": "^0.6.8",
51
+ "@synerise/ds-tabs": "^0.13.79",
52
+ "@synerise/ds-tooltip": "^0.14.5",
53
+ "@synerise/ds-utils": "^0.24.17",
54
54
  "lodash": "^4.17.19",
55
55
  "react-intl": "3.12.0",
56
56
  "react-window": "1.8.5",
@@ -66,5 +66,5 @@
66
66
  "@testing-library/react": "10.0.1",
67
67
  "@testing-library/user-event": "^10.3.1"
68
68
  },
69
- "gitHead": "f1f520c4c5ef9f90bacb5d5e0b2e778ceb8fdf79"
69
+ "gitHead": "1c1adf344f447e404a1d6320ad1d3f8486f29f67"
70
70
  }