@carbon/ibm-products 2.8.1 → 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +198 -174
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +5 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +2 -1
- 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 +150 -149
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +61 -44
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/css/index.min.css.map +1 -1
- package/es/components/CreateFullPage/CreateFullPage.js +25 -3
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +8 -2
- package/es/components/Datagrid/Datagrid/DraggableElement.js +61 -68
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +23 -15
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +5 -5
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +2 -2
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +24 -11
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +4 -7
- package/es/components/OptionsTile/OptionsTile.js +1 -1
- package/es/global/js/hooks/useClickOutside.js +6 -6
- package/lib/components/CreateFullPage/CreateFullPage.js +24 -2
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +8 -2
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +62 -68
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +23 -15
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +5 -5
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +2 -2
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +24 -11
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +4 -7
- package/lib/components/OptionsTile/OptionsTile.js +1 -1
- package/lib/global/js/hooks/useClickOutside.js +6 -6
- package/package.json +13 -15
- package/scss/components/Datagrid/_storybook-styles.scss +5 -0
- package/scss/components/EmptyStates/_empty-state.scss +2 -1
@@ -11,28 +11,27 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
11
11
|
import * as React from 'react';
|
12
12
|
import PropTypes from 'prop-types';
|
13
13
|
import { Draggable, Locked } from '@carbon/react/icons';
|
14
|
-
import { useDrag, useDrop } from 'react-dnd';
|
14
|
+
// import { useDrag, useDrop } from 'react-dnd';
|
15
15
|
import cx from 'classnames';
|
16
16
|
import { pkg } from '../../../settings';
|
17
17
|
var useEffect = React.useEffect,
|
18
18
|
useRef = React.useRef,
|
19
19
|
useState = React.useState;
|
20
20
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
21
|
-
|
21
|
+
|
22
|
+
// const DRAG_TYPE = `${blockClass}__shared-ui-draggable-element`;
|
23
|
+
|
22
24
|
var DraggableElement = function DraggableElement(_ref) {
|
23
25
|
var _cx;
|
24
|
-
var
|
25
|
-
index = _ref.index,
|
26
|
+
var index = _ref.index,
|
26
27
|
listData = _ref.listData,
|
27
28
|
children = _ref.children,
|
28
|
-
type = _ref.type,
|
29
29
|
disabled = _ref.disabled,
|
30
30
|
ariaLabel = _ref.ariaLabel,
|
31
31
|
onGrab = _ref.onGrab,
|
32
32
|
onArrowKeyDown = _ref.onArrowKeyDown,
|
33
33
|
isFocused = _ref.isFocused,
|
34
34
|
isSticky = _ref.isSticky,
|
35
|
-
moveElement = _ref.moveElement,
|
36
35
|
selected = _ref.selected,
|
37
36
|
_ref$positionLabel = _ref.positionLabel,
|
38
37
|
positionLabel = _ref$positionLabel === void 0 ? 'Current position {index} of {total}' : _ref$positionLabel,
|
@@ -41,72 +40,66 @@ var DraggableElement = function DraggableElement(_ref) {
|
|
41
40
|
_ref$droppedLabel = _ref.droppedLabel,
|
42
41
|
droppedLabel = _ref$droppedLabel === void 0 ? '{itemName} dropped.' : _ref$droppedLabel;
|
43
42
|
var ref = useRef();
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
}
|
91
|
-
}),
|
92
|
-
_useDrag2 = _slicedToArray(_useDrag, 3),
|
93
|
-
isDragging = _useDrag2[0].isDragging,
|
94
|
-
drag = _useDrag2[1],
|
95
|
-
preview = _useDrag2[2];
|
43
|
+
|
44
|
+
// const [{ isOver }, drop] = useDrop({
|
45
|
+
// accept: DRAG_TYPE + type,
|
46
|
+
// collect: (monitor) => ({
|
47
|
+
// isOver: !!monitor.isOver(),
|
48
|
+
// }),
|
49
|
+
// drop: (item) => {
|
50
|
+
// moveElement(item.index, index);
|
51
|
+
// },
|
52
|
+
// canDrop: () => !disabled,
|
53
|
+
// hover(item) {
|
54
|
+
// const dragIndex = item.index;
|
55
|
+
// const hoverIndex = index;
|
56
|
+
// // Don't replace items with themselves
|
57
|
+
// if (dragIndex === hoverIndex || disabled) {
|
58
|
+
// return;
|
59
|
+
// }
|
60
|
+
// // moveElement(dragIndex, hoverIndex);
|
61
|
+
// // Time to actually perform the action
|
62
|
+
// // Note: we're mutating the monitor item here!
|
63
|
+
// // Generally it's better to avoid mutations,
|
64
|
+
// // but it's good here for the sake of performance
|
65
|
+
// // to avoid expensive index searches.
|
66
|
+
// // eslint-disable-next-line no-param-reassign
|
67
|
+
// item.index = hoverIndex;
|
68
|
+
// },
|
69
|
+
// });
|
70
|
+
|
71
|
+
// const [{ isDragging }, drag, preview] = useDrag({
|
72
|
+
// type: DRAG_TYPE + type,
|
73
|
+
// item: { id, index },
|
74
|
+
// canDrag: () => !disabled,
|
75
|
+
// collect: (monitor) => ({
|
76
|
+
// isDragging: monitor.isDragging(),
|
77
|
+
// }),
|
78
|
+
// });
|
79
|
+
|
80
|
+
// Temporarily disable drag support because of commonjs support/issues with react-dnd in latest version
|
81
|
+
var _useState = useState(false),
|
82
|
+
_useState2 = _slicedToArray(_useState, 1),
|
83
|
+
isDragging = _useState2[0];
|
84
|
+
var _useState3 = useState(false),
|
85
|
+
_useState4 = _slicedToArray(_useState3, 1),
|
86
|
+
isOver = _useState4[0];
|
87
|
+
var preview = useRef();
|
88
|
+
var drag = useRef();
|
96
89
|
useEffect(function () {
|
97
90
|
if (isFocused && ref && ref.current) {
|
98
91
|
ref.current.focus();
|
99
92
|
}
|
100
93
|
}, [isFocused]);
|
101
|
-
var
|
102
|
-
|
103
|
-
isGrabbed =
|
104
|
-
setIsGrabbed =
|
105
|
-
var
|
106
|
-
|
107
|
-
isFocusedOnItem =
|
108
|
-
setIsFocusedOnItem =
|
109
|
-
drop(ref);
|
94
|
+
var _useState5 = useState(false),
|
95
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
96
|
+
isGrabbed = _useState6[0],
|
97
|
+
setIsGrabbed = _useState6[1];
|
98
|
+
var _useState7 = useState(isFocused),
|
99
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
100
|
+
isFocusedOnItem = _useState8[0],
|
101
|
+
setIsFocusedOnItem = _useState8[1];
|
102
|
+
// drop(ref);
|
110
103
|
var content = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
111
104
|
className: cx({
|
112
105
|
disabled: disabled
|
@@ -167,7 +160,7 @@ DraggableElement.propTypes = {
|
|
167
160
|
isFocused: PropTypes.bool.isRequired,
|
168
161
|
isSticky: PropTypes.bool,
|
169
162
|
listData: PropTypes.array.isRequired,
|
170
|
-
moveElement: PropTypes.func.isRequired,
|
163
|
+
// moveElement: PropTypes.func.isRequired,
|
171
164
|
onArrowKeyDown: PropTypes.func.isRequired,
|
172
165
|
onGrab: PropTypes.func.isRequired,
|
173
166
|
positionLabel: PropTypes.string,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
3
|
/**
|
4
|
-
* Copyright IBM Corp. 2022,
|
4
|
+
* Copyright IBM Corp. 2022, 2023
|
5
5
|
*
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
@@ -9,10 +9,10 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
9
9
|
|
10
10
|
import React from 'react';
|
11
11
|
import PropTypes from 'prop-types';
|
12
|
-
import { DndProvider } from 'react-dnd';
|
13
|
-
import { HTML5Backend } from 'react-dnd-html5-backend';
|
12
|
+
// import { DndProvider } from 'react-dnd';
|
13
|
+
// import { HTML5Backend } from 'react-dnd-html5-backend';
|
14
14
|
import { Checkbox } from '@carbon/react';
|
15
|
-
import update from 'immutability-helper';
|
15
|
+
// import update from 'immutability-helper';
|
16
16
|
import { pkg } from '../../../../../settings';
|
17
17
|
import cx from 'classnames';
|
18
18
|
import { DraggableItemsList } from './DraggableItemsList';
|
@@ -44,16 +44,23 @@ var Columns = function Columns(_ref) {
|
|
44
44
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
45
45
|
focusIndex = _React$useState4[0],
|
46
46
|
setFocusIndex = _React$useState4[1];
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
// const moveElement = React.useCallback(
|
48
|
+
// (dragIndex, hoverIndex) => {
|
49
|
+
// const dragCard = columns[dragIndex];
|
50
|
+
// setColumnsObject(
|
51
|
+
// update(columns, {
|
52
|
+
// $splice: [
|
53
|
+
// [dragIndex, 1],
|
54
|
+
// [hoverIndex, 0, dragCard],
|
55
|
+
// ],
|
56
|
+
// })
|
57
|
+
// );
|
58
|
+
// },
|
59
|
+
// [columns, setColumnsObject]
|
60
|
+
// );
|
61
|
+
|
53
62
|
return /*#__PURE__*/React.createElement("div", {
|
54
63
|
className: "".concat(blockClass, "__customize-columns-column-list")
|
55
|
-
}, /*#__PURE__*/React.createElement(DndProvider, {
|
56
|
-
backend: HTML5Backend
|
57
64
|
}, /*#__PURE__*/React.createElement("ol", {
|
58
65
|
className: "".concat(blockClass, "__customize-columns-column-list--focus"),
|
59
66
|
role: "listbox",
|
@@ -90,13 +97,14 @@ var Columns = function Columns(_ref) {
|
|
90
97
|
columns: columns,
|
91
98
|
filterString: filterString,
|
92
99
|
focusIndex: focusIndex,
|
93
|
-
getNextIndex: getNextIndex
|
94
|
-
|
100
|
+
getNextIndex: getNextIndex
|
101
|
+
// moveElement={moveElement}
|
102
|
+
,
|
95
103
|
onSelectColumn: onSelectColumn,
|
96
104
|
setAriaRegionText: setAriaRegionText,
|
97
105
|
setColumnsObject: setColumnsObject,
|
98
106
|
setFocusIndex: setFocusIndex
|
99
|
-
})))
|
107
|
+
})));
|
100
108
|
};
|
101
109
|
Columns.propTypes = {
|
102
110
|
assistiveTextDisabledInstructionsLabel: PropTypes.string,
|
@@ -18,7 +18,6 @@ export var DraggableItemsList = function DraggableItemsList(_ref) {
|
|
18
18
|
filterString = _ref.filterString,
|
19
19
|
focusIndex = _ref.focusIndex,
|
20
20
|
getNextIndex = _ref.getNextIndex,
|
21
|
-
moveElement = _ref.moveElement,
|
22
21
|
onSelectColumn = _ref.onSelectColumn,
|
23
22
|
setAriaRegionText = _ref.setAriaRegionText,
|
24
23
|
setColumnsObject = _ref.setColumnsObject,
|
@@ -68,8 +67,9 @@ export var DraggableItemsList = function DraggableItemsList(_ref) {
|
|
68
67
|
disabled: filterString.length > 0 || isFrozenColumn,
|
69
68
|
ariaLabel: colHeaderTitle,
|
70
69
|
onGrab: setAriaRegionText,
|
71
|
-
isFocused: focusIndex === i
|
72
|
-
|
70
|
+
isFocused: focusIndex === i
|
71
|
+
// moveElement={moveElement}
|
72
|
+
,
|
73
73
|
onArrowKeyDown: function onArrowKeyDown(e, isGrabbed, currentIndex) {
|
74
74
|
if (isGrabbed) {
|
75
75
|
var _columns$nextIndex;
|
@@ -78,7 +78,7 @@ export var DraggableItemsList = function DraggableItemsList(_ref) {
|
|
78
78
|
e.stopPropagation();
|
79
79
|
if (nextIndex >= 0 && !((_columns$nextIndex = columns[nextIndex]) !== null && _columns$nextIndex !== void 0 && _columns$nextIndex.sticky)) {
|
80
80
|
setFocusIndex(nextIndex);
|
81
|
-
moveElement(currentIndex, nextIndex);
|
81
|
+
// moveElement(currentIndex, nextIndex);
|
82
82
|
e.target.scrollIntoView({
|
83
83
|
block: 'center'
|
84
84
|
});
|
@@ -95,7 +95,7 @@ DraggableItemsList.propTypes = {
|
|
95
95
|
filterString: PropTypes.string.isRequired,
|
96
96
|
focusIndex: PropTypes.number.isRequired,
|
97
97
|
getNextIndex: PropTypes.func.isRequired,
|
98
|
-
moveElement: PropTypes.func.isRequired,
|
98
|
+
// moveElement: PropTypes.func.isRequired,
|
99
99
|
onSelectColumn: PropTypes.func.isRequired,
|
100
100
|
setAriaRegionText: PropTypes.func.isRequired,
|
101
101
|
setColumnsObject: PropTypes.func.isRequired,
|
@@ -152,7 +152,8 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
152
152
|
lastAppliedFilters.current = JSON.stringify(reactTableFiltersState);
|
153
153
|
}, [reactTableFiltersState, lastAppliedFilters]);
|
154
154
|
return /*#__PURE__*/React.createElement("div", {
|
155
|
-
className: "".concat(componentClass, "__container")
|
155
|
+
className: "".concat(componentClass, "__container"),
|
156
|
+
ref: filterFlyoutRef
|
156
157
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
157
158
|
label: flyoutIconDescription,
|
158
159
|
kind: "ghost",
|
@@ -161,7 +162,6 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
161
162
|
className: cx("".concat(componentClass, "__trigger"), _defineProperty({}, "".concat(componentClass, "__trigger--open"), open)),
|
162
163
|
disabled: data.length === 0
|
163
164
|
}, /*#__PURE__*/React.createElement(Filter, null)), /*#__PURE__*/React.createElement("div", {
|
164
|
-
ref: filterFlyoutRef,
|
165
165
|
className: cx(componentClass, (_cx2 = {}, _defineProperty(_cx2, "".concat(componentClass, "--open"), open), _defineProperty(_cx2, "".concat(componentClass, "--batch"), showActionSet), _defineProperty(_cx2, "".concat(componentClass, "--instant"), !showActionSet), _cx2))
|
166
166
|
}, /*#__PURE__*/React.createElement("div", {
|
167
167
|
className: "".concat(componentClass, "__inner-container")
|
@@ -15,7 +15,7 @@ import { Settings } from '@carbon/react/icons';
|
|
15
15
|
import { IconButton, Layer, Popover, PopoverContent } from '@carbon/react';
|
16
16
|
import RowSizeRadioGroup from './RowSizeRadioGroup';
|
17
17
|
import { pkg } from '../../../../../settings';
|
18
|
-
var blockClass = "".concat(pkg.prefix, "--
|
18
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid__row-size");
|
19
19
|
var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
20
20
|
var _ref$align = _ref.align,
|
21
21
|
align = _ref$align === void 0 ? 'bottom-right' : _ref$align,
|
@@ -26,24 +26,37 @@ var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
|
26
26
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
27
27
|
isOpen = _React$useState2[0],
|
28
28
|
setIsOpen = _React$useState2[1];
|
29
|
+
var onCloseHandler = function onCloseHandler() {
|
30
|
+
setIsOpen(false);
|
31
|
+
};
|
32
|
+
var onKeyHandler = function onKeyHandler(e) {
|
33
|
+
if (e.key === 'Escape') {
|
34
|
+
onCloseHandler();
|
35
|
+
}
|
36
|
+
};
|
37
|
+
var onBlurHandler = function onBlurHandler(e) {
|
38
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
39
|
+
onCloseHandler();
|
40
|
+
}
|
41
|
+
};
|
42
|
+
var onClickHandler = function onClickHandler() {
|
43
|
+
setIsOpen(!isOpen);
|
44
|
+
};
|
29
45
|
return /*#__PURE__*/React.createElement(Popover, {
|
46
|
+
tabIndex: -1,
|
30
47
|
isTabTip: true,
|
31
48
|
align: "bottom-right",
|
32
49
|
open: isOpen,
|
33
|
-
onRequestClose:
|
34
|
-
|
35
|
-
|
36
|
-
|
50
|
+
onRequestClose: onCloseHandler,
|
51
|
+
className: "".concat(blockClass, "-options-container"),
|
52
|
+
onKeyDown: onKeyHandler,
|
53
|
+
onBlur: onBlurHandler
|
37
54
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
38
55
|
align: align,
|
39
56
|
kind: "ghost",
|
40
|
-
onClick:
|
41
|
-
return setIsOpen(function (prevOpen) {
|
42
|
-
return !prevOpen;
|
43
|
-
});
|
44
|
-
},
|
57
|
+
onClick: onClickHandler,
|
45
58
|
label: legendText,
|
46
|
-
className: "".concat(blockClass, "
|
59
|
+
className: "".concat(blockClass, "-button")
|
47
60
|
}, /*#__PURE__*/React.createElement(Settings, {
|
48
61
|
size: 16
|
49
62
|
})), /*#__PURE__*/React.createElement(PopoverContent, null, /*#__PURE__*/React.createElement(Layer, null, /*#__PURE__*/React.createElement(RowSizeRadioGroup, _extends({}, props, {
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
10
10
|
import { RadioButtonGroup, RadioButton } from '@carbon/react';
|
11
11
|
import isArray from 'lodash/isArray';
|
12
12
|
import { pkg } from '../../../../../settings';
|
13
|
-
var blockClass = "".concat(pkg.prefix, "--
|
13
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid__row-size");
|
14
14
|
var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
|
15
15
|
var rowSizes = _ref.rowSizes,
|
16
16
|
selectedOption = _ref.selectedOption,
|
@@ -26,11 +26,8 @@ var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
|
|
26
26
|
xs: 'Extra small'
|
27
27
|
} : _ref$rowSizeLabels;
|
28
28
|
return /*#__PURE__*/React.createElement("div", {
|
29
|
-
className: "".concat(blockClass, "
|
30
|
-
role: "presentation"
|
31
|
-
onClick: function onClick(e) {
|
32
|
-
e.stopPropagation();
|
33
|
-
}
|
29
|
+
className: "".concat(blockClass, "-dropdown"),
|
30
|
+
role: "presentation"
|
34
31
|
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
35
32
|
legendText: legendText,
|
36
33
|
name: "row-height-group",
|
@@ -45,7 +42,7 @@ var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
|
|
45
42
|
labelText = option.value;
|
46
43
|
}
|
47
44
|
return /*#__PURE__*/React.createElement(RadioButton, {
|
48
|
-
className: "".concat(blockClass, "
|
45
|
+
className: "".concat(blockClass, "-radio-button"),
|
49
46
|
key: option.value,
|
50
47
|
labelText: labelText,
|
51
48
|
value: option.value,
|
@@ -214,7 +214,7 @@ export var OptionsTile = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
214
214
|
}, getDevtoolsProps(componentName)), enabled !== undefined && /*#__PURE__*/React.createElement("div", {
|
215
215
|
className: "".concat(blockClass, "__toggle-container")
|
216
216
|
}, /*#__PURE__*/React.createElement(Toggle, {
|
217
|
-
id: "".concat(
|
217
|
+
id: "".concat(titleId, "-toggle"),
|
218
218
|
className: "".concat(blockClass, "__toggle"),
|
219
219
|
toggled: enabled,
|
220
220
|
"aria-labelledby": titleId,
|
@@ -7,15 +7,15 @@
|
|
7
7
|
|
8
8
|
import { useEffect } from 'react';
|
9
9
|
export var useClickOutside = function useClickOutside(ref, callback) {
|
10
|
-
var handleClick = function handleClick(event) {
|
11
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
12
|
-
callback(event.target);
|
13
|
-
}
|
14
|
-
};
|
15
10
|
useEffect(function () {
|
11
|
+
var handleClick = function handleClick(event) {
|
12
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
13
|
+
callback(event.target);
|
14
|
+
}
|
15
|
+
};
|
16
16
|
document.addEventListener('click', handleClick);
|
17
17
|
return function () {
|
18
18
|
document.removeEventListener('click', handleClick);
|
19
19
|
};
|
20
|
-
});
|
20
|
+
}, [callback, ref]);
|
21
21
|
};
|
@@ -19,7 +19,8 @@ var _CreateInfluencer = require("../CreateInfluencer");
|
|
19
19
|
var _ActionSet = require("../ActionSet");
|
20
20
|
var _hooks = require("../../global/js/hooks");
|
21
21
|
var _lastIndexInArray = require("../../global/js/utils/lastIndexInArray");
|
22
|
-
var
|
22
|
+
var _getNumberOfHiddenSteps = require("../../global/js/utils/getNumberOfHiddenSteps");
|
23
|
+
var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "initialStep", "modalDangerButtonText", "modalDescription", "modalSecondaryButtonText", "modalTitle", "nextButtonText", "onClose", "onRequestSubmit", "firstFocusElement", "submitButtonText", "title"];
|
23
24
|
/**
|
24
25
|
* Copyright IBM Corp. 2021, 2023
|
25
26
|
*
|
@@ -62,6 +63,7 @@ var CreateFullPage = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
62
63
|
cancelButtonText = _ref.cancelButtonText,
|
63
64
|
children = _ref.children,
|
64
65
|
className = _ref.className,
|
66
|
+
initialStep = _ref.initialStep,
|
65
67
|
modalDangerButtonText = _ref.modalDangerButtonText,
|
66
68
|
modalDescription = _ref.modalDescription,
|
67
69
|
modalSecondaryButtonText = _ref.modalSecondaryButtonText,
|
@@ -132,7 +134,11 @@ var CreateFullPage = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
132
134
|
if (lastItem !== lastIncludedStep) {
|
133
135
|
setLastIncludedStep(lastItem);
|
134
136
|
}
|
135
|
-
|
137
|
+
if (open && initialStep) {
|
138
|
+
var numberOfHiddenSteps = (0, _getNumberOfHiddenSteps.getNumberOfHiddenSteps)(stepData, initialStep);
|
139
|
+
setCurrentStep(Number(initialStep + numberOfHiddenSteps));
|
140
|
+
}
|
141
|
+
}, [stepData, firstIncludedStep, lastIncludedStep, initialStep]);
|
136
142
|
(0, _hooks.useCreateComponentFocus)({
|
137
143
|
previousState: previousState,
|
138
144
|
currentStep: currentStep,
|
@@ -141,6 +147,16 @@ var CreateFullPage = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
141
147
|
firstFocusElement: firstFocusElement
|
142
148
|
});
|
143
149
|
(0, _hooks.useValidCreateStepCount)(stepData.length, componentName);
|
150
|
+
(0, _hooks.useResetCreateComponent)({
|
151
|
+
firstIncludedStep: firstIncludedStep,
|
152
|
+
previousState: previousState,
|
153
|
+
open: open,
|
154
|
+
setCurrentStep: setCurrentStep,
|
155
|
+
stepData: stepData,
|
156
|
+
initialStep: initialStep,
|
157
|
+
totalSteps: stepData === null || stepData === void 0 ? void 0 : stepData.length,
|
158
|
+
componentName: componentName
|
159
|
+
});
|
144
160
|
(0, _hooks.useCreateComponentStepChange)({
|
145
161
|
firstIncludedStep: firstIncludedStep,
|
146
162
|
lastIncludedStep: lastIncludedStep,
|
@@ -267,6 +283,12 @@ CreateFullPage.propTypes = {
|
|
267
283
|
* Specifies elements to focus on first on render.
|
268
284
|
*/
|
269
285
|
firstFocusElement: _propTypes.default.string,
|
286
|
+
/**
|
287
|
+
* This can be used to open the component to a step other than the first step.
|
288
|
+
* For example, a create flow was previously in progress, data was saved, and
|
289
|
+
* is now being completed.
|
290
|
+
*/
|
291
|
+
initialStep: _propTypes.default.number,
|
270
292
|
/**
|
271
293
|
* The primary 'danger' button text in the modal
|
272
294
|
*/
|
@@ -37,7 +37,8 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
37
37
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
38
38
|
receivedInitialWidth = _useState6[0],
|
39
39
|
setReceivedInitialWidth = _useState6[1];
|
40
|
-
var
|
40
|
+
var onSelectAllRows = datagridState.onSelectAllRows,
|
41
|
+
selectedRowIds = datagridState.state.selectedRowIds,
|
41
42
|
toggleAllRowsSelected = datagridState.toggleAllRowsSelected,
|
42
43
|
toolbarBatchActions = datagridState.toolbarBatchActions,
|
43
44
|
setGlobalFilter = datagridState.setGlobalFilter,
|
@@ -125,7 +126,12 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
125
126
|
onCancel: function onCancel() {
|
126
127
|
toggleAllRowsSelected(false);
|
127
128
|
setGlobalFilter(null);
|
128
|
-
}
|
129
|
+
},
|
130
|
+
onSelectAll: function onSelectAll() {
|
131
|
+
toggleAllRowsSelected(true);
|
132
|
+
onSelectAllRows === null || onSelectAllRows === void 0 ? void 0 : onSelectAllRows(true);
|
133
|
+
},
|
134
|
+
totalCount: rows && rows.length
|
129
135
|
}, !displayAllInMenu && toolbarBatchActions && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
130
136
|
if (index < 2 && toolbarBatchActions.length > 3 || index < 3 && toolbarBatchActions.length <= 3) {
|
131
137
|
return /*#__PURE__*/_react.default.createElement(_react2.TableBatchAction, {
|