@synerise/ds-condition 0.12.2 → 0.12.6

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,38 @@
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.12.6](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.12.5...@synerise/ds-condition@0.12.6) (2021-12-20)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-condition
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.12.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.12.4...@synerise/ds-condition@0.12.5) (2021-12-01)
15
+
16
+ **Note:** Version bump only for package @synerise/ds-condition
17
+
18
+
19
+
20
+
21
+
22
+ ## [0.12.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.12.3...@synerise/ds-condition@0.12.4) (2021-11-23)
23
+
24
+ **Note:** Version bump only for package @synerise/ds-condition
25
+
26
+
27
+
28
+
29
+
30
+ ## [0.12.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.12.2...@synerise/ds-condition@0.12.3) (2021-11-22)
31
+
32
+ **Note:** Version bump only for package @synerise/ds-condition
33
+
34
+
35
+
36
+
37
+
6
38
  ## [0.12.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.12.1...@synerise/ds-condition@0.12.2) (2021-11-16)
7
39
 
8
40
  **Note:** Version bump only for package @synerise/ds-condition
package/dist/Condition.js CHANGED
@@ -1,18 +1,6 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
-
5
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
-
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
-
9
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
-
11
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
-
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
-
15
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
16
4
 
17
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
18
6
 
@@ -76,24 +64,20 @@ var Condition = function Condition(props) {
76
64
  }, [texts, formatMessage]);
77
65
 
78
66
  var _React$useState = React.useState(DEFAULT_CONDITION),
79
- _React$useState2 = _slicedToArray(_React$useState, 2),
80
- currentConditionId = _React$useState2[0],
81
- setCurrentConditionId = _React$useState2[1];
67
+ currentConditionId = _React$useState[0],
68
+ setCurrentConditionId = _React$useState[1];
82
69
 
83
- var _React$useState3 = React.useState(DEFAULT_STEP),
84
- _React$useState4 = _slicedToArray(_React$useState3, 2),
85
- currentStepId = _React$useState4[0],
86
- setCurrentStepId = _React$useState4[1];
70
+ var _React$useState2 = React.useState(DEFAULT_STEP),
71
+ currentStepId = _React$useState2[0],
72
+ setCurrentStepId = _React$useState2[1];
87
73
 
88
- var _React$useState5 = React.useState(DEFAULT_FIELD),
89
- _React$useState6 = _slicedToArray(_React$useState5, 2),
90
- currentField = _React$useState6[0],
91
- setCurrentField = _React$useState6[1];
74
+ var _React$useState3 = React.useState(DEFAULT_FIELD),
75
+ currentField = _React$useState3[0],
76
+ setCurrentField = _React$useState3[1];
92
77
 
93
- var _React$useState7 = React.useState(null),
94
- _React$useState8 = _slicedToArray(_React$useState7, 2),
95
- priorityStepId = _React$useState8[0],
96
- setPriorityStepId = _React$useState8[1];
78
+ var _React$useState4 = React.useState(null),
79
+ priorityStepId = _React$useState4[0],
80
+ setPriorityStepId = _React$useState4[1];
97
81
 
98
82
  var prevSteps = usePrevious(steps);
