@carbon/ibm-products 2.43.2-canary.2 → 2.43.2-canary.20
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +35 -3
- 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.map +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +35 -3
- 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 +35 -3
- 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/ConditionBlock/ConditionBlock.js +23 -21
- package/es/components/ConditionBuilder/ConditionBuilder.js +67 -20
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +129 -0
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -4
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +24 -16
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +19 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +109 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +58 -33
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -5
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
- package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/util.js +16 -1
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +29 -16
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +9 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +18 -2
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +17 -6
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.d.ts +3 -1
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.js +15 -3
- package/es/components/DataSpreadsheet/types/index.d.ts +1 -1
- package/es/components/DataSpreadsheet/utils/moveColumnIndicatorLine.js +34 -2
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +21 -3
- package/es/components/Datagrid/types/index.d.ts +18 -4
- package/es/components/Datagrid/useActionsColumn.d.ts +8 -1
- package/es/components/Datagrid/useActionsColumn.js +7 -6
- package/es/components/Datagrid/useColumnRightAlign.d.ts +8 -1
- package/es/components/Datagrid/useColumnRightAlign.js +4 -3
- package/es/components/Datagrid/useInlineEdit.d.ts +8 -1
- package/es/components/Datagrid/useInlineEdit.js +13 -3
- package/es/components/Datagrid/useNestedRows.js +27 -9
- package/es/components/Decorator/Decorator.js +2 -1
- package/es/components/DecoratorBase/DecoratorBase.js +3 -5
- package/es/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
- package/es/components/DecoratorLink/DecoratorLink.js +2 -1
- package/es/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
- package/es/components/Tearsheet/Tearsheet.d.ts +8 -1
- package/es/components/Tearsheet/Tearsheet.js +9 -1
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
- package/es/components/Tearsheet/TearsheetNarrow.js +12 -0
- package/es/components/Tearsheet/TearsheetShell.d.ts +10 -0
- package/es/components/Tearsheet/TearsheetShell.js +17 -3
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +23 -21
- package/lib/components/ConditionBuilder/ConditionBuilder.js +67 -20
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +137 -0
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -3
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +23 -15
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +20 -5
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +117 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +56 -31
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -4
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
- package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/util.js +17 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +29 -16
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +9 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +18 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +17 -6
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.d.ts +3 -1
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.js +15 -3
- package/lib/components/DataSpreadsheet/types/index.d.ts +1 -1
- package/lib/components/DataSpreadsheet/utils/moveColumnIndicatorLine.js +34 -2
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +21 -3
- package/lib/components/Datagrid/types/index.d.ts +18 -4
- package/lib/components/Datagrid/useActionsColumn.d.ts +8 -1
- package/lib/components/Datagrid/useActionsColumn.js +7 -6
- package/lib/components/Datagrid/useColumnRightAlign.d.ts +8 -1
- package/lib/components/Datagrid/useColumnRightAlign.js +4 -3
- package/lib/components/Datagrid/useInlineEdit.d.ts +8 -1
- package/lib/components/Datagrid/useInlineEdit.js +13 -3
- package/lib/components/Datagrid/useNestedRows.js +27 -9
- package/lib/components/Decorator/Decorator.js +2 -1
- package/lib/components/DecoratorBase/DecoratorBase.js +3 -5
- package/lib/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
- package/lib/components/DecoratorLink/DecoratorLink.js +2 -1
- package/lib/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
- package/lib/components/Tearsheet/Tearsheet.d.ts +8 -1
- package/lib/components/Tearsheet/Tearsheet.js +9 -1
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
- package/lib/components/Tearsheet/TearsheetNarrow.js +12 -0
- package/lib/components/Tearsheet/TearsheetShell.d.ts +10 -0
- package/lib/components/Tearsheet/TearsheetShell.js +16 -2
- package/package.json +4 -4
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +9 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +26 -1
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +1 -0
- package/scss/components/StatusIcon/_status-icon.scss +4 -4
- package/scss/components/StringFormatter/_string-formatter.scss +2 -2
- package/scss/components/UserProfileImage/_user-profile-image.scss +6 -2
- package/telemetry.yml +1 -0
- package/es/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +0 -1
- package/es/components/ConditionBuilder/utils/checkForHoldingKey.js +0 -16
- package/lib/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +0 -1
- package/lib/components/ConditionBuilder/utils/checkForHoldingKey.js +0 -20
package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 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
|
+
|
8
|
+
import { slicedToArray as _slicedToArray } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default, { useContext, useRef, useState, useEffect } from 'react';
|
10
|
+
import { Search } from '@carbon/react';
|
11
|
+
import { Checkmark } from '@carbon/react/icons';
|
12
|
+
import PropTypes from '../../../../node_modules/prop-types/index.js';
|
13
|
+
import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
|
14
|
+
import { blockClass, translateWithId } from '../../ConditionBuilderContext/DataConfigs.js';
|
15
|
+
|
16
|
+
var ItemOption = function ItemOption(_ref) {
|
17
|
+
var _ref$conditionState = _ref.conditionState,
|
18
|
+
conditionState = _ref$conditionState === void 0 ? {} : _ref$conditionState,
|
19
|
+
_ref$config = _ref.config,
|
20
|
+
config = _ref$config === void 0 ? {} : _ref$config,
|
21
|
+
onChange = _ref.onChange;
|
22
|
+
var _useContext = useContext(ConditionBuilderContext),
|
23
|
+
popOverSearchThreshold = _useContext.popOverSearchThreshold;
|
24
|
+
var contentRef = useRef();
|
25
|
+
var allOptions = config.options;
|
26
|
+
var _useState = useState(''),
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
28
|
+
searchValue = _useState2[0],
|
29
|
+
setSearchValue = _useState2[1];
|
30
|
+
var selection = conditionState.value;
|
31
|
+
var filteredItems = allOptions === null || allOptions === void 0 ? void 0 : allOptions.filter(function (opt) {
|
32
|
+
return opt.label.toLowerCase().includes(searchValue.toLowerCase());
|
33
|
+
});
|
34
|
+
useEffect(function () {
|
35
|
+
//this will focus the first input field in the popover
|
36
|
+
|
37
|
+
if (contentRef.current) {
|
38
|
+
var firstFocusableElement = contentRef.current.querySelector('input, button,li');
|
39
|
+
if (firstFocusableElement) {
|
40
|
+
firstFocusableElement.focus();
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}, [allOptions]);
|
44
|
+
var onClickHandler = function onClickHandler(evt, option) {
|
45
|
+
onChange(option.id, evt);
|
46
|
+
};
|
47
|
+
var onSearchChangeHandler = function onSearchChangeHandler(evt) {
|
48
|
+
var value = evt.target.value;
|
49
|
+
setSearchValue(value);
|
50
|
+
};
|
51
|
+
var getAriaLabel = function getAriaLabel() {
|
52
|
+
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : translateWithId('property');
|
53
|
+
};
|
54
|
+
if (!allOptions) {
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
58
|
+
className: "".concat(blockClass, "__item-option"),
|
59
|
+
ref: contentRef
|
60
|
+
}, allOptions.length > popOverSearchThreshold && /*#__PURE__*/React__default.createElement("div", {
|
61
|
+
className: "".concat(blockClass, "__item-option__search")
|
62
|
+
}, /*#__PURE__*/React__default.createElement(Search, {
|
63
|
+
size: "sm",
|
64
|
+
labelText: translateWithId('clear_search'),
|
65
|
+
closeButtonLabelText: translateWithId('clear_search'),
|
66
|
+
onChange: onSearchChangeHandler
|
67
|
+
})), /*#__PURE__*/React__default.createElement("ul", {
|
68
|
+
"aria-label": getAriaLabel(),
|
69
|
+
role: "listbox"
|
70
|
+
}, filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.map(function (option) {
|
71
|
+
var isSelected = selection === option.id;
|
72
|
+
var Icon = option.icon;
|
73
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
74
|
+
tabIndex: 0,
|
75
|
+
key: option.id,
|
76
|
+
role: "option",
|
77
|
+
"aria-selected": isSelected,
|
78
|
+
className: "".concat(blockClass, "__item-option__option"),
|
79
|
+
onKeyUp: function onKeyUp() {
|
80
|
+
return false;
|
81
|
+
},
|
82
|
+
onClick: function onClick(evt) {
|
83
|
+
return onClickHandler(evt, option);
|
84
|
+
}
|
85
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
86
|
+
className: "".concat(blockClass, "__item-option__option-content")
|
87
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
88
|
+
className: "".concat(blockClass, "__item-option__option-label")
|
89
|
+
}, Icon && /*#__PURE__*/React__default.createElement(Icon, null), option.label), isSelected && /*#__PURE__*/React__default.createElement(Checkmark, {
|
90
|
+
className: "".concat(blockClass, "__checkmark")
|
91
|
+
})));
|
92
|
+
})));
|
93
|
+
};
|
94
|
+
ItemOption.propTypes = {
|
95
|
+
/**
|
96
|
+
* current condition object
|
97
|
+
*/
|
98
|
+
conditionState: PropTypes.object,
|
99
|
+
/**
|
100
|
+
* current config object that this property is part of
|
101
|
+
*/
|
102
|
+
config: PropTypes.object,
|
103
|
+
/**
|
104
|
+
* callback to update state oin date change
|
105
|
+
*/
|
106
|
+
onChange: PropTypes.func
|
107
|
+
};
|
108
|
+
|
109
|
+
export { ItemOption };
|
@@ -1,9 +1,9 @@
|
|
1
|
-
export function
|
1
|
+
export function ItemOptionForValueField({ conditionState, config, onChange, }: {
|
2
2
|
conditionState?: {} | undefined;
|
3
3
|
config?: {} | undefined;
|
4
4
|
onChange: any;
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
6
|
-
export namespace
|
6
|
+
export namespace ItemOptionForValueField {
|
7
7
|
namespace propTypes {
|
8
8
|
let conditionState: PropTypes.Requireable<object>;
|
9
9
|
let config: PropTypes.Requireable<object>;
|
@@ -6,35 +6,58 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray, toConsumableArray as _toConsumableArray, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default, { useContext,
|
10
|
-
import { Search, Button
|
9
|
+
import React__default, { useContext, useRef, useState, useEffect } from 'react';
|
10
|
+
import { SelectSkeleton, Search, Button } from '@carbon/react';
|
11
11
|
import { CheckboxCheckedFilled, Checkbox, Checkmark } from '@carbon/react/icons';
|
12
12
|
import PropTypes from '../../../../node_modules/prop-types/index.js';
|
13
13
|
import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
|
14
14
|
import { blockClass, translateWithId } from '../../ConditionBuilderContext/DataConfigs.js';
|
15
15
|
|
16
|
-
var _CheckboxCheckedFille, _Checkbox
|
17
|
-
var
|
16
|
+
var _SelectSkeleton, _CheckboxCheckedFille, _Checkbox;
|
17
|
+
var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
18
18
|
var _ref$conditionState = _ref.conditionState,
|
19
19
|
conditionState = _ref$conditionState === void 0 ? {} : _ref$conditionState,
|
20
20
|
_ref$config = _ref.config,
|
21
21
|
config = _ref$config === void 0 ? {} : _ref$config,
|
22
22
|
onChange = _ref.onChange;
|
23
|
-
var multiSelectable = conditionState.operator === '
|
23
|
+
var multiSelectable = conditionState.operator === 'one_of';
|
24
24
|
var _useContext = useContext(ConditionBuilderContext),
|
25
25
|
popOverSearchThreshold = _useContext.popOverSearchThreshold,
|
26
|
-
getOptions = _useContext.getOptions
|
26
|
+
getOptions = _useContext.getOptions,
|
27
|
+
rootState = _useContext.rootState;
|
28
|
+
var contentRef = useRef();
|
27
29
|
var _useState = useState(config.options),
|
28
30
|
_useState2 = _slicedToArray(_useState, 2),
|
29
31
|
allOptions = _useState2[0],
|
30
32
|
setAllOptions = _useState2[1];
|
31
|
-
var _useState3 = useState(
|
33
|
+
var _useState3 = useState(''),
|
32
34
|
_useState4 = _slicedToArray(_useState3, 2),
|
33
|
-
|
34
|
-
|
35
|
+
searchValue = _useState4[0],
|
36
|
+
setSearchValue = _useState4[1];
|
37
|
+
var filteredItems = allOptions === null || allOptions === void 0 ? void 0 : allOptions.filter(function (opt) {
|
38
|
+
return opt.label.toLowerCase().includes(searchValue.toLowerCase());
|
39
|
+
});
|
35
40
|
var selection = Array.isArray(conditionState.value) ? conditionState.value : conditionState.value !== undefined ? [conditionState.value] : [];
|
36
|
-
var contentRef = useRef();
|
37
41
|
useEffect(function () {
|
42
|
+
// if(rest['data-name'] == 'valueField'){
|
43
|
+
// const fetchData = async () => {
|
44
|
+
// const response = await config.options(conditionState);
|
45
|
+
// if (
|
46
|
+
// response?.length > 0 &&
|
47
|
+
// Object.keys(response[0]).includes('label') &&
|
48
|
+
// Object.keys(response[0]).includes('id')
|
49
|
+
// ) {
|
50
|
+
// setAllOptions(response);
|
51
|
+
// setFilteredItems(response);
|
52
|
+
// }
|
53
|
+
// };
|
54
|
+
|
55
|
+
// fetchData(); // Call the async method
|
56
|
+
// }else{
|
57
|
+
// setAllOptions(config.options);
|
58
|
+
// setFilteredItems(config.options);
|
59
|
+
// }
|
60
|
+
|
38
61
|
if (!allOptions && getOptions) {
|
39
62
|
var fetchData = /*#__PURE__*/function () {
|
40
63
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
@@ -43,12 +66,11 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
|
|
43
66
|
while (1) switch (_context.prev = _context.next) {
|
44
67
|
case 0:
|
45
68
|
_context.next = 2;
|
46
|
-
return getOptions(conditionState);
|
69
|
+
return getOptions(rootState, conditionState);
|
47
70
|
case 2:
|
48
71
|
response = _context.sent;
|
49
72
|
if ((response === null || response === void 0 ? void 0 : response.length) > 0 && Object.keys(response[0]).includes('label') && Object.keys(response[0]).includes('id')) {
|
50
73
|
setAllOptions(response);
|
51
|
-
setFilteredItems(response);
|
52
74
|
}
|
53
75
|
case 4:
|
54
76
|
case "end":
|
@@ -68,46 +90,47 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
|
|
68
90
|
//this will focus the first input field in the popover
|
69
91
|
|
70
92
|
if (contentRef.current) {
|
71
|
-
var
|
72
|
-
|
73
|
-
|
93
|
+
var firstFocusableElement = contentRef.current.querySelector('input, button,li');
|
94
|
+
if (firstFocusableElement) {
|
95
|
+
firstFocusableElement.focus();
|
96
|
+
}
|
74
97
|
}
|
75
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
76
98
|
}, [allOptions]);
|
77
99
|
var handleSelectAll = function handleSelectAll(evt) {
|
78
100
|
if (evt.currentTarget.dataset.selectedAll == 'false') {
|
79
101
|
onChange(undefined);
|
80
102
|
} else {
|
81
|
-
onChange(allOptions
|
82
|
-
return op.id;
|
83
|
-
}));
|
103
|
+
onChange(allOptions);
|
84
104
|
}
|
85
105
|
};
|
86
106
|
var onSearchChangeHandler = function onSearchChangeHandler(evt) {
|
87
107
|
var value = evt.target.value;
|
88
|
-
|
89
|
-
return opt.label.toLowerCase().includes(value.toLowerCase());
|
90
|
-
});
|
91
|
-
setFilteredItems(_filteredItems);
|
108
|
+
setSearchValue(value);
|
92
109
|
};
|
93
110
|
var onClickHandler = function onClickHandler(evt, option, isSelected) {
|
94
111
|
if (multiSelectable) {
|
95
112
|
if (isSelected) {
|
96
113
|
var items = selection.filter(function (v) {
|
97
|
-
return v !== option.id;
|
114
|
+
return v.id !== option.id;
|
98
115
|
});
|
99
116
|
onChange(items.length > 0 ? items : undefined, evt);
|
100
117
|
} else {
|
101
|
-
onChange([].concat(_toConsumableArray(selection), [option
|
118
|
+
onChange([].concat(_toConsumableArray(selection), [option]), evt);
|
102
119
|
}
|
103
120
|
} else {
|
104
|
-
onChange(option
|
121
|
+
onChange(option, evt);
|
105
122
|
}
|
106
123
|
};
|
107
|
-
|
124
|
+
var getAriaLabel = function getAriaLabel() {
|
125
|
+
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : translateWithId('property');
|
126
|
+
};
|
127
|
+
if (!allOptions) {
|
128
|
+
return _SelectSkeleton || (_SelectSkeleton = /*#__PURE__*/React__default.createElement(SelectSkeleton, null));
|
129
|
+
}
|
130
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
108
131
|
className: "".concat(blockClass, "__item-option"),
|
109
132
|
ref: contentRef
|
110
|
-
},
|
133
|
+
}, allOptions.length > popOverSearchThreshold && /*#__PURE__*/React__default.createElement("div", {
|
111
134
|
className: "".concat(blockClass, "__item-option__search")
|
112
135
|
}, /*#__PURE__*/React__default.createElement(Search, {
|
113
136
|
size: "sm",
|
@@ -123,11 +146,13 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
|
|
123
146
|
onClick: handleSelectAll,
|
124
147
|
className: "".concat(blockClass, "__selectAll-button")
|
125
148
|
}, selection.length == 0 ? 'Select all' : 'Deselect all')), /*#__PURE__*/React__default.createElement("ul", {
|
126
|
-
"aria-label":
|
149
|
+
"aria-label": getAriaLabel(),
|
127
150
|
role: "listbox",
|
128
151
|
"data-multi-select": multiSelectable
|
129
152
|
}, filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.map(function (option) {
|
130
|
-
var isSelected = selection.
|
153
|
+
var isSelected = selection.map(function (option) {
|
154
|
+
return option.id;
|
155
|
+
}).includes(option.id);
|
131
156
|
var Icon = option.icon;
|
132
157
|
return /*#__PURE__*/React__default.createElement("li", {
|
133
158
|
tabIndex: 0,
|
@@ -154,9 +179,9 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
|
|
154
179
|
}, Icon && /*#__PURE__*/React__default.createElement(Icon, null), option.label), isSelected && /*#__PURE__*/React__default.createElement(Checkmark, {
|
155
180
|
className: "".concat(blockClass, "__checkmark")
|
156
181
|
}))));
|
157
|
-
})))
|
182
|
+
})));
|
158
183
|
};
|
159
|
-
|
184
|
+
ItemOptionForValueField.propTypes = {
|
160
185
|
/**
|
161
186
|
* current condition object
|
162
187
|
*/
|
@@ -171,4 +196,4 @@ ConditionBuilderItemOption.propTypes = {
|
|
171
196
|
onChange: PropTypes.func
|
172
197
|
};
|
173
198
|
|
174
|
-
export {
|
199
|
+
export { ItemOptionForValueField };
|
@@ -12,15 +12,14 @@ import PropTypes from '../../../node_modules/prop-types/index.js';
|
|
12
12
|
import cx from 'classnames';
|
13
13
|
import { blockClass, translateWithId, statementConfig } from '../ConditionBuilderContext/DataConfigs.js';
|
14
14
|
import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
|
15
|
-
import { ConditionBuilderItemOption } from '../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js';
|
16
15
|
import { focusThisField } from '../utils/util.js';
|
17
16
|
import ConditionConnector from '../ConditionBuilderConnector/ConditionConnector.js';
|
18
17
|
import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
|
19
18
|
import uuidv4 from '../../../global/js/utils/uuidv4.js';
|
20
19
|
import ConditionPreview from '../ConditionPreview/ConditionPreview.js';
|
20
|
+
import { ItemOption } from '../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js';
|
21
21
|
|
22
22
|
var _ConditionPreview, _ConditionPreview2;
|
23
|
-
|
24
23
|
/**
|
25
24
|
*
|
26
25
|
* state - this is the current group that is being rendered . This can be a inner group or outer group
|
@@ -85,7 +84,6 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
85
84
|
var addConditionSubGroupHandler = function addConditionSubGroupHandler(conditionIndex) {
|
86
85
|
onChange(_objectSpread2(_objectSpread2({}, group), {}, {
|
87
86
|
conditions: [].concat(_toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [{
|
88
|
-
groupSeparateOperator: null,
|
89
87
|
groupOperator: 'and',
|
90
88
|
statement: 'if',
|
91
89
|
conditions: [{
|
@@ -178,7 +176,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
178
176
|
"data-name": "connectorField",
|
179
177
|
popOverClassName: "".concat(blockClass, "__gap"),
|
180
178
|
className: "".concat(blockClass, "__statement-button")
|
181
|
-
}, /*#__PURE__*/React__default.createElement(
|
179
|
+
}, /*#__PURE__*/React__default.createElement(ItemOption, {
|
182
180
|
conditionState: {
|
183
181
|
value: group.statement,
|
184
182
|
label: translateWithId('condition')
|
@@ -214,7 +212,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
214
212
|
onRemoveHandler(eachCondition.id, e);
|
215
213
|
},
|
216
214
|
conditionBuilderRef: conditionBuilderRef
|
217
|
-
})) : /*#__PURE__*/React__default.createElement(ConditionBlock, {
|
215
|
+
})) : /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(ConditionBlock, {
|
218
216
|
conjunction: conditionIndex > 0 ? group.groupOperator : undefined,
|
219
217
|
aria: {
|
220
218
|
level: aria.level + 1,
|
@@ -244,7 +242,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
244
242
|
},
|
245
243
|
hideConditionPreviewHandler: hideConditionPreviewHandler,
|
246
244
|
isLastCondition: isLastCondition
|
247
|
-
}), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default.createElement(ConditionPreview, {
|
245
|
+
})), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default.createElement(ConditionPreview, {
|
248
246
|
previewType: "subGroup"
|
249
247
|
}))), conditionIndex == showConditionPreview && (_ConditionPreview2 || (_ConditionPreview2 = /*#__PURE__*/React__default.createElement(ConditionPreview, {
|
250
248
|
previewType: "condition"
|
@@ -5,7 +5,9 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import
|
8
|
+
import { slicedToArray as _slicedToArray, defineProperty as _defineProperty } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default, { useState, useEffect } from 'react';
|
10
|
+
import cx from 'classnames';
|
9
11
|
import PropTypes from '../../../node_modules/prop-types/index.js';
|
10
12
|
import { blockClass, translateWithId } from '../ConditionBuilderContext/DataConfigs.js';
|
11
13
|
import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
|
@@ -13,6 +15,13 @@ import ConditionConnector from '../ConditionBuilderConnector/ConditionConnector.
|
|
13
15
|
|
14
16
|
var ConditionPreview = function ConditionPreview(_ref) {
|
15
17
|
var previewType = _ref.previewType;
|
18
|
+
var _useState = useState(false),
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
20
|
+
animate = _useState2[0],
|
21
|
+
setAnimate = _useState2[1];
|
22
|
+
useEffect(function () {
|
23
|
+
setAnimate(true);
|
24
|
+
}, []);
|
16
25
|
var getConditionSection = function getConditionSection() {
|
17
26
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
18
27
|
label: translateWithId('property')
|
@@ -23,20 +32,20 @@ var ConditionPreview = function ConditionPreview(_ref) {
|
|
23
32
|
}));
|
24
33
|
};
|
25
34
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, previewType == 'newGroup' && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
26
|
-
className: "".concat(blockClass, "__group__row ").concat(blockClass, "__group-preview
|
35
|
+
className: cx(["".concat(blockClass, "__group__row ").concat(blockClass, "__group-preview "), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
|
27
36
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
28
37
|
className: "".concat(blockClass, "__statement-button"),
|
29
38
|
label: translateWithId('and')
|
30
39
|
})), /*#__PURE__*/React__default.createElement("div", {
|
31
40
|
"aria-hidden": true,
|
32
|
-
className: "".concat(blockClass, "__group ").concat(blockClass, "__condition-wrapper ").concat(blockClass, "__group-preview ").concat(blockClass, "__group-wrapper")
|
41
|
+
className: cx(["".concat(blockClass, "__group ").concat(blockClass, "__condition-wrapper ").concat(blockClass, "__group-preview ").concat(blockClass, "__group-wrapper "), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
|
33
42
|
}, /*#__PURE__*/React__default.createElement("div", {
|
34
43
|
className: "".concat(blockClass, "__gap")
|
35
44
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
36
45
|
className: "".concat(blockClass, "__statement-button"),
|
37
46
|
label: translateWithId('if')
|
38
47
|
})), getConditionSection())), previewType == 'subGroup' && /*#__PURE__*/React__default.createElement("div", {
|
39
|
-
className: "".concat(blockClass, "__group-preview")
|
48
|
+
className: cx(["".concat(blockClass, "__group__row ").concat(blockClass, "__group-preview "), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
|
40
49
|
}, /*#__PURE__*/React__default.createElement("div", {
|
41
50
|
className: "".concat(blockClass, "__condition-block ").concat(blockClass, "__gap")
|
42
51
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
@@ -49,7 +58,7 @@ var ConditionPreview = function ConditionPreview(_ref) {
|
|
49
58
|
className: "".concat(blockClass, "__gap ").concat(blockClass, "__groupConnector"),
|
50
59
|
operator: translateWithId('if')
|
51
60
|
}), getConditionSection()))), previewType == 'condition' && /*#__PURE__*/React__default.createElement("div", {
|
52
|
-
className: "".concat(blockClass, "__group-preview")
|
61
|
+
className: cx(["".concat(blockClass, "__group__row ").concat(blockClass, "__group-preview "), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
|
53
62
|
}, /*#__PURE__*/React__default.createElement("div", {
|
54
63
|
className: "".concat(blockClass, "__condition-block ").concat(blockClass, "__gap")
|
55
64
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
@@ -7,8 +7,7 @@
|
|
7
7
|
|
8
8
|
import { toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { blockClass } from '../ConditionBuilderContext/DataConfigs.js';
|
10
|
-
import { checkForHoldingKey } from './
|
11
|
-
import { focusThisField, traverseReverse, traverseClockVise } from './util.js';
|
10
|
+
import { checkForHoldingKey, focusThisField, traverseReverse, traverseClockVise } from './util.js';
|
12
11
|
|
13
12
|
var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef) {
|
14
13
|
var activeElement = document.activeElement;
|
@@ -3,3 +3,4 @@ export function focusThisItem(currentElement: any): void;
|
|
3
3
|
export function traverseClockVise(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
|
4
4
|
export function traverseReverse(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
|
5
5
|
export function checkForHoldingKey(evt: any, key: any): any;
|
6
|
+
export function checkDuplicateAction(actionState: any, selectedId: any, currentActionId: any): boolean;
|
@@ -41,5 +41,20 @@ var traverseReverse = function traverseReverse(eachElem, index, allElements, rot
|
|
41
41
|
focusThisItem(allElements[allElements.length - 1]);
|
42
42
|
}
|
43
43
|
};
|
44
|
+
var checkForHoldingKey = function checkForHoldingKey(evt, key) {
|
45
|
+
// possible key inputs: altKey,ctrlKey,metaKey,shiftKey
|
46
|
+
if (key === 'cmd') {
|
47
|
+
return evt.metaKey || evt.ctrlKey;
|
48
|
+
}
|
49
|
+
return evt[key];
|
50
|
+
};
|
51
|
+
var checkDuplicateAction = function checkDuplicateAction(actionState, selectedId, currentActionId) {
|
52
|
+
if (selectedId !== currentActionId && actionState.find(function (eachAction) {
|
53
|
+
return eachAction.id === selectedId;
|
54
|
+
})) {
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
return false;
|
58
|
+
};
|
44
59
|
|
45
|
-
export { focusThisField, focusThisItem, traverseClockVise, traverseReverse };
|
60
|
+
export { checkDuplicateAction, checkForHoldingKey, focusThisField, focusThisItem, traverseClockVise, traverseReverse };
|
@@ -112,15 +112,19 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
112
112
|
_useState18 = _slicedToArray(_useState17, 2),
|
113
113
|
headerCellHoldActive = _useState18[0],
|
114
114
|
setHeaderCellHoldActive = _useState18[1];
|
115
|
-
var isBlurSpreadsheet = useRef(false);
|
116
115
|
var _useState19 = useState(false),
|
117
116
|
_useState20 = _slicedToArray(_useState19, 2),
|
118
|
-
|
119
|
-
|
117
|
+
selectedHeaderReorderActive = _useState20[0],
|
118
|
+
setSelectedHeaderReorderActive = _useState20[1];
|
119
|
+
var isBlurSpreadsheet = useRef(false);
|
120
120
|
var _useState21 = useState(false),
|
121
121
|
_useState22 = _slicedToArray(_useState21, 2),
|
122
|
-
|
123
|
-
|
122
|
+
isActiveHeaderCellChanged = _useState22[0],
|
123
|
+
setIsActiveHeaderCellChanged = _useState22[1];
|
124
|
+
var _useState23 = useState(false),
|
125
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
126
|
+
activeCellInsideSelectionArea = _useState24[0],
|
127
|
+
setActiveCellInsideSelectionArea = _useState24[1];
|
124
128
|
var previousState = usePreviousValue({
|
125
129
|
activeCellCoordinates: activeCellCoordinates,
|
126
130
|
isEditing: isEditing,
|
@@ -128,10 +132,10 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
128
132
|
}) || {};
|
129
133
|
var cellSizeValue = getCellSize(cellSize);
|
130
134
|
var cellEditorRef = useRef();
|
131
|
-
var
|
132
|
-
|
133
|
-
activeCellContent =
|
134
|
-
setActiveCellContent =
|
135
|
+
var _useState25 = useState(),
|
136
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
137
|
+
activeCellContent = _useState26[0],
|
138
|
+
setActiveCellContent = _useState26[1];
|
135
139
|
var activeCellRef = useRef();
|
136
140
|
var cellEditorRulerRef = useRef();
|
137
141
|
var defaultColumn = useMemo(function () {
|
@@ -207,9 +211,12 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
207
211
|
}
|
208
212
|
if ((prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) || (prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column)) {
|
209
213
|
if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) !== 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) !== 'header') {
|
210
|
-
var _activeCellFullData$r;
|
211
214
|
var activeCellFullData = typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'number' && typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'number' ? rows[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row].cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column] : null;
|
212
|
-
|
215
|
+
if (activeCellFullData) {
|
216
|
+
setActiveCellContent(activeCellFullData.render('Cell'));
|
217
|
+
} else {
|
218
|
+
setActiveCellContent(null);
|
219
|
+
}
|
213
220
|
}
|
214
221
|
if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
|
215
222
|
setActiveCellContent(null);
|
@@ -424,8 +431,8 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
424
431
|
var activeCellFullData = typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'number' && typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'number' ? rows[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row].cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column] : null;
|
425
432
|
var activeCellValue;
|
426
433
|
if (activeCellFullData && activeCellCoordinates !== null && activeCellCoordinates !== void 0 && activeCellCoordinates.column) {
|
427
|
-
var _activeCellFullData$
|
428
|
-
activeCellValue = activeCellFullData ? (_activeCellFullData$
|
434
|
+
var _activeCellFullData$r;
|
435
|
+
activeCellValue = activeCellFullData ? (_activeCellFullData$r = activeCellFullData.row.cells) === null || _activeCellFullData$r === void 0 || (_activeCellFullData$r = _activeCellFullData$r[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column]) === null || _activeCellFullData$r === void 0 ? void 0 : _activeCellFullData$r.value : null;
|
429
436
|
}
|
430
437
|
setCellEditorValue(activeCellValue || '');
|
431
438
|
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
@@ -615,6 +622,8 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
615
622
|
columns: columns,
|
616
623
|
currentMatcher: currentMatcher,
|
617
624
|
defaultColumn: defaultColumn,
|
625
|
+
selectedHeaderReorderActive: selectedHeaderReorderActive,
|
626
|
+
setSelectedHeaderReorderActive: setSelectedHeaderReorderActive,
|
618
627
|
headerGroups: headerGroups,
|
619
628
|
rows: rows,
|
620
629
|
scrollBarSize: scrollBarSize,
|
@@ -638,6 +647,8 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
638
647
|
currentMatcher: currentMatcher,
|
639
648
|
setCurrentMatcher: setCurrentMatcher,
|
640
649
|
setContainerHasFocus: setContainerHasFocus,
|
650
|
+
selectedHeaderReorderActive: selectedHeaderReorderActive,
|
651
|
+
setSelectedHeaderReorderActive: setSelectedHeaderReorderActive,
|
641
652
|
selectionAreas: selectionAreas,
|
642
653
|
setSelectionAreas: setSelectionAreas,
|
643
654
|
headerGroups: headerGroups,
|
@@ -688,9 +699,11 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
688
699
|
updateData: updateData
|
689
700
|
}),
|
690
701
|
onChange: function onChange(event) {
|
691
|
-
|
692
|
-
|
693
|
-
cellEditorRulerRef.current
|
702
|
+
if (previousState.isEditing) {
|
703
|
+
setCellEditorValue(event.target.value);
|
704
|
+
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
705
|
+
cellEditorRulerRef.current.textContent = event.target.value;
|
706
|
+
}
|
694
707
|
}
|
695
708
|
},
|
696
709
|
ref: cellEditorRef,
|
@@ -79,7 +79,15 @@ interface DataSpreadsheetBodyProps {
|
|
79
79
|
/**
|
80
80
|
* Array of selection area data
|
81
81
|
*/
|
82
|
-
selectionAreaData?:
|
82
|
+
selectionAreaData?: any[];
|
83
|
+
/**
|
84
|
+
* Header reordering is active
|
85
|
+
*/
|
86
|
+
selectedHeaderReorderActive?: boolean;
|
87
|
+
/**
|
88
|
+
* Set header reordering active or not
|
89
|
+
*/
|
90
|
+
setSelectedHeaderReorderActive?: Dispatch<SetStateAction<boolean>>;
|
83
91
|
/**
|
84
92
|
* Array of selection areas
|
85
93
|
*/
|
@@ -40,6 +40,8 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
40
40
|
selectionAreaData = _ref.selectionAreaData,
|
41
41
|
setSelectionAreaData = _ref.setSelectionAreaData,
|
42
42
|
setActiveCellCoordinates = _ref.setActiveCellCoordinates,
|
43
|
+
selectedHeaderReorderActive = _ref.selectedHeaderReorderActive,
|
44
|
+
setSelectedHeaderReorderActive = _ref.setSelectedHeaderReorderActive,
|
43
45
|
selectionAreas = _ref.selectionAreas,
|
44
46
|
setContainerHasFocus = _ref.setContainerHasFocus,
|
45
47
|
setSelectionAreas = _ref.setSelectionAreas,
|
@@ -75,8 +77,12 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
75
77
|
// back to the consumer
|
76
78
|
useEffect(function () {
|
77
79
|
if (selectionAreaData !== null && selectionAreaData !== void 0 && selectionAreaData.length) {
|
78
|
-
var _previousState$select;
|
79
|
-
|
80
|
+
var _previousState$select, _selectionAreaData$, _previousState$select2;
|
81
|
+
var selectionChanged = false;
|
82
|
+
if ((previousState === null || previousState === void 0 || (_previousState$select = previousState.selectionAreaData) === null || _previousState$select === void 0 ? void 0 : _previousState$select.length) !== (selectionAreaData === null || selectionAreaData === void 0 ? void 0 : selectionAreaData.length) || (selectionAreaData === null || selectionAreaData === void 0 || (_selectionAreaData$ = selectionAreaData[0]) === null || _selectionAreaData$ === void 0 ? void 0 : _selectionAreaData$.cells.length) !== (previousState === null || previousState === void 0 || (_previousState$select2 = previousState.selectionAreaData) === null || _previousState$select2 === void 0 || (_previousState$select2 = _previousState$select2[0]) === null || _previousState$select2 === void 0 ? void 0 : _previousState$select2.cells.length)) {
|
83
|
+
selectionChanged = true;
|
84
|
+
}
|
85
|
+
if (!clickAndHoldActive && previousState !== null && previousState !== void 0 && previousState.clickAndHoldActive || selectionChanged) {
|
80
86
|
onSelectionAreaChange === null || onSelectionAreaChange === void 0 || onSelectionAreaChange(selectionAreaData);
|
81
87
|
}
|
82
88
|
}
|
@@ -151,6 +157,8 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
151
157
|
setClickAndHoldActive: setClickAndHoldActive,
|
152
158
|
setSelectionAreas: setSelectionAreas,
|
153
159
|
setValidStartingPoint: setValidStartingPoint,
|
160
|
+
selectedHeaderReorderActive: selectedHeaderReorderActive,
|
161
|
+
setSelectedHeaderReorderActive: setSelectedHeaderReorderActive,
|
154
162
|
validStartingPoint: validStartingPoint,
|
155
163
|
ref: ref,
|
156
164
|
setHeaderCellHoldActive: setHeaderCellHoldActive,
|
@@ -457,6 +465,10 @@ DataSpreadsheetBody.propTypes = {
|
|
457
465
|
* The scrollbar width
|
458
466
|
*/
|
459
467
|
scrollBarSize: PropTypes.number,
|
468
|
+
/**
|
469
|
+
* Header reordering is active
|
470
|
+
*/
|
471
|
+
selectedHeaderReorderActive: PropTypes.bool,
|
460
472
|
/**
|
461
473
|
* Array of selection area data
|
462
474
|
*/
|
@@ -493,6 +505,10 @@ DataSpreadsheetBody.propTypes = {
|
|
493
505
|
* Setter fn for header cell hold active value
|
494
506
|
*/
|
495
507
|
setHeaderCellHoldActive: PropTypes.func,
|
508
|
+
/**
|
509
|
+
* Set header reordering active or not
|
510
|
+
*/
|
511
|
+
setSelectedHeaderReorderActive: PropTypes.func,
|
496
512
|
/**
|
497
513
|
* Setter fn for selectionAreaData state value
|
498
514
|
*/
|
@@ -56,6 +56,14 @@ interface DataSpreadsheetHeaderProps {
|
|
56
56
|
* Setter fn for activeCellCoordinates value
|
57
57
|
*/
|
58
58
|
setActiveCellCoordinates?: Dispatch<SetStateAction<ActiveCellCoordinates | null>>;
|
59
|
+
/**
|
60
|
+
* Header reordering is active
|
61
|
+
*/
|
62
|
+
selectedHeaderReorderActive?: boolean;
|
63
|
+
/**
|
64
|
+
* Set header reordering active or not
|
65
|
+
*/
|
66
|
+
setSelectedHeaderReorderActive?: Dispatch<SetStateAction<boolean>>;
|
59
67
|
/**
|
60
68
|
* Setter fn for currentMatcher value
|
61
69
|
*/
|