@synerise/ds-factors 0.11.9 → 0.13.0
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 +47 -0
- package/README.md +19 -17
- package/dist/FactorTypeSelector/FactorTypeSelector.styles.js +1 -1
- package/dist/FactorValue/Date/Date.js +9 -2
- package/dist/FactorValue/DateRange/DateRange.d.ts +4 -0
- package/dist/FactorValue/DateRange/DateRange.js +36 -0
- package/dist/FactorValue/DynamicKey/DynamicKey.js +4 -2
- package/dist/FactorValue/FactorValue.js +23 -26
- package/dist/FactorValue/Number/NumberInput.js +4 -2
- package/dist/FactorValue/Parameter/Parameter.js +13 -5
- package/dist/FactorValue/Text/Text.js +4 -2
- package/dist/Factors.d.ts +5 -0
- package/dist/Factors.js +219 -1
- package/dist/Factors.types.d.ts +9 -5
- package/dist/Factors.types.js +1 -1
- package/package.json +10 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,53 @@
|
|
|
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.13.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.12.2...@synerise/ds-factors@0.13.0) (2022-04-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **factors:** adds onDeactivate prop, updates Readme.md ([ff85234](https://github.com/Synerise/synerise-design/commit/ff852349a5c77047d6d0642d4b5587dbcc6d24cd))
|
|
12
|
+
* **factors:** adds tests ([8c469e1](https://github.com/Synerise/synerise-design/commit/8c469e164e986f346b591b3a97ed3b6fbab3cdaa))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [0.12.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.12.1...@synerise/ds-factors@0.12.2) (2022-04-12)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* fix filter dropdowns ([eaab107](https://github.com/Synerise/synerise-design/commit/eaab107b6dca7401a17c2e36806febd11edc677b))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [0.12.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.12.0...@synerise/ds-factors@0.12.1) (2022-04-08)
|
|
30
|
+
|
|
31
|
+
**Note:** Version bump only for package @synerise/ds-factors
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# [0.12.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.11.9...@synerise/ds-factors@0.12.0) (2022-04-05)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Bug Fixes
|
|
41
|
+
|
|
42
|
+
* fix eslint errors ([7cce9b9](https://github.com/Synerise/synerise-design/commit/7cce9b94f8dea533b3c36a0f0cfd5145d4737166))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Features
|
|
46
|
+
|
|
47
|
+
* **filter:** fixes bugs ([b862ddd](https://github.com/Synerise/synerise-design/commit/b862dddbce1293c2a5381663fc903bb574edd135))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
6
53
|
## [0.11.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.11.8...@synerise/ds-factors@0.11.9) (2022-03-30)
|
|
7
54
|
|
|
8
55
|
**Note:** Version bump only for package @synerise/ds-factors
|
package/README.md
CHANGED
|
@@ -97,23 +97,25 @@ import Factors from '@synerise/ds-factors'
|
|
|
97
97
|
|
|
98
98
|
## API
|
|
99
99
|
|
|
100
|
-
| Property | Description | Type
|
|
101
|
-
| --- | --- | ---
|
|
102
|
-
| autocompleteText | Array of available autocomplete suggestions (only if textType is equal to `autocomplete`) | {options: string[]}
|
|
103
|
-
| availableFactorTypes | Array of available factor types | FactorType[]
|
|
104
|
-
| defaultFactorType | Default factor type | FactorType
|
|
105
|
-
| formulaEditor | Formula editor render in modal when factory type is equal to `formula` | React.ReactNode
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
|
100
|
+
| Property | Description | Type | Default |
|
|
101
|
+
| --- | --- | --- | --- |
|
|
102
|
+
| autocompleteText | Array of available autocomplete suggestions (only if textType is equal to `autocomplete`) | {options: string[]} | - |
|
|
103
|
+
| availableFactorTypes | Array of available factor types | FactorType[] | - |
|
|
104
|
+
| defaultFactorType | Default factor type | FactorType | - |
|
|
105
|
+
| formulaEditor | Formula editor render in modal when factory type is equal to `formula` | React.ReactNode | - |
|
|
106
|
+
| getPopupContainerOverride | Popup container function for child tooltips and dropdowns | (trigger: HTMLElement \ null) => HTMLElement; | - |
|
|
107
|
+
| onActivate | Callback called when user opens dropdown | (fieldType: string) => void | - |
|
|
108
|
+
| onChangeValue | Callback called when user change value | (value: FactorValueType) => void | - |
|
|
109
|
+
| onDeactivate | Callback called when user closes dropdown | () => void | - |
|
|
110
|
+
| opened | Whether if dropdown should opens from outside of component | boolean | false |
|
|
111
|
+
| parameters | Options for parameters list | ParameterOptions | - |
|
|
112
|
+
| selectedFactorType | Selected factor type | FactorType | - |
|
|
113
|
+
| setSelectedFactorType | Callback called when user selects factor type | (factor: FactorType) => void | - |
|
|
114
|
+
| texts | Translations object | FactorsTexts | - |
|
|
115
|
+
| textType | Variant of text type input (`autocomplete` \ `expansible` \ `default` ) | string | `default` |
|
|
116
|
+
| unavailableFactorTypes | Array of excluded factor types | FactorType[] | - |
|
|
117
|
+
| value | Value | FactorValueType | - |
|
|
118
|
+
| withoutTypeSelector | Whether if hide factor type selector | boolean | - |
|
|
117
119
|
|
|
118
120
|
### FactorType
|
|
119
121
|
|
|
@@ -8,6 +8,6 @@ export var FactorTypeList = styled(Menu).withConfig({
|
|
|
8
8
|
export var TriggerButton = styled(Button).withConfig({
|
|
9
9
|
displayName: "FactorTypeSelectorstyles__TriggerButton",
|
|
10
10
|
componentId: "sc-15cv997-1"
|
|
11
|
-
})(["&&&{display:inline-flex;border-radius:3px 0 0 3px;&:focus{.btn-focus{box-shadow:inset 0 0 0 1px ", ";}}}"], function (props) {
|
|
11
|
+
})(["&&&{display:inline-flex;border-radius:3px 0 0 3px;min-width:32px;&:focus{.btn-focus{box-shadow:inset 0 0 0 1px ", ";}}}"], function (props) {
|
|
12
12
|
return props.theme.palette['grey-300'];
|
|
13
13
|
});
|
|
@@ -5,10 +5,16 @@ var DateInput = function DateInput(_ref) {
|
|
|
5
5
|
var value = _ref.value,
|
|
6
6
|
onChange = _ref.onChange,
|
|
7
7
|
texts = _ref.texts,
|
|
8
|
-
opened = _ref.opened
|
|
8
|
+
opened = _ref.opened,
|
|
9
|
+
onDeactivate = _ref.onDeactivate;
|
|
9
10
|
var changeHandler = React.useCallback(function (date) {
|
|
10
11
|
onChange(date);
|
|
11
12
|
}, [onChange]);
|
|
13
|
+
var handleVisibleChange = React.useCallback(function (visible) {
|
|
14
|
+
if (!visible) {
|
|
15
|
+
onDeactivate && onDeactivate();
|
|
16
|
+
}
|
|
17
|
+
}, [onDeactivate]);
|
|
12
18
|
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
13
19
|
onApply: changeHandler,
|
|
14
20
|
value: value,
|
|
@@ -18,7 +24,8 @@ var DateInput = function DateInput(_ref) {
|
|
|
18
24
|
disabledHours: [],
|
|
19
25
|
disabledMinutes: [],
|
|
20
26
|
disabledSeconds: [],
|
|
21
|
-
autoFocus: opened
|
|
27
|
+
autoFocus: opened,
|
|
28
|
+
onDropdownVisibleChange: handleVisibleChange
|
|
22
29
|
});
|
|
23
30
|
};
|
|
24
31
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import DateRangePicker from '@synerise/ds-date-range-picker';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
|
|
5
|
+
var DateRangeInput = function DateRangeInput(_ref) {
|
|
6
|
+
var value = _ref.value,
|
|
7
|
+
onChange = _ref.onChange,
|
|
8
|
+
texts = _ref.texts,
|
|
9
|
+
onDeactivate = _ref.onDeactivate;
|
|
10
|
+
var intl = useIntl();
|
|
11
|
+
var changeHandler = React.useCallback(function (date) {
|
|
12
|
+
onChange(date);
|
|
13
|
+
}, [onChange]);
|
|
14
|
+
var handleVisibleChange = React.useCallback(function (visible) {
|
|
15
|
+
if (!visible) {
|
|
16
|
+
onDeactivate && onDeactivate();
|
|
17
|
+
}
|
|
18
|
+
}, [onDeactivate]);
|
|
19
|
+
return /*#__PURE__*/React.createElement(DateRangePicker, {
|
|
20
|
+
intl: intl,
|
|
21
|
+
onApply: changeHandler,
|
|
22
|
+
showTime: true,
|
|
23
|
+
showFilter: true,
|
|
24
|
+
value: value,
|
|
25
|
+
texts: texts.dateRangePicker,
|
|
26
|
+
relativeFuture: false,
|
|
27
|
+
relativeModes: ['PAST'],
|
|
28
|
+
showRelativePicker: true,
|
|
29
|
+
popoverProps: {
|
|
30
|
+
placement: 'bottomLeft',
|
|
31
|
+
onVisibleChange: handleVisibleChange
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default DateRangeInput;
|
|
@@ -15,7 +15,8 @@ var DynamicKey = function DynamicKey(_ref) {
|
|
|
15
15
|
_ref$withoutTypeSelec = _ref.withoutTypeSelector,
|
|
16
16
|
withoutTypeSelector = _ref$withoutTypeSelec === void 0 ? false : _ref$withoutTypeSelec,
|
|
17
17
|
texts = _ref.texts,
|
|
18
|
-
opened = _ref.opened
|
|
18
|
+
opened = _ref.opened,
|
|
19
|
+
onDeactivate = _ref.onDeactivate;
|
|
19
20
|
|
|
20
21
|
var _React$useState = React.useState({
|
|
21
22
|
key: value.key,
|
|
@@ -44,7 +45,8 @@ var DynamicKey = function DynamicKey(_ref) {
|
|
|
44
45
|
value: localValue.key,
|
|
45
46
|
name: "key",
|
|
46
47
|
onChange: handleChange,
|
|
47
|
-
autoFocus: opened
|
|
48
|
+
autoFocus: opened,
|
|
49
|
+
onBlur: onDeactivate
|
|
48
50
|
}), /*#__PURE__*/React.createElement(RawInput, {
|
|
49
51
|
placeholder: texts.dynamicKey.valuePlaceholder,
|
|
50
52
|
value: localValue.value,
|
|
@@ -19,34 +19,31 @@ var FactorValue = function FactorValue(_ref) {
|
|
|
19
19
|
factorKey = _ref.factorKey,
|
|
20
20
|
preventAutoloadData = _ref.preventAutoloadData,
|
|
21
21
|
getPopupContainerOverride = _ref.getPopupContainerOverride,
|
|
22
|
-
onActivate = _ref.onActivate
|
|
22
|
+
onActivate = _ref.onActivate,
|
|
23
|
+
onDeactivate = _ref.onDeactivate;
|
|
23
24
|
var inputType = React.useMemo(function () {
|
|
24
25
|
var InputComponent = selectedFactor.input;
|
|
25
|
-
return (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
onActivate: onActivate
|
|
47
|
-
})
|
|
48
|
-
);
|
|
49
|
-
}, [selectedFactor.input, selectedFactor.name, factorKey, value, texts, onChangeValue, textType, selectedFactorType, autocompleteText, parameters, withoutTypeSelector, formulaEditor, opened, loading, onParamsClick, preventAutoloadData, onActivate, getPopupContainerOverride]);
|
|
26
|
+
return /*#__PURE__*/React.createElement(InputComponent, {
|
|
27
|
+
key: factorKey + "-" + selectedFactor.name,
|
|
28
|
+
value: value,
|
|
29
|
+
placeholder: texts.valuePlaceholder,
|
|
30
|
+
onChange: onChangeValue,
|
|
31
|
+
textType: textType,
|
|
32
|
+
factorType: selectedFactorType,
|
|
33
|
+
autocompleteText: autocompleteText,
|
|
34
|
+
parameters: ['parameter', 'contextParameter'].indexOf(selectedFactorType) >= 0 && parameters,
|
|
35
|
+
withoutTypeSelector: withoutTypeSelector,
|
|
36
|
+
texts: texts,
|
|
37
|
+
formulaEditor: formulaEditor,
|
|
38
|
+
opened: opened,
|
|
39
|
+
loading: loading,
|
|
40
|
+
onParamsClick: onParamsClick,
|
|
41
|
+
preventAutoloadData: preventAutoloadData,
|
|
42
|
+
getPopupContainerOverride: getPopupContainerOverride,
|
|
43
|
+
onActivate: onActivate,
|
|
44
|
+
onDeactivate: onDeactivate
|
|
45
|
+
});
|
|
46
|
+
}, [selectedFactor.input, selectedFactor.name, factorKey, value, texts, onChangeValue, textType, selectedFactorType, autocompleteText, parameters, withoutTypeSelector, formulaEditor, opened, loading, onParamsClick, preventAutoloadData, getPopupContainerOverride, onActivate, onDeactivate]);
|
|
50
47
|
return /*#__PURE__*/React.createElement(S.FactorInput, {
|
|
51
48
|
withoutTypeSelector: withoutTypeSelector
|
|
52
49
|
}, inputType);
|
|
@@ -6,7 +6,8 @@ var NumberInput = function NumberInput(_ref) {
|
|
|
6
6
|
var value = _ref.value,
|
|
7
7
|
onChange = _ref.onChange,
|
|
8
8
|
texts = _ref.texts,
|
|
9
|
-
opened = _ref.opened
|
|
9
|
+
opened = _ref.opened,
|
|
10
|
+
onDeactivate = _ref.onDeactivate;
|
|
10
11
|
|
|
11
12
|
var _React$useState = React.useState(value),
|
|
12
13
|
localValue = _React$useState[0],
|
|
@@ -26,7 +27,8 @@ var NumberInput = function NumberInput(_ref) {
|
|
|
26
27
|
autoFocus: opened,
|
|
27
28
|
placeholder: texts.valuePlaceholder,
|
|
28
29
|
value: localValue,
|
|
29
|
-
onChange: handleChange
|
|
30
|
+
onChange: handleChange,
|
|
31
|
+
onBlur: onDeactivate
|
|
30
32
|
});
|
|
31
33
|
};
|
|
32
34
|
|
|
@@ -22,7 +22,8 @@ var ParameterInput = function ParameterInput(_ref) {
|
|
|
22
22
|
opened = _ref.opened,
|
|
23
23
|
preventAutoloadData = _ref.preventAutoloadData,
|
|
24
24
|
getPopupContainerOverride = _ref.getPopupContainerOverride,
|
|
25
|
-
onActivate = _ref.onActivate
|
|
25
|
+
onActivate = _ref.onActivate,
|
|
26
|
+
onDeactivate = _ref.onDeactivate;
|
|
26
27
|
|
|
27
28
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
28
29
|
// @ts-ignore
|
|
@@ -44,9 +45,11 @@ var ParameterInput = function ParameterInput(_ref) {
|
|
|
44
45
|
onActivate && onActivate();
|
|
45
46
|
}, [onParamsClick, onActivate]);
|
|
46
47
|
React.useEffect(function () {
|
|
48
|
+
setDropdownVisible(Boolean(opened));
|
|
49
|
+
|
|
47
50
|
if (opened) {
|
|
48
|
-
setDropdownVisible(true);
|
|
49
51
|
onParamsClick && onParamsClick();
|
|
52
|
+
onActivate && onActivate();
|
|
50
53
|
} // eslint-disable-next-line
|
|
51
54
|
|
|
52
55
|
}, [opened]);
|
|
@@ -54,13 +57,18 @@ var ParameterInput = function ParameterInput(_ref) {
|
|
|
54
57
|
!preventAutoloadData && onParamsClick && onParamsClick(); // eslint-disable-next-line
|
|
55
58
|
}, []);
|
|
56
59
|
var onDropdownVisibilityChange = React.useCallback(function (newValue) {
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
newValue && onActivate && onActivate();
|
|
61
|
+
|
|
62
|
+
if (!newValue) {
|
|
63
|
+
onDeactivate && onDeactivate();
|
|
64
|
+
setDropdownVisible(false);
|
|
65
|
+
}
|
|
66
|
+
}, [onActivate, onDeactivate]);
|
|
59
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
60
68
|
"data-popup-container": true
|
|
61
69
|
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
62
70
|
visible: dropdownVisible,
|
|
63
|
-
getPopupContainer: getPopupContainer,
|
|
71
|
+
getPopupContainer: getPopupContainerOverride || getPopupContainer,
|
|
64
72
|
onVisibleChange: onDropdownVisibilityChange,
|
|
65
73
|
overlay: /*#__PURE__*/React.createElement(ParameterDropdown, _extends({
|
|
66
74
|
setDropdownVisible: setDropdownVisible,
|
|
@@ -15,7 +15,8 @@ var TextInput = function TextInput(_ref) {
|
|
|
15
15
|
textType = _ref.textType,
|
|
16
16
|
autocompleteText = _ref.autocompleteText,
|
|
17
17
|
factorType = _ref.factorType,
|
|
18
|
-
opened = _ref.opened
|
|
18
|
+
opened = _ref.opened,
|
|
19
|
+
onDeactivate = _ref.onDeactivate;
|
|
19
20
|
|
|
20
21
|
var _React$useState = React.useState(false),
|
|
21
22
|
openExpanseEditor = _React$useState[0],
|
|
@@ -81,7 +82,8 @@ var TextInput = function TextInput(_ref) {
|
|
|
81
82
|
placeholder: texts.valuePlaceholder,
|
|
82
83
|
suffix: SuffixIcon,
|
|
83
84
|
value: localValue,
|
|
84
|
-
onChange: handleChange
|
|
85
|
+
onChange: handleChange,
|
|
86
|
+
onBlur: onDeactivate
|
|
85
87
|
})), /*#__PURE__*/React.createElement(TextModal, {
|
|
86
88
|
visible: openExpanseEditor,
|
|
87
89
|
onCancel: function onCancel() {
|
package/dist/Factors.d.ts
CHANGED
|
@@ -41,6 +41,11 @@ export declare const factorTypes: {
|
|
|
41
41
|
name: string;
|
|
42
42
|
input: React.FC<import("./Factors.types").InputProps>;
|
|
43
43
|
};
|
|
44
|
+
dateRange: {
|
|
45
|
+
icon: JSX.Element;
|
|
46
|
+
name: string;
|
|
47
|
+
input: React.FC<import("./Factors.types").InputProps>;
|
|
48
|
+
};
|
|
44
49
|
};
|
|
45
50
|
declare const Factors: React.FC<FactorsProps>;
|
|
46
51
|
export default Factors;
|
package/dist/Factors.js
CHANGED
|
@@ -16,6 +16,7 @@ import FormulaInput from './FactorValue/Formula/Formula';
|
|
|
16
16
|
import TextInput from './FactorValue/Text/Text';
|
|
17
17
|
import ParameterInput from './FactorValue/Parameter/Parameter';
|
|
18
18
|
import NumberInput from './FactorValue/Number/NumberInput';
|
|
19
|
+
import DateRangeInput from './FactorValue/DateRange/DateRange';
|
|
19
20
|
export var factorTypes = {
|
|
20
21
|
text: {
|
|
21
22
|
icon: /*#__PURE__*/React.createElement(TextM, null),
|
|
@@ -56,6 +57,11 @@ export var factorTypes = {
|
|
|
56
57
|
icon: /*#__PURE__*/React.createElement(Calendar2M, null),
|
|
57
58
|
name: 'Date',
|
|
58
59
|
input: DateInput
|
|
60
|
+
},
|
|
61
|
+
dateRange: {
|
|
62
|
+
icon: /*#__PURE__*/React.createElement(Calendar2M, null),
|
|
63
|
+
name: 'Date range',
|
|
64
|
+
input: DateRangeInput
|
|
59
65
|
}
|
|
60
66
|
}; // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
61
67
|
|
|
@@ -85,6 +91,7 @@ var Factors = function Factors(_ref) {
|
|
|
85
91
|
factorKey = _ref.factorKey,
|
|
86
92
|
preventAutoloadData = _ref.preventAutoloadData,
|
|
87
93
|
onActivate = _ref.onActivate,
|
|
94
|
+
onDeactivate = _ref.onDeactivate,
|
|
88
95
|
getPopupContainerOverride = _ref.getPopupContainerOverride;
|
|
89
96
|
|
|
90
97
|
var _useIntl = useIntl(),
|
|
@@ -92,6 +99,216 @@ var Factors = function Factors(_ref) {
|
|
|
92
99
|
|
|
93
100
|
var text = React.useMemo(function () {
|
|
94
101
|
return _objectSpread({
|
|
102
|
+
dateRangePicker: {
|
|
103
|
+
after: formatMessage({
|
|
104
|
+
id: "DS.DATE-RANGE-PICKER.AFTER",
|
|
105
|
+
defaultMessage: 'after'
|
|
106
|
+
}),
|
|
107
|
+
allTime: formatMessage({
|
|
108
|
+
id: "DS.DATE-RANGE-PICKER.ALL-TIME",
|
|
109
|
+
defaultMessage: 'Lifetime'
|
|
110
|
+
}),
|
|
111
|
+
apply: formatMessage({
|
|
112
|
+
id: "DS.DATE-RANGE-PICKER.APPLY",
|
|
113
|
+
defaultMessage: 'Apply'
|
|
114
|
+
}),
|
|
115
|
+
before: formatMessage({
|
|
116
|
+
id: "DS.DATE-RANGE-PICKER.BEFORE",
|
|
117
|
+
defaultMessage: 'before'
|
|
118
|
+
}),
|
|
119
|
+
clear: formatMessage({
|
|
120
|
+
id: "DS.DATE-RANGE-PICKER.CLEAR",
|
|
121
|
+
defaultMessage: 'Clear'
|
|
122
|
+
}),
|
|
123
|
+
clearRange: formatMessage({
|
|
124
|
+
id: "DS.DATE-RANGE-PICKER.CLEAR-RANGE",
|
|
125
|
+
defaultMessage: ' Clear range'
|
|
126
|
+
}),
|
|
127
|
+
copyRange: formatMessage({
|
|
128
|
+
id: "DS.DATE-RANGE-PICKER.COPY-RANGE",
|
|
129
|
+
defaultMessage: 'Copy range'
|
|
130
|
+
}),
|
|
131
|
+
custom: formatMessage({
|
|
132
|
+
id: "DS.DATE-RANGE-PICKER.CUSTOM",
|
|
133
|
+
defaultMessage: 'Custom'
|
|
134
|
+
}),
|
|
135
|
+
days: formatMessage({
|
|
136
|
+
id: "DS.DATE-RANGE-PICKER.DAYS",
|
|
137
|
+
defaultMessage: 'Days'
|
|
138
|
+
}),
|
|
139
|
+
emptyDateError: formatMessage({
|
|
140
|
+
id: "DS.DATE-RANGE-PICKER.EMPTY-DATE-ERROR",
|
|
141
|
+
defaultMessage: 'Date cannot be empty'
|
|
142
|
+
}),
|
|
143
|
+
endDate: formatMessage({
|
|
144
|
+
id: "DS.DATE-RANGE-PICKER.END-DATE",
|
|
145
|
+
defaultMessage: 'End date'
|
|
146
|
+
}),
|
|
147
|
+
endDatePlaceholder: formatMessage({
|
|
148
|
+
id: "DS.DATE-RANGE-PICKER.END-DATE-PLACEHOLDER",
|
|
149
|
+
defaultMessage: 'End date'
|
|
150
|
+
}),
|
|
151
|
+
filter: formatMessage({
|
|
152
|
+
id: "DS.DATE-RANGE-PICKER.FILTER",
|
|
153
|
+
defaultMessage: 'Date filter'
|
|
154
|
+
}),
|
|
155
|
+
hours: formatMessage({
|
|
156
|
+
id: "DS.DATE-RANGE-PICKER.HOURS",
|
|
157
|
+
defaultMessage: 'Hours'
|
|
158
|
+
}),
|
|
159
|
+
last3Months: formatMessage({
|
|
160
|
+
id: "DS.DATE-RANGE-PICKER.LAST-3-MONTHS",
|
|
161
|
+
defaultMessage: 'Last 3 months'
|
|
162
|
+
}),
|
|
163
|
+
last6Months: formatMessage({
|
|
164
|
+
id: "DS.DATE-RANGE-PICKER.LAST-6-MONTHS",
|
|
165
|
+
defaultMessage: 'Last 6 months'
|
|
166
|
+
}),
|
|
167
|
+
last7Days: formatMessage({
|
|
168
|
+
id: "DS.DATE-RANGE-PICKER.LAST-7-DAYS",
|
|
169
|
+
defaultMessage: 'Last 7 days'
|
|
170
|
+
}),
|
|
171
|
+
last: formatMessage({
|
|
172
|
+
id: "DS.DATE-RANGE-PICKER.LAST",
|
|
173
|
+
defaultMessage: 'Last'
|
|
174
|
+
}),
|
|
175
|
+
lastMonth: formatMessage({
|
|
176
|
+
id: "DS.DATE-RANGE-PICKER.LAST-MONTH",
|
|
177
|
+
defaultMessage: 'Last month'
|
|
178
|
+
}),
|
|
179
|
+
lastWeek: formatMessage({
|
|
180
|
+
id: "DS.DATE-RANGE-PICKER.LAST-WEEK",
|
|
181
|
+
defaultMessage: 'Last week'
|
|
182
|
+
}),
|
|
183
|
+
lastYear: formatMessage({
|
|
184
|
+
id: "DS.DATE-RANGE-PICKER.LAST-YEAR",
|
|
185
|
+
defaultMessage: 'Last year'
|
|
186
|
+
}),
|
|
187
|
+
minutes: formatMessage({
|
|
188
|
+
id: "DS.DATE-RANGE-PICKER.MINUTES",
|
|
189
|
+
defaultMessage: 'Minutes'
|
|
190
|
+
}),
|
|
191
|
+
months: formatMessage({
|
|
192
|
+
id: "DS.DATE-RANGE-PICKER.MONTHS",
|
|
193
|
+
defaultMessage: 'Months'
|
|
194
|
+
}),
|
|
195
|
+
more: formatMessage({
|
|
196
|
+
id: "DS.DATE-RANGE-PICKER.MORE",
|
|
197
|
+
defaultMessage: 'More'
|
|
198
|
+
}),
|
|
199
|
+
next3Months: formatMessage({
|
|
200
|
+
id: "DS.DATE-RANGE-PICKER.NEXT-3-MONTHS",
|
|
201
|
+
defaultMessage: 'Next 3 months'
|
|
202
|
+
}),
|
|
203
|
+
next6Months: formatMessage({
|
|
204
|
+
id: "DS.DATE-RANGE-PICKER.NEXT-6-MONTHS",
|
|
205
|
+
defaultMessage: 'Next 6 months'
|
|
206
|
+
}),
|
|
207
|
+
next7Days: formatMessage({
|
|
208
|
+
id: "DS.DATE-RANGE-PICKER.NEXT-7-DAYS",
|
|
209
|
+
defaultMessage: 'Next 7 days'
|
|
210
|
+
}),
|
|
211
|
+
next: formatMessage({
|
|
212
|
+
id: "DS.DATE-RANGE-PICKER.NEXT",
|
|
213
|
+
defaultMessage: 'Next'
|
|
214
|
+
}),
|
|
215
|
+
nextMonth: formatMessage({
|
|
216
|
+
id: "DS.DATE-RANGE-PICKER.NEXT-MONTH",
|
|
217
|
+
defaultMessage: 'Next month'
|
|
218
|
+
}),
|
|
219
|
+
nextWeek: formatMessage({
|
|
220
|
+
id: "DS.DATE-RANGE-PICKER.NEXT-WEEK",
|
|
221
|
+
defaultMessage: 'Next week'
|
|
222
|
+
}),
|
|
223
|
+
nextYear: formatMessage({
|
|
224
|
+
id: "DS.DATE-RANGE-PICKER.NEXT-YEAR",
|
|
225
|
+
defaultMessage: 'Next year'
|
|
226
|
+
}),
|
|
227
|
+
now: formatMessage({
|
|
228
|
+
id: "DS.DATE-RANGE-PICKER.NOW",
|
|
229
|
+
defaultMessage: 'Now'
|
|
230
|
+
}),
|
|
231
|
+
pasteRange: formatMessage({
|
|
232
|
+
id: "DS.DATE-RANGE-PICKER.PASTE-RANGE",
|
|
233
|
+
defaultMessage: 'Paste range'
|
|
234
|
+
}),
|
|
235
|
+
relativeDateRange: formatMessage({
|
|
236
|
+
id: "DS.DATE-RANGE-PICKER.RELATIVE-DATE-RANGE",
|
|
237
|
+
defaultMessage: 'Relative date range'
|
|
238
|
+
}),
|
|
239
|
+
remove: formatMessage({
|
|
240
|
+
id: "DS.DATE-RANGE-PICKER.REMOVE",
|
|
241
|
+
defaultMessage: 'Remove'
|
|
242
|
+
}),
|
|
243
|
+
savedFiltersTrigger: formatMessage({
|
|
244
|
+
id: "DS.DATE-RANGE-PICKER.SAVED-FILTERS",
|
|
245
|
+
defaultMessage: 'Saved filters'
|
|
246
|
+
}),
|
|
247
|
+
seconds: formatMessage({
|
|
248
|
+
id: "DS.DATE-RANGE-PICKER.SECONDS",
|
|
249
|
+
defaultMessage: 'Seconds'
|
|
250
|
+
}),
|
|
251
|
+
selectDate: formatMessage({
|
|
252
|
+
id: "DS.DATE-RANGE-PICKER.SELECT-DATE",
|
|
253
|
+
defaultMessage: 'Select date'
|
|
254
|
+
}),
|
|
255
|
+
selectTime: formatMessage({
|
|
256
|
+
id: "DS.DATE-RANGE-PICKER.SELECT-TIME",
|
|
257
|
+
defaultMessage: 'Select time'
|
|
258
|
+
}),
|
|
259
|
+
since: formatMessage({
|
|
260
|
+
id: "DS.DATE-RANGE-PICKER.SINCE",
|
|
261
|
+
defaultMessage: 'Since'
|
|
262
|
+
}),
|
|
263
|
+
startDate: formatMessage({
|
|
264
|
+
id: "DS.DATE-RANGE-PICKER.START-DATE",
|
|
265
|
+
defaultMessage: 'Start date'
|
|
266
|
+
}),
|
|
267
|
+
startDatePlaceholder: formatMessage({
|
|
268
|
+
id: "DS.DATE-RANGE-PICKER.START-DATE-PLACEHOLDER",
|
|
269
|
+
defaultMessage: 'Start date'
|
|
270
|
+
}),
|
|
271
|
+
thisMonth: formatMessage({
|
|
272
|
+
id: "DS.DATE-RANGE-PICKER.THIS-MONTH",
|
|
273
|
+
defaultMessage: 'This month'
|
|
274
|
+
}),
|
|
275
|
+
thisWeek: formatMessage({
|
|
276
|
+
id: "DS.DATE-RANGE-PICKER.THIS-WEEK",
|
|
277
|
+
defaultMessage: 'This week'
|
|
278
|
+
}),
|
|
279
|
+
timestampLast: formatMessage({
|
|
280
|
+
id: "DS.DATE-RANGE-PICKER.TIMESTAMP-LAST",
|
|
281
|
+
defaultMessage: 'Last'
|
|
282
|
+
}),
|
|
283
|
+
timestampNext: formatMessage({
|
|
284
|
+
id: "DS.DATE-RANGE-PICKER.TIMESTAMP-NEXT",
|
|
285
|
+
defaultMessage: 'Next'
|
|
286
|
+
}),
|
|
287
|
+
timestampTill: formatMessage({
|
|
288
|
+
id: "DS.DATE-RANGE-PICKER.TIMESTAMP-TILL",
|
|
289
|
+
defaultMessage: 'till'
|
|
290
|
+
}),
|
|
291
|
+
today: formatMessage({
|
|
292
|
+
id: "DS.DATE-RANGE-PICKER.TODAY",
|
|
293
|
+
defaultMessage: 'Today'
|
|
294
|
+
}),
|
|
295
|
+
tomorrow: formatMessage({
|
|
296
|
+
id: "DS.DATE-RANGE-PICKER.TOMORROW",
|
|
297
|
+
defaultMessage: 'Tomorrow'
|
|
298
|
+
}),
|
|
299
|
+
weeks: formatMessage({
|
|
300
|
+
id: "DS.DATE-RANGE-PICKER.WEEKS",
|
|
301
|
+
defaultMessage: 'Weeks'
|
|
302
|
+
}),
|
|
303
|
+
years: formatMessage({
|
|
304
|
+
id: "DS.DATE-RANGE-PICKER.YEARS",
|
|
305
|
+
defaultMessage: 'Years'
|
|
306
|
+
}),
|
|
307
|
+
yesterday: formatMessage({
|
|
308
|
+
id: "DS.DATE-RANGE-PICKER.YESTERDAY",
|
|
309
|
+
defaultMessage: 'Yesterday'
|
|
310
|
+
})
|
|
311
|
+
},
|
|
95
312
|
datePicker: {
|
|
96
313
|
apply: formatMessage({
|
|
97
314
|
id: 'DS.FACTORS.DATE_PICKER.APPLY',
|
|
@@ -196,7 +413,8 @@ var Factors = function Factors(_ref) {
|
|
|
196
413
|
factorKey: factorKey,
|
|
197
414
|
preventAutoloadData: preventAutoloadData,
|
|
198
415
|
getPopupContainerOverride: getPopupContainerOverride,
|
|
199
|
-
onActivate: onActivate
|
|
416
|
+
onActivate: onActivate,
|
|
417
|
+
onDeactivate: onDeactivate
|
|
200
418
|
}));
|
|
201
419
|
};
|
|
202
420
|
|
package/dist/Factors.types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
import { DateFilter } from '@synerise/ds-date-range-picker/dist/date.types';
|
|
3
|
+
import { Texts as DateRangeTexts } from '@synerise/ds-date-range-picker/dist/DateRangePicker.types';
|
|
4
|
+
export declare const ALL_FACTOR_TYPES: readonly ["text", "number", "parameter", "contextParameter", "dynamicKey", "formula", "array", "date", "dateRange"];
|
|
3
5
|
export declare type FactorType = typeof ALL_FACTOR_TYPES[number] | string;
|
|
4
6
|
export declare type DynamicKeyValueType = {
|
|
5
7
|
key: React.ReactText;
|
|
@@ -29,13 +31,14 @@ export declare type ParameterItem = {
|
|
|
29
31
|
groupId: React.ReactText;
|
|
30
32
|
icon?: React.ReactNode;
|
|
31
33
|
};
|
|
32
|
-
export declare type FactorValueType = string | number | Date | undefined | DynamicKeyValueType | FormulaValueType | ParameterValueType
|
|
34
|
+
export declare type FactorValueType = string | number | Date | undefined | DynamicKeyValueType | FormulaValueType | ParameterValueType | Partial<DateFilter>;
|
|
33
35
|
export declare type SelectedFactorType = {
|
|
34
36
|
name: string;
|
|
35
37
|
icon: React.ReactNode;
|
|
36
|
-
input: React.
|
|
38
|
+
input: React.ElementType;
|
|
37
39
|
};
|
|
38
40
|
export declare type FactorsTexts = {
|
|
41
|
+
dateRangePicker: DateRangeTexts;
|
|
39
42
|
datePicker: {
|
|
40
43
|
apply: string;
|
|
41
44
|
clearTooltip: string;
|
|
@@ -70,6 +73,7 @@ export declare type FactorsProps = {
|
|
|
70
73
|
defaultFactorType: FactorType;
|
|
71
74
|
getPopupContainerOverride?: (trigger: HTMLElement | null) => HTMLElement;
|
|
72
75
|
onActivate?: () => void;
|
|
76
|
+
onDeactivate?: () => void;
|
|
73
77
|
onChangeValue: (value: FactorValueType) => void;
|
|
74
78
|
value: FactorValueType;
|
|
75
79
|
textType?: 'autocomplete' | 'expansible' | 'default' | string;
|
|
@@ -95,11 +99,11 @@ export declare type FactorTypeSelectorProps = Pick<FactorsProps, 'unavailableFac
|
|
|
95
99
|
setSelectedFactorType: (factor: FactorType) => void;
|
|
96
100
|
selectedFactor: SelectedFactorType;
|
|
97
101
|
};
|
|
98
|
-
export declare type FactorValueProps = Pick<FactorsProps, 'onChangeValue' | 'onParamsClick' | 'value' | 'selectedFactorType' | 'parameters' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'formulaEditor' | 'opened' | 'loading' | 'factorKey' | 'preventAutoloadData' | 'getPopupContainerOverride' | 'onActivate'> & {
|
|
102
|
+
export declare type FactorValueProps = Pick<FactorsProps, 'onChangeValue' | 'onParamsClick' | 'value' | 'selectedFactorType' | 'parameters' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'formulaEditor' | 'opened' | 'loading' | 'factorKey' | 'preventAutoloadData' | 'getPopupContainerOverride' | 'onActivate' | 'onDeactivate'> & {
|
|
99
103
|
texts: FactorsTexts;
|
|
100
104
|
selectedFactor: SelectedFactorType;
|
|
101
105
|
};
|
|
102
|
-
export declare type InputProps = Pick<FactorsProps, 'value' | 'parameters' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'opened' | 'getPopupContainerOverride' | 'onActivate'> & {
|
|
106
|
+
export declare type InputProps = Pick<FactorsProps, 'value' | 'parameters' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'opened' | 'getPopupContainerOverride' | 'onActivate' | 'onDeactivate'> & {
|
|
103
107
|
texts: FactorsTexts;
|
|
104
108
|
onChange: (value: FactorValueType) => void;
|
|
105
109
|
factorType: FactorType;
|
package/dist/Factors.types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var ALL_FACTOR_TYPES = ['text', 'number', 'parameter', 'contextParameter', 'dynamicKey', 'formula', 'array', 'date'];
|
|
1
|
+
export var ALL_FACTOR_TYPES = ['text', 'number', 'parameter', 'contextParameter', 'dynamicKey', 'formula', 'array', 'date', 'dateRange'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-factors",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Factors UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -32,19 +32,20 @@
|
|
|
32
32
|
],
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@synerise/ds-autocomplete": "^0.4.
|
|
36
|
-
"@synerise/ds-badge": "^0.6.
|
|
35
|
+
"@synerise/ds-autocomplete": "^0.4.10",
|
|
36
|
+
"@synerise/ds-badge": "^0.6.3",
|
|
37
37
|
"@synerise/ds-button": "^0.17.2",
|
|
38
|
-
"@synerise/ds-date-picker": "^0.6.
|
|
39
|
-
"@synerise/ds-
|
|
38
|
+
"@synerise/ds-date-picker": "^0.6.17",
|
|
39
|
+
"@synerise/ds-date-range-picker": "^0.12.13",
|
|
40
|
+
"@synerise/ds-dropdown": "^0.17.17",
|
|
40
41
|
"@synerise/ds-icon": "^0.49.0",
|
|
41
|
-
"@synerise/ds-inline-edit": "^0.6.
|
|
42
|
+
"@synerise/ds-inline-edit": "^0.6.12",
|
|
42
43
|
"@synerise/ds-input": "^0.18.10",
|
|
43
|
-
"@synerise/ds-input-number": "^0.6.
|
|
44
|
+
"@synerise/ds-input-number": "^0.6.10",
|
|
44
45
|
"@synerise/ds-menu": "^0.13.2",
|
|
45
46
|
"@synerise/ds-modal": "^0.15.9",
|
|
46
47
|
"@synerise/ds-result": "^0.6.9",
|
|
47
|
-
"@synerise/ds-tabs": "^0.13.
|
|
48
|
+
"@synerise/ds-tabs": "^0.13.11",
|
|
48
49
|
"@synerise/ds-typography": "^0.12.2",
|
|
49
50
|
"@synerise/ds-utils": "^0.19.0",
|
|
50
51
|
"classnames": "^2.2.6",
|
|
@@ -54,5 +55,5 @@
|
|
|
54
55
|
"@synerise/ds-core": "*",
|
|
55
56
|
"react": ">=16.9.0 < 17.0.0"
|
|
56
57
|
},
|
|
57
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "4a658911645846d1e329609ba9db06a7bc64962b"
|
|
58
59
|
}
|