@synerise/ds-condition 0.13.10 → 0.15.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 +69 -0
- package/dist/Condition.d.ts +1 -0
- package/dist/Condition.js +55 -16
- package/dist/Condition.style.d.ts +17 -2
- package/dist/Condition.style.js +69 -33
- package/dist/Condition.types.d.ts +6 -2
- package/dist/ConditionStep/AddCondition/AddCondition.types.d.ts +3 -3
- package/dist/ConditionStep/ConditionRow/ConditionRow.js +24 -10
- package/dist/ConditionStep/ConditionRow/ConditionRow.types.d.ts +3 -2
- package/dist/ConditionStep/ConditionStep.js +48 -18
- package/dist/ConditionStep/ConditionStep.types.d.ts +5 -0
- package/dist/ConditionStep/StepHeader/StepHeader.js +12 -10
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,75 @@
|
|
|
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.15.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.14.4...@synerise/ds-condition@0.15.0) (2022-04-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **condition:** clearing active step on deactivating inner components ([ad45310](https://github.com/Synerise/synerise-design/commit/ad45310cde108e40b2b88c0a88bf801d679056db))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.14.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.14.3...@synerise/ds-condition@0.14.4) (2022-04-13)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **condition:** conditionally render addCondition renderProp ([78a3de7](https://github.com/Synerise/synerise-design/commit/78a3de75d8ec9c917d96c1b54c70d24f50dc8c7a))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [0.14.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.14.2...@synerise/ds-condition@0.14.3) (2022-04-12)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* **condition:** rules-of-hooks dependencies ([10e573e](https://github.com/Synerise/synerise-design/commit/10e573e018ca7e2f69f3f317f35d51eace89ded8))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## [0.14.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.14.1...@synerise/ds-condition@0.14.2) (2022-04-12)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* fix filter dropdowns ([eaab107](https://github.com/Synerise/synerise-design/commit/eaab107b6dca7401a17c2e36806febd11edc677b))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## [0.14.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.14.0...@synerise/ds-condition@0.14.1) (2022-04-08)
|
|
51
|
+
|
|
52
|
+
**Note:** Version bump only for package @synerise/ds-condition
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# [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)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Bug Fixes
|
|
62
|
+
|
|
63
|
+
* **condition:** styles of StepHeader, hiding step name in stories ([9924476](https://github.com/Synerise/synerise-design/commit/9924476909449c5a11db7f784ba3a30008f48120))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Features
|
|
67
|
+
|
|
68
|
+
* **condition:** updates styles, allows to dragging by header, not only icon ([4c070eb](https://github.com/Synerise/synerise-design/commit/4c070ebaa5c3779733acea5cdff06d06842719b0))
|
|
69
|
+
* **filter:** fixes bugs ([b862ddd](https://github.com/Synerise/synerise-design/commit/b862dddbce1293c2a5381663fc903bb574edd135))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
6
75
|
## [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
76
|
|
|
8
77
|
**Note:** Version bump only for package @synerise/ds-condition
|
package/dist/Condition.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ import * as T from './Condition.types';
|
|
|
3
3
|
export declare const OPERATOR = "operator";
|
|
4
4
|
export declare const PARAMETER = "parameter";
|
|
5
5
|
export declare const FACTOR = "factor";
|
|
6
|
+
export declare const SUBJECT = "subject";
|
|
6
7
|
declare const Condition: React.FC<T.ConditionProps>;
|
|
7
8
|
export default Condition;
|
package/dist/Condition.js
CHANGED
|
@@ -21,10 +21,12 @@ var DEFAULT_STEP = '';
|
|
|
21
21
|
export var OPERATOR = 'operator';
|
|
22
22
|
export var PARAMETER = 'parameter';
|
|
23
23
|
export var FACTOR = 'factor';
|
|
24
|
+
export var SUBJECT = 'subject';
|
|
24
25
|
var SORTABLE_CONFIG = {
|
|
25
26
|
ghostClass: 'steps-list-ghost-element',
|
|
26
27
|
className: 'steps-list',
|
|
27
28
|
handle: '.step-drag-handler',
|
|
29
|
+
filter: '.ds-condition-step-name, .ds-cruds',
|
|
28
30
|
animation: 150,
|
|
29
31
|
forceFallback: true
|
|
30
32
|
};
|
|
@@ -37,6 +39,7 @@ var Condition = function Condition(props) {
|
|
|
37
39
|
duplicateStep = props.duplicateStep,
|
|
38
40
|
removeStep = props.removeStep,
|
|
39
41
|
addStep = props.addStep,
|
|
42
|
+
renderAddStep = props.renderAddStep,
|
|
40
43
|
onChangeOrder = props.onChangeOrder,
|
|
41
44
|
_props$minConditionsL = props.minConditionsLength,
|
|
42
45
|
minConditionsLength = _props$minConditionsL === void 0 ? 1 : _props$minConditionsL,
|
|
@@ -49,7 +52,8 @@ var Condition = function Condition(props) {
|
|
|
49
52
|
onChangeFactorType = props.onChangeFactorType,
|
|
50
53
|
onChangeFactorValue = props.onChangeFactorValue,
|
|
51
54
|
onUpdateStepName = props.onUpdateStepName,
|
|
52
|
-
getPopupContainerOverride = props.getPopupContainerOverride
|
|
55
|
+
getPopupContainerOverride = props.getPopupContainerOverride,
|
|
56
|
+
showSuffix = props.showSuffix;
|
|
53
57
|
|
|
54
58
|
var _useIntl = useIntl(),
|
|
55
59
|
formatMessage = _useIntl.formatMessage;
|
|
@@ -58,7 +62,11 @@ var Condition = function Condition(props) {
|
|
|
58
62
|
return _objectSpread({
|
|
59
63
|
addStep: formatMessage({
|
|
60
64
|
id: 'DS.CONDITION.ADD-STEP',
|
|
61
|
-
defaultMessage: '
|
|
65
|
+
defaultMessage: 'and then...'
|
|
66
|
+
}),
|
|
67
|
+
conditionSuffix: formatMessage({
|
|
68
|
+
id: 'DS.CONDITION.SUFFIX',
|
|
69
|
+
defaultMessage: 'and'
|
|
62
70
|
})
|
|
63
71
|
}, texts);
|
|
64
72
|
}, [texts, formatMessage]);
|
|
@@ -75,10 +83,6 @@ var Condition = function Condition(props) {
|
|
|
75
83
|
currentField = _React$useState3[0],
|
|
76
84
|
setCurrentField = _React$useState3[1];
|
|
77
85
|
|
|
78
|
-
var _React$useState4 = React.useState(null),
|
|
79
|
-
priorityStepId = _React$useState4[0],
|
|
80
|
-
setPriorityStepId = _React$useState4[1];
|
|
81
|
-
|
|
82
86
|
var prevSteps = usePrevious(steps);
|
|
83
87
|
React.useEffect(function () {
|
|
84
88
|
var newConditionId = prevSteps && steps && steps.reduce(function (id, step) {
|
|
@@ -147,11 +151,13 @@ var Condition = function Condition(props) {
|
|
|
147
151
|
var selectSubject = React.useCallback(function (value, stepId) {
|
|
148
152
|
clearConditionRow(stepId);
|
|
149
153
|
setCurrentStepId(stepId);
|
|
154
|
+
setCurrentField(PARAMETER);
|
|
150
155
|
onChangeSubject && onChangeSubject(stepId, value);
|
|
151
156
|
}, [clearConditionRow, onChangeSubject]);
|
|
152
157
|
var selectContext = React.useCallback(function (value, stepId) {
|
|
153
158
|
clearConditionRow(stepId);
|
|
154
159
|
setCurrentStepId(stepId);
|
|
160
|
+
setCurrentField(PARAMETER);
|
|
155
161
|
onChangeContext && onChangeContext(stepId, value);
|
|
156
162
|
}, [clearConditionRow, onChangeContext]);
|
|
157
163
|
var selectParameter = React.useCallback(function (stepId, conditionId, value) {
|
|
@@ -187,9 +193,38 @@ var Condition = function Condition(props) {
|
|
|
187
193
|
var draggableEnabled = React.useMemo(function () {
|
|
188
194
|
return onChangeOrder && steps.length > 1;
|
|
189
195
|
}, [steps, onChangeOrder]);
|
|
196
|
+
var handleAddStep = React.useCallback(function () {
|
|
197
|
+
var newStepId = addStep ? addStep() : undefined;
|
|
198
|
+
|
|
199
|
+
if (newStepId) {
|
|
200
|
+
setCurrentStepId(newStepId);
|
|
201
|
+
setCurrentField(SUBJECT);
|
|
202
|
+
}
|
|
203
|
+
}, [addStep]);
|
|
204
|
+
var handleAddCondition = React.useMemo(function () {
|
|
205
|
+
if (!addCondition) {
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return function (stepId) {
|
|
210
|
+
var newConditionId = addCondition ? addCondition(stepId) : undefined;
|
|
211
|
+
|
|
212
|
+
if (newConditionId) {
|
|
213
|
+
setCurrentConditionId(newConditionId);
|
|
214
|
+
setCurrentStepId(stepId);
|
|
215
|
+
setCurrentField(PARAMETER);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}, [addCondition]);
|
|
219
|
+
var handleClearActiveCondition = React.useCallback(function () {
|
|
220
|
+
setCurrentConditionId(DEFAULT_CONDITION);
|
|
221
|
+
setCurrentStepId(DEFAULT_STEP);
|
|
222
|
+
setCurrentField(DEFAULT_FIELD);
|
|
223
|
+
}, []);
|
|
190
224
|
return React.useMemo(function () {
|
|
191
225
|
return /*#__PURE__*/React.createElement(S.Condition, {
|
|
192
|
-
className: "ds-conditions"
|
|
226
|
+
className: "ds-conditions",
|
|
227
|
+
"data-popup-container": true
|
|
193
228
|
}, /*#__PURE__*/React.createElement(ReactSortable, _extends({}, SORTABLE_CONFIG, {
|
|
194
229
|
list: steps,
|
|
195
230
|
setList: onChangeOrder || NOOP
|
|
@@ -197,10 +232,9 @@ var Condition = function Condition(props) {
|
|
|
197
232
|
return /*#__PURE__*/React.createElement(ConditionStep, {
|
|
198
233
|
key: "step-id-" + step.id,
|
|
199
234
|
step: step,
|
|
200
|
-
texts:
|
|
235
|
+
texts: text,
|
|
201
236
|
index: index,
|
|
202
|
-
hasPriority: step.id ===
|
|
203
|
-
onStepActivate: setPriorityStepId,
|
|
237
|
+
hasPriority: step.id === currentStepId,
|
|
204
238
|
getPopupContainerOverride: getPopupContainerOverride,
|
|
205
239
|
draggableEnabled: draggableEnabled,
|
|
206
240
|
selectOperator: selectOperator,
|
|
@@ -218,16 +252,21 @@ var Condition = function Condition(props) {
|
|
|
218
252
|
currentStepId: currentStepId,
|
|
219
253
|
currentField: currentField,
|
|
220
254
|
removeCondition: removeCondition,
|
|
221
|
-
addCondition:
|
|
255
|
+
addCondition: handleAddCondition,
|
|
256
|
+
setCurrentField: setCurrentField,
|
|
257
|
+
setCurrentCondition: setCurrentConditionId,
|
|
258
|
+
setCurrentStep: setCurrentStepId,
|
|
259
|
+
onDeactivate: handleClearActiveCondition,
|
|
260
|
+
showSuffix: showSuffix
|
|
222
261
|
});
|
|
223
|
-
})), addStep && /*#__PURE__*/React.createElement(Button, {
|
|
224
|
-
type: "ghost
|
|
262
|
+
})), addStep && /*#__PURE__*/React.createElement(S.AddStepButton, null, /*#__PURE__*/React.createElement(Button, {
|
|
263
|
+
type: "ghost",
|
|
225
264
|
mode: "icon-label",
|
|
226
|
-
onClick:
|
|
265
|
+
onClick: handleAddStep
|
|
227
266
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
228
267
|
component: /*#__PURE__*/React.createElement(Add3M, null)
|
|
229
|
-
}), text.addStep));
|
|
230
|
-
}, [steps,
|
|
268
|
+
}), text.addStep)), renderAddStep && /*#__PURE__*/React.createElement(S.AddStepButton, null, renderAddStep()));
|
|
269
|
+
}, [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]);
|
|
231
270
|
};
|
|
232
271
|
|
|
233
272
|
export default Condition;
|
|
@@ -1,20 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ConditionRowProps } from './ConditionStep/ConditionRow';
|
|
3
|
+
export declare const DragIcon: import("styled-components").StyledComponent<import("react").FC<import("@synerise/ds-icon").IconProps>, any, {}, never>;
|
|
4
|
+
export declare const StepConditionCruds: import("styled-components").StyledComponent<import("react").FC<import("@synerise/ds-cruds/dist/Cruds.types").CrudsProps> & import("@synerise/ds-cruds/dist/Cruds.types").CrudsSubComponents, any, {}, never>;
|
|
1
5
|
export declare const StepConditions: import("styled-components").StyledComponent<"div", any, {
|
|
2
6
|
withoutStepName: boolean;
|
|
3
7
|
}, never>;
|
|
4
8
|
export declare const StepName: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
9
|
export declare const Condition: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
+
export declare const ConditionStepWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export declare const And: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
12
|
export declare const StepCruds: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
|
+
export declare const LeftSide: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
14
|
export declare const StepHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
15
|
+
export declare const DraggedLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
16
|
+
export declare const Step: import("styled-components").StyledComponent<"div", any, {
|
|
17
|
+
active: boolean;
|
|
18
|
+
showSuffix: boolean | undefined;
|
|
19
|
+
}, never>;
|
|
20
|
+
export declare const ConditionWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
21
|
+
fullWidth?: boolean | undefined;
|
|
22
|
+
}, never>;
|
|
10
23
|
export declare const Subject: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
24
|
export declare const RemoveIconWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
12
25
|
export declare const ConditionRows: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
26
|
export declare const ConditionRow: import("styled-components").StyledComponent<"div", any, {
|
|
14
27
|
index: number;
|
|
28
|
+
stepType: ConditionRowProps['stepType'];
|
|
15
29
|
}, never>;
|
|
16
30
|
export declare const AddConditionRow: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
31
|
export declare const ConditionConnections: import("styled-components").StyledComponent<"span", any, {
|
|
18
32
|
first?: boolean | undefined;
|
|
19
33
|
last?: boolean | undefined;
|
|
20
34
|
}, never>;
|
|
35
|
+
export declare const AddStepButton: import("styled-components").StyledComponent<"div", any, {}, never>;
|
package/dist/Condition.style.js
CHANGED
|
@@ -1,75 +1,107 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
2
|
import { IconWrapper } from '@synerise/ds-inline-edit/dist/InlineEdit.styles';
|
|
3
|
+
import Icon from '@synerise/ds-icon';
|
|
4
|
+
import Cruds from '@synerise/ds-cruds';
|
|
5
|
+
export var DragIcon = styled(Icon).withConfig({
|
|
6
|
+
displayName: "Conditionstyle__DragIcon",
|
|
7
|
+
componentId: "sc-1lk06p3-0"
|
|
8
|
+
})(["opacity:0;visibility:hidden;position:absolute;top:0;left:-24px;cursor:grab;"]);
|
|
9
|
+
export var StepConditionCruds = styled(Cruds).withConfig({
|
|
10
|
+
displayName: "Conditionstyle__StepConditionCruds",
|
|
11
|
+
componentId: "sc-1lk06p3-1"
|
|
12
|
+
})(["position:absolute;top:16px;right:24px;visibility:hidden;opacity:0;"]);
|
|
3
13
|
export var StepConditions = styled.div.withConfig({
|
|
4
14
|
displayName: "Conditionstyle__StepConditions",
|
|
5
|
-
componentId: "sc-1lk06p3-
|
|
6
|
-
})(["display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;margin-top:", ";"], function (props) {
|
|
7
|
-
return props.withoutStepName ? '
|
|
8
|
-
});
|
|
15
|
+
componentId: "sc-1lk06p3-2"
|
|
16
|
+
})(["display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;margin-top:0;padding:0 24px;width:", ";", "{left:0;top:16px;}"], function (props) {
|
|
17
|
+
return props.withoutStepName ? 'calc(100% - 48px)' : '100%';
|
|
18
|
+
}, DragIcon);
|
|
9
19
|
export var StepName = styled.div.withConfig({
|
|
10
20
|
displayName: "Conditionstyle__StepName",
|
|
11
|
-
componentId: "sc-1lk06p3-
|
|
12
|
-
})(["font-size:13px;line-height:1.84;color:", ";
|
|
13
|
-
return props.theme.palette['grey-
|
|
21
|
+
componentId: "sc-1lk06p3-3"
|
|
22
|
+
})(["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) {
|
|
23
|
+
return props.theme.palette['grey-800'];
|
|
14
24
|
});
|
|
15
25
|
export var Condition = styled.div.withConfig({
|
|
16
26
|
displayName: "Conditionstyle__Condition",
|
|
17
|
-
componentId: "sc-1lk06p3-
|
|
18
|
-
})(["padding:12px 0;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;min-width:575px
|
|
27
|
+
componentId: "sc-1lk06p3-4"
|
|
28
|
+
})(["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%;}"]);
|
|
29
|
+
export var ConditionStepWrapper = styled.div.withConfig({
|
|
30
|
+
displayName: "Conditionstyle__ConditionStepWrapper",
|
|
31
|
+
componentId: "sc-1lk06p3-5"
|
|
32
|
+
})(["display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:column;width:100%;"]);
|
|
33
|
+
export var And = styled.div.withConfig({
|
|
34
|
+
displayName: "Conditionstyle__And",
|
|
35
|
+
componentId: "sc-1lk06p3-6"
|
|
36
|
+
})(["display:contents;"]);
|
|
19
37
|
export var StepCruds = styled.div.withConfig({
|
|
20
38
|
displayName: "Conditionstyle__StepCruds",
|
|
21
|
-
componentId: "sc-1lk06p3-
|
|
22
|
-
})(["display:flex;align-items:center;justify-content:flex-end;opacity:0;visibility:hidden;
|
|
39
|
+
componentId: "sc-1lk06p3-7"
|
|
40
|
+
})(["display:flex;align-items:center;justify-content:flex-end;opacity:0;visibility:hidden;"]);
|
|
41
|
+
export var LeftSide = styled.div.withConfig({
|
|
42
|
+
displayName: "Conditionstyle__LeftSide",
|
|
43
|
+
componentId: "sc-1lk06p3-8"
|
|
44
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;position:relative;"]);
|
|
23
45
|
export var StepHeader = styled.div.withConfig({
|
|
24
46
|
displayName: "Conditionstyle__StepHeader",
|
|
25
|
-
componentId: "sc-1lk06p3-
|
|
26
|
-
})(["display:flex;width:100%;
|
|
47
|
+
componentId: "sc-1lk06p3-9"
|
|
48
|
+
})(["display:flex;width:100%;flex-direction:row;align-items:flex-end;justify-content:space-between;margin-bottom:8px;padding:0 24px;"]);
|
|
49
|
+
export var DraggedLabel = styled.span.withConfig({
|
|
50
|
+
displayName: "Conditionstyle__DraggedLabel",
|
|
51
|
+
componentId: "sc-1lk06p3-10"
|
|
52
|
+
})(["width:100%;height:100%;display:none;position:absolute;top:0;left:0;align-items:center;justify-content:flex-start;padding-left:18px;color:", ";font-size:13px;"], function (props) {
|
|
53
|
+
return props.theme.palette['grey-600'];
|
|
54
|
+
});
|
|
27
55
|
export var Step = styled.div.withConfig({
|
|
28
56
|
displayName: "Conditionstyle__Step",
|
|
29
|
-
componentId: "sc-1lk06p3-
|
|
30
|
-
})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;padding:
|
|
31
|
-
return props.theme.palette
|
|
32
|
-
},
|
|
57
|
+
componentId: "sc-1lk06p3-11"
|
|
58
|
+
})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;padding:12px 0 12px;position:relative;", " &:first-of-type{&.steps-list-ghost-element{&:after{display:none;}}}background-color:", ";&:hover{background-color:", ";", "{opacity:1;visibility:visible;}", "{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;&:after{display:none;}", "{align-items:center;}", "{margin:0;", "{display:none;}}", "{display:none;}", "{display:flex;}}&.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;&:before{content:attr(data-dropLabel);text-align:center;position:relative;color:", ";}", "{display:none;}*{display:none;}}}"], function (props) {
|
|
59
|
+
return Boolean(props.showSuffix) && css(["&:after{display:none;width:100%;padding:18px 0 18px 24px;bottom:-18px;content:attr(data-conditionSuffix);background-color:", ";position:relative;font-size:16px;font-weight:500;color:#3f4c5b;}&:first-child:not(:last-child){&:after{display:flex;}}&:not(:last-child){&:after{display:flex;}}"], props.theme.palette.white);
|
|
60
|
+
}, function (props) {
|
|
61
|
+
return props.active ? props.theme.palette['grey-050'] : 'transparent';
|
|
62
|
+
}, function (props) {
|
|
63
|
+
return props.theme.palette['grey-050'];
|
|
64
|
+
}, StepCruds, StepConditionCruds, DragIcon, function (props) {
|
|
33
65
|
return props.theme.palette.white;
|
|
34
|
-
}, StepHeader, StepName, IconWrapper, StepConditions, function (props) {
|
|
66
|
+
}, StepHeader, StepName, IconWrapper, StepConditions, DraggedLabel, function (props) {
|
|
35
67
|
return props.theme.palette['blue-050'];
|
|
36
68
|
}, function (props) {
|
|
37
|
-
return props.theme.palette['blue-
|
|
38
|
-
}, function (props) {
|
|
39
|
-
return props.theme.palette['grey-300'];
|
|
69
|
+
return props.theme.palette['blue-600'];
|
|
40
70
|
}, function (props) {
|
|
41
71
|
return props.theme.palette['blue-600'];
|
|
42
|
-
});
|
|
72
|
+
}, DraggedLabel);
|
|
43
73
|
export var ConditionWrapper = styled.div.withConfig({
|
|
44
74
|
displayName: "Conditionstyle__ConditionWrapper",
|
|
45
|
-
componentId: "sc-1lk06p3-
|
|
75
|
+
componentId: "sc-1lk06p3-12"
|
|
46
76
|
})([""]);
|
|
47
77
|
export var Subject = styled.div.withConfig({
|
|
48
78
|
displayName: "Conditionstyle__Subject",
|
|
49
|
-
componentId: "sc-1lk06p3-
|
|
79
|
+
componentId: "sc-1lk06p3-13"
|
|
50
80
|
})([""]);
|
|
51
81
|
export var RemoveIconWrapper = styled.span.withConfig({
|
|
52
82
|
displayName: "Conditionstyle__RemoveIconWrapper",
|
|
53
|
-
componentId: "sc-1lk06p3-
|
|
83
|
+
componentId: "sc-1lk06p3-14"
|
|
54
84
|
})(["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
85
|
export var ConditionRows = styled.div.withConfig({
|
|
56
86
|
displayName: "Conditionstyle__ConditionRows",
|
|
57
|
-
componentId: "sc-1lk06p3-
|
|
87
|
+
componentId: "sc-1lk06p3-15"
|
|
58
88
|
})(["display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:column;"]);
|
|
59
89
|
export var ConditionRow = styled.div.withConfig({
|
|
60
90
|
displayName: "Conditionstyle__ConditionRow",
|
|
61
|
-
componentId: "sc-1lk06p3-
|
|
62
|
-
})(["display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;padding-bottom:
|
|
91
|
+
componentId: "sc-1lk06p3-16"
|
|
92
|
+
})(["display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;padding-bottom:", ";z-index:", ";", "{margin-right:8px;&:last-of-type{margin-right:0;}}&:hover{", "{opacity:1;visibility:visible;pointer-events:all;cursor:pointer;}}"], function (props) {
|
|
93
|
+
return props.stepType === 'event' ? '16px' : '0';
|
|
94
|
+
}, function (props) {
|
|
63
95
|
return 10000 - props.index;
|
|
64
96
|
}, ConditionWrapper, RemoveIconWrapper);
|
|
65
97
|
export var AddConditionRow = styled.div.withConfig({
|
|
66
98
|
displayName: "Conditionstyle__AddConditionRow",
|
|
67
|
-
componentId: "sc-1lk06p3-
|
|
99
|
+
componentId: "sc-1lk06p3-17"
|
|
68
100
|
})(["display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:row;"]);
|
|
69
101
|
export var ConditionConnections = styled.span.withConfig({
|
|
70
102
|
displayName: "Conditionstyle__ConditionConnections",
|
|
71
|
-
componentId: "sc-1lk06p3-
|
|
72
|
-
})(["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) {
|
|
103
|
+
componentId: "sc-1lk06p3-18"
|
|
104
|
+
})(["display:flex;width:32px;min-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
105
|
return props.first ? '100%' : '16px';
|
|
74
106
|
}, function (props) {
|
|
75
107
|
return props.first ? '0' : '16px';
|
|
@@ -83,4 +115,8 @@ export var ConditionConnections = styled.span.withConfig({
|
|
|
83
115
|
return props.last ? '16px' : '-16px';
|
|
84
116
|
}, function (props) {
|
|
85
117
|
return props.theme.palette['grey-300'];
|
|
86
|
-
});
|
|
118
|
+
});
|
|
119
|
+
export var AddStepButton = styled.div.withConfig({
|
|
120
|
+
displayName: "Conditionstyle__AddStepButton",
|
|
121
|
+
componentId: "sc-1lk06p3-19"
|
|
122
|
+
})(["margin:12px 24px 0;"]);
|
|
@@ -26,15 +26,17 @@ export declare type ConditionTexts = {
|
|
|
26
26
|
moveTooltip: string;
|
|
27
27
|
duplicateTooltip: string;
|
|
28
28
|
removeTooltip: string;
|
|
29
|
+
conditionSuffix: string;
|
|
29
30
|
};
|
|
30
31
|
export declare type ConditionProps = {
|
|
31
32
|
steps: ConditionStep[];
|
|
32
33
|
getPopupContainerOverride?: (trigger: HTMLElement | null) => HTMLElement;
|
|
33
|
-
addCondition?: (stepId: React.ReactText) =>
|
|
34
|
+
addCondition?: (stepId: React.ReactText) => string | undefined;
|
|
35
|
+
renderAddStep?: () => React.ReactNode;
|
|
34
36
|
removeCondition?: (stepId: React.ReactText, conditionRowId: React.ReactText) => void;
|
|
35
37
|
removeStep?: (stepId: React.ReactText) => void;
|
|
36
38
|
duplicateStep?: (stepId: React.ReactText) => void;
|
|
37
|
-
addStep?: () =>
|
|
39
|
+
addStep?: () => string | undefined;
|
|
38
40
|
onChangeOrder?: (newOrder: ConditionStep[]) => void;
|
|
39
41
|
texts?: Partial<ConditionTexts>;
|
|
40
42
|
minConditionsLength: number;
|
|
@@ -47,4 +49,6 @@ export declare type ConditionProps = {
|
|
|
47
49
|
onChangeFactorValue: (stepId: React.ReactText, conditionId: React.ReactText, value: FactorValueType | undefined) => void;
|
|
48
50
|
onChangeFactorType: (stepId: React.ReactText, conditionId: React.ReactText, value: FactorType | undefined) => void;
|
|
49
51
|
onUpdateStepName?: (stepId: React.ReactText, value: string) => void;
|
|
52
|
+
type?: 'attribute' | 'event';
|
|
53
|
+
showSuffix?: boolean;
|
|
50
54
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConditionTexts } from '../../Condition.types';
|
|
3
3
|
export declare type AddConditionProps = {
|
|
4
|
-
addCondition:
|
|
4
|
+
addCondition: (stepId: React.ReactText) => void;
|
|
5
5
|
stepId: React.ReactText;
|
|
6
6
|
conditionsNumber: number;
|
|
7
7
|
texts: Partial<ConditionTexts>;
|
|
@@ -29,10 +29,13 @@ 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
|
-
texts = _ref.texts
|
|
34
|
+
texts = _ref.texts,
|
|
35
|
+
stepType = _ref.stepType,
|
|
36
|
+
onDeactivate = _ref.onDeactivate;
|
|
35
37
|
return /*#__PURE__*/React.createElement(S.ConditionRow, {
|
|
38
|
+
stepType: stepType,
|
|
36
39
|
style: hasPriority ? {
|
|
37
40
|
zIndex: 10001
|
|
38
41
|
} : undefined,
|
|
@@ -43,21 +46,32 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
43
46
|
last: Boolean(addCondition && index + 1 === conditionsNumber && maxConditionLength !== undefined && conditionsNumber === maxConditionLength)
|
|
44
47
|
}), /*#__PURE__*/React.createElement(S.ConditionWrapper, null, conditionParameter && /*#__PURE__*/React.createElement(Factors, _extends({}, conditionParameter, {
|
|
45
48
|
getPopupContainerOverride: getPopupContainerOverride,
|
|
46
|
-
onActivate: onActivate
|
|
49
|
+
onActivate: function onActivate() {
|
|
50
|
+
return _onActivate && _onActivate(PARAMETER);
|
|
51
|
+
},
|
|
52
|
+
onDeactivate: onDeactivate,
|
|
47
53
|
onChangeValue: function onChangeValue(value) {
|
|
48
54
|
return selectParameter(stepId, conditionId, value);
|
|
49
55
|
},
|
|
50
|
-
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, {
|
|
56
|
+
opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === PARAMETER
|
|
57
|
+
}))), (!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
58
|
getPopupContainerOverride: getPopupContainerOverride,
|
|
53
|
-
onActivate: onActivate
|
|
59
|
+
onActivate: function onActivate() {
|
|
60
|
+
return _onActivate && _onActivate(OPERATOR);
|
|
61
|
+
},
|
|
62
|
+
onDeactivate: onDeactivate,
|
|
54
63
|
onChange: function onChange(value) {
|
|
55
64
|
return selectOperator(stepId, conditionId, value);
|
|
56
65
|
},
|
|
57
|
-
opened: stepId === currentStepId && conditionId === currentConditionId && currentField === OPERATOR
|
|
58
|
-
}))), (conditionOperator == null ? void 0 : conditionOperator.value) &&
|
|
66
|
+
opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === OPERATOR
|
|
67
|
+
}))), conditionFactor !== undefined && (conditionOperator == null ? void 0 : conditionOperator.value) && (conditionFactor == null ? void 0 : conditionFactor.availableFactorTypes) !== null && /*#__PURE__*/React.createElement(S.ConditionWrapper, {
|
|
68
|
+
fullWidth: true
|
|
69
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({}, conditionFactor, {
|
|
59
70
|
getPopupContainerOverride: getPopupContainerOverride,
|
|
60
|
-
onActivate: onActivate
|
|
71
|
+
onActivate: function onActivate() {
|
|
72
|
+
return _onActivate && _onActivate(FACTOR);
|
|
73
|
+
},
|
|
74
|
+
onDeactivate: onDeactivate,
|
|
61
75
|
setSelectedFactorType: function setSelectedFactorType(factorType) {
|
|
62
76
|
return setStepConditionFactorType(stepId, conditionId, factorType);
|
|
63
77
|
},
|
|
@@ -65,7 +79,7 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
65
79
|
return setStepConditionFactorValue(stepId, conditionId, value);
|
|
66
80
|
},
|
|
67
81
|
factorKey: conditionId,
|
|
68
|
-
opened: stepId === currentStepId && conditionId === currentConditionId && currentField === FACTOR
|
|
82
|
+
opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === FACTOR
|
|
69
83
|
})))), removeCondition && conditionsNumber > minConditionLength && /*#__PURE__*/React.createElement(S.RemoveIconWrapper, {
|
|
70
84
|
onClick: function onClick() {
|
|
71
85
|
return removeCondition(stepId, conditionId);
|
|
@@ -5,9 +5,10 @@ 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
|
+
onDeactivate?: () => void;
|
|
9
10
|
conditionId: React.ReactText;
|
|
10
|
-
addCondition:
|
|
11
|
+
addCondition?: (stepId: React.ReactText) => void;
|
|
11
12
|
conditionParameter: FactorsProps;
|
|
12
13
|
conditionOperator: OperatorsProps;
|
|
13
14
|
conditionFactor: FactorsProps;
|
|
@@ -10,12 +10,16 @@ import * as React from 'react';
|
|
|
10
10
|
import Subject from '@synerise/ds-subject';
|
|
11
11
|
import ContextSelector from '@synerise/ds-context-selector';
|
|
12
12
|
import { useIntl } from 'react-intl';
|
|
13
|
+
import { DragHandleM } from '@synerise/ds-icon';
|
|
13
14
|
import * as S from '../Condition.style';
|
|
14
15
|
import { StepHeader } from './StepHeader';
|
|
15
16
|
import { AddCondition } from './AddCondition';
|
|
16
|
-
import { ConditionRow } from './ConditionRow';
|
|
17
|
+
import { ConditionRow } from './ConditionRow';
|
|
18
|
+
import { SUBJECT } from '../Condition'; // eslint-disable-next-line import/prefer-default-export
|
|
17
19
|
|
|
18
20
|
export var ConditionStep = function ConditionStep(_ref) {
|
|
21
|
+
var _step$subject2, _step$subject2$select, _step$context3, _step$context3$select;
|
|
22
|
+
|
|
19
23
|
var step = _ref.step,
|
|
20
24
|
texts = _ref.texts,
|
|
21
25
|
index = _ref.index,
|
|
@@ -35,15 +39,15 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
35
39
|
setStepConditionFactorType = _ref.setStepConditionFactorType,
|
|
36
40
|
setStepConditionFactorValue = _ref.setStepConditionFactorValue,
|
|
37
41
|
getPopupContainerOverride = _ref.getPopupContainerOverride,
|
|
38
|
-
onStepActivate = _ref.onStepActivate,
|
|
39
42
|
hasPriority = _ref.hasPriority,
|
|
40
43
|
currentStepId = _ref.currentStepId,
|
|
41
44
|
currentConditionId = _ref.currentConditionId,
|
|
42
|
-
currentField = _ref.currentField
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
currentField = _ref.currentField,
|
|
46
|
+
setCurrentField = _ref.setCurrentField,
|
|
47
|
+
setCurrentCondition = _ref.setCurrentCondition,
|
|
48
|
+
setCurrentStep = _ref.setCurrentStep,
|
|
49
|
+
onDeactivate = _ref.onDeactivate,
|
|
50
|
+
showSuffix = _ref.showSuffix;
|
|
47
51
|
|
|
48
52
|
var _useIntl = useIntl(),
|
|
49
53
|
formatMessage = _useIntl.formatMessage;
|
|
@@ -85,11 +89,15 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
85
89
|
addStep: formatMessage({
|
|
86
90
|
id: 'DS.CONDITION.ADD-STEP',
|
|
87
91
|
defaultMessage: 'Add step'
|
|
92
|
+
}),
|
|
93
|
+
conditionSuffix: formatMessage({
|
|
94
|
+
id: 'DS.CONDITION.SUFFIX',
|
|
95
|
+
defaultMessage: 'and'
|
|
88
96
|
})
|
|
89
97
|
}, texts);
|
|
90
98
|
}, [texts, formatMessage]);
|
|
91
|
-
var onActivate =
|
|
92
|
-
return
|
|
99
|
+
var onActivate = setCurrentStep ? function () {
|
|
100
|
+
return setCurrentStep(step.id);
|
|
93
101
|
} : undefined;
|
|
94
102
|
var onAddCondition = React.useCallback(function (stepId) {
|
|
95
103
|
addCondition && addCondition(stepId);
|
|
@@ -123,15 +131,17 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
123
131
|
var _step$context2;
|
|
124
132
|
|
|
125
133
|
var handleActivation = function handleActivation(conditionId) {
|
|
126
|
-
return function () {
|
|
127
|
-
setActiveConditionId(conditionId);
|
|
134
|
+
return function (fieldType) {
|
|
128
135
|
onActivate && onActivate();
|
|
136
|
+
setCurrentField && setCurrentField(fieldType);
|
|
137
|
+
setCurrentCondition && setCurrentCondition(conditionId);
|
|
138
|
+
setCurrentStep && setCurrentStep(step.id);
|
|
129
139
|
};
|
|
130
140
|
};
|
|
131
141
|
|
|
132
142
|
return /*#__PURE__*/React.createElement(ConditionRow, {
|
|
133
143
|
key: "step-" + step.id + "-condition-" + condition.id,
|
|
134
|
-
hasPriority: hasPriority &&
|
|
144
|
+
hasPriority: hasPriority && currentConditionId === condition.id,
|
|
135
145
|
index: conditionIndex,
|
|
136
146
|
conditionId: condition.id,
|
|
137
147
|
addCondition: addCondition,
|
|
@@ -155,29 +165,49 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
155
165
|
setStepConditionFactorType: setStepConditionFactorType,
|
|
156
166
|
setStepConditionFactorValue: setStepConditionFactorValue,
|
|
157
167
|
texts: text,
|
|
158
|
-
stepType: (_step$context2 = step.context) == null ? void 0 : _step$context2.type
|
|
168
|
+
stepType: (_step$context2 = step.context) == null ? void 0 : _step$context2.type,
|
|
169
|
+
onDeactivate: onDeactivate
|
|
159
170
|
});
|
|
160
|
-
}, [
|
|
171
|
+
}, [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]);
|
|
161
172
|
return /*#__PURE__*/React.createElement(S.Step, {
|
|
162
173
|
key: step.id,
|
|
163
174
|
id: "condition-step-" + step.id,
|
|
164
175
|
"data-dropLabel": text.dropLabel,
|
|
176
|
+
"data-conditionSuffix": text.conditionSuffix,
|
|
165
177
|
style: hasPriority ? {
|
|
166
178
|
zIndex: 10001
|
|
167
|
-
} : undefined
|
|
168
|
-
|
|
179
|
+
} : undefined,
|
|
180
|
+
active: step.id === currentStepId && currentField !== '',
|
|
181
|
+
showSuffix: showSuffix
|
|
182
|
+
}, !updateStepName && /*#__PURE__*/React.createElement(S.DraggedLabel, null, ((_step$subject2 = step.subject) == null ? void 0 : (_step$subject2$select = _step$subject2.selectedItem) == null ? void 0 : _step$subject2$select.name) || ((_step$context3 = step.context) == null ? void 0 : (_step$context3$select = _step$context3.selectedItem) == null ? void 0 : _step$context3$select.name)), updateStepName && stepHeader, /*#__PURE__*/React.createElement(S.StepConditions, {
|
|
169
183
|
withoutStepName: updateStepName === undefined
|
|
170
|
-
},
|
|
184
|
+
}, draggableEnabled && !updateStepName && /*#__PURE__*/React.createElement(S.DragIcon, {
|
|
185
|
+
className: "step-drag-handler",
|
|
186
|
+
component: /*#__PURE__*/React.createElement(DragHandleM, null)
|
|
187
|
+
}), /*#__PURE__*/React.createElement(S.Subject, null, step.subject && /*#__PURE__*/React.createElement(Subject, _extends({}, step.subject, {
|
|
171
188
|
getPopupContainerOverride: getPopupContainerOverride,
|
|
172
189
|
onActivate: onActivate,
|
|
190
|
+
onDeactivate: onDeactivate,
|
|
191
|
+
opened: step.id === currentStepId && currentField === SUBJECT,
|
|
173
192
|
onSelectItem: function onSelectItem(value) {
|
|
174
193
|
return selectSubject(value, step.id);
|
|
175
194
|
}
|
|
176
195
|
})), step.context && /*#__PURE__*/React.createElement(ContextSelector, _extends({}, step.context, {
|
|
177
196
|
getPopupContainerOverride: getPopupContainerOverride,
|
|
178
197
|
onActivate: onActivate,
|
|
198
|
+
onDeactivate: onDeactivate,
|
|
199
|
+
opened: step.id === currentStepId && currentField === SUBJECT,
|
|
179
200
|
onSelectItem: function onSelectItem(value) {
|
|
180
201
|
return selectContext(value, step.id);
|
|
181
202
|
}
|
|
182
|
-
}))), /*#__PURE__*/React.createElement(S.ConditionRows, null, step.conditions.length > 0 && step.conditions.map(renderConditionRow), addConditionButton)
|
|
203
|
+
}))), /*#__PURE__*/React.createElement(S.ConditionRows, null, step.conditions.length > 0 && step.conditions.map(renderConditionRow), addConditionButton), !updateStepName && /*#__PURE__*/React.createElement(S.StepConditionCruds, {
|
|
204
|
+
onDuplicate: duplicateStep ? function () {
|
|
205
|
+
return duplicateStep(step.id);
|
|
206
|
+
} : undefined,
|
|
207
|
+
onDelete: removeStep ? function () {
|
|
208
|
+
return removeStep(step.id);
|
|
209
|
+
} : undefined,
|
|
210
|
+
duplicateTooltip: text.duplicateTooltip,
|
|
211
|
+
deleteTooltip: text.removeTooltip
|
|
212
|
+
})));
|
|
183
213
|
};
|
|
@@ -28,4 +28,9 @@ export declare type ConditionStepProps = {
|
|
|
28
28
|
currentStepId: React.ReactText;
|
|
29
29
|
currentConditionId: React.ReactText;
|
|
30
30
|
currentField: React.ReactText;
|
|
31
|
+
setCurrentField: (field: string) => void;
|
|
32
|
+
setCurrentCondition: (conditionId: string) => void;
|
|
33
|
+
setCurrentStep: (stepId: React.ReactText) => void;
|
|
34
|
+
onDeactivate: () => void;
|
|
35
|
+
showSuffix?: boolean;
|
|
31
36
|
};
|
|
@@ -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,15 @@ 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: "ds-condition-step-header",
|
|
33
|
+
draggable: draggableEnabled
|
|
34
|
+
}, /*#__PURE__*/React.createElement(S.LeftSide, null, draggableEnabled && /*#__PURE__*/React.createElement(S.DragIcon, {
|
|
35
|
+
className: "step-drag-handler",
|
|
36
|
+
component: /*#__PURE__*/React.createElement(DragHandleM, null)
|
|
37
|
+
}), /*#__PURE__*/React.createElement(S.StepName, {
|
|
38
|
+
className: "ds-condition-step-name"
|
|
39
|
+
}, "" + (index + 1), ' ', /*#__PURE__*/React.createElement(InlineEdit, {
|
|
33
40
|
size: "small",
|
|
34
41
|
input: {
|
|
35
42
|
value: localName,
|
|
@@ -37,12 +44,7 @@ export var StepHeader = function StepHeader(_ref) {
|
|
|
37
44
|
placeholder: texts.stepNamePlaceholder,
|
|
38
45
|
onChange: handleChangeName
|
|
39
46
|
}
|
|
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, {
|
|
47
|
+
}))), /*#__PURE__*/React.createElement(S.StepCruds, null, /*#__PURE__*/React.createElement(Cruds, {
|
|
46
48
|
onDuplicate: duplicateStep ? function () {
|
|
47
49
|
return duplicateStep(stepId);
|
|
48
50
|
} : undefined,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-condition",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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.12.0",
|
|
37
|
+
"@synerise/ds-core": "^0.34.0",
|
|
38
38
|
"@synerise/ds-cruds": "^0.3.9",
|
|
39
|
-
"@synerise/ds-factors": "^0.
|
|
39
|
+
"@synerise/ds-factors": "^0.13.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.12",
|
|
42
|
+
"@synerise/ds-operators": "^0.9.0",
|
|
43
|
+
"@synerise/ds-subject": "^0.9.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": "4a658911645846d1e329609ba9db06a7bc64962b"
|
|
53
53
|
}
|