@carbon/ibm-products 2.48.0-rc.0 → 2.49.0-rc.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 +29 -14
- 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 +11 -2
- 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 +29 -14
- 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 +29 -14
- 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/APIKeyModal/APIKeyModal.types.d.ts +1 -1
- package/es/components/Card/Card.js +4 -2
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +100 -24
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +30 -27
- package/es/components/ConditionBuilder/ConditionBuilder.d.ts +9 -2
- package/es/components/ConditionBuilder/ConditionBuilder.js +13 -9
- package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +151 -0
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +26 -12
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +7 -7
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +62 -27
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -3
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +86 -37
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.d.ts +29 -14
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +10 -9
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +40 -20
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +40 -37
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +10 -49
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +22 -31
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +6 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +7 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +81 -31
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +14 -8
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +27 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +2 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +30 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +12 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +35 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +16 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.d.ts +32 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +4 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +35 -14
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +5 -6
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +25 -10
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +44 -17
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +50 -40
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +30 -13
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +2 -3
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +9 -10
- package/es/components/ConditionBuilder/utils/useDataConfigs.d.ts +18 -0
- package/es/components/ConditionBuilder/utils/useDataConfigs.js +120 -0
- package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/useTranslations.js +4 -1
- package/es/components/ConditionBuilder/utils/util.d.ts +12 -0
- package/es/components/ConditionBuilder/utils/util.js +48 -2
- package/es/components/CreateFullPage/CreateFullPageStep.d.ts +2 -2
- package/es/components/CreateFullPage/index.d.ts +1 -0
- package/es/components/CreateTearsheet/CreateTearsheet.js +3 -4
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +8 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +8 -3
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +20 -11
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +12 -7
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +18 -16
- package/es/components/Datagrid/types/index.d.ts +1 -0
- package/es/components/Datagrid/useActionsColumn.js +1 -4
- package/es/components/Datagrid/useFiltering.d.ts +1 -0
- package/es/components/Datagrid/useFiltering.js +14 -3
- package/es/components/EditInPlace/EditInPlace.js +7 -5
- package/es/components/NotificationsPanel/NotificationsPanel.d.ts +2 -0
- package/es/components/NotificationsPanel/NotificationsPanel.js +75 -5
- package/es/components/TagOverflow/TagOverflow.d.ts +1 -0
- package/es/components/TagOverflow/TagOverflow.js +8 -2
- package/es/components/TagOverflow/TagOverflowPopover.d.ts +1 -0
- package/es/components/TagOverflow/TagOverflowPopover.js +7 -1
- package/es/components/TagSet/TagSetOverflow.js +1 -1
- package/es/components/Tearsheet/Tearsheet.d.ts +2 -2
- package/es/components/Tearsheet/TearsheetShell.js +7 -3
- package/es/components/Toolbar/ToolbarButton.d.ts +12 -1
- package/es/components/Toolbar/ToolbarButton.js +16 -8
- package/es/global/js/hooks/useFocus.d.ts +1 -1
- package/es/global/js/hooks/useFocus.js +40 -24
- package/es/global/js/utils/keyboardNavigation.d.ts +27 -0
- package/es/global/js/utils/keyboardNavigation.js +37 -0
- package/es/global/js/utils/wrapFocus.d.ts +25 -0
- package/es/global/js/utils/wrapFocus.js +68 -0
- package/lib/components/APIKeyModal/APIKeyModal.types.d.ts +1 -1
- package/lib/components/Card/Card.js +3 -1
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +100 -24
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +36 -33
- package/lib/components/ConditionBuilder/ConditionBuilder.d.ts +9 -2
- package/lib/components/ConditionBuilder/ConditionBuilder.js +15 -11
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +151 -0
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +26 -12
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +15 -15
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +62 -27
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +7 -8
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +86 -37
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +4 -4
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.d.ts +29 -14
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +11 -10
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +8 -5
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +40 -20
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +47 -44
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +10 -49
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +22 -31
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +6 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +7 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +81 -31
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +18 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +27 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +3 -4
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +30 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +13 -8
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +35 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +22 -15
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.d.ts +32 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +15 -15
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +35 -14
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +5 -6
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +25 -10
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +2 -2
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +44 -17
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +60 -50
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +30 -13
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +18 -19
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +12 -13
- package/lib/components/ConditionBuilder/utils/useDataConfigs.d.ts +18 -0
- package/lib/components/ConditionBuilder/utils/useDataConfigs.js +124 -0
- package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/useTranslations.js +4 -1
- package/lib/components/ConditionBuilder/utils/util.d.ts +12 -0
- package/lib/components/ConditionBuilder/utils/util.js +53 -3
- package/lib/components/CreateFullPage/CreateFullPageStep.d.ts +2 -2
- package/lib/components/CreateFullPage/index.d.ts +1 -0
- package/lib/components/CreateTearsheet/CreateTearsheet.js +3 -4
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +8 -3
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +19 -10
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +6 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +11 -6
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +18 -16
- package/lib/components/Datagrid/types/index.d.ts +1 -0
- package/lib/components/Datagrid/useActionsColumn.js +1 -4
- package/lib/components/Datagrid/useFiltering.d.ts +1 -0
- package/lib/components/Datagrid/useFiltering.js +13 -1
- package/lib/components/EditInPlace/EditInPlace.js +7 -5
- package/lib/components/NotificationsPanel/NotificationsPanel.d.ts +2 -0
- package/lib/components/NotificationsPanel/NotificationsPanel.js +74 -4
- package/lib/components/TagOverflow/TagOverflow.d.ts +1 -0
- package/lib/components/TagOverflow/TagOverflow.js +8 -2
- package/lib/components/TagOverflow/TagOverflowPopover.d.ts +1 -0
- package/lib/components/TagOverflow/TagOverflowPopover.js +7 -1
- package/lib/components/TagSet/TagSetOverflow.js +1 -1
- package/lib/components/Tearsheet/Tearsheet.d.ts +2 -2
- package/lib/components/Tearsheet/TearsheetShell.js +6 -2
- package/lib/components/Toolbar/ToolbarButton.d.ts +12 -1
- package/lib/components/Toolbar/ToolbarButton.js +15 -6
- package/lib/global/js/hooks/useFocus.d.ts +1 -1
- package/lib/global/js/hooks/useFocus.js +40 -24
- package/lib/global/js/utils/keyboardNavigation.d.ts +27 -0
- package/lib/global/js/utils/keyboardNavigation.js +43 -0
- package/lib/global/js/utils/wrapFocus.d.ts +25 -0
- package/lib/global/js/utils/wrapFocus.js +73 -0
- package/package.json +4 -4
- package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +33 -22
- package/scss/components/Datagrid/styles/_datagrid.scss +7 -0
- package/scss/components/Datagrid/styles/_useActionsColumn.scss +4 -0
- package/scss/components/EditInPlace/_edit-in-place.scss +2 -2
- package/telemetry.yml +15 -6
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +0 -28
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +0 -123
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +0 -28
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +0 -131
@@ -15,8 +15,8 @@ var react = require('@carbon/react');
|
|
15
15
|
var icons = require('@carbon/react/icons');
|
16
16
|
var index = require('../../../../node_modules/prop-types/index.js');
|
17
17
|
var ConditionBuilderProvider = require('../../ConditionBuilderContext/ConditionBuilderProvider.js');
|
18
|
-
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
19
18
|
var useTranslations = require('../../utils/useTranslations.js');
|
19
|
+
var util = require('../../utils/util.js');
|
20
20
|
|
21
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
22
22
|
|
@@ -38,7 +38,7 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
38
38
|
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 2),
|
39
39
|
propertyText = _useTranslations2[0],
|
40
40
|
clearSearchText = _useTranslations2[1];
|
41
|
-
var contentRef = React.useRef();
|
41
|
+
var contentRef = React.useRef(null);
|
42
42
|
var _useState = React.useState(config.options),
|
43
43
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
44
44
|
allOptions = _useState2[0],
|
@@ -105,7 +105,7 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
105
105
|
if (contentRef.current) {
|
106
106
|
var firstFocusableElement = contentRef.current.querySelector('input, button,li');
|
107
107
|
if (firstFocusableElement) {
|
108
|
-
firstFocusableElement.focus();
|
108
|
+
firstFocusableElement === null || firstFocusableElement === void 0 || firstFocusableElement.focus();
|
109
109
|
}
|
110
110
|
}
|
111
111
|
}, [allOptions]);
|
@@ -144,23 +144,23 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
144
144
|
return _SelectSkeleton || (_SelectSkeleton = /*#__PURE__*/React__default["default"].createElement(react.SelectSkeleton, null));
|
145
145
|
}
|
146
146
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
147
|
-
className: "".concat(
|
147
|
+
className: "".concat(util.blockClass, "__item-option"),
|
148
148
|
ref: contentRef
|
149
|
-
}, allOptions.length > popOverSearchThreshold && /*#__PURE__*/React__default["default"].createElement("div", {
|
150
|
-
className: "".concat(
|
149
|
+
}, popOverSearchThreshold && allOptions.length > popOverSearchThreshold && /*#__PURE__*/React__default["default"].createElement("div", {
|
150
|
+
className: "".concat(util.blockClass, "__item-option__search")
|
151
151
|
}, /*#__PURE__*/React__default["default"].createElement(react.Search, {
|
152
152
|
size: "sm",
|
153
153
|
labelText: clearSearchText,
|
154
154
|
closeButtonLabelText: clearSearchText,
|
155
155
|
onChange: onSearchChangeHandler
|
156
156
|
})), multiSelectable && /*#__PURE__*/React__default["default"].createElement("div", {
|
157
|
-
className: "".concat(
|
157
|
+
className: "".concat(util.blockClass, "__multiselectSelectionStatusContainer")
|
158
158
|
}, /*#__PURE__*/React__default["default"].createElement("h4", null, /*#__PURE__*/React__default["default"].createElement("label", null, selection.length, "/", allOptions.length, " Selected")), /*#__PURE__*/React__default["default"].createElement(react.Button, {
|
159
159
|
kind: 'ghost',
|
160
160
|
size: 'sm',
|
161
161
|
"data-selected-all": "".concat(selection.length == 0 ? true : false),
|
162
162
|
onClick: handleSelectAll,
|
163
|
-
className: "".concat(
|
163
|
+
className: "".concat(util.blockClass, "__selectAll-button")
|
164
164
|
}, selection.length == 0 ? 'Select all' : 'Deselect all')), /*#__PURE__*/React__default["default"].createElement("ul", {
|
165
165
|
"aria-label": getAriaLabel(),
|
166
166
|
role: "listbox",
|
@@ -175,7 +175,7 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
175
175
|
key: option.id,
|
176
176
|
role: "option",
|
177
177
|
"aria-selected": isSelected,
|
178
|
-
className: "".concat(
|
178
|
+
className: "".concat(util.blockClass, "__item-option__option"),
|
179
179
|
onKeyUp: function onKeyUp() {
|
180
180
|
return false;
|
181
181
|
},
|
@@ -183,17 +183,17 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
183
183
|
return onClickHandler(evt, option, isSelected);
|
184
184
|
}
|
185
185
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
186
|
-
className: "".concat(
|
186
|
+
className: "".concat(util.blockClass, "__item-option__option-content")
|
187
187
|
}, multiSelectable ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", {
|
188
|
-
className: "".concat(
|
188
|
+
className: "".concat(util.blockClass, "__option-check-box")
|
189
189
|
}, isSelected ? _CheckboxCheckedFille || (_CheckboxCheckedFille = /*#__PURE__*/React__default["default"].createElement(icons.CheckboxCheckedFilled, null)) : _Checkbox || (_Checkbox = /*#__PURE__*/React__default["default"].createElement(icons.Checkbox, null))), /*#__PURE__*/React__default["default"].createElement("span", {
|
190
|
-
className: "".concat(
|
190
|
+
className: "".concat(util.blockClass, "__item-option__option-label")
|
191
191
|
}, option.label), Icon && /*#__PURE__*/React__default["default"].createElement("span", {
|
192
|
-
className: "".concat(
|
192
|
+
className: "".concat(util.blockClass, "__option-icon")
|
193
193
|
}, /*#__PURE__*/React__default["default"].createElement(Icon, null))) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", {
|
194
|
-
className: "".concat(
|
194
|
+
className: "".concat(util.blockClass, "__item-option__option-label")
|
195
195
|
}, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, null), option.label), isSelected && /*#__PURE__*/React__default["default"].createElement(icons.Checkmark, {
|
196
|
-
className: "".concat(
|
196
|
+
className: "".concat(util.blockClass, "__checkmark")
|
197
197
|
}))));
|
198
198
|
})));
|
199
199
|
};
|
@@ -1,15 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
export namespace ConditionBuilderItemText {
|
8
|
-
namespace propTypes {
|
9
|
-
let conditionState: PropTypes.Requireable<object>;
|
10
|
-
let config: PropTypes.Requireable<object>;
|
11
|
-
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
12
|
-
let type: PropTypes.Requireable<string>;
|
13
|
-
}
|
14
|
-
}
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
15
7
|
import PropTypes from 'prop-types';
|
8
|
+
import { Condition, PropertyConfigText, PropertyConfigTextArea } from '../../ConditionBuilder.types';
|
9
|
+
interface ConditionBuilderItemTextProps {
|
10
|
+
conditionState: Condition;
|
11
|
+
config: PropertyConfigText | PropertyConfigTextArea;
|
12
|
+
onChange: (value: string) => void;
|
13
|
+
type: 'textarea' | 'text';
|
14
|
+
}
|
15
|
+
export declare const ConditionBuilderItemText: {
|
16
|
+
({ conditionState, onChange, config, type, }: ConditionBuilderItemTextProps): import("react/jsx-runtime").JSX.Element;
|
17
|
+
propTypes: {
|
18
|
+
/**
|
19
|
+
* current condition object
|
20
|
+
*/
|
21
|
+
conditionState: PropTypes.Requireable<object>;
|
22
|
+
/**
|
23
|
+
* config of the current property
|
24
|
+
*/
|
25
|
+
config: PropTypes.Requireable<object>;
|
26
|
+
/**
|
27
|
+
* callback to update state oin date change
|
28
|
+
*/
|
29
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
30
|
+
/**
|
31
|
+
* current input type
|
32
|
+
*/
|
33
|
+
type: PropTypes.Requireable<string>;
|
34
|
+
};
|
35
|
+
};
|
36
|
+
export {};
|
@@ -13,7 +13,6 @@ var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabel
|
|
13
13
|
var React = require('react');
|
14
14
|
var react = require('@carbon/react');
|
15
15
|
var index = require('../../../../node_modules/prop-types/index.js');
|
16
|
-
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
17
16
|
var util = require('../../utils/util.js');
|
18
17
|
|
19
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
@@ -26,17 +25,17 @@ var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
|
|
26
25
|
_onChange = _ref.onChange,
|
27
26
|
config = _ref.config,
|
28
27
|
type = _ref.type;
|
29
|
-
var inputProps = _rollupPluginBabelHelpers.objectSpread2({
|
30
|
-
labelText: conditionState.property,
|
28
|
+
var inputProps = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, config), {}, {
|
31
29
|
hideLabel: true,
|
32
30
|
value: util.checkIsValid(conditionState.value) ? conditionState.value : '',
|
33
31
|
id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
|
34
32
|
onChange: function onChange(evt) {
|
35
33
|
_onChange(evt.target.value);
|
36
|
-
}
|
37
|
-
|
34
|
+
},
|
35
|
+
labelText: conditionState.property
|
36
|
+
});
|
38
37
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
39
|
-
className: "".concat(
|
38
|
+
className: "".concat(util.blockClass, "__item-text")
|
40
39
|
}, type == 'textarea' ? /*#__PURE__*/React__default["default"].createElement(react.TextArea, inputProps) : /*#__PURE__*/React__default["default"].createElement(react.TextInput, inputProps));
|
41
40
|
};
|
42
41
|
ConditionBuilderItemText.propTypes = {
|
@@ -1,11 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
let config: PropTypes.Requireable<object>;
|
8
|
-
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
9
|
-
}
|
10
|
-
}
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
11
7
|
import PropTypes from 'prop-types';
|
8
|
+
import { PropertyConfigTime } from '../../ConditionBuilder.types';
|
9
|
+
interface ConditionBuilderItemTime {
|
10
|
+
onChange: (value: string | undefined) => void;
|
11
|
+
config: PropertyConfigTime['config'];
|
12
|
+
}
|
13
|
+
export declare const ConditionBuilderItemTime: {
|
14
|
+
({ onChange, config, }: ConditionBuilderItemTime): import("react/jsx-runtime").JSX.Element;
|
15
|
+
propTypes: {
|
16
|
+
/**
|
17
|
+
* current config object that this property is part of
|
18
|
+
*/
|
19
|
+
config: PropTypes.Requireable<object>;
|
20
|
+
/**
|
21
|
+
* callback to update state oin date change
|
22
|
+
*/
|
23
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
24
|
+
};
|
25
|
+
};
|
26
|
+
export {};
|
@@ -13,7 +13,7 @@ var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabel
|
|
13
13
|
var React = require('react');
|
14
14
|
var react = require('@carbon/react');
|
15
15
|
var index = require('../../../../node_modules/prop-types/index.js');
|
16
|
-
var
|
16
|
+
var util = require('../../utils/util.js');
|
17
17
|
|
18
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
19
19
|
|
@@ -51,7 +51,7 @@ var ConditionBuilderItemTime = function ConditionBuilderItemTime(_ref) {
|
|
51
51
|
setTimeValue(evt.target.value);
|
52
52
|
};
|
53
53
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
54
|
-
className: "".concat(
|
54
|
+
className: "".concat(util.blockClass, "__item-time")
|
55
55
|
}, /*#__PURE__*/React__default["default"].createElement(react.TimePicker, {
|
56
56
|
id: "time-picker",
|
57
57
|
labelText: "Select a time",
|
@@ -1,24 +1,51 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import PropTypes from 'prop-types';
|
8
|
+
import { ConditionGroup } from '../ConditionBuilder.types';
|
2
9
|
/**
|
3
10
|
*
|
4
11
|
* state - this is the current group that is being rendered . This can be a inner group or outer group
|
5
12
|
* All the inner components of group are called from here.
|
6
13
|
* @returns
|
7
14
|
*/
|
8
|
-
|
9
|
-
group:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
let className: PropTypes.Requireable<string>;
|
19
|
-
let group: PropTypes.Requireable<object>;
|
20
|
-
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
21
|
-
let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
22
|
-
}
|
15
|
+
interface ConditionGroupBuilderProps {
|
16
|
+
group: ConditionGroup;
|
17
|
+
onRemove: (e: Event) => void;
|
18
|
+
onChange: (group: ConditionGroup) => void;
|
19
|
+
className?: string;
|
20
|
+
aria: {
|
21
|
+
level: number;
|
22
|
+
posinset: number;
|
23
|
+
setsize: number;
|
24
|
+
};
|
23
25
|
}
|
24
|
-
|
26
|
+
declare const ConditionGroupBuilder: {
|
27
|
+
({ group, aria, onRemove, onChange, className, }: ConditionGroupBuilderProps): import("react/jsx-runtime").JSX.Element;
|
28
|
+
propTypes: {
|
29
|
+
/**
|
30
|
+
* object contains the aria attributes
|
31
|
+
*/
|
32
|
+
aria: PropTypes.Requireable<object>;
|
33
|
+
/**
|
34
|
+
* state defines the current group
|
35
|
+
*/
|
36
|
+
/**
|
37
|
+
* Provide an optional class to be applied to the containing node.
|
38
|
+
*/
|
39
|
+
className: PropTypes.Requireable<string>;
|
40
|
+
group: PropTypes.Requireable<object>;
|
41
|
+
/**
|
42
|
+
* callback to update the current condition of the state tree
|
43
|
+
*/
|
44
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
45
|
+
/**
|
46
|
+
* call back to remove the particular group from the state tree
|
47
|
+
*/
|
48
|
+
onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
49
|
+
};
|
50
|
+
};
|
51
|
+
export default ConditionGroupBuilder;
|
@@ -14,7 +14,6 @@ var React = require('react');
|
|
14
14
|
var ConditionBlock = require('../ConditionBlock/ConditionBlock.js');
|
15
15
|
var index = require('../../../node_modules/prop-types/index.js');
|
16
16
|
var cx = require('classnames');
|
17
|
-
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
18
17
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
19
18
|
var util = require('../utils/util.js');
|
20
19
|
var ConditionConnector = require('../ConditionBuilderConnector/ConditionConnector.js');
|
@@ -23,6 +22,7 @@ var uuidv4 = require('../../../global/js/utils/uuidv4.js');
|
|
23
22
|
var ConditionPreview = require('../ConditionPreview/ConditionPreview.js');
|
24
23
|
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
25
24
|
var useTranslations = require('../utils/useTranslations.js');
|
25
|
+
var useDataConfigs = require('../utils/useDataConfigs.js');
|
26
26
|
|
27
27
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
28
28
|
|
@@ -48,6 +48,8 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
48
48
|
conditionBuilderGroupText = _useTranslations2[0],
|
49
49
|
conditionText = _useTranslations2[1],
|
50
50
|
conditionBuilderText = _useTranslations2[2];
|
51
|
+
var _useDataConfigs = useDataConfigs.useDataConfigs(),
|
52
|
+
statementConfig = _useDataConfigs.statementConfig;
|
51
53
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
52
54
|
variant = _useContext.variant,
|
53
55
|
conditionBuilderRef = _useContext.conditionBuilderRef;
|
@@ -60,23 +62,25 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
60
62
|
showConditionSubGroupPreview = _useState4[0],
|
61
63
|
setShowConditionSubGroupPreview = _useState4[1];
|
62
64
|
React.useState(false);
|
63
|
-
var conditionBuilderContentRef = React.useRef();
|
65
|
+
var conditionBuilderContentRef = React.useRef(null);
|
64
66
|
var onRemoveHandler = function onRemoveHandler(conditionId, evt, conditionIndex) {
|
65
|
-
if (group.conditions.length > 1) {
|
66
|
-
variant ==
|
67
|
+
if (group && group.conditions && group.conditions.length > 1) {
|
68
|
+
variant == util.HIERARCHICAL_VARIANT ? handleFocusOnCloseHierarchical(evt) : handleFocusOnClose(evt, conditionIndex);
|
67
69
|
if (!checkGroupHaveCondition(group.conditions, conditionId)) {
|
70
|
+
var _group$conditions;
|
68
71
|
//when we delete the last condition of a group without deleting the subgroup, we need to restructure the group.
|
69
72
|
//we will shift the group one level up. The subgroups will open up as conditions.
|
70
73
|
|
71
74
|
//spreading out the condition inside the subgroup
|
72
|
-
var allConditions = group.conditions.reduce(function (acc, condition) {
|
73
|
-
|
75
|
+
var allConditions = group === null || group === void 0 || (_group$conditions = group.conditions) === null || _group$conditions === void 0 ? void 0 : _group$conditions.reduce(function (acc, condition) {
|
76
|
+
var _condition = condition;
|
77
|
+
if (_condition.conditions) {
|
74
78
|
//this is a subgroup
|
75
|
-
return acc.concat(
|
79
|
+
return acc.concat(_condition.conditions);
|
76
80
|
}
|
77
81
|
return acc;
|
78
82
|
}, []);
|
79
|
-
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
83
|
+
onChange === null || onChange === void 0 || onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
80
84
|
conditions: allConditions
|
81
85
|
}));
|
82
86
|
} else {
|
@@ -86,15 +90,16 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
86
90
|
//This is to handle a edge case.
|
87
91
|
//When a group has structure as 1 condition,1 subgroup, 1 condition and if we delete first condition,
|
88
92
|
//the group will start with a subgroup. To avoid this,opening up that subgroup.
|
89
|
-
if (filteredConditions
|
90
|
-
|
93
|
+
if ((filteredConditions === null || filteredConditions === void 0 ? void 0 : filteredConditions[0]).conditions) {
|
94
|
+
var firstFilteredConditions = filteredConditions[0];
|
95
|
+
filteredConditions.splice.apply(filteredConditions, [0, 1].concat(_rollupPluginBabelHelpers.toConsumableArray(firstFilteredConditions === null || firstFilteredConditions === void 0 ? void 0 : firstFilteredConditions.conditions)));
|
91
96
|
}
|
92
|
-
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
97
|
+
onChange === null || onChange === void 0 || onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
93
98
|
conditions: filteredConditions
|
94
99
|
}));
|
95
100
|
}
|
96
101
|
} else {
|
97
|
-
onRemove(evt);
|
102
|
+
onRemove === null || onRemove === void 0 || onRemove(evt);
|
98
103
|
}
|
99
104
|
};
|
100
105
|
//check to identify a group without a plain condition
|
@@ -104,9 +109,11 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
104
109
|
});
|
105
110
|
};
|
106
111
|
var onChangeHandler = function onChangeHandler(updatedCondition, conditionIndex) {
|
107
|
-
var
|
108
|
-
|
109
|
-
|
112
|
+
var _group$id;
|
113
|
+
var updatedConditions = [].concat(_rollupPluginBabelHelpers.toConsumableArray(group !== null && group !== void 0 && group.conditions ? group.conditions.slice(0, conditionIndex) : []), [updatedCondition], _rollupPluginBabelHelpers.toConsumableArray(group !== null && group !== void 0 && group.conditions ? group.conditions.slice(conditionIndex + 1) : []));
|
114
|
+
onChange === null || onChange === void 0 || onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
115
|
+
conditions: updatedConditions,
|
116
|
+
id: (_group$id = group === null || group === void 0 ? void 0 : group.id) !== null && _group$id !== void 0 ? _group$id : uuidv4["default"]()
|
110
117
|
}));
|
111
118
|
};
|
112
119
|
var addConditionHandler = function addConditionHandler(conditionIndex) {
|
@@ -117,8 +124,8 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
117
124
|
popoverToOpen: 'propertyField',
|
118
125
|
id: uuidv4["default"]()
|
119
126
|
};
|
120
|
-
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
121
|
-
conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [newCondition], _rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(conditionIndex + 1)))
|
127
|
+
onChange === null || onChange === void 0 || onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
128
|
+
conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions ? group.conditions.slice(0, conditionIndex + 1) : []), [newCondition], _rollupPluginBabelHelpers.toConsumableArray(group.conditions ? group.conditions.slice(conditionIndex + 1) : []))
|
122
129
|
}));
|
123
130
|
};
|
124
131
|
var handleFocusOnClose = function handleFocusOnClose(e, conditionIndex) {
|
@@ -126,14 +133,14 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
126
133
|
//get all close buttons.
|
127
134
|
//if the last condition is closing, focus the second last one.
|
128
135
|
//or focus the next one.
|
129
|
-
var currentGroupCloseButtons = (_e$currentTarget$clos = e.currentTarget.closest(".".concat(
|
136
|
+
var currentGroupCloseButtons = (_e$currentTarget$clos = e.currentTarget.closest(".".concat(util.blockClass, "__group"))) === null || _e$currentTarget$clos === void 0 ? void 0 : _e$currentTarget$clos.querySelectorAll('[data-name="closeCondition"]');
|
130
137
|
if (conditionIndex == currentGroupCloseButtons.length - 1) {
|
131
138
|
util.manageTabIndexAndFocus(currentGroupCloseButtons[conditionIndex - 1], conditionBuilderRef);
|
132
139
|
} else {
|
133
140
|
util.manageTabIndexAndFocus(currentGroupCloseButtons[conditionIndex + 1], conditionBuilderRef);
|
134
141
|
}
|
135
142
|
};
|
136
|
-
var
|
143
|
+
var handleFocusOnCloseHierarchical = function handleFocusOnCloseHierarchical(evt) {
|
137
144
|
var _evt$currentTarget, _evt$currentTarget2, _conditionBuilderCont, _conditionBuilderCont2;
|
138
145
|
//getting the current aria-level and aria-posinset.
|
139
146
|
var currentLevel = (_evt$currentTarget = evt.currentTarget) === null || _evt$currentTarget === void 0 || (_evt$currentTarget = _evt$currentTarget.closest('[role="row"]')) === null || _evt$currentTarget === void 0 ? void 0 : _evt$currentTarget.getAttribute('aria-level');
|
@@ -145,9 +152,9 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
145
152
|
//checking if next level is a valid condition. If then, focus the close button inside that condition
|
146
153
|
//Otherwise , check the previous item is a valid condition
|
147
154
|
|
148
|
-
if (nextElement !== null && nextElement !== void 0 && nextElement.classList.contains("".concat(
|
155
|
+
if (nextElement !== null && nextElement !== void 0 && nextElement.classList.contains("".concat(util.blockClass, "__condition-block"))) {
|
149
156
|
util.manageTabIndexAndFocus(nextElement === null || nextElement === void 0 ? void 0 : nextElement.querySelector('[data-name="closeCondition"]'), conditionBuilderRef);
|
150
|
-
} else if (prevElement !== null && prevElement !== void 0 && prevElement.classList.contains("".concat(
|
157
|
+
} else if (prevElement !== null && prevElement !== void 0 && prevElement.classList.contains("".concat(util.blockClass, "__condition-block"))) {
|
151
158
|
util.manageTabIndexAndFocus(prevElement === null || prevElement === void 0 ? void 0 : prevElement.querySelector('[data-name="closeCondition"]'), conditionBuilderRef);
|
152
159
|
}
|
153
160
|
//If there are no valid condition in this group, focus next or previous row
|
@@ -163,10 +170,11 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
163
170
|
ariaPosInSet: nextRow.ariaPosInSet
|
164
171
|
};
|
165
172
|
setTimeout(function () {
|
166
|
-
var
|
173
|
+
var _conditionBuilderCont5;
|
174
|
+
var currentRowToFocus = (_conditionBuilderCont5 = conditionBuilderContentRef.current) === null || _conditionBuilderCont5 === void 0 ? void 0 : _conditionBuilderCont5.querySelector("[role=\"row\"][aria-level=\"".concat(rowIdentity.ariaLevel, "\"][aria-posinset=\"").concat(rowIdentity.ariaPosInSet, "\"]"));
|
167
175
|
util.manageTabIndexAndFocus(currentRowToFocus === null || currentRowToFocus === void 0 ? void 0 : currentRowToFocus.querySelector('[data-name="closeCondition"]'), conditionBuilderRef);
|
168
176
|
}, 0);
|
169
|
-
} else if (
|
177
|
+
} else if (prevRows !== null && prevRows !== void 0 && prevRows.length && prevRows.length > 1) {
|
170
178
|
var _prevRows;
|
171
179
|
util.manageTabIndexAndFocus((_prevRows = prevRows[prevRows.length - 2]) === null || _prevRows === void 0 ? void 0 : _prevRows.querySelector('[data-name="closeCondition"]'), conditionBuilderRef);
|
172
180
|
}
|
@@ -174,9 +182,9 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
174
182
|
};
|
175
183
|
var addConditionSubGroupHandler = function addConditionSubGroupHandler(conditionIndex) {
|
176
184
|
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
177
|
-
conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [{
|
185
|
+
conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions ? group.conditions.slice(0, conditionIndex + 1) : []), [{
|
186
|
+
statement: 'ifAll',
|
178
187
|
groupOperator: 'and',
|
179
|
-
statement: 'if',
|
180
188
|
conditions: [{
|
181
189
|
property: undefined,
|
182
190
|
operator: '',
|
@@ -185,7 +193,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
185
193
|
id: uuidv4["default"]()
|
186
194
|
}],
|
187
195
|
id: uuidv4["default"]()
|
188
|
-
}], _rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(conditionIndex + 1)))
|
196
|
+
}], _rollupPluginBabelHelpers.toConsumableArray(group.conditions ? group.conditions.slice(conditionIndex + 1) : []))
|
189
197
|
}));
|
190
198
|
};
|
191
199
|
var isLastCondition = function isLastCondition(conditionIndex, conditionArr) {
|
@@ -205,7 +213,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
205
213
|
};
|
206
214
|
var onStatementChangeHandler = function onStatementChangeHandler(updatedStatement) {
|
207
215
|
var _statementConfig$find;
|
208
|
-
var groupOperator = (_statementConfig$find =
|
216
|
+
var groupOperator = (_statementConfig$find = statementConfig.find(function (statement) {
|
209
217
|
return statement.id == updatedStatement;
|
210
218
|
})) === null || _statementConfig$find === void 0 ? void 0 : _statementConfig$find.connector;
|
211
219
|
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
@@ -218,24 +226,25 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
218
226
|
groupOperator: op
|
219
227
|
}));
|
220
228
|
};
|
221
|
-
var
|
222
|
-
var _group$
|
229
|
+
var getNonHierarchicalVariant = function getNonHierarchicalVariant() {
|
230
|
+
var _group$conditions2;
|
223
231
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
224
232
|
className: "".concat(className, " eachGroup")
|
225
233
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
226
|
-
className: "".concat(
|
234
|
+
className: "".concat(util.blockClass, "__condition-wrapper"),
|
227
235
|
role: "grid",
|
228
236
|
"aria-label": conditionBuilderText
|
229
|
-
}, group === null || group === void 0 || (_group$
|
237
|
+
}, group === null || group === void 0 || (_group$conditions2 = group.conditions) === null || _group$conditions2 === void 0 ? void 0 : _group$conditions2.map(function (eachCondition, conditionIndex) {
|
238
|
+
var _group$conditions3;
|
230
239
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
231
240
|
key: eachCondition.id,
|
232
|
-
className: "".concat(
|
241
|
+
className: "".concat(util.blockClass, "__group-wrapper")
|
233
242
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBlock["default"], {
|
234
243
|
conjunction: conditionIndex > 0 ? group.groupOperator : undefined,
|
235
244
|
aria: {
|
236
245
|
level: aria.level + 1,
|
237
246
|
posinset: conditionIndex + 1,
|
238
|
-
setsize: group.conditions.length
|
247
|
+
setsize: group === null || group === void 0 || (_group$conditions3 = group.conditions) === null || _group$conditions3 === void 0 ? void 0 : _group$conditions3.length
|
239
248
|
},
|
240
249
|
isStatement: conditionIndex == 0,
|
241
250
|
condition: eachCondition,
|
@@ -254,10 +263,10 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
254
263
|
}));
|
255
264
|
})));
|
256
265
|
};
|
257
|
-
var
|
258
|
-
var _group$
|
266
|
+
var getHierarchicalVariant = function getHierarchicalVariant() {
|
267
|
+
var _group$conditions4;
|
259
268
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
260
|
-
className: "".concat(className, " ").concat(
|
269
|
+
className: "".concat(className, " ").concat(util.blockClass, "__condition-wrapper"),
|
261
270
|
role: aria.level === 1 ? 'rowgroup' : undefined,
|
262
271
|
"aria-label": aria.level == 1 ? conditionBuilderGroupText : undefined,
|
263
272
|
ref: conditionBuilderContentRef
|
@@ -271,8 +280,8 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
271
280
|
label: group.statement,
|
272
281
|
title: conditionText,
|
273
282
|
"data-name": "connectorField",
|
274
|
-
popOverClassName: "".concat(
|
275
|
-
className: "".concat(
|
283
|
+
popOverClassName: "".concat(util.blockClass, "__gap"),
|
284
|
+
className: "".concat(util.blockClass, "__statement-button")
|
276
285
|
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
277
286
|
conditionState: {
|
278
287
|
value: group.statement,
|
@@ -283,37 +292,39 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
283
292
|
onStatementChangeHandler(v);
|
284
293
|
},
|
285
294
|
config: {
|
286
|
-
options:
|
295
|
+
options: statementConfig,
|
296
|
+
isStatement: true
|
287
297
|
}
|
288
|
-
}))), group === null || group === void 0 || (_group$
|
298
|
+
}))), group === null || group === void 0 || (_group$conditions4 = group.conditions) === null || _group$conditions4 === void 0 ? void 0 : _group$conditions4.map(function (eachCondition, conditionIndex) {
|
299
|
+
var _group$conditions$len, _group$conditions5, _group$conditions$len2, _group$conditions6;
|
289
300
|
return /*#__PURE__*/React__default["default"].createElement(React.Fragment, {
|
290
301
|
key: eachCondition.id
|
291
302
|
}, eachCondition.conditions ? /*#__PURE__*/React__default["default"].createElement("div", {
|
292
|
-
className: cx__default["default"]("".concat(
|
303
|
+
className: cx__default["default"]("".concat(util.blockClass, "__condition-block subgroup ").concat(util.blockClass, "__gap"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(util.blockClass, "__gap-bottom"), group && group.conditions && group.conditions.length < conditionIndex + 1), {})
|
293
304
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionConnector["default"], {
|
294
|
-
className: "".concat(
|
305
|
+
className: "".concat(util.blockClass, "__gap ").concat(util.blockClass, "__gap-bottom ").concat(util.blockClass, "__groupConnector"),
|
295
306
|
operator: group.groupOperator,
|
296
307
|
"aria-hidden": true
|
297
308
|
}), /*#__PURE__*/React__default["default"].createElement(ConditionGroupBuilder, {
|
298
309
|
aria: {
|
299
310
|
level: aria.level + 1,
|
300
311
|
posinset: conditionIndex + 1,
|
301
|
-
setsize: group.conditions.length
|
312
|
+
setsize: (_group$conditions$len = (_group$conditions5 = group.conditions) === null || _group$conditions5 === void 0 ? void 0 : _group$conditions5.length) !== null && _group$conditions$len !== void 0 ? _group$conditions$len : 0
|
302
313
|
},
|
303
|
-
className: "".concat(
|
314
|
+
className: "".concat(util.blockClass, "__group"),
|
304
315
|
group: eachCondition,
|
305
316
|
onChange: function onChange(updatedConditions) {
|
306
317
|
onChangeHandler(updatedConditions, conditionIndex);
|
307
318
|
},
|
308
319
|
onRemove: function onRemove(e) {
|
309
|
-
onRemoveHandler(eachCondition.id, e);
|
320
|
+
onRemoveHandler(eachCondition.id, e, conditionIndex);
|
310
321
|
}
|
311
322
|
})) : /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(ConditionBlock["default"], {
|
312
323
|
conjunction: conditionIndex > 0 ? group.groupOperator : undefined,
|
313
324
|
aria: {
|
314
325
|
level: aria.level + 1,
|
315
326
|
posinset: conditionIndex + 1,
|
316
|
-
setsize: group.conditions.length
|
327
|
+
setsize: (_group$conditions$len2 = (_group$conditions6 = group.conditions) === null || _group$conditions6 === void 0 ? void 0 : _group$conditions6.length) !== null && _group$conditions$len2 !== void 0 ? _group$conditions$len2 : 0
|
317
328
|
},
|
318
329
|
isStatement: false,
|
319
330
|
condition: eachCondition,
|
@@ -325,7 +336,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
325
336
|
onChangeHandler(updatedConditions, conditionIndex);
|
326
337
|
},
|
327
338
|
onRemove: function onRemove(e) {
|
328
|
-
onRemoveHandler(eachCondition.id, e);
|
339
|
+
onRemoveHandler(eachCondition.id, e, conditionIndex);
|
329
340
|
},
|
330
341
|
onConnectorOperatorChange: onConnectorOperatorChange,
|
331
342
|
onStatementChange: onStatementChangeHandler,
|
@@ -347,9 +358,8 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
347
358
|
}))));
|
348
359
|
}));
|
349
360
|
};
|
350
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, variant ==
|
361
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, variant == util.HIERARCHICAL_VARIANT && getHierarchicalVariant(), variant == util.NON_HIERARCHICAL_VARIANT && getNonHierarchicalVariant());
|
351
362
|
};
|
352
|
-
var ConditionGroupBuilder$1 = ConditionGroupBuilder;
|
353
363
|
ConditionGroupBuilder.propTypes = {
|
354
364
|
/**
|
355
365
|
* object contains the aria attributes
|
@@ -373,4 +383,4 @@ ConditionGroupBuilder.propTypes = {
|
|
373
383
|
onRemove: index["default"].func
|
374
384
|
};
|
375
385
|
|
376
|
-
exports["default"] = ConditionGroupBuilder
|
386
|
+
exports["default"] = ConditionGroupBuilder;
|