@carbon/ibm-products 2.44.0 → 2.45.0-rc.1
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 +118 -15
- 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 +203 -5
- 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 +118 -15
- 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 +118 -15
- 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/Coachmark/Coachmark.js +12 -7
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
- package/es/components/CoachmarkStack/CoachmarkStack.js +7 -3
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +35 -22
- package/es/components/ConditionBuilder/ConditionBuilder.js +17 -7
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +58 -36
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +23 -11
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +8 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +17 -9
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +29 -16
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +23 -20
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +49 -23
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +12 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +9 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +10 -5
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +19 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +70 -17
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +31 -14
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +120 -28
- package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/useTranslations.js +26 -0
- package/es/components/ConditionBuilder/utils/util.js +1 -9
- package/es/components/CreateFullPage/CreateFullPage.js +2 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +27 -12
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
- package/es/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/es/components/Datagrid/Datagrid/Datagrid.js +2 -8
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
- package/es/components/Datagrid/Datagrid/DatagridRow.js +8 -6
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
- package/es/components/Datagrid/types/index.d.ts +28 -6
- package/es/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/es/components/Datagrid/useCustomizeColumns.js +4 -3
- package/es/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/es/components/Datagrid/useNestedRowExpander.js +1 -3
- package/es/components/Datagrid/useRowExpander.js +1 -3
- package/es/components/Datagrid/useSelectRows.js +2 -1
- package/es/components/Datagrid/useStickyColumn.d.ts +8 -1
- package/es/components/Datagrid/useStickyColumn.js +12 -9
- package/es/components/EditInPlace/EditInPlace.d.ts +4 -0
- package/es/components/EditInPlace/EditInPlace.js +21 -10
- package/es/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/es/components/EditTearsheet/EditTearsheet.js +44 -9
- package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/es/components/Nav/NavItem.js +12 -3
- package/es/components/OptionsTile/OptionsTile.js +11 -6
- package/es/components/PageHeader/PageHeader.js +1 -0
- package/es/components/SearchBar/SearchBar.d.ts +1 -1
- package/es/components/SearchBar/SearchBar.js +2 -2
- package/es/components/SidePanel/SidePanel.js +17 -21
- package/es/components/SidePanel/motion/variants.d.ts +4 -6
- package/es/components/SidePanel/motion/variants.js +10 -11
- package/es/components/Tearsheet/TearsheetShell.js +3 -1
- package/es/components/WebTerminal/WebTerminal.js +10 -12
- package/es/global/js/hooks/usePrefersReducedMotion.js +14 -8
- package/es/global/js/package-settings.d.ts +1 -1
- package/es/global/js/package-settings.js +1 -1
- package/es/settings.d.ts +1 -1
- package/lib/components/Coachmark/Coachmark.js +12 -7
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
- package/lib/components/CoachmarkStack/CoachmarkStack.js +7 -3
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +34 -21
- package/lib/components/ConditionBuilder/ConditionBuilder.js +17 -7
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +56 -33
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +22 -10
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -3
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +6 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +16 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +28 -15
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +22 -20
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +48 -22
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +11 -8
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +8 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -4
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +18 -6
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +68 -15
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +30 -13
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +119 -27
- package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/useTranslations.js +30 -0
- package/lib/components/ConditionBuilder/utils/util.js +0 -9
- package/lib/components/CreateFullPage/CreateFullPage.js +2 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +27 -12
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
- package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -8
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +8 -6
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
- package/lib/components/Datagrid/types/index.d.ts +28 -6
- package/lib/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/lib/components/Datagrid/useCustomizeColumns.js +4 -3
- package/lib/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/lib/components/Datagrid/useNestedRowExpander.js +1 -3
- package/lib/components/Datagrid/useRowExpander.js +1 -3
- package/lib/components/Datagrid/useSelectRows.js +2 -1
- package/lib/components/Datagrid/useStickyColumn.d.ts +8 -1
- package/lib/components/Datagrid/useStickyColumn.js +12 -9
- package/lib/components/EditInPlace/EditInPlace.d.ts +4 -0
- package/lib/components/EditInPlace/EditInPlace.js +21 -10
- package/lib/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/lib/components/EditTearsheet/EditTearsheet.js +43 -8
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/lib/components/Nav/NavItem.js +10 -1
- package/lib/components/OptionsTile/OptionsTile.js +11 -6
- package/lib/components/PageHeader/PageHeader.js +1 -0
- package/lib/components/SearchBar/SearchBar.d.ts +1 -1
- package/lib/components/SearchBar/SearchBar.js +2 -2
- package/lib/components/SidePanel/SidePanel.js +16 -20
- package/lib/components/SidePanel/motion/variants.d.ts +4 -6
- package/lib/components/SidePanel/motion/variants.js +10 -11
- package/lib/components/Tearsheet/TearsheetShell.js +3 -1
- package/lib/components/WebTerminal/WebTerminal.js +10 -12
- package/lib/global/js/hooks/usePrefersReducedMotion.js +13 -7
- package/lib/global/js/package-settings.d.ts +1 -1
- package/lib/global/js/package-settings.js +1 -1
- package/lib/settings.d.ts +1 -1
- package/package.json +4 -4
- package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +8 -4
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +9 -2
- package/scss/components/Datagrid/_datagrid.scss +0 -4
- package/scss/components/HTTPErrors/_http-errors.scss +77 -0
- package/scss/components/OptionsTile/_options-tile.scss +6 -6
- package/scss/components/SidePanel/_side-panel.scss +1 -1
- package/scss/components/_index-released-only.scss +1 -0
- package/telemetry.yml +12 -2
- package/es/global/js/utils/window.d.ts +0 -2
- package/es/global/js/utils/window.js +0 -12
- package/lib/global/js/utils/window.d.ts +0 -2
- package/lib/global/js/utils/window.js +0 -16
@@ -16,12 +16,13 @@ var index = require('../../../node_modules/prop-types/index.js');
|
|
16
16
|
var icons = require('@carbon/react/icons');
|
17
17
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
18
18
|
var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
|
19
|
+
var useTranslations = require('../utils/useTranslations.js');
|
19
20
|
|
20
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
21
22
|
|
22
23
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
23
24
|
|
24
|
-
var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config"];
|
25
|
+
var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config", "renderChildren"];
|
25
26
|
var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
26
27
|
var children = _ref.children,
|
27
28
|
className = _ref.className,
|
@@ -33,23 +34,36 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
33
34
|
condition = _ref.condition,
|
34
35
|
popOverClassName = _ref.popOverClassName,
|
35
36
|
config = _ref.config,
|
37
|
+
renderChildren = _ref.renderChildren,
|
36
38
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
37
39
|
var contentRef = React.useRef(null);
|
40
|
+
var popoverRef = React.useRef(null);
|
38
41
|
var _useState = React.useState(false),
|
39
42
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
40
43
|
open = _useState2[0],
|
41
44
|
setOpen = _useState2[1];
|
45
|
+
var _useTranslations = useTranslations.useTranslations(['invalidText', 'addConditionText', label, 'invalidDateText']),
|
46
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 4),
|
47
|
+
invalidText = _useTranslations2[0],
|
48
|
+
addConditionText = _useTranslations2[1],
|
49
|
+
labelText = _useTranslations2[2],
|
50
|
+
invalidDateText = _useTranslations2[3];
|
42
51
|
var getPropertyDetails = function getPropertyDetails() {
|
43
52
|
if (label === 'INVALID') {
|
44
53
|
return {
|
45
|
-
propertyLabel:
|
54
|
+
propertyLabel: invalidText,
|
55
|
+
isInvalid: true
|
56
|
+
};
|
57
|
+
} else if (label === 'INVALID_DATE') {
|
58
|
+
return {
|
59
|
+
propertyLabel: invalidDateText,
|
46
60
|
isInvalid: true
|
47
61
|
};
|
48
62
|
}
|
49
|
-
var propertyId = rest['data-name'] == 'valueField' && type ? DataConfigs.valueRenderers[type](label, config) :
|
63
|
+
var propertyId = rest['data-name'] == 'valueField' && type ? DataConfigs.valueRenderers[type](label, config) : labelText;
|
50
64
|
return {
|
51
65
|
isInvalid: false,
|
52
|
-
propertyLabel:
|
66
|
+
propertyLabel: propertyId
|
53
67
|
};
|
54
68
|
};
|
55
69
|
var _getPropertyDetails = getPropertyDetails(),
|
@@ -65,60 +79,68 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
65
79
|
//if any condition is changed, state prop is triggered
|
66
80
|
if (condition.popoverToOpen && currentField !== condition.popoverToOpen) {
|
67
81
|
// close the previous popover
|
68
|
-
|
69
|
-
} else if (currentField == 'valueField' && type == 'option' && condition.operator !== '
|
82
|
+
closePopover();
|
83
|
+
} else if (currentField == 'valueField' && type == 'option' && condition.operator !== 'oneOf') {
|
70
84
|
//close the current popover if the field is valueField and is a single select dropdown. For all other inputs ,popover need to be open on value changes.
|
71
|
-
|
85
|
+
closePopover();
|
72
86
|
}
|
73
87
|
if (condition.popoverToOpen == currentField) {
|
74
88
|
//current popover need to be opened
|
75
|
-
|
89
|
+
openPopOver();
|
76
90
|
}
|
77
91
|
} else {
|
78
92
|
// when we change any statement(if/ excl.if) which is not part of condition state, label change is triggered.
|
79
93
|
//close popOver when statement is changed.
|
80
|
-
|
94
|
+
closePopover();
|
81
95
|
}
|
82
96
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
83
97
|
}, [condition, label]);
|
84
98
|
React.useEffect(function () {
|
85
99
|
//this will focus the first input field in the popover
|
86
100
|
if (open && contentRef.current) {
|
87
|
-
var firstFocusableElement = contentRef.current.querySelector('input');
|
101
|
+
var firstFocusableElement = contentRef.current.querySelector('input,textarea');
|
88
102
|
if (firstFocusableElement) {
|
89
103
|
firstFocusableElement.focus();
|
90
104
|
}
|
91
105
|
}
|
92
106
|
}, [contentRef, open]);
|
107
|
+
var closePopover = function closePopover() {
|
108
|
+
return setOpen(false);
|
109
|
+
};
|
110
|
+
var openPopOver = function openPopOver() {
|
111
|
+
return setOpen(true);
|
112
|
+
};
|
113
|
+
var togglePopover = function togglePopover() {
|
114
|
+
return setOpen(!open);
|
115
|
+
};
|
93
116
|
return /*#__PURE__*/React__default["default"].createElement(react.Popover, {
|
94
117
|
open: open,
|
95
118
|
isTabTip: true,
|
96
119
|
role: "gridcell",
|
97
120
|
className: popOverClassName,
|
98
|
-
|
99
|
-
|
100
|
-
}
|
121
|
+
ref: popoverRef,
|
122
|
+
onRequestClose: closePopover
|
101
123
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
|
102
|
-
label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel :
|
124
|
+
label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : addConditionText,
|
103
125
|
hideLabel: !label ? true : false,
|
104
|
-
onClick:
|
105
|
-
children ? setOpen(!open) : null;
|
106
|
-
},
|
126
|
+
onClick: togglePopover,
|
107
127
|
className: className,
|
108
128
|
"aria-haspopup": true,
|
109
129
|
"aria-expanded": open,
|
110
130
|
renderIcon: renderIcon ? renderIcon : label == undefined ? icons.Add : null,
|
111
131
|
showToolTip: showToolTip,
|
112
|
-
isInvalid: isInvalid
|
113
|
-
|
132
|
+
isInvalid: isInvalid,
|
133
|
+
condition: condition
|
134
|
+
}, rest)), open && /*#__PURE__*/React__default["default"].createElement(react.PopoverContent, {
|
114
135
|
className: "".concat(DataConfigs.blockClass, "__item__content"),
|
115
136
|
role: "dialog",
|
116
|
-
"aria-label":
|
137
|
+
"aria-label": title
|
117
138
|
}, /*#__PURE__*/React__default["default"].createElement(react.Layer, null, /*#__PURE__*/React__default["default"].createElement("h1", {
|
118
139
|
className: "".concat(DataConfigs.blockClass, "__item__title")
|
119
140
|
}, title), /*#__PURE__*/React__default["default"].createElement("div", {
|
120
|
-
ref: contentRef
|
121
|
-
|
141
|
+
ref: contentRef,
|
142
|
+
className: "".concat(DataConfigs.blockClass, "__popover-content")
|
143
|
+
}, renderChildren ? renderChildren(popoverRef) : children))));
|
122
144
|
};
|
123
145
|
ConditionBuilderItem.propTypes = {
|
124
146
|
/**
|
@@ -146,6 +168,10 @@ ConditionBuilderItem.propTypes = {
|
|
146
168
|
* class name for popover
|
147
169
|
*/
|
148
170
|
popOverClassName: index["default"].string,
|
171
|
+
/**
|
172
|
+
* callback prop that returns the jsx for children
|
173
|
+
*/
|
174
|
+
renderChildren: index["default"].func,
|
149
175
|
/**
|
150
176
|
* Optional prop to allow overriding the icon rendering.
|
151
177
|
*/
|
@@ -1,11 +1,13 @@
|
|
1
|
-
export function ConditionBuilderItemDate({ conditionState, onChange }: {
|
1
|
+
export function ConditionBuilderItemDate({ conditionState, onChange, parentRef, }: {
|
2
2
|
conditionState: any;
|
3
3
|
onChange: any;
|
4
|
+
parentRef: any;
|
4
5
|
}): import("react/jsx-runtime").JSX.Element;
|
5
6
|
export namespace ConditionBuilderItemDate {
|
6
7
|
namespace propTypes {
|
7
8
|
let conditionState: PropTypes.Requireable<object>;
|
8
9
|
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
10
|
+
let parentRef: PropTypes.Requireable<object>;
|
9
11
|
}
|
10
12
|
}
|
11
13
|
import PropTypes from 'prop-types';
|
@@ -9,11 +9,12 @@
|
|
9
9
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
12
13
|
var React = require('react');
|
13
14
|
var react = require('@carbon/react');
|
14
15
|
var settings = require('../../../../settings.js');
|
15
16
|
var index = require('../../../../node_modules/prop-types/index.js');
|
16
|
-
var
|
17
|
+
var useTranslations = require('../../utils/useTranslations.js');
|
17
18
|
|
18
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
19
20
|
|
@@ -22,17 +23,26 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
23
|
var blockClass = "".concat(settings.pkg.prefix, "--condition-builder");
|
23
24
|
var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
|
24
25
|
var conditionState = _ref.conditionState,
|
25
|
-
onChange = _ref.onChange
|
26
|
+
onChange = _ref.onChange,
|
27
|
+
parentRef = _ref.parentRef;
|
26
28
|
var DatePickerInputRef = React.useRef();
|
29
|
+
var _useTranslations = useTranslations.useTranslations(['startText', 'endText']),
|
30
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 2),
|
31
|
+
startText = _useTranslations2[0],
|
32
|
+
endText = _useTranslations2[1];
|
27
33
|
var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
|
34
|
+
var onCloseHandler = function onCloseHandler(selectedDate) {
|
35
|
+
onChange(selectedDate && selectedDate.length > 0 ? selectedDate : 'INVALID_DATE');
|
36
|
+
};
|
28
37
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
29
38
|
className: "".concat(blockClass, "__item-date ")
|
30
39
|
}, datePickerType == 'single' && /*#__PURE__*/React__default["default"].createElement(react.DatePicker, {
|
31
40
|
ref: DatePickerInputRef,
|
32
41
|
dateFormat: "d/m/Y",
|
33
42
|
datePickerType: "single",
|
34
|
-
|
35
|
-
|
43
|
+
value: conditionState.value,
|
44
|
+
onClose: onCloseHandler,
|
45
|
+
appendTo: parentRef === null || parentRef === void 0 ? void 0 : parentRef.current
|
36
46
|
}, /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, {
|
37
47
|
id: "datePicker",
|
38
48
|
placeholder: "dd/mm/yyyy",
|
@@ -41,16 +51,17 @@ var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
|
|
41
51
|
ref: DatePickerInputRef,
|
42
52
|
dateFormat: "d/m/Y",
|
43
53
|
datePickerType: datePickerType,
|
44
|
-
onClose:
|
45
|
-
value: conditionState.value
|
54
|
+
onClose: onCloseHandler,
|
55
|
+
value: conditionState.value,
|
56
|
+
appendTo: parentRef === null || parentRef === void 0 ? void 0 : parentRef.current
|
46
57
|
}, /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, {
|
47
58
|
id: "datePickerStart",
|
48
59
|
placeholder: "dd/mm/yyyy",
|
49
|
-
labelText:
|
60
|
+
labelText: startText
|
50
61
|
}), /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, {
|
51
62
|
id: "datePickerEnd",
|
52
63
|
placeholder: "dd/mm/yyyy",
|
53
|
-
labelText:
|
64
|
+
labelText: endText
|
54
65
|
})));
|
55
66
|
};
|
56
67
|
ConditionBuilderItemDate.propTypes = {
|
@@ -61,7 +72,11 @@ ConditionBuilderItemDate.propTypes = {
|
|
61
72
|
/**
|
62
73
|
* callback to update state oin date change
|
63
74
|
*/
|
64
|
-
onChange: index["default"].func
|
75
|
+
onChange: index["default"].func,
|
76
|
+
/**
|
77
|
+
* reference to the popover node
|
78
|
+
*/
|
79
|
+
parentRef: index["default"].object
|
65
80
|
};
|
66
81
|
|
67
82
|
exports.ConditionBuilderItemDate = ConditionBuilderItemDate;
|
@@ -9,10 +9,12 @@
|
|
9
9
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
12
13
|
var React = require('react');
|
13
14
|
var react = require('@carbon/react');
|
14
15
|
var index = require('../../../../node_modules/prop-types/index.js');
|
15
16
|
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
17
|
+
var useTranslations = require('../../utils/useTranslations.js');
|
16
18
|
|
17
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
18
20
|
|
@@ -23,9 +25,12 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
23
25
|
var conditionState = _ref.conditionState,
|
24
26
|
config = _ref.config,
|
25
27
|
onChange = _ref.onChange;
|
28
|
+
var _useTranslations = useTranslations.useTranslations(['invalidNumberWarnText']),
|
29
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 1),
|
30
|
+
invalidNumberWarnText = _useTranslations2[0];
|
26
31
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
27
32
|
var value = _ref2.value;
|
28
|
-
if (checkIfValid(value)) {
|
33
|
+
if (!isNaN(value) && checkIfValid(value)) {
|
29
34
|
var _config$unit;
|
30
35
|
onChange("".concat(value, " ").concat((_config$unit = config.unit) !== null && _config$unit !== void 0 ? _config$unit : ''));
|
31
36
|
} else {
|
@@ -44,18 +49,16 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
44
49
|
};
|
45
50
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
46
51
|
className: "".concat(DataConfigs.blockClass, "__item-number")
|
47
|
-
}, /*#__PURE__*/React__default["default"].createElement(react.NumberInput, {
|
52
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.NumberInput, _rollupPluginBabelHelpers["extends"]({
|
48
53
|
label: conditionState.property,
|
49
54
|
hideLabel: true,
|
50
|
-
defaultValue: getDefaultValue(),
|
51
55
|
id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
|
52
|
-
|
53
|
-
max: config.max,
|
54
|
-
step: config.step,
|
55
|
-
invalidText: DataConfigs.translateWithId('text_invalid_number'),
|
56
|
+
invalidText: invalidNumberWarnText,
|
56
57
|
allowEmpty: true,
|
57
58
|
onChange: onChangeHandler
|
58
|
-
}
|
59
|
+
}, config, {
|
60
|
+
defaultValue: getDefaultValue()
|
61
|
+
})));
|
59
62
|
};
|
60
63
|
ConditionBuilderItemNumber.propTypes = {
|
61
64
|
/**
|
@@ -16,6 +16,7 @@ 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
18
|
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
19
|
+
var useTranslations = require('../../utils/useTranslations.js');
|
19
20
|
|
20
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
21
22
|
|
@@ -30,6 +31,10 @@ var ItemOption = function ItemOption(_ref) {
|
|
30
31
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
31
32
|
popOverSearchThreshold = _useContext.popOverSearchThreshold;
|
32
33
|
var contentRef = React.useRef();
|
34
|
+
var _useTranslations = useTranslations.useTranslations(['propertyText', 'clearSearchText']),
|
35
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 2),
|
36
|
+
propertyText = _useTranslations2[0],
|
37
|
+
clearSearchText = _useTranslations2[1];
|
33
38
|
var allOptions = config.options;
|
34
39
|
var _useState = React.useState(''),
|
35
40
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
@@ -57,7 +62,7 @@ var ItemOption = function ItemOption(_ref) {
|
|
57
62
|
setSearchValue(value);
|
58
63
|
};
|
59
64
|
var getAriaLabel = function getAriaLabel() {
|
60
|
-
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property :
|
65
|
+
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : propertyText;
|
61
66
|
};
|
62
67
|
if (!allOptions) {
|
63
68
|
return;
|
@@ -69,8 +74,8 @@ var ItemOption = function ItemOption(_ref) {
|
|
69
74
|
className: "".concat(DataConfigs.blockClass, "__item-option__search")
|
70
75
|
}, /*#__PURE__*/React__default["default"].createElement(react.Search, {
|
71
76
|
size: "sm",
|
72
|
-
labelText:
|
73
|
-
closeButtonLabelText:
|
77
|
+
labelText: clearSearchText,
|
78
|
+
closeButtonLabelText: clearSearchText,
|
74
79
|
onChange: onSearchChangeHandler
|
75
80
|
})), /*#__PURE__*/React__default["default"].createElement("ul", {
|
76
81
|
"aria-label": getAriaLabel(),
|
@@ -16,6 +16,7 @@ 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
18
|
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
19
|
+
var useTranslations = require('../../utils/useTranslations.js');
|
19
20
|
|
20
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
21
22
|
|
@@ -28,11 +29,15 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
28
29
|
_ref$config = _ref.config,
|
29
30
|
config = _ref$config === void 0 ? {} : _ref$config,
|
30
31
|
onChange = _ref.onChange;
|
31
|
-
var multiSelectable = conditionState.operator === '
|
32
|
+
var multiSelectable = conditionState.operator === 'oneOf';
|
32
33
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
33
34
|
popOverSearchThreshold = _useContext.popOverSearchThreshold,
|
34
35
|
getOptions = _useContext.getOptions,
|
35
36
|
rootState = _useContext.rootState;
|
37
|
+
var _useTranslations = useTranslations.useTranslations(['propertyText', 'clearSearchText']),
|
38
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 2),
|
39
|
+
propertyText = _useTranslations2[0],
|
40
|
+
clearSearchText = _useTranslations2[1];
|
36
41
|
var contentRef = React.useRef();
|
37
42
|
var _useState = React.useState(config.options),
|
38
43
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
@@ -130,7 +135,7 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
130
135
|
}
|
131
136
|
};
|
132
137
|
var getAriaLabel = function getAriaLabel() {
|
133
|
-
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property :
|
138
|
+
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : propertyText;
|
134
139
|
};
|
135
140
|
if (!allOptions) {
|
136
141
|
return _SelectSkeleton || (_SelectSkeleton = /*#__PURE__*/React__default["default"].createElement(react.SelectSkeleton, null));
|
@@ -142,8 +147,8 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
142
147
|
className: "".concat(DataConfigs.blockClass, "__item-option__search")
|
143
148
|
}, /*#__PURE__*/React__default["default"].createElement(react.Search, {
|
144
149
|
size: "sm",
|
145
|
-
labelText:
|
146
|
-
closeButtonLabelText:
|
150
|
+
labelText: clearSearchText,
|
151
|
+
closeButtonLabelText: clearSearchText,
|
147
152
|
onChange: onSearchChangeHandler
|
148
153
|
})), multiSelectable && /*#__PURE__*/React__default["default"].createElement("div", {
|
149
154
|
className: "".concat(DataConfigs.blockClass, "__multiselectSelectionStatusContainer")
|
@@ -1,11 +1,15 @@
|
|
1
|
-
export function ConditionBuilderItemText({ conditionState, onChange }: {
|
1
|
+
export function ConditionBuilderItemText({ conditionState, onChange, config, type, }: {
|
2
2
|
conditionState: any;
|
3
3
|
onChange: any;
|
4
|
+
config: any;
|
5
|
+
type: any;
|
4
6
|
}): import("react/jsx-runtime").JSX.Element;
|
5
7
|
export namespace ConditionBuilderItemText {
|
6
8
|
namespace propTypes {
|
7
9
|
let conditionState: PropTypes.Requireable<object>;
|
10
|
+
let config: PropTypes.Requireable<object>;
|
8
11
|
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
12
|
+
let type: PropTypes.Requireable<string>;
|
9
13
|
}
|
10
14
|
}
|
11
15
|
import PropTypes from 'prop-types';
|
@@ -9,6 +9,7 @@
|
|
9
9
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
12
13
|
var React = require('react');
|
13
14
|
var react = require('@carbon/react');
|
14
15
|
var index = require('../../../../node_modules/prop-types/index.js');
|
@@ -21,10 +22,10 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
22
|
var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
|
22
23
|
var _conditionState$value, _conditionState$prope;
|
23
24
|
var conditionState = _ref.conditionState,
|
24
|
-
_onChange = _ref.onChange
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
_onChange = _ref.onChange,
|
26
|
+
config = _ref.config,
|
27
|
+
type = _ref.type;
|
28
|
+
var inputProps = _rollupPluginBabelHelpers.objectSpread2({
|
28
29
|
labelText: conditionState.property,
|
29
30
|
hideLabel: true,
|
30
31
|
value: (_conditionState$value = conditionState.value) !== null && _conditionState$value !== void 0 ? _conditionState$value : '',
|
@@ -32,17 +33,28 @@ var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
|
|
32
33
|
onChange: function onChange(evt) {
|
33
34
|
_onChange(evt.target.value);
|
34
35
|
}
|
35
|
-
})
|
36
|
+
}, config);
|
37
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
38
|
+
className: "".concat(DataConfigs.blockClass, "__item-text")
|
39
|
+
}, type == 'textarea' ? /*#__PURE__*/React__default["default"].createElement(react.TextArea, inputProps) : /*#__PURE__*/React__default["default"].createElement(react.TextInput, inputProps));
|
36
40
|
};
|
37
41
|
ConditionBuilderItemText.propTypes = {
|
38
42
|
/**
|
39
43
|
* current condition object
|
40
44
|
*/
|
41
45
|
conditionState: index["default"].object,
|
46
|
+
/**
|
47
|
+
* config of the current property
|
48
|
+
*/
|
49
|
+
config: index["default"].object,
|
42
50
|
/**
|
43
51
|
* callback to update state oin date change
|
44
52
|
*/
|
45
|
-
onChange: index["default"].func
|
53
|
+
onChange: index["default"].func,
|
54
|
+
/**
|
55
|
+
* current input type
|
56
|
+
*/
|
57
|
+
type: index["default"].string
|
46
58
|
};
|
47
59
|
|
48
60
|
exports.ConditionBuilderItemText = ConditionBuilderItemText;
|
@@ -66,7 +66,7 @@ var ConditionBuilderItemTime = function ConditionBuilderItemTime(_ref) {
|
|
66
66
|
value: "PM",
|
67
67
|
text: "PM"
|
68
68
|
}))), /*#__PURE__*/React__default["default"].createElement(react.TimePickerSelect, {
|
69
|
-
id: "time-picker-
|
69
|
+
id: "time-picker-time-zone",
|
70
70
|
onChange: setTimeZone
|
71
71
|
}, config === null || config === void 0 || (_config$timeZones2 = config.timeZones) === null || _config$timeZones2 === void 0 ? void 0 : _config$timeZones2.map(function (timeZone, index) {
|
72
72
|
return /*#__PURE__*/React__default["default"].createElement(react.SelectItem, {
|
@@ -22,13 +22,13 @@ var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuil
|
|
22
22
|
var uuidv4 = require('../../../global/js/utils/uuidv4.js');
|
23
23
|
var ConditionPreview = require('../ConditionPreview/ConditionPreview.js');
|
24
24
|
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
25
|
+
var useTranslations = require('../utils/useTranslations.js');
|
25
26
|
|
26
27
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
27
28
|
|
28
29
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
29
30
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
30
31
|
|
31
|
-
var _ConditionPreview, _ConditionPreview2;
|
32
32
|
/**
|
33
33
|
*
|
34
34
|
* state - this is the current group that is being rendered . This can be a inner group or outer group
|
@@ -37,12 +37,17 @@ var _ConditionPreview, _ConditionPreview2;
|
|
37
37
|
*/
|
38
38
|
|
39
39
|
var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
40
|
+
var _ConditionPreview, _ConditionPreview2;
|
40
41
|
var group = _ref.group,
|
41
42
|
aria = _ref.aria,
|
42
43
|
onRemove = _ref.onRemove,
|
43
44
|
onChange = _ref.onChange,
|
44
45
|
conditionBuilderRef = _ref.conditionBuilderRef,
|
45
46
|
className = _ref.className;
|
47
|
+
var _useTranslations = useTranslations.useTranslations(['condition_builder_group', 'conditionText']),
|
48
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 2),
|
49
|
+
conditionBuilderGroupText = _useTranslations2[0],
|
50
|
+
conditionText = _useTranslations2[1];
|
46
51
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
47
52
|
variant = _useContext.variant;
|
48
53
|
var _useState = React.useState(-1),
|
@@ -53,14 +58,15 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
53
58
|
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
54
59
|
showConditionSubGroupPreview = _useState4[0],
|
55
60
|
setShowConditionSubGroupPreview = _useState4[1];
|
56
|
-
var
|
61
|
+
var conditionBuilderContentRef = React.useRef();
|
62
|
+
var onRemoveHandler = function onRemoveHandler(conditionId, evt, conditionIndex) {
|
57
63
|
if (group.conditions.length > 1) {
|
64
|
+
variant == 'tree' ? handleFocusOnCloseTree(evt) : handleFocusOnClose(evt, conditionIndex);
|
58
65
|
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
59
66
|
conditions: group.conditions.filter(function (condition) {
|
60
67
|
return conditionId !== condition.id;
|
61
68
|
})
|
62
69
|
}));
|
63
|
-
handleFocusOnClose(evt);
|
64
70
|
} else {
|
65
71
|
onRemove(evt);
|
66
72
|
}
|
@@ -83,11 +89,50 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
83
89
|
conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [newCondition], _rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(conditionIndex + 1)))
|
84
90
|
}));
|
85
91
|
};
|
86
|
-
var handleFocusOnClose = function handleFocusOnClose(e) {
|
87
|
-
var _e$currentTarget;
|
88
|
-
|
89
|
-
if
|
90
|
-
|
92
|
+
var handleFocusOnClose = function handleFocusOnClose(e, conditionIndex) {
|
93
|
+
var _e$currentTarget$clos;
|
94
|
+
//get all close buttons.
|
95
|
+
//if the last condition is closing, focus the second last one.
|
96
|
+
//or focus the next one.
|
97
|
+
var currentGroupCloseButtons = (_e$currentTarget$clos = e.currentTarget.closest(".".concat(DataConfigs.blockClass, "__group"))) === null || _e$currentTarget$clos === void 0 ? void 0 : _e$currentTarget$clos.querySelectorAll('[data-name="closeCondition"]');
|
98
|
+
if (conditionIndex == currentGroupCloseButtons.length - 1) {
|
99
|
+
var _currentGroupCloseBut;
|
100
|
+
(_currentGroupCloseBut = currentGroupCloseButtons[conditionIndex - 1]) === null || _currentGroupCloseBut === void 0 || _currentGroupCloseBut.focus();
|
101
|
+
} else {
|
102
|
+
var _currentGroupCloseBut2;
|
103
|
+
(_currentGroupCloseBut2 = currentGroupCloseButtons[conditionIndex + 1]) === null || _currentGroupCloseBut2 === void 0 || _currentGroupCloseBut2.focus();
|
104
|
+
}
|
105
|
+
};
|
106
|
+
var handleFocusOnCloseTree = function handleFocusOnCloseTree(evt) {
|
107
|
+
var _evt$currentTarget, _evt$currentTarget2, _conditionBuilderCont, _conditionBuilderCont2;
|
108
|
+
//getting the current aria-level and aria-posinset.
|
109
|
+
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');
|
110
|
+
var currentPos = (_evt$currentTarget2 = evt.currentTarget) === null || _evt$currentTarget2 === void 0 || (_evt$currentTarget2 = _evt$currentTarget2.closest('[role="row"]')) === null || _evt$currentTarget2 === void 0 ? void 0 : _evt$currentTarget2.getAttribute('aria-posinset');
|
111
|
+
|
112
|
+
//finding the next and previous items in same level
|
113
|
+
var nextElement = (_conditionBuilderCont = conditionBuilderContentRef.current) === null || _conditionBuilderCont === void 0 ? void 0 : _conditionBuilderCont.querySelector("[aria-level=\"".concat(currentLevel, "\"][aria-posinset=\"").concat(Number(currentPos) + 1, "\"]"));
|
114
|
+
var prevElement = (_conditionBuilderCont2 = conditionBuilderContentRef.current) === null || _conditionBuilderCont2 === void 0 ? void 0 : _conditionBuilderCont2.querySelector("[aria-level=\"".concat(currentLevel, "\"][aria-posinset=\"").concat(Number(currentPos) - 1, "\"]"));
|
115
|
+
//checking if next level is a valid condition. If then, focus the close button inside that condition
|
116
|
+
//Otherwise , check the previous item is a valid condition
|
117
|
+
|
118
|
+
if (nextElement !== null && nextElement !== void 0 && nextElement.classList.contains("".concat(DataConfigs.blockClass, "__condition-block"))) {
|
119
|
+
var _nextElement$querySel;
|
120
|
+
nextElement === null || nextElement === void 0 || (_nextElement$querySel = nextElement.querySelector('[data-name="closeCondition"]')) === null || _nextElement$querySel === void 0 || _nextElement$querySel.focus();
|
121
|
+
} else if (prevElement !== null && prevElement !== void 0 && prevElement.classList.contains("".concat(DataConfigs.blockClass, "__condition-block"))) {
|
122
|
+
var _prevElement$querySel;
|
123
|
+
prevElement === null || prevElement === void 0 || (_prevElement$querySel = prevElement.querySelector('[data-name="closeCondition"]')) === null || _prevElement$querySel === void 0 || _prevElement$querySel.focus();
|
124
|
+
}
|
125
|
+
//If there are no valid condition in this group, focus next or previous row
|
126
|
+
else {
|
127
|
+
var _conditionBuilderCont3, _conditionBuilderCont4;
|
128
|
+
var prevRows = (_conditionBuilderCont3 = conditionBuilderContentRef.current) === null || _conditionBuilderCont3 === void 0 ? void 0 : _conditionBuilderCont3.querySelectorAll("[aria-level=\"".concat(Number(currentLevel) - 1, "\"][role=\"row\"]"));
|
129
|
+
var nextRow = (_conditionBuilderCont4 = conditionBuilderContentRef.current) === null || _conditionBuilderCont4 === void 0 ? void 0 : _conditionBuilderCont4.querySelector("[aria-level=\"".concat(Number(currentLevel) + 1, "\"][role=\"row\"]"));
|
130
|
+
if (nextRow) {
|
131
|
+
nextRow === null || nextRow === void 0 || nextRow.focus();
|
132
|
+
} else if ((prevRows === null || prevRows === void 0 ? void 0 : prevRows.length) > 1) {
|
133
|
+
var _prevRows;
|
134
|
+
(_prevRows = prevRows[prevRows.length - 2]) === null || _prevRows === void 0 || _prevRows.focus();
|
135
|
+
}
|
91
136
|
}
|
92
137
|
};
|
93
138
|
var addConditionSubGroupHandler = function addConditionSubGroupHandler(conditionIndex) {
|
@@ -122,7 +167,12 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
122
167
|
setShowConditionPreview(-1);
|
123
168
|
};
|
124
169
|
var onStatementChangeHandler = function onStatementChangeHandler(updatedStatement) {
|
170
|
+
var _statementConfig$find;
|
171
|
+
var groupOperator = (_statementConfig$find = DataConfigs.statementConfig.find(function (statement) {
|
172
|
+
return statement.id == updatedStatement;
|
173
|
+
})) === null || _statementConfig$find === void 0 ? void 0 : _statementConfig$find.connector;
|
125
174
|
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
175
|
+
groupOperator: groupOperator,
|
126
176
|
statement: updatedStatement
|
127
177
|
}));
|
128
178
|
};
|
@@ -138,7 +188,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
138
188
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
139
189
|
className: "".concat(DataConfigs.blockClass, "__condition-wrapper"),
|
140
190
|
role: "grid",
|
141
|
-
"aria-label":
|
191
|
+
"aria-label": conditionBuilderGroupText
|
142
192
|
}, group === null || group === void 0 || (_group$conditions = group.conditions) === null || _group$conditions === void 0 ? void 0 : _group$conditions.map(function (eachCondition, conditionIndex) {
|
143
193
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
144
194
|
key: eachCondition.id,
|
@@ -159,7 +209,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
159
209
|
},
|
160
210
|
addConditionHandler: addConditionHandler,
|
161
211
|
onRemove: function onRemove(e) {
|
162
|
-
onRemoveHandler(eachCondition.id, e);
|
212
|
+
onRemoveHandler(eachCondition.id, e, conditionIndex);
|
163
213
|
},
|
164
214
|
onConnectorOperatorChange: onConnectorOperatorChange,
|
165
215
|
onStatementChange: onStatementChangeHandler,
|
@@ -172,7 +222,8 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
172
222
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
173
223
|
className: "".concat(className, " ").concat(DataConfigs.blockClass, "__condition-wrapper"),
|
174
224
|
role: aria.level === 1 ? 'rowgroup' : undefined,
|
175
|
-
"aria-label": aria.level == 1 ?
|
225
|
+
"aria-label": aria.level == 1 ? conditionBuilderGroupText : undefined,
|
226
|
+
ref: conditionBuilderContentRef
|
176
227
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
177
228
|
tabIndex: 0,
|
178
229
|
role: "row",
|
@@ -181,14 +232,14 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
181
232
|
"aria-setsize": aria.setsize
|
182
233
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
183
234
|
label: group.statement,
|
184
|
-
title:
|
235
|
+
title: conditionText,
|
185
236
|
"data-name": "connectorField",
|
186
237
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
187
238
|
className: "".concat(DataConfigs.blockClass, "__statement-button")
|
188
239
|
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
189
240
|
conditionState: {
|
190
241
|
value: group.statement,
|
191
|
-
label:
|
242
|
+
label: conditionText
|
192
243
|
},
|
193
244
|
onChange: function onChange(v, evt) {
|
194
245
|
util.focusThisField(evt);
|
@@ -252,9 +303,11 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
252
303
|
hideConditionPreviewHandler: hideConditionPreviewHandler,
|
253
304
|
isLastCondition: isLastCondition
|
254
305
|
})), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
|
255
|
-
previewType: "subGroup"
|
306
|
+
previewType: "subGroup",
|
307
|
+
group: group
|
256
308
|
}))), conditionIndex == showConditionPreview && (_ConditionPreview2 || (_ConditionPreview2 = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
|
257
|
-
previewType: "condition"
|
309
|
+
previewType: "condition",
|
310
|
+
group: group
|
258
311
|
}))));
|
259
312
|
}));
|
260
313
|
};
|