@synerise/ds-condition 0.11.0 → 0.11.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 +8 -0
- package/README.md +30 -28
- package/dist/Condition.js +4 -2
- package/dist/Condition.types.d.ts +1 -0
- package/dist/ConditionStep/ConditionRow/ConditionRow.js +4 -0
- package/dist/ConditionStep/ConditionRow/ConditionRow.types.d.ts +1 -0
- package/dist/ConditionStep/ConditionStep.js +3 -1
- package/dist/ConditionStep/ConditionStep.types.d.ts +2 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.11.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.11.0...@synerise/ds-condition@0.11.1) (2021-11-05)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-condition
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [0.11.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.10.2...@synerise/ds-condition@0.11.0) (2021-11-04)
|
|
7
15
|
|
|
8
16
|
|
package/README.md
CHANGED
|
@@ -101,37 +101,39 @@ import Condition from '@synerise/ds-condition'
|
|
|
101
101
|
|
|
102
102
|
## API
|
|
103
103
|
|
|
104
|
-
| Property
|
|
105
|
-
| ---
|
|
106
|
-
| addCondition
|
|
107
|
-
| removeCondition
|
|
108
|
-
| steps
|
|
109
|
-
| texts
|
|
110
|
-
| updateStepName
|
|
111
|
-
| addStep
|
|
112
|
-
| duplicateStep
|
|
113
|
-
| removeStep
|
|
114
|
-
| onChangeOrder
|
|
115
|
-
| autoClearCondition
|
|
116
|
-
| minConditionsLength
|
|
117
|
-
| maxConditionsLength
|
|
118
|
-
| onChangeContext
|
|
119
|
-
| onChangeSubject
|
|
120
|
-
| onChangeParameter
|
|
121
|
-
| onChangeOperator
|
|
122
|
-
| onChangeFactorValue
|
|
123
|
-
| onChangeFactorType
|
|
124
|
-
| onUpdateStepName
|
|
104
|
+
| Property | Description | Type | Default |
|
|
105
|
+
| --- | --- | --- | --- |
|
|
106
|
+
| addCondition | Callback called when user adds new row of conditions | (stepId: React.ReactText) => void | - |
|
|
107
|
+
| removeCondition | Callback called when user clicks on remove row of condtions | (stepId: React.ReactText, conditionRowId: React.ReactText) => void | - |
|
|
108
|
+
| steps | Array contains all steps of condition | ConditionStep[] | - |
|
|
109
|
+
| texts | Translations object | Texts | - |
|
|
110
|
+
| updateStepName | Callback called when user change the name of step | (stepId: React.ReactText, value: string) => void | - |
|
|
111
|
+
| addStep | Callback called when user clicks on add step button | () => void | - |
|
|
112
|
+
| duplicateStep | Callback called when user clicks on duplicate step button | (stepId: React.ReactText) => void | - |
|
|
113
|
+
| removeStep | Callback called when user clicks on remove step button | (stepId: React.ReactText) => void | - |
|
|
114
|
+
| onChangeOrder | Callback called when user change order of steps | (order: ConditionStep[]) => void | - |
|
|
115
|
+
| autoClearCondition | Automatically fires clearing values of dependent elements | Boolean | false |
|
|
116
|
+
| minConditionsLength | Minimal length of conditions in step | number | - |
|
|
117
|
+
| maxConditionsLength | Maximal length of conditions in step | number \ undefined | - |
|
|
118
|
+
| onChangeContext | Callback called when user change value of step context | (stepId: React.ReactText, value: ContextItem \ ContextGroup \ undefined) => void | - |
|
|
119
|
+
| onChangeSubject | Callback called when user change value of step subject | (stepId: React.ReactText, value: SubjectItem \ undefined) => void | - |
|
|
120
|
+
| onChangeParameter | Callback called when user change value of condition parameter | (stepId: React.ReactText, conditionId: React.ReactText, value: ParameterValue) | - |
|
|
121
|
+
| onChangeOperator | Callback called when user change value of condition operator | (stepId: React.ReactText, conditionId: React.ReactText, value: OperatorsItem \ undefined) => void | - |
|
|
122
|
+
| onChangeFactorValue | Callback called when user change value of condition factor | (stepId: React.ReactText, conditionId: React.ReactText, value: OperatorsType \ undefined) => void | - |
|
|
123
|
+
| onChangeFactorType | Callback called when user change type of condition factor | (stepId: React.ReactText, conditionId: React.ReactText, value: FactorType \ undefined) => void | - |
|
|
124
|
+
| onUpdateStepName | Callback called when user change the name of step condition | (stepId: React.ReactText, value: string) => void | - |
|
|
125
|
+
| getPopupContainerOverride | Popup container function for child tooltips and dropdowns | (trigger: HTMLElement | null) => HTMLElement; | - |
|
|
125
126
|
|
|
126
127
|
### ConditionStep
|
|
127
128
|
|
|
128
|
-
| Property
|
|
129
|
-
| ---
|
|
130
|
-
| conditions
|
|
131
|
-
| id
|
|
132
|
-
| stepName
|
|
133
|
-
| subject
|
|
134
|
-
| context
|
|
129
|
+
| Property | Description | Type | Default |
|
|
130
|
+
| --- | --- | --- | --- |
|
|
131
|
+
| conditions | Rows of conditions | StepConditions[] | - |
|
|
132
|
+
| id | Id of condition step | React.ReactText | - |
|
|
133
|
+
| stepName | The name of step | string | - |
|
|
134
|
+
| subject | Subject options | [SubjectProps](/docs/components/subject) | - |
|
|
135
|
+
| context | ContextSelector options | [ContextSelectorProps](/docs/components/context-selector) | - |
|
|
136
|
+
| getPopupContainerOverride | Popup container function for child tooltips and dropdowns | (trigger: HTMLElement | null) => HTMLElement; | - |
|
|
135
137
|
|
|
136
138
|
### StepConditions
|
|
137
139
|
|
package/dist/Condition.js
CHANGED
|
@@ -61,7 +61,8 @@ var Condition = function Condition(props) {
|
|
|
61
61
|
onChangeOperator = props.onChangeOperator,
|
|
62
62
|
onChangeFactorType = props.onChangeFactorType,
|
|
63
63
|
onChangeFactorValue = props.onChangeFactorValue,
|
|
64
|
-
onUpdateStepName = props.onUpdateStepName
|
|
64
|
+
onUpdateStepName = props.onUpdateStepName,
|
|
65
|
+
getPopupContainerOverride = props.getPopupContainerOverride;
|
|
65
66
|
|
|
66
67
|
var _useIntl = useIntl(),
|
|
67
68
|
formatMessage = _useIntl.formatMessage;
|
|
@@ -210,6 +211,7 @@ var Condition = function Condition(props) {
|
|
|
210
211
|
step: step,
|
|
211
212
|
texts: texts,
|
|
212
213
|
index: index,
|
|
214
|
+
getPopupContainerOverride: getPopupContainerOverride,
|
|
213
215
|
draggableEnabled: draggableEnabled,
|
|
214
216
|
selectOperator: selectOperator,
|
|
215
217
|
selectParameter: selectParameter,
|
|
@@ -235,7 +237,7 @@ var Condition = function Condition(props) {
|
|
|
235
237
|
}, React.createElement(Icon, {
|
|
236
238
|
component: React.createElement(Add3M, null)
|
|
237
239
|
}), text.addStep));
|
|
238
|
-
}, [steps, onChangeOrder, addStep, text.addStep, texts, draggableEnabled, selectOperator, selectParameter, selectContext, selectSubject, onUpdateStepName, duplicateStep, removeStep, minConditionsLength, maxConditionsLength, setStepConditionFactorType, setStepConditionFactorValue, currentConditionId, currentStepId, currentField, removeCondition, addCondition]);
|
|
240
|
+
}, [steps, onChangeOrder, addStep, text.addStep, texts, draggableEnabled, selectOperator, selectParameter, selectContext, selectSubject, onUpdateStepName, duplicateStep, removeStep, minConditionsLength, maxConditionsLength, setStepConditionFactorType, setStepConditionFactorValue, currentConditionId, currentStepId, currentField, removeCondition, addCondition, getPopupContainerOverride]);
|
|
239
241
|
};
|
|
240
242
|
|
|
241
243
|
export default Condition;
|
|
@@ -29,6 +29,7 @@ export declare type ConditionTexts = {
|
|
|
29
29
|
};
|
|
30
30
|
export declare type ConditionProps = {
|
|
31
31
|
steps: ConditionStep[];
|
|
32
|
+
getPopupContainerOverride?: (trigger: HTMLElement | null) => HTMLElement;
|
|
32
33
|
addCondition?: (stepId: React.ReactText) => void;
|
|
33
34
|
removeCondition?: (stepId: React.ReactText, conditionRowId: React.ReactText) => void;
|
|
34
35
|
removeStep?: (stepId: React.ReactText) => void;
|
|
@@ -29,6 +29,7 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
29
29
|
selectOperator = _ref.selectOperator,
|
|
30
30
|
setStepConditionFactorType = _ref.setStepConditionFactorType,
|
|
31
31
|
setStepConditionFactorValue = _ref.setStepConditionFactorValue,
|
|
32
|
+
getPopupContainerOverride = _ref.getPopupContainerOverride,
|
|
32
33
|
texts = _ref.texts;
|
|
33
34
|
return React.createElement(S.ConditionRow, {
|
|
34
35
|
key: "condition-row-".concat(conditionId),
|
|
@@ -37,16 +38,19 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
37
38
|
first: index === 0,
|
|
38
39
|
last: Boolean(addCondition && index + 1 === conditionsNumber && maxConditionLength !== undefined && conditionsNumber === maxConditionLength)
|
|
39
40
|
}), React.createElement(S.ConditionWrapper, null, conditionParameter && React.createElement(Factors, _extends({}, conditionParameter, {
|
|
41
|
+
getPopupContainerOverride: getPopupContainerOverride,
|
|
40
42
|
onChangeValue: function onChangeValue(value) {
|
|
41
43
|
return selectParameter(stepId, conditionId, value);
|
|
42
44
|
},
|
|
43
45
|
opened: stepId === currentStepId && conditionId === currentConditionId && currentField === PARAMETER
|
|
44
46
|
}))), (!conditionParameter || (conditionParameter === null || conditionParameter === void 0 ? void 0 : conditionParameter.value)) && conditionOperator && React.createElement(S.ConditionWrapper, null, React.createElement(Operators, _extends({}, conditionOperator, {
|
|
47
|
+
getPopupContainerOverride: getPopupContainerOverride,
|
|
45
48
|
onChange: function onChange(value) {
|
|
46
49
|
return selectOperator(stepId, conditionId, value);
|
|
47
50
|
},
|
|
48
51
|
opened: stepId === currentStepId && conditionId === currentConditionId && currentField === OPERATOR
|
|
49
52
|
}))), (conditionOperator === null || conditionOperator === void 0 ? void 0 : conditionOperator.value) && React.createElement(S.ConditionWrapper, null, React.createElement(React.Fragment, null, (conditionFactor === null || conditionFactor === void 0 ? void 0 : conditionFactor.withCustomFactor) || React.createElement(Factors, _extends({}, conditionFactor, {
|
|
53
|
+
getPopupContainerOverride: getPopupContainerOverride,
|
|
50
54
|
setSelectedFactorType: function setSelectedFactorType(factorType) {
|
|
51
55
|
return setStepConditionFactorType(stepId, conditionId, factorType);
|
|
52
56
|
},
|
|
@@ -21,6 +21,7 @@ export declare type ConditionRowProps = {
|
|
|
21
21
|
selectOperator: ConditionProps['onChangeOperator'];
|
|
22
22
|
setStepConditionFactorType: ConditionProps['onChangeFactorType'];
|
|
23
23
|
setStepConditionFactorValue: ConditionProps['onChangeFactorValue'];
|
|
24
|
+
getPopupContainerOverride?: ConditionProps['getPopupContainerOverride'];
|
|
24
25
|
texts: Partial<ConditionTexts>;
|
|
25
26
|
stepType: 'event' | 'attribute' | 'default' | undefined;
|
|
26
27
|
};
|
|
@@ -34,6 +34,7 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
34
34
|
selectParameter = _ref.selectParameter,
|
|
35
35
|
setStepConditionFactorType = _ref.setStepConditionFactorType,
|
|
36
36
|
setStepConditionFactorValue = _ref.setStepConditionFactorValue,
|
|
37
|
+
getPopupContainerOverride = _ref.getPopupContainerOverride,
|
|
37
38
|
currentStepId = _ref.currentStepId,
|
|
38
39
|
currentConditionId = _ref.currentConditionId,
|
|
39
40
|
currentField = _ref.currentField;
|
|
@@ -126,12 +127,13 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
126
127
|
currentField: currentField,
|
|
127
128
|
selectParameter: selectParameter,
|
|
128
129
|
selectOperator: selectOperator,
|
|
130
|
+
getPopupContainerOverride: getPopupContainerOverride,
|
|
129
131
|
setStepConditionFactorType: setStepConditionFactorType,
|
|
130
132
|
setStepConditionFactorValue: setStepConditionFactorValue,
|
|
131
133
|
texts: text,
|
|
132
134
|
stepType: (_step$context2 = step.context) === null || _step$context2 === void 0 ? void 0 : _step$context2.type
|
|
133
135
|
});
|
|
134
|
-
}, [addCondition, currentConditionId, currentField, currentStepId, maxConditionsLength, minConditionsLength, removeCondition, selectOperator, selectParameter, setStepConditionFactorType, setStepConditionFactorValue, step.conditions.length, step.context, step.id, text]);
|
|
136
|
+
}, [getPopupContainerOverride, addCondition, currentConditionId, currentField, currentStepId, maxConditionsLength, minConditionsLength, removeCondition, selectOperator, selectParameter, setStepConditionFactorType, setStepConditionFactorValue, step.conditions.length, step.context, step.id, text]);
|
|
135
137
|
return React.createElement(S.Step, {
|
|
136
138
|
key: step.id,
|
|
137
139
|
"data-dropLabel": text.dropLabel
|
|
@@ -3,10 +3,11 @@ import { FactorType, FactorValueType } from '@synerise/ds-factors/dist/Factors.t
|
|
|
3
3
|
import { ContextGroup, ContextItem } from '@synerise/ds-context-selector/dist/ContextSelector.types';
|
|
4
4
|
import { SubjectItem } from '@synerise/ds-subject/dist/Subject.types';
|
|
5
5
|
import { OperatorsGroup, OperatorsItem } from '@synerise/ds-operators/dist/Operator.types';
|
|
6
|
-
import { ConditionStep, ConditionTexts } from '../Condition.types';
|
|
6
|
+
import { ConditionStep, ConditionTexts, ConditionProps } from '../Condition.types';
|
|
7
7
|
export declare type ConditionStepProps = {
|
|
8
8
|
index: number;
|
|
9
9
|
step: ConditionStep;
|
|
10
|
+
getPopupContainerOverride?: ConditionProps['getPopupContainerOverride'];
|
|
10
11
|
addCondition?: (stepId: React.ReactText) => void;
|
|
11
12
|
removeCondition?: (stepId: React.ReactText, conditionRowId: React.ReactText) => void;
|
|
12
13
|
updateStepName?: (stepId: React.ReactText, value: string) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-condition",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Condition UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@synerise/ds-button": "^0.15.0",
|
|
36
|
-
"@synerise/ds-context-selector": "^0.7.
|
|
36
|
+
"@synerise/ds-context-selector": "^0.7.3",
|
|
37
37
|
"@synerise/ds-core": "^0.30.14",
|
|
38
|
-
"@synerise/ds-cruds": "^0.2.
|
|
39
|
-
"@synerise/ds-factors": "^0.9.
|
|
38
|
+
"@synerise/ds-cruds": "^0.2.50",
|
|
39
|
+
"@synerise/ds-factors": "^0.9.1",
|
|
40
40
|
"@synerise/ds-icon": "^0.36.0",
|
|
41
|
-
"@synerise/ds-inline-edit": "^0.4.
|
|
42
|
-
"@synerise/ds-operators": "^0.5.
|
|
43
|
-
"@synerise/ds-subject": "^0.5.
|
|
44
|
-
"@synerise/ds-tooltip": "^0.10.
|
|
41
|
+
"@synerise/ds-inline-edit": "^0.4.39",
|
|
42
|
+
"@synerise/ds-operators": "^0.5.3",
|
|
43
|
+
"@synerise/ds-subject": "^0.5.52",
|
|
44
|
+
"@synerise/ds-tooltip": "^0.10.56",
|
|
45
45
|
"@synerise/ds-utils": "^0.19.0",
|
|
46
46
|
"react-sortablejs": "^6.0.0"
|
|
47
47
|
},
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"@synerise/ds-core": "*",
|
|
50
50
|
"react": ">=16.9.0 < 17.0.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "bf865b6d1967c42effb68dc794f34dd18ddebe27"
|
|
53
53
|
}
|