@carbon/ibm-products 2.42.1-canary.2 → 2.42.1-canary.22
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +302 -9
- 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 +302 -9
- 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 +302 -9
- 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/Carousel/Carousel.d.ts +1 -1
- package/es/components/Carousel/Carousel.js +1 -1
- package/es/components/Coachmark/CoachmarkDragbar.d.ts +1 -1
- package/es/components/Coachmark/CoachmarkDragbar.js +1 -1
- package/es/components/Coachmark/CoachmarkHeader.d.ts +1 -1
- package/es/components/Coachmark/CoachmarkHeader.js +1 -1
- package/es/components/Coachmark/CoachmarkOverlay.d.ts +1 -1
- package/es/components/Coachmark/CoachmarkOverlay.js +1 -1
- package/es/components/Coachmark/CoachmarkTagline.d.ts +1 -1
- package/es/components/Coachmark/CoachmarkTagline.js +1 -1
- package/es/components/CoachmarkStack/CoachmarkStackHome.d.ts +1 -1
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +2 -2
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +6 -0
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +74 -33
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +15 -1
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +95 -12
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +11 -2
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +27 -9
- package/es/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.js +38 -33
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.d.ts +2 -0
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +44 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +5 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +95 -14
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +1 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +7 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +8 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +197 -67
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +10 -0
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +69 -0
- package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -4
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +7 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +13 -3
- package/es/components/Datagrid/types/index.d.ts +2 -0
- package/es/components/Datagrid/useColumnOrder.d.ts +7 -1
- package/es/components/Datagrid/useNestedRows.js +24 -2
- package/es/components/Datagrid/useOnRowClick.d.ts +8 -1
- package/es/components/Datagrid/useOnRowClick.js +2 -1
- package/es/components/Datagrid/useRowIsMouseOver.d.ts +2 -1
- package/es/components/Datagrid/useRowIsMouseOver.js +1 -1
- package/es/components/Datagrid/useSelectRows.d.ts +8 -1
- package/es/components/Datagrid/useSelectRows.js +3 -2
- package/es/components/Datagrid/useSortableColumns.d.ts +10 -3
- package/es/components/Datagrid/useSortableColumns.js +3 -2
- package/es/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +8 -1
- package/es/components/Datagrid/utils/getAutoSizedColumnWidth.js +0 -7
- package/es/components/InterstitialScreenView/InterstitialScreenView.d.ts +1 -1
- package/es/components/InterstitialScreenView/InterstitialScreenView.js +1 -1
- package/es/components/SidePanel/SidePanel.d.ts +2 -2
- package/es/components/SidePanel/SidePanel.js +5 -3
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.d.ts +1 -1
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +1 -1
- package/es/feature-flags.js +18 -0
- package/es/global/js/package-settings.js +2 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/lib/components/Carousel/Carousel.d.ts +1 -1
- package/lib/components/Carousel/Carousel.js +1 -1
- package/lib/components/Coachmark/CoachmarkDragbar.d.ts +1 -1
- package/lib/components/Coachmark/CoachmarkDragbar.js +1 -1
- package/lib/components/Coachmark/CoachmarkHeader.d.ts +1 -1
- package/lib/components/Coachmark/CoachmarkHeader.js +1 -1
- package/lib/components/Coachmark/CoachmarkOverlay.d.ts +1 -1
- package/lib/components/Coachmark/CoachmarkOverlay.js +1 -1
- package/lib/components/Coachmark/CoachmarkTagline.d.ts +1 -1
- package/lib/components/Coachmark/CoachmarkTagline.js +1 -1
- package/lib/components/CoachmarkStack/CoachmarkStackHome.d.ts +1 -1
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +6 -0
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +73 -32
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +15 -1
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +92 -9
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +11 -2
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +26 -8
- package/lib/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.js +36 -31
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.d.ts +2 -0
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +52 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +5 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +92 -11
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +1 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +7 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +8 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +195 -64
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +10 -0
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +77 -0
- package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -4
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +7 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +1 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +13 -3
- package/lib/components/Datagrid/types/index.d.ts +2 -0
- package/lib/components/Datagrid/useColumnOrder.d.ts +7 -1
- package/lib/components/Datagrid/useNestedRows.js +24 -2
- package/lib/components/Datagrid/useOnRowClick.d.ts +8 -1
- package/lib/components/Datagrid/useOnRowClick.js +2 -1
- package/lib/components/Datagrid/useRowIsMouseOver.d.ts +2 -1
- package/lib/components/Datagrid/useRowIsMouseOver.js +1 -1
- package/lib/components/Datagrid/useSelectRows.d.ts +8 -1
- package/lib/components/Datagrid/useSelectRows.js +3 -2
- package/lib/components/Datagrid/useSortableColumns.d.ts +10 -3
- package/lib/components/Datagrid/useSortableColumns.js +3 -2
- package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +8 -1
- package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.js +0 -7
- package/lib/components/InterstitialScreenView/InterstitialScreenView.d.ts +1 -1
- package/lib/components/InterstitialScreenView/InterstitialScreenView.js +1 -1
- package/lib/components/SidePanel/SidePanel.d.ts +2 -2
- package/lib/components/SidePanel/SidePanel.js +5 -3
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.d.ts +1 -1
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +1 -1
- package/lib/feature-flags.js +40 -0
- package/lib/global/js/package-settings.js +2 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +3 -3
- package/scss/components/ConditionBuilder/_condition-builder.scss +21 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +22 -3
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +58 -21
- package/scss/components/NonLinearReading/_non-linear-reading.scss +1 -1
- /package/es/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.d.ts +0 -0
- /package/lib/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.d.ts +0 -0
@@ -32,7 +32,7 @@ var defaults = {
|
|
32
32
|
};
|
33
33
|
/**
|
34
34
|
* DO NOT USE. This component is for the exclusive use
|
35
|
-
* of other
|
35
|
+
* of other Onboarding components.
|
36
36
|
*/
|
37
37
|
var CoachmarkOverlay = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
38
38
|
var children = _ref.children,
|
@@ -25,7 +25,7 @@ interface CoachmarkTaglineProps {
|
|
25
25
|
}
|
26
26
|
/**
|
27
27
|
* DO NOT USE. This component is for the exclusive use
|
28
|
-
* of other
|
28
|
+
* of other Onboarding components.
|
29
29
|
*/
|
30
30
|
export declare let CoachmarkTagline: React.ForwardRefExoticComponent<CoachmarkTaglineProps & React.RefAttributes<HTMLDivElement>>;
|
31
31
|
export {};
|
@@ -28,7 +28,7 @@ var defaults = {
|
|
28
28
|
};
|
29
29
|
/**
|
30
30
|
* DO NOT USE. This component is for the exclusive use
|
31
|
-
* of other
|
31
|
+
* of other Onboarding components.
|
32
32
|
*/
|
33
33
|
var CoachmarkTagline = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
34
34
|
var _ref$closeIconDescrip = _ref.closeIconDescription,
|
@@ -30,7 +30,7 @@ var componentName = 'CoachmarkStackHome';
|
|
30
30
|
|
31
31
|
/**
|
32
32
|
* DO NOT USE. This component is for the exclusive use
|
33
|
-
* of other
|
33
|
+
* of other Onboarding components.
|
34
34
|
*/
|
35
35
|
var CoachmarkStackHome = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
36
36
|
var _document$querySelect;
|
@@ -58,7 +58,7 @@ var CoachmarkStackHome = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
58
58
|
}, 100);
|
59
59
|
}, [isOpen]);
|
60
60
|
if (!navLinkLabels) {
|
61
|
-
return pconsole.warn("".concat(componentName, " is
|
61
|
+
return pconsole.warn("".concat(componentName, " is an Onboarding internal component and is not intended for general use."));
|
62
62
|
}
|
63
63
|
var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
|
64
64
|
return /*#__PURE__*/createPortal( /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
@@ -6,17 +6,23 @@ declare function ConditionBlock(props: any): import("react/jsx-runtime").JSX.Ele
|
|
6
6
|
declare namespace ConditionBlock {
|
7
7
|
namespace propTypes {
|
8
8
|
let addConditionHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
9
|
+
let addConditionSubGroupHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
9
10
|
let aria: PropTypes.Requireable<object>;
|
10
11
|
let condition: PropTypes.Requireable<object>;
|
11
12
|
let conditionIndex: PropTypes.Requireable<number>;
|
12
13
|
let conjunction: PropTypes.Requireable<string>;
|
13
14
|
let group: PropTypes.Requireable<object>;
|
15
|
+
let hideConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
16
|
+
let hideConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
14
17
|
let isLastCondition: PropTypes.Requireable<(...args: any[]) => any>;
|
15
18
|
let isStatement: PropTypes.Requireable<boolean>;
|
16
19
|
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
17
20
|
let onConnectorOperatorChange: PropTypes.Requireable<(...args: any[]) => any>;
|
18
21
|
let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
19
22
|
let onStatementChange: PropTypes.Requireable<(...args: any[]) => any>;
|
23
|
+
let showConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
24
|
+
let showConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
25
|
+
let state: PropTypes.Requireable<object>;
|
20
26
|
}
|
21
27
|
}
|
22
28
|
import PropTypes from 'prop-types';
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { slicedToArray as _slicedToArray, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
8
|
+
import { slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { useContext, useState } from 'react';
|
10
10
|
import { Close } from '@carbon/react/icons';
|
11
11
|
import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
|
@@ -13,7 +13,7 @@ import PropTypes from '../../../node_modules/prop-types/index.js';
|
|
13
13
|
import { blockClass, translateWithId, statementConfig, operatorConfig } from '../ConditionBuilderContext/DataConfigs.js';
|
14
14
|
import { ConditionBuilderItemOption } from '../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js';
|
15
15
|
import cx from 'classnames';
|
16
|
-
import ConditionConnector from '../
|
16
|
+
import ConditionConnector from '../ConditionBuilderConnector/ConditionConnector.js';
|
17
17
|
import { ConditionBuilderItemNumber } from '../ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js';
|
18
18
|
import { ConditionBuilderItemText } from '../ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js';
|
19
19
|
import { ConditionBuilderItemDate } from '../ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js';
|
@@ -23,6 +23,7 @@ import { focusThisField } from '../utils/util.js';
|
|
23
23
|
import { ConditionBuilderItemTime } from '../ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js';
|
24
24
|
import ConditionBuilderAdd from '../ConditionBuilderAdd/ConditionBuilderAdd.js';
|
25
25
|
|
26
|
+
var _div;
|
26
27
|
/**
|
27
28
|
* This component build each block of condition consisting of property, operator value and close button.
|
28
29
|
*/
|
@@ -40,11 +41,19 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
40
41
|
isStatement = props.isStatement,
|
41
42
|
group = props.group,
|
42
43
|
onStatementChange = props.onStatementChange,
|
43
|
-
addConditionHandler = props.addConditionHandler,
|
44
44
|
conditionIndex = props.conditionIndex,
|
45
|
+
addConditionHandler = props.addConditionHandler,
|
46
|
+
_addConditionSubGroupHandler = props.addConditionSubGroupHandler,
|
47
|
+
aria = props.aria,
|
48
|
+
hideConditionSubGroupPreviewHandler = props.hideConditionSubGroupPreviewHandler,
|
49
|
+
showConditionSubGroupPreviewHandler = props.showConditionSubGroupPreviewHandler,
|
50
|
+
hideConditionPreviewHandler = props.hideConditionPreviewHandler,
|
51
|
+
showConditionPreviewHandler = props.showConditionPreviewHandler,
|
45
52
|
isLastCondition = props.isLastCondition;
|
46
53
|
var _useContext = useContext(ConditionBuilderContext),
|
47
|
-
inputConfig = _useContext.inputConfig
|
54
|
+
inputConfig = _useContext.inputConfig,
|
55
|
+
variant = _useContext.variant;
|
56
|
+
//Below possible input types expected for value field.
|
48
57
|
var itemComponents = {
|
49
58
|
option: ConditionBuilderItemOption,
|
50
59
|
text: ConditionBuilderItemText,
|
@@ -69,14 +78,17 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
69
78
|
type = _getCurrentConfig.type,
|
70
79
|
config = _getCurrentConfig.config,
|
71
80
|
label = _getCurrentConfig.label;
|
72
|
-
var ItemComponent
|
81
|
+
var ItemComponent;
|
82
|
+
// if (type == 'custom') {
|
83
|
+
// ItemComponent = config.component;
|
84
|
+
// } else {
|
85
|
+
ItemComponent = property ? itemComponents[type] : null;
|
86
|
+
//}
|
87
|
+
|
73
88
|
var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
|
74
89
|
focusThisField(evt);
|
75
90
|
onStatementChange(v);
|
76
91
|
};
|
77
|
-
var onConnectorOperatorChangeHandler = function onConnectorOperatorChangeHandler(op) {
|
78
|
-
onConnectorOperatorChange(op);
|
79
|
-
};
|
80
92
|
var onPropertyChangeHandler = function onPropertyChangeHandler(newProperty) {
|
81
93
|
onChange(_objectSpread2(_objectSpread2({}, condition), {}, {
|
82
94
|
property: newProperty,
|
@@ -109,21 +121,32 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
109
121
|
return operator.type.indexOf(type) != -1 || operator.type == 'all';
|
110
122
|
});
|
111
123
|
};
|
112
|
-
|
113
|
-
|
114
|
-
|
124
|
+
var getAriaAttributes = function getAriaAttributes() {
|
125
|
+
return variant == 'tree' ? {
|
126
|
+
'aria-level': aria.level,
|
127
|
+
'aria-posinset': aria.posinset,
|
128
|
+
'aria-setsize': aria.setsize
|
129
|
+
} : {};
|
130
|
+
};
|
131
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
132
|
+
className: cx("".concat(blockClass, "__condition-block"), _defineProperty({}, "".concat(blockClass, "__condition__deletion-preview"), showDeletionPreview), _defineProperty({}, "".concat(blockClass, "__gap-bottom"), variant == 'tree' && !(conditionIndex + 1 >= group.conditions.length)), _defineProperty({}, "".concat(blockClass, "__gap ").concat(blockClass, "__gap-bottom"), variant == 'sentence')),
|
115
133
|
role: "row",
|
116
134
|
"aria-label": translateWithId('condition_row'),
|
117
135
|
tabIndex: -1
|
118
|
-
},
|
119
|
-
|
120
|
-
|
136
|
+
}, getAriaAttributes()), conjunction ? /*#__PURE__*/React__default.createElement(ConditionConnector, {
|
137
|
+
className: "".concat(blockClass, "__gap"),
|
138
|
+
operator: conjunction,
|
139
|
+
onChange: function onChange(op) {
|
140
|
+
return onConnectorOperatorChange(op);
|
141
|
+
}
|
142
|
+
}) : _div || (_div = /*#__PURE__*/React__default.createElement("div", {
|
143
|
+
role: "gridcell"
|
144
|
+
})), isStatement && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
121
145
|
label: group.statement,
|
122
146
|
title: translateWithId('condition'),
|
123
147
|
"data-name": "connectorField",
|
124
148
|
popOverClassName: "".concat(blockClass, "__gap"),
|
125
|
-
className: "".concat(blockClass, "__statement-button")
|
126
|
-
tabIndex: 0
|
149
|
+
className: "".concat(blockClass, "__statement-button")
|
127
150
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderItemOption, {
|
128
151
|
conditionState: {
|
129
152
|
value: group.statement,
|
@@ -133,11 +156,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
133
156
|
config: {
|
134
157
|
options: statementConfig
|
135
158
|
}
|
136
|
-
})),
|
137
|
-
className: "".concat(blockClass, "__gap"),
|
138
|
-
operator: conjunction,
|
139
|
-
onChange: onConnectorOperatorChangeHandler
|
140
|
-
}), /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
159
|
+
})), /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
141
160
|
label: label,
|
142
161
|
title: translateWithId('property'),
|
143
162
|
renderIcon: icon !== null && icon !== void 0 ? icon : null,
|
@@ -184,7 +203,8 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
184
203
|
value: value
|
185
204
|
},
|
186
205
|
onChange: onValueChangeHandler,
|
187
|
-
config: config
|
206
|
+
config: config,
|
207
|
+
"data-name": "valueField"
|
188
208
|
})), /*#__PURE__*/React__default.createElement("span", {
|
189
209
|
role: "gridcell",
|
190
210
|
"aria-label": translateWithId('remove_condition')
|
@@ -202,9 +222,15 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
202
222
|
})), isLastCondition(conditionIndex, group.conditions) && /*#__PURE__*/React__default.createElement(ConditionBuilderAdd, {
|
203
223
|
onClick: function onClick() {
|
204
224
|
addConditionHandler(conditionIndex);
|
205
|
-
}
|
206
|
-
|
207
|
-
|
225
|
+
},
|
226
|
+
addConditionSubGroupHandler: function addConditionSubGroupHandler() {
|
227
|
+
_addConditionSubGroupHandler(conditionIndex);
|
228
|
+
},
|
229
|
+
showConditionSubGroupPreviewHandler: showConditionSubGroupPreviewHandler,
|
230
|
+
hideConditionSubGroupPreviewHandler: hideConditionSubGroupPreviewHandler,
|
231
|
+
enableSubGroup: variant == 'tree',
|
232
|
+
showConditionPreviewHandler: showConditionPreviewHandler,
|
233
|
+
hideConditionPreviewHandler: hideConditionPreviewHandler,
|
208
234
|
className: "".concat(blockClass, "__gap ").concat(blockClass, "__gap-left")
|
209
235
|
}));
|
210
236
|
};
|
@@ -215,16 +241,14 @@ ConditionBlock.propTypes = {
|
|
215
241
|
*/
|
216
242
|
addConditionHandler: PropTypes.func,
|
217
243
|
/**
|
218
|
-
*
|
244
|
+
* callback to add a new condition subgroup
|
219
245
|
*/
|
220
|
-
|
246
|
+
addConditionSubGroupHandler: PropTypes.func,
|
221
247
|
/**
|
222
|
-
* object
|
248
|
+
* object hold aria attributes
|
223
249
|
*/
|
250
|
+
aria: PropTypes.object,
|
224
251
|
condition: PropTypes.object,
|
225
|
-
/**
|
226
|
-
* index of the current condition
|
227
|
-
*/
|
228
252
|
conditionIndex: PropTypes.number,
|
229
253
|
/**
|
230
254
|
* string that decides to show the condition connector
|
@@ -235,8 +259,13 @@ ConditionBlock.propTypes = {
|
|
235
259
|
*/
|
236
260
|
group: PropTypes.object,
|
237
261
|
/**
|
238
|
-
*
|
262
|
+
* handler for hiding sub group preview
|
263
|
+
*/
|
264
|
+
hideConditionPreviewHandler: PropTypes.func,
|
265
|
+
/**
|
266
|
+
* handler for hiding sub group preview
|
239
267
|
*/
|
268
|
+
hideConditionSubGroupPreviewHandler: PropTypes.func,
|
240
269
|
isLastCondition: PropTypes.func,
|
241
270
|
/**
|
242
271
|
* boolean that decides to show the statement(if/ excl.if)
|
@@ -257,7 +286,19 @@ ConditionBlock.propTypes = {
|
|
257
286
|
/**
|
258
287
|
* callback to handle the statement(if/ excl.if) change
|
259
288
|
*/
|
260
|
-
onStatementChange: PropTypes.func
|
289
|
+
onStatementChange: PropTypes.func,
|
290
|
+
/**
|
291
|
+
* handler for showing add condition preview
|
292
|
+
*/
|
293
|
+
showConditionPreviewHandler: PropTypes.func,
|
294
|
+
/**
|
295
|
+
* handler for showing sub group preview
|
296
|
+
*/
|
297
|
+
showConditionSubGroupPreviewHandler: PropTypes.func,
|
298
|
+
/**
|
299
|
+
* object that hold the current condition
|
300
|
+
*/
|
301
|
+
state: PropTypes.object
|
261
302
|
};
|
262
303
|
|
263
304
|
export { ConditionBlock$1 as default };
|
@@ -1,12 +1,26 @@
|
|
1
1
|
export default ConditionBuilderAdd;
|
2
|
-
declare function ConditionBuilderAdd({ className, onClick }: {
|
2
|
+
declare function ConditionBuilderAdd({ className, onClick, addConditionSubGroupHandler, showConditionSubGroupPreviewHandler, hideConditionSubGroupPreviewHandler, showConditionPreviewHandler, hideConditionPreviewHandler, enableSubGroup, buttonLabel, }: {
|
3
3
|
className: any;
|
4
4
|
onClick: any;
|
5
|
+
addConditionSubGroupHandler: any;
|
6
|
+
showConditionSubGroupPreviewHandler: any;
|
7
|
+
hideConditionSubGroupPreviewHandler: any;
|
8
|
+
showConditionPreviewHandler: any;
|
9
|
+
hideConditionPreviewHandler: any;
|
10
|
+
enableSubGroup: any;
|
11
|
+
buttonLabel: any;
|
5
12
|
}): import("react/jsx-runtime").JSX.Element;
|
6
13
|
declare namespace ConditionBuilderAdd {
|
7
14
|
namespace propTypes {
|
15
|
+
let addConditionSubGroupHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
16
|
+
let buttonLabel: PropTypes.Requireable<string>;
|
8
17
|
let className: PropTypes.Requireable<string>;
|
18
|
+
let enableSubGroup: PropTypes.Requireable<boolean>;
|
19
|
+
let hideConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
20
|
+
let hideConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
9
21
|
let onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
22
|
+
let showConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
23
|
+
let showConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
10
24
|
}
|
11
25
|
}
|
12
26
|
import PropTypes from 'prop-types';
|
@@ -5,36 +5,119 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import
|
9
|
-
import {
|
8
|
+
import { slicedToArray as _slicedToArray, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default, { useState } from 'react';
|
10
|
+
import { AddAlt, TextNewLine } from '@carbon/react/icons';
|
10
11
|
import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
|
11
12
|
import PropTypes from '../../../node_modules/prop-types/index.js';
|
12
|
-
import {
|
13
|
+
import { translateWithId, blockClass } from '../ConditionBuilderContext/DataConfigs.js';
|
13
14
|
|
14
15
|
var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
15
16
|
var className = _ref.className,
|
16
|
-
onClick = _ref.onClick
|
17
|
+
onClick = _ref.onClick,
|
18
|
+
addConditionSubGroupHandler = _ref.addConditionSubGroupHandler,
|
19
|
+
showConditionSubGroupPreviewHandler = _ref.showConditionSubGroupPreviewHandler,
|
20
|
+
hideConditionSubGroupPreviewHandler = _ref.hideConditionSubGroupPreviewHandler,
|
21
|
+
showConditionPreviewHandler = _ref.showConditionPreviewHandler,
|
22
|
+
hideConditionPreviewHandler = _ref.hideConditionPreviewHandler,
|
23
|
+
enableSubGroup = _ref.enableSubGroup,
|
24
|
+
buttonLabel = _ref.buttonLabel;
|
25
|
+
var _useState = useState(false),
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
27
|
+
isAddSubgroup = _useState2[0],
|
28
|
+
setIsAddSubgroup = _useState2[1];
|
29
|
+
var showAddSubGroup = function showAddSubGroup() {
|
30
|
+
setIsAddSubgroup(true);
|
31
|
+
};
|
32
|
+
var hideAddSubGroup = function hideAddSubGroup() {
|
33
|
+
setIsAddSubgroup(false);
|
34
|
+
};
|
35
|
+
var onClickHandler = function onClickHandler() {
|
36
|
+
hideConditionPreviewHandler === null || hideConditionPreviewHandler === void 0 || hideConditionPreviewHandler();
|
37
|
+
onClick();
|
38
|
+
};
|
39
|
+
var previewHandlers = function previewHandlers() {
|
40
|
+
return enableSubGroup ? {
|
41
|
+
onMouseEnter: showConditionPreviewHandler,
|
42
|
+
onMouseLeave: hideConditionPreviewHandler,
|
43
|
+
onFocus: showConditionPreviewHandler,
|
44
|
+
onBlur: hideConditionPreviewHandler
|
45
|
+
} : {};
|
46
|
+
};
|
47
|
+
var previewHandlersForSubgroup = function previewHandlersForSubgroup() {
|
48
|
+
return {
|
49
|
+
onMouseEnter: showConditionSubGroupPreviewHandler,
|
50
|
+
onMouseLeave: hideConditionSubGroupPreviewHandler,
|
51
|
+
onFocus: showConditionSubGroupPreviewHandler,
|
52
|
+
onBlur: hideConditionSubGroupPreviewHandler
|
53
|
+
};
|
54
|
+
};
|
55
|
+
var wrapperProps = enableSubGroup ? {
|
56
|
+
role: 'gridcell',
|
57
|
+
'aria-label': translateWithId('add-condition')
|
58
|
+
} : {};
|
17
59
|
return /*#__PURE__*/React__default.createElement("div", {
|
18
|
-
className: className,
|
19
|
-
role:
|
20
|
-
|
60
|
+
className: "".concat(className, " ").concat(blockClass, "__add-button-wrapper"),
|
61
|
+
role: !enableSubGroup ? 'gridcell' : 'none',
|
62
|
+
"aria-label": !enableSubGroup ? translateWithId('add_condition_row') : undefined,
|
63
|
+
onMouseEnter: showAddSubGroup,
|
64
|
+
onMouseLeave: hideAddSubGroup,
|
65
|
+
onFocus: showAddSubGroup,
|
66
|
+
onBlur: hideAddSubGroup
|
67
|
+
}, /*#__PURE__*/React__default.createElement(ConditionBuilderButton, _extends({
|
21
68
|
renderIcon: AddAlt,
|
22
|
-
onClick:
|
69
|
+
onClick: onClickHandler
|
70
|
+
}, previewHandlers(), {
|
23
71
|
className: "".concat(blockClass, "__add-button"),
|
24
72
|
hideLabel: true,
|
25
|
-
|
26
|
-
|
73
|
+
"data-name": "addButton",
|
74
|
+
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : translateWithId('add-condition'),
|
75
|
+
wrapperProps: wrapperProps
|
76
|
+
})), isAddSubgroup && enableSubGroup && /*#__PURE__*/React__default.createElement(ConditionBuilderButton, _extends({
|
77
|
+
renderIcon: TextNewLine,
|
78
|
+
onClick: addConditionSubGroupHandler,
|
79
|
+
className: "".concat(blockClass, "__add-condition-group ").concat(blockClass, "__gap-left"),
|
80
|
+
hideLabel: true,
|
81
|
+
label: translateWithId('add-condition'),
|
82
|
+
wrapperProps: wrapperProps
|
83
|
+
}, previewHandlersForSubgroup())));
|
27
84
|
};
|
28
85
|
var ConditionBuilderAdd$1 = ConditionBuilderAdd;
|
29
86
|
ConditionBuilderAdd.propTypes = {
|
87
|
+
/**
|
88
|
+
* handler for hiding sub group preview
|
89
|
+
*/
|
90
|
+
addConditionSubGroupHandler: PropTypes.func,
|
91
|
+
/**
|
92
|
+
* handler for hiding sub group preview
|
93
|
+
*/ /**
|
94
|
+
* tooltip label for plus button
|
95
|
+
*/
|
96
|
+
buttonLabel: PropTypes.string,
|
30
97
|
/**
|
31
98
|
* Provide an optional class to be applied to the containing node.
|
32
99
|
*/
|
33
100
|
className: PropTypes.string,
|
34
101
|
/**
|
35
|
-
*
|
102
|
+
* boolean to enable sub groups for the tree variant
|
103
|
+
*/
|
104
|
+
enableSubGroup: PropTypes.bool,
|
105
|
+
/**
|
106
|
+
* handler for hiding sub group preview
|
107
|
+
*/
|
108
|
+
hideConditionPreviewHandler: PropTypes.func,
|
109
|
+
hideConditionSubGroupPreviewHandler: PropTypes.func,
|
110
|
+
/**
|
111
|
+
* handler for hiding sub group preview
|
112
|
+
*/ /**
|
113
|
+
* callback triggered on click of add button
|
114
|
+
*/
|
115
|
+
onClick: PropTypes.func,
|
116
|
+
showConditionPreviewHandler: PropTypes.func,
|
117
|
+
showConditionSubGroupPreviewHandler: PropTypes.func
|
118
|
+
/**
|
119
|
+
* handler for hiding sub group preview
|
36
120
|
*/
|
37
|
-
onClick: PropTypes.func
|
38
121
|
};
|
39
122
|
|
40
123
|
export { ConditionBuilderAdd$1 as default };
|
@@ -1,5 +1,4 @@
|
|
1
|
-
export function ConditionBuilderButton({ className, label, hideLabel, tooltipAlign, renderIcon: Icon, onClick, showToolTip,
|
2
|
-
[x: string]: any;
|
1
|
+
export function ConditionBuilderButton({ className, label, hideLabel, tooltipAlign, renderIcon: Icon, onClick, showToolTip, wrapperProps, onBlur, onFocus, onMouseEnter, onMouseLeave, }: {
|
3
2
|
className: any;
|
4
3
|
label: any;
|
5
4
|
hideLabel: any;
|
@@ -7,16 +6,26 @@ export function ConditionBuilderButton({ className, label, hideLabel, tooltipAli
|
|
7
6
|
renderIcon: any;
|
8
7
|
onClick: any;
|
9
8
|
showToolTip: any;
|
9
|
+
wrapperProps: any;
|
10
|
+
onBlur: any;
|
11
|
+
onFocus: any;
|
12
|
+
onMouseEnter: any;
|
13
|
+
onMouseLeave: any;
|
10
14
|
}): import("react/jsx-runtime").JSX.Element;
|
11
15
|
export namespace ConditionBuilderButton {
|
12
16
|
namespace propTypes {
|
13
17
|
let className: PropTypes.Requireable<string>;
|
14
18
|
let hideLabel: PropTypes.Requireable<boolean>;
|
15
19
|
let label: PropTypes.Requireable<string>;
|
20
|
+
let onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
16
21
|
let onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
22
|
+
let onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
23
|
+
let onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
24
|
+
let onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
17
25
|
let renderIcon: PropTypes.Requireable<object>;
|
18
26
|
let showToolTip: PropTypes.Requireable<boolean>;
|
19
27
|
let tooltipAlign: PropTypes.Requireable<string>;
|
28
|
+
let wrapperProps: PropTypes.Requireable<object>;
|
20
29
|
}
|
21
30
|
}
|
22
31
|
import PropTypes from 'prop-types';
|
@@ -5,16 +5,15 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import {
|
8
|
+
import { extends as _extends, defineProperty as _defineProperty } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default from 'react';
|
10
10
|
import cx from 'classnames';
|
11
11
|
import PropTypes from '../../../node_modules/prop-types/index.js';
|
12
12
|
import { Tooltip } from '@carbon/react';
|
13
13
|
import { blockClass } from '../ConditionBuilderContext/DataConfigs.js';
|
14
14
|
|
15
|
-
var _excluded = ["className", "label", "hideLabel", "tooltipAlign", "renderIcon", "onClick", "showToolTip"];
|
16
15
|
var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
|
17
|
-
var _Icon;
|
16
|
+
var _Icon, _span;
|
18
17
|
var className = _ref.className,
|
19
18
|
label = _ref.label,
|
20
19
|
hideLabel = _ref.hideLabel,
|
@@ -22,21 +21,29 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
|
|
22
21
|
Icon = _ref.renderIcon,
|
23
22
|
onClick = _ref.onClick,
|
24
23
|
showToolTip = _ref.showToolTip,
|
25
|
-
|
24
|
+
wrapperProps = _ref.wrapperProps,
|
25
|
+
onBlur = _ref.onBlur,
|
26
|
+
onFocus = _ref.onFocus,
|
27
|
+
onMouseEnter = _ref.onMouseEnter,
|
28
|
+
onMouseLeave = _ref.onMouseLeave;
|
26
29
|
var Button = function Button() {
|
27
|
-
return /*#__PURE__*/React__default.createElement("button",
|
30
|
+
return /*#__PURE__*/React__default.createElement("button", {
|
28
31
|
// role={'gridcell'}
|
29
32
|
tabIndex: -1,
|
30
33
|
className: cx([className, "".concat(blockClass, "__button"), _defineProperty({}, "".concat(blockClass, "__text-ellipsis"), showToolTip && !hideLabel)]),
|
31
34
|
type: "button",
|
32
|
-
onClick: onClick
|
33
|
-
|
35
|
+
onClick: onClick,
|
36
|
+
onBlur: onBlur,
|
37
|
+
onFocus: onFocus,
|
38
|
+
onMouseEnter: onMouseEnter,
|
39
|
+
onMouseLeave: onMouseLeave
|
40
|
+
}, Icon && (_Icon || (_Icon = /*#__PURE__*/React__default.createElement(Icon, null))), !hideLabel && (_span || (_span = /*#__PURE__*/React__default.createElement("span", null, label))));
|
34
41
|
};
|
35
42
|
return hideLabel || showToolTip ? /*#__PURE__*/React__default.createElement(Tooltip, _extends({
|
36
43
|
label: label,
|
37
44
|
align: tooltipAlign,
|
38
45
|
className: "".concat(blockClass, "__con-tooltip")
|
39
|
-
},
|
46
|
+
}, wrapperProps), Button()) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, Button());
|
40
47
|
};
|
41
48
|
ConditionBuilderButton.propTypes = {
|
42
49
|
/**
|
@@ -51,10 +58,17 @@ ConditionBuilderButton.propTypes = {
|
|
51
58
|
* label of the button
|
52
59
|
*/
|
53
60
|
label: PropTypes.string,
|
61
|
+
/**
|
62
|
+
* mouse events callbacks
|
63
|
+
*/
|
64
|
+
onBlur: PropTypes.func,
|
54
65
|
/**
|
55
66
|
* callback triggered on click of add button
|
56
67
|
*/
|
57
68
|
onClick: PropTypes.func,
|
69
|
+
onFocus: PropTypes.func,
|
70
|
+
onMouseEnter: PropTypes.func,
|
71
|
+
onMouseLeave: PropTypes.func,
|
58
72
|
/**
|
59
73
|
* Optional prop to allow overriding the icon rendering.
|
60
74
|
*/
|
@@ -68,7 +82,11 @@ ConditionBuilderButton.propTypes = {
|
|
68
82
|
/**
|
69
83
|
* tooltip position
|
70
84
|
*/
|
71
|
-
tooltipAlign: PropTypes.string
|
85
|
+
tooltipAlign: PropTypes.string,
|
86
|
+
/**
|
87
|
+
* optional props for tree grid to add role and aria-label to wrapper span
|
88
|
+
*/
|
89
|
+
wrapperProps: PropTypes.object
|
72
90
|
};
|
73
91
|
|
74
92
|
export { ConditionBuilderButton };
|