@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
@@ -12,7 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
13
|
var React = require('react');
|
14
14
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
15
|
-
var
|
15
|
+
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
16
16
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
17
17
|
var index = require('../../../node_modules/prop-types/index.js');
|
18
18
|
var util = require('../utils/util.js');
|
@@ -65,7 +65,7 @@ var ConditionConnector = function ConditionConnector(_ref) {
|
|
65
65
|
}, rest, {
|
66
66
|
popOverClassName: className,
|
67
67
|
className: "".concat(DataConfigs.blockClass, "__connector-button ")
|
68
|
-
}), /*#__PURE__*/React__default["default"].createElement(
|
68
|
+
}), /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
69
69
|
config: {
|
70
70
|
options: DataConfigs.connectorConfig
|
71
71
|
},
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
12
12
|
var React = require('react');
|
13
13
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
14
14
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
15
|
-
var
|
15
|
+
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
16
16
|
var util = require('../utils/util.js');
|
17
17
|
var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
|
18
18
|
|
@@ -34,7 +34,7 @@ var GroupConnector = function GroupConnector() {
|
|
34
34
|
"data-name": "connectorField",
|
35
35
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
36
36
|
className: "".concat(DataConfigs.blockClass, "__statement-button")
|
37
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
37
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
38
38
|
conditionState: {
|
39
39
|
value: rootState.operator,
|
40
40
|
label: DataConfigs.translateWithId('condition')
|
package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts
CHANGED
@@ -1,30 +1,28 @@
|
|
1
1
|
export default ConditionBuilderContent;
|
2
|
-
declare function ConditionBuilderContent({ startConditionLabel, conditionBuilderRef, getConditionState, initialState, }: {
|
2
|
+
declare function ConditionBuilderContent({ startConditionLabel, conditionBuilderRef, getConditionState, getActionsState, initialState, actions, }: {
|
3
3
|
startConditionLabel: any;
|
4
4
|
conditionBuilderRef: any;
|
5
5
|
getConditionState: any;
|
6
|
+
getActionsState: any;
|
6
7
|
initialState: any;
|
8
|
+
actions: any;
|
7
9
|
}): import("react/jsx-runtime").JSX.Element;
|
8
10
|
declare namespace ConditionBuilderContent {
|
9
11
|
namespace propTypes {
|
10
12
|
let actions: PropTypes.Requireable<(PropTypes.InferProps<{
|
11
|
-
id: PropTypes.
|
12
|
-
label: PropTypes.
|
13
|
+
id: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
14
|
+
label: PropTypes.Validator<string>;
|
13
15
|
}> | null | undefined)[]>;
|
14
16
|
let conditionBuilderRef: PropTypes.Requireable<object>;
|
15
17
|
let getActionsState: PropTypes.Requireable<(...args: any[]) => any>;
|
16
18
|
let getConditionState: PropTypes.Validator<(...args: any[]) => any>;
|
17
19
|
let initialState: PropTypes.Requireable<PropTypes.InferProps<{
|
18
20
|
groups: PropTypes.Requireable<(PropTypes.InferProps<{
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
conditions: PropTypes.Requireable<(PropTypes.InferProps<{
|
23
|
-
property: PropTypes.Requireable<string>;
|
24
|
-
operator: PropTypes.Requireable<string>;
|
25
|
-
value: PropTypes.Requireable<string>;
|
26
|
-
}> | null | undefined)[]>;
|
21
|
+
groupOperator: PropTypes.Validator<string>;
|
22
|
+
statement: PropTypes.Validator<string>;
|
23
|
+
conditions: PropTypes.Requireable<(object | null | undefined)[]>;
|
27
24
|
}> | null | undefined)[]>;
|
25
|
+
operator: PropTypes.Requireable<string>;
|
28
26
|
}>>;
|
29
27
|
let startConditionLabel: PropTypes.Validator<string>;
|
30
28
|
}
|
@@ -21,6 +21,7 @@ var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilder
|
|
21
21
|
var uuidv4 = require('../../../global/js/utils/uuidv4.js');
|
22
22
|
var ConditionPreview = require('../ConditionPreview/ConditionPreview.js');
|
23
23
|
var GroupConnector = require('../ConditionBuilderConnector/GroupConnector.js');
|
24
|
+
var ConditionBuilderActions = require('../ConditionBuilderActions/ConditionBuilderActions.js');
|
24
25
|
|
25
26
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
26
27
|
|
@@ -32,14 +33,14 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
32
33
|
var startConditionLabel = _ref.startConditionLabel,
|
33
34
|
conditionBuilderRef = _ref.conditionBuilderRef,
|
34
35
|
getConditionState = _ref.getConditionState,
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
// );
|
36
|
+
getActionsState = _ref.getActionsState,
|
37
|
+
initialState = _ref.initialState,
|
38
|
+
actions = _ref.actions;
|
39
39
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
40
40
|
rootState = _useContext.rootState,
|
41
41
|
setRootState = _useContext.setRootState,
|
42
|
-
variant = _useContext.variant
|
42
|
+
variant = _useContext.variant,
|
43
|
+
actionState = _useContext.actionState;
|
43
44
|
var _useState = React.useState(false),
|
44
45
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
45
46
|
isConditionBuilderActive = _useState2[0],
|
@@ -61,11 +62,10 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
61
62
|
|
62
63
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
63
64
|
}, [rootState]);
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
// }, [actionState]);
|
65
|
+
React.useEffect(function () {
|
66
|
+
getActionsState === null || getActionsState === void 0 || getActionsState(actionState);
|
67
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
68
|
+
}, [actionState]);
|
69
69
|
var onStartConditionBuilder = function onStartConditionBuilder() {
|
70
70
|
//when add condition button is clicked.
|
71
71
|
setIsConditionBuilderActive(true);
|
@@ -91,8 +91,6 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
91
91
|
};
|
92
92
|
var addConditionGroupHandler = function addConditionGroupHandler() {
|
93
93
|
var newGroup = {
|
94
|
-
groupSeparateOperator: 'and',
|
95
|
-
// 'or'|'and'|'null',
|
96
94
|
groupOperator: 'and',
|
97
95
|
//'and|or',
|
98
96
|
statement: 'if',
|
@@ -111,7 +109,7 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
111
109
|
}));
|
112
110
|
};
|
113
111
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(react.Button, {
|
114
|
-
className: "".concat(DataConfigs.blockClass, "
|
112
|
+
className: "".concat(DataConfigs.blockClass, "__add_condition-button"),
|
115
113
|
renderIcon: function renderIcon(props) {
|
116
114
|
return /*#__PURE__*/React__default["default"].createElement(icons.Add, _rollupPluginBabelHelpers["extends"]({
|
117
115
|
size: 16
|
@@ -121,10 +119,7 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
121
119
|
kind: "ghost",
|
122
120
|
size: "sm",
|
123
121
|
onClick: onStartConditionBuilder
|
124
|
-
}, startConditionLabel), isConditionBuilderActive &&
|
125
|
-
/*#__PURE__*/
|
126
|
-
// <h5 >Condition</h5>
|
127
|
-
React__default["default"].createElement(react.Section, {
|
122
|
+
}, startConditionLabel), isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(react.Section, {
|
128
123
|
className: "".concat(DataConfigs.blockClass, "__heading"),
|
129
124
|
level: 4
|
130
125
|
}, _Heading || (_Heading = /*#__PURE__*/React__default["default"].createElement(react.Heading, null, "Condition"))), /*#__PURE__*/React__default["default"].createElement("div", {
|
@@ -164,16 +159,19 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
164
159
|
onMouseLeave: function onMouseLeave() {
|
165
160
|
setShowConditionGroupPreview(false);
|
166
161
|
},
|
167
|
-
className: "".concat(DataConfigs.blockClass, "
|
162
|
+
className: "".concat(DataConfigs.blockClass, "__add_condition_group "),
|
168
163
|
hideLabel: true,
|
169
|
-
label: DataConfigs.translateWithId('
|
164
|
+
label: DataConfigs.translateWithId('add_condition_group'),
|
170
165
|
wrapperProps: {
|
171
166
|
role: 'gridcell',
|
172
|
-
'aria-label': DataConfigs.translateWithId('
|
167
|
+
'aria-label': DataConfigs.translateWithId('add_condition_group')
|
173
168
|
}
|
174
169
|
})), showConditionGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
|
175
170
|
previewType: "newGroup"
|
176
|
-
})))))
|
171
|
+
}))))), isConditionBuilderActive && actions && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderActions["default"], {
|
172
|
+
actions: actions,
|
173
|
+
className: "".concat(DataConfigs.blockClass, "__actions-container")
|
174
|
+
}));
|
177
175
|
};
|
178
176
|
var ConditionBuilderContent$1 = ConditionBuilderContent;
|
179
177
|
ConditionBuilderContent.propTypes = {
|
@@ -181,8 +179,8 @@ ConditionBuilderContent.propTypes = {
|
|
181
179
|
* optional array of object that give the list of actions.
|
182
180
|
*/
|
183
181
|
actions: index["default"].arrayOf(index["default"].shape({
|
184
|
-
id: index["default"].number,
|
185
|
-
label: index["default"].string
|
182
|
+
id: index["default"].oneOfType([index["default"].string, index["default"].number]).isRequired,
|
183
|
+
label: index["default"].string.isRequired
|
186
184
|
})),
|
187
185
|
/**
|
188
186
|
* ref of condition builder
|
@@ -201,15 +199,21 @@ ConditionBuilderContent.propTypes = {
|
|
201
199
|
*/
|
202
200
|
initialState: index["default"].shape({
|
203
201
|
groups: index["default"].arrayOf(index["default"].shape({
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
202
|
+
groupOperator: index["default"].string.isRequired,
|
203
|
+
statement: index["default"].string.isRequired,
|
204
|
+
conditions: index["default"].arrayOf(index["default"].oneOfType([index["default"].shape({
|
205
|
+
property: index["default"].string.isRequired,
|
206
|
+
operator: index["default"].string.isRequired,
|
207
|
+
value: index["default"].oneOfType([index["default"].string, index["default"].arrayOf(index["default"].shape({
|
208
|
+
id: index["default"].string,
|
209
|
+
label: index["default"].string
|
210
|
+
})), index["default"].shape({
|
211
|
+
id: index["default"].string,
|
212
|
+
label: index["default"].string
|
213
|
+
})])
|
214
|
+
}), index["default"].object]))
|
215
|
+
})),
|
216
|
+
operator: index["default"].string
|
213
217
|
}),
|
214
218
|
/* Provide a label to the button that starts condition builder
|
215
219
|
*/
|
@@ -21,7 +21,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
21
|
var emptyState = {
|
22
22
|
operator: 'or',
|
23
23
|
groups: [{
|
24
|
-
groupSeparateOperator: null,
|
25
24
|
groupOperator: 'and',
|
26
25
|
statement: 'if',
|
27
26
|
id: uuidv4["default"](),
|
@@ -58,10 +57,16 @@ var ConditionBuilderProvider = function ConditionBuilderProvider(props) {
|
|
58
57
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
59
58
|
rootState = _useState2[0],
|
60
59
|
setRootState = _useState2[1];
|
60
|
+
var _useState3 = React.useState([]),
|
61
|
+
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
62
|
+
actionState = _useState4[0],
|
63
|
+
setActionState = _useState4[1];
|
61
64
|
return /*#__PURE__*/React__default["default"].createElement(ConditionBuilderContext.Provider, {
|
62
65
|
value: {
|
63
66
|
rootState: rootState,
|
64
67
|
setRootState: setRootState,
|
68
|
+
actionState: actionState,
|
69
|
+
setActionState: setActionState,
|
65
70
|
inputConfig: props.inputConfig,
|
66
71
|
popOverSearchThreshold: props.popOverSearchThreshold,
|
67
72
|
getOptions: props.getOptions,
|
@@ -95,7 +100,7 @@ ConditionBuilderProvider.propTypes = {
|
|
95
100
|
id: index["default"].string,
|
96
101
|
label: index["default"].string,
|
97
102
|
icon: index["default"].oneOfType([index["default"].func, index["default"].object]),
|
98
|
-
type: index["default"].oneOf(['text', 'number', 'date', 'option', 'time']),
|
103
|
+
type: index["default"].oneOf(['text', 'number', 'date', 'option', 'time', 'custom']),
|
99
104
|
config: index["default"].shape({
|
100
105
|
options: index["default"].arrayOf(index["default"].shape({
|
101
106
|
id: index["default"].string,
|
@@ -6,6 +6,10 @@ export const connectorConfig: {
|
|
6
6
|
label: string;
|
7
7
|
id: string;
|
8
8
|
}[];
|
9
|
+
export const actionConfig: {
|
10
|
+
label: string;
|
11
|
+
id: string;
|
12
|
+
}[];
|
9
13
|
export const operatorConfig: {
|
10
14
|
label: string;
|
11
15
|
id: string;
|
@@ -16,7 +20,8 @@ export function translateWithId(key: any): any;
|
|
16
20
|
export namespace valueRenderers {
|
17
21
|
function text(val: any): any;
|
18
22
|
function time(val: any): any;
|
19
|
-
function number(val: any
|
23
|
+
function number(val: any): any;
|
20
24
|
function option(value: any): any;
|
21
25
|
function date(value: any): any;
|
26
|
+
function custom(value: any): any;
|
22
27
|
}
|
@@ -17,7 +17,7 @@ var statementConfig = [{
|
|
17
17
|
id: 'if'
|
18
18
|
}, {
|
19
19
|
label: 'excl.if',
|
20
|
-
id: '
|
20
|
+
id: 'excl_if'
|
21
21
|
}];
|
22
22
|
var connectorConfig = [{
|
23
23
|
label: 'and',
|
@@ -26,7 +26,6 @@ var connectorConfig = [{
|
|
26
26
|
label: 'or',
|
27
27
|
id: 'or'
|
28
28
|
}];
|
29
|
-
//op types : option, text, number, date,
|
30
29
|
var operatorConfig = [{
|
31
30
|
label: 'is',
|
32
31
|
id: 'is',
|
@@ -37,7 +36,7 @@ var operatorConfig = [{
|
|
37
36
|
type: 'number'
|
38
37
|
}, {
|
39
38
|
label: 'is greater than or equal to',
|
40
|
-
id: '
|
39
|
+
id: 'greater_equal',
|
41
40
|
type: 'number'
|
42
41
|
}, {
|
43
42
|
label: 'is lower than',
|
@@ -45,15 +44,15 @@ var operatorConfig = [{
|
|
45
44
|
type: 'number'
|
46
45
|
}, {
|
47
46
|
label: 'is lower than or equal to',
|
48
|
-
id: '
|
47
|
+
id: 'lower_equal',
|
49
48
|
type: 'number'
|
50
49
|
}, {
|
51
50
|
label: 'starts with',
|
52
|
-
id: '
|
51
|
+
id: 'starts_with',
|
53
52
|
type: 'text'
|
54
53
|
}, {
|
55
54
|
label: 'ends with',
|
56
|
-
id: '
|
55
|
+
id: 'ends_with',
|
57
56
|
type: 'text'
|
58
57
|
}, {
|
59
58
|
label: 'contains',
|
@@ -61,7 +60,7 @@ var operatorConfig = [{
|
|
61
60
|
type: 'text'
|
62
61
|
}, {
|
63
62
|
label: 'is one of',
|
64
|
-
id: '
|
63
|
+
id: 'one_of',
|
65
64
|
type: 'option'
|
66
65
|
}, {
|
67
66
|
label: 'is before',
|
@@ -96,11 +95,17 @@ var valueRenderers = {
|
|
96
95
|
time: function time(val) {
|
97
96
|
return val;
|
98
97
|
},
|
99
|
-
number: function number(val
|
100
|
-
return
|
98
|
+
number: function number(val) {
|
99
|
+
return val;
|
101
100
|
},
|
102
101
|
option: function option(value) {
|
103
|
-
|
102
|
+
if (value && typeof value !== 'string') {
|
103
|
+
var selectedValues = Array.isArray(value) ? value : [value];
|
104
|
+
return selectedValues.map(function (option) {
|
105
|
+
return option.label;
|
106
|
+
}).join(', ');
|
107
|
+
}
|
108
|
+
return value;
|
104
109
|
},
|
105
110
|
date: function date(value) {
|
106
111
|
if (Array.isArray(value) && value.length > 1) {
|
@@ -110,6 +115,9 @@ var valueRenderers = {
|
|
110
115
|
} else {
|
111
116
|
return value && new Date(value) ? formatDate(new Date(value)) : value;
|
112
117
|
}
|
118
|
+
},
|
119
|
+
custom: function custom(value) {
|
120
|
+
return value;
|
113
121
|
}
|
114
122
|
};
|
115
123
|
|
@@ -1,38 +1,41 @@
|
|
1
1
|
export namespace translationsObject {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
2
|
+
namespace en {
|
3
|
+
let _if: string;
|
4
|
+
export { _if as if };
|
5
|
+
export let excl_if: string;
|
6
|
+
export let and: string;
|
7
|
+
export let or: string;
|
8
|
+
export let is: string;
|
9
|
+
export let greater: string;
|
10
|
+
export let greater_equal: string;
|
11
|
+
export let lower: string;
|
12
|
+
export let lower_equal: string;
|
13
|
+
export let starts_with: string;
|
14
|
+
export let ends_with: string;
|
15
|
+
export let contains: string;
|
16
|
+
export let one_of: string;
|
17
|
+
export let before: string;
|
18
|
+
export let after: string;
|
19
|
+
export let between: string;
|
20
|
+
export let add_condition: string;
|
21
|
+
export let add_condition_group: string;
|
22
|
+
export let add_subgroup: string;
|
23
|
+
export let condition: string;
|
24
|
+
export let property: string;
|
25
|
+
export let operator: string;
|
26
|
+
export let value: string;
|
27
|
+
export let connector: string;
|
28
|
+
export let condition_row: string;
|
29
|
+
export let remove_condition: string;
|
30
|
+
export let add_condition_row: string;
|
31
|
+
export let start: string;
|
32
|
+
export let end: string;
|
33
|
+
export let clear_search: string;
|
34
|
+
export let actions: string;
|
35
|
+
export let then: string;
|
36
|
+
export let remove_action: string;
|
37
|
+
export let add_action: string;
|
38
|
+
export let invalid_text: string;
|
39
|
+
export let text_invalid_number: string;
|
40
|
+
}
|
38
41
|
}
|
@@ -12,24 +12,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
12
12
|
var translationsObject = {
|
13
13
|
en: {
|
14
14
|
if: 'if',
|
15
|
-
|
15
|
+
excl_if: 'excl.if',
|
16
16
|
and: 'and',
|
17
17
|
or: 'or',
|
18
18
|
is: 'is',
|
19
19
|
greater: 'is greater than',
|
20
|
-
|
20
|
+
greater_equal: 'is greater than or equal to',
|
21
21
|
lower: 'is lower than',
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
lower_equal: 'is lower than or equal to',
|
23
|
+
starts_with: 'starts with',
|
24
|
+
ends_with: 'ends with',
|
25
25
|
contains: 'contains',
|
26
|
-
|
26
|
+
one_of: 'is one of',
|
27
27
|
before: 'is before',
|
28
28
|
after: 'is after',
|
29
29
|
between: 'is between',
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
add_condition: 'Add condition',
|
31
|
+
add_condition_group: 'Add condition group',
|
32
|
+
add_subgroup: 'Add subgroup',
|
33
33
|
condition: 'Condition',
|
34
34
|
property: 'Property',
|
35
35
|
operator: 'Operator',
|
@@ -44,7 +44,9 @@ var translationsObject = {
|
|
44
44
|
actions: 'Actions',
|
45
45
|
then: 'then',
|
46
46
|
remove_action: 'Remove Action',
|
47
|
-
add_action: 'Add action'
|
47
|
+
add_action: 'Add action',
|
48
|
+
invalid_text: 'Incomplete',
|
49
|
+
text_invalid_number: 'Invalid number, must be 0 or greater'
|
48
50
|
}
|
49
51
|
};
|
50
52
|
|
@@ -17,7 +17,7 @@ export namespace ConditionBuilderItem {
|
|
17
17
|
let className: PropTypes.Requireable<string>;
|
18
18
|
let condition: PropTypes.Requireable<object>;
|
19
19
|
let config: PropTypes.Requireable<object>;
|
20
|
-
let label: PropTypes.Requireable<NonNullable<string |
|
20
|
+
let label: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
21
21
|
let popOverClassName: PropTypes.Requireable<string>;
|
22
22
|
let renderIcon: PropTypes.Requireable<object>;
|
23
23
|
let showToolTip: PropTypes.Requireable<boolean>;
|
@@ -35,19 +35,26 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
35
35
|
config = _ref.config,
|
36
36
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
37
37
|
var contentRef = React.useRef(null);
|
38
|
-
var _useState = React.useState(
|
38
|
+
var _useState = React.useState(false),
|
39
39
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
40
|
-
|
41
|
-
|
42
|
-
var
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
open = _useState2[0],
|
41
|
+
setOpen = _useState2[1];
|
42
|
+
var getPropertyDetails = function getPropertyDetails() {
|
43
|
+
if (label === 'INVALID') {
|
44
|
+
return {
|
45
|
+
propertyLabel: DataConfigs.translateWithId('invalid_text'),
|
46
|
+
isInvalid: true
|
47
|
+
};
|
48
|
+
}
|
47
49
|
var propertyId = rest['data-name'] == 'valueField' && type ? DataConfigs.valueRenderers[type](label, config) : label;
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
return {
|
51
|
+
isInvalid: false,
|
52
|
+
propertyLabel: DataConfigs.translateWithId(propertyId)
|
53
|
+
};
|
54
|
+
};
|
55
|
+
var _getPropertyDetails = getPropertyDetails(),
|
56
|
+
propertyLabel = _getPropertyDetails.propertyLabel,
|
57
|
+
isInvalid = _getPropertyDetails.isInvalid;
|
51
58
|
React.useEffect(function () {
|
52
59
|
/**
|
53
60
|
* rest['data-name'] holds the current field name
|
@@ -59,7 +66,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
59
66
|
if (condition.popoverToOpen && currentField !== condition.popoverToOpen) {
|
60
67
|
// close the previous popover
|
61
68
|
setOpen(false);
|
62
|
-
} else if (currentField == 'valueField' && type == 'option' && condition.operator !== '
|
69
|
+
} else if (currentField == 'valueField' && type == 'option' && condition.operator !== 'one_of') {
|
63
70
|
//close the current popover if the field is valueField and is a single select dropdown. For all other inputs ,popover need to be open on value changes.
|
64
71
|
setOpen(false);
|
65
72
|
}
|
@@ -92,7 +99,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
92
99
|
setOpen(false);
|
93
100
|
}
|
94
101
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
|
95
|
-
label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : DataConfigs.translateWithId('
|
102
|
+
label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : DataConfigs.translateWithId('add_condition'),
|
96
103
|
hideLabel: !label ? true : false,
|
97
104
|
onClick: function onClick() {
|
98
105
|
children ? setOpen(!open) : null;
|
@@ -101,7 +108,8 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
101
108
|
"aria-haspopup": true,
|
102
109
|
"aria-expanded": open,
|
103
110
|
renderIcon: renderIcon ? renderIcon : label == undefined ? icons.Add : null,
|
104
|
-
showToolTip: showToolTip
|
111
|
+
showToolTip: showToolTip,
|
112
|
+
isInvalid: isInvalid
|
105
113
|
}, rest)), /*#__PURE__*/React__default["default"].createElement(react.PopoverContent, {
|
106
114
|
className: "".concat(DataConfigs.blockClass, "__item__content"),
|
107
115
|
role: "dialog",
|
@@ -133,7 +141,7 @@ ConditionBuilderItem.propTypes = {
|
|
133
141
|
/**
|
134
142
|
* text to be displayed in the field
|
135
143
|
*/
|
136
|
-
label: index["default"].oneOfType([index["default"].string, index["default"].array]),
|
144
|
+
label: index["default"].oneOfType([index["default"].string, index["default"].array, index["default"].object]),
|
137
145
|
/**
|
138
146
|
* class name for popover
|
139
147
|
*/
|
@@ -11,14 +11,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
12
12
|
var React = require('react');
|
13
13
|
var react = require('@carbon/react');
|
14
|
-
var settings = require('../../../../settings.js');
|
15
14
|
var index = require('../../../../node_modules/prop-types/index.js');
|
15
|
+
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
16
16
|
|
17
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
18
18
|
|
19
19
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
20
20
|
|
21
|
-
var blockClass = "".concat(settings.pkg.prefix, "--condition-builder");
|
22
21
|
var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
23
22
|
var _conditionState$prope;
|
24
23
|
var conditionState = _ref.conditionState,
|
@@ -26,18 +25,34 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
26
25
|
onChange = _ref.onChange;
|
27
26
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
28
27
|
var value = _ref2.value;
|
29
|
-
|
28
|
+
if (checkIfValid(value)) {
|
29
|
+
var _config$unit;
|
30
|
+
onChange("".concat(value, " ").concat((_config$unit = config.unit) !== null && _config$unit !== void 0 ? _config$unit : ''));
|
31
|
+
} else {
|
32
|
+
onChange('INVALID');
|
33
|
+
}
|
34
|
+
};
|
35
|
+
var checkIfValid = function checkIfValid(value) {
|
36
|
+
if (value > config.max || value < config.min) {
|
37
|
+
return false;
|
38
|
+
}
|
39
|
+
return true;
|
40
|
+
};
|
41
|
+
var getDefaultValue = function getDefaultValue() {
|
42
|
+
var _conditionState$value;
|
43
|
+
return (_conditionState$value = conditionState.value) === null || _conditionState$value === void 0 || (_conditionState$value = _conditionState$value.split(' ')) === null || _conditionState$value === void 0 ? void 0 : _conditionState$value[0];
|
30
44
|
};
|
31
45
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
32
|
-
className: "".concat(blockClass, "__item-number")
|
46
|
+
className: "".concat(DataConfigs.blockClass, "__item-number")
|
33
47
|
}, /*#__PURE__*/React__default["default"].createElement(react.NumberInput, {
|
34
48
|
label: conditionState.property,
|
35
49
|
hideLabel: true,
|
50
|
+
defaultValue: getDefaultValue(),
|
36
51
|
id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
|
37
|
-
value: conditionState.value ? conditionState.value.split(' ')[0] : conditionState.value,
|
38
52
|
min: config.min,
|
39
53
|
max: config.max,
|
40
54
|
step: config.step,
|
55
|
+
invalidText: DataConfigs.translateWithId('text_invalid_number'),
|
41
56
|
allowEmpty: true,
|
42
57
|
onChange: onChangeHandler
|
43
58
|
}));
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export function ItemOption({ conditionState, config, onChange }: {
|
2
|
+
conditionState?: {} | undefined;
|
3
|
+
config?: {} | undefined;
|
4
|
+
onChange: any;
|
5
|
+
}): import("react/jsx-runtime").JSX.Element | undefined;
|
6
|
+
export namespace ItemOption {
|
7
|
+
namespace propTypes {
|
8
|
+
let conditionState: PropTypes.Requireable<object>;
|
9
|
+
let config: PropTypes.Requireable<object>;
|
10
|
+
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
import PropTypes from 'prop-types';
|