@synerise/ds-condition 0.8.13 → 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 +12 -0
- package/README.md +12 -11
- package/dist/Condition.js +9 -8
- package/dist/Condition.types.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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
|
+
|
|
6
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)
|
|
7
19
|
|
|
8
20
|
**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
|
@@ -59,7 +59,8 @@ var Condition = function Condition(_ref) {
|
|
|
59
59
|
addStep = _ref.addStep,
|
|
60
60
|
onChangeOrder = _ref.onChangeOrder,
|
|
61
61
|
_ref$minConditionsLen = _ref.minConditionsLength,
|
|
62
|
-
minConditionsLength = _ref$minConditionsLen === void 0 ? 1 : _ref$minConditionsLen
|
|
62
|
+
minConditionsLength = _ref$minConditionsLen === void 0 ? 1 : _ref$minConditionsLen,
|
|
63
|
+
autoClearCondition = _ref.autoClearCondition;
|
|
63
64
|
|
|
64
65
|
var _useIntl = useIntl(),
|
|
65
66
|
formatMessage = _useIntl.formatMessage;
|
|
@@ -164,7 +165,7 @@ var Condition = function Condition(_ref) {
|
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
step.conditions.forEach(function (condition) {
|
|
168
|
+
autoClearCondition && step.conditions.forEach(function (condition) {
|
|
168
169
|
condition.factor && condition.factor.onChangeValue(undefined);
|
|
169
170
|
condition.operator && condition.operator.onChange(undefined);
|
|
170
171
|
condition.parameter && condition.parameter.onChangeValue(undefined);
|
|
@@ -176,7 +177,7 @@ var Condition = function Condition(_ref) {
|
|
|
176
177
|
} else if (step.conditions[0].operator) {
|
|
177
178
|
setCurrentField(OPERATOR);
|
|
178
179
|
}
|
|
179
|
-
}, [removeCondition, addCondition]);
|
|
180
|
+
}, [removeCondition, addCondition, autoClearCondition]);
|
|
180
181
|
var selectSubject = React.useCallback(function (value, step) {
|
|
181
182
|
clearConditionRow(step);
|
|
182
183
|
step.subject && step.subject.onSelectItem(value);
|
|
@@ -187,21 +188,21 @@ var Condition = function Condition(_ref) {
|
|
|
187
188
|
}, [clearConditionRow]);
|
|
188
189
|
var selectParameter = React.useCallback(function (condition, value) {
|
|
189
190
|
if (condition.id && condition.parameter) {
|
|
190
|
-
condition.operator && condition.operator.onChange(undefined);
|
|
191
|
-
condition.factor && condition.factor.onChangeValue(undefined);
|
|
191
|
+
autoClearCondition && condition.operator && condition.operator.onChange(undefined);
|
|
192
|
+
autoClearCondition && condition.factor && condition.factor.onChangeValue(undefined);
|
|
192
193
|
condition.parameter.onChangeValue(value);
|
|
193
194
|
setCurrentConditionId(condition.id);
|
|
194
195
|
setCurrentField(OPERATOR);
|
|
195
196
|
}
|
|
196
|
-
}, []);
|
|
197
|
+
}, [autoClearCondition]);
|
|
197
198
|
var selectOperator = React.useCallback(function (condition, value) {
|
|
198
199
|
if (condition.id && condition.operator) {
|
|
199
|
-
condition.factor && condition.factor.onChangeValue(undefined);
|
|
200
|
+
autoClearCondition && condition.factor && condition.factor.onChangeValue(undefined);
|
|
200
201
|
condition.operator.onChange(value);
|
|
201
202
|
setCurrentConditionId(condition.id);
|
|
202
203
|
setCurrentField(FACTOR);
|
|
203
204
|
}
|
|
204
|
-
}, []);
|
|
205
|
+
}, [autoClearCondition]);
|
|
205
206
|
var setStepConditionFactorType = React.useCallback(function (step, condition, factorType) {
|
|
206
207
|
setCurrentConditionId(condition.id);
|
|
207
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",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"@synerise/ds-core": "*",
|
|
50
50
|
"react": ">=16.9.0 < 17.0.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "09ffaa9dfc140e71320e1dd6bbb5ca3d2f61c264"
|
|
53
53
|
}
|