@synerise/ds-condition 0.26.4 → 0.27.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.js +4 -10
- package/dist/ConditionStep/ConditionRow/ConditionRow.js +18 -12
- package/dist/ConditionStep/ConditionRow/ConditionRow.types.d.ts +3 -3
- package/dist/ConditionStep/ConditionStep.js +2 -7
- package/dist/modules.d.js +1 -1
- package/package.json +15 -15
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.27.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.26.4...@synerise/ds-condition@0.27.0) (2025-01-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* antd@4.24 react@18 ([d97a667](https://github.com/Synerise/synerise-design/commit/d97a667b1f33aed3177e1851de3b6f60be2d46a6))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.26.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.26.3...@synerise/ds-condition@0.26.4) (2025-01-21)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-condition
|
package/dist/Condition.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
2
|
import React, { useEffect, useState, useCallback, useMemo } from 'react';
|
|
8
3
|
import { useIntl } from 'react-intl';
|
|
9
4
|
import { ReactSortable } from 'react-sortablejs';
|
|
10
5
|
import Icon, { Add3M } from '@synerise/ds-icon';
|
|
11
6
|
import Button from '@synerise/ds-button';
|
|
12
|
-
import { NOOP } from '@synerise/ds-utils';
|
|
13
|
-
import usePrevious from '@synerise/ds-utils/dist/usePrevious/usePrevious';
|
|
7
|
+
import { NOOP, usePrevious } from '@synerise/ds-utils';
|
|
14
8
|
import { ConditionStep } from './ConditionStep';
|
|
15
9
|
import * as S from './Condition.style';
|
|
16
10
|
import { SORTABLE_CONFIG, DEFAULT_CONDITION, DEFAULT_FIELD, DEFAULT_STEP, OPERATOR, FACTOR, PARAMETER, SUBJECT, DEFAULT_INPUT_PROPS, ACTION_ATTRIBUTE } from './constants';
|
|
@@ -52,7 +46,7 @@ var Condition = function Condition(props) {
|
|
|
52
46
|
var _useIntl = useIntl(),
|
|
53
47
|
formatMessage = _useIntl.formatMessage;
|
|
54
48
|
var text = useMemo(function () {
|
|
55
|
-
return
|
|
49
|
+
return _extends({
|
|
56
50
|
addStep: formatMessage({
|
|
57
51
|
id: 'DS.CONDITION.ADD-STEP',
|
|
58
52
|
defaultMessage: 'and then...'
|
|
@@ -178,7 +172,7 @@ var Condition = function Condition(props) {
|
|
|
178
172
|
}
|
|
179
173
|
}, [autoClearCondition, onChangeFactorValue, onChangeOperator, onChangeParameter]);
|
|
180
174
|
var selectOperator = useCallback(function (stepId, conditionId, value) {
|
|
181
|
-
if (conditionId && onChangeOperator) {
|
|
175
|
+
if (conditionId && onChangeOperator && value && 'groupId' in value) {
|
|
182
176
|
autoClearCondition && onChangeFactorValue && onChangeFactorValue(stepId, conditionId, undefined);
|
|
183
177
|
onChangeOperator(stepId, conditionId, value);
|
|
184
178
|
setCurrentConditionId(conditionId);
|
|
@@ -265,7 +259,7 @@ var Condition = function Condition(props) {
|
|
|
265
259
|
onDeactivate: handleClearActiveCondition,
|
|
266
260
|
showSuffix: showSuffix,
|
|
267
261
|
hoverDisabled: hoverDisabled || currentStepId !== step.id && currentStepId !== undefined,
|
|
268
|
-
inputProps:
|
|
262
|
+
inputProps: _extends({}, DEFAULT_INPUT_PROPS, inputProps),
|
|
269
263
|
readOnly: readOnly,
|
|
270
264
|
singleStepCondition: singleStepCondition,
|
|
271
265
|
showActionAttribute: showActionAttribute,
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
2
|
import React, { useMemo } from 'react';
|
|
8
3
|
import Factors from '@synerise/ds-factors';
|
|
9
4
|
import Operators from '@synerise/ds-operators';
|
|
@@ -80,8 +75,8 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
80
75
|
}
|
|
81
76
|
var conditionFactorProps = useMemo(function () {
|
|
82
77
|
var _conditionFactor$para, _conditionFactor$para2;
|
|
83
|
-
return
|
|
84
|
-
parameters: (conditionFactor == null ? void 0 : conditionFactor.parameters) &&
|
|
78
|
+
return _extends({}, conditionFactor, {
|
|
79
|
+
parameters: (conditionFactor == null ? void 0 : conditionFactor.parameters) && _extends({}, conditionFactor.parameters, {
|
|
85
80
|
selectedButtonColored: ((_conditionFactor$para = conditionFactor.parameters) == null ? void 0 : _conditionFactor$para.selectedButtonColored) === undefined ? true : (_conditionFactor$para2 = conditionFactor.parameters) == null ? void 0 : _conditionFactor$para2.selectedButtonColored
|
|
86
81
|
})
|
|
87
82
|
});
|
|
@@ -102,7 +97,11 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
102
97
|
}), /*#__PURE__*/React.createElement(S.ConditionRowLine, null, /*#__PURE__*/React.createElement(S.ConditionRowDefinition, null, /*#__PURE__*/React.createElement(S.ConditionWrapper, {
|
|
103
98
|
"data-testid": "condition-parameter-wrapper",
|
|
104
99
|
withRemoveTrigger: lastConditionWrapper === 'parameter'
|
|
105
|
-
}, renderConditionParameterWrapper && /*#__PURE__*/React.createElement(Factors, _extends({
|
|
100
|
+
}, renderConditionParameterWrapper && /*#__PURE__*/React.createElement(Factors, _extends({
|
|
101
|
+
selectedFactorType: "",
|
|
102
|
+
defaultFactorType: "",
|
|
103
|
+
value: ""
|
|
104
|
+
}, conditionParameter, {
|
|
106
105
|
inputProps: inputProps,
|
|
107
106
|
getPopupContainerOverride: getPopupContainerOverride || getPopupContainer,
|
|
108
107
|
onActivate: function onActivate() {
|
|
@@ -114,11 +113,14 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
114
113
|
},
|
|
115
114
|
opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === PARAMETER,
|
|
116
115
|
readOnly: readOnly,
|
|
117
|
-
error: Boolean(conditionParameter.errorText)
|
|
116
|
+
error: Boolean(conditionParameter == null ? void 0 : conditionParameter.errorText)
|
|
118
117
|
})), lastConditionWrapper === 'parameter' && removeConditionTrigger), renderConditionOperatorWrapper && /*#__PURE__*/React.createElement(S.ConditionWrapper, {
|
|
119
118
|
"data-testid": "condition-operator-wrapper",
|
|
120
119
|
withRemoveTrigger: lastConditionWrapper === 'operator'
|
|
121
|
-
}, /*#__PURE__*/React.createElement(Operators, _extends({
|
|
120
|
+
}, /*#__PURE__*/React.createElement(Operators, _extends({
|
|
121
|
+
groups: [],
|
|
122
|
+
items: []
|
|
123
|
+
}, conditionOperator, {
|
|
122
124
|
getPopupContainerOverride: getPopupContainerOverride || getPopupContainer,
|
|
123
125
|
onActivate: function onActivate() {
|
|
124
126
|
return _onActivate && _onActivate(OPERATOR);
|
|
@@ -129,11 +131,15 @@ export var ConditionRow = function ConditionRow(_ref) {
|
|
|
129
131
|
},
|
|
130
132
|
opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === OPERATOR,
|
|
131
133
|
readOnly: readOnly,
|
|
132
|
-
errorText: conditionOperator.errorText
|
|
134
|
+
errorText: conditionOperator == null ? void 0 : conditionOperator.errorText
|
|
133
135
|
})), lastConditionWrapper === 'operator' && removeConditionTrigger), renderConditionFactorWrapper && /*#__PURE__*/React.createElement(S.ConditionWrapper, {
|
|
134
136
|
"data-testid": "condition-factor-wrapper",
|
|
135
137
|
withRemoveTrigger: lastConditionWrapper === 'factor'
|
|
136
|
-
}, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({
|
|
138
|
+
}, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({
|
|
139
|
+
selectedFactorType: "",
|
|
140
|
+
defaultFactorType: "",
|
|
141
|
+
value: ""
|
|
142
|
+
}, conditionFactorProps, {
|
|
137
143
|
inputProps: inputProps,
|
|
138
144
|
getPopupContainerOverride: getPopupContainerOverride || getPopupContainer,
|
|
139
145
|
onActivate: function onActivate() {
|
|
@@ -10,9 +10,9 @@ export type ConditionRowProps = {
|
|
|
10
10
|
onDeactivate?: () => void;
|
|
11
11
|
conditionId: React.ReactText;
|
|
12
12
|
addCondition?: (stepId: React.ReactText) => void;
|
|
13
|
-
conditionParameter
|
|
14
|
-
conditionOperator
|
|
15
|
-
conditionFactor
|
|
13
|
+
conditionParameter?: Omit<FactorsProps, 'onChangeValue'>;
|
|
14
|
+
conditionOperator?: Omit<OperatorsProps, 'onChange'>;
|
|
15
|
+
conditionFactor?: Omit<FactorsProps, 'onChangeValue'>;
|
|
16
16
|
removeCondition: ConditionProps['removeCondition'];
|
|
17
17
|
minConditionLength: ConditionProps['minConditionsLength'];
|
|
18
18
|
maxConditionLength: ConditionProps['maxConditionsLength'];
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
2
|
import React, { useCallback, useMemo } from 'react';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
8
4
|
import Subject from '@synerise/ds-subject';
|
|
9
5
|
import ContextSelector from '@synerise/ds-context-selector';
|
|
10
|
-
import { useIntl } from 'react-intl';
|
|
11
6
|
import { DragHandleM } from '@synerise/ds-icon';
|
|
12
7
|
import Factors from '@synerise/ds-factors';
|
|
13
8
|
import * as S from '../Condition.style';
|
|
@@ -58,7 +53,7 @@ export var ConditionStep = function ConditionStep(_ref) {
|
|
|
58
53
|
var _useIntl = useIntl(),
|
|
59
54
|
formatMessage = _useIntl.formatMessage;
|
|
60
55
|
var text = useMemo(function () {
|
|
61
|
-
return
|
|
56
|
+
return _extends({
|
|
62
57
|
stepNamePlaceholder: formatMessage({
|
|
63
58
|
id: 'DS.CONDITION.STEP_NAME-PLACEHOLDER',
|
|
64
59
|
defaultMessage: 'Step name'
|
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import '@testing-library/jest-dom
|
|
1
|
+
import '@testing-library/jest-dom';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-condition",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Condition UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,26 +34,26 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-button": "^0.
|
|
38
|
-
"@synerise/ds-context-selector": "^0.
|
|
39
|
-
"@synerise/ds-cruds": "^0.
|
|
40
|
-
"@synerise/ds-factors": "^0.
|
|
41
|
-
"@synerise/ds-icon": "^0.
|
|
42
|
-
"@synerise/ds-inline-edit": "^0.
|
|
43
|
-
"@synerise/ds-input": "^0.
|
|
44
|
-
"@synerise/ds-operators": "^0.
|
|
45
|
-
"@synerise/ds-subject": "^0.
|
|
46
|
-
"@synerise/ds-tooltip": "^0.
|
|
47
|
-
"@synerise/ds-utils": "^0.
|
|
37
|
+
"@synerise/ds-button": "^0.23.0",
|
|
38
|
+
"@synerise/ds-context-selector": "^0.26.0",
|
|
39
|
+
"@synerise/ds-cruds": "^0.6.0",
|
|
40
|
+
"@synerise/ds-factors": "^0.28.0",
|
|
41
|
+
"@synerise/ds-icon": "^0.71.0",
|
|
42
|
+
"@synerise/ds-inline-edit": "^0.10.0",
|
|
43
|
+
"@synerise/ds-input": "^0.25.0",
|
|
44
|
+
"@synerise/ds-operators": "^0.15.0",
|
|
45
|
+
"@synerise/ds-subject": "^0.11.0",
|
|
46
|
+
"@synerise/ds-tooltip": "^0.15.0",
|
|
47
|
+
"@synerise/ds-utils": "^0.32.0",
|
|
48
48
|
"lodash": "^4.17.19",
|
|
49
49
|
"react-sortablejs": "^6.0.0",
|
|
50
50
|
"sortablejs": "1.15.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@synerise/ds-core": "*",
|
|
54
|
-
"react": ">=16.9.0 <=
|
|
54
|
+
"react": ">=16.9.0 <= 18.3.1",
|
|
55
55
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
56
|
-
"styled-components": "5.
|
|
56
|
+
"styled-components": "^5.3.3"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "fbde34e126b492edaf148e469ab96247a891d6df"
|
|
59
59
|
}
|