@carbon/ibm-products 2.43.2-canary.229 → 2.43.2-canary.233
Sign up to get free protection for your applications and to get access to all the features.
- package/es/components/CreateFullPage/CreateFullPageStep.d.ts +3 -1
- package/es/components/CreateFullPage/CreateFullPageStep.js +5 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +17 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +13 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +1 -12
- package/es/components/Datagrid/useNestedRowExpander.js +12 -8
- package/lib/components/CreateFullPage/CreateFullPageStep.d.ts +3 -1
- package/lib/components/CreateFullPage/CreateFullPageStep.js +5 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +15 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +12 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +0 -11
- package/lib/components/Datagrid/useNestedRowExpander.js +12 -8
- package/package.json +2 -2
@@ -60,10 +60,12 @@ interface CreateFullPageStepBaseProps extends PropsWithChildren {
|
|
60
60
|
title: ReactNode;
|
61
61
|
}
|
62
62
|
type CreateFullPageStepFieldsetProps = {
|
63
|
+
fieldsetLegendText?: string;
|
64
|
+
} | {
|
63
65
|
hasFieldset: false;
|
64
66
|
fieldsetLegendText?: string;
|
65
67
|
} | {
|
66
|
-
hasFieldset
|
68
|
+
hasFieldset: true;
|
67
69
|
fieldsetLegendText: string;
|
68
70
|
};
|
69
71
|
export type CreateFullPageStepProps = CreateFullPageStepBaseProps & CreateFullPageStepFieldsetProps;
|
@@ -24,6 +24,11 @@ var blockClass = "".concat(pkg.prefix, "--create-full-page__step");
|
|
24
24
|
var defaults = {
|
25
25
|
includeStep: true
|
26
26
|
};
|
27
|
+
|
28
|
+
// Try to specify the hasFieldset and fieldsetLegendText Typescript requirements.
|
29
|
+
// Basically, fieldsetLegendText should only be specified when hasFieldset is true.
|
30
|
+
// And usually, hasFieldset won't be specified at all unless it's being set to true.
|
31
|
+
|
27
32
|
var CreateFullPageStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
28
33
|
var children = _ref.children,
|
29
34
|
className = _ref.className,
|
@@ -134,7 +139,6 @@ CreateFullPageStep.propTypes = {
|
|
134
139
|
/**
|
135
140
|
* This will conditionally disable the submit button in the multi step CreateFullPage
|
136
141
|
*/
|
137
|
-
/**@ts-ignore */
|
138
142
|
disableSubmit: PropTypes.bool,
|
139
143
|
/**
|
140
144
|
* This is the legend text that appears above a fieldset html element for accessibility purposes. It is required when the optional `hasFieldset` prop is provided to a FullPageStep.
|
@@ -147,7 +151,6 @@ CreateFullPageStep.propTypes = {
|
|
147
151
|
/**
|
148
152
|
* This optional prop will render your form content inside of a fieldset html element
|
149
153
|
*/
|
150
|
-
/**@ts-ignore */
|
151
154
|
hasFieldset: PropTypes.bool,
|
152
155
|
/**
|
153
156
|
* This prop is used to help track dynamic steps. If this value is `false` then the step is not included in the visible steps or the ProgressIndicator
|
@@ -6,15 +6,16 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray, defineProperty as _defineProperty } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import { BATCH, INSTANT, FLYOUT, CLEAR_FILTERS } from './constants.js';
|
9
|
+
import { BATCH, INSTANT, FLYOUT, CLEAR_FILTERS, SAVED_FILTERS } from './constants.js';
|
10
10
|
import { usePrefix, IconButton } from '@carbon/react';
|
11
|
-
import React__default, { useState, useRef, useEffect } from 'react';
|
11
|
+
import React__default, { useState, useRef, useContext, useEffect } from 'react';
|
12
12
|
import { breakpoints, px } from '@carbon/layout';
|
13
13
|
import { ActionSet } from '../../../../ActionSet/ActionSet.js';
|
14
14
|
import { Filter } from '@carbon/react/icons';
|
15
15
|
import PropTypes from '../../../../../node_modules/prop-types/index.js';
|
16
16
|
import cx from 'classnames';
|
17
17
|
import { pkg } from '../../../../../settings.js';
|
18
|
+
import { FilterContext } from './FilterProvider.js';
|
18
19
|
import useFilters from './hooks/useFilters.js';
|
19
20
|
import useShouldDisableButtons from './hooks/useShouldDisableButtons.js';
|
20
21
|
import { useWindowResize } from '../../../../../global/js/hooks/useWindowResize.js';
|
@@ -138,6 +139,10 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
138
139
|
handleResize(current);
|
139
140
|
});
|
140
141
|
|
142
|
+
/** Context */
|
143
|
+
var _useContext = useContext(FilterContext),
|
144
|
+
localDispatch = _useContext.dispatch;
|
145
|
+
|
141
146
|
/** Memos */
|
142
147
|
var showActionSet = updateMethod === BATCH;
|
143
148
|
var carbonPrefix = usePrefix();
|
@@ -174,6 +179,16 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
174
179
|
|
175
180
|
// Update the last applied filters
|
176
181
|
lastAppliedFilters.current = JSON.stringify(filtersObjectArray);
|
182
|
+
|
183
|
+
// Dispatch action from local filter context to track filters in order
|
184
|
+
// to keep history if `isFetching` becomes true. If so, react-table
|
185
|
+
// clears all filter history
|
186
|
+
localDispatch({
|
187
|
+
type: SAVED_FILTERS,
|
188
|
+
payload: {
|
189
|
+
savedFilters: filtersObjectArray
|
190
|
+
}
|
191
|
+
});
|
177
192
|
};
|
178
193
|
|
179
194
|
/** Renders all filters */
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { Button, Layer, Search, Accordion, AccordionItem } from '@carbon/react';
|
10
|
-
import { PANEL, BATCH, CLEAR_FILTERS, INSTANT } from './constants.js';
|
10
|
+
import { PANEL, BATCH, CLEAR_FILTERS, INSTANT, SAVED_FILTERS } from './constants.js';
|
11
11
|
import React__default, { useState, useContext, useRef, useMemo, useEffect, useCallback } from 'react';
|
12
12
|
import { panelVariants, innerContainerVariants, actionSetVariants } from './motion/variants.js';
|
13
13
|
import { motion, useReducedMotion } from 'framer-motion';
|
@@ -80,7 +80,8 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
80
80
|
/** Context */
|
81
81
|
var _useContext = useContext(FilterContext),
|
82
82
|
panelOpen = _useContext.panelOpen,
|
83
|
-
setPanelOpen = _useContext.setPanelOpen
|
83
|
+
setPanelOpen = _useContext.setPanelOpen,
|
84
|
+
localDispatch = _useContext.dispatch;
|
84
85
|
var _useFilters = useFilters({
|
85
86
|
updateMethod: updateMethod,
|
86
87
|
filters: filterSections,
|
@@ -145,6 +146,16 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
145
146
|
|
146
147
|
// Update the last applied filters
|
147
148
|
lastAppliedFilters.current = JSON.stringify(filtersObjectArray);
|
149
|
+
|
150
|
+
// Dispatch action from local filter context to track filters in order
|
151
|
+
// to keep history if `isFetching` becomes true. If so, react-table
|
152
|
+
// clears all filter history
|
153
|
+
localDispatch({
|
154
|
+
type: SAVED_FILTERS,
|
155
|
+
payload: {
|
156
|
+
savedFilters: filtersObjectArray
|
157
|
+
}
|
158
|
+
});
|
148
159
|
};
|
149
160
|
var renderActionSet = function renderActionSet() {
|
150
161
|
return showActionSet && /*#__PURE__*/React__default.createElement(MotionActionSet, {
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray, toConsumableArray as _toConsumableArray, extends as _extends, objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import { MULTISELECT, DROPDOWN, RADIO, CHECKBOX, NUMBER, DATE, BATCH,
|
9
|
+
import { MULTISELECT, DROPDOWN, RADIO, CHECKBOX, NUMBER, DATE, BATCH, INSTANT, PANEL } from '../constants.js';
|
10
10
|
import { MultiSelect, Dropdown, FormGroup, RadioButtonGroup, RadioButton, NumberInput, DatePicker, DatePickerInput, Layer, Checkbox } from '@carbon/react';
|
11
11
|
import React__default, { useContext, useState, useRef, useCallback, useEffect } from 'react';
|
12
12
|
import OverflowCheckboxes from '../OverflowCheckboxes.js';
|
@@ -31,7 +31,6 @@ var useFilters = function useFilters(_ref) {
|
|
31
31
|
isFetching = _ref.isFetching;
|
32
32
|
var _useContext = useContext(FilterContext),
|
33
33
|
state = _useContext.state,
|
34
|
-
localDispatch = _useContext.dispatch,
|
35
34
|
contextTableId = _useContext.tableId;
|
36
35
|
var savedFilters = state.savedFilters;
|
37
36
|
/** State */
|
@@ -136,16 +135,6 @@ var useFilters = function useFilters(_ref) {
|
|
136
135
|
filterCopy.splice(index, 1);
|
137
136
|
}
|
138
137
|
setFiltersObjectArray(filterCopy);
|
139
|
-
|
140
|
-
// Dispatch action from local filter context to track filters in order
|
141
|
-
// to keep history if `isFetching` becomes true. If so, react-table
|
142
|
-
// clears all filter history
|
143
|
-
localDispatch({
|
144
|
-
type: SAVED_FILTERS,
|
145
|
-
payload: {
|
146
|
-
savedFilters: filterCopy
|
147
|
-
}
|
148
|
-
});
|
149
138
|
if (updateMethod === INSTANT) {
|
150
139
|
setAllFilters(filterCopy);
|
151
140
|
}
|
@@ -48,7 +48,7 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
48
48
|
row.toggleRowExpanded();
|
49
49
|
lastExpandedRowIndex.current = row.id;
|
50
50
|
if (row.isExpanded) {
|
51
|
-
_context.next =
|
51
|
+
_context.next = 15;
|
52
52
|
break;
|
53
53
|
}
|
54
54
|
_context.prev = 4;
|
@@ -59,27 +59,31 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
59
59
|
depth: row.depth,
|
60
60
|
index: row.index
|
61
61
|
});
|
62
|
-
|
62
|
+
if (!getAsyncSubRows) {
|
63
|
+
_context.next = 9;
|
64
|
+
break;
|
65
|
+
}
|
66
|
+
_context.next = 9;
|
63
67
|
return getAsyncSubRows === null || getAsyncSubRows === void 0 ? void 0 : getAsyncSubRows(row);
|
64
|
-
case
|
68
|
+
case 9:
|
65
69
|
handleDynamicRowCheck({
|
66
70
|
dispatch: dispatch,
|
67
71
|
status: 'finish',
|
68
72
|
rowId: row.id
|
69
73
|
});
|
70
|
-
_context.next =
|
74
|
+
_context.next = 15;
|
71
75
|
break;
|
72
|
-
case
|
73
|
-
_context.prev =
|
76
|
+
case 12:
|
77
|
+
_context.prev = 12;
|
74
78
|
_context.t0 = _context["catch"](4);
|
75
79
|
console.log({
|
76
80
|
error: _context.t0
|
77
81
|
});
|
78
|
-
case
|
82
|
+
case 15:
|
79
83
|
case "end":
|
80
84
|
return _context.stop();
|
81
85
|
}
|
82
|
-
}, _callee, null, [[4,
|
86
|
+
}, _callee, null, [[4, 12]]);
|
83
87
|
}));
|
84
88
|
function onClick(_x) {
|
85
89
|
return _onClick.apply(this, arguments);
|
@@ -60,10 +60,12 @@ interface CreateFullPageStepBaseProps extends PropsWithChildren {
|
|
60
60
|
title: ReactNode;
|
61
61
|
}
|
62
62
|
type CreateFullPageStepFieldsetProps = {
|
63
|
+
fieldsetLegendText?: string;
|
64
|
+
} | {
|
63
65
|
hasFieldset: false;
|
64
66
|
fieldsetLegendText?: string;
|
65
67
|
} | {
|
66
|
-
hasFieldset
|
68
|
+
hasFieldset: true;
|
67
69
|
fieldsetLegendText: string;
|
68
70
|
};
|
69
71
|
export type CreateFullPageStepProps = CreateFullPageStepBaseProps & CreateFullPageStepFieldsetProps;
|
@@ -33,6 +33,11 @@ var blockClass = "".concat(settings.pkg.prefix, "--create-full-page__step");
|
|
33
33
|
var defaults = {
|
34
34
|
includeStep: true
|
35
35
|
};
|
36
|
+
|
37
|
+
// Try to specify the hasFieldset and fieldsetLegendText Typescript requirements.
|
38
|
+
// Basically, fieldsetLegendText should only be specified when hasFieldset is true.
|
39
|
+
// And usually, hasFieldset won't be specified at all unless it's being set to true.
|
40
|
+
|
36
41
|
exports.CreateFullPageStep = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
37
42
|
var children = _ref.children,
|
38
43
|
className = _ref.className,
|
@@ -143,7 +148,6 @@ exports.CreateFullPageStep.propTypes = {
|
|
143
148
|
/**
|
144
149
|
* This will conditionally disable the submit button in the multi step CreateFullPage
|
145
150
|
*/
|
146
|
-
/**@ts-ignore */
|
147
151
|
disableSubmit: index["default"].bool,
|
148
152
|
/**
|
149
153
|
* This is the legend text that appears above a fieldset html element for accessibility purposes. It is required when the optional `hasFieldset` prop is provided to a FullPageStep.
|
@@ -156,7 +160,6 @@ exports.CreateFullPageStep.propTypes = {
|
|
156
160
|
/**
|
157
161
|
* This optional prop will render your form content inside of a fieldset html element
|
158
162
|
*/
|
159
|
-
/**@ts-ignore */
|
160
163
|
hasFieldset: index["default"].bool,
|
161
164
|
/**
|
162
165
|
* This prop is used to help track dynamic steps. If this value is `false` then the step is not included in the visible steps or the ProgressIndicator
|
@@ -19,6 +19,7 @@ var icons = require('@carbon/react/icons');
|
|
19
19
|
var index = require('../../../../../node_modules/prop-types/index.js');
|
20
20
|
var cx = require('classnames');
|
21
21
|
var settings = require('../../../../../settings.js');
|
22
|
+
var FilterProvider = require('./FilterProvider.js');
|
22
23
|
var useFilters = require('./hooks/useFilters.js');
|
23
24
|
var useShouldDisableButtons = require('./hooks/useShouldDisableButtons.js');
|
24
25
|
var useWindowResize = require('../../../../../global/js/hooks/useWindowResize.js');
|
@@ -147,6 +148,10 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
147
148
|
handleResize(current);
|
148
149
|
});
|
149
150
|
|
151
|
+
/** Context */
|
152
|
+
var _useContext = React.useContext(FilterProvider.FilterContext),
|
153
|
+
localDispatch = _useContext.dispatch;
|
154
|
+
|
150
155
|
/** Memos */
|
151
156
|
var showActionSet = updateMethod === constants.BATCH;
|
152
157
|
var carbonPrefix = react.usePrefix();
|
@@ -183,6 +188,16 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
183
188
|
|
184
189
|
// Update the last applied filters
|
185
190
|
lastAppliedFilters.current = JSON.stringify(filtersObjectArray);
|
191
|
+
|
192
|
+
// Dispatch action from local filter context to track filters in order
|
193
|
+
// to keep history if `isFetching` becomes true. If so, react-table
|
194
|
+
// clears all filter history
|
195
|
+
localDispatch({
|
196
|
+
type: constants.SAVED_FILTERS,
|
197
|
+
payload: {
|
198
|
+
savedFilters: filtersObjectArray
|
199
|
+
}
|
200
|
+
});
|
186
201
|
};
|
187
202
|
|
188
203
|
/** Renders all filters */
|
@@ -89,7 +89,8 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
89
89
|
/** Context */
|
90
90
|
var _useContext = React.useContext(FilterProvider.FilterContext),
|
91
91
|
panelOpen = _useContext.panelOpen,
|
92
|
-
setPanelOpen = _useContext.setPanelOpen
|
92
|
+
setPanelOpen = _useContext.setPanelOpen,
|
93
|
+
localDispatch = _useContext.dispatch;
|
93
94
|
var _useFilters = useFilters["default"]({
|
94
95
|
updateMethod: updateMethod,
|
95
96
|
filters: filterSections,
|
@@ -154,6 +155,16 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
154
155
|
|
155
156
|
// Update the last applied filters
|
156
157
|
lastAppliedFilters.current = JSON.stringify(filtersObjectArray);
|
158
|
+
|
159
|
+
// Dispatch action from local filter context to track filters in order
|
160
|
+
// to keep history if `isFetching` becomes true. If so, react-table
|
161
|
+
// clears all filter history
|
162
|
+
localDispatch({
|
163
|
+
type: constants.SAVED_FILTERS,
|
164
|
+
payload: {
|
165
|
+
savedFilters: filtersObjectArray
|
166
|
+
}
|
167
|
+
});
|
157
168
|
};
|
158
169
|
var renderActionSet = function renderActionSet() {
|
159
170
|
return showActionSet && /*#__PURE__*/React__default["default"].createElement(MotionActionSet, {
|
@@ -39,7 +39,6 @@ var useFilters = function useFilters(_ref) {
|
|
39
39
|
isFetching = _ref.isFetching;
|
40
40
|
var _useContext = React.useContext(FilterProvider.FilterContext),
|
41
41
|
state = _useContext.state,
|
42
|
-
localDispatch = _useContext.dispatch,
|
43
42
|
contextTableId = _useContext.tableId;
|
44
43
|
var savedFilters = state.savedFilters;
|
45
44
|
/** State */
|
@@ -144,16 +143,6 @@ var useFilters = function useFilters(_ref) {
|
|
144
143
|
filterCopy.splice(index, 1);
|
145
144
|
}
|
146
145
|
setFiltersObjectArray(filterCopy);
|
147
|
-
|
148
|
-
// Dispatch action from local filter context to track filters in order
|
149
|
-
// to keep history if `isFetching` becomes true. If so, react-table
|
150
|
-
// clears all filter history
|
151
|
-
localDispatch({
|
152
|
-
type: constants.SAVED_FILTERS,
|
153
|
-
payload: {
|
154
|
-
savedFilters: filterCopy
|
155
|
-
}
|
156
|
-
});
|
157
146
|
if (updateMethod === constants.INSTANT) {
|
158
147
|
setAllFilters(filterCopy);
|
159
148
|
}
|
@@ -57,7 +57,7 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
57
57
|
row.toggleRowExpanded();
|
58
58
|
lastExpandedRowIndex.current = row.id;
|
59
59
|
if (row.isExpanded) {
|
60
|
-
_context.next =
|
60
|
+
_context.next = 15;
|
61
61
|
break;
|
62
62
|
}
|
63
63
|
_context.prev = 4;
|
@@ -68,27 +68,31 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
68
68
|
depth: row.depth,
|
69
69
|
index: row.index
|
70
70
|
});
|
71
|
-
|
71
|
+
if (!getAsyncSubRows) {
|
72
|
+
_context.next = 9;
|
73
|
+
break;
|
74
|
+
}
|
75
|
+
_context.next = 9;
|
72
76
|
return getAsyncSubRows === null || getAsyncSubRows === void 0 ? void 0 : getAsyncSubRows(row);
|
73
|
-
case
|
77
|
+
case 9:
|
74
78
|
stateReducer.handleDynamicRowCheck({
|
75
79
|
dispatch: dispatch,
|
76
80
|
status: 'finish',
|
77
81
|
rowId: row.id
|
78
82
|
});
|
79
|
-
_context.next =
|
83
|
+
_context.next = 15;
|
80
84
|
break;
|
81
|
-
case
|
82
|
-
_context.prev =
|
85
|
+
case 12:
|
86
|
+
_context.prev = 12;
|
83
87
|
_context.t0 = _context["catch"](4);
|
84
88
|
console.log({
|
85
89
|
error: _context.t0
|
86
90
|
});
|
87
|
-
case
|
91
|
+
case 15:
|
88
92
|
case "end":
|
89
93
|
return _context.stop();
|
90
94
|
}
|
91
|
-
}, _callee, null, [[4,
|
95
|
+
}, _callee, null, [[4, 12]]);
|
92
96
|
}));
|
93
97
|
function onClick(_x) {
|
94
98
|
return _onClick.apply(this, arguments);
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "2.43.2-canary.
|
4
|
+
"version": "2.43.2-canary.233+11c1554ba",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -120,5 +120,5 @@
|
|
120
120
|
"react": "^16.8.6 || ^17.0.1 || ^18.2.0",
|
121
121
|
"react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
|
122
122
|
},
|
123
|
-
"gitHead": "
|
123
|
+
"gitHead": "11c1554ba92037f559862ad9c83cfdf048074659"
|
124
124
|
}
|