@carbon/ibm-products 2.0.0-rc.0 → 2.0.0-rc.10
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -2
- package/css/index-full-carbon.css +1223 -325
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +6 -8
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +792 -174
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +4 -8
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +1109 -419
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +6 -8
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +1024 -274
- package/css/index.css.map +1 -1
- package/css/index.min.css +6 -8
- package/css/index.min.css.map +1 -1
- package/es/components/APIKeyModal/APIKeyModal.js +1 -1
- package/es/components/ActionBar/ActionBarOverflowItems.js +1 -0
- package/es/components/ActionSet/ActionSet.js +7 -3
- package/es/components/AddSelect/AddSelect.js +6 -6
- package/es/components/AddSelect/AddSelectBody.js +72 -31
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +12 -4
- package/es/components/AddSelect/AddSelectColumn.js +8 -8
- package/es/components/AddSelect/AddSelectFilter.js +10 -7
- package/es/components/AddSelect/AddSelectList.js +64 -29
- package/es/components/AddSelect/AddSelectMetaPanel.js +7 -1
- package/es/components/AddSelect/AddSelectSidebar.js +5 -2
- package/es/components/AddSelect/AddSelectSort.js +2 -2
- package/es/components/AddSelect/add-select-utils.js +9 -2
- package/es/components/AddSelect/hooks/useItemSort.js +6 -0
- package/es/components/AddSelect/hooks/useParentSelect.js +6 -0
- package/es/components/AddSelect/hooks/usePath.js +15 -1
- package/es/components/AddSelect/index.js +1 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +4 -6
- package/es/components/Card/Card.js +16 -6
- package/es/components/Card/CardFooter.js +3 -1
- package/es/components/Card/CardHeader.js +20 -1
- package/es/components/ComboButton/ComboButton.js +1 -1
- package/es/components/CreateFullPage/CreateFullPage.js +4 -1
- package/es/components/CreateTearsheet/CreateTearsheet.js +8 -1
- package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +2 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +64 -11
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
- package/es/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +6 -5
- package/es/components/DataSpreadsheet/utils/handleCellDeletion.js +40 -0
- package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
- package/es/components/Datagrid/Datagrid/Datagrid.js +10 -38
- package/es/components/Datagrid/Datagrid/DatagridContent.js +154 -0
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +53 -6
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -3
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +13 -4
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +142 -11
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +2 -1
- package/es/components/Datagrid/Datagrid/DraggableElement.js +6 -2
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +5 -45
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +4 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +36 -10
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +62 -26
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +3 -2
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +60 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +537 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +112 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +27 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +39 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +19 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +263 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +87 -0
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +17 -14
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +13 -36
- package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/CustomizeColumnStory.js +0 -0
- package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/LeftPanelStory.js +0 -0
- package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/RowSizeDropdownStory.js +0 -0
- package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/SelectAllWithToggleStory.js +0 -0
- package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/StickyActionsColumnStory.js +0 -0
- package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/common.js +0 -0
- package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/index.js +0 -0
- package/es/components/Datagrid/index.js +3 -1
- package/es/components/Datagrid/useActionsColumn.js +53 -12
- package/es/components/Datagrid/useColumnOrder.js +8 -0
- package/es/components/Datagrid/useCustomizeColumns.js +5 -0
- package/es/components/Datagrid/useDefaultStringRenderer.js +4 -1
- package/es/components/Datagrid/useDisableSelectRows.js +6 -2
- package/es/components/Datagrid/useExpandedRow.js +0 -1
- package/es/components/Datagrid/useInfiniteScroll.js +5 -2
- package/es/components/Datagrid/useInlineEdit.js +71 -0
- package/es/components/Datagrid/useNestedRowExpander.js +47 -0
- package/es/components/Datagrid/useNestedRows.js +16 -4
- package/es/components/Datagrid/useRowExpander.js +12 -4
- package/es/components/Datagrid/useRowSize.js +17 -6
- package/es/components/Datagrid/useSelectAllToggle.js +17 -4
- package/es/components/Datagrid/useSelectRows.js +13 -3
- package/es/components/Datagrid/useSortableColumns.js +1 -1
- package/es/components/Datagrid/useStickyColumn.js +14 -0
- package/es/components/Datagrid/utils/DatagridActions.js +236 -0
- package/es/components/Datagrid/utils/DatagridPagination.js +33 -0
- package/es/components/Datagrid/utils/Wrapper.js +21 -0
- package/es/components/Datagrid/utils/getArgTypes.js +89 -0
- package/es/components/Datagrid/utils/getInlineEditColumns.js +153 -0
- package/es/components/Datagrid/utils/makeData.js +47 -2
- package/es/components/EditUpdateCards/EditUpdateCards.js +144 -0
- package/es/components/EditUpdateCards/index.js +7 -0
- package/es/components/ExportModal/ExportModal.js +1 -1
- package/es/components/ImportModal/ImportModal.js +3 -3
- package/es/components/InlineEdit/InlineEdit.js +28 -426
- package/es/components/InlineEditV1/InlineEditV1.js +447 -0
- package/es/components/InlineEditV1/index.js +7 -0
- package/es/components/InlineEditV2/InlineEditV2.js +289 -0
- package/es/components/InlineEditV2/index.js +7 -0
- package/es/components/ModifiedTabs/ModifiedTabLabelNew.js +1 -1
- package/es/components/ModifiedTabs/ModifiedTabLabelWithClose.js +1 -1
- package/es/components/MultiAddSelect/MultiAddSelect.js +14 -7
- package/es/components/MultiAddSelect/index.js +6 -0
- package/es/components/NotificationsPanel/NotificationsPanel.js +1 -1
- package/es/components/OptionsTile/OptionsTile.js +29 -13
- package/es/components/PageHeader/PageHeader.js +4 -4
- package/es/components/PageHeader/PageHeaderTitle.js +1 -1
- package/es/components/ProductiveCard/ProductiveCard.js +5 -0
- package/es/components/RemoveModal/RemoveModal.js +20 -3
- package/es/components/Saving/Saving.js +1 -1
- package/es/components/SidePanel/SidePanel.js +45 -52
- package/es/components/SidePanel/motion/variants.js +45 -0
- package/es/components/SingleAddSelect/SingleAddSelect.js +6 -0
- package/es/components/SingleAddSelect/index.js +6 -0
- package/es/components/StatusIcon/StatusIcon.js +1 -1
- package/es/components/UserProfileImage/UserProfileImage.js +1 -1
- package/es/components/WebTerminal/WebTerminal.js +2 -2
- package/es/components/WebTerminal/WebTerminalContentWrapper.js +1 -1
- package/es/components/WebTerminal/hooks/index.js +6 -0
- package/es/components/WebTerminal/index.js +6 -0
- package/es/components/WebTerminal/preview-components/Navigation.js +7 -1
- package/es/components/WebTerminal/preview-components/documentationLinks.js +6 -0
- package/es/components/WebTerminal/preview-components/index.js +7 -0
- package/es/components/index.js +3 -2
- package/es/global/js/hooks/index.js +2 -1
- package/es/global/js/hooks/useClickOutside.js +1 -1
- package/es/global/js/hooks/useControllableState.js +83 -0
- package/es/global/js/hooks/useResetCreateComponent.js +6 -2
- package/es/global/js/package-settings.js +7 -4
- package/es/global/js/utils/getBezierValues.js +20 -0
- package/es/global/js/utils/getNumberOfHiddenSteps.js +19 -0
- package/es/global/js/utils/motionConstants.js +45 -0
- package/es/global/js/utils/rangeWithCallback.js +13 -0
- package/es/global/js/utils/story-helper.js +5 -1
- package/es/global/js/utils/uuidv4.spec.js +4 -0
- package/lib/components/APIKeyModal/APIKeyModal.js +4 -4
- package/lib/components/ActionBar/ActionBarOverflowItems.js +1 -0
- package/lib/components/ActionSet/ActionSet.js +7 -3
- package/lib/components/AddSelect/AddSelect.js +5 -6
- package/lib/components/AddSelect/AddSelectBody.js +67 -30
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +15 -4
- package/lib/components/AddSelect/AddSelectColumn.js +7 -7
- package/lib/components/AddSelect/AddSelectFilter.js +9 -6
- package/lib/components/AddSelect/AddSelectList.js +65 -30
- package/lib/components/AddSelect/AddSelectMetaPanel.js +8 -2
- package/lib/components/AddSelect/AddSelectSidebar.js +4 -1
- package/lib/components/AddSelect/AddSelectSort.js +5 -5
- package/lib/components/AddSelect/add-select-utils.js +9 -2
- package/lib/components/AddSelect/hooks/useItemSort.js +6 -0
- package/lib/components/AddSelect/hooks/useParentSelect.js +6 -0
- package/lib/components/AddSelect/hooks/usePath.js +9 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +6 -6
- package/lib/components/Card/Card.js +16 -6
- package/lib/components/Card/CardFooter.js +3 -1
- package/lib/components/Card/CardHeader.js +21 -1
- package/lib/components/ComboButton/ComboButton.js +3 -3
- package/lib/components/CreateFullPage/CreateFullPage.js +4 -1
- package/lib/components/CreateTearsheet/CreateTearsheet.js +9 -1
- package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +2 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +64 -10
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
- package/lib/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +6 -5
- package/lib/components/DataSpreadsheet/utils/handleCellDeletion.js +51 -0
- package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
- package/lib/components/Datagrid/Datagrid/Datagrid.js +12 -45
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +188 -0
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +63 -6
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +12 -3
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +16 -5
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +151 -9
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +2 -1
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +7 -3
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +12 -47
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +5 -2
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +48 -25
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +60 -25
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +3 -2
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +76 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +13 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +562 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +13 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +129 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +36 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +19 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +45 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +28 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +272 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +100 -0
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +17 -13
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +13 -35
- package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/CustomizeColumnStory.js +0 -0
- package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/LeftPanelStory.js +0 -0
- package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/RowSizeDropdownStory.js +0 -0
- package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/SelectAllWithToggleStory.js +0 -0
- package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/StickyActionsColumnStory.js +0 -0
- package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/common.js +0 -0
- package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/index.js +0 -0
- package/lib/components/Datagrid/index.js +17 -1
- package/lib/components/Datagrid/useActionsColumn.js +53 -13
- package/lib/components/Datagrid/useColumnOrder.js +17 -0
- package/lib/components/Datagrid/useCustomizeColumns.js +5 -0
- package/lib/components/Datagrid/useDefaultStringRenderer.js +5 -1
- package/lib/components/Datagrid/useDisableSelectRows.js +6 -2
- package/lib/components/Datagrid/useExpandedRow.js +0 -1
- package/lib/components/Datagrid/useInfiniteScroll.js +5 -2
- package/lib/components/Datagrid/useInlineEdit.js +85 -0
- package/lib/components/Datagrid/useNestedRowExpander.js +63 -0
- package/lib/components/Datagrid/useNestedRows.js +17 -4
- package/lib/components/Datagrid/useRowExpander.js +17 -5
- package/lib/components/Datagrid/useRowSize.js +18 -13
- package/lib/components/Datagrid/useSelectAllToggle.js +18 -4
- package/lib/components/Datagrid/useSelectRows.js +13 -3
- package/lib/components/Datagrid/useSortableColumns.js +5 -5
- package/lib/components/Datagrid/useStickyColumn.js +14 -0
- package/lib/components/Datagrid/utils/DatagridActions.js +260 -0
- package/lib/components/Datagrid/utils/DatagridPagination.js +46 -0
- package/lib/components/Datagrid/utils/Wrapper.js +33 -0
- package/lib/components/Datagrid/utils/getArgTypes.js +97 -0
- package/lib/components/Datagrid/utils/getInlineEditColumns.js +168 -0
- package/lib/components/Datagrid/utils/makeData.js +48 -2
- package/lib/components/EditUpdateCards/EditUpdateCards.js +152 -0
- package/lib/components/EditUpdateCards/index.js +13 -0
- package/lib/components/ExportModal/ExportModal.js +3 -3
- package/lib/components/ImportModal/ImportModal.js +4 -4
- package/lib/components/InlineEdit/InlineEdit.js +27 -426
- package/lib/components/InlineEditV1/InlineEditV1.js +464 -0
- package/lib/components/InlineEditV1/index.js +13 -0
- package/lib/components/InlineEditV2/InlineEditV2.js +309 -0
- package/lib/components/InlineEditV2/index.js +13 -0
- package/lib/components/ModifiedTabs/ModifiedTabLabelNew.js +2 -2
- package/lib/components/ModifiedTabs/ModifiedTabLabelWithClose.js +3 -3
- package/lib/components/MultiAddSelect/MultiAddSelect.js +14 -7
- package/lib/components/NotificationsPanel/NotificationsPanel.js +8 -8
- package/lib/components/OptionsTile/OptionsTile.js +34 -17
- package/lib/components/PageHeader/PageHeader.js +5 -5
- package/lib/components/PageHeader/PageHeaderTitle.js +1 -1
- package/lib/components/ProductiveCard/ProductiveCard.js +5 -0
- package/lib/components/RemoveModal/RemoveModal.js +20 -3
- package/lib/components/Saving/Saving.js +5 -5
- package/lib/components/SidePanel/SidePanel.js +48 -53
- package/lib/components/SidePanel/motion/variants.js +55 -0
- package/lib/components/SingleAddSelect/SingleAddSelect.js +6 -0
- package/lib/components/StatusIcon/StatusIcon.js +45 -45
- package/lib/components/UserProfileImage/UserProfileImage.js +7 -7
- package/lib/components/WebTerminal/WebTerminal.js +3 -3
- package/lib/components/WebTerminal/hooks/index.js +6 -0
- package/lib/components/WebTerminal/preview-components/Navigation.js +10 -4
- package/lib/components/WebTerminal/preview-components/documentationLinks.js +6 -0
- package/lib/components/index.js +21 -1
- package/lib/global/js/hooks/index.js +9 -1
- package/lib/global/js/hooks/useClickOutside.js +1 -1
- package/lib/global/js/hooks/useControllableState.js +94 -0
- package/lib/global/js/hooks/useResetCreateComponent.js +7 -2
- package/lib/global/js/package-settings.js +7 -4
- package/lib/global/js/utils/getBezierValues.js +29 -0
- package/lib/global/js/utils/getNumberOfHiddenSteps.js +28 -0
- package/lib/global/js/utils/motionConstants.js +55 -0
- package/lib/global/js/utils/rangeWithCallback.js +22 -0
- package/lib/global/js/utils/story-helper.js +5 -1
- package/lib/global/js/utils/uuidv4.spec.js +4 -0
- package/package.json +18 -16
- package/scss/components/AboutModal/_about-modal.scss +2 -1
- package/scss/components/ActionSet/_action-set.scss +9 -4
- package/scss/components/AddSelect/_add-select.scss +132 -34
- package/scss/components/AddSelect/_index.scss +1 -1
- package/scss/components/AddSelect/_storybook-styles.scss +1 -1
- package/scss/components/Card/_card.scss +1 -0
- package/scss/components/Cascade/_cascade.scss +1 -1
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +2 -0
- package/scss/components/Datagrid/_datagrid.scss +15 -0
- package/scss/components/Datagrid/_storybook-styles.scss +17 -5
- package/scss/components/Datagrid/styles/_datagrid.scss +129 -20
- package/scss/components/Datagrid/styles/_draggableElement.scss +26 -9
- package/scss/components/Datagrid/styles/_index.scss +1 -0
- package/scss/components/Datagrid/styles/_useActionsColumn.scss +14 -0
- package/scss/components/Datagrid/styles/_useExpandedRow.scss +57 -11
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +419 -0
- package/scss/components/Datagrid/styles/_useNestedRows.scss +33 -1
- package/scss/components/Datagrid/styles/_useStickyColumn.scss +31 -2
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsModal.scss +47 -6
- package/scss/components/Datagrid/styles/addons/_RowSizeDropdown.scss +9 -1
- package/scss/components/EditUpdateCards/_carbon-imports.scss +9 -0
- package/scss/components/EditUpdateCards/_edit-update-cards.scss +85 -0
- package/scss/components/EditUpdateCards/_index-with-carbon.scss +9 -0
- package/scss/components/EditUpdateCards/_index.scss +8 -0
- package/scss/components/EditUpdateCards/_storybook-styles.scss +55 -0
- package/scss/components/{InlineEdit → InlineEditV1}/_carbon-imports.scss +0 -0
- package/scss/components/{InlineEdit → InlineEditV1}/_index-with-carbon.scss +1 -1
- package/scss/components/{InlineEdit → InlineEditV1}/_index.scss +1 -1
- package/scss/components/{InlineEdit/_inline-edit.scss → InlineEditV1/_inline-edit-v1.scss} +5 -3
- package/scss/components/{InlineEdit → InlineEditV1}/_storybook-styles.scss +0 -0
- package/scss/components/InlineEditV2/_carbon-imports.scss +9 -0
- package/scss/components/InlineEditV2/_index-with-carbon.scss +9 -0
- package/scss/components/InlineEditV2/_index.scss +10 -0
- package/scss/components/InlineEditV2/_inline-edit-v2.scss +83 -0
- package/scss/components/InlineEditV2/_storybook-styles.scss +9 -0
- package/scss/components/MultiAddSelect/_multi-add-select.scss +7 -0
- package/scss/components/MultiAddSelect/_storybook-styles.scss +1 -1
- package/scss/components/NotificationsPanel/_notifications-panel.scss +3 -6
- package/scss/components/RemoveModal/_remove-modal.scss +0 -4
- package/scss/components/SidePanel/_side-panel.scss +3 -82
- package/scss/components/SidePanel/_storybook-styles.scss +6 -1
- package/scss/components/SingleAddSelect/_carbon-imports.scss +1 -1
- package/scss/components/SingleAddSelect/_index-with-carbon.scss +1 -1
- package/scss/components/SingleAddSelect/_index.scss +7 -0
- package/scss/components/SingleAddSelect/_single-add-select.scss +7 -0
- package/scss/components/SingleAddSelect/_storybook-styles.scss +1 -1
- package/scss/components/Tearsheet/_tearsheet.scss +2 -2
- package/scss/components/WebTerminal/_carbon-imports.scss +6 -0
- package/scss/components/WebTerminal/_index.scss +7 -0
- package/scss/components/WebTerminal/_storybook-styles.scss +7 -0
- package/scss/components/_index-released-only-with-carbon.scss +1 -1
- package/scss/components/_index-released-only.scss +2 -1
- package/scss/components/_index-with-carbon.scss +3 -1
- package/scss/components/_index.scss +3 -1
@@ -124,9 +124,9 @@ CreateTearsheetNarrow.propTypes = {
|
|
124
124
|
formDescription: _propTypes.default.node,
|
125
125
|
|
126
126
|
/**
|
127
|
-
* Specifies a
|
127
|
+
* Specifies a field that provides a title for a form
|
128
128
|
*/
|
129
|
-
formTitle: _propTypes.default.node
|
129
|
+
formTitle: _propTypes.default.node,
|
130
130
|
|
131
131
|
/**
|
132
132
|
* A label for the tearsheet, displayed in the header area of the tearsheet
|
@@ -63,7 +63,9 @@ var _handleActiveCellInSelectionEnter = require("./utils/handleActiveCellInSelec
|
|
63
63
|
|
64
64
|
var _handleActiveCellInSelectionTab = require("./utils/handleActiveCellInSelectionTab");
|
65
65
|
|
66
|
-
var
|
66
|
+
var _handleCellDeletion = require("./utils/handleCellDeletion");
|
67
|
+
|
68
|
+
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
67
69
|
|
68
70
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
69
71
|
|
@@ -85,13 +87,16 @@ var defaults = {
|
|
85
87
|
defaultEmptyRowCount: 16,
|
86
88
|
onDataUpdate: Object.freeze(function () {}),
|
87
89
|
onActiveCellChange: Object.freeze(function () {}),
|
88
|
-
onSelectionAreaChange: Object.freeze(function () {})
|
90
|
+
onSelectionAreaChange: Object.freeze(function () {}),
|
91
|
+
theme: 'light'
|
89
92
|
};
|
90
93
|
/**
|
91
94
|
* DataSpreadsheet: used to organize and display large amounts of structured data, separated by columns and rows in a grid-like format.
|
92
95
|
*/
|
93
96
|
|
94
97
|
var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
98
|
+
var _cx;
|
99
|
+
|
95
100
|
var _ref$cellSize = _ref.cellSize,
|
96
101
|
cellSize = _ref$cellSize === void 0 ? defaults.cellSize : _ref$cellSize,
|
97
102
|
className = _ref.className,
|
@@ -108,6 +113,9 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
108
113
|
onActiveCellChange = _ref$onActiveCellChan === void 0 ? defaults.onActiveCellChange : _ref$onActiveCellChan,
|
109
114
|
_ref$onSelectionAreaC = _ref.onSelectionAreaChange,
|
110
115
|
onSelectionAreaChange = _ref$onSelectionAreaC === void 0 ? defaults.onSelectionAreaChange : _ref$onSelectionAreaC,
|
116
|
+
selectAllAriaLabel = _ref.selectAllAriaLabel,
|
117
|
+
spreadsheetAriaLabel = _ref.spreadsheetAriaLabel,
|
118
|
+
theme = _ref.theme,
|
111
119
|
totalVisibleColumns = _ref.totalVisibleColumns,
|
112
120
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
113
121
|
var multiKeyTrackingRef = (0, _react.useRef)();
|
@@ -214,11 +222,11 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
214
222
|
visibleColumns = _useTable.visibleColumns; // Update the spreadsheet data after editing a cell
|
215
223
|
|
216
224
|
|
217
|
-
var updateData = (0, _react.useCallback)(function (rowIndex, columnId) {
|
225
|
+
var updateData = (0, _react.useCallback)(function (rowIndex, columnId, newValue) {
|
218
226
|
onDataUpdate(function (prev) {
|
219
227
|
return prev.map(function (row, index) {
|
220
228
|
if (index === rowIndex) {
|
221
|
-
return _objectSpread(_objectSpread({}, prev[rowIndex]), {}, (0, _defineProperty2.default)({}, columnId, cellEditorValue));
|
229
|
+
return _objectSpread(_objectSpread({}, prev[rowIndex]), {}, (0, _defineProperty2.default)({}, columnId, cellEditorValue || newValue));
|
222
230
|
}
|
223
231
|
|
224
232
|
return row;
|
@@ -406,13 +414,35 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
406
414
|
setCurrentMatcher: setCurrentMatcher,
|
407
415
|
usingMac: usingMac
|
408
416
|
});
|
409
|
-
}
|
410
|
-
// if one of the activeCellCoordinates is in a header position
|
417
|
+
}
|
411
418
|
|
419
|
+
var deleteParams = {
|
420
|
+
selectionAreas: selectionAreas,
|
421
|
+
currentMatcher: currentMatcher,
|
422
|
+
rows: rows,
|
423
|
+
setActiveCellContent: setActiveCellContent,
|
424
|
+
updateData: updateData,
|
425
|
+
activeCellCoordinates: activeCellCoordinates
|
426
|
+
}; // Allow arrow key navigation if there are less than two activeKeys OR
|
427
|
+
// if one of the activeCellCoordinates is in a header position
|
412
428
|
|
413
429
|
if (keysPressedList.length < 2 && !(0, _handleMultipleKeys.includesShift)(keysPressedList) || activeCellCoordinates.row === 'header' || activeCellCoordinates.column === 'header') {
|
414
430
|
switch (key) {
|
431
|
+
// Backspace
|
432
|
+
case 'Backspace':
|
433
|
+
{
|
434
|
+
(0, _handleCellDeletion.handleCellDeletion)(deleteParams);
|
435
|
+
break;
|
436
|
+
}
|
437
|
+
// Delete
|
438
|
+
|
439
|
+
case 'Delete':
|
440
|
+
{
|
441
|
+
(0, _handleCellDeletion.handleCellDeletion)(deleteParams);
|
442
|
+
break;
|
443
|
+
}
|
415
444
|
// Enter
|
445
|
+
|
416
446
|
case 'Enter':
|
417
447
|
{
|
418
448
|
(0, _handleActiveCellInSelectionEnter.handleActiveCellInSelectionEnter)({
|
@@ -610,7 +640,7 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
610
640
|
}
|
611
641
|
}
|
612
642
|
}
|
613
|
-
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, handleInitialArrowPress, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, isEditing, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac]);
|
643
|
+
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, handleInitialArrowPress, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, isEditing, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData]);
|
614
644
|
|
615
645
|
var startEditMode = function startEditMode() {
|
616
646
|
setIsEditing(true);
|
@@ -646,6 +676,11 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
646
676
|
}
|
647
677
|
|
648
678
|
return;
|
679
|
+
}; // Mouse up on active cell
|
680
|
+
|
681
|
+
|
682
|
+
var handleActiveCellMouseUp = function handleActiveCellMouseUp() {
|
683
|
+
setClickAndHoldActive(false);
|
649
684
|
}; // Mouse down on active cell
|
650
685
|
|
651
686
|
|
@@ -784,12 +819,13 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
784
819
|
}
|
785
820
|
}, [spreadsheetRef, currentMatcher]);
|
786
821
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, getTableProps(), (0, _devtools.getDevtoolsProps)(componentName), {
|
787
|
-
className: (0, _classnames.default)(blockClass, className, "".concat(blockClass, "--interactive-cell-element"), (0, _defineProperty2.default)(
|
822
|
+
className: (0, _classnames.default)(blockClass, className, "".concat(blockClass, "--interactive-cell-element"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__container-has-focus"), containerHasFocus), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__").concat(theme), theme === 'dark'), _cx)),
|
788
823
|
ref: spreadsheetRef,
|
789
824
|
role: "grid",
|
790
825
|
tabIndex: 0,
|
791
826
|
"aria-rowcount": (rows === null || rows === void 0 ? void 0 : rows.length) || 0,
|
792
827
|
"aria-colcount": (columns === null || columns === void 0 ? void 0 : columns.length) || 0,
|
828
|
+
"aria-label": spreadsheetAriaLabel,
|
793
829
|
onKeyDown: handleKeyPress,
|
794
830
|
onFocus: function onFocus() {
|
795
831
|
return setContainerHasFocus(true);
|
@@ -815,7 +851,8 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
815
851
|
updateActiveCellCoordinates: updateActiveCellCoordinates,
|
816
852
|
setHeaderCellHoldActive: setHeaderCellHoldActive,
|
817
853
|
headerCellHoldActive: headerCellHoldActive,
|
818
|
-
visibleColumns: visibleColumns
|
854
|
+
visibleColumns: visibleColumns,
|
855
|
+
selectAllAriaLabel: selectAllAriaLabel
|
819
856
|
}), /*#__PURE__*/_react.default.createElement(_DataSpreadsheetBody.DataSpreadsheetBody, {
|
820
857
|
activeCellCoordinates: activeCellCoordinates,
|
821
858
|
ref: spreadsheetRef,
|
@@ -850,6 +887,7 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
850
887
|
visibleColumns: visibleColumns
|
851
888
|
}), /*#__PURE__*/_react.default.createElement("button", {
|
852
889
|
onMouseDown: handleActiveCellMouseDown,
|
890
|
+
onMouseUp: handleActiveCellMouseUp,
|
853
891
|
onClick: handleActiveCellClick,
|
854
892
|
onKeyDown: handleActiveCellKeyDown,
|
855
893
|
onDoubleClick: handleActiveCellDoubleClick,
|
@@ -858,6 +896,7 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
858
896
|
className: (0, _classnames.default)("".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__active-cell--highlight"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__active-cell--with-selection"), activeCellInsideSelectionArea)),
|
859
897
|
type: "button"
|
860
898
|
}, activeCellContent), /*#__PURE__*/_react.default.createElement("textarea", {
|
899
|
+
id: "".concat(blockClass, "__cell-editor-text-area"),
|
861
900
|
value: cellEditorValue,
|
862
901
|
onKeyDown: (0, _handleEditSubmit.handleEditSubmit)({
|
863
902
|
activeCellCoordinates: activeCellCoordinates,
|
@@ -877,7 +916,7 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
877
916
|
cellEditorRulerRef.current.textContent = event.target.value;
|
878
917
|
},
|
879
918
|
ref: cellEditorRef,
|
880
|
-
"aria-labelledby": activeCellCoordinates ? "
|
919
|
+
"aria-labelledby": activeCellCoordinates ? "".concat(blockClass, "__cell--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) : null,
|
881
920
|
className: (0, _classnames.default)("".concat(blockClass, "__cell-editor"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__cell-editor--").concat(cellSize), (0, _defineProperty2.default)({}, "".concat(blockClass, "__cell-editor--active"), isEditing))
|
882
921
|
}), /*#__PURE__*/_react.default.createElement("pre", {
|
883
922
|
"aria-hidden": true,
|
@@ -946,6 +985,21 @@ DataSpreadsheet.propTypes = {
|
|
946
985
|
*/
|
947
986
|
onSelectionAreaChange: _propTypes.default.func,
|
948
987
|
|
988
|
+
/**
|
989
|
+
* The aria label applied to the Select all button
|
990
|
+
*/
|
991
|
+
selectAllAriaLabel: _propTypes.default.string.isRequired,
|
992
|
+
|
993
|
+
/**
|
994
|
+
* The aria label applied to the Data spreadsheet component
|
995
|
+
*/
|
996
|
+
spreadsheetAriaLabel: _propTypes.default.string.isRequired,
|
997
|
+
|
998
|
+
/**
|
999
|
+
* The theme the DataSpreadsheet should use (only used to render active cell/selection area colors on dark theme)
|
1000
|
+
*/
|
1001
|
+
theme: _propTypes.default.oneOf(['light', 'dark']),
|
1002
|
+
|
949
1003
|
/**
|
950
1004
|
* The total number of columns to be initially visible, additional columns will be rendered and
|
951
1005
|
* visible via horizontal scrollbar
|
@@ -411,7 +411,8 @@ var DataSpreadsheetBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
411
411
|
}), {
|
412
412
|
className: (0, _classnames.default)("".concat(blockClass, "__tr")),
|
413
413
|
"data-row-index": index,
|
414
|
-
"aria-rowindex": index + 1
|
414
|
+
"aria-rowindex": index + 1,
|
415
|
+
"aria-owns": "".concat(blockClass, "__cell-editor-text-area")
|
415
416
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
416
417
|
role: "rowheader",
|
417
418
|
className: "".concat(blockClass, "__td-th--cell-container")
|
@@ -66,6 +66,7 @@ var DataSpreadsheetHeader = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
|
|
66
66
|
updateActiveCellCoordinates = _ref.updateActiveCellCoordinates,
|
67
67
|
setHeaderCellHoldActive = _ref.setHeaderCellHoldActive,
|
68
68
|
headerCellHoldActive = _ref.headerCellHoldActive,
|
69
|
+
selectAllAriaLabel = _ref.selectAllAriaLabel,
|
69
70
|
visibleColumns = _ref.visibleColumns;
|
70
71
|
|
71
72
|
var _useState = (0, _react.useState)(0),
|
@@ -198,6 +199,7 @@ var DataSpreadsheetHeader = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
|
|
198
199
|
"data-column-index": "header",
|
199
200
|
type: "button",
|
200
201
|
tabIndex: -1,
|
202
|
+
"aria-label": selectAllAriaLabel,
|
201
203
|
onClick: handleSelectAllClick,
|
202
204
|
className: (0, _classnames.default)("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__th--select-all"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header'))
|
203
205
|
}, "\xA0")), headerGroup.headers.map(function (column, index) {
|
@@ -282,6 +284,11 @@ DataSpreadsheetHeader.propTypes = {
|
|
282
284
|
*/
|
283
285
|
scrollBarSize: _propTypes.default.number,
|
284
286
|
|
287
|
+
/**
|
288
|
+
* The aria label applied to the Select all button
|
289
|
+
*/
|
290
|
+
selectAllAriaLabel: _propTypes.default.string.isRequired,
|
291
|
+
|
285
292
|
/**
|
286
293
|
* All of the cell selection area items
|
287
294
|
*/
|
@@ -49,7 +49,8 @@ var useMultipleKeyTracking = function useMultipleKeyTracking(_ref) {
|
|
49
49
|
|
50
50
|
var previousState = (0, _hooks.usePreviousValue)({
|
51
51
|
isEditing: isEditing,
|
52
|
-
windowFocused: windowFocused
|
52
|
+
windowFocused: windowFocused,
|
53
|
+
containerHasFocus: containerHasFocus
|
53
54
|
}); // useEffect to check for window focus, if window loses focus
|
54
55
|
// we need to clear out the keysPressedList
|
55
56
|
|
@@ -80,7 +81,7 @@ var useMultipleKeyTracking = function useMultipleKeyTracking(_ref) {
|
|
80
81
|
};
|
81
82
|
}, []);
|
82
83
|
(0, _react.useEffect)(function () {
|
83
|
-
if (containerHasFocus && !isEditing) {
|
84
|
+
if (ref && containerHasFocus && !isEditing) {
|
84
85
|
ref.current.onkeydown = ref.current.onkeyup = function (event) {
|
85
86
|
// If keydown, we will add the new key to the keysPressedList array
|
86
87
|
if (event.type === 'keydown') {
|
@@ -132,15 +133,15 @@ var useMultipleKeyTracking = function useMultipleKeyTracking(_ref) {
|
|
132
133
|
// or is currently in edit mode
|
133
134
|
|
134
135
|
|
135
|
-
if (!containerHasFocus || isEditing) {
|
136
|
+
if (ref && !containerHasFocus || isEditing) {
|
136
137
|
ref.current.onkeydown = undefined;
|
137
138
|
ref.current.onkeyup = undefined;
|
138
139
|
|
139
|
-
if (!(previousState !== null && previousState !== void 0 && previousState.isEditing) && isEditing) {
|
140
|
+
if (!(previousState !== null && previousState !== void 0 && previousState.isEditing) && isEditing || previousState !== null && previousState !== void 0 && previousState.containerHasFocus && !containerHasFocus) {
|
140
141
|
setKeysPressedList([]);
|
141
142
|
}
|
142
143
|
}
|
143
|
-
}, [keysPressedList, containerHasFocus, ref, isEditing, previousState === null || previousState === void 0 ? void 0 : previousState.isEditing, windowFocused, previousState === null || previousState === void 0 ? void 0 : previousState.windowFocused, usingMac]);
|
144
|
+
}, [keysPressedList, containerHasFocus, ref, isEditing, previousState === null || previousState === void 0 ? void 0 : previousState.isEditing, previousState === null || previousState === void 0 ? void 0 : previousState.containerHasFocus, windowFocused, previousState === null || previousState === void 0 ? void 0 : previousState.windowFocused, usingMac]);
|
144
145
|
return {
|
145
146
|
keysPressedList: keysPressedList,
|
146
147
|
windowFocused: windowFocused,
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.handleCellDeletion = void 0;
|
7
|
+
|
8
|
+
var _deepCloneObject = require("../../../global/js/utils/deepCloneObject");
|
9
|
+
|
10
|
+
var _rangeWithCallback = require("../../../global/js/utils/rangeWithCallback");
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Copyright IBM Corp. 2022, 2022
|
14
|
+
*
|
15
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
17
|
+
*/
|
18
|
+
var handleCellDeletion = function handleCellDeletion(_ref) {
|
19
|
+
var activeCellCoordinates = _ref.activeCellCoordinates,
|
20
|
+
selectionAreas = _ref.selectionAreas,
|
21
|
+
currentMatcher = _ref.currentMatcher,
|
22
|
+
rows = _ref.rows,
|
23
|
+
setActiveCellContent = _ref.setActiveCellContent,
|
24
|
+
updateData = _ref.updateData;
|
25
|
+
|
26
|
+
// This means that the delete key has been pressed when the active cell is in a header,
|
27
|
+
// not within the spreadsheet body. To delete an entire row/column, it must first be
|
28
|
+
// selected, and then can be deleted.
|
29
|
+
if ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header') {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
|
33
|
+
var selectionAreaClone = (0, _deepCloneObject.deepCloneObject)(selectionAreas);
|
34
|
+
var indexOfCurrentSelectionArea = selectionAreaClone.findIndex(function (item) {
|
35
|
+
return item.matcher === currentMatcher;
|
36
|
+
});
|
37
|
+
var selectionAreaToEmptyContents = selectionAreaClone[indexOfCurrentSelectionArea];
|
38
|
+
var lowestColumnIndex = Math.min(selectionAreaToEmptyContents.point1.column, selectionAreaToEmptyContents.point2.column);
|
39
|
+
var greatestColumnIndex = Math.max(selectionAreaToEmptyContents.point1.column, selectionAreaToEmptyContents.point2.column);
|
40
|
+
var lowestRowIndex = Math.min(selectionAreaToEmptyContents.point1.row, selectionAreaToEmptyContents.point2.row);
|
41
|
+
var greatestRowIndex = Math.max(selectionAreaToEmptyContents.point1.row, selectionAreaToEmptyContents.point2.row);
|
42
|
+
(0, _rangeWithCallback.rangeWithCallback)(lowestColumnIndex, greatestColumnIndex, function (columnIndex) {
|
43
|
+
(0, _rangeWithCallback.rangeWithCallback)(lowestRowIndex, greatestRowIndex, function (rowIndex) {
|
44
|
+
var cellProps = rows[rowIndex].cells[columnIndex];
|
45
|
+
updateData(rowIndex, cellProps === null || cellProps === void 0 ? void 0 : cellProps.column.id, '');
|
46
|
+
});
|
47
|
+
});
|
48
|
+
setActiveCellContent(null);
|
49
|
+
};
|
50
|
+
|
51
|
+
exports.handleCellDeletion = handleCellDeletion;
|
@@ -9,39 +9,29 @@ exports.Datagrid = void 0;
|
|
9
9
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11
11
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
13
|
-
|
14
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
15
13
|
|
16
14
|
var _react = _interopRequireDefault(require("react"));
|
17
15
|
|
18
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
19
17
|
|
20
|
-
var _react2 = require("@carbon/react");
|
21
|
-
|
22
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
23
19
|
|
24
|
-
var _DatagridHead = _interopRequireDefault(require("./DatagridHead"));
|
25
|
-
|
26
|
-
var _DatagridBody = _interopRequireDefault(require("./DatagridBody"));
|
27
|
-
|
28
|
-
var _DatagridToolbar = _interopRequireDefault(require("./DatagridToolbar"));
|
29
|
-
|
30
20
|
var _devtools = require("../../../global/js/utils/devtools");
|
31
21
|
|
32
22
|
var _settings = require("../../../settings");
|
33
23
|
|
34
24
|
var _pconsole = _interopRequireDefault(require("../../../global/js/utils/pconsole"));
|
35
25
|
|
26
|
+
var _InlineEditContext = require("./addons/InlineEdit/InlineEditContext");
|
27
|
+
|
28
|
+
var _DatagridContent = require("./DatagridContent");
|
29
|
+
|
36
30
|
var _excluded = ["datagridState"];
|
37
31
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
38
32
|
var componentName = 'Datagrid';
|
39
|
-
var TableContainer = _react2.DataTable.TableContainer,
|
40
|
-
Table = _react2.DataTable.Table;
|
41
33
|
|
42
34
|
var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
43
|
-
var _getTableProps;
|
44
|
-
|
45
35
|
var datagridState = _ref.datagridState,
|
46
36
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
47
37
|
|
@@ -51,47 +41,24 @@ var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
51
41
|
return null;
|
52
42
|
}
|
53
43
|
|
54
|
-
var
|
55
|
-
getTableProps = _datagridState$getTab === void 0 ? function () {} : _datagridState$getTab,
|
56
|
-
withVirtualScroll = datagridState.withVirtualScroll,
|
44
|
+
var withVirtualScroll = datagridState.withVirtualScroll,
|
57
45
|
DatagridPagination = datagridState.DatagridPagination,
|
58
46
|
isFetching = datagridState.isFetching,
|
59
47
|
tableId = datagridState.tableId,
|
60
|
-
CustomizeColumnsModal = datagridState.CustomizeColumnsModal,
|
61
48
|
leftPanel = datagridState.leftPanel,
|
62
|
-
|
63
|
-
_datagridState$vertic = datagridState.verticalAlign,
|
64
|
-
verticalAlign = _datagridState$vertic === void 0 ? 'center' : _datagridState$vertic,
|
65
|
-
variableRowHeight = datagridState.variableRowHeight,
|
66
|
-
className = datagridState.className,
|
67
|
-
gridTitle = datagridState.gridTitle,
|
68
|
-
gridDescription = datagridState.gridDescription,
|
69
|
-
useDenseHeader = datagridState.useDenseHeader;
|
49
|
+
className = datagridState.className;
|
70
50
|
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
71
|
-
|
72
|
-
var dataGrid = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TableContainer, {
|
73
|
-
className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : ''),
|
74
|
-
title: gridTitle,
|
75
|
-
description: gridDescription
|
76
|
-
}, /*#__PURE__*/_react.default.createElement(_DatagridToolbar.default, datagridState), /*#__PURE__*/_react.default.createElement("div", {
|
77
|
-
className: "".concat(blockClass, "__table-container")
|
78
|
-
}, leftPanel && leftPanel.isOpen && /*#__PURE__*/_react.default.createElement("div", {
|
79
|
-
className: "".concat(blockClass, "__datagridLeftPanel")
|
80
|
-
}, leftPanel.panelContent), /*#__PURE__*/_react.default.createElement(Table, (0, _extends2.default)({}, getTableProps(), {
|
81
|
-
className: (0, _classnames.default)(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className)
|
82
|
-
}), /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState), /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
|
83
|
-
rows: rows
|
84
|
-
}))))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/_react.default.createElement(CustomizeColumnsModal, {
|
85
|
-
instance: datagridState
|
86
|
-
}));
|
87
|
-
|
88
|
-
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
51
|
+
return /*#__PURE__*/_react.default.createElement(_InlineEditContext.InlineEditProvider, null, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
89
52
|
id: tableId,
|
90
53
|
ref: ref,
|
91
54
|
className: (0, _classnames.default)(className, blockClass, withVirtualScroll ? "".concat(blockClass, "__datagridWrap") : "".concat(blockClass, "__datagridWrap-simple"), !isFetching && rows.length === 0 ? "".concat(blockClass, "__empty-state") : '')
|
92
55
|
}, (0, _devtools.getDevtoolsProps)(componentName)), leftPanel && /*#__PURE__*/_react.default.createElement("div", {
|
93
56
|
className: "".concat(blockClass, "__datagridWithPanel ").concat(blockClass, "__displayFlex ").concat(blockClass, "__leftPanel-position")
|
94
|
-
},
|
57
|
+
}, /*#__PURE__*/_react.default.createElement(_DatagridContent.DatagridContent, {
|
58
|
+
datagridState: datagridState
|
59
|
+
})), leftPanel === undefined && /*#__PURE__*/_react.default.createElement(_DatagridContent.DatagridContent, {
|
60
|
+
datagridState: datagridState
|
61
|
+
})));
|
95
62
|
}); // Return a placeholder if not released and not enabled by feature flag
|
96
63
|
|
97
64
|
|
@@ -0,0 +1,188 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
6
|
+
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
8
|
+
value: true
|
9
|
+
});
|
10
|
+
exports.DatagridContent = void 0;
|
11
|
+
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
|
+
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
15
|
+
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
17
|
+
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
19
|
+
|
20
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
21
|
+
|
22
|
+
var _react2 = require("@carbon/react");
|
23
|
+
|
24
|
+
var _layout = require("@carbon/layout");
|
25
|
+
|
26
|
+
var _DatagridHead = _interopRequireDefault(require("./DatagridHead"));
|
27
|
+
|
28
|
+
var _DatagridBody = _interopRequireDefault(require("./DatagridBody"));
|
29
|
+
|
30
|
+
var _DatagridToolbar = _interopRequireDefault(require("./DatagridToolbar"));
|
31
|
+
|
32
|
+
var _handleGridKeyPress = require("./addons/InlineEdit/handleGridKeyPress");
|
33
|
+
|
34
|
+
var _settings = require("../../../settings");
|
35
|
+
|
36
|
+
var _InlineEditContext = require("./addons/InlineEdit/InlineEditContext");
|
37
|
+
|
38
|
+
var _handleGridFocus = require("./addons/InlineEdit/handleGridFocus");
|
39
|
+
|
40
|
+
var _hooks = require("../../../global/js/hooks");
|
41
|
+
|
42
|
+
var _hooks2 = require("../../DataSpreadsheet/hooks");
|
43
|
+
|
44
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
45
|
+
|
46
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
47
|
+
|
48
|
+
var TableContainer = _react2.DataTable.TableContainer,
|
49
|
+
Table = _react2.DataTable.Table;
|
50
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
51
|
+
|
52
|
+
var DatagridContent = function DatagridContent(_ref) {
|
53
|
+
var _cx4;
|
54
|
+
|
55
|
+
var datagridState = _ref.datagridState;
|
56
|
+
|
57
|
+
var _useContext = (0, _react.useContext)(_InlineEditContext.InlineEditContext),
|
58
|
+
state = _useContext.state,
|
59
|
+
dispatch = _useContext.dispatch;
|
60
|
+
|
61
|
+
var activeCellId = state.activeCellId;
|
62
|
+
var _datagridState$getTab = datagridState.getTableProps,
|
63
|
+
getTableProps = _datagridState$getTab === void 0 ? function () {} : _datagridState$getTab,
|
64
|
+
withVirtualScroll = datagridState.withVirtualScroll,
|
65
|
+
DatagridPagination = datagridState.DatagridPagination,
|
66
|
+
isFetching = datagridState.isFetching,
|
67
|
+
CustomizeColumnsModal = datagridState.CustomizeColumnsModal,
|
68
|
+
leftPanel = datagridState.leftPanel,
|
69
|
+
fullHeightDatagrid = datagridState.fullHeightDatagrid,
|
70
|
+
_datagridState$vertic = datagridState.verticalAlign,
|
71
|
+
verticalAlign = _datagridState$vertic === void 0 ? 'center' : _datagridState$vertic,
|
72
|
+
variableRowHeight = datagridState.variableRowHeight,
|
73
|
+
gridTitle = datagridState.gridTitle,
|
74
|
+
gridDescription = datagridState.gridDescription,
|
75
|
+
useDenseHeader = datagridState.useDenseHeader,
|
76
|
+
withInlineEdit = datagridState.withInlineEdit,
|
77
|
+
tableId = datagridState.tableId,
|
78
|
+
DatagridActions = datagridState.DatagridActions,
|
79
|
+
totalColumnsWidth = datagridState.totalColumnsWidth;
|
80
|
+
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
81
|
+
var gridActive = state.gridActive,
|
82
|
+
editId = state.editId;
|
83
|
+
var gridAreaRef = (0, _react.useRef)();
|
84
|
+
var multiKeyTrackingRef = (0, _react.useRef)();
|
85
|
+
(0, _hooks.useClickOutside)(gridAreaRef, function (target) {
|
86
|
+
if (!withInlineEdit) {
|
87
|
+
return;
|
88
|
+
} // We return from here if we find a parent element with the selector below
|
89
|
+
// because that element was initially part of the grid area but was removed
|
90
|
+
// and swapped out with an input, i.e. text, number, selection, or date picker
|
91
|
+
|
92
|
+
|
93
|
+
if (target.closest(".".concat(blockClass, "__inline-edit-button")) || target.closest(".".concat(blockClass, "__inline-edit--select"))) {
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
|
97
|
+
dispatch({
|
98
|
+
type: 'REMOVE_GRID_ACTIVE_FOCUS',
|
99
|
+
payload: activeCellId
|
100
|
+
});
|
101
|
+
});
|
102
|
+
|
103
|
+
var renderTable = function renderTable() {
|
104
|
+
var _getTableProps;
|
105
|
+
|
106
|
+
return /*#__PURE__*/_react.default.createElement(Table, (0, _extends2.default)({}, getTableProps(), {
|
107
|
+
className: (0, _classnames.default)(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-grid-active"), gridActive), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
|
108
|
+
role: withInlineEdit && 'grid',
|
109
|
+
tabIndex: withInlineEdit && 0,
|
110
|
+
onKeyDown: withInlineEdit ? function (event) {
|
111
|
+
return (0, _handleGridKeyPress.handleGridKeyPress)({
|
112
|
+
event: event,
|
113
|
+
dispatch: dispatch,
|
114
|
+
state: state,
|
115
|
+
instance: datagridState,
|
116
|
+
keysPressedList: keysPressedList,
|
117
|
+
usingMac: usingMac
|
118
|
+
});
|
119
|
+
} : null,
|
120
|
+
onFocus: withInlineEdit ? function () {
|
121
|
+
return (0, _handleGridFocus.handleGridFocus)(state, dispatch);
|
122
|
+
} : null
|
123
|
+
}), /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState), /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
|
124
|
+
rows: rows
|
125
|
+
})));
|
126
|
+
};
|
127
|
+
|
128
|
+
var _useMultipleKeyTracki = (0, _hooks2.useMultipleKeyTracking)({
|
129
|
+
ref: withInlineEdit ? multiKeyTrackingRef : null,
|
130
|
+
containerHasFocus: gridActive,
|
131
|
+
isEditing: !!editId
|
132
|
+
}),
|
133
|
+
keysPressedList = _useMultipleKeyTracki.keysPressedList,
|
134
|
+
usingMac = _useMultipleKeyTracki.usingMac; // Provides a width for the region outline for useInlineEdit
|
135
|
+
|
136
|
+
|
137
|
+
(0, _react.useEffect)(function () {
|
138
|
+
if (!withInlineEdit) {
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
|
142
|
+
var gridElement = document.querySelector("#".concat(tableId));
|
143
|
+
var tableHeader = gridElement === null || gridElement === void 0 ? void 0 : gridElement.querySelector(".".concat(_settings.carbon.prefix, "--data-table-header"));
|
144
|
+
gridElement.style.setProperty("--".concat(blockClass, "--grid-width"), (0, _layout.px)(totalColumnsWidth + 32));
|
145
|
+
|
146
|
+
if (gridActive) {
|
147
|
+
gridElement.style.setProperty("--".concat(blockClass, "--grid-header-height"), (0, _layout.px)((tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.clientHeight) || 0));
|
148
|
+
}
|
149
|
+
}, [withInlineEdit, tableId, totalColumnsWidth, datagridState, gridActive]);
|
150
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TableContainer, {
|
151
|
+
className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : '', (_cx4 = {}, (0, _defineProperty2.default)(_cx4, "".concat(blockClass, "__grid-container-grid-active"), gridActive), (0, _defineProperty2.default)(_cx4, "".concat(blockClass, "__grid-container-inline-edit"), withInlineEdit), (0, _defineProperty2.default)(_cx4, "".concat(blockClass, "__grid-container-grid-active--without-toolbar"), withInlineEdit && !DatagridActions), _cx4)),
|
152
|
+
title: gridTitle,
|
153
|
+
description: gridDescription
|
154
|
+
}, /*#__PURE__*/_react.default.createElement(_DatagridToolbar.default, datagridState), /*#__PURE__*/_react.default.createElement("div", {
|
155
|
+
className: "".concat(blockClass, "__table-container"),
|
156
|
+
ref: gridAreaRef
|
157
|
+
}, leftPanel && leftPanel.isOpen && /*#__PURE__*/_react.default.createElement("div", {
|
158
|
+
className: "".concat(blockClass, "__datagridLeftPanel")
|
159
|
+
}, leftPanel.panelContent), withInlineEdit ? /*#__PURE__*/_react.default.createElement("div", {
|
160
|
+
ref: multiKeyTrackingRef
|
161
|
+
}, renderTable()) : renderTable())), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && /*#__PURE__*/_react.default.createElement(DatagridPagination, datagridState), CustomizeColumnsModal && /*#__PURE__*/_react.default.createElement(CustomizeColumnsModal, {
|
162
|
+
instance: datagridState
|
163
|
+
}));
|
164
|
+
};
|
165
|
+
|
166
|
+
exports.DatagridContent = DatagridContent;
|
167
|
+
DatagridContent.propTypes = {
|
168
|
+
datagridState: _propTypes.default.shape({
|
169
|
+
getTableProps: _propTypes.default.func,
|
170
|
+
withVirtualScroll: _propTypes.default.bool,
|
171
|
+
DatagridActions: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
172
|
+
DatagridPagination: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
173
|
+
CustomizeColumnsModal: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
174
|
+
isFetching: _propTypes.default.bool,
|
175
|
+
leftPanel: _propTypes.default.object,
|
176
|
+
fullHeightDatagrid: _propTypes.default.bool,
|
177
|
+
variableRowHeight: _propTypes.default.bool,
|
178
|
+
useDenseHeader: _propTypes.default.bool,
|
179
|
+
withInlineEdit: _propTypes.default.bool,
|
180
|
+
verticalAlign: _propTypes.default.string,
|
181
|
+
gridTitle: _propTypes.default.node,
|
182
|
+
gridDescription: _propTypes.default.node,
|
183
|
+
page: _propTypes.default.arrayOf(_propTypes.default.object),
|
184
|
+
rows: _propTypes.default.arrayOf(_propTypes.default.object),
|
185
|
+
tableId: _propTypes.default.string,
|
186
|
+
totalColumnsWidth: _propTypes.default.number
|
187
|
+
})
|
188
|
+
};
|
@@ -24,13 +24,21 @@ var DatagridExpandedRow = function DatagridExpandedRow(PreviousRowRenderer, Expa
|
|
24
24
|
return function (datagridState) {
|
25
25
|
var row = datagridState.row;
|
26
26
|
|
27
|
+
var _ref = row || {},
|
28
|
+
expandedContentHeight = _ref.expandedContentHeight;
|
29
|
+
|
27
30
|
if (!row.isExpanded) {
|
28
31
|
return PreviousRowRenderer(datagridState);
|
29
32
|
}
|
30
33
|
|
31
34
|
return /*#__PURE__*/_react.default.createElement("div", {
|
32
35
|
className: "".concat(blockClass, "__expanded-row")
|
33
|
-
}, PreviousRowRenderer(datagridState),
|
36
|
+
}, PreviousRowRenderer(datagridState), /*#__PURE__*/_react.default.createElement("div", {
|
37
|
+
className: "".concat(blockClass, "__expanded-row-content"),
|
38
|
+
style: {
|
39
|
+
height: expandedContentHeight ? expandedContentHeight : null
|
40
|
+
}
|
41
|
+
}, ExpandedRowContentComponent(datagridState)));
|
34
42
|
};
|
35
43
|
};
|
36
44
|
|