@synerise/ds-condition 0.18.11 → 0.19.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,25 @@
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.19.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.19.0...@synerise/ds-condition@0.19.1) (2023-01-02)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-condition
9
+
10
+
11
+
12
+
13
+
14
+ # [0.19.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.18.11...@synerise/ds-condition@0.19.0) (2022-12-13)
15
+
16
+
17
+ ### Features
18
+
19
+ * **filter:** readOnly state for conditions ([dfa4db3](https://github.com/Synerise/synerise-design/commit/dfa4db35826c0800859b7217dd1ea2f1497ac3c9))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.18.11](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.18.10...@synerise/ds-condition@0.18.11) (2022-12-08)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-condition
package/dist/Condition.js CHANGED
@@ -58,7 +58,9 @@ var Condition = function Condition(props) {
58
58
  _props$autoOpenedComp = props.autoOpenedComponent,
59
59
  autoOpenedComponent = _props$autoOpenedComp === void 0 ? DEFAULT_FIELD : _props$autoOpenedComp,
60
60
  inputProps = props.inputProps,
61
- onDeactivate = props.onDeactivate;
61
+ onDeactivate = props.onDeactivate,
62
+ _props$readOnly = props.readOnly,
63
+ readOnly = _props$readOnly === void 0 ? false : _props$readOnly;
62
64
 
63
65
  var _useIntl = useIntl(),
64
66
  formatMessage = _useIntl.formatMessage;
@@ -273,7 +275,8 @@ var Condition = function Condition(props) {
273
275
  onDeactivate: handleClearActiveCondition,
274
276
  showSuffix: showSuffix,
275
277
  hoverDisabled: hoverDisabled || currentStepId !== step.id && currentStepId !== undefined,
276
- inputProps: inputProps
278
+ inputProps: inputProps,
279
+ readOnly: readOnly
277
280
  });
278
281
  })), addStep && /*#__PURE__*/React.createElement(S.AddStepButton, null, /*#__PURE__*/React.createElement(Button, {
279
282
  type: "ghost",
@@ -281,8 +284,8 @@ var Condition = function Condition(props) {
281
284
  onClick: handleAddStep
282
285
  }, /*#__PURE__*/React.createElement(Icon, {
283
286
  component: /*#__PURE__*/React.createElement(Add3M, null)
284
- }), text.addStep)), renderAddStep && /*#__PURE__*/React.createElement(S.AddStepButton, null, renderAddStep()));
285
- }, [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]);
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]);
286
289
  };
287
290
 
288
291
  export default Condition;
@@ -6,6 +6,9 @@ export declare const StepConditions: import("styled-components").StyledComponent
6
6
  withoutStepName: boolean;
7
7
  }, never>;
8
8
  export declare const StepName: import("styled-components").StyledComponent<"div", any, {}, never>;
9
+ export declare const StepIndexWrapper: import("styled-components").StyledComponent<"span", any, {
10
+ readOnly?: boolean | undefined;
11
+ }, never>;
9
12
  export declare const Condition: import("styled-components").StyledComponent<"div", any, {}, never>;
10
13
  export declare const ConditionStepWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
11
14
  export declare const And: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -32,5 +35,6 @@ export declare const AddConditionRow: import("styled-components").StyledComponen
32
35
  export declare const ConditionConnections: import("styled-components").StyledComponent<"span", any, {
33
36
  first?: boolean | undefined;
34
37
  last?: boolean | undefined;
38
+ readOnly?: boolean | undefined;
35
39
  }, never>;
36
40
  export declare const AddStepButton: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -22,39 +22,46 @@ export var StepName = styled.div.withConfig({
22
22
  })(["font-size:13px;line-height:1.84;color:", ";display:flex;flex-direction:row;align-items:center;justify-content:flex-start;white-space:pre-wrap;&&& input{margin-top:2px;cursor:default;}"], function (props) {
23
23
  return props.theme.palette['grey-800'];
24
24
  });
