@carbon/ibm-products 2.43.2-canary.54 → 2.43.2-canary.56
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/css/index-full-carbon.css +103 -2
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +95 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +103 -2
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +103 -2
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +21 -11
- package/es/components/ConditionBuilder/ConditionBuilder.js +15 -5
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +58 -36
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +21 -9
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +8 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +17 -9
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +19 -10
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -17
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +36 -39
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +36 -38
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +20 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +8 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +9 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +9 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +10 -5
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +19 -7
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +23 -17
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +31 -14
- package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/useTranslations.js +26 -0
- package/es/components/ConditionBuilder/utils/util.js +1 -9
- package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +20 -10
- package/lib/components/ConditionBuilder/ConditionBuilder.js +15 -5
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +56 -33
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +20 -8
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -3
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +6 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +16 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +18 -9
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +17 -17
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +36 -39
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +36 -38
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +19 -11
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +8 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +8 -6
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +8 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -4
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +18 -6
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +21 -15
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +30 -13
- package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/useTranslations.js +30 -0
- package/lib/components/ConditionBuilder/utils/util.js +0 -9
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/package.json +3 -3
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +3 -1
- package/scss/components/HTTPErrors/_http-errors.scss +77 -0
@@ -27,6 +27,7 @@ var ConditionBuilderItemTime = require('../ConditionBuilderItem/ConditionBuilder
|
|
27
27
|
var ConditionBuilderAdd = require('../ConditionBuilderAdd/ConditionBuilderAdd.js');
|
28
28
|
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
29
29
|
var ItemOptionForValueField = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js');
|
30
|
+
var useTranslations = require('../utils/useTranslations.js');
|
30
31
|
|
31
32
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
32
33
|
|
@@ -68,6 +69,13 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
68
69
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
69
70
|
showDeletionPreview = _useState2[0],
|
70
71
|
setShowDeletionPreview = _useState2[1];
|
72
|
+
var _useTranslations = useTranslations.useTranslations(['conditionRowText', 'conditionText', 'propertyText', 'operatorText', 'removeConditionText']),
|
73
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 5),
|
74
|
+
conditionRowText = _useTranslations2[0],
|
75
|
+
conditionText = _useTranslations2[1],
|
76
|
+
propertyText = _useTranslations2[2],
|
77
|
+
operatorText = _useTranslations2[3],
|
78
|
+
removeConditionText = _useTranslations2[4];
|
71
79
|
|
72
80
|
//filtering the current property to access its properties and config options
|
73
81
|
var getCurrentConfig = function getCurrentConfig(property) {
|
@@ -89,7 +97,8 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
89
97
|
date: ConditionBuilderItemDate.ConditionBuilderItemDate,
|
90
98
|
time: ConditionBuilderItemTime.ConditionBuilderItemTime,
|
91
99
|
option: ItemOptionForValueField.ItemOptionForValueField,
|
92
|
-
custom: config === null || config === void 0 ? void 0 : config.component
|
100
|
+
custom: config === null || config === void 0 ? void 0 : config.component,
|
101
|
+
textarea: ConditionBuilderItemText.ConditionBuilderItemText
|
93
102
|
};
|
94
103
|
var ItemComponent = property ? itemComponents[type] : null;
|
95
104
|
var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
|
@@ -142,7 +151,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
142
151
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
143
152
|
className: cx__default["default"]("".concat(DataConfigs.blockClass, "__condition-block"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__condition__deletion-preview"), showDeletionPreview), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__gap-bottom"), variant == 'tree' && !(conditionIndex + 1 >= group.conditions.length)), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom"), variant == 'sentence')),
|
144
153
|
role: "row",
|
145
|
-
"aria-label":
|
154
|
+
"aria-label": conditionRowText,
|
146
155
|
tabIndex: -1
|
147
156
|
}, getAriaAttributes()), conjunction ? /*#__PURE__*/React__default["default"].createElement(ConditionConnector["default"], {
|
148
157
|
className: "".concat(DataConfigs.blockClass, "__gap"),
|
@@ -154,14 +163,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
154
163
|
role: "gridcell"
|
155
164
|
})), isStatement && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
156
165
|
label: group.statement,
|
157
|
-
title:
|
166
|
+
title: conditionText,
|
158
167
|
"data-name": "connectorField",
|
159
168
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
160
169
|
className: "".concat(DataConfigs.blockClass, "__statement-button")
|
161
170
|
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
162
171
|
conditionState: {
|
163
172
|
value: group.statement,
|
164
|
-
label:
|
173
|
+
label: conditionText
|
165
174
|
},
|
166
175
|
onChange: onStatementChangeHandler,
|
167
176
|
config: {
|
@@ -169,7 +178,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
169
178
|
}
|
170
179
|
})), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
171
180
|
label: label,
|
172
|
-
title:
|
181
|
+
title: propertyText,
|
173
182
|
renderIcon: icon !== null && icon !== void 0 ? icon : null,
|
174
183
|
className: "".concat(DataConfigs.blockClass, "__property-field"),
|
175
184
|
"data-name": "propertyField",
|
@@ -178,7 +187,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
178
187
|
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
179
188
|
conditionState: {
|
180
189
|
value: property,
|
181
|
-
label:
|
190
|
+
label: propertyText
|
182
191
|
},
|
183
192
|
onChange: onPropertyChangeHandler,
|
184
193
|
config: {
|
@@ -186,7 +195,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
186
195
|
}
|
187
196
|
})), property && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
188
197
|
label: operator,
|
189
|
-
title:
|
198
|
+
title: operatorText,
|
190
199
|
"data-name": "operatorField",
|
191
200
|
condition: condition,
|
192
201
|
type: type
|
@@ -196,7 +205,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
196
205
|
},
|
197
206
|
conditionState: {
|
198
207
|
value: operator,
|
199
|
-
label:
|
208
|
+
label: operatorText
|
200
209
|
},
|
201
210
|
onChange: onOperatorChangeHandler
|
202
211
|
})), property && operator && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
@@ -215,13 +224,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
215
224
|
},
|
216
225
|
onChange: onValueChangeHandler,
|
217
226
|
config: config,
|
227
|
+
type: type,
|
218
228
|
"data-name": "valueField"
|
219
229
|
})), /*#__PURE__*/React__default["default"].createElement("span", {
|
220
230
|
role: "gridcell",
|
221
|
-
"aria-label":
|
231
|
+
"aria-label": removeConditionText
|
222
232
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, {
|
223
233
|
hideLabel: true,
|
224
|
-
label:
|
234
|
+
label: removeConditionText,
|
225
235
|
onClick: onRemove,
|
226
236
|
onMouseEnter: handleShowDeletionPreview,
|
227
237
|
onMouseLeave: handleHideDeletionPreview,
|
@@ -26,7 +26,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
26
26
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
27
27
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
28
28
|
|
29
|
-
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions"];
|
29
|
+
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions", "translateWithId"];
|
30
30
|
|
31
31
|
// Carbon and package components we use.
|
32
32
|
/* TODO: @import(s) of carbon components and other package components. */
|
@@ -62,8 +62,10 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
62
62
|
initialState = _ref.initialState,
|
63
63
|
getConditionState = _ref.getConditionState,
|
64
64
|
getActionsState = _ref.getActionsState,
|
65
|
-
variant = _ref.variant,
|
65
|
+
_ref$variant = _ref.variant,
|
66
|
+
variant = _ref$variant === void 0 ? 'sentence' : _ref$variant,
|
66
67
|
actions = _ref.actions,
|
68
|
+
translateWithId = _ref.translateWithId,
|
67
69
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
68
70
|
var localRef = React.useRef();
|
69
71
|
var conditionBuilderRef = ref || localRef;
|
@@ -74,7 +76,8 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
74
76
|
inputConfig: inputConfig,
|
75
77
|
popOverSearchThreshold: popOverSearchThreshold,
|
76
78
|
getOptions: getOptions,
|
77
|
-
variant: variant
|
79
|
+
variant: variant,
|
80
|
+
translateWithId: translateWithId
|
78
81
|
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
79
82
|
className: cx__default["default"](DataConfigs.blockClass,
|
80
83
|
// Apply the block class to the main HTML element
|
@@ -182,7 +185,7 @@ exports.ConditionBuilder.propTypes = {
|
|
182
185
|
id: index["default"].string.isRequired,
|
183
186
|
label: index["default"].string.isRequired,
|
184
187
|
icon: index["default"].oneOfType([index["default"].func, index["default"].object]),
|
185
|
-
type: index["default"].oneOf(['text', 'number', 'date', 'option', 'time', 'custom']).isRequired,
|
188
|
+
type: index["default"].oneOf(['text', 'textarea', 'number', 'date', 'option', 'time', 'custom']).isRequired,
|
186
189
|
config: index["default"].shape({
|
187
190
|
options: index["default"].arrayOf(index["default"].shape({
|
188
191
|
id: index["default"].string.isRequired,
|
@@ -205,9 +208,16 @@ exports.ConditionBuilder.propTypes = {
|
|
205
208
|
* Provide a label to the button that starts condition builder
|
206
209
|
*/
|
207
210
|
startConditionLabel: index["default"].string.isRequired,
|
211
|
+
/**
|
212
|
+
* Optional prop, if you need to pass translations to the texts on the component instead of the defined defaults.
|
213
|
+
* This callback function will receive the message id and you need to return the corresponding text for that id.
|
214
|
+
* The message id will be one of [ "ifText","addConditionText", "addConditionGroupText", "addSubgroupText", "conditionText", "propertyText", "operatorText", "valueText", "connectorText", "conditionRowText", "removeConditionText", "addConditionRowText", "startText", "endText", "clearSearchText", "actionsText", "then", "removeActionText", "addActionText", "invalidText", "invalidNumberWarnText"]
|
215
|
+
]
|
216
|
+
*/
|
217
|
+
translateWithId: index["default"].func,
|
208
218
|
/* TODO: add types and DocGen for all props. */
|
209
219
|
/**
|
210
220
|
* Provide the condition builder variant: sentence/ tree
|
211
221
|
*/
|
212
|
-
variant: index["default"].
|
222
|
+
variant: index["default"].oneOf(['tree', 'sentence'])
|
213
223
|
};
|
package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts
CHANGED
@@ -6,8 +6,8 @@ declare function ConditionBuilderActions({ actions, className }: {
|
|
6
6
|
declare namespace ConditionBuilderActions {
|
7
7
|
namespace propTypes {
|
8
8
|
let actions: PropTypes.Requireable<(PropTypes.InferProps<{
|
9
|
-
id: PropTypes.
|
10
|
-
label: PropTypes.
|
9
|
+
id: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
10
|
+
label: PropTypes.Validator<string>;
|
11
11
|
}> | null | undefined)[]>;
|
12
12
|
let className: PropTypes.Requireable<string>;
|
13
13
|
}
|
@@ -12,20 +12,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
13
|
var React = require('react');
|
14
14
|
var index = require('../../../node_modules/prop-types/index.js');
|
15
|
+
var cx = require('classnames');
|
15
16
|
var icons = require('@carbon/react/icons');
|
16
17
|
var react = require('@carbon/react');
|
17
18
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
18
19
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
19
|
-
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
20
20
|
var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
|
21
21
|
var ConditionBuilderAdd = require('../ConditionBuilderAdd/ConditionBuilderAdd.js');
|
22
22
|
var uuidv4 = require('../../../global/js/utils/uuidv4.js');
|
23
23
|
var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
|
24
|
-
var
|
24
|
+
var useTranslations = require('../utils/useTranslations.js');
|
25
|
+
var ItemOptionForValueField = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js');
|
25
26
|
|
26
27
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
27
28
|
|
28
29
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
30
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
29
31
|
|
30
32
|
var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
31
33
|
var actions = _ref.actions,
|
@@ -33,90 +35,111 @@ var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
|
33
35
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
34
36
|
actionState = _useContext.actionState,
|
35
37
|
setActionState = _useContext.setActionState;
|
38
|
+
var _useState = React.useState(-1),
|
39
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
40
|
+
showDeletionPreview = _useState2[0],
|
41
|
+
setShowDeletionPreview = _useState2[1];
|
42
|
+
var _useTranslations = useTranslations.useTranslations(['actionsText', 'then', 'and', 'removeActionText', 'addActionText']),
|
43
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 5),
|
44
|
+
actionsText = _useTranslations2[0],
|
45
|
+
thenText = _useTranslations2[1],
|
46
|
+
andText = _useTranslations2[2],
|
47
|
+
removeActionText = _useTranslations2[3],
|
48
|
+
addActionText = _useTranslations2[4];
|
36
49
|
var addActionHandler = function addActionHandler() {
|
37
50
|
var action = {
|
38
51
|
id: uuidv4["default"](),
|
39
52
|
label: undefined,
|
40
|
-
popoverToOpen: '
|
53
|
+
popoverToOpen: 'valueField'
|
41
54
|
};
|
42
55
|
setActionState([].concat(_rollupPluginBabelHelpers.toConsumableArray(actionState), [action]));
|
43
56
|
};
|
44
|
-
var onchangeHandler = function onchangeHandler(
|
57
|
+
var onchangeHandler = function onchangeHandler(selectedId, actionIndex) {
|
45
58
|
var action = actions.find(function (action) {
|
46
59
|
return action.id === selectedId;
|
47
60
|
}); //fetch the selected action from the input action array
|
48
61
|
|
49
|
-
//if the action is duplicate, that action is added with a new id, else the same action is used.
|
50
62
|
// same actions can be added multiple times
|
51
|
-
var newAction =
|
52
|
-
id:
|
53
|
-
})
|
63
|
+
var newAction = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, action), {}, {
|
64
|
+
id: actionState[actionIndex].id
|
65
|
+
});
|
54
66
|
setActionState([].concat(_rollupPluginBabelHelpers.toConsumableArray(actionState.slice(0, actionIndex)), [newAction], _rollupPluginBabelHelpers.toConsumableArray(actionState.slice(actionIndex + 1))));
|
55
|
-
util.focusThisField(evt);
|
56
67
|
};
|
57
68
|
var onRemove = function onRemove(selectedId) {
|
58
69
|
setActionState(actionState.filter(function (action) {
|
59
70
|
return action.id !== selectedId;
|
60
71
|
}));
|
61
72
|
};
|
73
|
+
var handleShowDeletionPreview = function handleShowDeletionPreview(index) {
|
74
|
+
setShowDeletionPreview(index);
|
75
|
+
};
|
76
|
+
var handleHideDeletionPreview = function handleHideDeletionPreview() {
|
77
|
+
setShowDeletionPreview(-1);
|
78
|
+
};
|
62
79
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
63
|
-
className:
|
80
|
+
className: className
|
64
81
|
}, /*#__PURE__*/React__default["default"].createElement(react.Section, {
|
65
82
|
className: "".concat(DataConfigs.blockClass, "__heading"),
|
66
83
|
level: 4
|
67
|
-
}, /*#__PURE__*/React__default["default"].createElement(react.Heading, null,
|
68
|
-
className: "".concat(DataConfigs.blockClass, "__condition-wrapper")
|
84
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.Heading, null, actionsText)), /*#__PURE__*/React__default["default"].createElement("div", {
|
85
|
+
className: "".concat(DataConfigs.blockClass, "__condition-wrapper"),
|
86
|
+
role: "grid"
|
69
87
|
}, actionState === null || actionState === void 0 ? void 0 : actionState.map(function (action, index) {
|
70
88
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
71
89
|
key: action.id,
|
72
|
-
"
|
73
|
-
className: "".concat(DataConfigs.blockClass, "__condition-block
|
90
|
+
role: "row",
|
91
|
+
className: cx__default["default"]("".concat(DataConfigs.blockClass, "__condition-block ").concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__condition__deletion-preview"), showDeletionPreview == index))
|
74
92
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
75
93
|
className: "".concat(DataConfigs.blockClass, "__statement-button"),
|
94
|
+
tabIndex: 0,
|
76
95
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
77
|
-
label: index === 0 ?
|
96
|
+
label: index === 0 ? thenText : andText
|
78
97
|
}), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
79
98
|
label: action.label,
|
80
|
-
title:
|
81
|
-
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
99
|
+
title: actionsText,
|
82
100
|
condition: action,
|
83
|
-
"data-name": "
|
84
|
-
|
101
|
+
"data-name": "valueField",
|
102
|
+
type: "option"
|
103
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemOptionForValueField.ItemOptionForValueField, {
|
85
104
|
conditionState: {
|
86
105
|
value: action.label
|
87
106
|
},
|
88
|
-
onChange: function onChange(
|
89
|
-
return onchangeHandler(
|
107
|
+
onChange: function onChange(selection) {
|
108
|
+
return onchangeHandler(selection.id, index);
|
90
109
|
},
|
91
110
|
config: {
|
92
111
|
options: actions
|
93
112
|
}
|
94
113
|
})), /*#__PURE__*/React__default["default"].createElement("span", {
|
95
114
|
role: "gridcell",
|
96
|
-
"aria-label":
|
115
|
+
"aria-label": removeActionText
|
97
116
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, {
|
98
117
|
hideLabel: true,
|
99
|
-
label:
|
118
|
+
label: removeActionText,
|
100
119
|
onClick: function onClick() {
|
101
120
|
return onRemove(action.id);
|
102
|
-
}
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
121
|
+
},
|
122
|
+
onMouseEnter: function onMouseEnter() {
|
123
|
+
return handleShowDeletionPreview(index);
|
124
|
+
},
|
125
|
+
onMouseLeave: handleHideDeletionPreview,
|
126
|
+
onFocus: function onFocus() {
|
127
|
+
return handleShowDeletionPreview(index);
|
128
|
+
},
|
129
|
+
onBlur: handleHideDeletionPreview,
|
108
130
|
renderIcon: icons.Close,
|
109
131
|
className: "".concat(DataConfigs.blockClass, "__close-condition"),
|
110
132
|
"data-name": "closeCondition"
|
111
133
|
})), actionState.length === index + 1 && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderAdd["default"], {
|
112
134
|
onClick: addActionHandler,
|
113
135
|
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-left"),
|
114
|
-
buttonLabel:
|
136
|
+
buttonLabel: addActionText
|
115
137
|
}));
|
116
138
|
}), actionState.length === 0 && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderAdd["default"], {
|
117
139
|
onClick: addActionHandler,
|
118
140
|
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-left"),
|
119
|
-
buttonLabel:
|
141
|
+
buttonLabel: addActionText,
|
142
|
+
tabIndex: 0
|
120
143
|
})));
|
121
144
|
};
|
122
145
|
var ConditionBuilderActions$1 = ConditionBuilderActions;
|
@@ -125,8 +148,8 @@ ConditionBuilderActions.propTypes = {
|
|
125
148
|
* optional array of object that give the list of actions.
|
126
149
|
*/
|
127
150
|
actions: index["default"].arrayOf(index["default"].shape({
|
128
|
-
id: index["default"].number,
|
129
|
-
label: index["default"].string
|
151
|
+
id: index["default"].oneOfType([index["default"].string, index["default"].number]).isRequired,
|
152
|
+
label: index["default"].string.isRequired
|
130
153
|
})),
|
131
154
|
/**
|
132
155
|
* Provide an optional class to be applied to the containing node.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export default ConditionBuilderAdd;
|
2
|
-
declare function ConditionBuilderAdd({ className, onClick, addConditionSubGroupHandler, showConditionSubGroupPreviewHandler, hideConditionSubGroupPreviewHandler, showConditionPreviewHandler, hideConditionPreviewHandler, enableSubGroup, buttonLabel, }: {
|
2
|
+
declare function ConditionBuilderAdd({ className, onClick, addConditionSubGroupHandler, showConditionSubGroupPreviewHandler, hideConditionSubGroupPreviewHandler, showConditionPreviewHandler, hideConditionPreviewHandler, enableSubGroup, buttonLabel, tabIndex, }: {
|
3
3
|
className: any;
|
4
4
|
onClick: any;
|
5
5
|
addConditionSubGroupHandler: any;
|
@@ -9,6 +9,7 @@ declare function ConditionBuilderAdd({ className, onClick, addConditionSubGroupH
|
|
9
9
|
hideConditionPreviewHandler: any;
|
10
10
|
enableSubGroup: any;
|
11
11
|
buttonLabel: any;
|
12
|
+
tabIndex: any;
|
12
13
|
}): import("react/jsx-runtime").JSX.Element;
|
13
14
|
declare namespace ConditionBuilderAdd {
|
14
15
|
namespace propTypes {
|
@@ -21,6 +22,7 @@ declare namespace ConditionBuilderAdd {
|
|
21
22
|
let onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
22
23
|
let showConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
23
24
|
let showConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
25
|
+
let tabIndex: PropTypes.Requireable<number>;
|
24
26
|
}
|
25
27
|
}
|
26
28
|
import PropTypes from 'prop-types';
|
@@ -16,6 +16,7 @@ var icons = require('@carbon/react/icons');
|
|
16
16
|
var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
|
17
17
|
var index = require('../../../node_modules/prop-types/index.js');
|
18
18
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
19
|
+
var useTranslations = require('../utils/useTranslations.js');
|
19
20
|
|
20
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
21
22
|
|
@@ -31,11 +32,17 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
31
32
|
showConditionPreviewHandler = _ref.showConditionPreviewHandler,
|
32
33
|
hideConditionPreviewHandler = _ref.hideConditionPreviewHandler,
|
33
34
|
enableSubGroup = _ref.enableSubGroup,
|
34
|
-
buttonLabel = _ref.buttonLabel
|
35
|
+
buttonLabel = _ref.buttonLabel,
|
36
|
+
tabIndex = _ref.tabIndex;
|
35
37
|
var _useState = React.useState(false),
|
36
38
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
37
39
|
isAddSubgroup = _useState2[0],
|
38
40
|
setIsAddSubgroup = _useState2[1];
|
41
|
+
var _useTranslations = useTranslations.useTranslations(['addConditionText', 'addConditionRowText', 'addSubgroupText']),
|
42
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 3),
|
43
|
+
addConditionText = _useTranslations2[0],
|
44
|
+
addConditionRowText = _useTranslations2[1],
|
45
|
+
addSubgroupText = _useTranslations2[2];
|
39
46
|
var showAddSubGroup = function showAddSubGroup() {
|
40
47
|
setIsAddSubgroup(true);
|
41
48
|
};
|
@@ -63,13 +70,13 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
63
70
|
};
|
64
71
|
};
|
65
72
|
var wrapperProps = enableSubGroup ? {
|
66
|
-
role: 'gridcell'
|
67
|
-
'aria-label':
|
73
|
+
role: 'gridcell'
|
74
|
+
// 'aria-label': addSubgroupText,
|
68
75
|
} : {};
|
69
76
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
70
77
|
className: "".concat(className, " ").concat(DataConfigs.blockClass, "__add-button-wrapper"),
|
71
78
|
role: !enableSubGroup ? 'gridcell' : 'none',
|
72
|
-
"aria-label": !enableSubGroup ?
|
79
|
+
"aria-label": !enableSubGroup ? addConditionRowText : undefined,
|
73
80
|
onMouseEnter: showAddSubGroup,
|
74
81
|
onMouseLeave: hideAddSubGroup,
|
75
82
|
onFocus: showAddSubGroup,
|
@@ -78,17 +85,18 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
78
85
|
renderIcon: icons.AddAlt,
|
79
86
|
onClick: onClickHandler
|
80
87
|
}, previewHandlers(), {
|
88
|
+
wrapperProps: wrapperProps,
|
81
89
|
className: "".concat(DataConfigs.blockClass, "__add-button"),
|
82
90
|
hideLabel: true,
|
83
91
|
"data-name": "addButton",
|
84
|
-
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel :
|
85
|
-
|
92
|
+
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : addConditionText,
|
93
|
+
tabIndex: tabIndex
|
86
94
|
})), enableSubGroup && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
|
87
95
|
renderIcon: icons.TextNewLine,
|
88
96
|
onClick: addConditionSubGroupHandler,
|
89
97
|
className: cx__default["default"]("".concat(DataConfigs.blockClass, "__add_condition_group ").concat(DataConfigs.blockClass, "__gap-left")),
|
90
98
|
hideLabel: true,
|
91
|
-
label:
|
99
|
+
label: addSubgroupText,
|
92
100
|
wrapperProps: wrapperProps,
|
93
101
|
wrapperClassName: cx__default["default"]("".concat(DataConfigs.blockClass, "__add_condition_group-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__add_condition_group-wrapper--show"), isAddSubgroup))
|
94
102
|
}, previewHandlersForSubgroup())));
|
@@ -125,10 +133,14 @@ ConditionBuilderAdd.propTypes = {
|
|
125
133
|
*/
|
126
134
|
onClick: index["default"].func,
|
127
135
|
showConditionPreviewHandler: index["default"].func,
|
128
|
-
showConditionSubGroupPreviewHandler: index["default"].func
|
136
|
+
showConditionSubGroupPreviewHandler: index["default"].func,
|
129
137
|
/**
|
130
138
|
* handler for hiding sub group preview
|
131
139
|
*/
|
140
|
+
/**
|
141
|
+
* Tab index
|
142
|
+
*/
|
143
|
+
tabIndex: index["default"].number
|
132
144
|
};
|
133
145
|
|
134
146
|
exports["default"] = ConditionBuilderAdd$1;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
export function ConditionBuilderButton({ className, label, hideLabel, tooltipAlign, renderIcon: Icon, onClick, showToolTip, wrapperProps, onBlur, onFocus, onMouseEnter, onMouseLeave, isInvalid, wrapperClassName, }: {
|
1
|
+
export function ConditionBuilderButton({ className, label, hideLabel, tooltipAlign, renderIcon: Icon, onClick, showToolTip, wrapperProps, onBlur, onFocus, onMouseEnter, onMouseLeave, isInvalid, wrapperClassName, tabIndex, ...rest }: {
|
2
|
+
[x: string]: any;
|
2
3
|
className: any;
|
3
4
|
label: any;
|
4
5
|
hideLabel: any;
|
@@ -13,6 +14,7 @@ export function ConditionBuilderButton({ className, label, hideLabel, tooltipAli
|
|
13
14
|
onMouseLeave: any;
|
14
15
|
isInvalid: any;
|
15
16
|
wrapperClassName: any;
|
17
|
+
tabIndex: any;
|
16
18
|
}): import("react/jsx-runtime").JSX.Element;
|
17
19
|
export namespace ConditionBuilderButton {
|
18
20
|
namespace propTypes {
|
@@ -27,6 +29,7 @@ export namespace ConditionBuilderButton {
|
|
27
29
|
let onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
28
30
|
let renderIcon: PropTypes.Requireable<object>;
|
29
31
|
let showToolTip: PropTypes.Requireable<boolean>;
|
32
|
+
let tabIndex: PropTypes.Requireable<number>;
|
30
33
|
let tooltipAlign: PropTypes.Requireable<string>;
|
31
34
|
let wrapperClassName: PropTypes.Requireable<string>;
|
32
35
|
let wrapperProps: PropTypes.Requireable<object>;
|
@@ -23,6 +23,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
24
24
|
|
25
25
|
var _WarningAltFilled;
|
26
|
+
var _excluded = ["className", "label", "hideLabel", "tooltipAlign", "renderIcon", "onClick", "showToolTip", "wrapperProps", "onBlur", "onFocus", "onMouseEnter", "onMouseLeave", "isInvalid", "wrapperClassName", "tabIndex"];
|
26
27
|
var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
|
27
28
|
var _Icon, _span;
|
28
29
|
var className = _ref.className,
|
@@ -38,18 +39,23 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
|
|
38
39
|
onMouseEnter = _ref.onMouseEnter,
|
39
40
|
onMouseLeave = _ref.onMouseLeave,
|
40
41
|
isInvalid = _ref.isInvalid,
|
41
|
-
wrapperClassName = _ref.wrapperClassName
|
42
|
+
wrapperClassName = _ref.wrapperClassName,
|
43
|
+
tabIndex = _ref.tabIndex,
|
44
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
42
45
|
var Button = function Button() {
|
46
|
+
var _rest$dataName;
|
47
|
+
var dataName = (_rest$dataName = rest['data-name']) !== null && _rest$dataName !== void 0 ? _rest$dataName : '';
|
43
48
|
return /*#__PURE__*/React__default["default"].createElement("button", {
|
44
49
|
// role={'gridcell'}
|
45
|
-
tabIndex: -1,
|
50
|
+
tabIndex: tabIndex != undefined ? tabIndex : -1,
|
46
51
|
className: cx__default["default"]([className, "".concat(DataConfigs.blockClass, "__button"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__text-ellipsis"), showToolTip && !hideLabel && !isInvalid), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__invalid-input"), isInvalid)]),
|
47
52
|
type: "button",
|
48
53
|
onClick: onClick,
|
49
54
|
onBlur: onBlur,
|
50
55
|
onFocus: onFocus,
|
51
56
|
onMouseEnter: onMouseEnter,
|
52
|
-
onMouseLeave: onMouseLeave
|
57
|
+
onMouseLeave: onMouseLeave,
|
58
|
+
"data-name": dataName
|
53
59
|
}, Icon && (_Icon || (_Icon = /*#__PURE__*/React__default["default"].createElement(Icon, null))), !hideLabel && (_span || (_span = /*#__PURE__*/React__default["default"].createElement("span", null, label))), isInvalid && (_WarningAltFilled || (_WarningAltFilled = /*#__PURE__*/React__default["default"].createElement(icons.WarningAltFilled, null))));
|
54
60
|
};
|
55
61
|
return hideLabel || showToolTip ? /*#__PURE__*/React__default["default"].createElement(react.Tooltip, _rollupPluginBabelHelpers["extends"]({
|
@@ -96,6 +102,10 @@ ConditionBuilderButton.propTypes = {
|
|
96
102
|
*decides if tooltip to be shown
|
97
103
|
*/
|
98
104
|
showToolTip: index["default"].bool,
|
105
|
+
/**
|
106
|
+
* Tab index
|
107
|
+
*/
|
108
|
+
tabIndex: index["default"].number,
|
99
109
|
/**
|
100
110
|
* tooltip position
|
101
111
|
*/
|
@@ -17,6 +17,7 @@ var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
|
17
17
|
var index = require('../../../node_modules/prop-types/index.js');
|
18
18
|
var util = require('../utils/util.js');
|
19
19
|
var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
|
20
|
+
var useTranslations = require('../utils/useTranslations.js');
|
20
21
|
|
21
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
22
23
|
|
@@ -30,6 +31,9 @@ var ConditionConnector = function ConditionConnector(_ref) {
|
|
30
31
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
31
32
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
32
33
|
variant = _useContext.variant;
|
34
|
+
var _useTranslations = useTranslations.useTranslations(['connectorText']),
|
35
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 1),
|
36
|
+
connectorText = _useTranslations2[0];
|
33
37
|
var handleConnectorHover = React.useCallback(function (parentGroup, isHover) {
|
34
38
|
if (isHover) {
|
35
39
|
parentGroup.classList.add('hoveredConnector');
|
@@ -56,7 +60,7 @@ var ConditionConnector = function ConditionConnector(_ref) {
|
|
56
60
|
// <div className={className} {...rest}>
|
57
61
|
React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, _rollupPluginBabelHelpers["extends"]({
|
58
62
|
label: operator,
|
59
|
-
title:
|
63
|
+
title: connectorText,
|
60
64
|
"data-name": "connectorField",
|
61
65
|
onMouseEnter: activeConnectorHandler,
|
62
66
|
onMouseLeave: inActiveConnectorHandler,
|
@@ -71,7 +75,7 @@ var ConditionConnector = function ConditionConnector(_ref) {
|
|
71
75
|
},
|
72
76
|
conditionState: {
|
73
77
|
value: operator,
|
74
|
-
label:
|
78
|
+
label: connectorText
|
75
79
|
},
|
76
80
|
onChange: onChangeHandler
|
77
81
|
}))
|
@@ -9,12 +9,13 @@
|
|
9
9
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
12
13
|
var React = require('react');
|
13
14
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
14
15
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
15
16
|
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
16
|
-
var util = require('../utils/util.js');
|
17
17
|
var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
|
18
|
+
var useTranslations = require('../utils/useTranslations.js');
|
18
19
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
20
21
|
|
@@ -22,26 +23,33 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
23
|
|
23
24
|
var GroupConnector = function GroupConnector() {
|
24
25
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
25
|
-
rootState = _useContext.rootState
|
26
|
+
rootState = _useContext.rootState,
|
27
|
+
setRootState = _useContext.setRootState;
|
28
|
+
var _useTranslations = useTranslations.useTranslations(['conditionText']),
|
29
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 1),
|
30
|
+
conditionText = _useTranslations2[0];
|
31
|
+
var onStatementChangeHandler = function onStatementChangeHandler(updatedStatement) {
|
32
|
+
setRootState(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rootState), {}, {
|
33
|
+
operator: updatedStatement
|
34
|
+
}));
|
35
|
+
};
|
26
36
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
27
|
-
className: "".concat(DataConfigs.blockClass, "__group-separator"),
|
37
|
+
className: "".concat(DataConfigs.blockClass, "__group-separator ").concat(DataConfigs.blockClass, "__group-separator-row"),
|
28
38
|
role: "row",
|
29
39
|
tabIndex: -1,
|
30
40
|
"aria-level": 1
|
31
41
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
32
42
|
label: rootState.operator,
|
33
|
-
title:
|
43
|
+
title: conditionText,
|
34
44
|
"data-name": "connectorField",
|
35
45
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
36
46
|
className: "".concat(DataConfigs.blockClass, "__statement-button")
|
37
47
|
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
38
48
|
conditionState: {
|
39
49
|
value: rootState.operator,
|
40
|
-
label:
|
41
|
-
},
|
42
|
-
onChange: function onChange(v, e) {
|
43
|
-
util.focusThisField(e);
|
50
|
+
label: conditionText
|
44
51
|
},
|
52
|
+
onChange: onStatementChangeHandler,
|
45
53
|
config: {
|
46
54
|
options: DataConfigs.connectorConfig
|
47
55
|
}
|