@carbon/ibm-products 2.43.2-canary.63 → 2.43.2-canary.66
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 +7 -4
- 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.css +7 -4
- 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 +7 -4
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/ConditionBuilder/ConditionBuilder.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +11 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +4 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +49 -2
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +120 -28
- package/es/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/es/components/EditTearsheet/EditTearsheet.js +44 -9
- package/es/components/SearchBar/SearchBar.d.ts +1 -1
- package/es/components/SearchBar/SearchBar.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilder.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +11 -7
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +4 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +49 -2
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +119 -27
- package/lib/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/lib/components/EditTearsheet/EditTearsheet.js +43 -8
- package/lib/components/SearchBar/SearchBar.d.ts +1 -1
- package/lib/components/SearchBar/SearchBar.js +2 -2
- package/package.json +3 -3
- package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +5 -3
@@ -22,7 +22,7 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
22
22
|
invalidNumberWarnText = _useTranslations2[0];
|
23
23
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
24
24
|
var value = _ref2.value;
|
25
|
-
if (checkIfValid(value)) {
|
25
|
+
if (!isNaN(value) && checkIfValid(value)) {
|
26
26
|
var _config$unit;
|
27
27
|
onChange("".concat(value, " ").concat((_config$unit = config.unit) !== null && _config$unit !== void 0 ? _config$unit : ''));
|
28
28
|
} else {
|
@@ -44,12 +44,13 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
44
44
|
}, /*#__PURE__*/React__default.createElement(NumberInput, _extends({
|
45
45
|
label: conditionState.property,
|
46
46
|
hideLabel: true,
|
47
|
-
defaultValue: getDefaultValue(),
|
48
47
|
id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
|
49
48
|
invalidText: invalidNumberWarnText,
|
50
49
|
allowEmpty: true,
|
51
50
|
onChange: onChangeHandler
|
52
|
-
}, config
|
51
|
+
}, config, {
|
52
|
+
defaultValue: getDefaultValue()
|
53
|
+
})));
|
53
54
|
};
|
54
55
|
ConditionBuilderItemNumber.propTypes = {
|
55
56
|
/**
|
@@ -9,7 +9,7 @@ export namespace ConditionBuilderItemText {
|
|
9
9
|
let conditionState: PropTypes.Requireable<object>;
|
10
10
|
let config: PropTypes.Requireable<object>;
|
11
11
|
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
12
|
-
let type: PropTypes.Requireable<
|
12
|
+
let type: PropTypes.Requireable<string>;
|
13
13
|
}
|
14
14
|
}
|
15
15
|
import PropTypes from 'prop-types';
|
@@ -58,7 +58,7 @@ var ConditionBuilderItemTime = function ConditionBuilderItemTime(_ref) {
|
|
58
58
|
value: "PM",
|
59
59
|
text: "PM"
|
60
60
|
}))), /*#__PURE__*/React__default.createElement(TimePickerSelect, {
|
61
|
-
id: "time-picker-
|
61
|
+
id: "time-picker-time-zone",
|
62
62
|
onChange: setTimeZone
|
63
63
|
}, config === null || config === void 0 || (_config$timeZones2 = config.timeZones) === null || _config$timeZones2 === void 0 ? void 0 : _config$timeZones2.map(function (timeZone, index) {
|
64
64
|
return /*#__PURE__*/React__default.createElement(SelectItem, {
|
@@ -50,8 +50,9 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
50
50
|
showConditionSubGroupPreview = _useState4[0],
|
51
51
|
setShowConditionSubGroupPreview = _useState4[1];
|
52
52
|
var conditionBuilderContentRef = useRef();
|
53
|
-
var onRemoveHandler = function onRemoveHandler(conditionId, evt) {
|
53
|
+
var onRemoveHandler = function onRemoveHandler(conditionId, evt, conditionIndex) {
|
54
54
|
if (group.conditions.length > 1) {
|
55
|
+
variant == 'tree' ? handleFocusOnCloseTree(evt) : handleFocusOnClose(evt, conditionIndex);
|
55
56
|
onChange(_objectSpread2(_objectSpread2({}, group), {}, {
|
56
57
|
conditions: group.conditions.filter(function (condition) {
|
57
58
|
return conditionId !== condition.id;
|
@@ -79,6 +80,52 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
79
80
|
conditions: [].concat(_toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [newCondition], _toConsumableArray(group.conditions.slice(conditionIndex + 1)))
|
80
81
|
}));
|
81
82
|
};
|
83
|
+
var handleFocusOnClose = function handleFocusOnClose(e, conditionIndex) {
|
84
|
+
var _e$currentTarget$clos;
|
85
|
+
//get all close buttons.
|
86
|
+
//if the last condition is closing, focus the second last one.
|
87
|
+
//or focus the next one.
|
88
|
+
var currentGroupCloseButtons = (_e$currentTarget$clos = e.currentTarget.closest(".".concat(blockClass, "__group"))) === null || _e$currentTarget$clos === void 0 ? void 0 : _e$currentTarget$clos.querySelectorAll('[data-name="closeCondition"]');
|
89
|
+
if (conditionIndex == currentGroupCloseButtons.length - 1) {
|
90
|
+
var _currentGroupCloseBut;
|
91
|
+
(_currentGroupCloseBut = currentGroupCloseButtons[conditionIndex - 1]) === null || _currentGroupCloseBut === void 0 || _currentGroupCloseBut.focus();
|
92
|
+
} else {
|
93
|
+
var _currentGroupCloseBut2;
|
94
|
+
(_currentGroupCloseBut2 = currentGroupCloseButtons[conditionIndex + 1]) === null || _currentGroupCloseBut2 === void 0 || _currentGroupCloseBut2.focus();
|
95
|
+
}
|
96
|
+
};
|
97
|
+
var handleFocusOnCloseTree = function handleFocusOnCloseTree(evt) {
|
98
|
+
var _evt$currentTarget, _evt$currentTarget2, _conditionBuilderCont, _conditionBuilderCont2;
|
99
|
+
//getting the current aria-level and aria-posinset.
|
100
|
+
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');
|
101
|
+
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');
|
102
|
+
|
103
|
+
//finding the next and previous items in same level
|
104
|
+
var nextElement = (_conditionBuilderCont = conditionBuilderContentRef.current) === null || _conditionBuilderCont === void 0 ? void 0 : _conditionBuilderCont.querySelector("[aria-level=\"".concat(currentLevel, "\"][aria-posinset=\"").concat(Number(currentPos) + 1, "\"]"));
|
105
|
+
var prevElement = (_conditionBuilderCont2 = conditionBuilderContentRef.current) === null || _conditionBuilderCont2 === void 0 ? void 0 : _conditionBuilderCont2.querySelector("[aria-level=\"".concat(currentLevel, "\"][aria-posinset=\"").concat(Number(currentPos) - 1, "\"]"));
|
106
|
+
//checking if next level is a valid condition. If then, focus the close button inside that condition
|
107
|
+
//Otherwise , check the previous item is a valid condition
|
108
|
+
|
109
|
+
if (nextElement !== null && nextElement !== void 0 && nextElement.classList.contains("".concat(blockClass, "__condition-block"))) {
|
110
|
+
var _nextElement$querySel;
|
111
|
+
nextElement === null || nextElement === void 0 || (_nextElement$querySel = nextElement.querySelector('[data-name="closeCondition"]')) === null || _nextElement$querySel === void 0 || _nextElement$querySel.focus();
|
112
|
+
} else if (prevElement !== null && prevElement !== void 0 && prevElement.classList.contains("".concat(blockClass, "__condition-block"))) {
|
113
|
+
var _prevElement$querySel;
|
114
|
+
prevElement === null || prevElement === void 0 || (_prevElement$querySel = prevElement.querySelector('[data-name="closeCondition"]')) === null || _prevElement$querySel === void 0 || _prevElement$querySel.focus();
|
115
|
+
}
|
116
|
+
//If there are no valid condition in this group, focus next or previous row
|
117
|
+
else {
|
118
|
+
var _conditionBuilderCont3, _conditionBuilderCont4;
|
119
|
+
var prevRows = (_conditionBuilderCont3 = conditionBuilderContentRef.current) === null || _conditionBuilderCont3 === void 0 ? void 0 : _conditionBuilderCont3.querySelectorAll("[aria-level=\"".concat(Number(currentLevel) - 1, "\"][role=\"row\"]"));
|
120
|
+
var nextRow = (_conditionBuilderCont4 = conditionBuilderContentRef.current) === null || _conditionBuilderCont4 === void 0 ? void 0 : _conditionBuilderCont4.querySelector("[aria-level=\"".concat(Number(currentLevel) + 1, "\"][role=\"row\"]"));
|
121
|
+
if (nextRow) {
|
122
|
+
nextRow === null || nextRow === void 0 || nextRow.focus();
|
123
|
+
} else if ((prevRows === null || prevRows === void 0 ? void 0 : prevRows.length) > 1) {
|
124
|
+
var _prevRows;
|
125
|
+
(_prevRows = prevRows[prevRows.length - 2]) === null || _prevRows === void 0 || _prevRows.focus();
|
126
|
+
}
|
127
|
+
}
|
128
|
+
};
|
82
129
|
var addConditionSubGroupHandler = function addConditionSubGroupHandler(conditionIndex) {
|
83
130
|
onChange(_objectSpread2(_objectSpread2({}, group), {}, {
|
84
131
|
conditions: [].concat(_toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [{
|
@@ -153,7 +200,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
153
200
|
},
|
154
201
|
addConditionHandler: addConditionHandler,
|
155
202
|
onRemove: function onRemove(e) {
|
156
|
-
onRemoveHandler(eachCondition.id, e);
|
203
|
+
onRemoveHandler(eachCondition.id, e, conditionIndex);
|
157
204
|
},
|
158
205
|
onConnectorOperatorChange: onConnectorOperatorChange,
|
159
206
|
onStatementChange: onStatementChangeHandler,
|
@@ -1 +1 @@
|
|
1
|
-
export function handleKeyDown(evt: any, conditionBuilderRef: any): void;
|
1
|
+
export function handleKeyDown(evt: any, conditionBuilderRef: any, variant: any): void;
|
@@ -7,16 +7,24 @@
|
|
7
7
|
|
8
8
|
import { toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { blockClass } from '../ConditionBuilderContext/DataConfigs.js';
|
10
|
-
import { checkForHoldingKey, focusThisField, traverseReverse, traverseClockVise } from './util.js';
|
10
|
+
import { checkForHoldingKey, focusThisField, traverseReverse, traverseClockVise, focusThisItem } from './util.js';
|
11
11
|
|
12
|
-
var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef) {
|
12
|
+
var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef, variant) {
|
13
13
|
var activeElement = document.activeElement;
|
14
|
+
if (excludeKeyPress(evt)) {
|
15
|
+
return;
|
16
|
+
}
|
14
17
|
if (activeElement.closest("[role=\"dialog\"]")) {
|
15
18
|
handleKeyPressForPopover(evt, activeElement.closest("[role=\"dialog\"]"));
|
16
19
|
} else {
|
17
|
-
handleKeyPressForMainContent(evt, conditionBuilderRef);
|
20
|
+
handleKeyPressForMainContent(evt, conditionBuilderRef, variant);
|
18
21
|
}
|
19
22
|
};
|
23
|
+
//skipping keyboard handling for date and time fields to get take carbon's
|
24
|
+
var excludeKeyPress = function excludeKeyPress(evt) {
|
25
|
+
var _evt$target$closest, _evt$target$closest2;
|
26
|
+
return !['Escape'].includes(evt.key) && (((_evt$target$closest = evt.target.closest(".".concat(blockClass, "__item-date"))) === null || _evt$target$closest === void 0 ? void 0 : _evt$target$closest.length) || ((_evt$target$closest2 = evt.target.closest(".".concat(blockClass, "__item-time"))) === null || _evt$target$closest2 === void 0 ? void 0 : _evt$target$closest2.length));
|
27
|
+
};
|
20
28
|
var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer) {
|
21
29
|
var _parentContainer$quer;
|
22
30
|
var key = evt.key;
|
@@ -62,8 +70,8 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
|
|
62
70
|
if (document.activeElement.type !== 'button') {
|
63
71
|
var _document$activeEleme2;
|
64
72
|
//for button , enter key is click which already handled by framework, else trigger click
|
65
|
-
(_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
|
66
73
|
focusThisField(evt);
|
74
|
+
(_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
|
67
75
|
}
|
68
76
|
}
|
69
77
|
break;
|
@@ -73,8 +81,70 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
|
|
73
81
|
break;
|
74
82
|
}
|
75
83
|
};
|
84
|
+
var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef, variant) {
|
85
|
+
switch (evt.key) {
|
86
|
+
case 'ArrowRight':
|
87
|
+
evt.preventDefault();
|
88
|
+
if (variant == 'tree') {
|
89
|
+
var _evt$target$closest3;
|
90
|
+
var allCellsInRow = Array.from((_evt$target$closest3 = evt.target.closest('[role="row"]')) === null || _evt$target$closest3 === void 0 ? void 0 : _evt$target$closest3.querySelectorAll('[role="gridcell"] button'));
|
91
|
+
if (evt.target.getAttribute('role') == 'row') {
|
92
|
+
//when current focus is on a row, then we need to enter inside and focus the first cell of that row
|
93
|
+
if (allCellsInRow.length === 1) {
|
94
|
+
handleRowNavigationTree(evt, conditionBuilderRef, variant);
|
95
|
+
//focus next row
|
96
|
+
} else {
|
97
|
+
var _allCellsInRow$;
|
98
|
+
(_allCellsInRow$ = allCellsInRow[0]) === null || _allCellsInRow$ === void 0 || _allCellsInRow$.focus();
|
99
|
+
}
|
100
|
+
} else {
|
101
|
+
//finding the next cell to be focussed
|
102
|
+
//next cell = current cell index + 1
|
103
|
+
|
104
|
+
var currentItemIndex = allCellsInRow.indexOf(evt.target);
|
105
|
+
if (currentItemIndex < allCellsInRow.length - 1) {
|
106
|
+
focusThisItem(allCellsInRow[currentItemIndex + 1]);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
} else {
|
110
|
+
handleCellNavigation(evt, conditionBuilderRef);
|
111
|
+
}
|
112
|
+
break;
|
113
|
+
case 'ArrowLeft':
|
114
|
+
evt.preventDefault();
|
115
|
+
if (variant == 'tree') {
|
116
|
+
if (evt.target.getAttribute('role') !== 'row') {
|
117
|
+
var _evt$target$closest4;
|
118
|
+
//when any cell is focussed, arrow left will select the previous cell or current row
|
119
|
+
|
120
|
+
var allItems = Array.from((_evt$target$closest4 = evt.target.closest('[role="row"]')) === null || _evt$target$closest4 === void 0 ? void 0 : _evt$target$closest4.querySelectorAll('[role="gridcell"] button'));
|
121
|
+
var _currentItemIndex = allItems.indexOf(evt.target);
|
122
|
+
if (_currentItemIndex > 0) {
|
123
|
+
focusThisItem(allItems[_currentItemIndex - 1]);
|
124
|
+
} else {
|
125
|
+
//focus the row
|
126
|
+
var wrapper = evt.target.closest("[role=\"row\"]");
|
127
|
+
wrapper.focus();
|
128
|
+
}
|
129
|
+
}
|
130
|
+
} else {
|
131
|
+
handleCellNavigation(evt, conditionBuilderRef);
|
132
|
+
}
|
133
|
+
break;
|
134
|
+
case 'ArrowUp':
|
135
|
+
case 'ArrowDown':
|
136
|
+
evt.preventDefault();
|
137
|
+
if (variant == 'tree') {
|
138
|
+
handleRowNavigationTree(evt, conditionBuilderRef, variant);
|
139
|
+
} else {
|
140
|
+
handleRowNavigation(evt, conditionBuilderRef, variant);
|
141
|
+
}
|
142
|
+
break;
|
143
|
+
}
|
144
|
+
};
|
76
145
|
var getRows = function getRows(conditionBuilderRef) {
|
77
|
-
|
146
|
+
var _conditionBuilderRef$;
|
147
|
+
return Array.from((_conditionBuilderRef$ = conditionBuilderRef.current) === null || _conditionBuilderRef$ === void 0 ? void 0 : _conditionBuilderRef$.querySelectorAll('[role="row"]'));
|
78
148
|
};
|
79
149
|
var getRowIndex = function getRowIndex(element, conditionBuilderRef) {
|
80
150
|
var rows = getRows(conditionBuilderRef);
|
@@ -82,14 +152,39 @@ var getRowIndex = function getRowIndex(element, conditionBuilderRef) {
|
|
82
152
|
return row.contains(element);
|
83
153
|
});
|
84
154
|
};
|
85
|
-
var handleRowNavigation = function handleRowNavigation(evt, conditionBuilderRef) {
|
155
|
+
var handleRowNavigation = function handleRowNavigation(evt, conditionBuilderRef, variant) {
|
86
156
|
var rows = getRows(conditionBuilderRef);
|
87
157
|
var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
|
88
|
-
navigateToNextRowCell(evt, currentRowIndex, rows);
|
158
|
+
navigateToNextRowCell(evt, currentRowIndex, rows, variant);
|
89
159
|
};
|
90
|
-
|
91
|
-
var
|
92
|
-
|
160
|
+
function handleRowNavigationTree(evt, conditionBuilderRef, variant) {
|
161
|
+
var rows = getRows(conditionBuilderRef);
|
162
|
+
var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
|
163
|
+
var nextRowIndex = currentRowIndex;
|
164
|
+
if (evt.target.getAttribute('role') == 'row') {
|
165
|
+
if (['ArrowDown', 'ArrowRight'].includes(evt.key)) {
|
166
|
+
nextRowIndex += 1;
|
167
|
+
} else if (evt.key === 'ArrowUp') {
|
168
|
+
nextRowIndex -= 1;
|
169
|
+
}
|
170
|
+
|
171
|
+
//maintaining selection for first and last rows
|
172
|
+
if (nextRowIndex < 0) {
|
173
|
+
nextRowIndex = 0;
|
174
|
+
} else if (nextRowIndex >= rows.length) {
|
175
|
+
nextRowIndex = rows.length - 1;
|
176
|
+
}
|
177
|
+
if (nextRowIndex !== currentRowIndex) {
|
178
|
+
rows[currentRowIndex].setAttribute('tabindex', '-1');
|
179
|
+
rows[nextRowIndex].setAttribute('tabindex', '0');
|
180
|
+
rows[nextRowIndex].focus();
|
181
|
+
}
|
182
|
+
} else {
|
183
|
+
navigateToNextRowCell(evt, currentRowIndex, rows, variant);
|
184
|
+
}
|
185
|
+
}
|
186
|
+
var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex, rows, variant) {
|
187
|
+
//when the current focussed element is a cell of any row, arrow up/down will focus the next row same cell.
|
93
188
|
|
94
189
|
var nextRowIndex = currentRowIndex;
|
95
190
|
if (evt.key === 'ArrowUp') {
|
@@ -100,25 +195,22 @@ var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex,
|
|
100
195
|
}
|
101
196
|
var nextRow = rows[nextRowIndex];
|
102
197
|
var itemName = evt.target.dataset.name;
|
103
|
-
nextRow
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
conditionBuilderRef.current.querySelectorAll("[role=\"gridcell\"] button").forEach(function (eachElem, index, allElements) {
|
110
|
-
if (evt.key === 'ArrowRight') {
|
111
|
-
traverseClockVise(eachElem, index, allElements);
|
112
|
-
} else {
|
113
|
-
traverseReverse(eachElem, index, allElements);
|
114
|
-
}
|
115
|
-
});
|
116
|
-
break;
|
117
|
-
case 'ArrowUp':
|
118
|
-
case 'ArrowDown':
|
119
|
-
handleRowNavigation(evt, conditionBuilderRef);
|
120
|
-
break;
|
198
|
+
if (nextRow !== null && nextRow !== void 0 && nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) {
|
199
|
+
var _nextRow$querySelecto;
|
200
|
+
nextRow === null || nextRow === void 0 || (_nextRow$querySelecto = nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) === null || _nextRow$querySelecto === void 0 || _nextRow$querySelecto.focus();
|
201
|
+
} else if (variant === 'tree') {
|
202
|
+
//when the next row is a if statement , then that row is focused. From any cell of last row of an group , arrow down select the next row (if)
|
203
|
+
nextRow === null || nextRow === void 0 || nextRow.focus();
|
121
204
|
}
|
122
205
|
};
|
206
|
+
var handleCellNavigation = function handleCellNavigation(evt, conditionBuilderRef) {
|
207
|
+
conditionBuilderRef.current.querySelectorAll("[role=\"gridcell\"] button").forEach(function (eachElem, index, allElements) {
|
208
|
+
if (evt.key === 'ArrowRight') {
|
209
|
+
traverseClockVise(eachElem, index, allElements);
|
210
|
+
} else {
|
211
|
+
traverseReverse(eachElem, index, allElements);
|
212
|
+
}
|
213
|
+
});
|
214
|
+
};
|
123
215
|
|
124
216
|
export { handleKeyDown };
|
@@ -51,7 +51,8 @@ interface EditTearsheetProps extends PropsWithChildren {
|
|
51
51
|
*/
|
52
52
|
onFormChange?: (formIndex: number) => number;
|
53
53
|
/**
|
54
|
-
* Specify a handler for submitting the tearsheet.
|
54
|
+
* Specify a handler for submitting the tearsheet. Throughout its execution
|
55
|
+
* the submit button will be disabled and include a loading indicator.
|
55
56
|
*/
|
56
57
|
onRequestSubmit: () => void;
|
57
58
|
/**
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { forwardRef, useState, useRef, createContext } from 'react';
|
10
10
|
import PropTypes from '../../node_modules/prop-types/index.js';
|
11
11
|
import cx from 'classnames';
|
@@ -59,10 +59,45 @@ var EditTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
59
59
|
_ref$sideNavAriaLabel = _ref.sideNavAriaLabel,
|
60
60
|
sideNavAriaLabel = _ref$sideNavAriaLabel === void 0 ? defaults.sideNavAriaLabel : _ref$sideNavAriaLabel,
|
61
61
|
rest = _objectWithoutProperties(_ref, _excluded);
|
62
|
+
var _useState = useState(false),
|
63
|
+
_useState2 = _slicedToArray(_useState, 2),
|
64
|
+
isSubmitting = _useState2[0],
|
65
|
+
setIsSubmitting = _useState2[1];
|
66
|
+
var handleOnRequestSubmit = /*#__PURE__*/function () {
|
67
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
68
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
69
|
+
while (1) switch (_context.prev = _context.next) {
|
70
|
+
case 0:
|
71
|
+
setIsSubmitting(true);
|
72
|
+
_context.prev = 1;
|
73
|
+
_context.next = 4;
|
74
|
+
return onRequestSubmit();
|
75
|
+
case 4:
|
76
|
+
_context.next = 9;
|
77
|
+
break;
|
78
|
+
case 6:
|
79
|
+
_context.prev = 6;
|
80
|
+
_context.t0 = _context["catch"](1);
|
81
|
+
console.warn("".concat(componentName, " submit error: ").concat(_context.t0));
|
82
|
+
case 9:
|
83
|
+
setIsSubmitting(false);
|
84
|
+
case 10:
|
85
|
+
case "end":
|
86
|
+
return _context.stop();
|
87
|
+
}
|
88
|
+
}, _callee, null, [[1, 6]]);
|
89
|
+
}));
|
90
|
+
return function handleOnRequestSubmit() {
|
91
|
+
return _ref2.apply(this, arguments);
|
92
|
+
};
|
93
|
+
}();
|
62
94
|
var actions = [{
|
63
95
|
key: 'edit-action-button-submit',
|
64
96
|
label: submitButtonText,
|
65
|
-
onClick:
|
97
|
+
onClick: function onClick() {
|
98
|
+
return handleOnRequestSubmit();
|
99
|
+
},
|
100
|
+
loading: isSubmitting,
|
66
101
|
kind: 'primary'
|
67
102
|
}, {
|
68
103
|
key: 'edit-action-button-cancel',
|
@@ -70,14 +105,14 @@ var EditTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
70
105
|
onClick: onClose,
|
71
106
|
kind: 'ghost'
|
72
107
|
}];
|
73
|
-
var
|
74
|
-
_useState2 = _slicedToArray(_useState, 2),
|
75
|
-
currentForm = _useState2[0],
|
76
|
-
setCurrentForm = _useState2[1];
|
77
|
-
var _useState3 = useState([]),
|
108
|
+
var _useState3 = useState(0),
|
78
109
|
_useState4 = _slicedToArray(_useState3, 2),
|
79
|
-
|
80
|
-
|
110
|
+
currentForm = _useState4[0],
|
111
|
+
setCurrentForm = _useState4[1];
|
112
|
+
var _useState5 = useState([]),
|
113
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
114
|
+
formTitles = _useState6[0],
|
115
|
+
setFormTitles = _useState6[1];
|
81
116
|
var contentRef = useRef(null);
|
82
117
|
var handleCurrentForm = function handleCurrentForm(formIndex) {
|
83
118
|
setCurrentForm(formIndex);
|
@@ -17,7 +17,7 @@ interface SearchBarProps extends PropsWithChildren {
|
|
17
17
|
*/
|
18
18
|
hideScopesLabel?: boolean;
|
19
19
|
/** @type {string} The label text for the search text input. */
|
20
|
-
labelText
|
20
|
+
labelText: string;
|
21
21
|
/** @type {Function} Function handler for when the user changes their query search. */
|
22
22
|
onChange?: (event: any) => void;
|
23
23
|
/** @type {Function} Function handler for when the user submits a search. */
|
@@ -135,7 +135,7 @@ var SearchBar = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
135
135
|
})) : null, /*#__PURE__*/React__default.createElement(Search, {
|
136
136
|
className: "".concat(blockClass, "__input"),
|
137
137
|
closeButtonLabelText: clearButtonLabelText,
|
138
|
-
labelText: labelText
|
138
|
+
labelText: labelText,
|
139
139
|
name: "search-input",
|
140
140
|
onChange: handleInputChange,
|
141
141
|
placeholder: placeholderText,
|
@@ -188,7 +188,7 @@ SearchBar.propTypes = _objectSpread2({
|
|
188
188
|
*/
|
189
189
|
hideScopesLabel: PropTypes.bool,
|
190
190
|
/** @type {string} The label text for the search text input. */
|
191
|
-
labelText: PropTypes.string,
|
191
|
+
labelText: PropTypes.string.isRequired,
|
192
192
|
/** @type {Function} Function handler for when the user changes their query search. */
|
193
193
|
onChange: PropTypes.func,
|
194
194
|
/** @type {Function} Function handler for when the user submits a search. */
|
@@ -70,7 +70,7 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
70
70
|
var localRef = React.useRef();
|
71
71
|
var conditionBuilderRef = ref || localRef;
|
72
72
|
var handleKeyDownHandler = function handleKeyDownHandler(evt) {
|
73
|
-
handleKeyboardEvents.handleKeyDown(evt, conditionBuilderRef);
|
73
|
+
handleKeyboardEvents.handleKeyDown(evt, conditionBuilderRef, variant);
|
74
74
|
};
|
75
75
|
return /*#__PURE__*/React__default["default"].createElement(ConditionBuilderProvider.ConditionBuilderProvider, {
|
76
76
|
inputConfig: inputConfig,
|
@@ -118,7 +118,7 @@ exports.ConditionBuilder.propTypes = {
|
|
118
118
|
* optional array of actions
|
119
119
|
*/
|
120
120
|
actions: index["default"].arrayOf(index["default"].shape({
|
121
|
-
id: index["default"].oneOfType([index["default"].string
|
121
|
+
id: index["default"].oneOfType([index["default"].string, index["default"].number]).isRequired,
|
122
122
|
label: index["default"].string.isRequired
|
123
123
|
})),
|
124
124
|
/**
|
@@ -94,11 +94,11 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
94
94
|
})), enableSubGroup && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
|
95
95
|
renderIcon: icons.TextNewLine,
|
96
96
|
onClick: addConditionSubGroupHandler,
|
97
|
-
className: cx__default["default"]("".concat(DataConfigs.blockClass, "
|
97
|
+
className: cx__default["default"]("".concat(DataConfigs.blockClass, "__add-condition-sub-group ").concat(DataConfigs.blockClass, "__gap-left")),
|
98
98
|
hideLabel: true,
|
99
99
|
label: addSubgroupText,
|
100
100
|
wrapperProps: wrapperProps,
|
101
|
-
wrapperClassName: cx__default["default"]("".concat(DataConfigs.blockClass, "
|
101
|
+
wrapperClassName: cx__default["default"]("".concat(DataConfigs.blockClass, "__add-condition-sub-group-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__add-condition-sub-group-wrapper--show"), isAddSubgroup))
|
102
102
|
}, previewHandlersForSubgroup())));
|
103
103
|
};
|
104
104
|
var ConditionBuilderAdd$1 = ConditionBuilderAdd;
|
@@ -53,6 +53,12 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
53
53
|
var _useTranslations = useTranslations.useTranslations(['addConditionGroupText']),
|
54
54
|
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 1),
|
55
55
|
addConditionGroupText = _useTranslations2[0];
|
56
|
+
var showConditionGroupPreviewHandler = function showConditionGroupPreviewHandler() {
|
57
|
+
setShowConditionGroupPreview(true);
|
58
|
+
};
|
59
|
+
var hideConditionGroupPreviewHandler = function hideConditionGroupPreviewHandler() {
|
60
|
+
setShowConditionGroupPreview(false);
|
61
|
+
};
|
56
62
|
React.useEffect(function () {
|
57
63
|
var _rootState$groups;
|
58
64
|
if (rootState !== null && rootState !== void 0 && (_rootState$groups = rootState.groups) !== null && _rootState$groups !== void 0 && _rootState$groups.length) {
|
@@ -157,13 +163,11 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
157
163
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, {
|
158
164
|
renderIcon: icons.TextNewLine,
|
159
165
|
onClick: addConditionGroupHandler,
|
160
|
-
onMouseEnter:
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
},
|
166
|
-
className: "".concat(DataConfigs.blockClass, "__addConditionGroupText "),
|
166
|
+
onMouseEnter: showConditionGroupPreviewHandler,
|
167
|
+
onMouseLeave: hideConditionGroupPreviewHandler,
|
168
|
+
onFocus: showConditionGroupPreviewHandler,
|
169
|
+
onBlur: hideConditionGroupPreviewHandler,
|
170
|
+
className: "".concat(DataConfigs.blockClass, "__add-condition-group "),
|
167
171
|
hideLabel: true,
|
168
172
|
label: addConditionGroupText,
|
169
173
|
wrapperProps: {
|
@@ -30,7 +30,7 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
30
30
|
invalidNumberWarnText = _useTranslations2[0];
|
31
31
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
32
32
|
var value = _ref2.value;
|
33
|
-
if (checkIfValid(value)) {
|
33
|
+
if (!isNaN(value) && checkIfValid(value)) {
|
34
34
|
var _config$unit;
|
35
35
|
onChange("".concat(value, " ").concat((_config$unit = config.unit) !== null && _config$unit !== void 0 ? _config$unit : ''));
|
36
36
|
} else {
|
@@ -52,12 +52,13 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
52
52
|
}, /*#__PURE__*/React__default["default"].createElement(react.NumberInput, _rollupPluginBabelHelpers["extends"]({
|
53
53
|
label: conditionState.property,
|
54
54
|
hideLabel: true,
|
55
|
-
defaultValue: getDefaultValue(),
|
56
55
|
id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
|
57
56
|
invalidText: invalidNumberWarnText,
|
58
57
|
allowEmpty: true,
|
59
58
|
onChange: onChangeHandler
|
60
|
-
}, config
|
59
|
+
}, config, {
|
60
|
+
defaultValue: getDefaultValue()
|
61
|
+
})));
|
61
62
|
};
|
62
63
|
ConditionBuilderItemNumber.propTypes = {
|
63
64
|
/**
|
@@ -9,7 +9,7 @@ export namespace ConditionBuilderItemText {
|
|
9
9
|
let conditionState: PropTypes.Requireable<object>;
|
10
10
|
let config: PropTypes.Requireable<object>;
|
11
11
|
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
12
|
-
let type: PropTypes.Requireable<
|
12
|
+
let type: PropTypes.Requireable<string>;
|
13
13
|
}
|
14
14
|
}
|
15
15
|
import PropTypes from 'prop-types';
|
@@ -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, {
|