@synerise/ds-factors 1.11.11 → 1.11.13
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 +8 -0
- package/dist/FactorTypeSelector/FactorTypeSelector.d.ts +2 -2
- package/dist/FactorTypeSelector/FactorTypeSelector.js +37 -58
- package/dist/FactorTypeSelector/FactorTypeSelector.styles.d.ts +18 -18
- package/dist/FactorTypeSelector/FactorTypeSelector.styles.js +10 -10
- package/dist/FactorValue/Array/Array.const.js +8 -3
- package/dist/FactorValue/Array/Array.d.ts +2 -2
- package/dist/FactorValue/Array/Array.js +45 -57
- package/dist/FactorValue/Array/Array.styles.d.ts +39 -39
- package/dist/FactorValue/Array/Array.styles.js +44 -33
- package/dist/FactorValue/Array/Array.types.d.ts +3 -3
- package/dist/FactorValue/Array/Array.types.js +1 -1
- package/dist/FactorValue/Array/Array.utils.d.ts +2 -2
- package/dist/FactorValue/Array/Array.utils.js +21 -18
- package/dist/FactorValue/Array/components/ArrayCollector.d.ts +2 -2
- package/dist/FactorValue/Array/components/ArrayCollector.js +70 -94
- package/dist/FactorValue/Array/components/ArrayCreator.d.ts +2 -2
- package/dist/FactorValue/Array/components/ArrayCreator.js +43 -75
- package/dist/FactorValue/Array/components/ArrayLimit.d.ts +2 -2
- package/dist/FactorValue/Array/components/ArrayLimit.js +16 -14
- package/dist/FactorValue/Array/components/ArrayModal.d.ts +2 -2
- package/dist/FactorValue/Array/components/ArrayModal.js +78 -143
- package/dist/FactorValue/Array/components/ArrayRaw.d.ts +2 -2
- package/dist/FactorValue/Array/components/ArrayRaw.js +47 -58
- package/dist/FactorValue/Array/components/CopyButton.d.ts +2 -2
- package/dist/FactorValue/Array/components/CopyButton.js +20 -30
- package/dist/FactorValue/Array/hooks/useCollector.d.ts +3 -3
- package/dist/FactorValue/Array/hooks/useCollector.js +21 -22
- package/dist/FactorValue/Date/Date.d.ts +2 -2
- package/dist/FactorValue/Date/Date.js +38 -53
- package/dist/FactorValue/DateRange/DateRange.d.ts +2 -2
- package/dist/FactorValue/DateRange/DateRange.js +26 -41
- package/dist/FactorValue/DynamicKey/DynamicKey.d.ts +2 -2
- package/dist/FactorValue/DynamicKey/DynamicKey.js +37 -66
- package/dist/FactorValue/DynamicKey/DynamicKey.style.d.ts +2 -2
- package/dist/FactorValue/DynamicKey/DynamicKey.style.js +10 -8
- package/dist/FactorValue/FactorValue.d.ts +2 -2
- package/dist/FactorValue/FactorValue.js +68 -70
- package/dist/FactorValue/FactorValue.style.d.ts +1 -1
- package/dist/FactorValue/FactorValue.style.js +20 -20
- package/dist/FactorValue/Formula/Formula.d.ts +2 -2
- package/dist/FactorValue/Formula/Formula.js +36 -54
- package/dist/FactorValue/Formula/Formula.styles.d.ts +1 -1
- package/dist/FactorValue/Formula/Formula.styles.js +6 -5
- package/dist/FactorValue/Formula/FormulaModal.d.ts +2 -2
- package/dist/FactorValue/Formula/FormulaModal.js +27 -42
- package/dist/FactorValue/Number/NumberInput.d.ts +2 -2
- package/dist/FactorValue/Number/NumberInput.js +21 -31
- package/dist/FactorValue/Parameter/Parameter.constants.d.ts +1 -1
- package/dist/FactorValue/Parameter/Parameter.constants.js +27 -13
- package/dist/FactorValue/Parameter/Parameter.d.ts +2 -2
- package/dist/FactorValue/Parameter/Parameter.js +82 -127
- package/dist/FactorValue/Parameter/Parameter.style.d.ts +28 -28
- package/dist/FactorValue/Parameter/Parameter.style.js +34 -31
- package/dist/FactorValue/Parameter/Parameter.types.d.ts +2 -2
- package/dist/FactorValue/Parameter/Parameter.types.js +1 -1
- package/dist/FactorValue/Parameter/ParameterDropdown.d.ts +2 -2
- package/dist/FactorValue/Parameter/ParameterDropdown.js +155 -226
- package/dist/FactorValue/Parameter/ParameterDropdownItem.d.ts +3 -3
- package/dist/FactorValue/Parameter/ParameterDropdownItem.js +27 -33
- package/dist/FactorValue/Parameter/useGroups.d.ts +2 -2
- package/dist/FactorValue/Parameter/useGroups.js +30 -42
- package/dist/FactorValue/Parameter/utils.d.ts +2 -2
- package/dist/FactorValue/Parameter/utils.js +22 -17
- package/dist/FactorValue/RelativeDate/RelativeDate.const.d.ts +1 -1
- package/dist/FactorValue/RelativeDate/RelativeDate.const.js +12 -5
- package/dist/FactorValue/RelativeDate/RelativeDate.d.ts +2 -2
- package/dist/FactorValue/RelativeDate/RelativeDate.js +57 -88
- package/dist/FactorValue/RelativeDate/RelativeDate.utils.d.ts +1 -1
- package/dist/FactorValue/RelativeDate/RelativeDate.utils.js +14 -10
- package/dist/FactorValue/RelativeDate/RelativeDateDropdown.d.ts +2 -2
- package/dist/FactorValue/RelativeDate/RelativeDateDropdown.js +56 -87
- package/dist/FactorValue/RelativeDate/RelativeDateDropdown.styles.d.ts +7 -7
- package/dist/FactorValue/RelativeDate/RelativeDateDropdown.styles.js +23 -20
- package/dist/FactorValue/Text/Text.d.ts +2 -2
- package/dist/FactorValue/Text/Text.js +56 -121
- package/dist/FactorValue/Text/Text.styles.d.ts +3 -3
- package/dist/FactorValue/Text/Text.styles.js +11 -10
- package/dist/FactorValue/Text/TextModal.d.ts +2 -2
- package/dist/FactorValue/Text/TextModal.js +19 -33
- package/dist/Factors.d.ts +2 -2
- package/dist/Factors.js +95 -132
- package/dist/Factors.types.d.ts +9 -9
- package/dist/Factors.types.js +8 -3
- package/dist/hooks/useTexts.d.ts +2 -2
- package/dist/hooks/useTexts.js +287 -291
- package/dist/index.js +7 -6
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/dist/style/Factors.style.d.ts +1 -1
- package/dist/style/Factors.style.js +10 -11
- package/package.json +32 -32
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FactorValueComponentProps } from '../../Factors.types';
|
|
3
3
|
declare const DateRangeInput: ({ getPopupContainerOverride, value, onChange, error, texts, onDeactivate, allowClear, readOnly, }: FactorValueComponentProps) => React.JSX.Element;
|
|
4
4
|
export default DateRangeInput;
|
|
@@ -1,48 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import DateRangePicker from "@synerise/ds-date-range-picker";
|
|
5
|
+
import { getPopupContainer } from "@synerise/ds-utils";
|
|
6
|
+
const DateRangeInput = ({
|
|
7
|
+
getPopupContainerOverride,
|
|
8
|
+
value,
|
|
9
|
+
onChange,
|
|
10
|
+
error,
|
|
11
|
+
texts,
|
|
12
|
+
onDeactivate,
|
|
13
|
+
allowClear,
|
|
14
|
+
readOnly = false
|
|
15
|
+
}) => {
|
|
16
|
+
const intl = useIntl();
|
|
17
|
+
const changeHandler = useCallback((date) => {
|
|
17
18
|
onChange(date);
|
|
18
19
|
}, [onChange]);
|
|
19
|
-
|
|
20
|
+
const handleVisibleChange = useCallback((visible) => {
|
|
20
21
|
if (!visible) {
|
|
21
22
|
onDeactivate && onDeactivate();
|
|
22
23
|
}
|
|
23
24
|
}, [onDeactivate]);
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
relativeFuture: false,
|
|
33
|
-
relativeModes: ['PAST'],
|
|
34
|
-
showRelativePicker: true,
|
|
35
|
-
placement: "bottomLeft",
|
|
36
|
-
onVisibleChange: handleVisibleChange,
|
|
37
|
-
showNowButton: false,
|
|
38
|
-
filterRangeDisplayMode: "slider",
|
|
39
|
-
filterValueSelectionModes: ['Range'],
|
|
40
|
-
rangePickerInputProps: {
|
|
41
|
-
readOnly: readOnly,
|
|
42
|
-
error: error,
|
|
43
|
-
allowClear: allowClear
|
|
44
|
-
},
|
|
45
|
-
readOnly: readOnly
|
|
46
|
-
});
|
|
25
|
+
return /* @__PURE__ */ jsx(DateRangePicker, { intl, onApply: changeHandler, showTime: true, getPopupContainer: getPopupContainerOverride || getPopupContainer, showFilter: true, value, texts: texts.dateRangePicker, relativeFuture: false, relativeModes: ["PAST"], showRelativePicker: true, placement: "bottomLeft", onVisibleChange: handleVisibleChange, showNowButton: false, filterRangeDisplayMode: "slider", filterValueSelectionModes: ["Range"], rangePickerInputProps: {
|
|
26
|
+
readOnly,
|
|
27
|
+
error,
|
|
28
|
+
allowClear
|
|
29
|
+
}, readOnly });
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
DateRangeInput as default
|
|
47
33
|
};
|
|
48
|
-
export default DateRangeInput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FactorValueComponentProps } from '../../Factors.types';
|
|
3
3
|
declare const DynamicKey: ({ value, onChange, withoutTypeSelector, texts, opened, onDeactivate, error, factorValueExtraProps, readOnly, uncontrolledComponent, }: FactorValueComponentProps) => React.JSX.Element;
|
|
4
4
|
export default DynamicKey;
|
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var _useState2 = useState(false),
|
|
26
|
-
localError = _useState2[0],
|
|
27
|
-
setLocalError = _useState2[1];
|
|
28
|
-
var handleChange = function handleChange(inputKey, inputValue) {
|
|
29
|
-
var newValue = _extends({}, value);
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { DynamicKeyInput, DynamicKey as DynamicKey$1 } from "./DynamicKey.style.js";
|
|
4
|
+
const DynamicKey = ({
|
|
5
|
+
value,
|
|
6
|
+
onChange,
|
|
7
|
+
withoutTypeSelector = false,
|
|
8
|
+
texts,
|
|
9
|
+
opened,
|
|
10
|
+
onDeactivate,
|
|
11
|
+
error,
|
|
12
|
+
factorValueExtraProps,
|
|
13
|
+
readOnly = false,
|
|
14
|
+
uncontrolledComponent
|
|
15
|
+
}) => {
|
|
16
|
+
const [localValue, setLocalValue] = useState(() => ({
|
|
17
|
+
key: value.key,
|
|
18
|
+
value: value.value
|
|
19
|
+
}));
|
|
20
|
+
const [localError, setLocalError] = useState(false);
|
|
21
|
+
const handleChange = (inputKey, inputValue) => {
|
|
22
|
+
const newValue = {
|
|
23
|
+
...value
|
|
24
|
+
};
|
|
30
25
|
newValue[inputKey] = inputValue;
|
|
31
26
|
setLocalValue(newValue);
|
|
32
27
|
onChange(newValue);
|
|
@@ -36,7 +31,7 @@ var DynamicKey = function DynamicKey(_ref) {
|
|
|
36
31
|
setLocalError(false);
|
|
37
32
|
}
|
|
38
33
|
};
|
|
39
|
-
useEffect(
|
|
34
|
+
useEffect(() => {
|
|
40
35
|
if (!uncontrolledComponent) {
|
|
41
36
|
setLocalValue({
|
|
42
37
|
key: value.key,
|
|
@@ -44,40 +39,16 @@ var DynamicKey = function DynamicKey(_ref) {
|
|
|
44
39
|
});
|
|
45
40
|
}
|
|
46
41
|
}, [value, uncontrolledComponent]);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
onChange: function onChange(event) {
|
|
60
|
-
return handleChange('key', event.target.value);
|
|
61
|
-
},
|
|
62
|
-
autoFocus: opened,
|
|
63
|
-
onBlur: onDeactivate,
|
|
64
|
-
error: localError || error,
|
|
65
|
-
readOnly: readOnly
|
|
66
|
-
})), /*#__PURE__*/React.createElement(S.DynamicKeyInput, _extends({
|
|
67
|
-
index: 1
|
|
68
|
-
}, valueInputProps, {
|
|
69
|
-
placeholder: texts.dynamicKey.valuePlaceholder,
|
|
70
|
-
value: localValue.value,
|
|
71
|
-
name: "value",
|
|
72
|
-
onChange: function onChange(event) {
|
|
73
|
-
return handleChange('value', event.target.value);
|
|
74
|
-
},
|
|
75
|
-
error: localError || error,
|
|
76
|
-
readOnly: readOnly
|
|
77
|
-
})));
|
|
78
|
-
return /*#__PURE__*/React.createElement(S.DynamicKey, {
|
|
79
|
-
"data-testid": "ds-factors-dynamic-key",
|
|
80
|
-
withoutTypeSelector: withoutTypeSelector
|
|
81
|
-
}, trigger);
|
|
42
|
+
const {
|
|
43
|
+
keyInputProps = {},
|
|
44
|
+
valueInputProps = {}
|
|
45
|
+
} = factorValueExtraProps?.dynamicKey || {};
|
|
46
|
+
const trigger = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
47
|
+
/* @__PURE__ */ jsx(DynamicKeyInput, { withoutTypeSelector, index: 0, ...keyInputProps, placeholder: texts.dynamicKey.keyPlaceholder, value: localValue.key, name: "key", onChange: (event) => handleChange("key", event.target.value), autoFocus: opened, onBlur: onDeactivate, error: localError || error, readOnly }),
|
|
48
|
+
/* @__PURE__ */ jsx(DynamicKeyInput, { index: 1, ...valueInputProps, placeholder: texts.dynamicKey.valuePlaceholder, value: localValue.value, name: "value", onChange: (event) => handleChange("value", event.target.value), error: localError || error, readOnly })
|
|
49
|
+
] });
|
|
50
|
+
return /* @__PURE__ */ jsx(DynamicKey$1, { "data-testid": "ds-factors-dynamic-key", withoutTypeSelector, children: trigger });
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
DynamicKey as default
|
|
82
54
|
};
|
|
83
|
-
export default DynamicKey;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StyledInput } from '@synerise/ds-input';
|
|
2
2
|
type ExtraProps = {
|
|
3
3
|
index: 0 | 1;
|
|
4
4
|
withoutTypeSelector?: boolean;
|
|
5
5
|
};
|
|
6
6
|
export declare const DynamicKeyInput: StyledInput<ExtraProps>;
|
|
7
|
-
export declare const DynamicKey: import(
|
|
7
|
+
export declare const DynamicKey: import('styled-components').StyledComponent<"div", any, {
|
|
8
8
|
withoutTypeSelector: boolean;
|
|
9
9
|
}, never>;
|
|
10
10
|
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
import { Input } from
|
|
3
|
-
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { Input } from "@synerise/ds-input";
|
|
3
|
+
const DynamicKeyInput = /* @__PURE__ */ styled(Input).withConfig({
|
|
4
4
|
displayName: "DynamicKeystyle__DynamicKeyInput",
|
|
5
5
|
componentId: "sc-43cup-0"
|
|
6
|
-
})(["flex:1;&:focus{z-index:2;}.ant-input{", "}"],
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
export var DynamicKey = styled.div.withConfig({
|
|
6
|
+
})(["flex:1;&:focus{z-index:2;}.ant-input{", "}"], (props) => props.index === 0 ? css(["border-radius:", ";"], props.withoutTypeSelector ? "3px 0 0 3px" : "0") : css(["border-radius:0 3px 3px 0;margin-left:-1px;"]));
|
|
7
|
+
const DynamicKey = /* @__PURE__ */ styled.div.withConfig({
|
|
10
8
|
displayName: "DynamicKeystyle__DynamicKey",
|
|
11
9
|
componentId: "sc-43cup-1"
|
|
12
|
-
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;width:100%;"]);
|
|
10
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;width:100%;"]);
|
|
11
|
+
export {
|
|
12
|
+
DynamicKey,
|
|
13
|
+
DynamicKeyInput
|
|
14
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FactorValueProps } from '../Factors.types';
|
|
3
3
|
declare const FactorValue: ({ selectedFactorType, value, onChangeValue, onParamsClick, selectedFactor, textType, parameters, autocompleteText, withoutTypeSelector, texts, formulaEditor, opened, loading, factorKey, preventAutoloadData, getPopupContainerOverride, onActivate, onDeactivate, error, inputProps, allowClear, readOnly, relativeDateProps, arrayProps, factorValueExtraProps, uncontrolledComponent, }: FactorValueProps) => React.JSX.Element;
|
|
4
4
|
export default FactorValue;
|
|
@@ -1,74 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
import React from
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var inputType = React.useMemo(function () {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FactorInput } from "./FactorValue.style.js";
|
|
4
|
+
const FactorValue = ({
|
|
5
|
+
selectedFactorType,
|
|
6
|
+
value,
|
|
7
|
+
onChangeValue,
|
|
8
|
+
onParamsClick,
|
|
9
|
+
selectedFactor,
|
|
10
|
+
textType,
|
|
11
|
+
parameters,
|
|
12
|
+
autocompleteText,
|
|
13
|
+
withoutTypeSelector = false,
|
|
14
|
+
texts,
|
|
15
|
+
formulaEditor,
|
|
16
|
+
opened,
|
|
17
|
+
loading,
|
|
18
|
+
factorKey,
|
|
19
|
+
preventAutoloadData,
|
|
20
|
+
getPopupContainerOverride,
|
|
21
|
+
onActivate,
|
|
22
|
+
onDeactivate,
|
|
23
|
+
error,
|
|
24
|
+
inputProps,
|
|
25
|
+
allowClear,
|
|
26
|
+
readOnly = false,
|
|
27
|
+
relativeDateProps,
|
|
28
|
+
arrayProps,
|
|
29
|
+
factorValueExtraProps,
|
|
30
|
+
uncontrolledComponent
|
|
31
|
+
}) => {
|
|
32
|
+
const inputType = React.useMemo(() => {
|
|
34
33
|
if (!selectedFactor) {
|
|
35
|
-
return
|
|
34
|
+
return void 0;
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
36
|
+
const FactorValueComponent = selectedFactor.component;
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
FactorValueComponent,
|
|
39
|
+
{
|
|
40
|
+
value,
|
|
41
|
+
onChange: onChangeValue,
|
|
42
|
+
textType,
|
|
43
|
+
factorType: selectedFactorType,
|
|
44
|
+
autocompleteText,
|
|
45
|
+
parameters: ["parameter", "contextParameter"].indexOf(selectedFactorType) >= 0 ? parameters : void 0,
|
|
46
|
+
withoutTypeSelector,
|
|
47
|
+
texts,
|
|
48
|
+
arrayProps,
|
|
49
|
+
formulaEditor,
|
|
50
|
+
opened,
|
|
51
|
+
loading,
|
|
52
|
+
onParamsClick,
|
|
53
|
+
preventAutoloadData,
|
|
54
|
+
getPopupContainerOverride,
|
|
55
|
+
onActivate,
|
|
56
|
+
onDeactivate,
|
|
57
|
+
error,
|
|
58
|
+
allowClear,
|
|
59
|
+
readOnly,
|
|
60
|
+
inputProps,
|
|
61
|
+
factorValueExtraProps,
|
|
62
|
+
...relativeDateProps,
|
|
63
|
+
uncontrolledComponent
|
|
64
|
+
},
|
|
65
|
+
`${factorKey}-${selectedFactor.name}`
|
|
66
|
+
);
|
|
67
67
|
}, [selectedFactor, factorKey, value, texts, onChangeValue, textType, selectedFactorType, autocompleteText, parameters, withoutTypeSelector, inputProps, arrayProps, formulaEditor, opened, loading, onParamsClick, preventAutoloadData, getPopupContainerOverride, onActivate, onDeactivate, error, allowClear, readOnly, relativeDateProps, factorValueExtraProps, uncontrolledComponent]);
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}, inputType);
|
|
68
|
+
return /* @__PURE__ */ jsx(FactorInput, { inputType: selectedFactorType, inputTextType: textType, withoutTypeSelector, children: inputType });
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
FactorValue as default
|
|
73
72
|
};
|
|
74
|
-
export default FactorValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const FactorInput: import(
|
|
1
|
+
export declare const FactorInput: import('styled-components').StyledComponent<"div", any, {
|
|
2
2
|
withoutTypeSelector: boolean;
|
|
3
3
|
inputTextType?: "autocomplete" | "default" | "expansible";
|
|
4
4
|
inputType?: string;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
import { Container } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { Container } from "@synerise/ds-date-picker/dist/Elements/PickerInput/PickerInput.styles";
|
|
3
|
+
const DEFAULT_WIDTH = {
|
|
4
|
+
"text-autocomplete": "147px",
|
|
5
|
+
"text-default": "147px",
|
|
6
|
+
"text-expansible": "123px"
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
const FactorInput = /* @__PURE__ */ styled.div.withConfig({
|
|
9
9
|
displayName: "FactorValuestyle__FactorInput",
|
|
10
10
|
componentId: "sc-17jtnx3-0"
|
|
11
|
-
})(["&&{", ";", "{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:", ";}}}"],
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
inputTextType =
|
|
11
|
+
})(["&&{", ";", "{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:", ";}}}"], (props) => {
|
|
12
|
+
const {
|
|
13
|
+
inputType,
|
|
14
|
+
inputTextType = "default"
|
|
15
|
+
} = props;
|
|
15
16
|
if (inputType) {
|
|
16
|
-
if (inputType ===
|
|
17
|
+
if (inputType === "array") {
|
|
17
18
|
return css(["&&&{min-width:173px;input{min-width:123px;}}"]);
|
|
18
19
|
}
|
|
19
|
-
if (inputType ===
|
|
20
|
+
if (inputType === "dateRange") {
|
|
20
21
|
return css(["&&&{min-width:173px;}"]);
|
|
21
22
|
}
|
|
22
|
-
if (inputType ===
|
|
23
|
-
return css(["&&&{input{min-width:", ";}}"], DEFAULT_WIDTH[inputType
|
|
23
|
+
if (inputType === "text" && DEFAULT_WIDTH[`${inputType}-${inputTextType}`]) {
|
|
24
|
+
return css(["&&&{input{min-width:", ";}}"], DEFAULT_WIDTH[`${inputType}-${inputTextType}`]);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
return false;
|
|
27
|
-
}, Container,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
28
|
+
}, Container, (props) => props.withoutTypeSelector ? "3px" : "0 3px 3px 0", (props) => props.withoutTypeSelector ? "3px" : "0 3px 3px 0");
|
|
29
|
+
export {
|
|
30
|
+
FactorInput
|
|
31
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FactorValueComponentProps } from '../../Factors.types';
|
|
3
3
|
declare const FormulaInput: ({ value, error, onChange, withoutTypeSelector, texts, formulaEditor, readOnly, }: FactorValueComponentProps) => React.JSX.Element;
|
|
4
4
|
export default FormulaInput;
|
|
@@ -1,64 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
setOpenFormulaModal = _useState[1];
|
|
20
|
-
var triggerMode = useMemo(function () {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo, useCallback } from "react";
|
|
3
|
+
import Badge from "@synerise/ds-badge";
|
|
4
|
+
import Button from "@synerise/ds-button";
|
|
5
|
+
import Icon, { EditS } from "@synerise/ds-icon";
|
|
6
|
+
import { FormulaButton } from "./Formula.styles.js";
|
|
7
|
+
import FormulaModal from "./FormulaModal.js";
|
|
8
|
+
const FormulaInput = ({
|
|
9
|
+
value,
|
|
10
|
+
error,
|
|
11
|
+
onChange,
|
|
12
|
+
withoutTypeSelector = false,
|
|
13
|
+
texts,
|
|
14
|
+
formulaEditor,
|
|
15
|
+
readOnly = false
|
|
16
|
+
}) => {
|
|
17
|
+
const [openFormulaModal, setOpenFormulaModal] = useState(false);
|
|
18
|
+
const triggerMode = useMemo(() => {
|
|
21
19
|
if (value) {
|
|
22
|
-
return readOnly ?
|
|
20
|
+
return readOnly ? "label-icon" : "two-icons";
|
|
23
21
|
}
|
|
24
|
-
return readOnly ?
|
|
22
|
+
return readOnly ? "simple" : "label-icon";
|
|
25
23
|
}, [value, readOnly]);
|
|
26
|
-
|
|
27
|
-
return value ?
|
|
28
|
-
flag: true,
|
|
29
|
-
status: "active"
|
|
30
|
-
}) : '';
|
|
24
|
+
const activeIcon = useMemo(() => {
|
|
25
|
+
return value ? /* @__PURE__ */ jsx(Badge, { flag: true, status: "active" }) : "";
|
|
31
26
|
}, [value]);
|
|
32
|
-
|
|
27
|
+
const label = useMemo(() => {
|
|
33
28
|
return value ? value.name : texts.formula.buttonPlaceholder;
|
|
34
29
|
}, [value, texts.formula.buttonPlaceholder]);
|
|
35
|
-
|
|
30
|
+
const handleChange = useCallback((val) => {
|
|
36
31
|
setOpenFormulaModal(false);
|
|
37
32
|
onChange(val);
|
|
38
33
|
}, [onChange]);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, activeIcon, label, /*#__PURE__*/React.createElement(Icon, {
|
|
52
|
-
component: /*#__PURE__*/React.createElement(EditS, null)
|
|
53
|
-
})), /*#__PURE__*/React.createElement(FormulaModal, {
|
|
54
|
-
visible: openFormulaModal,
|
|
55
|
-
onCancel: function onCancel() {
|
|
56
|
-
return setOpenFormulaModal(false);
|
|
57
|
-
},
|
|
58
|
-
value: value,
|
|
59
|
-
onApply: handleChange,
|
|
60
|
-
texts: texts,
|
|
61
|
-
formulaEditor: formulaEditor
|
|
62
|
-
}));
|
|
34
|
+
const handleClick = !readOnly ? () => setOpenFormulaModal(true) : void 0;
|
|
35
|
+
return /* @__PURE__ */ jsxs(FormulaButton, { "data-testid": "ds-factors-formula", withoutTypeSelector, children: [
|
|
36
|
+
/* @__PURE__ */ jsxs(Button, { readOnly, type: "secondary", error, mode: triggerMode, onClick: handleClick, children: [
|
|
37
|
+
activeIcon,
|
|
38
|
+
label,
|
|
39
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(EditS, {}) })
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ jsx(FormulaModal, { visible: openFormulaModal, onCancel: () => setOpenFormulaModal(false), value, onApply: handleChange, texts, formulaEditor })
|
|
42
|
+
] });
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
FormulaInput as default
|
|
63
46
|
};
|
|
64
|
-
export default FormulaInput;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
const FormulaButton = /* @__PURE__ */ styled.div.withConfig({
|
|
3
3
|
displayName: "Formulastyles__FormulaButton",
|
|
4
4
|
componentId: "sc-bixbni-0"
|
|
5
|
-
})([".ds-button{border-radius:", ";.ant-badge{padding:0 8px 0 12px;}}"],
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
})([".ds-button{border-radius:", ";.ant-badge{padding:0 8px 0 12px;}}"], (props) => props.withoutTypeSelector ? "3px" : "0 3px 3px 0");
|
|
6
|
+
export {
|
|
7
|
+
FormulaButton
|
|
8
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FormulaModalProps } from '../../Factors.types';
|
|
3
3
|
declare const FormulaModal: React.FC<FormulaModalProps>;
|
|
4
4
|
export default FormulaModal;
|