@synerise/ds-condition 1.0.0 → 1.0.2
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 +16 -0
- package/dist/Condition.js +9 -1
- package/dist/Condition.types.d.ts +17 -5
- package/dist/ConditionStep/ConditionRow/ConditionRow.d.ts +1 -1
- package/dist/ConditionStep/ConditionRow/ConditionRow.js +21 -3
- package/dist/ConditionStep/ConditionRow/ConditionRow.types.d.ts +13 -15
- package/dist/ConditionStep/ConditionStep.d.ts +1 -1
- package/dist/ConditionStep/ConditionStep.js +39 -13
- package/dist/ConditionStep/ConditionStep.types.d.ts +7 -20
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
## [1.0.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@1.0.1...@synerise/ds-condition@1.0.2) (2025-03-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-condition
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.0.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@1.0.0...@synerise/ds-condition@1.0.1) (2025-03-18)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @synerise/ds-condition
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.27.14](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.27.13...@synerise/ds-condition@0.27.14) (2025-03-10)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @synerise/ds-condition
|
package/dist/Condition.js
CHANGED
|
@@ -41,6 +41,10 @@ var Condition = function Condition(props) {
|
|
|
41
41
|
singleStepCondition = props.singleStepCondition,
|
|
42
42
|
showActionAttribute = props.showActionAttribute,
|
|
43
43
|
onChangeActionAttribute = props.onChangeActionAttribute,
|
|
44
|
+
contextSelectorComponent = props.contextSelectorComponent,
|
|
45
|
+
parameterSelectorComponent = props.parameterSelectorComponent,
|
|
46
|
+
factorParameterSelectorComponent = props.factorParameterSelectorComponent,
|
|
47
|
+
actionAttributeParameterSelectorComponent = props.actionAttributeParameterSelectorComponent,
|
|
44
48
|
_props$showEmptyCondi = props.showEmptyConditionPlaceholder,
|
|
45
49
|
showEmptyConditionPlaceholder = _props$showEmptyCondi === void 0 ? false : _props$showEmptyCondi;
|
|
46
50
|
var _useIntl = useIntl(),
|
|
@@ -233,6 +237,10 @@ var Condition = function Condition(props) {
|
|
|
233
237
|
step: step,
|
|
234
238
|
texts: text,
|
|
235
239
|
index: index,
|
|
240
|
+
contextSelectorComponent: contextSelectorComponent,
|
|
241
|
+
parameterSelectorComponent: parameterSelectorComponent,
|
|
242
|
+
factorParameterSelectorComponent: factorParameterSelectorComponent,
|
|
243
|
+
actionAttributeParameterSelectorComponent: actionAttributeParameterSelectorComponent,
|
|
236
244
|
hasPriority: step.id === currentStepId,
|
|
237
245
|
getPopupContainerOverride: getPopupContainerOverride,
|
|
238
246
|
draggableEnabled: draggableEnabled,
|
|
@@ -272,6 +280,6 @@ var Condition = function Condition(props) {
|
|
|
272
280
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
273
281
|
component: /*#__PURE__*/React.createElement(Add3M, null)
|
|
274
282
|
}), text.addStep)), !readOnly && renderAddStep && /*#__PURE__*/React.createElement(S.AddStepButton, null, renderAddStep()));
|
|
275
|
-
}, [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, singleStepCondition,
|
|
283
|
+
}, [steps, onChangeOrder, addStep, handleAddStep, text, readOnly, renderAddStep, contextSelectorComponent, parameterSelectorComponent, factorParameterSelectorComponent, actionAttributeParameterSelectorComponent, currentStepId, getPopupContainerOverride, draggableEnabled, selectOperator, selectParameter, selectContext, selectSubject, selectActionAttribute, onUpdateStepName, duplicateStep, removeStep, minConditionsLength, maxConditionsLength, setStepConditionFactorType, setStepConditionFactorValue, currentConditionId, currentField, removeCondition, handleAddCondition, handleClearActiveCondition, showSuffix, hoverDisabled, inputProps, singleStepCondition, showActionAttribute, showEmptyConditionPlaceholder]);
|
|
276
284
|
};
|
|
277
285
|
export default Condition;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactText, ReactNode } from 'react';
|
|
2
|
-
import { SubjectItem, SubjectProps } from '@synerise/ds-subject
|
|
3
|
-
import { FactorsProps, FactorType, FactorValueType, InputProps } from '@synerise/ds-factors
|
|
4
|
-
import { OperatorsItem, OperatorsProps } from '@synerise/ds-operators
|
|
5
|
-
import { ContextGroup, ContextItem, ContextProps } from '@synerise/ds-context-selector
|
|
1
|
+
import type { ReactText, ReactNode, ComponentType } from 'react';
|
|
2
|
+
import type { SubjectItem, SubjectProps } from '@synerise/ds-subject';
|
|
3
|
+
import type { FactorsProps, FactorType, FactorValueComponentProps, FactorValueType, InputProps, ParameterValueType } from '@synerise/ds-factors';
|
|
4
|
+
import type { OperatorsItem, OperatorsProps } from '@synerise/ds-operators';
|
|
5
|
+
import type { ContextGroup, ContextItem, ContextProps } from '@synerise/ds-context-selector';
|
|
6
6
|
import type { ConditionStepCrudActions } from './ConditionStep/ConditionStep.types';
|
|
7
7
|
export type StepConditions = {
|
|
8
8
|
id: ReactText;
|
|
@@ -33,6 +33,14 @@ export type ConditionTexts = {
|
|
|
33
33
|
stepNamePrefix: string;
|
|
34
34
|
emptyConditionLabel: string;
|
|
35
35
|
};
|
|
36
|
+
export type CustomContextSelectorProps = Pick<ContextProps, 'onActivate' | 'onDeactivate' | 'onSelectItem' | 'selectedItem' | 'opened' | 'readOnly'> & {
|
|
37
|
+
getPopupContainer: ContextProps['getPopupContainerOverride'];
|
|
38
|
+
};
|
|
39
|
+
export type CustomParameterSelectorProps = Pick<FactorsProps, 'onActivate' | 'onDeactivate' | 'opened' | 'readOnly'> & {
|
|
40
|
+
getPopupContainer: FactorsProps['getPopupContainerOverride'];
|
|
41
|
+
onSelectItem: FactorsProps['onChangeValue'];
|
|
42
|
+
selectedItem?: ParameterValueType;
|
|
43
|
+
};
|
|
36
44
|
export type ConditionProps = {
|
|
37
45
|
steps: ConditionStep[];
|
|
38
46
|
getPopupContainerOverride?: (trigger: HTMLElement | null) => HTMLElement;
|
|
@@ -45,6 +53,10 @@ export type ConditionProps = {
|
|
|
45
53
|
minConditionsLength: number;
|
|
46
54
|
maxConditionsLength?: number | undefined;
|
|
47
55
|
autoClearCondition?: boolean;
|
|
56
|
+
contextSelectorComponent?: ComponentType<CustomContextSelectorProps>;
|
|
57
|
+
parameterSelectorComponent?: ComponentType<FactorValueComponentProps>;
|
|
58
|
+
factorParameterSelectorComponent?: ComponentType<FactorValueComponentProps>;
|
|
59
|
+
actionAttributeParameterSelectorComponent?: ComponentType<FactorValueComponentProps>;
|
|
48
60
|
onChangeContext: (stepId: ReactText, value: ContextItem | ContextGroup | undefined) => void;
|
|
49
61
|
onChangeSubject: (stepId: ReactText, value: SubjectItem | undefined) => void;
|
|
50
62
|
onChangeParameter: (stepId: ReactText, conditionId: ReactText, value: FactorValueType | undefined) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import * as T from './ConditionRow.types';
|
|
3
|
-
export declare const ConditionRow: ({ index, conditionId, conditionParameter, conditionOperator, conditionFactor, removeCondition, addCondition, minConditionLength, maxConditionLength, conditionsNumber, stepId, currentStepId, currentConditionId, currentField, selectParameter, selectOperator, setStepConditionFactorType, setStepConditionFactorValue, getPopupContainerOverride, onActivate, hasPriority, texts, onDeactivate, inputProps, readOnly, }: T.ConditionRowProps) => React.JSX.Element;
|
|
3
|
+
export declare const ConditionRow: ({ index, conditionId, conditionParameter, conditionOperator, conditionFactor, removeCondition, addCondition, minConditionLength, maxConditionLength, conditionsNumber, stepId, currentStepId, currentConditionId, currentField, selectParameter, selectOperator, setStepConditionFactorType, setStepConditionFactorValue, getPopupContainerOverride, onActivate, hasPriority, texts, onDeactivate, inputProps, readOnly, parameterSelectorComponent, factorParameterSelectorComponent, }: T.ConditionRowProps) => React.JSX.Element;
|
|
@@ -34,7 +34,9 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
34
34
|
onDeactivate = _ref.onDeactivate,
|
|
35
35
|
inputProps = _ref.inputProps,
|
|
36
36
|
_ref$readOnly = _ref.readOnly,
|
|
37
|
-
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly
|
|
37
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
38
|
+
parameterSelectorComponent = _ref.parameterSelectorComponent,
|
|
39
|
+
factorParameterSelectorComponent = _ref.factorParameterSelectorComponent;
|
|
38
40
|
var conditionFactorErrorText = conditionFactor == null ? void 0 : conditionFactor.errorText;
|
|
39
41
|
var conditionParameterErrorText = conditionParameter == null ? void 0 : conditionParameter.errorText;
|
|
40
42
|
var conditionOperatorErrorText = conditionOperator == null ? void 0 : conditionOperator.errorText;
|
|
@@ -100,7 +102,15 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
100
102
|
}, renderConditionParameterWrapper && /*#__PURE__*/React.createElement(Factors, _extends({
|
|
101
103
|
selectedFactorType: "",
|
|
102
104
|
defaultFactorType: "",
|
|
103
|
-
value: ""
|
|
105
|
+
value: "",
|
|
106
|
+
customFactorValueComponents: parameterSelectorComponent && {
|
|
107
|
+
parameter: {
|
|
108
|
+
component: parameterSelectorComponent
|
|
109
|
+
},
|
|
110
|
+
contextParameter: {
|
|
111
|
+
component: parameterSelectorComponent
|
|
112
|
+
}
|
|
113
|
+
}
|
|
104
114
|
}, conditionParameter, {
|
|
105
115
|
inputProps: inputProps,
|
|
106
116
|
getPopupContainerOverride: getPopupContainerOverride || getPopupContainer,
|
|
@@ -138,7 +148,15 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
138
148
|
}, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({
|
|
139
149
|
selectedFactorType: "",
|
|
140
150
|
defaultFactorType: "",
|
|
141
|
-
value: ""
|
|
151
|
+
value: "",
|
|
152
|
+
customFactorValueComponents: factorParameterSelectorComponent && {
|
|
153
|
+
parameter: {
|
|
154
|
+
component: factorParameterSelectorComponent
|
|
155
|
+
},
|
|
156
|
+
contextParameter: {
|
|
157
|
+
component: factorParameterSelectorComponent
|
|
158
|
+
}
|
|
159
|
+
}
|
|
142
160
|
}, conditionFactorProps, {
|
|
143
161
|
inputProps: inputProps,
|
|
144
162
|
getPopupContainerOverride: getPopupContainerOverride || getPopupContainer,
|
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { FactorsProps,
|
|
3
|
-
import { OperatorsProps } from '@synerise/ds-operators
|
|
4
|
-
import { ConditionProps, ConditionTexts } from '../../Condition.types';
|
|
5
|
-
export type ConditionRowProps = {
|
|
1
|
+
import type { ReactText } from 'react';
|
|
2
|
+
import type { FactorsProps, FactorValueComponentProps } from '@synerise/ds-factors';
|
|
3
|
+
import type { OperatorsProps } from '@synerise/ds-operators';
|
|
4
|
+
import type { ConditionProps, ConditionTexts } from '../../Condition.types';
|
|
5
|
+
export type ConditionRowProps = Pick<ConditionProps, 'removeCondition' | 'getPopupContainerOverride' | 'factorParameterSelectorComponent' | 'parameterSelectorComponent'> & {
|
|
6
6
|
index: number;
|
|
7
7
|
error?: boolean;
|
|
8
8
|
hasPriority?: boolean;
|
|
9
9
|
onActivate?: (fieldType: string) => void;
|
|
10
10
|
onDeactivate?: () => void;
|
|
11
|
-
conditionId:
|
|
12
|
-
addCondition?: (stepId:
|
|
11
|
+
conditionId: ReactText;
|
|
12
|
+
addCondition?: (stepId: ReactText) => void;
|
|
13
13
|
conditionParameter?: Omit<FactorsProps, 'onChangeValue'>;
|
|
14
14
|
conditionOperator?: Omit<OperatorsProps, 'onChange'>;
|
|
15
15
|
conditionFactor?: Omit<FactorsProps, 'onChangeValue'>;
|
|
16
|
-
|
|
16
|
+
conditionsNumber: number;
|
|
17
|
+
stepId: ReactText;
|
|
18
|
+
currentStepId: ReactText;
|
|
19
|
+
currentConditionId: ReactText;
|
|
20
|
+
currentField: ReactText;
|
|
17
21
|
minConditionLength: ConditionProps['minConditionsLength'];
|
|
18
22
|
maxConditionLength: ConditionProps['maxConditionsLength'];
|
|
19
|
-
conditionsNumber: number;
|
|
20
|
-
stepId: React.ReactText;
|
|
21
|
-
currentStepId: React.ReactText;
|
|
22
|
-
currentConditionId: React.ReactText;
|
|
23
|
-
currentField: React.ReactText;
|
|
24
23
|
selectParameter: ConditionProps['onChangeParameter'];
|
|
25
24
|
selectOperator: ConditionProps['onChangeOperator'];
|
|
26
25
|
setStepConditionFactorType: ConditionProps['onChangeFactorType'];
|
|
27
26
|
setStepConditionFactorValue: ConditionProps['onChangeFactorValue'];
|
|
28
|
-
getPopupContainerOverride?: ConditionProps['getPopupContainerOverride'];
|
|
29
27
|
texts: Partial<ConditionTexts>;
|
|
30
28
|
stepType: 'event' | 'attribute' | 'default' | undefined;
|
|
31
|
-
inputProps?: Partial<
|
|
29
|
+
inputProps?: Partial<FactorValueComponentProps>;
|
|
32
30
|
readOnly?: boolean;
|
|
33
31
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import * as T from './ConditionStep.types';
|
|
3
|
-
export declare const ConditionStep: ({ step, texts, index, addCondition, removeCondition, updateStepName, removeStep, duplicateStep, minConditionsLength, maxConditionsLength, draggableEnabled, selectSubject, selectContext, selectActionAttribute, selectOperator, selectParameter, setStepConditionFactorType, setStepConditionFactorValue, getPopupContainerOverride, hasPriority, currentStepId, currentConditionId, currentField, setCurrentField, setCurrentCondition, setCurrentStep, onDeactivate, showSuffix, inputProps, readOnly, singleStepCondition, showActionAttribute, showEmptyConditionPlaceholder, }: T.ConditionStepProps) => React.JSX.Element;
|
|
3
|
+
export declare const ConditionStep: ({ step, texts, index, addCondition, removeCondition, updateStepName, removeStep, duplicateStep, minConditionsLength, maxConditionsLength, draggableEnabled, selectSubject, selectContext, selectActionAttribute, selectOperator, selectParameter, setStepConditionFactorType, setStepConditionFactorValue, getPopupContainerOverride, hasPriority, currentStepId, currentConditionId, currentField, setCurrentField, setCurrentCondition, setCurrentStep, onDeactivate, showSuffix, inputProps, readOnly, singleStepCondition, showActionAttribute, contextSelectorComponent: CustomContextSelectorComponent, actionAttributeParameterSelectorComponent, parameterSelectorComponent, factorParameterSelectorComponent, showEmptyConditionPlaceholder, }: T.ConditionStepProps) => React.JSX.Element;
|
|
@@ -48,6 +48,10 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
48
48
|
_ref$singleStepCondit = _ref.singleStepCondition,
|
|
49
49
|
singleStepCondition = _ref$singleStepCondit === void 0 ? false : _ref$singleStepCondit,
|
|
50
50
|
showActionAttribute = _ref.showActionAttribute,
|
|
51
|
+
CustomContextSelectorComponent = _ref.contextSelectorComponent,
|
|
52
|
+
actionAttributeParameterSelectorComponent = _ref.actionAttributeParameterSelectorComponent,
|
|
53
|
+
parameterSelectorComponent = _ref.parameterSelectorComponent,
|
|
54
|
+
factorParameterSelectorComponent = _ref.factorParameterSelectorComponent,
|
|
51
55
|
_ref$showEmptyConditi = _ref.showEmptyConditionPlaceholder,
|
|
52
56
|
showEmptyConditionPlaceholder = _ref$showEmptyConditi === void 0 ? false : _ref$showEmptyConditi;
|
|
53
57
|
var _useIntl = useIntl(),
|
|
@@ -119,6 +123,28 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
119
123
|
readOnly: readOnly
|
|
120
124
|
});
|
|
121
125
|
}, [draggableEnabled, duplicateStep, index, removeStep, step.id, step.stepName, text, updateStepName, readOnly]);
|
|
126
|
+
var renderContextSelector = useCallback(function (contextData) {
|
|
127
|
+
return CustomContextSelectorComponent ? /*#__PURE__*/React.createElement(CustomContextSelectorComponent, _extends({}, contextData, {
|
|
128
|
+
getPopupContainer: getPopupContainerOverride,
|
|
129
|
+
onActivate: _onActivate,
|
|
130
|
+
onDeactivate: onDeactivate,
|
|
131
|
+
opened: step.id === currentStepId && currentField === SUBJECT,
|
|
132
|
+
onSelectItem: function onSelectItem(value) {
|
|
133
|
+
return selectContext(value, step.id);
|
|
134
|
+
},
|
|
135
|
+
readOnly: contextData.readOnly || readOnly
|
|
136
|
+
})) : /*#__PURE__*/React.createElement(ContextSelector, _extends({}, contextData, {
|
|
137
|
+
errorText: undefined,
|
|
138
|
+
getPopupContainerOverride: getPopupContainerOverride,
|
|
139
|
+
onActivate: _onActivate,
|
|
140
|
+
onDeactivate: onDeactivate,
|
|
141
|
+
opened: step.id === currentStepId && currentField === SUBJECT,
|
|
142
|
+
onSelectItem: function onSelectItem(value) {
|
|
143
|
+
return selectContext(value, step.id);
|
|
144
|
+
},
|
|
145
|
+
readOnly: contextData.readOnly || readOnly
|
|
146
|
+
}));
|
|
147
|
+
}, [CustomContextSelectorComponent, currentField, currentStepId, getPopupContainerOverride, _onActivate, onDeactivate, readOnly, selectContext, step.id]);
|
|
122
148
|
var addConditionButton = useMemo(function () {
|
|
123
149
|
var _step$subject, _step$context, _step$actionAttribute;
|
|
124
150
|
return !readOnly && addCondition && (maxConditionsLength === undefined || step.conditions.length < maxConditionsLength) && /*#__PURE__*/React.createElement(AddCondition, {
|
|
@@ -170,9 +196,11 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
170
196
|
texts: text,
|
|
171
197
|
stepType: (_step$context2 = step.context) == null ? void 0 : _step$context2.type,
|
|
172
198
|
onDeactivate: onDeactivate,
|
|
173
|
-
readOnly: readOnly
|
|
199
|
+
readOnly: readOnly,
|
|
200
|
+
parameterSelectorComponent: parameterSelectorComponent,
|
|
201
|
+
factorParameterSelectorComponent: factorParameterSelectorComponent
|
|
174
202
|
});
|
|
175
|
-
}, [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, inputProps, readOnly]);
|
|
203
|
+
}, [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, inputProps, readOnly, parameterSelectorComponent, factorParameterSelectorComponent]);
|
|
176
204
|
var hasSelectedSubjectOrContext = useMemo(function () {
|
|
177
205
|
var _step$subject2, _step$context3;
|
|
178
206
|
return ((_step$subject2 = step.subject) == null ? void 0 : _step$subject2.selectedItem) || ((_step$context3 = step.context) == null ? void 0 : _step$context3.selectedItem);
|
|
@@ -208,21 +236,19 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
208
236
|
onSelectItem: function onSelectItem(value) {
|
|
209
237
|
return selectSubject(value, step.id);
|
|
210
238
|
}
|
|
211
|
-
})), step.context && /*#__PURE__*/React.createElement(
|
|
212
|
-
errorText: undefined,
|
|
213
|
-
getPopupContainerOverride: getPopupContainerOverride,
|
|
214
|
-
onActivate: _onActivate,
|
|
215
|
-
onDeactivate: onDeactivate,
|
|
216
|
-
opened: step.id === currentStepId && currentField === SUBJECT,
|
|
217
|
-
onSelectItem: function onSelectItem(value) {
|
|
218
|
-
return selectContext(value, step.id);
|
|
219
|
-
},
|
|
220
|
-
readOnly: step.context.readOnly || readOnly
|
|
221
|
-
})), contextOrActionErrorText && /*#__PURE__*/React.createElement(S.ErrorWrapper, null, contextOrActionErrorText)), hasSelectedSubjectOrContext || !showEmptyConditionPlaceholder ? /*#__PURE__*/React.createElement(React.Fragment, null, showActionAttribute && /*#__PURE__*/React.createElement(S.ActionAttribute, {
|
|
239
|
+
})), step.context && renderContextSelector(step.context), contextOrActionErrorText && /*#__PURE__*/React.createElement(S.ErrorWrapper, null, contextOrActionErrorText)), hasSelectedSubjectOrContext || !showEmptyConditionPlaceholder ? /*#__PURE__*/React.createElement(React.Fragment, null, showActionAttribute && /*#__PURE__*/React.createElement(S.ActionAttribute, {
|
|
222
240
|
style: {
|
|
223
241
|
zIndex: step.id === currentStepId && currentField === ACTION_ATTRIBUTE ? 10002 : 0
|
|
224
242
|
}
|
|
225
243
|
}, /*#__PURE__*/React.createElement(Factors, _extends({}, step.actionAttribute, {
|
|
244
|
+
customFactorValueComponents: actionAttributeParameterSelectorComponent && {
|
|
245
|
+
parameter: {
|
|
246
|
+
component: actionAttributeParameterSelectorComponent
|
|
247
|
+
},
|
|
248
|
+
contextParameter: {
|
|
249
|
+
component: actionAttributeParameterSelectorComponent
|
|
250
|
+
}
|
|
251
|
+
},
|
|
226
252
|
errorText: undefined,
|
|
227
253
|
value: (_step$actionAttribute5 = step.actionAttribute) == null ? void 0 : _step$actionAttribute5.value,
|
|
228
254
|
withoutTypeSelector: true,
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import { ReactText } from 'react';
|
|
2
|
-
import { FactorType, FactorValueType
|
|
3
|
-
import { ContextGroup, ContextItem } from '@synerise/ds-context-selector
|
|
4
|
-
import { SubjectItem } from '@synerise/ds-subject
|
|
5
|
-
import { OperatorsGroup, OperatorsItem } from '@synerise/ds-operators
|
|
6
|
-
import { ConditionStep,
|
|
7
|
-
export type ConditionStepProps = {
|
|
1
|
+
import type { ReactText } from 'react';
|
|
2
|
+
import type { FactorType, FactorValueType } from '@synerise/ds-factors';
|
|
3
|
+
import type { ContextGroup, ContextItem } from '@synerise/ds-context-selector';
|
|
4
|
+
import type { SubjectItem } from '@synerise/ds-subject';
|
|
5
|
+
import type { OperatorsGroup, OperatorsItem } from '@synerise/ds-operators';
|
|
6
|
+
import type { ConditionStep, ConditionProps } from '../Condition.types';
|
|
7
|
+
export type ConditionStepProps = Pick<ConditionProps, 'singleStepCondition' | 'showActionAttribute' | 'showEmptyConditionPlaceholder' | 'showSuffix' | 'readOnly' | 'inputProps' | 'hoverDisabled' | 'getPopupContainerOverride' | 'minConditionsLength' | 'addCondition' | 'removeCondition' | 'texts' | 'maxConditionsLength' | 'contextSelectorComponent' | 'factorParameterSelectorComponent' | 'parameterSelectorComponent' | 'actionAttributeParameterSelectorComponent'> & {
|
|
8
8
|
index: number;
|
|
9
9
|
step: ConditionStep;
|
|
10
10
|
hasPriority?: boolean;
|
|
11
11
|
onStepActivate?: (stepid: ReactText) => void;
|
|
12
|
-
getPopupContainerOverride?: ConditionProps['getPopupContainerOverride'];
|
|
13
|
-
addCondition?: (stepId: ReactText) => void;
|
|
14
|
-
removeCondition?: (stepId: ReactText, conditionRowId: ReactText) => void;
|
|
15
12
|
updateStepName?: (stepId: ReactText, value: string) => void;
|
|
16
|
-
texts?: Partial<ConditionTexts>;
|
|
17
|
-
minConditionsLength: number;
|
|
18
|
-
maxConditionsLength: number | undefined;
|
|
19
13
|
draggableEnabled?: boolean;
|
|
20
14
|
selectSubject: (value: SubjectItem, stepId: ReactText) => void;
|
|
21
15
|
selectContext: (value: ContextItem | ContextGroup | undefined, stepId: ReactText) => void;
|
|
@@ -31,13 +25,6 @@ export type ConditionStepProps = {
|
|
|
31
25
|
setCurrentCondition: (conditionId: string) => void;
|
|
32
26
|
setCurrentStep: (stepId: ReactText) => void;
|
|
33
27
|
onDeactivate: () => void;
|
|
34
|
-
showSuffix?: boolean;
|
|
35
|
-
hoverDisabled?: boolean;
|
|
36
|
-
inputProps?: Partial<InputProps>;
|
|
37
|
-
readOnly?: boolean;
|
|
38
|
-
singleStepCondition?: boolean;
|
|
39
|
-
showActionAttribute?: boolean;
|
|
40
|
-
showEmptyConditionPlaceholder?: boolean;
|
|
41
28
|
} & ConditionStepCrudActions;
|
|
42
29
|
export type ConditionStepCrudActions = {
|
|
43
30
|
removeStep?: (stepId: ReactText) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-condition",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Condition UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-button": "^1.
|
|
38
|
-
"@synerise/ds-context-selector": "^1.0.
|
|
39
|
-
"@synerise/ds-cruds": "^1.0.
|
|
40
|
-
"@synerise/ds-factors": "^1.
|
|
41
|
-
"@synerise/ds-icon": "^1.
|
|
42
|
-
"@synerise/ds-inline-edit": "^1.0.
|
|
43
|
-
"@synerise/ds-input": "^1.0.
|
|
44
|
-
"@synerise/ds-operators": "^1.0.
|
|
45
|
-
"@synerise/ds-subject": "^1.0.
|
|
46
|
-
"@synerise/ds-tooltip": "^1.
|
|
47
|
-
"@synerise/ds-utils": "^1.0.
|
|
37
|
+
"@synerise/ds-button": "^1.1.1",
|
|
38
|
+
"@synerise/ds-context-selector": "^1.0.2",
|
|
39
|
+
"@synerise/ds-cruds": "^1.0.2",
|
|
40
|
+
"@synerise/ds-factors": "^1.1.0",
|
|
41
|
+
"@synerise/ds-icon": "^1.1.0",
|
|
42
|
+
"@synerise/ds-inline-edit": "^1.0.2",
|
|
43
|
+
"@synerise/ds-input": "^1.0.2",
|
|
44
|
+
"@synerise/ds-operators": "^1.0.2",
|
|
45
|
+
"@synerise/ds-subject": "^1.0.2",
|
|
46
|
+
"@synerise/ds-tooltip": "^1.1.1",
|
|
47
|
+
"@synerise/ds-utils": "^1.0.1",
|
|
48
48
|
"lodash": "^4.17.19",
|
|
49
49
|
"react-sortablejs": "^6.0.0",
|
|
50
50
|
"sortablejs": "1.15.1"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
56
56
|
"styled-components": "^5.3.3"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "47960dcd849dc47c85bd134bcfeb90a5505656a7"
|
|
59
59
|
}
|