@synerise/ds-condition 0.13.10 → 0.14.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 +17 -0
- package/dist/Condition.js +11 -8
- package/dist/Condition.style.d.ts +9 -1
- package/dist/Condition.style.js +44 -23
- package/dist/Condition.types.d.ts +1 -0
- package/dist/ConditionStep/ConditionRow/ConditionRow.js +12 -6
- package/dist/ConditionStep/ConditionRow/ConditionRow.types.d.ts +1 -1
- package/dist/ConditionStep/ConditionStep.js +5 -3
- package/dist/ConditionStep/ConditionStep.types.d.ts +1 -0
- package/dist/ConditionStep/StepHeader/StepHeader.js +11 -10
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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.14.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.13.10...@synerise/ds-condition@0.14.0) (2022-04-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **condition:** styles of StepHeader, hiding step name in stories ([9924476](https://github.com/Synerise/synerise-design/commit/9924476909449c5a11db7f784ba3a30008f48120))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **condition:** updates styles, allows to dragging by header, not only icon ([4c070eb](https://github.com/Synerise/synerise-design/commit/4c070ebaa5c3779733acea5cdff06d06842719b0))
|
|
17
|
+
* **filter:** fixes bugs ([b862ddd](https://github.com/Synerise/synerise-design/commit/b862dddbce1293c2a5381663fc903bb574edd135))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [0.13.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.13.9...@synerise/ds-condition@0.13.10) (2022-03-31)
|
|
7
24
|
|
|
8
25
|
**Note:** Version bump only for package @synerise/ds-condition
|
package/dist/Condition.js
CHANGED
|
@@ -25,6 +25,7 @@ var SORTABLE_CONFIG = {
|
|
|
25
25
|
ghostClass: 'steps-list-ghost-element',
|
|
26
26
|
className: 'steps-list',
|
|
27
27
|
handle: '.step-drag-handler',
|
|
28
|
+
filter: '.ds-condition-step-name, .ds-cruds',
|
|
28
29
|
animation: 150,
|
|
29
30
|
forceFallback: true
|
|
30
31
|
};
|
|
@@ -58,7 +59,7 @@ var Condition = function Condition(props) {
|
|
|
58
59
|
return _objectSpread({
|
|
59
60
|
addStep: formatMessage({
|
|
60
61
|
id: 'DS.CONDITION.ADD-STEP',
|
|
61
|
-
defaultMessage: '
|
|
62
|
+
defaultMessage: 'and then...'
|
|
62
63
|
})
|
|
63
64
|
}, texts);
|
|
64
65
|
}, [texts, formatMessage]);
|
|
@@ -189,7 +190,8 @@ var Condition = function Condition(props) {
|
|
|
189
190
|
}, [steps, onChangeOrder]);
|
|
190
191
|
return React.useMemo(function () {
|
|
191
192
|
return /*#__PURE__*/React.createElement(S.Condition, {
|
|
192
|
-
className: "ds-conditions"
|
|
193
|
+
className: "ds-conditions",
|
|
194
|
+
"data-popup-container": true
|
|
193
195
|
}, /*#__PURE__*/React.createElement(ReactSortable, _extends({}, SORTABLE_CONFIG, {
|
|
194
196
|
list: steps,
|
|
195
197
|
setList: onChangeOrder || NOOP
|
|
@@ -197,7 +199,7 @@ var Condition = function Condition(props) {
|
|
|
197
199
|
return /*#__PURE__*/React.createElement(ConditionStep, {
|
|
198
200
|
key: "step-id-" + step.id,
|
|
199
201
|
step: step,
|
|
200
|
-
texts:
|
|
202
|
+
texts: text,
|
|
201
203
|
index: index,
|
|
202
204
|
hasPriority: step.id === priorityStepId,
|
|
203
205
|
onStepActivate: setPriorityStepId,
|
|
@@ -218,16 +220,17 @@ var Condition = function Condition(props) {
|
|
|
218
220
|
currentStepId: currentStepId,
|
|
219
221
|
currentField: currentField,
|
|
220
222
|
removeCondition: removeCondition,
|
|
221
|
-
addCondition: addCondition
|
|
223
|
+
addCondition: addCondition,
|
|
224
|
+
setCurrentField: setCurrentField
|
|
222
225
|
});
|
|
223
|
-
})), addStep && /*#__PURE__*/React.createElement(Button, {
|
|
224
|
-
type: "ghost
|
|
226
|
+
})), addStep && /*#__PURE__*/React.createElement(S.AddStepButton, null, /*#__PURE__*/React.createElement(Button, {
|
|
227
|
+
type: "ghost",
|
|
225
228
|
mode: "icon-label",
|
|
226
229
|
onClick: addStep
|
|
227
230
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
228
231
|
component: /*#__PURE__*/React.createElement(Add3M, null)
|
|
229
|
-
}), text.addStep));
|
|
230
|
-
}, [steps, priorityStepId, setPriorityStepId, onChangeOrder, addStep, text
|
|
232
|
+
}), text.addStep)));
|
|
233
|
+
}, [steps, priorityStepId, setPriorityStepId, onChangeOrder, addStep, text, draggableEnabled, selectOperator, selectParameter, selectContext, selectSubject, onUpdateStepName, duplicateStep, removeStep, minConditionsLength, maxConditionsLength, setStepConditionFactorType, setStepConditionFactorValue, currentConditionId, currentStepId, currentField, removeCondition, addCondition, getPopupContainerOverride]);
|
|
231
234
|
};
|
|
232
235
|
|
|
233
236
|
export default Condition;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare const StepConditions: import("styled-components").StyledComponent<"div", any, {
|
|
2
3
|
withoutStepName: boolean;
|
|
3
4
|
}, never>;
|
|
4
5
|
export declare const StepName: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
6
|
export declare const Condition: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const ConditionStepWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
|
+
export declare const And: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
|
+
export declare const DragIcon: import("styled-components").StyledComponent<import("react").FC<import("@synerise/ds-icon").IconProps>, any, {}, never>;
|
|
6
10
|
export declare const StepCruds: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
-
export declare const
|
|
11
|
+
export declare const LeftSide: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
+
export declare const StepHeader: import("styled-components").StyledComponent<"div", any, {
|
|
13
|
+
draggable: boolean;
|
|
14
|
+
}, never>;
|
|
8
15
|
export declare const Step: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
16
|
export declare const ConditionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
17
|
export declare const Subject: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -18,3 +25,4 @@ export declare const ConditionConnections: import("styled-components").StyledCom
|
|
|
18
25
|
first?: boolean | undefined;
|
|
19
26
|
last?: boolean | undefined;
|
|
20
27
|
}, never>;
|
|
28
|
+
export declare const AddStepButton: import("styled-components").StyledComponent<"div", any, {}, never>;
|
package/dist/Condition.style.js
CHANGED
|
@@ -1,40 +1,57 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { IconWrapper } from '@synerise/ds-inline-edit/dist/InlineEdit.styles';
|
|
3
|
+
import Icon from '@synerise/ds-icon';
|
|
3
4
|
export var StepConditions = styled.div.withConfig({
|
|
4
5
|
displayName: "Conditionstyle__StepConditions",
|
|
5
6
|
componentId: "sc-1lk06p3-0"
|
|
6
|
-
})(["display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;margin-top:
|
|
7
|
-
return props.withoutStepName ? '22px' : '0';
|
|
8
|
-
});
|
|
7
|
+
})(["display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;margin-top:0;padding:0 24px;width:100%;"]);
|
|
9
8
|
export var StepName = styled.div.withConfig({
|
|
10
9
|
displayName: "Conditionstyle__StepName",
|
|
11
10
|
componentId: "sc-1lk06p3-1"
|
|
12
|
-
})(["font-size:13px;line-height:1.84;color:", ";
|
|
13
|
-
return props.theme.palette['grey-
|
|
11
|
+
})(["font-size:13px;line-height:1.84;color:", ";display:flex;flex-direction:row;align-items:center;justify-content:flex-start;white-space:pre-wrap;&&& input{margin-top:2px;cursor:default;}"], function (props) {
|
|
12
|
+
return props.theme.palette['grey-800'];
|
|
14
13
|
});
|
|
15
14
|
export var Condition = styled.div.withConfig({
|
|
16
15
|
displayName: "Conditionstyle__Condition",
|
|
17
16
|
componentId: "sc-1lk06p3-2"
|
|
18
|
-
})(["padding:12px 0;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;min-width:575px
|
|
17
|
+
})(["padding:12px 0;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;min-width:575px;width:100%;.steps-list{width:100%;}"]);
|
|
18
|
+
export var ConditionStepWrapper = styled.div.withConfig({
|
|
19
|
+
displayName: "Conditionstyle__ConditionStepWrapper",
|
|
20
|
+
componentId: "sc-1lk06p3-3"
|
|
21
|
+
})(["display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:column;width:100%;"]);
|
|
22
|
+
export var And = styled.div.withConfig({
|
|
23
|
+
displayName: "Conditionstyle__And",
|
|
24
|
+
componentId: "sc-1lk06p3-4"
|
|
25
|
+
})([""]);
|
|
26
|
+
export var DragIcon = styled(Icon).withConfig({
|
|
27
|
+
displayName: "Conditionstyle__DragIcon",
|
|
28
|
+
componentId: "sc-1lk06p3-5"
|
|
29
|
+
})(["opacity:0;visibility:hidden;position:absolute;top:0;left:-24px;"]);
|
|
19
30
|
export var StepCruds = styled.div.withConfig({
|
|
20
31
|
displayName: "Conditionstyle__StepCruds",
|
|
21
|
-
componentId: "sc-1lk06p3-
|
|
22
|
-
})(["display:flex;align-items:center;justify-content:flex-end;opacity:0;visibility:hidden;
|
|
32
|
+
componentId: "sc-1lk06p3-6"
|
|
33
|
+
})(["display:flex;align-items:center;justify-content:flex-end;opacity:0;visibility:hidden;"]);
|
|
34
|
+
export var LeftSide = styled.div.withConfig({
|
|
35
|
+
displayName: "Conditionstyle__LeftSide",
|
|
36
|
+
componentId: "sc-1lk06p3-7"
|
|
37
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;position:relative;"]);
|
|
23
38
|
export var StepHeader = styled.div.withConfig({
|
|
24
39
|
displayName: "Conditionstyle__StepHeader",
|
|
25
|
-
componentId: "sc-1lk06p3-
|
|
26
|
-
})(["display:flex;width:100%;
|
|
40
|
+
componentId: "sc-1lk06p3-8"
|
|
41
|
+
})(["display:flex;width:100%;flex-direction:row;align-items:flex-end;justify-content:space-between;margin-bottom:8px;padding:12px 24px 0;cursor:", ";"], function (props) {
|
|
42
|
+
return props.draggable ? 'grab' : 'default';
|
|
43
|
+
});
|
|
27
44
|
export var Step = styled.div.withConfig({
|
|
28
45
|
displayName: "Conditionstyle__Step",
|
|
29
|
-
componentId: "sc-1lk06p3-
|
|
30
|
-
})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;padding:0 0
|
|
31
|
-
return props.theme.palette['grey-
|
|
32
|
-
}, StepCruds, function (props) {
|
|
46
|
+
componentId: "sc-1lk06p3-9"
|
|
47
|
+
})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;padding:0 0 12px;position:relative;&:first-of-type{&.steps-list-ghost-element{&:after{display:none;}}}&:hover{background-color:", ";", "{opacity:1;visibility:visible;}", "{opacity:1;visibility:visible;}}&.sortable-chosen{cursor:grabbing;width:100%;opacity:1 !important;height:50px;background-color:", ";display:flex;align-items:center;justify-content:center;padding:0 20px;box-shadow:0 16px 32px 0 #23293619;", "{align-items:center;}", "{margin:0;", "{display:none;}}", "{display:none;}}&.steps-list-ghost-element{cursor:grabbing;width:100%;background-color:", ";border-left:2px solid ", ";border-radius:0;display:flex;align-items:center;justify-content:center;padding:0;height:50px;box-shadow:none;position:relative;margin:24px 0;&:after{content:'';position:absolute;top:-24px;left:0;width:100%;height:1px;border-bottom:1px dotted ", ";}&:before{content:attr(data-dropLabel);text-align:center;position:relative;color:", ";}*{display:none;}}}"], function (props) {
|
|
48
|
+
return props.theme.palette['grey-050'];
|
|
49
|
+
}, StepCruds, DragIcon, function (props) {
|
|
33
50
|
return props.theme.palette.white;
|
|
34
51
|
}, StepHeader, StepName, IconWrapper, StepConditions, function (props) {
|
|
35
52
|
return props.theme.palette['blue-050'];
|
|
36
53
|
}, function (props) {
|
|
37
|
-
return props.theme.palette['blue-
|
|
54
|
+
return props.theme.palette['blue-600'];
|
|
38
55
|
}, function (props) {
|
|
39
56
|
return props.theme.palette['grey-300'];
|
|
40
57
|
}, function (props) {
|
|
@@ -42,33 +59,33 @@ export var Step = styled.div.withConfig({
|
|
|
42
59
|
});
|
|
43
60
|
export var ConditionWrapper = styled.div.withConfig({
|
|
44
61
|
displayName: "Conditionstyle__ConditionWrapper",
|
|
45
|
-
componentId: "sc-1lk06p3-
|
|
62
|
+
componentId: "sc-1lk06p3-10"
|
|
46
63
|
})([""]);
|
|
47
64
|
export var Subject = styled.div.withConfig({
|
|
48
65
|
displayName: "Conditionstyle__Subject",
|
|
49
|
-
componentId: "sc-1lk06p3-
|
|
66
|
+
componentId: "sc-1lk06p3-11"
|
|
50
67
|
})([""]);
|
|
51
68
|
export var RemoveIconWrapper = styled.span.withConfig({
|
|
52
69
|
displayName: "Conditionstyle__RemoveIconWrapper",
|
|
53
|
-
componentId: "sc-1lk06p3-
|
|
70
|
+
componentId: "sc-1lk06p3-12"
|
|
54
71
|
})(["visibility:hidden;pointer-events:none;opacity:0;transition:all 0.3s ease;width:32px;height:32px;display:flex;align-items:center;justify-content:center;margin-left:8px;"]);
|
|
55
72
|
export var ConditionRows = styled.div.withConfig({
|
|
56
73
|
displayName: "Conditionstyle__ConditionRows",
|
|
57
|
-
componentId: "sc-1lk06p3-
|
|
74
|
+
componentId: "sc-1lk06p3-13"
|
|
58
75
|
})(["display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:column;"]);
|
|
59
76
|
export var ConditionRow = styled.div.withConfig({
|
|
60
77
|
displayName: "Conditionstyle__ConditionRow",
|
|
61
|
-
componentId: "sc-1lk06p3-
|
|
78
|
+
componentId: "sc-1lk06p3-14"
|
|
62
79
|
})(["display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;padding-bottom:16px;min-width:780px;z-index:", ";", "{margin-right:8px;&:last-of-type{margin-right:0;}}&:hover{", "{opacity:1;visibility:visible;pointer-events:all;cursor:pointer;}}"], function (props) {
|
|
63
80
|
return 10000 - props.index;
|
|
64
81
|
}, ConditionWrapper, RemoveIconWrapper);
|
|
65
82
|
export var AddConditionRow = styled.div.withConfig({
|
|
66
83
|
displayName: "Conditionstyle__AddConditionRow",
|
|
67
|
-
componentId: "sc-1lk06p3-
|
|
84
|
+
componentId: "sc-1lk06p3-15"
|
|
68
85
|
})(["display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:row;"]);
|
|
69
86
|
export var ConditionConnections = styled.span.withConfig({
|
|
70
87
|
displayName: "Conditionstyle__ConditionConnections",
|
|
71
|
-
componentId: "sc-1lk06p3-
|
|
88
|
+
componentId: "sc-1lk06p3-16"
|
|
72
89
|
})(["display:flex;width:32px;margin:0 12px;position:relative;height:32px;&:before{position:absolute;content:'';width:", ";height:1px;top:50%;left:", ";background-color:", ";}&:after{display:", ";position:absolute;content:'';width:1px;left:50%;height:auto;top:", ";bottom:", ";background-color:", ";}"], function (props) {
|
|
73
90
|
return props.first ? '100%' : '16px';
|
|
74
91
|
}, function (props) {
|
|
@@ -83,4 +100,8 @@ export var ConditionConnections = styled.span.withConfig({
|
|
|
83
100
|
return props.last ? '16px' : '-16px';
|
|
84
101
|
}, function (props) {
|
|
85
102
|
return props.theme.palette['grey-300'];
|
|
86
|
-
});
|
|
103
|
+
});
|
|
104
|
+
export var AddStepButton = styled.div.withConfig({
|
|
105
|
+
displayName: "Conditionstyle__AddStepButton",
|
|
106
|
+
componentId: "sc-1lk06p3-17"
|
|
107
|
+
})(["margin:12px 24px 0;"]);
|
|
@@ -47,4 +47,5 @@ export declare type ConditionProps = {
|
|
|
47
47
|
onChangeFactorValue: (stepId: React.ReactText, conditionId: React.ReactText, value: FactorValueType | undefined) => void;
|
|
48
48
|
onChangeFactorType: (stepId: React.ReactText, conditionId: React.ReactText, value: FactorType | undefined) => void;
|
|
49
49
|
onUpdateStepName?: (stepId: React.ReactText, value: string) => void;
|
|
50
|
+
type?: 'attribute' | 'event';
|
|
50
51
|
};
|
|
@@ -29,7 +29,7 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
29
29
|
setStepConditionFactorType = _ref.setStepConditionFactorType,
|
|
30
30
|
setStepConditionFactorValue = _ref.setStepConditionFactorValue,
|
|
31
31
|
getPopupContainerOverride = _ref.getPopupContainerOverride,
|
|
32
|
-
|
|
32
|
+
_onActivate = _ref.onActivate,
|
|
33
33
|
hasPriority = _ref.hasPriority,
|
|
34
34
|
texts = _ref.texts;
|
|
35
35
|
return /*#__PURE__*/React.createElement(S.ConditionRow, {
|
|
@@ -43,21 +43,27 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
43
43
|
last: Boolean(addCondition && index + 1 === conditionsNumber && maxConditionLength !== undefined && conditionsNumber === maxConditionLength)
|
|
44
44
|
}), /*#__PURE__*/React.createElement(S.ConditionWrapper, null, conditionParameter && /*#__PURE__*/React.createElement(Factors, _extends({}, conditionParameter, {
|
|
45
45
|
getPopupContainerOverride: getPopupContainerOverride,
|
|
46
|
-
onActivate: onActivate
|
|
46
|
+
onActivate: function onActivate() {
|
|
47
|
+
return _onActivate && _onActivate(PARAMETER);
|
|
48
|
+
},
|
|
47
49
|
onChangeValue: function onChangeValue(value) {
|
|
48
50
|
return selectParameter(stepId, conditionId, value);
|
|
49
51
|
},
|
|
50
52
|
opened: stepId === currentStepId && conditionId === currentConditionId && currentField === PARAMETER
|
|
51
|
-
}))), (!conditionParameter || (conditionParameter == null ? void 0 : conditionParameter.value)) && conditionOperator && /*#__PURE__*/React.createElement(S.ConditionWrapper, null, /*#__PURE__*/React.createElement(Operators, _extends({}, conditionOperator, {
|
|
53
|
+
}))), (!conditionParameter || (conditionParameter == null ? void 0 : conditionParameter.value) && (conditionParameter == null ? void 0 : conditionParameter.value).name !== '') && conditionOperator && /*#__PURE__*/React.createElement(S.ConditionWrapper, null, /*#__PURE__*/React.createElement(Operators, _extends({}, conditionOperator, {
|
|
52
54
|
getPopupContainerOverride: getPopupContainerOverride,
|
|
53
|
-
onActivate: onActivate
|
|
55
|
+
onActivate: function onActivate() {
|
|
56
|
+
return _onActivate && _onActivate(OPERATOR);
|
|
57
|
+
},
|
|
54
58
|
onChange: function onChange(value) {
|
|
55
59
|
return selectOperator(stepId, conditionId, value);
|
|
56
60
|
},
|
|
57
61
|
opened: stepId === currentStepId && conditionId === currentConditionId && currentField === OPERATOR
|
|
58
|
-
}))), (conditionOperator == null ? void 0 : conditionOperator.value) && /*#__PURE__*/React.createElement(S.ConditionWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({}, conditionFactor, {
|
|
62
|
+
}))), conditionFactor !== undefined && (conditionOperator == null ? void 0 : conditionOperator.value) && (conditionFactor == null ? void 0 : conditionFactor.availableFactorTypes) !== null && /*#__PURE__*/React.createElement(S.ConditionWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({}, conditionFactor, {
|
|
59
63
|
getPopupContainerOverride: getPopupContainerOverride,
|
|
60
|
-
onActivate: onActivate
|
|
64
|
+
onActivate: function onActivate() {
|
|
65
|
+
return _onActivate && _onActivate(FACTOR);
|
|
66
|
+
},
|
|
61
67
|
setSelectedFactorType: function setSelectedFactorType(factorType) {
|
|
62
68
|
return setStepConditionFactorType(stepId, conditionId, factorType);
|
|
63
69
|
},
|
|
@@ -5,7 +5,7 @@ import { ConditionProps, ConditionTexts } from '../../Condition.types';
|
|
|
5
5
|
export declare type ConditionRowProps = {
|
|
6
6
|
index: number;
|
|
7
7
|
hasPriority?: boolean;
|
|
8
|
-
onActivate?: () => void;
|
|
8
|
+
onActivate?: (fieldType: string) => void;
|
|
9
9
|
conditionId: React.ReactText;
|
|
10
10
|
addCondition: ConditionProps['addCondition'];
|
|
11
11
|
conditionParameter: FactorsProps;
|
|
@@ -39,7 +39,8 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
39
39
|
hasPriority = _ref.hasPriority,
|
|
40
40
|
currentStepId = _ref.currentStepId,
|
|
41
41
|
currentConditionId = _ref.currentConditionId,
|
|
42
|
-
currentField = _ref.currentField
|
|
42
|
+
currentField = _ref.currentField,
|
|
43
|
+
setCurrentField = _ref.setCurrentField;
|
|
43
44
|
|
|
44
45
|
var _React$useState = React.useState(null),
|
|
45
46
|
activeConditionId = _React$useState[0],
|
|
@@ -123,9 +124,10 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
123
124
|
var _step$context2;
|
|
124
125
|
|
|
125
126
|
var handleActivation = function handleActivation(conditionId) {
|
|
126
|
-
return function () {
|
|
127
|
+
return function (fieldType) {
|
|
127
128
|
setActiveConditionId(conditionId);
|
|
128
129
|
onActivate && onActivate();
|
|
130
|
+
setCurrentField && setCurrentField(fieldType);
|
|
129
131
|
};
|
|
130
132
|
};
|
|
131
133
|
|
|
@@ -157,7 +159,7 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
157
159
|
texts: text,
|
|
158
160
|
stepType: (_step$context2 = step.context) == null ? void 0 : _step$context2.type
|
|
159
161
|
});
|
|
160
|
-
}, [
|
|
162
|
+
}, [step.id, step.conditions.length, step.context, hasPriority, activeConditionId, addCondition, removeCondition, minConditionsLength, maxConditionsLength, currentStepId, currentConditionId, currentField, selectParameter, selectOperator, getPopupContainerOverride, setStepConditionFactorType, setStepConditionFactorValue, text, onActivate, setCurrentField]);
|
|
161
163
|
return /*#__PURE__*/React.createElement(S.Step, {
|
|
162
164
|
key: step.id,
|
|
163
165
|
id: "condition-step-" + step.id,
|
|
@@ -10,13 +10,12 @@ export var StepHeader = function StepHeader(_ref) {
|
|
|
10
10
|
var stepName = _ref.stepName,
|
|
11
11
|
stepId = _ref.stepId,
|
|
12
12
|
texts = _ref.texts,
|
|
13
|
-
|
|
14
|
-
updateStepName = _ref$updateStepName === void 0 ? NOOP : _ref$updateStepName,
|
|
13
|
+
updateStepName = _ref.updateStepName,
|
|
15
14
|
duplicateStep = _ref.duplicateStep,
|
|
16
15
|
removeStep = _ref.removeStep,
|
|
17
16
|
index = _ref.index,
|
|
18
17
|
draggableEnabled = _ref.draggableEnabled;
|
|
19
|
-
var onChangeNameDebounce = React.useCallback(debounce(updateStepName, 300), [updateStepName]);
|
|
18
|
+
var onChangeNameDebounce = React.useCallback(debounce(updateStepName || NOOP, 300), [updateStepName]);
|
|
20
19
|
|
|
21
20
|
var _React$useState = React.useState(stepName),
|
|
22
21
|
localName = _React$useState[0],
|
|
@@ -29,7 +28,14 @@ export var StepHeader = function StepHeader(_ref) {
|
|
|
29
28
|
setLocalName(event.target.value);
|
|
30
29
|
onChangeNameDebounce(stepId, event.target.value);
|
|
31
30
|
}, [onChangeNameDebounce, stepId]);
|
|
32
|
-
return /*#__PURE__*/React.createElement(S.StepHeader,
|
|
31
|
+
return /*#__PURE__*/React.createElement(S.StepHeader, {
|
|
32
|
+
className: "step-drag-handler",
|
|
33
|
+
draggable: draggableEnabled
|
|
34
|
+
}, /*#__PURE__*/React.createElement(S.LeftSide, null, draggableEnabled && /*#__PURE__*/React.createElement(S.DragIcon, {
|
|
35
|
+
component: /*#__PURE__*/React.createElement(DragHandleM, null)
|
|
36
|
+
}), updateStepName && /*#__PURE__*/React.createElement(S.StepName, {
|
|
37
|
+
className: "ds-condition-step-name"
|
|
38
|
+
}, "" + (index + 1), ' ', /*#__PURE__*/React.createElement(InlineEdit, {
|
|
33
39
|
size: "small",
|
|
34
40
|
input: {
|
|
35
41
|
value: localName,
|
|
@@ -37,12 +43,7 @@ export var StepHeader = function StepHeader(_ref) {
|
|
|
37
43
|
placeholder: texts.stepNamePlaceholder,
|
|
38
44
|
onChange: handleChangeName
|
|
39
45
|
}
|
|
40
|
-
})), /*#__PURE__*/React.createElement(S.StepCruds, null,
|
|
41
|
-
icon: /*#__PURE__*/React.createElement(DragHandleM, null),
|
|
42
|
-
title: texts.moveTooltip,
|
|
43
|
-
onClick: NOOP,
|
|
44
|
-
className: "step-drag-handler"
|
|
45
|
-
}), /*#__PURE__*/React.createElement(Cruds, {
|
|
46
|
+
}))), /*#__PURE__*/React.createElement(S.StepCruds, null, /*#__PURE__*/React.createElement(Cruds, {
|
|
46
47
|
onDuplicate: duplicateStep ? function () {
|
|
47
48
|
return duplicateStep(stepId);
|
|
48
49
|
} : undefined,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-condition",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Condition UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@synerise/ds-button": "^0.17.2",
|
|
36
|
-
"@synerise/ds-context-selector": "^0.
|
|
37
|
-
"@synerise/ds-core": "^0.
|
|
36
|
+
"@synerise/ds-context-selector": "^0.11.0",
|
|
37
|
+
"@synerise/ds-core": "^0.33.0",
|
|
38
38
|
"@synerise/ds-cruds": "^0.3.9",
|
|
39
|
-
"@synerise/ds-factors": "^0.
|
|
39
|
+
"@synerise/ds-factors": "^0.12.0",
|
|
40
40
|
"@synerise/ds-icon": "^0.49.0",
|
|
41
|
-
"@synerise/ds-inline-edit": "^0.6.
|
|
42
|
-
"@synerise/ds-operators": "^0.
|
|
43
|
-
"@synerise/ds-subject": "^0.
|
|
41
|
+
"@synerise/ds-inline-edit": "^0.6.10",
|
|
42
|
+
"@synerise/ds-operators": "^0.8.0",
|
|
43
|
+
"@synerise/ds-subject": "^0.8.0",
|
|
44
44
|
"@synerise/ds-tooltip": "^0.11.9",
|
|
45
45
|
"@synerise/ds-utils": "^0.19.0",
|
|
46
46
|
"react-sortablejs": "^6.0.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": "5793ce09feb88b36cc8ca1923ddfcb272b889cb0"
|
|
53
53
|
}
|