25
+ export var StepIndexWrapper = styled.span.withConfig({
26
+ displayName: "Conditionstyle__StepIndexWrapper",
27
+ componentId: "sc-1lk06p3-4"
28
+ })(["font-size:13px;font-weight:", ";"], function (_ref) {
29
+ var readOnly = _ref.readOnly;
30
+ return readOnly ? '500' : '400';
31
+ });
25
32
  export var Condition = styled.div.withConfig({
26
33
  displayName: "Conditionstyle__Condition",
27
- componentId: "sc-1lk06p3-4"
34
+ componentId: "sc-1lk06p3-5"
28
35
  })(["padding:12px 0;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;min-width:575px;width:100%;.steps-list{width:100%;}"]);
29
36
  export var ConditionStepWrapper = styled.div.withConfig({
30
37
  displayName: "Conditionstyle__ConditionStepWrapper",
31
- componentId: "sc-1lk06p3-5"
38
+ componentId: "sc-1lk06p3-6"
32
39
  })(["display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:column;width:100%;"]);
33
40
  export var And = styled.div.withConfig({
34
41
  displayName: "Conditionstyle__And",
35
- componentId: "sc-1lk06p3-6"
42
+ componentId: "sc-1lk06p3-7"
36
43
  })(["display:contents;"]);
37
44
  export var StepCruds = styled.div.withConfig({
38
45
  displayName: "Conditionstyle__StepCruds",
39
- componentId: "sc-1lk06p3-7"
46
+ componentId: "sc-1lk06p3-8"
40
47
  })(["display:flex;align-items:center;justify-content:flex-end;opacity:0;visibility:hidden;"]);
