@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
@@ -64,6 +64,17 @@ interface TearsheetNarrowBaseProps extends PropsWithChildren {
|
|
64
64
|
* The DOM element that the tearsheet should be rendered within. Defaults to document.body.
|
65
65
|
*/
|
66
66
|
portalTarget?: ReactNode;
|
67
|
+
/**
|
68
|
+
* Specify a CSS selector that matches the DOM element that should be
|
69
|
+
* focused when the Modal opens.
|
70
|
+
*/
|
71
|
+
selectorPrimaryFocus?: string;
|
72
|
+
/**
|
73
|
+
* Specify the CSS selectors that match the floating menus.
|
74
|
+
*
|
75
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-composedmodal--overview#focus-management
|
76
|
+
*/
|
77
|
+
selectorsFloatingMenus?: string[];
|
67
78
|
/**
|
68
79
|
* The main title of the tearsheet, displayed in the header area.
|
69
80
|
*/
|
@@ -148,6 +148,18 @@ TearsheetNarrow.propTypes = _objectSpread2({
|
|
148
148
|
*/
|
149
149
|
/**@ts-ignore */
|
150
150
|
portalTarget: portalType,
|
151
|
+
/**
|
152
|
+
* Specify a CSS selector that matches the DOM element that should be
|
153
|
+
* focused when the Modal opens.
|
154
|
+
*/
|
155
|
+
selectorPrimaryFocus: PropTypes.string,
|
156
|
+
/**
|
157
|
+
* Specify the CSS selectors that match the floating menus.
|
158
|
+
*
|
159
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-composedmodal--overview#focus-management
|
160
|
+
*/
|
161
|
+
/**@ts-ignore*/
|
162
|
+
selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string),
|
151
163
|
/**
|
152
164
|
* The main title of the tearsheet, displayed in the header area.
|
153
165
|
*/
|
@@ -81,7 +81,17 @@ interface TearsheetShellProps extends PropsWithChildren {
|
|
81
81
|
* The DOM element that the tearsheet should be rendered within. Defaults to document.body.
|
82
82
|
*/
|
83
83
|
portalTarget?: ReactNode;
|
84
|
+
/**
|
85
|
+
* Specify a CSS selector that matches the DOM element that should be
|
86
|
+
* focused when the Modal opens.
|
87
|
+
*/
|
84
88
|
selectorPrimaryFocus?: string;
|
89
|
+
/**
|
90
|
+
* Specify the CSS selectors that match the floating menus.
|
91
|
+
*
|
92
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-composedmodal--overview#focus-management
|
93
|
+
*/
|
94
|
+
selectorsFloatingMenus?: string[];
|
85
95
|
/**
|
86
96
|
* Specifies the width of the tearsheet, 'narrow' or 'wide'.
|
87
97
|
*/
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
8
|
+
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty, toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { useRef, useState, useEffect } from 'react';
|
10
10
|
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
|
11
11
|
import PropTypes from '../../node_modules/prop-types/index.js';
|
@@ -20,7 +20,7 @@ import { useFocus } from '../../global/js/hooks/useFocus.js';
|
|
20
20
|
import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
|
21
21
|
import { ActionSet } from '../ActionSet/ActionSet.js';
|
22
22
|
|
23
|
-
var _excluded = ["actions", "ariaLabel", "children", "className", "closeIconDescription", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
|
23
|
+
var _excluded = ["actions", "ariaLabel", "children", "className", "closeIconDescription", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "selectorsFloatingMenus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
|
24
24
|
|
25
25
|
// The block part of our conventional BEM class names (bc__E--M).
|
26
26
|
var bc = "".concat(pkg.prefix, "--tearsheet");
|
@@ -79,6 +79,8 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
79
79
|
open = _ref.open,
|
80
80
|
portalTargetIn = _ref.portalTarget,
|
81
81
|
selectorPrimaryFocus = _ref.selectorPrimaryFocus,
|
82
|
+
_ref$selectorsFloatin = _ref.selectorsFloatingMenus,
|
83
|
+
selectorsFloatingMenus = _ref$selectorsFloatin === void 0 ? [] : _ref$selectorsFloatin,
|
82
84
|
size = _ref.size,
|
83
85
|
slug = _ref.slug,
|
84
86
|
title = _ref.title,
|
@@ -249,7 +251,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
249
251
|
onKeyDown: keyDownListener,
|
250
252
|
preventCloseOnClickOutside: !isPassive,
|
251
253
|
ref: modalRef,
|
252
|
-
selectorsFloatingMenus: [".".concat(carbonPrefix, "--overflow-menu-options"), ".".concat(carbonPrefix, "--tooltip"), '.flatpickr-calendar', ".".concat(bc, "__container")],
|
254
|
+
selectorsFloatingMenus: [".".concat(carbonPrefix, "--overflow-menu-options"), ".".concat(carbonPrefix, "--tooltip"), '.flatpickr-calendar', ".".concat(bc, "__container")].concat(_toConsumableArray(selectorsFloatingMenus)),
|
253
255
|
size: "sm"
|
254
256
|
}), includeHeader && /*#__PURE__*/React__default.createElement(ModalHeader, {
|
255
257
|
className: cx("".concat(bc, "__header"), _defineProperty(_defineProperty({}, "".concat(bc, "__header--with-close-icon"), effectiveHasCloseIcon), "".concat(bc, "__header--with-nav"), navigation)),
|
@@ -445,6 +447,18 @@ TearsheetShell.propTypes = _objectSpread2({
|
|
445
447
|
*/
|
446
448
|
/**@ts-ignore*/
|
447
449
|
portalTarget: portalType,
|
450
|
+
/**
|
451
|
+
* Specify a CSS selector that matches the DOM element that should be
|
452
|
+
* focused when the Modal opens.
|
453
|
+
*/
|
454
|
+
selectorPrimaryFocus: PropTypes.string,
|
455
|
+
/**
|
456
|
+
* Specify the CSS selectors that match the floating menus.
|
457
|
+
*
|
458
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-composedmodal--overview#focus-management
|
459
|
+
*/
|
460
|
+
/**@ts-ignore*/
|
461
|
+
selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string),
|
448
462
|
/**
|
449
463
|
* Specifies the width of the tearsheet, 'narrow' or 'wide'.
|
450
464
|
*/
|
@@ -15,7 +15,6 @@ var icons = require('@carbon/react/icons');
|
|
15
15
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
16
16
|
var index = require('../../../node_modules/prop-types/index.js');
|
17
17
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
18
|
-
var ConditionBuilderItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js');
|
19
18
|
var cx = require('classnames');
|
20
19
|
var ConditionConnector = require('../ConditionBuilderConnector/ConditionConnector.js');
|
21
20
|
var ConditionBuilderItemNumber = require('../ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js');
|
@@ -26,6 +25,8 @@ var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilder
|
|
26
25
|
var util = require('../utils/util.js');
|
27
26
|
var ConditionBuilderItemTime = require('../ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js');
|
28
27
|
var ConditionBuilderAdd = require('../ConditionBuilderAdd/ConditionBuilderAdd.js');
|
28
|
+
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
29
|
+
var ItemOptionForValueField = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js');
|
29
30
|
|
30
31
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
31
32
|
|
@@ -33,6 +34,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
33
34
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
34
35
|
|
35
36
|
var _div;
|
37
|
+
|
36
38
|
/**
|
37
39
|
* This component build each block of condition consisting of property, operator value and close button.
|
38
40
|
*/
|
@@ -62,14 +64,6 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
62
64
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
63
65
|
inputConfig = _useContext.inputConfig,
|
64
66
|
variant = _useContext.variant;
|
65
|
-
//Below possible input types expected for value field.
|
66
|
-
var itemComponents = {
|
67
|
-
option: ConditionBuilderItemOption.ConditionBuilderItemOption,
|
68
|
-
text: ConditionBuilderItemText.ConditionBuilderItemText,
|
69
|
-
number: ConditionBuilderItemNumber.ConditionBuilderItemNumber,
|
70
|
-
date: ConditionBuilderItemDate.ConditionBuilderItemDate,
|
71
|
-
time: ConditionBuilderItemTime.ConditionBuilderItemTime
|
72
|
-
};
|
73
67
|
var _useState = React.useState(false),
|
74
68
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
75
69
|
showDeletionPreview = _useState2[0],
|
@@ -87,13 +81,17 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
87
81
|
type = _getCurrentConfig.type,
|
88
82
|
config = _getCurrentConfig.config,
|
89
83
|
label = _getCurrentConfig.label;
|
90
|
-
var ItemComponent;
|
91
|
-
// if (type == 'custom') {
|
92
|
-
// ItemComponent = config.component;
|
93
|
-
// } else {
|
94
|
-
ItemComponent = property ? itemComponents[type] : null;
|
95
|
-
//}
|
96
84
|
|
85
|
+
//Below possible input types expected for value field.
|
86
|
+
var itemComponents = {
|
87
|
+
text: ConditionBuilderItemText.ConditionBuilderItemText,
|
88
|
+
number: ConditionBuilderItemNumber.ConditionBuilderItemNumber,
|
89
|
+
date: ConditionBuilderItemDate.ConditionBuilderItemDate,
|
90
|
+
time: ConditionBuilderItemTime.ConditionBuilderItemTime,
|
91
|
+
option: ItemOptionForValueField.ItemOptionForValueField,
|
92
|
+
custom: config === null || config === void 0 ? void 0 : config.component
|
93
|
+
};
|
94
|
+
var ItemComponent = property ? itemComponents[type] : null;
|
97
95
|
var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
|
98
96
|
util.focusThisField(evt);
|
99
97
|
onStatementChange(v);
|
@@ -114,9 +112,10 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
114
112
|
}));
|
115
113
|
};
|
116
114
|
var onValueChangeHandler = function onValueChangeHandler(newValue) {
|
117
|
-
|
118
|
-
|
119
|
-
|
115
|
+
var currentCondition = _rollupPluginBabelHelpers.objectSpread2({}, condition);
|
116
|
+
delete currentCondition.popoverToOpen;
|
117
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, currentCondition), {}, {
|
118
|
+
value: newValue
|
120
119
|
}));
|
121
120
|
};
|
122
121
|
var handleShowDeletionPreview = function handleShowDeletionPreview() {
|
@@ -126,6 +125,9 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
126
125
|
setShowDeletionPreview(false);
|
127
126
|
};
|
128
127
|
var getOperators = function getOperators() {
|
128
|
+
if (config !== null && config !== void 0 && config.operators) {
|
129
|
+
return config.operators;
|
130
|
+
}
|
129
131
|
return DataConfigs.operatorConfig.filter(function (operator) {
|
130
132
|
return operator.type.indexOf(type) != -1 || operator.type == 'all';
|
131
133
|
});
|
@@ -156,7 +158,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
156
158
|
"data-name": "connectorField",
|
157
159
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
158
160
|
className: "".concat(DataConfigs.blockClass, "__statement-button")
|
159
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
161
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
160
162
|
conditionState: {
|
161
163
|
value: group.statement,
|
162
164
|
label: DataConfigs.translateWithId('condition')
|
@@ -173,7 +175,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
173
175
|
"data-name": "propertyField",
|
174
176
|
condition: condition,
|
175
177
|
type: type
|
176
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
178
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
177
179
|
conditionState: {
|
178
180
|
value: property,
|
179
181
|
label: DataConfigs.translateWithId('property')
|
@@ -188,7 +190,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
188
190
|
"data-name": "operatorField",
|
189
191
|
condition: condition,
|
190
192
|
type: type
|
191
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
193
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
192
194
|
config: {
|
193
195
|
options: getOperators()
|
194
196
|
},
|
@@ -26,7 +26,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
26
26
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
27
27
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
28
28
|
|
29
|
-
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "variant"];
|
29
|
+
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions"];
|
30
30
|
|
31
31
|
// Carbon and package components we use.
|
32
32
|
/* TODO: @import(s) of carbon components and other package components. */
|
@@ -61,7 +61,9 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
61
61
|
getOptions = _ref.getOptions,
|
62
62
|
initialState = _ref.initialState,
|
63
63
|
getConditionState = _ref.getConditionState,
|
64
|
+
getActionsState = _ref.getActionsState,
|
64
65
|
variant = _ref.variant,
|
66
|
+
actions = _ref.actions,
|
65
67
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
66
68
|
var localRef = React.useRef();
|
67
69
|
var conditionBuilderRef = ref || localRef;
|
@@ -92,7 +94,9 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
92
94
|
startConditionLabel: startConditionLabel,
|
93
95
|
conditionBuilderRef: conditionBuilderRef,
|
94
96
|
getConditionState: getConditionState,
|
95
|
-
|
97
|
+
getActionsState: getActionsState,
|
98
|
+
initialState: initialState,
|
99
|
+
actions: actions
|
96
100
|
}))));
|
97
101
|
});
|
98
102
|
|
@@ -108,27 +112,66 @@ exports.ConditionBuilder.displayName = componentName;
|
|
108
112
|
// See https://www.npmjs.com/package/prop-types#usage.
|
109
113
|
exports.ConditionBuilder.propTypes = {
|
110
114
|
/**
|
111
|
-
*
|
115
|
+
* optional array of actions
|
112
116
|
*/
|
113
|
-
|
114
|
-
|
117
|
+
actions: index["default"].arrayOf(index["default"].shape({
|
118
|
+
id: index["default"].oneOfType([index["default"].string | index["default"].number]).isRequired,
|
119
|
+
label: index["default"].string.isRequired
|
120
|
+
})),
|
115
121
|
/**
|
116
122
|
* Provide an optional class to be applied to the containing node.
|
117
123
|
*/
|
118
124
|
className: index["default"].string,
|
125
|
+
/**
|
126
|
+
* This is a callback that gives back the updated action state
|
127
|
+
*/
|
128
|
+
getActionsState: index["default"].func,
|
129
|
+
/**
|
130
|
+
* This is a callback that gives back updated condition state
|
131
|
+
*/
|
119
132
|
getConditionState: index["default"].func.isRequired,
|
133
|
+
/**
|
134
|
+
* This is a callback that get triggered when you want to dynamically fetch options.
|
135
|
+
* Component call this when the option array is not passed against a property with type as option in the input config.
|
136
|
+
* This is an asynchronous callback that can return a promise , and you need to resolve the promise with options array in the valid format.
|
137
|
+
* You will receive the root condition state and current condition as the 2 arguments.
|
138
|
+
* eg: const getOptions = async (conditionState,condition) => {
|
139
|
+
switch (condition.property) {
|
140
|
+
case 'continent':
|
141
|
+
return new Promise((resolve) => {
|
142
|
+
const continents=[{
|
143
|
+
label: 'Africa',
|
144
|
+
id: 'Africa',
|
145
|
+
},...]
|
146
|
+
resolve(continents);
|
147
|
+
});
|
148
|
+
default:
|
149
|
+
return [];
|
150
|
+
}
|
151
|
+
};
|
152
|
+
*/
|
120
153
|
getOptions: index["default"].func,
|
154
|
+
/**
|
155
|
+
* Optional prop if you want to pass a saved condition state.
|
156
|
+
* This object should respect the structure of condition state that is available in getConditionState callback
|
157
|
+
*/
|
121
158
|
initialState: index["default"].shape({
|
122
159
|
groups: index["default"].arrayOf(index["default"].shape({
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
160
|
+
groupOperator: index["default"].string.isRequired,
|
161
|
+
statement: index["default"].string.isRequired,
|
162
|
+
conditions: index["default"].arrayOf(index["default"].oneOfType([index["default"].shape({
|
163
|
+
property: index["default"].string.isRequired,
|
164
|
+
operator: index["default"].string.isRequired,
|
165
|
+
value: index["default"].oneOfType([index["default"].string, index["default"].arrayOf(index["default"].shape({
|
166
|
+
id: index["default"].string,
|
167
|
+
label: index["default"].string
|
168
|
+
})), index["default"].shape({
|
169
|
+
id: index["default"].string,
|
170
|
+
label: index["default"].string
|
171
|
+
})])
|
172
|
+
}), index["default"].object]))
|
173
|
+
})),
|
174
|
+
operator: index["default"].string
|
132
175
|
}),
|
133
176
|
/**
|
134
177
|
* This is a mandatory prop that defines the input to the condition builder.
|
@@ -136,17 +179,21 @@ exports.ConditionBuilder.propTypes = {
|
|
136
179
|
*/
|
137
180
|
inputConfig: index["default"].shape({
|
138
181
|
properties: index["default"].arrayOf(index["default"].shape({
|
139
|
-
id: index["default"].string,
|
140
|
-
label: index["default"].string,
|
182
|
+
id: index["default"].string.isRequired,
|
183
|
+
label: index["default"].string.isRequired,
|
141
184
|
icon: index["default"].oneOfType([index["default"].func, index["default"].object]),
|
142
|
-
type: index["default"].oneOf(['text', 'number', 'date', 'option', 'time']),
|
185
|
+
type: index["default"].oneOf(['text', 'number', 'date', 'option', 'time', 'custom']).isRequired,
|
143
186
|
config: index["default"].shape({
|
144
187
|
options: index["default"].arrayOf(index["default"].shape({
|
145
|
-
id: index["default"].string,
|
146
|
-
label: index["default"].string,
|
188
|
+
id: index["default"].string.isRequired,
|
189
|
+
label: index["default"].string.isRequired,
|
147
190
|
icon: index["default"].oneOfType([index["default"].func, index["default"].object])
|
148
191
|
})),
|
149
|
-
|
192
|
+
component: index["default"].func,
|
193
|
+
operators: index["default"].arrayOf(index["default"].shape({
|
194
|
+
id: index["default"].string.isRequired,
|
195
|
+
label: index["default"].string.isRequired
|
196
|
+
}))
|
150
197
|
})
|
151
198
|
}))
|
152
199
|
}).isRequired,
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export default ConditionBuilderActions;
|
2
|
+
declare function ConditionBuilderActions({ actions, className }: {
|
3
|
+
actions: any;
|
4
|
+
className: any;
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
6
|
+
declare namespace ConditionBuilderActions {
|
7
|
+
namespace propTypes {
|
8
|
+
let actions: PropTypes.Requireable<(PropTypes.InferProps<{
|
9
|
+
id: PropTypes.Requireable<number>;
|
10
|
+
label: PropTypes.Requireable<string>;
|
11
|
+
}> | null | undefined)[]>;
|
12
|
+
let className: PropTypes.Requireable<string>;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
import PropTypes from 'prop-types';
|
@@ -0,0 +1,137 @@
|
|
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 index = require('../../../node_modules/prop-types/index.js');
|
15
|
+
var icons = require('@carbon/react/icons');
|
16
|
+
var react = require('@carbon/react');
|
17
|
+
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
18
|
+
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
19
|
+
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
20
|
+
var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
|
21
|
+
var ConditionBuilderAdd = require('../ConditionBuilderAdd/ConditionBuilderAdd.js');
|
22
|
+
var uuidv4 = require('../../../global/js/utils/uuidv4.js');
|
23
|
+
var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
|
24
|
+
var util = require('../utils/util.js');
|
25
|
+
|
26
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
27
|
+
|
28
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
29
|
+
|
30
|
+
var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
31
|
+
var actions = _ref.actions,
|
32
|
+
className = _ref.className;
|
33
|
+
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
34
|
+
actionState = _useContext.actionState,
|
35
|
+
setActionState = _useContext.setActionState;
|
36
|
+
var addActionHandler = function addActionHandler() {
|
37
|
+
var action = {
|
38
|
+
id: uuidv4["default"](),
|
39
|
+
label: undefined,
|
40
|
+
popoverToOpen: 'actionField'
|
41
|
+
};
|
42
|
+
setActionState([].concat(_rollupPluginBabelHelpers.toConsumableArray(actionState), [action]));
|
43
|
+
};
|
44
|
+
var onchangeHandler = function onchangeHandler(evt, selectedId, actionIndex, currentAction) {
|
45
|
+
var action = actions.find(function (action) {
|
46
|
+
return action.id === selectedId;
|
47
|
+
}); //fetch the selected action from the input action array
|
48
|
+
|
49
|
+
//if the action is duplicate, that action is added with a new id, else the same action is used.
|
50
|
+
// same actions can be added multiple times
|
51
|
+
var newAction = util.checkDuplicateAction(actionState, selectedId, currentAction.id) ? _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, action), {}, {
|
52
|
+
id: uuidv4["default"]()
|
53
|
+
}) : action;
|
54
|
+
setActionState([].concat(_rollupPluginBabelHelpers.toConsumableArray(actionState.slice(0, actionIndex)), [newAction], _rollupPluginBabelHelpers.toConsumableArray(actionState.slice(actionIndex + 1))));
|
55
|
+
util.focusThisField(evt);
|
56
|
+
};
|
57
|
+
var onRemove = function onRemove(selectedId) {
|
58
|
+
setActionState(actionState.filter(function (action) {
|
59
|
+
return action.id !== selectedId;
|
60
|
+
}));
|
61
|
+
};
|
62
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
63
|
+
className: "".concat(className)
|
64
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.Section, {
|
65
|
+
className: "".concat(DataConfigs.blockClass, "__heading"),
|
66
|
+
level: 4
|
67
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.Heading, null, DataConfigs.translateWithId('actions'))), /*#__PURE__*/React__default["default"].createElement("div", {
|
68
|
+
className: "".concat(DataConfigs.blockClass, "__condition-wrapper")
|
69
|
+
}, actionState === null || actionState === void 0 ? void 0 : actionState.map(function (action, index) {
|
70
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
71
|
+
key: action.id,
|
72
|
+
"aria-hidden": true,
|
73
|
+
className: "".concat(DataConfigs.blockClass, "__condition-block conditionBlockWrapper ").concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom ")
|
74
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
75
|
+
className: "".concat(DataConfigs.blockClass, "__statement-button"),
|
76
|
+
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
77
|
+
label: index === 0 ? DataConfigs.translateWithId('then') : DataConfigs.translateWithId('and')
|
78
|
+
}), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
79
|
+
label: action.label,
|
80
|
+
title: DataConfigs.translateWithId('actions'),
|
81
|
+
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
82
|
+
condition: action,
|
83
|
+
"data-name": "actionField"
|
84
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
85
|
+
conditionState: {
|
86
|
+
value: action.label
|
87
|
+
},
|
88
|
+
onChange: function onChange(selectedId, evt) {
|
89
|
+
return onchangeHandler(evt, selectedId, index, action);
|
90
|
+
},
|
91
|
+
config: {
|
92
|
+
options: actions
|
93
|
+
}
|
94
|
+
})), /*#__PURE__*/React__default["default"].createElement("span", {
|
95
|
+
role: "gridcell",
|
96
|
+
"aria-label": DataConfigs.translateWithId('remove_action')
|
97
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, {
|
98
|
+
hideLabel: true,
|
99
|
+
label: DataConfigs.translateWithId('remove_action'),
|
100
|
+
onClick: function onClick() {
|
101
|
+
return onRemove(action.id);
|
102
|
+
}
|
103
|
+
// onMouseEnter={handleShowDeletionPreview}
|
104
|
+
// onMouseLeave={handleHideDeletionPreview}
|
105
|
+
// onFocus={handleShowDeletionPreview}
|
106
|
+
// onBlur={handleHideDeletionPreview}
|
107
|
+
,
|
108
|
+
renderIcon: icons.Close,
|
109
|
+
className: "".concat(DataConfigs.blockClass, "__close-condition"),
|
110
|
+
"data-name": "closeCondition"
|
111
|
+
})), actionState.length === index + 1 && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderAdd["default"], {
|
112
|
+
onClick: addActionHandler,
|
113
|
+
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-left"),
|
114
|
+
buttonLabel: DataConfigs.translateWithId('add_action')
|
115
|
+
}));
|
116
|
+
}), actionState.length === 0 && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderAdd["default"], {
|
117
|
+
onClick: addActionHandler,
|
118
|
+
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-left"),
|
119
|
+
buttonLabel: DataConfigs.translateWithId('add_action')
|
120
|
+
})));
|
121
|
+
};
|
122
|
+
var ConditionBuilderActions$1 = ConditionBuilderActions;
|
123
|
+
ConditionBuilderActions.propTypes = {
|
124
|
+
/**
|
125
|
+
* optional array of object that give the list of actions.
|
126
|
+
*/
|
127
|
+
actions: index["default"].arrayOf(index["default"].shape({
|
128
|
+
id: index["default"].number,
|
129
|
+
label: index["default"].string
|
130
|
+
})),
|
131
|
+
/**
|
132
|
+
* Provide an optional class to be applied to the containing node.
|
133
|
+
*/
|
134
|
+
className: index["default"].string
|
135
|
+
};
|
136
|
+
|
137
|
+
exports["default"] = ConditionBuilderActions$1;
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
13
|
var React = require('react');
|
14
|
+
var cx = require('classnames');
|
14
15
|
var icons = require('@carbon/react/icons');
|
15
16
|
var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
|
16
17
|
var index = require('../../../node_modules/prop-types/index.js');
|
@@ -19,6 +20,7 @@ var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
20
21
|
|
21
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
23
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
22
24
|
|
23
25
|
var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
24
26
|
var className = _ref.className,
|
@@ -81,13 +83,14 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
81
83
|
"data-name": "addButton",
|
82
84
|
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : DataConfigs.translateWithId('add-condition'),
|
83
85
|
wrapperProps: wrapperProps
|
84
|
-
})),
|
86
|
+
})), enableSubGroup && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
|
85
87
|
renderIcon: icons.TextNewLine,
|
86
88
|
onClick: addConditionSubGroupHandler,
|
87
|
-
className: "".concat(DataConfigs.blockClass, "
|
89
|
+
className: cx__default["default"]("".concat(DataConfigs.blockClass, "__add_condition_group ").concat(DataConfigs.blockClass, "__gap-left")),
|
88
90
|
hideLabel: true,
|
89
91
|
label: DataConfigs.translateWithId('add-condition'),
|
90
|
-
wrapperProps: wrapperProps
|
92
|
+
wrapperProps: wrapperProps,
|
93
|
+
wrapperClassName: cx__default["default"]("".concat(DataConfigs.blockClass, "__add_condition_group-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__add_condition_group-wrapper--show"), isAddSubgroup))
|
91
94
|
}, previewHandlersForSubgroup())));
|
92
95
|
};
|
93
96
|
var ConditionBuilderAdd$1 = ConditionBuilderAdd;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export function ConditionBuilderButton({ className, label, hideLabel, tooltipAlign, renderIcon: Icon, onClick, showToolTip, wrapperProps, onBlur, onFocus, onMouseEnter, onMouseLeave, }: {
|
1
|
+
export function ConditionBuilderButton({ className, label, hideLabel, tooltipAlign, renderIcon: Icon, onClick, showToolTip, wrapperProps, onBlur, onFocus, onMouseEnter, onMouseLeave, isInvalid, wrapperClassName, }: {
|
2
2
|
className: any;
|
3
3
|
label: any;
|
4
4
|
hideLabel: any;
|
@@ -11,11 +11,14 @@ export function ConditionBuilderButton({ className, label, hideLabel, tooltipAli
|
|
11
11
|
onFocus: any;
|
12
12
|
onMouseEnter: any;
|
13
13
|
onMouseLeave: any;
|
14
|
+
isInvalid: any;
|
15
|
+
wrapperClassName: any;
|
14
16
|
}): import("react/jsx-runtime").JSX.Element;
|
15
17
|
export namespace ConditionBuilderButton {
|
16
18
|
namespace propTypes {
|
17
19
|
let className: PropTypes.Requireable<string>;
|
18
20
|
let hideLabel: PropTypes.Requireable<boolean>;
|
21
|
+
let isInvalid: PropTypes.Requireable<boolean>;
|
19
22
|
let label: PropTypes.Requireable<string>;
|
20
23
|
let onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
21
24
|
let onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
@@ -25,6 +28,7 @@ export namespace ConditionBuilderButton {
|
|
25
28
|
let renderIcon: PropTypes.Requireable<object>;
|
26
29
|
let showToolTip: PropTypes.Requireable<boolean>;
|
27
30
|
let tooltipAlign: PropTypes.Requireable<string>;
|
31
|
+
let wrapperClassName: PropTypes.Requireable<string>;
|
28
32
|
let wrapperProps: PropTypes.Requireable<object>;
|
29
33
|
}
|
30
34
|
}
|
@@ -15,12 +15,14 @@ var cx = require('classnames');
|
|
15
15
|
var index = require('../../../node_modules/prop-types/index.js');
|
16
16
|
var react = require('@carbon/react');
|
17
17
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
18
|
+
var icons = require('@carbon/react/icons');
|
18
19
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
20
21
|
|
21
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
22
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
23
24
|
|
25
|
+
var _WarningAltFilled;
|
24
26
|
var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
|
25
27
|
var _Icon, _span;
|
26
28
|
var className = _ref.className,
|
@@ -34,24 +36,26 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
|
|
34
36
|
onBlur = _ref.onBlur,
|
35
37
|
onFocus = _ref.onFocus,
|
36
38
|
onMouseEnter = _ref.onMouseEnter,
|
37
|
-
onMouseLeave = _ref.onMouseLeave
|
39
|
+
onMouseLeave = _ref.onMouseLeave,
|
40
|
+
isInvalid = _ref.isInvalid,
|
41
|
+
wrapperClassName = _ref.wrapperClassName;
|
38
42
|
var Button = function Button() {
|
39
43
|
return /*#__PURE__*/React__default["default"].createElement("button", {
|
40
44
|
// role={'gridcell'}
|
41
45
|
tabIndex: -1,
|
42
|
-
className: cx__default["default"]([className, "".concat(DataConfigs.blockClass, "__button"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__text-ellipsis"), showToolTip && !hideLabel)]),
|
46
|
+
className: cx__default["default"]([className, "".concat(DataConfigs.blockClass, "__button"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__text-ellipsis"), showToolTip && !hideLabel && !isInvalid), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__invalid-input"), isInvalid)]),
|
43
47
|
type: "button",
|
44
48
|
onClick: onClick,
|
45
49
|
onBlur: onBlur,
|
46
50
|
onFocus: onFocus,
|
47
51
|
onMouseEnter: onMouseEnter,
|
48
52
|
onMouseLeave: onMouseLeave
|
49
|
-
}, Icon && (_Icon || (_Icon = /*#__PURE__*/React__default["default"].createElement(Icon, null))), !hideLabel && (_span || (_span = /*#__PURE__*/React__default["default"].createElement("span", null, label))));
|
53
|
+
}, Icon && (_Icon || (_Icon = /*#__PURE__*/React__default["default"].createElement(Icon, null))), !hideLabel && (_span || (_span = /*#__PURE__*/React__default["default"].createElement("span", null, label))), isInvalid && (_WarningAltFilled || (_WarningAltFilled = /*#__PURE__*/React__default["default"].createElement(icons.WarningAltFilled, null))));
|
50
54
|
};
|
51
55
|
return hideLabel || showToolTip ? /*#__PURE__*/React__default["default"].createElement(react.Tooltip, _rollupPluginBabelHelpers["extends"]({
|
52
56
|
label: label,
|
53
57
|
align: tooltipAlign,
|
54
|
-
className: "".concat(
|
58
|
+
className: "".concat(wrapperClassName)
|
55
59
|
}, wrapperProps), Button()) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, Button());
|
56
60
|
};
|
57
61
|
ConditionBuilderButton.propTypes = {
|
@@ -63,6 +67,10 @@ ConditionBuilderButton.propTypes = {
|
|
63
67
|
* decides if label and tooltip to be hidden
|
64
68
|
*/
|
65
69
|
hideLabel: index["default"].bool,
|
70
|
+
/**
|
71
|
+
* boolean to know the updated value in not valid
|
72
|
+
*/
|
73
|
+
isInvalid: index["default"].bool,
|
66
74
|
/**
|
67
75
|
* label of the button
|
68
76
|
*/
|
@@ -92,6 +100,10 @@ ConditionBuilderButton.propTypes = {
|
|
92
100
|
* tooltip position
|
93
101
|
*/
|
94
102
|
tooltipAlign: index["default"].string,
|
103
|
+
/**
|
104
|
+
* classname applies to the wrapper of popover
|
105
|
+
*/
|
106
|
+
wrapperClassName: index["default"].string,
|
95
107
|
/**
|
96
108
|
* optional props for tree grid to add role and aria-label to wrapper span
|
97
109
|
*/
|