@carbon/ibm-products 2.42.1-canary.27 → 2.42.1-canary.4
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +9 -302
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon.css +9 -302
- 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 +9 -302
- 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.d.ts +0 -6
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +33 -74
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +1 -15
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +12 -95
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +2 -11
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +9 -27
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +0 -5
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +14 -95
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +0 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +0 -7
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +1 -8
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
- package/es/components/ConditionBuilder/{ConditionBuilderConnector → ConditionConnector}/ConditionConnector.js +33 -38
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +67 -197
- package/es/components/ConditionBuilder/utils/util.d.ts +0 -1
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +4 -7
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +1 -7
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +0 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +3 -13
- package/es/components/Datagrid/types/index.d.ts +0 -2
- package/es/components/Datagrid/useColumnOrder.d.ts +1 -7
- package/es/components/Datagrid/useFiltering.d.ts +1 -8
- package/es/components/Datagrid/useFiltering.js +7 -8
- package/es/components/Datagrid/useFlexResize.d.ts +1 -1
- package/es/components/Datagrid/useFlexResize.js +11 -11
- package/es/components/Datagrid/useNestedRows.js +2 -24
- package/es/components/Datagrid/useOnRowClick.d.ts +1 -8
- package/es/components/Datagrid/useOnRowClick.js +1 -2
- package/es/components/Datagrid/useRowIsMouseOver.d.ts +1 -2
- package/es/components/Datagrid/useRowIsMouseOver.js +1 -1
- package/es/components/Datagrid/useSelectRows.d.ts +1 -8
- package/es/components/Datagrid/useSelectRows.js +2 -3
- package/es/components/Datagrid/useSortableColumns.d.ts +3 -10
- package/es/components/Datagrid/useSortableColumns.js +2 -3
- package/es/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +1 -8
- package/es/components/Datagrid/utils/getAutoSizedColumnWidth.js +7 -0
- package/es/components/SidePanel/SidePanel.d.ts +2 -2
- package/es/components/SidePanel/SidePanel.js +5 -9
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +0 -6
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +32 -73
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +1 -15
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +9 -92
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +2 -11
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +8 -26
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +0 -5
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +11 -92
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +0 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +0 -7
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +1 -8
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
- package/lib/components/ConditionBuilder/{ConditionBuilderConnector → ConditionConnector}/ConditionConnector.js +31 -36
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +64 -195
- package/lib/components/ConditionBuilder/utils/util.d.ts +0 -1
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +4 -7
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +1 -7
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +0 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +3 -13
- package/lib/components/Datagrid/types/index.d.ts +0 -2
- package/lib/components/Datagrid/useColumnOrder.d.ts +1 -7
- package/lib/components/Datagrid/useFiltering.d.ts +1 -8
- package/lib/components/Datagrid/useFiltering.js +7 -8
- package/lib/components/Datagrid/useFlexResize.d.ts +1 -1
- package/lib/components/Datagrid/useFlexResize.js +11 -11
- package/lib/components/Datagrid/useNestedRows.js +2 -24
- package/lib/components/Datagrid/useOnRowClick.d.ts +1 -8
- package/lib/components/Datagrid/useOnRowClick.js +1 -2
- package/lib/components/Datagrid/useRowIsMouseOver.d.ts +1 -2
- package/lib/components/Datagrid/useRowIsMouseOver.js +1 -1
- package/lib/components/Datagrid/useSelectRows.d.ts +1 -8
- package/lib/components/Datagrid/useSelectRows.js +2 -3
- package/lib/components/Datagrid/useSortableColumns.d.ts +3 -10
- package/lib/components/Datagrid/useSortableColumns.js +2 -3
- package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +1 -8
- package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.js +7 -0
- package/lib/components/SidePanel/SidePanel.d.ts +2 -2
- package/lib/components/SidePanel/SidePanel.js +5 -9
- package/package.json +3 -3
- package/scss/components/ConditionBuilder/_condition-builder.scss +1 -21
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +3 -22
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +21 -58
- package/telemetry.yml +0 -23
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.d.ts +0 -2
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +0 -44
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +0 -10
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +0 -69
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.d.ts +0 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +0 -52
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +0 -10
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +0 -77
- /package/es/components/ConditionBuilder/{ConditionBuilderConnector → ConditionConnector}/ConditionConnector.d.ts +0 -0
- /package/lib/components/ConditionBuilder/{ConditionBuilderConnector → ConditionConnector}/ConditionConnector.d.ts +0 -0
@@ -17,12 +17,9 @@ export namespace translationsObject {
|
|
17
17
|
after: string;
|
18
18
|
between: string;
|
19
19
|
'add-condition': string;
|
20
|
-
'add-condition-group': string;
|
21
|
-
'add-condition-sub-group': string;
|
22
20
|
condition: string;
|
23
21
|
property: string;
|
24
22
|
operator: string;
|
25
|
-
value: string;
|
26
23
|
connector: string;
|
27
24
|
condition_row: string;
|
28
25
|
remove_condition: string;
|
@@ -30,9 +27,5 @@ export namespace translationsObject {
|
|
30
27
|
start: string;
|
31
28
|
end: string;
|
32
29
|
clear_search: string;
|
33
|
-
actions: string;
|
34
|
-
then: string;
|
35
|
-
remove_action: string;
|
36
|
-
add_action: string;
|
37
30
|
};
|
38
31
|
}
|
@@ -24,23 +24,16 @@ var translationsObject = {
|
|
24
24
|
after: 'is after',
|
25
25
|
between: 'is between',
|
26
26
|
'add-condition': 'Add Condition',
|
27
|
-
'add-condition-group': 'Add Condition Group',
|
28
|
-
'add-condition-sub-group': 'Add Condition sub group',
|
29
27
|
condition: 'Condition',
|
30
28
|
property: 'Property',
|
31
29
|
operator: 'Operator',
|
32
|
-
value: 'Value',
|
33
30
|
connector: 'Connector',
|
34
31
|
condition_row: 'Condition row',
|
35
32
|
remove_condition: 'Remove condition',
|
36
33
|
add_condition_row: 'Add condition row',
|
37
34
|
start: 'Start',
|
38
35
|
end: 'End',
|
39
|
-
clear_search: 'Clear search input'
|
40
|
-
actions: 'Actions',
|
41
|
-
then: 'then',
|
42
|
-
remove_action: 'Remove Action',
|
43
|
-
add_action: 'Add action'
|
36
|
+
clear_search: 'Clear search input'
|
44
37
|
}
|
45
38
|
};
|
46
39
|
|
@@ -87,7 +87,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
87
87
|
label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : translateWithId('add-condition'),
|
88
88
|
hideLabel: !label ? true : false,
|
89
89
|
onClick: function onClick() {
|
90
|
-
|
90
|
+
setOpen(!open);
|
91
91
|
},
|
92
92
|
className: className,
|
93
93
|
"aria-haspopup": true,
|
@@ -6,22 +6,21 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default, {
|
9
|
+
import React__default, { useCallback } from 'react';
|
10
10
|
import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
|
11
11
|
import { ConditionBuilderItemOption } from '../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js';
|
12
|
-
import {
|
12
|
+
import { translateWithId, connectorConfig } from '../ConditionBuilderContext/DataConfigs.js';
|
13
|
+
import { pkg } from '../../../settings.js';
|
13
14
|
import PropTypes from '../../../node_modules/prop-types/index.js';
|
14
15
|
import { focusThisField } from '../utils/util.js';
|
15
|
-
import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
|
16
16
|
|
17
17
|
var _excluded = ["operator", "className", "onChange"];
|
18
|
-
var
|
18
|
+
var blockClass = "".concat(pkg.prefix, "--condition-builder");
|
19
|
+
function ConditionConnector(_ref) {
|
19
20
|
var operator = _ref.operator,
|
20
21
|
className = _ref.className,
|
21
22
|
onChange = _ref.onChange,
|
22
23
|
rest = _objectWithoutProperties(_ref, _excluded);
|
23
|
-
var _useContext = useContext(ConditionBuilderContext),
|
24
|
-
variant = _useContext.variant;
|
25
24
|
var handleConnectorHover = useCallback(function (parentGroup, isHover) {
|
26
25
|
if (isHover) {
|
27
26
|
parentGroup.classList.add('hoveredConnector');
|
@@ -41,37 +40,33 @@ var ConditionConnector = function ConditionConnector(_ref) {
|
|
41
40
|
onChange(op);
|
42
41
|
focusThisField(evt);
|
43
42
|
};
|
44
|
-
return
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
}
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
// </div>
|
72
|
-
;
|
73
|
-
};
|
74
|
-
var ConditionConnector$1 = ConditionConnector;
|
43
|
+
return (
|
44
|
+
/*#__PURE__*/
|
45
|
+
// <div className={className} {...rest}>
|
46
|
+
React__default.createElement(ConditionBuilderItem, _extends({
|
47
|
+
label: operator,
|
48
|
+
title: translateWithId('connector'),
|
49
|
+
"data-name": "connectorField",
|
50
|
+
onMouseEnter: activeConnectorHandler,
|
51
|
+
onMouseLeave: inActiveConnectorHandler,
|
52
|
+
onFocus: activeConnectorHandler,
|
53
|
+
onBlur: inActiveConnectorHandler
|
54
|
+
}, rest, {
|
55
|
+
popOverClassName: className,
|
56
|
+
className: "".concat(blockClass, "__connector-button ")
|
57
|
+
}), /*#__PURE__*/React__default.createElement(ConditionBuilderItemOption, {
|
58
|
+
config: {
|
59
|
+
options: connectorConfig
|
60
|
+
},
|
61
|
+
conditionState: {
|
62
|
+
value: operator,
|
63
|
+
label: translateWithId('connector')
|
64
|
+
},
|
65
|
+
onChange: onChangeHandler
|
66
|
+
}))
|
67
|
+
// </div>
|
68
|
+
);
|
69
|
+
}
|
75
70
|
ConditionConnector.propTypes = {
|
76
71
|
/**
|
77
72
|
* Provide an optional class to be applied to the containing node.
|
@@ -87,4 +82,4 @@ ConditionConnector.propTypes = {
|
|
87
82
|
operator: PropTypes.string
|
88
83
|
};
|
89
84
|
|
90
|
-
export { ConditionConnector
|
85
|
+
export { ConditionConnector as default };
|
@@ -5,21 +5,12 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import {
|
9
|
-
import React__default
|
8
|
+
import { objectSpread2 as _objectSpread2, toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default from 'react';
|
10
10
|
import ConditionBlock from '../ConditionBlock/ConditionBlock.js';
|
11
11
|
import PropTypes from '../../../node_modules/prop-types/index.js';
|
12
|
-
import
|
13
|
-
import { blockClass, translateWithId, statementConfig } from '../ConditionBuilderContext/DataConfigs.js';
|
14
|
-
import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
|
15
|
-
import { ConditionBuilderItemOption } from '../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js';
|
16
|
-
import { focusThisField } from '../utils/util.js';
|
17
|
-
import ConditionConnector from '../ConditionBuilderConnector/ConditionConnector.js';
|
18
|
-
import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
|
12
|
+
import { blockClass, translateWithId } from '../ConditionBuilderContext/DataConfigs.js';
|
19
13
|
import uuidv4 from '../../../global/js/utils/uuidv4.js';
|
20
|
-
import ConditionPreview from '../ConditionPreview/ConditionPreview.js';
|
21
|
-
|
22
|
-
var _ConditionPreview, _ConditionPreview2;
|
23
14
|
|
24
15
|
/**
|
25
16
|
*
|
@@ -27,24 +18,14 @@ var _ConditionPreview, _ConditionPreview2;
|
|
27
18
|
* All the inner components of group are called from here.
|
28
19
|
* @returns
|
29
20
|
*/
|
30
|
-
|
31
21
|
var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
22
|
+
var _group$conditions;
|
32
23
|
var group = _ref.group,
|
33
24
|
aria = _ref.aria,
|
34
25
|
onRemove = _ref.onRemove,
|
35
26
|
onChange = _ref.onChange,
|
36
27
|
conditionBuilderRef = _ref.conditionBuilderRef,
|
37
28
|
className = _ref.className;
|
38
|
-
var _useContext = useContext(ConditionBuilderContext),
|
39
|
-
variant = _useContext.variant;
|
40
|
-
var _useState = useState(-1),
|
41
|
-
_useState2 = _slicedToArray(_useState, 2),
|
42
|
-
showConditionPreview = _useState2[0],
|
43
|
-
setShowConditionPreview = _useState2[1];
|
44
|
-
var _useState3 = useState(-1),
|
45
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
46
|
-
showConditionSubGroupPreview = _useState4[0],
|
47
|
-
setShowConditionSubGroupPreview = _useState4[1];
|
48
29
|
var onRemoveHandler = function onRemoveHandler(conditionId, evt) {
|
49
30
|
if (group.conditions.length > 1) {
|
50
31
|
onChange(_objectSpread2(_objectSpread2({}, group), {}, {
|
@@ -75,183 +56,72 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
75
56
|
conditions: [].concat(_toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [newCondition], _toConsumableArray(group.conditions.slice(conditionIndex + 1)))
|
76
57
|
}));
|
77
58
|
};
|
78
|
-
var handleFocusOnClose = function handleFocusOnClose(e) {
|
79
|
-
var _e$currentTarget;
|
80
|
-
var previousClose = (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.closest('[role="row"]')) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.previousSibling) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.querySelector('[data-name="closeCondition"]');
|
81
|
-
if (previousClose) {
|
82
|
-
previousClose.focus();
|
83
|
-
}
|
84
|
-
};
|
85
|
-
var addConditionSubGroupHandler = function addConditionSubGroupHandler(conditionIndex) {
|
86
|
-
onChange(_objectSpread2(_objectSpread2({}, group), {}, {
|
87
|
-
conditions: [].concat(_toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [{
|
88
|
-
groupSeparateOperator: null,
|
89
|
-
groupOperator: 'and',
|
90
|
-
statement: 'if',
|
91
|
-
conditions: [{
|
92
|
-
property: undefined,
|
93
|
-
operator: '',
|
94
|
-
value: '',
|
95
|
-
popoverToOpen: 'propertyField',
|
96
|
-
id: uuidv4()
|
97
|
-
}],
|
98
|
-
id: uuidv4()
|
99
|
-
}], _toConsumableArray(group.conditions.slice(conditionIndex + 1)))
|
100
|
-
}));
|
101
|
-
};
|
102
59
|
var isLastCondition = function isLastCondition(conditionIndex, conditionArr) {
|
103
60
|
return conditionIndex + 1 >= conditionArr.length || conditionArr.length - 1 != conditionIndex && conditionArr[conditionIndex + 1].conditions;
|
104
61
|
};
|
105
|
-
var
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
var _showConditionPreviewHandler = function showConditionPreviewHandler(conditionIndex) {
|
112
|
-
setShowConditionPreview(conditionIndex);
|
113
|
-
};
|
114
|
-
var hideConditionPreviewHandler = function hideConditionPreviewHandler() {
|
115
|
-
setShowConditionPreview(-1);
|
116
|
-
};
|
117
|
-
var onStatementChangeHandler = function onStatementChangeHandler(updatedStatement) {
|
118
|
-
onChange(_objectSpread2(_objectSpread2({}, group), {}, {
|
119
|
-
statement: updatedStatement
|
120
|
-
}));
|
121
|
-
};
|
122
|
-
var onConnectorOperatorChange = function onConnectorOperatorChange(op) {
|
123
|
-
onChange(_objectSpread2(_objectSpread2({}, group), {}, {
|
124
|
-
groupOperator: op
|
125
|
-
}));
|
126
|
-
};
|
127
|
-
var getSentenceVariant = function getSentenceVariant() {
|
128
|
-
var _group$conditions;
|
129
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
130
|
-
className: "".concat(className, " eachGroup")
|
131
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
132
|
-
className: "".concat(blockClass, "__condition-wrapper"),
|
133
|
-
role: "grid",
|
134
|
-
"aria-label": translateWithId('condition_builder_group')
|
135
|
-
}, group === null || group === void 0 || (_group$conditions = group.conditions) === null || _group$conditions === void 0 ? void 0 : _group$conditions.map(function (eachCondition, conditionIndex) {
|
136
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
137
|
-
key: eachCondition.id,
|
138
|
-
className: "".concat(blockClass, "__group-wrapper")
|
139
|
-
}, /*#__PURE__*/React__default.createElement(ConditionBlock, {
|
140
|
-
conjunction: conditionIndex > 0 ? group.groupOperator : undefined,
|
141
|
-
aria: {
|
142
|
-
level: aria.level + 1,
|
143
|
-
posinset: conditionIndex + 1,
|
144
|
-
setsize: group.conditions.length
|
145
|
-
},
|
146
|
-
isStatement: conditionIndex == 0,
|
147
|
-
condition: eachCondition,
|
148
|
-
group: group,
|
149
|
-
conditionIndex: conditionIndex,
|
150
|
-
onChange: function onChange(updatedConditions) {
|
151
|
-
onChangeHandler(updatedConditions, conditionIndex);
|
152
|
-
},
|
153
|
-
addConditionHandler: addConditionHandler,
|
154
|
-
onRemove: function onRemove(e) {
|
155
|
-
onRemoveHandler(eachCondition.id, e);
|
156
|
-
},
|
157
|
-
onConnectorOperatorChange: onConnectorOperatorChange,
|
158
|
-
onStatementChange: onStatementChangeHandler,
|
159
|
-
isLastCondition: isLastCondition
|
160
|
-
}));
|
161
|
-
})));
|
62
|
+
var handleFocusOnClose = function handleFocusOnClose(evt) {
|
63
|
+
var _evt$currentTarget;
|
64
|
+
var previousClose = (_evt$currentTarget = evt.currentTarget) === null || _evt$currentTarget === void 0 || (_evt$currentTarget = _evt$currentTarget.closest('[role="row"]')) === null || _evt$currentTarget === void 0 || (_evt$currentTarget = _evt$currentTarget.parentElement) === null || _evt$currentTarget === void 0 || (_evt$currentTarget = _evt$currentTarget.previousSibling) === null || _evt$currentTarget === void 0 ? void 0 : _evt$currentTarget.querySelector('[data-name="closeCondition"]');
|
65
|
+
if (previousClose) {
|
66
|
+
previousClose.focus();
|
67
|
+
}
|
162
68
|
};
|
163
|
-
|
164
|
-
|
69
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
70
|
+
className: "".concat(className, " eachGroup")
|
71
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
72
|
+
className: "".concat(blockClass, "__condition-wrapper"),
|
73
|
+
role: "grid",
|
74
|
+
"aria-label": translateWithId('condition_builder_group')
|
75
|
+
}, group === null || group === void 0 || (_group$conditions = group.conditions) === null || _group$conditions === void 0 ? void 0 : _group$conditions.map(function (eachCondition, conditionIndex) {
|
165
76
|
return /*#__PURE__*/React__default.createElement("div", {
|
166
|
-
|
167
|
-
|
168
|
-
"
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
77
|
+
key: eachCondition.id
|
78
|
+
}, eachCondition.conditions && /*#__PURE__*/React__default.createElement(ConditionGroupBuilder, {
|
79
|
+
className: "".concat(blockClass, "__group"),
|
80
|
+
aria: {
|
81
|
+
level: aria.level + 1,
|
82
|
+
posinset: conditionIndex + 1,
|
83
|
+
setsize: group.conditions.length
|
84
|
+
},
|
85
|
+
group: eachCondition,
|
86
|
+
onChange: function onChange(updatedCondition) {
|
87
|
+
onChangeHandler(updatedCondition, conditionIndex);
|
88
|
+
},
|
89
|
+
onRemove: function onRemove(evt) {
|
90
|
+
onRemoveHandler(eachCondition.id, evt);
|
91
|
+
},
|
92
|
+
conditionBuilderRef: conditionBuilderRef
|
93
|
+
}), !eachCondition.conditions && /*#__PURE__*/React__default.createElement(ConditionBlock, {
|
94
|
+
conjunction: conditionIndex > 0 ? group.groupOperator : undefined,
|
95
|
+
aria: {
|
96
|
+
level: aria.level + 1,
|
97
|
+
posinset: conditionIndex + 1,
|
98
|
+
setsize: group.conditions.length
|
185
99
|
},
|
186
|
-
|
187
|
-
|
188
|
-
|
100
|
+
isStatement: conditionIndex == 0,
|
101
|
+
condition: eachCondition,
|
102
|
+
group: group,
|
103
|
+
conditionIndex: conditionIndex,
|
104
|
+
className: "".concat(blockClass, "__gap ").concat(blockClass, "__gap-bottom"),
|
105
|
+
onChange: function onChange(updatedConditions) {
|
106
|
+
onChangeHandler(updatedConditions, conditionIndex);
|
189
107
|
},
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
},
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
posinset: conditionIndex + 1,
|
206
|
-
setsize: group.conditions.length
|
207
|
-
},
|
208
|
-
className: "".concat(blockClass, "__group"),
|
209
|
-
group: eachCondition,
|
210
|
-
onChange: function onChange(updatedConditions) {
|
211
|
-
onChangeHandler(updatedConditions, conditionIndex);
|
212
|
-
},
|
213
|
-
onRemove: function onRemove(e) {
|
214
|
-
onRemoveHandler(eachCondition.id, e);
|
215
|
-
},
|
216
|
-
conditionBuilderRef: conditionBuilderRef
|
217
|
-
})) : /*#__PURE__*/React__default.createElement(ConditionBlock, {
|
218
|
-
conjunction: conditionIndex > 0 ? group.groupOperator : undefined,
|
219
|
-
aria: {
|
220
|
-
level: aria.level + 1,
|
221
|
-
posinset: conditionIndex + 1,
|
222
|
-
setsize: group.conditions.length
|
223
|
-
},
|
224
|
-
isStatement: false,
|
225
|
-
condition: eachCondition,
|
226
|
-
group: group,
|
227
|
-
conditionIndex: conditionIndex,
|
228
|
-
addConditionHandler: addConditionHandler,
|
229
|
-
addConditionSubGroupHandler: addConditionSubGroupHandler,
|
230
|
-
onChange: function onChange(updatedConditions) {
|
231
|
-
onChangeHandler(updatedConditions, conditionIndex);
|
232
|
-
},
|
233
|
-
onRemove: function onRemove(e) {
|
234
|
-
onRemoveHandler(eachCondition.id, e);
|
235
|
-
},
|
236
|
-
onConnectorOperatorChange: onConnectorOperatorChange,
|
237
|
-
onStatementChange: onStatementChangeHandler,
|
238
|
-
showConditionSubGroupPreviewHandler: function showConditionSubGroupPreviewHandler() {
|
239
|
-
_showConditionSubGroupPreviewHandler(conditionIndex);
|
240
|
-
},
|
241
|
-
hideConditionSubGroupPreviewHandler: hideConditionSubGroupPreviewHandler,
|
242
|
-
showConditionPreviewHandler: function showConditionPreviewHandler() {
|
243
|
-
_showConditionPreviewHandler(conditionIndex);
|
244
|
-
},
|
245
|
-
hideConditionPreviewHandler: hideConditionPreviewHandler,
|
246
|
-
isLastCondition: isLastCondition
|
247
|
-
}), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default.createElement(ConditionPreview, {
|
248
|
-
previewType: "subGroup"
|
249
|
-
}))), conditionIndex == showConditionPreview && (_ConditionPreview2 || (_ConditionPreview2 = /*#__PURE__*/React__default.createElement(ConditionPreview, {
|
250
|
-
previewType: "condition"
|
251
|
-
}))));
|
108
|
+
addConditionHandler: addConditionHandler,
|
109
|
+
onRemove: function onRemove(evt) {
|
110
|
+
onRemoveHandler(eachCondition.id, evt);
|
111
|
+
},
|
112
|
+
onConnectorOperatorChange: function onConnectorOperatorChange(op) {
|
113
|
+
onChange(_objectSpread2(_objectSpread2({}, group), {}, {
|
114
|
+
groupOperator: op
|
115
|
+
}));
|
116
|
+
},
|
117
|
+
onStatementChange: function onStatementChange(updatedStatement) {
|
118
|
+
onChange(_objectSpread2(_objectSpread2({}, group), {}, {
|
119
|
+
statement: updatedStatement
|
120
|
+
}));
|
121
|
+
},
|
122
|
+
isLastCondition: isLastCondition
|
252
123
|
}));
|
253
|
-
};
|
254
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, variant == 'tree' && getTreeVariant(), variant == 'sentence' && getSentenceVariant());
|
124
|
+
})));
|
255
125
|
};
|
256
126
|
var ConditionGroupBuilder$1 = ConditionGroupBuilder;
|
257
127
|
ConditionGroupBuilder.propTypes = {
|
@@ -260,19 +130,19 @@ ConditionGroupBuilder.propTypes = {
|
|
260
130
|
*/
|
261
131
|
aria: PropTypes.object,
|
262
132
|
/**
|
263
|
-
*
|
264
|
-
*/
|
265
|
-
/**
|
266
|
-
* Provide an optional class to be applied to the containing node.
|
133
|
+
* Provide an class to be applied to the containing node.
|
267
134
|
*/
|
268
135
|
className: PropTypes.string,
|
269
136
|
/**
|
270
|
-
className: PropTypes.string,
|
271
137
|
* ref of condition builder
|
272
138
|
*/
|
273
139
|
conditionBuilderRef: PropTypes.object,
|
140
|
+
/**
|
141
|
+
* group defines the current group
|
142
|
+
*/
|
274
143
|
group: PropTypes.object,
|
275
144
|
/**
|
145
|
+
|
276
146
|
* callback to update the current condition of the state tree
|
277
147
|
*/
|
278
148
|
onChange: PropTypes.func,
|
@@ -2,4 +2,3 @@ export function focusThisField(evt: any): void;
|
|
2
2
|
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
|
-
export function checkForHoldingKey(evt: any, key: any): any;
|
@@ -185,7 +185,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
185
185
|
headerProps = _extends({}, (_objectDestructuringEmpty(_header$getHeaderProp), _header$getHeaderProp));
|
186
186
|
var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
|
187
187
|
return /*#__PURE__*/React__default.createElement(TableHeader, _extends({}, headerProps, {
|
188
|
-
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))
|
188
|
+
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))),
|
189
189
|
key: header.id,
|
190
190
|
"aria-hidden": header.id === 'spacer' && 'true'
|
191
191
|
}, getAccessibilityProps(header)), header.render('Header'), renderSlug(header.slug), resizerProps && !header.isAction && /*#__PURE__*/React__default.createElement(ResizeHeader, {
|
@@ -11,6 +11,7 @@ import { VariableSizeList } from 'react-window';
|
|
11
11
|
import { TableBody } from '@carbon/react';
|
12
12
|
import { pkg } from '../../../settings.js';
|
13
13
|
import DatagridHead from './DatagridHead.js';
|
14
|
+
import { px } from '@carbon/layout';
|
14
15
|
import { useResizeObserver } from '../../../global/js/hooks/useResizeObserver.js';
|
15
16
|
|
16
17
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
@@ -71,6 +72,10 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
71
72
|
if (headWrapEl) {
|
72
73
|
headWrapEl.scrollLeft = virtualBody === null || virtualBody === void 0 ? void 0 : virtualBody.scrollLeft;
|
73
74
|
}
|
75
|
+
var spacerColumn = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap thead th:last-child"));
|
76
|
+
if (spacerColumn) {
|
77
|
+
spacerColumn.style.width = px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
|
78
|
+
}
|
74
79
|
}
|
75
80
|
var testRefValue = testRef === null || testRef === void 0 ? void 0 : testRef.current;
|
76
81
|
testRefValue === null || testRefValue === void 0 || testRefValue.addEventListener('scroll', handleScroll);
|
package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js
CHANGED
@@ -74,7 +74,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
74
74
|
};
|
75
75
|
var onCheckboxCheck = function onCheckboxCheck(col, value) {
|
76
76
|
var changedDefinitions = columnObjects.map(function (definition) {
|
77
|
-
if (
|
77
|
+
if (Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) {
|
78
78
|
return _objectSpread2(_objectSpread2({}, definition), {}, {
|
79
79
|
isVisible: value
|
80
80
|
});
|
@@ -98,12 +98,9 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
98
98
|
useEffect(function () {
|
99
99
|
var notFilterableCount = columnObjects.filter(function (col) {
|
100
100
|
return !col.canFilter;
|
101
|
-
})
|
102
|
-
|
103
|
-
|
104
|
-
}).length;
|
105
|
-
setVisibleColumnsCount(getVisibleColumnsCount() - notFilterableCount - actionCount);
|
106
|
-
setTotalColumns(columnObjects.length - notFilterableCount - actionCount);
|
101
|
+
});
|
102
|
+
setVisibleColumnsCount(getVisibleColumnsCount() - notFilterableCount.length);
|
103
|
+
setTotalColumns(columnObjects.length - notFilterableCount.length);
|
107
104
|
}, [getVisibleColumnsCount, columnObjects]);
|
108
105
|
return /*#__PURE__*/React__default.createElement(TearsheetNarrow, {
|
109
106
|
className: "".concat(blockClass, "__customize-columns-tearsheet"),
|
@@ -1,8 +1,2 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright IBM Corp. 2023, 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
|
-
declare const useFilterContext: () => any;
|
8
1
|
export default useFilterContext;
|
2
|
+
declare function useFilterContext(): any;
|
package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts
CHANGED
@@ -20,7 +20,6 @@ export namespace InlineEditCell {
|
|
20
20
|
rows: PropTypes.Requireable<(object | null | undefined)[]>;
|
21
21
|
rowSize: PropTypes.Requireable<string>;
|
22
22
|
tableId: PropTypes.Requireable<string>;
|
23
|
-
cellEditing: PropTypes.Requireable<object>;
|
24
23
|
}>>;
|
25
24
|
let nonEditCell: PropTypes.Requireable<boolean>;
|
26
25
|
let placeholder: PropTypes.Requireable<string>;
|
@@ -36,8 +36,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
36
36
|
var columnIndex = instance.columns.findIndex(function (col) {
|
37
37
|
return col.id === columnId;
|
38
38
|
});
|
39
|
-
var
|
40
|
-
var cellId = "column-".concat(columnIndex, "-row-").concat(rowIndex);
|
39
|
+
var cellId = "column-".concat(columnIndex, "-row-").concat(cell.row.index);
|
41
40
|
var _useContext = useContext(InlineEditContext),
|
42
41
|
state = _useContext.state,
|
43
42
|
dispatch = _useContext.dispatch;
|
@@ -73,14 +72,6 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
73
72
|
var rowSize = instance.rowSize,
|
74
73
|
onDataUpdate = instance.onDataUpdate;
|
75
74
|
var saveCellData;
|
76
|
-
if (inEditMode) {
|
77
|
-
instance.cellEditing = {
|
78
|
-
cellId: cellId,
|
79
|
-
columnIndex: columnIndex,
|
80
|
-
rowIndex: rowIndex,
|
81
|
-
curCellValue: cellValue
|
82
|
-
};
|
83
|
-
}
|
84
75
|
useEffect(function () {
|
85
76
|
setInitialValue(value);
|
86
77
|
var columnId = cell.column.id;
|
@@ -454,7 +445,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
454
445
|
"data-inline-type": type,
|
455
446
|
onClick: !nonEditCell ? handleInlineCellClick : addActiveState,
|
456
447
|
onKeyDown: !nonEditCell ? handleKeyDown : null,
|
457
|
-
className: cx("".concat(blockClass, "__inline-edit--outer-cell-button"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"),
|
448
|
+
className: cx("".concat(blockClass, "__inline-edit--outer-cell-button"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"), config === null || config === void 0 || (_config$validator = config.validator) === null || _config$validator === void 0 ? void 0 : _config$validator.call(config, cellValue)), "".concat(blockClass, "__static--outer-cell"), !disabledCell))
|
458
449
|
}, !nonEditCell && !disabledCell && renderRegularCell(), (!inEditMode || disabledCell) && /*#__PURE__*/React__default.createElement(InlineEditButton, {
|
459
450
|
isActiveCell: cellId === activeCellId,
|
460
451
|
renderIcon: setRenderIcon(),
|
@@ -478,8 +469,7 @@ InlineEditCell.propTypes = {
|
|
478
469
|
onDataUpdate: PropTypes.func,
|
479
470
|
rows: PropTypes.arrayOf(PropTypes.object),
|
480
471
|
rowSize: PropTypes.string,
|
481
|
-
tableId: PropTypes.string
|
482
|
-
cellEditing: PropTypes.object
|
472
|
+
tableId: PropTypes.string
|
483
473
|
}),
|
484
474
|
nonEditCell: PropTypes.bool,
|
485
475
|
placeholder: PropTypes.string,
|
@@ -192,8 +192,6 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
|
|
192
192
|
onVirtualScroll?: (evt?: boolean) => void;
|
193
193
|
fetchMoreData?: () => void;
|
194
194
|
loadMoreThreshold?: number;
|
195
|
-
onRowClick?: (row: any, event: any) => void;
|
196
|
-
onSort?: boolean;
|
197
195
|
}
|
198
196
|
export interface ResizeHeaderProps {
|
199
197
|
resizerProps?: ResizerProps;
|