@carbon/ibm-products 2.43.2-canary.78 → 2.43.2-canary.81
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 +252 -58
- 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 +3 -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 +72 -20
- 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 +173 -44
- 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/ActionBar/ActionBarItem.js +1 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +20 -14
- package/es/components/ConditionBuilder/ConditionBuilder.js +3 -3
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +8 -5
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +4 -2
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +4 -3
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +1 -3
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +4 -10
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +6 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +4 -2
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +47 -23
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +3 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +6 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +3 -2
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +1 -3
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +52 -32
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +51 -44
- package/es/components/ConditionBuilder/utils/util.d.ts +6 -4
- package/es/components/ConditionBuilder/utils/util.js +35 -17
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +33 -1
- package/es/components/StringFormatter/StringFormatter.js +14 -3
- package/es/components/StringFormatter/utils/enums.d.ts +20 -1
- package/es/components/StringFormatter/utils/enums.js +22 -2
- package/es/node_modules/@carbon/icon-helpers/es/index.js +49 -62
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-2.js +1020 -1058
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +881 -758
- package/lib/components/ActionBar/ActionBarItem.js +1 -1
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +19 -13
- package/lib/components/ConditionBuilder/ConditionBuilder.js +3 -3
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +8 -5
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +4 -2
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +4 -3
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +1 -3
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +4 -10
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +6 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +4 -2
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +46 -22
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +3 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +6 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +3 -2
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +1 -3
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +51 -31
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +50 -42
- package/lib/components/ConditionBuilder/utils/util.d.ts +6 -4
- package/lib/components/ConditionBuilder/utils/util.js +36 -16
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +32 -0
- package/lib/components/StringFormatter/StringFormatter.js +13 -2
- package/lib/components/StringFormatter/utils/enums.d.ts +20 -1
- package/lib/components/StringFormatter/utils/enums.js +23 -1
- package/lib/node_modules/@carbon/icon-helpers/es/index.js +49 -62
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-2.js +1036 -1074
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +946 -823
- package/package.json +5 -5
- package/scss/components/ConditionBuilder/_condition-builder.scss +4 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +6 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +1 -1
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsTearsheet.scss +7 -5
- package/scss/components/Datagrid/styles/addons/_FilterFlyout.scss +5 -4
@@ -43,7 +43,7 @@ exports.ActionBarItem = /*#__PURE__*/React__default["default"].forwardRef(functi
|
|
43
43
|
className: cx__default["default"](blockClass, className),
|
44
44
|
kind: 'ghost',
|
45
45
|
size: 'md',
|
46
|
-
align: 'bottom-
|
46
|
+
align: 'bottom-end',
|
47
47
|
type: 'button',
|
48
48
|
label: label
|
49
49
|
}), Icon ? /*#__PURE__*/React__default["default"].createElement(Icon, null) : null);
|
@@ -64,7 +64,8 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
64
64
|
isLastCondition = props.isLastCondition;
|
65
65
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
66
66
|
inputConfig = _useContext.inputConfig,
|
67
|
-
variant = _useContext.variant
|
67
|
+
variant = _useContext.variant,
|
68
|
+
conditionBuilderRef = _useContext.conditionBuilderRef;
|
68
69
|
var _useState = React.useState(false),
|
69
70
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
70
71
|
showDeletionPreview = _useState2[0],
|
@@ -80,9 +81,9 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
80
81
|
//filtering the current property to access its properties and config options
|
81
82
|
var getCurrentConfig = function getCurrentConfig(property) {
|
82
83
|
var _inputConfig$properti, _inputConfig$properti2;
|
83
|
-
return (_inputConfig$properti = (_inputConfig$properti2 = inputConfig.properties) === null || _inputConfig$properti2 === void 0 ? void 0 : _inputConfig$properti2.
|
84
|
+
return (_inputConfig$properti = (_inputConfig$properti2 = inputConfig.properties) === null || _inputConfig$properti2 === void 0 ? void 0 : _inputConfig$properti2.find(function (eachProperty) {
|
84
85
|
return eachProperty.id == property;
|
85
|
-
})
|
86
|
+
})) !== null && _inputConfig$properti !== void 0 ? _inputConfig$properti : {};
|
86
87
|
};
|
87
88
|
var _getCurrentConfig = getCurrentConfig(property),
|
88
89
|
icon = _getCurrentConfig.icon,
|
@@ -102,7 +103,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
102
103
|
};
|
103
104
|
var ItemComponent = property ? itemComponents[type] : null;
|
104
105
|
var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
|
105
|
-
util.focusThisField(evt);
|
106
|
+
util.focusThisField(evt, conditionBuilderRef);
|
106
107
|
onStatementChange(v);
|
107
108
|
};
|
108
109
|
var onPropertyChangeHandler = function onPropertyChangeHandler(newProperty) {
|
@@ -110,19 +111,20 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
110
111
|
property: newProperty,
|
111
112
|
operator: undefined,
|
112
113
|
value: '',
|
113
|
-
popoverToOpen: 'operatorField'
|
114
|
+
popoverToOpen: util.checkIsValid(newProperty) ? 'operatorField' : ''
|
114
115
|
}));
|
115
116
|
};
|
116
117
|
var onOperatorChangeHandler = function onOperatorChangeHandler(newOperator) {
|
117
118
|
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, condition), {}, {
|
118
119
|
operator: newOperator,
|
119
120
|
value: undefined,
|
120
|
-
popoverToOpen: 'valueField'
|
121
|
+
popoverToOpen: util.checkIsValid(newOperator) ? 'valueField' : ''
|
121
122
|
}));
|
122
123
|
};
|
123
|
-
var onValueChangeHandler = function onValueChangeHandler(newValue) {
|
124
|
+
var onValueChangeHandler = function onValueChangeHandler(newValue, evt) {
|
124
125
|
var currentCondition = _rollupPluginBabelHelpers.objectSpread2({}, condition);
|
125
126
|
delete currentCondition.popoverToOpen;
|
127
|
+
util.focusThisField(evt, conditionBuilderRef);
|
126
128
|
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, currentCondition), {}, {
|
127
129
|
value: newValue
|
128
130
|
}));
|
@@ -158,7 +160,8 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
158
160
|
onChange: onValueChangeHandler,
|
159
161
|
config: config,
|
160
162
|
"data-name": "valueField",
|
161
|
-
parentRef: popoverRef
|
163
|
+
parentRef: popoverRef,
|
164
|
+
type: type
|
162
165
|
});
|
163
166
|
};
|
164
167
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
@@ -189,13 +192,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
189
192
|
options: DataConfigs.statementConfig
|
190
193
|
}
|
191
194
|
})), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
192
|
-
label: label,
|
195
|
+
label: label !== null && label !== void 0 ? label : condition === null || condition === void 0 ? void 0 : condition.property,
|
193
196
|
title: propertyText,
|
194
197
|
renderIcon: icon !== null && icon !== void 0 ? icon : null,
|
195
198
|
className: "".concat(DataConfigs.blockClass, "__property-field"),
|
196
199
|
"data-name": "propertyField",
|
197
200
|
condition: condition,
|
198
|
-
type: type
|
201
|
+
type: type,
|
202
|
+
onChange: onPropertyChangeHandler
|
199
203
|
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
200
204
|
conditionState: {
|
201
205
|
value: property,
|
@@ -205,12 +209,13 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
205
209
|
config: {
|
206
210
|
options: inputConfig.properties
|
207
211
|
}
|
208
|
-
})), property && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
212
|
+
})), util.checkIsValid(property) && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
209
213
|
label: operator,
|
210
214
|
title: operatorText,
|
211
215
|
"data-name": "operatorField",
|
212
216
|
condition: condition,
|
213
|
-
type: type
|
217
|
+
type: type,
|
218
|
+
onChange: onOperatorChangeHandler
|
214
219
|
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
215
220
|
config: {
|
216
221
|
options: getOperators()
|
@@ -220,7 +225,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
220
225
|
label: operatorText
|
221
226
|
},
|
222
227
|
onChange: onOperatorChangeHandler
|
223
|
-
})), property && operator && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
228
|
+
})), util.checkIsValid(property) && util.checkIsValid(operator) && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
224
229
|
label: value,
|
225
230
|
type: type,
|
226
231
|
title: label,
|
@@ -228,6 +233,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
228
233
|
"data-name": "valueField",
|
229
234
|
condition: condition,
|
230
235
|
config: config,
|
236
|
+
onChange: onValueChangeHandler,
|
231
237
|
renderChildren: renderChildren
|
232
238
|
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
233
239
|
role: "gridcell",
|
@@ -77,7 +77,8 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
77
77
|
popOverSearchThreshold: popOverSearchThreshold,
|
78
78
|
getOptions: getOptions,
|
79
79
|
variant: variant,
|
80
|
-
translateWithId: translateWithId
|
80
|
+
translateWithId: translateWithId,
|
81
|
+
conditionBuilderRef: conditionBuilderRef
|
81
82
|
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
82
83
|
className: cx__default["default"](DataConfigs.blockClass,
|
83
84
|
// Apply the block class to the main HTML element
|
@@ -95,7 +96,6 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
95
96
|
onKeyDown: handleKeyDownHandler
|
96
97
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderContent["default"], {
|
97
98
|
startConditionLabel: startConditionLabel,
|
98
|
-
conditionBuilderRef: conditionBuilderRef,
|
99
99
|
getConditionState: getConditionState,
|
100
100
|
getActionsState: getActionsState,
|
101
101
|
initialState: initialState,
|
@@ -211,7 +211,7 @@ exports.ConditionBuilder.propTypes = {
|
|
211
211
|
/**
|
212
212
|
* Optional prop, if you need to pass translations to the texts on the component instead of the defined defaults.
|
213
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",
|
214
|
+
* The message id will be one of [ "ifText","addConditionText", "addConditionGroupText", "addSubgroupText", "conditionText", "propertyText", "operatorText", "valueText", "connectorText", "conditionRowText","conditionRowGroupText","conditionBuilderText","actionSectionText", "removeConditionText", "addConditionRowText", "startText", "endText", "clearSearchText", "actionsText", "then", "removeActionText", "addActionText", "invalidText", "invalidNumberWarnText"]
|
215
215
|
]
|
216
216
|
*/
|
217
217
|
translateWithId: index["default"].func,
|
@@ -39,13 +39,14 @@ var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
|
39
39
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
40
40
|
showDeletionPreview = _useState2[0],
|
41
41
|
setShowDeletionPreview = _useState2[1];
|
42
|
-
var _useTranslations = useTranslations.useTranslations(['actionsText', 'then', 'and', 'removeActionText', 'addActionText']),
|
43
|
-
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations,
|
42
|
+
var _useTranslations = useTranslations.useTranslations(['actionsText', 'then', 'and', 'removeActionText', 'addActionText', 'actionSectionText']),
|
43
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 6),
|
44
44
|
actionsText = _useTranslations2[0],
|
45
45
|
thenText = _useTranslations2[1],
|
46
46
|
andText = _useTranslations2[2],
|
47
47
|
removeActionText = _useTranslations2[3],
|
48
|
-
addActionText = _useTranslations2[4]
|
48
|
+
addActionText = _useTranslations2[4],
|
49
|
+
actionSectionText = _useTranslations2[5];
|
49
50
|
var addActionHandler = function addActionHandler() {
|
50
51
|
var action = {
|
51
52
|
id: uuidv4["default"](),
|
@@ -83,7 +84,8 @@ var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
|
83
84
|
level: 4
|
84
85
|
}, /*#__PURE__*/React__default["default"].createElement(react.Heading, null, actionsText)), /*#__PURE__*/React__default["default"].createElement("div", {
|
85
86
|
className: "".concat(DataConfigs.blockClass, "__condition-wrapper"),
|
86
|
-
role: "grid"
|
87
|
+
role: "grid",
|
88
|
+
"aria-label": actionSectionText
|
87
89
|
}, actionState === null || actionState === void 0 ? void 0 : actionState.map(function (action, index) {
|
88
90
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
89
91
|
key: action.id,
|
@@ -133,7 +135,8 @@ var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
|
133
135
|
})), actionState.length === index + 1 && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderAdd["default"], {
|
134
136
|
onClick: addActionHandler,
|
135
137
|
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-left"),
|
136
|
-
buttonLabel: addActionText
|
138
|
+
buttonLabel: addActionText,
|
139
|
+
tabIndex: 0
|
137
140
|
}));
|
138
141
|
}), actionState.length === 0 && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderAdd["default"], {
|
139
142
|
onClick: addActionHandler,
|
@@ -69,14 +69,16 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
69
69
|
onBlur: hideConditionSubGroupPreviewHandler
|
70
70
|
};
|
71
71
|
};
|
72
|
+
var getAriaLabel = function getAriaLabel() {
|
73
|
+
return buttonLabel ? buttonLabel : !enableSubGroup ? addConditionRowText : undefined;
|
74
|
+
};
|
72
75
|
var wrapperProps = enableSubGroup ? {
|
73
76
|
role: 'gridcell'
|
74
|
-
// 'aria-label': addSubgroupText,
|
75
77
|
} : {};
|
76
78
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
77
79
|
className: "".concat(className, " ").concat(DataConfigs.blockClass, "__add-button-wrapper"),
|
78
80
|
role: !enableSubGroup ? 'gridcell' : 'none',
|
79
|
-
"aria-label":
|
81
|
+
"aria-label": getAriaLabel(),
|
80
82
|
onMouseEnter: showAddSubGroup,
|
81
83
|
onMouseLeave: hideAddSubGroup,
|
82
84
|
onFocus: showAddSubGroup,
|
@@ -45,7 +45,7 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
|
|
45
45
|
var Button = function Button() {
|
46
46
|
var _rest$dataName;
|
47
47
|
var dataName = (_rest$dataName = rest['data-name']) !== null && _rest$dataName !== void 0 ? _rest$dataName : '';
|
48
|
-
return /*#__PURE__*/React__default["default"].createElement("button", {
|
48
|
+
return /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
|
49
49
|
// role={'gridcell'}
|
50
50
|
tabIndex: tabIndex != undefined ? tabIndex : -1,
|
51
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)]),
|
@@ -56,7 +56,7 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
|
|
56
56
|
onMouseEnter: onMouseEnter,
|
57
57
|
onMouseLeave: onMouseLeave,
|
58
58
|
"data-name": dataName
|
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))));
|
59
|
+
}, rest), 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))));
|
60
60
|
};
|
61
61
|
return hideLabel || showToolTip ? /*#__PURE__*/React__default["default"].createElement(react.Tooltip, _rollupPluginBabelHelpers["extends"]({
|
62
62
|
label: label,
|
@@ -30,7 +30,8 @@ var ConditionConnector = function ConditionConnector(_ref) {
|
|
30
30
|
onChange = _ref.onChange,
|
31
31
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
32
32
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
33
|
-
variant = _useContext.variant
|
33
|
+
variant = _useContext.variant,
|
34
|
+
conditionBuilderRef = _useContext.conditionBuilderRef;
|
34
35
|
var _useTranslations = useTranslations.useTranslations(['connectorText']),
|
35
36
|
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 1),
|
36
37
|
connectorText = _useTranslations2[0];
|
@@ -51,10 +52,10 @@ var ConditionConnector = function ConditionConnector(_ref) {
|
|
51
52
|
};
|
52
53
|
var onChangeHandler = function onChangeHandler(op, evt) {
|
53
54
|
onChange(op);
|
54
|
-
util.focusThisField(evt);
|
55
|
+
util.focusThisField(evt, conditionBuilderRef);
|
55
56
|
};
|
56
57
|
return variant == 'tree' ? /*#__PURE__*/React__default["default"].createElement("span", {
|
57
|
-
className: "".concat(className, " ").concat(DataConfigs.blockClass, "__connector
|
58
|
+
className: "".concat(className, " ").concat(DataConfigs.blockClass, "__connector--disabled")
|
58
59
|
}, operator) :
|
59
60
|
/*#__PURE__*/
|
60
61
|
// <div className={className} {...rest}>
|
package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
export default ConditionBuilderContent;
|
2
|
-
declare function ConditionBuilderContent({ startConditionLabel,
|
2
|
+
declare function ConditionBuilderContent({ startConditionLabel, getConditionState, getActionsState, initialState, actions, }: {
|
3
3
|
startConditionLabel: any;
|
4
|
-
conditionBuilderRef: any;
|
5
4
|
getConditionState: any;
|
6
5
|
getActionsState: any;
|
7
6
|
initialState: any;
|
@@ -13,7 +12,6 @@ declare namespace ConditionBuilderContent {
|
|
13
12
|
id: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
14
13
|
label: PropTypes.Validator<string>;
|
15
14
|
}> | null | undefined)[]>;
|
16
|
-
let conditionBuilderRef: PropTypes.Requireable<object>;
|
17
15
|
let getActionsState: PropTypes.Requireable<(...args: any[]) => any>;
|
18
16
|
let getConditionState: PropTypes.Validator<(...args: any[]) => any>;
|
19
17
|
let initialState: PropTypes.Requireable<PropTypes.InferProps<{
|
@@ -32,7 +32,6 @@ var _Heading, _GroupConnector;
|
|
32
32
|
var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
33
33
|
var _rootState$groups2;
|
34
34
|
var startConditionLabel = _ref.startConditionLabel,
|
35
|
-
conditionBuilderRef = _ref.conditionBuilderRef,
|
36
35
|
getConditionState = _ref.getConditionState,
|
37
36
|
getActionsState = _ref.getActionsState,
|
38
37
|
initialState = _ref.initialState,
|
@@ -153,13 +152,13 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
153
152
|
},
|
154
153
|
onChange: function onChange(updatedGroup) {
|
155
154
|
onChangeHandler(updatedGroup, groupIndex);
|
156
|
-
}
|
157
|
-
conditionBuilderRef: conditionBuilderRef
|
155
|
+
}
|
158
156
|
}), groupIndex < rootState.groups.length - 1 && (_GroupConnector || (_GroupConnector = /*#__PURE__*/React__default["default"].createElement(GroupConnector["default"], null))));
|
159
157
|
})), isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, variant == 'tree' && /*#__PURE__*/React__default["default"].createElement("div", {
|
160
158
|
role: "row",
|
161
159
|
tabIndex: -1,
|
162
|
-
"aria-level": 1
|
160
|
+
"aria-level": 1,
|
161
|
+
className: "".concat(DataConfigs.blockClass, "__add-group")
|
163
162
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, {
|
164
163
|
renderIcon: icons.TextNewLine,
|
165
164
|
onClick: addConditionGroupHandler,
|
@@ -182,8 +181,7 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
182
181
|
}))), isConditionBuilderActive && actions && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderActions["default"], {
|
183
182
|
actions: actions,
|
184
183
|
className: "".concat(DataConfigs.blockClass, "__actions-container"),
|
185
|
-
variant: variant
|
186
|
-
conditionBuilderRef: conditionBuilderRef
|
184
|
+
variant: variant
|
187
185
|
}));
|
188
186
|
};
|
189
187
|
var ConditionBuilderContent$1 = ConditionBuilderContent;
|
@@ -195,10 +193,6 @@ ConditionBuilderContent.propTypes = {
|
|
195
193
|
id: index["default"].oneOfType([index["default"].string, index["default"].number]).isRequired,
|
196
194
|
label: index["default"].string.isRequired
|
197
195
|
})),
|
198
|
-
/**
|
199
|
-
* ref of condition builder
|
200
|
-
*/
|
201
|
-
conditionBuilderRef: index["default"].object,
|
202
196
|
/**
|
203
197
|
* callback functions that will provide the updated action state back.
|
204
198
|
*/
|
package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts
CHANGED
@@ -18,6 +18,7 @@ export function ConditionBuilderProvider(props: any): import("react/jsx-runtime"
|
|
18
18
|
export namespace ConditionBuilderProvider {
|
19
19
|
namespace propTypes {
|
20
20
|
let children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
21
|
+
let conditionBuilderRef: PropTypes.Requireable<object>;
|
21
22
|
let getOptions: PropTypes.Requireable<(...args: any[]) => any>;
|
22
23
|
let inputConfig: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
23
24
|
properties: PropTypes.Requireable<(PropTypes.InferProps<{
|
@@ -71,7 +71,8 @@ var ConditionBuilderProvider = function ConditionBuilderProvider(props) {
|
|
71
71
|
popOverSearchThreshold: props.popOverSearchThreshold,
|
72
72
|
getOptions: props.getOptions,
|
73
73
|
variant: props.variant,
|
74
|
-
translateWithId: props.translateWithId
|
74
|
+
translateWithId: props.translateWithId,
|
75
|
+
conditionBuilderRef: props.conditionBuilderRef
|
75
76
|
}
|
76
77
|
},
|
77
78
|
// eslint-disable-next-line react/prop-types
|
@@ -82,6 +83,10 @@ ConditionBuilderProvider.propTypes = {
|
|
82
83
|
* Provide the contents of the ConditionBuilder.
|
83
84
|
*/
|
84
85
|
children: index["default"].node.isRequired,
|
86
|
+
/**
|
87
|
+
* ref of condition builder
|
88
|
+
*/
|
89
|
+
conditionBuilderRef: index["default"].object,
|
85
90
|
/**
|
86
91
|
* This is an optional callback function that will be triggered when options array is not passed in the inputConfig against a property.
|
87
92
|
* This can be a asynchronous function that need to return a promise, so it will allow to fetch options from API call.
|
@@ -24,6 +24,7 @@ export namespace translationsObject {
|
|
24
24
|
let valueText: string;
|
25
25
|
let connectorText: string;
|
26
26
|
let conditionRowText: string;
|
27
|
+
let conditionRowGroupText: string;
|
27
28
|
let removeConditionText: string;
|
28
29
|
let addConditionRowText: string;
|
29
30
|
let startText: string;
|
@@ -34,6 +35,7 @@ export namespace translationsObject {
|
|
34
35
|
let removeActionText: string;
|
35
36
|
let addActionText: string;
|
36
37
|
let invalidText: string;
|
37
|
-
let invalidDateText: string;
|
38
38
|
let invalidNumberWarnText: string;
|
39
|
+
let conditionBuilderText: string;
|
40
|
+
let actionSectionText: string;
|
39
41
|
}
|
@@ -35,6 +35,7 @@ var translationsObject = {
|
|
35
35
|
valueText: 'Value',
|
36
36
|
connectorText: 'Connector',
|
37
37
|
conditionRowText: 'Condition row',
|
38
|
+
conditionRowGroupText: 'Condition row group',
|
38
39
|
removeConditionText: 'Remove condition',
|
39
40
|
addConditionRowText: 'Add condition row',
|
40
41
|
startText: 'Start',
|
@@ -45,8 +46,9 @@ var translationsObject = {
|
|
45
46
|
removeActionText: 'Remove Action',
|
46
47
|
addActionText: 'Add action',
|
47
48
|
invalidText: 'Incomplete',
|
48
|
-
|
49
|
-
|
49
|
+
invalidNumberWarnText: 'Invalid number, must be 0 or greater',
|
50
|
+
conditionBuilderText: 'Condition Builder',
|
51
|
+
actionSectionText: 'Action Section'
|
50
52
|
};
|
51
53
|
|
52
54
|
exports.translationsObject = translationsObject;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export function ConditionBuilderItem({ children, className, label, renderIcon, title, type, showToolTip, condition, popOverClassName, config, renderChildren, ...rest }: {
|
1
|
+
export function ConditionBuilderItem({ children, className, label, renderIcon, title, type, showToolTip, condition, popOverClassName, config, renderChildren, onChange, ...rest }: {
|
2
2
|
[x: string]: any;
|
3
3
|
children: any;
|
4
4
|
className: any;
|
@@ -11,6 +11,7 @@ export function ConditionBuilderItem({ children, className, label, renderIcon, t
|
|
11
11
|
popOverClassName: any;
|
12
12
|
config: any;
|
13
13
|
renderChildren: any;
|
14
|
+
onChange: any;
|
14
15
|
}): import("react/jsx-runtime").JSX.Element;
|
15
16
|
export namespace ConditionBuilderItem {
|
16
17
|
namespace propTypes {
|
@@ -19,6 +20,7 @@ export namespace ConditionBuilderItem {
|
|
19
20
|
let condition: PropTypes.Requireable<object>;
|
20
21
|
let config: PropTypes.Requireable<object>;
|
21
22
|
let label: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
23
|
+
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
22
24
|
let popOverClassName: PropTypes.Requireable<string>;
|
23
25
|
let renderChildren: PropTypes.Requireable<(...args: any[]) => any>;
|
24
26
|
let renderIcon: PropTypes.Requireable<object>;
|
@@ -17,12 +17,14 @@ var icons = require('@carbon/react/icons');
|
|
17
17
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
18
18
|
var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
|
19
19
|
var useTranslations = require('../utils/useTranslations.js');
|
20
|
+
var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
|
21
|
+
var handleKeyboardEvents = require('../utils/handleKeyboardEvents.js');
|
20
22
|
|
21
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
22
24
|
|
23
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
24
26
|
|
25
|
-
var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config", "renderChildren"];
|
27
|
+
var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config", "renderChildren", "onChange"];
|
26
28
|
var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
27
29
|
var children = _ref.children,
|
28
30
|
className = _ref.className,
|
@@ -35,30 +37,29 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
35
37
|
popOverClassName = _ref.popOverClassName,
|
36
38
|
config = _ref.config,
|
37
39
|
renderChildren = _ref.renderChildren,
|
40
|
+
onChange = _ref.onChange,
|
38
41
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
39
|
-
var contentRef = React.useRef(null);
|
40
42
|
var popoverRef = React.useRef(null);
|
41
43
|
var _useState = React.useState(false),
|
42
44
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
43
45
|
open = _useState2[0],
|
44
46
|
setOpen = _useState2[1];
|
45
|
-
var _useTranslations = useTranslations.useTranslations(['invalidText', 'addConditionText', label
|
46
|
-
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations,
|
47
|
+
var _useTranslations = useTranslations.useTranslations(['invalidText', 'addConditionText', label]),
|
48
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 3),
|
47
49
|
invalidText = _useTranslations2[0],
|
48
50
|
addConditionText = _useTranslations2[1],
|
49
|
-
labelText = _useTranslations2[2]
|
50
|
-
|
51
|
+
labelText = _useTranslations2[2];
|
52
|
+
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
53
|
+
conditionBuilderRef = _useContext.conditionBuilderRef;
|
51
54
|
var getPropertyDetails = function getPropertyDetails() {
|
52
|
-
|
55
|
+
var _ref2 = condition || {},
|
56
|
+
property = _ref2.property,
|
57
|
+
operator = _ref2.operator;
|
58
|
+
if (label === 'INVALID' || rest['data-name'] === 'propertyField' && property === 'INVALID' || rest['data-name'] === 'operatorField' && operator === 'INVALID') {
|
53
59
|
return {
|
54
60
|
propertyLabel: invalidText,
|
55
61
|
isInvalid: true
|
56
62
|
};
|
57
|
-
} else if (label === 'INVALID_DATE') {
|
58
|
-
return {
|
59
|
-
propertyLabel: invalidDateText,
|
60
|
-
isInvalid: true
|
61
|
-
};
|
62
63
|
}
|
63
64
|
var propertyId = rest['data-name'] == 'valueField' && type ? DataConfigs.valueRenderers[type](label, config) : labelText;
|
64
65
|
return {
|
@@ -97,27 +98,46 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
97
98
|
}, [condition, label]);
|
98
99
|
React.useEffect(function () {
|
99
100
|
//this will focus the first input field in the popover
|
100
|
-
if (open &&
|
101
|
-
var firstFocusableElement =
|
101
|
+
if (open && popoverRef.current) {
|
102
|
+
var firstFocusableElement = popoverRef.current.querySelector('input,textarea');
|
102
103
|
if (firstFocusableElement) {
|
103
|
-
|
104
|
+
setTimeout(function () {
|
105
|
+
return firstFocusableElement.focus();
|
106
|
+
}, 0);
|
104
107
|
}
|
105
108
|
}
|
106
|
-
}, [
|
109
|
+
}, [popoverRef, open]);
|
110
|
+
var manageInvalidSelection = function manageInvalidSelection() {
|
111
|
+
//when the user didn't select any value , we need to show as incomplete
|
112
|
+
if (rest['data-name'] === 'propertyField' && !(condition !== null && condition !== void 0 && condition.property) || rest['data-name'] === 'operatorField' && !(condition !== null && condition !== void 0 && condition.operator) || rest['data-name'] === 'valueField' && !(condition !== null && condition !== void 0 && condition.value)) {
|
113
|
+
onChange === null || onChange === void 0 || onChange('INVALID');
|
114
|
+
}
|
115
|
+
};
|
107
116
|
var closePopover = function closePopover() {
|
108
|
-
|
117
|
+
if (open) {
|
118
|
+
manageInvalidSelection();
|
119
|
+
}
|
120
|
+
setOpen(false);
|
109
121
|
};
|
110
122
|
var openPopOver = function openPopOver() {
|
111
123
|
return setOpen(true);
|
112
124
|
};
|
113
125
|
var togglePopover = function togglePopover() {
|
114
|
-
|
126
|
+
if (children || renderChildren) {
|
127
|
+
setOpen(!open);
|
128
|
+
}
|
129
|
+
};
|
130
|
+
var handleKeyDownHandler = function handleKeyDownHandler(evt) {
|
131
|
+
handleKeyboardEvents.handleKeyDownForPopover(evt, conditionBuilderRef, popoverRef);
|
132
|
+
if (evt.key === 'Escape') {
|
133
|
+
manageInvalidSelection();
|
134
|
+
}
|
115
135
|
};
|
116
136
|
return /*#__PURE__*/React__default["default"].createElement(react.Popover, {
|
117
137
|
open: open,
|
118
138
|
isTabTip: true,
|
119
139
|
role: "gridcell",
|
120
|
-
className: popOverClassName,
|
140
|
+
className: "".concat(popOverClassName, " ").concat(DataConfigs.blockClass, "__popover"),
|
121
141
|
ref: popoverRef,
|
122
142
|
onRequestClose: closePopover
|
123
143
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
|
@@ -132,13 +152,13 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
132
152
|
isInvalid: isInvalid,
|
133
153
|
condition: condition
|
134
154
|
}, rest)), open && /*#__PURE__*/React__default["default"].createElement(react.PopoverContent, {
|
135
|
-
className: "".concat(DataConfigs.blockClass, "
|
155
|
+
className: "".concat(DataConfigs.blockClass, "__popover-content-wrapper"),
|
136
156
|
role: "dialog",
|
137
|
-
"aria-label": title
|
157
|
+
"aria-label": title,
|
158
|
+
onKeyDown: handleKeyDownHandler
|
138
159
|
}, /*#__PURE__*/React__default["default"].createElement(react.Layer, null, /*#__PURE__*/React__default["default"].createElement("h1", {
|
139
160
|
className: "".concat(DataConfigs.blockClass, "__item__title")
|
140
161
|
}, title), /*#__PURE__*/React__default["default"].createElement("div", {
|
141
|
-
ref: contentRef,
|
142
162
|
className: "".concat(DataConfigs.blockClass, "__popover-content")
|
143
163
|
}, renderChildren ? renderChildren(popoverRef) : children))));
|
144
164
|
};
|
@@ -164,6 +184,10 @@ ConditionBuilderItem.propTypes = {
|
|
164
184
|
* text to be displayed in the field
|
165
185
|
*/
|
166
186
|
label: index["default"].oneOfType([index["default"].string, index["default"].array, index["default"].object]),
|
187
|
+
/**
|
188
|
+
* callback to update the current condition of the state tree
|
189
|
+
*/
|
190
|
+
onChange: index["default"].func,
|
167
191
|
/**
|
168
192
|
* class name for popover
|
169
193
|
*/
|
@@ -32,7 +32,7 @@ var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
|
|
32
32
|
endText = _useTranslations2[1];
|
33
33
|
var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
|
34
34
|
var onCloseHandler = function onCloseHandler(selectedDate) {
|
35
|
-
onChange(selectedDate && selectedDate.length > 0 ? selectedDate : '
|
35
|
+
onChange(selectedDate && selectedDate.length > 0 ? selectedDate : 'INVALID');
|
36
36
|
};
|
37
37
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
38
38
|
className: "".concat(blockClass, "__item-date ")
|
@@ -30,7 +30,7 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
30
30
|
invalidNumberWarnText = _useTranslations2[0];
|
31
31
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
32
32
|
var value = _ref2.value;
|
33
|
-
if (!isNaN(value) && checkIfValid(value)) {
|
33
|
+
if (value !== '' && !isNaN(value) && checkIfValid(value)) {
|
34
34
|
var _config$unit;
|
35
35
|
onChange("".concat(value, " ").concat((_config$unit = config.unit) !== null && _config$unit !== void 0 ? _config$unit : ''));
|
36
36
|
} else {
|
@@ -44,8 +44,8 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
44
44
|
return true;
|
45
45
|
};
|
46
46
|
var getDefaultValue = function getDefaultValue() {
|
47
|
-
var _conditionState$value;
|
48
|
-
return (_conditionState$value = conditionState.value) === null || _conditionState$
|
47
|
+
var _conditionState$value, _conditionState$value2;
|
48
|
+
return (_conditionState$value = (_conditionState$value2 = conditionState.value) === null || _conditionState$value2 === void 0 || (_conditionState$value2 = _conditionState$value2.split(' ')) === null || _conditionState$value2 === void 0 ? void 0 : _conditionState$value2[0]) !== null && _conditionState$value !== void 0 ? _conditionState$value : '';
|
49
49
|
};
|
50
50
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
51
51
|
className: "".concat(DataConfigs.blockClass, "__item-number")
|
@@ -121,14 +121,17 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
121
121
|
setSearchValue(value);
|
122
122
|
};
|
123
123
|
var onClickHandler = function onClickHandler(evt, option, isSelected) {
|
124
|
+
var updatedSelections = selection.filter(function (item) {
|
125
|
+
return item !== 'INVALID';
|
126
|
+
});
|
124
127
|
if (multiSelectable) {
|
125
128
|
if (isSelected) {
|
126
|
-
var items =
|
129
|
+
var items = updatedSelections.filter(function (v) {
|
127
130
|
return v.id !== option.id;
|
128
131
|
});
|
129
|
-
onChange(items.length > 0 ? items : undefined
|
132
|
+
onChange(items.length > 0 ? items : undefined);
|
130
133
|
} else {
|
131
|
-
onChange([].concat(_rollupPluginBabelHelpers.toConsumableArray(
|
134
|
+
onChange([].concat(_rollupPluginBabelHelpers.toConsumableArray(updatedSelections), [option]));
|
132
135
|
}
|
133
136
|
} else {
|
134
137
|
onChange(option, evt);
|
@@ -14,13 +14,14 @@ var React = require('react');
|
|
14
14
|
var react = require('@carbon/react');
|
15
15
|
var index = require('../../../../node_modules/prop-types/index.js');
|
16
16
|
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
17
|
+
var util = require('../../utils/util.js');
|
17
18
|
|
18
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
19
20
|
|
20
21
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
21
22
|
|
22
23
|
var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
|
23
|
-
var _conditionState$
|
24
|
+
var _conditionState$prope;
|
24
25
|
var conditionState = _ref.conditionState,
|
25
26
|
_onChange = _ref.onChange,
|
26
27
|
config = _ref.config,
|
@@ -28,7 +29,7 @@ var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
|
|
28
29
|
var inputProps = _rollupPluginBabelHelpers.objectSpread2({
|
29
30
|
labelText: conditionState.property,
|
30
31
|
hideLabel: true,
|
31
|
-
value: (
|
32
|
+
value: util.checkIsValid(conditionState.value) ? conditionState.value : '',
|
32
33
|
id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
|
33
34
|
onChange: function onChange(evt) {
|
34
35
|
_onChange(evt.target.value);
|