@synerise/ds-condition 0.17.2 → 0.17.5
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
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
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.17.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.17.4...@synerise/ds-condition@0.17.5) (2022-06-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-condition
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.17.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.17.3...@synerise/ds-condition@0.17.4) (2022-06-03)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **condition:** validation value ([3e202bc](https://github.com/Synerise/synerise-design/commit/3e202bcbadd18cafc7463dcbe96a6bb9ca2542f3))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [0.17.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.17.2...@synerise/ds-condition@0.17.3) (2022-05-31)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **condition:** fixes testPrev value for empty conditions array ([35a266a](https://github.com/Synerise/synerise-design/commit/35a266a44ea97556fa0d57090dd16d7f0af1da2e))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
## [0.17.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.17.1...@synerise/ds-condition@0.17.2) (2022-05-30)
|
|
7
37
|
|
|
8
38
|
**Note:** Version bump only for package @synerise/ds-condition
|
package/dist/Condition.js
CHANGED
|
@@ -86,10 +86,6 @@ var Condition = function Condition(props) {
|
|
|
86
86
|
currentField = _React$useState3[0],
|
|
87
87
|
setCurrentField = _React$useState3[1];
|
|
88
88
|
|
|
89
|
-
var _React$useState4 = React.useState(''),
|
|
90
|
-
errorId = _React$useState4[0],
|
|
91
|
-
setErrorId = _React$useState4[1];
|
|
92
|
-
|
|
93
89
|
var prevSteps = usePrevious(steps);
|
|
94
90
|
React.useEffect(function () {
|
|
95
91
|
if (autoOpenedComponent && steps.length && steps[0].conditions[0].operator && steps[0].conditions[0].operator.value === undefined) {
|
|
@@ -216,32 +212,13 @@ var Condition = function Condition(props) {
|
|
|
216
212
|
setCurrentField(SUBJECT);
|
|
217
213
|
}
|
|
218
214
|
}, [addStep]);
|
|
219
|
-
var returnLast = React.useCallback(function (arr) {
|
|
220
|
-
return arr[arr.length - 1];
|
|
221
|
-
}, []);
|
|
222
|
-
var testPrevValueElement = React.useCallback(function () {
|
|
223
|
-
return steps == null ? void 0 : steps.map(function (step) {
|
|
224
|
-
var _returnLast;
|
|
225
|
-
|
|
226
|
-
return !((_returnLast = returnLast(step.conditions)) != null && _returnLast.factor.value) && setErrorId(returnLast(step.conditions).id);
|
|
227
|
-
});
|
|
228
|
-
}, [steps, returnLast]);
|
|
229
215
|
var handleAddCondition = React.useMemo(function () {
|
|
230
|
-
var lastStep = returnLast(steps);
|
|
231
|
-
var lastCondition = returnLast(lastStep.conditions);
|
|
232
|
-
|
|
233
216
|
if (!addCondition) {
|
|
234
217
|
return undefined;
|
|
235
218
|
}
|
|
236
219
|
|
|
237
220
|
return function (stepId) {
|
|
238
|
-
var newConditionId;
|
|
239
|
-
|
|
240
|
-
if (addCondition && lastCondition != null && lastCondition.factor.value || (lastStep == null ? void 0 : lastStep.conditions.length) === 0) {
|
|
241
|
-
newConditionId = addCondition(stepId);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
testPrevValueElement();
|
|
221
|
+
var newConditionId = addCondition ? addCondition(stepId) : undefined;
|
|
245
222
|
|
|
246
223
|
if (newConditionId) {
|
|
247
224
|
setCurrentConditionId(newConditionId);
|
|
@@ -249,7 +226,7 @@ var Condition = function Condition(props) {
|
|
|
249
226
|
setCurrentField(PARAMETER);
|
|
250
227
|
}
|
|
251
228
|
};
|
|
252
|
-
}, [addCondition
|
|
229
|
+
}, [addCondition]);
|
|
253
230
|
var handleClearActiveCondition = React.useCallback(function () {
|
|
254
231
|
setCurrentConditionId(DEFAULT_CONDITION);
|
|
255
232
|
setCurrentStepId(DEFAULT_STEP);
|
|
@@ -292,8 +269,7 @@ var Condition = function Condition(props) {
|
|
|
292
269
|
setCurrentStep: setCurrentStepId,
|
|
293
270
|
onDeactivate: handleClearActiveCondition,
|
|
294
271
|
showSuffix: showSuffix,
|
|
295
|
-
hoverDisabled: hoverDisabled || currentStepId !== step.id && currentStepId !== undefined
|
|
296
|
-
errorId: errorId
|
|
272
|
+
hoverDisabled: hoverDisabled || currentStepId !== step.id && currentStepId !== undefined
|
|
297
273
|
});
|
|
298
274
|
})), addStep && /*#__PURE__*/React.createElement(S.AddStepButton, null, /*#__PURE__*/React.createElement(Button, {
|
|
299
275
|
type: "ghost",
|
|
@@ -302,7 +278,7 @@ var Condition = function Condition(props) {
|
|
|
302
278
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
303
279
|
component: /*#__PURE__*/React.createElement(Add3M, null)
|
|
304
280
|
}), text.addStep)), renderAddStep && /*#__PURE__*/React.createElement(S.AddStepButton, null, renderAddStep()));
|
|
305
|
-
}, [steps, onChangeOrder, addStep, handleAddStep, text, renderAddStep, currentStepId, getPopupContainerOverride, draggableEnabled, selectOperator, selectParameter, selectContext, selectSubject, onUpdateStepName, duplicateStep, removeStep, minConditionsLength, maxConditionsLength, setStepConditionFactorType, setStepConditionFactorValue, currentConditionId, currentField, removeCondition, handleAddCondition, handleClearActiveCondition, showSuffix, hoverDisabled
|
|
281
|
+
}, [steps, onChangeOrder, addStep, handleAddStep, text, renderAddStep, currentStepId, getPopupContainerOverride, draggableEnabled, selectOperator, selectParameter, selectContext, selectSubject, onUpdateStepName, duplicateStep, removeStep, minConditionsLength, maxConditionsLength, setStepConditionFactorType, setStepConditionFactorValue, currentConditionId, currentField, removeCondition, handleAddCondition, handleClearActiveCondition, showSuffix, hoverDisabled]);
|
|
306
282
|
};
|
|
307
283
|
|
|
308
284
|
export default Condition;
|
|
@@ -48,8 +48,7 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
48
48
|
setCurrentStep = _ref.setCurrentStep,
|
|
49
49
|
onDeactivate = _ref.onDeactivate,
|
|
50
50
|
showSuffix = _ref.showSuffix,
|
|
51
|
-
hoverDisabled = _ref.hoverDisabled
|
|
52
|
-
errorId = _ref.errorId;
|
|
51
|
+
hoverDisabled = _ref.hoverDisabled;
|
|
53
52
|
|
|
54
53
|
var _useIntl = useIntl(),
|
|
55
54
|
formatMessage = _useIntl.formatMessage;
|
|
@@ -168,10 +167,9 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
168
167
|
setStepConditionFactorValue: setStepConditionFactorValue,
|
|
169
168
|
texts: text,
|
|
170
169
|
stepType: (_step$context2 = step.context) == null ? void 0 : _step$context2.type,
|
|
171
|
-
onDeactivate: onDeactivate
|
|
172
|
-
error: errorId === condition.id && !condition.factor.value && true
|
|
170
|
+
onDeactivate: onDeactivate
|
|
173
171
|
});
|
|
174
|
-
}, [step.id, step.conditions.length, step.context, hasPriority, currentConditionId, addCondition, removeCondition, minConditionsLength, maxConditionsLength, currentStepId, currentField, selectParameter, selectOperator, getPopupContainerOverride, setStepConditionFactorType, setStepConditionFactorValue, text, onDeactivate, onActivate, setCurrentField, setCurrentCondition, setCurrentStep
|
|
172
|
+
}, [step.id, step.conditions.length, step.context, hasPriority, currentConditionId, addCondition, removeCondition, minConditionsLength, maxConditionsLength, currentStepId, currentField, selectParameter, selectOperator, getPopupContainerOverride, setStepConditionFactorType, setStepConditionFactorValue, text, onDeactivate, onActivate, setCurrentField, setCurrentCondition, setCurrentStep]);
|
|
175
173
|
return /*#__PURE__*/React.createElement(S.Step, {
|
|
176
174
|
key: step.id,
|
|
177
175
|
id: "condition-step-" + step.id,
|
|
@@ -7,7 +7,6 @@ import { ConditionStep, ConditionTexts, ConditionProps } from '../Condition.type
|
|
|
7
7
|
export declare type ConditionStepProps = {
|
|
8
8
|
index: number;
|
|
9
9
|
step: ConditionStep;
|
|
10
|
-
errorId?: string;
|
|
11
10
|
hasPriority?: boolean;
|
|
12
11
|
onStepActivate?: (stepid: React.ReactText) => void;
|
|
13
12
|
getPopupContainerOverride?: ConditionProps['getPopupContainerOverride'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-condition",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.5",
|
|
4
4
|
"description": "Condition UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@synerise/ds-context-selector": "^0.12.1",
|
|
37
37
|
"@synerise/ds-core": "^0.34.0",
|
|
38
38
|
"@synerise/ds-cruds": "^0.3.9",
|
|
39
|
-
"@synerise/ds-factors": "^0.14.
|
|
39
|
+
"@synerise/ds-factors": "^0.14.3",
|
|
40
40
|
"@synerise/ds-icon": "^0.49.0",
|
|
41
41
|
"@synerise/ds-inline-edit": "^0.6.12",
|
|
42
42
|
"@synerise/ds-operators": "^0.9.0",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"@synerise/ds-core": "*",
|
|
50
50
|
"react": ">=16.9.0 < 17.0.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "116cf109200639a805ef51ce8301e47dc7a8b168"
|
|
53
53
|
}
|