@carbon/ibm-products 2.43.2-canary.70 → 2.43.2-canary.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +2 -5
- package/es/components/Datagrid/types/index.d.ts +14 -2
- package/es/components/Datagrid/useDisableSelectRows.d.ts +2 -1
- package/es/components/Datagrid/useDisableSelectRows.js +27 -22
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +2 -5
- package/lib/components/Datagrid/types/index.d.ts +14 -2
- package/lib/components/Datagrid/useDisableSelectRows.d.ts +2 -1
- package/lib/components/Datagrid/useDisableSelectRows.js +27 -22
- package/package.json +4 -4
@@ -434,14 +434,11 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
434
434
|
handleKeyPress(event, activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, setSelectionAreas, setSelectionAreaData, setCurrentMatcher, activeCellRef, setActiveCellCoordinates, setContainerHasFocus, setActiveCellContent, readOnlyTable);
|
435
435
|
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, readOnlyTable]);
|
436
436
|
var startEditMode = function startEditMode() {
|
437
|
+
var _activeCellFullData$r;
|
437
438
|
setIsEditing(true);
|
438
439
|
setClickAndHoldActive(false);
|
439
440
|
var activeCellFullData = typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'number' && typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'number' ? rows[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row].cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column] : null;
|
440
|
-
var activeCellValue;
|
441
|
-
if (activeCellFullData && activeCellCoordinates !== null && activeCellCoordinates !== void 0 && activeCellCoordinates.column) {
|
442
|
-
var _activeCellFullData$r;
|
443
|
-
activeCellValue = activeCellFullData ? (_activeCellFullData$r = activeCellFullData.row.cells) === null || _activeCellFullData$r === void 0 || (_activeCellFullData$r = _activeCellFullData$r[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column]) === null || _activeCellFullData$r === void 0 ? void 0 : _activeCellFullData$r.value : null;
|
444
|
-
}
|
441
|
+
var activeCellValue = activeCellFullData === null || activeCellFullData === void 0 || (_activeCellFullData$r = activeCellFullData.row) === null || _activeCellFullData$r === void 0 || (_activeCellFullData$r = _activeCellFullData$r.cells) === null || _activeCellFullData$r === void 0 || (_activeCellFullData$r = _activeCellFullData$r[Number(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column)]) === null || _activeCellFullData$r === void 0 ? void 0 : _activeCellFullData$r.value;
|
445
442
|
setCellEditorValue(activeCellValue || '');
|
446
443
|
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
447
444
|
cellEditorRulerRef.current.textContent = activeCellValue;
|
@@ -6,7 +6,7 @@ import { RadioButtonGroupProps } from '@carbon/react/lib/components/RadioButtonG
|
|
6
6
|
import { CheckboxProps } from '@carbon/react/lib/components/Checkbox';
|
7
7
|
import { NumberInputProps } from '@carbon/react/lib/components/NumberInput/NumberInput';
|
8
8
|
import React, { CSSProperties, ComponentType, FunctionComponent, JSXElementConstructor, MutableRefObject, ReactNode, TouchEventHandler } from 'react';
|
9
|
-
import { Cell, Column, ColumnInstance, FilterValue, Filters, HeaderGroup, Meta, Row, TableCommonProps, TableDispatch, TableInstance, TableToggleAllRowsSelectedProps, UseExpandedRowProps, UseFiltersInstanceProps, UsePaginationInstanceProps, UseResizeColumnsColumnProps, UseResizeColumnsOptions, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseSortByOptions, UseTableHooks } from 'react-table';
|
9
|
+
import { Cell, Column, ColumnInstance, FilterValue, Filters, HeaderGroup, Meta, Row, TableCommonProps, TableDispatch, TableInstance, TableState, TableToggleAllRowsSelectedProps, UseExpandedRowProps, UseFiltersInstanceProps, UsePaginationInstanceProps, UseResizeColumnsColumnProps, UseResizeColumnsOptions, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseSortByOptions, UseTableHooks } from 'react-table';
|
10
10
|
import { CarbonIconType } from '@carbon/react/icons';
|
11
11
|
import { IconButton, type ButtonProps } from '@carbon/react';
|
12
12
|
import { TableBatchActionsProps } from '@carbon/react/lib/components/DataTable/TableBatchActions';
|
@@ -129,7 +129,15 @@ export interface DataGridTableProps extends TableCommonProps {
|
|
129
129
|
interface DataGridTableState extends UseResizeColumnsState<any>, UseRowSelectState<any> {
|
130
130
|
filters: Filters<DataGridFilter>;
|
131
131
|
}
|
132
|
-
export interface DataGridTableInstance<T extends object = any> extends TableInstance<T
|
132
|
+
export interface DataGridTableInstance<T extends object = any> extends Omit<TableInstance<T>, 'state'>, Partial<UsePaginationInstanceProps<any>> {
|
133
|
+
shouldDisableSelectRow?: (...args: any[]) => void | boolean;
|
134
|
+
state?: Partial<TableState & UseRowSelectState<any>>;
|
135
|
+
disableSelectAll?: boolean;
|
136
|
+
disableSelectRowsProps?: {
|
137
|
+
labels?: {
|
138
|
+
toggleAllRowsLabel?: string;
|
139
|
+
};
|
140
|
+
};
|
133
141
|
withSelectRows?: boolean;
|
134
142
|
}
|
135
143
|
export interface RowAction {
|
@@ -253,4 +261,8 @@ export interface ResizeHeaderProps {
|
|
253
261
|
}
|
254
262
|
export type VisibleColumns<T extends object = {}> = (allColumns: Array<ColumnInstance<T>>, meta: Meta<T>) => Array<Column<T>>;
|
255
263
|
export type NodeFuncType = (props: any) => ReactNode;
|
264
|
+
export interface PropGetterMeta {
|
265
|
+
instance?: DataGridTableInstance;
|
266
|
+
row?: Partial<Row<any> & DatagridRow<any>>;
|
267
|
+
}
|
256
268
|
export {};
|
@@ -9,52 +9,56 @@ var useDisableSelectRows = function useDisableSelectRows(hooks) {
|
|
9
9
|
updateSelectAll(hooks);
|
10
10
|
updatePageSelectAll(hooks);
|
11
11
|
var getRowProps = function getRowProps(props, _ref) {
|
12
|
+
var _instance$shouldDisab;
|
12
13
|
var row = _ref.row,
|
13
14
|
instance = _ref.instance;
|
14
15
|
return [props, {
|
15
|
-
disabled: instance.shouldDisableSelectRow
|
16
|
+
disabled: instance === null || instance === void 0 || (_instance$shouldDisab = instance.shouldDisableSelectRow) === null || _instance$shouldDisab === void 0 ? void 0 : _instance$shouldDisab.call(instance, row)
|
16
17
|
}];
|
17
18
|
};
|
18
19
|
hooks.getRowProps.push(getRowProps);
|
19
20
|
};
|
20
21
|
var updateSelectAll = function updateSelectAll(hooks) {
|
21
22
|
var getToggleAllRowsSelectedProps = function getToggleAllRowsSelectedProps(props, _ref2) {
|
22
|
-
var _instance$disableSele;
|
23
|
+
var _instance$rows, _instance$disableSele, _instance$state2;
|
23
24
|
var instance = _ref2.instance;
|
24
|
-
var selectableRows = instance.rows.filter(function (row) {
|
25
|
+
var selectableRows = (instance === null || instance === void 0 || (_instance$rows = instance.rows) === null || _instance$rows === void 0 ? void 0 : _instance$rows.filter(function (row) {
|
25
26
|
return !(instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row));
|
26
|
-
});
|
27
|
-
var isAllRowsSelected = selectableRows.length > 0 && selectableRows.every(function (_ref3) {
|
27
|
+
})) || [];
|
28
|
+
var isAllRowsSelected = (selectableRows === null || selectableRows === void 0 ? void 0 : selectableRows.length) > 0 && selectableRows.every(function (_ref3) {
|
29
|
+
var _instance$state;
|
28
30
|
var id = _ref3.id;
|
29
|
-
return instance.state.selectedRowIds[id];
|
31
|
+
return instance === null || instance === void 0 || (_instance$state = instance.state) === null || _instance$state === void 0 || (_instance$state = _instance$state.selectedRowIds) === null || _instance$state === void 0 ? void 0 : _instance$state[id];
|
30
32
|
});
|
31
33
|
return [props, {
|
32
34
|
onChange: function onChange(e) {
|
33
35
|
selectableRows.forEach(function (row) {
|
34
|
-
|
36
|
+
var _toggleRowSelected, _ref4;
|
37
|
+
return row === null || row === void 0 || (_toggleRowSelected = (_ref4 = row).toggleRowSelected) === null || _toggleRowSelected === void 0 ? void 0 : _toggleRowSelected.call(_ref4, e.target.checked);
|
35
38
|
});
|
36
39
|
},
|
37
40
|
style: {
|
38
41
|
cursor: 'pointer'
|
39
42
|
},
|
40
43
|
checked: isAllRowsSelected,
|
41
|
-
disabled: instance.disableSelectAll,
|
44
|
+
disabled: instance === null || instance === void 0 ? void 0 : instance.disableSelectAll,
|
42
45
|
title: (instance === null || instance === void 0 || (_instance$disableSele = instance.disableSelectRowsProps) === null || _instance$disableSele === void 0 || (_instance$disableSele = _instance$disableSele.labels) === null || _instance$disableSele === void 0 ? void 0 : _instance$disableSele.toggleAllRowsLabel) || 'Toggle All Rows Selected',
|
43
|
-
indeterminate: Boolean(!isAllRowsSelected && Object.keys(instance.state.selectedRowIds).length)
|
46
|
+
indeterminate: Boolean(!isAllRowsSelected && Object.keys((instance === null || instance === void 0 || (_instance$state2 = instance.state) === null || _instance$state2 === void 0 ? void 0 : _instance$state2.selectedRowIds) || {}).length)
|
44
47
|
}];
|
45
48
|
};
|
46
49
|
hooks.getToggleAllRowsSelectedProps.push(getToggleAllRowsSelectedProps);
|
47
50
|
};
|
48
51
|
var updatePageSelectAll = function updatePageSelectAll(hooks) {
|
49
|
-
var getToggleAllPageRowsSelectedProps = function getToggleAllPageRowsSelectedProps(props,
|
50
|
-
var _instance$disableSele2;
|
51
|
-
var instance =
|
52
|
-
var selectableRows = instance.page.filter(function (row) {
|
52
|
+
var getToggleAllPageRowsSelectedProps = function getToggleAllPageRowsSelectedProps(props, _ref5) {
|
53
|
+
var _instance$page, _instance$disableSele2, _instance$page2;
|
54
|
+
var instance = _ref5.instance;
|
55
|
+
var selectableRows = (instance === null || instance === void 0 || (_instance$page = instance.page) === null || _instance$page === void 0 ? void 0 : _instance$page.filter(function (row) {
|
53
56
|
return !(instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row));
|
54
|
-
});
|
55
|
-
var isAllRowsSelected = selectableRows.length > 0 && selectableRows.every(function (
|
56
|
-
var
|
57
|
-
|
57
|
+
})) || [];
|
58
|
+
var isAllRowsSelected = (selectableRows === null || selectableRows === void 0 ? void 0 : selectableRows.length) > 0 && selectableRows.every(function (_ref6) {
|
59
|
+
var _instance$state3;
|
60
|
+
var id = _ref6.id;
|
61
|
+
return instance === null || instance === void 0 || (_instance$state3 = instance.state) === null || _instance$state3 === void 0 || (_instance$state3 = _instance$state3.selectedRowIds) === null || _instance$state3 === void 0 ? void 0 : _instance$state3[id];
|
58
62
|
});
|
59
63
|
return [props, {
|
60
64
|
onChange: function onChange(e) {
|
@@ -66,12 +70,13 @@ var updatePageSelectAll = function updatePageSelectAll(hooks) {
|
|
66
70
|
cursor: 'pointer'
|
67
71
|
},
|
68
72
|
checked: isAllRowsSelected,
|
69
|
-
disabled: instance.disableSelectAll,
|
73
|
+
disabled: instance === null || instance === void 0 ? void 0 : instance.disableSelectAll,
|
70
74
|
title: (instance === null || instance === void 0 || (_instance$disableSele2 = instance.disableSelectRowsProps) === null || _instance$disableSele2 === void 0 || (_instance$disableSele2 = _instance$disableSele2.labels) === null || _instance$disableSele2 === void 0 ? void 0 : _instance$disableSele2.toggleAllRowsLabel) || 'Toggle All Rows Selected',
|
71
|
-
indeterminate: Boolean(!isAllRowsSelected && instance.page.some(function (
|
72
|
-
var
|
73
|
-
|
74
|
-
|
75
|
+
indeterminate: Boolean(!isAllRowsSelected && (instance === null || instance === void 0 || (_instance$page2 = instance.page) === null || _instance$page2 === void 0 ? void 0 : _instance$page2.some(function (_ref7) {
|
76
|
+
var _instance$state4;
|
77
|
+
var id = _ref7.id;
|
78
|
+
return instance === null || instance === void 0 || (_instance$state4 = instance.state) === null || _instance$state4 === void 0 || (_instance$state4 = _instance$state4.selectedRowIds) === null || _instance$state4 === void 0 ? void 0 : _instance$state4[id];
|
79
|
+
})))
|
75
80
|
}];
|
76
81
|
};
|
77
82
|
hooks.getToggleAllPageRowsSelectedProps.push(getToggleAllPageRowsSelectedProps);
|
@@ -443,14 +443,11 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
443
443
|
commonEventHandlers.handleKeyPress(event, activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, setSelectionAreas, setSelectionAreaData, setCurrentMatcher, activeCellRef, setActiveCellCoordinates, setContainerHasFocus, setActiveCellContent, readOnlyTable);
|
444
444
|
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, readOnlyTable]);
|
445
445
|
var startEditMode = function startEditMode() {
|
446
|
+
var _activeCellFullData$r;
|
446
447
|
setIsEditing(true);
|
447
448
|
setClickAndHoldActive(false);
|
448
449
|
var activeCellFullData = typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'number' && typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'number' ? rows[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row].cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column] : null;
|
449
|
-
var activeCellValue;
|
450
|
-
if (activeCellFullData && activeCellCoordinates !== null && activeCellCoordinates !== void 0 && activeCellCoordinates.column) {
|
451
|
-
var _activeCellFullData$r;
|
452
|
-
activeCellValue = activeCellFullData ? (_activeCellFullData$r = activeCellFullData.row.cells) === null || _activeCellFullData$r === void 0 || (_activeCellFullData$r = _activeCellFullData$r[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column]) === null || _activeCellFullData$r === void 0 ? void 0 : _activeCellFullData$r.value : null;
|
453
|
-
}
|
450
|
+
var activeCellValue = activeCellFullData === null || activeCellFullData === void 0 || (_activeCellFullData$r = activeCellFullData.row) === null || _activeCellFullData$r === void 0 || (_activeCellFullData$r = _activeCellFullData$r.cells) === null || _activeCellFullData$r === void 0 || (_activeCellFullData$r = _activeCellFullData$r[Number(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column)]) === null || _activeCellFullData$r === void 0 ? void 0 : _activeCellFullData$r.value;
|
454
451
|
setCellEditorValue(activeCellValue || '');
|
455
452
|
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
456
453
|
cellEditorRulerRef.current.textContent = activeCellValue;
|
@@ -6,7 +6,7 @@ import { RadioButtonGroupProps } from '@carbon/react/lib/components/RadioButtonG
|
|
6
6
|
import { CheckboxProps } from '@carbon/react/lib/components/Checkbox';
|
7
7
|
import { NumberInputProps } from '@carbon/react/lib/components/NumberInput/NumberInput';
|
8
8
|
import React, { CSSProperties, ComponentType, FunctionComponent, JSXElementConstructor, MutableRefObject, ReactNode, TouchEventHandler } from 'react';
|
9
|
-
import { Cell, Column, ColumnInstance, FilterValue, Filters, HeaderGroup, Meta, Row, TableCommonProps, TableDispatch, TableInstance, TableToggleAllRowsSelectedProps, UseExpandedRowProps, UseFiltersInstanceProps, UsePaginationInstanceProps, UseResizeColumnsColumnProps, UseResizeColumnsOptions, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseSortByOptions, UseTableHooks } from 'react-table';
|
9
|
+
import { Cell, Column, ColumnInstance, FilterValue, Filters, HeaderGroup, Meta, Row, TableCommonProps, TableDispatch, TableInstance, TableState, TableToggleAllRowsSelectedProps, UseExpandedRowProps, UseFiltersInstanceProps, UsePaginationInstanceProps, UseResizeColumnsColumnProps, UseResizeColumnsOptions, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseSortByOptions, UseTableHooks } from 'react-table';
|
10
10
|
import { CarbonIconType } from '@carbon/react/icons';
|
11
11
|
import { IconButton, type ButtonProps } from '@carbon/react';
|
12
12
|
import { TableBatchActionsProps } from '@carbon/react/lib/components/DataTable/TableBatchActions';
|
@@ -129,7 +129,15 @@ export interface DataGridTableProps extends TableCommonProps {
|
|
129
129
|
interface DataGridTableState extends UseResizeColumnsState<any>, UseRowSelectState<any> {
|
130
130
|
filters: Filters<DataGridFilter>;
|
131
131
|
}
|
132
|
-
export interface DataGridTableInstance<T extends object = any> extends TableInstance<T
|
132
|
+
export interface DataGridTableInstance<T extends object = any> extends Omit<TableInstance<T>, 'state'>, Partial<UsePaginationInstanceProps<any>> {
|
133
|
+
shouldDisableSelectRow?: (...args: any[]) => void | boolean;
|
134
|
+
state?: Partial<TableState & UseRowSelectState<any>>;
|
135
|
+
disableSelectAll?: boolean;
|
136
|
+
disableSelectRowsProps?: {
|
137
|
+
labels?: {
|
138
|
+
toggleAllRowsLabel?: string;
|
139
|
+
};
|
140
|
+
};
|
133
141
|
withSelectRows?: boolean;
|
134
142
|
}
|
135
143
|
export interface RowAction {
|
@@ -253,4 +261,8 @@ export interface ResizeHeaderProps {
|
|
253
261
|
}
|
254
262
|
export type VisibleColumns<T extends object = {}> = (allColumns: Array<ColumnInstance<T>>, meta: Meta<T>) => Array<Column<T>>;
|
255
263
|
export type NodeFuncType = (props: any) => ReactNode;
|
264
|
+
export interface PropGetterMeta {
|
265
|
+
instance?: DataGridTableInstance;
|
266
|
+
row?: Partial<Row<any> & DatagridRow<any>>;
|
267
|
+
}
|
256
268
|
export {};
|
@@ -13,52 +13,56 @@ var useDisableSelectRows = function useDisableSelectRows(hooks) {
|
|
13
13
|
updateSelectAll(hooks);
|
14
14
|
updatePageSelectAll(hooks);
|
15
15
|
var getRowProps = function getRowProps(props, _ref) {
|
16
|
+
var _instance$shouldDisab;
|
16
17
|
var row = _ref.row,
|
17
18
|
instance = _ref.instance;
|
18
19
|
return [props, {
|
19
|
-
disabled: instance.shouldDisableSelectRow
|
20
|
+
disabled: instance === null || instance === void 0 || (_instance$shouldDisab = instance.shouldDisableSelectRow) === null || _instance$shouldDisab === void 0 ? void 0 : _instance$shouldDisab.call(instance, row)
|
20
21
|
}];
|
21
22
|
};
|
22
23
|
hooks.getRowProps.push(getRowProps);
|
23
24
|
};
|
24
25
|
var updateSelectAll = function updateSelectAll(hooks) {
|
25
26
|
var getToggleAllRowsSelectedProps = function getToggleAllRowsSelectedProps(props, _ref2) {
|
26
|
-
var _instance$disableSele;
|
27
|
+
var _instance$rows, _instance$disableSele, _instance$state2;
|
27
28
|
var instance = _ref2.instance;
|
28
|
-
var selectableRows = instance.rows.filter(function (row) {
|
29
|
+
var selectableRows = (instance === null || instance === void 0 || (_instance$rows = instance.rows) === null || _instance$rows === void 0 ? void 0 : _instance$rows.filter(function (row) {
|
29
30
|
return !(instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row));
|
30
|
-
});
|
31
|
-
var isAllRowsSelected = selectableRows.length > 0 && selectableRows.every(function (_ref3) {
|
31
|
+
})) || [];
|
32
|
+
var isAllRowsSelected = (selectableRows === null || selectableRows === void 0 ? void 0 : selectableRows.length) > 0 && selectableRows.every(function (_ref3) {
|
33
|
+
var _instance$state;
|
32
34
|
var id = _ref3.id;
|
33
|
-
return instance.state.selectedRowIds[id];
|
35
|
+
return instance === null || instance === void 0 || (_instance$state = instance.state) === null || _instance$state === void 0 || (_instance$state = _instance$state.selectedRowIds) === null || _instance$state === void 0 ? void 0 : _instance$state[id];
|
34
36
|
});
|
35
37
|
return [props, {
|
36
38
|
onChange: function onChange(e) {
|
37
39
|
selectableRows.forEach(function (row) {
|
38
|
-
|
40
|
+
var _toggleRowSelected, _ref4;
|
41
|
+
return row === null || row === void 0 || (_toggleRowSelected = (_ref4 = row).toggleRowSelected) === null || _toggleRowSelected === void 0 ? void 0 : _toggleRowSelected.call(_ref4, e.target.checked);
|
39
42
|
});
|
40
43
|
},
|
41
44
|
style: {
|
42
45
|
cursor: 'pointer'
|
43
46
|
},
|
44
47
|
checked: isAllRowsSelected,
|
45
|
-
disabled: instance.disableSelectAll,
|
48
|
+
disabled: instance === null || instance === void 0 ? void 0 : instance.disableSelectAll,
|
46
49
|
title: (instance === null || instance === void 0 || (_instance$disableSele = instance.disableSelectRowsProps) === null || _instance$disableSele === void 0 || (_instance$disableSele = _instance$disableSele.labels) === null || _instance$disableSele === void 0 ? void 0 : _instance$disableSele.toggleAllRowsLabel) || 'Toggle All Rows Selected',
|
47
|
-
indeterminate: Boolean(!isAllRowsSelected && Object.keys(instance.state.selectedRowIds).length)
|
50
|
+
indeterminate: Boolean(!isAllRowsSelected && Object.keys((instance === null || instance === void 0 || (_instance$state2 = instance.state) === null || _instance$state2 === void 0 ? void 0 : _instance$state2.selectedRowIds) || {}).length)
|
48
51
|
}];
|
49
52
|
};
|
50
53
|
hooks.getToggleAllRowsSelectedProps.push(getToggleAllRowsSelectedProps);
|
51
54
|
};
|
52
55
|
var updatePageSelectAll = function updatePageSelectAll(hooks) {
|
53
|
-
var getToggleAllPageRowsSelectedProps = function getToggleAllPageRowsSelectedProps(props,
|
54
|
-
var _instance$disableSele2;
|
55
|
-
var instance =
|
56
|
-
var selectableRows = instance.page.filter(function (row) {
|
56
|
+
var getToggleAllPageRowsSelectedProps = function getToggleAllPageRowsSelectedProps(props, _ref5) {
|
57
|
+
var _instance$page, _instance$disableSele2, _instance$page2;
|
58
|
+
var instance = _ref5.instance;
|
59
|
+
var selectableRows = (instance === null || instance === void 0 || (_instance$page = instance.page) === null || _instance$page === void 0 ? void 0 : _instance$page.filter(function (row) {
|
57
60
|
return !(instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row));
|
58
|
-
});
|
59
|
-
var isAllRowsSelected = selectableRows.length > 0 && selectableRows.every(function (
|
60
|
-
var
|
61
|
-
|
61
|
+
})) || [];
|
62
|
+
var isAllRowsSelected = (selectableRows === null || selectableRows === void 0 ? void 0 : selectableRows.length) > 0 && selectableRows.every(function (_ref6) {
|
63
|
+
var _instance$state3;
|
64
|
+
var id = _ref6.id;
|
65
|
+
return instance === null || instance === void 0 || (_instance$state3 = instance.state) === null || _instance$state3 === void 0 || (_instance$state3 = _instance$state3.selectedRowIds) === null || _instance$state3 === void 0 ? void 0 : _instance$state3[id];
|
62
66
|
});
|
63
67
|
return [props, {
|
64
68
|
onChange: function onChange(e) {
|
@@ -70,12 +74,13 @@ var updatePageSelectAll = function updatePageSelectAll(hooks) {
|
|
70
74
|
cursor: 'pointer'
|
71
75
|
},
|
72
76
|
checked: isAllRowsSelected,
|
73
|
-
disabled: instance.disableSelectAll,
|
77
|
+
disabled: instance === null || instance === void 0 ? void 0 : instance.disableSelectAll,
|
74
78
|
title: (instance === null || instance === void 0 || (_instance$disableSele2 = instance.disableSelectRowsProps) === null || _instance$disableSele2 === void 0 || (_instance$disableSele2 = _instance$disableSele2.labels) === null || _instance$disableSele2 === void 0 ? void 0 : _instance$disableSele2.toggleAllRowsLabel) || 'Toggle All Rows Selected',
|
75
|
-
indeterminate: Boolean(!isAllRowsSelected && instance.page.some(function (
|
76
|
-
var
|
77
|
-
|
78
|
-
|
79
|
+
indeterminate: Boolean(!isAllRowsSelected && (instance === null || instance === void 0 || (_instance$page2 = instance.page) === null || _instance$page2 === void 0 ? void 0 : _instance$page2.some(function (_ref7) {
|
80
|
+
var _instance$state4;
|
81
|
+
var id = _ref7.id;
|
82
|
+
return instance === null || instance === void 0 || (_instance$state4 = instance.state) === null || _instance$state4 === void 0 || (_instance$state4 = _instance$state4.selectedRowIds) === null || _instance$state4 === void 0 ? void 0 : _instance$state4[id];
|
83
|
+
})))
|
79
84
|
}];
|
80
85
|
};
|
81
86
|
hooks.getToggleAllPageRowsSelectedProps.push(getToggleAllPageRowsSelectedProps);
|
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.73+8daba150a",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -81,7 +81,7 @@
|
|
81
81
|
"fs-extra": "^11.2.0",
|
82
82
|
"glob": "^10.3.10",
|
83
83
|
"jest": "^29.7.0",
|
84
|
-
"jest-config-ibm-cloud-cognitive": "^1.
|
84
|
+
"jest-config-ibm-cloud-cognitive": "^1.4.0-rc.0",
|
85
85
|
"jest-environment-jsdom": "^29.7.0",
|
86
86
|
"namor": "^1.1.2",
|
87
87
|
"npm-check-updates": "^16.14.12",
|
@@ -96,7 +96,7 @@
|
|
96
96
|
"dependencies": {
|
97
97
|
"@babel/runtime": "^7.23.9",
|
98
98
|
"@carbon/feature-flags": "^0.20.0",
|
99
|
-
"@carbon/ibm-products-styles": "^2.
|
99
|
+
"@carbon/ibm-products-styles": "^2.41.0-rc.0",
|
100
100
|
"@carbon/telemetry": "^0.1.0",
|
101
101
|
"@dnd-kit/core": "^6.0.8",
|
102
102
|
"@dnd-kit/modifiers": "^7.0.0",
|
@@ -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": "8daba150a8cd5b2288057a32b53a2c8b9789a45f"
|
124
124
|
}
|