@carbon/ibm-products 2.44.0 → 2.45.0-rc.1
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/css/index-full-carbon.css +118 -15
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +203 -5
- 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 +118 -15
- 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 +118 -15
- 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/Coachmark/Coachmark.js +12 -7
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
- package/es/components/CoachmarkStack/CoachmarkStack.js +7 -3
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +35 -22
- package/es/components/ConditionBuilder/ConditionBuilder.js +17 -7
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +58 -36
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +23 -11
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +8 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +17 -9
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +29 -16
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +23 -20
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +49 -23
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +12 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +9 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +10 -5
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +19 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +70 -17
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +31 -14
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +120 -28
- package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/useTranslations.js +26 -0
- package/es/components/ConditionBuilder/utils/util.js +1 -9
- package/es/components/CreateFullPage/CreateFullPage.js +2 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +27 -12
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
- package/es/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/es/components/Datagrid/Datagrid/Datagrid.js +2 -8
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
- package/es/components/Datagrid/Datagrid/DatagridRow.js +8 -6
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
- package/es/components/Datagrid/types/index.d.ts +28 -6
- package/es/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/es/components/Datagrid/useCustomizeColumns.js +4 -3
- package/es/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/es/components/Datagrid/useNestedRowExpander.js +1 -3
- package/es/components/Datagrid/useRowExpander.js +1 -3
- package/es/components/Datagrid/useSelectRows.js +2 -1
- package/es/components/Datagrid/useStickyColumn.d.ts +8 -1
- package/es/components/Datagrid/useStickyColumn.js +12 -9
- package/es/components/EditInPlace/EditInPlace.d.ts +4 -0
- package/es/components/EditInPlace/EditInPlace.js +21 -10
- package/es/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/es/components/EditTearsheet/EditTearsheet.js +44 -9
- package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/es/components/Nav/NavItem.js +12 -3
- package/es/components/OptionsTile/OptionsTile.js +11 -6
- package/es/components/PageHeader/PageHeader.js +1 -0
- package/es/components/SearchBar/SearchBar.d.ts +1 -1
- package/es/components/SearchBar/SearchBar.js +2 -2
- package/es/components/SidePanel/SidePanel.js +17 -21
- package/es/components/SidePanel/motion/variants.d.ts +4 -6
- package/es/components/SidePanel/motion/variants.js +10 -11
- package/es/components/Tearsheet/TearsheetShell.js +3 -1
- package/es/components/WebTerminal/WebTerminal.js +10 -12
- package/es/global/js/hooks/usePrefersReducedMotion.js +14 -8
- package/es/global/js/package-settings.d.ts +1 -1
- package/es/global/js/package-settings.js +1 -1
- package/es/settings.d.ts +1 -1
- package/lib/components/Coachmark/Coachmark.js +12 -7
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
- package/lib/components/CoachmarkStack/CoachmarkStack.js +7 -3
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +34 -21
- package/lib/components/ConditionBuilder/ConditionBuilder.js +17 -7
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +56 -33
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +22 -10
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -3
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +6 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +16 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +28 -15
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +22 -20
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +48 -22
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +11 -8
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +8 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -4
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +18 -6
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +68 -15
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +30 -13
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +119 -27
- package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/useTranslations.js +30 -0
- package/lib/components/ConditionBuilder/utils/util.js +0 -9
- package/lib/components/CreateFullPage/CreateFullPage.js +2 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +27 -12
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
- package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -8
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +8 -6
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
- package/lib/components/Datagrid/types/index.d.ts +28 -6
- package/lib/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/lib/components/Datagrid/useCustomizeColumns.js +4 -3
- package/lib/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/lib/components/Datagrid/useNestedRowExpander.js +1 -3
- package/lib/components/Datagrid/useRowExpander.js +1 -3
- package/lib/components/Datagrid/useSelectRows.js +2 -1
- package/lib/components/Datagrid/useStickyColumn.d.ts +8 -1
- package/lib/components/Datagrid/useStickyColumn.js +12 -9
- package/lib/components/EditInPlace/EditInPlace.d.ts +4 -0
- package/lib/components/EditInPlace/EditInPlace.js +21 -10
- package/lib/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/lib/components/EditTearsheet/EditTearsheet.js +43 -8
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/lib/components/Nav/NavItem.js +10 -1
- package/lib/components/OptionsTile/OptionsTile.js +11 -6
- package/lib/components/PageHeader/PageHeader.js +1 -0
- package/lib/components/SearchBar/SearchBar.d.ts +1 -1
- package/lib/components/SearchBar/SearchBar.js +2 -2
- package/lib/components/SidePanel/SidePanel.js +16 -20
- package/lib/components/SidePanel/motion/variants.d.ts +4 -6
- package/lib/components/SidePanel/motion/variants.js +10 -11
- package/lib/components/Tearsheet/TearsheetShell.js +3 -1
- package/lib/components/WebTerminal/WebTerminal.js +10 -12
- package/lib/global/js/hooks/usePrefersReducedMotion.js +13 -7
- package/lib/global/js/package-settings.d.ts +1 -1
- package/lib/global/js/package-settings.js +1 -1
- package/lib/settings.d.ts +1 -1
- package/package.json +4 -4
- package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +8 -4
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +9 -2
- package/scss/components/Datagrid/_datagrid.scss +0 -4
- package/scss/components/HTTPErrors/_http-errors.scss +77 -0
- package/scss/components/OptionsTile/_options-tile.scss +6 -6
- package/scss/components/SidePanel/_side-panel.scss +1 -1
- package/scss/components/_index-released-only.scss +1 -0
- package/telemetry.yml +12 -2
- package/es/global/js/utils/window.d.ts +0 -2
- package/es/global/js/utils/window.js +0 -12
- package/lib/global/js/utils/window.d.ts +0 -2
- package/lib/global/js/utils/window.js +0 -16
@@ -32,7 +32,7 @@ import { useSpreadsheetOutsideClick } from './hooks/useSpreadsheetOutsideClick.j
|
|
32
32
|
import { useMoveActiveCell } from './hooks/useMoveActiveCell.js';
|
33
33
|
import { useSpreadsheetEdit } from './hooks/useSpreadsheetEdit.js';
|
34
34
|
|
35
|
-
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "renderRowHeader", "renderRowHeaderDirection", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
35
|
+
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "renderRowHeader", "renderRowHeaderDirection", "disableColumnSwapping", "readOnlyTable", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
36
36
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
37
37
|
var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
|
38
38
|
var componentName = 'DataSpreadsheet';
|
@@ -69,6 +69,10 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
69
69
|
onSelectionAreaChange = _ref$onSelectionAreaC === void 0 ? defaults.onSelectionAreaChange : _ref$onSelectionAreaC,
|
70
70
|
renderRowHeader = _ref.renderRowHeader,
|
71
71
|
renderRowHeaderDirection = _ref.renderRowHeaderDirection,
|
72
|
+
_ref$disableColumnSwa = _ref.disableColumnSwapping,
|
73
|
+
disableColumnSwapping = _ref$disableColumnSwa === void 0 ? false : _ref$disableColumnSwa,
|
74
|
+
_ref$readOnlyTable = _ref.readOnlyTable,
|
75
|
+
readOnlyTable = _ref$readOnlyTable === void 0 ? false : _ref$readOnlyTable,
|
72
76
|
selectAllAriaLabel = _ref.selectAllAriaLabel,
|
73
77
|
spreadsheetAriaLabel = _ref.spreadsheetAriaLabel,
|
74
78
|
theme = _ref.theme,
|
@@ -427,17 +431,14 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
427
431
|
}
|
428
432
|
}, [handleInitialArrowPress, updateActiveCellCoordinates, activeCellCoordinates, columns, rows]);
|
429
433
|
var handleKeyPressEvent = useCallback(function (event) {
|
430
|
-
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);
|
431
|
-
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress]);
|
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
|
+
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, readOnlyTable]);
|
432
436
|
var startEditMode = function startEditMode() {
|
437
|
+
var _activeCellFullData$r;
|
433
438
|
setIsEditing(true);
|
434
439
|
setClickAndHoldActive(false);
|
435
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;
|
436
|
-
var activeCellValue;
|
437
|
-
if (activeCellFullData && activeCellCoordinates !== null && activeCellCoordinates !== void 0 && activeCellCoordinates.column) {
|
438
|
-
var _activeCellFullData$r;
|
439
|
-
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;
|
440
|
-
}
|
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;
|
441
442
|
setCellEditorValue(activeCellValue || '');
|
442
443
|
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
443
444
|
cellEditorRulerRef.current.textContent = activeCellValue;
|
@@ -499,7 +500,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
499
500
|
// Go into edit mode if 'Enter' key is pressed on activeCellRef
|
500
501
|
var handleActiveCellKeyDown = function handleActiveCellKeyDown(event) {
|
501
502
|
var key = event.key;
|
502
|
-
if (key === 'Enter' && !activeCellInsideSelectionArea) {
|
503
|
+
if (key === 'Enter' && !activeCellInsideSelectionArea && !readOnlyTable) {
|
503
504
|
if ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) !== 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) !== 'header') {
|
504
505
|
startEditMode();
|
505
506
|
}
|
@@ -555,8 +556,10 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
555
556
|
};
|
556
557
|
|
557
558
|
// Go into edit mode if double click is detected on activeCellRef
|
558
|
-
var handleActiveCellDoubleClick = function handleActiveCellDoubleClick() {
|
559
|
-
|
559
|
+
var handleActiveCellDoubleClick = function handleActiveCellDoubleClick(readOnlyTable) {
|
560
|
+
if (!readOnlyTable) {
|
561
|
+
startEditMode();
|
562
|
+
}
|
560
563
|
};
|
561
564
|
useSpreadsheetEdit({
|
562
565
|
isEditing: isEditing,
|
@@ -636,6 +639,8 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
636
639
|
setSelectionAreas: setSelectionAreas,
|
637
640
|
setCurrentMatcher: setCurrentMatcher,
|
638
641
|
setSelectionAreaData: setSelectionAreaData,
|
642
|
+
disableColumnSwapping: disableColumnSwapping,
|
643
|
+
readOnlyTable: readOnlyTable,
|
639
644
|
totalVisibleColumns: totalVisibleColumns,
|
640
645
|
updateActiveCellCoordinates: updateActiveCellCoordinates,
|
641
646
|
setHeaderCellHoldActive: setHeaderCellHoldActive,
|
@@ -684,7 +689,9 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
684
689
|
onMouseUp: handleActiveCellMouseUp,
|
685
690
|
onClick: handleActiveCellClick,
|
686
691
|
onKeyDown: handleActiveCellKeyDown,
|
687
|
-
onDoubleClick:
|
692
|
+
onDoubleClick: function onDoubleClick() {
|
693
|
+
return handleActiveCellDoubleClick(readOnlyTable);
|
694
|
+
},
|
688
695
|
onMouseEnter: handleActiveCellMouseEnter,
|
689
696
|
ref: activeCellRef,
|
690
697
|
className: cx("".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__active-cell--highlight"), _defineProperty({}, "".concat(blockClass, "__active-cell--with-selection"), activeCellInsideSelectionArea)),
|
@@ -760,6 +767,10 @@ DataSpreadsheet.propTypes = {
|
|
760
767
|
* Sets the number of empty rows to be created when there is no data provided
|
761
768
|
*/
|
762
769
|
defaultEmptyRowCount: PropTypes.number,
|
770
|
+
/**
|
771
|
+
* Disable column swapping, default false
|
772
|
+
*/
|
773
|
+
disableColumnSwapping: PropTypes.bool,
|
763
774
|
/**
|
764
775
|
* Check if spreadsheet is using custom row header component attached
|
765
776
|
*/
|
@@ -780,6 +791,10 @@ DataSpreadsheet.propTypes = {
|
|
780
791
|
* The event handler that is called when the selection area values change
|
781
792
|
*/
|
782
793
|
onSelectionAreaChange: PropTypes.func,
|
794
|
+
/**
|
795
|
+
* Read-only table
|
796
|
+
*/
|
797
|
+
readOnlyTable: PropTypes.bool,
|
783
798
|
/**
|
784
799
|
* Component next to numbering rows
|
785
800
|
*/
|
@@ -16,6 +16,10 @@ interface DataSpreadsheetHeaderProps {
|
|
16
16
|
* Specifies the cell height
|
17
17
|
*/
|
18
18
|
cellSize?: Size;
|
19
|
+
/**
|
20
|
+
* Disable column swapping, default false
|
21
|
+
*/
|
22
|
+
disableColumnSwapping?: boolean;
|
19
23
|
/**
|
20
24
|
* All of the spreadsheet columns
|
21
25
|
*/
|
@@ -36,6 +40,10 @@ interface DataSpreadsheetHeaderProps {
|
|
36
40
|
* Headers provided from useTable hook
|
37
41
|
*/
|
38
42
|
headerGroups?: any[];
|
43
|
+
/**
|
44
|
+
* Read-only table
|
45
|
+
*/
|
46
|
+
readOnlyTable?: boolean;
|
39
47
|
/**
|
40
48
|
* All of the spreadsheet row data
|
41
49
|
*/
|
@@ -36,6 +36,8 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
36
36
|
setActiveCellCoordinates = _ref.setActiveCellCoordinates,
|
37
37
|
setCurrentMatcher = _ref.setCurrentMatcher,
|
38
38
|
setSelectionAreas = _ref.setSelectionAreas,
|
39
|
+
readOnlyTable = _ref.readOnlyTable,
|
40
|
+
disableColumnSwapping = _ref.disableColumnSwapping,
|
39
41
|
setSelectionAreaData = _ref.setSelectionAreaData,
|
40
42
|
rows = _ref.rows,
|
41
43
|
totalVisibleColumns = _ref.totalVisibleColumns,
|
@@ -194,8 +196,8 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
194
196
|
"data-row-index": "header",
|
195
197
|
"data-column-index": index,
|
196
198
|
tabIndex: -1,
|
197
|
-
onMouseDown: selectedHeader ? handleHeaderMouseDown(index) : undefined,
|
198
|
-
onMouseUp: selectedHeader && typeof setSelectedHeaderReorderActive === 'function' ? function () {
|
199
|
+
onMouseDown: selectedHeader && !readOnlyTable && !disableColumnSwapping ? handleHeaderMouseDown(index) : undefined,
|
200
|
+
onMouseUp: selectedHeader && !readOnlyTable && !disableColumnSwapping && typeof setSelectedHeaderReorderActive === 'function' ? function () {
|
199
201
|
return setSelectedHeaderReorderActive(false);
|
200
202
|
} : undefined,
|
201
203
|
onClick: !selectedHeader ? handleColumnHeaderClick(index) : undefined,
|
@@ -203,7 +205,7 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
203
205
|
height: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight,
|
204
206
|
width: (column === null || column === void 0 ? void 0 : column.width) || (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.width)
|
205
207
|
},
|
206
|
-
className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === index || checkActiveHeaderCell(index, selectionAreas, 'column')), "".concat(blockClass, "__th--selected-header"), selectedHeader), "".concat(blockClass, "__th--selected-header-reorder-active"), selectedHeaderReorderActive)),
|
208
|
+
className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === index || checkActiveHeaderCell(index, selectionAreas, 'column')), "".concat(blockClass, "__th--active-header-disabledSwapping"), disableColumnSwapping || readOnlyTable), "".concat(blockClass, "__th--selected-header"), selectedHeader), "".concat(blockClass, "__th--selected-header-reorder-active"), selectedHeaderReorderActive)),
|
207
209
|
type: "button"
|
208
210
|
}, column.render('Header')));
|
209
211
|
}));
|
@@ -239,6 +241,10 @@ DataSpreadsheetHeader.propTypes = {
|
|
239
241
|
rowHeaderWidth: PropTypes.number,
|
240
242
|
width: PropTypes.number
|
241
243
|
}),
|
244
|
+
/**
|
245
|
+
* Disable column swapping, default false
|
246
|
+
*/
|
247
|
+
disableColumnSwapping: PropTypes.bool,
|
242
248
|
/**
|
243
249
|
* Whether or not a click/hold is active on a header cell
|
244
250
|
*/
|
@@ -247,6 +253,10 @@ DataSpreadsheetHeader.propTypes = {
|
|
247
253
|
* Headers provided from useTable hook
|
248
254
|
*/
|
249
255
|
headerGroups: PropTypes.arrayOf(PropTypes.object),
|
256
|
+
/**
|
257
|
+
* Read-only table
|
258
|
+
*/
|
259
|
+
readOnlyTable: PropTypes.bool,
|
250
260
|
/**
|
251
261
|
* All of the spreadsheet row data
|
252
262
|
*/
|
@@ -16,10 +16,6 @@ export interface DatagridProps {
|
|
16
16
|
* The data grid state, much of it being supplied by the useDatagrid hook
|
17
17
|
*/
|
18
18
|
datagridState: DataGridState;
|
19
|
-
/**
|
20
|
-
* Table title
|
21
|
-
*/
|
22
|
-
title?: string;
|
23
19
|
}
|
24
20
|
/**
|
25
21
|
* The `Datagrid` component is an extension of Carbon's DataTable component. At the most basic level, the `Datagrid` component takes in columns and rows and renders a data table. There is a set of data table extensions which this component provides support for, these can be found [here](https://pages.github.ibm.com/cdai-design/pal/components/data-table/overview/). This component is data driven and allows you to choose what pieces will be included based on the hooks/plugins that are provided.
|
@@ -16,7 +16,7 @@ import { DatagridContent } from './DatagridContent.js';
|
|
16
16
|
import { FilterProvider } from './addons/Filtering/FilterProvider.js';
|
17
17
|
import { InlineEditProvider } from './addons/InlineEdit/InlineEditContext/InlineEditContext.js';
|
18
18
|
|
19
|
-
var _excluded = ["datagridState", "
|
19
|
+
var _excluded = ["datagridState", "ariaToolbarLabel"];
|
20
20
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
21
21
|
var componentName = 'Datagrid';
|
22
22
|
/**
|
@@ -24,7 +24,6 @@ var componentName = 'Datagrid';
|
|
24
24
|
*/
|
25
25
|
var Datagrid = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
26
26
|
var datagridState = _ref.datagridState,
|
27
|
-
title = _ref.title,
|
28
27
|
ariaToolbarLabel = _ref.ariaToolbarLabel,
|
29
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
30
29
|
if (!datagridState) {
|
@@ -40,7 +39,6 @@ var Datagrid = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
40
39
|
state = datagridState.state;
|
41
40
|
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
42
41
|
var props = {
|
43
|
-
title: title,
|
44
42
|
datagridState: datagridState,
|
45
43
|
ariaToolbarLabel: ariaToolbarLabel
|
46
44
|
};
|
@@ -73,11 +71,7 @@ Datagrid.propTypes = {
|
|
73
71
|
* The data grid state, much of it being supplied by the useDatagrid hook
|
74
72
|
*/
|
75
73
|
/**@ts-ignore */
|
76
|
-
datagridState: PropTypes.object.isRequired
|
77
|
-
/**
|
78
|
-
* Table title
|
79
|
-
*/
|
80
|
-
title: PropTypes.string
|
74
|
+
datagridState: PropTypes.object.isRequired
|
81
75
|
};
|
82
76
|
|
83
77
|
export { Datagrid };
|
@@ -23,10 +23,8 @@ var _excluded = ["className"],
|
|
23
23
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
24
24
|
var getAccessibilityProps = function getAccessibilityProps(header) {
|
25
25
|
var props = {};
|
26
|
-
var
|
27
|
-
if (
|
28
|
-
props.title = title;
|
29
|
-
} else {
|
26
|
+
var content = getNodeTextContent(header.Header);
|
27
|
+
if (!content) {
|
30
28
|
props['aria-hidden'] = true;
|
31
29
|
}
|
32
30
|
return props;
|
@@ -82,6 +80,7 @@ var ResizeHeader = function ResizeHeader(_ref) {
|
|
82
80
|
"aria-label": resizerAriaLabel || 'Resize column',
|
83
81
|
disabled: isFetching
|
84
82
|
})), /*#__PURE__*/React__default.createElement("span", {
|
83
|
+
role: "separator",
|
85
84
|
className: "".concat(blockClass, "__col-resize-indicator")
|
86
85
|
}));
|
87
86
|
};
|
@@ -136,7 +135,9 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
136
135
|
}
|
137
136
|
onMouseDown === null || onMouseDown === void 0 || onMouseDown(event);
|
138
137
|
};
|
139
|
-
var _headerGroup$getHeade = headerGroup.getHeaderGroupProps(
|
138
|
+
var _headerGroup$getHeade = headerGroup.getHeaderGroupProps({
|
139
|
+
role: undefined
|
140
|
+
}),
|
140
141
|
headerGroupClassName = _headerGroup$getHeade.className,
|
141
142
|
headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded);
|
142
143
|
var renderSlug = function renderSlug(slug) {
|
@@ -185,9 +186,13 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
185
186
|
var _ref5 = columnResizing || {},
|
186
187
|
columnWidths = _ref5.columnWidths;
|
187
188
|
var originalCol = visibleColumns[index];
|
188
|
-
var _header$getHeaderProp = header.getHeaderProps(
|
189
|
+
var _header$getHeaderProp = header.getHeaderProps({
|
190
|
+
role: undefined
|
191
|
+
}),
|
189
192
|
headerProps = _extends({}, (_objectDestructuringEmpty(_header$getHeaderProp), _header$getHeaderProp));
|
190
|
-
var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header
|
193
|
+
var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header, {
|
194
|
+
role: undefined
|
195
|
+
});
|
191
196
|
var headerStyle = headerProps === null || headerProps === void 0 ? void 0 : headerProps.style;
|
192
197
|
var lastVisibleIndex = withActionsColumn ? 2 : 1;
|
193
198
|
var lastVisibleFlexStyle = index === visibleColumns.length - lastVisibleIndex ? '1 1 0' : '0 0 auto';
|
@@ -108,7 +108,9 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
108
108
|
}
|
109
109
|
return {};
|
110
110
|
};
|
111
|
-
var _row$getRowProps = row.getRowProps(
|
111
|
+
var _row$getRowProps = row.getRowProps({
|
112
|
+
role: undefined
|
113
|
+
}),
|
112
114
|
className = _row$getRowProps.className,
|
113
115
|
rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
|
114
116
|
var foundAIRow = rows.some(function (r) {
|
@@ -136,8 +138,10 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
136
138
|
})) : /*#__PURE__*/React__default.createElement("td", {
|
137
139
|
className: "".concat(blockClass, "__table-row-ai-spacer")
|
138
140
|
}) : null, row.cells.map(function (cell, index) {
|
139
|
-
var _cell$column, _cell$column2,
|
140
|
-
var cellProps = cell.getCellProps(
|
141
|
+
var _cell$column, _cell$column2, _associatedHeader$;
|
142
|
+
var cellProps = cell.getCellProps({
|
143
|
+
role: undefined
|
144
|
+
});
|
141
145
|
// eslint-disable-next-line no-unused-vars
|
142
146
|
var _ref2 = cellProps,
|
143
147
|
style = _ref2.style,
|
@@ -151,7 +155,6 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
151
155
|
key: cell.column.id
|
152
156
|
});
|
153
157
|
}
|
154
|
-
var title = content === null || content === void 0 || (_content$props = content.props) === null || _content$props === void 0 || (_content$props = _content$props.children[0]) === null || _content$props === void 0 || (_content$props = _content$props.props) === null || _content$props === void 0 ? void 0 : _content$props.value;
|
155
158
|
var associatedHeader = headers === null || headers === void 0 ? void 0 : headers.filter(function (h) {
|
156
159
|
return h.id === cell.column.id;
|
157
160
|
});
|
@@ -164,8 +167,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
164
167
|
className: cx("".concat(blockClass, "__cell"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__expandable-row-cell"), row.canExpand && index === 0), "".concat(blockClass, "__expandable-row-cell--is-expanded"), row.isExpanded && index === 0), "".concat(blockClass, "__slug--cell"), associatedHeader && associatedHeader.length && /*#__PURE__*/isValidElement((_associatedHeader$ = associatedHeader[0]) === null || _associatedHeader$ === void 0 ? void 0 : _associatedHeader$.slug)), columnClassname)
|
165
168
|
}, restProps, {
|
166
169
|
style: style,
|
167
|
-
key: cell.column.id
|
168
|
-
title: title
|
170
|
+
key: cell.column.id
|
169
171
|
}), content);
|
170
172
|
})), (renderExpandedRow === null || renderExpandedRow === void 0 ? void 0 : renderExpandedRow()) || undefined);
|
171
173
|
};
|
@@ -16,11 +16,12 @@ var _excluded = ["onChange"];
|
|
16
16
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
17
17
|
var SelectAll = function SelectAll(datagridState) {
|
18
18
|
var _columns$;
|
19
|
-
var _useState = useState(
|
19
|
+
var _useState = useState(),
|
20
20
|
_useState2 = _slicedToArray(_useState, 2),
|
21
21
|
windowSize = _useState2[0],
|
22
22
|
setWindowSize = _useState2[1];
|
23
23
|
useLayoutEffect(function () {
|
24
|
+
setWindowSize(window.innerWidth);
|
24
25
|
/* istanbul ignore next */
|
25
26
|
function updateSize() {
|
26
27
|
setWindowSize(window.innerWidth);
|
@@ -43,11 +43,12 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
|
|
43
43
|
onSelectAllRows(isAllRowsSelected && selectAllMode === SELECT_ALL_ROWS);
|
44
44
|
}
|
45
45
|
}, [isAllRowsSelected, selectAllMode, onSelectAllRows]);
|
46
|
-
var _useState3 = useState(
|
46
|
+
var _useState3 = useState(),
|
47
47
|
_useState4 = _slicedToArray(_useState3, 2),
|
48
48
|
windowSize = _useState4[0],
|
49
49
|
setWindowSize = _useState4[1];
|
50
50
|
useLayoutEffect(function () {
|
51
|
+
setWindowSize(window.innerWidth);
|
51
52
|
function updateSize() {
|
52
53
|
setWindowSize(window.innerWidth);
|
53
54
|
}
|
@@ -68,7 +69,7 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
|
|
68
69
|
var isFirstColumnStickyLeft = (columns === null || columns === void 0 || (_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
|
69
70
|
return /*#__PURE__*/React__default.createElement("th", {
|
70
71
|
scope: "col",
|
71
|
-
className: cx("".concat(blockClass, "__select-all-toggle-on"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), isFirstColumnStickyLeft && windowSize > 671))
|
72
|
+
className: cx("".concat(blockClass, "__select-all-toggle-on"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), isFirstColumnStickyLeft && (windowSize !== null && windowSize !== void 0 ? windowSize : 0) > 671))
|
72
73
|
}, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(Checkbox, _extends({}, selectProps, {
|
73
74
|
name: "".concat(tableId, "-select-all-checkbox-name"),
|
74
75
|
onClick: function onClick(e) {
|
@@ -62,7 +62,7 @@ var clearSingleFilter = function clearSingleFilter(_ref, setAllFilters, state) {
|
|
62
62
|
This checks if all the checkboxes are selected = false and removes it from the array
|
63
63
|
*/
|
64
64
|
var valueIndex = filterValues.findIndex(function (val) {
|
65
|
-
return val.
|
65
|
+
return val.value === value;
|
66
66
|
});
|
67
67
|
filterValues[valueIndex].selected = false;
|
68
68
|
var updatedFilterObject = _objectSpread2(_objectSpread2({}, f), {}, {
|
package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js
CHANGED
@@ -27,8 +27,7 @@ var InlineEditButton = function InlineEditButton(_ref) {
|
|
27
27
|
tabIndex: isActiveCell ? 0 : -1,
|
28
28
|
"data-disabled": disabledCell,
|
29
29
|
"aria-disabled": disabledCell,
|
30
|
-
role: "button"
|
31
|
-
title: label
|
30
|
+
role: "button"
|
32
31
|
}, LabelIcon && /*#__PURE__*/React__default.createElement("div", {
|
33
32
|
className: "".concat(blockClass, "__label-icon")
|
34
33
|
}, /*#__PURE__*/React__default.createElement(LabelIcon, null)), label !== '' ? /*#__PURE__*/React__default.createElement("span", {
|
@@ -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, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseSortByOptions, UseTableHooks } from 'react-table';
|
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';
|
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';
|
@@ -59,6 +59,18 @@ interface Labels {
|
|
59
59
|
allPageRows?: object;
|
60
60
|
allRows?: object;
|
61
61
|
}
|
62
|
+
interface ColumnLabels {
|
63
|
+
findColumnPlaceholderLabel?: string;
|
64
|
+
resetToDefaultLabel?: string;
|
65
|
+
customizeTearsheetHeadingLabel?: string;
|
66
|
+
primaryButtonTextLabel?: string;
|
67
|
+
secondaryButtonTextLabel?: string;
|
68
|
+
instructionsLabel?: string;
|
69
|
+
iconTooltipLabel?: string;
|
70
|
+
assistiveTextInstructionsLabel?: string;
|
71
|
+
assistiveTextDisabledInstructionsLabel?: string;
|
72
|
+
selectAllLabel?: string;
|
73
|
+
}
|
62
74
|
interface Section {
|
63
75
|
categoryTitle?: string;
|
64
76
|
filters?: DataGridFilter[];
|
@@ -85,7 +97,7 @@ export interface DataGridToggleAllRowsProps extends TableToggleAllRowsSelectedPr
|
|
85
97
|
}
|
86
98
|
export interface DatagridTableHooks<T extends object = any> extends UseTableHooks<T> {
|
87
99
|
}
|
88
|
-
export interface DatagridColumn<T extends object = any> extends ColumnInstance<T>, UseSortByOptions<T> {
|
100
|
+
export interface DatagridColumn<T extends object = any> extends ColumnInstance<T>, UseSortByOptions<T>, Partial<UseResizeColumnsColumnProps<T>>, UseResizeColumnsOptions<T> {
|
89
101
|
sticky?: 'left' | 'right';
|
90
102
|
className?: string;
|
91
103
|
rightAlignedColumn?: boolean;
|
@@ -112,15 +124,13 @@ export interface DataGridHeader<T extends object = any> extends ColumnInstance,
|
|
112
124
|
}
|
113
125
|
export interface DataGridHeaderGroup<T extends object = any> extends HeaderGroup<T>, UseResizeColumnsColumnProps<T> {
|
114
126
|
}
|
115
|
-
export interface
|
116
|
-
className?: string;
|
117
|
-
role?: string;
|
118
|
-
style?: CSSStyleDeclaration;
|
127
|
+
export interface DataGridTableProps extends TableCommonProps {
|
119
128
|
}
|
120
129
|
interface DataGridTableState extends UseResizeColumnsState<any>, UseRowSelectState<any> {
|
121
130
|
filters: Filters<DataGridFilter>;
|
122
131
|
}
|
123
132
|
export interface DataGridTableInstance<T extends object = any> extends TableInstance<T> {
|
133
|
+
withSelectRows?: boolean;
|
124
134
|
}
|
125
135
|
export interface RowAction {
|
126
136
|
id?: string;
|
@@ -210,11 +220,23 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
|
|
210
220
|
expandedRowIds?: object;
|
211
221
|
onRowClick?: (row: any, event: any) => void;
|
212
222
|
onSort?: boolean;
|
223
|
+
customizeColumnsProps?: {
|
224
|
+
onSaveColumnPrefs?: (args: any) => void;
|
225
|
+
labels?: ColumnLabels;
|
226
|
+
isTearsheetOpen?: boolean;
|
227
|
+
setIsTearsheetOpen?: (args: boolean) => void;
|
228
|
+
};
|
229
|
+
CustomizeColumnsButton?: (args: any) => ReactNode;
|
213
230
|
column?: DatagridColumn;
|
214
231
|
expandedContentHeight?: number;
|
215
232
|
onRowExpand?: (row: DatagridRow, event: React.MouseEvent<HTMLElement>) => void;
|
216
233
|
ExpandedRowContentComponent?: JSXElementConstructor<any>;
|
217
234
|
}
|
235
|
+
export interface DataGridData {
|
236
|
+
instance?: DataGridTableInstance;
|
237
|
+
column?: DatagridColumn;
|
238
|
+
cell?: DataGridCell;
|
239
|
+
}
|
218
240
|
export interface ResizeHeaderProps {
|
219
241
|
resizerProps?: ResizerProps;
|
220
242
|
header: DataGridHeader;
|
@@ -1,2 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2021, 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 useCustomizeColumns: (hooks: Hooks) => void;
|
1
9
|
export default useCustomizeColumns;
|
2
|
-
declare function useCustomizeColumns(hooks: any): void;
|
@@ -16,9 +16,10 @@ var useCustomizeColumns = function useCustomizeColumns(hooks) {
|
|
16
16
|
isTearsheetOpen = _React$useState2[0],
|
17
17
|
setIsTearsheetOpen = _React$useState2[1];
|
18
18
|
hooks.useInstance.push(function (instance) {
|
19
|
-
var
|
20
|
-
|
21
|
-
|
19
|
+
var _ref = instance,
|
20
|
+
customizeColumnsProps = _ref.customizeColumnsProps;
|
21
|
+
var _ref2 = customizeColumnsProps || {},
|
22
|
+
labels = _ref2.labels;
|
22
23
|
Object.assign(instance, {
|
23
24
|
customizeColumnsProps: _objectSpread2(_objectSpread2({}, customizeColumnsProps), {}, {
|
24
25
|
isTearsheetOpen: isTearsheetOpen,
|
@@ -21,7 +21,6 @@ var useDefaultStringRenderer = function useDefaultStringRenderer(hooks) {
|
|
21
21
|
var HeaderRenderer = function HeaderRenderer(header, slug) {
|
22
22
|
return /*#__PURE__*/React__default.createElement("div", {
|
23
23
|
className: cx("".concat(blockClass, "__defaultStringRenderer"), _defineProperty({}, "".concat(blockClass, "__defaultStringRenderer--slug"), slug && /*#__PURE__*/React__default.isValidElement(slug))),
|
24
|
-
title: typeof header === 'string' ? header : '',
|
25
24
|
key: typeof header === 'string' ? header : ''
|
26
25
|
}, header);
|
27
26
|
};
|
@@ -48,9 +48,7 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
48
48
|
type: "button",
|
49
49
|
"aria-label": expanderTitle,
|
50
50
|
className: cx("".concat(blockClass, "__row-expander"), "".concat(carbon.prefix, "--btn"), "".concat(carbon.prefix, "--btn--ghost"))
|
51
|
-
}, expanderButtonProps, {
|
52
|
-
title: expanderTitle
|
53
|
-
}), /*#__PURE__*/React__default.createElement(ChevronRight, {
|
51
|
+
}, expanderButtonProps), /*#__PURE__*/React__default.createElement(ChevronRight, {
|
54
52
|
className: cx("".concat(blockClass, "__expander-icon"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__expander-icon--not-open"), !row.isExpanded), "".concat(blockClass, "__expander-icon--open"), row.isExpanded))
|
55
53
|
}));
|
56
54
|
},
|
@@ -50,9 +50,7 @@ var useRowExpander = function useRowExpander(hooks) {
|
|
50
50
|
type: "button",
|
51
51
|
"aria-label": expanderTitle,
|
52
52
|
className: cx("".concat(blockClass, "__row-expander"), "".concat(carbon.prefix, "--btn"), "".concat(carbon.prefix, "--btn--ghost"))
|
53
|
-
}, expanderButtonProps, {
|
54
|
-
title: expanderTitle
|
55
|
-
}), row.isExpanded ? /*#__PURE__*/React__default.createElement(ChevronUp, {
|
53
|
+
}, expanderButtonProps), row.isExpanded ? /*#__PURE__*/React__default.createElement(ChevronUp, {
|
56
54
|
className: "".concat(blockClass, "__row-expander--icon")
|
57
55
|
}) : /*#__PURE__*/React__default.createElement(ChevronDown, {
|
58
56
|
className: "".concat(blockClass, "__row-expander--icon")
|
@@ -81,11 +81,12 @@ var SelectRow = function SelectRow(datagridState) {
|
|
81
81
|
withStickyColumn = datagridState.withStickyColumn,
|
82
82
|
dispatch = datagridState.dispatch,
|
83
83
|
getRowId = datagridState.getRowId;
|
84
|
-
var _useState = useState(
|
84
|
+
var _useState = useState(),
|
85
85
|
_useState2 = _slicedToArray(_useState, 2),
|
86
86
|
windowSize = _useState2[0],
|
87
87
|
setWindowSize = _useState2[1];
|
88
88
|
useLayoutEffect(function () {
|
89
|
+
setWindowSize(window.innerWidth);
|
89
90
|
function updateSize() {
|
90
91
|
setWindowSize(window.innerWidth);
|
91
92
|
}
|
@@ -1,2 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2021, 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 useStickyColumn: (hooks: Hooks) => void;
|
1
9
|
export default useStickyColumn;
|
2
|
-
declare function useStickyColumn(hooks: any): void;
|
@@ -18,12 +18,13 @@ var OFFSET_SCROLL_CLASS = "".concat(styleClassPrefix, "-offset-scroll");
|
|
18
18
|
var useStickyColumn = function useStickyColumn(hooks) {
|
19
19
|
var tableBodyRef = useRef();
|
20
20
|
var stickyHeaderCellRef = useRef();
|
21
|
-
var _useState = useState(
|
21
|
+
var _useState = useState(),
|
22
22
|
_useState2 = _slicedToArray(_useState, 2),
|
23
23
|
windowSize = _useState2[0],
|
24
24
|
setWindowSize = _useState2[1];
|
25
25
|
useEffect(function () {
|
26
|
-
|
26
|
+
var _window;
|
27
|
+
setWindowSize((_window = window) === null || _window === void 0 ? void 0 : _window.innerWidth);
|
27
28
|
}, []);
|
28
29
|
useLayoutEffect(function () {
|
29
30
|
/* istanbul ignore next */
|
@@ -49,10 +50,11 @@ var useStickyColumn = function useStickyColumn(hooks) {
|
|
49
50
|
var useEventListener = function useEventListener(instance) {
|
50
51
|
useEffect(function () {
|
51
52
|
var tableBodyElement = tableBodyRef.current;
|
52
|
-
var headerCellElement = stickyHeaderCellRef.current;
|
53
|
+
var headerCellElement = stickyHeaderCellRef === null || stickyHeaderCellRef === void 0 ? void 0 : stickyHeaderCellRef.current;
|
53
54
|
/* istanbul ignore next */
|
54
55
|
if (hasVertScroll(tableBodyElement) && headerCellElement) {
|
55
|
-
|
56
|
+
var _headerCellElement$cl;
|
57
|
+
headerCellElement === null || headerCellElement === void 0 || (_headerCellElement$cl = headerCellElement.classList) === null || _headerCellElement$cl === void 0 || _headerCellElement$cl.add(OFFSET_SCROLL_CLASS);
|
56
58
|
}
|
57
59
|
var boundListener = debounce(onBodyResize.bind(null, tableBodyElement, headerCellElement), 250);
|
58
60
|
/* istanbul ignore next */
|
@@ -74,7 +76,7 @@ var useStickyColumn = function useStickyColumn(hooks) {
|
|
74
76
|
};
|
75
77
|
toggleStickyShadow(tableBodyElement, headerCellElement);
|
76
78
|
if (tableBodyElement) {
|
77
|
-
tableBodyElement.addEventListener('scroll', listener);
|
79
|
+
tableBodyElement === null || tableBodyElement === void 0 || tableBodyElement.addEventListener('scroll', listener);
|
78
80
|
}
|
79
81
|
return function () {
|
80
82
|
if (tableBodyElement) {
|
@@ -138,18 +140,19 @@ var addTableBodyProps = function addTableBodyProps(tableBodyRef, props) {
|
|
138
140
|
}];
|
139
141
|
};
|
140
142
|
var changeProps = function changeProps(elementName, headerCellRef, windowSize, props, data) {
|
141
|
-
var
|
142
|
-
|
143
|
+
var _data$cell;
|
144
|
+
var column = data.column || ((_data$cell = data.cell) === null || _data$cell === void 0 ? void 0 : _data$cell.column);
|
145
|
+
if ((column === null || column === void 0 ? void 0 : column.sticky) === 'right') {
|
143
146
|
return [props, _objectSpread2({
|
144
147
|
className: cx(_defineProperty(_defineProperty(_defineProperty({}, "".concat(styleClassPrefix, "-").concat(elementName), true), "".concat(blockClass, "__resizableColumn"), false), "".concat(blockClass, "__sortableColumn"), false))
|
145
148
|
}, headerCellRef && {
|
146
149
|
ref: headerCellRef
|
147
150
|
})];
|
148
151
|
}
|
149
|
-
if (column.sticky === 'left') {
|
152
|
+
if ((column === null || column === void 0 ? void 0 : column.sticky) === 'left') {
|
150
153
|
var _data$instance;
|
151
154
|
return [props, _objectSpread2({
|
152
|
-
className: cx(_defineProperty(_defineProperty({}, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName), windowSize > 671), "".concat(leftStickyStyleClassPrefix, "-").concat(elementName, "--with-extra-select-column"), (data === null || data === void 0 || (_data$instance = data.instance) === null || _data$instance === void 0 ? void 0 : _data$instance.withSelectRows) && windowSize > 671))
|
155
|
+
className: cx(_defineProperty(_defineProperty({}, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName), windowSize && windowSize > 671), "".concat(leftStickyStyleClassPrefix, "-").concat(elementName, "--with-extra-select-column"), (data === null || data === void 0 || (_data$instance = data.instance) === null || _data$instance === void 0 ? void 0 : _data$instance.withSelectRows) && windowSize && windowSize > 671))
|
153
156
|
}, headerCellRef && {
|
154
157
|
ref: headerCellRef
|
155
158
|
})];
|
@@ -50,6 +50,10 @@ interface EditInplaceProps extends PropsWithChildren {
|
|
50
50
|
* Provide the text that will be read by a screen reader when visiting this control
|
51
51
|
*/
|
52
52
|
labelText: string;
|
53
|
+
/**
|
54
|
+
* handler to add custom onBlur event
|
55
|
+
*/
|
56
|
+
onBlur?: (value: string) => void;
|
53
57
|
/**
|
54
58
|
* handler that is called when the cancel button is pressed or when the user removes focus from the input and there is no new value
|
55
59
|
*/
|