@carbon/ibm-products 2.42.1-canary.7 → 2.43.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +302 -9
- 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.css +302 -9
- 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 +302 -9
- 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.d.ts +6 -0
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +74 -33
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +15 -1
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +95 -12
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +11 -2
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +27 -9
- package/es/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.js +38 -33
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.d.ts +2 -0
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +44 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +5 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +95 -14
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +1 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +7 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +8 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +197 -67
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +10 -0
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +69 -0
- package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +0 -5
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -4
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +7 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -2
- package/es/components/Datagrid/types/index.d.ts +2 -0
- package/es/components/Datagrid/useColumnOrder.d.ts +7 -1
- package/es/components/Datagrid/useFiltering.d.ts +8 -1
- package/es/components/Datagrid/useFiltering.js +8 -7
- package/es/components/Datagrid/useFlexResize.d.ts +1 -1
- package/es/components/Datagrid/useFlexResize.js +11 -11
- package/es/components/Datagrid/useNestedRows.js +24 -2
- package/es/components/Datagrid/useOnRowClick.d.ts +8 -1
- package/es/components/Datagrid/useOnRowClick.js +2 -1
- package/es/components/Datagrid/useRowIsMouseOver.d.ts +2 -1
- package/es/components/Datagrid/useRowIsMouseOver.js +1 -1
- package/es/components/Datagrid/useSelectRows.d.ts +8 -1
- package/es/components/Datagrid/useSelectRows.js +3 -2
- package/es/components/Datagrid/useSortableColumns.d.ts +10 -3
- package/es/components/Datagrid/useSortableColumns.js +3 -2
- package/es/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +8 -1
- package/es/components/Datagrid/utils/getAutoSizedColumnWidth.js +0 -7
- package/es/components/SidePanel/SidePanel.js +4 -2
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +6 -0
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +73 -32
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +15 -1
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +92 -9
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +11 -2
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +26 -8
- package/lib/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.js +36 -31
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.d.ts +2 -0
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +52 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +5 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +92 -11
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +1 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +7 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +8 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +195 -64
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +10 -0
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +77 -0
- package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +0 -5
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -4
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +7 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +1 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -2
- package/lib/components/Datagrid/types/index.d.ts +2 -0
- package/lib/components/Datagrid/useColumnOrder.d.ts +7 -1
- package/lib/components/Datagrid/useFiltering.d.ts +8 -1
- package/lib/components/Datagrid/useFiltering.js +8 -7
- package/lib/components/Datagrid/useFlexResize.d.ts +1 -1
- package/lib/components/Datagrid/useFlexResize.js +11 -11
- package/lib/components/Datagrid/useNestedRows.js +24 -2
- package/lib/components/Datagrid/useOnRowClick.d.ts +8 -1
- package/lib/components/Datagrid/useOnRowClick.js +2 -1
- package/lib/components/Datagrid/useRowIsMouseOver.d.ts +2 -1
- package/lib/components/Datagrid/useRowIsMouseOver.js +1 -1
- package/lib/components/Datagrid/useSelectRows.d.ts +8 -1
- package/lib/components/Datagrid/useSelectRows.js +3 -2
- package/lib/components/Datagrid/useSortableColumns.d.ts +10 -3
- package/lib/components/Datagrid/useSortableColumns.js +3 -2
- package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +8 -1
- package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.js +0 -7
- package/lib/components/SidePanel/SidePanel.js +4 -2
- package/package.json +3 -3
- package/scss/components/ConditionBuilder/_condition-builder.scss +21 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +22 -3
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +58 -21
- package/telemetry.yml +23 -0
- /package/es/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.d.ts +0 -0
- /package/lib/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.d.ts +0 -0
@@ -185,7 +185,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
185
185
|
headerProps = _extends({}, (_objectDestructuringEmpty(_header$getHeaderProp), _header$getHeaderProp));
|
186
186
|
var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
|
187
187
|
return /*#__PURE__*/React__default.createElement(TableHeader, _extends({}, headerProps, {
|
188
|
-
className: cx(header === null || header === void 0 ? void 0 : header.className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default.isValidElement(header === null || header === void 0 ? void 0 : header.slug))),
|
188
|
+
className: cx(header === null || header === void 0 ? void 0 : header.className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default.isValidElement(header === null || header === void 0 ? void 0 : header.slug)), headerProps.className),
|
189
189
|
key: header.id,
|
190
190
|
"aria-hidden": header.id === 'spacer' && 'true'
|
191
191
|
}, getAccessibilityProps(header)), header.render('Header'), renderSlug(header.slug), resizerProps && !header.isAction && /*#__PURE__*/React__default.createElement(ResizeHeader, {
|
@@ -11,7 +11,6 @@ import { VariableSizeList } from 'react-window';
|
|
11
11
|
import { TableBody } from '@carbon/react';
|
12
12
|
import { pkg } from '../../../settings.js';
|
13
13
|
import DatagridHead from './DatagridHead.js';
|
14
|
-
import { px } from '@carbon/layout';
|
15
14
|
import { useResizeObserver } from '../../../global/js/hooks/useResizeObserver.js';
|
16
15
|
|
17
16
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
@@ -72,10 +71,6 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
72
71
|
if (headWrapEl) {
|
73
72
|
headWrapEl.scrollLeft = virtualBody === null || virtualBody === void 0 ? void 0 : virtualBody.scrollLeft;
|
74
73
|
}
|
75
|
-
var spacerColumn = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap thead th:last-child"));
|
76
|
-
if (spacerColumn) {
|
77
|
-
spacerColumn.style.width = px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
|
78
|
-
}
|
79
74
|
}
|
80
75
|
var testRefValue = testRef === null || testRef === void 0 ? void 0 : testRef.current;
|
81
76
|
testRefValue === null || testRefValue === void 0 || testRefValue.addEventListener('scroll', handleScroll);
|
package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js
CHANGED
@@ -74,7 +74,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
74
74
|
};
|
75
75
|
var onCheckboxCheck = function onCheckboxCheck(col, value) {
|
76
76
|
var changedDefinitions = columnObjects.map(function (definition) {
|
77
|
-
if (Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) {
|
77
|
+
if ((Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) && definition.canFilter && !definition.disabled) {
|
78
78
|
return _objectSpread2(_objectSpread2({}, definition), {}, {
|
79
79
|
isVisible: value
|
80
80
|
});
|
@@ -98,9 +98,12 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
98
98
|
useEffect(function () {
|
99
99
|
var notFilterableCount = columnObjects.filter(function (col) {
|
100
100
|
return !col.canFilter;
|
101
|
-
});
|
102
|
-
|
103
|
-
|
101
|
+
}).length;
|
102
|
+
var actionCount = columnObjects.filter(function (col) {
|
103
|
+
return col.id === 'actions';
|
104
|
+
}).length;
|
105
|
+
setVisibleColumnsCount(getVisibleColumnsCount() - notFilterableCount - actionCount);
|
106
|
+
setTotalColumns(columnObjects.length - notFilterableCount - actionCount);
|
104
107
|
}, [getVisibleColumnsCount, columnObjects]);
|
105
108
|
return /*#__PURE__*/React__default.createElement(TearsheetNarrow, {
|
106
109
|
className: "".concat(blockClass, "__customize-columns-tearsheet"),
|
@@ -1,2 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2023, 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
|
+
declare const useFilterContext: () => any;
|
1
8
|
export default useFilterContext;
|
2
|
-
declare function useFilterContext(): any;
|
package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts
CHANGED
@@ -20,6 +20,7 @@ export namespace InlineEditCell {
|
|
20
20
|
rows: PropTypes.Requireable<(object | null | undefined)[]>;
|
21
21
|
rowSize: PropTypes.Requireable<string>;
|
22
22
|
tableId: PropTypes.Requireable<string>;
|
23
|
+
cellEditing: PropTypes.Requireable<object>;
|
23
24
|
}>>;
|
24
25
|
let nonEditCell: PropTypes.Requireable<boolean>;
|
25
26
|
let placeholder: PropTypes.Requireable<string>;
|
@@ -36,7 +36,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
36
36
|
var columnIndex = instance.columns.findIndex(function (col) {
|
37
37
|
return col.id === columnId;
|
38
38
|
});
|
39
|
-
var
|
39
|
+
var rowIndex = cell.row.index;
|
40
|
+
var cellId = "column-".concat(columnIndex, "-row-").concat(rowIndex);
|
40
41
|
var _useContext = useContext(InlineEditContext),
|
41
42
|
state = _useContext.state,
|
42
43
|
dispatch = _useContext.dispatch;
|
@@ -72,6 +73,14 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
72
73
|
var rowSize = instance.rowSize,
|
73
74
|
onDataUpdate = instance.onDataUpdate;
|
74
75
|
var saveCellData;
|
76
|
+
if (inEditMode) {
|
77
|
+
instance.cellEditing = {
|
78
|
+
cellId: cellId,
|
79
|
+
columnIndex: columnIndex,
|
80
|
+
rowIndex: rowIndex,
|
81
|
+
curCellValue: cellValue
|
82
|
+
};
|
83
|
+
}
|
75
84
|
useEffect(function () {
|
76
85
|
setInitialValue(value);
|
77
86
|
var columnId = cell.column.id;
|
@@ -469,7 +478,8 @@ InlineEditCell.propTypes = {
|
|
469
478
|
onDataUpdate: PropTypes.func,
|
470
479
|
rows: PropTypes.arrayOf(PropTypes.object),
|
471
480
|
rowSize: PropTypes.string,
|
472
|
-
tableId: PropTypes.string
|
481
|
+
tableId: PropTypes.string,
|
482
|
+
cellEditing: PropTypes.object
|
473
483
|
}),
|
474
484
|
nonEditCell: PropTypes.bool,
|
475
485
|
placeholder: PropTypes.string,
|
@@ -192,6 +192,8 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
|
|
192
192
|
onVirtualScroll?: (evt?: boolean) => void;
|
193
193
|
fetchMoreData?: () => void;
|
194
194
|
loadMoreThreshold?: number;
|
195
|
+
onRowClick?: (row: any, event: any) => void;
|
196
|
+
onSort?: boolean;
|
195
197
|
}
|
196
198
|
export interface ResizeHeaderProps {
|
197
199
|
resizerProps?: ResizerProps;
|
@@ -1,2 +1,8 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2022, 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
|
+
*/
|
2
7
|
import { useColumnOrder } from 'react-table';
|
8
|
+
export default useColumnOrder;
|
@@ -1,2 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2022, 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
|
+
import { Hooks } from 'react-table';
|
8
|
+
declare const useFiltering: (hooks: Hooks) => void;
|
1
9
|
export default useFiltering;
|
2
|
-
declare function useFiltering(hooks: any): void;
|
@@ -63,12 +63,13 @@ var useFiltering = function useFiltering(hooks) {
|
|
63
63
|
});
|
64
64
|
}, []);
|
65
65
|
hooks.useInstance.push(function (instance) {
|
66
|
-
var
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
66
|
+
var _ref4 = instance,
|
67
|
+
filterProps = _ref4.filterProps,
|
68
|
+
setAllFilters = _ref4.setAllFilters,
|
69
|
+
setFilter = _ref4.setFilter,
|
70
|
+
headers = _ref4.headers,
|
71
|
+
data = _ref4.data,
|
72
|
+
state = _ref4.state;
|
72
73
|
var defaultProps = {
|
73
74
|
variation: 'flyout',
|
74
75
|
updateMethod: BATCH,
|
@@ -84,7 +85,7 @@ var useFiltering = function useFiltering(hooks) {
|
|
84
85
|
});
|
85
86
|
};
|
86
87
|
Object.assign(instance, {
|
87
|
-
filterProps: _objectSpread2(_objectSpread2({}, defaultProps), instance.filterProps),
|
88
|
+
filterProps: _objectSpread2(_objectSpread2({}, defaultProps), instance === null || instance === void 0 ? void 0 : instance.filterProps),
|
88
89
|
filterTypes: filterTypes,
|
89
90
|
getFilterFlyoutProps: getFilterFlyoutProps,
|
90
91
|
FilterFlyout: FilterFlyout
|
@@ -7,31 +7,31 @@
|
|
7
7
|
|
8
8
|
import { toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
|
10
|
+
/* eslint-disable no-unreachable */
|
10
11
|
/**
|
11
|
-
* Copyright IBM Corp. 2020,
|
12
|
+
* Copyright IBM Corp. 2020, 2024
|
12
13
|
*
|
13
14
|
* This source code is licensed under the Apache-2.0 license found in the
|
14
15
|
* LICENSE file in the root directory of this source tree.
|
15
16
|
*/
|
16
17
|
|
17
18
|
var useFlexResize = function useFlexResize(hooks) {
|
18
|
-
var spacer = {
|
19
|
-
id: 'spacer',
|
20
|
-
width: 0,
|
21
|
-
disableSortBy: true,
|
22
|
-
disableResizing: true
|
23
|
-
};
|
24
19
|
hooks.visibleColumns.push(function (columns) {
|
25
|
-
// always move actions
|
20
|
+
// always move actions to the end
|
26
21
|
var actionsIdx = columns.findIndex(function (col) {
|
27
22
|
return col.isAction;
|
28
23
|
});
|
29
24
|
if (actionsIdx === -1) {
|
30
|
-
|
25
|
+
var _lastCol = columns.at(-1);
|
26
|
+
_lastCol.isFlexCol = true;
|
27
|
+
return _toConsumableArray(columns);
|
31
28
|
}
|
32
29
|
var cols = _toConsumableArray(columns);
|
33
30
|
var actions = cols.splice(actionsIdx, 1)[0];
|
34
|
-
cols.splice(columns.length, 0,
|
31
|
+
cols.splice(columns.length, 0, actions);
|
32
|
+
// the last non-action action column should flex remaining space
|
33
|
+
var lastCol = columns.at(-2);
|
34
|
+
lastCol.isFlexCol = true;
|
35
35
|
return cols;
|
36
36
|
});
|
37
37
|
var changeProps = function changeProps(props, data) {
|
@@ -39,7 +39,7 @@ var useFlexResize = function useFlexResize(hooks) {
|
|
39
39
|
if (!column && data.cell) {
|
40
40
|
column = data.cell.column;
|
41
41
|
}
|
42
|
-
if (column.
|
42
|
+
if (column.isFlexCol) {
|
43
43
|
return [props, {
|
44
44
|
style: {
|
45
45
|
flex: '1 1 0'
|
@@ -15,6 +15,23 @@ 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 rows = instance.rows;
|
20
|
+
var defaultExpandedRows = rows.filter(function (row) {
|
21
|
+
var _row$original;
|
22
|
+
return row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.defaultExpanded;
|
23
|
+
});
|
24
|
+
if (defaultExpandedRows !== null && defaultExpandedRows !== void 0 && defaultExpandedRows.length) {
|
25
|
+
defaultExpandedRows.map(function (defaultExpandedRow) {
|
26
|
+
if (!defaultExpandedRow.isExpanded && !defaultExpandedRow.hasExpanded) {
|
27
|
+
var _defaultExpandedRow$t;
|
28
|
+
defaultExpandedRow === null || defaultExpandedRow === void 0 || (_defaultExpandedRow$t = defaultExpandedRow.toggleRowExpanded) === null || _defaultExpandedRow$t === void 0 || _defaultExpandedRow$t.call(defaultExpandedRow);
|
29
|
+
defaultExpandedRow.hasExpanded = true;
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
}, [instance, instance.rows]);
|
18
35
|
// This useEffect will expand rows if they exist in the initialState obj
|
19
36
|
useEffect(function () {
|
20
37
|
var rows = instance.rows,
|
@@ -46,16 +63,21 @@ var useNestedRows = function useNestedRows(hooks) {
|
|
46
63
|
}
|
47
64
|
}];
|
48
65
|
};
|
66
|
+
var getIndentation = function getIndentation(depth) {
|
67
|
+
return 32 * depth + 16;
|
68
|
+
}; // row indentation padding
|
49
69
|
var getCellProps = function getCellProps(props, _ref3) {
|
50
70
|
var cell = _ref3.cell,
|
51
71
|
instance = _ref3.instance;
|
52
|
-
//
|
72
|
+
// 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
|
53
73
|
var isFirstCell = instance.columns.findIndex(function (c) {
|
54
74
|
return c.id === cell.column.id;
|
55
75
|
}) === 0;
|
56
76
|
return [props, {
|
57
77
|
style: {
|
58
|
-
marginRight:
|
78
|
+
marginRight: isFirstCell && cell.row.depth > 0 && parseInt(props.style.width, 10) <= getIndentation(cell.row.depth) + 50 // indentation padding + expander cell or empty cell width
|
79
|
+
? "".concat(parseInt(props.style.width, 10) - (getIndentation(cell.row.depth) + 50), "px") : '',
|
80
|
+
width: isFirstCell && cell.row.depth > 0 ? parseInt(props.style.width, 10) - getIndentation(cell.row.depth) : props.style.width
|
59
81
|
}
|
60
82
|
}];
|
61
83
|
};
|
@@ -1,2 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2023
|
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 { Hooks } from 'react-table';
|
8
|
+
declare const useOnRowClick: (hooks: Hooks) => void;
|
1
9
|
export default useOnRowClick;
|
2
|
-
declare function useOnRowClick(hooks: any): void;
|
@@ -9,7 +9,8 @@ import { pkg, carbon } from '../../settings.js';
|
|
9
9
|
|
10
10
|
var useOnRowClick = function useOnRowClick(hooks) {
|
11
11
|
var useInstance = function useInstance(rowInstance) {
|
12
|
-
var
|
12
|
+
var _ref = rowInstance,
|
13
|
+
onRowClick = _ref.onRowClick;
|
13
14
|
var getRowProps = function getRowProps(props, datagridState) {
|
14
15
|
var isFetching = datagridState.isFetching,
|
15
16
|
row = datagridState.row,
|
@@ -17,7 +17,7 @@ var useRowIsMouseOver = function useRowIsMouseOver(hooks) {
|
|
17
17
|
setMouseOverRowIndex = _useState2[1];
|
18
18
|
var onMouseChange = useDebounce(function (datagridState) {
|
19
19
|
var row = datagridState.row;
|
20
|
-
setMouseOverRowIndex(row.index);
|
20
|
+
setMouseOverRowIndex(row === null || row === void 0 ? void 0 : row.index);
|
21
21
|
}, 100);
|
22
22
|
var getRowProps = function getRowProps(props, datagridState) {
|
23
23
|
var onMouseOver = function onMouseOver() {
|
@@ -1,2 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2023
|
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 { Hooks } from 'react-table';
|
8
|
+
declare const useSelectRows: (hooks: Hooks) => void;
|
1
9
|
export default useSelectRows;
|
2
|
-
declare function useSelectRows(hooks: any): void;
|
@@ -108,7 +108,8 @@ var SelectRow = function SelectRow(datagridState) {
|
|
108
108
|
dispatch: dispatch,
|
109
109
|
rowData: row,
|
110
110
|
isChecked: event.target.checked,
|
111
|
-
getRowId: getRowId
|
111
|
+
getRowId: getRowId,
|
112
|
+
selectAll: null
|
112
113
|
});
|
113
114
|
};
|
114
115
|
var selectDisabled = isFetching || row.getRowProps().disabled;
|
@@ -128,7 +129,7 @@ var SelectRow = function SelectRow(datagridState) {
|
|
128
129
|
onSelect: onSelectHandler,
|
129
130
|
id: rowId,
|
130
131
|
name: "".concat(rowId, "-name"),
|
131
|
-
className: cx([checkboxClass, cellProps.className, _defineProperty({}, "".concat(checkboxClass, "-sticky-left"), isFirstColumnStickyLeft && windowSize > 671)]),
|
132
|
+
className: cx([checkboxClass, cellProps.className, _defineProperty({}, "".concat(checkboxClass, "-sticky-left"), isFirstColumnStickyLeft && Number(windowSize) > 671)]),
|
132
133
|
ariaLabel: title,
|
133
134
|
disabled: selectDisabled
|
134
135
|
}));
|
@@ -1,6 +1,13 @@
|
|
1
|
-
|
2
|
-
|
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
|
+
import { Hooks } from 'react-table';
|
8
|
+
export declare const getNewSortOrder: (sortOrder?: boolean | string) => {
|
9
|
+
newSortDesc: boolean;
|
3
10
|
newOrder: string;
|
4
11
|
};
|
12
|
+
declare const useSortableColumns: (hooks: Hooks) => void;
|
5
13
|
export default useSortableColumns;
|
6
|
-
declare function useSortableColumns(hooks: any): void;
|
@@ -22,7 +22,7 @@ var ordering = {
|
|
22
22
|
};
|
23
23
|
var getNewSortOrder = function getNewSortOrder(sortOrder) {
|
24
24
|
var order = {
|
25
|
-
newSortDesc:
|
25
|
+
newSortDesc: false,
|
26
26
|
newOrder: ordering.NONE
|
27
27
|
};
|
28
28
|
if (sortOrder === false || sortOrder === ordering.DESC) {
|
@@ -137,7 +137,8 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
137
137
|
return (_instance$customizeCo = instance.customizeColumnsProps) !== null && _instance$customizeCo !== void 0 && _instance$customizeCo.isTearsheetOpen ? visibleColumns : _toConsumableArray(sortableColumns);
|
138
138
|
};
|
139
139
|
var sortInstanceProps = function sortInstanceProps(instance) {
|
140
|
-
var
|
140
|
+
var _ref3 = instance,
|
141
|
+
onSort = _ref3.onSort;
|
141
142
|
Object.assign(instance, {
|
142
143
|
manualSortBy: !!onSort,
|
143
144
|
isTableSortable: true
|
@@ -1 +1,8 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2023, 2023
|
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 { Row } from 'react-table';
|
8
|
+
export declare const getAutoSizedColumnWidth: (rows: Array<Row<object>>, accessor: string, headerText: string) => number;
|
@@ -14,13 +14,6 @@ import { toConsumableArray as _toConsumableArray } from '../../../_virtual/_roll
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
15
15
|
*/
|
16
16
|
|
17
|
-
/**
|
18
|
-
* Calculates the auto sized width of a column
|
19
|
-
* @param {Array<object>} rows - The datagrid rows
|
20
|
-
* @param {string} accessor - The accessor for the column
|
21
|
-
* @param {string} headerText - The header text for the column
|
22
|
-
*/
|
23
|
-
|
24
17
|
var getAutoSizedColumnWidth = function getAutoSizedColumnWidth(rows, accessor, headerText) {
|
25
18
|
var maxWidth = 400;
|
26
19
|
var minWidth = 58;
|
@@ -95,7 +95,8 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
95
95
|
var subtitleRef = useRef(null);
|
96
96
|
var previousState = usePreviousValue({
|
97
97
|
size: size,
|
98
|
-
open: open
|
98
|
+
open: open,
|
99
|
+
currentStep: currentStep
|
99
100
|
});
|
100
101
|
var _useState3 = useState(-1),
|
101
102
|
_useState4 = _slicedToArray(_useState3, 2),
|
@@ -162,9 +163,10 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
162
163
|
if (sidePanelRef && panelRefValue) {
|
163
164
|
var _animatedScrollRef$cu;
|
164
165
|
var scrollableSection = (_animatedScrollRef$cu = animatedScrollRef.current) !== null && _animatedScrollRef$cu !== void 0 ? _animatedScrollRef$cu : innerContentRef.current;
|
165
|
-
if (scrollableSection) {
|
166
|
+
if (previousState && previousState['currentStep'] !== currentStep && scrollableSection) {
|
166
167
|
scrollableSection.scrollTop = 0;
|
167
168
|
}
|
169
|
+
|
168
170
|
// The size of the panel has changed while it is still opened
|
169
171
|
// so we need to scroll it to the top and reset the header
|
170
172
|
// height css custom property
|
@@ -6,17 +6,23 @@ declare function ConditionBlock(props: any): import("react/jsx-runtime").JSX.Ele
|
|
6
6
|
declare namespace ConditionBlock {
|
7
7
|
namespace propTypes {
|
8
8
|
let addConditionHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
9
|
+
let addConditionSubGroupHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
9
10
|
let aria: PropTypes.Requireable<object>;
|
10
11
|
let condition: PropTypes.Requireable<object>;
|
11
12
|
let conditionIndex: PropTypes.Requireable<number>;
|
12
13
|
let conjunction: PropTypes.Requireable<string>;
|
13
14
|
let group: PropTypes.Requireable<object>;
|
15
|
+
let hideConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
16
|
+
let hideConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
14
17
|
let isLastCondition: PropTypes.Requireable<(...args: any[]) => any>;
|
15
18
|
let isStatement: PropTypes.Requireable<boolean>;
|
16
19
|
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
17
20
|
let onConnectorOperatorChange: PropTypes.Requireable<(...args: any[]) => any>;
|
18
21
|
let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
19
22
|
let onStatementChange: PropTypes.Requireable<(...args: any[]) => any>;
|
23
|
+
let showConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
24
|
+
let showConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
25
|
+
let state: PropTypes.Requireable<object>;
|
20
26
|
}
|
21
27
|
}
|
22
28
|
import PropTypes from 'prop-types';
|