@carbon/ibm-products 2.43.2-canary.2 → 2.43.2-canary.22
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +35 -3
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +35 -3
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +35 -3
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +23 -21
- package/es/components/ConditionBuilder/ConditionBuilder.js +67 -20
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +129 -0
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -4
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +24 -16
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +19 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +109 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +58 -33
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -5
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
- package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/util.js +16 -1
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +29 -16
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +9 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +18 -2
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +17 -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/addons/Filtering/FilterFlyout.js +6 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.d.ts +3 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +6 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +21 -16
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +21 -3
- package/es/components/Datagrid/types/index.d.ts +18 -4
- package/es/components/Datagrid/useActionsColumn.d.ts +8 -1
- package/es/components/Datagrid/useActionsColumn.js +7 -6
- package/es/components/Datagrid/useColumnRightAlign.d.ts +8 -1
- package/es/components/Datagrid/useColumnRightAlign.js +4 -3
- package/es/components/Datagrid/useInlineEdit.d.ts +8 -1
- package/es/components/Datagrid/useInlineEdit.js +13 -3
- package/es/components/Datagrid/useNestedRows.js +27 -9
- package/es/components/Decorator/Decorator.js +2 -1
- package/es/components/DecoratorBase/DecoratorBase.js +3 -5
- package/es/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
- package/es/components/DecoratorLink/DecoratorLink.js +2 -1
- package/es/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
- package/es/components/Tearsheet/Tearsheet.d.ts +8 -1
- package/es/components/Tearsheet/Tearsheet.js +9 -1
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
- package/es/components/Tearsheet/TearsheetNarrow.js +12 -0
- package/es/components/Tearsheet/TearsheetShell.d.ts +10 -0
- package/es/components/Tearsheet/TearsheetShell.js +17 -3
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +23 -21
- package/lib/components/ConditionBuilder/ConditionBuilder.js +67 -20
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +137 -0
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -3
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +23 -15
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +20 -5
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +117 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +56 -31
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -4
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
- package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/util.js +17 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +29 -16
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +9 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +18 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +17 -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/addons/Filtering/FilterFlyout.js +6 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.d.ts +3 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +6 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +21 -16
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +21 -3
- package/lib/components/Datagrid/types/index.d.ts +18 -4
- package/lib/components/Datagrid/useActionsColumn.d.ts +8 -1
- package/lib/components/Datagrid/useActionsColumn.js +7 -6
- package/lib/components/Datagrid/useColumnRightAlign.d.ts +8 -1
- package/lib/components/Datagrid/useColumnRightAlign.js +4 -3
- package/lib/components/Datagrid/useInlineEdit.d.ts +8 -1
- package/lib/components/Datagrid/useInlineEdit.js +13 -3
- package/lib/components/Datagrid/useNestedRows.js +27 -9
- package/lib/components/Decorator/Decorator.js +2 -1
- package/lib/components/DecoratorBase/DecoratorBase.js +3 -5
- package/lib/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
- package/lib/components/DecoratorLink/DecoratorLink.js +2 -1
- package/lib/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
- package/lib/components/Tearsheet/Tearsheet.d.ts +8 -1
- package/lib/components/Tearsheet/Tearsheet.js +9 -1
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
- package/lib/components/Tearsheet/TearsheetNarrow.js +12 -0
- package/lib/components/Tearsheet/TearsheetShell.d.ts +10 -0
- package/lib/components/Tearsheet/TearsheetShell.js +16 -2
- package/package.json +3 -3
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +9 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +26 -1
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +1 -0
- package/scss/components/StatusIcon/_status-icon.scss +4 -4
- package/scss/components/StringFormatter/_string-formatter.scss +2 -2
- package/scss/components/UserProfileImage/_user-profile-image.scss +6 -2
- package/telemetry.yml +1 -0
- 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
@@ -5,6 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
+
import { typeof as _typeof } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
8
9
|
import React__default from 'react';
|
9
10
|
import { pkg } from '../../settings.js';
|
10
11
|
import cx from 'classnames';
|
@@ -13,19 +14,20 @@ import { InlineEditCell } from './Datagrid/addons/InlineEdit/InlineEditCell/Inli
|
|
13
14
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
14
15
|
var useInlineEdit = function useInlineEdit(hooks) {
|
15
16
|
var addInlineEdit = function addInlineEdit(props, _ref) {
|
16
|
-
var _cell$column, _cell$column2;
|
17
|
+
var _cell$column, _cell$column2, _cell$value, _cell$value2, _cell$value3;
|
17
18
|
var cell = _ref.cell,
|
18
19
|
instance = _ref.instance;
|
19
20
|
var columnInlineEditConfig = cell.column.inlineEdit;
|
20
21
|
var inlineEditType = (_cell$column = cell.column) === null || _cell$column === void 0 || (_cell$column = _cell$column.inlineEdit) === null || _cell$column === void 0 ? void 0 : _cell$column.type;
|
21
22
|
var isDisabled = (_cell$column2 = cell.column) === null || _cell$column2 === void 0 ? void 0 : _cell$column2.isDisabled;
|
23
|
+
var staticCell = _typeof(cell.value) === 'object' && cell.column.id === ((_cell$value = cell.value) === null || _cell$value === void 0 ? void 0 : _cell$value.columnId) && ((_cell$value2 = cell.value) === null || _cell$value2 === void 0 ? void 0 : _cell$value2.isStaticCell);
|
22
24
|
var renderInlineEditComponent = function renderInlineEditComponent(type) {
|
23
25
|
return /*#__PURE__*/React__default.createElement(InlineEditCell, {
|
24
26
|
config: columnInlineEditConfig,
|
25
27
|
tabIndex: -1,
|
26
28
|
value: cell.value,
|
27
29
|
cell: cell,
|
28
|
-
|
30
|
+
disabledCell: isDisabled,
|
29
31
|
instance: instance,
|
30
32
|
type: type
|
31
33
|
});
|
@@ -38,7 +40,15 @@ var useInlineEdit = function useInlineEdit(hooks) {
|
|
38
40
|
return [props, {
|
39
41
|
className: cx("".concat(blockClass, "__cell"), "".concat(blockClass, "__cell-inline-edit")),
|
40
42
|
role: 'gridcell',
|
41
|
-
children: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, inlineEditType === 'text' && renderInlineEditComponent(inlineEditType), inlineEditType === 'number' && renderInlineEditComponent(inlineEditType), inlineEditType === 'selection' && renderInlineEditComponent(inlineEditType), inlineEditType === 'date' && renderInlineEditComponent(inlineEditType),
|
43
|
+
children: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !staticCell && inlineEditType === 'text' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'number' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'selection' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'date' && renderInlineEditComponent(inlineEditType), staticCell && /*#__PURE__*/React__default.createElement(InlineEditCell, {
|
44
|
+
config: columnInlineEditConfig,
|
45
|
+
tabIndex: -1,
|
46
|
+
value: (_cell$value3 = cell.value) === null || _cell$value3 === void 0 ? void 0 : _cell$value3.value,
|
47
|
+
cell: cell,
|
48
|
+
instance: instance,
|
49
|
+
nonEditCell: true,
|
50
|
+
type: "text"
|
51
|
+
}), !inlineEditType && /*#__PURE__*/React__default.createElement(InlineEditCell, {
|
42
52
|
config: columnInlineEditConfig,
|
43
53
|
tabIndex: -1,
|
44
54
|
value: cell.value,
|
@@ -15,12 +15,30 @@ var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
15
15
|
var useNestedRows = function useNestedRows(hooks) {
|
16
16
|
useNestedRowExpander(hooks);
|
17
17
|
var useInstance = function useInstance(instance) {
|
18
|
+
useEffect(function () {
|
19
|
+
var _ref = instance,
|
20
|
+
rows = _ref.rows;
|
21
|
+
var defaultExpandedRows = rows.filter(function (row) {
|
22
|
+
var _row$original;
|
23
|
+
return row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.defaultExpanded;
|
24
|
+
});
|
25
|
+
if (defaultExpandedRows !== null && defaultExpandedRows !== void 0 && defaultExpandedRows.length) {
|
26
|
+
defaultExpandedRows.map(function (defaultExpandedRow) {
|
27
|
+
if (!(defaultExpandedRow !== null && defaultExpandedRow !== void 0 && defaultExpandedRow.isExpanded) && !(defaultExpandedRow !== null && defaultExpandedRow !== void 0 && defaultExpandedRow.hasExpanded)) {
|
28
|
+
var _defaultExpandedRow$t;
|
29
|
+
defaultExpandedRow === null || defaultExpandedRow === void 0 || (_defaultExpandedRow$t = defaultExpandedRow.toggleRowExpanded) === null || _defaultExpandedRow$t === void 0 || _defaultExpandedRow$t.call(defaultExpandedRow);
|
30
|
+
defaultExpandedRow.hasExpanded = true;
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
});
|
34
|
+
}
|
35
|
+
}, [instance, instance.rows]);
|
18
36
|
// This useEffect will expand rows if they exist in the initialState obj
|
19
37
|
useEffect(function () {
|
20
38
|
var rows = instance.rows,
|
21
39
|
initialState = instance.initialState;
|
22
|
-
var
|
23
|
-
expandedRowIds =
|
40
|
+
var _ref2 = initialState,
|
41
|
+
expandedRowIds = _ref2.expandedRowIds;
|
24
42
|
if (expandedRowIds) {
|
25
43
|
Object.keys(expandedRowIds).forEach(function (key) {
|
26
44
|
var row = rows.filter(function (r) {
|
@@ -34,14 +52,14 @@ var useNestedRows = function useNestedRows(hooks) {
|
|
34
52
|
}
|
35
53
|
}, [instance]);
|
36
54
|
var marginLeft = 24;
|
37
|
-
var getRowProps = function getRowProps(props,
|
38
|
-
var row =
|
55
|
+
var getRowProps = function getRowProps(props, _ref3) {
|
56
|
+
var row = _ref3.row;
|
39
57
|
return [props, {
|
40
58
|
className: cx(_defineProperty(_defineProperty({}, "".concat(blockClass, "__carbon-nested-row"), row.depth > 0), "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded))
|
41
59
|
}];
|
42
60
|
};
|
43
|
-
var getRowStyles = function getRowStyles(props,
|
44
|
-
var row =
|
61
|
+
var getRowStyles = function getRowStyles(props, _ref4) {
|
62
|
+
var row = _ref4.row;
|
45
63
|
return [props, {
|
46
64
|
style: {
|
47
65
|
paddingLeft: "".concat(row.depth > 1 ? marginLeft * 2 + (row.depth - 1) * (marginLeft + marginLeft / 3) : row.depth === 1 ? marginLeft * 2 : 0, "px")
|
@@ -51,9 +69,9 @@ var useNestedRows = function useNestedRows(hooks) {
|
|
51
69
|
var getIndentation = function getIndentation(depth) {
|
52
70
|
return 32 * depth + 16;
|
53
71
|
}; // row indentation padding
|
54
|
-
var getCellProps = function getCellProps(props,
|
55
|
-
var cell =
|
56
|
-
instance =
|
72
|
+
var getCellProps = function getCellProps(props, _ref5) {
|
73
|
+
var cell = _ref5.cell,
|
74
|
+
instance = _ref5.instance;
|
57
75
|
// we add a dynamic -ve margin right only if the cell is resized below minimum width i.e 50px, else we set the width based on indentation at different levels
|
58
76
|
var isFirstCell = instance.columns.findIndex(function (c) {
|
59
77
|
return c.id === cell.column.id;
|
@@ -87,7 +87,8 @@ Decorator.propTypes = {
|
|
87
87
|
*/
|
88
88
|
small: PropTypes.bool,
|
89
89
|
/**
|
90
|
-
*
|
90
|
+
* Override the default theme of the component.
|
91
|
+
* Useful if you want "invert" the component's theme.
|
91
92
|
*/
|
92
93
|
theme: PropTypes.oneOf(['light', 'dark']),
|
93
94
|
/**
|
@@ -23,8 +23,7 @@ var defaults = {
|
|
23
23
|
onContextMenu: function onContextMenu() {},
|
24
24
|
onContextMenuLabel: function onContextMenuLabel() {},
|
25
25
|
onContextMenuValue: function onContextMenuValue() {},
|
26
|
-
scoreThresholds: [0, 4, 7, 10]
|
27
|
-
theme: 'light'
|
26
|
+
scoreThresholds: [0, 4, 7, 10]
|
28
27
|
};
|
29
28
|
|
30
29
|
/**
|
@@ -56,8 +55,7 @@ var DecoratorBase = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
56
55
|
_ref$scoreThresholds = _ref.scoreThresholds,
|
57
56
|
scoreThresholds = _ref$scoreThresholds === void 0 ? defaults.scoreThresholds : _ref$scoreThresholds,
|
58
57
|
small = _ref.small,
|
59
|
-
|
60
|
-
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
58
|
+
theme = _ref.theme,
|
61
59
|
truncateValue = _ref.truncateValue,
|
62
60
|
value = _ref.value,
|
63
61
|
valueTitle = _ref.valueTitle,
|
@@ -67,7 +65,7 @@ var DecoratorBase = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
67
65
|
var _value = truncate(value, truncateValue);
|
68
66
|
|
69
67
|
// These class names apply to all types of DecoratorBase.
|
70
|
-
var classNames = cx(blockClass, className, "".concat(blockClass, "--").concat(theme),
|
68
|
+
var classNames = cx(blockClass, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "--").concat(theme), theme), "".concat(blockClass, "--sm"), small), "".concat(blockClass, "--truncate-end"), truncateValue === 'end'), "".concat(blockClass, "--truncate-start"), truncateValue === 'start'), "".concat(blockClass, "--truncate-midline"), truncateValue === null || truncateValue === void 0 ? void 0 : truncateValue.maxLength));
|
71
69
|
|
72
70
|
// These properties apply to all <DecoratorIcons>.
|
73
71
|
var decoratorIconsProps = {
|
@@ -111,7 +111,8 @@ DecoratorDualButton.propTypes = {
|
|
111
111
|
*/
|
112
112
|
small: PropTypes.bool,
|
113
113
|
/**
|
114
|
-
*
|
114
|
+
* Override the default theme of the component.
|
115
|
+
* Useful if you want "invert" the component's theme.
|
115
116
|
*/
|
116
117
|
theme: PropTypes.oneOf(['light', 'dark']),
|
117
118
|
/**
|
@@ -101,7 +101,8 @@ DecoratorLink.propTypes = {
|
|
101
101
|
*/
|
102
102
|
small: PropTypes.bool,
|
103
103
|
/**
|
104
|
-
*
|
104
|
+
* Override the default theme of the component.
|
105
|
+
* Useful if you want "invert" the component's theme.
|
105
106
|
*/
|
106
107
|
theme: PropTypes.oneOf(['light', 'dark']),
|
107
108
|
/**
|
@@ -101,7 +101,8 @@ DecoratorSingleButton.propTypes = {
|
|
101
101
|
*/
|
102
102
|
small: PropTypes.bool,
|
103
103
|
/**
|
104
|
-
*
|
104
|
+
* Override the default theme of the component.
|
105
|
+
* Useful if you want "invert" the component's theme.
|
105
106
|
*/
|
106
107
|
theme: PropTypes.oneOf(['light', 'dark']),
|
107
108
|
/**
|
@@ -99,9 +99,16 @@ interface TearsheetProps extends PropsWithChildren {
|
|
99
99
|
*/
|
100
100
|
portalTarget: ReactNode;
|
101
101
|
/**
|
102
|
-
* Specify a CSS selector that matches the DOM element that should be
|
102
|
+
* Specify a CSS selector that matches the DOM element that should be
|
103
|
+
* focused when the Modal opens.
|
103
104
|
*/
|
104
105
|
selectorPrimaryFocus?: string;
|
106
|
+
/**
|
107
|
+
* Specify the CSS selectors that match the floating menus.
|
108
|
+
*
|
109
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-composedmodal--overview#focus-management
|
110
|
+
*/
|
111
|
+
selectorsFloatingMenus?: string[];
|
105
112
|
/**
|
106
113
|
* The main title of the tearsheet, displayed in the header area.
|
107
114
|
*/
|
@@ -190,9 +190,17 @@ Tearsheet.propTypes = _objectSpread2({
|
|
190
190
|
/**@ts-ignore */
|
191
191
|
portalTarget: portalType,
|
192
192
|
/**
|
193
|
-
* Specify a CSS selector that matches the DOM element that should be
|
193
|
+
* Specify a CSS selector that matches the DOM element that should be
|
194
|
+
* focused when the Modal opens.
|
194
195
|
*/
|
195
196
|
selectorPrimaryFocus: PropTypes.string,
|
197
|
+
/**
|
198
|
+
* Specify the CSS selectors that match the floating menus.
|
199
|
+
*
|
200
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-composedmodal--overview#focus-management
|
201
|
+
*/
|
202
|
+
/**@ts-ignore*/
|
203
|
+
selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string),
|
196
204
|
/**
|
197
205
|
* The main title of the tearsheet, displayed in the header area.
|
198
206
|
*/
|
@@ -64,6 +64,17 @@ interface TearsheetNarrowBaseProps extends PropsWithChildren {
|
|
64
64
|
* The DOM element that the tearsheet should be rendered within. Defaults to document.body.
|
65
65
|
*/
|
66
66
|
portalTarget?: ReactNode;
|
67
|
+
/**
|
68
|
+
* Specify a CSS selector that matches the DOM element that should be
|
69
|
+
* focused when the Modal opens.
|
70
|
+
*/
|
71
|
+
selectorPrimaryFocus?: string;
|
72
|
+
/**
|
73
|
+
* Specify the CSS selectors that match the floating menus.
|
74
|
+
*
|
75
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-composedmodal--overview#focus-management
|
76
|
+
*/
|
77
|
+
selectorsFloatingMenus?: string[];
|
67
78
|
/**
|
68
79
|
* The main title of the tearsheet, displayed in the header area.
|
69
80
|
*/
|
@@ -148,6 +148,18 @@ TearsheetNarrow.propTypes = _objectSpread2({
|
|
148
148
|
*/
|
149
149
|
/**@ts-ignore */
|
150
150
|
portalTarget: portalType,
|
151
|
+
/**
|
152
|
+
* Specify a CSS selector that matches the DOM element that should be
|
153
|
+
* focused when the Modal opens.
|
154
|
+
*/
|
155
|
+
selectorPrimaryFocus: PropTypes.string,
|
156
|
+
/**
|
157
|
+
* Specify the CSS selectors that match the floating menus.
|
158
|
+
*
|
159
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-composedmodal--overview#focus-management
|
160
|
+
*/
|
161
|
+
/**@ts-ignore*/
|
162
|
+
selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string),
|
151
163
|
/**
|
152
164
|
* The main title of the tearsheet, displayed in the header area.
|
153
165
|
*/
|
@@ -81,7 +81,17 @@ interface TearsheetShellProps extends PropsWithChildren {
|
|
81
81
|
* The DOM element that the tearsheet should be rendered within. Defaults to document.body.
|
82
82
|
*/
|
83
83
|
portalTarget?: ReactNode;
|
84
|
+
/**
|
85
|
+
* Specify a CSS selector that matches the DOM element that should be
|
86
|
+
* focused when the Modal opens.
|
87
|
+
*/
|
84
88
|
selectorPrimaryFocus?: string;
|
89
|
+
/**
|
90
|
+
* Specify the CSS selectors that match the floating menus.
|
91
|
+
*
|
92
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-composedmodal--overview#focus-management
|
93
|
+
*/
|
94
|
+
selectorsFloatingMenus?: string[];
|
85
95
|
/**
|
86
96
|
* Specifies the width of the tearsheet, 'narrow' or 'wide'.
|
87
97
|
*/
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
8
|
+
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty, toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { useRef, useState, useEffect } from 'react';
|
10
10
|
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
|
11
11
|
import PropTypes from '../../node_modules/prop-types/index.js';
|
@@ -20,7 +20,7 @@ import { useFocus } from '../../global/js/hooks/useFocus.js';
|
|
20
20
|
import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
|
21
21
|
import { ActionSet } from '../ActionSet/ActionSet.js';
|
22
22
|
|
23
|
-
var _excluded = ["actions", "ariaLabel", "children", "className", "closeIconDescription", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
|
23
|
+
var _excluded = ["actions", "ariaLabel", "children", "className", "closeIconDescription", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "selectorsFloatingMenus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
|
24
24
|
|
25
25
|
// The block part of our conventional BEM class names (bc__E--M).
|
26
26
|
var bc = "".concat(pkg.prefix, "--tearsheet");
|
@@ -79,6 +79,8 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
79
79
|
open = _ref.open,
|
80
80
|
portalTargetIn = _ref.portalTarget,
|
81
81
|
selectorPrimaryFocus = _ref.selectorPrimaryFocus,
|
82
|
+
_ref$selectorsFloatin = _ref.selectorsFloatingMenus,
|
83
|
+
selectorsFloatingMenus = _ref$selectorsFloatin === void 0 ? [] : _ref$selectorsFloatin,
|
82
84
|
size = _ref.size,
|
83
85
|
slug = _ref.slug,
|
84
86
|
title = _ref.title,
|
@@ -249,7 +251,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
249
251
|
onKeyDown: keyDownListener,
|
250
252
|
preventCloseOnClickOutside: !isPassive,
|
251
253
|
ref: modalRef,
|
252
|
-
selectorsFloatingMenus: [".".concat(carbonPrefix, "--overflow-menu-options"), ".".concat(carbonPrefix, "--tooltip"), '.flatpickr-calendar', ".".concat(bc, "__container")],
|
254
|
+
selectorsFloatingMenus: [".".concat(carbonPrefix, "--overflow-menu-options"), ".".concat(carbonPrefix, "--tooltip"), '.flatpickr-calendar', ".".concat(bc, "__container")].concat(_toConsumableArray(selectorsFloatingMenus)),
|
253
255
|
size: "sm"
|
254
256
|
}), includeHeader && /*#__PURE__*/React__default.createElement(ModalHeader, {
|
255
257
|
className: cx("".concat(bc, "__header"), _defineProperty(_defineProperty({}, "".concat(bc, "__header--with-close-icon"), effectiveHasCloseIcon), "".concat(bc, "__header--with-nav"), navigation)),
|
@@ -445,6 +447,18 @@ TearsheetShell.propTypes = _objectSpread2({
|
|
445
447
|
*/
|
446
448
|
/**@ts-ignore*/
|
447
449
|
portalTarget: portalType,
|
450
|
+
/**
|
451
|
+
* Specify a CSS selector that matches the DOM element that should be
|
452
|
+
* focused when the Modal opens.
|
453
|
+
*/
|
454
|
+
selectorPrimaryFocus: PropTypes.string,
|
455
|
+
/**
|
456
|
+
* Specify the CSS selectors that match the floating menus.
|
457
|
+
*
|
458
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-composedmodal--overview#focus-management
|
459
|
+
*/
|
460
|
+
/**@ts-ignore*/
|
461
|
+
selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string),
|
448
462
|
/**
|
449
463
|
* Specifies the width of the tearsheet, 'narrow' or 'wide'.
|
450
464
|
*/
|
@@ -15,7 +15,6 @@ var icons = require('@carbon/react/icons');
|
|
15
15
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
16
16
|
var index = require('../../../node_modules/prop-types/index.js');
|
17
17
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
18
|
-
var ConditionBuilderItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js');
|
19
18
|
var cx = require('classnames');
|
20
19
|
var ConditionConnector = require('../ConditionBuilderConnector/ConditionConnector.js');
|
21
20
|
var ConditionBuilderItemNumber = require('../ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js');
|
@@ -26,6 +25,8 @@ var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilder
|
|
26
25
|
var util = require('../utils/util.js');
|
27
26
|
var ConditionBuilderItemTime = require('../ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js');
|
28
27
|
var ConditionBuilderAdd = require('../ConditionBuilderAdd/ConditionBuilderAdd.js');
|
28
|
+
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
29
|
+
var ItemOptionForValueField = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js');
|
29
30
|
|
30
31
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
31
32
|
|
@@ -33,6 +34,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
33
34
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
34
35
|
|
35
36
|
var _div;
|
37
|
+
|
36
38
|
/**
|
37
39
|
* This component build each block of condition consisting of property, operator value and close button.
|
38
40
|
*/
|
@@ -62,14 +64,6 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
62
64
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
63
65
|
inputConfig = _useContext.inputConfig,
|
64
66
|
variant = _useContext.variant;
|
65
|
-
//Below possible input types expected for value field.
|
66
|
-
var itemComponents = {
|
67
|
-
option: ConditionBuilderItemOption.ConditionBuilderItemOption,
|
68
|
-
text: ConditionBuilderItemText.ConditionBuilderItemText,
|
69
|
-
number: ConditionBuilderItemNumber.ConditionBuilderItemNumber,
|
70
|
-
date: ConditionBuilderItemDate.ConditionBuilderItemDate,
|
71
|
-
time: ConditionBuilderItemTime.ConditionBuilderItemTime
|
72
|
-
};
|
73
67
|
var _useState = React.useState(false),
|
74
68
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
75
69
|
showDeletionPreview = _useState2[0],
|
@@ -87,13 +81,17 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
87
81
|
type = _getCurrentConfig.type,
|
88
82
|
config = _getCurrentConfig.config,
|
89
83
|
label = _getCurrentConfig.label;
|
90
|
-
var ItemComponent;
|
91
|
-
// if (type == 'custom') {
|
92
|
-
// ItemComponent = config.component;
|
93
|
-
// } else {
|
94
|
-
ItemComponent = property ? itemComponents[type] : null;
|
95
|
-
//}
|
96
84
|
|
85
|
+
//Below possible input types expected for value field.
|
86
|
+
var itemComponents = {
|
87
|
+
text: ConditionBuilderItemText.ConditionBuilderItemText,
|
88
|
+
number: ConditionBuilderItemNumber.ConditionBuilderItemNumber,
|
89
|
+
date: ConditionBuilderItemDate.ConditionBuilderItemDate,
|
90
|
+
time: ConditionBuilderItemTime.ConditionBuilderItemTime,
|
91
|
+
option: ItemOptionForValueField.ItemOptionForValueField,
|
92
|
+
custom: config === null || config === void 0 ? void 0 : config.component
|
93
|
+
};
|
94
|
+
var ItemComponent = property ? itemComponents[type] : null;
|
97
95
|
var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
|
98
96
|
util.focusThisField(evt);
|
99
97
|
onStatementChange(v);
|
@@ -114,9 +112,10 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
114
112
|
}));
|
115
113
|
};
|
116
114
|
var onValueChangeHandler = function onValueChangeHandler(newValue) {
|
117
|
-
|
118
|
-
|
119
|
-
|
115
|
+
var currentCondition = _rollupPluginBabelHelpers.objectSpread2({}, condition);
|
116
|
+
delete currentCondition.popoverToOpen;
|
117
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, currentCondition), {}, {
|
118
|
+
value: newValue
|
120
119
|
}));
|
121
120
|
};
|
122
121
|
var handleShowDeletionPreview = function handleShowDeletionPreview() {
|
@@ -126,6 +125,9 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
126
125
|
setShowDeletionPreview(false);
|
127
126
|
};
|
128
127
|
var getOperators = function getOperators() {
|
128
|
+
if (config !== null && config !== void 0 && config.operators) {
|
129
|
+
return config.operators;
|
130
|
+
}
|
129
131
|
return DataConfigs.operatorConfig.filter(function (operator) {
|
130
132
|
return operator.type.indexOf(type) != -1 || operator.type == 'all';
|
131
133
|
});
|
@@ -156,7 +158,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
156
158
|
"data-name": "connectorField",
|
157
159
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
158
160
|
className: "".concat(DataConfigs.blockClass, "__statement-button")
|
159
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
161
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
160
162
|
conditionState: {
|
161
163
|
value: group.statement,
|
162
164
|
label: DataConfigs.translateWithId('condition')
|
@@ -173,7 +175,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
173
175
|
"data-name": "propertyField",
|
174
176
|
condition: condition,
|
175
177
|
type: type
|
176
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
178
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
177
179
|
conditionState: {
|
178
180
|
value: property,
|
179
181
|
label: DataConfigs.translateWithId('property')
|
@@ -188,7 +190,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
188
190
|
"data-name": "operatorField",
|
189
191
|
condition: condition,
|
190
192
|
type: type
|
191
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
193
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
192
194
|
config: {
|
193
195
|
options: getOperators()
|
194
196
|
},
|
@@ -26,7 +26,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
26
26
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
27
27
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
28
28
|
|
29
|
-
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "variant"];
|
29
|
+
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions"];
|
30
30
|
|
31
31
|
// Carbon and package components we use.
|
32
32
|
/* TODO: @import(s) of carbon components and other package components. */
|
@@ -61,7 +61,9 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
61
61
|
getOptions = _ref.getOptions,
|
62
62
|
initialState = _ref.initialState,
|
63
63
|
getConditionState = _ref.getConditionState,
|
64
|
+
getActionsState = _ref.getActionsState,
|
64
65
|
variant = _ref.variant,
|
66
|
+
actions = _ref.actions,
|
65
67
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
66
68
|
var localRef = React.useRef();
|
67
69
|
var conditionBuilderRef = ref || localRef;
|
@@ -92,7 +94,9 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
92
94
|
startConditionLabel: startConditionLabel,
|
93
95
|
conditionBuilderRef: conditionBuilderRef,
|
94
96
|
getConditionState: getConditionState,
|
95
|
-
|
97
|
+
getActionsState: getActionsState,
|
98
|
+
initialState: initialState,
|
99
|
+
actions: actions
|
96
100
|
}))));
|
97
101
|
});
|
98
102
|
|
@@ -108,27 +112,66 @@ exports.ConditionBuilder.displayName = componentName;
|
|
108
112
|
// See https://www.npmjs.com/package/prop-types#usage.
|
109
113
|
exports.ConditionBuilder.propTypes = {
|
110
114
|
/**
|
111
|
-
*
|
115
|
+
* optional array of actions
|
112
116
|
*/
|
113
|
-
|
114
|
-
|
117
|
+
actions: index["default"].arrayOf(index["default"].shape({
|
118
|
+
id: index["default"].oneOfType([index["default"].string | index["default"].number]).isRequired,
|
119
|
+
label: index["default"].string.isRequired
|
120
|
+
})),
|
115
121
|
/**
|
116
122
|
* Provide an optional class to be applied to the containing node.
|
117
123
|
*/
|
118
124
|
className: index["default"].string,
|
125
|
+
/**
|
126
|
+
* This is a callback that gives back the updated action state
|
127
|
+
*/
|
128
|
+
getActionsState: index["default"].func,
|
129
|
+
/**
|
130
|
+
* This is a callback that gives back updated condition state
|
131
|
+
*/
|
119
132
|
getConditionState: index["default"].func.isRequired,
|
133
|
+
/**
|
134
|
+
* This is a callback that get triggered when you want to dynamically fetch options.
|
135
|
+
* Component call this when the option array is not passed against a property with type as option in the input config.
|
136
|
+
* This is an asynchronous callback that can return a promise , and you need to resolve the promise with options array in the valid format.
|
137
|
+
* You will receive the root condition state and current condition as the 2 arguments.
|
138
|
+
* eg: const getOptions = async (conditionState,condition) => {
|
139
|
+
switch (condition.property) {
|
140
|
+
case 'continent':
|
141
|
+
return new Promise((resolve) => {
|
142
|
+
const continents=[{
|
143
|
+
label: 'Africa',
|
144
|
+
id: 'Africa',
|
145
|
+
},...]
|
146
|
+
resolve(continents);
|
147
|
+
});
|
148
|
+
default:
|
149
|
+
return [];
|
150
|
+
}
|
151
|
+
};
|
152
|
+
*/
|
120
153
|
getOptions: index["default"].func,
|
154
|
+
/**
|
155
|
+
* Optional prop if you want to pass a saved condition state.
|
156
|
+
* This object should respect the structure of condition state that is available in getConditionState callback
|
157
|
+
*/
|
121
158
|
initialState: index["default"].shape({
|
122
159
|
groups: index["default"].arrayOf(index["default"].shape({
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
160
|
+
groupOperator: index["default"].string.isRequired,
|
161
|
+
statement: index["default"].string.isRequired,
|
162
|
+
conditions: index["default"].arrayOf(index["default"].oneOfType([index["default"].shape({
|
163
|
+
property: index["default"].string.isRequired,
|
164
|
+
operator: index["default"].string.isRequired,
|
165
|
+
value: index["default"].oneOfType([index["default"].string, index["default"].arrayOf(index["default"].shape({
|
166
|
+
id: index["default"].string,
|
167
|
+
label: index["default"].string
|
168
|
+
})), index["default"].shape({
|
169
|
+
id: index["default"].string,
|
170
|
+
label: index["default"].string
|
171
|
+
})])
|
172
|
+
}), index["default"].object]))
|
173
|
+
})),
|
174
|
+
operator: index["default"].string
|
132
175
|
}),
|
133
176
|
/**
|
134
177
|
* This is a mandatory prop that defines the input to the condition builder.
|
@@ -136,17 +179,21 @@ exports.ConditionBuilder.propTypes = {
|
|
136
179
|
*/
|
137
180
|
inputConfig: index["default"].shape({
|
138
181
|
properties: index["default"].arrayOf(index["default"].shape({
|
139
|
-
id: index["default"].string,
|
140
|
-
label: index["default"].string,
|
182
|
+
id: index["default"].string.isRequired,
|
183
|
+
label: index["default"].string.isRequired,
|
141
184
|
icon: index["default"].oneOfType([index["default"].func, index["default"].object]),
|
142
|
-
type: index["default"].oneOf(['text', 'number', 'date', 'option', 'time']),
|
185
|
+
type: index["default"].oneOf(['text', 'number', 'date', 'option', 'time', 'custom']).isRequired,
|
143
186
|
config: index["default"].shape({
|
144
187
|
options: index["default"].arrayOf(index["default"].shape({
|
145
|
-
id: index["default"].string,
|
146
|
-
label: index["default"].string,
|
188
|
+
id: index["default"].string.isRequired,
|
189
|
+
label: index["default"].string.isRequired,
|
147
190
|
icon: index["default"].oneOfType([index["default"].func, index["default"].object])
|
148
191
|
})),
|
149
|
-
|
192
|
+
component: index["default"].func,
|
193
|
+
operators: index["default"].arrayOf(index["default"].shape({
|
194
|
+
id: index["default"].string.isRequired,
|
195
|
+
label: index["default"].string.isRequired
|
196
|
+
}))
|
150
197
|
})
|
151
198
|
}))
|
152
199
|
}).isRequired,
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export default ConditionBuilderActions;
|
2
|
+
declare function ConditionBuilderActions({ actions, className }: {
|
3
|
+
actions: any;
|
4
|
+
className: any;
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
6
|
+
declare namespace ConditionBuilderActions {
|
7
|
+
namespace propTypes {
|
8
|
+
let actions: PropTypes.Requireable<(PropTypes.InferProps<{
|
9
|
+
id: PropTypes.Requireable<number>;
|
10
|
+
label: PropTypes.Requireable<string>;
|
11
|
+
}> | null | undefined)[]>;
|
12
|
+
let className: PropTypes.Requireable<string>;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
import PropTypes from 'prop-types';
|