@carbon/ibm-products 2.43.2-canary.53 → 2.43.2-canary.55
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 +8 -2
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon.css +8 -2
- 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 +8 -2
- 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/Coachmark/Coachmark.js +12 -7
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
- package/es/components/CoachmarkStack/CoachmarkStack.js +7 -3
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +21 -11
- package/es/components/ConditionBuilder/ConditionBuilder.js +15 -5
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +58 -36
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +21 -9
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +8 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +17 -9
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +19 -10
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -17
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +36 -39
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +36 -38
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +20 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +8 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +9 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +9 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +10 -5
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +19 -7
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +23 -17
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +31 -14
- package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/useTranslations.js +26 -0
- package/es/components/ConditionBuilder/utils/util.js +1 -9
- package/es/components/CreateFullPage/CreateFullPage.js +2 -2
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/es/components/Datagrid/useSelectRows.js +2 -1
- package/es/components/Nav/NavItem.js +12 -3
- package/es/components/OptionsTile/OptionsTile.js +4 -5
- package/es/components/SidePanel/SidePanel.js +17 -20
- package/es/components/SidePanel/motion/variants.d.ts +4 -6
- package/es/components/SidePanel/motion/variants.js +10 -11
- package/es/components/Tearsheet/TearsheetShell.js +3 -1
- package/es/components/WebTerminal/WebTerminal.js +10 -12
- package/es/global/js/hooks/usePrefersReducedMotion.js +14 -8
- package/lib/components/Coachmark/Coachmark.js +12 -7
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
- package/lib/components/CoachmarkStack/CoachmarkStack.js +7 -3
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +20 -10
- package/lib/components/ConditionBuilder/ConditionBuilder.js +15 -5
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +56 -33
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +20 -8
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -3
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +6 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +16 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +18 -9
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +17 -17
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +36 -39
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +36 -38
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +19 -11
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +8 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +8 -6
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +8 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -4
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +18 -6
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +21 -15
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +30 -13
- package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/useTranslations.js +30 -0
- package/lib/components/ConditionBuilder/utils/util.js +0 -9
- package/lib/components/CreateFullPage/CreateFullPage.js +2 -2
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/lib/components/Datagrid/useSelectRows.js +2 -1
- package/lib/components/Nav/NavItem.js +10 -1
- package/lib/components/OptionsTile/OptionsTile.js +4 -5
- package/lib/components/SidePanel/SidePanel.js +16 -19
- package/lib/components/SidePanel/motion/variants.d.ts +4 -6
- package/lib/components/SidePanel/motion/variants.js +10 -11
- package/lib/components/Tearsheet/TearsheetShell.js +3 -1
- package/lib/components/WebTerminal/WebTerminal.js +10 -12
- package/lib/global/js/hooks/usePrefersReducedMotion.js +13 -7
- package/package.json +3 -3
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +3 -1
- package/es/global/js/utils/window.d.ts +0 -2
- package/es/global/js/utils/window.js +0 -12
- package/lib/global/js/utils/window.d.ts +0 -2
- package/lib/global/js/utils/window.js +0 -16
@@ -9,12 +9,13 @@
|
|
9
9
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
12
13
|
var React = require('react');
|
13
14
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
14
15
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
15
16
|
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
16
|
-
var util = require('../utils/util.js');
|
17
17
|
var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
|
18
|
+
var useTranslations = require('../utils/useTranslations.js');
|
18
19
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
20
21
|
|
@@ -22,26 +23,33 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
23
|
|
23
24
|
var GroupConnector = function GroupConnector() {
|
24
25
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
25
|
-
rootState = _useContext.rootState
|
26
|
+
rootState = _useContext.rootState,
|
27
|
+
setRootState = _useContext.setRootState;
|
28
|
+
var _useTranslations = useTranslations.useTranslations(['conditionText']),
|
29
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 1),
|
30
|
+
conditionText = _useTranslations2[0];
|
31
|
+
var onStatementChangeHandler = function onStatementChangeHandler(updatedStatement) {
|
32
|
+
setRootState(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rootState), {}, {
|
33
|
+
operator: updatedStatement
|
34
|
+
}));
|
35
|
+
};
|
26
36
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
27
|
-
className: "".concat(DataConfigs.blockClass, "__group-separator"),
|
37
|
+
className: "".concat(DataConfigs.blockClass, "__group-separator ").concat(DataConfigs.blockClass, "__group-separator-row"),
|
28
38
|
role: "row",
|
29
39
|
tabIndex: -1,
|
30
40
|
"aria-level": 1
|
31
41
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
32
42
|
label: rootState.operator,
|
33
|
-
title:
|
43
|
+
title: conditionText,
|
34
44
|
"data-name": "connectorField",
|
35
45
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
36
46
|
className: "".concat(DataConfigs.blockClass, "__statement-button")
|
37
47
|
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
38
48
|
conditionState: {
|
39
49
|
value: rootState.operator,
|
40
|
-
label:
|
41
|
-
},
|
42
|
-
onChange: function onChange(v, e) {
|
43
|
-
util.focusThisField(e);
|
50
|
+
label: conditionText
|
44
51
|
},
|
52
|
+
onChange: onStatementChangeHandler,
|
45
53
|
config: {
|
46
54
|
options: DataConfigs.connectorConfig
|
47
55
|
}
|
@@ -22,12 +22,13 @@ 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
24
|
var ConditionBuilderActions = require('../ConditionBuilderActions/ConditionBuilderActions.js');
|
25
|
+
var useTranslations = require('../utils/useTranslations.js');
|
25
26
|
|
26
27
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
27
28
|
|
28
29
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
29
30
|
|
30
|
-
var _Heading, _GroupConnector
|
31
|
+
var _Heading, _GroupConnector;
|
31
32
|
var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
32
33
|
var _rootState$groups2;
|
33
34
|
var startConditionLabel = _ref.startConditionLabel,
|
@@ -49,6 +50,9 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
49
50
|
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
50
51
|
showConditionGroupPreview = _useState4[0],
|
51
52
|
setShowConditionGroupPreview = _useState4[1];
|
53
|
+
var _useTranslations = useTranslations.useTranslations(['addConditionGroupText']),
|
54
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 1),
|
55
|
+
addConditionGroupText = _useTranslations2[0];
|
52
56
|
React.useEffect(function () {
|
53
57
|
var _rootState$groups;
|
54
58
|
if (rootState !== null && rootState !== void 0 && (_rootState$groups = rootState.groups) !== null && _rootState$groups !== void 0 && _rootState$groups.length) {
|
@@ -109,7 +113,7 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
109
113
|
}));
|
110
114
|
};
|
111
115
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(react.Button, {
|
112
|
-
className: "".concat(DataConfigs.blockClass, "
|
116
|
+
className: "".concat(DataConfigs.blockClass, "__addConditionText-button"),
|
113
117
|
renderIcon: function renderIcon(props) {
|
114
118
|
return /*#__PURE__*/React__default["default"].createElement(icons.Add, _rollupPluginBabelHelpers["extends"]({
|
115
119
|
size: 16
|
@@ -159,18 +163,23 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
159
163
|
onMouseLeave: function onMouseLeave() {
|
160
164
|
setShowConditionGroupPreview(false);
|
161
165
|
},
|
162
|
-
className: "".concat(DataConfigs.blockClass, "
|
166
|
+
className: "".concat(DataConfigs.blockClass, "__addConditionGroupText "),
|
163
167
|
hideLabel: true,
|
164
|
-
label:
|
168
|
+
label: addConditionGroupText,
|
165
169
|
wrapperProps: {
|
166
170
|
role: 'gridcell',
|
167
|
-
'aria-label':
|
171
|
+
'aria-label': addConditionGroupText
|
168
172
|
}
|
169
|
-
})), showConditionGroupPreview &&
|
170
|
-
previewType: "newGroup"
|
171
|
-
|
173
|
+
})), showConditionGroupPreview && /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
|
174
|
+
previewType: "newGroup",
|
175
|
+
group: {
|
176
|
+
groupOperator: rootState.operator
|
177
|
+
}
|
178
|
+
}))), isConditionBuilderActive && actions && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderActions["default"], {
|
172
179
|
actions: actions,
|
173
|
-
className: "".concat(DataConfigs.blockClass, "__actions-container")
|
180
|
+
className: "".concat(DataConfigs.blockClass, "__actions-container"),
|
181
|
+
variant: variant,
|
182
|
+
conditionBuilderRef: conditionBuilderRef
|
174
183
|
}));
|
175
184
|
};
|
176
185
|
var ConditionBuilderContent$1 = ConditionBuilderContent;
|
package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts
CHANGED
@@ -21,21 +21,27 @@ export namespace ConditionBuilderProvider {
|
|
21
21
|
let getOptions: PropTypes.Requireable<(...args: any[]) => any>;
|
22
22
|
let inputConfig: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
23
23
|
properties: PropTypes.Requireable<(PropTypes.InferProps<{
|
24
|
-
id: PropTypes.
|
25
|
-
label: PropTypes.
|
24
|
+
id: PropTypes.Validator<string>;
|
25
|
+
label: PropTypes.Validator<string>;
|
26
26
|
icon: PropTypes.Requireable<object>;
|
27
|
-
type: PropTypes.
|
27
|
+
type: PropTypes.Validator<string>;
|
28
28
|
config: PropTypes.Requireable<PropTypes.InferProps<{
|
29
29
|
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
30
|
-
id: PropTypes.
|
31
|
-
label: PropTypes.
|
30
|
+
id: PropTypes.Validator<string>;
|
31
|
+
label: PropTypes.Validator<string>;
|
32
32
|
icon: PropTypes.Requireable<object>;
|
33
33
|
}> | null | undefined)[]>;
|
34
|
-
|
34
|
+
component: PropTypes.Requireable<(...args: any[]) => any>;
|
35
|
+
operators: PropTypes.Requireable<(PropTypes.InferProps<{
|
36
|
+
id: PropTypes.Validator<string>;
|
37
|
+
label: PropTypes.Validator<string>;
|
38
|
+
}> | null | undefined)[]>;
|
39
|
+
long: PropTypes.Requireable<boolean>;
|
35
40
|
}>>;
|
36
41
|
}> | null | undefined)[]>;
|
37
42
|
}>>>;
|
38
43
|
let popOverSearchThreshold: PropTypes.Validator<number>;
|
44
|
+
let translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
39
45
|
let variant: PropTypes.Validator<string>;
|
40
46
|
}
|
41
47
|
}
|
@@ -70,7 +70,8 @@ var ConditionBuilderProvider = function ConditionBuilderProvider(props) {
|
|
70
70
|
inputConfig: props.inputConfig,
|
71
71
|
popOverSearchThreshold: props.popOverSearchThreshold,
|
72
72
|
getOptions: props.getOptions,
|
73
|
-
variant: props.variant
|
73
|
+
variant: props.variant,
|
74
|
+
translateWithId: props.translateWithId
|
74
75
|
}
|
75
76
|
},
|
76
77
|
// eslint-disable-next-line react/prop-types
|
@@ -97,17 +98,22 @@ ConditionBuilderProvider.propTypes = {
|
|
97
98
|
*/
|
98
99
|
inputConfig: index["default"].shape({
|
99
100
|
properties: index["default"].arrayOf(index["default"].shape({
|
100
|
-
id: index["default"].string,
|
101
|
-
label: index["default"].string,
|
101
|
+
id: index["default"].string.isRequired,
|
102
|
+
label: index["default"].string.isRequired,
|
102
103
|
icon: index["default"].oneOfType([index["default"].func, index["default"].object]),
|
103
|
-
type: index["default"].oneOf(['text', 'number', 'date', 'option', 'time', 'custom']),
|
104
|
+
type: index["default"].oneOf(['text', 'textarea', 'number', 'date', 'option', 'time', 'custom']).isRequired,
|
104
105
|
config: index["default"].shape({
|
105
106
|
options: index["default"].arrayOf(index["default"].shape({
|
106
|
-
id: index["default"].string,
|
107
|
-
label: index["default"].string,
|
107
|
+
id: index["default"].string.isRequired,
|
108
|
+
label: index["default"].string.isRequired,
|
108
109
|
icon: index["default"].oneOfType([index["default"].func, index["default"].object])
|
109
110
|
})),
|
110
|
-
|
111
|
+
component: index["default"].func,
|
112
|
+
operators: index["default"].arrayOf(index["default"].shape({
|
113
|
+
id: index["default"].string.isRequired,
|
114
|
+
label: index["default"].string.isRequired
|
115
|
+
})),
|
116
|
+
long: index["default"].bool
|
111
117
|
})
|
112
118
|
}))
|
113
119
|
}).isRequired,
|
@@ -115,6 +121,13 @@ ConditionBuilderProvider.propTypes = {
|
|
115
121
|
* Provide an mandatory numeric value that will be used to enable search option in the popovers with list.
|
116
122
|
*/
|
117
123
|
popOverSearchThreshold: index["default"].number.isRequired,
|
124
|
+
/**
|
125
|
+
* Optional prop if you want to pass translation to the texts used . Otherwise this will the defined defaults.
|
126
|
+
* This callback function will receive the message id and you need to return the corresponding text for that id.
|
127
|
+
* The message key will be one of [ "ifText", "addConditionText", "addConditionGroupText", "addSubgroupText", "conditionText", "propertyText", "operatorText", "valueText", "connectorText", "conditionRowText", "removeConditionText", "addConditionRowText", "startText", "endText", "clearSearchText", "actionsText", "then", "removeActionText", "addActionText", "invalidText", "invalidNumberWarnText"
|
128
|
+
]
|
129
|
+
*/
|
130
|
+
translateWithId: index["default"].func,
|
118
131
|
/**
|
119
132
|
* Provide the condition builder variant: sentence/ tree
|
120
133
|
*/
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export const statementConfig: {
|
2
2
|
label: string;
|
3
3
|
id: string;
|
4
|
+
connector: string;
|
4
5
|
}[];
|
5
6
|
export const connectorConfig: {
|
6
7
|
label: string;
|
@@ -16,9 +17,9 @@ export const operatorConfig: {
|
|
16
17
|
type: string;
|
17
18
|
}[];
|
18
19
|
export const blockClass: string;
|
19
|
-
export function translateWithId(key: any): any;
|
20
20
|
export namespace valueRenderers {
|
21
21
|
function text(val: any): any;
|
22
|
+
function textarea(val: any): any;
|
22
23
|
function time(val: any): any;
|
23
24
|
function number(val: any): any;
|
24
25
|
function option(value: any): any;
|
@@ -10,14 +10,15 @@
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
12
|
var settings = require('../../../settings.js');
|
13
|
-
var translationObject = require('./translationObject.js');
|
14
13
|
|
15
14
|
var statementConfig = [{
|
16
15
|
label: 'if',
|
17
|
-
id: 'if'
|
16
|
+
id: 'if',
|
17
|
+
connector: 'and'
|
18
18
|
}, {
|
19
19
|
label: 'excl.if',
|
20
|
-
id: 'excl_if'
|
20
|
+
id: 'excl_if',
|
21
|
+
connector: 'or'
|
21
22
|
}];
|
22
23
|
var connectorConfig = [{
|
23
24
|
label: 'and',
|
@@ -36,7 +37,7 @@ var operatorConfig = [{
|
|
36
37
|
type: 'number'
|
37
38
|
}, {
|
38
39
|
label: 'is greater than or equal to',
|
39
|
-
id: '
|
40
|
+
id: 'greaterEqual',
|
40
41
|
type: 'number'
|
41
42
|
}, {
|
42
43
|
label: 'is lower than',
|
@@ -44,23 +45,23 @@ var operatorConfig = [{
|
|
44
45
|
type: 'number'
|
45
46
|
}, {
|
46
47
|
label: 'is lower than or equal to',
|
47
|
-
id: '
|
48
|
+
id: 'lowerEqual',
|
48
49
|
type: 'number'
|
49
50
|
}, {
|
50
51
|
label: 'starts with',
|
51
|
-
id: '
|
52
|
-
type: 'text'
|
52
|
+
id: 'startsWith',
|
53
|
+
type: 'text,textarea'
|
53
54
|
}, {
|
54
55
|
label: 'ends with',
|
55
|
-
id: '
|
56
|
-
type: 'text'
|
56
|
+
id: 'endsWith',
|
57
|
+
type: 'text,textarea'
|
57
58
|
}, {
|
58
59
|
label: 'contains',
|
59
60
|
id: 'contains',
|
60
|
-
type: 'text'
|
61
|
+
type: 'text,textarea'
|
61
62
|
}, {
|
62
63
|
label: 'is one of',
|
63
|
-
id: '
|
64
|
+
id: 'oneOf',
|
64
65
|
type: 'option'
|
65
66
|
}, {
|
66
67
|
label: 'is before',
|
@@ -83,15 +84,15 @@ var formatDate = function formatDate(date) {
|
|
83
84
|
var year = date.getFullYear();
|
84
85
|
return "".concat(day, "/").concat(month, "/").concat(year);
|
85
86
|
};
|
86
|
-
|
87
|
-
|
88
|
-
var _translationsObjectCu;
|
89
|
-
return (_translationsObjectCu = translationsObjectCurrent[key]) !== null && _translationsObjectCu !== void 0 ? _translationsObjectCu : key;
|
90
|
-
};
|
87
|
+
//const translationsObjectCurrent = translationsObject['en']; // TO DO: need to discuss if language is to be passed as prop
|
88
|
+
|
91
89
|
var valueRenderers = {
|
92
90
|
text: function text(val) {
|
93
91
|
return val;
|
94
92
|
},
|
93
|
+
textarea: function textarea(val) {
|
94
|
+
return val;
|
95
|
+
},
|
95
96
|
time: function time(val) {
|
96
97
|
return val;
|
97
98
|
},
|
@@ -125,5 +126,4 @@ exports.blockClass = blockClass;
|
|
125
126
|
exports.connectorConfig = connectorConfig;
|
126
127
|
exports.operatorConfig = operatorConfig;
|
127
128
|
exports.statementConfig = statementConfig;
|
128
|
-
exports.translateWithId = translateWithId;
|
129
129
|
exports.valueRenderers = valueRenderers;
|
@@ -1,41 +1,38 @@
|
|
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
|
-
|
38
|
-
export let invalid_text: string;
|
39
|
-
export let text_invalid_number: string;
|
40
|
-
}
|
2
|
+
let ifText: string;
|
3
|
+
let excl_if: string;
|
4
|
+
let and: string;
|
5
|
+
let or: string;
|
6
|
+
let is: string;
|
7
|
+
let greater: string;
|
8
|
+
let greaterEqual: string;
|
9
|
+
let lower: string;
|
10
|
+
let lowerEqual: string;
|
11
|
+
let startsWith: string;
|
12
|
+
let endsWith: string;
|
13
|
+
let contains: string;
|
14
|
+
let oneOf: string;
|
15
|
+
let before: string;
|
16
|
+
let after: string;
|
17
|
+
let between: string;
|
18
|
+
let addConditionText: string;
|
19
|
+
let addConditionGroupText: string;
|
20
|
+
let addSubgroupText: string;
|
21
|
+
let conditionText: string;
|
22
|
+
let propertyText: string;
|
23
|
+
let operatorText: string;
|
24
|
+
let valueText: string;
|
25
|
+
let connectorText: string;
|
26
|
+
let conditionRowText: string;
|
27
|
+
let removeConditionText: string;
|
28
|
+
let addConditionRowText: string;
|
29
|
+
let startText: string;
|
30
|
+
let endText: string;
|
31
|
+
let clearSearchText: string;
|
32
|
+
let actionsText: string;
|
33
|
+
let then: string;
|
34
|
+
let removeActionText: string;
|
35
|
+
let addActionText: string;
|
36
|
+
let invalidText: string;
|
37
|
+
let invalidNumberWarnText: string;
|
41
38
|
}
|
@@ -10,44 +10,42 @@
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
12
|
var translationsObject = {
|
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
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
text_invalid_number: 'Invalid number, must be 0 or greater'
|
50
|
-
}
|
13
|
+
ifText: 'if',
|
14
|
+
excl_if: 'excl.if',
|
15
|
+
and: 'and',
|
16
|
+
or: 'or',
|
17
|
+
is: 'is',
|
18
|
+
greater: 'is greater than',
|
19
|
+
greaterEqual: 'is greater than or equal to',
|
20
|
+
lower: 'is lower than',
|
21
|
+
lowerEqual: 'is lower than or equal to',
|
22
|
+
startsWith: 'starts with',
|
23
|
+
endsWith: 'ends with',
|
24
|
+
contains: 'contains',
|
25
|
+
oneOf: 'is one of',
|
26
|
+
before: 'is before',
|
27
|
+
after: 'is after',
|
28
|
+
between: 'is between',
|
29
|
+
addConditionText: 'Add condition',
|
30
|
+
addConditionGroupText: 'Add condition group',
|
31
|
+
addSubgroupText: 'Add subgroup',
|
32
|
+
conditionText: 'Condition',
|
33
|
+
propertyText: 'Property',
|
34
|
+
operatorText: 'Operator',
|
35
|
+
valueText: 'Value',
|
36
|
+
connectorText: 'Connector',
|
37
|
+
conditionRowText: 'Condition row',
|
38
|
+
removeConditionText: 'Remove condition',
|
39
|
+
addConditionRowText: 'Add condition row',
|
40
|
+
startText: 'Start',
|
41
|
+
endText: 'End',
|
42
|
+
clearSearchText: 'Clear search input',
|
43
|
+
actionsText: 'Actions',
|
44
|
+
then: 'then',
|
45
|
+
removeActionText: 'Remove Action',
|
46
|
+
addActionText: 'Add action',
|
47
|
+
invalidText: 'Incomplete',
|
48
|
+
invalidNumberWarnText: 'Invalid number, must be 0 or greater'
|
51
49
|
};
|
52
50
|
|
53
51
|
exports.translationsObject = translationsObject;
|
@@ -16,6 +16,7 @@ var index = require('../../../node_modules/prop-types/index.js');
|
|
16
16
|
var icons = require('@carbon/react/icons');
|
17
17
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
18
18
|
var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
|
19
|
+
var useTranslations = require('../utils/useTranslations.js');
|
19
20
|
|
20
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
21
22
|
|
@@ -39,17 +40,22 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
39
40
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
40
41
|
open = _useState2[0],
|
41
42
|
setOpen = _useState2[1];
|
43
|
+
var _useTranslations = useTranslations.useTranslations(['invalidText', 'addConditionText', label]),
|
44
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 3),
|
45
|
+
invalidText = _useTranslations2[0],
|
46
|
+
addConditionText = _useTranslations2[1],
|
47
|
+
labelText = _useTranslations2[2];
|
42
48
|
var getPropertyDetails = function getPropertyDetails() {
|
43
49
|
if (label === 'INVALID') {
|
44
50
|
return {
|
45
|
-
propertyLabel:
|
51
|
+
propertyLabel: invalidText,
|
46
52
|
isInvalid: true
|
47
53
|
};
|
48
54
|
}
|
49
|
-
var propertyId = rest['data-name'] == 'valueField' && type ? DataConfigs.valueRenderers[type](label, config) :
|
55
|
+
var propertyId = rest['data-name'] == 'valueField' && type ? DataConfigs.valueRenderers[type](label, config) : labelText;
|
50
56
|
return {
|
51
57
|
isInvalid: false,
|
52
|
-
propertyLabel:
|
58
|
+
propertyLabel: propertyId
|
53
59
|
};
|
54
60
|
};
|
55
61
|
var _getPropertyDetails = getPropertyDetails(),
|
@@ -66,7 +72,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
66
72
|
if (condition.popoverToOpen && currentField !== condition.popoverToOpen) {
|
67
73
|
// close the previous popover
|
68
74
|
setOpen(false);
|
69
|
-
} else if (currentField == 'valueField' && type == 'option' && condition.operator !== '
|
75
|
+
} else if (currentField == 'valueField' && type == 'option' && condition.operator !== 'oneOf') {
|
70
76
|
//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.
|
71
77
|
setOpen(false);
|
72
78
|
}
|
@@ -84,7 +90,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
84
90
|
React.useEffect(function () {
|
85
91
|
//this will focus the first input field in the popover
|
86
92
|
if (open && contentRef.current) {
|
87
|
-
var firstFocusableElement = contentRef.current.querySelector('input');
|
93
|
+
var firstFocusableElement = contentRef.current.querySelector('input,textarea');
|
88
94
|
if (firstFocusableElement) {
|
89
95
|
firstFocusableElement.focus();
|
90
96
|
}
|
@@ -99,7 +105,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
99
105
|
setOpen(false);
|
100
106
|
}
|
101
107
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
|
102
|
-
label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel :
|
108
|
+
label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : addConditionText,
|
103
109
|
hideLabel: !label ? true : false,
|
104
110
|
onClick: function onClick() {
|
105
111
|
children ? setOpen(!open) : null;
|
@@ -109,16 +115,18 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
109
115
|
"aria-expanded": open,
|
110
116
|
renderIcon: renderIcon ? renderIcon : label == undefined ? icons.Add : null,
|
111
117
|
showToolTip: showToolTip,
|
112
|
-
isInvalid: isInvalid
|
113
|
-
|
118
|
+
isInvalid: isInvalid,
|
119
|
+
condition: condition
|
120
|
+
}, rest)), open && /*#__PURE__*/React__default["default"].createElement(react.PopoverContent, {
|
114
121
|
className: "".concat(DataConfigs.blockClass, "__item__content"),
|
115
122
|
role: "dialog",
|
116
|
-
"aria-label":
|
123
|
+
"aria-label": title
|
117
124
|
}, /*#__PURE__*/React__default["default"].createElement(react.Layer, null, /*#__PURE__*/React__default["default"].createElement("h1", {
|
118
125
|
className: "".concat(DataConfigs.blockClass, "__item__title")
|
119
126
|
}, title), /*#__PURE__*/React__default["default"].createElement("div", {
|
120
|
-
ref: contentRef
|
121
|
-
|
127
|
+
ref: contentRef,
|
128
|
+
className: "".concat(DataConfigs.blockClass, "__popover-content")
|
129
|
+
}, children))));
|
122
130
|
};
|
123
131
|
ConditionBuilderItem.propTypes = {
|
124
132
|
/**
|
@@ -9,11 +9,12 @@
|
|
9
9
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
12
13
|
var React = require('react');
|
13
14
|
var react = require('@carbon/react');
|
14
15
|
var settings = require('../../../../settings.js');
|
15
16
|
var index = require('../../../../node_modules/prop-types/index.js');
|
16
|
-
var
|
17
|
+
var useTranslations = require('../../utils/useTranslations.js');
|
17
18
|
|
18
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
19
20
|
|
@@ -24,6 +25,10 @@ var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
|
|
24
25
|
var conditionState = _ref.conditionState,
|
25
26
|
onChange = _ref.onChange;
|
26
27
|
var DatePickerInputRef = React.useRef();
|
28
|
+
var _useTranslations = useTranslations.useTranslations(['startText', 'endText']),
|
29
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 2),
|
30
|
+
startText = _useTranslations2[0],
|
31
|
+
endText = _useTranslations2[1];
|
27
32
|
var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
|
28
33
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
29
34
|
className: "".concat(blockClass, "__item-date ")
|
@@ -46,11 +51,11 @@ var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
|
|
46
51
|
}, /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, {
|
47
52
|
id: "datePickerStart",
|
48
53
|
placeholder: "dd/mm/yyyy",
|
49
|
-
labelText:
|
54
|
+
labelText: startText
|
50
55
|
}), /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, {
|
51
56
|
id: "datePickerEnd",
|
52
57
|
placeholder: "dd/mm/yyyy",
|
53
|
-
labelText:
|
58
|
+
labelText: endText
|
54
59
|
})));
|
55
60
|
};
|
56
61
|
ConditionBuilderItemDate.propTypes = {
|
@@ -9,10 +9,12 @@
|
|
9
9
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
12
13
|
var React = require('react');
|
13
14
|
var react = require('@carbon/react');
|
14
15
|
var index = require('../../../../node_modules/prop-types/index.js');
|
15
16
|
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
17
|
+
var useTranslations = require('../../utils/useTranslations.js');
|
16
18
|
|
17
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
18
20
|
|
@@ -23,6 +25,9 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
23
25
|
var conditionState = _ref.conditionState,
|
24
26
|
config = _ref.config,
|
25
27
|
onChange = _ref.onChange;
|
28
|
+
var _useTranslations = useTranslations.useTranslations(['invalidNumberWarnText']),
|
29
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 1),
|
30
|
+
invalidNumberWarnText = _useTranslations2[0];
|
26
31
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
27
32
|
var value = _ref2.value;
|
28
33
|
if (checkIfValid(value)) {
|
@@ -44,18 +49,15 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
44
49
|
};
|
45
50
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
46
51
|
className: "".concat(DataConfigs.blockClass, "__item-number")
|
47
|
-
}, /*#__PURE__*/React__default["default"].createElement(react.NumberInput, {
|
52
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.NumberInput, _rollupPluginBabelHelpers["extends"]({
|
48
53
|
label: conditionState.property,
|
49
54
|
hideLabel: true,
|
50
55
|
defaultValue: getDefaultValue(),
|
51
56
|
id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
|
52
|
-
|
53
|
-
max: config.max,
|
54
|
-
step: config.step,
|
55
|
-
invalidText: DataConfigs.translateWithId('text_invalid_number'),
|
57
|
+
invalidText: invalidNumberWarnText,
|
56
58
|
allowEmpty: true,
|
57
59
|
onChange: onChangeHandler
|
58
|
-
}));
|
60
|
+
}, config)));
|
59
61
|
};
|
60
62
|
ConditionBuilderItemNumber.propTypes = {
|
61
63
|
/**
|