@carbon/ibm-products 2.36.0-alpha.27 → 2.37.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 +5404 -5117
- 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 +4 -4
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +820 -61
- 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 +329 -6
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +9 -10
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
- package/es/components/Carousel/Carousel.d.ts +46 -2
- package/es/components/Carousel/Carousel.js +36 -21
- package/es/components/Carousel/CarouselItem.d.ts +19 -2
- package/es/components/Carousel/CarouselItem.js +0 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +261 -0
- package/es/components/ConditionBuilder/ConditionBuilder.js +45 -16
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +74 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
- package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
- package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +112 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +151 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +59 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +52 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +162 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +82 -0
- package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
- package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +85 -0
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +145 -0
- package/es/components/ConditionBuilder/utils/util.d.ts +4 -0
- package/es/components/ConditionBuilder/utils/util.js +16 -0
- package/es/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
- package/es/components/CreateTearsheet/CreateTearsheet.js +12 -32
- package/es/components/Datagrid/useParentDimensions.js +1 -1
- package/es/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
- package/es/components/EditUpdateCards/EditUpdateCards.js +3 -0
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
- package/es/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
- package/es/components/ExpressiveCard/ExpressiveCard.js +4 -0
- package/es/components/InlineTip/InlineTipButton.d.ts +21 -2
- package/es/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
- package/es/components/InterstitialScreen/InterstitialScreen.js +25 -14
- package/es/components/Nav/NavItem.js +1 -1
- package/es/components/NotificationsPanel/NotificationsPanel.js +5 -6
- package/es/components/PageHeader/PageHeader.js +12 -3
- package/es/components/SidePanel/SidePanel.js +1 -1
- package/es/components/SimpleHeader/SimpleHeader.d.ts +1 -5
- package/es/components/SimpleHeader/SimpleHeader.js +2 -4
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
- package/es/components/Tearsheet/TearsheetShell.d.ts +119 -10
- package/es/components/Tearsheet/TearsheetShell.js +18 -8
- package/es/components/UserProfileImage/UserProfileImage.d.ts +66 -2
- package/es/components/UserProfileImage/UserProfileImage.js +5 -3
- package/es/components/WebTerminal/WebTerminal.d.ts +46 -2
- package/es/components/WebTerminal/WebTerminal.js +2 -2
- package/es/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/es/global/js/hooks/usePrefersReducedMotion.js +28 -0
- package/es/global/js/utils/Wrap.d.ts +31 -2
- package/es/global/js/utils/Wrap.js +7 -9
- package/es/global/js/utils/getNodeTextContent.d.ts +1 -1
- package/es/global/js/utils/getNodeTextContent.js +1 -1
- package/es/global/js/utils/window.d.ts +2 -0
- package/es/global/js/utils/window.js +12 -0
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2780 -0
- package/lib/_virtual/_rollupPluginBabelHelpers.js +9 -10
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
- package/lib/components/Carousel/Carousel.d.ts +46 -2
- package/lib/components/Carousel/Carousel.js +35 -20
- package/lib/components/Carousel/CarouselItem.d.ts +19 -2
- package/lib/components/Carousel/CarouselItem.js +0 -1
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +270 -0
- package/lib/components/ConditionBuilder/ConditionBuilder.js +46 -17
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +48 -0
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +83 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
- package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +121 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +44 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +159 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +67 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +60 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +170 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +48 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +90 -0
- package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
- package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +93 -0
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +153 -0
- package/lib/components/ConditionBuilder/utils/util.d.ts +4 -0
- package/lib/components/ConditionBuilder/utils/util.js +20 -0
- package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
- package/lib/components/CreateTearsheet/CreateTearsheet.js +12 -32
- package/lib/components/Datagrid/useParentDimensions.js +1 -1
- package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
- package/lib/components/EditUpdateCards/EditUpdateCards.js +3 -0
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
- package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
- package/lib/components/ExpressiveCard/ExpressiveCard.js +4 -0
- package/lib/components/InlineTip/InlineTipButton.d.ts +21 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.js +24 -13
- package/lib/components/Nav/NavItem.js +2 -2
- package/lib/components/NotificationsPanel/NotificationsPanel.js +5 -6
- package/lib/components/PageHeader/PageHeader.js +11 -2
- package/lib/components/SidePanel/SidePanel.js +1 -1
- package/lib/components/SimpleHeader/SimpleHeader.d.ts +1 -5
- package/lib/components/SimpleHeader/SimpleHeader.js +2 -4
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
- package/lib/components/Tearsheet/TearsheetShell.d.ts +119 -10
- package/lib/components/Tearsheet/TearsheetShell.js +16 -6
- package/lib/components/UserProfileImage/UserProfileImage.d.ts +66 -2
- package/lib/components/UserProfileImage/UserProfileImage.js +5 -3
- package/lib/components/WebTerminal/WebTerminal.d.ts +46 -2
- package/lib/components/WebTerminal/WebTerminal.js +2 -2
- package/lib/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/lib/global/js/hooks/usePrefersReducedMotion.js +32 -0
- package/lib/global/js/utils/Wrap.d.ts +31 -2
- package/lib/global/js/utils/Wrap.js +7 -9
- package/lib/global/js/utils/getNodeTextContent.d.ts +1 -1
- package/lib/global/js/utils/getNodeTextContent.js +1 -1
- package/lib/global/js/utils/window.d.ts +2 -0
- package/lib/global/js/utils/window.js +16 -0
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2912 -0
- package/package.json +5 -5
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -1
- package/scss/components/ConditionBuilder/_condition-builder.scss +26 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +46 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +194 -0
- package/scss/components/ConditionBuilder/styles/_index.scss +2 -0
- package/scss/components/Guidebanner/_guidebanner.scss +3 -0
- package/scss/components/InterstitialScreen/_interstitial-screen.scss +1 -6
- package/scss/components/Tearsheet/_tearsheet.scss +3 -1
- package/telemetry.yml +3 -0
- package/es/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
- package/es/global/js/utils/keyboardNavigation.d.ts +0 -27
- package/es/global/js/utils/keyboardNavigation.js +0 -33
- package/es/global/js/utils/wrapFocus.d.ts +0 -25
- package/es/global/js/utils/wrapFocus.js +0 -68
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3004
- package/lib/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
- package/lib/global/js/utils/keyboardNavigation.d.ts +0 -27
- package/lib/global/js/utils/keyboardNavigation.js +0 -39
- package/lib/global/js/utils/wrapFocus.d.ts +0 -25
- package/lib/global/js/utils/wrapFocus.js +0 -73
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3136
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
+
var React = require('react');
|
|
14
|
+
var react = require('@carbon/react');
|
|
15
|
+
var icons = require('@carbon/react/icons');
|
|
16
|
+
var index = require('../../../../node_modules/prop-types/index.js');
|
|
17
|
+
var ConditionBuilderProvider = require('../../ConditionBuilderContext/ConditionBuilderProvider.js');
|
|
18
|
+
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
|
19
|
+
|
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
+
|
|
22
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
|
+
|
|
24
|
+
var _CheckboxCheckedFille, _Checkbox, _SelectSkeleton;
|
|
25
|
+
var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
|
|
26
|
+
var _ref$conditionState = _ref.conditionState,
|
|
27
|
+
conditionState = _ref$conditionState === void 0 ? {} : _ref$conditionState,
|
|
28
|
+
_ref$config = _ref.config,
|
|
29
|
+
config = _ref$config === void 0 ? {} : _ref$config,
|
|
30
|
+
onChange = _ref.onChange;
|
|
31
|
+
var multiSelectable = conditionState.operator === 'one-of';
|
|
32
|
+
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
|
33
|
+
popOverSearchThreshold = _useContext.popOverSearchThreshold,
|
|
34
|
+
getOptions = _useContext.getOptions;
|
|
35
|
+
var _useState = React.useState(config.options),
|
|
36
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
37
|
+
allOptions = _useState2[0],
|
|
38
|
+
setAllOptions = _useState2[1];
|
|
39
|
+
var _useState3 = React.useState(config.options),
|
|
40
|
+
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
|
41
|
+
filteredItems = _useState4[0],
|
|
42
|
+
setFilteredItems = _useState4[1];
|
|
43
|
+
var selection = Array.isArray(conditionState.value) ? conditionState.value : conditionState.value !== undefined ? [conditionState.value] : [];
|
|
44
|
+
React.useEffect(function () {
|
|
45
|
+
if (!allOptions && getOptions) {
|
|
46
|
+
var fetchData = /*#__PURE__*/function () {
|
|
47
|
+
var _ref2 = _rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
|
|
48
|
+
var response;
|
|
49
|
+
return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
|
|
50
|
+
while (1) switch (_context.prev = _context.next) {
|
|
51
|
+
case 0:
|
|
52
|
+
_context.next = 2;
|
|
53
|
+
return getOptions(conditionState);
|
|
54
|
+
case 2:
|
|
55
|
+
response = _context.sent;
|
|
56
|
+
if ((response === null || response === void 0 ? void 0 : response.length) > 0 && Object.keys(response[0]).includes('label') && Object.keys(response[0]).includes('id')) {
|
|
57
|
+
setAllOptions(response);
|
|
58
|
+
setFilteredItems(response);
|
|
59
|
+
}
|
|
60
|
+
case 4:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
63
|
+
}
|
|
64
|
+
}, _callee);
|
|
65
|
+
}));
|
|
66
|
+
return function fetchData() {
|
|
67
|
+
return _ref2.apply(this, arguments);
|
|
68
|
+
};
|
|
69
|
+
}();
|
|
70
|
+
fetchData(); // Call the async method
|
|
71
|
+
}
|
|
72
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
|
+
}, []);
|
|
74
|
+
var handleSelectAll = function handleSelectAll(e) {
|
|
75
|
+
if (e.currentTarget.dataset.selectedAll == 'false') {
|
|
76
|
+
onChange(undefined);
|
|
77
|
+
} else {
|
|
78
|
+
onChange(allOptions.map(function (op) {
|
|
79
|
+
return op.id;
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var onSearchChangeHandler = function onSearchChangeHandler(e) {
|
|
84
|
+
var value = e.target.value;
|
|
85
|
+
var _filteredItems = allOptions.filter(function (opt) {
|
|
86
|
+
return opt.label.toLowerCase().includes(value.toLowerCase());
|
|
87
|
+
});
|
|
88
|
+
setFilteredItems(_filteredItems);
|
|
89
|
+
};
|
|
90
|
+
var onClickHandler = function onClickHandler(e, option, isSelected) {
|
|
91
|
+
if (multiSelectable) {
|
|
92
|
+
if (isSelected) {
|
|
93
|
+
var items = selection.filter(function (v) {
|
|
94
|
+
return v !== option.id;
|
|
95
|
+
});
|
|
96
|
+
onChange(items.length > 0 ? items : undefined, e);
|
|
97
|
+
} else {
|
|
98
|
+
onChange([].concat(_rollupPluginBabelHelpers.toConsumableArray(selection), [option.id]), e);
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
onChange(option.id, e);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, allOptions && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
105
|
+
className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option")
|
|
106
|
+
}, (config.includeSearch || allOptions.length > popOverSearchThreshold) && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
107
|
+
className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option__search")
|
|
108
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.Search, {
|
|
109
|
+
size: "sm",
|
|
110
|
+
labelText: DataConfigs.translateWithId('clear_search'),
|
|
111
|
+
closeButtonLabelText: DataConfigs.translateWithId('clear_search'),
|
|
112
|
+
onChange: onSearchChangeHandler
|
|
113
|
+
})), multiSelectable && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
114
|
+
className: "".concat(DataConfigs.blockClass, "__multiselectSelectionStatusContainer")
|
|
115
|
+
}, /*#__PURE__*/React__default["default"].createElement("h4", null, /*#__PURE__*/React__default["default"].createElement("label", null, selection.length, "/", allOptions.length, " Selected")), /*#__PURE__*/React__default["default"].createElement(react.Button, {
|
|
116
|
+
kind: 'ghost',
|
|
117
|
+
size: 'sm',
|
|
118
|
+
"data-selected-all": "".concat(selection.length == 0 ? true : false),
|
|
119
|
+
onClick: handleSelectAll,
|
|
120
|
+
className: "".concat(DataConfigs.blockClass, "__selectAll-button")
|
|
121
|
+
}, selection.length == 0 ? 'Select all' : 'Deselect all')), /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
122
|
+
"aria-label": conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : DataConfigs.translateWithId('property'),
|
|
123
|
+
role: "listbox",
|
|
124
|
+
"data-multi-select": multiSelectable
|
|
125
|
+
}, filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.map(function (option) {
|
|
126
|
+
var isSelected = selection.includes(option.id);
|
|
127
|
+
var Icon = option.icon;
|
|
128
|
+
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
129
|
+
tabIndex: 0,
|
|
130
|
+
key: option.id,
|
|
131
|
+
role: "option",
|
|
132
|
+
"aria-selected": isSelected,
|
|
133
|
+
className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option__option"),
|
|
134
|
+
onKeyUp: function onKeyUp() {
|
|
135
|
+
return false;
|
|
136
|
+
},
|
|
137
|
+
onClick: function onClick(e) {
|
|
138
|
+
return onClickHandler(e, option, isSelected);
|
|
139
|
+
}
|
|
140
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
141
|
+
className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option__option-content")
|
|
142
|
+
}, multiSelectable ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
143
|
+
className: "".concat(DataConfigs.blockClass, "__option-check-box")
|
|
144
|
+
}, isSelected ? _CheckboxCheckedFille || (_CheckboxCheckedFille = /*#__PURE__*/React__default["default"].createElement(icons.CheckboxCheckedFilled, null)) : _Checkbox || (_Checkbox = /*#__PURE__*/React__default["default"].createElement(icons.Checkbox, null))), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
145
|
+
className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option__option-label")
|
|
146
|
+
}, option.label), Icon && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
147
|
+
className: "".concat(DataConfigs.blockClass, "__option-icon")
|
|
148
|
+
}, /*#__PURE__*/React__default["default"].createElement(Icon, null))) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
149
|
+
className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option__option-label")
|
|
150
|
+
}, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, null), option.label), isSelected && /*#__PURE__*/React__default["default"].createElement(icons.Checkmark, {
|
|
151
|
+
className: "".concat(DataConfigs.blockClass, "__condition-builder-checkmark")
|
|
152
|
+
}))));
|
|
153
|
+
}))), !allOptions && (_SelectSkeleton || (_SelectSkeleton = /*#__PURE__*/React__default["default"].createElement(react.SelectSkeleton, null))));
|
|
154
|
+
};
|
|
155
|
+
ConditionBuilderItemOption.propTypes = {
|
|
156
|
+
/**
|
|
157
|
+
* current condition object
|
|
158
|
+
*/
|
|
159
|
+
conditionState: index["default"].object,
|
|
160
|
+
/**
|
|
161
|
+
* current config object that this property is part of
|
|
162
|
+
*/
|
|
163
|
+
config: index["default"].object,
|
|
164
|
+
/**
|
|
165
|
+
* callback to update state oin date change
|
|
166
|
+
*/
|
|
167
|
+
onChange: index["default"].func
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
exports.ConditionBuilderItemOption = ConditionBuilderItemOption;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function ConditionBuilderItemText({ conditionState, onChange }: {
|
|
2
|
+
conditionState: any;
|
|
3
|
+
onChange: any;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export namespace ConditionBuilderItemText {
|
|
6
|
+
namespace propTypes {
|
|
7
|
+
let conditionState: PropTypes.Requireable<object>;
|
|
8
|
+
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,48 @@
|
|
|
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 React = require('react');
|
|
13
|
+
var react = require('@carbon/react');
|
|
14
|
+
var index = require('../../../../node_modules/prop-types/index.js');
|
|
15
|
+
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
+
|
|
19
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
|
+
|
|
21
|
+
var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
|
|
22
|
+
var _conditionState$value, _conditionState$prope;
|
|
23
|
+
var conditionState = _ref.conditionState,
|
|
24
|
+
_onChange = _ref.onChange;
|
|
25
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
26
|
+
className: "".concat(DataConfigs.blockClass, "__condition-builder-item-text")
|
|
27
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.TextInput, {
|
|
28
|
+
labelText: conditionState.property,
|
|
29
|
+
hideLabel: true,
|
|
30
|
+
value: (_conditionState$value = conditionState.value) !== null && _conditionState$value !== void 0 ? _conditionState$value : '',
|
|
31
|
+
id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
|
|
32
|
+
onChange: function onChange(e) {
|
|
33
|
+
_onChange(e.target.value);
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
ConditionBuilderItemText.propTypes = {
|
|
38
|
+
/**
|
|
39
|
+
* current condition object
|
|
40
|
+
*/
|
|
41
|
+
conditionState: index["default"].object,
|
|
42
|
+
/**
|
|
43
|
+
* callback to update state oin date change
|
|
44
|
+
*/
|
|
45
|
+
onChange: index["default"].func
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.ConditionBuilderItemText = ConditionBuilderItemText;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function ConditionBuilderItemTime({ onChange, config }: {
|
|
2
|
+
onChange: any;
|
|
3
|
+
config: any;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export namespace ConditionBuilderItemTime {
|
|
6
|
+
namespace propTypes {
|
|
7
|
+
let config: PropTypes.Requireable<object>;
|
|
8
|
+
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
+
var React = require('react');
|
|
14
|
+
var react = require('@carbon/react');
|
|
15
|
+
var index = require('../../../../node_modules/prop-types/index.js');
|
|
16
|
+
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
|
17
|
+
|
|
18
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
|
+
|
|
20
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
|
+
|
|
22
|
+
var _SelectItem, _SelectItem2;
|
|
23
|
+
var ConditionBuilderItemTime = function ConditionBuilderItemTime(_ref) {
|
|
24
|
+
var _config$timeZones, _config$timeZones2;
|
|
25
|
+
var onChange = _ref.onChange,
|
|
26
|
+
config = _ref.config;
|
|
27
|
+
var _useState = React.useState(''),
|
|
28
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
29
|
+
timeValue = _useState2[0],
|
|
30
|
+
setTimeValue = _useState2[1];
|
|
31
|
+
var _useState3 = React.useState('AM'),
|
|
32
|
+
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
|
33
|
+
dayZoneValue = _useState4[0],
|
|
34
|
+
setDayZoneValue = _useState4[1];
|
|
35
|
+
var _useState5 = React.useState(config === null || config === void 0 || (_config$timeZones = config.timeZones) === null || _config$timeZones === void 0 ? void 0 : _config$timeZones[0]),
|
|
36
|
+
_useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
|
|
37
|
+
timeZoneValue = _useState6[0],
|
|
38
|
+
setTimeZoneValue = _useState6[1];
|
|
39
|
+
React.useEffect(function () {
|
|
40
|
+
var timeToUpdate = "".concat(timeValue !== null && timeValue !== void 0 ? timeValue : '', " ").concat(dayZoneValue !== null && dayZoneValue !== void 0 ? dayZoneValue : '', " ").concat(timeZoneValue !== null && timeZoneValue !== void 0 ? timeZoneValue : '');
|
|
41
|
+
onChange(timeValue ? timeToUpdate : undefined);
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
}, [timeValue, dayZoneValue, timeZoneValue]);
|
|
44
|
+
var setTimeZone = function setTimeZone(e) {
|
|
45
|
+
setTimeZoneValue(e.target.value);
|
|
46
|
+
};
|
|
47
|
+
var setDayZone = function setDayZone(e) {
|
|
48
|
+
setDayZoneValue(e.target.value);
|
|
49
|
+
};
|
|
50
|
+
var setTime = function setTime(e) {
|
|
51
|
+
setTimeValue(e.target.value);
|
|
52
|
+
};
|
|
53
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
54
|
+
className: "".concat(DataConfigs.blockClass, "__condition-builder-item-time")
|
|
55
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.TimePicker, {
|
|
56
|
+
id: "time-picker",
|
|
57
|
+
labelText: "Select a time",
|
|
58
|
+
onChange: setTime
|
|
59
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.TimePickerSelect, {
|
|
60
|
+
id: "time-picker-day-zone",
|
|
61
|
+
onChange: setDayZone
|
|
62
|
+
}, _SelectItem || (_SelectItem = /*#__PURE__*/React__default["default"].createElement(react.SelectItem, {
|
|
63
|
+
value: "AM",
|
|
64
|
+
text: "AM"
|
|
65
|
+
})), _SelectItem2 || (_SelectItem2 = /*#__PURE__*/React__default["default"].createElement(react.SelectItem, {
|
|
66
|
+
value: "PM",
|
|
67
|
+
text: "PM"
|
|
68
|
+
}))), /*#__PURE__*/React__default["default"].createElement(react.TimePickerSelect, {
|
|
69
|
+
id: "time-picker-select-2",
|
|
70
|
+
onChange: setTimeZone
|
|
71
|
+
}, config === null || config === void 0 || (_config$timeZones2 = config.timeZones) === null || _config$timeZones2 === void 0 ? void 0 : _config$timeZones2.map(function (timeZone, index) {
|
|
72
|
+
return /*#__PURE__*/React__default["default"].createElement(react.SelectItem, {
|
|
73
|
+
key: index,
|
|
74
|
+
value: timeZone,
|
|
75
|
+
text: timeZone
|
|
76
|
+
});
|
|
77
|
+
}))));
|
|
78
|
+
};
|
|
79
|
+
ConditionBuilderItemTime.propTypes = {
|
|
80
|
+
/**
|
|
81
|
+
* current config object that this property is part of
|
|
82
|
+
*/
|
|
83
|
+
config: index["default"].object,
|
|
84
|
+
/**
|
|
85
|
+
* callback to update state oin date change
|
|
86
|
+
*/
|
|
87
|
+
onChange: index["default"].func
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
exports.ConditionBuilderItemTime = ConditionBuilderItemTime;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default ConditionConnector;
|
|
2
|
+
declare function ConditionConnector({ operator, className, onChange, ...rest }: {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
operator: any;
|
|
5
|
+
className: any;
|
|
6
|
+
onChange: any;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare namespace ConditionConnector {
|
|
9
|
+
namespace propTypes {
|
|
10
|
+
let className: PropTypes.Requireable<string>;
|
|
11
|
+
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
+
let operator: PropTypes.Requireable<string>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,93 @@
|
|
|
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 ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
|
15
|
+
var ConditionBuilderItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js');
|
|
16
|
+
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
|
17
|
+
var settings = require('../../../settings.js');
|
|
18
|
+
var index = require('../../../node_modules/prop-types/index.js');
|
|
19
|
+
var util = require('../utils/util.js');
|
|
20
|
+
|
|
21
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
|
+
|
|
23
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
|
+
|
|
25
|
+
var _excluded = ["operator", "className", "onChange"];
|
|
26
|
+
var blockClass = "".concat(settings.pkg.prefix, "--condition-builder");
|
|
27
|
+
function ConditionConnector(_ref) {
|
|
28
|
+
var operator = _ref.operator,
|
|
29
|
+
className = _ref.className,
|
|
30
|
+
onChange = _ref.onChange,
|
|
31
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
var handleConnectorHover = React.useCallback(function (parentGroup, isHover) {
|
|
33
|
+
if (isHover) {
|
|
34
|
+
parentGroup.classList.add('hoveredConnector');
|
|
35
|
+
} else {
|
|
36
|
+
parentGroup.classList.remove('hoveredConnector');
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
var activeConnectorHandler = function activeConnectorHandler(e) {
|
|
40
|
+
var parentGroup = e.currentTarget.closest('.eachGroup');
|
|
41
|
+
handleConnectorHover(parentGroup, true);
|
|
42
|
+
};
|
|
43
|
+
var inActiveConnectorHandler = function inActiveConnectorHandler(e) {
|
|
44
|
+
var parentGroup = e.currentTarget.closest('.eachGroup');
|
|
45
|
+
handleConnectorHover(parentGroup, false);
|
|
46
|
+
};
|
|
47
|
+
var onChangeHandler = function onChangeHandler(op, e) {
|
|
48
|
+
onChange(op);
|
|
49
|
+
util.focusThisField(e);
|
|
50
|
+
};
|
|
51
|
+
return (
|
|
52
|
+
/*#__PURE__*/
|
|
53
|
+
// <div className={className} {...rest}>
|
|
54
|
+
React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, _rollupPluginBabelHelpers["extends"]({
|
|
55
|
+
label: operator,
|
|
56
|
+
title: DataConfigs.translateWithId('connector'),
|
|
57
|
+
"data-name": "connectorField",
|
|
58
|
+
onMouseEnter: activeConnectorHandler,
|
|
59
|
+
onMouseLeave: inActiveConnectorHandler,
|
|
60
|
+
onFocus: activeConnectorHandler,
|
|
61
|
+
onBlur: inActiveConnectorHandler
|
|
62
|
+
}, rest, {
|
|
63
|
+
popOverClassName: className,
|
|
64
|
+
className: "".concat(blockClass, "__connector-button ")
|
|
65
|
+
}), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
|
|
66
|
+
config: {
|
|
67
|
+
options: DataConfigs.connectorConfig
|
|
68
|
+
},
|
|
69
|
+
conditionState: {
|
|
70
|
+
value: operator,
|
|
71
|
+
label: DataConfigs.translateWithId('connector')
|
|
72
|
+
},
|
|
73
|
+
onChange: onChangeHandler
|
|
74
|
+
}))
|
|
75
|
+
// </div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
ConditionConnector.propTypes = {
|
|
79
|
+
/**
|
|
80
|
+
* Provide an optional class to be applied to the containing node.
|
|
81
|
+
*/
|
|
82
|
+
className: index["default"].string,
|
|
83
|
+
/**
|
|
84
|
+
* callback to update the current condition of the state tree
|
|
85
|
+
*/
|
|
86
|
+
onChange: index["default"].func,
|
|
87
|
+
/**
|
|
88
|
+
* string that defines the connector operator (and/or)
|
|
89
|
+
*/
|
|
90
|
+
operator: index["default"].string
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
exports["default"] = ConditionConnector;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default ConditionGroupBuilder;
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* state - this is the current group that is being rendered . This can be a inner group or outer group
|
|
5
|
+
* All the inner components of group are called from here.
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
declare function ConditionGroupBuilder({ state, aria, onRemove, onChange, conditionBuilderRef, }: {
|
|
9
|
+
state: any;
|
|
10
|
+
aria: any;
|
|
11
|
+
onRemove: any;
|
|
12
|
+
onChange: any;
|
|
13
|
+
conditionBuilderRef: any;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare namespace ConditionGroupBuilder {
|
|
16
|
+
namespace propTypes {
|
|
17
|
+
let aria: PropTypes.Requireable<object>;
|
|
18
|
+
let conditionBuilderRef: PropTypes.Requireable<object>;
|
|
19
|
+
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
+
let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
21
|
+
let state: PropTypes.Requireable<object>;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,153 @@
|
|
|
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 ConditionBlock = require('../ConditionBlock/ConditionBlock.js');
|
|
15
|
+
var index = require('../../../node_modules/prop-types/index.js');
|
|
16
|
+
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
|
17
|
+
|
|
18
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
|
+
|
|
20
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* state - this is the current group that is being rendered . This can be a inner group or outer group
|
|
25
|
+
* All the inner components of group are called from here.
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
29
|
+
var _state$conditions;
|
|
30
|
+
var state = _ref.state,
|
|
31
|
+
aria = _ref.aria,
|
|
32
|
+
onRemove = _ref.onRemove,
|
|
33
|
+
onChange = _ref.onChange,
|
|
34
|
+
conditionBuilderRef = _ref.conditionBuilderRef;
|
|
35
|
+
var onRemoveHandler = function onRemoveHandler(conditionIndex, e) {
|
|
36
|
+
if (state.conditions.length > 1) {
|
|
37
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
|
38
|
+
conditions: state.conditions.filter(function (condition, cIndex) {
|
|
39
|
+
return conditionIndex !== cIndex;
|
|
40
|
+
})
|
|
41
|
+
}));
|
|
42
|
+
handleFocusOnClose(e);
|
|
43
|
+
} else {
|
|
44
|
+
onRemove();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var onChangeHandler = function onChangeHandler(updatedConditions, conditionIndex) {
|
|
48
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
|
49
|
+
conditions: state.conditions.map(function (condition, cIndex) {
|
|
50
|
+
return conditionIndex === cIndex ? updatedConditions : condition;
|
|
51
|
+
})
|
|
52
|
+
}));
|
|
53
|
+
};
|
|
54
|
+
var addConditionHandler = function addConditionHandler(conditionIndex) {
|
|
55
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
|
56
|
+
conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(state.conditions.slice(0, conditionIndex + 1)), [{
|
|
57
|
+
property: undefined,
|
|
58
|
+
operator: '',
|
|
59
|
+
value: '',
|
|
60
|
+
popoverToOpen: 'propertyField'
|
|
61
|
+
}], _rollupPluginBabelHelpers.toConsumableArray(state.conditions.slice(conditionIndex + 1)))
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
var handleFocusOnClose = function handleFocusOnClose(e) {
|
|
65
|
+
var _e$currentTarget;
|
|
66
|
+
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"]');
|
|
67
|
+
if (previousClose) {
|
|
68
|
+
previousClose.focus();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
72
|
+
className: " ".concat(DataConfigs.blockClass, "__condition-builder__group eachGroup")
|
|
73
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74
|
+
className: "".concat(DataConfigs.blockClass, "__condition-wrapper"),
|
|
75
|
+
role: "grid",
|
|
76
|
+
"aria-label": DataConfigs.translateWithId('condition_builder_group')
|
|
77
|
+
}, state === null || state === void 0 || (_state$conditions = state.conditions) === null || _state$conditions === void 0 ? void 0 : _state$conditions.map(function (eachCondition, conditionIndex) {
|
|
78
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
79
|
+
key: conditionIndex
|
|
80
|
+
}, eachCondition.conditions && /*#__PURE__*/React__default["default"].createElement(ConditionGroupBuilder, {
|
|
81
|
+
aria: {
|
|
82
|
+
level: aria.level + 1,
|
|
83
|
+
posinset: conditionIndex + 1,
|
|
84
|
+
setsize: state.conditions.length
|
|
85
|
+
},
|
|
86
|
+
state: eachCondition,
|
|
87
|
+
onChange: function onChange(updatedConditions) {
|
|
88
|
+
onChangeHandler(updatedConditions, conditionIndex);
|
|
89
|
+
},
|
|
90
|
+
onRemove: function onRemove(e) {
|
|
91
|
+
onRemoveHandler(conditionIndex, e);
|
|
92
|
+
},
|
|
93
|
+
conditionBuilderRef: conditionBuilderRef,
|
|
94
|
+
key: conditionIndex
|
|
95
|
+
}), !eachCondition.conditions && /*#__PURE__*/React__default["default"].createElement(ConditionBlock["default"], {
|
|
96
|
+
key: conditionIndex,
|
|
97
|
+
conjunction: conditionIndex > 0 ? state.groupOperator : undefined,
|
|
98
|
+
aria: {
|
|
99
|
+
level: aria.level + 1,
|
|
100
|
+
posinset: conditionIndex + 1,
|
|
101
|
+
setsize: state.conditions.length
|
|
102
|
+
},
|
|
103
|
+
isStatement: conditionIndex == 0,
|
|
104
|
+
state: eachCondition,
|
|
105
|
+
group: state,
|
|
106
|
+
conditionIndex: conditionIndex,
|
|
107
|
+
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom"),
|
|
108
|
+
onChange: function onChange(updatedConditions) {
|
|
109
|
+
onChangeHandler(updatedConditions, conditionIndex);
|
|
110
|
+
},
|
|
111
|
+
addConditionHandler: addConditionHandler,
|
|
112
|
+
onRemove: function onRemove(e) {
|
|
113
|
+
onRemoveHandler(conditionIndex, e);
|
|
114
|
+
},
|
|
115
|
+
onConnectorOperatorChange: function onConnectorOperatorChange(op) {
|
|
116
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
|
117
|
+
groupOperator: op
|
|
118
|
+
}));
|
|
119
|
+
},
|
|
120
|
+
onStatementChange: function onStatementChange(updatedStatement) {
|
|
121
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
|
122
|
+
statement: updatedStatement
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
}));
|
|
126
|
+
})));
|
|
127
|
+
};
|
|
128
|
+
var ConditionGroupBuilder$1 = ConditionGroupBuilder;
|
|
129
|
+
ConditionGroupBuilder.propTypes = {
|
|
130
|
+
/**
|
|
131
|
+
* object contains the aria attributes
|
|
132
|
+
*/
|
|
133
|
+
aria: index["default"].object,
|
|
134
|
+
/**
|
|
135
|
+
* ref of condition builder
|
|
136
|
+
*/
|
|
137
|
+
conditionBuilderRef: index["default"].object,
|
|
138
|
+
/**
|
|
139
|
+
|
|
140
|
+
* callback to update the current condition of the state tree
|
|
141
|
+
*/
|
|
142
|
+
onChange: index["default"].func,
|
|
143
|
+
/**
|
|
144
|
+
* call back to remove the particular group from the state tree
|
|
145
|
+
*/
|
|
146
|
+
onRemove: index["default"].func,
|
|
147
|
+
/**
|
|
148
|
+
* state defines the current group
|
|
149
|
+
*/
|
|
150
|
+
state: index["default"].object
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
exports["default"] = ConditionGroupBuilder$1;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export function focusThisField(e: any): void;
|
|
2
|
+
export function focusThisItem(currentElement: any): void;
|
|
3
|
+
export function traverseClockVise(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
|
|
4
|
+
export function traverseReverse(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
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 focusThisField = function focusThisField(e) {
|
|
13
|
+
setTimeout(function () {
|
|
14
|
+
var _e$target$closest, _e$target$closest2;
|
|
15
|
+
(_e$target$closest = e.target.closest('[role="gridcell"]')) === null || _e$target$closest === void 0 || (_e$target$closest = _e$target$closest.querySelector('button')) === null || _e$target$closest === void 0 || _e$target$closest.click();
|
|
16
|
+
(_e$target$closest2 = e.target.closest('[role="gridcell"]')) === null || _e$target$closest2 === void 0 || (_e$target$closest2 = _e$target$closest2.querySelector('button')) === null || _e$target$closest2 === void 0 || _e$target$closest2.focus();
|
|
17
|
+
}, 0);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.focusThisField = focusThisField;
|