@synerise/ds-condition 0.20.65 → 0.21.1

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,28 @@
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.21.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.21.0...@synerise/ds-condition@0.21.1) (2024-01-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **filter:** fixed zindex issues ([71ce5bc](https://github.com/Synerise/synerise-design/commit/71ce5bcf25f2107fd1b43969d2c255e18c112b47))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.21.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.20.65...@synerise/ds-condition@0.21.0) (2023-12-14)
18
+
19
+
20
+ ### Features
21
+
22
+ * **filter:** reorder cruds in filter step conditions ([8d4019b](https://github.com/Synerise/synerise-design/commit/8d4019b49c7579000e093aabbcd31a75626d9c1c))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [0.20.65](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.20.64...@synerise/ds-condition@0.20.65) (2023-12-13)
7
29
 
8
30
  **Note:** Version bump only for package @synerise/ds-condition
@@ -1,8 +1,7 @@
1
- import * as React from 'react';
2
1
  import * as T from './Condition.types';
3
2
  export declare const OPERATOR = "operator";
4
3
  export declare const PARAMETER = "parameter";
5
4
  export declare const FACTOR = "factor";
6
5
  export declare const SUBJECT = "subject";
7
- declare const Condition: React.FC<T.ConditionProps>;
6
+ declare const Condition: (props: T.ConditionProps) => JSX.Element;
8
7
  export default Condition;
package/dist/Condition.js CHANGED
@@ -6,7 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
 
7
7
  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; }
8
8
 
9
- import * as React from 'react';
9
+ import React, { useEffect, useState, useCallback, useMemo } from 'react';
10
10
  import { useIntl } from 'react-intl';
11
11
  import { ReactSortable } from 'react-sortablejs';
12
12
  import Icon, { Add3M } from '@synerise/ds-icon';
@@ -65,7 +65,7 @@ var Condition = function Condition(props) {
65
65
  var _useIntl = useIntl(),
66
66
  formatMessage = _useIntl.formatMessage;
67
67
 
68
- var text = React.useMemo(function () {
68
+ var text = useMemo(function () {
69
69
  return _objectSpread({
70
70
  addStep: formatMessage({
71
71
  id: 'DS.CONDITION.ADD-STEP',
@@ -78,20 +78,20 @@ var Condition = function Condition(props) {
78
78
  }, texts);
79
79
  }, [texts, formatMessage]);
80
80
 
81
- var _React$useState = React.useState(DEFAULT_CONDITION),
82
- currentConditionId = _React$useState[0],
83
- setCurrentConditionId = _React$useState[1];
81
+ var _useState = useState(DEFAULT_CONDITION),
82
+ currentConditionId = _useState[0],
83
+ setCurrentConditionId = _useState[1];
84
84
 
85
- var _React$useState2 = React.useState(DEFAULT_STEP),
86
- currentStepId = _React$useState2[0],
87
- setCurrentStepId = _React$useState2[1];
85
+ var _useState2 = useState(DEFAULT_STEP),
86
+ currentStepId = _useState2[0],
87
+ setCurrentStepId = _useState2[1];
88
88
 
89
- var _React$useState3 = React.useState(autoOpenedComponent),
90
- currentField = _React$useState3[0],
91
- setCurrentField = _React$useState3[1];
89
+ var _useState3 = useState(autoOpenedComponent),
90
+ currentField = _useState3[0],
91
+ setCurrentField = _useState3[1];
92
92
 
93
93
  var prevSteps = usePrevious(steps);
94
- React.useEffect(function () {
94
+ useEffect(function () {
95
95
  if (autoOpenedComponent && steps.length && steps[0].conditions[0].operator && steps[0].conditions[0].operator.value === undefined) {
96
96
  setCurrentStepId(steps[0].id);
97
97
  setCurrentConditionId(steps[0].conditions[0].id);
@@ -99,7 +99,7 @@ var Condition = function Condition(props) {
99
99
  } // eslint-disable-next-line react-hooks/exhaustive-deps
100
100
 
101
101
  }, []);
102
- React.useEffect(function () {
102
+ useEffect(function () {
103
103
  var newConditionId = prevSteps && steps && steps.reduce(function (id, step) {
104
104
  var result = id;
105
105
  var conditions = step.conditions.map(function (condition) {
@@ -135,7 +135,7 @@ var Condition = function Condition(props) {
135
135
  setCurrentConditionId(newConditionId);
136
136
  }
137
137
  }, [currentConditionId, currentField, prevSteps, steps]);
138
- var clearConditionRow = React.useCallback(function (stepId) {
138
+ var clearConditionRow = useCallback(function (stepId) {
139
139
  var step = steps.find(function (s) {
140
140
  return s.id === stepId;
141
141
  });
@@ -163,19 +163,19 @@ var Condition = function Condition(props) {
163
163
  setCurrentField(OPERATOR);
164
164
  }
165
165
  }, [steps, removeCondition, addCondition, autoClearCondition, onChangeFactorValue, onChangeOperator, onChangeParameter]);
166
- var selectSubject = React.useCallback(function (value, stepId) {
166
+ var selectSubject = useCallback(function (value, stepId) {
167
167
  clearConditionRow(stepId);
168
168
  setCurrentStepId(stepId);
169
169
  setCurrentField(PARAMETER);
170
170
  onChangeSubject && onChangeSubject(stepId, value);
171
171
  }, [clearConditionRow, onChangeSubject]);
172
- var selectContext = React.useCallback(function (value, stepId) {
172
+ var selectContext = useCallback(function (value, stepId) {
173
173
  clearConditionRow(stepId);
174
174
  setCurrentStepId(stepId);
175
175
  setCurrentField(PARAMETER);
176
176
  onChangeContext && onChangeContext(stepId, value);
177
177
  }, [clearConditionRow, onChangeContext]);
178
- var selectParameter = React.useCallback(function (stepId, conditionId, value) {
178
+ var selectParameter = useCallback(function (stepId, conditionId, value) {
179
179
  if (conditionId && onChangeParameter) {
180
180
  autoClearCondition && onChangeOperator && onChangeOperator(stepId, conditionId, undefined);
181
181
  autoClearCondition && onChangeFactorValue && onChangeFactorValue(stepId, conditionId, undefined);
@@ -185,7 +185,7 @@ var Condition = function Condition(props) {
185
185
  setCurrentField(OPERATOR);
186
186
  }
187
187
  }, [autoClearCondition, onChangeFactorValue, onChangeOperator, onChangeParameter]);
188
- var selectOperator = React.useCallback(function (stepId, conditionId, value) {
188
+ var selectOperator = useCallback(function (stepId, conditionId, value) {
189
189
  if (conditionId && onChangeOperator) {
190
190
  autoClearCondition && onChangeFactorValue && onChangeFactorValue(stepId, conditionId, undefined);
191
191
  onChangeOperator(stepId, conditionId, value);
@@ -194,21 +194,21 @@ var Condition = function Condition(props) {
194
194
  setCurrentField(FACTOR);
195
195
  }
196
196
  }, [autoClearCondition, onChangeFactorValue, onChangeOperator]);
197
- var setStepConditionFactorType = React.useCallback(function (stepId, conditionId, factorType) {
197
+ var setStepConditionFactorType = useCallback(function (stepId, conditionId, factorType) {
198
198
  setCurrentConditionId(conditionId);
199
199
  setCurrentStepId(stepId);
200
200
  setCurrentField(FACTOR);
201
201
  onChangeFactorType && onChangeFactorType(stepId, conditionId, factorType);
202
202
  }, [onChangeFactorType]);
203
- var setStepConditionFactorValue = React.useCallback(function (stepId, conditionId, value) {
203
+ var setStepConditionFactorValue = useCallback(function (stepId, conditionId, value) {
204
204
  setCurrentField(DEFAULT_FIELD);
205
205
  setCurrentStepId(stepId);
206
206
  onChangeFactorValue && onChangeFactorValue(stepId, conditionId, value);
207
207
  }, [onChangeFactorValue]);
208
- var draggableEnabled = React.useMemo(function () {
208
+ var draggableEnabled = useMemo(function () {
209
209
  return onChangeOrder && steps.length > 1;
210
210
  }, [steps, onChangeOrder]);
211
- var handleAddStep = React.useCallback(function () {
211
+ var handleAddStep = useCallback(function () {
212
212
  var newStepId = addStep ? addStep() : undefined;
213
213
 
214
214
  if (newStepId) {
@@ -216,7 +216,7 @@ var Condition = function Condition(props) {
216
216
  setCurrentField(SUBJECT);
217
217
  }
218
218
  }, [addStep]);
219
- var handleAddCondition = React.useMemo(function () {
219
+ var handleAddCondition = useMemo(function () {
220
220
  if (!addCondition) {
221
221
  return undefined;
222
222
  }
@@ -231,13 +231,13 @@ var Condition = function Condition(props) {
231
231
  }
232
232
  };
233
233
  }, [addCondition]);
234
- var handleClearActiveCondition = React.useCallback(function () {
234
+ var handleClearActiveCondition = useCallback(function () {
235
235
  onDeactivate && onDeactivate(currentStepId, currentConditionId);
236
236
  setCurrentConditionId(DEFAULT_CONDITION);
237
237
  setCurrentStepId(DEFAULT_STEP);
238
238
  setCurrentField(DEFAULT_FIELD);
239
239
  }, [currentConditionId, currentStepId, onDeactivate]);
240
- return React.useMemo(function () {
240
+ return useMemo(function () {
241
241
  return /*#__PURE__*/React.createElement(S.Condition, {
242
242
  className: "ds-conditions",
243
243
  "data-popup-container": true
@@ -285,7 +285,7 @@ var Condition = function Condition(props) {
285
285
  }, /*#__PURE__*/React.createElement(Icon, {
286
286
  component: /*#__PURE__*/React.createElement(Add3M, null)
287
287
  }), text.addStep)), !readOnly && renderAddStep && /*#__PURE__*/React.createElement(S.AddStepButton, null, renderAddStep()));
288
- }, [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, inputProps, readOnly]);
288
+ }, [steps, onChangeOrder, addStep, handleAddStep, text, readOnly, renderAddStep, currentStepId, getPopupContainerOverride, draggableEnabled, selectOperator, selectParameter, selectContext, selectSubject, onUpdateStepName, duplicateStep, removeStep, minConditionsLength, maxConditionsLength, setStepConditionFactorType, setStepConditionFactorValue, currentConditionId, currentField, removeCondition, handleAddCondition, handleClearActiveCondition, showSuffix, hoverDisabled, inputProps]);
289
289
  };
290
290
 
291
291
  export default Condition;
@@ -132,10 +132,8 @@ export var ConditionConnections = styled.span.withConfig({
132
132
  export var ConditionRow = styled.div.withConfig({
133
133
  displayName: "Conditionstyle__ConditionRow",
134
134
  componentId: "sc-1lk06p3-22"
135
- })(["padding-bottom:", ";z-index:", ";display:flex;", "{height:", ";", "}}", "{margin-right:8px;&:last-of-type{margin-right:0;}}&:hover{", "{opacity:1;visibility:visible;pointer-events:all;cursor:pointer;}}"], function (props) {
135
+ })(["padding-bottom:", ";display:flex;", "{height:", ";", "}}", "{margin-right:8px;&:last-of-type{margin-right:0;}}&:hover{", "{opacity:1;visibility:visible;pointer-events:all;cursor:pointer;}}"], function (props) {
136
136
  return props.stepType === 'event' ? '16px' : '0';
137
- }, function (props) {
138
- return 10000 - props.index;
139
137
  }, ConditionConnections, function (props) {
140
138
  return props.withError ? 'auto' : '32px';
141
139
  }, function (props) {
@@ -1,28 +1,29 @@
1
- import * as React from 'react';
1
+ import { ReactText, ReactNode } from 'react';
2
2
  import { SubjectItem, SubjectProps } from '@synerise/ds-subject/dist/Subject.types';
3
3
  import { FactorsProps, FactorType, FactorValueType, InputProps } from '@synerise/ds-factors/dist/Factors.types';
4
4
  import { OperatorsItem, OperatorsProps } from '@synerise/ds-operators/dist/Operator.types';
5
5
  import { ContextGroup, ContextItem, ContextProps } from '@synerise/ds-context-selector/dist/ContextSelector.types';
6
+ import type { ConditionStepCrudActions } from './ConditionStep/ConditionStep.types';
6
7
  export type StepConditions = {
7
- id: React.ReactText;
8
+ id: ReactText;
8
9
  parameter?: Omit<FactorsProps, 'onChangeValue'>;
9
10
  operator?: Omit<OperatorsProps, 'onChange'>;
10
11
  factor?: Omit<FactorsProps, 'onChangeValue' | 'setSelectedFactorType'>;
11
12
  };
12
13
  export type ConditionStep = {
13
- id: React.ReactText;
14
+ id: ReactText;
14
15
  subject?: Omit<SubjectProps, 'onSelectItem'>;
15
16
  context?: Omit<ContextProps, 'onSelectItem'>;
16
17
  stepName?: string;
17
18
  conditions: StepConditions[];
18
- addConditionErrorText?: React.ReactNode | string;
19
+ addConditionErrorText?: ReactNode;
19
20
  };
20
21
  export type ConditionTexts = {
21
22
  stepNamePlaceholder: string;
22
23
  removeConditionRowTooltip: string;
23
24
  addFirstConditionRowButton: string;
24
25
  addConditionRowButton: string;
25
- addStep: string | React.ReactNode;
26
+ addStep: ReactNode;
26
27
  dropLabel: string;
27
28
  moveTooltip: string;
28
29
  duplicateTooltip: string;
@@ -32,29 +33,27 @@ export type ConditionTexts = {
32
33
  export type ConditionProps = {
33
34
  steps: ConditionStep[];
34
35
  getPopupContainerOverride?: (trigger: HTMLElement | null) => HTMLElement;
35
- addCondition?: (stepId: React.ReactText) => string | void;
36
- renderAddStep?: () => React.ReactNode;
37
- removeCondition?: (stepId: React.ReactText, conditionRowId: React.ReactText) => void;
38
- removeStep?: (stepId: React.ReactText) => void;
39
- duplicateStep?: (stepId: React.ReactText) => void;
36
+ addCondition?: (stepId: ReactText) => string | void;
37
+ renderAddStep?: () => ReactNode;
38
+ removeCondition?: (stepId: ReactText, conditionRowId: ReactText) => void;
40
39
  addStep?: () => string | void;
41
40
  onChangeOrder?: (newOrder: ConditionStep[]) => void;
42
41
  texts?: Partial<ConditionTexts>;
43
42
  minConditionsLength: number;
44
43
  maxConditionsLength?: number | undefined;
45
44
  autoClearCondition?: boolean;
46
- onChangeContext: (stepId: React.ReactText, value: ContextItem | ContextGroup | undefined) => void;
47
- onChangeSubject: (stepId: React.ReactText, value: SubjectItem | undefined) => void;
48
- onChangeParameter: (stepId: React.ReactText, conditionId: React.ReactText, value: FactorValueType | undefined) => void;
49
- onChangeOperator: (stepId: React.ReactText, conditionId: React.ReactText, value: OperatorsItem | undefined) => void;
50
- onChangeFactorValue: (stepId: React.ReactText, conditionId: React.ReactText, value: FactorValueType | undefined) => void;
51
- onChangeFactorType: (stepId: React.ReactText, conditionId: React.ReactText, value: FactorType | undefined) => void;
52
- onUpdateStepName?: (stepId: React.ReactText, value: string) => void;
45
+ onChangeContext: (stepId: ReactText, value: ContextItem | ContextGroup | undefined) => void;
46
+ onChangeSubject: (stepId: ReactText, value: SubjectItem | undefined) => void;
47
+ onChangeParameter: (stepId: ReactText, conditionId: ReactText, value: FactorValueType | undefined) => void;
48
+ onChangeOperator: (stepId: ReactText, conditionId: ReactText, value: OperatorsItem | undefined) => void;
49
+ onChangeFactorValue: (stepId: ReactText, conditionId: ReactText, value: FactorValueType | undefined) => void;
50
+ onChangeFactorType: (stepId: ReactText, conditionId: ReactText, value: FactorType | undefined) => void;
51
+ onUpdateStepName?: (stepId: ReactText, value: string) => void;
53
52
  type?: 'attribute' | 'event';
54
53
  showSuffix?: boolean;
55
54
  hoverDisabled?: boolean;
56
55
  autoOpenedComponent?: 'subject' | 'operator' | 'factor' | 'parameter' | 'context';
57
56
  inputProps?: Partial<InputProps>;
58
- onDeactivate?: (currentStepId: React.ReactText, currentConditionId: React.ReactText) => void;
57
+ onDeactivate?: (currentStepId: ReactText, currentConditionId: ReactText) => void;
59
58
  readOnly?: boolean;
60
- };
59
+ } & ConditionStepCrudActions;
@@ -5,6 +5,7 @@ import Operators from '@synerise/ds-operators';
5
5
  import Tooltip from '@synerise/ds-tooltip';
6
6
  import Icon, { CloseS } from '@synerise/ds-icon';
7
7
  import { theme } from '@synerise/ds-core';
8
+ import { getPopupContainer } from '@synerise/ds-utils';
8
9
  import * as React from 'react';
9
10
  import { FACTOR, OPERATOR, PARAMETER } from '../../Condition';
10
11
  import * as S from '../../Condition.style';
@@ -68,7 +69,7 @@ export var ConditionRow = function ConditionRow(_ref) {
68
69
  readOnly: readOnly
69
70
  }), /*#__PURE__*/React.createElement(S.ConditionRowLine, null, /*#__PURE__*/React.createElement(S.ConditionRowDefinition, null, /*#__PURE__*/React.createElement(S.ConditionWrapper, null, conditionParameter && /*#__PURE__*/React.createElement(Factors, _extends({}, conditionParameter, {
70
71
  inputProps: inputProps,
71
- getPopupContainerOverride: getPopupContainerOverride,
72
+ getPopupContainerOverride: getPopupContainerOverride || getPopupContainer,
72
73
  onActivate: function onActivate() {
73
74
  return _onActivate && _onActivate(PARAMETER);
74
75
  },
@@ -80,7 +81,7 @@ export var ConditionRow = function ConditionRow(_ref) {
80
81
  readOnly: readOnly,
81
82
  error: Boolean(conditionParameter.errorText)
82
83
  }))), (!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, {
83
- getPopupContainerOverride: getPopupContainerOverride,
84
+ getPopupContainerOverride: getPopupContainerOverride || getPopupContainer,
84
85
  onActivate: function onActivate() {
85
86
  return _onActivate && _onActivate(OPERATOR);
86
87
  },
@@ -95,7 +96,7 @@ export var ConditionRow = function ConditionRow(_ref) {
95
96
  fullWidth: true
96
97
  }, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({}, conditionFactor, {
97
98
  inputProps: inputProps,
98
- getPopupContainerOverride: getPopupContainerOverride,
99
+ getPopupContainerOverride: getPopupContainerOverride || getPopupContainer,
99
100
  onActivate: function onActivate() {
100
101
  return _onActivate && _onActivate(FACTOR);
101
102
  },
@@ -1,3 +1,2 @@
1
- import * as React from 'react';
2
1
  import * as T from './ConditionStep.types';
3
- export declare const ConditionStep: React.FC<T.ConditionStepProps>;
2
+ export declare const ConditionStep: ({ step, texts, index, addCondition, removeCondition, updateStepName, removeStep, duplicateStep, minConditionsLength, maxConditionsLength, draggableEnabled, selectSubject, selectContext, selectOperator, selectParameter, setStepConditionFactorType, setStepConditionFactorValue, getPopupContainerOverride, hasPriority, currentStepId, currentConditionId, currentField, setCurrentField, setCurrentCondition, setCurrentStep, onDeactivate, showSuffix, hoverDisabled, inputProps, readOnly, }: T.ConditionStepProps) => JSX.Element;
@@ -6,7 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
 
7
7
  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; }
8
8
 
9
- import * as React from 'react';
9
+ import React, { useCallback, useMemo } 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';
@@ -15,8 +15,7 @@ import * as S from '../Condition.style';
15
15
  import { StepHeader } from './StepHeader';
16
16
  import { AddCondition } from './AddCondition';
17
17
  import { ConditionRow } from './ConditionRow';
18
- import { SUBJECT } from '../Condition'; // eslint-disable-next-line import/prefer-default-export
19
-
18
+ import { SUBJECT } from '../Condition';
20
19
  export var ConditionStep = function ConditionStep(_ref) {
21
20
  var _step$subject2, _step$subject2$select, _step$context3, _step$context3$select;
22
21
 
@@ -56,7 +55,7 @@ export var ConditionStep = function ConditionStep(_ref) {
56
55
  var _useIntl = useIntl(),
57
56
  formatMessage = _useIntl.formatMessage;
58
57
 
59
- var text = React.useMemo(function () {
58
+ var text = useMemo(function () {
60
59
  return _objectSpread({
61
60
  stepNamePlaceholder: formatMessage({
62
61
  id: 'DS.CONDITION.STEP_NAME-PLACEHOLDER',
@@ -100,16 +99,16 @@ export var ConditionStep = function ConditionStep(_ref) {
100
99
  })
101
100
  }, texts);
102
101
  }, [texts, formatMessage]);
103
- var onActivate = React.useCallback(function () {
102
+ var onActivate = useCallback(function () {
104
103
  return setCurrentStep ? function () {
105
104
  return setCurrentStep(step.id);
106
105
  } : undefined;
107
106
  }, [step.id, setCurrentStep]);
108
- var onAddCondition = React.useCallback(function (stepId) {
107
+ var onAddCondition = useCallback(function (stepId) {
109
108
  addCondition && addCondition(stepId);
110
109
  onActivate && onActivate();
111
110
  }, [addCondition, onActivate]);
112
- var stepHeader = React.useMemo(function () {
111
+ var stepHeader = useMemo(function () {
113
112
  return /*#__PURE__*/React.createElement(StepHeader, {
114
113
  index: index,
115
114
  stepId: step.id,
@@ -122,7 +121,7 @@ export var ConditionStep = function ConditionStep(_ref) {
122
121
  readOnly: readOnly
123
122
  });
124
123
  }, [draggableEnabled, duplicateStep, index, removeStep, step.id, step.stepName, text, updateStepName, readOnly]);
125
- var addConditionButton = React.useMemo(function () {
124
+ var addConditionButton = useMemo(function () {
126
125
  var _step$subject, _step$context;
127
126
 
128
127
  return !readOnly && addCondition && (maxConditionsLength === undefined || step.conditions.length < maxConditionsLength) && /*#__PURE__*/React.createElement(AddCondition, {
@@ -135,7 +134,7 @@ export var ConditionStep = function ConditionStep(_ref) {
135
134
  selectedContext: Boolean((_step$context = step.context) == null ? void 0 : _step$context.selectedItem)
136
135
  });
137
136
  }, [addCondition, onAddCondition, maxConditionsLength, step.conditions.length, step.context, step.id, step.subject, text, readOnly, step.addConditionErrorText]);
138
- var renderConditionRow = React.useCallback(function (condition, conditionIndex) {
137
+ var renderConditionRow = useCallback(function (condition, conditionIndex) {
139
138
  var _step$context2;
140
139
 
141
140
  var handleActivation = function handleActivation(conditionId) {
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { ReactText } from 'react';
2
2
  import { FactorType, FactorValueType, InputProps } from '@synerise/ds-factors/dist/Factors.types';
3
3
  import { ContextGroup, ContextItem } from '@synerise/ds-context-selector/dist/ContextSelector.types';
4
4
  import { SubjectItem } from '@synerise/ds-subject/dist/Subject.types';
@@ -8,32 +8,34 @@ export type ConditionStepProps = {
8
8
  index: number;
9
9
  step: ConditionStep;
10
10
  hasPriority?: boolean;
11
- onStepActivate?: (stepid: React.ReactText) => void;
11
+ onStepActivate?: (stepid: ReactText) => void;
12
12
  getPopupContainerOverride?: ConditionProps['getPopupContainerOverride'];
13
- addCondition?: (stepId: React.ReactText) => void;
14
- removeCondition?: (stepId: React.ReactText, conditionRowId: React.ReactText) => void;
15
- updateStepName?: (stepId: React.ReactText, value: string) => void;
16
- removeStep?: (stepId: React.ReactText) => void;
17
- duplicateStep?: (stepId: React.ReactText) => void;
13
+ addCondition?: (stepId: ReactText) => void;
14
+ removeCondition?: (stepId: ReactText, conditionRowId: ReactText) => void;
15
+ updateStepName?: (stepId: ReactText, value: string) => void;
18
16
  texts?: Partial<ConditionTexts>;
19
17
  minConditionsLength: number;
20
18
  maxConditionsLength: number | undefined;
21
19
  draggableEnabled?: boolean;
22
- selectSubject: (value: SubjectItem, stepId: React.ReactText) => void;
23
- selectContext: (value: ContextItem | ContextGroup | undefined, stepId: React.ReactText) => void;
24
- selectParameter: (stepId: React.ReactText, condition: React.ReactText, value: FactorValueType | undefined) => void;
25
- selectOperator: (stepId: React.ReactText, condition: React.ReactText, value: OperatorsItem | OperatorsGroup | undefined) => void;
26
- setStepConditionFactorType: (stepId: React.ReactText, condition: React.ReactText, factorType: FactorType | undefined) => void;
27
- setStepConditionFactorValue: (stepId: React.ReactText, condition: React.ReactText, value: FactorValueType) => void;
28
- currentStepId: React.ReactText;
29
- currentConditionId: React.ReactText;
30
- currentField: React.ReactText;
20
+ selectSubject: (value: SubjectItem, stepId: ReactText) => void;
21
+ selectContext: (value: ContextItem | ContextGroup | undefined, stepId: ReactText) => void;
22
+ selectParameter: (stepId: ReactText, condition: ReactText, value: FactorValueType | undefined) => void;
23
+ selectOperator: (stepId: ReactText, condition: ReactText, value: OperatorsItem | OperatorsGroup | undefined) => void;
24
+ setStepConditionFactorType: (stepId: ReactText, condition: ReactText, factorType: FactorType | undefined) => void;
25
+ setStepConditionFactorValue: (stepId: ReactText, condition: ReactText, value: FactorValueType) => void;
26
+ currentStepId: ReactText;
27
+ currentConditionId: ReactText;
28
+ currentField: ReactText;
31
29
  setCurrentField: (field: string) => void;
32
30
  setCurrentCondition: (conditionId: string) => void;
33
- setCurrentStep: (stepId: React.ReactText) => void;
31
+ setCurrentStep: (stepId: ReactText) => void;
34
32
  onDeactivate: () => void;
35
33
  showSuffix?: boolean;
36
34
  hoverDisabled?: boolean;
37
35
  inputProps?: Partial<InputProps>;
38
36
  readOnly?: boolean;
37
+ } & ConditionStepCrudActions;
38
+ export type ConditionStepCrudActions = {
39
+ removeStep?: (stepId: ReactText) => void;
40
+ duplicateStep?: (stepId: ReactText) => void;
39
41
  };
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { default } from './Condition';
2
+ export type { ConditionStepCrudActions } from './ConditionStep/ConditionStep.types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-condition",
3
- "version": "0.20.65",
3
+ "version": "0.21.1",
4
4
  "description": "Condition UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -33,16 +33,16 @@
33
33
  ],
34
34
  "types": "dist/index.d.ts",
35
35
  "dependencies": {
36
- "@synerise/ds-button": "^0.18.9",
37
- "@synerise/ds-context-selector": "^0.19.22",
36
+ "@synerise/ds-button": "^0.18.10",
37
+ "@synerise/ds-context-selector": "^0.19.24",
38
38
  "@synerise/ds-core": "^0.40.9",
39
- "@synerise/ds-cruds": "^0.3.43",
40
- "@synerise/ds-factors": "^0.20.15",
41
- "@synerise/ds-icon": "^0.58.9",
42
- "@synerise/ds-inline-edit": "^0.6.91",
43
- "@synerise/ds-operators": "^0.10.50",
44
- "@synerise/ds-subject": "^0.9.78",
45
- "@synerise/ds-tooltip": "^0.14.13",
39
+ "@synerise/ds-cruds": "^0.4.1",
40
+ "@synerise/ds-factors": "^0.20.17",
41
+ "@synerise/ds-icon": "^0.59.0",
42
+ "@synerise/ds-inline-edit": "^0.6.92",
43
+ "@synerise/ds-operators": "^0.10.51",
44
+ "@synerise/ds-subject": "^0.9.79",
45
+ "@synerise/ds-tooltip": "^0.14.14",
46
46
  "@synerise/ds-utils": "^0.24.23",
47
47
  "lodash": "^4.17.19",
48
48
  "react-intl": "3.12.0",
@@ -59,5 +59,5 @@
59
59
  "@testing-library/react": "10.0.1",
60
60
  "uuid": "^8.3.2"
61
61
  },
62
- "gitHead": "76edb4723a30c59f1a54f666f66fcd814de0af70"
62
+ "gitHead": "ba51e38beff83b8adba409f09311131f429ada01"
63
63
  }