@carbon/ibm-products 2.43.2-canary.4 → 2.43.2-canary.40
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 +52 -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 +12 -0
- 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 +52 -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 +52 -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.d.ts +12 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +51 -19
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +21 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +40 -8
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +20 -6
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.d.ts +3 -1
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.js +15 -3
- package/es/components/DataSpreadsheet/types/index.d.ts +1 -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/InlineEditButton/InlineEditButton.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +74 -11
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +10 -2
- package/es/components/Datagrid/types/index.d.ts +37 -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/useCustomizeColumns.d.ts +8 -1
- package/es/components/Datagrid/useCustomizeColumns.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/EditTearsheet/EditTearsheet.d.ts +5 -1
- package/es/components/EditTearsheet/EditTearsheet.js +0 -1
- package/es/components/EditTearsheet/EditTearsheetForm.d.ts +45 -2
- package/es/components/EditTearsheet/EditTearsheetForm.js +3 -0
- package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
- package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
- package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
- package/es/components/PageHeader/PageHeader.js +1 -0
- package/es/components/RemoveModal/RemoveModal.d.ts +4 -0
- package/es/components/RemoveModal/RemoveModal.js +7 -1
- package/es/components/StatusIndicator/StatusIndicatorStep.js +87 -0
- 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/es/components/Toolbar/ToolbarButton.js +1 -1
- package/es/components/index.d.ts +1 -1
- package/es/index.js +1 -0
- 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.d.ts +12 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +51 -19
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +21 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +40 -8
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +20 -6
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.d.ts +3 -1
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.js +15 -3
- package/lib/components/DataSpreadsheet/types/index.d.ts +1 -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/InlineEditButton/InlineEditButton.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +73 -10
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +10 -2
- package/lib/components/Datagrid/types/index.d.ts +37 -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/useCustomizeColumns.d.ts +8 -1
- package/lib/components/Datagrid/useCustomizeColumns.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/EditTearsheet/EditTearsheet.d.ts +5 -1
- package/lib/components/EditTearsheet/EditTearsheet.js +0 -1
- package/lib/components/EditTearsheet/EditTearsheetForm.d.ts +45 -2
- package/lib/components/EditTearsheet/EditTearsheetForm.js +3 -0
- package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
- package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
- package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
- package/lib/components/PageHeader/PageHeader.js +1 -0
- package/lib/components/RemoveModal/RemoveModal.d.ts +4 -0
- package/lib/components/RemoveModal/RemoveModal.js +7 -1
- package/lib/components/StatusIndicator/StatusIndicatorStep.js +94 -0
- 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/lib/components/Toolbar/ToolbarButton.js +1 -1
- package/lib/components/index.d.ts +1 -1
- package/lib/index.js +5 -0
- package/package.json +7 -6
- 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 +8 -0
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +13 -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
@@ -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';
|
@@ -0,0 +1,117 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
+
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
var React = require('react');
|
14
|
+
var react = require('@carbon/react');
|
15
|
+
var icons = require('@carbon/react/icons');
|
16
|
+
var index = require('../../../../node_modules/prop-types/index.js');
|
17
|
+
var ConditionBuilderProvider = require('../../ConditionBuilderContext/ConditionBuilderProvider.js');
|
18
|
+
var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
|
19
|
+
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
21
|
+
|
22
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
23
|
+
|
24
|
+
var ItemOption = function ItemOption(_ref) {
|
25
|
+
var _ref$conditionState = _ref.conditionState,
|
26
|
+
conditionState = _ref$conditionState === void 0 ? {} : _ref$conditionState,
|
27
|
+
_ref$config = _ref.config,
|
28
|
+
config = _ref$config === void 0 ? {} : _ref$config,
|
29
|
+
onChange = _ref.onChange;
|
30
|
+
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
31
|
+
popOverSearchThreshold = _useContext.popOverSearchThreshold;
|
32
|
+
var contentRef = React.useRef();
|
33
|
+
var allOptions = config.options;
|
34
|
+
var _useState = React.useState(''),
|
35
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
36
|
+
searchValue = _useState2[0],
|
37
|
+
setSearchValue = _useState2[1];
|
38
|
+
var selection = conditionState.value;
|
39
|
+
var filteredItems = allOptions === null || allOptions === void 0 ? void 0 : allOptions.filter(function (opt) {
|
40
|
+
return opt.label.toLowerCase().includes(searchValue.toLowerCase());
|
41
|
+
});
|
42
|
+
React.useEffect(function () {
|
43
|
+
//this will focus the first input field in the popover
|
44
|
+
|
45
|
+
if (contentRef.current) {
|
46
|
+
var firstFocusableElement = contentRef.current.querySelector('input, button,li');
|
47
|
+
if (firstFocusableElement) {
|
48
|
+
firstFocusableElement.focus();
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}, [allOptions]);
|
52
|
+
var onClickHandler = function onClickHandler(evt, option) {
|
53
|
+
onChange(option.id, evt);
|
54
|
+
};
|
55
|
+
var onSearchChangeHandler = function onSearchChangeHandler(evt) {
|
56
|
+
var value = evt.target.value;
|
57
|
+
setSearchValue(value);
|
58
|
+
};
|
59
|
+
var getAriaLabel = function getAriaLabel() {
|
60
|
+
return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : DataConfigs.translateWithId('property');
|
61
|
+
};
|
62
|
+
if (!allOptions) {
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
66
|
+
className: "".concat(DataConfigs.blockClass, "__item-option"),
|
67
|
+
ref: contentRef
|
68
|
+
}, allOptions.length > popOverSearchThreshold && /*#__PURE__*/React__default["default"].createElement("div", {
|
69
|
+
className: "".concat(DataConfigs.blockClass, "__item-option__search")
|
70
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.Search, {
|
71
|
+
size: "sm",
|
72
|
+
labelText: DataConfigs.translateWithId('clear_search'),
|
73
|
+
closeButtonLabelText: DataConfigs.translateWithId('clear_search'),
|
74
|
+
onChange: onSearchChangeHandler
|
75
|
+
})), /*#__PURE__*/React__default["default"].createElement("ul", {
|
76
|
+
"aria-label": getAriaLabel(),
|
77
|
+
role: "listbox"
|
78
|
+
}, filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.map(function (option) {
|
79
|
+
var isSelected = selection === option.id;
|
80
|
+
var Icon = option.icon;
|
81
|
+
return /*#__PURE__*/React__default["default"].createElement("li", {
|
82
|
+
tabIndex: 0,
|
83
|
+
key: option.id,
|
84
|
+
role: "option",
|
85
|
+
"aria-selected": isSelected,
|
86
|
+
className: "".concat(DataConfigs.blockClass, "__item-option__option"),
|
87
|
+
onKeyUp: function onKeyUp() {
|
88
|
+
return false;
|
89
|
+
},
|
90
|
+
onClick: function onClick(evt) {
|
91
|
+
return onClickHandler(evt, option);
|
92
|
+
}
|
93
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
94
|
+
className: "".concat(DataConfigs.blockClass, "__item-option__option-content")
|
95
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
96
|
+
className: "".concat(DataConfigs.blockClass, "__item-option__option-label")
|
97
|
+
}, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, null), option.label), isSelected && /*#__PURE__*/React__default["default"].createElement(icons.Checkmark, {
|
98
|
+
className: "".concat(DataConfigs.blockClass, "__checkmark")
|
99
|
+
})));
|
100
|
+
})));
|
101
|
+
};
|
102
|
+
ItemOption.propTypes = {
|
103
|
+
/**
|
104
|
+
* current condition object
|
105
|
+
*/
|
106
|
+
conditionState: index["default"].object,
|
107
|
+
/**
|
108
|
+
* current config object that this property is part of
|
109
|
+
*/
|
110
|
+
config: index["default"].object,
|
111
|
+
/**
|
112
|
+
* callback to update state oin date change
|
113
|
+
*/
|
114
|
+
onChange: index["default"].func
|
115
|
+
};
|
116
|
+
|
117
|
+
exports.ItemOption = ItemOption;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
export function
|
1
|
+
export function ItemOptionForValueField({ conditionState, config, onChange, }: {
|
2
2
|
conditionState?: {} | undefined;
|
3
3
|
config?: {} | undefined;
|
4
4
|
onChange: any;
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
6
|
-
export namespace
|
6
|
+
export namespace ItemOptionForValueField {
|
7
7
|
namespace propTypes {
|
8
8
|
let conditionState: PropTypes.Requireable<object>;
|
9
9
|
let config: PropTypes.Requireable<object>;
|