@carbon/ibm-products 2.43.2-canary.7 → 2.44.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/index-full-carbon.css +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 +12 -7
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
- package/es/components/DataSpreadsheet/utils/moveColumnIndicatorLine.js +34 -2
- package/es/components/Datagrid/Datagrid/Datagrid.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -1
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +11 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +13 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.d.ts +3 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +6 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +21 -16
- 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.js +12 -2
- package/es/components/Datagrid/useNestedRows.js +32 -13
- 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 +12 -7
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
- package/lib/components/DataSpreadsheet/utils/moveColumnIndicatorLine.js +34 -2
- package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +11 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +13 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.d.ts +3 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +6 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +21 -16
- 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.js +12 -2
- package/lib/components/Datagrid/useNestedRows.js +32 -13
- 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 +5 -5
- 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 +8 -3
- 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 };
|
@@ -211,9 +211,12 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
211
211
|
}
|
212
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)) {
|
213
213
|
if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) !== 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) !== 'header') {
|
214
|
-
var _activeCellFullData$r;
|
215
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;
|
216
|
-
|
215
|
+
if (activeCellFullData) {
|
216
|
+
setActiveCellContent(activeCellFullData.render('Cell'));
|
217
|
+
} else {
|
218
|
+
setActiveCellContent(null);
|
219
|
+
}
|
217
220
|
}
|
218
221
|
if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
|
219
222
|
setActiveCellContent(null);
|
@@ -428,8 +431,8 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
428
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;
|
429
432
|
var activeCellValue;
|
430
433
|
if (activeCellFullData && activeCellCoordinates !== null && activeCellCoordinates !== void 0 && activeCellCoordinates.column) {
|
431
|
-
var _activeCellFullData$
|
432
|
-
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;
|
433
436
|
}
|
434
437
|
setCellEditorValue(activeCellValue || '');
|
435
438
|
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
@@ -696,9 +699,11 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
696
699
|
updateData: updateData
|
697
700
|
}),
|
698
701
|
onChange: function onChange(event) {
|
699
|
-
|
700
|
-
|
701
|
-
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
|
+
}
|
702
707
|
}
|
703
708
|
},
|
704
709
|
ref: cellEditorRef,
|
@@ -40,9 +40,12 @@ var useSpreadsheetMouseMove = function useSpreadsheetMouseMove(_ref) {
|
|
40
40
|
var totalSpreadsheetScrollingWidth = listContainer.scrollWidth;
|
41
41
|
var clonedSelectionWidth = clonedSelectionElement.offsetWidth;
|
42
42
|
var clonePlacement = Math.max(xPositionRelativeToSpreadsheet - offsetXValue, defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth);
|
43
|
+
var leftPosition = totalSpreadsheetScrollingWidth - clonedSelectionWidth >= clonePlacement ? clonePlacement + scrollAmount : totalSpreadsheetScrollingWidth - clonedSelectionWidth;
|
43
44
|
// Moves the position of the cloned selection area to follow mouse, and
|
44
45
|
// add the amount horizontally scrolled
|
45
|
-
|
46
|
+
if (leftPosition < spreadsheetCoords.right - 40) {
|
47
|
+
clonedSelectionElement.style.left = px(leftPosition);
|
48
|
+
}
|
46
49
|
};
|
47
50
|
if (headerCellHoldActive) {
|
48
51
|
ref.current.addEventListener('mousemove', handleMouseMove);
|
@@ -22,11 +22,43 @@ var moveColumnIndicatorLine = function moveColumnIndicatorLine(_ref) {
|
|
22
22
|
var indicatorLineElement = ref.current.querySelector(".".concat(blockClass, "__reorder-indicator-line"));
|
23
23
|
var matcherId = clonedSelectionElement === null || clonedSelectionElement === void 0 ? void 0 : clonedSelectionElement.getAttribute('data-matcher-id');
|
24
24
|
var selectionAreaOrigin = ref.current.querySelector("[data-matcher-id=\"".concat(matcherId, "\"]"));
|
25
|
+
var listContainer = ref.current.querySelector(".".concat(blockClass, "__list--container"));
|
26
|
+
var scrollSpeed = 10; // Scrolling speed
|
27
|
+
var leftEdgeThreshold = 120; // Distance from the left edge to start scrolling
|
28
|
+
var rightEdgeThreshold = 100; // Distance from the right edge to start scrolling
|
29
|
+
|
30
|
+
var _event = event,
|
31
|
+
clientX = _event.clientX;
|
32
|
+
var _listContainer$getBou = listContainer.getBoundingClientRect(),
|
33
|
+
left = _listContainer$getBou.left,
|
34
|
+
right = _listContainer$getBou.right;
|
35
|
+
|
36
|
+
// Is near left side of viewport
|
37
|
+
if (clientX < leftEdgeThreshold) {
|
38
|
+
window.scrollBy(-scrollSpeed, 0);
|
39
|
+
}
|
40
|
+
|
41
|
+
// Is near right side of viewport
|
42
|
+
if (clientX > window.innerWidth - rightEdgeThreshold) {
|
43
|
+
window.scrollBy(scrollSpeed, 0);
|
44
|
+
}
|
45
|
+
|
46
|
+
// Is near left edge of table
|
47
|
+
if (clientX > left && clientX < left + leftEdgeThreshold) {
|
48
|
+
listContainer.scrollBy(-scrollSpeed, 0);
|
49
|
+
}
|
50
|
+
|
51
|
+
// Is near right edge of table
|
52
|
+
if (clientX < right && clientX > right - rightEdgeThreshold) {
|
53
|
+
listContainer.scrollBy(scrollSpeed, 0);
|
54
|
+
}
|
25
55
|
if (Number(newColumnIndex) > Number(originalColumnIndex)) {
|
26
|
-
|
56
|
+
var leftPosition = closestCellCoords.left - spreadsheetCoords.left + closestCell.offsetWidth - 2 + leftScrollAmount;
|
57
|
+
indicatorLineElement.style.left = px(leftPosition);
|
27
58
|
}
|
28
59
|
if (Number(newColumnIndex) < Number(originalColumnIndex)) {
|
29
|
-
|
60
|
+
var _leftPosition = closestCellCoords.left - spreadsheetCoords.left + leftScrollAmount;
|
61
|
+
indicatorLineElement.style.left = px(_leftPosition);
|
30
62
|
}
|
31
63
|
if (Number(newColumnIndex) === Number(originalColumnIndex)) {
|
32
64
|
indicatorLineElement.style.left = selectionAreaOrigin.style.left;
|
@@ -46,7 +46,8 @@ var Datagrid = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
46
46
|
};
|
47
47
|
return /*#__PURE__*/React__default.createElement(FilterProvider, {
|
48
48
|
filters: state === null || state === void 0 ? void 0 : state.filters,
|
49
|
-
filterProps: filterProps
|
49
|
+
filterProps: filterProps,
|
50
|
+
tableId: tableId
|
50
51
|
}, /*#__PURE__*/React__default.createElement(InlineEditProvider, null, /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
51
52
|
id: tableId,
|
52
53
|
ref: ref,
|
@@ -158,7 +158,7 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
158
158
|
className: "".concat(blockClass, "__filter-summary"),
|
159
159
|
filters: filterTags,
|
160
160
|
clearFilters: function clearFilters() {
|
161
|
-
return EventEmitter.dispatch(CLEAR_FILTERS);
|
161
|
+
return EventEmitter.dispatch(CLEAR_FILTERS, tableId);
|
162
162
|
},
|
163
163
|
renderLabel: filterProps === null || filterProps === void 0 ? void 0 : filterProps.renderLabel,
|
164
164
|
overflowType: "tag"
|
@@ -90,7 +90,8 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
90
90
|
var resizerAriaLabel = datagridState.resizerAriaLabel,
|
91
91
|
isTableSortable = datagridState.isTableSortable,
|
92
92
|
rows = datagridState.rows,
|
93
|
-
isFetching = datagridState.isFetching
|
93
|
+
isFetching = datagridState.isFetching,
|
94
|
+
headers = datagridState.headers;
|
94
95
|
useInitialColumnSort(datagridState);
|
95
96
|
// Used to measure the height of the table and uses that value
|
96
97
|
// to display a vertical line to indicate the column you are resizing
|
@@ -152,6 +153,9 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
152
153
|
});
|
153
154
|
var key = headerGroupProps.key,
|
154
155
|
rowProps = _objectWithoutProperties(headerGroupProps, _excluded2);
|
156
|
+
var withActionsColumn = headers ? !!headers.filter(function (header) {
|
157
|
+
return header.isAction;
|
158
|
+
}).length : false;
|
155
159
|
return /*#__PURE__*/React__default.createElement(TableRow, _extends({
|
156
160
|
key: key
|
157
161
|
}, rowProps, {
|
@@ -184,6 +188,12 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
184
188
|
var _header$getHeaderProp = header.getHeaderProps(),
|
185
189
|
headerProps = _extends({}, (_objectDestructuringEmpty(_header$getHeaderProp), _header$getHeaderProp));
|
186
190
|
var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
|
191
|
+
var headerStyle = headerProps === null || headerProps === void 0 ? void 0 : headerProps.style;
|
192
|
+
var lastVisibleIndex = withActionsColumn ? 2 : 1;
|
193
|
+
var lastVisibleFlexStyle = index === visibleColumns.length - lastVisibleIndex ? '1 1 0' : '0 0 auto';
|
194
|
+
if (headerStyle) {
|
195
|
+
headerStyle.flex = lastVisibleFlexStyle;
|
196
|
+
}
|
187
197
|
return /*#__PURE__*/React__default.createElement(TableHeader, _extends({}, headerProps, {
|
188
198
|
className: cx(header === null || header === void 0 ? void 0 : header.className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default.isValidElement(header === null || header === void 0 ? void 0 : header.slug)), headerProps.className),
|
189
199
|
key: header.id,
|