@synerise/ds-condition 0.20.65 → 0.21.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 +11 -0
- package/dist/Condition.d.ts +1 -2
- package/dist/Condition.js +26 -26
- package/dist/Condition.types.d.ts +18 -19
- package/dist/ConditionStep/ConditionStep.d.ts +1 -2
- package/dist/ConditionStep/ConditionStep.js +8 -9
- package/dist/ConditionStep/ConditionStep.types.d.ts +19 -17
- package/dist/index.d.ts +1 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.20.65...@synerise/ds-condition@0.21.0) (2023-12-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **filter:** reorder cruds in filter step conditions ([8d4019b](https://github.com/Synerise/synerise-design/commit/8d4019b49c7579000e093aabbcd31a75626d9c1c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [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
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-condition
|
package/dist/Condition.d.ts
CHANGED
|
@@ -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:
|
|
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
|
|
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 =
|
|
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
|
|
82
|
-
currentConditionId =
|
|
83
|
-
setCurrentConditionId =
|
|
81
|
+
var _useState = useState(DEFAULT_CONDITION),
|
|
82
|
+
currentConditionId = _useState[0],
|
|
83
|
+
setCurrentConditionId = _useState[1];
|
|
84
84
|
|
|
85
|
-
var
|
|
86
|
-
currentStepId =
|
|
87
|
-
setCurrentStepId =
|
|
85
|
+
var _useState2 = useState(DEFAULT_STEP),
|
|
86
|
+
currentStepId = _useState2[0],
|
|
87
|
+
setCurrentStepId = _useState2[1];
|
|
88
88
|
|
|
89
|
-
var
|
|
90
|
-
currentField =
|
|
91
|
-
setCurrentField =
|
|
89
|
+
var _useState3 = useState(autoOpenedComponent),
|
|
90
|
+
currentField = _useState3[0],
|
|
91
|
+
setCurrentField = _useState3[1];
|
|
92
92
|
|
|
93
93
|
var prevSteps = usePrevious(steps);
|
|
94
|
-
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
208
|
+
var draggableEnabled = useMemo(function () {
|
|
209
209
|
return onChangeOrder && steps.length > 1;
|
|
210
210
|
}, [steps, onChangeOrder]);
|
|
211
|
-
var handleAddStep =
|
|
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 =
|
|
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 =
|
|
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
|
|
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
|
|
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;
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import
|
|
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:
|
|
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:
|
|
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?:
|
|
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:
|
|
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:
|
|
36
|
-
renderAddStep?: () =>
|
|
37
|
-
removeCondition?: (stepId:
|
|
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:
|
|
47
|
-
onChangeSubject: (stepId:
|
|
48
|
-
onChangeParameter: (stepId:
|
|
49
|
-
onChangeOperator: (stepId:
|
|
50
|
-
onChangeFactorValue: (stepId:
|
|
51
|
-
onChangeFactorType: (stepId:
|
|
52
|
-
onUpdateStepName?: (stepId:
|
|
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:
|
|
57
|
+
onDeactivate?: (currentStepId: ReactText, currentConditionId: ReactText) => void;
|
|
59
58
|
readOnly?: boolean;
|
|
60
|
-
};
|
|
59
|
+
} & ConditionStepCrudActions;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as T from './ConditionStep.types';
|
|
3
|
-
export declare const ConditionStep:
|
|
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
|
|
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';
|
|
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 =
|
|
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 =
|
|
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 =
|
|
107
|
+
var onAddCondition = useCallback(function (stepId) {
|
|
109
108
|
addCondition && addCondition(stepId);
|
|
110
109
|
onActivate && onActivate();
|
|
111
110
|
}, [addCondition, onActivate]);
|
|
112
|
-
var stepHeader =
|
|
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 =
|
|
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 =
|
|
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
|
|
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:
|
|
11
|
+
onStepActivate?: (stepid: ReactText) => void;
|
|
12
12
|
getPopupContainerOverride?: ConditionProps['getPopupContainerOverride'];
|
|
13
|
-
addCondition?: (stepId:
|
|
14
|
-
removeCondition?: (stepId:
|
|
15
|
-
updateStepName?: (stepId:
|
|
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:
|
|
23
|
-
selectContext: (value: ContextItem | ContextGroup | undefined, stepId:
|
|
24
|
-
selectParameter: (stepId:
|
|
25
|
-
selectOperator: (stepId:
|
|
26
|
-
setStepConditionFactorType: (stepId:
|
|
27
|
-
setStepConditionFactorValue: (stepId:
|
|
28
|
-
currentStepId:
|
|
29
|
-
currentConditionId:
|
|
30
|
-
currentField:
|
|
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:
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-condition",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Condition UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"types": "dist/index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@synerise/ds-button": "^0.18.9",
|
|
37
|
-
"@synerise/ds-context-selector": "^0.19.
|
|
37
|
+
"@synerise/ds-context-selector": "^0.19.23",
|
|
38
38
|
"@synerise/ds-core": "^0.40.9",
|
|
39
|
-
"@synerise/ds-cruds": "^0.
|
|
40
|
-
"@synerise/ds-factors": "^0.20.
|
|
39
|
+
"@synerise/ds-cruds": "^0.4.0",
|
|
40
|
+
"@synerise/ds-factors": "^0.20.16",
|
|
41
41
|
"@synerise/ds-icon": "^0.58.9",
|
|
42
42
|
"@synerise/ds-inline-edit": "^0.6.91",
|
|
43
43
|
"@synerise/ds-operators": "^0.10.50",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"@testing-library/react": "10.0.1",
|
|
60
60
|
"uuid": "^8.3.2"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "0a23e5f431033a6180383d3e0e19e885b5a66778"
|
|
63
63
|
}
|