@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
@@ -0,0 +1,117 @@
|
|
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
|
+
'use strict';
|
9
|
+
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
+
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
var React = require('react');
|
14
|
+
var react = require('@carbon/react');
|
15
|
+
var icons = require('@carbon/react/icons');
|
16
|
+
var index = require('../../../../node_modules/prop-types/index.js');
|
17
|
+
var ConditionBuilderProvider = require('../../ConditionBuilderContext/ConditionBuilderProvider.js');
|
18
|
+
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
19
|
+
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
21
|
+
|
22
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
23
|
+
|
24
|
+
var ItemOption = function ItemOption(_ref) {
|
25
|
+
var _ref$conditionState = _ref.conditionState,
|
26
|
+
conditionState = _ref$conditionState === void 0 ? {} : _ref$conditionState,
|
27
|
+
_ref$config = _ref.config,
|
28
|
+
config = _ref$config === void 0 ? {} : _ref$config,
|
29
|
+
onChange = _ref.onChange;
|
30
|
+
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
31
|
+
popOverSearchThreshold = _useContext.popOverSearchThreshold;
|
32
|
+
var contentRef = React.useRef();
|
33
|
+
var allOptions = config.options;
|
34
|
+
var _useState = React.useState(''),
|
35
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
36
|
+
searchValue = _useState2[0],
|
37
|
+
setSearchValue = _useState2[1];
|
38
|
+
var selection = conditionState.value;
|
39
|
+
var filteredItems = allOptions === null || allOptions === void 0 ? void 0 : allOptions.filter(function (opt) {
|
40
|
+
return opt.label.toLowerCase().includes(searchValue.toLowerCase());
|
41
|
+
});
|
42
|
+
React.useEffect(function () {
|
43
|
+
//this will focus the first input field in the popover
|
44
|
+
|
45
|
+
if (contentRef.current) {
|
46
|
+
var firstFocusableElement = contentRef.current.querySelector('input, button,li');
|
47
|
+
if (firstFocusableElement) {
|
48
|
+
firstFocusableElement.focus();
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}, [allOptions]);
|
52
|
+
var onClickHandler = function onClickHandler(evt, option) {
|
53
|
+
onChange(option.id, evt);
|
54
|
+
};
|
55
|
+
var onSearchChangeHandler = function onSearchChangeHandler(evt) {
|
56
|
+
var value = evt.target.value;
|
57
|
+
setSearchValue(value);
|
58
|
+
};
|
59
|
+
var getAriaLabel = function getAriaLabel() {
|
60
|
+
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : DataConfigs.translateWithId('property');
|
61
|
+
};
|
62
|
+
if (!allOptions) {
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
66
|
+
className: "".concat(DataConfigs.blockClass, "__item-option"),
|
67
|
+
ref: contentRef
|
68
|
+
}, allOptions.length > popOverSearchThreshold && /*#__PURE__*/React__default["default"].createElement("div", {
|
69
|
+
className: "".concat(DataConfigs.blockClass, "__item-option__search")
|
70
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.Search, {
|
71
|
+
size: "sm",
|
72
|
+
labelText: DataConfigs.translateWithId('clear_search'),
|
73
|
+
closeButtonLabelText: DataConfigs.translateWithId('clear_search'),
|
74
|
+
onChange: onSearchChangeHandler
|
75
|
+
})), /*#__PURE__*/React__default["default"].createElement("ul", {
|
76
|
+
"aria-label": getAriaLabel(),
|
77
|
+
role: "listbox"
|
78
|
+
}, filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.map(function (option) {
|
79
|
+
var isSelected = selection === option.id;
|
80
|
+
var Icon = option.icon;
|
81
|
+
return /*#__PURE__*/React__default["default"].createElement("li", {
|
82
|
+
tabIndex: 0,
|
83
|
+
key: option.id,
|
84
|
+
role: "option",
|
85
|
+
"aria-selected": isSelected,
|
86
|
+
className: "".concat(DataConfigs.blockClass, "__item-option__option"),
|
87
|
+
onKeyUp: function onKeyUp() {
|
88
|
+
return false;
|
89
|
+
},
|
90
|
+
onClick: function onClick(evt) {
|
91
|
+
return onClickHandler(evt, option);
|
92
|
+
}
|
93
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
94
|
+
className: "".concat(DataConfigs.blockClass, "__item-option__option-content")
|
95
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
96
|
+
className: "".concat(DataConfigs.blockClass, "__item-option__option-label")
|
97
|
+
}, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, null), option.label), isSelected && /*#__PURE__*/React__default["default"].createElement(icons.Checkmark, {
|
98
|
+
className: "".concat(DataConfigs.blockClass, "__checkmark")
|
99
|
+
})));
|
100
|
+
})));
|
101
|
+
};
|
102
|
+
ItemOption.propTypes = {
|
103
|
+
/**
|
104
|
+
* current condition object
|
105
|
+
*/
|
106
|
+
conditionState: index["default"].object,
|
107
|
+
/**
|
108
|
+
* current config object that this property is part of
|
109
|
+
*/
|
110
|
+
config: index["default"].object,
|
111
|
+
/**
|
112
|
+
* callback to update state oin date change
|
113
|
+
*/
|
114
|
+
onChange: index["default"].func
|
115
|
+
};
|
116
|
+
|
117
|
+
exports.ItemOption = 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>;
|
@@ -21,28 +21,51 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
21
21
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
23
23
|
|
24
|
-
var _CheckboxCheckedFille, _Checkbox
|
25
|
-
var
|
24
|
+
var _SelectSkeleton, _CheckboxCheckedFille, _Checkbox;
|
25
|
+
var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
26
26
|
var _ref$conditionState = _ref.conditionState,
|
27
27
|
conditionState = _ref$conditionState === void 0 ? {} : _ref$conditionState,
|
28
28
|
_ref$config = _ref.config,
|
29
29
|
config = _ref$config === void 0 ? {} : _ref$config,
|
30
30
|
onChange = _ref.onChange;
|
31
|
-
var multiSelectable = conditionState.operator === '
|
31
|
+
var multiSelectable = conditionState.operator === 'one_of';
|
32
32
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
33
33
|
popOverSearchThreshold = _useContext.popOverSearchThreshold,
|
34
|
-
getOptions = _useContext.getOptions
|
34
|
+
getOptions = _useContext.getOptions,
|
35
|
+
rootState = _useContext.rootState;
|
36
|
+
var contentRef = React.useRef();
|
35
37
|
var _useState = React.useState(config.options),
|
36
38
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
37
39
|
allOptions = _useState2[0],
|
38
40
|
setAllOptions = _useState2[1];
|
39
|
-
var _useState3 = React.useState(
|
41
|
+
var _useState3 = React.useState(''),
|
40
42
|
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
41
|
-
|
42
|
-
|
43
|
+
searchValue = _useState4[0],
|
44
|
+
setSearchValue = _useState4[1];
|
45
|
+
var filteredItems = allOptions === null || allOptions === void 0 ? void 0 : allOptions.filter(function (opt) {
|
46
|
+
return opt.label.toLowerCase().includes(searchValue.toLowerCase());
|
47
|
+
});
|
43
48
|
var selection = Array.isArray(conditionState.value) ? conditionState.value : conditionState.value !== undefined ? [conditionState.value] : [];
|
44
|
-
var contentRef = React.useRef();
|
45
49
|
React.useEffect(function () {
|
50
|
+
// if(rest['data-name'] == 'valueField'){
|
51
|
+
// const fetchData = async () => {
|
52
|
+
// const response = await config.options(conditionState);
|
53
|
+
// if (
|
54
|
+
// response?.length > 0 &&
|
55
|
+
// Object.keys(response[0]).includes('label') &&
|
56
|
+
// Object.keys(response[0]).includes('id')
|
57
|
+
// ) {
|
58
|
+
// setAllOptions(response);
|
59
|
+
// setFilteredItems(response);
|
60
|
+
// }
|
61
|
+
// };
|
62
|
+
|
63
|
+
// fetchData(); // Call the async method
|
64
|
+
// }else{
|
65
|
+
// setAllOptions(config.options);
|
66
|
+
// setFilteredItems(config.options);
|
67
|
+
// }
|
68
|
+
|
46
69
|
if (!allOptions && getOptions) {
|
47
70
|
var fetchData = /*#__PURE__*/function () {
|
48
71
|
var _ref2 = _rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
|
@@ -51,12 +74,11 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
|
|
51
74
|
while (1) switch (_context.prev = _context.next) {
|
52
75
|
case 0:
|
53
76
|
_context.next = 2;
|
54
|
-
return getOptions(conditionState);
|
77
|
+
return getOptions(rootState, conditionState);
|
55
78
|
case 2:
|
56
79
|
response = _context.sent;
|
57
80
|
if ((response === null || response === void 0 ? void 0 : response.length) > 0 && Object.keys(response[0]).includes('label') && Object.keys(response[0]).includes('id')) {
|
58
81
|
setAllOptions(response);
|
59
|
-
setFilteredItems(response);
|
60
82
|
}
|
61
83
|
case 4:
|
62
84
|
case "end":
|
@@ -76,46 +98,47 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
|
|
76
98
|
//this will focus the first input field in the popover
|
77
99
|
|
78
100
|
if (contentRef.current) {
|
79
|
-
var
|
80
|
-
|
81
|
-
|
101
|
+
var firstFocusableElement = contentRef.current.querySelector('input, button,li');
|
102
|
+
if (firstFocusableElement) {
|
103
|
+
firstFocusableElement.focus();
|
104
|
+
}
|
82
105
|
}
|
83
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
84
106
|
}, [allOptions]);
|
85
107
|
var handleSelectAll = function handleSelectAll(evt) {
|
86
108
|
if (evt.currentTarget.dataset.selectedAll == 'false') {
|
87
109
|
onChange(undefined);
|
88
110
|
} else {
|
89
|
-
onChange(allOptions
|
90
|
-
return op.id;
|
91
|
-
}));
|
111
|
+
onChange(allOptions);
|
92
112
|
}
|
93
113
|
};
|
94
114
|
var onSearchChangeHandler = function onSearchChangeHandler(evt) {
|
95
115
|
var value = evt.target.value;
|
96
|
-
|
97
|
-
return opt.label.toLowerCase().includes(value.toLowerCase());
|
98
|
-
});
|
99
|
-
setFilteredItems(_filteredItems);
|
116
|
+
setSearchValue(value);
|
100
117
|
};
|
101
118
|
var onClickHandler = function onClickHandler(evt, option, isSelected) {
|
102
119
|
if (multiSelectable) {
|
103
120
|
if (isSelected) {
|
104
121
|
var items = selection.filter(function (v) {
|
105
|
-
return v !== option.id;
|
122
|
+
return v.id !== option.id;
|
106
123
|
});
|
107
124
|
onChange(items.length > 0 ? items : undefined, evt);
|
108
125
|
} else {
|
109
|
-
onChange([].concat(_rollupPluginBabelHelpers.toConsumableArray(selection), [option
|
126
|
+
onChange([].concat(_rollupPluginBabelHelpers.toConsumableArray(selection), [option]), evt);
|
110
127
|
}
|
111
128
|
} else {
|
112
|
-
onChange(option
|
129
|
+
onChange(option, evt);
|
113
130
|
}
|
114
131
|
};
|
115
|
-
|
132
|
+
var getAriaLabel = function getAriaLabel() {
|
133
|
+
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : DataConfigs.translateWithId('property');
|
134
|
+
};
|
135
|
+
if (!allOptions) {
|
136
|
+
return _SelectSkeleton || (_SelectSkeleton = /*#__PURE__*/React__default["default"].createElement(react.SelectSkeleton, null));
|
137
|
+
}
|
138
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
116
139
|
className: "".concat(DataConfigs.blockClass, "__item-option"),
|
117
140
|
ref: contentRef
|
118
|
-
},
|
141
|
+
}, allOptions.length > popOverSearchThreshold && /*#__PURE__*/React__default["default"].createElement("div", {
|
119
142
|
className: "".concat(DataConfigs.blockClass, "__item-option__search")
|
120
143
|
}, /*#__PURE__*/React__default["default"].createElement(react.Search, {
|
121
144
|
size: "sm",
|
@@ -131,11 +154,13 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
|
|
131
154
|
onClick: handleSelectAll,
|
132
155
|
className: "".concat(DataConfigs.blockClass, "__selectAll-button")
|
133
156
|
}, selection.length == 0 ? 'Select all' : 'Deselect all')), /*#__PURE__*/React__default["default"].createElement("ul", {
|
134
|
-
"aria-label":
|
157
|
+
"aria-label": getAriaLabel(),
|
135
158
|
role: "listbox",
|
136
159
|
"data-multi-select": multiSelectable
|
137
160
|
}, filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.map(function (option) {
|
138
|
-
var isSelected = selection.
|
161
|
+
var isSelected = selection.map(function (option) {
|
162
|
+
return option.id;
|
163
|
+
}).includes(option.id);
|
139
164
|
var Icon = option.icon;
|
140
165
|
return /*#__PURE__*/React__default["default"].createElement("li", {
|
141
166
|
tabIndex: 0,
|
@@ -162,9 +187,9 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
|
|
162
187
|
}, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, null), option.label), isSelected && /*#__PURE__*/React__default["default"].createElement(icons.Checkmark, {
|
163
188
|
className: "".concat(DataConfigs.blockClass, "__checkmark")
|
164
189
|
}))));
|
165
|
-
})))
|
190
|
+
})));
|
166
191
|
};
|
167
|
-
|
192
|
+
ItemOptionForValueField.propTypes = {
|
168
193
|
/**
|
169
194
|
* current condition object
|
170
195
|
*/
|
@@ -179,4 +204,4 @@ ConditionBuilderItemOption.propTypes = {
|
|
179
204
|
onChange: index["default"].func
|
180
205
|
};
|
181
206
|
|
182
|
-
exports.
|
207
|
+
exports.ItemOptionForValueField = ItemOptionForValueField;
|
@@ -16,12 +16,12 @@ var index = require('../../../node_modules/prop-types/index.js');
|
|
16
16
|
var cx = require('classnames');
|
17
17
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
18
18
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
19
|
-
var ConditionBuilderItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js');
|
20
19
|
var util = require('../utils/util.js');
|
21
20
|
var ConditionConnector = require('../ConditionBuilderConnector/ConditionConnector.js');
|
22
21
|
var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
|
23
22
|
var uuidv4 = require('../../../global/js/utils/uuidv4.js');
|
24
23
|
var ConditionPreview = require('../ConditionPreview/ConditionPreview.js');
|
24
|
+
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
25
25
|
|
26
26
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
27
27
|
|
@@ -29,7 +29,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
29
29
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
30
30
|
|
31
31
|
var _ConditionPreview, _ConditionPreview2;
|
32
|
-
|
33
32
|
/**
|
34
33
|
*
|
35
34
|
* state - this is the current group that is being rendered . This can be a inner group or outer group
|
@@ -94,7 +93,6 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
94
93
|
var addConditionSubGroupHandler = function addConditionSubGroupHandler(conditionIndex) {
|
95
94
|
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
96
95
|
conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [{
|
97
|
-
groupSeparateOperator: null,
|
98
96
|
groupOperator: 'and',
|
99
97
|
statement: 'if',
|
100
98
|
conditions: [{
|
@@ -187,7 +185,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
187
185
|
"data-name": "connectorField",
|
188
186
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
189
187
|
className: "".concat(DataConfigs.blockClass, "__statement-button")
|
190
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
188
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
191
189
|
conditionState: {
|
192
190
|
value: group.statement,
|
193
191
|
label: DataConfigs.translateWithId('condition')
|
@@ -223,7 +221,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
223
221
|
onRemoveHandler(eachCondition.id, e);
|
224
222
|
},
|
225
223
|
conditionBuilderRef: conditionBuilderRef
|
226
|
-
})) : /*#__PURE__*/React__default["default"].createElement(ConditionBlock["default"], {
|
224
|
+
})) : /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(ConditionBlock["default"], {
|
227
225
|
conjunction: conditionIndex > 0 ? group.groupOperator : undefined,
|
228
226
|
aria: {
|
229
227
|
level: aria.level + 1,
|
@@ -253,7 +251,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
253
251
|
},
|
254
252
|
hideConditionPreviewHandler: hideConditionPreviewHandler,
|
255
253
|
isLastCondition: isLastCondition
|
256
|
-
}), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
|
254
|
+
})), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
|
257
255
|
previewType: "subGroup"
|
258
256
|
}))), conditionIndex == showConditionPreview && (_ConditionPreview2 || (_ConditionPreview2 = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
|
259
257
|
previewType: "condition"
|
@@ -9,7 +9,9 @@
|
|
9
9
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
12
13
|
var React = require('react');
|
14
|
+
var cx = require('classnames');
|
13
15
|
var index = require('../../../node_modules/prop-types/index.js');
|
14
16
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
15
17
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
@@ -18,9 +20,17 @@ var ConditionConnector = require('../ConditionBuilderConnector/ConditionConnecto
|
|
18
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
19
21
|
|
20
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
23
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
21
24
|
|
22
25
|
var ConditionPreview = function ConditionPreview(_ref) {
|
23
26
|
var previewType = _ref.previewType;
|
27
|
+
var _useState = React.useState(false),
|
28
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
29
|
+
animate = _useState2[0],
|
30
|
+
setAnimate = _useState2[1];
|
31
|
+
React.useEffect(function () {
|
32
|
+
setAnimate(true);
|
33
|
+
}, []);
|
24
34
|
var getConditionSection = function getConditionSection() {
|
25
35
|
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
26
36
|
label: DataConfigs.translateWithId('property')
|
@@ -31,20 +41,20 @@ var ConditionPreview = function ConditionPreview(_ref) {
|
|
31
41
|
}));
|
32
42
|
};
|
33
43
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, previewType == 'newGroup' && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
34
|
-
className: "".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview
|
44
|
+
className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
|
35
45
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
36
46
|
className: "".concat(DataConfigs.blockClass, "__statement-button"),
|
37
47
|
label: DataConfigs.translateWithId('and')
|
38
48
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
39
49
|
"aria-hidden": true,
|
40
|
-
className: "".concat(DataConfigs.blockClass, "__group ").concat(DataConfigs.blockClass, "__condition-wrapper ").concat(DataConfigs.blockClass, "__group-preview ").concat(DataConfigs.blockClass, "__group-wrapper")
|
50
|
+
className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group ").concat(DataConfigs.blockClass, "__condition-wrapper ").concat(DataConfigs.blockClass, "__group-preview ").concat(DataConfigs.blockClass, "__group-wrapper "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
|
41
51
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
42
52
|
className: "".concat(DataConfigs.blockClass, "__gap")
|
43
53
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
44
54
|
className: "".concat(DataConfigs.blockClass, "__statement-button"),
|
45
55
|
label: DataConfigs.translateWithId('if')
|
46
56
|
})), getConditionSection())), previewType == 'subGroup' && /*#__PURE__*/React__default["default"].createElement("div", {
|
47
|
-
className: "".concat(DataConfigs.blockClass, "__group-preview")
|
57
|
+
className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
|
48
58
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
49
59
|
className: "".concat(DataConfigs.blockClass, "__condition-block ").concat(DataConfigs.blockClass, "__gap")
|
50
60
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
@@ -57,7 +67,7 @@ var ConditionPreview = function ConditionPreview(_ref) {
|
|
57
67
|
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__groupConnector"),
|
58
68
|
operator: DataConfigs.translateWithId('if')
|
59
69
|
}), getConditionSection()))), previewType == 'condition' && /*#__PURE__*/React__default["default"].createElement("div", {
|
60
|
-
className: "".concat(DataConfigs.blockClass, "__group-preview")
|
70
|
+
className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
|
61
71
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
62
72
|
className: "".concat(DataConfigs.blockClass, "__condition-block ").concat(DataConfigs.blockClass, "__gap")
|
63
73
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
@@ -11,7 +11,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
13
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
14
|
-
var checkForHoldingKey = require('./checkForHoldingKey.js');
|
15
14
|
var util = require('./util.js');
|
16
15
|
|
17
16
|
var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef) {
|
@@ -25,7 +24,7 @@ var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef) {
|
|
25
24
|
var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer) {
|
26
25
|
var _parentContainer$quer;
|
27
26
|
var key = evt.key;
|
28
|
-
var isHoldingShiftKey =
|
27
|
+
var isHoldingShiftKey = util.checkForHoldingKey(evt, 'shiftKey');
|
29
28
|
var isMultiSelect = (_parentContainer$quer = parentContainer.querySelector('ul')) === null || _parentContainer$quer === void 0 ? void 0 : _parentContainer$quer.dataset.multiSelect;
|
30
29
|
var allItems = [];
|
31
30
|
switch (key) {
|
@@ -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;
|
@@ -45,7 +45,24 @@ var traverseReverse = function traverseReverse(eachElem, index, allElements, rot
|
|
45
45
|
focusThisItem(allElements[allElements.length - 1]);
|
46
46
|
}
|
47
47
|
};
|
48
|
+
var checkForHoldingKey = function checkForHoldingKey(evt, key) {
|
49
|
+
// possible key inputs: altKey,ctrlKey,metaKey,shiftKey
|
50
|
+
if (key === 'cmd') {
|
51
|
+
return evt.metaKey || evt.ctrlKey;
|
52
|
+
}
|
53
|
+
return evt[key];
|
54
|
+
};
|
55
|
+
var checkDuplicateAction = function checkDuplicateAction(actionState, selectedId, currentActionId) {
|
56
|
+
if (selectedId !== currentActionId && actionState.find(function (eachAction) {
|
57
|
+
return eachAction.id === selectedId;
|
58
|
+
})) {
|
59
|
+
return true;
|
60
|
+
}
|
61
|
+
return false;
|
62
|
+
};
|
48
63
|
|
64
|
+
exports.checkDuplicateAction = checkDuplicateAction;
|
65
|
+
exports.checkForHoldingKey = checkForHoldingKey;
|
49
66
|
exports.focusThisField = focusThisField;
|
50
67
|
exports.focusThisItem = focusThisItem;
|
51
68
|
exports.traverseClockVise = traverseClockVise;
|
@@ -220,9 +220,12 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
220
220
|
}
|
221
221
|
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)) {
|
222
222
|
if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) !== 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) !== 'header') {
|
223
|
-
var _activeCellFullData$r;
|
224
223
|
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;
|
225
|
-
|
224
|
+
if (activeCellFullData) {
|
225
|
+
setActiveCellContent(activeCellFullData.render('Cell'));
|
226
|
+
} else {
|
227
|
+
setActiveCellContent(null);
|
228
|
+
}
|
226
229
|
}
|
227
230
|
if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
|
228
231
|
setActiveCellContent(null);
|
@@ -437,8 +440,8 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
437
440
|
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;
|
438
441
|
var activeCellValue;
|
439
442
|
if (activeCellFullData && activeCellCoordinates !== null && activeCellCoordinates !== void 0 && activeCellCoordinates.column) {
|
440
|
-
var _activeCellFullData$
|
441
|
-
activeCellValue = activeCellFullData ? (_activeCellFullData$
|
443
|
+
var _activeCellFullData$r;
|
444
|
+
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;
|
442
445
|
}
|
443
446
|
setCellEditorValue(activeCellValue || '');
|
444
447
|
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
@@ -705,9 +708,11 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
705
708
|
updateData: updateData
|
706
709
|
}),
|
707
710
|
onChange: function onChange(event) {
|
708
|
-
|
709
|
-
|
710
|
-
cellEditorRulerRef.current
|
711
|
+
if (previousState.isEditing) {
|
712
|
+
setCellEditorValue(event.target.value);
|
713
|
+
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
714
|
+
cellEditorRulerRef.current.textContent = event.target.value;
|
715
|
+
}
|
711
716
|
}
|
712
717
|
},
|
713
718
|
ref: cellEditorRef,
|
@@ -44,9 +44,12 @@ var useSpreadsheetMouseMove = function useSpreadsheetMouseMove(_ref) {
|
|
44
44
|
var totalSpreadsheetScrollingWidth = listContainer.scrollWidth;
|
45
45
|
var clonedSelectionWidth = clonedSelectionElement.offsetWidth;
|
46
46
|
var clonePlacement = Math.max(xPositionRelativeToSpreadsheet - offsetXValue, defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth);
|
47
|
+
var leftPosition = totalSpreadsheetScrollingWidth - clonedSelectionWidth >= clonePlacement ? clonePlacement + scrollAmount : totalSpreadsheetScrollingWidth - clonedSelectionWidth;
|
47
48
|
// Moves the position of the cloned selection area to follow mouse, and
|
48
49
|
// add the amount horizontally scrolled
|
49
|
-
|
50
|
+
if (leftPosition < spreadsheetCoords.right - 40) {
|
51
|
+
clonedSelectionElement.style.left = layout.px(leftPosition);
|
52
|
+
}
|
50
53
|
};
|
51
54
|
if (headerCellHoldActive) {
|
52
55
|
ref.current.addEventListener('mousemove', handleMouseMove);
|
@@ -26,11 +26,43 @@ var moveColumnIndicatorLine = function moveColumnIndicatorLine(_ref) {
|
|
26
26
|
var indicatorLineElement = ref.current.querySelector(".".concat(blockClass, "__reorder-indicator-line"));
|
27
27
|
var matcherId = clonedSelectionElement === null || clonedSelectionElement === void 0 ? void 0 : clonedSelectionElement.getAttribute('data-matcher-id');
|
28
28
|
var selectionAreaOrigin = ref.current.querySelector("[data-matcher-id=\"".concat(matcherId, "\"]"));
|
29
|
+
var listContainer = ref.current.querySelector(".".concat(blockClass, "__list--container"));
|
30
|
+
var scrollSpeed = 10; // Scrolling speed
|
31
|
+
var leftEdgeThreshold = 120; // Distance from the left edge to start scrolling
|
32
|
+
var rightEdgeThreshold = 100; // Distance from the right edge to start scrolling
|
33
|
+
|
34
|
+
var _event = event,
|
35
|
+
clientX = _event.clientX;
|
36
|
+
var _listContainer$getBou = listContainer.getBoundingClientRect(),
|
37
|
+
left = _listContainer$getBou.left,
|
38
|
+
right = _listContainer$getBou.right;
|
39
|
+
|
40
|
+
// Is near left side of viewport
|
41
|
+
if (clientX < leftEdgeThreshold) {
|
42
|
+
window.scrollBy(-scrollSpeed, 0);
|
43
|
+
}
|
44
|
+
|
45
|
+
// Is near right side of viewport
|
46
|
+
if (clientX > window.innerWidth - rightEdgeThreshold) {
|
47
|
+
window.scrollBy(scrollSpeed, 0);
|
48
|
+
}
|
49
|
+
|
50
|
+
// Is near left edge of table
|
51
|
+
if (clientX > left && clientX < left + leftEdgeThreshold) {
|
52
|
+
listContainer.scrollBy(-scrollSpeed, 0);
|
53
|
+
}
|
54
|
+
|
55
|
+
// Is near right edge of table
|
56
|
+
if (clientX < right && clientX > right - rightEdgeThreshold) {
|
57
|
+
listContainer.scrollBy(scrollSpeed, 0);
|
58
|
+
}
|
29
59
|
if (Number(newColumnIndex) > Number(originalColumnIndex)) {
|
30
|
-
|
60
|
+
var leftPosition = closestCellCoords.left - spreadsheetCoords.left + closestCell.offsetWidth - 2 + leftScrollAmount;
|
61
|
+
indicatorLineElement.style.left = layout.px(leftPosition);
|
31
62
|
}
|
32
63
|
if (Number(newColumnIndex) < Number(originalColumnIndex)) {
|
33
|
-
|
64
|
+
var _leftPosition = closestCellCoords.left - spreadsheetCoords.left + leftScrollAmount;
|
65
|
+
indicatorLineElement.style.left = layout.px(_leftPosition);
|
34
66
|
}
|
35
67
|
if (Number(newColumnIndex) === Number(originalColumnIndex)) {
|
36
68
|
indicatorLineElement.style.left = selectionAreaOrigin.style.left;
|
@@ -55,7 +55,8 @@ exports.Datagrid = /*#__PURE__*/React__default["default"].forwardRef(function (_
|
|
55
55
|
};
|
56
56
|
return /*#__PURE__*/React__default["default"].createElement(FilterProvider.FilterProvider, {
|
57
57
|
filters: state === null || state === void 0 ? void 0 : state.filters,
|
58
|
-
filterProps: filterProps
|
58
|
+
filterProps: filterProps,
|
59
|
+
tableId: tableId
|
59
60
|
}, /*#__PURE__*/React__default["default"].createElement(InlineEditContext.InlineEditProvider, null, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
60
61
|
id: tableId,
|
61
62
|
ref: ref,
|
@@ -167,7 +167,7 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
167
167
|
className: "".concat(blockClass, "__filter-summary"),
|
168
168
|
filters: filterTags,
|
169
169
|
clearFilters: function clearFilters() {
|
170
|
-
return EventEmitter.dispatch(constants.CLEAR_FILTERS);
|
170
|
+
return EventEmitter.dispatch(constants.CLEAR_FILTERS, tableId);
|
171
171
|
},
|
172
172
|
renderLabel: filterProps === null || filterProps === void 0 ? void 0 : filterProps.renderLabel,
|
173
173
|
overflowType: "tag"
|
@@ -99,7 +99,8 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
99
99
|
var resizerAriaLabel = datagridState.resizerAriaLabel,
|
100
100
|
isTableSortable = datagridState.isTableSortable,
|
101
101
|
rows = datagridState.rows,
|
102
|
-
isFetching = datagridState.isFetching
|
102
|
+
isFetching = datagridState.isFetching,
|
103
|
+
headers = datagridState.headers;
|
103
104
|
useInitialColumnSort.useInitialColumnSort(datagridState);
|
104
105
|
// Used to measure the height of the table and uses that value
|
105
106
|
// to display a vertical line to indicate the column you are resizing
|
@@ -161,6 +162,9 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
161
162
|
});
|
162
163
|
var key = headerGroupProps.key,
|
163
164
|
rowProps = _rollupPluginBabelHelpers.objectWithoutProperties(headerGroupProps, _excluded2);
|
165
|
+
var withActionsColumn = headers ? !!headers.filter(function (header) {
|
166
|
+
return header.isAction;
|
167
|
+
}).length : false;
|
164
168
|
return /*#__PURE__*/React__default["default"].createElement(react.TableRow, _rollupPluginBabelHelpers["extends"]({
|
165
169
|
key: key
|
166
170
|
}, rowProps, {
|
@@ -193,6 +197,12 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
193
197
|
var _header$getHeaderProp = header.getHeaderProps(),
|
194
198
|
headerProps = _rollupPluginBabelHelpers["extends"]({}, (_rollupPluginBabelHelpers.objectDestructuringEmpty(_header$getHeaderProp), _header$getHeaderProp));
|
195
199
|
var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
|
200
|
+
var headerStyle = headerProps === null || headerProps === void 0 ? void 0 : headerProps.style;
|
201
|
+
var lastVisibleIndex = withActionsColumn ? 2 : 1;
|
202
|
+
var lastVisibleFlexStyle = index === visibleColumns.length - lastVisibleIndex ? '1 1 0' : '0 0 auto';
|
203
|
+
if (headerStyle) {
|
204
|
+
headerStyle.flex = lastVisibleFlexStyle;
|
205
|
+
}
|
196
206
|
return /*#__PURE__*/React__default["default"].createElement(react.TableHeader, _rollupPluginBabelHelpers["extends"]({}, headerProps, {
|
197
207
|
className: cx__default["default"](header === null || header === void 0 ? void 0 : header.className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.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["default"].isValidElement(header === null || header === void 0 ? void 0 : header.slug)), headerProps.className),
|
198
208
|
key: header.id,
|