@carbon/ibm-products 2.45.0 → 2.46.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/css/index-full-carbon.css +261 -124
- 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 +81 -86
- 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 +182 -110
- 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/Coachmark/Coachmark.d.ts +6 -1
- package/es/components/Coachmark/Coachmark.js +37 -6
- package/es/components/Coachmark/CoachmarkOverlay.js +2 -4
- package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +1 -7
- 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 +26 -30
- 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 +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -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 +62 -32
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +52 -46
- package/es/components/ConditionBuilder/utils/util.d.ts +6 -5
- package/es/components/ConditionBuilder/utils/util.js +35 -17
- package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +6 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +77 -38
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +4 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +10 -1
- package/es/components/DataSpreadsheet/types/index.d.ts +1 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +34 -10
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +33 -1
- package/es/components/Datagrid/types/index.d.ts +14 -2
- package/es/components/Datagrid/useDisableSelectRows.d.ts +2 -1
- package/es/components/Datagrid/useDisableSelectRows.js +27 -22
- 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/components/Tearsheet/TearsheetShell.d.ts +1 -1
- package/es/components/Tearsheet/TearsheetShell.js +4 -2
- package/es/global/js/hooks/useFocus.d.ts +1 -0
- package/es/global/js/hooks/useFocus.js +5 -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/Coachmark/Coachmark.d.ts +6 -1
- package/lib/components/Coachmark/Coachmark.js +36 -5
- package/lib/components/Coachmark/CoachmarkOverlay.js +2 -4
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +1 -7
- 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 +25 -29
- 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 +4 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -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 +61 -31
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +51 -44
- package/lib/components/ConditionBuilder/utils/util.d.ts +6 -5
- package/lib/components/ConditionBuilder/utils/util.js +36 -16
- package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +6 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +77 -38
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +4 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +10 -1
- package/lib/components/DataSpreadsheet/types/index.d.ts +1 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +34 -10
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +32 -0
- package/lib/components/Datagrid/types/index.d.ts +14 -2
- package/lib/components/Datagrid/useDisableSelectRows.d.ts +2 -1
- package/lib/components/Datagrid/useDisableSelectRows.js +27 -22
- 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/components/Tearsheet/TearsheetShell.d.ts +1 -1
- package/lib/components/Tearsheet/TearsheetShell.js +3 -1
- package/lib/global/js/hooks/useFocus.d.ts +1 -0
- package/lib/global/js/hooks/useFocus.js +5 -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 +6 -6
- package/scss/components/Coachmark/_coachmark-overlay.scss +6 -70
- package/scss/components/Coachmark/_coachmark.scss +5 -4
- package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +1 -3
- 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
- package/telemetry.yml +5 -14
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { forwardRef, useState, useRef, useCallback, useEffect } from 'react';
|
10
10
|
import cx from 'classnames';
|
11
11
|
import PropTypes from '../../node_modules/prop-types/index.js';
|
@@ -17,9 +17,11 @@ import { useClickOutsideElement, useWindowEvent } from './utils/hooks.js';
|
|
17
17
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
18
18
|
import { pkg } from '../../settings.js';
|
19
19
|
import { throttle } from 'lodash';
|
20
|
+
import { Popover, PopoverContent } from '@carbon/react';
|
20
21
|
import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
|
21
22
|
|
22
|
-
var _excluded = ["align", "children", "className", "onClose", "overlayClassName", "overlayKind", "overlayRef", "
|
23
|
+
var _excluded = ["align", "autoAlign", "children", "className", "onClose", "overlayClassName", "overlayKind", "overlayRef", "positionTune", "portalTarget", "target", "theme"];
|
24
|
+
|
23
25
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
24
26
|
var blockClass = "".concat(pkg.prefix, "--coachmark");
|
25
27
|
var overlayBlockClass = "".concat(blockClass, "-overlay");
|
@@ -37,8 +39,10 @@ var defaults = {
|
|
37
39
|
*/
|
38
40
|
|
39
41
|
var Coachmark = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
42
|
+
var _positionTune$y, _positionTune$x;
|
40
43
|
var _ref$align = _ref.align,
|
41
44
|
align = _ref$align === void 0 ? defaults.align : _ref$align,
|
45
|
+
autoAlign = _ref.autoAlign,
|
42
46
|
children = _ref.children,
|
43
47
|
className = _ref.className,
|
44
48
|
_ref$onClose = _ref.onClose,
|
@@ -47,8 +51,8 @@ var Coachmark = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
47
51
|
_ref$overlayKind = _ref.overlayKind,
|
48
52
|
overlayKind = _ref$overlayKind === void 0 ? defaults.overlayKind : _ref$overlayKind,
|
49
53
|
overlayRef = _ref.overlayRef,
|
50
|
-
portalTarget = _ref.portalTarget,
|
51
54
|
positionTune = _ref.positionTune,
|
55
|
+
portalTarget = _ref.portalTarget,
|
52
56
|
target = _ref.target,
|
53
57
|
_ref$theme = _ref.theme,
|
54
58
|
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
@@ -124,6 +128,10 @@ var Coachmark = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
124
128
|
setShouldResetPosition(true);
|
125
129
|
}
|
126
130
|
};
|
131
|
+
var overlayPositionStyle = {
|
132
|
+
top: ((_positionTune$y = positionTune === null || positionTune === void 0 ? void 0 : positionTune.y) !== null && _positionTune$y !== void 0 ? _positionTune$y : 0) - 16,
|
133
|
+
left: ((_positionTune$x = positionTune === null || positionTune === void 0 ? void 0 : positionTune.x) !== null && _positionTune$x !== void 0 ? _positionTune$x : 0) - 16
|
134
|
+
};
|
127
135
|
var contextValue = {
|
128
136
|
buttonProps: {
|
129
137
|
'aria-expanded': isOpen,
|
@@ -139,7 +147,8 @@ var Coachmark = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
139
147
|
targetRect: targetRect,
|
140
148
|
targetOffset: targetOffset,
|
141
149
|
align: align,
|
142
|
-
positionTune: positionTune
|
150
|
+
positionTune: positionTune,
|
151
|
+
isOpen: isOpen
|
143
152
|
};
|
144
153
|
var handleResize = throttle(function () {
|
145
154
|
closeOverlay();
|
@@ -173,7 +182,7 @@ var Coachmark = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
173
182
|
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
174
183
|
className: cx(blockClass, "".concat(blockClass, "__").concat(theme), className),
|
175
184
|
ref: _coachmarkRef
|
176
|
-
}, rest, getDevtoolsProps(componentName)), target, isOpen && (portalNode === null || portalNode === void 0 ? void 0 : portalNode.current) && /*#__PURE__*/createPortal( /*#__PURE__*/React__default.createElement(CoachmarkOverlay, {
|
185
|
+
}, rest, getDevtoolsProps(componentName)), overlayKind !== 'tooltip' ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, target, isOpen && (portalNode === null || portalNode === void 0 ? void 0 : portalNode.current) && /*#__PURE__*/createPortal( /*#__PURE__*/React__default.createElement(CoachmarkOverlay, {
|
177
186
|
ref: _overlayRef,
|
178
187
|
fixedIsVisible: false,
|
179
188
|
kind: overlayKind,
|
@@ -181,7 +190,23 @@ var Coachmark = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
181
190
|
theme: theme,
|
182
191
|
className: cx(overlayClassName, "".concat(overlayBlockClass, "--is-visible"))
|
183
192
|
}, children), // Default to `document.body` when `portalNode` is `null`
|
184
|
-
portalNode === null || portalNode === void 0 ? void 0 : portalNode.current))
|
193
|
+
portalNode === null || portalNode === void 0 ? void 0 : portalNode.current)) : /*#__PURE__*/React__default.createElement(Popover, {
|
194
|
+
highContrast: true,
|
195
|
+
caret: true,
|
196
|
+
style: _objectSpread2({
|
197
|
+
position: 'absolute'
|
198
|
+
}, overlayPositionStyle),
|
199
|
+
align: align,
|
200
|
+
autoAlign: autoAlign,
|
201
|
+
open: isOpen
|
202
|
+
}, target, /*#__PURE__*/React__default.createElement(PopoverContent, null, isOpen && /*#__PURE__*/React__default.createElement(CoachmarkOverlay, {
|
203
|
+
ref: _overlayRef,
|
204
|
+
fixedIsVisible: false,
|
205
|
+
kind: overlayKind,
|
206
|
+
onClose: handleClose,
|
207
|
+
theme: theme,
|
208
|
+
className: cx(overlayClassName, _defineProperty({}, "".concat(overlayBlockClass, "--is-visible"), isOpen))
|
209
|
+
}, children)))));
|
185
210
|
});
|
186
211
|
var overlayRefType = typeof HTMLElement === 'undefined' ? PropTypes.object :
|
187
212
|
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
@@ -204,6 +229,11 @@ Coachmark.propTypes = {
|
|
204
229
|
* @see COACHMARK_ALIGNMENT
|
205
230
|
*/
|
206
231
|
align: PropTypes.oneOf(['bottom', 'bottom-left', 'bottom-right', 'left', 'left-top', 'left-bottom', 'right', 'right-top', 'right-bottom', 'top', 'top-left', 'top-right']),
|
232
|
+
/**
|
233
|
+
* Auto aligns the coachmark based on screen boundaries
|
234
|
+
* Applies only to Tooltip Coachmarks.
|
235
|
+
*/
|
236
|
+
autoAlign: PropTypes.bool,
|
207
237
|
/**
|
208
238
|
* Coachmark should use a single CoachmarkOverlayElements component as a child.
|
209
239
|
* @see CoachmarkOverlayElements
|
@@ -242,6 +272,7 @@ Coachmark.propTypes = {
|
|
242
272
|
/**
|
243
273
|
* Fine tune the position of the target in pixels. Applies only to Beacons.
|
244
274
|
*/
|
275
|
+
// @ts-ignore
|
245
276
|
positionTune: PropTypes.shape({
|
246
277
|
x: PropTypes.number,
|
247
278
|
y: PropTypes.number
|
@@ -55,7 +55,7 @@ var CoachmarkOverlay = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
55
55
|
var coachmark = useCoachmark();
|
56
56
|
var isBeacon = kind === COACHMARK_OVERLAY_KIND.TOOLTIP;
|
57
57
|
var isDraggable = kind === COACHMARK_OVERLAY_KIND.FLOATING;
|
58
|
-
var isVisible = className
|
58
|
+
var isVisible = className === null || className === void 0 ? void 0 : className.includes('is-visible');
|
59
59
|
var handleKeyPress = function handleKeyPress(event) {
|
60
60
|
var shiftKey = event.shiftKey,
|
61
61
|
key = event.key;
|
@@ -163,9 +163,7 @@ var CoachmarkOverlay = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
163
163
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
164
164
|
isVisible: isVisible
|
165
165
|
});
|
166
|
-
}))
|
167
|
-
className: "".concat(blockClass, "__caret")
|
168
|
-
}));
|
166
|
+
})));
|
169
167
|
});
|
170
168
|
function getWindowDimensions() {
|
171
169
|
var _window = window,
|
@@ -26,7 +26,6 @@ var defaults = {
|
|
26
26
|
* Use beacon for the target prop of a Coachmark component.
|
27
27
|
*/
|
28
28
|
var CoachmarkBeacon = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
29
|
-
var _coachmark$positionTu, _coachmark$positionTu2, _coachmark$positionTu3, _coachmark$positionTu4;
|
30
29
|
var label = _ref.label,
|
31
30
|
className = _ref.className,
|
32
31
|
_ref$kind = _ref.kind,
|
@@ -36,14 +35,9 @@ var CoachmarkBeacon = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
36
35
|
if (!coachmark) {
|
37
36
|
return _div || (_div = /*#__PURE__*/React__default.createElement("div", null, "CoachmarkBeacon is to be use exclusively within the target prop of Coachmark"));
|
38
37
|
}
|
39
|
-
var overlayPositionStyle = {
|
40
|
-
top: (_coachmark$positionTu = (_coachmark$positionTu2 = coachmark.positionTune) === null || _coachmark$positionTu2 === void 0 ? void 0 : _coachmark$positionTu2.y) !== null && _coachmark$positionTu !== void 0 ? _coachmark$positionTu : 0,
|
41
|
-
left: (_coachmark$positionTu3 = (_coachmark$positionTu4 = coachmark.positionTune) === null || _coachmark$positionTu4 === void 0 ? void 0 : _coachmark$positionTu4.x) !== null && _coachmark$positionTu3 !== void 0 ? _coachmark$positionTu3 : 0
|
42
|
-
};
|
43
38
|
return /*#__PURE__*/React__default.createElement("span", _extends({}, rest, {
|
44
39
|
className: cx(blockClass, "".concat(blockClass, "-").concat(kind), className),
|
45
|
-
ref: ref
|
46
|
-
style: overlayPositionStyle
|
40
|
+
ref: ref
|
47
41
|
}, getDevtoolsProps(componentName), {
|
48
42
|
role: "tooltip"
|
49
43
|
}), /*#__PURE__*/React__default.createElement("button", _extends({
|
@@ -18,7 +18,7 @@ import { ConditionBuilderItemText } from '../ConditionBuilderItem/ConditionBuild
|
|
18
18
|
import { ConditionBuilderItemDate } from '../ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js';
|
19
19
|
import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
|
20
20
|
import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
|
21
|
-
import { focusThisField } from '../utils/util.js';
|
21
|
+
import { checkIsValid, focusThisField } from '../utils/util.js';
|
22
22
|
import { ConditionBuilderItemTime } from '../ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js';
|
23
23
|
import ConditionBuilderAdd from '../ConditionBuilderAdd/ConditionBuilderAdd.js';
|
24
24
|
import { ItemOption } from '../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js';
|
@@ -55,7 +55,8 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
55
55
|
isLastCondition = props.isLastCondition;
|
56
56
|
var _useContext = useContext(ConditionBuilderContext),
|
57
57
|
inputConfig = _useContext.inputConfig,
|
58
|
-
variant = _useContext.variant
|
58
|
+
variant = _useContext.variant,
|
59
|
+
conditionBuilderRef = _useContext.conditionBuilderRef;
|
59
60
|
var _useState = useState(false),
|
60
61
|
_useState2 = _slicedToArray(_useState, 2),
|
61
62
|
showDeletionPreview = _useState2[0],
|
@@ -71,9 +72,9 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
71
72
|
//filtering the current property to access its properties and config options
|
72
73
|
var getCurrentConfig = function getCurrentConfig(property) {
|
73
74
|
var _inputConfig$properti, _inputConfig$properti2;
|
74
|
-
return (_inputConfig$properti = (_inputConfig$properti2 = inputConfig.properties) === null || _inputConfig$properti2 === void 0 ? void 0 : _inputConfig$properti2.
|
75
|
+
return (_inputConfig$properti = (_inputConfig$properti2 = inputConfig.properties) === null || _inputConfig$properti2 === void 0 ? void 0 : _inputConfig$properti2.find(function (eachProperty) {
|
75
76
|
return eachProperty.id == property;
|
76
|
-
})
|
77
|
+
})) !== null && _inputConfig$properti !== void 0 ? _inputConfig$properti : {};
|
77
78
|
};
|
78
79
|
var _getCurrentConfig = getCurrentConfig(property),
|
79
80
|
icon = _getCurrentConfig.icon,
|
@@ -93,7 +94,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
93
94
|
};
|
94
95
|
var ItemComponent = property ? itemComponents[type] : null;
|
95
96
|
var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
|
96
|
-
focusThisField(evt);
|
97
|
+
focusThisField(evt, conditionBuilderRef);
|
97
98
|
onStatementChange(v);
|
98
99
|
};
|
99
100
|
var onPropertyChangeHandler = function onPropertyChangeHandler(newProperty) {
|
@@ -101,19 +102,20 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
101
102
|
property: newProperty,
|
102
103
|
operator: undefined,
|
103
104
|
value: '',
|
104
|
-
popoverToOpen: 'operatorField'
|
105
|
+
popoverToOpen: checkIsValid(newProperty) ? 'operatorField' : ''
|
105
106
|
}));
|
106
107
|
};
|
107
108
|
var onOperatorChangeHandler = function onOperatorChangeHandler(newOperator) {
|
108
109
|
onChange(_objectSpread2(_objectSpread2({}, condition), {}, {
|
109
110
|
operator: newOperator,
|
110
111
|
value: undefined,
|
111
|
-
popoverToOpen: 'valueField'
|
112
|
+
popoverToOpen: checkIsValid(newOperator) ? 'valueField' : ''
|
112
113
|
}));
|
113
114
|
};
|
114
|
-
var onValueChangeHandler = function onValueChangeHandler(newValue) {
|
115
|
+
var onValueChangeHandler = function onValueChangeHandler(newValue, evt) {
|
115
116
|
var currentCondition = _objectSpread2({}, condition);
|
116
117
|
delete currentCondition.popoverToOpen;
|
118
|
+
focusThisField(evt, conditionBuilderRef);
|
117
119
|
onChange(_objectSpread2(_objectSpread2({}, currentCondition), {}, {
|
118
120
|
value: newValue
|
119
121
|
}));
|
@@ -149,7 +151,8 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
149
151
|
onChange: onValueChangeHandler,
|
150
152
|
config: config,
|
151
153
|
"data-name": "valueField",
|
152
|
-
parentRef: popoverRef
|
154
|
+
parentRef: popoverRef,
|
155
|
+
type: type
|
153
156
|
});
|
154
157
|
};
|
155
158
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
@@ -180,13 +183,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
180
183
|
options: statementConfig
|
181
184
|
}
|
182
185
|
})), /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
183
|
-
label: label,
|
186
|
+
label: label !== null && label !== void 0 ? label : condition === null || condition === void 0 ? void 0 : condition.property,
|
184
187
|
title: propertyText,
|
185
188
|
renderIcon: icon !== null && icon !== void 0 ? icon : null,
|
186
189
|
className: "".concat(blockClass, "__property-field"),
|
187
190
|
"data-name": "propertyField",
|
188
191
|
condition: condition,
|
189
|
-
type: type
|
192
|
+
type: type,
|
193
|
+
onChange: onPropertyChangeHandler
|
190
194
|
}, /*#__PURE__*/React__default.createElement(ItemOption, {
|
191
195
|
conditionState: {
|
192
196
|
value: property,
|
@@ -196,12 +200,13 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
196
200
|
config: {
|
197
201
|
options: inputConfig.properties
|
198
202
|
}
|
199
|
-
})), property && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
203
|
+
})), checkIsValid(property) && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
200
204
|
label: operator,
|
201
205
|
title: operatorText,
|
202
206
|
"data-name": "operatorField",
|
203
207
|
condition: condition,
|
204
|
-
type: type
|
208
|
+
type: type,
|
209
|
+
onChange: onOperatorChangeHandler
|
205
210
|
}, /*#__PURE__*/React__default.createElement(ItemOption, {
|
206
211
|
config: {
|
207
212
|
options: getOperators()
|
@@ -211,7 +216,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
211
216
|
label: operatorText
|
212
217
|
},
|
213
218
|
onChange: onOperatorChangeHandler
|
214
|
-
})), property && operator && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
219
|
+
})), checkIsValid(property) && checkIsValid(operator) && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
215
220
|
label: value,
|
216
221
|
type: type,
|
217
222
|
title: label,
|
@@ -219,6 +224,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
219
224
|
"data-name": "valueField",
|
220
225
|
condition: condition,
|
221
226
|
config: config,
|
227
|
+
onChange: onValueChangeHandler,
|
222
228
|
renderChildren: renderChildren
|
223
229
|
}), /*#__PURE__*/React__default.createElement("span", {
|
224
230
|
role: "gridcell",
|
@@ -68,7 +68,8 @@ var ConditionBuilder = /*#__PURE__*/React__default.forwardRef(function (_ref, re
|
|
68
68
|
popOverSearchThreshold: popOverSearchThreshold,
|
69
69
|
getOptions: getOptions,
|
70
70
|
variant: variant,
|
71
|
-
translateWithId: translateWithId
|
71
|
+
translateWithId: translateWithId,
|
72
|
+
conditionBuilderRef: conditionBuilderRef
|
72
73
|
}, /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
73
74
|
className: cx(blockClass,
|
74
75
|
// Apply the block class to the main HTML element
|
@@ -86,7 +87,6 @@ var ConditionBuilder = /*#__PURE__*/React__default.forwardRef(function (_ref, re
|
|
86
87
|
onKeyDown: handleKeyDownHandler
|
87
88
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderContent, {
|
88
89
|
startConditionLabel: startConditionLabel,
|
89
|
-
conditionBuilderRef: conditionBuilderRef,
|
90
90
|
getConditionState: getConditionState,
|
91
91
|
getActionsState: getActionsState,
|
92
92
|
initialState: initialState,
|
@@ -202,7 +202,7 @@ ConditionBuilder.propTypes = {
|
|
202
202
|
/**
|
203
203
|
* Optional prop, if you need to pass translations to the texts on the component instead of the defined defaults.
|
204
204
|
* This callback function will receive the message id and you need to return the corresponding text for that id.
|
205
|
-
* 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",
|
205
|
+
* 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"]
|
206
206
|
]
|
207
207
|
*/
|
208
208
|
translateWithId: PropTypes.func,
|
@@ -30,13 +30,14 @@ var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
|
30
30
|
_useState2 = _slicedToArray(_useState, 2),
|
31
31
|
showDeletionPreview = _useState2[0],
|
32
32
|
setShowDeletionPreview = _useState2[1];
|
33
|
-
var _useTranslations = useTranslations(['actionsText', 'then', 'and', 'removeActionText', 'addActionText']),
|
34
|
-
_useTranslations2 = _slicedToArray(_useTranslations,
|
33
|
+
var _useTranslations = useTranslations(['actionsText', 'then', 'and', 'removeActionText', 'addActionText', 'actionSectionText']),
|
34
|
+
_useTranslations2 = _slicedToArray(_useTranslations, 6),
|
35
35
|
actionsText = _useTranslations2[0],
|
36
36
|
thenText = _useTranslations2[1],
|
37
37
|
andText = _useTranslations2[2],
|
38
38
|
removeActionText = _useTranslations2[3],
|
39
|
-
addActionText = _useTranslations2[4]
|
39
|
+
addActionText = _useTranslations2[4],
|
40
|
+
actionSectionText = _useTranslations2[5];
|
40
41
|
var addActionHandler = function addActionHandler() {
|
41
42
|
var action = {
|
42
43
|
id: uuidv4(),
|
@@ -74,7 +75,8 @@ var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
|
74
75
|
level: 4
|
75
76
|
}, /*#__PURE__*/React__default.createElement(Heading, null, actionsText)), /*#__PURE__*/React__default.createElement("div", {
|
76
77
|
className: "".concat(blockClass, "__condition-wrapper"),
|
77
|
-
role: "grid"
|
78
|
+
role: "grid",
|
79
|
+
"aria-label": actionSectionText
|
78
80
|
}, actionState === null || actionState === void 0 ? void 0 : actionState.map(function (action, index) {
|
79
81
|
return /*#__PURE__*/React__default.createElement("div", {
|
80
82
|
key: action.id,
|
@@ -124,7 +126,8 @@ var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
|
124
126
|
})), actionState.length === index + 1 && /*#__PURE__*/React__default.createElement(ConditionBuilderAdd, {
|
125
127
|
onClick: addActionHandler,
|
126
128
|
className: "".concat(blockClass, "__gap ").concat(blockClass, "__gap-left"),
|
127
|
-
buttonLabel: addActionText
|
129
|
+
buttonLabel: addActionText,
|
130
|
+
tabIndex: 0
|
128
131
|
}));
|
129
132
|
}), actionState.length === 0 && /*#__PURE__*/React__default.createElement(ConditionBuilderAdd, {
|
130
133
|
onClick: addActionHandler,
|
@@ -60,14 +60,16 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
60
60
|
onBlur: hideConditionSubGroupPreviewHandler
|
61
61
|
};
|
62
62
|
};
|
63
|
+
var getAriaLabel = function getAriaLabel() {
|
64
|
+
return buttonLabel ? buttonLabel : !enableSubGroup ? addConditionRowText : undefined;
|
65
|
+
};
|
63
66
|
var wrapperProps = enableSubGroup ? {
|
64
67
|
role: 'gridcell'
|
65
|
-
// 'aria-label': addSubgroupText,
|
66
68
|
} : {};
|
67
69
|
return /*#__PURE__*/React__default.createElement("div", {
|
68
70
|
className: "".concat(className, " ").concat(blockClass, "__add-button-wrapper"),
|
69
71
|
role: !enableSubGroup ? 'gridcell' : 'none',
|
70
|
-
"aria-label":
|
72
|
+
"aria-label": getAriaLabel(),
|
71
73
|
onMouseEnter: showAddSubGroup,
|
72
74
|
onMouseLeave: hideAddSubGroup,
|
73
75
|
onFocus: showAddSubGroup,
|
@@ -36,7 +36,7 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
|
|
36
36
|
var Button = function Button() {
|
37
37
|
var _rest$dataName;
|
38
38
|
var dataName = (_rest$dataName = rest['data-name']) !== null && _rest$dataName !== void 0 ? _rest$dataName : '';
|
39
|
-
return /*#__PURE__*/React__default.createElement("button", {
|
39
|
+
return /*#__PURE__*/React__default.createElement("button", _extends({
|
40
40
|
// role={'gridcell'}
|
41
41
|
tabIndex: tabIndex != undefined ? tabIndex : -1,
|
42
42
|
className: cx([className, "".concat(blockClass, "__button"), _defineProperty({}, "".concat(blockClass, "__text-ellipsis"), showToolTip && !hideLabel && !isInvalid), _defineProperty({}, "".concat(blockClass, "__invalid-input"), isInvalid)]),
|
@@ -47,7 +47,7 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
|
|
47
47
|
onMouseEnter: onMouseEnter,
|
48
48
|
onMouseLeave: onMouseLeave,
|
49
49
|
"data-name": dataName
|
50
|
-
}, Icon && (_Icon || (_Icon = /*#__PURE__*/React__default.createElement(Icon, null))), !hideLabel && (_span || (_span = /*#__PURE__*/React__default.createElement("span", null, label))), isInvalid && (_WarningAltFilled || (_WarningAltFilled = /*#__PURE__*/React__default.createElement(WarningAltFilled, null))));
|
50
|
+
}, rest), Icon && (_Icon || (_Icon = /*#__PURE__*/React__default.createElement(Icon, null))), !hideLabel && (_span || (_span = /*#__PURE__*/React__default.createElement("span", null, label))), isInvalid && (_WarningAltFilled || (_WarningAltFilled = /*#__PURE__*/React__default.createElement(WarningAltFilled, null))));
|
51
51
|
};
|
52
52
|
return hideLabel || showToolTip ? /*#__PURE__*/React__default.createElement(Tooltip, _extends({
|
53
53
|
label: label,
|
@@ -22,7 +22,8 @@ var ConditionConnector = function ConditionConnector(_ref) {
|
|
22
22
|
onChange = _ref.onChange,
|
23
23
|
rest = _objectWithoutProperties(_ref, _excluded);
|
24
24
|
var _useContext = useContext(ConditionBuilderContext),
|
25
|
-
variant = _useContext.variant
|
25
|
+
variant = _useContext.variant,
|
26
|
+
conditionBuilderRef = _useContext.conditionBuilderRef;
|
26
27
|
var _useTranslations = useTranslations(['connectorText']),
|
27
28
|
_useTranslations2 = _slicedToArray(_useTranslations, 1),
|
28
29
|
connectorText = _useTranslations2[0];
|
@@ -43,10 +44,10 @@ var ConditionConnector = function ConditionConnector(_ref) {
|
|
43
44
|
};
|
44
45
|
var onChangeHandler = function onChangeHandler(op, evt) {
|
45
46
|
onChange(op);
|
46
|
-
focusThisField(evt);
|
47
|
+
focusThisField(evt, conditionBuilderRef);
|
47
48
|
};
|
48
49
|
return variant == 'tree' ? /*#__PURE__*/React__default.createElement("span", {
|
49
|
-
className: "".concat(className, " ").concat(blockClass, "__connector
|
50
|
+
className: "".concat(className, " ").concat(blockClass, "__connector--disabled")
|
50
51
|
}, operator) :
|
51
52
|
/*#__PURE__*/
|
52
53
|
// <div className={className} {...rest}>
|
@@ -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<{
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2,
|
8
|
+
import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { useContext, useState, useEffect, useCallback } from 'react';
|
10
10
|
import PropTypes from '../../../node_modules/prop-types/index.js';
|
11
11
|
import { Button, Section, Heading } from '@carbon/react';
|
@@ -20,11 +20,10 @@ import GroupConnector from '../ConditionBuilderConnector/GroupConnector.js';
|
|
20
20
|
import ConditionBuilderActions from '../ConditionBuilderActions/ConditionBuilderActions.js';
|
21
21
|
import { useTranslations } from '../utils/useTranslations.js';
|
22
22
|
|
23
|
-
var
|
23
|
+
var _GroupConnector;
|
24
24
|
var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
25
25
|
var _rootState$groups2;
|
26
26
|
var startConditionLabel = _ref.startConditionLabel,
|
27
|
-
conditionBuilderRef = _ref.conditionBuilderRef,
|
28
27
|
getConditionState = _ref.getConditionState,
|
29
28
|
getActionsState = _ref.getActionsState,
|
30
29
|
initialState = _ref.initialState,
|
@@ -42,9 +41,10 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
42
41
|
_useState4 = _slicedToArray(_useState3, 2),
|
43
42
|
showConditionGroupPreview = _useState4[0],
|
44
43
|
setShowConditionGroupPreview = _useState4[1];
|
45
|
-
var _useTranslations = useTranslations(['addConditionGroupText']),
|
46
|
-
_useTranslations2 = _slicedToArray(_useTranslations,
|
47
|
-
addConditionGroupText = _useTranslations2[0]
|
44
|
+
var _useTranslations = useTranslations(['addConditionGroupText', 'conditionHeadingText']),
|
45
|
+
_useTranslations2 = _slicedToArray(_useTranslations, 2),
|
46
|
+
addConditionGroupText = _useTranslations2[0],
|
47
|
+
conditionHeadingText = _useTranslations2[1];
|
48
48
|
var showConditionGroupPreviewHandler = function showConditionGroupPreviewHandler() {
|
49
49
|
setShowConditionGroupPreview(true);
|
50
50
|
};
|
@@ -110,21 +110,22 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
110
110
|
groups: [].concat(_toConsumableArray(rootState.groups), [newGroup])
|
111
111
|
}));
|
112
112
|
};
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
},
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
}
|
113
|
+
if (!isConditionBuilderActive) {
|
114
|
+
return /*#__PURE__*/React__default.createElement(Button, {
|
115
|
+
className: "".concat(blockClass, "__addConditionText-button"),
|
116
|
+
renderIcon: function renderIcon(props) {
|
117
|
+
return /*#__PURE__*/React__default.createElement(Add, props);
|
118
|
+
},
|
119
|
+
iconDescription: startConditionLabel,
|
120
|
+
kind: "ghost",
|
121
|
+
size: "sm",
|
122
|
+
onClick: onStartConditionBuilder
|
123
|
+
}, startConditionLabel);
|
124
|
+
}
|
125
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Section, {
|
125
126
|
className: "".concat(blockClass, "__heading"),
|
126
127
|
level: 4
|
127
|
-
},
|
128
|
+
}, /*#__PURE__*/React__default.createElement(Heading, null, conditionHeadingText)), /*#__PURE__*/React__default.createElement("div", {
|
128
129
|
className: "".concat(blockClass, "__content-container"),
|
129
130
|
role: "treegrid",
|
130
131
|
"aria-label": "condition builder tree"
|
@@ -145,13 +146,13 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
145
146
|
},
|
146
147
|
onChange: function onChange(updatedGroup) {
|
147
148
|
onChangeHandler(updatedGroup, groupIndex);
|
148
|
-
}
|
149
|
-
conditionBuilderRef: conditionBuilderRef
|
149
|
+
}
|
150
150
|
}), groupIndex < rootState.groups.length - 1 && (_GroupConnector || (_GroupConnector = /*#__PURE__*/React__default.createElement(GroupConnector, null))));
|
151
|
-
})),
|
151
|
+
})), variant == 'tree' && /*#__PURE__*/React__default.createElement("div", {
|
152
152
|
role: "row",
|
153
153
|
tabIndex: -1,
|
154
|
-
"aria-level": 1
|
154
|
+
"aria-level": 1,
|
155
|
+
className: "".concat(blockClass, "__add-group")
|
155
156
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderButton, {
|
156
157
|
renderIcon: TextNewLine,
|
157
158
|
onClick: addConditionGroupHandler,
|
@@ -171,11 +172,10 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
171
172
|
group: {
|
172
173
|
groupOperator: rootState.operator
|
173
174
|
}
|
174
|
-
}))
|
175
|
+
})), actions && /*#__PURE__*/React__default.createElement(ConditionBuilderActions, {
|
175
176
|
actions: actions,
|
176
177
|
className: "".concat(blockClass, "__actions-container"),
|
177
|
-
variant: variant
|
178
|
-
conditionBuilderRef: conditionBuilderRef
|
178
|
+
variant: variant
|
179
179
|
}));
|
180
180
|
};
|
181
181
|
var ConditionBuilderContent$1 = ConditionBuilderContent;
|
@@ -187,10 +187,6 @@ ConditionBuilderContent.propTypes = {
|
|
187
187
|
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
188
188
|
label: PropTypes.string.isRequired
|
189
189
|
})),
|
190
|
-
/**
|
191
|
-
* ref of condition builder
|
192
|
-
*/
|
193
|
-
conditionBuilderRef: PropTypes.object,
|
194
190
|
/**
|
195
191
|
* callback functions that will provide the updated action state back.
|
196
192
|
*/
|
package/es/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<{
|
@@ -63,7 +63,8 @@ var ConditionBuilderProvider = function ConditionBuilderProvider(props) {
|
|
63
63
|
popOverSearchThreshold: props.popOverSearchThreshold,
|
64
64
|
getOptions: props.getOptions,
|
65
65
|
variant: props.variant,
|
66
|
-
translateWithId: props.translateWithId
|
66
|
+
translateWithId: props.translateWithId,
|
67
|
+
conditionBuilderRef: props.conditionBuilderRef
|
67
68
|
}
|
68
69
|
},
|
69
70
|
// eslint-disable-next-line react/prop-types
|
@@ -74,6 +75,10 @@ ConditionBuilderProvider.propTypes = {
|
|
74
75
|
* Provide the contents of the ConditionBuilder.
|
75
76
|
*/
|
76
77
|
children: PropTypes.node.isRequired,
|
78
|
+
/**
|
79
|
+
* ref of condition builder
|
80
|
+
*/
|
81
|
+
conditionBuilderRef: PropTypes.object,
|
77
82
|
/**
|
78
83
|
* This is an optional callback function that will be triggered when options array is not passed in the inputConfig against a property.
|
79
84
|
* 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,8 @@ 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;
|
41
|
+
let conditionHeadingText: string;
|
39
42
|
}
|
@@ -31,6 +31,7 @@ var translationsObject = {
|
|
31
31
|
valueText: 'Value',
|
32
32
|
connectorText: 'Connector',
|
33
33
|
conditionRowText: 'Condition row',
|
34
|
+
conditionRowGroupText: 'Condition row group',
|
34
35
|
removeConditionText: 'Remove condition',
|
35
36
|
addConditionRowText: 'Add condition row',
|
36
37
|
startText: 'Start',
|
@@ -41,8 +42,10 @@ var translationsObject = {
|
|
41
42
|
removeActionText: 'Remove Action',
|
42
43
|
addActionText: 'Add action',
|
43
44
|
invalidText: 'Incomplete',
|
44
|
-
|
45
|
-
|
45
|
+
invalidNumberWarnText: 'Invalid number, must be 0 or greater',
|
46
|
+
conditionBuilderText: 'Condition Builder',
|
47
|
+
actionSectionText: 'Action Section',
|
48
|
+
conditionHeadingText: 'Condition'
|
46
49
|
};
|
47
50
|
|
48
51
|
export { 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>;
|