@synerise/ds-factors 0.27.2 → 0.27.3
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 +11 -0
- package/dist/FactorTypeSelector/FactorTypeSelector.js +6 -10
- package/dist/FactorValue/Date/Date.d.ts +1 -1
- package/dist/FactorValue/Date/Date.js +16 -23
- package/dist/FactorValue/DateRange/DateRange.js +8 -10
- package/dist/FactorValue/DynamicKey/DynamicKey.js +16 -30
- package/dist/FactorValue/DynamicKey/DynamicKey.style.js +2 -1
- package/dist/FactorValue/FactorValue.js +24 -26
- package/dist/FactorValue/FactorValue.style.js +4 -8
- package/dist/FactorValue/Formula/Formula.js +10 -15
- package/dist/FactorValue/Formula/Formula.styles.js +2 -1
- package/dist/FactorValue/Formula/FormulaModal.js +7 -11
- package/dist/FactorValue/Number/NumberInput.js +9 -15
- package/dist/FactorValue/Parameter/Parameter.constants.js +0 -1
- package/dist/FactorValue/Parameter/Parameter.js +35 -56
- package/dist/FactorValue/Parameter/ParameterDropdown.js +32 -68
- package/dist/FactorValue/Parameter/ParameterDropdownItem.js +9 -16
- package/dist/FactorValue/Parameter/useGroups.js +0 -12
- package/dist/FactorValue/Parameter/utils.js +0 -4
- package/dist/FactorValue/Text/Text.js +20 -33
- package/dist/FactorValue/Text/Text.styles.js +2 -1
- package/dist/FactorValue/Text/TextModal.js +6 -10
- package/dist/Factors.js +32 -34
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.27.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.27.2...@synerise/ds-factors@0.27.3) (2024-11-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **factors:** fixed date factor value change handler ([5e9a3aa](https://github.com/Synerise/synerise-design/commit/5e9a3aae9ad285f39c2785006ec4528169c99f65))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.27.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.27.1...@synerise/ds-factors@0.27.2) (2024-11-21)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -7,24 +7,21 @@ import { theme } from '@synerise/ds-core';
|
|
|
7
7
|
import * as S from './FactorTypeSelector.styles';
|
|
8
8
|
import { ALL_FACTOR_TYPES } from '../Factors.types';
|
|
9
9
|
import { factorTypes } from '../Factors';
|
|
10
|
-
|
|
11
10
|
var FactorTypeSelector = function FactorTypeSelector(_ref) {
|
|
12
11
|
var selectedFactorType = _ref.selectedFactorType,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
setSelectedFactorType = _ref.setSelectedFactorType,
|
|
13
|
+
unavailableFactorTypes = _ref.unavailableFactorTypes,
|
|
14
|
+
availableFactorTypes = _ref.availableFactorTypes,
|
|
15
|
+
selectedFactor = _ref.selectedFactor,
|
|
16
|
+
texts = _ref.texts,
|
|
17
|
+
readOnly = _ref.readOnly;
|
|
19
18
|
var typesList = useMemo(function () {
|
|
20
19
|
var list = availableFactorTypes || ALL_FACTOR_TYPES;
|
|
21
|
-
|
|
22
20
|
if (unavailableFactorTypes !== undefined) {
|
|
23
21
|
list = [].concat(list).filter(function (type) {
|
|
24
22
|
return unavailableFactorTypes.indexOf(type) < 0;
|
|
25
23
|
});
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
return list.map(function (type) {
|
|
29
26
|
return /*#__PURE__*/React.createElement(ListItem, {
|
|
30
27
|
className: "ds-factor-type",
|
|
@@ -60,5 +57,4 @@ var FactorTypeSelector = function FactorTypeSelector(_ref) {
|
|
|
60
57
|
disabled: readOnly
|
|
61
58
|
}, trigger));
|
|
62
59
|
};
|
|
63
|
-
|
|
64
60
|
export default FactorTypeSelector;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InputProps } from '../../Factors.types';
|
|
3
|
-
declare const DateInput: React.
|
|
3
|
+
declare const DateInput: ({ value, onChange, texts, opened, onDeactivate, onActivate, error, allowClear, readOnly, getPopupContainerOverride, }: InputProps) => React.JSX.Element;
|
|
4
4
|
export default DateInput;
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { getPopupContainer } from '@synerise/ds-utils';
|
|
3
3
|
import DatePicker from '@synerise/ds-date-picker';
|
|
4
|
-
|
|
5
4
|
var DateInput = function DateInput(_ref) {
|
|
6
5
|
var value = _ref.value,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
onChange = _ref.onChange,
|
|
7
|
+
texts = _ref.texts,
|
|
8
|
+
opened = _ref.opened,
|
|
9
|
+
onDeactivate = _ref.onDeactivate,
|
|
10
|
+
onActivate = _ref.onActivate,
|
|
11
|
+
error = _ref.error,
|
|
12
|
+
allowClear = _ref.allowClear,
|
|
13
|
+
_ref$readOnly = _ref.readOnly,
|
|
14
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
15
|
+
getPopupContainerOverride = _ref.getPopupContainerOverride;
|
|
18
16
|
var _useState = useState(value),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
localValue = _useState[0],
|
|
18
|
+
setLocalValue = _useState[1];
|
|
22
19
|
useEffect(function () {
|
|
23
20
|
setLocalValue(value);
|
|
24
21
|
}, [value]);
|
|
25
|
-
var changeHandler =
|
|
22
|
+
var changeHandler = useCallback(function (date) {
|
|
26
23
|
onChange(date);
|
|
27
24
|
}, [onChange]);
|
|
28
25
|
var localValueAsDate = useMemo(function () {
|
|
29
26
|
return localValue ? new Date(String(localValue)) : undefined;
|
|
30
27
|
}, [localValue]);
|
|
31
|
-
var handleClear =
|
|
28
|
+
var handleClear = useCallback(function () {
|
|
32
29
|
onChange(undefined);
|
|
33
30
|
}, [onChange]);
|
|
34
|
-
var handleVisibleChange =
|
|
31
|
+
var handleVisibleChange = useCallback(function (visible) {
|
|
35
32
|
if (!visible) {
|
|
36
33
|
onDeactivate && onDeactivate();
|
|
37
34
|
onChange(localValueAsDate);
|
|
@@ -41,9 +38,6 @@ var DateInput = function DateInput(_ref) {
|
|
|
41
38
|
}, [localValueAsDate, onActivate, onChange, onDeactivate]);
|
|
42
39
|
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
43
40
|
onClear: handleClear,
|
|
44
|
-
onValueChange: function onValueChange(date) {
|
|
45
|
-
return setLocalValue(date == null ? void 0 : date.toDateString());
|
|
46
|
-
},
|
|
47
41
|
onApply: changeHandler,
|
|
48
42
|
value: localValueAsDate,
|
|
49
43
|
showTime: true,
|
|
@@ -64,5 +58,4 @@ var DateInput = function DateInput(_ref) {
|
|
|
64
58
|
}
|
|
65
59
|
});
|
|
66
60
|
};
|
|
67
|
-
|
|
68
61
|
export default DateInput;
|
|
@@ -2,17 +2,16 @@ import React, { useCallback } from 'react';
|
|
|
2
2
|
import DateRangePicker from '@synerise/ds-date-range-picker';
|
|
3
3
|
import { getPopupContainer } from '@synerise/ds-utils';
|
|
4
4
|
import { useIntl } from 'react-intl';
|
|
5
|
-
|
|
6
5
|
var DateRangeInput = function DateRangeInput(_ref) {
|
|
7
6
|
var getPopupContainerOverride = _ref.getPopupContainerOverride,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
value = _ref.value,
|
|
8
|
+
onChange = _ref.onChange,
|
|
9
|
+
error = _ref.error,
|
|
10
|
+
texts = _ref.texts,
|
|
11
|
+
onDeactivate = _ref.onDeactivate,
|
|
12
|
+
allowClear = _ref.allowClear,
|
|
13
|
+
_ref$readOnly = _ref.readOnly,
|
|
14
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
|
|
16
15
|
var intl = useIntl();
|
|
17
16
|
var changeHandler = useCallback(function (date) {
|
|
18
17
|
onChange(date);
|
|
@@ -48,5 +47,4 @@ var DateRangeInput = function DateRangeInput(_ref) {
|
|
|
48
47
|
readOnly: readOnly
|
|
49
48
|
});
|
|
50
49
|
};
|
|
51
|
-
|
|
52
50
|
export default DateRangeInput;
|
|
@@ -1,60 +1,47 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
4
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
8
|
-
|
|
9
5
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
-
|
|
11
6
|
import React from 'react';
|
|
12
7
|
import { RawInput } from '@synerise/ds-input';
|
|
13
8
|
import { debounce } from 'lodash';
|
|
14
9
|
import * as S from './DynamicKey.style';
|
|
15
|
-
|
|
16
10
|
var DynamicKey = function DynamicKey(_ref) {
|
|
17
11
|
var value = _ref.value,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
onChange = _ref.onChange,
|
|
13
|
+
_ref$withoutTypeSelec = _ref.withoutTypeSelector,
|
|
14
|
+
withoutTypeSelector = _ref$withoutTypeSelec === void 0 ? false : _ref$withoutTypeSelec,
|
|
15
|
+
texts = _ref.texts,
|
|
16
|
+
opened = _ref.opened,
|
|
17
|
+
onDeactivate = _ref.onDeactivate,
|
|
18
|
+
error = _ref.error,
|
|
19
|
+
_ref$readOnly = _ref.readOnly,
|
|
20
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
|
|
28
21
|
var _React$useState = React.useState({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
key: value.key,
|
|
23
|
+
value: value.value
|
|
24
|
+
}),
|
|
25
|
+
localValue = _React$useState[0],
|
|
26
|
+
setLocalValue = _React$useState[1];
|
|
35
27
|
var _React$useState2 = React.useState(false),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
localError = _React$useState2[0],
|
|
29
|
+
setLocalError = _React$useState2[1];
|
|
39
30
|
var onChangeRef = React.useRef(onChange);
|
|
40
31
|
var debouncedOnChange = React.useRef(debounce(function (inputValue) {
|
|
41
32
|
onChangeRef.current && onChangeRef.current(inputValue);
|
|
42
33
|
}, 300)).current;
|
|
43
|
-
|
|
44
34
|
var handleChange = function handleChange(event) {
|
|
45
35
|
var newValue = _objectSpread({}, value);
|
|
46
|
-
|
|
47
36
|
newValue[event.target.name] = event.target.value;
|
|
48
37
|
setLocalValue(newValue);
|
|
49
38
|
debouncedOnChange(newValue);
|
|
50
|
-
|
|
51
39
|
if (!event.target.value.length) {
|
|
52
40
|
setLocalError(true);
|
|
53
41
|
} else {
|
|
54
42
|
setLocalError(false);
|
|
55
43
|
}
|
|
56
44
|
};
|
|
57
|
-
|
|
58
45
|
React.useEffect(function () {
|
|
59
46
|
onChangeRef.current = onChange;
|
|
60
47
|
}, [localValue, onChange]);
|
|
@@ -88,5 +75,4 @@ var DynamicKey = function DynamicKey(_ref) {
|
|
|
88
75
|
withoutTypeSelector: withoutTypeSelector
|
|
89
76
|
}, trigger);
|
|
90
77
|
};
|
|
91
|
-
|
|
92
78
|
export default DynamicKey;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
1
|
+
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
3
4
|
export var DynamicKey = styled.div.withConfig({
|
|
4
5
|
displayName: "DynamicKeystyle__DynamicKey",
|
|
5
6
|
componentId: "sc-43cup-0"
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import * as S from './FactorValue.style';
|
|
3
|
-
|
|
4
3
|
var FactorValue = function FactorValue(_ref) {
|
|
5
4
|
var selectedFactorType = _ref.selectedFactorType,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
5
|
+
value = _ref.value,
|
|
6
|
+
onChangeValue = _ref.onChangeValue,
|
|
7
|
+
onParamsClick = _ref.onParamsClick,
|
|
8
|
+
selectedFactor = _ref.selectedFactor,
|
|
9
|
+
textType = _ref.textType,
|
|
10
|
+
parameters = _ref.parameters,
|
|
11
|
+
autocompleteText = _ref.autocompleteText,
|
|
12
|
+
_ref$withoutTypeSelec = _ref.withoutTypeSelector,
|
|
13
|
+
withoutTypeSelector = _ref$withoutTypeSelec === void 0 ? false : _ref$withoutTypeSelec,
|
|
14
|
+
texts = _ref.texts,
|
|
15
|
+
formulaEditor = _ref.formulaEditor,
|
|
16
|
+
opened = _ref.opened,
|
|
17
|
+
loading = _ref.loading,
|
|
18
|
+
factorKey = _ref.factorKey,
|
|
19
|
+
preventAutoloadData = _ref.preventAutoloadData,
|
|
20
|
+
getPopupContainerOverride = _ref.getPopupContainerOverride,
|
|
21
|
+
onActivate = _ref.onActivate,
|
|
22
|
+
onDeactivate = _ref.onDeactivate,
|
|
23
|
+
error = _ref.error,
|
|
24
|
+
inputProps = _ref.inputProps,
|
|
25
|
+
allowClear = _ref.allowClear,
|
|
26
|
+
_ref$readOnly = _ref.readOnly,
|
|
27
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
28
|
+
getMenuEntryProps = _ref.getMenuEntryProps;
|
|
30
29
|
var inputType = React.useMemo(function () {
|
|
31
30
|
var InputComponent = selectedFactor.input;
|
|
32
31
|
return /*#__PURE__*/React.createElement(InputComponent, {
|
|
@@ -61,5 +60,4 @@ var FactorValue = function FactorValue(_ref) {
|
|
|
61
60
|
withoutTypeSelector: withoutTypeSelector
|
|
62
61
|
}, inputType);
|
|
63
62
|
};
|
|
64
|
-
|
|
65
63
|
export default FactorValue;
|
|
@@ -4,30 +4,26 @@ var DEFAULT_WIDTH = {
|
|
|
4
4
|
'text-autocomplete': '147px',
|
|
5
5
|
'text-default': '147px',
|
|
6
6
|
'text-expansible': '123px'
|
|
7
|
-
};
|
|
8
|
-
|
|
7
|
+
};
|
|
8
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
9
9
|
export var FactorInput = styled.div.withConfig({
|
|
10
10
|
displayName: "FactorValuestyle__FactorInput",
|
|
11
11
|
componentId: "sc-17jtnx3-0"
|
|
12
12
|
})(["&&{", ";", "{width:auto;}.ds-autocomplete{display:flex;> *{min-width:0;flex-grow:1;}.ant-select{width:100%;}.ant-select-selection-placeholder{padding:0;}.ant-select-selector{border-radius:", ";}}.ant-dropdown-trigger{input{border-radius:", ";}}}"], function (props) {
|
|
13
13
|
var inputType = props.inputType,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
_props$inputTextType = props.inputTextType,
|
|
15
|
+
inputTextType = _props$inputTextType === void 0 ? 'default' : _props$inputTextType;
|
|
17
16
|
if (inputType) {
|
|
18
17
|
if (inputType === 'array') {
|
|
19
18
|
return css(["&&&{min-width:173px;input{min-width:123px;}}"]);
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
if (inputType === 'dateRange') {
|
|
23
21
|
return css(["&&&{min-width:173px;}"]);
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
if (inputType === 'text' && DEFAULT_WIDTH[inputType + "-" + inputTextType]) {
|
|
27
24
|
return css(["&&&{input{min-width:", ";}}"], DEFAULT_WIDTH[inputType + "-" + inputTextType]);
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
return false;
|
|
32
28
|
}, Container, function (props) {
|
|
33
29
|
return props.withoutTypeSelector ? '3px' : '0 3px 3px 0';
|
|
@@ -4,27 +4,23 @@ import Icon, { EditS } from '@synerise/ds-icon';
|
|
|
4
4
|
import Badge from '@synerise/ds-badge';
|
|
5
5
|
import FormulaModal from './FormulaModal';
|
|
6
6
|
import * as S from './Formula.styles';
|
|
7
|
-
|
|
8
7
|
var FormulaInput = function FormulaInput(_ref) {
|
|
9
8
|
var value = _ref.value,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
error = _ref.error,
|
|
10
|
+
onChange = _ref.onChange,
|
|
11
|
+
_ref$withoutTypeSelec = _ref.withoutTypeSelector,
|
|
12
|
+
withoutTypeSelector = _ref$withoutTypeSelec === void 0 ? false : _ref$withoutTypeSelec,
|
|
13
|
+
texts = _ref.texts,
|
|
14
|
+
formulaEditor = _ref.formulaEditor,
|
|
15
|
+
_ref$readOnly = _ref.readOnly,
|
|
16
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
|
|
19
17
|
var _useState = useState(false),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
openFormulaModal = _useState[0],
|
|
19
|
+
setOpenFormulaModal = _useState[1];
|
|
23
20
|
var triggerMode = useMemo(function () {
|
|
24
21
|
if (value) {
|
|
25
22
|
return readOnly ? 'label-icon' : 'two-icons';
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
return readOnly ? 'simple' : 'label-icon';
|
|
29
25
|
}, [value, readOnly]);
|
|
30
26
|
var activeIcon = useMemo(function () {
|
|
@@ -65,5 +61,4 @@ var FormulaInput = function FormulaInput(_ref) {
|
|
|
65
61
|
formulaEditor: formulaEditor
|
|
66
62
|
}));
|
|
67
63
|
};
|
|
68
|
-
|
|
69
64
|
export default FormulaInput;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
1
|
+
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
3
4
|
export var FormulaButton = styled.div.withConfig({
|
|
4
5
|
displayName: "Formulastyles__FormulaButton",
|
|
5
6
|
componentId: "bixbni-0"
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ModalProxy from '@synerise/ds-modal';
|
|
3
3
|
import InlineEdit from '@synerise/ds-inline-edit';
|
|
4
|
-
|
|
5
4
|
var FormulaModal = function FormulaModal(_ref) {
|
|
6
5
|
var value = _ref.value,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
onApply = _ref.onApply,
|
|
7
|
+
onCancel = _ref.onCancel,
|
|
8
|
+
visible = _ref.visible,
|
|
9
|
+
texts = _ref.texts,
|
|
10
|
+
formulaEditor = _ref.formulaEditor;
|
|
13
11
|
var _React$useState = React.useState((value == null ? void 0 : value.name) || texts.formula.defaultName),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
formulaName = _React$useState[0],
|
|
13
|
+
setFormulaName = _React$useState[1];
|
|
17
14
|
var handleOk = React.useCallback(function () {
|
|
18
15
|
onApply({
|
|
19
16
|
name: formulaName,
|
|
@@ -47,5 +44,4 @@ var FormulaModal = function FormulaModal(_ref) {
|
|
|
47
44
|
cancelText: texts.modalCancel
|
|
48
45
|
}, formulaEditor);
|
|
49
46
|
};
|
|
50
|
-
|
|
51
47
|
export default FormulaModal;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import InputNumber from '@synerise/ds-input-number';
|
|
3
3
|
import { debounce } from 'lodash';
|
|
4
|
-
|
|
5
4
|
var NumberInput = function NumberInput(_ref) {
|
|
6
5
|
var error = _ref.error,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
value = _ref.value,
|
|
7
|
+
onChange = _ref.onChange,
|
|
8
|
+
texts = _ref.texts,
|
|
9
|
+
opened = _ref.opened,
|
|
10
|
+
onDeactivate = _ref.onDeactivate,
|
|
11
|
+
_ref$readOnly = _ref.readOnly,
|
|
12
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
|
|
15
13
|
var _useState = useState(value),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
localValue = _useState[0],
|
|
15
|
+
setLocalValue = _useState[1];
|
|
19
16
|
var onChangeRef = useRef(onChange);
|
|
20
17
|
useEffect(function () {
|
|
21
18
|
onChangeRef.current = onChange;
|
|
@@ -31,12 +28,10 @@ var NumberInput = function NumberInput(_ref) {
|
|
|
31
28
|
debouncedOnChange.cancel();
|
|
32
29
|
};
|
|
33
30
|
}, [debouncedOnChange]);
|
|
34
|
-
|
|
35
31
|
var handleChange = function handleChange(val) {
|
|
36
32
|
setLocalValue(val);
|
|
37
33
|
debouncedOnChange(val);
|
|
38
34
|
};
|
|
39
|
-
|
|
40
35
|
return /*#__PURE__*/React.createElement(InputNumber, {
|
|
41
36
|
error: error,
|
|
42
37
|
autoFocus: opened,
|
|
@@ -47,5 +42,4 @@ var NumberInput = function NumberInput(_ref) {
|
|
|
47
42
|
readOnly: readOnly
|
|
48
43
|
});
|
|
49
44
|
};
|
|
50
|
-
|
|
51
45
|
export default NumberInput;
|