@carbon/ibm-products 2.36.0 → 2.38.0-alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +5404 -5117
- 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 +4 -4
- 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 +820 -61
- 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 +329 -6
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +9 -10
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +261 -0
- package/es/components/ConditionBuilder/ConditionBuilder.js +45 -16
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +74 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
- package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
- package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +112 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +151 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +59 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +52 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +162 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +82 -0
- package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
- package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +85 -0
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +145 -0
- package/es/components/ConditionBuilder/utils/util.d.ts +4 -0
- package/es/components/ConditionBuilder/utils/util.js +16 -0
- package/es/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
- package/es/components/CreateTearsheet/CreateTearsheet.js +12 -32
- package/es/components/Datagrid/Datagrid/DatagridContent.d.ts +1 -0
- package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -0
- package/es/components/Datagrid/useParentDimensions.js +1 -1
- package/es/components/Datagrid/useSkeletonRows.d.ts +1 -1
- package/es/components/Datagrid/useSkeletonRows.js +11 -3
- package/es/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
- package/es/components/EditUpdateCards/EditUpdateCards.js +3 -0
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
- package/es/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
- package/es/components/ExpressiveCard/ExpressiveCard.js +4 -0
- package/es/components/InlineTip/InlineTipButton.d.ts +21 -2
- package/es/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
- package/es/components/InterstitialScreen/InterstitialScreen.js +25 -14
- package/es/components/Nav/NavItem.js +1 -1
- package/es/components/NotificationsPanel/NotificationsPanel.js +5 -6
- package/es/components/PageHeader/PageHeader.js +12 -3
- package/es/components/SidePanel/SidePanel.js +1 -1
- package/es/components/SimpleHeader/SimpleHeader.d.ts +1 -5
- package/es/components/SimpleHeader/SimpleHeader.js +2 -4
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
- package/es/components/Tearsheet/TearsheetShell.d.ts +119 -10
- package/es/components/Tearsheet/TearsheetShell.js +18 -8
- package/es/components/WebTerminal/WebTerminal.d.ts +46 -2
- package/es/components/WebTerminal/WebTerminal.js +2 -2
- package/es/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/es/global/js/hooks/usePrefersReducedMotion.js +28 -0
- package/es/global/js/utils/Wrap.d.ts +31 -2
- package/es/global/js/utils/Wrap.js +7 -9
- package/es/global/js/utils/getNodeTextContent.d.ts +1 -1
- package/es/global/js/utils/getNodeTextContent.js +1 -1
- package/es/global/js/utils/window.d.ts +2 -0
- package/es/global/js/utils/window.js +12 -0
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2780 -0
- package/lib/_virtual/_rollupPluginBabelHelpers.js +9 -10
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +270 -0
- package/lib/components/ConditionBuilder/ConditionBuilder.js +46 -17
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +48 -0
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +83 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
- package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +121 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +44 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +159 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +67 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +60 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +170 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +48 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +90 -0
- package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
- package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +93 -0
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +153 -0
- package/lib/components/ConditionBuilder/utils/util.d.ts +4 -0
- package/lib/components/ConditionBuilder/utils/util.js +20 -0
- package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
- package/lib/components/CreateTearsheet/CreateTearsheet.js +12 -32
- package/lib/components/Datagrid/Datagrid/DatagridContent.d.ts +1 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -0
- package/lib/components/Datagrid/useParentDimensions.js +1 -1
- package/lib/components/Datagrid/useSkeletonRows.d.ts +1 -1
- package/lib/components/Datagrid/useSkeletonRows.js +11 -3
- package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
- package/lib/components/EditUpdateCards/EditUpdateCards.js +3 -0
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
- package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
- package/lib/components/ExpressiveCard/ExpressiveCard.js +4 -0
- package/lib/components/InlineTip/InlineTipButton.d.ts +21 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.js +24 -13
- package/lib/components/Nav/NavItem.js +2 -2
- package/lib/components/NotificationsPanel/NotificationsPanel.js +5 -6
- package/lib/components/PageHeader/PageHeader.js +11 -2
- package/lib/components/SidePanel/SidePanel.js +1 -1
- package/lib/components/SimpleHeader/SimpleHeader.d.ts +1 -5
- package/lib/components/SimpleHeader/SimpleHeader.js +2 -4
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
- package/lib/components/Tearsheet/TearsheetShell.d.ts +119 -10
- package/lib/components/Tearsheet/TearsheetShell.js +16 -6
- package/lib/components/WebTerminal/WebTerminal.d.ts +46 -2
- package/lib/components/WebTerminal/WebTerminal.js +2 -2
- package/lib/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/lib/global/js/hooks/usePrefersReducedMotion.js +32 -0
- package/lib/global/js/utils/Wrap.d.ts +31 -2
- package/lib/global/js/utils/Wrap.js +7 -9
- package/lib/global/js/utils/getNodeTextContent.d.ts +1 -1
- package/lib/global/js/utils/getNodeTextContent.js +1 -1
- package/lib/global/js/utils/window.d.ts +2 -0
- package/lib/global/js/utils/window.js +16 -0
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2912 -0
- package/package.json +6 -4
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -1
- package/scss/components/ConditionBuilder/_condition-builder.scss +26 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +46 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +194 -0
- package/scss/components/ConditionBuilder/styles/_index.scss +2 -0
- package/scss/components/Guidebanner/_guidebanner.scss +3 -0
- package/scss/components/InterstitialScreen/_interstitial-screen.scss +1 -6
- package/scss/components/Tearsheet/_tearsheet.scss +3 -1
- package/telemetry.yml +939 -683
- package/es/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
- package/es/global/js/utils/keyboardNavigation.d.ts +0 -27
- package/es/global/js/utils/keyboardNavigation.js +0 -33
- package/es/global/js/utils/wrapFocus.d.ts +0 -25
- package/es/global/js/utils/wrapFocus.js +0 -68
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3004
- package/lib/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
- package/lib/global/js/utils/keyboardNavigation.d.ts +0 -27
- package/lib/global/js/utils/keyboardNavigation.js +0 -39
- package/lib/global/js/utils/wrapFocus.d.ts +0 -25
- package/lib/global/js/utils/wrapFocus.js +0 -73
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3136
@@ -0,0 +1,15 @@
|
|
1
|
+
export default ConditionConnector;
|
2
|
+
declare function ConditionConnector({ operator, className, onChange, ...rest }: {
|
3
|
+
[x: string]: any;
|
4
|
+
operator: any;
|
5
|
+
className: any;
|
6
|
+
onChange: any;
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
8
|
+
declare namespace ConditionConnector {
|
9
|
+
namespace propTypes {
|
10
|
+
let className: PropTypes.Requireable<string>;
|
11
|
+
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
12
|
+
let operator: PropTypes.Requireable<string>;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
import PropTypes from 'prop-types';
|
@@ -0,0 +1,93 @@
|
|
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 ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
15
|
+
var ConditionBuilderItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js');
|
16
|
+
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
17
|
+
var settings = require('../../../settings.js');
|
18
|
+
var index = require('../../../node_modules/prop-types/index.js');
|
19
|
+
var util = require('../utils/util.js');
|
20
|
+
|
21
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
22
|
+
|
23
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
24
|
+
|
25
|
+
var _excluded = ["operator", "className", "onChange"];
|
26
|
+
var blockClass = "".concat(settings.pkg.prefix, "--condition-builder");
|
27
|
+
function ConditionConnector(_ref) {
|
28
|
+
var operator = _ref.operator,
|
29
|
+
className = _ref.className,
|
30
|
+
onChange = _ref.onChange,
|
31
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
32
|
+
var handleConnectorHover = React.useCallback(function (parentGroup, isHover) {
|
33
|
+
if (isHover) {
|
34
|
+
parentGroup.classList.add('hoveredConnector');
|
35
|
+
} else {
|
36
|
+
parentGroup.classList.remove('hoveredConnector');
|
37
|
+
}
|
38
|
+
}, []);
|
39
|
+
var activeConnectorHandler = function activeConnectorHandler(e) {
|
40
|
+
var parentGroup = e.currentTarget.closest('.eachGroup');
|
41
|
+
handleConnectorHover(parentGroup, true);
|
42
|
+
};
|
43
|
+
var inActiveConnectorHandler = function inActiveConnectorHandler(e) {
|
44
|
+
var parentGroup = e.currentTarget.closest('.eachGroup');
|
45
|
+
handleConnectorHover(parentGroup, false);
|
46
|
+
};
|
47
|
+
var onChangeHandler = function onChangeHandler(op, e) {
|
48
|
+
onChange(op);
|
49
|
+
util.focusThisField(e);
|
50
|
+
};
|
51
|
+
return (
|
52
|
+
/*#__PURE__*/
|
53
|
+
// <div className={className} {...rest}>
|
54
|
+
React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, _rollupPluginBabelHelpers["extends"]({
|
55
|
+
label: operator,
|
56
|
+
title: DataConfigs.translateWithId('connector'),
|
57
|
+
"data-name": "connectorField",
|
58
|
+
onMouseEnter: activeConnectorHandler,
|
59
|
+
onMouseLeave: inActiveConnectorHandler,
|
60
|
+
onFocus: activeConnectorHandler,
|
61
|
+
onBlur: inActiveConnectorHandler
|
62
|
+
}, rest, {
|
63
|
+
popOverClassName: className,
|
64
|
+
className: "".concat(blockClass, "__connector-button ")
|
65
|
+
}), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
|
66
|
+
config: {
|
67
|
+
options: DataConfigs.connectorConfig
|
68
|
+
},
|
69
|
+
conditionState: {
|
70
|
+
value: operator,
|
71
|
+
label: DataConfigs.translateWithId('connector')
|
72
|
+
},
|
73
|
+
onChange: onChangeHandler
|
74
|
+
}))
|
75
|
+
// </div>
|
76
|
+
);
|
77
|
+
}
|
78
|
+
ConditionConnector.propTypes = {
|
79
|
+
/**
|
80
|
+
* Provide an optional class to be applied to the containing node.
|
81
|
+
*/
|
82
|
+
className: index["default"].string,
|
83
|
+
/**
|
84
|
+
* callback to update the current condition of the state tree
|
85
|
+
*/
|
86
|
+
onChange: index["default"].func,
|
87
|
+
/**
|
88
|
+
* string that defines the connector operator (and/or)
|
89
|
+
*/
|
90
|
+
operator: index["default"].string
|
91
|
+
};
|
92
|
+
|
93
|
+
exports["default"] = ConditionConnector;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
export default ConditionGroupBuilder;
|
2
|
+
/**
|
3
|
+
*
|
4
|
+
* state - this is the current group that is being rendered . This can be a inner group or outer group
|
5
|
+
* All the inner components of group are called from here.
|
6
|
+
* @returns
|
7
|
+
*/
|
8
|
+
declare function ConditionGroupBuilder({ state, aria, onRemove, onChange, conditionBuilderRef, }: {
|
9
|
+
state: any;
|
10
|
+
aria: any;
|
11
|
+
onRemove: any;
|
12
|
+
onChange: any;
|
13
|
+
conditionBuilderRef: any;
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
15
|
+
declare namespace ConditionGroupBuilder {
|
16
|
+
namespace propTypes {
|
17
|
+
let aria: PropTypes.Requireable<object>;
|
18
|
+
let conditionBuilderRef: PropTypes.Requireable<object>;
|
19
|
+
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
20
|
+
let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
21
|
+
let state: PropTypes.Requireable<object>;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
import PropTypes from 'prop-types';
|
@@ -0,0 +1,153 @@
|
|
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 ConditionBlock = require('../ConditionBlock/ConditionBlock.js');
|
15
|
+
var index = require('../../../node_modules/prop-types/index.js');
|
16
|
+
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
17
|
+
|
18
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
19
|
+
|
20
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
21
|
+
|
22
|
+
/**
|
23
|
+
*
|
24
|
+
* state - this is the current group that is being rendered . This can be a inner group or outer group
|
25
|
+
* All the inner components of group are called from here.
|
26
|
+
* @returns
|
27
|
+
*/
|
28
|
+
var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
29
|
+
var _state$conditions;
|
30
|
+
var state = _ref.state,
|
31
|
+
aria = _ref.aria,
|
32
|
+
onRemove = _ref.onRemove,
|
33
|
+
onChange = _ref.onChange,
|
34
|
+
conditionBuilderRef = _ref.conditionBuilderRef;
|
35
|
+
var onRemoveHandler = function onRemoveHandler(conditionIndex, e) {
|
36
|
+
if (state.conditions.length > 1) {
|
37
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
38
|
+
conditions: state.conditions.filter(function (condition, cIndex) {
|
39
|
+
return conditionIndex !== cIndex;
|
40
|
+
})
|
41
|
+
}));
|
42
|
+
handleFocusOnClose(e);
|
43
|
+
} else {
|
44
|
+
onRemove();
|
45
|
+
}
|
46
|
+
};
|
47
|
+
var onChangeHandler = function onChangeHandler(updatedConditions, conditionIndex) {
|
48
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
49
|
+
conditions: state.conditions.map(function (condition, cIndex) {
|
50
|
+
return conditionIndex === cIndex ? updatedConditions : condition;
|
51
|
+
})
|
52
|
+
}));
|
53
|
+
};
|
54
|
+
var addConditionHandler = function addConditionHandler(conditionIndex) {
|
55
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
56
|
+
conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(state.conditions.slice(0, conditionIndex + 1)), [{
|
57
|
+
property: undefined,
|
58
|
+
operator: '',
|
59
|
+
value: '',
|
60
|
+
popoverToOpen: 'propertyField'
|
61
|
+
}], _rollupPluginBabelHelpers.toConsumableArray(state.conditions.slice(conditionIndex + 1)))
|
62
|
+
}));
|
63
|
+
};
|
64
|
+
var handleFocusOnClose = function handleFocusOnClose(e) {
|
65
|
+
var _e$currentTarget;
|
66
|
+
var previousClose = (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.closest('[role="row"]')) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.previousSibling) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.querySelector('[data-name="closeCondition"]');
|
67
|
+
if (previousClose) {
|
68
|
+
previousClose.focus();
|
69
|
+
}
|
70
|
+
};
|
71
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
72
|
+
className: " ".concat(DataConfigs.blockClass, "__condition-builder__group eachGroup")
|
73
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
74
|
+
className: "".concat(DataConfigs.blockClass, "__condition-wrapper"),
|
75
|
+
role: "grid",
|
76
|
+
"aria-label": DataConfigs.translateWithId('condition_builder_group')
|
77
|
+
}, state === null || state === void 0 || (_state$conditions = state.conditions) === null || _state$conditions === void 0 ? void 0 : _state$conditions.map(function (eachCondition, conditionIndex) {
|
78
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
79
|
+
key: conditionIndex
|
80
|
+
}, eachCondition.conditions && /*#__PURE__*/React__default["default"].createElement(ConditionGroupBuilder, {
|
81
|
+
aria: {
|
82
|
+
level: aria.level + 1,
|
83
|
+
posinset: conditionIndex + 1,
|
84
|
+
setsize: state.conditions.length
|
85
|
+
},
|
86
|
+
state: eachCondition,
|
87
|
+
onChange: function onChange(updatedConditions) {
|
88
|
+
onChangeHandler(updatedConditions, conditionIndex);
|
89
|
+
},
|
90
|
+
onRemove: function onRemove(e) {
|
91
|
+
onRemoveHandler(conditionIndex, e);
|
92
|
+
},
|
93
|
+
conditionBuilderRef: conditionBuilderRef,
|
94
|
+
key: conditionIndex
|
95
|
+
}), !eachCondition.conditions && /*#__PURE__*/React__default["default"].createElement(ConditionBlock["default"], {
|
96
|
+
key: conditionIndex,
|
97
|
+
conjunction: conditionIndex > 0 ? state.groupOperator : undefined,
|
98
|
+
aria: {
|
99
|
+
level: aria.level + 1,
|
100
|
+
posinset: conditionIndex + 1,
|
101
|
+
setsize: state.conditions.length
|
102
|
+
},
|
103
|
+
isStatement: conditionIndex == 0,
|
104
|
+
state: eachCondition,
|
105
|
+
group: state,
|
106
|
+
conditionIndex: conditionIndex,
|
107
|
+
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom"),
|
108
|
+
onChange: function onChange(updatedConditions) {
|
109
|
+
onChangeHandler(updatedConditions, conditionIndex);
|
110
|
+
},
|
111
|
+
addConditionHandler: addConditionHandler,
|
112
|
+
onRemove: function onRemove(e) {
|
113
|
+
onRemoveHandler(conditionIndex, e);
|
114
|
+
},
|
115
|
+
onConnectorOperatorChange: function onConnectorOperatorChange(op) {
|
116
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
117
|
+
groupOperator: op
|
118
|
+
}));
|
119
|
+
},
|
120
|
+
onStatementChange: function onStatementChange(updatedStatement) {
|
121
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
122
|
+
statement: updatedStatement
|
123
|
+
}));
|
124
|
+
}
|
125
|
+
}));
|
126
|
+
})));
|
127
|
+
};
|
128
|
+
var ConditionGroupBuilder$1 = ConditionGroupBuilder;
|
129
|
+
ConditionGroupBuilder.propTypes = {
|
130
|
+
/**
|
131
|
+
* object contains the aria attributes
|
132
|
+
*/
|
133
|
+
aria: index["default"].object,
|
134
|
+
/**
|
135
|
+
* ref of condition builder
|
136
|
+
*/
|
137
|
+
conditionBuilderRef: index["default"].object,
|
138
|
+
/**
|
139
|
+
|
140
|
+
* callback to update the current condition of the state tree
|
141
|
+
*/
|
142
|
+
onChange: index["default"].func,
|
143
|
+
/**
|
144
|
+
* call back to remove the particular group from the state tree
|
145
|
+
*/
|
146
|
+
onRemove: index["default"].func,
|
147
|
+
/**
|
148
|
+
* state defines the current group
|
149
|
+
*/
|
150
|
+
state: index["default"].object
|
151
|
+
};
|
152
|
+
|
153
|
+
exports["default"] = ConditionGroupBuilder$1;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export function focusThisField(e: any): void;
|
2
|
+
export function focusThisItem(currentElement: any): void;
|
3
|
+
export function traverseClockVise(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
|
4
|
+
export function traverseReverse(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
|
@@ -0,0 +1,20 @@
|
|
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 focusThisField = function focusThisField(e) {
|
13
|
+
setTimeout(function () {
|
14
|
+
var _e$target$closest, _e$target$closest2;
|
15
|
+
(_e$target$closest = e.target.closest('[role="gridcell"]')) === null || _e$target$closest === void 0 || (_e$target$closest = _e$target$closest.querySelector('button')) === null || _e$target$closest === void 0 || _e$target$closest.click();
|
16
|
+
(_e$target$closest2 = e.target.closest('[role="gridcell"]')) === null || _e$target$closest2 === void 0 || (_e$target$closest2 = _e$target$closest2.querySelector('button')) === null || _e$target$closest2 === void 0 || _e$target$closest2.focus();
|
17
|
+
}, 0);
|
18
|
+
};
|
19
|
+
|
20
|
+
exports.focusThisField = focusThisField;
|
@@ -1,4 +1,106 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2021, 2022
|
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
|
+
import React, { ReactNode, PropsWithChildren, Dispatch, SetStateAction } from 'react';
|
8
|
+
export interface StepsContextType {
|
9
|
+
currentStep: number;
|
10
|
+
setIsDisabled: Dispatch<SetStateAction<boolean>>;
|
11
|
+
setOnPrevious: (fn: any) => void;
|
12
|
+
setOnNext: (fn: any) => void;
|
13
|
+
setOnMount: (fn: any) => void;
|
14
|
+
setStepData: Dispatch<SetStateAction<Step[]>>;
|
15
|
+
stepData: Step[];
|
16
|
+
}
|
17
|
+
export declare const StepsContext: React.Context<StepsContextType | null>;
|
18
|
+
export declare const StepNumberContext: React.Context<number>;
|
19
|
+
interface CreateTearsheetProps extends PropsWithChildren {
|
20
|
+
/**
|
21
|
+
* The back button text
|
22
|
+
*/
|
23
|
+
backButtonText: string;
|
24
|
+
/**
|
25
|
+
* The cancel button text
|
26
|
+
*/
|
27
|
+
cancelButtonText: string;
|
28
|
+
/**
|
29
|
+
* The main content of the tearsheet
|
30
|
+
*/
|
31
|
+
/**
|
32
|
+
* An optional class or classes to be added to the outermost element.
|
33
|
+
*/
|
34
|
+
className?: string;
|
35
|
+
/**
|
36
|
+
* A description of the flow, displayed in the header area of the tearsheet.
|
37
|
+
*/
|
38
|
+
description?: ReactNode;
|
39
|
+
/**
|
40
|
+
* Specifies elements to focus on first on render.
|
41
|
+
*/
|
42
|
+
firstFocusElement?: string;
|
43
|
+
/**
|
44
|
+
* Used to set the size of the influencer
|
45
|
+
*/
|
46
|
+
influencerWidth?: 'narrow' | 'wide';
|
47
|
+
/**
|
48
|
+
* This can be used to open the component to a step other than the first step.
|
49
|
+
* For example, a create flow was previously in progress, data was saved, and
|
50
|
+
* is now being completed.
|
51
|
+
*/
|
52
|
+
initialStep?: number;
|
53
|
+
/**
|
54
|
+
* A label for the tearsheet, displayed in the header area of the tearsheet
|
55
|
+
* to maintain context for the tearsheet (e.g. as the title changes from page
|
56
|
+
* to page of a multi-page task).
|
57
|
+
*/
|
58
|
+
label?: ReactNode;
|
59
|
+
/**
|
60
|
+
* The next button text
|
61
|
+
*/
|
62
|
+
nextButtonText: string;
|
63
|
+
/**
|
64
|
+
* An optional handler that is called when the user closes the tearsheet (by
|
65
|
+
* clicking the close button, if enabled, or clicking outside, if enabled).
|
66
|
+
* Returning `false` here prevents the modal from closing.
|
67
|
+
*/
|
68
|
+
onClose?: () => void;
|
69
|
+
/**
|
70
|
+
* Specify a handler for submitting the multi step tearsheet (final step).
|
71
|
+
* This function can _optionally_ return a promise that is either resolved or rejected and the CreateTearsheet will handle the submitting state of the create button.
|
72
|
+
*/
|
73
|
+
onRequestSubmit: () => void;
|
74
|
+
/**
|
75
|
+
* Specifies whether the tearsheet is currently open.
|
76
|
+
*/
|
77
|
+
open?: boolean;
|
78
|
+
/**
|
79
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component
|
80
|
+
*/
|
81
|
+
slug?: ReactNode;
|
82
|
+
/**
|
83
|
+
* The submit button text
|
84
|
+
*/
|
85
|
+
submitButtonText: string;
|
86
|
+
/**
|
87
|
+
* The main title of the tearsheet, displayed in the header area.
|
88
|
+
*/
|
89
|
+
title?: ReactNode;
|
90
|
+
/**
|
91
|
+
* The position of the top of tearsheet in the viewport. The 'normal'
|
92
|
+
* position (the default) is a short distance down from the top of the
|
93
|
+
* viewport, leaving room at the top for a global header bar to show through
|
94
|
+
* from below. The 'lower' position provides a little extra room at the top
|
95
|
+
* to allow an action bar navigation or breadcrumbs to also show through.
|
96
|
+
*/
|
97
|
+
verticalPosition?: 'normal' | 'lower';
|
98
|
+
}
|
99
|
+
interface Step {
|
100
|
+
introStep?: boolean;
|
101
|
+
secondaryLabel?: string;
|
102
|
+
shouldIncludeStep?: boolean;
|
103
|
+
title?: string;
|
104
|
+
}
|
105
|
+
export declare let CreateTearsheet: React.ForwardRefExoticComponent<CreateTearsheetProps & React.RefAttributes<HTMLDivElement>>;
|
106
|
+
export {};
|
@@ -14,7 +14,6 @@ var React = require('react');
|
|
14
14
|
var index = require('../../node_modules/prop-types/index.js');
|
15
15
|
var cx = require('classnames');
|
16
16
|
var react = require('@carbon/react');
|
17
|
-
var wrapFocus = require('../../global/js/utils/wrapFocus.js');
|
18
17
|
var TearsheetShell = require('../Tearsheet/TearsheetShell.js');
|
19
18
|
var settings = require('../../settings.js');
|
20
19
|
var devtools = require('../../global/js/utils/devtools.js');
|
@@ -39,17 +38,12 @@ var blockClass = "".concat(settings.pkg.prefix, "--tearsheet-create");
|
|
39
38
|
// This is a general context for the steps container
|
40
39
|
// containing information about the state of the container
|
41
40
|
// and providing some callback methods for steps to use
|
41
|
+
|
42
42
|
var StepsContext = /*#__PURE__*/React.createContext(null);
|
43
43
|
|
44
44
|
// This is a context supplied separately to each step in the container
|
45
45
|
// to let it know what number it is in the sequence of steps
|
46
46
|
var StepNumberContext = /*#__PURE__*/React.createContext(-1);
|
47
|
-
|
48
|
-
// Default values for props
|
49
|
-
var defaults = {
|
50
|
-
verticalPosition: 'normal',
|
51
|
-
influencerWidth: 'narrow'
|
52
|
-
};
|
53
47
|
exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
54
48
|
var backButtonText = _ref.backButtonText,
|
55
49
|
cancelButtonText = _ref.cancelButtonText,
|
@@ -57,7 +51,7 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
57
51
|
className = _ref.className,
|
58
52
|
description = _ref.description,
|
59
53
|
_ref$influencerWidth = _ref.influencerWidth,
|
60
|
-
influencerWidth = _ref$influencerWidth === void 0 ?
|
54
|
+
influencerWidth = _ref$influencerWidth === void 0 ? 'narrow' : _ref$influencerWidth,
|
61
55
|
initialStep = _ref.initialStep,
|
62
56
|
label = _ref.label,
|
63
57
|
nextButtonText = _ref.nextButtonText,
|
@@ -69,7 +63,7 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
69
63
|
submitButtonText = _ref.submitButtonText,
|
70
64
|
title = _ref.title,
|
71
65
|
_ref$verticalPosition = _ref.verticalPosition,
|
72
|
-
verticalPosition = _ref$verticalPosition === void 0 ?
|
66
|
+
verticalPosition = _ref$verticalPosition === void 0 ? 'normal' : _ref$verticalPosition,
|
73
67
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
74
68
|
var _useState = React.useState([]),
|
75
69
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
@@ -115,7 +109,7 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
115
109
|
_useState22 = _rollupPluginBabelHelpers.slicedToArray(_useState21, 2),
|
116
110
|
firstIncludedStep = _useState22[0],
|
117
111
|
setFirstIncludedStep = _useState22[1];
|
118
|
-
var _useState23 = React.useState(
|
112
|
+
var _useState23 = React.useState(),
|
119
113
|
_useState24 = _rollupPluginBabelHelpers.slicedToArray(_useState23, 2),
|
120
114
|
lastIncludedStep = _useState24[0],
|
121
115
|
setLastIncludedStep = _useState24[1];
|
@@ -123,7 +117,7 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
123
117
|
currentStep: currentStep,
|
124
118
|
open: open
|
125
119
|
});
|
126
|
-
var contentRef = React.useRef();
|
120
|
+
var contentRef = React.useRef(null);
|
127
121
|
React.useEffect(function () {
|
128
122
|
var firstItem = stepData.findIndex(function (item) {
|
129
123
|
return item === null || item === void 0 ? void 0 : item.shouldIncludeStep;
|
@@ -153,9 +147,11 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
153
147
|
useResetCreateComponent.useResetCreateComponent({
|
154
148
|
firstIncludedStep: firstIncludedStep,
|
155
149
|
previousState: previousState,
|
150
|
+
/**@ts-ignore */
|
156
151
|
open: open,
|
157
152
|
setCurrentStep: setCurrentStep,
|
158
153
|
stepData: stepData,
|
154
|
+
/**@ts-ignore */
|
159
155
|
initialStep: initialStep,
|
160
156
|
totalSteps: stepData === null || stepData === void 0 ? void 0 : stepData.length,
|
161
157
|
componentName: componentName
|
@@ -170,6 +166,7 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
170
166
|
setCurrentStep: setCurrentStep,
|
171
167
|
setIsSubmitting: setIsSubmitting,
|
172
168
|
setShouldViewAll: setShouldViewAll,
|
169
|
+
/**@ts-ignore */
|
173
170
|
setLoadingPrevious: setLoadingPrevious,
|
174
171
|
loadingPrevious: loadingPrevious,
|
175
172
|
onClose: onClose,
|
@@ -185,43 +182,26 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
185
182
|
componentBlockClass: blockClass,
|
186
183
|
setCreateComponentActions: setCreateTearsheetActions
|
187
184
|
});
|
188
|
-
|
189
|
-
|
190
|
-
/* istanbul ignore next */
|
191
|
-
var handleBlur = function handleBlur(_ref2) {
|
192
|
-
var oldActiveNode = _ref2.target,
|
193
|
-
currentActiveNode = _ref2.relatedTarget;
|
194
|
-
var visibleStepInnerContent = document.querySelector(".".concat(settings.pkg.prefix, "--tearsheet__body"));
|
195
|
-
if (open && visibleStepInnerContent) {
|
196
|
-
wrapFocus["default"]({
|
197
|
-
bodyNode: visibleStepInnerContent,
|
198
|
-
currentActiveNode: currentActiveNode,
|
199
|
-
oldActiveNode: oldActiveNode
|
200
|
-
});
|
201
|
-
}
|
202
|
-
};
|
203
|
-
return /*#__PURE__*/React__default["default"].createElement(TearsheetShell.TearsheetShell, _rollupPluginBabelHelpers["extends"]({}, rest, devtools.getDevtoolsProps(componentName), {
|
185
|
+
return /*#__PURE__*/React__default["default"].createElement(TearsheetShell.TearsheetShell, _rollupPluginBabelHelpers["extends"]({}, devtools.getDevtoolsProps(componentName), rest, {
|
186
|
+
ref: ref,
|
204
187
|
actions: createTearsheetActions,
|
205
188
|
className: cx__default["default"](blockClass, className),
|
206
189
|
description: description,
|
207
|
-
hasCloseIcon: false,
|
208
190
|
influencer: /*#__PURE__*/React__default["default"].createElement(CreateInfluencer.CreateInfluencer, {
|
209
191
|
currentStep: currentStep,
|
210
192
|
stepData: stepData
|
211
193
|
}),
|
212
|
-
influencerPosition: "left",
|
213
194
|
influencerWidth: influencerWidth,
|
214
195
|
label: label,
|
215
196
|
onClose: onClose,
|
216
197
|
open: open,
|
217
|
-
size:
|
198
|
+
size: 'wide',
|
218
199
|
slug: slug,
|
219
200
|
title: title,
|
220
201
|
verticalPosition: verticalPosition,
|
221
|
-
|
202
|
+
closeIconDescription: ''
|
222
203
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
223
204
|
className: "".concat(blockClass, "__content"),
|
224
|
-
onBlur: handleBlur,
|
225
205
|
ref: contentRef
|
226
206
|
}, /*#__PURE__*/React__default["default"].createElement(react.Form, {
|
227
207
|
"aria-label": title
|
@@ -14,6 +14,7 @@ export namespace DatagridContent {
|
|
14
14
|
DatagridPagination: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>;
|
15
15
|
CustomizeColumnsTearsheet: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>;
|
16
16
|
isFetching: PropTypes.Requireable<boolean>;
|
17
|
+
skeletonRowCount: PropTypes.Requireable<number>;
|
17
18
|
fullHeightDatagrid: PropTypes.Requireable<boolean>;
|
18
19
|
filterProps: PropTypes.Requireable<object>;
|
19
20
|
variableRowHeight: PropTypes.Requireable<boolean>;
|
@@ -193,6 +193,7 @@ DatagridContent.propTypes = {
|
|
193
193
|
DatagridPagination: index["default"].oneOfType([index["default"].element, index["default"].func]),
|
194
194
|
CustomizeColumnsTearsheet: index["default"].oneOfType([index["default"].element, index["default"].func]),
|
195
195
|
isFetching: index["default"].bool,
|
196
|
+
skeletonRowCount: index["default"].number,
|
196
197
|
fullHeightDatagrid: index["default"].bool,
|
197
198
|
filterProps: index["default"].object,
|
198
199
|
variableRowHeight: index["default"].bool,
|
@@ -48,7 +48,7 @@ var useParentDimensions = function useParentDimensions(hooks) {
|
|
48
48
|
setTableHeight(newHeight);
|
49
49
|
};
|
50
50
|
Object.assign(instance, {
|
51
|
-
tableHeight: tableHeight,
|
51
|
+
tableHeight: tableHeight || instance.tableHeight,
|
52
52
|
rootRef: rootRef,
|
53
53
|
headRef: headRef,
|
54
54
|
innerListRef: innerListRef,
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
13
13
|
|
14
14
|
/**
|
15
|
-
* Copyright IBM Corp. 2020,
|
15
|
+
* Copyright IBM Corp. 2020, 2024
|
16
16
|
*
|
17
17
|
* This source code is licensed under the Apache-2.0 license found in the
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
@@ -21,7 +21,11 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
21
21
|
var useSkeletons = function useSkeletons(hooks) {
|
22
22
|
var useInstance = function useInstance(instance) {
|
23
23
|
var isFetching = instance.isFetching,
|
24
|
-
rows = instance.rows
|
24
|
+
rows = instance.rows,
|
25
|
+
skeletonRowCount = instance.skeletonRowCount;
|
26
|
+
if (isFetching && skeletonRowCount === 0) {
|
27
|
+
throw new Error('skeletonRowCount cannot be set to 0, if isFetching is true');
|
28
|
+
}
|
25
29
|
var skeletonRow = function skeletonRow(id) {
|
26
30
|
return {
|
27
31
|
isSkeleton: true,
|
@@ -29,7 +33,11 @@ var useSkeletons = function useSkeletons(hooks) {
|
|
29
33
|
id: id
|
30
34
|
};
|
31
35
|
};
|
32
|
-
var rowsWithSkeletons = [].concat(_rollupPluginBabelHelpers.toConsumableArray(rows),
|
36
|
+
var rowsWithSkeletons = [].concat(_rollupPluginBabelHelpers.toConsumableArray(rows), _rollupPluginBabelHelpers.toConsumableArray(Array.from({
|
37
|
+
length: skeletonRowCount || 3
|
38
|
+
}, function (_, index) {
|
39
|
+
return skeletonRow("skeleton-row-".concat(index + 1));
|
40
|
+
})));
|
33
41
|
Object.assign(instance, {
|
34
42
|
rows: isFetching ? rowsWithSkeletons : rows
|
35
43
|
});
|