@carbon/ibm-products 2.44.0-rc.2 → 2.45.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 +118 -15
- 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 +203 -5
- 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 +118 -15
- 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 +118 -15
- 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 +35 -22
- package/es/components/ConditionBuilder/ConditionBuilder.js +17 -7
- 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 +23 -11
- 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 +29 -16
- 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 +23 -20
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +49 -23
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +12 -9
- 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/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +70 -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/handleKeyboardEvents.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +120 -28
- 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/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +25 -7
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
- package/es/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/es/components/Datagrid/Datagrid/Datagrid.js +2 -8
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
- package/es/components/Datagrid/Datagrid/DatagridRow.js +8 -6
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
- package/es/components/Datagrid/types/index.d.ts +28 -6
- package/es/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/es/components/Datagrid/useCustomizeColumns.js +4 -3
- package/es/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/es/components/Datagrid/useNestedRowExpander.js +1 -3
- package/es/components/Datagrid/useRowExpander.js +1 -3
- package/es/components/Datagrid/useSelectRows.js +2 -1
- package/es/components/Datagrid/useStickyColumn.d.ts +8 -1
- package/es/components/Datagrid/useStickyColumn.js +12 -9
- package/es/components/EditInPlace/EditInPlace.d.ts +4 -0
- package/es/components/EditInPlace/EditInPlace.js +21 -10
- package/es/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/es/components/EditTearsheet/EditTearsheet.js +44 -9
- package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/es/components/Nav/NavItem.js +12 -3
- package/es/components/OptionsTile/OptionsTile.js +11 -6
- package/es/components/PageHeader/PageHeader.js +1 -0
- package/es/components/SearchBar/SearchBar.d.ts +1 -1
- package/es/components/SearchBar/SearchBar.js +2 -2
- package/es/components/SidePanel/SidePanel.js +17 -21
- 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/es/global/js/package-settings.d.ts +1 -1
- package/es/global/js/package-settings.js +1 -1
- package/es/settings.d.ts +1 -1
- 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 +34 -21
- package/lib/components/ConditionBuilder/ConditionBuilder.js +17 -7
- 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 +22 -10
- 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 +28 -15
- 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 +22 -20
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +48 -22
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +11 -8
- 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/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +68 -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/handleKeyboardEvents.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +119 -27
- 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/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +25 -7
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
- package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -8
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +8 -6
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
- package/lib/components/Datagrid/types/index.d.ts +28 -6
- package/lib/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/lib/components/Datagrid/useCustomizeColumns.js +4 -3
- package/lib/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/lib/components/Datagrid/useNestedRowExpander.js +1 -3
- package/lib/components/Datagrid/useRowExpander.js +1 -3
- package/lib/components/Datagrid/useSelectRows.js +2 -1
- package/lib/components/Datagrid/useStickyColumn.d.ts +8 -1
- package/lib/components/Datagrid/useStickyColumn.js +12 -9
- package/lib/components/EditInPlace/EditInPlace.d.ts +4 -0
- package/lib/components/EditInPlace/EditInPlace.js +21 -10
- package/lib/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/lib/components/EditTearsheet/EditTearsheet.js +43 -8
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/lib/components/Nav/NavItem.js +10 -1
- package/lib/components/OptionsTile/OptionsTile.js +11 -6
- package/lib/components/PageHeader/PageHeader.js +1 -0
- package/lib/components/SearchBar/SearchBar.d.ts +1 -1
- package/lib/components/SearchBar/SearchBar.js +2 -2
- package/lib/components/SidePanel/SidePanel.js +16 -20
- 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/lib/global/js/package-settings.d.ts +1 -1
- package/lib/global/js/package-settings.js +1 -1
- package/lib/settings.d.ts +1 -1
- package/package.json +4 -4
- package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +8 -4
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +9 -2
- package/scss/components/Datagrid/_datagrid.scss +0 -4
- package/scss/components/HTTPErrors/_http-errors.scss +77 -0
- package/scss/components/OptionsTile/_options-tile.scss +6 -6
- package/scss/components/SidePanel/_side-panel.scss +1 -1
- package/scss/components/_index-released-only.scss +1 -0
- package/telemetry.yml +12 -2
- 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
@@ -6,44 +6,43 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
var translationsObject = {
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
9
|
+
ifText: 'if',
|
10
|
+
excl_if: 'excl.if',
|
11
|
+
and: 'and',
|
12
|
+
or: 'or',
|
13
|
+
is: 'is',
|
14
|
+
greater: 'is greater than',
|
15
|
+
greaterEqual: 'is greater than or equal to',
|
16
|
+
lower: 'is lower than',
|
17
|
+
lowerEqual: 'is lower than or equal to',
|
18
|
+
startsWith: 'starts with',
|
19
|
+
endsWith: 'ends with',
|
20
|
+
contains: 'contains',
|
21
|
+
oneOf: 'is one of',
|
22
|
+
before: 'is before',
|
23
|
+
after: 'is after',
|
24
|
+
between: 'is between',
|
25
|
+
addConditionText: 'Add condition',
|
26
|
+
addConditionGroupText: 'Add condition group',
|
27
|
+
addSubgroupText: 'Add subgroup',
|
28
|
+
conditionText: 'Condition',
|
29
|
+
propertyText: 'Property',
|
30
|
+
operatorText: 'Operator',
|
31
|
+
valueText: 'Value',
|
32
|
+
connectorText: 'Connector',
|
33
|
+
conditionRowText: 'Condition row',
|
34
|
+
removeConditionText: 'Remove condition',
|
35
|
+
addConditionRowText: 'Add condition row',
|
36
|
+
startText: 'Start',
|
37
|
+
endText: 'End',
|
38
|
+
clearSearchText: 'Clear search input',
|
39
|
+
actionsText: 'Actions',
|
40
|
+
then: 'then',
|
41
|
+
removeActionText: 'Remove Action',
|
42
|
+
addActionText: 'Add action',
|
43
|
+
invalidText: 'Incomplete',
|
44
|
+
invalidDateText: 'Invalid Date',
|
45
|
+
invalidNumberWarnText: 'Invalid number, must be 0 or greater'
|
47
46
|
};
|
48
47
|
|
49
48
|
export { translationsObject };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export function ConditionBuilderItem({ children, className, label, renderIcon, title, type, showToolTip, condition, popOverClassName, config, ...rest }: {
|
1
|
+
export function ConditionBuilderItem({ children, className, label, renderIcon, title, type, showToolTip, condition, popOverClassName, config, renderChildren, ...rest }: {
|
2
2
|
[x: string]: any;
|
3
3
|
children: any;
|
4
4
|
className: any;
|
@@ -10,6 +10,7 @@ export function ConditionBuilderItem({ children, className, label, renderIcon, t
|
|
10
10
|
condition: any;
|
11
11
|
popOverClassName: any;
|
12
12
|
config: any;
|
13
|
+
renderChildren: any;
|
13
14
|
}): import("react/jsx-runtime").JSX.Element;
|
14
15
|
export namespace ConditionBuilderItem {
|
15
16
|
namespace propTypes {
|
@@ -19,6 +20,7 @@ export namespace ConditionBuilderItem {
|
|
19
20
|
let config: PropTypes.Requireable<object>;
|
20
21
|
let label: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
21
22
|
let popOverClassName: PropTypes.Requireable<string>;
|
23
|
+
let renderChildren: PropTypes.Requireable<(...args: any[]) => any>;
|
22
24
|
let renderIcon: PropTypes.Requireable<object>;
|
23
25
|
let showToolTip: PropTypes.Requireable<boolean>;
|
24
26
|
let title: PropTypes.Requireable<string>;
|
@@ -10,10 +10,11 @@ import React__default, { useRef, useState, useEffect } from 'react';
|
|
10
10
|
import { Popover, PopoverContent, Layer } from '@carbon/react';
|
11
11
|
import PropTypes from '../../../node_modules/prop-types/index.js';
|
12
12
|
import { Add } from '@carbon/react/icons';
|
13
|
-
import {
|
13
|
+
import { blockClass, valueRenderers } from '../ConditionBuilderContext/DataConfigs.js';
|
14
14
|
import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
|
15
|
+
import { useTranslations } from '../utils/useTranslations.js';
|
15
16
|
|
16
|
-
var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config"];
|
17
|
+
var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config", "renderChildren"];
|
17
18
|
var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
18
19
|
var children = _ref.children,
|
19
20
|
className = _ref.className,
|
@@ -25,23 +26,36 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
25
26
|
condition = _ref.condition,
|
26
27
|
popOverClassName = _ref.popOverClassName,
|
27
28
|
config = _ref.config,
|
29
|
+
renderChildren = _ref.renderChildren,
|
28
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
29
31
|
var contentRef = useRef(null);
|
32
|
+
var popoverRef = useRef(null);
|
30
33
|
var _useState = useState(false),
|
31
34
|
_useState2 = _slicedToArray(_useState, 2),
|
32
35
|
open = _useState2[0],
|
33
36
|
setOpen = _useState2[1];
|
37
|
+
var _useTranslations = useTranslations(['invalidText', 'addConditionText', label, 'invalidDateText']),
|
38
|
+
_useTranslations2 = _slicedToArray(_useTranslations, 4),
|
39
|
+
invalidText = _useTranslations2[0],
|
40
|
+
addConditionText = _useTranslations2[1],
|
41
|
+
labelText = _useTranslations2[2],
|
42
|
+
invalidDateText = _useTranslations2[3];
|
34
43
|
var getPropertyDetails = function getPropertyDetails() {
|
35
44
|
if (label === 'INVALID') {
|
36
45
|
return {
|
37
|
-
propertyLabel:
|
46
|
+
propertyLabel: invalidText,
|
47
|
+
isInvalid: true
|
48
|
+
};
|
49
|
+
} else if (label === 'INVALID_DATE') {
|
50
|
+
return {
|
51
|
+
propertyLabel: invalidDateText,
|
38
52
|
isInvalid: true
|
39
53
|
};
|
40
54
|
}
|
41
|
-
var propertyId = rest['data-name'] == 'valueField' && type ? valueRenderers[type](label, config) :
|
55
|
+
var propertyId = rest['data-name'] == 'valueField' && type ? valueRenderers[type](label, config) : labelText;
|
42
56
|
return {
|
43
57
|
isInvalid: false,
|
44
|
-
propertyLabel:
|
58
|
+
propertyLabel: propertyId
|
45
59
|
};
|
46
60
|
};
|
47
61
|
var _getPropertyDetails = getPropertyDetails(),
|
@@ -57,60 +71,68 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
57
71
|
//if any condition is changed, state prop is triggered
|
58
72
|
if (condition.popoverToOpen && currentField !== condition.popoverToOpen) {
|
59
73
|
// close the previous popover
|
60
|
-
|
61
|
-
} else if (currentField == 'valueField' && type == 'option' && condition.operator !== '
|
74
|
+
closePopover();
|
75
|
+
} else if (currentField == 'valueField' && type == 'option' && condition.operator !== 'oneOf') {
|
62
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.
|
63
|
-
|
77
|
+
closePopover();
|
64
78
|
}
|
65
79
|
if (condition.popoverToOpen == currentField) {
|
66
80
|
//current popover need to be opened
|
67
|
-
|
81
|
+
openPopOver();
|
68
82
|
}
|
69
83
|
} else {
|
70
84
|
// when we change any statement(if/ excl.if) which is not part of condition state, label change is triggered.
|
71
85
|
//close popOver when statement is changed.
|
72
|
-
|
86
|
+
closePopover();
|
73
87
|
}
|
74
88
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
75
89
|
}, [condition, label]);
|
76
90
|
useEffect(function () {
|
77
91
|
//this will focus the first input field in the popover
|
78
92
|
if (open && contentRef.current) {
|
79
|
-
var firstFocusableElement = contentRef.current.querySelector('input');
|
93
|
+
var firstFocusableElement = contentRef.current.querySelector('input,textarea');
|
80
94
|
if (firstFocusableElement) {
|
81
95
|
firstFocusableElement.focus();
|
82
96
|
}
|
83
97
|
}
|
84
98
|
}, [contentRef, open]);
|
99
|
+
var closePopover = function closePopover() {
|
100
|
+
return setOpen(false);
|
101
|
+
};
|
102
|
+
var openPopOver = function openPopOver() {
|
103
|
+
return setOpen(true);
|
104
|
+
};
|
105
|
+
var togglePopover = function togglePopover() {
|
106
|
+
return setOpen(!open);
|
107
|
+
};
|
85
108
|
return /*#__PURE__*/React__default.createElement(Popover, {
|
86
109
|
open: open,
|
87
110
|
isTabTip: true,
|
88
111
|
role: "gridcell",
|
89
112
|
className: popOverClassName,
|
90
|
-
|
91
|
-
|
92
|
-
}
|
113
|
+
ref: popoverRef,
|
114
|
+
onRequestClose: closePopover
|
93
115
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderButton, _extends({
|
94
|
-
label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel :
|
116
|
+
label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : addConditionText,
|
95
117
|
hideLabel: !label ? true : false,
|
96
|
-
onClick:
|
97
|
-
children ? setOpen(!open) : null;
|
98
|
-
},
|
118
|
+
onClick: togglePopover,
|
99
119
|
className: className,
|
100
120
|
"aria-haspopup": true,
|
101
121
|
"aria-expanded": open,
|
102
122
|
renderIcon: renderIcon ? renderIcon : label == undefined ? Add : null,
|
103
123
|
showToolTip: showToolTip,
|
104
|
-
isInvalid: isInvalid
|
105
|
-
|
124
|
+
isInvalid: isInvalid,
|
125
|
+
condition: condition
|
126
|
+
}, rest)), open && /*#__PURE__*/React__default.createElement(PopoverContent, {
|
106
127
|
className: "".concat(blockClass, "__item__content"),
|
107
128
|
role: "dialog",
|
108
|
-
"aria-label":
|
129
|
+
"aria-label": title
|
109
130
|
}, /*#__PURE__*/React__default.createElement(Layer, null, /*#__PURE__*/React__default.createElement("h1", {
|
110
131
|
className: "".concat(blockClass, "__item__title")
|
111
132
|
}, title), /*#__PURE__*/React__default.createElement("div", {
|
112
|
-
ref: contentRef
|
113
|
-
|
133
|
+
ref: contentRef,
|
134
|
+
className: "".concat(blockClass, "__popover-content")
|
135
|
+
}, renderChildren ? renderChildren(popoverRef) : children))));
|
114
136
|
};
|
115
137
|
ConditionBuilderItem.propTypes = {
|
116
138
|
/**
|
@@ -138,6 +160,10 @@ ConditionBuilderItem.propTypes = {
|
|
138
160
|
* class name for popover
|
139
161
|
*/
|
140
162
|
popOverClassName: PropTypes.string,
|
163
|
+
/**
|
164
|
+
* callback prop that returns the jsx for children
|
165
|
+
*/
|
166
|
+
renderChildren: PropTypes.func,
|
141
167
|
/**
|
142
168
|
* Optional prop to allow overriding the icon rendering.
|
143
169
|
*/
|
@@ -1,11 +1,13 @@
|
|
1
|
-
export function ConditionBuilderItemDate({ conditionState, onChange }: {
|
1
|
+
export function ConditionBuilderItemDate({ conditionState, onChange, parentRef, }: {
|
2
2
|
conditionState: any;
|
3
3
|
onChange: any;
|
4
|
+
parentRef: any;
|
4
5
|
}): import("react/jsx-runtime").JSX.Element;
|
5
6
|
export namespace ConditionBuilderItemDate {
|
6
7
|
namespace propTypes {
|
7
8
|
let conditionState: PropTypes.Requireable<object>;
|
8
9
|
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
10
|
+
let parentRef: PropTypes.Requireable<object>;
|
9
11
|
}
|
10
12
|
}
|
11
13
|
import PropTypes from 'prop-types';
|
@@ -5,26 +5,36 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
+
import { slicedToArray as _slicedToArray } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
8
9
|
import React__default, { useRef } from 'react';
|
9
10
|
import { DatePicker, DatePickerInput } from '@carbon/react';
|
10
11
|
import { pkg } from '../../../../settings.js';
|
11
12
|
import PropTypes from '../../../../node_modules/prop-types/index.js';
|
12
|
-
import {
|
13
|
+
import { useTranslations } from '../../utils/useTranslations.js';
|
13
14
|
|
14
15
|
var blockClass = "".concat(pkg.prefix, "--condition-builder");
|
15
16
|
var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
|
16
17
|
var conditionState = _ref.conditionState,
|
17
|
-
onChange = _ref.onChange
|
18
|
+
onChange = _ref.onChange,
|
19
|
+
parentRef = _ref.parentRef;
|
18
20
|
var DatePickerInputRef = useRef();
|
21
|
+
var _useTranslations = useTranslations(['startText', 'endText']),
|
22
|
+
_useTranslations2 = _slicedToArray(_useTranslations, 2),
|
23
|
+
startText = _useTranslations2[0],
|
24
|
+
endText = _useTranslations2[1];
|
19
25
|
var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
|
26
|
+
var onCloseHandler = function onCloseHandler(selectedDate) {
|
27
|
+
onChange(selectedDate && selectedDate.length > 0 ? selectedDate : 'INVALID_DATE');
|
28
|
+
};
|
20
29
|
return /*#__PURE__*/React__default.createElement("div", {
|
21
30
|
className: "".concat(blockClass, "__item-date ")
|
22
31
|
}, datePickerType == 'single' && /*#__PURE__*/React__default.createElement(DatePicker, {
|
23
32
|
ref: DatePickerInputRef,
|
24
33
|
dateFormat: "d/m/Y",
|
25
34
|
datePickerType: "single",
|
26
|
-
|
27
|
-
|
35
|
+
value: conditionState.value,
|
36
|
+
onClose: onCloseHandler,
|
37
|
+
appendTo: parentRef === null || parentRef === void 0 ? void 0 : parentRef.current
|
28
38
|
}, /*#__PURE__*/React__default.createElement(DatePickerInput, {
|
29
39
|
id: "datePicker",
|
30
40
|
placeholder: "dd/mm/yyyy",
|
@@ -33,16 +43,17 @@ var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
|
|
33
43
|
ref: DatePickerInputRef,
|
34
44
|
dateFormat: "d/m/Y",
|
35
45
|
datePickerType: datePickerType,
|
36
|
-
onClose:
|
37
|
-
value: conditionState.value
|
46
|
+
onClose: onCloseHandler,
|
47
|
+
value: conditionState.value,
|
48
|
+
appendTo: parentRef === null || parentRef === void 0 ? void 0 : parentRef.current
|
38
49
|
}, /*#__PURE__*/React__default.createElement(DatePickerInput, {
|
39
50
|
id: "datePickerStart",
|
40
51
|
placeholder: "dd/mm/yyyy",
|
41
|
-
labelText:
|
52
|
+
labelText: startText
|
42
53
|
}), /*#__PURE__*/React__default.createElement(DatePickerInput, {
|
43
54
|
id: "datePickerEnd",
|
44
55
|
placeholder: "dd/mm/yyyy",
|
45
|
-
labelText:
|
56
|
+
labelText: endText
|
46
57
|
})));
|
47
58
|
};
|
48
59
|
ConditionBuilderItemDate.propTypes = {
|
@@ -53,7 +64,11 @@ ConditionBuilderItemDate.propTypes = {
|
|
53
64
|
/**
|
54
65
|
* callback to update state oin date change
|
55
66
|
*/
|
56
|
-
onChange: PropTypes.func
|
67
|
+
onChange: PropTypes.func,
|
68
|
+
/**
|
69
|
+
* reference to the popover node
|
70
|
+
*/
|
71
|
+
parentRef: PropTypes.object
|
57
72
|
};
|
58
73
|
|
59
74
|
export { ConditionBuilderItemDate };
|
@@ -5,19 +5,24 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
+
import { slicedToArray as _slicedToArray, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
8
9
|
import React__default from 'react';
|
9
10
|
import { NumberInput } from '@carbon/react';
|
10
11
|
import PropTypes from '../../../../node_modules/prop-types/index.js';
|
11
|
-
import { blockClass
|
12
|
+
import { blockClass } from '../../ConditionBuilderContext/DataConfigs.js';
|
13
|
+
import { useTranslations } from '../../utils/useTranslations.js';
|
12
14
|
|
13
15
|
var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
14
16
|
var _conditionState$prope;
|
15
17
|
var conditionState = _ref.conditionState,
|
16
18
|
config = _ref.config,
|
17
19
|
onChange = _ref.onChange;
|
20
|
+
var _useTranslations = useTranslations(['invalidNumberWarnText']),
|
21
|
+
_useTranslations2 = _slicedToArray(_useTranslations, 1),
|
22
|
+
invalidNumberWarnText = _useTranslations2[0];
|
18
23
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
19
24
|
var value = _ref2.value;
|
20
|
-
if (checkIfValid(value)) {
|
25
|
+
if (!isNaN(value) && checkIfValid(value)) {
|
21
26
|
var _config$unit;
|
22
27
|
onChange("".concat(value, " ").concat((_config$unit = config.unit) !== null && _config$unit !== void 0 ? _config$unit : ''));
|
23
28
|
} else {
|
@@ -36,18 +41,16 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
|
36
41
|
};
|
37
42
|
return /*#__PURE__*/React__default.createElement("div", {
|
38
43
|
className: "".concat(blockClass, "__item-number")
|
39
|
-
}, /*#__PURE__*/React__default.createElement(NumberInput, {
|
44
|
+
}, /*#__PURE__*/React__default.createElement(NumberInput, _extends({
|
40
45
|
label: conditionState.property,
|
41
46
|
hideLabel: true,
|
42
|
-
defaultValue: getDefaultValue(),
|
43
47
|
id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
|
44
|
-
|
45
|
-
max: config.max,
|
46
|
-
step: config.step,
|
47
|
-
invalidText: translateWithId('text_invalid_number'),
|
48
|
+
invalidText: invalidNumberWarnText,
|
48
49
|
allowEmpty: true,
|
49
50
|
onChange: onChangeHandler
|
50
|
-
}
|
51
|
+
}, config, {
|
52
|
+
defaultValue: getDefaultValue()
|
53
|
+
})));
|
51
54
|
};
|
52
55
|
ConditionBuilderItemNumber.propTypes = {
|
53
56
|
/**
|
package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js
CHANGED
@@ -11,7 +11,8 @@ import { Search } from '@carbon/react';
|
|
11
11
|
import { Checkmark } from '@carbon/react/icons';
|
12
12
|
import PropTypes from '../../../../node_modules/prop-types/index.js';
|
13
13
|
import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
|
14
|
-
import { blockClass
|
14
|
+
import { blockClass } from '../../ConditionBuilderContext/DataConfigs.js';
|
15
|
+
import { useTranslations } from '../../utils/useTranslations.js';
|
15
16
|
|
16
17
|
var ItemOption = function ItemOption(_ref) {
|
17
18
|
var _ref$conditionState = _ref.conditionState,
|
@@ -22,6 +23,10 @@ var ItemOption = function ItemOption(_ref) {
|
|
22
23
|
var _useContext = useContext(ConditionBuilderContext),
|
23
24
|
popOverSearchThreshold = _useContext.popOverSearchThreshold;
|
24
25
|
var contentRef = useRef();
|
26
|
+
var _useTranslations = useTranslations(['propertyText', 'clearSearchText']),
|
27
|
+
_useTranslations2 = _slicedToArray(_useTranslations, 2),
|
28
|
+
propertyText = _useTranslations2[0],
|
29
|
+
clearSearchText = _useTranslations2[1];
|
25
30
|
var allOptions = config.options;
|
26
31
|
var _useState = useState(''),
|
27
32
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -49,7 +54,7 @@ var ItemOption = function ItemOption(_ref) {
|
|
49
54
|
setSearchValue(value);
|
50
55
|
};
|
51
56
|
var getAriaLabel = function getAriaLabel() {
|
52
|
-
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property :
|
57
|
+
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : propertyText;
|
53
58
|
};
|
54
59
|
if (!allOptions) {
|
55
60
|
return;
|
@@ -61,8 +66,8 @@ var ItemOption = function ItemOption(_ref) {
|
|
61
66
|
className: "".concat(blockClass, "__item-option__search")
|
62
67
|
}, /*#__PURE__*/React__default.createElement(Search, {
|
63
68
|
size: "sm",
|
64
|
-
labelText:
|
65
|
-
closeButtonLabelText:
|
69
|
+
labelText: clearSearchText,
|
70
|
+
closeButtonLabelText: clearSearchText,
|
66
71
|
onChange: onSearchChangeHandler
|
67
72
|
})), /*#__PURE__*/React__default.createElement("ul", {
|
68
73
|
"aria-label": getAriaLabel(),
|
@@ -11,7 +11,8 @@ import { SelectSkeleton, Search, Button } from '@carbon/react';
|
|
11
11
|
import { CheckboxCheckedFilled, Checkbox, Checkmark } from '@carbon/react/icons';
|
12
12
|
import PropTypes from '../../../../node_modules/prop-types/index.js';
|
13
13
|
import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
|
14
|
-
import { blockClass
|
14
|
+
import { blockClass } from '../../ConditionBuilderContext/DataConfigs.js';
|
15
|
+
import { useTranslations } from '../../utils/useTranslations.js';
|
15
16
|
|
16
17
|
var _SelectSkeleton, _CheckboxCheckedFille, _Checkbox;
|
17
18
|
var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
@@ -20,11 +21,15 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
20
21
|
_ref$config = _ref.config,
|
21
22
|
config = _ref$config === void 0 ? {} : _ref$config,
|
22
23
|
onChange = _ref.onChange;
|
23
|
-
var multiSelectable = conditionState.operator === '
|
24
|
+
var multiSelectable = conditionState.operator === 'oneOf';
|
24
25
|
var _useContext = useContext(ConditionBuilderContext),
|
25
26
|
popOverSearchThreshold = _useContext.popOverSearchThreshold,
|
26
27
|
getOptions = _useContext.getOptions,
|
27
28
|
rootState = _useContext.rootState;
|
29
|
+
var _useTranslations = useTranslations(['propertyText', 'clearSearchText']),
|
30
|
+
_useTranslations2 = _slicedToArray(_useTranslations, 2),
|
31
|
+
propertyText = _useTranslations2[0],
|
32
|
+
clearSearchText = _useTranslations2[1];
|
28
33
|
var contentRef = useRef();
|
29
34
|
var _useState = useState(config.options),
|
30
35
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -122,7 +127,7 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
122
127
|
}
|
123
128
|
};
|
124
129
|
var getAriaLabel = function getAriaLabel() {
|
125
|
-
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property :
|
130
|
+
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : propertyText;
|
126
131
|
};
|
127
132
|
if (!allOptions) {
|
128
133
|
return _SelectSkeleton || (_SelectSkeleton = /*#__PURE__*/React__default.createElement(SelectSkeleton, null));
|
@@ -134,8 +139,8 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
134
139
|
className: "".concat(blockClass, "__item-option__search")
|
135
140
|
}, /*#__PURE__*/React__default.createElement(Search, {
|
136
141
|
size: "sm",
|
137
|
-
labelText:
|
138
|
-
closeButtonLabelText:
|
142
|
+
labelText: clearSearchText,
|
143
|
+
closeButtonLabelText: clearSearchText,
|
139
144
|
onChange: onSearchChangeHandler
|
140
145
|
})), multiSelectable && /*#__PURE__*/React__default.createElement("div", {
|
141
146
|
className: "".concat(blockClass, "__multiselectSelectionStatusContainer")
|
@@ -1,11 +1,15 @@
|
|
1
|
-
export function ConditionBuilderItemText({ conditionState, onChange }: {
|
1
|
+
export function ConditionBuilderItemText({ conditionState, onChange, config, type, }: {
|
2
2
|
conditionState: any;
|
3
3
|
onChange: any;
|
4
|
+
config: any;
|
5
|
+
type: any;
|
4
6
|
}): import("react/jsx-runtime").JSX.Element;
|
5
7
|
export namespace ConditionBuilderItemText {
|
6
8
|
namespace propTypes {
|
7
9
|
let conditionState: PropTypes.Requireable<object>;
|
10
|
+
let config: PropTypes.Requireable<object>;
|
8
11
|
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
12
|
+
let type: PropTypes.Requireable<string>;
|
9
13
|
}
|
10
14
|
}
|
11
15
|
import PropTypes from 'prop-types';
|
@@ -5,18 +5,19 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
+
import { objectSpread2 as _objectSpread2 } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
8
9
|
import React__default from 'react';
|
9
|
-
import { TextInput } from '@carbon/react';
|
10
|
+
import { TextArea, TextInput } from '@carbon/react';
|
10
11
|
import PropTypes from '../../../../node_modules/prop-types/index.js';
|
11
12
|
import { blockClass } from '../../ConditionBuilderContext/DataConfigs.js';
|
12
13
|
|
13
14
|
var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
|
14
15
|
var _conditionState$value, _conditionState$prope;
|
15
16
|
var conditionState = _ref.conditionState,
|
16
|
-
_onChange = _ref.onChange
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
_onChange = _ref.onChange,
|
18
|
+
config = _ref.config,
|
19
|
+
type = _ref.type;
|
20
|
+
var inputProps = _objectSpread2({
|
20
21
|
labelText: conditionState.property,
|
21
22
|
hideLabel: true,
|
22
23
|
value: (_conditionState$value = conditionState.value) !== null && _conditionState$value !== void 0 ? _conditionState$value : '',
|
@@ -24,17 +25,28 @@ var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
|
|
24
25
|
onChange: function onChange(evt) {
|
25
26
|
_onChange(evt.target.value);
|
26
27
|
}
|
27
|
-
})
|
28
|
+
}, config);
|
29
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
30
|
+
className: "".concat(blockClass, "__item-text")
|
31
|
+
}, type == 'textarea' ? /*#__PURE__*/React__default.createElement(TextArea, inputProps) : /*#__PURE__*/React__default.createElement(TextInput, inputProps));
|
28
32
|
};
|
29
33
|
ConditionBuilderItemText.propTypes = {
|
30
34
|
/**
|
31
35
|
* current condition object
|
32
36
|
*/
|
33
37
|
conditionState: PropTypes.object,
|
38
|
+
/**
|
39
|
+
* config of the current property
|
40
|
+
*/
|
41
|
+
config: PropTypes.object,
|
34
42
|
/**
|
35
43
|
* callback to update state oin date change
|
36
44
|
*/
|
37
|
-
onChange: PropTypes.func
|
45
|
+
onChange: PropTypes.func,
|
46
|
+
/**
|
47
|
+
* current input type
|
48
|
+
*/
|
49
|
+
type: PropTypes.string
|
38
50
|
};
|
39
51
|
|
40
52
|
export { ConditionBuilderItemText };
|
@@ -58,7 +58,7 @@ var ConditionBuilderItemTime = function ConditionBuilderItemTime(_ref) {
|
|
58
58
|
value: "PM",
|
59
59
|
text: "PM"
|
60
60
|
}))), /*#__PURE__*/React__default.createElement(TimePickerSelect, {
|
61
|
-
id: "time-picker-
|
61
|
+
id: "time-picker-time-zone",
|
62
62
|
onChange: setTimeZone
|
63
63
|
}, config === null || config === void 0 || (_config$timeZones2 = config.timeZones) === null || _config$timeZones2 === void 0 ? void 0 : _config$timeZones2.map(function (timeZone, index) {
|
64
64
|
return /*#__PURE__*/React__default.createElement(SelectItem, {
|