41
48
  export var LeftSide = styled.div.withConfig({
42
49
  displayName: "Conditionstyle__LeftSide",
43
- componentId: "sc-1lk06p3-8"
50
+ componentId: "sc-1lk06p3-9"
44
51
  })(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;position:relative;"]);
45
52
  export var StepHeader = styled.div.withConfig({
46
53
  displayName: "Conditionstyle__StepHeader",
47
- componentId: "sc-1lk06p3-9"
54
+ componentId: "sc-1lk06p3-10"
48
55
  })(["display:flex;width:100%;flex-direction:row;align-items:flex-end;justify-content:space-between;margin-bottom:8px;padding:0 24px;"]);
49
56
  export var DraggedLabel = styled.span.withConfig({
50
57
  displayName: "Conditionstyle__DraggedLabel",
51
- componentId: "sc-1lk06p3-10"
58
+ componentId: "sc-1lk06p3-11"
52
59
  })(["width:100%;height:100%;display:none;position:absolute;top:0;left:0;align-items:center;justify-content:flex-start;padding-left:18px;color:", ";font-size:13px;"], function (props) {
53
60
  return props.theme.palette['grey-600'];
54
61
  });
55
62
  export var Step = styled.div.withConfig({
56
63
  displayName: "Conditionstyle__Step",
57
- componentId: "sc-1lk06p3-11"
64
+ componentId: "sc-1lk06p3-12"
58
65
  })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;padding:12px 0 12px;position:relative;", " &:first-of-type{&.steps-list-ghost-element{&:after{display:none;}}}background-color:", ";&:hover{background-color:", ";", "{opacity:1;visibility:visible;}", "{opacity:1;visibility:visible;}", "{opacity:1;visibility:visible;}}&.sortable-chosen,&.sortable-drag{cursor:grabbing;width:100%;opacity:1 !important;height:50px;background-color:", ";display:flex;align-items:center;justify-content:center;padding:0 20px;box-shadow:0 16px 32px 0 #23293619;&:after{display:none;}", "{align-items:center;}", "{margin:0;", "{display:none;}}", "{display:none;}", "{display:flex;}}&.steps-list-ghost-element{cursor:grabbing;width:100%;background-color:", ";border-left:2px solid ", ";border-radius:0;display:flex;align-items:center;justify-content:center;padding:0;height:50px;box-shadow:none;position:relative;&:before{content:attr(data-dropLabel);text-align:center;position:relative;color:", ";}", "{display:none;}*{display:none;}&:after{display:none;content:'';}}}"], function (props) {
59
66
  return Boolean(props.showSuffix) && css(["&:after{display:none;width:100%;padding:18px 0 18px 24px;bottom:-18px;content:attr(data-conditionSuffix);background-color:", ";position:relative;font-size:16px;font-weight:500;color:#3f4c5b;}&:first-child:not(:last-child){&:after{display:flex;}}&:not(:last-child){&:after{display:flex;}}"], props.theme.palette.white);
60
67
  }, function (props) {
@@ -72,23 +79,23 @@ export var Step = styled.div.withConfig({
72
79
  }, DraggedLabel);
73
80
  export var ConditionWrapper = styled.div.withConfig({
74
81
  displayName: "Conditionstyle__ConditionWrapper",
75
- componentId: "sc-1lk06p3-12"
82
+ componentId: "sc-1lk06p3-13"
76
83
  })([""]);
77
84
  export var Subject = styled.div.withConfig({
78
85
  displayName: "Conditionstyle__Subject",
79
- componentId: "sc-1lk06p3-13"
86
+ componentId: "sc-1lk06p3-14"
80
87
  })([""]);
81
88
  export var RemoveIconWrapper = styled.span.withConfig({
82
89
  displayName: "Conditionstyle__RemoveIconWrapper",
83
- componentId: "sc-1lk06p3-14"
90
+ componentId: "sc-1lk06p3-15"
84
91
  })(["visibility:hidden;pointer-events:none;opacity:0;transition:all 0.3s ease;width:32px;height:32px;display:flex;align-items:center;justify-content:center;margin-left:8px;"]);
85
92
  export var ConditionRows = styled.div.withConfig({
86
93
  displayName: "Conditionstyle__ConditionRows",
87
- componentId: "sc-1lk06p3-15"
94
+ componentId: "sc-1lk06p3-16"
88
95
  })(["display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:column;"]);
89
96
  export var ConditionRow = styled.div.withConfig({
90
97
  displayName: "Conditionstyle__ConditionRow",
91
- componentId: "sc-1lk06p3-16"
98
+ componentId: "sc-1lk06p3-17"
92
99
  })(["display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;padding-bottom:", ";z-index:", ";", "{margin-right:8px;&:last-of-type{margin-right:0;}}&:hover{", "{opacity:1;visibility:visible;pointer-events:all;cursor:pointer;}}"], function (props) {
93
100
  return props.stepType === 'event' ? '16px' : '0';
94
101
  }, function (props) {
@@ -96,11 +103,11 @@ export var ConditionRow = styled.div.withConfig({
96
103
  }, ConditionWrapper, RemoveIconWrapper);
97
104
  export var AddConditionRow = styled.div.withConfig({
98
105
  displayName: "Conditionstyle__AddConditionRow",
99
- componentId: "sc-1lk06p3-17"
106
+ componentId: "sc-1lk06p3-18"
100
107
  })(["display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:row;"]);
101
108
  export var ConditionConnections = styled.span.withConfig({
102
109
  displayName: "Conditionstyle__ConditionConnections",
103
- componentId: "sc-1lk06p3-18"
110
+ componentId: "sc-1lk06p3-19"
104
111
  })(["display:flex;width:32px;min-width:32px;margin:0 12px;position:relative;height:32px;&:before{position:absolute;content:'';width:", ";height:1px;top:50%;left:", ";background-color:", ";}&:after{display:", ";position:absolute;content:'';width:1px;left:50%;height:auto;top:", ";bottom:", ";background-color:", ";}"], function (props) {
105
112
  return props.first ? '100%' : '16px';
106
113
  }, function (props) {
@@ -108,7 +115,7 @@ export var ConditionConnections = styled.span.withConfig({
108
115
  }, function (props) {
109
116
  return props.theme.palette['grey-300'];
110
117
  }, function (props) {
111
- return props.first && props.last ? 'none' : 'flex';
118
+ return props.first && props.last || props.last && props.readOnly ? 'none' : 'flex';
112
119
  }, function (props) {
113
120
  return props.first ? '16px' : '0';
114
121
  }, function (props) {
@@ -118,5 +125,5 @@ export var ConditionConnections = styled.span.withConfig({
118
125
  });
119
126
  export var AddStepButton = styled.div.withConfig({
120
127
  displayName: "Conditionstyle__AddStepButton",
121
- componentId: "sc-1lk06p3-19"
128
+ componentId: "sc-1lk06p3-20"
122
129
  })(["margin:12px 24px 0;"]);
@@ -55,4 +55,5 @@ export declare type ConditionProps = {
55
55
  autoOpenedComponent?: 'subject' | 'operator' | 'factor' | 'parameter' | 'context';
56
56
  inputProps?: InputProps;
57
57
  onDeactivate?: (currentStepId: React.ReactText, currentConditionId: React.ReactText) => void;
58
+ readOnly?: boolean;
58
59
  };
@@ -9,7 +9,9 @@ export var AddCondition = function AddCondition(_ref) {
9
9
  conditionsNumber = _ref.conditionsNumber,
10
10
  texts = _ref.texts,
11
11
  selectedSubject = _ref.selectedSubject,
12
- selectedContext = _ref.selectedContext;
12
+ selectedContext = _ref.selectedContext,
13
+ _ref$readOnly = _ref.readOnly,
14
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
13
15
  return /*#__PURE__*/React.createElement(S.AddConditionRow, null, /*#__PURE__*/React.createElement(S.ConditionConnections, {
14
16
  last: true,
15
17
  first: conditionsNumber === 0
@@ -22,5 +24,5 @@ export var AddCondition = function AddCondition(_ref) {
22
24
  disabled: !(selectedSubject || selectedContext)
23
25
  }, /*#__PURE__*/React.createElement(Icon, {
24
26
  component: /*#__PURE__*/React.createElement(Add2M, null)
25
- }), conditionsNumber > 0 ? texts.addConditionRowButton : texts.addFirstConditionRowButton));
27
+ }), !readOnly && conditionsNumber > 0 ? texts.addConditionRowButton : texts.addFirstConditionRowButton));
26
28
  };
@@ -7,4 +7,5 @@ export declare type AddConditionProps = {
7
7
  texts: Partial<ConditionTexts>;
8
8
  selectedSubject: boolean;
9
9
  selectedContext: boolean;
10
+ readOnly?: boolean;
10
11
  };
@@ -35,7 +35,9 @@ export var ConditionRow = function ConditionRow(_ref) {
35
35
  stepType = _ref.stepType,
36
36
  onDeactivate = _ref.onDeactivate,
37
37
  error = _ref.error,
38
- inputProps = _ref.inputProps;
38
+ inputProps = _ref.inputProps,
39
+ _ref$readOnly = _ref.readOnly,
40
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
39
41
  return /*#__PURE__*/React.createElement(S.ConditionRow, {
40
42
  stepType: stepType,
41
43
  style: hasPriority ? {
@@ -45,7 +47,8 @@ export var ConditionRow = function ConditionRow(_ref) {
45
47
  index: index
46
48
  }, /*#__PURE__*/React.createElement(S.ConditionConnections, {
47
49
  first: index === 0,
48
- last: Boolean(addCondition && index + 1 === conditionsNumber && maxConditionLength !== undefined && conditionsNumber === maxConditionLength)
50
+ last: readOnly ? Boolean(index + 1 === conditionsNumber) : Boolean(addCondition && index + 1 === conditionsNumber && maxConditionLength !== undefined && conditionsNumber === maxConditionLength),
51
+ readOnly: readOnly
49
52
  }), /*#__PURE__*/React.createElement(S.ConditionWrapper, null, conditionParameter && /*#__PURE__*/React.createElement(Factors, _extends({}, conditionParameter, {
50
53
  inputProps: inputProps,
51
54
  getPopupContainerOverride: getPopupContainerOverride,
@@ -56,7 +59,8 @@ export var ConditionRow = function ConditionRow(_ref) {
56
59
  onChangeValue: function onChangeValue(value) {
57
60
  return selectParameter(stepId, conditionId, value);
58
61
  },
59
- opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === PARAMETER
62
+ opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === PARAMETER,
63
+ readOnly: readOnly
60
64
  }))), (!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, {
61
65
  getPopupContainerOverride: getPopupContainerOverride,
62
66
  onActivate: function onActivate() {
@@ -66,7 +70,8 @@ export var ConditionRow = function ConditionRow(_ref) {
66
70
  onChange: function onChange(value) {
67
71
  return selectOperator(stepId, conditionId, value);
68
72
  },
69
- opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === OPERATOR
73
+ opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === OPERATOR,
74
+ readOnly: readOnly
70
75
  }))), conditionFactor !== undefined && (conditionOperator == null ? void 0 : conditionOperator.value) && (conditionFactor == null ? void 0 : conditionFactor.availableFactorTypes) !== null && /*#__PURE__*/React.createElement(S.ConditionWrapper, {
71
76
  fullWidth: true
72
77
  }, /*#__PURE__*/React.createElement(React.Fragment, null, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({}, conditionFactor, {
@@ -84,8 +89,9 @@ export var ConditionRow = function ConditionRow(_ref) {
84
89
  },
85
90
  factorKey: conditionId,
86
91
  error: error,
87
- opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === FACTOR
88
- })))), removeCondition && conditionsNumber > minConditionLength && /*#__PURE__*/React.createElement(S.RemoveIconWrapper, {
92
+ opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === FACTOR,
93
+ readOnly: readOnly
94
+ })))), !readOnly && removeCondition && conditionsNumber > minConditionLength && /*#__PURE__*/React.createElement(S.RemoveIconWrapper, {
89
95
  onClick: function onClick() {
90
96
  return removeCondition(stepId, conditionId);
91
97
  },
@@ -29,4 +29,5 @@ export declare type ConditionRowProps = {
29
29
  texts: Partial<ConditionTexts>;
30
30
  stepType: 'event' | 'attribute' | 'default' | undefined;
31
31
  inputProps?: InputProps;
32
+ readOnly?: boolean;
32
33
  };
@@ -49,7 +49,9 @@ export var ConditionStep = function ConditionStep(_ref) {
49
49
  onDeactivate = _ref.onDeactivate,
50
50
  showSuffix = _ref.showSuffix,
51
51
  hoverDisabled = _ref.hoverDisabled,
52
- inputProps = _ref.inputProps;
52
+ inputProps = _ref.inputProps,
53
+ _ref$readOnly = _ref.readOnly,
54
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
53
55
 
54
56
  var _useIntl = useIntl(),
55
57
  formatMessage = _useIntl.formatMessage;
@@ -114,13 +116,14 @@ export var ConditionStep = function ConditionStep(_ref) {
114
116
  updateStepName: updateStepName,
115
117
  removeStep: removeStep,
116
118
  duplicateStep: duplicateStep,
117
- draggableEnabled: Boolean(draggableEnabled)
119
+ draggableEnabled: Boolean(draggableEnabled),
120
+ readOnly: readOnly
118
121
  });
119
- }, [draggableEnabled, duplicateStep, index, removeStep, step.id, step.stepName, text, updateStepName]);
122
+ }, [draggableEnabled, duplicateStep, index, removeStep, step.id, step.stepName, text, updateStepName, readOnly]);
120
123
  var addConditionButton = React.useMemo(function () {
121
124
  var _step$subject, _step$context;
122
125
 
123
- return addCondition && (maxConditionsLength === undefined || step.conditions.length < maxConditionsLength) && /*#__PURE__*/React.createElement(AddCondition, {
126
+ return !readOnly && addCondition && (maxConditionsLength === undefined || step.conditions.length < maxConditionsLength) && /*#__PURE__*/React.createElement(AddCondition, {
124
127
  texts: text,
125
128
  stepId: step.id,
126
129
  addCondition: onAddCondition,
@@ -128,7 +131,7 @@ export var ConditionStep = function ConditionStep(_ref) {
128
131
  selectedSubject: Boolean((_step$subject = step.subject) == null ? void 0 : _step$subject.selectedItem),
129
132
  selectedContext: Boolean((_step$context = step.context) == null ? void 0 : _step$context.selectedItem)
130
133
  });
131
- }, [addCondition, onAddCondition, maxConditionsLength, step.conditions.length, step.context, step.id, step.subject, text]);
134
+ }, [addCondition, onAddCondition, maxConditionsLength, step.conditions.length, step.context, step.id, step.subject, text, readOnly]);
132
135
  var renderConditionRow = React.useCallback(function (condition, conditionIndex) {
133
136
  var _step$context2;
134
137
 
@@ -169,9 +172,10 @@ export var ConditionStep = function ConditionStep(_ref) {
169
172
  setStepConditionFactorValue: setStepConditionFactorValue,
170
173
  texts: text,
171
174
  stepType: (_step$context2 = step.context) == null ? void 0 : _step$context2.type,
172
- onDeactivate: onDeactivate
175
+ onDeactivate: onDeactivate,
176
+ readOnly: readOnly
173
177
  });
174
- }, [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]);
178
+ }, [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]);
175
179
  return /*#__PURE__*/React.createElement(S.Step, {
176
180
  key: step.id,
177
181
  id: "condition-step-" + step.id,
@@ -203,7 +207,8 @@ export var ConditionStep = function ConditionStep(_ref) {
203
207
  opened: step.id === currentStepId && currentField === SUBJECT,
204
208
  onSelectItem: function onSelectItem(value) {
205
209
  return selectContext(value, step.id);
206
- }
210
+ },
211
+ readOnly: readOnly
207
212
  }))), /*#__PURE__*/React.createElement(S.ConditionRows, null, step.conditions.length > 0 && step.conditions.map(renderConditionRow), addConditionButton), !updateStepName && /*#__PURE__*/React.createElement(S.StepConditionCruds, {
208
213
  onDuplicate: duplicateStep ? function () {
209
214
  return duplicateStep(step.id);
@@ -35,4 +35,5 @@ export declare type ConditionStepProps = {
35
35
  showSuffix?: boolean;
36
36
  hoverDisabled?: boolean;
37
37
  inputProps?: InputProps;
38
+ readOnly?: boolean;
38
39
  };
@@ -14,7 +14,9 @@ export var StepHeader = function StepHeader(_ref) {
14
14
  duplicateStep = _ref.duplicateStep,
15
15
  removeStep = _ref.removeStep,
16
16
  index = _ref.index,
17
- draggableEnabled = _ref.draggableEnabled;
17
+ draggableEnabled = _ref.draggableEnabled,
18
+ _ref$readOnly = _ref.readOnly,
19
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
18
20
  var onChangeNameDebounce = React.useCallback(debounce(updateStepName || NOOP, 300), [updateStepName]);
19
21
 
20
22
  var _React$useState = React.useState(stepName),
@@ -28,15 +30,11 @@ export var StepHeader = function StepHeader(_ref) {
28
30
  setLocalName(event.target.value);
29
31
  onChangeNameDebounce(stepId, event.target.value);
30
32
  }, [onChangeNameDebounce, stepId]);
31
- return /*#__PURE__*/React.createElement(S.StepHeader, {
32
- className: "ds-condition-step-header",
33
- draggable: draggableEnabled
34
- }, /*#__PURE__*/React.createElement(S.LeftSide, null, draggableEnabled && /*#__PURE__*/React.createElement(S.DragIcon, {
33
+ var dragHandleElement = !readOnly && draggableEnabled && /*#__PURE__*/React.createElement(S.DragIcon, {
35
34
  className: "step-drag-handler",
36
35
  component: /*#__PURE__*/React.createElement(DragHandleM, null)
37
- }), /*#__PURE__*/React.createElement(S.StepName, {
38
- className: "ds-condition-step-name"
39
- }, "" + (index + 1), ' ', /*#__PURE__*/React.createElement(InlineEdit, {
36
+ });
37
+ var stepNameElement = readOnly ? localName : /*#__PURE__*/React.createElement(InlineEdit, {
40
38
  size: "small",
41
39
  input: {
42
40
  value: localName,
@@ -44,7 +42,8 @@ export var StepHeader = function StepHeader(_ref) {
44
42
  placeholder: texts.stepNamePlaceholder,
45
43
  onChange: handleChangeName
46
44
  }
47
- }))), /*#__PURE__*/React.createElement(S.StepCruds, null, /*#__PURE__*/React.createElement(Cruds, {
45
+ });
46
+ var crudElement = !readOnly && /*#__PURE__*/React.createElement(S.StepCruds, null, /*#__PURE__*/React.createElement(Cruds, {
48
47
  onDuplicate: duplicateStep ? function () {
49
48
  return duplicateStep(stepId);
50
49
  } : undefined,
@@ -53,5 +52,13 @@ export var StepHeader = function StepHeader(_ref) {
53
52
  } : undefined,
54
53
  duplicateTooltip: texts.duplicateTooltip,
55
54
  deleteTooltip: texts.removeTooltip
56
- })));
55
+ }));
56
+ return /*#__PURE__*/React.createElement(S.StepHeader, {
57
+ className: "ds-condition-step-header",
58
+ draggable: draggableEnabled
59
+ }, /*#__PURE__*/React.createElement(S.LeftSide, null, dragHandleElement, /*#__PURE__*/React.createElement(S.StepName, {
60
+ className: "ds-condition-step-name"
61
+ }, /*#__PURE__*/React.createElement(S.StepIndexWrapper, {
62
+ readOnly: readOnly
63
+ }, "" + (index + 1)), stepNameElement)), crudElement);
57
64
  };
@@ -9,4 +9,5 @@ export declare type StepHeaderProps = {
9
9
  duplicateStep: ConditionProps['duplicateStep'];
10
10
  updateStepName: ConditionProps['onUpdateStepName'];
11
11
  draggableEnabled: boolean;
12
+ readOnly?: boolean;
12
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-condition",
3
- "version": "0.18.11",
3
+ "version": "0.19.1",
4
4
  "description": "Condition UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -33,14 +33,14 @@
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
35
  "@synerise/ds-button": "^0.17.10",
36
- "@synerise/ds-context-selector": "^0.14.12",
36
+ "@synerise/ds-context-selector": "^0.15.1",
37
37
  "@synerise/ds-core": "^0.38.0",
38
38
  "@synerise/ds-cruds": "^0.3.18",
39
- "@synerise/ds-factors": "^0.15.16",
39
+ "@synerise/ds-factors": "^0.16.1",
40
40
  "@synerise/ds-icon": "^0.52.0",
41
- "@synerise/ds-inline-edit": "^0.6.41",
42
- "@synerise/ds-operators": "^0.9.29",
43
- "@synerise/ds-subject": "^0.9.29",
41
+ "@synerise/ds-inline-edit": "^0.6.42",
42
+ "@synerise/ds-operators": "^0.10.1",
43
+ "@synerise/ds-subject": "^0.9.30",
44
44
  "@synerise/ds-tooltip": "^0.11.18",
45
45
  "@synerise/ds-utils": "^0.19.0",
46
46
  "react-sortablejs": "^6.0.0"
@@ -49,5 +49,5 @@
49
49
  "@synerise/ds-core": "*",
50
50
  "react": ">=16.9.0 < 17.0.0"
51
51
  },
52
- "gitHead": "6b7a49d1e4ab90ba861c6037226988f9629b744e"
52
+ "gitHead": "dc78070c73476c9959230e11a5ae020d413e5c16"
53
53
  }