@synerise/ds-condition 0.8.10 → 0.9.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 +39 -0
- package/README.md +12 -11
- package/dist/Condition.js +13 -14
- package/dist/Condition.types.d.ts +1 -0
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,45 @@
|
|
|
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.9.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.8.13...@synerise/ds-condition@0.9.0) (2021-09-30)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **condition:** adds autoclearCondition props ([58111ea](https://github.com/Synerise/synerise-design/commit/58111ea895ad4b77eafc82257d263820f7b3cf39))
|
|
12
|
+
* **condition:** removes console.log ([e76ceee](https://github.com/Synerise/synerise-design/commit/e76ceee6977c33581e47654ea1aac18bd25cbc46))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [0.8.13](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.8.12...@synerise/ds-condition@0.8.13) (2021-09-21)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @synerise/ds-condition
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## [0.8.12](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.8.11...@synerise/ds-condition@0.8.12) (2021-09-15)
|
|
27
|
+
|
|
28
|
+
**Note:** Version bump only for package @synerise/ds-condition
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## [0.8.11](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.8.10...@synerise/ds-condition@0.8.11) (2021-09-14)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* **factors:** fire method when dropdown is opened ([2ec39ec](https://github.com/Synerise/synerise-design/commit/2ec39ec0f075675f1fbf23af89cfde2a26f529e4))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
6
45
|
## [0.8.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.8.9...@synerise/ds-condition@0.8.10) (2021-09-09)
|
|
7
46
|
|
|
8
47
|
**Note:** Version bump only for package @synerise/ds-condition
|
package/README.md
CHANGED
|
@@ -99,17 +99,18 @@ import Condition from '@synerise/ds-condition'
|
|
|
99
99
|
|
|
100
100
|
## API
|
|
101
101
|
|
|
102
|
-
| Property
|
|
103
|
-
| ---
|
|
104
|
-
| addCondition
|
|
105
|
-
| removeCondition
|
|
106
|
-
| steps
|
|
107
|
-
| texts
|
|
108
|
-
| updateStepName
|
|
109
|
-
| addStep
|
|
110
|
-
| duplicateStep
|
|
111
|
-
| removeStep
|
|
112
|
-
| onChangeOrder
|
|
102
|
+
| Property | Description | Type | Default |
|
|
103
|
+
| --- | --- | --- | --- |
|
|
104
|
+
| addCondition | Callback called when user adds new row of conditions | (stepId: React.ReactText) => void | - |
|
|
105
|
+
| removeCondition | Callback called when user clicks on remove row of condtions | (stepId: React.ReactText, conditionRowId: React.ReactText) => void | - |
|
|
106
|
+
| steps | Array contains all steps of condition | ConditionStep[] | - |
|
|
107
|
+
| texts | Translations object | Texts | - |
|
|
108
|
+
| updateStepName | Callback called when user change the name of step | (stepId: React.ReactText, value: string) => void | - |
|
|
109
|
+
| addStep | Callback called when user clicks on add step button | () => void | - |
|
|
110
|
+
| duplicateStep | Callback called when user clicks on duplicate step button | (stepId: React.ReactText) => void | - |
|
|
111
|
+
| removeStep | Callback called when user clicks on remove step button | (stepId: React.ReactText) => void | - |
|
|
112
|
+
| onChangeOrder | Callback called when user change order of steps | (order: ConditionStep[]) => void | - |
|
|
113
|
+
| autoClearCondition | Automatically fires clearing values of dependent elements | Boolean | false |
|
|
113
114
|
|
|
114
115
|
### ConditionStep
|
|
115
116
|
|
package/dist/Condition.js
CHANGED
|
@@ -19,29 +19,27 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
19
19
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
20
|
|
|
21
21
|
import * as React from 'react';
|
|
22
|
+
import { useIntl } from 'react-intl';
|
|
23
|
+
import { ReactSortable } from 'react-sortablejs';
|
|
22
24
|
import InlineEdit from '@synerise/ds-inline-edit';
|
|
23
25
|
import { Add2M, Add3M, CloseS, DragHandleM } from '@synerise/ds-icon/dist/icons';
|
|
24
26
|
import Icon from '@synerise/ds-icon';
|
|
25
27
|
import Button from '@synerise/ds-button';
|
|
26
28
|
import theme from '@synerise/ds-core/dist/js/DSProvider/ThemeProvider/theme';
|
|
27
29
|
import Tooltip from '@synerise/ds-tooltip';
|
|
30
|
+
import { NOOP } from '@synerise/ds-utils';
|
|
28
31
|
import Subject from '@synerise/ds-subject';
|
|
29
32
|
import Factors from '@synerise/ds-factors';
|
|
30
33
|
import Operators from '@synerise/ds-operators';
|
|
31
34
|
import ContextSelector from '@synerise/ds-context-selector';
|
|
32
35
|
import Cruds from '@synerise/ds-cruds';
|
|
33
|
-
import { ReactSortable } from 'react-sortablejs';
|
|
34
|
-
import { useIntl } from 'react-intl';
|
|
35
36
|
import usePrevious from '@synerise/ds-utils/dist/usePrevious/usePrevious';
|
|
36
37
|
import * as S from './Condition.style';
|
|
37
38
|
var DEFAULT_FIELD = '';
|
|
38
39
|
var DEFAULT_CONDITION = '';
|
|
39
40
|
var OPERATOR = 'operator';
|
|
40
41
|
var PARAMETER = 'parameter';
|
|
41
|
-
var FACTOR = 'factor';
|
|
42
|
-
|
|
43
|
-
var NOOP = function NOOP() {};
|
|
44
|
-
|
|
42
|
+
var FACTOR = 'factor';
|
|
45
43
|
var SORTABLE_CONFIG = {
|
|
46
44
|
ghostClass: 'steps-list-ghost-element',
|
|
47
45
|
className: 'steps-list',
|
|
@@ -61,7 +59,8 @@ var Condition = function Condition(_ref) {
|
|
|
61
59
|
addStep = _ref.addStep,
|
|
62
60
|
onChangeOrder = _ref.onChangeOrder,
|
|
63
61
|
_ref$minConditionsLen = _ref.minConditionsLength,
|
|
64
|
-
minConditionsLength = _ref$minConditionsLen === void 0 ? 1 : _ref$minConditionsLen
|
|
62
|
+
minConditionsLength = _ref$minConditionsLen === void 0 ? 1 : _ref$minConditionsLen,
|
|
63
|
+
autoClearCondition = _ref.autoClearCondition;
|
|
65
64
|
|
|
66
65
|
var _useIntl = useIntl(),
|
|
67
66
|
formatMessage = _useIntl.formatMessage;
|
|
@@ -166,7 +165,7 @@ var Condition = function Condition(_ref) {
|
|
|
166
165
|
});
|
|
167
166
|
}
|
|
168
167
|
|
|
169
|
-
step.conditions.forEach(function (condition) {
|
|
168
|
+
autoClearCondition && step.conditions.forEach(function (condition) {
|
|
170
169
|
condition.factor && condition.factor.onChangeValue(undefined);
|
|
171
170
|
condition.operator && condition.operator.onChange(undefined);
|
|
172
171
|
condition.parameter && condition.parameter.onChangeValue(undefined);
|
|
@@ -178,7 +177,7 @@ var Condition = function Condition(_ref) {
|
|
|
178
177
|
} else if (step.conditions[0].operator) {
|
|
179
178
|
setCurrentField(OPERATOR);
|
|
180
179
|
}
|
|
181
|
-
}, [removeCondition, addCondition]);
|
|
180
|
+
}, [removeCondition, addCondition, autoClearCondition]);
|
|
182
181
|
var selectSubject = React.useCallback(function (value, step) {
|
|
183
182
|
clearConditionRow(step);
|
|
184
183
|
step.subject && step.subject.onSelectItem(value);
|
|
@@ -189,21 +188,21 @@ var Condition = function Condition(_ref) {
|
|
|
189
188
|
}, [clearConditionRow]);
|
|
190
189
|
var selectParameter = React.useCallback(function (condition, value) {
|
|
191
190
|
if (condition.id && condition.parameter) {
|
|
192
|
-
condition.operator && condition.operator.onChange(undefined);
|
|
193
|
-
condition.factor && condition.factor.onChangeValue(undefined);
|
|
191
|
+
autoClearCondition && condition.operator && condition.operator.onChange(undefined);
|
|
192
|
+
autoClearCondition && condition.factor && condition.factor.onChangeValue(undefined);
|
|
194
193
|
condition.parameter.onChangeValue(value);
|
|
195
194
|
setCurrentConditionId(condition.id);
|
|
196
195
|
setCurrentField(OPERATOR);
|
|
197
196
|
}
|
|
198
|
-
}, []);
|
|
197
|
+
}, [autoClearCondition]);
|
|
199
198
|
var selectOperator = React.useCallback(function (condition, value) {
|
|
200
199
|
if (condition.id && condition.operator) {
|
|
201
|
-
condition.factor && condition.factor.onChangeValue(undefined);
|
|
200
|
+
autoClearCondition && condition.factor && condition.factor.onChangeValue(undefined);
|
|
202
201
|
condition.operator.onChange(value);
|
|
203
202
|
setCurrentConditionId(condition.id);
|
|
204
203
|
setCurrentField(FACTOR);
|
|
205
204
|
}
|
|
206
|
-
}, []);
|
|
205
|
+
}, [autoClearCondition]);
|
|
207
206
|
var setStepConditionFactorType = React.useCallback(function (step, condition, factorType) {
|
|
208
207
|
setCurrentConditionId(condition.id);
|
|
209
208
|
setCurrentField(FACTOR);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-condition",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Condition UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -32,22 +32,22 @@
|
|
|
32
32
|
],
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@synerise/ds-button": "^0.13.
|
|
36
|
-
"@synerise/ds-context-selector": "^0.6.
|
|
37
|
-
"@synerise/ds-core": "^0.30.
|
|
38
|
-
"@synerise/ds-cruds": "^0.2.
|
|
39
|
-
"@synerise/ds-factors": "^0.7.
|
|
35
|
+
"@synerise/ds-button": "^0.13.66",
|
|
36
|
+
"@synerise/ds-context-selector": "^0.6.4",
|
|
37
|
+
"@synerise/ds-core": "^0.30.14",
|
|
38
|
+
"@synerise/ds-cruds": "^0.2.46",
|
|
39
|
+
"@synerise/ds-factors": "^0.7.35",
|
|
40
40
|
"@synerise/ds-icon": "^0.36.0",
|
|
41
|
-
"@synerise/ds-inline-edit": "^0.4.
|
|
42
|
-
"@synerise/ds-operators": "^0.4.
|
|
43
|
-
"@synerise/ds-subject": "^0.5.
|
|
44
|
-
"@synerise/ds-tooltip": "^0.10.
|
|
45
|
-
"@synerise/ds-utils": "^0.18.
|
|
41
|
+
"@synerise/ds-inline-edit": "^0.4.35",
|
|
42
|
+
"@synerise/ds-operators": "^0.4.29",
|
|
43
|
+
"@synerise/ds-subject": "^0.5.48",
|
|
44
|
+
"@synerise/ds-tooltip": "^0.10.52",
|
|
45
|
+
"@synerise/ds-utils": "^0.18.1",
|
|
46
46
|
"react-sortablejs": "^6.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@synerise/ds-core": "*",
|
|
50
50
|
"react": ">=16.9.0 < 17.0.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "09ffaa9dfc140e71320e1dd6bbb5ca3d2f61c264"
|
|
53
53
|
}
|