99
83
  React.useEffect(function () {
@@ -104,7 +88,7 @@ var Condition = function Condition(props) {
104
88
 
105
89
  return {
106
90
  id: condition.id,
107
- value: (_condition$parameter = condition.parameter) === null || _condition$parameter === void 0 ? void 0 : _condition$parameter.value
91
+ value: (_condition$parameter = condition.parameter) == null ? void 0 : _condition$parameter.value
108
92
  };
109
93
  });
110
94
  var oldStep = prevSteps.find(function (prevStep) {
@@ -122,7 +106,7 @@ var Condition = function Condition(props) {
122
106
  } else {
123
107
  var _step$conditions$;
124
108
 
125
- result = (_step$conditions$ = step.conditions[0]) === null || _step$conditions$ === void 0 ? void 0 : _step$conditions$.id;
109
+ result = (_step$conditions$ = step.conditions[0]) == null ? void 0 : _step$conditions$.id;
126
110
  }
127
111
 
128
112
  return result;
@@ -211,7 +195,7 @@ var Condition = function Condition(props) {
211
195
  setList: onChangeOrder || NOOP
212
196
  }), steps.map(function (step, index) {
213
197
  return /*#__PURE__*/React.createElement(ConditionStep, {
214
- key: "step-id-".concat(step.id),
198
+ key: "step-id-" + step.id,
215
199
  step: step,
216
200
  texts: texts,
217
201
  index: index,
@@ -32,7 +32,7 @@ export var ConditionRow = function ConditionRow(_ref) {
32
32
  onActivate = _ref.onActivate,
33
33
  texts = _ref.texts;
34
34
  return /*#__PURE__*/React.createElement(S.ConditionRow, {
35
- key: "condition-row-".concat(conditionId),
35
+ key: "condition-row-" + conditionId,
36
36
  index: index
37
37
  }, /*#__PURE__*/React.createElement(S.ConditionConnections, {
38
38
  first: index === 0,
@@ -44,14 +44,14 @@ export var ConditionRow = function ConditionRow(_ref) {
44
44
  return selectParameter(stepId, conditionId, value);
45
45
  },
46
46
  opened: stepId === currentStepId && conditionId === currentConditionId && currentField === PARAMETER
47
- }))), (!conditionParameter || (conditionParameter === null || conditionParameter === void 0 ? void 0 : conditionParameter.value)) && conditionOperator && /*#__PURE__*/React.createElement(S.ConditionWrapper, null, /*#__PURE__*/React.createElement(Operators, _extends({}, conditionOperator, {
47
+ }))), (!conditionParameter || (conditionParameter == null ? void 0 : conditionParameter.value)) && conditionOperator && /*#__PURE__*/React.createElement(S.ConditionWrapper, null, /*#__PURE__*/React.createElement(Operators, _extends({}, conditionOperator, {
48
48
  getPopupContainerOverride: getPopupContainerOverride,
49
49
  onActivate: onActivate,
50
50
  onChange: function onChange(value) {
51
51
  return selectOperator(stepId, conditionId, value);
52
52
  },
53
53
  opened: stepId === currentStepId && conditionId === currentConditionId && currentField === OPERATOR
54
- }))), (conditionOperator === null || conditionOperator === void 0 ? void 0 : conditionOperator.value) && /*#__PURE__*/React.createElement(S.ConditionWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, (conditionFactor === null || conditionFactor === void 0 ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({}, conditionFactor, {
54
+ }))), (conditionOperator == null ? void 0 : conditionOperator.value) && /*#__PURE__*/React.createElement(S.ConditionWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({}, conditionFactor, {
55
55
  getPopupContainerOverride: getPopupContainerOverride,
56
56
  onActivate: onActivate,
57
57
  setSelectedFactorType: function setSelectedFactorType(factorType) {
@@ -1,6 +1,6 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4
4
 
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
6
 
@@ -111,15 +111,15 @@ export var ConditionStep = function ConditionStep(_ref) {
111
111
  stepId: step.id,
112
112
  addCondition: onAddCondition,
113
113
  conditionsNumber: step.conditions.length,
114
- selectedSubject: Boolean((_step$subject = step.subject) === null || _step$subject === void 0 ? void 0 : _step$subject.selectedItem),
115
- selectedContext: Boolean((_step$context = step.context) === null || _step$context === void 0 ? void 0 : _step$context.selectedItem)
114
+ selectedSubject: Boolean((_step$subject = step.subject) == null ? void 0 : _step$subject.selectedItem),
115
+ selectedContext: Boolean((_step$context = step.context) == null ? void 0 : _step$context.selectedItem)
116
116
  });
117
117
  }, [addCondition, onAddCondition, maxConditionsLength, step.conditions.length, step.context, step.id, step.subject, text]);
118
118
  var renderConditionRow = React.useCallback(function (condition, conditionIndex) {
119
119
  var _step$context2;
120
120
 
121
121
  return /*#__PURE__*/React.createElement(ConditionRow, {
122
- key: "step-".concat(step.id, "-condition-").concat(condition.id),
122
+ key: "step-" + step.id + "-condition-" + condition.id,
123
123
  index: conditionIndex,
124
124
  conditionId: condition.id,
125
125
  addCondition: addCondition,
@@ -138,17 +138,17 @@ export var ConditionStep = function ConditionStep(_ref) {
138
138
  selectParameter: selectParameter,
139
139
  selectOperator: selectOperator,
140
140
  getPopupContainerOverride: getPopupContainerOverride || function () {
141
- return document.querySelector("#condition-step-".concat(step.id)) || document.body;
141
+ return document.querySelector("#condition-step-" + step.id) || document.body;
142
142
  },
143
143
  setStepConditionFactorType: setStepConditionFactorType,
144
144
  setStepConditionFactorValue: setStepConditionFactorValue,
145
145
  texts: text,
146
- stepType: (_step$context2 = step.context) === null || _step$context2 === void 0 ? void 0 : _step$context2.type
146
+ stepType: (_step$context2 = step.context) == null ? void 0 : _step$context2.type
147
147
  });
148
148
  }, [getPopupContainerOverride, addCondition, currentConditionId, currentField, currentStepId, maxConditionsLength, minConditionsLength, removeCondition, selectOperator, selectParameter, setStepConditionFactorType, setStepConditionFactorValue, step.conditions.length, step.context, step.id, text, onActivate]);
149
149
  return /*#__PURE__*/React.createElement(S.Step, {
150
150
  key: step.id,
151
- id: "condition-step-".concat(step.id),
151
+ id: "condition-step-" + step.id,
152
152
  "data-dropLabel": text.dropLabel,
153
153
  style: hasPriority ? {
154
154
  zIndex: 10001
@@ -1,15 +1,3 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
1
  import InlineEdit from '@synerise/ds-inline-edit';
14
2
  import * as React from 'react';
15
3
  import Cruds from '@synerise/ds-cruds';
@@ -31,9 +19,8 @@ export var StepHeader = function StepHeader(_ref) {
31
19
  var onChangeNameDebounce = React.useCallback(debounce(updateStepName, 300), [updateStepName]);
32
20
 
33
21
  var _React$useState = React.useState(stepName),
34
- _React$useState2 = _slicedToArray(_React$useState, 2),
35
- localName = _React$useState2[0],
36
- setLocalName = _React$useState2[1];
22
+ localName = _React$useState[0],
23
+ setLocalName = _React$useState[1];
37
24
 
38
25
  React.useEffect(function () {
39
26
  setLocalName(stepName);
@@ -42,11 +29,11 @@ export var StepHeader = function StepHeader(_ref) {
42
29
  setLocalName(event.target.value);
43
30
  onChangeNameDebounce(stepId, event.target.value);
44
31
  }, [onChangeNameDebounce, stepId]);
45
- return /*#__PURE__*/React.createElement(S.StepHeader, null, updateStepName && /*#__PURE__*/React.createElement(S.StepName, null, "".concat(index + 1, "."), ' ', /*#__PURE__*/React.createElement(InlineEdit, {
32
+ return /*#__PURE__*/React.createElement(S.StepHeader, null, updateStepName && /*#__PURE__*/React.createElement(S.StepName, null, index + 1 + ".", ' ', /*#__PURE__*/React.createElement(InlineEdit, {
46
33
  size: "small",
47
34
  input: {
48
35
  value: localName,
49
- name: "condition-step-name-".concat(stepId),
36
+ name: "condition-step-name-" + stepId,
50
37
  placeholder: texts.stepNamePlaceholder,
51
38
  onChange: handleChangeName
52
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-condition",
3
- "version": "0.12.2",
3
+ "version": "0.12.6",
4
4
  "description": "Condition UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -32,16 +32,16 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-button": "^0.16.1",
36
- "@synerise/ds-context-selector": "^0.8.2",
37
- "@synerise/ds-core": "^0.31.1",
38
- "@synerise/ds-cruds": "^0.3.1",
39
- "@synerise/ds-factors": "^0.10.2",
40
- "@synerise/ds-icon": "^0.46.1",
41
- "@synerise/ds-inline-edit": "^0.5.2",
42
- "@synerise/ds-operators": "^0.6.2",
43
- "@synerise/ds-subject": "^0.6.2",
44
- "@synerise/ds-tooltip": "^0.11.1",
35
+ "@synerise/ds-button": "^0.16.2",
36
+ "@synerise/ds-context-selector": "^0.8.5",
37
+ "@synerise/ds-core": "^0.31.2",
38
+ "@synerise/ds-cruds": "^0.3.2",
39
+ "@synerise/ds-factors": "^0.10.6",
40
+ "@synerise/ds-icon": "^0.46.2",
41
+ "@synerise/ds-inline-edit": "^0.5.6",
42
+ "@synerise/ds-operators": "^0.6.5",
43
+ "@synerise/ds-subject": "^0.6.5",
44
+ "@synerise/ds-tooltip": "^0.11.2",
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": "8e667a88a48d774c550ff4766de71c4aab01f5a9"
52
+ "gitHead": "dd78d8abea639d2d77cf841f8b41a1382cf8d827"
53
53
  }